PageSourceSearch

https://kloud.cn/static/Rappid/rappid.min.2.3.3.js?v=202203150000

js kloud.cn collected 2026-10-08 05:01:09 UTC 800,559 bytes, 124 lines download raw bytes

1/*! Rappid v2.3.3 - HTML5 Diagramming Framework
2
3Copyright (c) 2015 client IO
4
5 2018-08-03 
6
7
8This Source Code Form is subject to the terms of the Rappid License
9, v. 2.0. If a copy of the Rappid License was not distributed with this
10file, You can obtain one at http://jointjs.com/license/rappid_v2.txt
11 or from the Rappid archive as was distributed by client IO. See the LICENSE file.*/
12
13
14(function(root, factory) {
15
16    if (typeof define === 'function' && define.amd) {
17
18        // For AMD.
19
20        define(['backbone', 'lodash', 'jquery'], function(Backbone, _, $) {
21
22            Backbone.$ = $;
23
24            return factory(root, Backbone, _, $);
25        });
26
27    } else if (typeof exports !== 'undefined') {
28
29        // For Node.js or CommonJS.
30
31        var Backbone = require('backbone');
32        var _ = require('lodash');
33        var $ = Backbone.$ = require('jquery');
34
35        module.exports = factory(root, Backbone, _, $);
36
37    } else {
38
39        // As a browser global.
40
41        var Backbone = root.Backbone;
42        var _ = root._;
43        var $ = Backbone.$ = root.jQuery || root.$;
44
45        root.joint = factory(root, Backbone, _, $);
46        root.g = root.joint.g;
47        root.V = root.Vectorizer = root.joint.V;
48    }
49
50}(this, function(root, Backbone, _, $) {
51
52!function(){function a(a){this.message=a}var b="undefined"!=typeof exports?exports:this,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";a.prototype=new Error,a.prototype.name="InvalidCharacterError",b.btoa||(b.btoa=function(b){for(var d,e,f=String(b),g=0,h=c,i="";f.charAt(0|g)||(h="=",g%1);i+=h.charAt(63&d>>8-g%1*8)){if(e=f.charCodeAt(g+=.75),e>255)throw new a("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");d=d<<8|e}return i}),b.atob||(b.atob=function(b){var d=String(b).replace(/=+$/,"");if(d.length%4==1)throw new a("'atob' failed: The string to be decoded is not correctly encoded.");for(var e,f,g=0,h=0,i="";f=d.charAt(h++);~f&&(e=g%4?64*e+f:f,g++%4)?i+=String.fromCharCode(255&e>>(-2*g&6)):0)f=c.indexOf(f);return i})}(),function(){function a(a,b){return this.slice(a,b)}function b(a,b){arguments.length<2&&(b=0);for(var c=0,d=a.length;c<d;++c,++b)this[b]=255&a[c]}function c(c){var d;if("number"==typeof c){d=new Array(c);for(var e=0;e<c;++e)d[e]=0}else d=c.slice(0);return d.subarray=a,d.buffer=d,d.byteLength=d.length,d.set=b,"object"==typeof c&&c.buffer&&(d.buffer=c.buffer),d}"undefined"==typeof Uint8Array&&"undefined"!=typeof window&&(window.Uint8Array=c,window.Uint32Array=c,window.Int32Array=c)}(),function(){"undefined"!=typeof XMLHttpRequest&&("response"in XMLHttpRequest.prototype||"mozResponseArrayBuffer"in XMLHttpRequest.prototype||"mozResponse"in XMLHttpRequest.prototype||"responseArrayBuffer"in XMLHttpRequest.prototype||Object.defineProperty(XMLHttpRequest.prototype,"response",{get:function(){return new Uint8Array(new VBArray(this.responseBody).toArray())}}))}(),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(a,b){function c(a,b){return a===b||"number"==typeof a&&"number"==typeof b&&isNaN(a)&&isNaN(b)}if(null==this)throw new TypeError('"this" is null or not defined');var d=Object(this),e=d.length>>>0;if(0===e)return!1;for(var f=0|b,g=Math.max(f>=0?f:e-Math.abs(f),0);g<e;){if(c(d[g],a))return!0;g++}return!1}}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(a){if(null==this)throw new TypeError('"this" is null or not defined');var b=Object(this),c=b.length>>>0;if("function"!=typeof a)throw new TypeError("predicate must be a function");for(var d=arguments[1],e=0;e<c;){var f=b[e];if(a.call(d,f,e,b))return f;e++}}}),Array.from||(Array.from=function(){var a=Object.prototype.toString,b=function(b){return"function"==typeof b||"[object Function]"===a.call(b)},c=function(a){var b=Number(a);return isNaN(b)?0:0!==b&&isFinite(b)?(b>0?1:-1)*Math.floor(Math.abs(b)):b},d=Math.pow(2,53)-1,e=function(a){var b=c(a);return Math.min(Math.max(b,0),d)};return function(a){var c=this,d=Object(a);if(null==a)throw new TypeError("Array.from requires an array-like object - not null or undefined");var f,g=arguments.length>1?arguments[1]:void 0;if("undefined"!=typeof g){if(!b(g))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(f=arguments[2])}for(var h,i=e(d.length),j=b(c)?Object(new c(i)):new Array(i),k=0;k<i;)h=d[k],g?j[k]="undefined"==typeof f?g(h,k):g.call(f,h,k):j[k]=h,k+=1;return j.length=i,j}}()),Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(a){if
52(null==this)throw new TypeError('"this" is null or not defined');var b=Object(this),c=b.length>>>0;if("function"!=typeof a)throw new TypeError("predicate must be a function");for(var d=arguments[1],e=0;e<c;){var f=b[e];if(a.call(d,f,e,b))return e;e++}return-1}}),String.prototype.includes||(String.prototype.includes=function(a,b){"use strict";return"number"!=typeof b&&(b=0),!(b+a.length>this.length)&&this.indexOf(a,b)!==-1}),String.prototype.startsWith||(String.prototype.startsWith=function(a,b){return this.substr(b||0,a.length)===a}),Number.isFinite=Number.isFinite||function(a){return"number"==typeof a&&isFinite(a)},Number.isNaN=Number.isNaN||function(a){return a!==a};
53var g={};!function(a){function b(a,b){return b.unshift(null),new(Function.prototype.bind.apply(a,b))}function c(a){var b,c,d=[];for(c=arguments.length,b=1;b<c;b++)d.push(arguments[b]);if(!a)throw new Error("Missing a parent object.");var e=Object.create(a);for(c=d.length,b=0;b<c;b++){var f,g,h=d[b];for(g in h)h.hasOwnProperty(g)&&(delete e[g],f=Object.getOwnPropertyDescriptor(h,g),Object.defineProperty(e,g,f))}return e}var d=Math,e=d.abs,f=d.cos,g=d.sin,h=d.sqrt,i=d.min,j=d.max,k=d.atan2,l=d.round,m=d.floor,n=d.PI,o=d.random,p=d.pow;a.bezier={curveThroughPoints:function(a){return console.warn("deprecated"),new t(q.throughPoints(a)).serialize()},getCurveControlPoints:function(a){console.warn("deprecated");var b,c=[],d=[],e=a.length-1;if(1==e)return c[0]=new u((2*a[0].x+a[1].x)/3,(2*a[0].y+a[1].y)/3),d[0]=new u(2*c[0].x-a[0].x,2*c[0].y-a[0].y),[c,d];var f=[];for(b=1;b<e-1;b++)f[b]=4*a[b].x+2*a[b+1].x;f[0]=a[0].x+2*a[1].x,f[e-1]=(8*a[e-1].x+a[e].x)/2;var g=this.getFirstControlPoints(f);for(b=1;b<e-1;++b)f[b]=4*a[b].y+2*a[b+1].y;f[0]=a[0].y+2*a[1].y,f[e-1]=(8*a[e-1].y+a[e].y)/2;var h=this.getFirstControlPoints(f);for(b=0;b<e;b++)c.push(new u(g[b],h[b])),b<e-1?d.push(new u(2*a[b+1].x-g[b+1],2*a[b+1].y-h[b+1])):d.push(new u((a[e].x+g[e-1])/2,(a[e].y+h[e-1])/2));return[c,d]},getFirstControlPoints:function(a){console.warn("deprecated");var b=a.length,c=[],d=[],e=2;c[0]=a[0]/e;for(var f=1;f<b;f++)d[f]=1/e,e=(f<b-1?4:3.5)-d[f],c[f]=(a[f]-c[f-1])/e;for(f=1;f<b;f++)c[b-f-1]-=d[b-f]*c[b-f];return c},getCurveDivider:function(a,b,c,d){console.warn("deprecated");var e=new q(a,b,c,d);return function(a){var b=e.divide(a);return[{p0:b[0].start,p1:b[0].controlPoint1,p2:b[0].controlPoint2,p3:b[0].end},{p0:b[1].start,p1:b[1].controlPoint1,p2:b[1].controlPoint2,p3:b[1].end}]}},getInversionSolver:function(a,b,c,d){console.warn("deprecated");var e=new q(a,b,c,d);return function(a){return e.closestPointT(a)}}};var q=a.Curve=function(a,b,c,d){return this instanceof q?a instanceof q?new q(a.start,a.controlPoint1,a.controlPoint2,a.end):(this.start=new u(a),this.controlPoint1=new u(b),this.controlPoint2=new u(c),void(this.end=new u(d))):new q(a,b,c,d)};q.throughPoints=function(){function a(a){var b=a.length,c=[],d=[],e=2;c[0]=a[0]/e;for(var f=1;f<b;f++)d[f]=1/e,e=(f<b-1?4:3.5)-d[f],c[f]=(a[f]-c[f-1])/e;for(f=1;f<b;f++)c[b-f-1]-=d[b-f]*c[b-f];return c}function b(b){var c,d=[],e=[],f=b.length-1;if(1==f)return d[0]=new u((2*b[0].x+b[1].x)/3,(2*b[0].y+b[1].y)/3),e[0]=new u(2*d[0].x-b[0].x,2*d[0].y-b[0].y),[d,e];var g=[];for(c=1;c<f-1;c++)g[c]=4*b[c].x+2*b[c+1].x;g[0]=b[0].x+2*b[1].x,g[f-1]=(8*b[f-1].x+b[f].x)/2;var h=a(g);for(c=1;c<f-1;++c)g[c]=4*b[c].y+2*b[c+1].y;g[0]=b[0].y+2*b[1].y,g[f-1]=(8*b[f-1].y+b[f].y)/2;var i=a(g);for(c=0;c<f;c++)d.push(new u(h[c],i[c])),c<f-1?e.push(new u(2*b[c+1].x-h[c+1],2*b[c+1].y-i[c+1])):e.push(new u((b[f].x+h[f-1])/2,(b[f].y+i[f-1])/2));return[d,e]}return function(a){if(!a||Array.isArray(a)&&a.length<2)throw new Error("At least 2 points are required");for(var c=b(a),d=[],e=c[0].length,f=0;f<e;f++){var g=new u(c[0][f].x,c[0][f].y),h=new u(c[1][f].x,c[1][f].y);d.push(new q(a[f],g,h,a[f+1]))}return d}}(),q.prototype={bbox:function(){for(var a,b,c,d,f,g,k,l,m=this.start,n=this.controlPoint1,o=this.controlPoint2,p=this.end,q=m.x,r=m.y,s=n.x,t=n.y,u=o.x,w=o.y,x=p.x,y=p.y,z=new Array,A=new Array,B=[new Array,new Array],C=0;C<2;++C)if(0===C?(b=6*q-12*s+6*u,a=-3*q+9*s-9*u+3*x,c=3*s-3*q):(b=6*r-12*t+6*w,a=-3*r+9*t-9*w+3*y,c=3*t-3*r),e(a)<1e-12){if(e(b)<1e-12)continue;d=-c/b,0<d&&d<1&&A.push(d)}else k=b*b-4*c*a,l=h(k),k<0||(f=(-b+l)/(2*a),0<f&&f<1&&A.push(f),g=(-b-l)/(2*a),0<g&&g<1&&A.push(g));for(var D,E,F,G=A.length,H=G;G--;)d=A[G],D=1-d,E=D*D*D*q+3*D*D*d*s+3*D*d*d*u+d*d*d*x,B[0][G]=E,F=D*D*D*r+3*D*D*d*t+3*D*d*d*w+d
53*d*d*y,B[1][G]=F,z[G]={X:E,Y:F};A[H]=0,A[H+1]=1,z[H]={X:q,Y:r},z[H+1]={X:x,Y:y},B[0][H]=q,B[1][H]=r,B[0][H+1]=x,B[1][H+1]=y,A.length=H+2,B[0].length=H+2,B[1].length=H+2,z.length=H+2;var I=i.apply(null,B[0]),J=i.apply(null,B[1]),K=j.apply(null,B[0]),L=j.apply(null,B[1]);return new v(I,J,K-I,L-J)},clone:function(){return new q(this.start,this.controlPoint1,this.controlPoint2,this.end)},closestPoint:function(a,b){return this.pointAtT(this.closestPointT(a,b))},closestPointLength:function(a,b){b=b||{};var c=void 0===b.precision?this.PRECISION:b.precision,d=void 0===b.subdivisions?this.getSubdivisions({precision:c}):b.subdivisions,e={precision:c,subdivisions:d};return this.lengthAtT(this.closestPointT(a,e),e)},closestPointNormalizedLength:function(a,b){b=b||{};var c=void 0===b.precision?this.PRECISION:b.precision,d=void 0===b.subdivisions?this.getSubdivisions({precision:c}):b.subdivisions,e={precision:c,subdivisions:d},f=this.closestPointLength(a,e);if(!f)return 0;var g=this.length(e);return 0===g?0:f/g},closestPointT:function(a,b){b=b||{};for(var c,d,f,g,h,i,j=void 0===b.precision?this.PRECISION:b.precision,k=void 0===b.subdivisions?this.getSubdivisions({precision:j}):b.subdivisions,l=k.length,m=l?1/l:0,n=0;n<l;n++){var o=k[n],q=o.start.distance(a),r=o.end.distance(a),s=q+r;(!i||s<i)&&(c=o,d=n*m,f=(n+1)*m,g=q,h=r,i=s)}for(var t=p(10,-j);;){var u,v;if(u=g?e(g-h)/g:0,v=h?e(g-h)/h:0,u<t||v<t)return g<=h?d:f;var w=c.divide(.5);m/=2;var x=w[0].start.distance(a),y=w[0].end.distance(a),z=x+y,A=w[1].start.distance(a),B=w[1].end.distance(a),C=A+B;z<=C?(c=w[0],f-=m,g=x,h=y):(c=w[1],d+=m,g=A,h=B)}},closestPointTangent:function(a,b){return this.tangentAtT(this.closestPointT(a,b))},divide:function(a){var b=this.start,c=this.controlPoint1,d=this.controlPoint2,e=this.end;if(a<=0)return[new q(b,b,b,b),new q(b,c,d,e)];if(a>=1)return[new q(b,c,d,e),new q(e,e,e,e)];var f=this.getSkeletonPoints(a),g=f.startControlPoint1,h=f.startControlPoint2,i=f.divider,j=f.dividerControlPoint1,k=f.dividerControlPoint2;return[new q(b,g,h,i),new q(i,j,k,e)]},endpointDistance:function(){return this.start.distance(this.end)},equals:function(a){return!!a&&this.start.x===a.start.x&&this.start.y===a.start.y&&this.controlPoint1.x===a.controlPoint1.x&&this.controlPoint1.y===a.controlPoint1.y&&this.controlPoint2.x===a.controlPoint2.x&&this.controlPoint2.y===a.controlPoint2.y&&this.end.x===a.end.x&&this.end.y===a.end.y},getSkeletonPoints:function(a){var b=this.start,c=this.controlPoint1,d=this.controlPoint2,e=this.end;if(a<=0)return{startControlPoint1:b.clone(),startControlPoint2:b.clone(),divider:b.clone(),dividerControlPoint1:c.clone(),dividerControlPoint2:d.clone()};if(a>=1)return{startControlPoint1:c.clone(),startControlPoint2:d.clone(),divider:e.clone(),dividerControlPoint1:e.clone(),dividerControlPoint2:e.clone()};var f=new s(b,c).pointAt(a),g=new s(c,d).pointAt(a),h=new s(d,e).pointAt(a),i=new s(f,g).pointAt(a),j=new s(g,h).pointAt(a),k=new s(i,j).pointAt(a),l={startControlPoint1:f,startControlPoint2:i,divider:k,dividerControlPoint1:j,dividerControlPoint2:h};return l},getSubdivisions:function(a){a=a||{};var b=void 0===a.precision?this.PRECISION:a.precision,c=[new q(this.start,this.controlPoint1,this.controlPoint2,this.end)];if(0===b)return c;for(var d=this.endpointDistance(),e=p(10,-b),f=0;;){f+=1;for(var g=[],h=c.length,i=0;i<h;i++){var j=c[i],k=j.divide(.5);g.push(k[0],k[1])}for(var l=0,m=g.length,n=0;n<m;n++){var o=g[n];l+=o.endpointDistance()}var r=0!==l?(l-d)/l:0;if(f>1&&r<e)return g;c=g,d=l}},isDifferentiable:function(){var a=this.start,b=this.controlPoint1,c=this.controlPoint2,d=this.end;return!(a.equals(b)&&b.equals(c)&&c.equals(d))},length:function(a){a=a||{};for(var b=void 0===a.precision?this.PRECISION:a.precision,c=void 0===a.subdivisions?this.getSubdivisions({precision:b}):a.subdivisions,d=0,e=c.length,f=0;f<e;f++){var g=c[f];d+=g.endpointDistance()}return d},lengthAtT:function(a,b){if(a<=0)return 0;b=b||{};var c=void 0===b.precision?this.PRECISION:b.precision,d=this.divide(a)[0],e=d.length({precision:c});return e},pointAt:function(a,b){if(a<=0)return this.start.clone();if(a>=1)return this.end.clone();var c=this.tAt(a,b);return this.pointAtT(c)},pointAtLength:function(a,b){var c=this.tAtLength(a,b);return this.pointAtT(c)},pointAtT:function(a){return a<=0?this.start.clone():a>=1?this.end.clone():this.getSkeletonPoints(a).divider},PRECISION:3,scale:function(a,b,c){return this.start.scale(a,b,c),this.controlPoint1.scale(a,b,c),this.controlPoint2.scale(a,b,c),this.end.scale(a,b,c),this},tangentAt:function(a,b){if(!this.isDifferentiable())return null;a<0?a=0:a>1&&(a=1);var c=this.tAt(a,b);return this.tangentAtT(c)},tangentAtLength:function(a,b){if(!this.isDifferentiable())return null;var c=this.tAtLength(a,b);return this.tangentAtT(c)}
53,tangentAtT:function(a){if(!this.isDifferentiable())return null;a<0?a=0:a>1&&(a=1);var b=this.getSkeletonPoints(a),c=b.startControlPoint2,d=b.dividerControlPoint1,e=b.divider,f=new s(c,d);return f.translate(e.x-c.x,e.y-c.y),f},tAt:function(a,b){if(a<=0)return 0;if(a>=1)return 1;b=b||{};var c=void 0===b.precision?this.PRECISION:b.precision,d=void 0===b.subdivisions?this.getSubdivisions({precision:c}):b.subdivisions,e={precision:c,subdivisions:d},f=this.length(e),g=f*a;return this.tAtLength(g,e)},tAtLength:function(a,b){var c=!0;a<0&&(c=!1,a=-a),b=b||{};for(var d,e,f,g,h,i=void 0===b.precision?this.PRECISION:b.precision,j=void 0===b.subdivisions?this.getSubdivisions({precision:i}):b.subdivisions,k={precision:i,subdivisions:j},l=0,m=j.length,n=1/m,o=c?0:m-1;c?o<m:o>=0;c?o++:o--){var q=j[o],r=q.endpointDistance();if(a<=l+r){d=q,e=o*n,f=(o+1)*n,g=c?a-l:r+l-a,h=c?r+l-a:a-l;break}l+=r}if(!d)return c?1:0;for(var s=this.length(k),t=p(10,-i);;){var u;if(u=0!==s?g/s:0,u<t)return e;if(u=0!==s?h/s:0,u<t)return f;var v,w,x=d.divide(.5);n/=2;var y=x[0].endpointDistance(),z=x[1].endpointDistance();g<=y?(d=x[0],f-=n,v=g,w=y-v):(d=x[1],e+=n,v=g-y,w=z-v),g=v,h=w}},translate:function(a,b){return this.start.translate(a,b),this.controlPoint1.translate(a,b),this.controlPoint2.translate(a,b),this.end.translate(a,b),this},toPoints:function(a){a=a||{};for(var b=void 0===a.precision?this.PRECISION:a.precision,c=void 0===a.subdivisions?this.getSubdivisions({precision:b}):a.subdivisions,d=[c[0].start.clone()],e=c.length,f=0;f<e;f++){var g=c[f];d.push(g.end.clone())}return d},toPolyline:function(a){return new w(this.toPoints(a))},toString:function(){return this.start+" "+this.controlPoint1+" "+this.controlPoint2+" "+this.end}};var r=a.Ellipse=function(a,b,c){return this instanceof r?a instanceof r?new r(new u(a.x,a.y),a.a,a.b):(a=new u(a),this.x=a.x,this.y=a.y,this.a=b,void(this.b=c)):new r(a,b,c)};r.fromRect=function(a){return a=new v(a),new r(a.center(),a.width/2,a.height/2)},r.prototype={bbox:function(){return new v(this.x-this.a,this.y-this.b,2*this.a,2*this.b)},clone:function(){return new r(this)},normalizedDistance:function(a){var b=a.x,c=a.y,d=this.a,e=this.b,f=this.x,g=this.y;return(b-f)*(b-f)/(d*d)+(c-g)*(c-g)/(e*e)},inflate:function(a,b){return void 0===a&&(a=0),void 0===b&&(b=a),this.a+=2*a,this.b+=2*b,this},containsPoint:function(a){return this.normalizedDistance(a)<=1},center:function(){return new u(this.x,this.y)},tangentTheta:function(a){var b,c,d=30,e=a.x,f=a.y,g=this.a,h=this.b,i=this.bbox().center(),j=i.x,k=i.y,l=e>i.x+g/2,m=e<i.x-g/2;return l||m?(b=e>i.x?f-d:f+d,c=g*g/(e-j)-g*g*(f-k)*(b-k)/(h*h*(e-j))+j):(c=f>i.y?e+d:e-d,b=h*h/(f-k)-h*h*(e-j)*(c-j)/(g*g*(f-k))+k),new u(c,b).theta(a)},equals:function(a){return!!a&&a.x===this.x&&a.y===this.y&&a.a===this.a&&a.b===this.b},intersectionWithLine:function(a){var b=[],c=a.start,d=a.end,e=this.a,f=this.b,g=a.vector(),i=c.difference(new u(this)),j=new u(g.x/(e*e),g.y/(f*f)),k=new u(i.x/(e*e),i.y/(f*f)),l=g.dot(j),m=g.dot(k),n=i.dot(k)-1,o=m*m-l*n;if(o<0)return null;if(o>0){var p=h(o),q=(-m-p)/l,r=(-m+p)/l;if((q<0||1<q)&&(r<0||1<r))return null;0<=q&&q<=1&&b.push(c.lerp(d,q)),0<=r&&r<=1&&b.push(c.lerp(d,r))}else{var s=-m/l;if(!(0<=s&&s<=1))return null;b.push(c.lerp(d,s))}return b},intersectionWithLineFromCenterToPoint:function(a,b){a=new u(a),b&&a.rotate(new u(this.x,this.y),b);var c,d=a.x-this.x,e=a.y-this.y;if(0===d)return c=this.bbox().pointNearestToPoint(a),b?c.rotate(new u(this.x,this.y),-b):c;var f=e/d,g=f*f,i=this.a*this.a,j=this.b*this.b,k=h(1/(1/i+g/j));k=d<0?-k:k;var l=f*k;return c=new u(this.x+k,this.y+l),b?c.rotate(new u(this.x,this.y),-b):c},toString:function(){return new u(this.x,this.y).toString()+" "+this.a+" "+this.b}};var s=a.Line=function(a,b){return this instanceof s?a instanceof s?new s(a.start,a.end):(this.start=new u(a),void(this.end=new u(b))):new s(a,b)};s.prototype={bbox:function(){var a=i(this.start.x,this.end.x),b=i(this.start.y,this.end.y),c=j(this.start.x,this.end.x),d=j(this.start.y,this.end.y);return new v(a,b,c-a,d-b)},bearing:function(){var a=A(this.start.y),b=A(this.end.y),c=this.start.x,d=this.end.x,e=A(d-c),h=g(e)*f(b),i=f(a)*g(b)-g(a)*f(b)*f(e),j=z(k(h,i)
53),l=["NE","E","SE","S","SW","W","NW","N"],m=j-22.5;return m<0&&(m+=360),m=parseInt(m/45),l[m]},clone:function(){return new s(this.start,this.end)},closestPoint:function(a){return this.pointAt(this.closestPointNormalizedLength(a))},closestPointLength:function(a){return this.closestPointNormalizedLength(a)*this.length()},closestPointNormalizedLength:function(a){var b=this.vector().dot(new s(this.start,a).vector()),c=i(1,j(0,b/this.squaredLength()));return c!==c?0:c},closestPointTangent:function(a){return this.tangentAt(this.closestPointNormalizedLength(a))},equals:function(a){return!!a&&this.start.x===a.start.x&&this.start.y===a.start.y&&this.end.x===a.end.x&&this.end.y===a.end.y},intersectionWithLine:function(a){var b=new u(this.end.x-this.start.x,this.end.y-this.start.y),c=new u(a.end.x-a.start.x,a.end.y-a.start.y),d=b.x*c.y-b.y*c.x,e=new u(a.start.x-this.start.x,a.start.y-this.start.y),f=e.x*c.y-e.y*c.x,g=e.x*b.y-e.y*b.x;if(0===d||f*d<0||g*d<0)return null;if(d>0){if(f>d||g>d)return null}else if(f<d||g<d)return null;return[new u(this.start.x+f*b.x/d,this.start.y+f*b.y/d)]},intersect:function(a,b){if(a instanceof s||a instanceof v||a instanceof w||a instanceof r||a instanceof t){var c=a.intersectionWithLine(this,b);return c&&a instanceof s&&(c=c[0]),c}return null},isDifferentiable:function(){return!this.start.equals(this.end)},length:function(){return h(this.squaredLength())},midpoint:function(){return new u((this.start.x+this.end.x)/2,(this.start.y+this.end.y)/2)},pointAt:function(a){var b=this.start,c=this.end;return a<=0?b.clone():a>=1?c.clone():b.lerp(c,a)},pointAtLength:function(a){var b=this.start,c=this.end,d=!0;a<0&&(d=!1,a=-a);var e=this.length();return a>=e?d?c.clone():b.clone():this.pointAt((d?a:e-a)/e)},pointOffset:function(b){b=new a.Point(b);var c=this.start,d=this.end,e=(d.x-c.x)*(b.y-c.y)-(d.y-c.y)*(b.x-c.x);return e/this.length()},rotate:function(a,b){return this.start.rotate(a,b),this.end.rotate(a,b),this},round:function(a){var b=p(10,a||0);return this.start.x=l(this.start.x*b)/b,this.start.y=l(this.start.y*b)/b,this.end.x=l(this.end.x*b)/b,this.end.y=l(this.end.y*b)/b,this},scale:function(a,b,c){return this.start.scale(a,b,c),this.end.scale(a,b,c),this},setLength:function(a){var b=this.length();if(!b)return this;var c=a/b;return this.scale(c,c,this.start)},squaredLength:function(){var a=this.start.x,b=this.start.y,c=this.end.x,d=this.end.y;return(a-=c)*a+(b-=d)*b},tangentAt:function(a){if(!this.isDifferentiable())return null;var b=this.start,c=this.end,d=this.pointAt(a),e=new s(b,c);return e.translate(d.x-b.x,d.y-b.y),e},tangentAtLength:function(a){if(!this.isDifferentiable())return null;var b=this.start,c=this.end,d=this.pointAtLength(a),e=new s(b,c);return e.translate(d.x-b.x,d.y-b.y),e},translate:function(a,b){return this.start.translate(a,b),this.end.translate(a,b),this},vector:function(){return new u(this.end.x-this.start.x,this.end.y-this.start.y)},toString:function(){return this.start.toString()+" "+this.end.toString()}},s.prototype.intersection=s.prototype.intersect;var t=a.Path=function(a){if(!(this instanceof t))return new t(a);if("string"==typeof a)return new t.parse(a);this.segments=[];var b,c;if(a){if(Array.isArray(a)&&0!==a.length)if(c=a.length,a[0].isSegment)for(b=0;b<c;b++){var d=a[b];this.appendSegment(d)}else{var e=null;for(b=0;b<c;b++){var f=a[b];if(!(f instanceof s||f instanceof q))throw new Error("Cannot construct a path segment from the provided object.");0===b&&this.appendSegment(t.createSegment("M",f.start)),e&&!e.end.equals(f.start)&&this.appendSegment(t.createSegment("M",f.start)),f instanceof s?this.appendSegment(t.createSegment("L",f.end)):f instanceof q&&this.appendSegment(t.createSegment("C",f.controlPoint1,f.controlPoint2,f.end)),e=f}}else if(a.isSegment)this.appendSegment(a);else if(a instanceof s)this.appendSegment(t.createSegment("M",a.start)),this.appendSegment(t.createSegment("L",a.end));else if(a instanceof q)this.appendSegment(t.createSegment("M",a.start)),this.appendSegment(t.createSegment("C",a.controlPoint1,a.controlPoint2,a.end));else if(a instanceof w&&a.points&&0!==a.points.length)for(c=a.points.length,b=0;b<c;b++){var g=a.points[b];0===b?this.appendSegment(t.createSegment("M",g)):this.appendSegment(t.createSegment("L",g))}}else;};
53t.parse=function(a){if(!a)return new t;for(var b=new t,c=/(?:[a-zA-Z] *)(?:(?:-?\d+(?:\.\d+)? *,? *)|(?:-?\.\d+ *,? *))+|(?:[a-zA-Z] *)(?! |\d|-|\.)/g,d=a.match(c),e=d.length,f=0;f<e;f++){var g=d[f],h=/(?:[a-zA-Z])|(?:(?:-?\d+(?:\.\d+)?))|(?:(?:-?\.\d+))/g,i=g.match(h),j=t.createSegment.apply(this,i);b.appendSegment(j)}return b},t.createSegment=function(a){if(!a)throw new Error("Type must be provided.");var c=t.segmentTypes[a];if(!c)throw new Error(a+" is not a recognized path segment type.");for(var d=[],e=arguments.length,f=1;f<e;f++)d.push(arguments[f]);return b(c,d)},t.prototype={appendSegment:function(a){var b,c=this.segments,d=c.length,e=0!==d?c[d-1]:null,f=null;if(Array.isArray(a)){if(!a[0].isSegment)throw new Error("Segments required.");for(var g=a.length,h=0;h<g;h++){var i=a[h];b=this.prepareSegment(i,e,f),c.push(b),e=b}}else{if(!a||!a.isSegment)throw new Error("Segment required.");b=this.prepareSegment(a,e,f),c.push(b)}},bbox:function(){var a=this.segments,b=a.length;if(0===b)return null;for(var c,d=0;d<b;d++){var e=a[d];if(e.isVisible){var f=e.bbox();c=c?c.union(f):f}}if(c)return c;var g=a[b-1];return new v(g.end.x,g.end.y,0,0)},clone:function(){for(var a=this.segments,b=a.length,c=new t,d=0;d<b;d++){var e=a[d].clone();c.appendSegment(e)}return c},closestPoint:function(a,b){var c=this.closestPointT(a,b);return c?this.pointAtT(c):null},closestPointLength:function(a,b){b=b||{};var c=void 0===b.precision?this.PRECISION:b.precision,d=void 0===b.segmentSubdivisions?this.getSegmentSubdivisions({precision:c}):b.segmentSubdivisions,e={precision:c,segmentSubdivisions:d},f=this.closestPointT(a,e);return f?this.lengthAtT(f,e):0},closestPointNormalizedLength:function(a,b){b=b||{};var c=void 0===b.precision?this.PRECISION:b.precision,d=void 0===b.segmentSubdivisions?this.getSegmentSubdivisions({precision:c}):b.segmentSubdivisions,e={precision:c,segmentSubdivisions:d},f=this.closestPointLength(a,e);if(0===f)return 0;var g=this.length(e);return 0===g?0:f/g},closestPointT:function(a,b){var c=this.segments,d=c.length;if(0===d)return null;b=b||{};for(var e,f=void 0===b.precision?this.PRECISION:b.precision,g=void 0===b.segmentSubdivisions?this.getSegmentSubdivisions({precision:f}):b.segmentSubdivisions,h=1/0,i=0;i<d;i++){var j=c[i],k=g[i];if(j.isVisible){var l=j.closestPointT(a,{precision:f,subdivisions:k}),m=j.pointAtT(l),n=new s(m,a).squaredLength();n<h&&(e={segmentIndex:i,value:l},h=n)}}return e?e:{segmentIndex:d-1,value:1}},closestPointTangent:function(a,b){var c=this.segments,d=c.length;if(0===d)return null;b=b||{};for(var e,f=void 0===b.precision?this.PRECISION:b.precision,g=void 0===b.segmentSubdivisions?this.getSegmentSubdivisions({precision:f}):b.segmentSubdivisions,h=1/0,i=0;i<d;i++){var j=c[i],k=g[i];if(j.isDifferentiable()){var l=j.closestPointT(a,{precision:f,subdivisions:k}),m=j.pointAtT(l),n=new s(m,a).squaredLength();n<h&&(e=j.tangentAtT(l),h=n)}}return e?e:null},equals:function(a){if(!a)return!1;var b=this.segments,c=a.segments,d=b.length;if(c.length!==d)return!1;for(var e=0;e<d;e++){var f=b[e],g=c[e];if(f.type!==g.type||!f.equals(g))return!1}return!0},getSegment:function(a){var b=this.segments,c=b.length;if(0===!c)throw new Error("Path has no segments.");if(a<0&&(a=c+a),a>=c||a<0)throw new Error("Index out of range.");return b[a]},getSegmentSubdivisions:function(a){var b=this.segments,c=b.length;a=a||{};for(var d=void 0===a.precision?this.PRECISION:a.precision,e=[],f=0;f<c;f++){var g=b[f],h=g.getSubdivisions({precision:d});e.push(h)}return e},insertSegment:function(a,b){var c=this.segments,d=c.length;if(a<0&&(a=d+a+1),a>d||a<0)throw new Error("Index out of range.");var e,f=null,g=null;if(0!==d&&(a>=1?(f=c[a-1],g=f.nextSegment):g=c[0]),Array.isArray(b)){if(!b[0].isSegment)throw new Error("Segments required.");for(var h=b.length,i=0;i<h;i++){var j=b[i];e=this.prepareSegment(j,f,g),c.splice(a+i,0,e),f=e}}else{if(!b||!b.isSegment)throw new Error("Segment required.");e=this.prepareSegment(b,f,g),c.splice(a,0,e)}},isDifferentiable:function(){for(var a=this.segments,b=a.length,c=0;c<b;c++){var d=a[c];if(d.isDifferentiable())return!0}return!1},isValid:function(){var a=this.segments,b=0===a.length||"M"===a[0].type;return b},length:function(a){var b=this.segments,c=b.length;if(0===c)return 0;a=a||{};for(var d=void 0===a.precision?this.PRECISION:a.precision,e=void 0===a.segmentSubdivisions?this.get
53SegmentSubdivisions({precision:d}):a.segmentSubdivisions,f=0,g=0;g<c;g++){var h=b[g],i=e[g];f+=h.length({subdivisions:i})}return f},lengthAtT:function(a,b){var c=this.segments,d=c.length;if(0===d)return 0;var e=a.segmentIndex;if(e<0)return 0;var f=a.value;e>=d?(e=d-1,f=1):f<0?f=0:f>1&&(f=1),b=b||{};for(var g,h=void 0===b.precision?this.PRECISION:b.precision,i=void 0===b.segmentSubdivisions?this.getSegmentSubdivisions({precision:h}):b.segmentSubdivisions,j=0,k=0;k<e;k++){var l=c[k];g=i[k],j+=l.length({precisison:h,subdivisions:g})}return l=c[e],g=i[e],j+=l.lengthAtT(f,{precisison:h,subdivisions:g})},pointAt:function(a,b){var c=this.segments,d=c.length;if(0===d)return null;if(a<=0)return this.start.clone();if(a>=1)return this.end.clone();b=b||{};var e=void 0===b.precision?this.PRECISION:b.precision,f=void 0===b.segmentSubdivisions?this.getSegmentSubdivisions({precision:e}):b.segmentSubdivisions,g={precision:e,segmentSubdivisions:f},h=this.length(g),i=h*a;return this.pointAtLength(i,g)},pointAtLength:function(a,b){var c=this.segments,d=c.length;if(0===d)return null;if(0===a)return this.start.clone();var e=!0;a<0&&(e=!1,a=-a),b=b||{};for(var f,g=void 0===b.precision?this.PRECISION:b.precision,h=void 0===b.segmentSubdivisions?this.getSegmentSubdivisions({precision:g}):b.segmentSubdivisions,i=0,j=e?0:d-1;e?j<d:j>=0;e?j++:j--){var k=c[j],l=h[j],m=k.length({precision:g,subdivisions:l});if(k.isVisible){if(a<=i+m)return k.pointAtLength((e?1:-1)*(a-i),{precision:g,subdivisions:l});f=k}i+=m}if(f)return e?f.end:f.start;var n=c[d-1];return n.end.clone()},pointAtT:function(a){var b=this.segments,c=b.length;if(0===c)return null;var d=a.segmentIndex;if(d<0)return b[0].pointAtT(0);if(d>=c)return b[c-1].pointAtT(1);var e=a.value;return e<0?e=0:e>1&&(e=1),b[d].pointAtT(e)},prepareSegment:function(a,b,c){a.previousSegment=b,a.nextSegment=c,b&&(b.nextSegment=a),c&&(c.previousSegment=a);var d=a;return a.isSubpathStart&&(a.subpathStartSegment=a,d=c),d&&this.updateSubpathStartSegment(d),a},PRECISION:3,removeSegment:function(a){var b=this.segments,c=b.length;if(0===c)throw new Error("Path has no segments.");if(a<0&&(a=c+a),a>=c||a<0)throw new Error("Index out of range.");var d=b.splice(a,1)[0],e=d.previousSegment,f=d.nextSegment;e&&(e.nextSegment=f),f&&(f.previousSegment=e),d.isSubpathStart&&f&&this.updateSubpathStartSegment(f)},replaceSegment:function(a,b){var c=this.segments,d=c.length;if(0===d)throw new Error("Path has no segments.");if(a<0&&(a=d+a),a>=d||a<0)throw new Error("Index out of range.");var e,f=c[a],g=f.previousSegment,h=f.nextSegment,i=f.isSubpathStart;if(Array.isArray(b)){if(!b[0].isSegment)throw new Error("Segments required.");c.splice(a,1);for(var j=b.length,k=0;k<j;k++){var l=b[k];e=this.prepareSegment(l,g,h),c.splice(a+k,0,e),g=e,i&&e.isSubpathStart&&(i=!1)}}else{if(!b||!b.isSegment)throw new Error("Segment required.");e=this.prepareSegment(b,g,h),c.splice(a,1,e),i&&e.isSubpathStart&&(i=!1)}i&&h&&this.updateSubpathStartSegment(h)},scale:function(a,b,c){for(var d=this.segments,e=d.length,f=0;f<e;f++){var g=d[f];g.scale(a,b,c)}return this},segmentAt:function(a,b){var c=this.segmentIndexAt(a,b);return c?this.getSegment(c):null},segmentAtLength:function(a,b){var c=this.segmentIndexAtLength(a,b);return c?this.getSegment(c):null},segmentIndexAt:function(a,b){var c=this.segments,d=c.length;if(0===d)return null;a<0&&(a=0),a>1&&(a=1),b=b||{};var e=void 0===b.precision?this.PRECISION:b.precision,f=void 0===b.segmentSubdivisions?this.getSegmentSubdivisions({precision:e}):b.segmentSubdivisions,g={precision:e,segmentSubdivisions:f},h=this.length(g),i=h*a;return this.segmentIndexAtLength(i,g)},toPoints:function(a){var b=this.segments,c=b.length;if(0===c)return null;a=a||{};for(var d=void 0===a.precision?this.PRECISION:a.precision,e=void 0===a.segmentSubdivisions?this.getSegmentSubdivisions({precision:d}):a.segmentSubdivisions,f=[],g=[],h=0;h<c;h++){var i=b[h];if(i.isVisible){var j=e[h];if(j.length>0){var k=j.map(function(a){return a.start});Array.prototype.push.apply(g,k)}else g.push(i.start)}else g.length>0&&(g.push(b[h-1].end),f.push(g),g=[])}return g.length>
530&&(g.push(this.end),f.push(g)),f},toPolylines:function(a){var b=[],c=this.toPoints(a);if(!c)return null;for(var d=0,e=c.length;d<e;d++)b.push(new w(c[d]));return b},intersectionWithLine:function(a,b){var c=null,d=this.toPolylines(b);if(!d)return null;for(var e=0,f=d.length;e<f;e++){var g=d[e],h=a.intersect(g);h&&(c||(c=[]),Array.isArray(h)?Array.prototype.push.apply(c,h):c.push(h))}return c},segmentIndexAtLength:function(a,b){var c=this.segments,d=c.length;if(0===d)return null;var e=!0;a<0&&(e=!1,a=-a),b=b||{};for(var f=void 0===b.precision?this.PRECISION:b.precision,g=void 0===b.segmentSubdivisions?this.getSegmentSubdivisions({precision:f}):b.segmentSubdivisions,h=null,i=0,j=e?0:d-1;e?j<d:j>=0;e?j++:j--){var k=c[j],l=g[j],m=k.length({precision:f,subdivisions:l});if(k.isVisible){if(a<=i+m)return j;h=j}i+=m}return h},tangentAt:function(a,b){var c=this.segments,d=c.length;if(0===d)return null;a<0&&(a=0),a>1&&(a=1),b=b||{};var e=void 0===b.precision?this.PRECISION:b.precision,f=void 0===b.segmentSubdivisions?this.getSegmentSubdivisions({precision:e}):b.segmentSubdivisions,g={precision:e,segmentSubdivisions:f},h=this.length(g),i=h*a;return this.tangentAtLength(i,g)},tangentAtLength:function(a,b){var c=this.segments,d=c.length;if(0===d)return null;var e=!0;a<0&&(e=!1,a=-a),b=b||{};for(var f,g=void 0===b.precision?this.PRECISION:b.precision,h=void 0===b.segmentSubdivisions?this.getSegmentSubdivisions({precision:g}):b.segmentSubdivisions,i=0,j=e?0:d-1;e?j<d:j>=0;e?j++:j--){var k=c[j],l=h[j],m=k.length({precision:g,subdivisions:l});if(k.isDifferentiable()){if(a<=i+m)return k.tangentAtLength((e?1:-1)*(a-i),{precision:g,subdivisions:l});f=k}i+=m}if(f){var n=e?1:0;return f.tangentAtT(n)}return null},tangentAtT:function(a){var b=this.segments,c=b.length;if(0===c)return null;var d=a.segmentIndex;if(d<0)return b[0].tangentAtT(0);if(d>=c)return b[c-1].tangentAtT(1);var e=a.value;return e<0?e=0:e>1&&(e=1),b[d].tangentAtT(e)},translate:function(a,b){for(var c=this.segments,d=c.length,e=0;e<d;e++){var f=c[e];f.translate(a,b)}return this},updateSubpathStartSegment:function(a){for(var b=a.previousSegment;a&&!a.isSubpathStart;)b?a.subpathStartSegment=b.subpathStartSegment:a.subpathStartSegment=null,b=a,a=a.nextSegment},serialize:function(){if(!this.isValid())throw new Error("Invalid path segments.");return this.toString()},toString:function(){for(var a=this.segments,b=a.length,c="",d=0;d<b;d++){var e=a[d];c+=e.serialize()+" "}return c.trim()}},Object.defineProperty(t.prototype,"start",{configurable:!0,enumerable:!0,get:function(){var a=this.segments,b=a.length;if(0===b)return null;for(var c=0;c<b;c++){var d=a[c];if(d.isVisible)return d.start}return a[b-1].end}}),Object.defineProperty(t.prototype,"end",{configurable:!0,enumerable:!0,get:function(){var a=this.segments,b=a.length;if(0===b)return null;for(var c=b-1;c>=0;c--){var d=a[c];if(d.isVisible)return d.end}return a[b-1].end}});var u=a.Point=function(a,b){if(!(this instanceof u))return new u(a,b);if("string"==typeof a){var c=a.split(a.indexOf("@")===-1?" ":"@");a=parseFloat(c[0]),b=parseFloat(c[1])}else Object(a)===a&&(b=a.y,a=a.x);this.x=void 0===a?0:a,this.y=void 0===b?0:b};u.fromPolar=function(a,b,c){c=c&&new u(c)||new u(0,0);var d=e(a*f(b)),h=e(a*g(b)),i=x(z(b));return i<90?h=-h:i<180?(d=-d,h=-h):i<270&&(d=-d),new u(c.x+d,c.y+h)},u.random=function(a,b,c,d){return new u(m(o()*(b-a+1)+a),m(o()*(d-c+1)+c))},u.prototype={adhereToRect:function(a){return a.containsPoint(this)?this:(this.x=i(j(this.x,a.x),a.x+a.width),this.y=i(j(this.y,a.y),a.y+a.height),this)},bearing:function(a){return new s(this,a).bearing()},changeInAngle:function(a,b,c){return this.clone().offset(-a,-b).theta(c)-this.theta(c)},clone:function(){return new u(this)},difference:function(a,b){return Object(a)===a&&(b=a.y,a=a.x),new u(this.x-(a||0),this.y-(b||0))},distance:function(a){return new s(this,a).length()},squaredDistance:function(a){return new s(this,a).squaredLength()},equals:function(a){return!!a&&this.x===a.x&&this.y===a.y},magnitude:function(){return h(this.x*this.x+this.y*this.y)||.01},manhattanDistance:function(a){return e(a.x-this.x)+e(a.y-this.y)},move:function(a,b){var c=A(new u(a).theta(this)),d=this.offset(f(c)*b,-g(c)*b);return d},normalize:function(a){var b=(a||1)/this.magnitude();return this.scale(b,b)},offset:function(a,b){return Object(a)===a&&(b=a.y,a=a.x),this.x+=a||0,this.y+=b||0,this},reflection:function(a){return new u(a).move(this,this.distance(a))}
53,rotate:function(b,c){b=b||new a.Point(0,0),c=A(x(-c));var d=f(c),e=g(c),h=d*(this.x-b.x)-e*(this.y-b.y)+b.x,i=e*(this.x-b.x)+d*(this.y-b.y)+b.y;return this.x=h,this.y=i,this},round:function(a){var b=p(10,a||0);return this.x=l(this.x*b)/b,this.y=l(this.y*b)/b,this},scale:function(a,b,c){return c=c&&new u(c)||new u(0,0),this.x=c.x+a*(this.x-c.x),this.y=c.y+b*(this.y-c.y),this},snapToGrid:function(a,b){return this.x=y(this.x,a),this.y=y(this.y,b||a),this},theta:function(a){a=new u(a);var b=-(a.y-this.y),c=a.x-this.x,d=k(b,c);return d<0&&(d=2*n+d),180*d/n},angleBetween:function(a,b){var c=this.equals(a)||this.equals(b)?NaN:this.theta(b)-this.theta(a);return c<0&&(c+=360),c},vectorAngle:function(a){var b=new u(0,0);return b.angleBetween(this,a)},toJSON:function(){return{x:this.x,y:this.y}},toPolar:function(a){a=a&&new u(a)||new u(0,0);var b=this.x,c=this.y;return this.x=h((b-a.x)*(b-a.x)+(c-a.y)*(c-a.y)),this.y=A(a.theta(new u(b,c))),this},toString:function(){return this.x+"@"+this.y},update:function(a,b){return this.x=a||0,this.y=b||0,this},dot:function(a){return a?this.x*a.x+this.y*a.y:NaN},cross:function(a,b){return a&&b?(b.x-this.x)*(a.y-this.y)-(b.y-this.y)*(a.x-this.x):NaN},lerp:function(a,b){var c=this.x,d=this.y;return new u((1-b)*c+b*a.x,(1-b)*d+b*a.y)}},u.prototype.translate=u.prototype.offset;var v=a.Rect=function(a,b,c,d){return this instanceof v?(Object(a)===a&&(b=a.y,c=a.width,d=a.height,a=a.x),this.x=void 0===a?0:a,this.y=void 0===b?0:b,this.width=void 0===c?0:c,void(this.height=void 0===d?0:d)):new v(a,b,c,d)};v.fromEllipse=function(a){return a=new r(a),new v(a.x-a.a,a.y-a.b,2*a.a,2*a.b)},v.prototype={bbox:function(a){if(!a)return this.clone();var b=A(a||0),c=e(g(b)),d=e(f(b)),h=this.width*d+this.height*c,i=this.width*c+this.height*d;return new v(this.x+(this.width-h)/2,this.y+(this.height-i)/2,h,i)},bottomLeft:function(){return new u(this.x,this.y+this.height)},bottomLine:function(){return new s(this.bottomLeft(),this.bottomRight())},bottomMiddle:function(){return new u(this.x+this.width/2,this.y+this.height);
54},center:function(){return new u(this.x+this.width/2,this.y+this.height/2)},clone:function(){return new v(this)},containsPoint:function(a){return a=new u(a),a.x>=this.x&&a.x<=this.x+this.width&&a.y>=this.y&&a.y<=this.y+this.height},containsRect:function(a){var b=new v(this).normalize(),c=new v(a).normalize(),d=b.width,e=b.height,f=c.width,g=c.height;if(!(d&&e&&f&&g))return!1;var h=b.x,i=b.y,j=c.x,k=c.y;return f+=j,d+=h,g+=k,e+=i,h<=j&&f<=d&&i<=k&&g<=e},corner:function(){return new u(this.x+this.width,this.y+this.height)},equals:function(a){var b=new v(this).normalize(),c=new v(a).normalize();return b.x===c.x&&b.y===c.y&&b.width===c.width&&b.height===c.height},intersect:function(a){var b=this.origin(),c=this.corner(),d=a.origin(),e=a.corner();if(e.x<=b.x||e.y<=b.y||d.x>=c.x||d.y>=c.y)return null;var f=j(b.x,d.x),g=j(b.y,d.y);return new v(f,g,i(c.x,e.x)-f,i(c.y,e.y)-g)},intersectionWithLine:function(a){var b,c,d=this,e=[d.topLine(),d.rightLine(),d.bottomLine(),d.leftLine()],f=[],g=[],h=e.length;for(c=0;c<h;c++)b=a.intersect(e[c]),null!==b&&g.indexOf(b.toString())<0&&(f.push(b),g.push(b.toString()));return f.length>0?f:null},intersectionWithLineFromCenterToPoint:function(a,b){a=new u(a);var c,d=new u(this.x+this.width/2,this.y+this.height/2);b&&a.rotate(d,b);for(var e=[this.topLine(),this.rightLine(),this.bottomLine(),this.leftLine()],f=new s(d,a),g=e.length-1;g>=0;--g){var h=e[g].intersection(f);if(null!==h){c=h;break}}return c&&b&&c.rotate(d,-b),c},leftLine:function(){return new s(this.topLeft(),this.bottomLeft())},leftMiddle:function(){return new u(this.x,this.y+this.height/2)},moveAndExpand:function(a){return this.x+=a.x||0,this.y+=a.y||0,this.width+=a.width||0,this.height+=a.height||0,this},offset:function(a,b){return u.prototype.offset.call(this,a,b)},inflate:function(a,b){return void 0===a&&(a=0),void 0===b&&(b=a),this.x-=a,this.y-=b,this.width+=2*a,this.height+=2*b,this},normalize:function(){var a=this.x,b=this.y,c=this.width,d=this.height;return this.width<0&&(a=this.x+this.width,c=-this.width),this.height<0&&(b=this.y+this.height,d=-this.height),this.x=a,this.y=b,this.width=c,this.height=d,this},origin:function(){return new u(this.x,this.y)}
54,pointNearestToPoint:function(a){if(a=new u(a),this.containsPoint(a)){var b=this.sideNearestToPoint(a);switch(b){case"right":return new u(this.x+this.width,a.y);case"left":return new u(this.x,a.y);case"bottom":return new u(a.x,this.y+this.height);case"top":return new u(a.x,this.y)}}return a.adhereToRect(this)},rightLine:function(){return new s(this.topRight(),this.bottomRight())},rightMiddle:function(){return new u(this.x+this.width,this.y+this.height/2)},round:function(a){var b=p(10,a||0);return this.x=l(this.x*b)/b,this.y=l(this.y*b)/b,this.width=l(this.width*b)/b,this.height=l(this.height*b)/b,this},scale:function(a,b,c){return c=this.origin().scale(a,b,c),this.x=c.x,this.y=c.y,this.width*=a,this.height*=b,this},maxRectScaleToFit:function(a,b){a=new v(a),b||(b=a.center());var c,d,e,f,g,h,j,k,l=b.x,m=b.y;c=d=e=f=g=h=j=k=1/0;var n=a.topLeft();n.x<l&&(c=(this.x-l)/(n.x-l)),n.y<m&&(g=(this.y-m)/(n.y-m));var o=a.bottomRight();o.x>l&&(d=(this.x+this.width-l)/(o.x-l)),o.y>m&&(h=(this.y+this.height-m)/(o.y-m));var p=a.topRight();p.x>l&&(e=(this.x+this.width-l)/(p.x-l)),p.y<m&&(j=(this.y-m)/(p.y-m));var q=a.bottomLeft();return q.x<l&&(f=(this.x-l)/(q.x-l)),q.y>m&&(k=(this.y+this.height-m)/(q.y-m)),{sx:i(c,d,e,f),sy:i(g,h,j,k)}},maxRectUniformScaleToFit:function(a,b){var c=this.maxRectScaleToFit(a,b);return i(c.sx,c.sy)},sideNearestToPoint:function(a){a=new u(a);var b=a.x-this.x,c=this.x+this.width-a.x,d=a.y-this.y,e=this.y+this.height-a.y,f=b,g="left";return c<f&&(f=c,g="right"),d<f&&(f=d,g="top"),e<f&&(f=e,g="bottom"),g},snapToGrid:function(a,b){var c=this.origin().snapToGrid(a,b),d=this.corner().snapToGrid(a,b);return this.x=c.x,this.y=c.y,this.width=d.x-c.x,this.height=d.y-c.y,this},topLine:function(){return new s(this.topLeft(),this.topRight())},topMiddle:function(){return new u(this.x+this.width/2,this.y)},topRight:function(){return new u(this.x+this.width,this.y)},toJSON:function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},toString:function(){return this.origin().toString()+" "+this.corner().toString()},union:function(a){a=new v(a);var b=this.origin(),c=this.corner(),d=a.origin(),e=a.corner(),f=i(b.x,d.x),g=i(b.y,d.y),h=j(c.x,e.x),k=j(c.y,e.y);return new v(f,g,h-f,k-g)}},v.prototype.bottomRight=v.prototype.corner,v.prototype.topLeft=v.prototype.origin,v.prototype.translate=v.prototype.offset;var w=a.Polyline=function(a){return this instanceof w?"string"==typeof a?new w.parse(a):void(this.points=Array.isArray(a)?a.map(u):[]):new w(a)};w.parse=function(a){if(a=a.trim(),""===a)return new w;for(var b=[],c=a.split(/\s*,\s*|\s+/),d=c.length,e=0;e<d;e+=2)b.push({x:+c[e],y:+c[e+1]});return new w(b)},w.prototype={bbox:function(){var a=1/0,b=-(1/0),c=1/0,d=-(1/0),e=this.points,f=e.length;if(0===f)return null;for(var g=0;g<f;g++){var h=e[g],i=h.x,j=h.y;i<a&&(a=i),i>b&&(b=i),j<c&&(c=j),j>d&&(d=j)}return new v(a,c,b-a,d-c)},clone:function(){var a=this.points,b=a.length;if(0===b)return new w;for(var c=[],d=0;d<b;d++){var e=a[d].clone();c.push(e)}return new w(c)},closestPoint:function(a){var b=this.closestPointLength(a);return this.pointAtLength(b)},closestPointLength:function(a){var b=this.points,c=b.length;if(0===c)return 0;if(1===c)return 0;for(var d,e=1/0,f=0,g=c-1,h=0;h<g;h++){var i=new s(b[h],b[h+1]),j=i.length(),k=i.closestPointNormalizedLength(a),l=i.pointAt(k),m=l.squaredDistance(a);m<e&&(e=m,d=f+k*j),f+=j}return d},closestPointNormalizedLength:function(a){var b=this.closestPointLength(a);if(0===b)return 0;var c=this.length();return 0===c?0:b/c},closestPointTangent:function(a){var b=this.closestPointLength(a);return this.tangentAtLength(b)},convexHull:function(){var a,b,c=this.points,d=c.length;if(0===d)return new w;var f;for(a=0;a<d;a++)void 0===f?f=c[a]:c[a].y<f.y?f=c[a]:c[a].y===f.y&&c[a].x>f.x&&(f=c[a]);var g=[];for(a=0;a<d;a++){var h=f.theta(c[a]);0===h&&(h=360);var i=[c[a],a,h];g.push(i)}if(g.sort(function(a,b){var c=a[2]-b[2];return 0===c&&(c=b[1]-a[1]),c}),g.length>2){var j=g[g.length-1];g.unshift(j)}for(var k,l,m,n,o,p,q={},r=[];0!==g.length;)if(k=g.pop(),l=k[0],!q.hasOwnProperty(k[0]+"@@"+k[1]))for(var s=!1;!s;)if(r.length<2)r.push(k),s=!0;else{m=r.pop(),n=m[0],o=r.pop(),p=o[0];var t=p.cross(n,l);if(t<0)r.push(o),r.push(m),r.push(k),s=!0;else if(0===t){var u=1e-10,v=n.angleBetween(p,l);e(v-180)<u?(q[m[0]+"@@"+m[1]]=n,r.push(o)):n.equals(l)||p.equals(n)?(q[m[0]+"@@"+m[1]]=n,r.push(o)):e((v+1)%360-1)<u&&(r.push(o),g.pu
54sh(m))}else q[m[0]+"@@"+m[1]]=n,r.push(o)}r.length>2&&r.pop();var x,y=-1;for(b=r.length,a=0;a<b;a++){var z=r[a][1];(void 0===x||z<x)&&(x=z,y=a)}var A=[];if(y>0){var B=r.slice(y),C=r.slice(0,y);A=B.concat(C)}else A=r;var D=[];for(b=A.length,a=0;a<b;a++)D.push(A[a][0]);return new w(D)},equals:function(a){if(!a)return!1;var b=this.points,c=a.points,d=b.length;if(c.length!==d)return!1;for(var e=0;e<d;e++){var f=b[e],g=a.points[e];if(!f.equals(g))return!1}return!0},isDifferentiable:function(){var a=this.points,b=a.length;if(0===b)return!1;for(var c=b-1,d=0;d<c;d++){var e=a[d],f=a[d+1],g=new s(e,f);if(g.isDifferentiable())return!0}return!1},length:function(){var a=this.points,b=a.length;if(0===b)return 0;for(var c=0,d=b-1,e=0;e<d;e++)c+=a[e].distance(a[e+1]);return c},pointAt:function(a){var b=this.points,c=b.length;if(0===c)return null;if(1===c)return b[0].clone();if(a<=0)return b[0].clone();if(a>=1)return b[c-1].clone();var d=this.length(),e=d*a;return this.pointAtLength(e)},pointAtLength:function(a){var b=this.points,c=b.length;if(0===c)return null;if(1===c)return b[0].clone();var d=!0;a<0&&(d=!1,a=-a);for(var e=0,f=c-1,g=d?0:f-1;d?g<f:g>=0;d?g++:g--){var h=b[g],i=b[g+1],j=new s(h,i),k=h.distance(i);if(a<=e+k)return j.pointAtLength((d?1:-1)*(a-e));e+=k}var l=d?b[c-1]:b[0];return l.clone()},scale:function(a,b,c){var d=this.points,e=d.length;if(0===e)return this;for(var f=0;f<e;f++)d[f].scale(a,b,c);return this},tangentAt:function(a){var b=this.points,c=b.length;if(0===c)return null;if(1===c)return null;a<0&&(a=0),a>1&&(a=1);var d=this.length(),e=d*a;return this.tangentAtLength(e)},tangentAtLength:function(a){var b=this.points,c=b.length;if(0===c)return null;if(1===c)return null;var d=!0;a<0&&(d=!1,a=-a);for(var e,f=0,g=c-1,h=d?0:g-1;d?h<g:h>=0;d?h++:h--){var i=b[h],j=b[h+1],k=new s(i,j),l=i.distance(j);if(k.isDifferentiable()){if(a<=f+l)return k.tangentAtLength((d?1:-1)*(a-f));e=k}f+=l}if(e){var m=d?1:0;return e.tangentAt(m)}return null},intersectionWithLine:function(a){for(var b=new s(a),c=[],d=this.points,e=0,f=d.length-1;e<f;e++){var g=d[e],h=d[e+1],i=new s(g,h),j=b.intersectionWithLine(i);j&&c.push(j[0])}return c.length>0?c:null},translate:function(a,b){var c=this.points,d=c.length;if(0===d)return this;for(var e=0;e<d;e++)c[e].translate(a,b);return this},serialize:function(){var a=this.points,b=a.length;if(0===b)return"";for(var c="",d=0;d<b;d++){var e=a[d];c+=e.x+","+e.y+" "}return c.trim()},toString:function(){return this.points+""}},Object.defineProperty(w.prototype,"start",{configurable:!0,enumerable:!0,get:function(){var a=this.points,b=a.length;return 0===b?null:this.points[0]}}),Object.defineProperty(w.prototype,"end",{configurable:!0,enumerable:!0,get:function(){var a=this.points,b=a.length;return 0===b?null:this.points[b-1]}}),a.scale={linear:function(a,b,c){var d=a[1]-a[0],e=b[1]-b[0];return(c-a[0])/d*e+b[0]||0}};var x=a.normalizeAngle=function(a){return a%360+(a<0?360:0)},y=a.snapToGrid=function(a,b){return b*l(a/b)},z=a.toDeg=function(a){return 180*a/n%360},A=a.toRad=function(a,b){return b=b||!1,a=b?a:a%360,a*n/180};a.ellipse=a.Ellipse,a.line=a.Line,a.point=a.Point,a.rect=a.Rect;var B={closestPointT:function(a){if(this.closestPointNormalizedLength)return this.closestPointNormalizedLength(a);throw new Error("Neither closestPointT() nor closestPointNormalizedLength() function is implemented.")},isSegment:!0,isSubpathStart:!1,isVisible:!0,nextSegment:null,lengthAtT:function(a){if(a<=0)return 0;var b=this.length();return a>=1?b:b*a},pointAtT:function(a){if(this.pointAt)return this.pointAt(a);throw new Error("Neither pointAtT() nor pointAt() function is implemented.")},previousSegment:null,subpathStartSegment:null,tangentAtT:function(a){if(this.tangentAt)return this.tangentAt(a);throw new Error("Neither tangentAtT() nor tangentAt() function is implemented.")},bbox:function(){throw new Error("Declaration missing for virtual function.")},clone:function(){throw new Error("Declaration missing for virtual function.")},closestPoint:function(){throw new Error("Declaration missing for virtual function.")},closestPointLength:function(){throw new Error("Declaration missing for virtual function.")},closestPointNormalizedLength:function(){throw new Error("Declaration missing for virtual function.")},closestPointTangent:function(){throw new Error("Declaration missing for virtual function.")},equals:function(){throw new Error("Declaration missing for virtual function.")},getSubdivisions:function(){throw new Error("Declaration missing for virtual function.")},isDifferentiable:function(){throw new Error("Declaration missing for virtual function.")},length:function(){throw new Error("Declaration missing for virtual function.")},pointAt:function(){throw new Error("Declaration missing for virtual function.")},pointAtLength:function(){throw new Error("Declaration missing for virtual function.")},scale:function(){throw new Error("Declaration missing for virtual function.")},tangentAt:function(){throw new Error("Declaration missing for virtual function.")},tangentAtLength:function(){throw new Error("Declaration missing for virtual function.")},translate:function(){throw new Error("Declaration missing for virtual function.")},serialize:function(){throw new Error("Declaration missing for virtual function.")},toString:function(){throw new Error("Declaration missing for virtual function.")}},C=function(){for(var a=[],c=arguments.length,d=0;d<c;d++)a.push(arguments[d]);if(!(this instanceof C))return b(C,a);if(0===c)throw new Error("Lineto constructor expects 1 point or 2 coordinates (none provided).");var e;if("string"==typeof a[0]||"number"==typeof a[0]){if(2===c)return this.end=new u(+a[0],+a[1]),this;if(c<2)throw new Error("Lineto constructor expects 1 point or 2 coordinates ("+c+" coordinates provided).");var f;for(e=[],d=0;d<c;d+=2)f=a.slice(d,d+2),e.push(b(C,f));return e}if(1===c)return this.end=new u(a[0]),this;var g;for(e=[],d=0;d<c;d+=1)g=a[d],e.push(new C(g));return e},D={clone:function(){return new C(this.end)},getSubdivisions:function(){return[]},isDifferentiable:function(){return!!this.previousSegment&&!this.start.equals(this.end)},scale:function(a,b,c){return this.end.scale(a,b,c),this},translate:function(a,b){return this.end.translate(a,b),this},type:"L",serialize:function(){var a=this.end;return this.type+" "+a.x+" "+a.y},toString:function(){return this.type+" "+this.start+" "+this.end}};Object.defineProperty(D,"start",{configurable:!0,enumerable:!0,get:function(){if(!this.previousSegment)throw new Error("Missing previous segment. (This segment cannot be the first segment of a path; OR segment has not yet been added to a path.)");return this.previousSegment.end}}),C.prototype=c(B,s.prototype,D);var E=function(){for(var a=[],c=arguments.length,d=0;d<c;d++)a.push(arguments[d]);if(!(this instanceof E))return b(E,a);if(0===c)throw new Error("Curveto constructor expects 3 points or 6 coordinates (none provided).");var e;if("string"==typeof a[0]||"number"==typeof a[0]){if(6===c)return this.controlPoint1=new u(+a[0],+a[1]),this.controlPoint2=new u(+a[2],+a[3]),this.end=new u(+a[4],+a[5]),this;if(c<6)throw new Error("Curveto constructor expects 3 points or 6 coordinates ("+c+" coordinates provided).");var f;for(e=[],d=0;d<c;d+=6)f=a.slice(d,d+6),e.push(b(E,f));return e}if(3===c)return this.controlPoint1=new u(a[0]),this.controlPoint2=new u(a[1]),this.end=new u(a[2]),this;if(c<3)throw new Error("Curveto constructor expects 3 points or 6 coordinates ("+c+" points provided).");var g;for(e=[],d=0;d<c;d+=3)g=a.slice(d,d+3),e.push(b(E,g));return e},F={clone:function(){return new E(this.controlPoint1,this.controlPoint2,this.end)},isDifferentiable:function(){if(!this.previousSegment)return!1;var a=this.start,b=this.controlPoint1,c=this.controlPoint2,d=this.end;return!(a.equals(b)&&b.equals(c)&&c.equals(d))},scale:function(a,b,c){return this.controlPoint1.scale(a,b,c),this.controlPoint2.scale(a,b,c),this.end.scale(a,b,c),this},translate:function(a,b){return this.controlPoint1.translate(a,b),this.controlPoint2.translate(a,b),this.end.translate(a,b),this},type:"C",serialize:function(){var a=this.controlPoint1,b=this.controlPoint2,c=this.end;return this.type+" "+a.x+" "+a.y+" "+b.x+" "+b.y+" "+c.x+" "+c.y},toString:function(){return this.type+" "+this.start+" "+this.controlPoint1+" "+this.controlPoint2+" "+this.end}};Object.defineProperty(F,"start",{configurable:!0,enumerable:!0,get:function(){if(!this.previousSegment)throw new Error("Missing previous segment. (This segment cannot be the first segment of a path; OR segment has not yet been added to a path.)");return this.previousSegment.end}}),E.prototype=c(B,q.prototype,F);var G=function(){for(var a=[],c=arguments.length,d=0;d<c;d++)a.push(arguments[d]);if(!(this instanceof G))return b(G,a);if(0===c)throw new Error("Moveto constructor expects 1 point or 2 coordinates (none provided).");var e;if("string"==typeof a[0]||"number"==typeof a[0]){if(2===c)return this.end=new u(+a[0],+a[1]),this;if(c<2)throw new Error("Moveto constructor expects 1 point or 2 coordinates ("+c+" coordinates provided).");var f;for(e=[],d=0;d<c;d+=2)f=a.slice(d,d+2),0===d?e.push(b(G,f)):e.push(b(C,f));return e}if(1===c)return this.end=new u(a[0]),this;var g;for(e=[],d=0;d<c;d+=1)g=a[d],0===d?e.push(new G(g)):e.push(new C(g));return e},H={bbox:function(){return null},clone:function(){return new G(this.end)},closestPoint:function(){return this.end.clone()},closestPointNormalizedLength:function(){return 0},closestPointLength:function(){return 0},closestPointT:function(){return 1},closestPointTangent:function(){return null},equals:function(a){return this.end.equals(a.end)},getSubdivisions:function(){return[]},isDifferentiable:function(){return!1},isSubpathStart:!0,isVisible:!1,length:function(){return 0},lengthAtT:function(){return 0},pointAt:function(){return this.end.clone()},pointAtLength:function(){return this.end.clone()},pointAtT:function(){return this.end.clone()},scale:function(a,b,c){return this.end.scale(a,b,c),this},tangentAt:function(){return null},tangentAtLength:function(){return null},tangentAtT:function(){return null},translate:function(a,b){return this.end.translate(a,b),this},type:"M",serialize:function(){var a=this.end;return this.type+" "+a.x+" "+a.y},toString:function(){return this.type+" "+this.end}};Object.defineProperty(H,"start",{configurable:!0,enumerable:!0,get:function(){throw new Error("Illegal access. Moveto segments should not need a start property.")}}),G.prototype=c(B,H);var I=function(){for(var a=[],c=arguments.length,d=0;d<c;d++)a.push(arguments[d]);if(!(this instanceof I))return b(I,a);if(c>0)throw new Error("Closepath constructor expects no arguments.");return this},J={clone:function(){return new I},getSubdivisions:function(){return[]},isDifferentiable:function(){return!(!this.previousSegment||!this.subpathStartSegment)&&!this.start.equals(this.end)},scale:function(){return this},translate:function(){return this},type:"Z",serialize:function(){return this.type},toString:function(){return this.type+" "+this.start+" "+this.end}};Object.defineProperty(J,"start",{configurable:!0,enumerable:!0,get:function(){if(!this.previousSegment)throw new Error("Missing previous segment. (This segment cannot be the first segment of a path; OR segment has not yet been added to a path.)");return this.previousSegment.end}}),Object.defineProperty(J,"end",{configurable:!0,enumerable:!0,get:function(){if(!this.subpathStartSegment)throw new Error("Missing subpath start segment. (This segment needs a subpath start segment (e.g. Moveto); OR segment has not yet been added to a path.)");return this.subpathStartSegment.end}}),I.prototype=c(B,s.prototype,J);var K=t.segmentTypes={L:C,C:E,M:G,Z:I,z:I};t.regexSupportedData=new RegExp("^[\\s\\d"+Object.keys(K).join("")+",.]*$"),t.isDataSupported=function(a){return"string"==typeof a&&this.regexSupportedData.test(a)}}(g);
55var V,Vectorizer;V=Vectorizer=function(){"use strict";function a(a,b){a||(a={});var c=q("textPath"),d=a.d;if(d&&void 0===a["xlink:href"]){var e=q("path").attr("d",d).appendTo(b.defs());c.attr("xlink:href","#"+e.id)}return q.isObject(a)&&c.attr(a),c.node}function b(a,b,c){c||(c={});for(var d=c.includeAnnotationIndices,e=c.eol,f=c.lineHeight,g=c.baseSize,h=0,i={},j=b.length-1,k=0;k<=j;k++){var l=b[k],m=null;if(q.isObject(l)){var n=l.attrs,o=q("tspan",n),p=o.node,r=l.t;e&&k===j&&(r+=e),p.textContent=r;var s=n.class;s&&o.addClass(s),d&&o.attr("annotations",l.annotations),m=parseFloat(n["font-size"]),void 0===m&&(m=g),m&&m>h&&(h=m)}else e&&k===j&&(l+=e),p=document.createTextNode(l||" "),g&&g>h&&(h=g);a.appendChild(p)}return h&&(i.maxFontSize=h),f?i.lineHeight=f:h&&(i.lineHeight=1.2*h),i}function c(a,b){var c=parseFloat(a);return s.test(a)?c*b:c}function d(a,b,d,e){if(!Array.isArray(b))return 0;var f=b.length;if(!f)return 0;for(var g=b[0],h=c(g.maxFontSize,d)||d,i=0,j=c(e,d),k=1;k<f;k++){g=b[k];var l=c(g.lineHeight,d)||j;i+=l}var m,n=c(g.maxFontSize,d)||d;switch(a){case"middle":m=h/2-.15*n-i/2;break;case"bottom":m=-(.25*n)-i;break;default:case"top":m=.8*h}return m}var e="object"==typeof window&&!(!window.SVGAngle&&!document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"));if(!e)return function(){throw new Error("SVG is required to use Vectorizer.")};var f={xmlns:"http://www.w3.org/2000/svg",xml:"http://www.w3.org/XML/1998/namespace",xlink:"http://www.w3.org/1999/xlink",xhtml:"http://www.w3.org/1999/xhtml"},h="1.1",i=Math,j=i.PI,k=i.atan2,l=i.sqrt,m=i.min,n=i.max,o=i.cos,p=i.sin,q=function(a,b,c){if(!(this instanceof q))return q.apply(Object.create(q.prototype),arguments);if(a){if(q.isV(a)&&(a=a.node),b=b||{},q.isString(a)){if("svg"===a.toLowerCase())a=q.createSvgDocument();else if("<"===a[0]){var d=q.createSvgDocument(a);if(d.childNodes.length>1){var e,g,h=[];for(e=0,g=d.childNodes.length;e<g;e++){var i=d.childNodes[e];h.push(new q(document.importNode(i,!0)))}return h}a=document.importNode(d.firstChild,!0)}else a=document.createElementNS(f.xmlns,a);q.ensureId(a)}return this.node=a,this.setAttributes(b),c&&this.append(c),this}},r=q.prototype;Object.defineProperty(r,"id",{enumerable:!0,get:function(){return this.node.id},set:function(a){this.node.id=a}}),r.getTransformToElement=function(a){return a=q.toNode(a),a.getScreenCTM().inverse().multiply(this.node.getScreenCTM())},r.transform=function(a,b){var c=this.node;if(q.isUndefined(a))return q.transformStringToMatrix(this.attr("transform"));if(b&&b.absolute)return this.attr("transform",q.matrixToTransformString(a));var d=q.createSVGTransform(a);return c.transform.baseVal.appendItem(d),this},r.translate=function(a,b,c){c=c||{},b=b||0;var d=this.attr("transform")||"",e=q.parseTransformString(d);if(d=e.value,q.isUndefined(a))return e.translate;d=d.replace(/translate\([^)]*\)/g,"").trim();var f=c.absolute?a:e.translate.tx+a,g=c.absolute?b:e.translate.ty+b,h="translate("+f+","+g+")";return this.attr("transform",(h+" "+d).trim()),this},r.rotate=function(a,b,c,d){d=d||{};var e=this.attr("transform")||"",f=q.parseTransformString(e);if(e=f.value,q.isUndefined(a))return f.rotate;e=e.replace(/rotate\([^)]*\)/g,"").trim(),a%=360;var g=d.absolute?a:f.rotate.angle+a,h=void 0!==b&&void 0!==c?","+b+","+c:"",i="rotate("+g+h+")";return this.attr("transform",(e+" "+i).trim()),this},r.scale=function(a,b){b=q.isUndefined(b)?a:b;var c=this.attr("transform")||"",d=q.parseTransformString(c);if(c=d.value,q.isUndefined(a))return d.scale;c=c.replace(/scale\([^)]*\)/g,"").trim();var e="scale("+a+","+b+")";return this.attr("transform",(c+" "+e).trim()),this},r.bbox=function(a,b){var c,d=this.node,e=d.ownerSVGElement;if(!e)return new g.Rect(0,0,0,0);try{c=d.getBBox()}catch(a){c={x:d.clientLeft,y:d.clientTop,width:d.clientWidth,height:d.clientHeight}}if(a)return new g.Rect(c);var f=this.getTransformToElement(b||e);
55return q.transformRect(c,f)},r.getBBox=function(a){var b,c={},d=this.node,e=d.ownerSVGElement;if(!e)return new g.Rect(0,0,0,0);if(a&&(a.target&&(c.target=q.toNode(a.target)),a.recursive&&(c.recursive=a.recursive)),c.recursive){var f=this.children(),h=f.length;if(0===h)return this.getBBox({target:c.target,recursive:!1});c.target||(c.target=this);for(var i=0;i<h;i++){var j,k=f[i];j=0===k.children().length?k.getBBox({target:c.target,recursive:!1}):k.getBBox({target:c.target,recursive:!0}),b=b?b.union(j):j}return b}try{b=d.getBBox()}catch(a){b={x:d.clientLeft,y:d.clientTop,width:d.clientWidth,height:d.clientHeight}}if(c.target){var l=this.getTransformToElement(c.target);return q.transformRect(b,l)}return new g.Rect(b)};var s=/em$/;r.text=function(c,e){if(c&&"string"!=typeof c)throw new Error("Vectorizer: text() expects the first argument to be a string.");c=q.sanitizeText(c),e||(e={});var f=e.eol,g=e.textPath,h=e.textVerticalAnchor,i="middle"===h||"bottom"===h||"top"===h,j=e.x;void 0===j&&(j=this.attr("x")||0);var k=e.includeAnnotationIndices,l=e.annotations;l&&!q.isArray(l)&&(l=[l]);var m=e.lineHeight,n="auto"===m,o=n?"1.5em":m||"1em";this.empty(),this.attr({"xml:space":"preserve",display:c?null:"none"});var p=parseFloat(this.attr("font-size"));p||(p=16,(i||l)&&this.attr("font-size",p));var r,t=document;g?("string"==typeof g&&(g={d:g}),r=a(g,this)):r=t.createDocumentFragment();for(var u,v=0,w=c.split("\n"),x=[],y=0,z=w.length-1;y<=z;y++){var A,B=o,C="v-line",D=t.createElementNS(q.namespace.xmlns,"tspan"),E=w[y];if(E)if(l){var F=q.annotateString(E,l,{offset:-v,includeAnnotationIndices:k});A=b(D,F,{includeAnnotationIndices:k,eol:y!==z&&f,lineHeight:n?null:o,baseSize:p});var G=A.lineHeight;G&&n&&0!==y&&(B=G),0===y&&(u=.8*A.maxFontSize)}else f&&y!==z&&(E+=f),D.textContent=E;else{D.textContent="-",C+=" v-empty-line";var H=D.style;H.fillOpacity=0,H.strokeOpacity=0,l&&(A={})}A&&x.push(A),y>0&&D.setAttribute("dy",B),(y>0||g)&&D.setAttribute("x",j),D.className.baseVal=C,r.appendChild(D),v+=E.length+1}if(i)if(l)B=d(h,x,p,o);else if("top"===h)B="0.8em";else{var I;switch(z>0?(I=parseFloat(o)||1,I*=z,s.test(o)||(I/=p)):I=0,h){case"middle":B=.3-I/2+"em";break;case"bottom":B=-I-.3+"em"}}else 0===h?B="0em":h?B=h:(B=0,null===this.attr("y")&&this.attr("y",u||"0.8em"));return r.firstChild.setAttribute("dy",B),this.append(r),this},r.removeAttr=function(a){var b=q.qualifyAttr(a),c=this.node;return b.ns?c.hasAttributeNS(b.ns,b.local)&&c.removeAttributeNS(b.ns,b.local):c.hasAttribute(a)&&c.removeAttribute(a),this},r.attr=function(a,b){if(q.isUndefined(a)){for(var c=this.node.attributes,d={},e=0;e<c.length;e++)d[c[e].name]=c[e].value;return d}if(q.isString(a)&&q.isUndefined(b))return this.node.getAttribute(a);if("object"==typeof a)for(var f in a)a.hasOwnProperty(f)&&this.setAttribute(f,a[f]);else this.setAttribute(a,b);return this},r.normalizePath=function(){var a=this.tagName();return"PATH"===a&&this.attr("d",q.normalizePathData(this.attr("d"))),this},r.remove=function(){return this.node.parentNode&&this.node.parentNode.removeChild(this.node),this},r.empty=function(){for(;this.node.firstChild;)this.node.removeChild(this.node.firstChild);return this},r.setAttributes=function(a){for(var b in a)a.hasOwnProperty(b)&&this.setAttribute(b,a[b]);return this},r.append=function(a){q.isArray(a)||(a=[a]);for(var b=0,c=a.length;b<c;b++)this.node.appendChild(q.toNode(a[b]));return this},r.prepend=function(a){var b=this.node.firstChild;return b?q(b).before(a):this.append(a)},r.before=function(a){var b=this.node,c=b.parentNode;if(c){q.isArray(a)||(a=[a]);for(var d=0,e=a.length;d<e;d++)c.insertBefore(q.toNode(a[d]),b)}return this},r.appendTo=function(a){return q.toNode(a).appendChild(this.node),this},r.svg=function(){return this.node instanceof window.SVGSVGElement?this:q(this.node.ownerSVGElement)},r.tagName=function(){return this.node.tagName.toUpperCase()},r.defs=function(){var a=this.svg()||this,b=a.node.getElementsByTagName("defs")[0];return b?q(b):q("defs").appendTo(a)},r.clone=function(){var a=q(this.node.cloneNode(!0));return a.node.id=q.uniqueId(),a},r.findOne=function(a){var b=this.node.querySelector(a);return b?q(b):void 0},r.find=function(a){var b=[],c=this.node.querySelectorAll(a);if(c)for(var d=0;d<c.length;d++)b.push(q(c[d]));return b},r.children=function(){for(var a=this.node.childNodes,b=[],c=0;c<a.length;c++){var d=a[c];1===d.nodeType&&b.push(q(a[c]))}return b},r.index=function(){for(var a=0,b=this.node.previousSibling;b;)1===b.nodeType&&a++,b=b.previousSibling;return a},r.findParentByClass=function(a,b){for(var c=this.node.ownerSVGElement,d=this.node.parentNode;d&&d!==b&&d!==c;){var e=q(d);if(e.hasClass(a))return e;d=d.parentNode}return null},r.contains=function(a){var b=this.node,c=q.toNode(a),d=c&&c.parentNode;return b===d||!!(d&&1===d.nodeType&&16&b.compareDocumentPosition(d))},r.toLocalPoint=function(a,b){var c=this.svg().node,d=c.createSVGPoint();d.x=a,d.y=b;try{var e=d.matrixTransform(c.getScreenCTM().inverse()),f=this.getTransformToElement(c).inverse()}catch(a){return d}return e.matrixTransform(f)},r.translateCenterToPoint=function(a){var b=this.getBBox({target:this.svg()}),c=b.center();return this.translate(a.x-c.x,a.y-c.y),this},r.translateAndAutoOrient=function(a,b,c){var d=this.scale();this.attr("transform",""),this.scale(d.sx,d.sy);var e=this.svg().node,f=this.getBBox({target:c||e}),h=e.createSVGTransform();h.setTranslate(-f.x-f.width/2,-f.y-f.height/2);var i=e.createSVGTransform(),j=new g.Point(a).changeInAngle(a.x-b.x,a.y-b.y,b);
55i.setRotate(j,0,0);var k=e.createSVGTransform(),l=new g.Point(a).move(b,f.width/2);k.setTranslate(a.x+(a.x-l.x),a.y+(a.y-l.y));var m=this.getTransformToElement(c||e),n=e.createSVGTransform();n.setMatrix(k.matrix.multiply(i.matrix.multiply(h.matrix.multiply(m))));var o=q.decomposeMatrix(n.matrix);return this.translate(o.translateX,o.translateY),this.rotate(o.rotation),this},r.animateAlongPath=function(a,b){b=q.toNode(b);var c=q.ensureId(b),d=q("animateMotion",a),e=q("mpath",{"xlink:href":"#"+c});d.append(e),this.append(d);try{d.node.beginElement()}catch(a){if("fake"===document.documentElement.getAttribute("smiling")){var f=d.node;f.animators=[];var g=f.getAttribute("id");g&&(id2anim[g]=f);for(var h=getTargets(f),i=0,j=h.length;i<j;i++){var k=h[i],l=new Animator(f,k,i);animators.push(l),f.animators[i]=l,l.register()}}}return this},r.hasClass=function(a){return new RegExp("(\\s|^)"+a+"(\\s|$)").test(this.node.getAttribute("class"))},r.addClass=function(a){if(!this.hasClass(a)){var b=this.node.getAttribute("class")||"";this.node.setAttribute("class",(b+" "+a).trim())}return this},r.removeClass=function(a){if(this.hasClass(a)){var b=this.node.getAttribute("class").replace(new RegExp("(\\s|^)"+a+"(\\s|$)","g"),"$2");this.node.setAttribute("class",b)}return this},r.toggleClass=function(a,b){var c=q.isUndefined(b)?this.hasClass(a):!b;return c?this.removeClass(a):this.addClass(a),this},r.sample=function(a){a=a||1;for(var b,c=this.node,d=c.getTotalLength(),e=[],f=0;f<d;)b=c.getPointAtLength(f),e.push({x:b.x,y:b.y,distance:f}),f+=a;return e},r.convertToPath=function(){var a=q("path");a.attr(this.attr());var b=this.convertToPathData();return b&&a.attr("d",b),a},r.convertToPathData=function(){var a=this.tagName();switch(a){case"PATH":return this.attr("d");case"LINE":return q.convertLineToPathData(this.node);case"POLYGON":return q.convertPolygonToPathData(this.node);case"POLYLINE":return q.convertPolylineToPathData(this.node);case"ELLIPSE":return q.convertEllipseToPathData(this.node);case"CIRCLE":return q.convertCircleToPathData(this.node);case"RECT":return q.convertRectToPathData(this.node)}throw new Error(a+" cannot be converted to PATH.")},q.prototype.toGeometryShape=function(){var a,b,c,d,e,f,h,i,j,k,l,m,n,o,p;switch(this.tagName()){case"RECT":return a=parseFloat(this.attr("x"))||0,b=parseFloat(this.attr("y"))||0,c=parseFloat(this.attr("width"))||0,d=parseFloat(this.attr("height"))||0,new g.Rect(a,b,c,d);case"CIRCLE":return e=parseFloat(this.attr("cx"))||0,f=parseFloat(this.attr("cy"))||0,h=parseFloat(this.attr("r"))||0,new g.Ellipse({x:e,y:f},h,h);case"ELLIPSE":return e=parseFloat(this.attr("cx"))||0,f=parseFloat(this.attr("cy"))||0,i=parseFloat(this.attr("rx"))||0,j=parseFloat(this.attr("ry"))||0,new g.Ellipse({x:e,y:f},i,j);case"POLYLINE":return k=q.getPointsFromSvgNode(this),new g.Polyline(k);case"POLYGON":return k=q.getPointsFromSvgNode(this),k.length>1&&k.push(k[0]),new g.Polyline(k);case"PATH":return l=this.attr("d"),g.Path.isDataSupported(l)||(l=q.normalizePathData(l)),new g.Path(l);case"LINE":return m=parseFloat(this.attr("x1"))||0,o=parseFloat(this.attr("y1"))||0,n=parseFloat(this.attr("x2"))||0,p=parseFloat(this.attr("y2"))||0,new g.Line({x:m,y:o},{x:n,y:p})}return this.getBBox()},r.findIntersection=function(a,b){var c=this.svg().node;b=b||c;var d=this.getBBox({target:b}),e=d.center();if(d.intersectionWithLineFromCenterToPoint(a)){var f,h=this.tagName();if("RECT"===h){var i=new g.Rect(parseFloat(this.attr("x")||0),parseFloat(this.attr("y")||0),parseFloat(this.attr("width")),parseFloat(this.attr("height"))),j=this.getTransformToElement(b),k=q.decomposeMatrix(j),l=c.createSVGTransform();l.setRotate(-k.rotation,e.x,e.y);var m=q.transformRect(i,l.matrix.multiply(j));f=new g.Rect(m).intersectionWithLineFromCenterToPoint(a,k.rotation)}else if("PATH"===h||"POLYGON"===h||"POLYLINE"===h||"CIRCLE"===h||"ELLIPSE"===h){var n,o,p,r,s,t,u="PATH"===h?this:this.convertToPath(),v=u.sample(),w=1/0,x=[];for(n=0;n<v.length;n++)o=v[n],p=q.createSVGPoint(o.x,o.y),p=p.matrixTransform(this.getTransformToElement(b)),o=new g.Point(p),r=o.distance(e),s=1.1*o.distance(a),t=r+s,t<w?(w=t,x=[{sample:o,refDistance:s}]):t<w+1&&x.push({sample:o,refDistance:s});x.sort(function(a,b){return a.refDistance-b.refDistance}
55),x[0]&&(f=x[0].sample)}return f}},r.setAttribute=function(a,b){var c=this.node;if(null===b)return this.removeAttr(a),this;var d=q.qualifyAttr(a);return d.ns?c.setAttributeNS(d.ns,a,b):"id"===a?c.id=b:c.setAttribute(a,b),this},q.createSvgDocument=function(a){var b='<svg xmlns="'+f.xmlns+'" xmlns:xlink="'+f.xlink+'" version="'+h+'">'+(a||"")+"</svg>",c=q.parseXML(b,{async:!1});return c.documentElement},q.idCounter=0,q.uniqueId=function(){return"v-"+ ++q.idCounter},q.toNode=function(a){return q.isV(a)?a.node:a.nodeName&&a||a[0]},q.ensureId=function(a){return a=q.toNode(a),a.id||(a.id=q.uniqueId())},q.sanitizeText=function(a){return(a||"").replace(/ /g,"\xa0")},q.isUndefined=function(a){return"undefined"==typeof a},q.isString=function(a){return"string"==typeof a},q.isObject=function(a){return a&&"object"==typeof a},q.isArray=Array.isArray,q.parseXML=function(a,b){b=b||{};var c;try{var d=new DOMParser;q.isUndefined(b.async)||(d.async=b.async),c=d.parseFromString(a,"text/xml")}catch(a){c=void 0}if(!c||c.getElementsByTagName("parsererror").length)throw new Error("Invalid XML: "+a);return c},q.qualifyAttr=function(a){if(a.indexOf(":")!==-1){var b=a.split(":");return{ns:f[b[0]],local:b[1]}}return{ns:null,local:a}},q.transformRegex=/(\w+)\(([^,)]+),?([^)]+)?\)/gi,q.transformSeparatorRegex=/[ ,]+/,q.transformationListRegex=/^(\w+)\((.*)\)/,q.transformStringToMatrix=function(a){var b=q.createSVGMatrix(),c=a&&a.match(q.transformRegex);if(!c)return b;for(var d=0,e=c.length;d<e;d++){var f=c[d],g=f.match(q.transformationListRegex);if(g){var h,i,j,k,l,m=q.createSVGMatrix(),n=g[2].split(q.transformSeparatorRegex);switch(g[1].toLowerCase()){case"scale":h=parseFloat(n[0]),i=void 0===n[1]?h:parseFloat(n[1]),m=m.scaleNonUniform(h,i);break;case"translate":j=parseFloat(n[0]),k=parseFloat(n[1]),m=m.translate(j,k);break;case"rotate":l=parseFloat(n[0]),j=parseFloat(n[1])||0,k=parseFloat(n[2])||0,m=0!==j||0!==k?m.translate(j,k).rotate(l).translate(-j,-k):m.rotate(l);break;case"skewx":l=parseFloat(n[0]),m=m.skewX(l);break;case"skewy":l=parseFloat(n[0]),m=m.skewY(l);break;case"matrix":m.a=parseFloat(n[0]),m.b=parseFloat(n[1]),m.c=parseFloat(n[2]),m.d=parseFloat(n[3]),m.e=parseFloat(n[4]),m.f=parseFloat(n[5]);break;default:continue}b=b.multiply(m)}}return b},q.matrixToTransformString=function(a){return a||(a=!0),"matrix("+(void 0!==a.a?a.a:1)+","+(void 0!==a.b?a.b:0)+","+(void 0!==a.c?a.c:0)+","+(void 0!==a.d?a.d:1)+","+(void 0!==a.e?a.e:0)+","+(void 0!==a.f?a.f:0)+")"},q.parseTransformString=function(a){var b,c,d;if(a){var e=q.transformSeparatorRegex;if(a.trim().indexOf("matrix")>=0){var f=q.transformStringToMatrix(a),g=q.decomposeMatrix(f);b=[g.translateX,g.translateY],d=[g.scaleX,g.scaleY],c=[g.rotation];var h=[];0===b[0]&&0===b[0]||h.push("translate("+b+")"),1===d[0]&&1===d[1]||h.push("scale("+d+")"),0!==c[0]&&h.push("rotate("+c+")"),a=h.join(" ")}else{var i=a.match(/translate\((.*?)\)/);i&&(b=i[1].split(e));var j=a.match(/rotate\((.*?)\)/);j&&(c=j[1].split(e));var k=a.match(/scale\((.*?)\)/);k&&(d=k[1].split(e))}}var l=d&&d[0]?parseFloat(d[0]):1;return{value:a,translate:{tx:b&&b[0]?parseInt(b[0],10):0,ty:b&&b[1]?parseInt(b[1],10):0},rotate:{angle:c&&c[0]?parseInt(c[0],10):0,cx:c&&c[1]?parseInt(c[1],10):void 0,cy:c&&c[2]?parseInt(c[2],10):void 0},scale:{sx:l,sy:d&&d[1]?parseFloat(d[1]):l}}},q.deltaTransformPoint=function(a,b){var c=b.x*a.a+b.y*a.c+0,d=b.x*a.b+b.y*a.d+0;return{x:c,y:d}},q.decomposeMatrix=function(a){var b=q.deltaTransformPoint(a,{x:0,y:1}),c=q.deltaTransformPoint(a,{x:1,y:0}),d=180/j*k(b.y,b.x)-90,e=180/j*k(c.y,c.x);return{translateX:a.e,translateY:a.f,scaleX:l(a.a*a.a+a.b*a.b),scaleY:l(a.c*a.c+a.d*a.d),skewX:d,skewY:e,rotation:d}},q.matrixToScale=function(a){var b,c,d,e;return a?(b=q.isUndefined(a.a)?1:a.a,e=q.isUndefined(a.d)?1:a.d,c=a.b,d=a.c):b=e=1,{sx:c?l(b*b+c*c):b,sy:d?l(d*d+e*e):e}},q.matrixToRotate=function(a){var b={x:0,y:1};return a&&(b=q.deltaTransformPoint(a,b)),{angle:g.normalizeAngle(g.toDeg(k(b.y,b.x))-90)}},q.matrixToTranslate=function(a){return{tx:a&&a.e||0,ty:a&&a.f||0}},q.isV=function(a){return a instanceof q},q.isVElement=q.isV;var t=q("svg").node;return q.createSVGMatrix=function(a){var b=t.createSVGMatrix();for(var c in a)b[c]=a[c];return b},q.createSVGTransform=function(a){return q.isUndefined(a)?t.createSVGTransform():(a instanceof SVGMatrix||(a=q.createSVGMatrix(a)),t.createSVGTransformFromMatrix(a))},q.createSVGPoint=function(a,b){var c=t.createSVGPoint();return c.x=a,c.y=b,c},q.transformRect=function(a,b){var c=t.createSVGPoint();c.x=a.x,c.y=a.y;var d=c.matrixTransform(b);c.x=a.x+a.width,c.y=a.y;var e=c.matrixTransform(b);c.x=a.x+a.width,c.y=a.y+a.height;var f=c.matrixTransform(b);c.x=a.x,c.y=a.y+a.height;var h=c.matrixTransform(b),i=m(d.x,e.x,f.x,h.x),j=n(d.x,e.x,f.x,h.x),k=m(d.y,e.y,f.y,h.y),l=n(d.y,e.y,f.y,h.y);return new g.Rect(i,k,j-i,l-k)},q.transformPoint=function(a,b){return new g.Point(q.createSVGPoint(a.x,a.y).matrixTransform(b))},q.transformLine=function(a,b){return new g.Line(q.transformPoint(a.start,b),q.transformPoint(a.end,b))},q.transformPolyline=function(a,b){var c=a instanceof g.Polyline?a.points:a;q.isArray(c)||(c=[]);for(var d=[],e=0,f=c.length;e<f;e++)d[e]=q.transformPoint(c[e],b);return new g.Polyline(d)},q.styleToObject=function(a){for(var b={},c=a.split(";"),d=0;d<c.length;d++){var e=c[d],f=e.split("=");b[f[0].trim()]=f[1].trim()}return b},q.createSlicePathData=function(a,b,c,d){var e=2*j-1e-6,f=a,g=b,h=c,i=d,k=(i<h&&(k=h,h=i,i=k),i-h),l=k<j?"0":"1",m=o(h),n=p(h),q=o(i),r=p(i);return k>=e?f?"M0,"+g+"A"+g+","+g+" 0 1,1 0,"+-g+"A"+g+","+g+" 0 1,1 0,"+g+"M0,"+f+"A"+f+","+f+" 0 1,0 0,"+-f+"A"+f+","+f+" 0 1,0 0,"+f+"Z":"M0,"+g+"A"+g+","+g+" 0 1,1 0,"+-g+"A"+g+","+g+" 0 1,1 0,"+g+"Z":f?"M"+g*m+","+g*n+"A"+g+","+g+" 0 "+l+",1 "+g*q+","+g*r+"L"+f*q+","+f*r+"A"+f+","+f+" 0 "+l+",0 "+f*m+","+f*n+"Z":"M"+g*m+","+g*n+"A"+g+","+g+" 0 "+l+",1 "+g*q+","+g*r+"L0,0Z"},q.mergeAttrs=function(a,b){for(var c in b)"class"===c?a[c]=a[c]?a[c]+" "+b[c]:b[c]:"style"===c?q.isObject(a[c])&&q.isObject(b[c])?a[c]=q.mergeAttrs(a[c],b[c]):q.isObject(a[c])?a[c]=q.mergeAttrs(a[c],q.styleToObject(b[c])
55):q.isObject(b[c])?a[c]=q.mergeAttrs(q.styleToObject(a[c]),b[c]):a[c]=q.mergeAttrs(q.styleToObject(a[c]),q.styleToObject(b[c])):a[c]=b[c];return a},q.annotateString=function(a,b,c){b=b||[],c=c||{};for(var d,e,f,g=c.offset||0,h=[],i=[],j=0;j<a.length;j++){e=i[j]=a[j];for(var k=0;k<b.length;k++){var l=b[k],m=l.start+g,n=l.end+g;j>=m&&j<n&&(q.isObject(e)?e.attrs=q.mergeAttrs(q.mergeAttrs({},e.attrs),l.attrs):e=i[j]={t:a[j],attrs:l.attrs},c.includeAnnotationIndices&&(e.annotations||(e.annotations=[])).push(k))}f=i[j-1],f?q.isObject(e)&&q.isObject(f)?JSON.stringify(e.attrs)===JSON.stringify(f.attrs)?d.t+=e.t:(h.push(d),d=e):q.isObject(e)?(h.push(d),d=e):q.isObject(f)?(h.push(d),d=e):d=(d||"")+e:d=e}return d&&h.push(d),h},q.findAnnotationsAtIndex=function(a,b){var c=[];return a&&a.forEach(function(a){a.start<b&&b<=a.end&&c.push(a)}),c},q.findAnnotationsBetweenIndexes=function(a,b,c){var d=[];return a&&a.forEach(function(a){(b>=a.start&&b<a.end||c>a.start&&c<=a.end||a.start>=b&&a.end<c)&&d.push(a)}),d},q.shiftAnnotations=function(a,b,c){return a&&a.forEach(function(a){a.start<b&&a.end>=b?a.end+=c:a.start>=b&&(a.start+=c,a.end+=c)}),a},q.convertLineToPathData=function(a){a=q(a);var b=["M",a.attr("x1"),a.attr("y1"),"L",a.attr("x2"),a.attr("y2")].join(" ");return b},q.convertPolygonToPathData=function(a){var b=q.getPointsFromSvgNode(a);return 0===b.length?null:q.svgPointsToPath(b)+" Z"},q.convertPolylineToPathData=function(a){var b=q.getPointsFromSvgNode(a);return 0===b.length?null:q.svgPointsToPath(b)},q.svgPointsToPath=function(a){for(var b=0,c=a.length;b<c;b++)a[b]=a[b].x+" "+a[b].y;return"M "+a.join(" L")},q.getPointsFromSvgNode=function(a){a=q.toNode(a);var b=[],c=a.points;if(c)for(var d=0,e=c.numberOfItems;d<e;d++)b.push(c.getItem(d));return b},q.KAPPA=.551784,q.convertCircleToPathData=function(a){a=q(a);var b=parseFloat(a.attr("cx"))||0,c=parseFloat(a.attr("cy"))||0,d=parseFloat(a.attr("r")),e=d*q.KAPPA,f=["M",b,c-d,"C",b+e,c-d,b+d,c-e,b+d,c,"C",b+d,c+e,b+e,c+d,b,c+d,"C",b-e,c+d,b-d,c+e,b-d,c,"C",b-d,c-e,b-e,c-d,b,c-d,"Z"].join(" ");return f},q.convertEllipseToPathData=function(a){a=q(a);var b=parseFloat(a.attr("cx"))||0,c=parseFloat(a.attr("cy"))||0,d=parseFloat(a.attr("rx")),e=parseFloat(a.attr("ry"))||d,f=d*q.KAPPA,g=e*q.KAPPA,h=["M",b,c-e,"C",b+f,c-e,b+d,c-g,b+d,c,"C",b+d,c+g,b+f,c+e,b,c+e,"C",b-f,c+e,b-d,c+g,b-d,c,"C",b-d,c-g,b-f,c-e,b,c-e,"Z"].join(" ");return h},q.convertRectToPathData=function(a){return a=q(a),q.rectToPath({x:parseFloat(a.attr("x"))||0,y:parseFloat(a.attr("y"))||0,width:parseFloat(a.attr("width"))||0,height:parseFloat(a.attr("height"))||0,rx:parseFloat(a.attr("rx"))||0,ry:parseFloat(a.attr("ry"))||0})},q.rectToPath=function(a){var b,c=a.x,d=a.y,e=a.width,f=a.height,g=m(a.rx||a["top-rx"]||0,e/2),h=m(a.rx||a["bottom-rx"]||0,e/2),i=m(a.ry||a["top-ry"]||0,f/2),j=m(a.ry||a["bottom-ry"]||0,f/2);return b=g||h||i||j?["M",c,d+i,"v",f-i-j,"a",h,j,0,0,0,h,j,"h",e-2*h,"a",h,j,0,0,0,h,-j,"v",-(f-j-i),"a",g,i,0,0,0,-g,-i,"h",-(e-2*g),"a",g,i,0,0,0,-g,i,"Z"]:["M",c,d,"H",c+e,"V",d+f,"H",c,"V",d,"Z"],b.join(" ")},q.normalizePathData=function(){function a(a,b,c,d,e,f){var g=1/3,h=2/3;return[g*a+h*c,g*b+h*d,g*e+h*c,g*f+h*d,e,f]}function b(a,c,d,e,f,g,h,i,q,r){var s,t=120*j/180,u=j/180*(+f||0),v=[],w=function(a,b,c){var d=a*l(c)-b*k(c),e=a*k(c)+b*l(c);return{x:d,y:e}};if(r)F=r[0],G=r[1],D=r[2],E=r[3];else{s=w(a,c,-u),a=s.x,c=s.y,s=w(i,q,-u),i=s.x,q=s.y;var x=(a-i)/2,y=(c-q)/2,z=x*x/(d*d)+y*y/(e*e);z>1&&(z=o(z),d*=z,e*=z);var A=d*d,B=e*e,C=(g==h?-1:1)*o(p((A*B-A*y*y-B*x*x)/(A*y*y+B*x*x))),D=C*d*y/e+(a+i)/2,E=C*-e*x/d+(c+q)/2,F=n(((c-E)/e).toFixed(9)),G=n(((q-E)/e).toFixed(9));F=a<D?j-F:F,G=i<D?j-G:G,F<0&&(F=2*j+F),G<0&&(G=2*j+G),(h&&F)>G&&(F-=2*j),(!h&&G)>F&&(G-=2*j)}var H=G-F;if(p(H)>t){var I=G,J=i,K=q;G=F+t*((h&&G)>F?1:-1),i=D+d*l(G),q=E+e*k(G),v=b(i,q,d,e,f,0,h,J,K,[G,I,D,E])}H=G-F;var L=l(F),M=k(F),N=l(G),O=k(G),P=m(H/4),Q=4/3*(d*P),R=4/3*(e*P),S=[a,c],T=[a+Q*M,c-R*L],U=[i+Q*O,q-R*N],V=[i,q];if(T[0]=2*S[0]-T[0],T[1]=2*S[1]-T[1],r)return[T,U,V].concat(v);v=[T,U,V].concat(v).join().split(",");for(var W=[],X=v.length,Y=0;Y<X;Y++)W[Y]=Y%2?w(v[Y-1],v[Y],u).y:w(v[Y],v[Y+1],u).x;return W}function c(a){if(!a)return null;var b={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},c=[];return String(a).replace(g,function(a,d,e){var f=[],g=d.toLowerCase();for(e.replace(h,function(a,b){b&&f.push(+b)}),"m"===g&&f.length>2&&(c.push([d].concat(f.splice(0,2))),g="l",d="m"===d?"l":"L");f.length>=b[g]&&(c.push([d].concat(f.splice(0,b[g]))),b[g]););}),c}function d(a){if(Array.isArray(a)&&Array.isArray(a&&a[0])||(a=c(a)),!a||!a.length)return[["M",0,0]];for(var b,d=[],e=0,f=0,g=0,h=0,i=0,j=a.length,k=i;k<j;k++){var l=[];d.push(l);var m=a[k];if(b=m[0],b!=b.toUpperCase()){l[0]=b.toUpperCase();var n,o;switch(l[0]){case"A":l[1]=m[1],l[2]=m[2],l[3]=m[3],l[4]=m[4],l[5]=m[5],l[6]=+m[6]+e,l[7]=+m[7]+f;break;case"V":l[1]=+m[1]+f;break;case"H":l[1]=+m[1]+e;break;case"M":for(g=+m[1]+e,h=+m[2]+f,n=m.length,o=1;o<n;o++)l[o]=+m[o]+(o%2?e:f);break;default:for(n=m.length,o=1;o<n;o++)l[o]=+m[o]+(o%2?e:f)}}else for(var p=m.length,q=0;q<p;q++)l[q]=m[q];switch(l[0]){case"Z":e=+g,f=+h;break;case"H":e=l[1];break;case"V":f=l[1];break;case"M":g=l[l.length-2],h=l[l.length-1],e=l[l.length-2],f=l[l.length-1];break;default:e=l[l.length-2],f=l[l.length-1]}}return d}function e(c){function e(c,d,e){var f,g;if(!c)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(c[0]in{T:1,Q:1}||(d.qx=null,d.qy=null),c[0]){case"M":d.X=c[1],d.Y=c[2];break;case"A":c=["C"].concat(b.apply(0,[d.x,d.y].concat(c.slice(1))));break;case"S":"C"===e||"S"===e?(f=2*d.x-d.bx,g=2*d.y-d.by):(f=d.x,g=d.y),c=["C",f,g].concat(c.slice(1));break;case"T":"Q"===e||"T"===e?(d.qx=2*d.x-d.qx,d.qy=2*d.y-d.qy):(d.qx=d.x,d.qy=d.y),c=["C"].concat(a(d.x,d.y,d.qx,d.qy,c[1],c[2]));break;case"Q":d.qx=c[1],d.qy=c[2],c=["C"].concat(a(d.x,d.y,c[1],c[2],c[3],c[4]));break;case"H":c=["L"].concat(c[1],d.y);break;case"V":c=["L"].concat(d.x,c[1]);break;case"L":break;case"Z":}return c}function f(a,b){if(a[b].length>7){a[b].shift();for(var c=a[b];c.length;)i[b]="A",a.splice(b++,0,["C"].concat(c.splice(0,6)));a.splice(b,1),l=g.length}}for(var g=d(c),h={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=[],j="",k="",l=g.length,m=0;m<l;m++){g[m]&&(j=g[m][0]),"C"!==j&&(i[m]=j,m>
550&&(k=i[m-1])),g[m]=e(g[m],h,k),"A"!==i[m]&&"C"===j&&(i[m]="C"),f(g,m);var n=g[m],o=n.length;h.x=n[o-2],h.y=n[o-1],h.bx=parseFloat(n[o-4])||h.x,h.by=parseFloat(n[o-3])||h.y}return g[0][0]&&"M"===g[0][0]||g.unshift(["M",0,0]),g}var f="\t\n\v\f\r \xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029",g=new RegExp("([a-z])["+f+",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?["+f+"]*,?["+f+"]*)+)","ig"),h=new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)["+f+"]*,?["+f+"]*","ig"),i=Math,j=i.PI,k=i.sin,l=i.cos,m=i.tan,n=i.asin,o=i.sqrt,p=i.abs;return function(a){return e(a).join(",").split(",").join(" ")}}(),q.namespace=f,q}();
56var joint={version:"2.1.4",config:{classNamePrefix:"joint-",defaultTheme:"default"},dia:{},ui:{},layout:{},shapes:{},format:{},connectors:{},highlighters:{},routers:{},anchors:{},connectionPoints:{},connectionStrategies:{},linkTools:{},mvc:{views:{}},setTheme:function(a,b){b=b||{},joint.util.invoke(joint.mvc.views,"setTheme",a,b),joint.mvc.View.prototype.defaultTheme=a},env:{_results:{},_tests:{svgforeignobject:function(){return!!document.createElementNS&&/SVGForeignObject/.test({}.toString.call(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")))}},addTest:function(a,b){return joint.env._tests[a]=b},test:function(a){var b=joint.env._tests[a];if(!b)throw new Error('Test not defined ("'+a+'"). Use `joint.env.addTest(name, fn) to add a new test.`');var c=joint.env._results[a];if("undefined"!=typeof c)return c;try{c=b()}catch(a){c=!1}return joint.env._results[a]=c,c}},util:{hashCode:function(a){var b=0;if(0==a.length)return b;for(var c=0;c<a.length;c++){var d=a.charCodeAt(c);b=(b<<5)-b+d,b&=b}return b},getByPath:function(a,b,c){for(var d,e=Array.isArray(b)?b.slice():b.split(c||"/");e.length;){if(d=e.shift(),!(Object(a)===a&&d in a))return;a=a[d]}return a},setByPath:function(a,b,c,d){for(var e=Array.isArray(b)?b:b.split(d||"/"),f=a,g=0,h=e.length;g<h-1;
56g++)f=f[e[g]]||(f[e[g]]={});return f[e[h-1]]=c,a},unsetByPath:function(a,b,c){c=c||"/";var d=Array.isArray(b)?b.slice():b.split(c),e=d.pop();if(d.length>0){var f=joint.util.getByPath(a,d,c);f&&delete f[e]}else delete a[e];return a},flattenObject:function(a,b,c){b=b||"/";var d={};for(var e in a)if(a.hasOwnProperty(e)){var f="object"==typeof a[e];if(f&&c&&c(a[e])&&(f=!1),f){var g=this.flattenObject(a[e],b,c);for(var h in g)g.hasOwnProperty(h)&&(d[e+b+h]=g[h])}else d[e]=a[e]}return d},uuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16)})},guid:function(a){return this.guid.id=this.guid.id||1,a.id=void 0===a.id?"j_"+this.guid.id++:a.id,a.id},toKebabCase:function(a){return a.replace(/[A-Z]/g,"-$&").toLowerCase()},normalizeEvent:function(a){var b=a.originalEvent&&a.originalEvent.changedTouches&&a.originalEvent.changedTouches[0];if(b){for(var c in a)void 0===b[c]&&(b[c]=a[c]);return b}return a},nextFrame:function(){var a;if("undefined"!=typeof window&&(a=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame),!a){var b=0;a=function(a){var c=(new Date).getTime(),d=Math.max(0,16-(c-b)),e=setTimeout(function(){a(c+d)},d);return b=c+d,e}}return function(b,c){return a(c?b.bind(c):b)}}(),cancelFrame:function(){var a,b="undefined"!=typeof window;return b&&(a=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.msCancelAnimationFrame||window.msCancelRequestAnimationFrame||window.oCancelAnimationFrame||window.oCancelRequestAnimationFrame||window.mozCancelAnimationFrame||window.mozCancelRequestAnimationFrame),a=a||clearTimeout,b?a.bind(window):a}(),shapePerimeterConnectionPoint:function(a,b,c,d){var e,f;if(!c){var g=b.$(".scalable")[0],h=b.$(".rotatable")[0];g&&g.firstChild?c=g.firstChild:h&&h.firstChild&&(c=h.firstChild)}return c?(f=V(c).findIntersection(d,a.paper.viewport),f||(e=V(c).getBBox({target:a.paper.viewport}))):(e=b.model.getBBox(),f=e.intersectionWithLineFromCenterToPoint(d)),f||e.center()},isPercentage:function(a){return joint.util.isString(a)&&"%"===a.slice(-1)},parseCssNumeric:function(a,b){b=b||[];var c={value:parseFloat(a)};if(Number.isNaN(c.value))return null;var d=b.join("|");if(joint.util.isString(a)){var e=new RegExp("(\\d+)("+d+")$").exec(a);if(!e)return null;e[2]&&(c.unit=e[2])}return c},breakText:function(a,b,c,d){d=d||{},c=c||{};var e=b.width,f=b.height,g=d.svgDocument||V("svg").node,h=V("tspan").node,i=V("text").attr(c).append(h).node,j=document.createTextNode("");i.style.opacity=0,i.style.display="block",h.style.display="block",h.appendChild(j),g.appendChild(i),d.svgDocument||document.body.appendChild(g);for(var k,l,m=d.separator||" ",n=d.eol||"\n",o=a.split(m),p=[],q=[],r=0,s=0,t=o.length;r<t;r++){var u=o[r];if(u)if(n&&u.indexOf(n)>=0)if(u.length>1){for(var v=u.split(n),w=0,x=v.length-1;w<x;w++)v.splice(2*w+1,0,n);Array.prototype.splice.apply(o,[r,1].concat(v)),r--,t+=v.length-1}else s++;else{if(j.data=q[s]?q[s]+" "+u:u,h.getComputedTextLength()<=e)q[s]=j.data,k&&(p[s++]=!0,k=0);else{if(!q[s]||k){var y=!!k;if(k=u.length-1,y||!k){if(!k){if(!q[s]){q=[];break}o.splice(r,2,u+o[r+1]),t--,p[s++]=!0,r--;continue}o[r]=u.substring(0,k),o[r+1]=u.substring(k)+o[r+1]}else o.splice(r,1,u.substring(0,k),u.substring(k)),t++,s&&!p[s-1]&&s--;r--;continue}s++,r--}if(void 0!==f){if(void 0===l){var z;z="auto"===c.lineHeight?{value:1.5,unit:"em"}:joint.util.parseCssNumeric(c.lineHeight,["em"])||{value:1,unit:"em"},l=z.value,"em"===z.unit&&(l*=i.getBBox().height)}if(l*q.length>f){q.splice(Math.floor(f/l));break}}}}return d.svgDocument?g.removeChild(i):document.body.removeChild(g),q.join(n)},sanitizeHTML:function(a){var b=$($.parseHTML("<div>"+a+"</div>",null,!1));return b.find("*").each(function(){var a=this;$.each(a.attributes,function(){var b=this,c=b.name,d=b.value;0!==c.indexOf("on")&&0!==d.indexOf("javascript:")||$(a).removeAttr(c)})}),b.html()},downloadBlob:function(a,b){if(window.navigator.msSaveBlob)window.navigator.msSaveBlob(a,b);else{var c=window.URL.createObjectURL(a),d=document.createElement("a");d.href=c,d.download=b,document.body.appendChild(d),d.click(),document.body.removeChild(d),window.URL.revokeObjectURL(c)}},downloadDataUri:function(a,b){var c=joint.util.dataUriToBlob(a);joint.util.downloadBlob(c,b)},dataUriToBlob:function(a){a=a.replace(/\s/g,""),a=decodeURIComponent(a);var b,c=a.indexOf(","),d=a.slice(0,c),e=d.split(":")[1].split(";")[0],f=a.slice(c+1);b=d.indexOf("base64")>=0?atob(f):unescape(encodeURIComponent(f));for(var g=new Uint8Array(b.length),h=0;h<b.length;h++)g[h]=b.charCodeAt(h);return new Blob([g],{type:e})},imageToDataUri:function(a,b){if(!a||"data:"===a.substr(0,"data:".length))return setTimeout(function(){b(null,a)},0);
56var c=function(b,c){if(200===b.status){var d=new FileReader;d.onload=function(a){var b=a.target.result;c(null,b)},d.onerror=function(){c(new Error("Failed to load image "+a))},d.readAsDataURL(b.response)}else c(new Error("Failed to load image "+a))},d=function(b,c){var d=function(a){for(var b=32768,c=[],d=0;d<a.length;d+=b)c.push(String.fromCharCode.apply(null,a.subarray(d,d+b)));return c.join("")};if(200===b.status){var e=new Uint8Array(b.response),f=a.split(".").pop()||"png",g={svg:"svg+xml"},h="data:image/"+(g[f]||f)+";base64,",i=h+btoa(d(e));c(null,i)}else c(new Error("Failed to load image "+a))},e=new XMLHttpRequest;e.open("GET",a,!0),e.addEventListener("error",function(){b(new Error("Failed to load image "+a))}),e.responseType=window.FileReader?"blob":"arraybuffer",e.addEventListener("load",function(){window.FileReader?c(e,b):d(e,b)}),e.send()},getElementBBox:function(a){var b=$(a);if(0===b.length)throw new Error("Element not found");var c=b[0],d=c.ownerDocument,e=c.getBoundingClientRect(),f=0,g=0;if(c.ownerSVGElement){var h=V(c),i=h.getBBox({target:h.svg()});f=e.width-i.width,g=e.height-i.height}return{x:e.left+window.pageXOffset-d.documentElement.offsetLeft+f/2,y:e.top+window.pageYOffset-d.documentElement.offsetTop+g/2,width:e.width-f,height:e.height-g}},sortElements:function(a,b){var c=$(a),d=c.map(function(){var a=this,b=a.parentNode,c=b.insertBefore(document.createTextNode(""),a.nextSibling);return function(){if(b===this)throw new Error("You can't sort elements if any one is a descendant of another.");b.insertBefore(this,c),b.removeChild(c)}});return Array.prototype.sort.call(c,b).each(function(a){d[a].call(this)})},setAttributesBySelector:function(a,b){var c=$(a);joint.util.forIn(b,function(a,b){var d=c.find(b).addBack().filter(b);joint.util.has(a,"class")&&(d.addClass(a.class),a=joint.util.omit(a,"class")),d.attr(a)})},normalizeSides:function(a){if(Object(a)!==a){var b=0;return isFinite(a)&&(b=+a),{top:b,right:b,bottom:b,left:b}}var c,d,e,f;return c=d=e=f=0,isFinite(a.vertical)&&(c=e=+a.vertical),isFinite(a.horizontal)&&(d=f=+a.horizontal),isFinite(a.top)&&(c=+a.top),isFinite(a.right)&&(d=+a.right),isFinite(a.bottom)&&(e=+a.bottom),isFinite(a.left)&&(f=+a.left),{top:c,right:d,bottom:e,left:f}},timing:{linear:function(a){return a},quad:function(a){return a*a},cubic:function(a){return a*a*a},inout:function(a){if(a<=0)return 0;if(a>=1)return 1;var b=a*a,c=b*a;return 4*(a<.5?c:3*(a-b)+c-.75)},exponential:function(a){return Math.pow(2,10*(a-1))},bounce:function(a){for(var b=0,c=1;1;b+=c,c/=2)if(a>=(7-4*b)/11){var d=(11-6*b-11*a)/4;return-d*d+c*c}},reverse:function(a){return function(b){return 1-a(1-b)}},reflect:function(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}},clamp:function(a,b,c){return b=b||0,c=c||1,function(d){var e=a(d);return e<b?b:e>c?c:e}},back:function(a){return a||(a=1.70158),function(b){return b*b*((a+1)*b-a)}},elastic:function(a){return a||(a=1.5),function(b){return Math.pow(2,10*(b-1))*Math.cos(20*Math.PI*a/3*b)}}},interpolate:{number:function(a,b){var c=b-a;return function(b){return a+c*b}},object:function(a,b){var c=Object.keys(a);return function(d){var e,f,g={};for(e=c.length-1;e!=-1;e--)f=c[e],g[f]=a[f]+(b[f]-a[f])*d;return g}},hexColor:function(a,b){var c=parseInt(a.slice(1),16),d=parseInt(b.slice(1),16),e=255&c,f=(255&d)-e,g=65280&c,h=(65280&d)-g,i=16711680&c,j=(16711680&d)-i;return function(a){var b=e+f*a&255,c=g+h*a&65280,d=i+j*a&16711680;return"#"+(1<<24|b|c|d).toString(16).slice(1)}},unit:function(a,b){var c=/(-?[0-9]*.[0-9]*)(px|em|cm|mm|in|pt|pc|%)/,d=c.exec(a),e=c.exec(b),f=e[1].indexOf("."),g=f>0?e[1].length-f-1:0;a=+d[1];var h=+e[1]-a,i=d[2];return function(b){return(a+h*b).toFixed(g)+i}}},filter:{outline:function(a){var b='<filter><feFlood flood-color="${color}" flood-opacity="${opacity}" result="colored"/><feMorphology in="SourceAlpha" result="morphedOuter" operator="dilate" radius="${outerRadius}" /><feMorphology in="SourceAlpha" result="morphedInner" operator="dilate" radius="${innerRadius}" /><feComposite result="morphedOuterColored" in="colored" in2="morphedOuter" operator="in"/><feComposite operator="xor" in="morphedOuterColored" in2="morphedInner" result="outline"/><feMerge><feMergeNode in="outline"/><feMergeNode in="SourceGraphic"/></feMerge></filter>',c=Number.isFinite(a.margin)?a.margin:2,d=Number.isFinite(a.width)?a.width:1;return joint.util.template(b)({color:a.color||"blue",opacity:Number.isFinite(a.opacity)?a.opacity:1,outerRadius:c+d,innerRadius:c})},highlight:function(a){var b='<filter><feFlood flood-color="${color}" flood-opacity="${opacity}" result="colored"/><feMorphology result="morphed" in="SourceGraphic" operator="dilate" radius="${width}"/><feComposite result="composed" in="colored" in2="morphed" operator="in"/><feGaussianBlur result="blured" in="composed" stdDeviation="${blur}"/><feBlend in="SourceGraphic" in2="blured" mode="normal"/></filter>';return joint.util.template(b)({color:a.color||"red",width:Number.isFinite(a.width)?a.width:1,blur:Number.isFinite(a.blur)?a.blur:0,opacity:Number.isFinite(a.opacity)?a.opacity:1})},blur:function(a){var b=Number.isFinite(a.x)?a.x:2;return joint.util.template('<filter><feGaussianBlur stdDeviation="${stdDeviation}"/></filter>')({stdDeviation:Number.isFinite(a.y)?[b,a.y]:b})},dropShadow:function(a){var b="SVGFEDropShadowElement"in window?'<filter><feDropShadow stdDeviation="${blur}" dx="${dx}" dy="${dy}" flood-color="${color}" flood-opacity="${opacity}"/></filter>':'<filter><feGaussianBlur in="SourceAlpha" stdDeviation="${blur}"/><feOffset dx="${dx}" dy="${dy}" result="offsetblur"/><feFlood flood-color="${color}"/><feComposite in2="offsetblur" operator="in"/><feComponentTransfer><feFuncA type="linear" slope="${opacity}"/></feComponentTransfer><feMerge><feMergeNode/><feMergeNode in="SourceGraphic"/></feMerge></filter>';return joint.util.template(b)({dx:a.dx||0,dy:a.dy||0,opacity:Number.isFinite(a.opacity)?a.opacity:1,color:a.color||"black",blur:Number.isFinite(a.blur)?a.blur:4})},grayscale:function(a){var b=Number.isFinite(a.amount)?a.amount:1;return joint.util.template('<filter><feColorMatrix type="matrix" values="${a} ${b} ${c} 0 0 ${d} ${e} ${f} 0 0 ${g} ${b} ${h} 0 0 0 0 0 1 0"/></filter>')({a:.2126+.7874*(1-b),b:.7152-.7152*(1-b),c:.0722-.0722*(1-b),d:.2126-.2126*(1-b),e:.7152+.2848*(1-b),f:.0722-.0722*(1-b),g:.2126-.2126*(1-b),h:.0722+.9278*(1-b)})},sepia:function(a){var b=Number.isFinite(a.amount)?a.amount:1;return joint.util.template('<filter><feColorMatrix type="matrix" values="${a} ${b} ${c} 0 0 ${d} ${e} ${f} 0 0 ${g} ${h} ${i} 0 0 0 0 0 1 0"/></filter>')({a:.393+.607*(1-b),b:.769-.769*(1-b),c:.189-.189*(1-b),d:.349-.349*(1-b),e:.686+.314*(1-b),f:.168-.168*(1-b),g:.272-.272*(1-b),h:.534-.534*(1-b),i:.131+.869*(1-b)})},saturate:function(a){var b=Number.isFinite(a.amount)?a.amount:1;return joint.util.template('<filter><feColorMatrix type="saturate" values="${amount}"/></filter>')({amount:1-b})},hueRotate:function(a){return joint.util.template('<filter><feColorMatrix type="hueRotate" values="${angle}"/></filter>')({angle:a.angle||0})},invert:function(a){var b=Number.isFinite(a.amount)?a.amount:1;return joint.util.template('<filter><feComponentTransfer><feFuncR type="table" tableValues="${amount} ${amount2}"/><feFuncG type="table" tableValues="${amount} ${amount2}"/><feFuncB type="table" tableValues="${amount} ${amount2}"/></feComponentTransfer></filter>')({amount:b,amount2:1-b})},brightness:function(a){return joint.util.template('<filter><feComponentTransfer><feFuncR type="linear" slope="${amount}"/><feFuncG type="linear" slope="${amount}"/><feFuncB type="linear" slope="${amount}"/></feComponentTransfer></filter>')({amount:Number.isFinite(a.amount)?a.amount:1}
56)},contrast:function(a){var b=Number.isFinite(a.amount)?a.amount:1;return joint.util.template('<filter><feComponentTransfer><feFuncR type="linear" slope="${amount}" intercept="${amount2}"/><feFuncG type="linear" slope="${amount}" intercept="${amount2}"/><feFuncB type="linear" slope="${amount}" intercept="${amount2}"/></feComponentTransfer></filter>')({amount:b,amount2:.5-b/2})}},format:{number:function(a,b,c){function d(a){for(var b=a.length,d=[],e=0,f=c.grouping[0];b>0&&f>0;)d.push(a.substring(b-=f,b+f)),f=c.grouping[e=(e+1)%c.grouping.length];return d.reverse().join(c.thousands)}c=c||{currency:["$",""],decimal:".",thousands:",",grouping:[3]};var e=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,f=e.exec(a),g=f[1]||" ",h=f[2]||">",i=f[3]||"",j=f[4]||"",k=f[5],l=+f[6],m=f[7],n=f[8],o=f[9],p=1,q="",r="",s=!1;switch(n&&(n=+n.substring(1)),(k||"0"===g&&"="===h)&&(k=g="0",h="=",m&&(l-=Math.floor((l-1)/4))),o){case"n":m=!0,o="g";break;case"%":p=100,r="%",o="f";break;case"p":p=100,r="%",o="r";break;case"b":case"o":case"x":case"X":"#"===j&&(q="0"+o.toLowerCase());break;case"c":case"d":s=!0,n=0;break;case"s":p=-1,o="r"}"$"===j&&(q=c.currency[0],r=c.currency[1]),"r"!=o||n||(o="g"),null!=n&&("g"==o?n=Math.max(1,Math.min(21,n)):"e"!=o&&"f"!=o||(n=Math.max(0,Math.min(20,n))));var t=k&&m;if(s&&b%1)return"";var u=b<0||0===b&&1/b<0?(b=-b,"-"):i,v=r;if(p<0){var w=this.prefix(b,n);b=w.scale(b),v=w.symbol+r}else b*=p;b=this.convert(o,b,n);var x=b.lastIndexOf("."),y=x<0?b:b.substring(0,x),z=x<0?"":c.decimal+b.substring(x+1);!k&&m&&c.grouping&&(y=d(y));var A=q.length+y.length+z.length+(t?0:u.length),B=A<l?new Array(A=l-A+1).join(g):"";return t&&(y=d(B+y)),u+=q,b=y+z,("<"===h?u+b+B:">"===h?B+u+b:"^"===h?B.substring(0,A>>=1)+u+b+B.substring(A):u+(t?b:B+b))+v},string:function(a,b){for(var c,d="{",e=!1,f=[];(c=a.indexOf(d))!==-1;){var g,h,i;if(g=a.slice(0,c),e){h=g.split(":"),i=h.shift().split("."),g=b;for(var j=0;j<i.length;j++)g=g[i[j]];h.length&&(g=this.number(h,g))}f.push(g),a=a.slice(c+1),e=!e,d=e?"}":"{"}return f.push(a),f.join("")},convert:function(a,b,c){switch(a){case"b":return b.toString(2);case"c":return String.fromCharCode(b);case"o":return b.toString(8);case"x":return b.toString(16);case"X":return b.toString(16).toUpperCase();case"g":return b.toPrecision(c);case"e":return b.toExponential(c);case"f":return b.toFixed(c);case"r":return(b=this.round(b,this.precision(b,c))).toFixed(Math.max(0,Math.min(20,this.precision(b*(1+1e-15),c))));default:return b+""}},round:function(a,b){return b?Math.round(a*(b=Math.pow(10,b)))/b:Math.round(a)},precision:function(a,b){return b-(a?Math.ceil(Math.log(a)/Math.LN10):1)},prefix:function(a,b){var c=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map(function(a,b){var c=Math.pow(10,3*Math.abs(8-b));return{scale:b>8?function(a){return a/c}:function(a){return a*c},symbol:a}}),d=0;return a&&(a<0&&(a*=-1),b&&(a=this.round(a,this.precision(a,b))),d=1+Math.floor(1e-12+Math.log(a)/Math.LN10),d=Math.max(-24,Math.min(24,3*Math.floor((d<=0?d+1:d-1)/3)))),c[8+d/3]}},template:function(a){var b=/<%= ([^ ]+) %>|\$\{ ?([^{} ]+) ?\}|\{\{([^{} ]+)\}\}/g;return function(c){return c=c||{},a.replace(b,function(a){for(var b=Array.from(arguments),d=b.slice(1,4).find(function(a){return!!a}),e=d.split("."),f=c[e.shift()];void 0!==f&&e.length;)f=f[e.shift()];return void 0!==f?f:""})}},toggleFullScreen:function(a){function b(a,b){for(var c=["webkit","moz","ms","o",""],d=0;d<c.length;d++){var e=c[d],f=e?e+b:b.substr(0,1).toLowerCase()+b.substr(1);if(void 0!==a[f])return joint.util.isFunction(a[f])?a[f]():a[f]}}var c=window.top.document;a=a||c.body,b(c,"FullscreenElement")||b(c,"FullScreenElement")?b(c,"ExitFullscreen")||b(c,"CancelFullScreen"):b(a,"RequestFullscreen")||b(a,"RequestFullScreen")},addClassNamePrefix:function(a){return a?a.toString().split(" ").map(function(a){return a.substr(0,joint.config.classNamePrefix.length)!==joint.config.classNamePrefix&&(a=joint.config.classNamePrefix+a),a}).join(" "):a},removeClassNamePrefix:function(a){return a?a.toString().split(" ").map(function(a){return a.substr(0,joint.config.classNamePrefix.length)===joint.config.classNamePrefix&&(a=a.substr(joint.config.classNamePrefix.length)),a}).join(" "):a},wrapWith:function(a,b,c){if(joint.util.isString(c)){if(!joint.util.wrappers[c])throw new Error('Unknown wrapper: "'+c+'"');c=joint.util.wrappers[c]}if(!joint.util.isFunction(c))throw new Error("Wrapper must be a function.");this.toArray(b).forEach(function(b){a[b]=c(a[b])})},wrappers:{cells:function(a){return function(){var b=Array.from(arguments),c=b.length,d=c>0&&b[0]||[],e=c>1&&b[c-1]||{};
56return Array.isArray(d)||(e instanceof joint.dia.Cell?d=b:d instanceof joint.dia.Cell&&(b.length>1&&b.pop(),d=b)),e instanceof joint.dia.Cell&&(e={}),a.call(this,d,e)}}},parseDOMJSON:function(a,b){for(var c={},d=V.namespace.xmlns,e=b||d,f=document.createDocumentFragment(),g=[a,f,e];g.length>0;){e=g.pop();for(var h=g.pop(),i=g.pop(),j=0,k=i.length;j<k;j++){var l=i[j];if(!l.hasOwnProperty("tagName"))throw new Error("json-dom-parser: missing tagName");var m=l.tagName;l.hasOwnProperty("namespaceURI")&&(e=l.namespaceURI);var n=document.createElementNS(e,m),o=e===d,p=o?V:$,q=l.attributes;q&&p(n).attr(q);var r=l.style;if(r&&$(n).css(r),l.hasOwnProperty("className")){var s=l.className;o?n.className.baseVal=s:n.className=s}if(l.hasOwnProperty("selector")){var t=l.selector;if(c[t])throw new Error("json-dom-parser: selector must be unique");c[t]=n,p(n).attr("joint-selector",t)}h.appendChild(n);var u=l.children;Array.isArray(u)&&g.push(u,n,e)}}return{fragment:f,selectors:c}},mixin:_.assign,supplement:_.defaults,deepMixin:_.mixin,deepSupplement:_.defaultsDeep,sortedIndex:_.sortedIndexBy||_.sortedIndex,uniq:_.uniqBy||_.uniq,uniqueId:_.uniqueId,sortBy:_.sortBy,isFunction:_.isFunction,result:_.result,union:_.union,invoke:_.invokeMap||_.invoke,difference:_.difference,intersection:_.intersection,omit:_.omit,pick:_.pick,has:_.has,bindAll:_.bindAll,assign:_.assign,defaults:_.defaults,defaultsDeep:_.defaultsDeep,isPlainObject:_.isPlainObject,isEmpty:_.isEmpty,isEqual:_.isEqual,cloneDeep:_.cloneDeep,toArray:_.toArray,flattenDeep:_.flattenDeep,camelCase:_.camelCase,groupBy:_.groupBy,forIn:_.forIn,without:_.without,debounce:_.debounce,clone:_.clone,merge:function(){if(_.mergeWith){var a=Array.from(arguments),b=a[a.length-1],c=this.isFunction(b)?b:this.noop;return a.push(function(a,b){var d=c(a,b);return void 0!==d?d:Array.isArray(a)&&!Array.isArray(b)?b:void 0}),_.mergeWith.apply(this,a)}return _.merge.apply(this,arguments)},noop:function(){},isBoolean:function(a){var b=Object.prototype.toString;return a===!0||a===!1||!!a&&"object"==typeof a&&"[object Boolean]"===b.call(a)},isObject:function(a){return!!a&&("object"==typeof a||"function"==typeof a)},isNumber:function(a){var b=Object.prototype.toString;return"number"==typeof a||!!a&&"object"==typeof a&&"[object Number]"===b.call(a)},isString:function(a){var b=Object.prototype.toString;return"string"==typeof a||!!a&&"object"==typeof a&&"[object String]"===b.call(a)}}};joint.mvc.View=Backbone.View.extend({options:{},theme:null,themeClassNamePrefix:joint.util.addClassNamePrefix("theme-"),requireSetThemeOverride:!1,defaultTheme:joint.config.defaultTheme,children:null,childNodes:null,constructor:function(a){this.requireSetThemeOverride=a&&!!a.theme,this.options=joint.util.assign({},this.options,a),Backbone.View.call(this,a)},initialize:function(a){joint.util.bindAll(this,"setTheme","onSetTheme","remove","onRemove"),joint.mvc.views[this.cid]=this,this.setTheme(this.options.theme||this.defaultTheme),this.init()},renderChildren:function(a){if(a||(a=this.children),a){var b=V.namespace[this.svgElement?"xmlns":"xhtml"],c=joint.util.parseDOMJSON(a,b);this.vel.empty().append(c.fragment),this.childNodes=c.selectors}return this},_ensureElement:function(){if(this.el)this.setElement(joint.util.result(this,"el"));else{var a=joint.util.result(this,"tagName"),b=joint.util.assign({},joint.util.result(this,"attributes"));this.id&&(b.id=joint.util.result(this,"id")),this.setElement(this._createElement(a)),this._setAttributes(b)}this._ensureElClassName()},_setAttributes:function(a){this.svgElement?this.vel.attr(a):this.$el.attr(a)},_createElement:function(a){return this.svgElement?document.createElementNS(V.namespace.xmlns,a):document.createElement(a)},_setElement:function(a){this.$el=a instanceof Backbone.$?a:Backbone.$(a),this.el=this.$el[0],this.svgElement&&(this.vel=V(this.el))},_ensureElClassName:function(){var a=joint.util.result(this,"className"),b=joint.util.addClassNamePrefix(a);this.svgElement?this.vel.removeClass(a).addClass(b):this.$el.removeClass(a).addClass(b)},init:function(){},onRender:function(){},setTheme:function(a,b){return b=b||{},this.theme&&this.requireSetThemeOverride&&!b.override?this:(this.removeThemeClassName(),this.addThemeClassName(a),this.onSetTheme(this.theme,a),this.theme=a,this)},addThemeClassName:function(a){a=a||this.theme;var b=this.themeClassNamePrefix+a;return this.svgElement?this.vel.addClass(b):this.$el.addClass(b),this},removeThemeClassName:function(a){a=a||this.theme;var b=this.themeClassNamePrefix+a;return this.svgElement?this.vel.removeClass(b):this.$el.removeClass(b),this},onSetTheme:function(a,b){},remove:function(){return this.onRemove(),this.undelegateDocumentEvents(),joint.mvc.views[this.cid]=null,Backbone.View.prototype.remove.apply(this,arguments),this},onRemove:function(){},getEventNamespace:function(){return".joint-event-ns-"+this.cid},delegateElementEvents:function(a,b,c){if(!b)return this;c||(c={});var d=this.getEventNamespace();for(var e in b){var f=b[e];"function"!=typeof f&&(f=this[f]),f&&$(a).on(e+d,c,f.bind(this))}return this},undelegateElementEvents:function(a){return $(a).off(this.getEventNamespace()),this},delegateDocumentEvents:function(a,b){return a||(a=joint.util.result(this,"documentEvents")),this.delegateElementEvents(document,a,b)},undelegateDocumentEvents:function(){return this.undelegateElementEvents(document)},eventData:function(a,b){if(!a)throw new Error("eventData(): event object required.");var c=a.data,d="__"+this.cid+"__";return void 0===b?c?c[d]||{}:{}:(c||(c=a.data={}),c[d]||(c[d]={}),joint.util.assign(c[d],b),this)}},{extend:function(){var a=Array.from(arguments),b=a[0]&&joint.util.assign({},a[0])||{},c=a[1]&&joint.util.assign({},a[1])||{},d=b.render||this.prototype&&this.prototype.render||null;return b.render=function(){return d&&d.apply(this,arguments),this.onRender(),this},Backbone.View.extend.call(this,b,c)}}),joint.dia.GraphCells=Backbone.Collection.extend({cellNamespace:joint.shapes,initialize:function(a,b){b.cellNamespace&&(this.cellNamespace=b.cellNamespace),this.graph=b.graph},model:function(a,b){var c=b.collection,d=c.cellNamespace,e="link"===a.type?joint.dia.Link:joint.util.getByPath(d,a.type,".")||joint.dia.Element,f=new e(a,b);return b.dry||(f.graph=c.graph),f}
56,comparator:function(a){return a.get("z")||0}}),joint.dia.Graph=Backbone.Model.extend({_batches:{},initialize:function(a,b){b=b||{};var c=new joint.dia.GraphCells([],{model:b.cellModel,cellNamespace:b.cellNamespace,graph:this});Backbone.Model.prototype.set.call(this,"cells",c),c.on("all",this.trigger,this),this.on("change:z",this._sortOnChangeZ,this),this._out={},this._in={},this._nodes={},this._edges={},c.on("add",this._restructureOnAdd,this),c.on("remove",this._restructureOnRemove,this),c.on("reset",this._restructureOnReset,this),c.on("change:source",this._restructureOnChangeSource,this),c.on("change:target",this._restructureOnChangeTarget,this),c.on("remove",this._removeCell,this)},_sortOnChangeZ:function(){this.get("cells").sort()},_restructureOnAdd:function(a){if(a.isLink()){this._edges[a.id]=!0;var b=a.source(),c=a.target();b.id&&((this._out[b.id]||(this._out[b.id]={}))[a.id]=!0),c.id&&((this._in[c.id]||(this._in[c.id]={}))[a.id]=!0)}else this._nodes[a.id]=!0},_restructureOnRemove:function(a){if(a.isLink()){delete this._edges[a.id];var b=a.source(),c=a.target();b.id&&this._out[b.id]&&this._out[b.id][a.id]&&delete this._out[b.id][a.id],c.id&&this._in[c.id]&&this._in[c.id][a.id]&&delete this._in[c.id][a.id]}else delete this._nodes[a.id]},_restructureOnReset:function(a){a=a.models,this._out={},this._in={},this._nodes={},this._edges={},a.forEach(this._restructureOnAdd,this)},_restructureOnChangeSource:function(a){var b=a.previous("source");b.id&&this._out[b.id]&&delete this._out[b.id][a.id];var c=a.source();c.id&&((this._out[c.id]||(this._out[c.id]={}))[a.id]=!0)},_restructureOnChangeTarget:function(a){var b=a.previous("target");b.id&&this._in[b.id]&&delete this._in[b.id][a.id];var c=a.get("target");c.id&&((this._in[c.id]||(this._in[c.id]={}))[a.id]=!0)},getOutboundEdges:function(a){return this._out&&this._out[a]||{}},getInboundEdges:function(a){return this._in&&this._in[a]||{}},toJSON:function(){var a=Backbone.Model.prototype.toJSON.apply(this,arguments);return a.cells=this.get("cells").toJSON(),a},fromJSON:function(a,b){if(!a.cells)throw new Error("Graph JSON must contain cells array.");return this.set(a,b)},set:function(a,b,c){var d;return"object"==typeof a?(d=a,c=b):(d={})[a]=b,d.hasOwnProperty("cells")&&(this.resetCells(d.cells,c),d=joint.util.omit(d,"cells")),Backbone.Model.prototype.set.call(this,d,c)},clear:function(a){a=joint.util.assign({},a,{clear:!0});var b=this.get("cells");if(0===b.length)return this;this.startBatch("clear",a);var c=b.sortBy(function(a){return a.isLink()?1:2});do c.shift().remove(a);while(c.length>0);return this.stopBatch("clear"),this},_prepareCell:function(a,b){var c;if(a instanceof Backbone.Model?(c=a.attributes,a.graph||b&&b.dry||(a.graph=this)):c=a,!joint.util.isString(c.type))throw new TypeError("dia.Graph: cell type must be a string.");return a},minZIndex:function(){var a=this.get("cells").first();return a?a.get("z")||0:0},maxZIndex:function(){var a=this.get("cells").last();return a?a.get("z")||0:0},addCell:function(a,b){return Array.isArray(a)?this.addCells(a,b):(a instanceof Backbone.Model?a.has("z")||a.set("z",this.maxZIndex()+1):void 0===a.z&&(a.z=this.maxZIndex()+1),this.get("cells").add(this._prepareCell(a,b),b||{}),this)},addCells:function(a,b){return a.length&&(a=joint.util.flattenDeep(a),b.position=a.length,this.startBatch("add"),a.forEach(function(a){b.position--,this.addCell(a,b)},this),this.stopBatch("add")),this},resetCells:function(a,b){var c=joint.util.toArray(a).map(function(a){return this._prepareCell(a,b)},this);return this.get("cells").reset(c,b),this},removeCells:function(a,b){return a.length&&(this.startBatch("remove"),joint.util.invoke(a,"remove",b),this.stopBatch("remove")),this},_removeCell:function(a,b,c){c=c||{},c.clear||(c.disconnectLinks?this.disconnectLinks(a,c):this.removeLinks(a,c)),this.get("cells").remove(a,{silent:!0}),a.graph===this&&(a.graph=null)},getCell:function(a){return this.get("cells").get(a)},getCells:function(){return this.get("cells").toArray()},getElements:function(){return Object.keys(this._nodes).map(this.getCell,this)},getLinks:function(){return Object.keys(this._edges).map(this.getCell,this)},getFirstCell:function(){return this.get("cells").first()},getLastCell:function(){return this.get("cells").last()},getConnectedLinks:function(a,b){b=b||{};var c=b.inbound,d=b.outbound;void 0===c&&void 0===d&&(c=d=!0);var e=[],f={};if(d&&joint.util.forIn(this.getOutboundEdges(a.id),function(a,b){f[b]||(e.push(this.getCell(b)),f[b]=!0)}.bind(this)),c&&joint.util.forIn(this.getInboundEdges(a.id),function(a,b){f[b]||(e.push(this.getCell(b)),f[b]=!0)}.bind(this)),b.deep){var g=a.getEmbeddedCells({deep:!0}),h={};
56g.forEach(function(a){a.isElement()&&(h[a.id]=!0)}),g.forEach(function(a){a.isLink()||(d&&joint.util.forIn(this.getOutboundEdges(a.id),function(a,c){if(!f[c]){var d=this.getCell(c),g=d.source().id,i=d.target().id;if(!b.includeEnclosed&&g&&h[g]&&i&&h[i])return;e.push(this.getCell(c)),f[c]=!0}}.bind(this)),c&&joint.util.forIn(this.getInboundEdges(a.id),function(a,c){if(!f[c]){var d=this.getCell(c),g=d.source().id,i=d.target().id;if(!b.includeEnclosed&&g&&h[g]&&i&&h[i])return;e.push(this.getCell(c)),f[c]=!0}}.bind(this)))},this)}return e},getNeighbors:function(a,b){b=b||{};var c=b.inbound,d=b.outbound;void 0===c&&void 0===d&&(c=d=!0);var e=this.getConnectedLinks(a,b).reduce(function(e,f){var g=f.source(),h=f.target(),i=f.hasLoop(b);if(c&&joint.util.has(g,"id")&&!e[g.id]){var j=this.getCell(g.id);!i&&(!j||j===a||b.deep&&j.isEmbeddedIn(a))||(e[g.id]=j)}if(d&&joint.util.has(h,"id")&&!e[h.id]){var k=this.getCell(h.id);!i&&(!k||k===a||b.deep&&k.isEmbeddedIn(a))||(e[h.id]=k)}return e}.bind(this),{});return joint.util.toArray(e)},getCommonAncestor:function(){var a=Array.from(arguments).map(function(a){for(var b=[],c=a.get("parent");c;)b.push(c),c=this.getCell(c).get("parent");return b},this);a=a.sort(function(a,b){return a.length-b.length});var b=joint.util.toArray(a.shift()).find(function(b){return a.every(function(a){return a.includes(b)})});return this.getCell(b)},getSuccessors:function(a,b){b=b||{};var c=[];return this.search(a,function(b){b!==a&&c.push(b)},joint.util.assign({},b,{outbound:!0})),c},cloneCells:function(a){a=joint.util.uniq(a);var b=joint.util.toArray(a).reduce(function(a,b){return a[b.id]=b.clone(),a},{});return joint.util.toArray(a).forEach(function(a){var c=b[a.id];if(c.isLink()){var d=c.source(),e=c.target();d.id&&b[d.id]&&c.prop("source/id",b[d.id].id),e.id&&b[e.id]&&c.prop("target/id",b[e.id].id)}var f=a.get("parent");f&&b[f]&&c.set("parent",b[f].id);var g=joint.util.toArray(a.get("embeds")).reduce(function(a,c){return b[c]&&a.push(b[c].id),a},[]);joint.util.isEmpty(g)||c.set("embeds",g)}),b},cloneSubgraph:function(a,b){var c=this.getSubgraph(a,b);return this.cloneCells(c)},getSubgraph:function(a,b){b=b||{};var c=[],d={},e=[],f=[];return joint.util.toArray(a).forEach(function(a){if(d[a.id]||(c.push(a),d[a.id]=a,a.isLink()?f.push(a):e.push(a)),b.deep){var g=a.getEmbeddedCells({deep:!0});g.forEach(function(a){d[a.id]||(c.push(a),d[a.id]=a,a.isLink()?f.push(a):e.push(a))})}}),f.forEach(function(a){var b=a.source(),f=a.target();
57if(b.id&&!d[b.id]){var g=this.getCell(b.id);c.push(g),d[g.id]=g,e.push(g)}if(f.id&&!d[f.id]){var h=this.getCell(f.id);c.push(this.getCell(f.id)),d[h.id]=h,e.push(h)}},this),e.forEach(function(a){var e=this.getConnectedLinks(a,b);e.forEach(function(a){var b=a.source(),e=a.target();!d[a.id]&&b.id&&d[b.id]&&e.id&&d[e.id]&&(c.push(a),d[a.id]=a)})},this),c},getPredecessors:function(a,b){b=b||{};var c=[];return this.search(a,function(b){b!==a&&c.push(b)},joint.util.assign({},b,{inbound:!0})),c},search:function(a,b,c){c=c||{},c.breadthFirst?this.bfs(a,b,c):this.dfs(a,b,c)},bfs:function(a,b,c){c=c||{};var d={},e={},f=[];for(f.push(a),e[a.id]=0;f.length>0;){var g=f.shift();if(!d[g.id]){if(d[g.id]=!0,b(g,e[g.id])===!1)return;this.getNeighbors(g,c).forEach(function(a){e[a.id]=e[g.id]+1,f.push(a)})}}},dfs:function(a,b,c,d,e){c=c||{};var f=d||{},g=e||0;b(a,g)!==!1&&(f[a.id]=!0,this.getNeighbors(a,c).forEach(function(a){f[a.id]||this.dfs(a,b,c,f,g+1)},this))},getSources:function(){var a=[];return joint.util.forIn(this._nodes,function(b,c){this._in[c]&&!joint.util.isEmpty(this._in[c])||a.push(this.getCell(c))}.bind(this)),a},getSinks:function(){var a=[];return joint.util.forIn(this._nodes,function(b,c){this._out[c]&&!joint.util.isEmpty(this._out[c])||a.push(this.getCell(c))}.bind(this)),a},isSource:function(a){return!this._in[a.id]||joint.util.isEmpty(this._in[a.id])},isSink:function(a){return!this._out[a.id]||joint.util.isEmpty(this._out[a.id])},isSuccessor:function(a,b){var c=!1;return this.search(a,function(d){if(d===b&&d!==a)return c=!0,!1},{outbound:!0}),c},isPredecessor:function(a,b){var c=!1;return this.search(a,function(d){if(d===b&&d!==a)return c=!0,!1},{inbound:!0}),c},isNeighbor:function(a,b,c){c=c||{};var d=c.inbound,e=c.outbound;void 0===d&&void 0===e&&(d=e=!0);var f=!1;
57return this.getConnectedLinks(a,c).forEach(function(a){var c=a.source(),g=a.target();return d&&joint.util.has(c,"id")&&c.id===b.id?(f=!0,!1):e&&joint.util.has(g,"id")&&g.id===b.id?(f=!0,!1):void 0}),f},disconnectLinks:function(a,b){this.getConnectedLinks(a).forEach(function(c){c.set(c.source().id===a.id?"source":"target",{x:0,y:0},b)})},removeLinks:function(a,b){joint.util.invoke(this.getConnectedLinks(a),"remove",b)},findModelsFromPoint:function(a){return this.getElements().filter(function(b){return b.getBBox().containsPoint(a)})},findModelsInArea:function(a,b){a=g.rect(a),b=joint.util.defaults(b||{},{strict:!1});var c=b.strict?"containsRect":"intersect";return this.getElements().filter(function(b){return a[c](b.getBBox())})},findModelsUnderElement:function(a,b){b=joint.util.defaults(b||{},{searchBy:"bbox"});var c=a.getBBox(),d="bbox"===b.searchBy?this.findModelsInArea(c):this.findModelsFromPoint(c[b.searchBy]());return d.filter(function(b){return a.id!==b.id&&!b.isEmbeddedIn(a)})},getBBox:function(a,b){return this.getCellsBBox(a||this.getElements(),b)},getCellsBBox:function(a,b){return joint.util.toArray(a).reduce(function(a,c){return c.isLink()?a:a?a.union(c.getBBox(b)):c.getBBox(b)},null)},translate:function(a,b,c){var d=this.getCells().filter(function(a){return!a.isEmbedded()});return joint.util.invoke(d,"translate",a,b,c),this},resize:function(a,b,c){return this.resizeCells(a,b,this.getCells(),c)},resizeCells:function(a,b,c,d){var e=this.getCellsBBox(c);if(e){var f=Math.max(a/e.width,0),g=Math.max(b/e.height,0);joint.util.invoke(c,"scale",f,g,e.origin(),d)}return this},startBatch:function(a,b){return b=b||{},this._batches[a]=(this._batches[a]||0)+1,this.trigger("batch:start",joint.util.assign({},b,{batchName:a}))},stopBatch:function(a,b){return b=b||{},this._batches[a]=(this._batches[a]||0)-1,this.trigger("batch:stop",joint.util.assign({},b,{batchName:a}))},hasActiveBatch:function(a){return 0===arguments.length?joint.util.toArray(this._batches).some(function(a){return a>0}):Array.isArray(a)?a.some(function(a){return!!this._batches[a]},this):!!this._batches[a]}},{validations:{multiLinks:function(a,b){var c=b.source(),d=b.target();if(c.id&&d.id){var e=b.getSourceElement();if(e){var f=a.getConnectedLinks(e,{outbound:!0}),g=f.filter(function(a){var b=a.source(),e=a.target();return b&&b.id===c.id&&(!b.port||b.port===c.port)&&e&&e.id===d.id&&(!e.port||e.port===d.port)});if(g.length>1)return!1}}return!0},linkPinning:function(a,b){return b.source().id&&b.target().id}}}),joint.util.wrapWith(joint.dia.Graph.prototype,["resetCells","addCells","removeCells"],"cells"),function(a,b,c,d,e){function f(a,b){return function(c,d){var f=e.isPercentage(c);c=parseFloat(c),f&&(c/=100);var g={};if(isFinite(c)){var h=f||c>=0&&c<=1?c*d[b]:Math.max(c+d[b],0);g[a]=h}return g}}function g(a,b,d){return function(f,g){var h=e.isPercentage(f);f=parseFloat(f),h&&(f/=100);var i;if(isFinite(f)){var j=g[d]();i=h||f>0&&f<1?j[a]+g[b]*f:j[a]+f}var k=c.Point();return k[a]=i||0,k}}function h(a,b,d){return function(f,g){var h;h="middle"===f?g[b]/2:f===d?g[b]:isFinite(f)?f>-1&&f<1?-g[b]*f:-f:e.isPercentage(f)?g[b]*parseFloat(f)/100:0;var i=c.Point();return i[a]=-(g[a]+h),i}}function i(a,b){var c="joint-shape",e=b&&b.resetOffset;return function(b,f,g){var h=d(g),i=h.data(c);if(!i||i.value!==b){var j=a(b);i={value:b,shape:j,shapeBBox:j.bbox()},h.data(c,i)}var k=i.shape.clone(),l=i.shapeBBox.clone(),m=l.origin(),n=f.origin();l.x=n.x,l.y=n.y;var o=f.maxRectScaleToFit(l,n),p=0===l.width||0===f.width?1:o.sx,q=0===l.height||0===f.height?1:o.sy;return k.scale(p,q,m),e&&k.translate(-m.x,-m.y),k}}function j(a){function d(a){return new c.Path(b.normalizePathData(a))}var e=i(d,a);return function(a,b,c){var d=e(a,b,c);return{d:d.serialize()}}}function k(a){var b=i(c.Polyline,a);return function(a,c,d){var e=b(a,c,d);return{points:e.serialize()}}}function l(a,b){var d=new c.Point(1,0);return function(c){var e,f,g=this[a](c);return g?(f=b.rotate?g.vector().vectorAngle(d):0,e=g.start):(e=this.path.start,f=0),0===f?{transform:"translate("+e.x+","+e.y+")"}:{transform:"translate("+e.x+","+e.y+") rotate("+f+")"}}}function m(a,b,c){return void 0!==c.text}function n(){return this instanceof a.dia.LinkView}function o(a){var b={},c=a.stroke;"string"==typeof c&&(b.stroke=c,b.fill=c);var d=a.strokeOpacity;return void 0===d&&(d=a["stroke-opacity"]),void 0===d&&(d=a.opacity),void 0!==d&&(b["stroke-opacity"]=d,b["fill-opacity"]=d),b}var p=a.dia.attributes={xlinkHref:{set:"xlink:href"},xlinkShow:{set:"xlink:show"},xlinkRole:{set:"xlink:role"},xlinkType:{set:"xlink:type"},xlinkArcrole:{set:"xlink:arcrole"},xlinkTitle:{set:"xlink:title"},xlinkActuate:{set:"xlink:actuate"},xmlSpace:{set:"xml:space"},xmlBase:{set:"xml:base"},xmlLang:{set:"xml:lang"},preserveAspectRatio:{set:"preserveAspectRatio"},requiredExtension:{set:"requiredExtension"},requiredFeatures:{set:"requiredFeatures"},systemLanguage:{set:"systemLanguage"},externalResourcesRequired:{set:"externalResourceRequired"}
57,filter:{qualify:e.isPlainObject,set:function(a){return"url(#"+this.paper.defineFilter(a)+")"}},fill:{qualify:e.isPlainObject,set:function(a){return"url(#"+this.paper.defineGradient(a)+")"}},stroke:{qualify:e.isPlainObject,set:function(a){return"url(#"+this.paper.defineGradient(a)+")"}},sourceMarker:{qualify:e.isPlainObject,set:function(a,b,c,d){return a=e.assign(o(d),a),{"marker-start":"url(#"+this.paper.defineMarker(a)+")"}}},targetMarker:{qualify:e.isPlainObject,set:function(a,b,c,d){return a=e.assign(o(d),{transform:"rotate(180)"},a),{"marker-end":"url(#"+this.paper.defineMarker(a)+")"}}},vertexMarker:{qualify:e.isPlainObject,set:function(a,b,c,d){return a=e.assign(o(d),a),{"marker-mid":"url(#"+this.paper.defineMarker(a)+")"}}},text:{qualify:function(a,b,c){return!c.textWrap||!e.isPlainObject(c.textWrap)},set:function(c,f,g,h){var i=d(g),j="joint-text",k=i.data(j),l=a.util.pick(h,"lineHeight","annotations","textPath","x","textVerticalAnchor","eol"),m=l.fontSize=h["font-size"]||h.fontSize,n=JSON.stringify([c,l]);if(void 0===k||k!==n){m&&g.setAttribute("font-size",m);var o=l.textPath;if(e.isObject(o)){var p=o.selector;if("string"==typeof p){var q=this.findBySelector(p)[0];q instanceof SVGPathElement&&(l.textPath=e.assign({"xlink:href":"#"+q.id},o))}}b(g).text(""+c,l),i.data(j,n)}}},textWrap:{qualify:e.isPlainObject,set:function(b,c,d,f){var g=b.width||0;e.isPercentage(g)?c.width*=parseFloat(g)/100:g<=0?c.width+=g:c.width=g;var h=b.height||0;e.isPercentage(h)?c.height*=parseFloat(h)/100:h<=0?c.height+=h:c.height=h;var i,j=b.text;void 0===j&&(j=f.text),i=void 0!==j?a.util.breakText(""+j,c,{"font-weight":f["font-weight"]||f.fontWeight,"font-size":f["font-size"]||f.fontSize,"font-family":f["font-family"]||f.fontFamily,lineHeight:f.lineHeight},{svgDocument:this.paper.svg}):"",a.dia.attributes.text.set.call(this,i,c,d,f)}},title:{qualify:function(a,b){return b instanceof SVGElement},set:function(a,b,c){var e=d(c),f="joint-title",g=e.data(f);if(void 0===g||g!==a){e.data(f,a);var h=c.firstChild;if(h&&"TITLE"===h.tagName.toUpperCase())h.textContent=a;else{var i=document.createElementNS(c.namespaceURI,"title");i.textContent=a,c.insertBefore(i,h)}}}},lineHeight:{qualify:m},textVerticalAnchor:{qualify:m},textPath:{qualify:m},annotations:{qualify:m},port:{set:function(a){return null===a||void 0===a.id?a:a.id}},style:{qualify:e.isPlainObject,set:function(a,b,c){d(c).css(a)}},html:{set:function(a,b,c){d(c).html(a+"")}},ref:{},refX:{position:g("x","width","origin")},refY:{position:g("y","height","origin")},refDx:{position:g("x","width","corner")},refDy:{position:g("y","height","corner")},refWidth:{set:f("width","width")},refHeight:{set:f("height","height")},refRx:{set:f("rx","width")},refRy:{set:f("ry","height")},refRInscribed:{set:function(a){var b=f(a,"width"),c=f(a,"height");return function(a,d){var e=d.height>d.width?b:c;return e(a,d)}}("r")},refRCircumscribed:{set:function(a,b){var c=e.isPercentage(a);a=parseFloat(a),c&&(a/=100);var d,f=Math.sqrt(b.height*b.height+b.width*b.width);return isFinite(a)&&(d=c||a>=0&&a<=1?a*f:Math.max(a+f,0)),{r:d}}},refCx:{set:f("cx","width")},refCy:{set:f("cy","height")},xAlignment:{offset:h("x","width","right")},yAlignment:{offset:h("y","height","bottom")},resetOffset:{offset:function(a,b){return a?{x:-b.x,y:-b.y}:{x:0,y:0}}},refDResetOffset:{set:j({resetOffset:!0})},refDKeepOffset:{set:j({resetOffset:!1})},refPointsResetOffset:{set:k({resetOffset:!0})},refPointsKeepOffset:{set:k({resetOffset:!1})},connection:{qualify:n,set:function(){return{d:this.getSerializedConnection()}}},atConnectionLengthKeepGradient:{qualify:n,set:l("getTangentAtLength",{rotate:!0})},atConnectionLengthIgnoreGradient:{qualify:n,set:l("getTangentAtLength",{rotate:!1})},atConnectionRatioKeepGradient:{qualify:n,set:l("getTangentAtRatio",{rotate:!0})},atConnectionRatioIgnoreGradient:{qualify:n,set:l("getTangentAtRatio",{rotate:!1})}};p.refR=p.refRInscribed,p.refD=p.refDResetOffset,p.refPoints=p.refPointsResetOffset,p.atConnectionLength=p.atConnectionLengthKeepGradient,p.atConnectionRatio=p.atConnectionRatioKeepGradient,p.refX2=p.refX,p.refY2=p.refY,p["ref-x"]=p.refX,p["ref
57-y"]=p.refY,p["ref-dy"]=p.refDy,p["ref-dx"]=p.refDx,p["ref-width"]=p.refWidth,p["ref-height"]=p.refHeight,p["x-alignment"]=p.xAlignment,p["y-alignment"]=p.yAlignment}(joint,V,g,$,joint.util),function(a,b){var c=a.mvc.View.extend({name:null,tagName:"g",className:"tool",svgElement:!0,_visible:!0,init:function(){var a=this.name;a&&this.vel.attr("data-tool-name",a)},configure:function(a,b){return this.relatedView=a,this.paper=a.paper,this.parentView=b,this.simulateRelatedView(this.el),this},simulateRelatedView:function(a){a&&a.setAttribute("model-id",this.relatedView.model.id)},getName:function(){return this.name},show:function(){this.el.style.display="",this._visible=!0},hide:function(){this.el.style.display="none",this._visible=!1},isVisible:function(){return!!this._visible},focus:function(){var a=this.options.focusOpacity;isFinite(a)&&(this.el.style.opacity=a),this.parentView.focusTool(this)},blur:function(){this.el.style.opacity="",this.parentView.blurTool(this)},update:function(){}}),d=a.mvc.View.extend({tagName:"g",className:"tools",svgElement:!0,tools:null,options:{tools:null,relatedView:null,name:null,component:!1},configure:function(d){d=b.assign(this.options,d);var e=d.tools;if(!Array.isArray(e))return this;var f=d.relatedView;if(!(f instanceof a.dia.CellView))return this;for(var g=this.tools=[],h=0,i=e.length;h<i;h++){var j=e[h];j instanceof c&&(j.configure(f,this),j.render(),this.vel.append(j.el),g.push(j))}return this},getName:function(){return this.options.name},update:function(a){a||(a={});var b=this.tools;if(b){for(var c=0,d=b.length;c<d;c++){var e=b[c];a.tool!==e.cid&&e.isVisible()&&e.update()}return this}},focusTool:function(a){var b=this.tools;if(!b)return this;for(var c=0,d=b.length;c<d;c++){var e=b[c];a===e?e.show():e.hide()}return this},blurTool:function(a){var b=this.tools;if(!b)return this;for(var c=0,d=b.length;c<d;c++){var e=b[c];e===a||e.isVisible()||(e.show(),e.update())}return this},hide:function(){return this.focusTool(null)},show:function(){return this.blurTool(null)},onRemove:function(){var a=this.tools;if(!a)return this;for(var b=0,c=a.length;b<c;b++)a[b].remove();this.tools=null},mount:function(){var a=this.options,b=a.relatedView;if(b){var c=a.component?b.el:b.paper.tools;c.appendChild(this.el)}return this}});a.dia.ToolsView=d,a.dia.ToolView=c}(joint,joint.util),joint.dia.Cell=Backbone.Model.extend({constructor:function(a,b){var c,d=a||{};this.cid=joint.util.uniqueId("c"),this.attributes={},b&&b.collection&&(this.collection=b.collection),b&&b.parse&&(d=this.parse(d,b)||{}),(c=joint.util.result(this,"defaults"))&&(d=joint.util.merge({},c,d)),this.set(d,b),this.changed={},this.initialize.apply(this,arguments)}
57,translate:function(a,b,c){throw new Error("Must define a translate() method.")},toJSON:function(){var a=this.constructor.prototype.defaults.attrs||{},b=this.attributes.attrs,c={};joint.util.forIn(b,function(b,d){var e=a[d];joint.util.forIn(b,function(a,b){joint.util.isObject(a)&&!Array.isArray(a)?joint.util.forIn(a,function(a,f){e&&e[b]&&joint.util.isEqual(e[b][f],a)||(c[d]=c[d]||{},(c[d][b]||(c[d][b]={}))[f]=a)}):e&&joint.util.isEqual(e[b],a)||(c[d]=c[d]||{},c[d][b]=a)})});var d=joint.util.cloneDeep(joint.util.omit(this.attributes,"attrs"));return d.attrs=c,d},initialize:function(a){a&&a.id||this.set("id",joint.util.uuid(),{silent:!0}),this._transitionIds={},this.processPorts(),this.on("change:attrs",this.processPorts,this)},processPorts:function(){var a=this.ports,b={};joint.util.forIn(this.get("attrs"),function(a,c){a&&a.port&&(void 0!==a.port.id?b[a.port.id]=a.port:b[a.port]={id:a.port})});var c={};if(joint.util.forIn(a,function(a,d){b[d]||(c[d]=!0)}),this.graph&&!joint.util.isEmpty(c)){var d=this.graph.getConnectedLinks(this,{inbound:!0});d.forEach(function(a){c[a.get("target").port]&&a.remove()});var e=this.graph.getConnectedLinks(this,{outbound:!0});e.forEach(function(a){c[a.get("source").port]&&a.remove()})}this.ports=b},remove:function(a){a=a||{};var b=this.graph;b&&b.startBatch("remove");var c=this.getParentCell();return c&&c.unembed(this),joint.util.invoke(this.getEmbeddedCells(),"remove",a),this.trigger("remove",this,this.collection,a),b&&b.stopBatch("remove"),this},toFront:function(a){var b=this.graph;if(b){a=a||{};var c,d=b.maxZIndex();a.deep?(c=this.getEmbeddedCells({deep:!0,breadthFirst:!0}),c.unshift(this)):c=[this],d=d-c.length+1;var e=b.get("cells"),f=e.indexOf(this)!==e.length-c.length;f||(f=c.some(function(a,b){return a.get("z")!==d+b})),f&&(this.startBatch("to-front"),d+=c.length,c.forEach(function(b,c){b.set("z",d+c,a)}),this.stopBatch("to-front"))}return this},toBack:function(a){var b=this.graph;if(b){a=a||{};var c,d=b.minZIndex();a.deep?(c=this.getEmbeddedCells({deep:!0,breadthFirst:!0}),c.unshift(this)):c=[this];var e=b.get("cells"),f=0!==e.indexOf(this);f||(f=c.some(function(a,b){return a.get("z")!==d+b})),f&&(this.startBatch("to-back"),d-=c.length,c.forEach(function(b,c){b.set("z",d+c,a)}),this.stopBatch("to-back"))}return this},parent:function(a,b){return void 0===a?this.get("parent"):this.set("parent",a,b)},embed:function(a,b){if(this===a||this.isEmbeddedIn(a))throw new Error("Recursive embedding not allowed.");this.startBatch("embed");var c=joint.util.assign([],this.get("embeds"));return c[a.isLink()?"unshift":"push"](a.id),a.parent(this.id,b),this.set("embeds",joint.util.uniq(c),b),this.stopBatch("embed"),this},unembed:function(a,b){return this.startBatch("unembed"),a.unset("parent",b),this.set("embeds",joint.util.without(this.get("embeds"),a.id),b),this.stopBatch("unembed"),this},getParentCell:function(){var a=this.parent(),b=this.graph;return a&&b&&b.getCell(a)||null},getAncestors:function(){var a=[];if(!this.graph)return a;for(var b=this.getParentCell();b;)a.push(b),b=b.getParentCell();return a},getEmbeddedCells:function(a){if(a=a||{},this.graph){var b;if(a.deep)if(a.breadthFirst){b=[];for(var c=this.getEmbeddedCells();c.length>0;){var d=c.shift();b.push(d),c.push.apply(c,d.getEmbeddedCells())}}else b=this.getEmbeddedCells(),b.forEach(function(c){b.push.apply(b,c.getEmbeddedCells(a))});else b=joint.util.toArray(this.get("embeds")).map(this.graph.getCell,this.graph);return b}return[]},isEmbeddedIn:function(a,b){var c=joint.util.isString(a)?a:a.id,d=this.parent();if(b=joint.util.defaults({deep:!0},b),this.graph&&b.deep){for(;d;){if(d===c)return!0;d=this.graph.getCell(d).parent()}return!1}return d===c},isEmbedded:function(){return!!this.parent()},clone:function(a){if(a=a||{},a.deep)return joint.util.toArray(joint.dia.Graph.prototype.cloneCells.call(null,[this].concat(this.getEmbeddedCells({deep:!0}))));var b=Backbone.Model.prototype.clone.apply(this,arguments);return b.set("id",joint.util.uuid()),b.unset("embeds"),b.unset("parent"),b},prop:function(a,b,c){var d="/",e=joint.util.isString(a);if(e||Array.isArray(a)){if(arguments.length>1){var f,g;e?(f=a,g=f.split("/")):(f=a.join(d),g=a.slice());var h=g[0],i=g.length;if(c=c||{},c.propertyPath=f,c.propertyValue=b,c.propertyPathArray=g,1===i)return this.set(h,b,c);for(var j={},k=j,l=h,m=1;m<i;m++){var n=g[m],o=Number.isFinite(e?Number(n):n);k=k[l]=o?[]:{},l=n}j=joint.util.setByPath(j,g,b,"/");var p=joint.util.merge({},this.attributes);c.rewrite&&joint.util.unsetByPath(p,f,"/");var q=joint.util.merge(p,j);return this.set(h,q[h],c)}return joint.util.getByPath(this.attributes,a,d)}return this.set(joint.util.merge({},this.attributes,a),b)},removeProp:function(a,b){b=b||{},b.dirty=!0;var c=Array.isArray(a)?a:a.split("/");if(1===c.length)return this.unset(a,b);var d=c[0],e=c.slice(1),f=joint.util.cloneDeep(this.get(d));return joint.util.unsetByPath(f,e,"/"),this.set(d,f,b)},attr:function(a,b,c){var d=Array.from(arguments);return 0===d.length?this.get("attrs"):(Array.isArray(a)?d[0]=["attrs"].concat(a):joint.util.isString(a)?d[0]="attrs/"+a:d[0]={attrs:a},this.prop.apply(this,d))},removeAttr:function(a,b){return Array.isArray(a)?this.removeProp(["attrs"].concat(a)):this.removeProp("attrs/"+a,b)},transition:function(a,b,c,d){d=d||"/";var e={duration:100,delay:10,timingFunction:joint.util.timing.linear,valueFunction:joint.util.interpolate.number};c=joint.util.assign(e,c);var f,g=0,h=function(b){var d,e,i;g=g||b,b-=g,e=b/c.duration,e<1?this._transitionIds[a]=d=joint.util.nextFrame(h):(e=1,delete this._transitionIds[a]),i=f(c.timingFunction(e)),c.transitionId=d,this.prop(a,i,c),d||this.trigger("transition:end",this,a)}.bind(this),i=function(e){this.stopTransitions(a),f=c.valueFunction(joint.util.getByPath(this.attributes,a,d),b),this._transitionIds[a]=joint.util.nextFrame(e),this.trigger("transition:start",this,a)}.bind(this);return setTimeout(i,c.delay,h)},getTransitions:function(){return Object.keys(this._transitionIds)},stopTransitions:function(a,b){b=b||"/";var c=a&&a.split(b);return Object.keys(this._transitionIds).filter(c&&function(a){return joint.util.isEqual(c,a.split(b).slice(0,c.length))}
57).forEach(function(a){joint.util.cancelFrame(this._transitionIds[a]),delete this._transitionIds[a],this.trigger("transition:end",this,a)},this),this},addTo:function(a,b){return a.addCell(this,b),this},findView:function(a){return a.findViewByModel(this)},isElement:function(){return!1},isLink:function(){return!1},startBatch:function(a,b){return this.graph&&this.graph.startBatch(a,joint.util.assign({},b,{cell:this})),this},stopBatch:function(a,b){return this.graph&&this.graph.stopBatch(a,joint.util.assign({},b,{cell:this})),this}},{getAttributeDefinition:function(a){var b=this.attributes,c=joint.dia.attributes;return b&&b[a]||c[a]},define:function(a,b,c,d){c=joint.util.assign({defaults:joint.util.defaultsDeep({type:a},b,this.prototype.defaults)},c);var e=this.extend(c,d);return joint.util.setByPath(joint.shapes,a,e,"."),e}}),joint.dia.CellView=joint.mvc.View.extend({tagName:"g",svgElement:!0,selector:"root",className:function(){var a=["cell"],b=this.model.get("type");return b&&b.toLowerCase().split(".").forEach(function(b,c,d){a.push("type-"+d.slice(0,c+1).join("-"))}),a.join(" ")},attributes:function(){return{"model-id":this.model.id}},constructor:function(a){a.id=a.id||joint.util.guid(this),joint.mvc.View.call(this,a)},init:function(){joint.util.bindAll(this,"remove","update"),this.$el.data("view",this),this.$el.attr("data-type",this.model.get("type")),this.listenTo(this.model,"change:attrs",this.onChangeAttrs)},onChangeAttrs:function(a,b,c){return c.dirty?this.render():this.update(a,b,c)},can:function(a){var b=joint.util.isFunction(this.options.interactive)?this.options.interactive(this):this.options.interactive;return joint.util.isObject(b)&&b[a]!==!1||joint.util.isBoolean(b)&&b!==!1},findBySelector:function(a,b,c){return b||(b=this.el),c||(c=this.selectors),a&&"."!==a?c&&c[a]?[c[a]]:$(b).find(a).toArray():[b]},notify:function(a){if(this.paper){var b=Array.prototype.slice.call(arguments,1);this.trigger.apply(this,[a].concat(b)),this.paper.trigger.apply(this.paper,[a,this].concat(b))}},getStrokeBBox:function(a){var b=!!a;a=a||this.el;var c,d=V(a).getBBox({target:this.paper.viewport});return c=b?V(a).attr("stroke-width"):this.model.attr("rect/stroke-width")||this.model.attr("circle/stroke-width")||this.model.attr("ellipse/stroke-width")||this.model.attr("path/stroke-width"),c=parseFloat(c)||0,g.rect(d).moveAndExpand({x:-c/2,y:-c/2,width:c,height:c})},getBBox:function(){return this.vel.getBBox({target:this.paper.svg})},highlight:function(a,b){return a=a?this.$(a)[0]||this.el:this.el,b=b||{},b.partial=a!==this.el,this.notify("cell:highlight",a,b),this},unhighlight:function(a,b){return a=a?this.$(a)[0]||this.el:this.el,b=b||{},b.partial=a!=this.el,this.notify("cell:unhighlight",a,b),this},findMagnet:function(a){var b=this.$(a),c=this.$el;0===b.length&&(b=c);do{var d=b.attr("magnet");if((d||b.is(c))&&"false"!==d)return b[0];b=b.parent()}while(b.length>0)},getSelector:function(a,b){var c;if(a===this.el)return"string"==typeof b&&(c="> "+b),c;if(a){var d=V(a).index()+1;c=a.tagName+":nth-child("+d+")",b&&(c+=" > "+b),c=this.getSelector(a.parentNode,c)}return c},getLinkEnd:function(a,b,c,d,e){var f=this.model,h=f.id,i=this.findAttribute("port",a),j=a.getAttribute("joint-selector"),k={id:h};null!=j&&(k.magnet=j),null!=i?(k.port=i,f.hasPort(i)||j||(k.selector=this.getSelector(a))):null==j&&this.el!==a&&(k.selector=this.getSelector(a));var l=this.paper,m=l.options.connectionStrategy;if("function"==typeof m){var n=m.call(l,k,this,a,new g.Point(b,c),d,e);n&&(k=n)}return k},getMagnetFromLinkEnd:function(a){var b,c=this.el,d=a.port,e=a.magnet;return null!=d&&this.model.hasPort(d)?b=this.findPortNode(d,e)||c:(e||(e=a.selector),e||null==d||(e='[port="'+d+'"]'),b=this.findBySelector(e,c,this.selectors)[0]),b},findAttribute:function(a,b){if(!b)return null;var c=b.getAttribute(a);if(null===c){if(b===this.el)return null;for(var d=b.parentNode;d&&d!==this.el&&1===d.nodeType&&(c=d.getAttribute(a),null===c);)d=d.parentNode}return c},getAttributeDefinition:function(a){return this.model.constructor.getAttributeDefinition(a)},setNodeAttributes:function(a,b){joint.util.isEmpty(b)||(a instanceof SVGElement?V(a).attr(b):$(a).attr(b))},processNodeAttributes:function(a,b){var c,d,e,f,g,h,i,j,k,l=[];for(c in b)b.hasOwnProperty(c)&&(d=b[c],e=this.getAttributeDefinition(c),!e||joint.util.isFunction(e.qualify)&&!e.qualify.call(this,d,a,b)?(h||(h={}),h[joint.util.toKebabCase(c)]=d):(joint.util.isString(e.set)&&(h||(h={}),h[e.set]=d),null!==d&&l.push(c,e)));for(f=0,g=l.length;f<g;f+=2)c=l[f],e=l[f+1],d=b[c],joint.util.isFunction(e.set)&&(i||(i={}),i[c]=d),joint.util.isFunction(e.position)&&(j||(j={}),j[c]=d),joint.util.isFunction(e.offset)&&(k||(k={}),k[c]=d);return{raw:b,normal:h,set:i,position:j,offset:k}},updateRelativeAttributes:function(a,b,c,d){d||(d={});var e,f,h,i=b.raw||{},j=b.normal||{},k=b.set,l=b.position,m=b.offset;for(e in k){f=k[e],h=this.getAttributeDefinition(e);var n=h.set.call(this,f,c.clone(),a,i);joint.util.isObject(n)?joint.util.assign(j,n):void 0!==n&&(j[e]=n)}
57if(a instanceof HTMLElement)return void this.setNodeAttributes(a,j);var o=j.transform,p=V.transformStringToMatrix(o),q=g.Point(p.e,p.f);o&&(j=joint.util.omit(j,"transform"),p.e=p.f=0);var r,s,t;if(l||m){var u=this.getNodeScale(a,d.scalableNode);r=u.sx,s=u.sy}var v=!1;for(e in l)f=l[e],h=this.getAttributeDefinition(e),t=h.position.call(this,f,c.clone(),a,i),t&&(q.offset(g.Point(t).scale(r,s)),v||(v=!0));this.setNodeAttributes(a,j);var w=!1;if(m){var x=a.getBoundingClientRect();if(x.width>0&&x.height>0){var y=V.transformRect(a.getBBox(),p).scale(1/r,1/s);for(e in m)f=m[e],h=this.getAttributeDefinition(e),t=h.offset.call(this,f,y,a,i),t&&(q.offset(g.Point(t).scale(r,s)),w||(w=!0))}}(void 0!==o||v||w)&&(q.round(1),p.e=q.x,p.f=q.y,a.setAttribute("transform",V.matrixToTransformString(p)))},getNodeScale:function(a,b){var c,d;if(b&&b.contains(a)){var e=b.scale();c=1/e.sx,d=1/e.sy}else c=1,d=1;return{sx:c,sy:d}},findNodesAttributes:function(a,b,c,d){var e={};for(var f in a)if(a.hasOwnProperty(f))for(var g=c[f]=this.findBySelector(f,b,d),h=0,i=g.length;h<i;h++){var j=g[h],k=V.ensureId(j),l=a[f],m=e[k];m?(m.merged||(m.merged=!0,m.attributes=joint.util.cloneDeep(m.attributes)||{}),joint.util.merge(m.attributes,l)):e[k]={attributes:l,node:j,merged:!1}}return e},updateDOMSubtreeAttributes:function(a,b,c){c||(c={}),c.rootBBox||(c.rootBBox=g.Rect()),c.selectors||(c.selectors=this.selectors);var d,e,f,h,i,j={},k={},l=[],m=c.roAttributes,n=this.findNodesAttributes(m||b,a,j,c.selectors),o=m?o=this.findNodesAttributes(b,a,j,c.selectors):n;for(var p in n)if(h=n[p],f=h.attributes,e=h.node,i=this.processNodeAttributes(e,f),i.set||i.position||i.offset){var q,r=o[p]&&o[p].attributes,s=r&&void 0===f.ref?r.ref:f.ref;if(s){if(q=(j[s]||this.findBySelector(s,a,c.selectors))[0],!q)throw new Error('dia.ElementView: "'+s+'" reference does not exist.')}else q=null;d={node:e,refNode:q,processedAttributes:i,allAttributes:r};var t=l.findIndex(function(a){return a.refNode===e});t>-1?l.splice(t,0,d):l.push(d)}else this.setNodeAttributes(e,i.normal);for(var u=0,v=l.length;u<v;u++){d=l[u],e=d.node,q=d.refNode;var w=q?V.ensureId(q):"",x=k[w];x||(x=k[w]=q?V(q).getBBox({target:c.rotatableNode||a}):c.rootBBox),m?(i=this.processNodeAttributes(e,d.allAttributes),this.mergeProcessedAttributes(i,d.processedAttributes)):i=d.processedAttributes,this.updateRelativeAttributes(e,i,x,c)}},mergeProcessedAttributes:function(a,b){a.set||(a.set={}),a.position||(a.position={}),a.offset||(a.offset={}),joint.util.assign(a.set,b.set),joint.util.assign(a.position,b.position),joint.util.assign(a.offset,b.offset);var c=a.normal&&a.normal.transform;void 0!==c&&b.normal&&(b.normal.transform=c),a.normal=b.normal},onRemove:function(){this.removeTools()},_toolsView:null,hasTools:function(a){var b=this._toolsView;return!!b&&(!a||b.getName()===a)},addTools:function(a){return this.removeTools(),a instanceof joint.dia.ToolsView&&(this._toolsView=a,a.configure({relatedView:this}),a.listenTo(this.paper,"tools:event",this.onToolEvent.bind(this)),a.mount()),this},updateTools:function(a){var b=this._toolsView;return b&&b.update(a),this},removeTools:function(){var a=this._toolsView;return a&&(a.remove(),this._toolsView=null),this},hideTools:function(){var a=this._toolsView;return a&&a.hide(),this},showTools:function(){var a=this._toolsView;return a&&a.show(),this},onToolEvent:function(a){switch(a){case"remove":this.removeTools();break;case"hide":this.hideTools();break;case"show":this.showTools()}},pointerdblclick:function(a,b,c){this.notify("cell:pointerdblclick",a,b,c)},pointerclick:function(a,b,c){this.notify("cell:pointerclick",a,b,c)},contextmenu:function(a,b,c){this.notify("cell:contextmenu",a,b,c)},pointerdown:function(a,b,c){this.model.graph&&(this.model.startBatch("pointer"),this._graph=this.model.graph),this.notify("cell:pointerdown",a,b,c)},pointermove:function(a,b,c){this.notify("cell:pointermove",a,b,c)},pointerup:function(a,b,c){this.notify("cell:pointerup",a,b,c),this._graph&&(this._graph.stopBatch("pointer",{cell:this.model}),delete this._graph)},mouseover:function(a){this.notify("cell:mouseover",a)},mouseout:function(a){this.notify("cell:mouseout",a)},mouseenter:function(a){this.notify("cell:mouseenter",a)},mouseleave:function(a){this.notify("cell:mouseleave",a)},mousewheel:function(a,b,c,d){this.notify("cell:mousewheel",a,b,c,d)},onevent:function(a,b,c,d){this.notify(b,a,c,d)},onmagnet:function(){},setInteractivity:function(a){this.options.interactive=a}}
57,{dispatchToolsEvent:function(a,b){"string"==typeof b&&a instanceof joint.dia.Paper&&a.trigger("tools:event",b)}}),joint.dia.Element=joint.dia.Cell.extend({defaults:{position:{x:0,y:0},size:{width:1,height:1},angle:0},initialize:function(){this._initializePorts(),joint.dia.Cell.prototype.initialize.apply(this,arguments)},_initializePorts:function(){},isElement:function(){return!0},position:function(a,b,c){var d=joint.util.isNumber(b);if(c=(d?c:a)||{},c.parentRelative){if(!this.graph)throw new Error("Element must be part of a graph.");var e=this.getParentCell(),f=e&&!e.isLink()?e.get("position"):{x:0,y:0}}if(d){if(c.parentRelative&&(a+=f.x,b+=f.y),c.deep){var h=this.get("position");this.translate(a-h.x,b-h.y,c)}else this.set("position",{x:a,y:b},c);return this}var i=g.point(this.get("position"));return c.parentRelative?i.difference(f):i},translate:function(a,b,c){if(a=a||0,b=b||0,0===a&&0===b)return this;c=c||{},c.translateBy=c.translateBy||this.id;var d=this.get("position")||{x:0,y:0};if(c.restrictedArea&&c.translateBy===this.id){var e=this.getBBox({deep:!0}),f=c.restrictedArea,g=d.x-e.x,h=d.y-e.y,i=Math.max(f.x+g,Math.min(f.x+f.width+g-e.width,d.x+a)),j=Math.max(f.y+h,Math.min(f.y+f.height+h-e.height,d.y+b));a=i-d.x,b=j-d.y}var k={x:d.x+a,y:d.y+b};return c.tx=a,c.ty=b,c.transition?(joint.util.isObject(c.transition)||(c.transition={}),this.transition("position",k,joint.util.assign({},c.transition,{valueFunction:joint.util.interpolate.object}))):this.set("position",k,c),joint.util.invoke(this.getEmbeddedCells(),"translate",a,b,c),this},size:function(a,b,c){var d=this.get("size");return void 0===a?{width:d.width,height:d.height}:(joint.util.isObject(a)&&(c=b,b=joint.util.isNumber(a.height)?a.height:d.height,a=joint.util.isNumber(a.width)?a.width:d.width),this.resize(a,b,c))},resize:function(a,b,c){if(c=c||{},this.startBatch("resize",c),c.direction){var d=this.get("size");switch(c.direction){case"left":case"right":b=d.height;break;case"top":case"bottom":a=d.width}var e=g.normalizeAngle(this.get("angle")||0),f={"top-right":0,right:0,"top-left":1,top:1,"bottom-left":2,left:2,"bottom-right":3,bottom:3}[c.direction];c.absolute&&(f+=Math.floor((e+45)/90),f%=4);var h=this.getBBox(),i=h[["bottomLeft","corner","topRight","origin"][f]](),j=g.point(i).rotate(h.center(),-e),k=Math.sqrt(a*a+b*b)/2,l=f*Math.PI/2;l+=Math.atan(f%2==0?b/a:a/b),l-=g.toRad(e);var m=g.point.fromPolar(k,l,j),n=g.point(m).offset(a/-2,b/-2);this.set("size",{width:a,height:b}
57,c),this.position(n.x,n.y,c)}else this.set("size",{width:a,height:b},c);return this.stopBatch("resize",c),this},scale:function(a,b,c,d){var e=this.getBBox().scale(a,b,c);return this.startBatch("scale",d),this.position(e.x,e.y,d),
58this.resize(e.width,e.height,d),this.stopBatch("scale"),this},fitEmbeds:function(a){if(a=a||{},!this.graph)throw new Error("Element must be part of a graph.");var b=this.getEmbeddedCells();if(b.length>0){this.startBatch("fit-embeds",a),a.deep&&joint.util.invoke(b,"fitEmbeds",a);var c=this.graph.getCellsBBox(b),d=joint.util.normalizeSides(a.padding);c.moveAndExpand({x:-d.left,y:-d.top,width:d.right+d.left,height:d.bottom+d.top}),this.set({position:{x:c.x,y:c.y},size:{width:c.width,height:c.height}},a),this.stopBatch("fit-embeds")}return this},rotate:function(a,b,c,d){if(c){var e=this.getBBox().center(),f=this.get("size"),g=this.get("position");e.rotate(c,this.get("angle")-a);var h=e.x-f.width/2-g.x,i=e.y-f.height/2-g.y;this.startBatch("rotate",{angle:a,absolute:b,origin:c}),this.position(g.x+h,g.y+i,d),this.rotate(a,b,null,d),this.stopBatch("rotate")}else this.set("angle",b?a:(this.get("angle")+a)%360,d);return this},angle:function(){return g.normalizeAngle(this.get("angle")||0)},getBBox:function(a){if(a=a||{},a.deep&&this.graph){var b=this.getEmbeddedCells({deep:!0,breadthFirst:!0});return b.push(this),this.graph.getCellsBBox(b)}var c=this.get("position"),d=this.get("size");return new g.Rect(c.x,c.y,d.width,d.height)}}),joint.dia.ElementView=joint.dia.CellView.extend({_removePorts:function(){},_renderPorts:function(){},className:function(){var a=joint.dia.CellView.prototype.className.apply(this).split(" ");return a.push("element"),a.join(" ")},metrics:null,initialize:function(){joint.dia.CellView.prototype.initialize.apply(this,arguments);var a=this.model;this.listenTo(a,"change:position",this.translate),this.listenTo(a,"change:size",this.resize),this.listenTo(a,"change:angle",this.rotate),this.listenTo(a,"change:markup",this.render),this._initializePorts(),this.metrics={}},_initializePorts:function(){},update:function(a,b){this.metrics={},this._removePorts();var c=this.model,d=c.attr();this.updateDOMSubtreeAttributes(this.el,d,{rootBBox:new g.Rect(c.size()),selectors:this.selectors,scalableNode:this.scalableNode,rotatableNode:this.rotatableNode,roAttributes:b===d?null:b}),this._renderPorts()},rotatableSelector:"rotatable",scalableSelector:"scalable",scalableNode:null,rotatableNode:null,renderMarkup:function(){var a=this.model,b=a.get("markup")||a.markup;if(!b)throw new Error("dia.ElementView: markup required");if(Array.isArray(b))return this.renderJSONMarkup(b);if("string"==typeof b)return this.renderStringMarkup(b);throw new Error("dia.ElementView: invalid markup")},renderJSONMarkup:function(a){var b=joint.util.parseDOMJSON(a),c=this.selectors=b.selectors,d=this.selector;if(c[d])throw new Error("dia.ElementView: ambiguous root selector.");c[d]=this.el,this.rotatableNode=V(c[this.rotatableSelector])||null,this.scalableNode=V(c[this.scalableSelector])||null,this.vel.append(b.fragment)},renderStringMarkup:function(a){var b=this.vel;b.append(V(a)),this.rotatableNode=b.findOne(".rotatable"),this.scalableNode=b.findOne(".scalable");var c=this.selectors={};c[this.selector]=this.el},render:function(){return this.vel.empty(),this.renderMarkup(),this.scalableNode&&this.update(),this.resize(),this.rotatableNode?(this.rotate(),this.translate(),this):(this.updateTransformation(),this)},resize:function(){return this.scalableNode?this.sgResize.apply(this,arguments):(this.model.attributes.angle&&this.rotate(),void this.update())},translate:function(){return this.rotatableNode?this.rgTranslate():void this.updateTransformation()},rotate:function(){return this.rotatableNode?this.rgRotate():void this.updateTransformation()},updateTransformation:function(){var a=this.getTranslateString(),b=this.getRotateString();b&&(a+=" "+b),this.vel.attr("transform",a)},getTranslateString:function(){var a=this.model.attributes.position;return"translate("+a.x+","+a.y+")"},getRotateString:function(){var a=this.model.attributes,b=a.angle;if(!b)return null;var c=a.size;return"rotate("+b+","+c.width/2+","+c.height/2+")"},getBBox:function(a){var b;if(a&&a.useModelGeometry){var c=this.model;b=c.getBBox().bbox(c.angle())}else b=this.getNodeBBox(this.el);return this.paper.localToPaperRect(b)},nodeCache:function(a){var b=V.ensureId(a),c=this.metrics[b];return c||(c=this.metrics[b]={}),c},getNodeData:function(a){var b=this.nodeCache(a);return b.data||(b.data={}),b.data}
58,getNodeBBox:function(a){var b=this.getNodeBoundingRect(a),c=this.getNodeMatrix(a),d=this.getRootTranslateMatrix(),e=this.getRootRotateMatrix();return V.transformRect(b,d.multiply(e).multiply(c))},getNodeBoundingRect:function(a){var b=this.nodeCache(a);return void 0===b.boundingRect&&(b.boundingRect=V(a).getBBox()),new g.Rect(b.boundingRect)},getNodeUnrotatedBBox:function(a){var b=this.getNodeBoundingRect(a),c=this.getNodeMatrix(a),d=this.getRootTranslateMatrix();return V.transformRect(b,d.multiply(c))},getNodeShape:function(a){var b=this.nodeCache(a);return void 0===b.geometryShape&&(b.geometryShape=V(a).toGeometryShape()),b.geometryShape.clone()},getNodeMatrix:function(a){var b=this.nodeCache(a);if(void 0===b.magnetMatrix){var c=this.rotatableNode||this.el;b.magnetMatrix=V(a).getTransformToElement(c)}return V.createSVGMatrix(b.magnetMatrix)},getRootTranslateMatrix:function(){var a=this.model,b=a.position(),c=V.createSVGMatrix().translate(b.x,b.y);return c},getRootRotateMatrix:function(){var a=V.createSVGMatrix(),b=this.model,c=b.angle();if(c){var d=b.getBBox(),e=d.width/2,f=d.height/2;a=a.translate(e,f).rotate(c).translate(-e,-f)}return a},rgRotate:function(){this.rotatableNode.attr("transform",this.getRotateString())},rgTranslate:function(){this.vel.attr("transform",this.getTranslateString())},sgResize:function(a,b,c){var d=this.model,e=d.get("angle")||0,f=d.get("size")||{width:1,height:1},g=this.scalableNode,h=!1;g.node.getElementsByTagName("path").length>0&&(h=!0);var i=g.getBBox({recursive:h}),j=f.width/(i.width||1),k=f.height/(i.height||1);g.attr("transform","scale("+j+","+k+")");var l=this.rotatableNode,m=l&&l.attr("transform");if(m&&null!==m){l.attr("transform",m+" rotate("+-e+","+f.width/2+","+f.height/2+")");var n=g.getBBox({target:this.paper.viewport});d.set("position",{x:n.x,y:n.y},c),this.rotate()}this.update()},prepareEmbedding:function(a){a||(a={});var b=a.model||this.model,c=a.paper||this.paper,d=c.model;b.startBatch("to-front"),b.toFront({deep:!0,ui:!0});var e=d.get("cells").max("z").get("z"),f=d.getConnectedLinks(b,{deep:!0,includeEnclosed:!0});joint.util.invoke(f,"set","z",e+1,{ui:!0}),b.stopBatch("to-front");var g=b.parent();g&&d.getCell(g).unembed(b,{ui:!0})},processEmbedding:function(a){a||(a={});var b=a.model||this.model,c=a.paper||this.paper,d=c.options,e=[];if(joint.util.isFunction(d.findParentBy)){var f=joint.util.toArray(d.findParentBy.call(c.model,this));e=f.filter(function(a){return a instanceof joint.dia.Cell&&this.model.id!==a.id&&!a.isEmbeddedIn(this.model)}.bind(this))}else e=c.model.findModelsUnderElement(b,{searchBy:d.findParentBy});d.frontParentOnly&&(e=e.slice(-1));for(var g=null,h=a.candidateEmbedView,i=e.length-1;i>=0;i--){var j=e[i];if(h&&h.model.id==j.id){g=h;break}var k=j.findView(c);if(d.validateEmbedding.call(c,this,k)){g=k;break}}g&&g!=h&&(this.clearEmbedding(a),a.candidateEmbedView=g.highlight(null,{embedding:!0})),!g&&h&&this.clearEmbedding(a)},clearEmbedding:function(a){a||(a={});var b=a.candidateEmbedView;b&&(b.unhighlight(null,{embedding:!0}),a.candidateEmbedView=null)},finalizeEmbedding:function(a){a||(a={});var b=a.candidateEmbedView,c=a.model||this.model,d=a.paper||this.paper;b&&(b.model.embed(c,{ui:!0}),b.unhighlight(null,{embedding:!0}),a.candidateEmbedView=null),joint.util.invoke(d.model.getConnectedLinks(c,{deep:!0}),"reparent",{ui:!0})},pointerdblclick:function(a,b,c){joint.dia.CellView.prototype.pointerdblclick.apply(this,arguments),this.notify("element:pointerdblclick",a,b,c)},pointerclick:function(a,b,c){joint.dia.CellView.prototype.pointerclick.apply(this,arguments),this.notify("element:pointerclick",a,b,c)},contextmenu:function(a,b,c){joint.dia.CellView.prototype.contextmenu.apply(this,arguments),this.notify("element:contextmenu",a,b,c)},pointerdown:function(a,b,c){joint.dia.CellView.prototype.pointerdown.apply(this,arguments),this.notify("element:pointerdown",a,b,c),this.dragStart(a,b,c)},pointermove:function(a,b,c){var d=this.eventData(a);switch(d.action){case"move":this.drag(a,b,c);break;case"magnet":this.dragMagnet(a,b,c)}d.stopPropagation||(joint.dia.CellView.prototype.pointermove.apply(this,arguments),this.notify("element:pointermove",a,b,c)),this.eventData(a,d)},pointerup:function(a,b,c){var d=this.eventData(a);switch(d.action){case"move":this.dragEnd(a,b,c);break;case"magnet":return void this.dragMagnetEnd(a,b,c)}d.stopPropagation||(this.notify("element:pointerup",a,b,c),joint.dia.CellView.prototype.pointerup.apply(this,arguments))},mouseover:function(a){joint.dia.CellView.prototype.mouseover.apply(this,arguments),this.notify("element:mouseover",a)},mouseout:function(a){joint.dia.CellView.prototype.mouseout.apply(this,arguments),this.notify("element:mouseout",a)},mouseenter:function(a){joint.dia.CellView.prototype.mouseenter.apply(this,arguments),this.notify("element:mouseenter",a)},mouseleave:function(a){joint.dia.CellView.prototype.mouseleave.apply(this,arguments),this.notify("element:mouseleave",a)},mousewheel:function(a,b,c,d){joint.dia.CellView.prototype.mousewheel.apply(this,arguments),this.notify("element:mousewheel",a,b,c,d)},onmagnet:function(a,b,c){this.dragMagnetStart(a,b,c);var d=this.eventData(a).stopPropagation;d&&a.stopPropagation()},dragStart:function(a,b,c){this.can("elementMove")&&this.eventData(a,{action:"move",x:b,y:c,restrictedArea:this.paper.getRestrictedArea(this)})},dragMagnetStart:function(a,b,c){if(this.can("addLinkFromMagnet")){this.model.startBatch("add-link");var d=this.paper,e=d.model,f=a.target,g=d.getDefaultLink(this,f),h=this.getLinkEnd(f,b,c,g,"source"),i={x:b,y:c};g.set({source:h,target:i}),g.addTo(e,{async:!1,ui:!0});var j=g.findView(d);joint.dia.CellView.prototype.pointerdown.apply(j,arguments),j.notify("link:pointerdown",a,b,c);var k=j.startArrowheadMove("target",{whenNotAllowed:"remove"});j.eventData(a,k),this.eventData(a,{action:"magnet",linkView:j,stopPropagation:!0}),this.paper.delegateDragEvents(this,a.data)}},drag:function(a,b,c){var d=this.paper,e=d.options.gridSize,f=this.model,h=f.position(),i=this.eventData(a),j=g.snapToGri
58d(h.x,e)-h.x+g.snapToGrid(b-i.x,e),k=g.snapToGrid(h.y,e)-h.y+g.snapToGrid(c-i.y,e);f.translate(j,k,{restrictedArea:i.restrictedArea,ui:!0});var l=!!i.embedding;d.options.embeddingMode&&(l||(this.prepareEmbedding(i),l=!0),this.processEmbedding(i)),this.eventData(a,{x:g.snapToGrid(b,e),y:g.snapToGrid(c,e),embedding:l})},dragMagnet:function(a,b,c){var d=this.eventData(a),e=d.linkView;e&&e.pointermove(a,b,c)},dragEnd:function(a,b,c){var d=this.eventData(a);d.embedding&&this.finalizeEmbedding(d)},dragMagnetEnd:function(a,b,c){var d=this.eventData(a),e=d.linkView;e&&e.pointerup(a,b,c),this.model.stopBatch("add-link")}}),joint.dia.Link=joint.dia.Cell.extend({markup:['<path class="connection" stroke="black" d="M 0 0 0 0"/>','<path class="marker-source" fill="black" stroke="black" d="M 0 0 0 0"/>','<path class="marker-target" fill="black" stroke="black" d="M 0 0 0 0"/>','<path class="connection-wrap" d="M 0 0 0 0"/>','<g class="labels"/>','<g class="marker-vertices"/>','<g class="marker-arrowheads"/>','<g class="link-tools"/>'].join(""),toolMarkup:['<g class="link-tool">','<g class="tool-remove" event="remove">','<circle r="11" />','<path transform="scale(.8) translate(-16, -16)" d="M24.778,21.419 19.276,15.917 24.777,10.415 21.949,7.585 16.447,13.087 10.945,7.585 8.117,10.415 13.618,15.917 8.116,21.419 10.946,24.248 16.447,18.746 21.948,24.248z" />',"<title>Remove link.</title>","</g>",'<g class="tool-options" event="link:options">','<circle r="11" transform="translate(25)"/>','<path fill="white" transform="scale(.55) translate(29, -16)" d="M31.229,17.736c0.064-0.571,0.104-1.148,0.104-1.736s-0.04-1.166-0.104-1.737l-4.377-1.557c-0.218-0.716-0.504-1.401-0.851-2.05l1.993-4.192c-0.725-0.91-1.549-1.734-2.458-2.459l-4.193,1.994c-0.647-0.347-1.334-0.632-2.049-0.849l-1.558-4.378C17.165,0.708,16.588,0.667,16,0.667s-1.166,0.041-1.737,0.105L12.707,5.15c-0.716,0.217-1.401,0.502-2.05,0.849L6.464,4.005C5.554,4.73,4.73,5.554,4.005,6.464l1.994,4.192c-0.347,0.648-0.632,1.334-0.849,2.05l-4.378,1.557C0.708,14.834,0.667,15.412,0.667,16s0.041,1.165,0.105,1.736l4.378,1.558c0.217,0.715,0.502,1.401,0.849,2.049l-1.994,4.193c0.725,0.909,1.549,1.733,2.459,2.458l4.192-1.993c0.648,0.347,1.334,0.633,2.05,0.851l1.557,4.377c0.571,0.064,1.148,0.104,1.737,0.104c0.588,0,1.165-0.04,1.736-0.104l1.558-4.377c0.715-0.218,1.399-0.504,2.049-0.851l4.193,1.993c0.909-0.725,1.733-1.549,2.458-2.458l-1.993-4.193c0.347-0.647,0.633-1.334,0.851-2.049L31.229,17.736zM16,20.871c-2.69,0-4.872-2.182-4.872-4.871c0-2.69,2.182-4.872,4.872-4.872c2.689,0,4.871,2.182,4.871,4.872C20.871,18.689,18.689,20.871,16,20.871z"/>',"<title>Link options.</title>","</g>","</g>"].join(""),doubleToolMarkup:void 0,vertexMarkup:['<g class="marker-vertex-group" transform="translate(<%= x %>, <%= y %>)">','<circle class="marker-vertex" idx="<%= idx %>" r="10" />','<path class="marker-vertex-remove-area" idx="<%= idx %>" d="M16,5.333c-7.732,0-14,4.701-14,10.5c0,1.982,0.741,3.833,2.016,5.414L2,25.667l5.613-1.441c2.339,1.317,5.237,2.107,8.387,2.107c7.732,0,14-4.701,14-10.5C30,10.034,23.732,5.333,16,5.333z" transform="translate(5, -33)"/>','<path class="marker-vertex-remove" idx="<%= idx %>" transform="scale(.8) translate(9.5, -37)" d="M24.778,21.419 19.276,15.917 24.777,10.415 21.949,7.585 16.447,13.087 10.945,7.585 8.117,10.415 13.618,15.917 8.116,21.419 10.946,24.248 16.447,18.746 21.948,24.248z">',"<title>Remove vertex.</title>","</path>","</g>"].join(""),arrowheadMarkup:['<g class="marker-arrowhead-group marker-arrowhead-group-<%= end %>">','<path class="marker-arrowhead" end="<%= end %>" d="M 26 0 L 0 13 L 26 26 z" />',"</g>"].join(""),defaultLabel:void 0,labelMarkup:void 0,_builtins:{defaultLabel:{markup:[{tagName:"rect",selector:"rect"},{tagName:"text",selector:"text"}],attrs:{text:{fill:"#000000",fontSize:14,textAnchor:"middle",yAlignment:"middle",pointerEvents:"none"},rect:{ref:"text",fill:"#ffffff",rx:3,ry:3,refWidth:1,refHeight:1,refX:0,refY:0}},position:{distance:.5}}},defaults:{type:"link",source:{},target:{}},isLink:function(){return!0},disconnect:function(a){return this.set({source:{x:0,y:0},target:{x:0,y:0}},a)},source:function(a,b,c){if(void 0===a)return joint.util.clone(this.get("source"));var d,e,f=a instanceof joint.dia.Cell;if(f)return d=joint.util.clone(b)||{},d.id=a.id,e=c,this.set("source",d,e);var h=a instanceof g.Point;return h?(d=joint.util.clone(b)||{},d.x=a.x,d.y=a.y,e=c,this.set("source",d,e)):(d=a,e=b,this.set("source",d,e))},target:function(a,b,c){if(void 0===a)return joint.util.clone(this.get("target"));var d,e,f=a instanceof joint.dia.Cell;if(f)return d=joint.util.clone(b)||{},d.id=a.id,e=c,this.set("target",d,e);var h=a instanceof g.Point;return h?(d=joint.util.clone(b)||{},d.x=a.x,d.y=a.y,e=c,this.set("target",d,e)):(d=a,e=b,this.set("target",d,e))},router:function(a,b,c){if(void 0===a){var d=this.get("router");return d?"object"==typeof d?joint.util.clone(d):d:this.get("manhattan")?{name:"orthogonal"}:null}var e="object"==typeof a||"function"==typeof a,f=e?a:{name:a,args:b},g=e?b:c;return this.set("router",f,g)},connector:function(a,b,c){if(void 0===a){var d=this.get("connector");return d?"object"==typeof d?joint.util.clone(d):d:this.get("smooth")?{name:"smooth"}:null}var e="object"==typeof a||"function"==typeof a,f=e?a:{name:a,args:b},g=e?b:c;return this.set("connector",f,g)},label:function(a,b,c){var d=this.labels();return a=isFinite(a)&&null!==a?0|a:0,a<0&&(a=d.length+a),arguments.length<=1?this.prop(["labels",a]):this.prop(["labels",a],b,c)},labels:function(a,b){return 0===arguments.length?(a=this.get("labels"),Array.isArray(a)?a.slice():[]):(Array.isArray(a)||(a=[]),this.set("labels",a,b))},insertLabel:function(a,b,c){if(!b)throw new Error("dia.Link: no label provided");var d=this.labels(),e=d.length;return a=isFinite(a)&&null!==a?0|a:e,a<0&&(a=e+a+1),d.splice(a,0,b),this.labels(d,c)},appendLabel:function(a,b){return this.insertLabel(-1,a,b)},removeLabel:function(a,b){var c=this.labels();return a=isFinite(a)&&null!==a?0|a:-1,c.splice(a,1),this.labels(c,b)},vertex:function(a,b,c){var d=this.vertices();return a=isFinite(a)&&null!==a?0|a:0,a<0&&(a=d.length+a),arguments.length<=1?this.prop(["vertices",a]):this.prop(["vertices",a],b,c)},vertices:function(a,b){return 0===arguments.length?(a=this.get("vertices"),Array.isArray(a)?a.slice():[]):(Array.isArray(a)||(a=[]),this.set("vertices",a,b))},insertVertex:function(a,b,c){if(!b)throw new Error("dia.Link: no vertex provided");var d=this.vertices(),e=d.length;return a=isFinite(a)&&null!==a?0|a:e,a<0&&(a=e+a+1),d.splice(a,0,b),this.vertices(d,c)},removeVertex:function(a,b){var c=this.vertices();return a=isFinite(a)&&null!==a?0|a:-1,c.splice(a,1),this.vertices(c,b)},translate:function(a,b,c){return c=c||{},c.translateBy=c.translateBy||this.id,c.tx=a,c.ty=b,this.applyToPoints(function(c){return{x:(c.x||0)+a,y:(c.y||0)+b}},c)},scale:function(a,b,c,d){return this.applyToPoints(function(d){return g.point(d).scale(a,b,c).toJSON()},d)},applyToPoints:function(a,b){if(!joint.util.isFunction(a))throw new TypeError("dia.Link: applyToPoints expects its first parameter to be a function.");var c={},d=this.source();
58d.id||(c.source=a(d));var e=this.target();e.id||(c.target=a(e));var f=this.vertices();return f.length>0&&(c.vertices=f.map(a)),this.set(c,b)},reparent:function(a){var b;if(this.graph){var c=this.getSourceElement(),d=this.getTargetElement(),e=this.getParentCell();c&&d&&(b=c===d||c.isEmbeddedIn(d)?d:d.isEmbeddedIn(c)?c:this.graph.getCommonAncestor(c,d)),!e||b&&b.id===e.id||e.unembed(this,a),b&&b.embed(this,a)}return b},hasLoop:function(a){a=a||{};var b=this.source().id,c=this.target().id;if(!b||!c)return!1;var d=b===c;if(!d&&a.deep&&this.graph){var e=this.getSourceElement(),f=this.getTargetElement();d=e.isEmbeddedIn(f)||f.isEmbeddedIn(e)}return d},getSourceElement:function(){var a=this.source(),b=this.graph;return a&&a.id&&b&&b.getCell(a.id)||null},getTargetElement:function(){var a=this.target(),b=this.graph;return a&&a.id&&b&&b.getCell(a.id)||null},getRelationshipAncestor:function(){var a;if(this.graph){var b=[this,this.getSourceElement(),this.getTargetElement()].filter(function(a){return!!a});a=this.graph.getCommonAncestor.apply(this.graph,b)}return a||null},isRelationshipEmbeddedIn:function(a){var b=joint.util.isString(a)||joint.util.isNumber(a)?a:a.id,c=this.getRelationshipAncestor();return!!c&&(c.id===b||c.isEmbeddedIn(b))},_getDefaultLabel:function(){var a=this.get("defaultLabel")||this.defaultLabel||{},b={};return b.markup=a.markup||this.get("labelMarkup")||this.labelMarkup,b.position=a.position,b.attrs=a.attrs,b.size=a.size,b}},{endsEqual:function(a,b){var c=a.port===b.port||!a.port&&!b.port;return a.id===b.id&&c}}),joint.dia.LinkView=joint.dia.CellView.extend({className:function(){var a=joint.dia.CellView.prototype.className.apply(this).split(" ");return a.push("link"),a.join(" ")},options:{shortLinkLength:105,doubleLinkTools:!1,longLinkLength:155,linkToolsOffset:40,doubleLinkToolsOffset:65,sampleInterval:50},_labelCache:null,_labelSelectors:null,_markerCache:null,_V:null,_dragData:null,metrics:null,decimalsRounding:2,initialize:function(a){joint.dia.CellView.prototype.initialize.apply(this,arguments),"function"!=typeof this.constructor.prototype.watchSource&&(this.constructor.prototype.watchSource=this.createWatcher("source"),this.constructor.prototype.watchTarget=this.createWatcher("target")),this._labelCache={},this._labelSelectors={},this._markerCache={},this._V={},this.metrics={},this.startListening()},startListening:function(){var a=this.model;this.listenTo(a,"change:markup",this.render),this.listenTo(a,"change:smooth change:manhattan change:router change:connector",this.update),this.listenTo(a,"change:toolMarkup",this.onToolsChange),this.listenTo(a,"change:labels change:labelMarkup",this.onLabelsChange),this.listenTo(a,"change:vertices change:vertexMarkup",this.onVerticesChange),this.listenTo(a,"change:source",this.onSourceChange),this.listenTo(a,"change:target",this.onTargetChange)},onSourceChange:function(a,b,c){this.watchSource(a,b);var d=this.model;c.translateBy&&d.get("target").id&&b.id||this.update(d,null,c)},onTargetChange:function(a,b,c){this.watchTarget(a,b);var d=this.model;(!c.translateBy||d.get("source").id&&!b.id&&joint.util.isEmpty(d.get("vertices")))&&this.update(d,null,c)},onVerticesChange:function(a,b,c){this.renderVertexMarkers(),c.translateBy&&c.translateBy!==this.model.id&&!this.model.hasLoop()||this.update(a,null,c)},onToolsChange:function(){this.renderTools().updateToolsPosition()},onLabelsChange:function(a,b,c){var d=!0,e=this.model.previous("labels");if(e&&"propertyPathArray"in c&&"propertyValue"in c){var f=c.propertyPathArray||[],g=f.length;if(g>1){var h=!!e[f[1]];h&&(2===g?d="markup"in Object(c.propertyValue):"markup"!==f[2]&&(d=!1))}}d?this.renderLabels():this.updateLabels(),this.updateLabelPositions()},render:function(){this.vel.empty(),this._V={},this.renderMarkup(),this.renderLabels();var a=this.model;return this.watchSource(a,a.source()).watchTarget(a,a.target()).update(),this},renderMarkup:function(){var a=this.model,b=a.get("markup")||a.markup;if(!b)throw new Error("dia.LinkView: markup required");if(Array.isArray(b))return this.renderJSONMarkup(b);if("string"==typeof b)return this.renderStringMarkup(b);
58throw new Error("dia.LinkView: invalid markup")},renderJSONMarkup:function(a){var b=joint.util.parseDOMJSON(a),c=this.selectors=b.selectors,d=this.selector;if(c[d])throw new Error("dia.LinkView: ambiguous root selector.");c[d]=this.el,this.vel.append(b.fragment)},renderStringMarkup:function(a){var b=V(a);Array.isArray(b)||(b=[b]);for(var c=this._V,d=0,e=b.length;d<e;d++){var f=b[d],g=f.attr("class");g&&(g=joint.util.removeClassNamePrefix(g),c[$.camelCase(g)]=f)}this.renderTools(),this.renderVertexMarkers(),this.renderArrowheadMarkers(),this.vel.append(b)},_getLabelMarkup:function(a){if(a){if(Array.isArray(a))return this._getLabelJSONMarkup(a);if("string"==typeof a)return this._getLabelStringMarkup(a);throw new Error("dia.linkView: invalid label markup")}},_getLabelJSONMarkup:function(a){return joint.util.parseDOMJSON(a)},_getLabelStringMarkup:function(a){var b=V(a),c=document.createDocumentFragment();if(Array.isArray(b))for(var d=0,e=b.length;d<e;d++){var f=b[d].node;c.appendChild(f)}else c.append(b.node);return{fragment:c,selectors:{}}},_normalizeLabelMarkup:function(a){if(a){var b=a.fragment;if(!(a.fragment instanceof DocumentFragment&&a.fragment.hasChildNodes()))throw new Error("dia.LinkView: invalid label markup.");var c,d=b.childNodes;return d.length>1||"G"!==d[0].nodeName.toUpperCase()?(c=V("g"),c.append(b),c.addClass("label")):(c=V(d[0]),c.addClass("label")),{node:c.node,selectors:a.selectors}}},renderLabels:function(){var a=this._V,b=a.labels,c=this._labelCache={},d=this._labelSelectors={};b&&b.empty();var e=this.model,f=e.get("labels")||[],g=f.length;if(0===g)return this;b||(b=a.labels=V("g").addClass("labels").appendTo(this.el));for(var h=0;h<g;h++){var i,j,k=f[h],l=this._normalizeLabelMarkup(this._getLabelMarkup(k.markup));if(l)i=l.node,j=l.selectors;else{var m=e._builtins.defaultLabel,n=this._normalizeLabelMarkup(this._getLabelMarkup(m.markup)),o=e._getDefaultLabel(),p=this._normalizeLabelMarkup(this._getLabelMarkup(o.markup)),q=p||n;i=q.node,j=q.selectors}var r=V(i);r.attr("label-idx",h),r.appendTo(b),c[h]=r,j[this.selector]=r.node,d[h]=j}return this.updateLabels(),this},_mergeLabelAttrs:function(a,b,c,d){if(null===b)return null;if(void 0===b){if(null===c)return null;if(void 0===c){if(a)return;return d}return a?c:joint.util.merge({},d,c)}return a?joint.util.merge({},c,b):joint.util.merge({},d,c,b)},updateLabels:function(){if(!this._V.labels)return this;for(var a=this.model,b=a.get("labels")||[],c=this.can("labelMove"),d=a._builtins.defaultLabel,e=d.attrs,f=a._getDefaultLabel(),h=f.markup,i=f.attrs,j=0,k=b.length;j<k;j++){var l=this._labelCache[j];l.attr("cursor",c?"move":"default");var m=this._labelSelectors[j],n=b[j],o=n.markup,p=n.attrs,q=this._mergeLabelAttrs(o||h,p,i,e);this.updateDOMSubtreeAttributes(l.node,q,{rootBBox:new g.Rect(n.size),selectors:m})}return this},renderTools:function(){if(!this._V.linkTools)return this;var a=$(this._V.linkTools.node).empty(),b=joint.util.template(this.model.get("toolMarkup")||this.model.toolMarkup),c=V(b());if(a.append(c.node),this._toolCache=c,this.options.doubleLinkTools){var d;this.model.get("doubleToolMarkup")||this.model.doubleToolMarkup?(b=joint.util.template(this.model.get("doubleToolMarkup")||this.model.doubleToolMarkup),d=V(b())):d=c.clone(),a.append(d.node),this._tool2Cache=d}return this},renderVertexMarkers:function(){if(!this._V.markerVertices)return this;var a=$(this._V.markerVertices.node).empty(),b=joint.util.template(this.model.get("vertexMarkup")||this.model.vertexMarkup);return this.model.vertices().forEach(function(c,d){a.append(V(b(joint.util.assign({idx:d},c))).node)}),this},renderArrowheadMarkers:function(){if(!this._V.markerArrowheads)return this;var a=$(this._V.markerArrowheads.node);a.empty();var b=joint.util.template(this.model.get("arrowheadMarkup")||this.model.arrowheadMarkup);return this._V.sourceArrowhead=V(b({end:"source"})),this._V.targetArrowhead=V(b({end:"target"})),a.append(this._V.sourceArrowhead.node,this._V.targetArrowhead.node),this},update:function(a,b,c){return c||(c={}),this.updateConnection(c),this.updateDOMSubtreeAttributes(this.el,this.model.attr(),{selectors:this.selectors}),this.updateDefaultConnectionPath(),this.updateLabelPositions(),this.updateToolsPosition(),this.updateArrowheadMarkers(),this.updateTools(c),this.options.perpendicular=null,this.updatePostponed=!1,this},removeRedundantLinearVertices:function(a){for(var b=this.model,c=b.vertices(),d=[],e=c.length,f=0,h=0;h<e;h++){var i=new g.Point(c[h]).round(),j=new g.Point(d[f-1]||this.sourceAnchor).round();if(!j.equals(i)){var k=new g.Point(c[h+1]||this.targetAnchor).round();if(!j.equals(k)){var l=new g.Line(j,k);0!==l.pointOffset(i)&&(d.push(c[h]),f++)}}}return e===f?0:(b.vertices(d,a),e-f)},updateDefaultConnectionPath:function(){var a=this._V;
58a.connection&&a.connection.attr("d",this.getSerializedConnection()),a.connectionWrap&&a.connectionWrap.attr("d",this.getSerializedConnection()),a.markerSource&&a.markerTarget&&this._translateAndAutoOrientArrows(a.markerSource,a.markerTarget)},getEndView:function(a){switch(a){case"source":return this.sourceView||null;case"target":return this.targetView||null;default:throw new Error("dia.LinkView: type parameter required.")}},getEndAnchor:function(a){switch(a){case"source":return new g.Point(this.sourceAnchor);case"target":return new g.Point(this.targetAnchor);default:throw new Error("dia.LinkView: type parameter required.")}},getEndMagnet:function(a){switch(a){case"source":var b=this.sourceView;if(!b)break;return this.sourceMagnet||b.el;case"target":var c=this.targetView;if(!c)break;return this.targetMagnet||c.el;default:throw new Error("dia.LinkView: type parameter required.")}return null},updateConnection:function(a){a=a||{};var b,c,d=this.model;if(a.translateBy&&d.isRelationshipEmbeddedIn(a.translateBy)){var e=a.tx||0,f=a.ty||0;b=new g.Polyline(this.route).translate(e,f).points,this._translateConnectionPoints(e,f),c=this.path,c.translate(e,f)}else{var h=d.vertices(),i=this.findAnchors(h),j=this.sourceAnchor=i.source,k=this.targetAnchor=i.target;b=this.findRoute(h,a);var l=this.findConnectionPoints(b,j,k),m=this.sourcePoint=l.source,n=this.targetPoint=l.target,o=this.findMarkerPoints(b,m,n);c=this.findPath(b,o.source||m,o.target||n)}this.route=b,this.path=c,this.metrics={}},findMarkerPoints:function(a,b,c){var d,e,f=a[0],h=a[a.length-1],i=this._markerCache;return this._V.markerSource&&(i.sourceBBox=i.sourceBBox||this._V.markerSource.getBBox(),d=g.point(b).move(f||c,i.sourceBBox.width*this._V.markerSource.scale().sx*-1).round()),this._V.markerTarget&&(i.targetBBox=i.targetBBox||this._V.markerTarget.getBBox(),e=g.point(c).move(h||b,i.targetBBox.width*this._V.markerTarget.scale().sx*-1).round()),i.sourcePoint=d||b.clone(),i.targetPoint=e||c.clone(),{source:d,target:e}},findAnchors:function(a){var b,c,d,e=this.model,f=a[0],h=a[a.length-1],i=e.get("source"),j=e.get("target"),k=this.sourceView,l=this.targetView;if(k){b=this.sourceMagnet||k.el;var m;m=f?new g.Point(f):l?this.targetMagnet||l.el:new g.Point(j),d=this.getAnchor(i.anchor,k,b,m,"source")}else d=new g.Point(i);var n;if(l){c=this.targetMagnet||l.el;var o=new g.Point(h||d);n=this.getAnchor(j.anchor,l,c,o,"target")}else n=new g.Point(j);return{source:d,target:n}},findConnectionPoints:function(a,b,c){var d,e,f,h=a[0],i=a[a.length-1],j=this.model,k=j.get("source"),l=j.get("target"),m=this.sourceView,n=this.targetView,o=this.paper.options;if(m){d=this.sourceMagnet||m.el;var p=k.connectionPoint||o.defaultConnectionPoint,q=h||c,r=new g.Line(q,b);f=this.getConnectionPoint(p,m,d,r,"source")}else f=b;var s;if(n){e=this.targetMagnet||n.el;var t=l.connectionPoint||o.defaultConnectionPoint,u=i||b,v=new g.Line(u,c);s=this.getConnectionPoint(t,n,e,v,"target")}else s=c;return{source:f,target:s}},getAnchor:function(a,b,c,d,e){if(!a){var f=this.paper.options;a=f.perpendicularLinks||this.options.perpendicular?{name:"perpendicular"}:f.defaultAnchor}if(!a)throw new Error("Anchor required.");var h;if("function"==typeof a)h=a;else{var i=a.name;if(h=joint.anchors[i],"function"!=typeof h)throw new Error("Unknown anchor: "+i)}var j=h.call(this,b,c,d,a.args||{},e,this);return j?j.round(this.decimalsRounding):new g.Point},getConnectionPoint:function(a,b,c,d,e){var f,g=d.end,h=this.paper.options;if("function"==typeof h.linkConnectionPoint){var i=c===b.el?void 0:c;if(f=h.linkConnectionPoint(this,b,i,d.start,e))return f}if(!a)return g;var j;if("function"==typeof a)j=a;else{var k=a.name;if(j=joint.connectionPoints[k],"function"!=typeof j)throw new Error("Unknown connection point: "+k)}return f=j.call(this,d,b,c,a.args||{},e,this),f?f.round(this.decimalsRounding):g},_translateConnectionPoints:function(a,b){var c=this._markerCache;c.sourcePoint.offset(a,b),c.targetPoint.offset(a,b),this.sourcePoint.offset(a,b),this.targetPoint.offset(a,b),this.sourceAnchor.offset(a,b),this.targetAnchor.offset(a,b)},_normalizeLabelPosition:function(a){return"number"==typeof a?{distance:a,offset:null,args:null}:a},updateLabelPositions:function(){if(!this._V.labels)return this;var a=this.path;if(!a)return this;var b=this.model,c=b.get("labels")||[];if(!c.length)return this;for(var d=b._builtins.defaultLabel,e=d.position,f=b._getDefaultLabel(),g=this._normalizeLabelPosition(f.position),h=joint.util.merge({},e,g),i=0,j=c.length;i<j;i++){var k=c[i],l=this._normalizeLabelPosition(k.position),m=joint.util.merge({},h,l),n=this.getLabelCoordinates(m);this._labelCache[i].attr("transform","translate("+n.x+", "+n.y+")")}return this},updateToolsPosition:function(){if(!this._V.linkTools)return this;var a="",b=this.options.linkToolsOffset,c=this.getConnectionLength();if(!Number.isNaN(c)){c<this.options.shortLinkLength&&(a="scale(.5)",b/=2);var d=this.getPointAtLength(b);if(this._toolCache.attr("transform","translate("+d.x+", "+d.y+") "+a),this.options.doubleLinkTools&&c>=this.options.longLinkLength){var e=this.options.doubleLinkToolsOffset||b;
58d=this.getPointAtLength(c-e),this._tool2Cache.attr("transform","translate("+d.x+", "+d.y+") "+a),this._tool2Cache.attr("visibility","visible")}else this.options.doubleLinkTools&&this._tool2Cache.attr("visibility","hidden")}return this},updateArrowheadMarkers:function(){if(!this._V.markerArrowheads)return this;if("none"===$.css(this._V.markerArrowheads.node,"display"))return this;var a=this.getConnectionLength()<this.options.shortLinkLength?.5:1;return this._V.sourceArrowhead.scale(a),
59this._V.targetArrowhead.scale(a),this._translateAndAutoOrientArrows(this._V.sourceArrowhead,this._V.targetArrowhead),this},createWatcher:function(a){function b(b,d){d=d||{};var e=null,f=b.previous(a)||{};return f.id&&this.stopListening(this.paper.getModelById(f.id),"change",c),d.id&&(e=this.paper.getModelById(d.id),this.listenTo(e,"change",c)),c.call(this,e,{cacheOnly:!0}),this}var c=function(b,c){this.onEndModelChange(a,b,c)};return b},onEndModelChange:function(a,b,c){var d=!c.cacheOnly,e=this.model,f=e.get(a)||{};if(b){var g=this.constructor.makeSelector(f),h="source"==a?"target":"source",i=e.get(h)||{},j=f.id,k=i.id,l=k&&this.constructor.makeSelector(i);if(c.handleBy===this.cid&&j===k&&g==l)this[a+"View"]=this[h+"View"],this[a+"Magnet"]=this[h+"Magnet"];else if(c.translateBy);else{var m=this.paper.model.getCell(j);if(!m)throw new Error("LinkView: invalid "+a+" cell.");var n=m.findView(this.paper);if(n){var o=n.getMagnetFromLinkEnd(f);o===n.el&&(o=null),this[a+"View"]=n,this[a+"Magnet"]=o}else this[a+"View"]=this[a+"Magnet"]=null}if(c.handleBy===this.cid&&c.translateBy&&e.isEmbeddedIn(b)&&!joint.util.isEmpty(e.get("vertices"))&&(d=!1),!this.updatePostponed&&k){var p=this.paper.getModelById(k);f.id===i.id&&(c.translateBy&&!joint.util.isEmpty(e.get("vertices"))&&e.isEmbeddedIn(c.translateBy)?d=!1:c.handleBy=this.cid),d&&(c.handleBy===this.cid||c.translateBy&&p.isEmbeddedIn(c.translateBy))&&(this.updatePostponed=!0,d=!1)}}else this[a+"View"]=this[a+"Magnet"]=null;d&&this.update(e,null,c)},_translateAndAutoOrientArrows:function(a,b){var c=joint.util.toArray(this.route);a&&a.translateAndAutoOrient(this.sourcePoint,c[0]||this.targetPoint,this.paper.viewport),b&&b.translateAndAutoOrient(this.targetPoint,c[c.length-1]||this.sourcePoint,this.paper.viewport)},_getDefaultLabelPositionArgs:function(){var a=this.model._getDefaultLabel(),b=a.position||{};return b.args},_getLabelPositionArgs:function(a){var b=this.model.label(a).position||{};return b.args},_mergeLabelPositionArgs:function(a,b){return null===a?null:void 0===a?null===b?null:b:joint.util.merge({},b,a)},addLabel:function(a,b,c){var d="number"!=typeof a,e=d?a.x:a,f=d?a.y:b,g=d?b:c,h=this._getDefaultLabelPositionArgs(),i=g,j=this._mergeLabelPositionArgs(i,h),k={position:this.getLabelPosition(e,f,j)},l=-1;return this.model.insertLabel(l,k,g),l},addVertex:function(a,b,c){var d="number"!=typeof a,e=d?a.x:a,f=d?a.y:b,g=d?b:c,h={x:e,y:f},i=this.getVertexIndex(e,f);return this.model.insertVertex(i,h,g),i},sendToken:function(a,b,c){function d(a,b){return function(){a.remove(),"function"==typeof b&&b()}}var e,f,g;joint.util.isObject(b)?(e=b.duration,f="reverse"===b.direction,g=b.connection):(e=b,f=!1,g=null),e=e||1e3;var h={dur:e+"ms",repeatCount:1,calcMode:"linear",fill:"freeze"};f&&(h.keyPoints="1;0",h.keyTimes="0;1");var i,j=V(a);if("string"==typeof g)i=this.findBySelector(g,this.el,this.selectors)[0];else{var k=this._V;i=k.connection?k.connection.node:this.el.querySelector("path")}if(!(i instanceof SVGPathElement))throw new Error("dia.LinkView: token animation requires a valid connection path.");j.appendTo(this.paper.viewport).animateAlongPath(h,i),setTimeout(d(j,c),e)},findRoute:function(a){a||(a=[]);var b=joint.routers,c=this.model.router(),d=this.paper.options.defaultRouter;if(!c){if(!d)return a.map(g.Point,g);c=d}var e=joint.util.isFunction(c)?c:b[c.name];if(!joint.util.isFunction(e))throw new Error('dia.LinkView: unknown router: "'+c.name+'".');var f=c.args||{},h=e.call(this,a,f,this);return h?h:a.map(g.Point,g)},findPath:function(a,b,c){var d=joint.connectors,e=this.model.connector(),f=this.paper.options.defaultConnector;e||(e=f||{});var h=joint.util.isFunction(e)?e:d[e.name];if(!joint.util.isFunction(h))throw new Error('dia.LinkView: unknown connector: "'+e.n
59ame+'".');var i=joint.util.clone(e.args||{});i.raw=!0;var j=h.call(this,b,c,a,i,this);return"string"==typeof j&&(j=new g.Path(V.normalizePathData(j))),j},getConnection:function(){var a=this.path;return a?a.clone():null},getSerializedConnection:function(){var a=this.path;if(!a)return null;var b=this.metrics;if(b.hasOwnProperty("data"))return b.data;var c=a.serialize();return b.data=c,c},getConnectionSubdivisions:function(){var a=this.path;if(!a)return null;var b=this.metrics;if(b.hasOwnProperty("segmentSubdivisions"))return b.segmentSubdivisions;var c=a.getSegmentSubdivisions();return b.segmentSubdivisions=c,c},getConnectionLength:function(){var a=this.path;if(!a)return 0;var b=this.metrics;if(b.hasOwnProperty("length"))return b.length;var c=a.length({segmentSubdivisions:this.getConnectionSubdivisions()});return b.length=c,c},getPointAtLength:function(a){var b=this.path;return b?b.pointAtLength(a,{segmentSubdivisions:this.getConnectionSubdivisions()}):null},getPointAtRatio:function(a){var b=this.path;return b?b.pointAt(a,{segmentSubdivisions:this.getConnectionSubdivisions()}):null},getTangentAtLength:function(a){var b=this.path;return b?b.tangentAtLength(a,{segmentSubdivisions:this.getConnectionSubdivisions()}):null},getTangentAtRatio:function(a){var b=this.path;return b?b.tangentAt(a,{segmentSubdivisions:this.getConnectionSubdivisions()}):null},getClosestPoint:function(a){var b=this.path;return b?b.closestPoint(a,{segmentSubdivisions:this.getConnectionSubdivisions()}):null},getClosestPointLength:function(a){var b=this.path;return b?b.closestPointLength(a,{segmentSubdivisions:this.getConnectionSubdivisions()}):null},getClosestPointRatio:function(a){var b=this.path;return b?b.closestPointNormalizedLength(a,{segmentSubdivisions:this.getConnectionSubdivisions()}):null},getLabelPosition:function(a,b,c){var d={},e=c||{};c&&(d.args=c);var f=!e.absoluteDistance,h=e.absoluteDistance&&e.reverseDistance,i=e.absoluteOffset,j=this.path,k={segmentSubdivisions:this.getConnectionSubdivisions()},l=new g.Point(a,b),m=j.closestPointT(l,k),n=j.lengthAtT(m,k);f&&(n=n/this.getConnectionLength()||0),h&&(n=-1*(this.getConnectionLength()-n)||1),d.distance=n;var o;i||(o=j.tangentAtT(m));var p;if(o)p=o.pointOffset(l);else{var q=j.pointAtT(m),r=l.difference(q);p={x:r.x,y:r.y}}return d.offset=p,d},getLabelCoordinates:function(a){var b;if("number"==typeof a)b=a;else{if("number"!=typeof a.distance)throw new Error("dia.LinkView: invalid label position distance.");b=a.distance}var c=b>0&&b<=1,d=0,e={x:0,y:0};if(a.offset){var f=a.offset;"number"==typeof f&&(d=f),f.x&&(e.x=f.x),f.y&&(e.y=f.y)}var g,h=0!==e.x||0!==e.y||0===d,i=this.path,j={segmentSubdivisions:this.getConnectionSubdivisions()},k=c?b*this.getConnectionLength():b;if(h)g=i.pointAtLength(k,j),g.offset(e);else{var l=i.tangentAtLength(k,j);l?(l.rotate(l.start,-90),l.setLength(d),g=l.end):g=i.start}return g},getVertexIndex:function(a,b){for(var c=this.model,d=c.vertices(),e=this.getClosestPointLength(new g.Point(a,b)),f=0,h=d.length;f<h;f++){var i=d[f],j=this.getClosestPointLength(i);if(e<j)break}return f},pointerdblclick:function(a,b,c){joint.dia.CellView.prototype.pointerdblclick.apply(this,arguments),this.notify("link:pointerdblclick",a,b,c)},pointerclick:function(a,b,c){joint.dia.CellView.prototype.pointerclick.apply(this,arguments),this.notify("link:pointerclick",a,b,c)},contextmenu:function(a,b,c){joint.dia.CellView.prototype.contextmenu.apply(this,arguments),this.notify("link:contextmenu",a,b,c)},pointerdown:function(a,b,c){joint.dia.CellView.prototype.pointerdown.apply(this,arguments),this.notify("link:pointerdown",a,b,c);var d=a.target.getAttribute("class");switch(d){case"marker-vertex":return void this.dragVertexStart(a,b,c);case"marker-vertex-remove":case"marker-vertex-remove-area":return void this.dragVertexRemoveStart(a,b,c);case"marker-arrowhead":return void this.dragArrowheadStart(a,b,c);case"connection":case"connection-wrap":return void this.dragConnectionStart(a,b,c);case"marker-source":case"marker-target":return}this.dragStart(a,b,c)},pointermove:function(a,b,c){var d=this._dragData;d&&this.eventData(a,d);var e=this.eventData(a);switch(e.action){case"vertex-move":this.dragVertex(a,b,c);break;case"label-move":this.dragLabel(a,b,c);break;case"arrowhead-move":this.dragArrowhead(a,b,c);break;case"move":this.drag(a,b,c)}d&&joint.util.assign(d,this.eventData(a)),joint.dia.CellView.prototype.pointermove.apply(this,arguments),this.notify("link:pointermove",a,b,c)},pointerup:function(a,b,c){var d=this._dragData;d&&(this.eventData(a,d),this._dragData=null);var e=this.eventData(a);switch(e.action){case"vertex-move":this.dragVertexEnd(a,b,c);break;case"label-move":this.dragLabelEnd(a,b,c);break;case"arrowhead-move":this.dragArrowheadEnd(a,b,c);break;case"move":this.dragEnd(a,b,c)}this.notify("link:pointerup",a,b,c),joint.dia.CellView.prototype.pointerup.apply(this,arguments)},mouseover:function(a){joint.dia.CellView.prototype.mouseover.apply(this,arguments),this.notify("link:mouseover",a)},mouseout:function(a){joint.dia.CellView.prototype.mouseout.apply(this,arguments),this.notify("link:mouseout",a)},mouseenter:function(a){joint.dia.CellView.prototype.mouseenter.apply(this,arguments),this.notify("link:mouseenter",a)},mouseleave:function(a){joint.dia.CellView.prototype.mouseleave.apply(this,arguments),this.notify("link:mouseleave",a)},mousewheel:function(a,b,c,d){joint.dia.CellView.prototype.mousewheel.apply(this,arguments),this.notify("link:mousewheel",a,b,c,d)},onevent:function(a,b,c,d){var e=V(a.target).findParentByClass("link-tool",this.el);e?this.can("useLinkTools")&&("remove"===b?(a.stopPropagation(),this.model.remove({ui:!0})):this.notify(b,a,c,d)):joint.dia.CellView.prototype.onevent.apply(this,arguments)},onlabel:function(a,b,c){joint.dia.CellView.prototype.pointerdown.apply(this,arguments),this.notify("link:pointerdown",a,b,c),this.dragLabelStart(a,b,c);var d=this.eventData(a).stopPropagation;d&&a.stopPropagation()},dragConnectionStart:function(a,b,c){if(this.can("vertexAdd")){var d=this.addVertex({x:b,y:c},{ui:!0});this.eventData(a,{action:"vertex-move",vertexIdx:d})}},dragLabelStart:function(a,b,c){if(!this.can("labelMove"))return void this.eventData(a,{stopPropagation:!0});var d=a.currentTarget,e=parseInt(d.getAttribute("label-idx"),10),f=this._getDefaultLabelPositionArgs(),g=this._getLabelPositionArgs(e),h=this._mergeLabelPositionArgs(g,f);this.eventData(a,{action:"label-move",labelIdx:e,positionArgs:h,stopPropagation:!0}),this.paper.delegateDragEvents(this,a.data)},dragVertexStart:function(a,b,c){if(this.can("vertexMove")){var d=a.target,e=parseInt(d.getAttribute("idx"),10);this.eventData(a,{action:"vertex-move",vertexIdx:e})}},dragVertexRemoveStart:function(a,b,c){if(this.can("vertexRemove")){var d=a.target,e=parseInt(d.getAttribute("idx"),10);this.model.removeVertex(e)}},dragArrowheadStart:function(a,b,c){if(this.can("arrowheadMove")){var d=a.target,e=d.getAttribute("end"),f=this.startArrowheadMove(e,{ignoreBackwardsCompatibility:!0});this.eventData(a,f)}},dragStart:function(a,b,c){this.can("linkMove")&&this.eventData(a,{action:"move",dx:b,dy:c})},dragLabel:function(a,b,c){var d=this.eventData(a),e={position:this.getLabelPosition(b,c,d.positionArgs)};this.model.label(d.labelIdx,e)},dragVertex:function(a,b,c){var d=this.eventData(a);this.model.vertex(d.vertexIdx,{x:b,y:c},{ui:!0})},dragArrowhead:function(a,b,c){var d=this.eventData(a);if(this.paper.options.snapLinks)this._snapArrowhead(b,c,d);else{var e="mousemove"===a.type?a.target:document.elementFromPoint(a.clientX,a.clientY);this._connectArrowhead(e,b,c,d)}},drag:function(a,b,c){var d=this.eventData(a);this.model.translate(b-d.dx,c-d.dy,{ui:!0}),this.eventData(a,{dx:b,dy:c})},dragLabelEnd:function(){},dragVertexEnd:function(){},dragArrowheadEnd:function(a,b,c){var d=this.eventData(a),e=this.paper;e.options.snapLinks?this._snapArrowheadEnd(d):this._connectArrowheadEnd(d,b,c),e.linkAllowed(this)?(this._finishEmbedding(d),this._notifyConnectEvent(d,a)):this._disallow(d),this._afterArrowheadMove(d),this.vel.contains(a.target)||this.mouseleave(a)},dragEnd:function(){},_disallow:function(a){switch(a.whenNotAllowed){case"remove":this.model.remove({ui:!0});break;case"revert":default:this.model.set(a.arrowhead,a.initialEnd,{ui:!0})}},_finishEmbedding:function(a){this.paper.options.embeddingMode&&this.model.reparent()&&
59(a.z=null)},_notifyConnectEvent:function(a,b){var c=a.arrowhead,d=a.initialEnd,e=this.model.prop(c),f=e&&!joint.dia.Link.endsEqual(d,e);if(f){var g=this.paper;d.id&&this.notify("link:disconnect",b,g.findViewByModel(d.id),a.initialMagnet,c),e.id&&this.notify("link:connect",b,g.findViewByModel(e.id),a.magnetUnderPointer,c)}},_snapArrowhead:function(a,b,c){var d=this.paper.options.snapLinks.radius||50,e=this.paper.findViewsInArea({x:a-d,y:b-d,width:2*d,height:2*d});c.closestView&&c.closestView.unhighlight(c.closestMagnet,{connecting:!0,snapping:!0}),c.closestView=c.closestMagnet=null;var f,h=Number.MAX_VALUE,i=g.point(a,b),j=this.paper;e.forEach(function(a){"false"!==a.el.getAttribute("magnet")&&(f=a.model.getBBox().center().distance(i),f<d&&f<h&&j.options.validateConnection.apply(j,c.validateConnectionArgs(a,null))&&(h=f,c.closestView=a,c.closestMagnet=a.el)),a.$("[magnet]").each(function(b,e){var g=a.getNodeBBox(e);f=i.distance({x:g.x+g.width/2,y:g.y+g.height/2}),f<d&&f<h&&j.options.validateConnection.apply(j,c.validateConnectionArgs(a,e))&&(h=f,c.closestView=a,c.closestMagnet=e)}.bind(this))},this);var k,l=c.closestView,m=c.closestMagnet,n=c.arrowhead;l?(l.highlight(m,{connecting:!0,snapping:!0}),k=l.getLinkEnd(m,a,b,this.model,n)):k={x:a,y:b},this.model.set(n,k||{x:a,y:b},{ui:!0})},_snapArrowheadEnd:function(a){var b=a.closestView,c=a.closestMagnet;b&&c&&(b.unhighlight(c,{connecting:!0,snapping:!0}),a.magnetUnderPointer=b.findMagnet(c)),a.closestView=a.closestMagnet=null},_connectArrowhead:function(a,b,c,d){d.eventTarget!==a&&(d.magnetUnderPointer&&d.viewUnderPointer.unhighlight(d.magnetUnderPointer,{connecting:!0}),d.viewUnderPointer=this.paper.findView(a),d.viewUnderPointer?(d.magnetUnderPointer=d.viewUnderPointer.findMagnet(a),d.magnetUnderPointer&&this.paper.options.validateConnection.apply(this.paper,d.validateConnectionArgs(d.viewUnderPointer,d.magnetUnderPointer))?d.magnetUnderPointer&&d.viewUnderPointer.highlight(d.magnetUnderPointer,{connecting:!0}):d.magnetUnderPointer=null):d.magnetUnderPointer=null),d.eventTarget=a,this.model.set(d.arrowhead,{x:b,y:c},{ui:!0})},_connectArrowheadEnd:function(a,b,c){var d=a.viewUnderPointer,e=a.magnetUnderPointer;if(e&&d){d.unhighlight(e,{connecting:!0});var f=a.arrowhead,g=d.getLinkEnd(e,b,c,this.model,f);this.model.set(f,g,{ui:!0})}},_beforeArrowheadMove:function(a){a.z=this.model.get("z"),this.model.toFront(),this.el.style.pointerEvents="none",this.paper.options.markAvailable&&this._markAvailableMagnets(a)},_afterArrowheadMove:function(a){null!==a.z&&(this.model.set("z",a.z,{ui:!0}),a.z=null),this.el.style.pointerEvents="visiblePainted",this.paper.options.markAvailable&&this._unmarkAvailableMagnets(a)},_createValidateConnectionArgs:function(a){function b(a,b){return c[f]=a,c[f+1]=a.el===b?void 0:b,c}var c=[];c[4]=a,c[5]=this;var d,e=0,f=0;"source"===a?(e=2,d="target"):(f=2,d="source");var g=this.model.get(d);if(g.id){var h=c[e]=this.paper.findViewByModel(g.id),i=h.getMagnetFromLinkEnd(g);i===h.el&&(i=void 0),c[e+1]=i}return b},_markAvailableMagnets:function(a){function b(a,b){var c=a.paper,d=c.options.validateConnection;return d.apply(c,this.validateConnectionArgs(a,b))}var c=this.paper,d=c.model.getElements();a.marked={};for(var e=0,f=d.length;e<f;e++){var g=d[e].findView(c);if(g){var h=Array.prototype.slice.call(g.el.querySelectorAll("[magnet]"));"false"!==g.el.getAttribute("magnet")&&h.push(g.el);var i=h.filter(b.bind(a,g));if(i.length>0){for(var j=0,k=i.length;j<k;j++)g.highlight(i[j],{magnetAvailability:!0});g.highlight(null,{elementAvailability:!0}),a.marked[g.model.id]=i}}}},_unmarkAvailableMagnets:function(a){for(var b,c,d=Object.keys(a.marked),e=0,f=d.length;e<f;e++){b=d[e],c=a.marked[b];var g=this.paper.findViewByModel(b);if(g){for(var h=0,i=c.length;h<i;h++)g.unhighlight(c[h],{magnetAvailability:!0});g.unhighlight(null,{elementAvailability:!0})}}a.marked=null},startArrowheadMove:function(a,b){b||(b={});var c={action:"arrowhead-move",arrowhead:a,whenNotAllowed:b.whenNotAllowed||"revert",initialMagnet:this[a+"Magnet"]||(this[a+"View"]?this[a+"View"].el:null),initialEnd:joint.util.clone(this.model.get(a)),validateConnectionArgs:this._createValidateConnectionArgs(a)};return this._beforeArrowheadMove(c),b.ignoreBackwardsCompatibility!==!0&&(this._dragData=c),c}},{makeSelector:function(a){var b="";return a.port?b+='[port="'+a.port+'"]':a.selector&&(b+=a.selector),b}}),Object.defineProperty(joint.dia.LinkView.prototype,"sourceBBox",{enumerable:!0,get:function(){var a=this.sourceView,b=this.sourceMagnet;if(a)return b||(b=a.el),a.getNodeBBox(b);var c=this.model.source();return new g.Rect(c.x,c.y,1,1)}}),Object.defineProperty(joint.dia.LinkView.prototype,"targetBBox",{enumerable:!0,get:function(){var a=this.targetView,b=this.targetMagnet;if(a)return b||(b=a.el),a.getNodeBBox(b);var c=this.model.target();return new g.Rect(c.x,c.y,1,1)}}),joint.dia.Paper=joint.mvc.View.extend({className:"paper",options:{width:800,height:600,origin:{x:0,y:0}
59,gridSize:1,drawGrid:!1,background:!1,perpendicularLinks:!1,elementView:joint.dia.ElementView,linkView:joint.dia.LinkView,snapLinks:!1,multiLinks:!0,guard:function(a,b){return!1},highlighting:{default:{name:"stroke",options:{padding:3}},magnetAvailability:{name:"addClass",options:{className:"available-magnet"}},elementAvailability:{name:"addClass",options:{className:"available-cell"}}},preventContextMenu:!0,preventDefaultBlankAction:!0,restrictTranslate:!1,markAvailable:!1,defaultLink:new joint.dia.Link,defaultConnector:{name:"normal"},defaultRouter:{name:"normal"},defaultAnchor:{name:"center"},defaultConnectionPoint:{name:"bbox"},connectionStrategy:null,validateMagnet:function(a,b){return"passive"!==b.getAttribute("magnet")},validateConnection:function(a,b,c,d,e,f){return("target"===e?c:a)instanceof joint.dia.ElementView},embeddingMode:!1,validateEmbedding:function(a,b){return!0},findParentBy:"bbox",frontParentOnly:!0,interactive:{labelMove:!1},linkPinning:!0,allowLink:null,clickThreshold:0,moveThreshold:0,cellViewNamespace:joint.shapes,highlighterNamespace:joint.highlighters},events:{dblclick:"pointerdblclick",click:"pointerclick",touchend:"pointerclick",contextmenu:"contextmenu",mousedown:"pointerdown",touchstart:"pointerdown",mouseover:"mouseover",mouseout:"mouseout",mouseenter:"mouseenter",mouseleave:"mou
59seleave",mousewheel:"mousewheel",DOMMouseScroll:"mousewheel","mouseenter .joint-cell":"mouseenter","mouseleave .joint-cell":"mouseleave","mouseenter .joint-tools":"mouseenter","mouseleave .joint-tools":"mouseleave","mousedown .joint-cell [event]":"onevent","touchstart .joint-cell [event]":"onevent","mousedown .joint-cell [magnet]":"onmagnet","touchstart .joint-cell [magnet]":"onmagnet","mousedown .joint-link .label":"onlabel","touchstart .joint-link .label":"onlabel","dragstart .joint-cell image":"onImageDragStart"},documentEvents:{mousemove:"pointermove",touchmove:"pointermove",mouseup:"pointerup",touchend:"pointerup",touchcancel:"pointerup"},_highlights:{},init:function(){joint.util.bindAll(this,"pointerup");var a=this.model=this.options.model||new joint.dia.Graph;this.setGrid(this.options.drawGrid),this.cloneOptions(),this.render(),this.setDimensions(),this.listenTo(a,"add",this.onCellAdded).listenTo(a,"remove",this.removeView).listenTo(a,"reset",this.resetViews).listenTo(a,"sort",this._onSort).listenTo(a,"batch:stop",this._onBatchStop),this.on("cell:highlight",this.onCellHighlight).on("cell:unhighlight",this.onCellUnhighlight).on("scale translate",this.update),this._mousemoved=0,this._views={},this.$document=$(this.el.ownerDocument)},cloneOptions:function(){var a=this.options;a.origin=joint.util.assign({},a.origin),a.defaultConnector=joint.util.assign({},a.defaultConnector),a.highlighting=joint.util.defaultsDeep({},a.highlighting,this.constructor.prototype.options.highlighting)},render:function(){return this.$el.empty(),this.svg=V("svg").attr({width:"100%",height:"100%"}).node,this.viewport=V("g").addClass(joint.util.addClassNamePrefix("viewport")).node,this.defs=V("defs").node,this.tools=V("g").addClass(joint.util.addClassNamePrefix("tools-container")).node,V(this.svg).append([this.defs,this.viewport,this.tools]),this.$background=$("<div/>").addClass(joint.util.addClassNamePrefix("paper-background")),this.options.background&&this.drawBackground(this.options.background),this.$grid=$("<div/>").addClass(joint.util.addClassNamePrefix("paper-grid")),this.options.drawGrid&&this.drawGrid(),this.$el.append(this.$background,this.$grid,this.svg),this},update:function(){return this.options.drawGrid&&this.drawGrid(),this._background&&this.updateBackgroun
59dImage(this._background),this},_viewportMatrix:null,_viewportTransformString:null,matrix:function(a){var b=this.viewport;if(void 0===a){var c=b.getAttribute("transform");return(this._viewportTransformString||null)===c?a=this._viewportMatrix:(a=b.getCTM(),this._viewportMatrix=a,this._viewportTransformString=c),V.createSVGMatrix(a)}a=V.createSVGMatrix(a);var d=V.matrixToTransformString(a);return b.setAttribute("transform",d),this.tools.setAttribute("transform",d),this._viewportMatrix=a,this._viewportTransformString=b.getAttribute("transform"),this},clientMatrix:function(){return V.createSVGMatrix(this.viewport.getScreenCTM())},_sortDelayingBatches:["add","to-front","to-back"],_onSort:function(){this.model.hasActiveBatch(this._sortDelayingBatches)||this.sortViews()},_onBatchStop:function(a){var b=a&&a.batchName;this._sortDelayingBatches.includes(b)&&!this.model.hasActiveBatch(this._sortDelayingBatches)&&this.sortViews()},onRemove:function(){this.removeViews()},setDimensions:function(a,b){a=this.options.width=a||this.options.width,b=this.options.height=b||this.options.height,this.$el.css({width:Math.round(a),height:Math.round(b)}),this.trigger("resize",a,b)},setOrigin:function(a,b){return this.translate(a||0,b||0,{absolute:!0})},fitToContent:function(a,b,c,d){joint.util.isObject(a)?(d=a,a=d.gridWidth||1,b=d.gridHeight||1,c=d.padding||0):(d=d||{},a=a||1,b=b||1,c=c||0),c=joint.util.normalizeSides(c);var e=V(this.viewport).getBBox(),f=this.scale(),g=this.translate();e.x*=f.sx,e.y*=f.sy,e.width*=f.sx,e.height*=f.sy;var h=Math.max(Math.ceil((e.width+e.x)/a),1)*a,i=Math.max(Math.ceil((e.height+e.y)/b),1)*b,j=0,k=0;("negative"==d.allowNewOrigin&&e.x<0||"positive"==d.allowNewOrigin&&e.x>=0||"any"==d.allowNewOrigin)&&(j=Math.ceil(-e.x/a)*a,j+=c.left,h+=j),("negative"==d.allowNewOrigin&&e.y<0||"positive"==d.allowNewOrigin&&e.y>=0||"any"==d.allowNewOrigin)&&(k=Math.ceil(-e.y/b)*b,k+=c.top,i+=k),h+=c.right,i+=c.bottom,h=Math.max(h,d.minWidth||0),i=Math.max(i,d.minHeight||0),h=Math.min(h,d.maxWidth||Number.MAX_VALUE),i=Math.min(i,d.maxHeight||Number.MAX_VALUE);var l=h!=this.options.width||i!=this.options.height,m=j!=g.tx||k!=g.ty;m&&this.translate(j,k),l&&this.setDimensions(h,i)},scaleContentToFit:function(a){var b=this.getContentBBox();if(b.width&&b.height){a=a||{},joint.util.defaults(a,{padding:0,preserveAspectRatio:!0,scaleGrid:null,minScale:0,maxScale:Number.MAX_VALUE});var c,d=a.padding,e=a.minScaleX||a.minScale,f=a.maxScaleX||a.maxScale,h=a.minScaleY||a.minScale,i=a.maxScaleY||a.maxScale;if(a.fittingBBox)c=a.fittingBBox;else{var j=this.translate();c={x:j.tx,y:j.ty,width:this.options.width,height:this.options.height}}c=g.rect(c).moveAndExpand({x:d,y:d,width:-2*d,height:-2*d});var k=this.scale(),l=c.width/b.width*k.sx,m=c.height/b.height*k.sy;if(a.preserveAspectRatio&&(l=m=Math.min(l,m)),a.scaleGrid){var n=a.scaleGrid;l=n*Math.floor(l/n),m=n*Math.floor(m/n)}l=Math.min(f,Math.max(e,l)),m=Math.min(i,Math.max(h,m)),this.scale(l,m);var o=this.getContentBBox(),p=c.x-o.x,q=c.y-o.y;this.translate(p,q)}},getContentArea:function(){return V(this.viewport).getBBox()},getContentBBox:function(){var a=this.viewport.getBoundingClientRect(),b=this.clientMatrix(),c=this.translate();return g.rect({x:a.left-b.e+c.tx,y:a.top-b.f+c.ty,width:a.width,height:a.height})},getArea:function(){return this.paperToLocalRect({x:0,y:0,width:this.options.width,height:this.options.height})},getRestrictedArea:function(){var a;return a=joint.util.isFunction(this.options.restrictTranslate)?this.options.restrictTranslate.apply(this,arguments):this.options.restrictTranslate===!0?this.getArea():this.options.restrictTranslate||null},createViewForModel:function(a){var b,c,d=this.options.cellViewNamespace,e=a.get("type")+"View",f=joint.util.getByPath(d,e,".");a.isLink()?(b=this.options.linkView,c=joint.dia.LinkView):(b=this.options.elementView,c=joint.dia.ElementView);var g=b.prototype instanceof Backbone.View?f||b:b.call(this,a)||f||c;return new g({model:a,interactive:this.options.interactive})},onCellAdded:function(a,b,c){if(this.options.async&&c.async!==!1&&joint.util.isNumber(c.position)){if
59(this._asyncCells=this._asyncCells||[],this._asyncCells.push(a),0==c.position){if(this._frameId)throw new Error("another asynchronous rendering in progress");this.asyncRenderViews(this._asyncCells,c),delete this._asyncCells}}else this.renderView(a)},removeView:function(a){var b=this._views[a.id];return b&&(b.remove(),delete this._views[a.id]),b},renderView:function(a){var b=this._views[a.id]=this.createViewForModel(a);return V(this.viewport).append(b.el),b.paper=this,b.render(),b},onImageDragStart:function(){return!1},beforeRenderViews:function(a){return a.sort(function(a){return a.isLink()?1:-1}),a},afterRenderViews:function(){this.sortViews()},resetViews:function(a,b){this.removeViews();var c=a.models.slice();if(c=this.beforeRenderViews(c,b)||c,this.cancelRenderViews(),this.options.async)this.asyncRenderViews(c,b);else{for(var d=0,e=c.length;d<e;d++)this.renderView(c[d]);this.sortViews()}},cancelRenderViews:function(){this._frameId&&(joint.util.cancelFrame(this._frameId),delete this._frameId)},removeViews:function(){joint.util.invoke(this._views,"remove"),this._views={}},asyncBatchAdded:joint.util.noop,asyncRenderViews:function(a,b){if(this._frameId){var c=this.options.async&&this.options.async.batchSize||50,d=a.splice(0,c);d.forEach(function(a){a.graph===this.model&&this.renderView(a)},this),this.asyncBatchAdded()}a.length?this._frameId=joint.util.nextFrame(function(){this.asyncRenderViews(a,b)},this):(delete this._frameId,this.afterRenderViews(b),this.trigger("render:done",b))},sortViews:function(){var a=$(this.viewport).children("[model-id]"),b=this.model.get("cells");joint.util.sortElements(a,function(a,c){var d=b.get($(a).attr("model-id")),e=b.get($(c).attr("model-id"));return(d.get("z")||0)>(e.get("z")||0)?1:-1})},scale:function(a,b,c,d){if(void 0===a)return V.matrixToScale(this.matrix());void 0===b&&(b=a),void 0===c&&(c=0,d=0);var e=this.translate();if(c||d||e.tx||e.ty){var f=e.tx-c*(a-1),g=e.ty-d*(b-1);this.translate(f,g)}var h=this.matrix();return h.a=a||0,h.d=b||0,this.matrix(h),this.trigger("scale",a,b,c,d),this},rotate:function(a,b,c){if(void 0===a)return V.matrixToRotate(this.matrix());if(void 0===b){var d=this.viewport.getBBox();b=d.width/2,c=d.height/2}var e=this.matrix().translate(b,c).rotate(a).translate(-b,-c);return this.matrix(e),this},translate:function(a,b){if(void 0===a)return V.matrixToTranslate(this.matrix());var c=this.matrix();c.e=a||0,c.f=b||0,this.matrix(c);var d=this.translate(),e=this.options.origin;return e.x=d.tx,e.y=d.ty,this.trigger("translate",d.tx,d.ty),this.options.drawGrid&&this.drawGrid(),this},findView:function(a){for(var b=joint.util.isString(a)?this.viewport.querySelector(a):a instanceof $?a[0]:a;b&&b!==this.el&&b!==document;){var c=b.getAttribute("model-id");if(c)return this._views[c];b=b.parentNode}},findViewByModel:function(a){var b=joint.util.isString(a)||joint.util.isNumber(a)?a:a&&a.id;return this._views[b]},findViewsFromPoint:function(a){a=g.point(a);var b=this.model.getElements().map(this.findViewByModel,this);return b.filter(function(b){return b&&b.vel.getBBox({target:this.viewport}).containsPoint(a)},this)},findViewsInArea:function(a,b){b=joint.util.defaults(b||{},{strict:!1}),a=g.rect(a);var c=this.model.getElements().map(this.findViewByModel,this),d=b.strict?"containsRect":"intersect";return c.filter(function(b){return b&&a[d](b.vel.getBBox({target:this.viewport}))},this)},removeTools:function(){return joint.dia.CellView.dispatchToolsEvent(this,"remove"),this},hideTools:function(){return joint.dia.CellView.dispatchToolsEvent(this,"hide"),this},showTools:function(){return joint.dia.CellView.dispatchToolsEvent(this,"show"),this},getModelById:function(a){return this.model.getCell(a)},snapToGrid:function(a,b){return this.clientToLocalPoint(a,b).snapToGrid(this.options.gridSize)},localToPaperPoint:function(a,b){var c=g.Point(a,b),d=V.transformPoint(c,this.matrix());return g.Point(d)},localToPaperRect:function(a,b,c,d){var e=g.Rect(a,b),f=V.transformRect(e,this.matrix());return g.Rect(f)},paperToLocalPoint:function(a,b){var c=g.Point(a,b),d=V.transformPoint(c,this.matrix().inverse());return g.Point(d)},paperToLocalRect:function(a,b,c,d){var e=g.Rect(a,b,c,d),f=V.transformRect
59(e,this.matrix().inverse());return g.Rect(f)},localToClientPoint:function(a,b){var c=g.Point(a,b),d=V.transformPoint(c,this.clientMatrix());return g.Point(d)},localToClientRect:function(a,b,c,d){var e=g.Rect(a,b,c,d),f=V.transformRect(e,this.clientMatrix());return g.Rect(f)},clientToLocalPoint:function(a,b){var c=g.Point(a,b),d=V.transformPoint(c,this.clientMatrix().inverse());return g.Point(d)},clientToLocalRect:function(a,b,c,d){var e=g.Rect(a,b,c,d),f=V.transformRect(e,this.clientMatrix().inverse());return g.Rect(f)},localToPagePoint:function(a,b){return this.localToPaperPoint(a,b).offset(this.pageOffset())},localToPageRect:function(a,b,c,d){return this.localToPaperRect(a,b,c,d).moveAndExpand(this.pageOffset())},pageToLocalPoint:function(a,b){var c=g.Point(a,b),d=c.difference(this.pageOffset());return this.paperToLocalPoint(d)},pageToLocalRect:function(a,b,c,d){var e=this.pageOffset(),f=g.Rect(a,b,c,d);return f.x-=e.x,f.y-=e.y,this.paperToLocalRect(f)},clientOffset:function(){var a=this.svg.getBoundingClientRect();return g.Point(a.left,a.top)},pageOffset:function(){return this.clientOffset().offset(window.scrollX,window.scrollY)},linkAllowed:function(a){if(!(a instanceof joint.dia.LinkView))throw new Error("Mu
59st provide a linkView.");var b=a.model,c=this.options,d=this.model,e=d.constructor.validations;return!(!c.multiLinks&&!e.multiLinks.call(this,d,b))&&(!(!c.linkPinning&&!e.linkPinning.call(this,d,b))&&!("function"==typeof c.allowLink&&!c.allowLink.call(this,a,this)))},getDefaultLink:function(a,b){return joint.util.isFunction(this.options.defaultLink)?this.options.defaultLink.call(this,a,b):this.options.defaultLink.clone()},resolveHighlighter:function(a){a=a||{};var b=a.highlighter,c=this.options;if(void 0===b){var d=["embedding","connecting","magnetAvailability","elementAvailability"].find(function(b){return!!a[b]});b=d&&c.highlighting[d]||c.highlighting.default}if(!b)return!1;joint.util.isString(b)&&(b={name:b});var e=b.name,f=c.highlighterNamespace[e];if(!f)throw new Error('Unknown highlighter ("'+e+'")');if("function"!=typeof f.highlight)throw new Error('Highlighter ("'+e+'") is missing required highlight() method');if("function"!=typeof f.unhighlight)throw new Error('Highlighter ("'+e+'") is missing required unhighlight() method');return{highlighter:f,options:b.options||{},name:e}},onCellHighlight:function(a,b,c){if(c=this.resolveHighlighter(c)){b.id||(b.id=V.uniqueId());var d=c.name+b.id+JSON.stringify(c.options);if(!this._highlights[d]){var e=c.highlighter;e.highlight(a,b,joint.util.assign({},c.options)),this._highlights[d]={cellView:a,magnetEl:b,opt:c.options,highlighter:e}}}},onCellUnhighlight:function(a,b,c){if(c=this.resolveHighlighter(c)){var d=c.name+b.id+JSON.stringify(c.options),e=this._highlights[d];e&&(e.highlighter.unhighlight(e.cellView,e.magnetEl,e.opt),this._highlights[d]=null)}},pointerdblclick:function(a){a.preventDefault(),a=joint.util.normalizeEvent(a);var b=this.findView(a.target);
60if(!this.guard(a,b)){var c=this.snapToGrid({x:a.clientX,y:a.clientY});b?b.pointerdblclick(a,c.x,c.y):this.trigger("blank:pointerdblclick",a,c.x,c.y)}},pointerclick:function(a){if(this._mousemoved<=this.options.clickThreshold){a=joint.util.normalizeEvent(a);var b=this.findView(a.target);if(this.guard(a,b))return;var c=this.snapToGrid({x:a.clientX,y:a.clientY});b?b.pointerclick(a,c.x,c.y):this.trigger("blank:pointerclick",a,c.x,c.y)}},contextmenu:function(a){this.options.preventContextMenu&&a.preventDefault(),a=joint.util.normalizeEvent(a);var b=this.findView(a.target);if(!this.guard(a,b)){var c=this.snapToGrid({x:a.clientX,y:a.clientY});b?b.contextmenu(a,c.x,c.y):this.trigger("blank:contextmenu",a,c.x,c.y)}},pointerdown:function(a){a=joint.util.normalizeEvent(a);var b=this.findView(a.target);if(!this.guard(a,b)){var c=this.snapToGrid({x:a.clientX,y:a.clientY});b?(a.preventDefault(),b.pointerdown(a,c.x,c.y)):(this.options.preventDefaultBlankAction&&a.preventDefault(),this.trigger("blank:pointerdown",a,c.x,c.y)),this.delegateDragEvents(b,a.data)}},pointermove:function(a){a.preventDefault();var b=this.eventData(a);b.mousemoved||(b.mousemoved=0);var c=++b.mousemoved;if(!(c<=this.options.moveThreshold)){a=joint.util.normalizeEvent(a);var d=this.snapToGrid({x:a.clientX,y:a.clientY}),e=b.sourceView;e?e.pointermove(a,d.x,d.y):this.trigger("blank:pointermove",a,d.x,d.y),this.eventData(a,b)}},pointerup:function(a){this.undelegateDocumentEvents(),a=joint.util.normalizeEvent(a);var b=this.snapToGrid({x:a.clientX,y:a.clientY}),c=this.eventData(a).sourceView;c?c.pointerup(a,b.x,b.y):this.trigger("blank:pointerup",a,b.x,b.y),this.delegateEvents()},mouseover:function(a){a=joint.util.normalizeEvent(a);var b=this.findView(a.target);if(!this.guard(a,b))if(b)b.mouseover(a);else{if(this.el===a.target)return;this.trigger("blank:mouseover",a)}},mouseout:function(a){a=joint.util.normalizeEvent(a);var b=this.findView(a.target);if(!this.guard(a,b))if(b)b.mouseout(a);else{if(this.el===a.target)return;this.trigger("blank:mouseout",a)}},mouseenter:function(a){a=joint.util.normalizeEvent(a);var b=this.findView(a.target);if(!this.guard(a,b)){var c=this.findView(a.relatedTarget);if(b){if(c===b)return;b.mouseenter(a)}else{if(c)return;this.trigger("paper:mouseenter",a)}}},mouseleave:function(a){a=joint.util.normalizeEvent(a);var b=this.findView(a.target);if(!this.guard(a,b)){var c=this.findView(a.relatedTarget);if(b){if(c===b)return;b.mouseleave(a)}else{if(c)return;this.trigger("paper:mouseleave",a)}}},mousewheel:function(a){a=joint.util.normalizeEvent(a);var b=this.findView(a.target);
60if(!this.guard(a,b)){var c=a.originalEvent,d=this.snapToGrid({x:c.clientX,y:c.clientY}),e=Math.max(-1,Math.min(1,c.wheelDelta||-c.detail));b?b.mousewheel(a,d.x,d.y,e):this.trigger("blank:mousewheel",a,d.x,d.y,e)}},onevent:function(a){var b=a.currentTarget,c=b.getAttribute("event");if(c){var d=this.findView(b);if(d){if(a=joint.util.normalizeEvent(a),this.guard(a,d))return;var e=this.snapToGrid({x:a.clientX,y:a.clientY});d.onevent(a,c,e.x,e.y)}}},onmagnet:function(a){var b=a.currentTarget,c=b.getAttribute("magnet");if(c){var d=this.findView(b);if(d){if(a=joint.util.normalizeEvent(a),this.guard(a,d))return;if(!this.options.validateMagnet(d,b))return;var e=this.snapToGrid(a.clientX,a.clientY);d.onmagnet(a,e.x,e.y)}}},onlabel:function(a){var b=a.currentTarget,c=this.findView(b);if(c){if(a=joint.util.normalizeEvent(a),this.guard(a,c))return;var d=this.snapToGrid(a.clientX,a.clientY);c.onlabel(a,d.x,d.y)}},delegateDragEvents:function(a,b){b||(b={}),this.eventData({data:b},{sourceView:a||null,mousemoved:0}),this.delegateDocumentEvents(null,b),this.undelegateEvents()},guard:function(a,b){return"mousedown"===a.type&&2===a.button||(!(!this.options.guard||!this.options.guard(a,b))||(a.data&&void 0!==a.data.guarded?a.data.guarded:!(b&&b.model&&b.model instanceof joint.dia.Cell)&&(this.svg!==a.target&&this.el!==a.target&&!$.contains(this.svg,a.target))))},setGridSize:function(a){return this.options.gridSize=a,this.options.drawGrid&&this.drawGrid(),this},clearGrid:function(){return this.$grid&&this.$grid.css("backgroundImage","none"),this},_getGriRefs:function(){return this._gridCache||(this._gridCache={root:V("svg",{width:"100%",height:"100%"},V("defs")),patterns:{},add:function(a,b){V(this.root.node.childNodes[0]).append(b),this.patterns[a]=b,this.root.append(V("rect",{width:"100%",height:"100%",fill:"url(#"+a+")"}))},get:function(a){return this.patterns[a]},exist:function(a){return void 0!==this.patterns[a]}}),this._gridCache},setGrid:function(a){this.clearGrid(),this._gridCache=null,this._gridSettings=[];var b=Array.isArray(a)?a:[a||{}];return b.forEach(function(a){this._gridSettings.push.apply(this._gridSettings,this._resolveDrawGridOption(a))},this),this},_resolveDrawGridOption:function(a){var b=this.constructor.gridPatterns;if(joint.util.isString(a)&&Array.isArray(b[a]))return b[a].map(function(a){return joint.util.assign({},a)});var c=a||{args:[{}]},d=Array.isArray(c),e=c.name;if(d||e||c.markup||(e="dot"),e&&Array.isArray(b[e])){var f=b[e].map(function(a){return joint.util.assign({},a)}),g=Array.isArray(c.args)?c.args:[c.args||{}];joint.util.defaults(g[0],joint.util.omit(a,"args"));for(var h=0;h<g.length;h++)f[h]&&joint.util.assign(f[h],g[h]);return f}return d?c:[c]},drawGrid:function(a){var b=this.options.gridSize;if(b<=1)return this.clearGrid();var c=Array.isArray(a)?a:[a],d=this.matrix(),e=this._getGriRefs();this._gridSettings.forEach(function(a,f){var g="pattern_"+f,h=joint.util.merge(a,c[f],{sx:d.a||1,sy:d.d||1,ox:d.e||0,oy:d.f||0});h.width=b*(d.a||1)*(h.scaleFactor||1),h.height=b*(d.d||1)*(h.scaleFactor||1),e.exist(g)||e.add(g,V("pattern",{id:g,patternUnits:"userSpaceOnUse"},V(h.markup)));var i=e.get(g);joint.util.isFunction(h.update)&&h.update(i.node.childNodes[0],h);var j=h.ox%h.width;j<0&&(j+=h.width);var k=h.oy%h.height;k<0&&(k+=h.height),i.attr({x:j,y:k,width:h.width,height:h.height})});var f=(new XMLSerializer).serializeToString(e.root.node);return f="url(data:image/svg+xml;base64,"+btoa(f)+")",this.$grid.css("backgroundImage",f),this}
60,updateBackgroundImage:function(a){a=a||{};var b=a.position||"center",c=a.size||"auto auto",d=this.scale(),e=this.translate();if(joint.util.isObject(b)){var f=e.tx+d.sx*(b.x||0),h=e.ty+d.sy*(b.y||0);b=f+"px "+h+"px"}joint.util.isObject(c)&&(c=g.rect(c).scale(d.sx,d.sy),c=c.width+"px "+c.height+"px"),this.$background.css({backgroundSize:c,backgroundPosition:b})},drawBackgroundImage:function(a,b){if(!(a instanceof HTMLImageElement))return void this.$background.css("backgroundImage","");b=b||{};var c,d=b.size,e=b.repeat||"no-repeat",f=b.opacity||1,g=Math.abs(b.quality)||1,h=this.constructor.backgroundPatterns[joint.util.camelCase(e)];if(joint.util.isFunction(h)){a.width*=g,a.height*=g;var i=h(a,b);if(!(i instanceof HTMLCanvasElement))throw new Error("dia.Paper: background pattern must return an HTML Canvas instance");c=i.toDataURL("image/png"),e="repeat",joint.util.isObject(d)?(d.width*=i.width/a.width,d.height*=i.height/a.height):void 0===d&&(b.size={width:i.width/g,height:i.height/g})}else c=a.src,void 0===d&&(b.size={width:a.width,height:a.height});this.$background.css({opacity:f,backgroundRepeat:e,backgroundImage:"url("+c+")"}
60),this.updateBackgroundImage(b)},updateBackgroundColor:function(a){this.$el.css("backgroundColor",a||"")},drawBackground:function(a){if(a=a||{},this.updateBackgroundColor(a.color),a.image){a=this._background=joint.util.cloneDeep(a);var b=document.createElement("img");b.onload=this.drawBackgroundImage.bind(this,b,a),b.src=a.image}else this.drawBackgroundImage(null),this._background=null;return this},setInteractivity:function(a){this.options.interactive=a,joint.util.invoke(this._views,"setInteractivity",a)},isDefined:function(a){return!!this.svg.getElementById(a)},defineFilter:function(a){if(!joint.util.isObject(a))throw new TypeError("dia.Paper: defineFilter() requires 1. argument to be an object.");var b=a.id,c=a.name;if(b||(b=c+this.svg.id+joint.util.hashCode(JSON.stringify(a))),!this.isDefined(b)){var d=joint.util.filter,e=d[c]&&d[c](a.args||{});if(!e)throw new Error("Non-existing filter "+c);var f=joint.util.assign({filterUnits:"objectBoundingBox",x:-1,y:-1,width:3,height:3},a.attrs,{id:b});V(e,f).appendTo(this.defs)}return b},defineGradient:function(a){if(!joint.util.isObject(a))throw new TypeError("dia.Paper: defineGradient() requires 1. argument to be an object.");var b=a.id,c=a.type,d=a.stops;if(b||(b=c+this.svg.id+joint.util.hashCode(JSON.stringify(a))),!this.isDefined(b)){var e=joint.util.template('<stop offset="${offset}" stop-color="${color}" stop-opacity="${opacity}"/>'),f=joint.util.toArray(d).map(function(a){return e({offset:a.offset,color:a.color,opacity:Number.isFinite(a.opacity)?a.opacity:1})}),g=["<"+c+">",f.join(""),"</"+c+">"].join(""),h=joint.util.assign({id:b},a.attrs);V(g,h).appendTo(this.defs)}return b},defineMarker:function(a){if(!joint.util.isObject(a))throw new TypeError("dia.Paper: defineMarker() requires 1. argument to be an object.");var b=a.id;if(b||(b=this.svg.id+joint.util.hashCode(JSON.stringify(a))),!this.isDefined(b)){var c=joint.util.omit(a,"type","userSpaceOnUse"),d=V("marker",{id:b,orient:"auto",overflow:"visible",markerUnits:a.markerUnits||"userSpaceOnUse"},[V(a.type||"path",c)]);d.appendTo(this.defs)}return b}},{backgroundPatterns:{flipXy:function(a){var b=document.createElement("canvas"),c=a.width,d=a.height;b.width=2*c,b.height=2*d;var e=b.getContext("2d");return e.drawImage(a,0,0,c,d),e.setTransform(-1,0,0,-1,b.width,b.height),e.drawImage(a,0,0,c,d),e.setTransform(-1,0,0,1,b.width,0),e.drawImage(a,0,0,c,d),e.setTransform(1,0,0,-1,0,b.height),e.drawImage(a,0,0,c,d),b},flipX:function(a){var b=document.createElement("canvas"),c=a.width,d=a.height;b.width=2*c,b.height=d;var e=b.getContext("2d");return e.drawImage(a,0,0,c,d),e.translate(2*c,0),e.scale(-1,1),e.drawImage(a,0,0,c,d),b},flipY:function(a){var b=document.createElement("canvas"),c=a.width,d=a.height;b.width=c,b.height=2*d;var e=b.getContext("2d");return e.drawImage(a,0,0,c,d),e.translate(0,2*d),e.scale(1,-1),e.drawImage(a,0,0,c,d),b},watermark:function(a,b){b=b||{};var c=a.width,d=a.height,e=document.createElement("canvas");e.width=3*c,e.height=3*d;for(var f=e.getContext("2d"),h=joint.util.isNumber(b.watermarkAngle)?-b.watermarkAngle:-20,i=g.toRad(h),j=e.width/4,k=e.height/4,l=0;l<4;l++)for(var m=0;m<4;m++)(l+m)%2>0&&(f.setTransform(1,0,0,1,(2*l-1)*j,(2*m-1)*k),f.rotate(i),f.drawImage(a,-c/2,-d/2,c,d));return e}},gridPatterns:{dot:[{color:"#AAAAAA",thickness:1,markup:"rect",update:function(a,b){V(a).attr({width:b.thickness*b.sx,height:b.thickness*b.sy,fill:b.color})}}],fixedDot:[{color:"#AAAAAA",thickness:1,markup:"rect",update:function(a,b){var c=b.sx<=1?b.thickness*b.sx:b.thickness;V(a).attr({width:c,height:c,fill:b.color})}}],mesh:[{color:"#AAAAAA",thickness:1,markup:"path",update:function(a,b){var c,d=b.width,e=b.height,f=b.thickness;c=d-f>=0&&e-f>=0?["M",d,0,"H0 M0 0 V0",e].join(" "):"M 0 0 0 0",V(a).attr({d:c,stroke:b.color,"stroke-width":b.thickness})}}],doubleMesh:[{color:"#AAAAAA",thickness:1,markup:"path",update:function(a,b){var c,d=b.width,e=b.height,f=b.thickness;c=d-f>=0&&e-f>=0?["M",d,0,"H0 M0 0 V0",e].join(" "):"M 0 0 0 0",V(a).attr({d:c,stroke:b.color,"stroke-width":b.thickness})}},{color:"#000000",thickness:3,scaleFactor:4,markup:"path",update:function(a,b){var c,d=b.width,e=b.height,f=b.thickness;c=d-f>=0&&e-f>=0?["M",d,0,"H0 M0 0 V0",e].join(" "):"M 0 0 0 0",V(a).attr({d:c,stroke:b.color,"stroke-width":b.thickness})}}]}}),function(a,b){var c=function(c){var d=b.cloneDeep(c)||{};this.ports=[],this.groups={},this.portLayoutNamespace=a.layout.Port,this.portLabelLayoutNamespace=a.layout.PortLabel,this._init(d)};c.prototype={getPorts:function(){return this.ports},getGroup:function(a){return this.groups[a]||{}},getPortsByGroup:function(a){return this.ports.filter(function(b){return b.group===a})},getGroupPortsMetrics:function(a,c){var d=this.getGroup(a),e=this.getPortsByGroup(a),f=d.position||{},h=f.name,i=this.portLayoutNamespace;i[h]||(h="left");var j=f.args||{},k=e.map(function(a){return a&&a.position&&a.position.args}),l=i[h](k,c,j),m={ports:e,result:[]};return b.toArray(l).reduce(function(a,b,d){var e=a.ports[d];return a.result.push({portId:e.id,portTransformation:b,labelTransformation:this._getPortLabelLayout(e,g.Point(b),c),portAttrs:e.attrs,portSize:e.size,labelSize:e.label.size}),a}.bind(this),m),m.result},_getPortLabelLayout:function(a,b,c){var d=this.portLabelLayoutNamespace,e=a.label.position.name||"left";
60return d[e]?d[e](b,c,a.label.position.args):null},_init:function(a){if(b.isObject(a.groups))for(var c=Object.keys(a.groups),d=0,e=c.length;d<e;d++){var f=c[d];this.groups[f]=this._evaluateGroup(a.groups[f])}for(var g=b.toArray(a.items),h=0,i=g.length;h<i;h++)this.ports.push(this._evaluatePort(g[h]))},_evaluateGroup:function(a){return b.merge(a,{position:this._getPosition(a.position,!0),label:this._getLabel(a,!0)})},_evaluatePort:function(a){var c=b.assign({},a),d=this.getGroup(a.group);return c.markup=c.markup||d.markup,c.attrs=b.merge({},d.attrs,c.attrs),c.position=this._createPositionNode(d,c),c.label=b.merge({},d.label,this._getLabel(c)),c.z=this._getZIndex(d,c),c.size=b.assign({},d.size,c.size),c},_getZIndex:function(a,c){return b.isNumber(c.z)?c.z:b.isNumber(a.z)||"auto"===a.z?a.z:"auto"},_createPositionNode:function(a,c){return b.merge({name:"left",args:{}},a.position,{args:c.args})},_getPosition:function(a,c){var d,e={};b.isFunction(a)?(d="fn",e.fn=a):b.isString(a)?d=a:void 0===a?d=c?"left":null:Array.isArray(a)?(d="absolute",e.x=a[0],e.y=a[1]):b.isObject(a)&&(d=a.name,b.assign(e,a.args));var f={args:e};return d&&(f.name=d),f},_getLabel:function(a,b){var c=a.label||{},d=c;return d.position=this._getPosition(c.position,b),d}},b.assign(a.dia.Element.prototype,{_initializePorts:function(){this._createPortData(),this.on("change:ports",function(){this._processRemovedPort(),this._createPortData()},this)},_processRemovedPort:function(){var a=this.get("ports")||{},c={};b.toArray(a.items).forEach(function(a){c[a.id]=!0});var d=this.previous("ports")||{},e={};b.toArray(d.items).forEach(function(a){c[a.id]||(e[a.id]=!0)});var f=this.graph;if(f&&!b.isEmpty(e)){var g=f.getConnectedLinks(this,{inbound:!0});g.forEach(function(a){e[a.get("target").port]&&a.remove()});var h=f.getConnectedLinks(this,{outbound:!0});h.forEach(function(a){e[a.get("source").port]&&a.remove()})}},hasPorts:function(){var a=this.prop("ports/items");return Array.isArray(a)&&a.length>0},hasPort:function(a){return this.getPortIndex(a)!==-1},getPorts:function(){return b.cloneDeep(this.prop("ports/items"))||[]},getPort:function(a){return b.cloneDeep(b.toArray(this.prop("ports/items")).find(function(b){return b.id&&b.id===a}))},getPortsPositions:function(a){var b=this._portSettingsData.getGroupPortsMetrics(a,g.Rect(this.size()));return b.reduce(function(a,b){var c=b.portTransformation;return a[b.portId]={x:c.x,y:c.y,angle:c.angle},a},{})},getPortIndex:function(a){var c=b.isObject(a)?a.id:a;return this._isValidPortId(c)?b.toArray(this.prop("ports/items")).findIndex(function(a){return a.id===c}):-1},addPort:function(a,c){if(!b.isObject(a)||Array.isArray(a))throw new Error("Element: addPort requires an object.");var d=b.assign([],this.prop("ports/items"));return d.push(a),this.prop("ports/items",d,c),this},portProp:function(a,c,d,e){var f=this.getPortIndex(a);if(f===-1)throw new Error("Element: unable to find port with id "+a);var g=Array.prototype.slice.call(arguments,1);return Array.isArray(c)?g[0]=["ports","items",f].concat(c):b.isString(c)?g[0]=["ports/items/",f,"/",c].join(""):(g=["ports/items/"+f],b.isPlainObject(c)&&(g.push(c),g.push(d))),this.prop.apply(this,g)},_validatePorts:function(){var c=this.get("ports")||{},d=[];c=c||{};var e=b.toArray(c.items);return e.forEach(function(a){"object"!=typeof a&&d.push("Element: invalid port ",a),this._isValidPortId(a.id)||(a.id=b.uuid())},this),a.util.uniq(e,"id").length!==e.length&&d.push("Element: found id duplicities in ports."),d},_isValidPortId:function(a){return null!==a&&void 0!==a&&!b.isObject(a)},addPorts:function(a,c){return a.length&&this.prop("ports/items",b.assign([],this.prop("ports/items")).concat(a),c),this},removePort:function(a,c){var d=c||{},e=b.assign([],this.prop("ports/items")),f=this.getPortIndex(a);return f!==-1&&(e.splice(f,1),d.rewrite=!0,this.prop("ports/items",e,d)),this},_createPortData:function(){var a=this._validatePorts();if(a.length>0)throw this.set("ports",this.previous("ports")),new Error(a.join(" "));var b;this._portSettingsData&&(b=this._portSettingsData.getPorts()),this._portSettingsData=new c(this.get("ports"));var d=this._portSettingsData.getPorts();
60if(b){var e=d.filter(function(a){if(!b.find(function(b){return b.id===a.id}))return a}),f=b.filter(function(a){if(!d.find(function(b){return b.id===a.id}))return a});f.length>0&&this.trigger("ports:remove",this,f),e.length>0&&this.trigger("ports:add",this,e)}}}),b.assign(a.dia.ElementView.prototype,{portContainerMarkup:"g",portMarkup:[{tagName:"circle",selector:"circle",attributes:{r:10,fill:"#FFFFFF",stroke:"#000000"}}],portLabelMarkup:[{tagName:"text",selector:"text",attributes:{fill:"#000000"}}],_portElementsCache:null,_initializePorts:function(){this._portElementsCache={},this.listenTo(this.model,"change:ports",function(){this._refreshPorts()})},_refreshPorts:function(){this._removePorts(),this._portElementsCache={},this._renderPorts()},_renderPorts:function(){for(var a=[],c=this._getContainerElement(),d=0,e=c.node.childNodes.length;d<e;d++)a.push(c.node.childNodes[d]);var f=b.groupBy(this.model._portSettingsData.getPorts(),"z"),g="auto";b.toArray(f[g]).forEach(function(b){var d=this._getPortElement(b);c.append(d),a.push(d)},this);for(var h=Object.keys(f),i=0;i<h.length;i++){var j=h[i];if(j!==g){var k=parseInt(j,10);this._appendPorts(f[j],k,a)}}this._updatePorts()},_getContainerElement:function(){return this.rotatableNode||this.vel},_appendPorts:function(a,c,d){var e=this._getContainerElement(),f=b.toArray(a).map(this._getPortElement,this);d[c]||c<0?V(d[Math.max(c,0)]).before(f):e.append(f)},_getPortElement:function(a){return this._portElementsCache[a.id]?this._portElementsCache[a.id].portElement:this._createPortElement(a)},findPortNode:function(a,b){var c=this._portElementsCache[a];if(!c)return null;var d=c.portContentElement.node,e=c.portContentSelectors;return this.findBySelector(b,d,e)[0]},_updatePorts:function(){this._updatePortGroup(void 0);var a=Object.keys(this.model._portSettingsData.groups);a.forEach(this._updatePortGroup,this)},_removePorts:function(){b.invoke(this._portElementsCache,"portElement.remove")},_createPortElement:function(a){var c,d,e,f=this._getPortMarkup(a);if(Array.isArray(f)){var g=b.parseDOMJSON(f),h=g.fragment;c=h.childNodes.length>1?V("g").append(h):V(h.firstChild),e=g.selectors}else c=V(f),Array.isArray(c)&&(c=V("g").append(c));if(!c)throw new Error("ElementView: Invalid port markup.");c.attr({port:a.id,"port-group":a.group});var i,j=this._getPortLabelMarkup(a.label);if(Array.isArray(j)){var k=b.parseDOMJSON(j),l=k.fragment;d=l.childNodes.length>1?V("g").append(l):V(l.firstChild),i=k.selectors}else d=V(j),Array.isArray(d)&&(d=V("g").append(d));if(!d)throw new Error("ElementView: Invalid port label markup.");var m;if(e&&i){for(var n in i)if(e[n])throw new Error("ElementView: selectors within port must be unique.");m=b.assign({},e,i)}else m=e||i;var o=V(this.portContainerMarkup).addClass("joint-port").append([c.addClass("joint-port-body"),d.addClass("joint-port-label")]);return this._portElementsCache[a.id]={portElement:o,portLabelElement:d,portSelectors:m,portLabelSelectors:i,portContentElement:c,portContentSelectors:e},o},_updatePortGroup:function(a){for(var b=g.Rect(this.model.size()),c=this.model._portSettingsData.getGroupPortsMetrics(a,b),d=0,e=c.length;d<e;d++){var f=c[d],h=f.portId,i=this._portElementsCache[h]||{},j=f.portTransformation;this.applyPortTransform(i.portElement,j),this.updateDOMSubtreeAttributes(i.portElement.node,f.portAttrs,{rootBBox:new g.Rect(f.portSize),selectors:i.portSelectors});var k=f.labelTransformation;k&&(this.applyPortTransform(i.portLabelElement,k,-j.angle||0),this.updateDOMSubtreeAttributes(i.portLabelElement.node,k.attrs,{rootBBox:new g.Rect(f.labelSize),selectors:i.portLabelSelectors}))}},applyPortTransform:function(a,b,c){var d=V.createSVGMatrix().rotate(c||0).translate(b.x||0,b.y||0).rotate(b.angle||0);a.transform(d,{absolute:!0})},_getPortMarkup:function(a){return a.markup||this.model.get("portMarkup")||this.model.portMarkup||this.portMar
60kup},_getPortLabelMarkup:function(a){return a.markup||this.model.get("portLabelMarkup")||this.model.portLabelMarkup||this.portLabelMarkup}})}(joint,joint.util),joint.dia.Element.define("basic.Generic",{attrs:{".":{fill:"#ffffff",stroke:"none"}}}),joint.shapes.basic.Generic.define("basic.Rect",{attrs:{rect:{fill:"#ffffff",stroke:"#000000",width:100,height:60},text:{fill:"#000000",text:"","font-size":14,"ref-x":.5,"ref-y":.5,"text-anchor":"middle","y-alignment":"middle","font-family":"Arial, helvetica, sans-serif"}}},{markup:'<g class="rotatable"><g class="scalable"><rect/></g><text/></g>'}),joint.shapes.basic.TextView=joint.dia.ElementView.extend({initialize:function(){joint.dia.ElementView.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change:attrs",this.resize)}}),joint.shapes.basic.Generic.define("basic.Text",{attrs:{text:{"font-size":18,fill:"#000000"}}},{markup:'<g class="rotatable"><g class="scalable"><text/></g></g>'}),joint.shapes.basic.Generic.define("basic.Circle",{size:{width:60,height:60},attrs:{circle:{fill:"#ffffff",stroke:"#000000",r:30,cx:30,cy:30},text:{"font-size":14,text:"","text-anchor":"middle","ref-x":.5,"ref-y":.5,"y-alignment":"middle",fill:"#000000","font-family":"Arial, helvetica, sans-serif"}}},{markup:'<g class="rotatable"><g class="scalable"><circle/></g><text/></g>'}
60),joint.shapes.basic.Generic.define("basic.Ellipse",{size:{width:60,height:40},attrs:{ellipse:{fill:"#ffffff",stroke:"#000000",rx:30,ry:20,cx:30,cy:20},text:{"font-size":14,text:"","text-anchor":"middle","ref-x":.5,"ref-y":.5,"y-alignment":"middle",fill:"#000000","font-family":"Arial, helvetica, sans-serif"}}},{markup:'<g class="rotatable"><g class="scalable"><ellipse/></g><text/></g>'}),joint.shapes.basic.Generic.define("basic.Polygon",{size:{width:60,height:40},attrs:{polygon:{fill:"#ffffff",stroke:"#000000"},text:{"font-size":14,text:"","text-anchor":"middle","ref-x":.5,"ref-dy":20,"y-alignment":"middle",fill:"#000000","font-family":"Arial, helvetica, sans-serif"}}},{markup:'<g class="rotatable"><g class="scalable"><polygon/></g><text/></g>'}),joint.shapes.basic.Generic.define("basic.Polyline",{size:{width:60,height:40},attrs:{polyline:{fill:"#ffffff",stroke:"#000000"},text:{"font-size":14,text:"","text-anchor":"middle","ref-x":.5,"ref-dy":20,"y-alignment":"middle",fill:"#000000","font-family":"Arial, helvetica, sans-serif"}}},{markup:'<g class="rotatable"><g class="scalable"><polyline/></g><text/></g>'}),joint.shapes.basic.Generic.define("basic.Image",{attrs:{text:{"font-size":14,text:"","text-anchor":"middle","ref-x":.5,"ref-dy":20,"y-alignment":"middle",fill:"#000000","font-family":"Arial, helvetica, sans-serif"}}},{markup:'<g class="rotatable"><g class="scalable"><image/></g><text/></g>'}),joint.shapes.basic.Generic.define("basic.Path",{size:{width:60,height:60},attrs:{path:{fill:"#ffffff",stroke:"#000000"},text:{"font-size":14,text:"","text-anchor":"middle",ref:"path","ref-x":.5,"ref-dy":10,fill:"#000000","font-family":"Arial, helvetica, sans-serif"}}},{markup:'<g class="rotatable"><g class="scalable"><path/></g><text/></g>'}),joint.shapes.basic.Path.define("basic.Rhombus",{attrs:{path:{d:"M 30 0 L 60 30 30 60 0 30 z"},text:{"ref-y":.5,"ref-dy":null,"y-alignment":"middle"}}}),joint.shapes.basic.PortsModelInterface={initialize:function(){this.updatePortsAttrs(),this.on("change:inPorts change:outPorts",this.updatePortsAttrs,this),this.constructor.__super__.constructor.__super__.initialize.apply(this,arguments)},updatePortsAttrs:function(a){if(this._portSelectors){var b=joint.util.omit(this.get("attrs"),this._portSelectors);this.set("attrs",b,{silent:!0})}this._portSelectors=[];var c={};joint.util.toArray(this.get("inPorts")).forEach(function(a,b,d){var e=this.getPortAttrs(a,b,d.length,".inPorts","in");this._portSelectors=this._portSelectors.concat(Object.keys(e)),joint.util.assign(c,e)},this),joint.util.toArray(this.get("outPorts")).forEach(function(a,b,d){var e=this.getPortAttrs(a,b,d.length,".outPorts","out");this._portSelectors=this._portSelectors.concat(Object.keys(e)),joint.util.assign(c,e)},this),this.attr(c,{silent:!0}),this.processPorts(),this.trigger("process:ports")},getPortSelector:function(a){var b=".inPorts",c=this.get("inPorts").indexOf(a);if(c<0&&(b=".outPorts",c=this.get("outPorts").indexOf(a),c<0))throw new Error("getPortSelector(): Port doesn't exist.");return b+">g:nth-child("+(c+1)+")>.port-body"}},joint.shapes.basic.PortsViewInterface={initialize:function(){this.listenTo(this.model,"process:ports",this.update),joint.dia.ElementView.prototype.initialize.apply(this,arguments)},update:function(){this.renderPorts(),joint.dia.ElementView.prototype.update.apply(this,arguments)},renderPorts:function(){var a=this.$(".inPorts").empty(),b=this.$(".outPorts").empty(),c=joint.util.template(this.model.portMarkup),d=this.model.ports||[];d.filter(function(a){return"in"===a.type}).forEach(function(b,d){a.append(V(c({id:d,port:b})).node)}),d.filter(function(a){return"out"===a.type}).forEach(function(a,d){b.append(V(c({id:d,port:a})).node)})}},joint.shapes.basic.Generic.define("basic.TextBlock",{attrs:{rect:{fill:"#ffffff",stroke:"#000000",width:80,height:100},text:{fill:"#000000","font-size":14,"font-family":"Arial, helvetica, sans-serif"},".content":{text:"","ref-x":.5,"ref-y":.5,"y-alignment":"middle","x-alignment":"middle"}},content:""},{markup:['<g class="rotatable">','<g class="scalable"><rect/></g>',joint.env.test("svgforeignobject")?'<foreignObject class="fobj"><body xmlns="http://www.w3.org/1999/xhtml"><div class="content"/></body></foreignObject>':'<text class="content"/>',"</g>"].join(""),initialize:function(){this.listenTo(this,"change:size",this.updateSize),this.listenTo(this,"change:content",this.updateContent),this.updateSize(this,this.get("size")),this.updateContent(this,this.get("content")),joint.shapes.basic.Generic.prototype.initialize.apply(this,arguments)},updateSize:function(a,b){this.attr({".fobj":joint.util.assign({},b),div:{style:joint.util.assign({},b)}})},updateContent:function(a,b){joint.env.test("svgforeignobject")?this.attr({".content":{html:joint.util.sanitizeHTML(b)}}):this.attr({".content":{text:b}})},setForeignObjectSize:function(){this.updateSize.apply(this,arguments)},setDivContent:function(){this.updateContent.apply(this,arguments)}}),joint.shapes.basic.TextBlockView=joint.dia.ElementView.extend({initialize:function(){joint.dia.ElementView.prototype.initialize.apply(this,arguments),this.noSVGForeignObjectElement=!joint.env.test("svgforeignobject"),joint.env.test("svgforeignobject")||this.listenTo(this.model,"change:content change:size",function(a){this.updateContent(a)})},update:function(a,b){var c=this.model;if(joint.env.test("svgforeignobject"))joint.dia.ElementView.prototype.update.call(this,c,b);else{var d=joint.util.omit(b||c.get("attrs"),".content");joint.dia.ElementView.prototype.update.call(this,c,d),b&&!joint.util.has(b,".content")||this.updateContent(c,b)}},updateContent:function(a,b){var c=joint.util.merge({},(b||a.get("attrs"))[".content"]);c=joint.util.omit(c,"text");var d=joint.util.breakText(a.get("content"),a.get("size"),c,{svgDocument:this.paper.svg}),e=joint.util.setByPath({},".content",c,"/");e[".content"].text=d,joint.dia.ElementView.prototype.update.call(this,a,e)}}),function(a,b,c,d){"use strict";var e=a.Element;e.define("standard.Rectangle",{attrs:{body:{refWidth:"100%",refHeight:"100%",strokeWidth:2,stroke:"#000000",fill:"#FFFFFF"},label:{textVerticalAnchor:"middle",textAnchor:"middle",refX:"50%",refY:"50%",fontSize:14,fill:"#333333"}}},{markup:[{tagName:"rect",selector:"body"},{tagName:"text",selector:"label"}]}),e.define("standard.Circle",{attrs:{body:{refCx:"50%",refCy:"50%",refR:"50%",strokeWidth:2,stroke:"#333333",fill:"#FFFFFF"},label:{textVerticalAnchor:"middle",textAnchor:"middle",refX:"50%",refY:"50%",fontSize:14,fill:"#333333"}}},{markup:[{tagName:"circle",selector:"body"},{tagName:"text",selector:"label"}]}),e.define("standard.Ellipse",{attrs:{body:{refCx:"50%",refCy:"50%",refRx:"50%",refRy:"50%",strokeWidth:2,stroke:"#333333",fill:"#FFFFFF"},label:{textVerticalAnchor:"middle",textAnchor:"middle",refX:"50%",refY:"50%",fontSize:14,fill:"#333333"}}},{markup:[{tagName:"ellipse",selector:"body"},{tagName:"text",selector:"label"}]}),e.define("standard.Path",{attrs:{body:{refD:"M 0 0 L 10 0 10 10 0 10 Z",strokeWidth:2,stroke:"#333333",fill:"#FFFFFF"},label:{textVerticalAnchor:"middle",textAnchor:"middle",refX:"50%",refY:"50%",fontSize:14,fill:"#333333"}}},{markup:[{tagName:"path",selector:"body"},{tagName:"text",selector:"label"}]}),e.define("standard.Polygon",{attrs:{body:{refPoints:"0 0 10 0 10 10 0 10",strokeWidth:2,stroke:"#333333",fill:"#FFFFFF"},label:{textVerticalAnchor:"middle",textAnchor:"middle",refX:"50%",refY:"50%",fontSize:14,fill:"#333333"}}},{markup:[{tagName:"polygon",selector:"body"},{tagName:"text",selector:"label"}]}),e.define("standard.Polyline",{attrs:{body:{refPoints:"0 0 10 0 10 10 0 10 0 0",strokeWidth:2,stroke:"#333333",fill:"#FFFFFF"},label:{textVerticalAnchor:"middle",textAnchor:"middle",refX:"50%",refY:"50%",fontSize:14,fill:"#333333"}}},{markup:[{tagName:"polyline",selector:"body"},{tagName:"text",selector:"label"}]}),e.define("standard.Image",{attrs:{image:{refWidth:"100%",refHeight:"100%"},label:{textVerticalAnchor:"top",textAnchor:"middle",refX:"50%",refY:"100%",refY2:10,fontSize:14,fill:"#333333"}}},{markup:[{tagName:"image",selector:"image"},{tagName:"text",selector:"label"}]}),e.define("standard.BorderedImage",{attrs:{border:{refWidth:"100%",refHeight:"100%",stroke:"#333333",strokeWidth:2},image:{refWidth:-1,refHeight:-1,x:.5,y:.5},label:{textVerticalAnchor:"top",textAnchor:"middle",refX:"50%",refY:"100%",refY2:10,fontSize:14,fill:"#333333"}}},{markup:[{tagName:"image",selector:"image"},{tagName:"rect",selector:"border",attributes:{fill:"none"}},{tagName:"text",selector:"label"}]}),e.define("standard.EmbeddedImage",{attrs:{body:{refWidth:"100%",refHeight:"100%",stroke:"#333333",fill:"#FFFFFF",strokeWidth:2},image:{refWidth:"30%",refHeight:-20,x:10,y:10,preserveAspectRatio:"xMidYMin"},label:{textVerticalAnchor:"top",textAnchor:"left",refX:"30%",refX2:20,refY:10,fontSize:14,fill:"#333333"}}},{markup:[{tagName:"rect",selector:"body"},{tagName:"image",selector:"image"},{tagName:"text",selector:"label"}]}),e.define("standard.HeaderedRectangle",{attrs:{body:{refWidth:"100%",refHeight:"100%",strokeWidth:2,stroke:"#000000",fill:"#FFFFFF"},header:{refWidth:"100%",height:30,strokeWidth:2,stroke:"#000000",fill:"#FFFFFF"},headerText:{textVerticalAnchor:"middle",textAnchor:"middle",refX:"50%",refY:15,fontSize:16,fill:"#333333"},bodyText:{textVerticalAnchor:"middle",textAnchor:"middle",refX:"50%",refY:"50%",refY2:15,fontSize:14,fill:"#333333"}}},{markup:[{tagName:"rect",selector:"body"},{tagName:"rect",selector:"header"},{tagName:"text",selector:"headerText"},{tagName:"text",selector:"bodyText"}]});var f=10;joint.dia.Element.define("standard.Cylinder",{attrs:{body:{lateralArea:f,fill:"#FFFFFF",stroke:"#333333",strokeWidth:2}
60,top:{refCx:"50%",cy:f,refRx:"50%",ry:f,fill:"#FFFFFF",stroke:"#333333",strokeWidth:2},label:{textVerticalAnchor:"middle",textAnchor:"middle",refX:"50%",refY:"100%",refY2:15,fontSize:14,fill:"#333333"}}},{markup:[{tagName:"path",selector:"body"},{tagName:"ellipse",selector:"top"},{tagName:"text",selector:"label"}],topRy:function(a,c){
61if(void 0===a)return this.attr("body/lateralArea");var d=b.isPercentage(a),e={lateralArea:a},f=d?{refCy:a,refRy:a,cy:null,ry:null}:{refCy:null,refRy:null,cy:a,ry:a};return this.attr({body:e,top:f},c)}},{attributes:{lateralArea:{set:function(a,c){var e=b.isPercentage(a);e&&(a=parseFloat(a)/100);var f=c.x,g=c.y,h=c.width,i=c.height,j=h/2,k=e?i*a:a,l=d.KAPPA,m=l*j,n=l*(e?i*a:a),o=f,p=f+h/2,q=f+h,r=g+k,s=r-k,t=g+i-k,u=g+i,v=["M",o,r,"L",o,t,"C",f,t+n,p-m,u,p,u,"C",p+m,u,q,t+n,q,t,"L",q,r,"C",q,r-n,p+m,s,p,s,"C",p-m,s,o,r-n,o,r,"Z"];return{d:v.join(" ")}}}}});var g={tagName:"foreignObject",selector:"foreignObject",attributes:{overflow:"hidden"},children:[{tagName:"div",namespaceURI:"http://www.w3.org/1999/xhtml",selector:"label",style:{width:"100%",height:"100%",position:"static",backgroundColor:"transparent",textAlign:"center",margin:0,padding:"0px 5px",boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center"}}]},h={tagName:"text",selector:"label",attributes:{"text-anchor":"middle"}},i=c.test("svgforeignobject")?g:h;e.define("standard.TextBlock",{attrs:{body:{refWidth:"100%",refHeight:"100%",stroke:"#333333",fill:"#ffffff",strokeWidth:2},foreignObject:{refWidth:"100%",refHeight:"100%"},label:{style:{fontSize:14}}}},{markup:[{tagName:"rect",selector:"body"},i]},{attributes:{text:{set:function(c,d,e,f){if(!(e instanceof HTMLElement)){var g=f.style||{},h={text:c,width:-5,height:"100%"},i=b.assign({textVerticalAnchor:"middle"},g);return a.attributes.textWrap.set.call(this,h,d,e,i),{fill:g.color||null}}e.textContent=c},position:function(a,b,c){if(c instanceof SVGElement)return b.center()}}}});var j=a.Link;j.define("standard.Link",{attrs:{line:{connection:!0,stroke:"#333333",strokeWidth:2,strokeLinejoin:"round",targetMarker:{type:"path",d:"M 10 -5 0 0 10 5 z"}},wrapper:{connection:!0,strokeWidth:10,strokeLinejoin:"round"}}},{markup:[{tagName:"path",selector:"wrapper",attributes:{fill:"none",cursor:"pointer",stroke:"transparent"}},{tagName:"path",selector:"line",attributes:{fill:"none","pointer-events":"none"}}]}),j.define("standard.DoubleLink",{attrs:{line:{connection:!0,stroke:"#DDDDDD",strokeWidth:4,strokeLinejoin:"round",targetMarker:{type:"path",stroke:"#000000",d:"M 10 -3 10 -10 -2 0 10 10 10 3"}},outline:{connection:!0,stroke:"#000000",strokeWidth:6,strokeLinejoin:"round"}}},{markup:[{tagName:"path",selector:"outline",attributes:{fill:"none"}},{tagName:"path",selector:"line",attributes:{fill:"none"}}]}),j.define("standard.ShadowLink",{attrs:{line:{connection:!0,stroke:"#FF0000",strokeWidth:20,strokeLinejoin:"round",targetMarker:{type:"path",stroke:"none",d:"M 0 -10 -10 0 0 10 z"},sourceMarker:{type:"path",stroke:"none",d:"M -10 -10 0 0 -10 10 0 10 0 -10 z"}},shadow:{connection:!0,refX:3,refY:6,stroke:"#000000",strokeOpacity:.2,strokeWidth:20,strokeLinejoin:"round",targetMarker:{type:"path",d:"M 0 -10 -10 0 0 10 z",stroke:"none"},sourceMarker:{type:"path",stroke:"none",d:"M -10 -10 0 0 -10 10 0 10 0 -10 z"}}}},{markup:[{tagName:"path",selector:"shadow",attributes:{fill:"none"}},{tagName:"path",selector:"line",attributes:{fill:"none"}}]})}(joint.dia,joint.util,joint.env,V),joint.routers.manhattan=function(a,b,c){"use strict";function d(a){this.map={},this.options=a,this.mapGridSize=100}function e(){this.items=[],this.hash={},this.values={},this.OPEN=1,this.CLOSE=2}function f(a,b){return b&&b.paddingBox?a.sourceBBox.clone().moveAndExpand(b.paddingBox):a.sourceBBox.clone()}function g(a,b){return b&&b.paddingBox?a.targetBBox.clone().moveAndExpand(b.paddingBox):a.targetBBox.clone()}function h(a,b){if(a.sourceAnchor)return a.sourceAnchor;var c=f(a,b);return c.center()}function i(a,b){if(a.targetAnchor)return a.targetAnchor;var c=g(a,b);return c.center()}function j(b,c,d,e,f){var g=360/d,h=b.theta(k(b,c,e,f)),i=a.normalizeAngle(h+g/2);return g*Math.floor(i/g)}function k(b,c,d,e){var f=e.step,g=c.x-b.x,h=c.y-b.y,i=g/d.x,j=h/d.y,k=i*f,l=j*f;return new a.Point(b.x+k,b.y+l)}function l(a,b){var c=Math.abs(a-b);return c>180?360-c:c}function m(a,b,d){var e=d.step;
61c.toArray(d.directions).forEach(function(a){a.gridOffsetX=a.offsetX/e*b.x,a.gridOffsetY=a.offsetY/e*b.y})}function n(a,b,c){return{source:b.clone(),x:o(c.x-b.x,a),y:o(c.y-b.y,a)}}function o(a,b){if(!a)return b;var c=Math.abs(a),d=Math.round(c/b);if(!d)return c;var e=d*b,f=c-e,g=f/d;return b+g}function p(b,c){var d=c.source,e=a.snapToGrid(b.x-d.x,c.x)+d.x,f=a.snapToGrid(b.y-d.y,c.y)+d.y;return new a.Point(e,f)}function q(a,b){return a?a.round(b.precision):a}function r(a){return a.clone().round().toString()}function s(b){return new a.Point(0===b.x?0:Math.abs(b.x)/b.x,0===b.y?0:Math.abs(b.y)/b.y)}function t(a,b,c,d,e,f){for(var g,h=[],i=s(e.difference(c)),j=r(c),k=a[j];k;){g=q(b[j],f);var l=s(g.difference(q(k.clone(),f)));l.equals(i)||(h.unshift(g),i=l),j=r(k),k=a[j]}var m=q(b[j],f),n=s(m.difference(d));return n.equals(i)||h.unshift(m),h}function u(a,b){for(var c=1/0,d=0,e=b.length;d<e;d++){var f=a.manhattanDistance(b[d]);f<c&&(c=f)}return c}function v(b,d,e,f,g){var h=g.directionMap,i=q(p(b,f),g),j=q(p(d.center(),f),g),k=i.difference(j),l=c.isObject(h)?Object.keys(h):[],m=c.toArray(e),n=l.reduce(function(c,e){if(m.includes(e)){for(var j,l=h[e],n=new a.Point(i.x+l.x*(Math.abs(k.x)+d.width),i.y+l.y*(Math.abs(k.y)+d.height)),o=new a.Line(b,n),r=o.intersect(d)||[],s=r.length,t=null,u=0;u<s;u++){var v=r[u],w=i.squaredDistance(v);(void 0===j||w>j)&&(j=w,t=p(v,f))}var x=q(t,g);x&&(d.containsPoint(x)&&q(x.offset(l.x*f.x,l.y*f.y),g),c.push(x))}return c},[]);return d.containsPoint(i)||n.push(i),n}function w(b,d,f,g){var k,o;k=b instanceof a.Rect?h(this,g).clone():b.clone(),o=d instanceof a.Rect?i(this,g).clone():d.clone();var s,w,x,y,z=n(g.step,k,o);if(b instanceof a.Rect?(s=q(p(k,z),g),x=v(s,b,g.startDirections,z,g)):(s=q(p(k,z),g),x=[s]),d instanceof a.Rect?(w=q(p(o,z),g),y=v(o,d,g.endDirections,z,g)):(w=q(p(o,z),g),y=[w]),x=x.filter(f.isPointAccessible,f),y=y.filter(f.isPointAccessible,f),x.length>0&&y.length>0){for(var A=new e,B={},C={},D={},E=0,F=x.length;E<F;E++){var G=x[E],H=r(G);A.add(H,u(G,y)),B[H]=G,D[H]=0}var I,J,K=g.previousDirectionAngle,L=void 0===K,M=g.directions;m(M,z,g);for(var N=M.length,O=c.toArray(y).reduce(function(a,b){var c=r(b);return a.push(c),a},[]),P=g.maximumLoops;!A.isEmpty()&&P>0;){var Q,R=A.pop(),S=B[R],T=C[R],U=D[R],V=void 0===T,W=S.equals(s);if(Q=V?L?W?null:j(s,S,N,z,g):K:j(T,S,N,z,g),O.indexOf(R)>=0)return g.previousDirectionAngle=Q,t(C,B,S,s,w,g);for(E=0;E<N;E++){I=M[E];var X=I.angle;if(J=l(Q,X),L&&W||!(J>g.maxAllowedDirectionChange)){var Y=S.clone().offset(I.gridOffsetX,I.gridOffsetY),Z=r(Y);if(!A.isClose(Z)&&f.isPointAccessible(Y)){if(O.indexOf(Z)>=0){q(Y,g);var $=Y.equals(w);if(!$){var _=j(Y,w,N,z,g),aa=l(X,_);if(aa>g.maxAllowedDirectionChange)continue}}var ba=I.cost,ca=W?0:g.penalties[J],da=U+ba+ca;(!A.isOpen(Z)||da<D[Z])&&(B[Z]=Y,C[Z]=S,D[Z]=da,A.add(Z,da+u(Y,y)))}}}P--}}return g.fallbackRoute.call(this,s,w,g)}function x(b){b.directions=c.result(b,"directions"),b.penalties=c.result(b,"penalties"),b.paddingBox=c.result(b,"paddingBox"),c.toArray(b.directions).forEach(function(b){var c=new a.Point(0,0),d=new a.Point(b.offsetX,b.offsetY);b.angle=a.normalizeAngle(c.theta(d))})}function y(b,e,i){x(e),i.options.perpendicular=!!e.perpendicular;for(var j=f(i,e),k=g(i,e),l=h(i,e),m=new d(e).build(i.paper.model,i.model),n=c.toArray(b).map(a.Point),o=[],p=l,q=0,r=n.length;q<=r;q++){var s=null,t=u||j,u=n[q];if(!u){u=k;var v=!i.model.get("source").id||!i.model.get("target").id;if(v&&c.isFunction(e.draggingRoute)){var y=t===j?l:t,z=u.origin();s=e.draggingRoute.call(i,y,z,e)}}if(s=s||w.call(i,t,u,m,e),null===s)return e.fallbackRouter(b,e,i);var A=s[0];A&&A.equals(p)&&s.shift(),p=s[s.length-1]||p,Array.prototype.push.apply(o,s)}return o}var z={step:10,maximumLoops:2e3,precision:10,maxAllowedDirectionChange:90,perpendicular:!0,excludeEnds:[],excludeTypes:["basic.Text"],startDirections:["top","right","bottom","left"],endDirections:["top","right","bottom","left"],directionMap:{top:{x:0,y:-1},right:{x:1,y:0},bottom:{x:0,y:1},left:{x:-1,y:0}},cost:function(){return this.step},directions:function(){var a=this.step,b=this.cost();return[{offsetX:a,offsetY:0,cost:b},{offsetX:0,offsetY:a,cost:b},{offsetX:-a,offsetY:0,cost:b},{offsetX:0,offsetY:-a,cost:b}]},penalties:function(){return{0:0,45:this.step/2,90:this.step/2}},paddingBox:function(){var a=this.step;return{x:-a,y:-a,width:2*a,height:2*a}},fallbackRouter:function(a,d,e){if(!c.isFunction(b.routers.orthogonal))throw new Error("Manhattan requires the orthogonal router as default fallback.");return b.routers.orthogonal(a,c.assign({},z,d),e)},fallbackRoute:function(a,b,c){return null},draggingRoute:null};return d.prototype.build=function(a,b){var d=this.options,e=c.toArray(d.excludeEnds).reduce(function(c,d){var e=b.get(d);if(e){var f=a.getCell(e.id);f&&c.push(f)}return c},[]),f=[],g=a.getCell(b.get("source").id);g&&(f=c.union(f,g.getAncestors().map(function(a){return a.id})));var h=a.getCell(b.get("target").id);h&&(f=c.union(f,h.getAncestors().map(function(a){return a.id})));var i=this.mapGridSize;return a.getElements().reduce(function(a,b){var g=c.toArray(d.excludeTypes).includes(b.get("type")),h=e.find(function(a){return a.id===b.id}),j=f.includes(b.id),k=g||h||j;if(!k)for(var l=b.getBBox().moveAndExpand(d.paddingBox),m=l.origin().snapToGri
61d(i),n=l.corner().snapToGrid(i),o=m.x;o<=n.x;o+=i)for(var p=m.y;p<=n.y;p+=i){var q=o+"@"+p;a[q]=a[q]||[],a[q].push(l)}return a},this.map),this},d.prototype.isPointAccessible=function(a){var b=a.clone().snapToGrid(this.mapGridSize).toString();return c.toArray(this.map[b]).every(function(b){return!b.containsPoint(a)})},e.prototype.add=function(a,c){this.hash[a]?this.items.splice(this.items.indexOf(a),1):this.hash[a]=this.OPEN,this.values[a]=c;var d=b.util.sortedIndex(this.items,a,function(a){return this.values[a]}.bind(this));this.items.splice(d,0,a)},e.prototype.remove=function(a){this.hash[a]=this.CLOSE},e.prototype.isOpen=function(a){return this.hash[a]===this.OPEN},e.prototype.isClose=function(a){return this.hash[a]===this.CLOSE},e.prototype.isEmpty=function(){return 0===this.items.length},e.prototype.pop=function(){var a=this.items.shift();return this.remove(a),a},function(a,b,d){return y(a,c.assign({},z,b),d)}}(g,joint,joint.util),joint.routers.metro=function(a){var b={maxAllowedDirectionChange:45,diagonalCost:function(){var a=this.step;return Math.ceil(Math.sqrt(a*a<<1))},directions:function(){var a=this.step,b=this.cost(),c=this.diagonalCost();return[{offsetX:a,offsetY:0,cost:b},{offsetX:a,offsetY:a,cost:c},{offsetX:0,offsetY:a,cost:b},{offsetX:-a,offsetY:a,cost:c},{offsetX:-a,offsetY:0,cost:b},{offsetX:-a,offsetY:-a,cost:c},{offsetX:0,offsetY:-a,cost:b},{offsetX:a,offsetY:-a,cost:c}]},fallbackRoute:function(a,b,c){var d=a.theta(b),e=[],f={x:b.x,y:a.y},h={x:a.x,y:b.y};if(d%180>90){var i=f;f=h,h=i}var j=d%90<45?f:h,k=new g.Line(a,j),l=90*Math.ceil(d/90),m=g.Point.fromPolar(k.squaredLength(),g.toRad(l+135),j),n=new g.Line(b,m),o=k.intersection(n),p=o?o:b,q=o?p:a,r=360/c.directions.length,s=q.theta(b),t=g.normalizeAngle(s+r/2),u=r*Math.floor(t/r);return c.previousDirectionAngle=u,p&&e.push(p.round()),e.push(b),e}};return function(c,d,e){if(!a.isFunction(joint.routers.manhattan))throw new Error("Metro requires the manhattan router.");return joint.routers.manhattan(c,a.assign({},b,d),e)}}(joint.util),joint.routers.normal=function(a,b,c){return a},joint.routers.oneSide=function(a,b,c){var d,e,f,g=b.side||"bottom",h=b.padding||40,i=c.sourceBBox,j=c.targetBBox,k=i.center(),l=j.center();switch(g){case"bottom":f=1,d="y",e="height";break;case"top":f=-1,d="y",e="height";break;case"left":f=-1,d="x",e="width";break;case"right":f=1,d="x",e="width";break;default:throw new Error("Router: invalid side")}return k[d]+=f*(i[e]/2+h),l[d]+=f*(j[e]/2+h),f*(k[d]-l[d])>0?l[d]=k[d]:k[d]=l[d],[k].concat(a,l)},joint.routers.orthogonal=function(a){function b(a,b,c){var d=new g.Point(a.x,b.y);return c.containsPoint(d)&&(d=new g.Point(b.x,a.y)),d}function c(a,b){return a["W"===b||"E"===b?"width":"height"]}function d(a,b){return a.x===b.x?a.y>b.y?"N":"S":a.y===b.y?a.x>b.x?"W":"E":null}function e(a){return new g.Rect(a.x,a.y,0,0)}function f(a,b){var c=b&&b.elementPadding||20;return a.sourceBBox.clone().inflate(c)}function h(a,b){var c=b&&b.elementPadding||20;return a.targetBBox.clone().inflate(c)}function i(a,b){if(a.sourceAnchor)return a.sourceAnchor;var c=f(a,b);return c.center()}function j(a,b){if(a.targetAnchor)return a.targetAnchor;var c=h(a,b);return c.center()}function k(a,b,c){var e=new g.Point(a.x,b.y),f=new g.Point(b.x,a.y),h=d(a,e),i=d(a,f),j=q[c],k=h===c||h!==j&&(i===j||i!==c)?e:f;return{points:[k],direction:d(k,b)}}function l(a,c,e){var f=b(a,c,e);return{points:[f],direction:d(f,c)}}function m(e,f,h,i){var j,k={},l=[new g.Point(e.x,f.y),new g.Point(f.x,e.y)],m=l.filter(function(a){return!h.containsPoint(a)}),n=m.filter(function(a){return d(a,e)!==i});if(n.length>0)j=n.filter(function(a){return d(e,a)===i}).pop(),j=j||n[0],k.points=[j],k.direction=d(j,f);else{j=a.difference(l,m)[0];var o=new g.Point(f).move(j,-c(h,i)/2),p=b(o,e,h);k.points=[p,o],k.direction=d(o,f)}return k}function n(a,b,e,f){var h=l(b,a,f),i=h.points[0];if(e.containsPoint(i)){h=l(a,b,e);var j=h.points[0];if(f.containsPoint(j)){var m=new g.Point(a).move(j,-c(e,d(a,j))/2),n=new g.Point(b).move(i,-c(f,d(b,i))/2),o=new g.Line(m,n).midpoint(),p=l(a,o,e),q=k(o,b,p.direction);h.points=[p.points[0],q.points[0]],h.direction=q.direction}}return h}function o(a,c,e,f,h){var i,j,k,l={},m=e.union(f).inflate(1),n=m.center().distance(c)>m.center().distance(a),o=n?c:a,p=n?a:c;return h?(i=g.Point.fromPolar(m.width+m.height,r[h],o),i=m.pointNearestToPoint(i).move(i,-1)):i=m.pointNearestToPoint(o).move(o,1),j=b(i,p,m),i.roun
61d().equals(j.round())?(j=g.Point.fromPolar(m.width+m.height,g.toRad(i.theta(o))+Math.PI/2,p),j=m.pointNearestToPoint(j).move(p,1).round(),k=b(i,j,m),l.points=n?[j,k,i]:[i,k,j]):l.points=n?[j,i]:[i,j],l.direction=n?d(i,c):d(j,c),l}function p(b,c,p){var q=c.elementPadding||20,r=f(p,c),s=h(p,c),t=i(p,c),u=j(p,c);r=r.union(e(t)),s=s.union(e(u)),b=a.toArray(b).map(g.Point),b.unshift(t),b.push(u);for(var v,w=[],x=0,y=b.length-1;x<y;x++){var z=null,A=b[x],B=b[x+1],C=!!d(A,B);if(0===x)x+1===y?r.intersect(s.clone().inflate(1))?z=o(A,B,r,s):C||(z=n(A,B,r,s)):r.containsPoint(B)?z=o(A,B,r,e(B).inflate(q)):C||(z=l(A,B,r));else if(x+1===y){var D=C&&d(B,A)===v;s.containsPoint(A)||D?z=o(A,B,e(A).inflate(q),s,v):C||(z=m(A,B,s,v))}else C||(z=k(A,B,v));z?(Array.prototype.push.apply(w,z.points),v=z.direction):v=d(A,B),x+1<y&&w.push(B)}return w}var q={N:"S",S:"N",E:"W",W:"E"},r={N:-Math.PI/2*3,S:-Math.PI/2,E:0,W:Math.PI};return p}(joint.util),joint.connectors.normal=function(a,b,c,d){var e=d&&d.raw,f=[a].concat(c).concat([b]),h=new g.Polyline(f),i=new g.Path(h);return e?i:i.serialize()},joint.connectors.rounded=function(a,b,c,d){d||(d={});var e,f=d.radius||10,h=d.raw,i=new g.Path;e=g.Path.createSegment("M",a),i.appendSegment(e);for(var j,k,l,m,n,o,p,q,r,s,t,u=1/3,v=2/3,w=0,x=c.length;w<x;w++)j=new g.Point(c[w]),k=c[w-1]||a,l=c[w+1]||b,m=n||j.distance(k)/2,n=j.distance(l)/2,o=-Math.min(f,m),p=-Math.min(f,n),q=j.clone().move(k,o).round(),r=j.clone().move(l,p).roun
61d(),s=new g.Point(u*q.x+v*j.x,v*j.y+u*q.y),t=new g.Point(u*r.x+v*j.x,v*j.y+u*r.y),e=g.Path.createSegment("L",q),i.appendSegment(e),e=g.Path.createSegment("C",s,t,r),i.appendSegment(e);return e=g.Path.createSegment("L",b),i.appendSegment(e),h?i:i.serialize()},joint.connectors.smooth=function(a,b,c,d){var e,f=d&&d.raw;if(c&&0!==c.length){var h=[a].concat(c).concat([b]),i=g.Curve.throughPoints(h);e=new g.Path(i)}else{e=new g.Path;var j;if(j=g.Path.createSegment("M",a),e.appendSegment(j),Math.abs(a.x-b.x)>=Math.abs(a.y-b.y)){var k=(a.x+b.x)/2;j=g.Path.createSegment("C",k,a.y,k,b.y,b.x,b.y),e.appendSegment(j)}else{var l=(a.y+b.y)/2;j=g.Path.createSegment("C",a.x,l,b.x,l,b.x,b.y),e.appendSegment(j)}}return f?e:e.serialize()},joint.connectors.jumpover=function(a,b){function c(b,c,d){var e=[].concat(b,d,c);return e.reduce(function(b,c,d){var f=e[d+1];return null!=f&&(b[d]=a.line(c,f)),b},[])}function d(a){var b=a.paper._jumpOverUpdateList;null==b&&(b=a.paper._jumpOverUpdateList=[],a.paper.on("cell:pointerup",e),a.paper.model.on("reset",function(){b=a.paper._jumpOverUpdateList=[]})),b.indexOf(a)<0&&(b.push(a),a.listenToOnce(a.model,"change:connector remove",function(){b.splice(b.indexOf(a),1)}))}function e(){for(var a=this._jumpOverUpdateList,b=0;b<a.length;b++)a[b].update()}function f(a,c){return b.toArray(c).reduce(function(b,c){var d=a.intersection(c);return d&&b.push(d),b},[])}function g(b,c){return a.line(b,c).squaredLength()}function h(b,c,d){return c.reduce(function(e,f,g){if(f.skip===!0)return e;var h=e.pop()||b,i=a.point(f).move(h.start,-d),j=a.point(f).move(h.start,+d),k=c[g+1];if(null!=k){var m=j.distance(k);m<=d&&(j=k.move(h.start,m),k.skip=!0)}else{var n=i.distance(h.end);if(n<2*d+l)return e.push(h),e}var o=j.distance(h.start);if(o<2*d+l)return e.push(h),e;var p=a.line(i,j);return p.isJump=!0,e.push(a.line(h.start,i),p,a.line(j,h.end)),e},[])}function i(b,c,d){var e,f=new a.Path;return e=a.Path.createSegment("M",b[0].start),f.appendSegment(e),joint.util.toArray(b).forEach(function(b,g){if(b.isJump){var h,i,j,k;if("arc"===d){h=-90,i=b.start.difference(b.end);var l=Number(i.x<0||0===i.x&&i.y<0);l&&(h+=180);var m,n=b.midpoint(),o=new a.Line(n,b.end).rotate(n,h);m=new a.Line(b.start,n),j=m.pointAt(2/3).rotate(b.start,h),k=o.pointAt(1/3).rotate(o.end,-h),e=a.Path.createSegment("C",j,k,o.end),f.appendSegment(e),m=new a.Line(n,b.end),j=o.pointAt(1/3).rotate(o.end,h),k=m.pointAt(1/3).rotate(b.end,-h),e=a.Path.createSegment("C",j,k,b.end),f.appendSegment(e)}else if("gap"===d)e=a.Path.createSegment("M",b.end),f.appendSegment(e);else if("cubic"===d){h=b.start.theta(b.end);var p=.6*c,q=1.35*c;i=b.start.difference(b.end),l=Number(i.x<0||0===i.x&&i.y<0),l&&(q*=-1),j=a.Point(b.start.x+p,b.start.y+q).rotate(b.start,h),k=a.Point(b.end.x-p,b.end.y+q).rotate(b.end,h),e=a.Path.createSegment("C",j,k,b.end),f.appendSegment(e)}}else e=a.Path.createSegment("L",b.end),f.appendSegment(e)}),f}var j=5,k=["arc","gap","cubic"],l=1,m=["smooth"];return function(a,e,l,n){d(this);var o=n.raw,p=n.size||j,q=n.jump&&(""+n.jump).toLowerCase(),r=n.ignoreConnectors||m;k.indexOf(q)===-1&&(q=k[0]);var s=this.paper,t=s.model,u=t.getLinks();if(1===u.length)return i(c(a,e,l),p,q);var v=this.model,w=u.indexOf(v),x=s.options.defaultConnector||{},y=u.filter(function(a,c){var d=a.get("connector")||x;return!b.toArray(r).includes(d.name)&&(!(c>w)||"jumpover"!==d.name)}),z=y.map(function(a){return s.findViewByModel(a)}),A=c(a,e,l),B=z.map(function(a){return null==a?[]:a===this?A:c(a.sourcePoint,a.targetPoint,a.route)},this),C=A.reduce(function(a,b){var c=y.reduce(function(a,c,d){if(c!==v){var e=f(b,B[d]);a.push.apply(a,e)}return a},[]).sort(function(a,c){return g(b.start,a)-g(b.start,c)});return c.length>0?a.push.apply(a,h(b,c,p)):a.push(b),a},[]),D=i(C,p,q);return o?D:D.serialize()}}(g,joint.util),function(a,b,c){function d(a,c,d){var e=a.toJSON();return e.angle=c||0,b.util.defaults({},d,e)}function e(b,c,e){return b.map(function(a,b,c){var e=this.pointAt((b+.5)/c.length);return(a.dx||a.dy)&&e.offset(a.dx||0,a.dy||0),d(e.round(),0,a)},a.line(c,e))}function f(b,c,e,f){var g=c.center(),h=c.width/c.height,i=c.topMiddle(),j=a.Ellipse.fromRect(c);return b.map(function(a,b,c){var k=e+f(b,c.length),l=i.clone().rotate(g,-k).scale(h,1,g),m=a.compensateRotation?-j.tangentTheta(l):0;return(a.dx||a.dy)&&l.offset(a.dx||0,a.dy||0),a.dr&&l.move(g,a.dr),d(l.round(),m,a)})}function g(b,d){var e=d.x;c.isString(e)&&(e=parseFloat(e)/100*b.width);var f=d.y;return c.isString(f)&&(f=parseFloat(f)/100*b.height),a.point(e||0,f||0)}b.layout.Port={absolute:function(a,b,c){return a.map(g.bind(null,b))},fn:function(a,b,c){return c.fn(a,b,c)},line:function(a,b,c){var d=g(b,c.start||b.origin()),f=g(b,c.end||b.corner());return e(a,d,f)},left:function(a,b,c){return e(a,b.origin(),b.bottomLeft())},right:function(a,b,c){return e(a,b.topRight(),b.corner())},top:function(a,b,c){return e(a,b.origin(),b.topRight())},bottom:function(a,b,c){return e(a,b.bottomLeft(),b.corner())},ellipseSpread:function(a,b,c){var d=c.startAngle||0,e=c.step||360/a.length;return f(a,b,d,function(a){return a*e})},ellipse:function(a,b,c){var d=c.startAngle||0,e=c.step||20;return f(a,b,d,function(a,b){return(a+.5-b/2)*e})}}}(g,joint,joint.util),function(a,b,c){function d(a,b){return c.defaultsDeep({},a,b,{x:0,y:0,angle:0,attrs:{".":{y:"0","text-anchor":"start"}}})}function e(a,b,e,g){g=c.defaults({},g,{offset:15});var h,i,j,k,l=b.center().theta(a),m=f(b),n=g.offset,o=0;l<m[1]||l>m[2]?(j=".3em",h=n,i=0,k="start"):l<m[0]?(j="0",h=0,i=-n,e?(o=-90,k="start"):k="middle"):l<m[3]?(j=".3em",h=-n,i=0,k="end"):(j=".6em",h=0,i=n,e?(o=90,k="start"):k="middle");var p=Math.round;return d({x:p(h),y:p(i),angle:o,attrs:{".":{y:j,"text-anchor":k}}})}function f(a){var b=a.center(),c=b.theta(a.origin()),d=b.theta(a.bottomLeft()),e=b.theta(a.corner()),f=b.theta(a.topRight());return[c,f,e,d]}function g(a,b,e,g){var h=b.center().theta(a);g=c.defaults({},g,{offset:15});var i,j,k,l,m=g.offset,n=0,o=f(b);h<o[1]||h>o[2]?(k=".3em",i=-m,j=0,l="end"):h<o[0]?(k=".6em",i=0,j=m,e?(n=90,l="start"):l="middle"):h<o[3]?(k=".3em",i=m,j=0,l="start"):(k="0em",i=0,j=-m,e?(n=-90,l="start"):l="middle");var p=Math.round;return d({x:p(i),y:p(j),angle:n,attrs:{".":{y:k,"text-anchor":l}}})}function h(b,e,f){f=c.defaults({},f,{offset:20});var g,h=a.point(0,0),i=-b.theta(h),j=i,k=b.clone().move(h,f.offset).difference(b).round(),l=".3em";(i+90)%180===0?(g=e?"end":"middle",e||i!==-270||(l="0em")):i>-270&&i<-90?(g="start",j=i-180):g="end";var m=Math.round;return d({x:m(k.x),y:m(k.y),angle:e?j:0,attrs:{".":{y:l,"text-anchor":g}}})}b.layout.PortLabel={manual:function(a,b,c){return d(c,b)}
61,left:function(a,b,c){return d(c,{x:-15,attrs:{".":{y:".3em","text-anchor":"end"}}})},right:function(a,b,c){return d(c,{x:15,attrs:{".":{y:".3em","text-anchor":"start"}}})},top:function(a,b,c){return d(c,{y:-15,attrs:{".":{"text-anchor":"middle"}}})},bottom:function(a,b,c){return d(c,{y:15,attrs:{".":{y:".6em","text-anchor":"middle"}}})},outsideOriented:function(a,b,c){return e(a,b,!0,c)},outside:function(a,b,c){return e(a,b,!1,c)},insideOriented:function(a,b,c){return g(a,b,!0,c)},inside:function(a,b,c){return g(a,b,!1,c)},radial:function(a,b,c){return h(a.difference(b.center()),!1,c)},radialOriented:function(a,b,c){return h(a.difference(b.center()),!0,c)}}}(g,joint,joint.util),joint.highlighters.addClass={className:joint.util.addClassNamePrefix("highlighted"),highlight:function(a,b,c){var d=c||{},e=d.className||this.className;V(b).addClass(e)},unhighlight:function(a,b,c){var d=c||{},e=d.className||this.className;V(b).removeClass(e)}},joint.highlighters.opacity={highlight:function(a,b){V(b).addClass(joint.util.addClassNamePrefix("highlight-opacity"))},unhighlight:function(a,b){V(b).removeClass(joint.util.addClassNamePrefix("highlight-opacity"))}},joint.highlighters.stroke={defaultOptions:{padding:3,rx:0,ry:0,attrs:{"stroke-width":3,stroke:"#FEB663"}},_views:{},getHighlighterId:function(a,b){return a.id+JSON.stringify(b)},removeHighlighter:function(a){this._views[a]&&(this._views[a].remove(),this._views[a]=null)},highlight:function(a,b,c){var d=this.getHighlighterId(b,c);if(!this._views[d]){var e,f=joint.util.defaults(c||{},this.defaultOptions),g=V(b);try{var h=g.convertToPathData()}catch(a){e=g.bbox(!0),h=V.rectToPath(joint.util.assign({},f,e))}var i=V("path").attr({d:h,"pointer-events":"none","vector-effect":"non-scaling-stroke",fill:"none"}).attr(f.attrs),j=g.getTransformToElement(a.el),k=f.padding;if(k){e||(e=g.bbox(!0));var l=e.x+e.width/2,m=e.y+e.height/2;e=V.transformRect(e,j);var n=Math.max(e.width,1),o=Math.max(e.height,1),p=(n+k)/n,q=(o+k)/o,r=V.createSVGMatrix({a:p,b:0,c:0,d:q,e:l-p*l,f:m-q*m});j=j.multiply(r)}i.transform(j);var s=this._views[d]=new joint.mvc.View({svgElement:!0,className:"highlight-stroke",el:i.node}),t=this.removeHighlighter.bind(this,d),u=a.model;s.listenTo(u,"remove",t),s.listenTo(u.graph,"reset",t),a.vel.append(i)}},unhighlight:function(a,b,c){this.removeHighlighter(this.getHighlighterId(b,c))}},function(a,b){function c(a){return function(c,d,e,f){var g=!!f.rotate,h=g?c.getNodeUnrotatedBBox(d):c.getNodeBBox(d),i=h[a](),j=f.dx;if(j){var k=b.isPercentage(j);j=parseFloat(j),isFinite(j)&&(k&&(j/=100,j*=h.width),i.x+=j)}var l=f.dy;if(l){var m=b.isPercentage(l);l=parseFloat(l),isFinite(l)&&(m&&(l/=100,l*=h.height),i.y+=l)}return g?i.rotate(c.model.getBBox().center(),-c.model.angle()):i}}function d(a){return function(b,c,d,e){if(d instanceof Element){var f=this.paper.findView(d),h=f?f.getNodeBBox(d).center():new g.Point;return a.call(this,b,c,h,e)}return a.apply(this,arguments)}}function e(a,b,c,d){var e=a.model.angle(),f=a.getNodeBBox(b),h=f.center(),i=f.origin(),j=f.corner(),k=d.padding;if(isFinite(k)||(k=0),i.y+k<=c.y&&c.y<=j.y-k){var l=c.y-h.y;h.x+=0===e||180===e?0:1*l/Math.tan(g.toRad(e)),h.y+=l}else if(i.x+k<=c.x&&c.x<=j.x-k){var m=c.x-h.x;h.y+=90===e||270===e?0:m*Math.tan(g.toRad(e)),h.x+=m}return h}function f(a,b,c,d){var e,f,g,h=!!d.rotate;h?(e=a.getNodeUnrotatedBBox(b),g=a.model.getBBox().center(),f=a.model.angle()):e=a.getNodeBBox(b);var i=d.padding;isFinite(i)&&e.inflate(i),h&&c.rotate(g,f);var j,k=e.sideNearestToPoint(c);switch(k){case"left":j=e.leftMiddle();break;case"right":j=e.rightMiddle();break;case"top":j=e.topMiddle();break;case"bottom":j=e.bottomMiddle()}return h?j.rotate(g,-f):j}function h(a,b){var c=a.model,d=c.getBBox(),e=d.center(),f=c.angle(),h=a.findAttribute("port",b);if(h){var i=c.portProp(h,"group"),j=c.getPortsPositions(i),k=new g.Point(j[h]).offset(d.origin());return k.rotate(e,-f),k}return e}a.anchors={center:c("center"),top:c("topMiddle"),bottom:c("bottomMiddle"),left:c("leftMiddle"),right:c("rightMiddle"),topLeft:c("origin"),topRight:c("topRight"),bottomLeft:c("bottomLeft"),bottomRight:c("corner"),perpendicular:d(e),midSide:d(f),modelCenter:h}}(joint,joint.util),function(a,b,c,d){function e(a,c){return 1===a.length?a[0]:b.sortBy(a,function(a){return a.squaredDistance(c)})[0]}function f(a,b,c){if(!isFinite(c))return a;var d=a.distance(b);return 0===c&&d>0?a:a.move(b,-Math.min(c,d-1))}
61function g(a){var b=a.getAttribute("stroke-width");return null===b?0:parseFloat(b)||0}function h(a,b,c,d){return f(a.end,a.start,d.offset)}function i(a,b,c,d){var h=b.getNodeBBox(c);d.stroke&&h.inflate(g(c)/2);var i=a.intersect(h),j=i?e(i,a.start):a.end;return f(j,a.start,d.offset)}function j(a,b,c,d){var h=b.model.angle();if(0===h)return i(a,b,c,d);var j=b.getNodeUnrotatedBBox(c);d.stroke&&j.inflate(g(c)/2);var k=j.center(),l=a.clone().rotate(k,h),m=l.setLength(1e6).intersect(j),n=m?e(m,l.start).rotate(k,-h):a.end;return f(n,a.start,d.offset)}function k(a,h,i,j){var k,n,o=j.selector,p=a.end;if("string"==typeof o)k=h.findBySelector(o)[0];else if(Array.isArray(o))k=b.getByPath(i,o);else{k=i;do{var q=k.tagName.toUpperCase();if("G"===q)k=k.firstChild;else{if("TITLE"!==q)break;k=k.nextSibling}}while(k)}if(!(k instanceof Element))return p;var r=h.getNodeShape(k),s=h.getNodeMatrix(k),t=h.getRootTranslateMatrix(),u=h.getRootRotateMatrix(),v=t.multiply(u).multiply(s),w=v.inverse(),x=d.transformLine(a,w),y=x.start.clone(),z=h.getNodeData(k);if(j.insideout===!1){z[m]||(z[m]=r.bbox());var A=z[m];if(A.containsPoint(y))return p}var B;if(r instanceof c.Path){var C=j.precision||2;z[l]||(z[l]=r.getSegmentSubdivisions({precision:C})),B={precision:C,segmentSubdivisions:z[l]}}j.extrapolate===!0&&x.setLength(1e6),n=x.intersect(r,B),n?d.isArray(n)&&(n=e(n,y)):j.sticky===!0&&(n=r instanceof c.Rect?r.pointNearestToPoint(y):r instanceof c.Ellipse?r.intersectionWithLineFromCenterToPoint(y):r.closestPoint(y,B));var D=n?d.transformPoint(n,v):p,E=j.offset||0;return j.stroke&&(E+=g(k)/2),f(D,a.start,E)}var l="segmentSubdivisons",m="shapeBBox";a.connectionPoints={anchor:h,bbox:i,rectangle:j,boundary:k}}(joint,joint.util,g,V),function(a,b){function c(a,b){return 0===b?"0%":Math.round(a/b*100)+"%"}function d(a){return function(b,d,e,f){var g=d.model.angle(),h=d.getNodeUnrotatedBBox(e),i=d.model.getBBox().center();f.rotate(i,g);var j=f.x-h.x,k=f.y-h.y;return a&&(j=c(j,h.width),k=c(k,h.height)),b.anchor={name:"topLeft",args:{dx:j,dy:k,rotate:!0}},b}}a.connectionStrategies={useDefaults:b.noop,pinAbsolute:d(!1),pinRelative:d(!0)}}(joint,joint.util),function(a,b,c,d){function e(b,c,d){var e=a.connectionStrategies.pinRelative.call(this.paper,{},c,d,b,this.model);return e.anchor}function f(a,b,c,d,e,f){var g=f.options.snapRadius,h="source"===d,i=h?0:-1,j=this.model.vertex(i)||this.getEndAnchor(h?"target":"source");return j&&(Math.abs(j.x-a.x)<g&&(a.x=j.x),Math.abs(j.y-a.y)<g&&(a.y=j.y)),a}var g=a.dia.ToolView,h=a.mvc.View.extend({tagName:"circle",svgElement:!0,className:"marker-vertex",events:{mousedown:"onPointerDown",touchstart:"onPointerDown",dblclick:"onDoubleClick"},documentEvents:{mousemove:"onPointerMove",touchmove:"onPointerMove",mouseup:"onPointerUp",touchend:"onPointerUp"},attributes:{r:6,fill:"#33334F",stroke:"#FFFFFF","stroke-width":2,cursor:"move"},position:function(a,b){this.vel.attr({cx:a,cy:b})},onPointerDown:function(a){a.stopPropagation(),this.options.paper.undelegateEvents(),this.delegateDocumentEvents(null,a.data),this.trigger("will-change")},onPointerMove:function(a){this.trigger("changing",this,a)},onDoubleClick:function(a){this.trigger("remove",this,a)},onPointerUp:function(a){this.trigger("changed",this,a),this.undelegateDocumentEvents(),this.options.paper.delegateEvents()}}),i=g.extend({name:"vertices",options:{handleClass:h,snapRadius:20,redundancyRemoval:!0,vertexAdding:!0},children:[{tagName:"path",selector:"connection",className:"joint-vertices-path",attributes:{fill:"none",stroke:"transparent","stroke-width":10,cursor:"cell"}}],handles:null,events:{"mousedown .joint-vertices-path":"onPathPointerDown"},onRender:function(){this.resetHandles(),this.options.vertexAdding&&(this.renderChildren(),this.updatePath());for(var a=this.relatedView,b=a.model.vertices(),c=0,d=b.length;c<d;c++){var e=b[c],f=new this.options.handleClass({index:c,paper:this.paper});f.render(),f.position(e.x,e.y),this.simulateRelatedView(f.el),f.vel.appendTo(this.el),this.handles.push(f),this.startHandleListening(f)}return this},update:function(){return this.render(),this},updatePath:function(){var a=this.childNodes.connection;a&&a.setAttribute("d",this.relatedView.getConnection().serialize())},startHandleListening:function(a){var b=this.relatedView;b.can("vertexMove")&&(this.listenTo(a,"will-change",this.onHandleWillChange),this.listenTo(a,"changing",this.onHandleChanging),this.listenTo(a,"changed",this.onHandleChanged)),b.can("vertexRemove")&&this.listenTo(a,"remove",this.onHandleRemove)},resetHandles:function(){var a=this.handles;if(this.handles=[],this.stopListening(),Array.isArray(a))for(var b=0,c=a.length;b<c;b++)a[b].remove()},getNeighborPoints:function(a){var b=this.relatedView,c=b.model.vertices(),e=a>0?c[a-1]:b.sourceAnchor,f=a<c.length-1?c[a+1]:b.targetAnchor;return{prev:new d.Point(e),next:new d.Point(f)}},onHandleWillChange:function(a,b){this.focus(),this.relatedView.model.startBatch("vertex-move",{ui:!0,tool:this.cid})},onHandleChanging:function(a,b){var c=this.relatedView,d=c.paper,e=a.options.index,f=d.snapToGri
61d(b.clientX,b.clientY).toJSON();this.snapVertex(f,e),c.model.vertex(e,f,{ui:!0,tool:this.cid}),a.position(f.x,f.y)},snapVertex:function(a,b){var c=this.options.snapRadius;if(c>0){var d=this.getNeighborPoints(b),e=d.prev,f=d.next;Math.abs(a.x-e.x)<c?a.x=e.x:Math.abs(a.x-f.x)<c&&(a.x=f.x),Math.abs(a.y-e.y)<c?a.y=d.prev.y:Math.abs(a.y-f.y)<c&&(a.y=f.y)}},onHandleChanged:function(a,b){if(this.options.vertexAdding&&this.updatePath(),this.options.redundancyRemoval){var c=this.relatedView,d=c.removeRedundantLinearVertices({ui:!0,tool:this.cid});d&&this.render(),this.blur(),c.model.stopBatch("vertex-move",{
62ui:!0,tool:this.cid}),this.eventData(b).vertexAdded&&c.model.stopBatch("vertex-add",{ui:!0,tool:this.cid})}},onHandleRemove:function(a){var b=a.options.index;this.relatedView.model.removeVertex(b,{ui:!0})},onPathPointerDown:function(a){a.stopPropagation();var b=this.paper.snapToGrid(a.clientX,a.clientY).toJSON(),c=this.relatedView;c.model.startBatch("vertex-add",{ui:!0,tool:this.cid});var d=c.getVertexIndex(b.x,b.y);this.snapVertex(b,d),c.model.insertVertex(d,b,{ui:!0,tool:this.cid}),this.render();var e=this.handles[d];this.eventData(a,{vertexAdded:!0}),e.onPointerDown(a)},onRemove:function(){this.resetHandles()}},{VertexHandle:h}),j=a.mvc.View.extend({tagName:"g",svgElement:!0,className:"marker-segment",events:{mousedown:"onPointerDown",touchstart:"onPointerDown"},documentEvents:{mousemove:"onPointerMove",touchmove:"onPointerMove",mouseup:"onPointerUp",touchend:"onPointerUp"},children:[{tagName:"line",selector:"line",attributes:{stroke:"#33334F","stroke-width":2,fill:"none","pointer-events":"none"}},{tagName:"rect",selector:"handle",attributes:{width:20,height:8,x:-10,y:-4,rx:4,ry:4,fill:"#33334F",stroke:"#FFFFFF","stroke-width":2}}],onRender:function(){this.renderChildren()},position:function(a,b,e,f){var g=c.createSVGMatrix().translate(a,b).rotate(e),h=this.childNodes.handle;h.setAttribute("transform",c.matrixToTransformString(g)),h.setAttribute("cursor",e%180===0?"row-resize":"col-resize");var i=f.getClosestPoint(new d.Point(a,b)),j=this.childNodes.line;j.setAttribute("x1",a),j.setAttribute("y1",b),j.setAttribute("x2",i.x),j.setAttribute("y2",i.y)},onPointerDown:function(a){this.trigger("change:start",this,a),a.stopPropagation(),this.options.paper.undelegateEvents(),this.delegateDocumentEvents(null,a.data)},onPointerMove:function(a){this.trigger("changing",this,a)},onPointerUp:function(a){this.undelegateDocumentEvents(),this.options.paper.delegateEvents(),this.trigger("change:end",this,a)},show:function(){this.el.style.display=""},hide:function(){this.el.style.display="none"}}),k=g.extend({name:"segments",precision:.5,options:{handleClass:j,segmentLengthThreshold:40,redundancyRemoval:!0,anchor:e,snapRadius:10,snapHandle:!0},handles:null,onRender:function(){this.resetHandles();var a=this.relatedView,b=a.model.vertices();b.unshift(a.sourcePoint),b.push(a.targetPoint);for(var c=0,d=b.length;c<d-1;c++){var e=b[c],f=b[c+1],g=this.renderHandle(e,f);this.simulateRelatedView(g.el),this.handles.push(g),g.options.index=c}return this},renderHandle:function(a,b){var c=new this.options.handleClass({paper:this.paper});return c.render(),this.updateHandle(c,a,b),c.vel.appendTo(this.el),this.startHandleListening(c),c},update:function(){return this.render(),this},startHandleListening:function(a){this.listenTo(a,"change:start",this.onHandleChangeStart),this.listenTo(a,"changing",this.onHandleChanging),this.listenTo(a,"change:end",this.onHandleChangeEnd)},resetHandles:function(){var a=this.handles;if(this.handles=[],this.stopListening(),Array.isArray(a))for(var b=0,c=a.length;b<c;b++)a[b].remove()},shiftHandleIndexes:function(a){for(var b=this.handles,c=0,d=b.length;c<d;c++)b[c].options.index+=a},resetAnchor:function(a,b){var c=this.relatedView.model;b?c.prop([a,"anchor"],b,{rewrite:!0,ui:!0,tool:this.cid}):c.removeProp([a,"anchor"],{ui:!0,tool:this.cid})},snapHandle:function(a,b,c){var d=a.options.index,e=this.relatedView,f=e.model,g=f.vertices(),h=a.options.axis,i=g[d-2]||c.sourceAnchor,j=g[d+1]||c.targetAnchor,k=this.options.snapRadius;return Math.abs(b[h]-i[h])<k?b[h]=i[h]:Math.abs(b[h]-j[h])<k&&(b[h]=j[h]),b},onHandleChanging:function(a,c){var d=this.eventData(c),e=this.relatedView,f=e.paper,g=a.options.index-1,h=f.snapToGri
62d(c.clientX,c.clientY),i=this.snapHandle(a,h.clone(),d),j=a.options.axis,k=this.options.snapHandle?0:h[j]-i[j],l=e.model,m=b.cloneDeep(l.vertices()),n=m[g],o=m[g+1],p=this.options.anchor;"function"!=typeof p&&(p=null);var q=e.sourceView,r=e.sourceBBox,s=!1,t=!1;if(n?0===g?r.containsPoint(n)?(m.shift(),this.shiftHandleIndexes(-1),s=!0):(n[j]=i[j],t=!0):n[j]=i[j]:(n=e.sourceAnchor.toJSON(),n[j]=i[j],r.containsPoint(n)?(n[j]=i[j],s=!0):(m.unshift(n),this.shiftHandleIndexes(1),t=!0)),p&&q){if(s){var u=d.sourceAnchor.clone();u[j]=i[j];var v=p.call(e,u,q,e.sourceMagnet||q.el,"source",e);this.resetAnchor("source",v)}t&&this.resetAnchor("source",d.sourceAnchorDef)}var w=e.targetView,x=e.targetBBox,y=!1,z=!1;if(o?g===m.length-2?x.containsPoint(o)?(m.pop(),y=!0):(o[j]=i[j],z=!0):o[j]=i[j]:(o=e.targetAnchor.toJSON(),o[j]=i[j],x.containsPoint(o)?y=!0:(m.push(o),z=!0)),p&&w){if(y){var A=d.targetAnchor.clone();A[j]=i[j];var B=p.call(e,A,w,e.targetMagnet||w.el,"target",e);this.resetAnchor("target",B)}z&&this.resetAnchor("target",d.targetAnchorDef)}l.vertices(m,{ui:!0,tool:this.cid}),this.updateHandle(a,n,o,k)},onHandleChangeStart:function(a,c){var d=a.options.index,e=this.handles;if(Array.isArray(e)){for(var f=0,g=e.length;f<g;f++)f!==d&&e[f].hide();this.focus();var h=this.relatedView,i=h.model;this.eventData(c,{sourceAnchor:h.sourceAnchor.clone(),targetAnchor:h.targetAnchor.clone(),sourceAnchorDef:b.clone(i.prop(["source","anchor"])),targetAnchorDef:b.clone(i.prop(["target","anchor"]))}),h.model.startBatch("segment-move",{ui:!0,tool:this.cid})}},onHandleChangeEnd:function(a){var b=this.relatedView;this.options.redundancyRemoval&&b.removeRedundantLinearVertices({ui:!0,tool:this.cid}),this.render(),this.blur(),b.model.stopBatch("segment-move",{ui:!0,tool:this.cid})},updateHandle:function(a,b,c,e){var f=Math.abs(b.x-c.x)<this.precision,g=Math.abs(b.y-c.y)<this.precision;if(f||g){var h=new d.Line(b,c),i=h.length();if(i<this.options.segmentLengthThreshold)a.hide();else{var j=h.midpoint(),k=f?"x":"y";j[k]+=e||0;var l=h.vector().vectorAngle(new d.Point(1,0));a.position(j.x,j.y,l,this.relatedView),a.show(),a.options.axis=k}}else a.hide()},onRemove:function(){this.resetHandles()}},{SegmentHandle:j}),l=g.extend({tagName:"path",xAxisVector:new d.Point(1,0),events:{mousedown:"onPointerDown",touchstart:"onPointerDown"},documentEvents:{mousemove:"onPointerMove",touchmove:"onPointerMove",mouseup:"onPointerUp",touchend:"onPointerUp"},onRender:function(){this.update()},update:function(){var a,b,d=this.ratio,e=this.relatedView,f=e.getTangentAtRatio(d);f?(a=f.start,b=f.vector().vectorAngle(this.xAxisVector)||0):(a=e.getPointAtRatio(d),b=0);var g=c.createSVGMatrix().translate(a.x,a.y).rotate(b);return this.vel.transform(g,{absolute:!0}),this},onPointerDown:function(a){a.stopPropagation();var b=this.relatedView;b.model.startBatch("arrowhead-move",{ui:!0,tool:this.cid}),b.can("arrowheadMove")&&(b.startArrowheadMove(this.arrowheadType),this.delegateDocumentEvents(),b.paper.undelegateEvents()),this.focus(),this.el.style.pointerEvents="none"},onPointerMove:function(a){var b=this.paper.snapToGrid(a.clientX,a.clientY);this.relatedView.pointermove(a,b.x,b.y)},onPointerUp:function(a){this.undelegateDocumentEvents();
62var b=this.relatedView,c=b.paper,d=c.snapToGrid(a.clientX,a.clientY);b.pointerup(a,d.x,d.y),c.delegateEvents(),this.blur(),this.el.style.pointerEvents="",b.model.stopBatch("arrowhead-move",{ui:!0,tool:this.cid})}}),m=l.extend({name:"target-arrowhead",ratio:1,arrowheadType:"target",attributes:{d:"M -10 -8 10 0 -10 8 Z",fill:"#33334F",stroke:"#FFFFFF","stroke-width":2,cursor:"move",class:"target-arrowhead"}}),n=l.extend({name:"source-arrowhead",ratio:0,arrowheadType:"source",attributes:{d:"M 10 -8 -10 0 10 8 Z",fill:"#33334F",stroke:"#FFFFFF","stroke-width":2,cursor:"move",class:"source-arrowhead"}}),o=g.extend({name:"button",events:{mousedown:"onPointerDown",touchstart:"onPointerDown"},options:{distance:0,offset:0,rotate:!1},onRender:function(){this.renderChildren(this.options.markup),this.update()},update:function(){var a,e,f,g=this.options.distance||0;a=b.isPercentage(g)?this.relatedView.getTangentAtRatio(parseFloat(g)/100):this.relatedView.getTangentAtLength(g),a?(e=a.start,f=a.vector().vectorAngle(new d.Point(1,0))||0):(e=this.relatedView.getConnection().start,f=0);var h=c.createSVGMatrix().translate(e.x,e.y).rotate(f).translate(0,this.options.offset||0);return this.options.rotate||(h=h.rotate(-f)),this.vel.transform(h,{absolute:!0}),this},onPointerDown:function(a){a.stopPropagation();var b=this.options.action;"function"==typeof b&&b.call(this.relatedView,a,this.relatedView)}}),p=o.extend({children:[{tagName:"circle",selector:"button",attributes:{r:7,fill:"#FF1D00",cursor:"pointer"}},{tagName:"path",selector:"icon",attributes:{d:"M -3 -3 3 3 M -3 3 3 -3",fill:"none",stroke:"#FFFFFF","stroke-width":2,"pointer-events":"none"}}],options:{distance:60,offset:0,action:function(a){this.model.remove({ui:!0,tool:this.cid})}}}),q=g.extend({name:"boundary",tagName:"rect",options:{padding:10},attributes:{fill:"none",stroke:"#33334F","stroke-width":.5,"stroke-dasharray":"5, 5","pointer-events":"none"},onRender:function(){this.update()},update:function(){var a=this.options.padding;isFinite(a)||(a=0);var b=this.relatedView.getConnection().bbox().inflate(a);return this.vel.attr(b.toJSON()),this}}),r=g.extend({tagName:"g",type:null,children:[{tagName:"circle",selector:"anchor",attributes:{cursor:"pointer"}},{tagName:"rect",selector:"area",attributes:{"pointer-events":"none",fill:"none",stroke:"#33334F","stroke-dasharray":"2,4",rx:5,ry:5}}],events:{mousedown:"onPointerDown",touchstart:"onPointerDown",dblclick:"onPointerDblClick"},documentEvents:{mousemove:"onPointerMove",touchmove:"onPointerMove",mouseup:"onPointerUp",touchend:"onPointerUp"},options:{snap:f,anchor:e,customAnchorAttributes:{"stroke-width":4,stroke:"#33334F",fill:"#FFFFFF",r:5},defaultAnchorAttributes:{"stroke-width":2,stroke:"#FFFFFF",fill:"#33334F",r:6},areaPadding:6,snapRadius:10,restrictArea:!0,redundancyRemoval:!0},onRender:function(){this.renderChildren(),this.toggleArea(!1),this.update()},update:function(){var a=this.type,b=this.relatedView,c=b.getEndView(a);return c?(this.updateAnchor(),this.updateArea(),this.el.style.display=""):this.el.style.display="none",this},updateAnchor:function(){var a=this.childNodes;if(a){var b=a.anchor;if(b){var c=this.relatedView,d=this.type,e=c.getEndAnchor(d),f=this.options,g=c.model.prop([d,"anchor"]);b.setAttribute("transform","translate("+e.x+","+e.y+")");var h=g?f.customAnchorAttributes:f.defaultAnchorAttributes;for(var i in h)b.setAttribute(i,h[i])}}},updateArea:function(){var a=this.childNodes;if(a){var b=a.area;if(b){var c=this.relatedView,d=this.type,e=c.getEndView(d),f=c.getEndMagnet(d),g=this.options.areaPadding;isFinite(g)||(g=0);var h=e.getNodeUnrotatedBBox(f).inflate(g),i=e.model.angle();b.setAttribute("x",-h.width/2),b.setAttribute("y",-h.height/2),b.setAttribute("width",h.width),b.setAttribute("height",h.height);var j=e.model.getBBox().center(),k=h.center().rotate(j,-i);b.setAttribute("transform","translate("+k.x+","+k.y+") rotate("+i+")")}}},toggleArea:function(a){this.childNodes.area.style.display=a?"":"none"},onPointerDown:function(a){a.stopPropagation(),this.paper.undelegateEvents(),this.delegateDocumentEvents(),this.focus(),this.toggleArea(this.options.restrictArea),this.relatedView.model.startBatch("anchor-move",{ui:!0,tool:this.cid})}
62,resetAnchor:function(a){var b=this.type,c=this.relatedView.model;a?c.prop([b,"anchor"],a,{rewrite:!0,ui:!0,tool:this.cid}):c.removeProp([b,"anchor"],{ui:!0,tool:this.cid})},onPointerMove:function(a){var b=this.relatedView,c=this.type,e=b.getEndView(c),f=b.getEndMagnet(c),g=this.paper.clientToLocalPoint(a.clientX,a.clientY),h=this.options.snap;if("function"==typeof h&&(g=h.call(b,g,e,f,c,b,this),g=new d.Point(g)),this.options.restrictArea){var i=e.getNodeUnrotatedBBox(f),j=e.model.angle(),k=e.model.getBBox().center(),l=g.clone().rotate(k,j);i.containsPoint(l)||(g=i.pointNearestToPoint(l).rotate(k,-j))}var m,n=this.options.anchor;"function"==typeof n&&(m=n.call(b,g,e,f,c,b)),this.resetAnchor(m),this.update()},onPointerUp:function(a){this.paper.delegateEvents(),this.undelegateDocumentEvents(),this.blur(),this.toggleArea(!1);var b=this.relatedView;this.options.redundancyRemoval&&b.removeRedundantLinearVertices({ui:!0,tool:this.cid}),b.model.stopBatch("anchor-move",{ui:!0,tool:this.cid})},onPointerDblClick:function(){this.resetAnchor(),this.update()}}),s=r.extend({name:"source-anchor",type:"source"}),t=r.extend({name:"target-anchor",type:"target"});a.linkTools={Vertices:i,Segments:k,SourceArrowhead:n,TargetArrowhead:m,SourceAnchor:s,TargetAnchor:t,Button:o,Remove:p,Boundary:q}}(joint,joint.util,V,g);
63joint.dia.Element.define("erd.Entity",{size:{width:150,height:60},attrs:{".outer":{fill:"#2ECC71",stroke:"#27AE60","stroke-width":2,points:"100,0 100,60 0,60 0,0"},".inner":{fill:"#2ECC71",stroke:"#27AE60","stroke-width":2,points:"95,5 95,55 5,55 5,5",display:"none"},text:{text:"Entity","font-family":"Arial","font-size":14,"ref-x":.5,"ref-y":.5,"y-alignment":"middle","text-anchor":"middle"}}},{markup:'<g class="rotatable"><g class="scalable"><polygon class="outer"/><polygon class="inner"/></g><text/></g>'}),joint.shapes.erd.Entity.define("erd.WeakEntity",{attrs:{".inner":{display:"auto"},text:{text:"Weak Entity"}}}),joint.dia.Element.define("erd.Relationship",{size:{width:80,height:80},attrs:{".outer":{fill:"#3498DB",stroke:"#2980B9","stroke-width":2,points:"40,0 80,40 40,80 0,40"},".inner":{fill:"#3498DB",stroke:"#2980B9","stroke-width":2,points:"40,5 75,40 40,75 5,40",display:"none"},text:{text:"Relationship","font-family":"Arial","font-size":12,"ref-x":.5,"ref-y":.5,"y-alignment":"middle","text-anchor":"middle"}}},{markup:'<g class="rotatable"><g class="scalable"><polygon class="outer"/><polygon class="inner"/></g><text/></g>'}),joint.shapes.erd.Relationship.define("erd.IdentifyingRelationship",{attrs:{".inner":{display:"auto"},text:{text:"Identifying"}}}),joint.dia.Element.define("erd.Attribute",{size:{width:100,height:50},attrs:{ellipse:{transform:"translate(50, 25)"},".outer":{stroke:"#D35400","stroke-width":2,cx:0,cy:0,rx:50,ry:25,fill:"#E67E22"},".inner":{stroke:"#D35400","stroke-width":2,cx:0,cy:0,rx:45,ry:20,fill:"#E67E22",display:"none"},text:{"font-family":"Arial","font-size":14,"ref-x":.5,"ref-y":.5,"y-alignment":"middle","text-anchor":"middle"}}},{markup:'<g class="rotatable"><g class="scalable"><ellipse class="outer"/><ellipse class="inner"/></g><text/></g>'}),joint.shapes.erd.Attribute.define("erd.Multivalued",{attrs:{".inner":{display:"block"},text:{text:"multivalued"}}}),joint.shapes.erd.Attribute.define("erd.Derived",{attrs:{".outer":{"stroke-dasharray":"3,5"},text:{text:"derived"}}}),joint.shapes.erd.Attribute.define("erd.Key",{attrs:{ellipse:{"stroke-width":4},text:{text:"key","font-weight":"800","text-decoration":"underline"}}}),joint.shapes.erd.Attribute.define("erd.Normal",{attrs:{text:{text:"Normal"}}}),joint.dia.Element.define("erd.ISA",{type:"erd.ISA",size:{width:100,height:50},attrs:{polygon:{points:"0,0 50,50 100,0",fill:"#F1C40F",stroke:"#F39C12","stroke-width":2},text:{text:"ISA","font-size":18,"ref-x":.5,"ref-y":.3,"y-alignment":"middle","text-anchor":"middle"}}},{markup:'<g class="rotatable"><g class="scalable"><polygon/></g><text/></g>'}),joint.dia.Link.define("erd.Line",{},{cardinality:function(a){this.set("labels",[{position:-20,attrs:{text:{dy:-8,text:a}}}])}});
64joint.shapes.basic.Circle.define("fsa.State",{attrs:{circle:{"stroke-width":3},text:{"font-weight":"800"}}}),joint.dia.Element.define("fsa.StartState",{size:{width:20,height:20},attrs:{circle:{transform:"translate(10, 10)",r:10,fill:"#000000"}}},{markup:'<g class="rotatable"><g class="scalable"><circle/></g></g>'}),joint.dia.Element.define("fsa.EndState",{size:{width:20,height:20},attrs:{".outer":{transform:"translate(10, 10)",r:10,fill:"#ffffff",stroke:"#000000"},".inner":{transform:"translate(10, 10)",r:6,fill:"#000000"}}},{markup:'<g class="rotatable"><g class="scalable"><circle class="outer"/><circle class="inner"/></g></g>'}),joint.dia.Link.define("fsa.Arrow",{attrs:{".marker-target":{d:"M 10 0 L 0 5 L 10 10 z"}},smooth:!0});
65joint.dia.Element.define("org.Member",{size:{width:180,height:70},attrs:{rect:{width:170,height:60},".card":{fill:"#FFFFFF",stroke:"#000000","stroke-width":2,"pointer-events":"visiblePainted",rx:10,ry:10},image:{width:48,height:48,ref:".card","ref-x":10,"ref-y":5},".rank":{"text-decoration":"underline",ref:".card","ref-x":.9,"ref-y":.2,"font-family":"Courier New","font-size":14,"text-anchor":"end"},".name":{"font-weight":"800",ref:".card","ref-x":.9,"ref-y":.6,"font-family":"Courier New","font-size":14,"text-anchor":"end"}}},{markup:'<g class="rotatable"><g class="scalable"><rect class="card"/><image/></g><text class="rank"/><text class="name"/></g>'}),joint.dia.Link.define("org.Arrow",{source:{selector:".card"},target:{selector:".card"},attrs:{".connection":{stroke:"#585858","stroke-width":3}},z:-1});
66joint.shapes.basic.Generic.define("chess.KingWhite",{size:{width:42,he
66ight:38}},{markup:'<g class="rotatable"><g class="scalable"><g style="fill:none; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;"><path      d="M 22.5,11.63 L 22.5,6"      style="fill:none; stroke:#000000; stroke-linejoin:miter;" />    <path      d="M 20,8 L 25,8"      style="fill:none; stroke:#000000; stroke-linejoin:miter;" />    <path      d="M 22.5,25 C 22.5,25 27,17.5 25.5,14.5 C 25.5,14.5 24.5,12 22.5,12 C 20.5,12 19.5,14.5 19.5,14.5 C 18,17.5 22.5,25 22.5,25"      style="fill:#ffffff; stroke:#000000; stroke-linecap:butt; stroke-linejoin:miter;" />    <path      d="M 11.5,37 C 17,40.5 27,40.5 32.5,37 L 32.5,30 C 32.5,30 41.5,25.5 38.5,19.5 C 34.5,13 25,16 22.5,23.5 L 22.5,27 L 22.5,23.5 C 19,16 9.5,13 6.5,19.5 C 3.5,25.5 11.5,29.5 11.5,29.5 L 11.5,37 z "      style="fill:#ffffff; stroke:#000000;" />    <path      d="M 11.5,30 C 17,27 27,27 32.5,30"      style="fill:none; stroke:#000000;" />    <path      d="M 11.5,33.5 C 17,30.5 27,30.5 32.5,33.5"      style="fill:none; stroke:#000000;" />    <path      d="M 11.5,37 C 17,34 27,34 32.5,37"      style="fill:none; stroke:#000000;" />  </g></g></g>'}),joint.shapes.basic.Generic.define("chess.KingBlack",{size:{width:42,he
66ight:38}},{markup:'<g class="rotatable"><g class="scalable"><g style="fill:none; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">    <path       d="M 22.5,11.63 L 22.5,6"       style="fill:none; stroke:#000000; stroke-linejoin:miter;"       id="path6570" />    <path       d="M 22.5,25 C 22.5,25 27,17.5 25.5,14.5 C 25.5,14.5 24.5,12 22.5,12 C 20.5,12 19.5,14.5 19.5,14.5 C 18,17.5 22.5,25 22.5,25"       style="fill:#000000;fill-opacity:1; stroke-linecap:butt; stroke-linejoin:miter;" />    <path       d="M 11.5,37 C 17,40.5 27,40.5 32.5,37 L 32.5,30 C 32.5,30 41.5,25.5 38.5,19.5 C 34.5,13 25,16 22.5,23.5 L 22.5,27 L 22.5,23.5 C 19,16 9.5,13 6.5,19.5 C 3.5,25.5 11.5,29.5 11.5,29.5 L 11.5,37 z "       style="fill:#000000; stroke:#000000;" />    <path       d="M 20,8 L 25,8"       style="fill:none; stroke:#000000; stroke-linejoin:miter;" />    <path       d="M 32,29.5 C 32,29.5 40.5,25.5 38.03,19.85 C 34.15,14 25,18 22.5,24.5 L 22.51,26.6 L 22.5,24.5 C 20,18 9.906,14 6.997,19.85 C 4.5,25.5 11.85,28.85 11.85,28.85"       style="fill:none; stroke:#ffffff;" />    <path       d="M 11.5,30 C 17,27 27,27 32.5,30 M 11.5,33.5 C 17,30.5 27,30.5 32.5,33.5 M 11.5,37 C 17,34 27,34 32.5,37"       style="fill:none; stroke:#ffffff;" />  </g></g></g>'}),joint.shapes.basic.Generic.define("chess.QueenWhite",{size:{width:42,he
66ight:38}},{markup:'<g class="rotatable"><g class="scalable"><g style="opacity:1; fill:#ffffff; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">    <path      d="M 9 13 A 2 2 0 1 1  5,13 A 2 2 0 1 1  9 13 z"      transform="translate(-1,-1)" />    <path      d="M 9 13 A 2 2 0 1 1  5,13 A 2 2 0 1 1  9 13 z"      transform="translate(15.5,-5.5)" />    <path      d="M 9 13 A 2 2 0 1 1  5,13 A 2 2 0 1 1  9 13 z"      transform="translate(32,-1)" />    <path      d="M 9 13 A 2 2 0 1 1  5,13 A 2 2 0 1 1  9 13 z"      transform="translate(7,-4.5)" />    <path      d="M 9 13 A 2 2 0 1 1  5,13 A 2 2 0 1 1  9 13 z"      transform="translate(24,-4)" />    <path      d="M 9,26 C 17.5,24.5 30,24.5 36,26 L 38,14 L 31,25 L 31,11 L 25.5,24.5 L 22.5,9.5 L 19.5,24.5 L 14,10.5 L 14,25 L 7,14 L 9,26 z "      style="stroke-linecap:butt;" />    <path      d="M 9,26 C 9,28 10.5,28 11.5,30 C 12.5,31.5 12.5,31 12,33.5 C 10.5,34.5 10.5,36 10.5,36 C 9,37.5 11,38.5 11,38.5 C 17.5,39.5 27.5,39.5 34,38.5 C 34,38.5 35.5,37.5 34,36 C 34,36 34.5,34.5 33,33.5 C 32.5,31 32.5,31.5 33.5,30 C 34.5,28 36,28 36,26 C 27.5,24.5 17.5,24.5 9,26 z "      style="stroke-linecap:butt;" />    <path      d="M 11.5,30 C 15,29 30,29 33.5,30"      style="fill:none;" />    <path      d="M 12,33.5 C 18,32.5 27,32.5 33,33.5"      style="fill:none;" />  </g></g></g>'}),joint.shapes.basic.Generic.define("chess.QueenBlack",{size:{width:42,he
66ight:38}},{markup:'<g class="rotatable"><g class="scalable"><g style="opacity:1; fill:#000000; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">    <g style="fill:#000000; stroke:none;">      <circle cx="6"    cy="12" r="2.75" />      <circle cx="14"   cy="9"  r="2.75" />      <circle cx="22.5" cy="8"  r="2.75" />      <circle cx="31"   cy="9"  r="2.75" />      <circle cx="39"   cy="12" r="2.75" />    </g>    <path       d="M 9,26 C 17.5,24.5 30,24.5 36,26 L 38.5,13.5 L 31,25 L 30.7,10.9 L 25.5,24.5 L 22.5,10 L 19.5,24.5 L 14.3,10.9 L 14,25 L 6.5,13.5 L 9,26 z"       style="stroke-linecap:butt; stroke:#000000;" />    <path       d="M 9,26 C 9,28 10.5,28 11.5,30 C 12.5,31.5 12.5,31 12,33.5 C 10.5,34.5 10.5,36 10.5,36 C 9,37.5 11,38.5 11,38.5 C 17.5,39.5 27.5,39.5 34,38.5 C 34,38.5 35.5,37.5 34,36 C 34,36 34.5,34.5 33,33.5 C 32.5,31 32.5,31.5 33.5,30 C 34.5,28 36,28 36,26 C 27.5,24.5 17.5,24.5 9,26 z"       style="stroke-linecap:butt;" />    <path       d="M 11,38.5 A 35,35 1 0 0 34,38.5"       style="fill:none; stroke:#000000; stroke-linecap:butt;" />    <path       d="M 11,29 A 35,35 1 0 1 34,29"       style="fill:none; stroke:#ffffff;" />    <path       d="M 12.5,31.5 L 32.5,31.5"       style="fill:none; stroke:#ffffff;" />    <path       d="M 11.5,34.5 A 35,35 1 0 0 33.5,34.5"       style="fill:none; stroke:#ffffff;" />    <path       d="M 10.5,37.5 A 35,35 1 0 0 34.5,37.5"       style="fill:none; stroke:#ffffff;" />  </g></g></g>'}),joint.shapes.basic.Generic.define("chess.RookWhite",{size:{width:32,height:34}},{markup:'<g class="rotatable"><g class="scalable"><g style="opacity:1; fill:#ffffff; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">    <path      d="M 9,39 L 36,39 L 36,36 L 9,36 L 9,39 z "      style="stroke-linecap:butt;" />    <path      d="M 12,36 L 12,32 L 33,32 L 33,36 L 12,36 z "      style="stroke-linecap:butt;" />    <path      d="M 11,14 L 11,9 L 15,9 L 15,11 L 20,11 L 20,9 L 25,9 L 25,11 L 30,11 L 30,9 L 34,9 L 34,14"      style="stroke-linecap:butt;" />    <path      d="M 34,14 L 31,17 L 14,17 L 11,14" />    <path      d="M 31,17 L 31,29.5 L 14,29.5 L 14,17"      style="stroke-linecap:butt; stroke-linejoin:miter;" />    <path      d="M 31,29.5 L 32.5,32 L 12.5,32 L 14,29.5" />    <path      d="M 11,14 L 34,14"      style="fill:none; stroke:#000000; stroke-linejoin:miter;" />  </g></g></g>'}),joint.shapes.basic.Generic.define("chess.RookBlack",{size:{width:32,height:34}},{markup:'<g class="rotatable"><g class="scalable"><g style="opacity:1; fill:#000000; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">    <path      d="M 9,39 L 36,39 L 36,36 L 9,36 L 9,39 z "      style="stroke-linecap:butt;" />    <path      d="M 12.5,32 L 14,29.5 L 31,29.5 L 32.5,32 L 12.5,32 z "      style="stroke-linecap:butt;" />    <path      d="M 12,36 L 12,32 L 33,32 L 33,36 L 12,36 z "      style="stroke-linecap:butt;" />    <path      d="M 14,29.5 L 14,16.5 L 31,16.5 L 31,29.5 L 14,29.5 z "      style="stroke-linecap:butt;stroke-linejoin:miter;" />    <path      d="M 14,16.5 L 11,14 L 34,14 L 31,16.5 L 14,16.5 z "      style="stroke-linecap:butt;" />    <path      d="M 11,14 L 11,9 L 15,9 L 15,11 L 20,11 L 20,9 L 25,9 L 25,11 L 30,11 L 30,9 L 34,9 L 34,14 L 11,14 z "      style="stroke-linecap:butt;" />    <path      d="M 12,35.5 L 33,35.5 L 33,35.5"      style="fill:none; stroke:#ffffff; stroke-width:1; stroke-linejoin:miter;" />    <path      d="M 13,31.5 L 32,31.5"      style="fill:none; stroke:#ffffff; stroke-width:1; stroke-linejoin:miter;" />    <path      d="M 14,29.5 L 31,29.5"      style="fill:none; stroke:#ffffff; stroke-width:1; stroke-linejoin:miter;" />    <path      d="M 14,16.5 L 31,16.5"      style="fill:none; stroke:#ffffff; stroke-width:1; stroke-linejoin:miter;" />    <path      d="M 11,14 L 34,14"      style="fill:none; stroke:#ffffff; stroke-width:1; stroke-linejoin:miter;" />  </g></g></g>'}
66),joint.shapes.basic.Generic.define("chess.BishopWhite",{size:{width:38,height:38}},{markup:'<g class="rotatable"><g class="scalable"><g style="opacity:1; fill:none; fill-rule:evenodd; fill-opacity:1; stroke:#000000; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">    <g style="fill:#ffffff; stroke:#000000; stroke-linecap:butt;">       <path        d="M 9,36 C 12.39,35.03 19.11,36.43 22.5,34 C 25.89,36.43 32.61,35.03 36,36 C 36,36 37.65,36.54 39,38 C 38.32,38.97 37.35,38.99 36,38.5 C 32.61,37.53 25.89,38.96 22.5,37.5 C 19.11,38.96 12.39,37.53 9,38.5 C 7.646,38.99 6.677,38.97 6,38 C 7.354,36.06 9,36 9,36 z" />      <path        d="M 15,32 C 17.5,34.5 27.5,34.5 30,32 C 30.5,30.5 30,30 30,30 C 30,27.5 27.5,26 27.5,26 C 33,24.5 33.5,14.5 22.5,10.5 C 11.5,14.5 12,24.5 17.5,26 C 17.5,26 15,27.5 15,30 C 15,30 14.5,30.5 15,32 z" />      <path        d="M 25 8 A 2.5 2.5 0 1 1  20,8 A 2.5 2.5 0 1 1  25 8 z" />    </g>    <path      d="M 17.5,26 L 27.5,26 M 15,30 L 30,30 M 22.5,15.5 L 22.5,20.5 M 20,18 L 25,18"      style="fill:none; stroke:#000000; stroke-linejoin:miter;" />  </g></g></g>'}),joint.shapes.basic.Generic.define("chess.BishopBlack",{size:{width:38,height:38}},{markup:'<g class="rotatable"><g class="scalable"><g style="opacity:1; fill:none; fill-rule:evenodd; fill-opacity:1; stroke:#000000; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">    <g style="fill:#000000; stroke:#000000; stroke-linecap:butt;">       <path        d="M 9,36 C 12.39,35.03 19.11,36.43 22.5,34 C 25.89,36.43 32.61,35.03 36,36 C 36,36 37.65,36.54 39,38 C 38.32,38.97 37.35,38.99 36,38.5 C 32.61,37.53 25.89,38.96 22.5,37.5 C 19.11,38.96 12.39,37.53 9,38.5 C 7.646,38.99 6.677,38.97 6,38 C 7.354,36.06 9,36 9,36 z" />      <path        d="M 15,32 C 17.5,34.5 27.5,34.5 30,32 C 30.5,30.5 30,30 30,30 C 30,27.5 27.5,26 27.5,26 C 33,24.5 33.5,14.5 22.5,10.5 C 11.5,14.5 12,24.5 17.5,26 C 17.5,26 15,27.5 15,30 C 15,30 14.5,30.5 15,32 z" />      <path        d="M 25 8 A 2.5 2.5 0 1 1  20,8 A 2.5 2.5 0 1 1  25 8 z" />    </g>    <path       d="M 17.5,26 L 27.5,26 M 15,30 L 30,30 M 22.5,15.5 L 22.5,20.5 M 20,18 L 25,18"       style="fill:none; stroke:#ffffff; stroke-linejoin:miter;" />  </g></g></g>'}),joint.shapes.basic.Generic.define("chess.KnightWhite",{size:{width:38,height:37}},{markup:'<g class="rotatable"><g class="scalable"><g style="opacity:1; fill:none; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">    <path      d="M 22,10 C 32.5,11 38.5,18 38,39 L 15,39 C 15,30 25,32.5 23,18"      style="fill:#ffffff; stroke:#000000;" />    <path      d="M 24,18 C 24.38,20.91 18.45,25.37 16,27 C 13,29 13.18,31.34 11,31 C 9.958,30.06 12.41,27.96 11,28 C 10,28 11.19,29.23 10,30 C 9,30 5.997,31 6,26 C 6,24 12,14 12,14 C 12,14 13.89,12.1 14,10.5 C 13.27,9.506 13.5,8.5 13.5,7.5 C 14.5,6.5 16.5,10 16.5,10 L 18.5,10 C 18.5,10 19.28,8.008 21,7 C 22,7 22,10 22,10"      style="fill:#ffffff; stroke:#000000;" />    <path      d="M 9.5 25.5 A 0.5 0.5 0 1 1 8.5,25.5 A 0.5 0.5 0 1 1 9.5 25.5 z"      style="fill:#000000; stroke:#000000;" />    <path      d="M 15 15.5 A 0.5 1.5 0 1 1  14,15.5 A 0.5 1.5 0 1 1  15 15.5 z"      transform="matrix(0.866,0.5,-0.5,0.866,9.693,-5.173)"      style="fill:#000000; stroke:#000000;" />  </g></g></g>'}),joint.shapes.basic.Generic.define("chess.KnightBlack",{size:{width:38,height:37}},{markup:'<g class="rotatable"><g class="scalable"><g style="opacity:1; fill:none; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">    <path      d="M 22,10 C 32.5,11 38.5,18 38,39 L 15,39 C 15,30 25,32.5 23,18"      style="fill:#000000; stroke:#000000;" />    <path      d="M 24,18 C 24.38,20.91 18.45,25.37 16,27 C 13,29 13.18,31.34 11,31 C 9.958,30.06 12.41,27.96 11,28 C 10,28 11.19,29.23 10,30 C 9,30 5.997,31 6,26 C 6,24 12,14 12,14 C 12,14 13.89,12.1 14,10.5 C 13.27,9.506 13.5,8.5 13.5,7.5 C 14.5,6.5 16.5,10 16.5,10 
66L 18.5,10 C 18.5,10 19.28,8.008 21,7 C 22,7 22,10 22,10"      style="fill:#000000; stroke:#000000;" />    <path      d="M 9.5 25.5 A 0.5 0.5 0 1 1 8.5,25.5 A 0.5 0.5 0 1 1 9.5 25.5 z"      style="fill:#ffffff; stroke:#ffffff;" />    <path      d="M 15 15.5 A 0.5 1.5 0 1 1  14,15.5 A 0.5 1.5 0 1 1  15 15.5 z"      transform="matrix(0.866,0.5,-0.5,0.866,9.693,-5.173)"      style="fill:#ffffff; stroke:#ffffff;" />    <path      d="M 24.55,10.4 L 24.1,11.85 L 24.6,12 C 27.75,13 30.25,14.49 32.5,18.75 C 34.75,23.01 35.75,29.06 35.25,39 L 35.2,39.5 L 37.45,39.5 L 37.5,39 C 38,28.94 36.62,22.15 34.25,17.66 C 31.88,13.17 28.46,11.02 25.06,10.5 L 24.55,10.4 z "      style="fill:#ffffff; stroke:none;" />  </g></g></g>'}),joint.shapes.basic.Generic.define("chess.PawnWhite",{size:{width:28,height:33}},{markup:'<g class="rotatable"><g class="scalable"><path d="M 22,9 C 19.79,9 18,10.79 18,13 C 18,13.89 18.29,14.71 18.78,15.38 C 16.83,16.5 15.5,18.59 15.5,21 C 15.5,23.03 16.44,24.84 17.91,26.03 C 14.91,27.09 10.5,31.58 10.5,39.5 L 33.5,39.5 C 33.5,31.58 29.09,27.09 26.09,26.03 C 27.56,24.84 28.5,23.03 28.5,21 C 28.5,18.59 27.17,16.5 25.22,15.38 C 25.71,14.71 26,13.89 26,13 C 26,10.79 24.21,9 22,9 z "  style="opacity:1; fill:#ffffff; fill-opacity:1; fill-rule:nonzero; stroke:#000000; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:miter; stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;" /></g></g>'}),joint.shapes.basic.Generic.define("chess.PawnBlack",{size:{width:28,height:33}},{markup:'<g class="rotatable"><g class="scalable"><path d="M 22,9 C 19.79,9 18,10.79 18,13 C 18,13.89 18.29,14.71 18.78,15.38 C 16.83,16.5 15.5,18.59 15.5,21 C 15.5,23.03 16.44,24.84 17.91,26.03 C 14.91,27.09 10.5,31.58 10.5,39.5 L 33.5,39.5 C 33.5,31.58 29.09,27.09 26.09,26.03 C 27.56,24.84 28.5,23.03 28.5,21 C 28.5,18.59 27.17,16.5 25.22,15.38 C 25.71,14.71 26,13.89 26,13 C 26,10.79 24.21,9 22,9 z "  style="opacity:1; fill:#000000; fill-opacity:1; fill-rule:nonzero; stroke:#000000; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:miter; stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;" /></g></g>'});
67joint.shapes.basic.Generic.define("pn.Place",{size:{width:50,height:50},attrs:{".root":{r:25,fill:"#ffffff",stroke:"#000000",transform:"translate(25, 25)"},".label":{"text-anchor":"middle","ref-x":.5,"ref-y":-20,ref:".root",fill:"#000000","font-size":12},".tokens > circle":{fill:"#000000",r:5},".tokens.one > circle":{transform:"translate(25, 25)"},".tokens.two > circle:nth-child(1)":{transform:"translate(19, 25)"},".tokens.two > circle:nth-child(2)":{transform:"translate(31, 25)"},".tokens.three > circle:nth-child(1)":{transform:"translate(18, 29)"},".tokens.three > circle:nth-child(2)":{transform:"translate(25, 19)"},".tokens.three > circle:nth-child(3)":{transform:"translate(32, 29)"},".tokens.alot > text":{transform:"translate(25, 18)","text-anchor":"middle",fill:"#000000"}}},{markup:'<g class="rotatable"><g class="scalable"><circle class="root"/><g class="tokens" /></g><text class="label"/></g>'}),joint.shapes.pn.PlaceView=joint.dia.ElementView.extend({},{initialize:function(){joint.dia.ElementView.prototype.initialize.apply(this,arguments),this.model.on("change:tokens",function(){this.renderTokens(),this.update()},this)},render:function(){joint.dia.ElementView.prototype.render.apply(this,arguments),this.renderTokens(),this.update()},renderTokens:function(){var a=this.$(".tokens").empty();a[0].className.baseVal="tokens";var b=this.model.get("tokens");if(b)switch(b){case 1:a[0].className.baseVal+=" one",a.append(V("<circle/>").node);break;case 2:a[0].className.baseVal+=" two",a.append(V("<circle/>").node,V("<circle/>").node);break;case 3:a[0].className.baseVal+=" three",a.append(V("<circle/>").node,V("<circle/>").node,V("<circle/>").node);break;default:a[0].className.baseVal+=" alot",a.append(V("<text/>").text(b+"").node)}}}),joint.shapes.basic.Generic.define("pn.Transition",{size:{width:12,height:50},attrs:{rect:{width:12,height:50,fill:"#000000",stroke:"#000000"},".label":{"text-anchor":"middle","ref-x":.5,"ref-y":-20,ref:"rect",fill:"#000000","font-size":12}}},{markup:'<g class="rotatable"><g class="scalable"><rect class="root"/></g></g><text class="label"/>'}),joint.dia.Link.define("pn.Link",{attrs:{".marker-target":{d:"M 10 0 L 0 5 L 10 10 z"}}});
68joint.shapes.basic.Generic.define("devs.Model",{inPorts:[],outPorts:[],size:{width:80,height:80},attrs:{".":{magnet:!1},".label":{text:"Model","ref-x":.5,"ref-y":10,"font-size":18,"text-anchor":"middle",fill:"#000"},".body":{"ref-width":"100%","ref-height":"100%",stroke:"#000"}},ports:{groups:{in:{position:{name:"left"},attrs:{".port-label":{fill:"#000"},".port-body":{fill:"#fff",stroke:"#000",r:10,magnet:!0}},label:{position:{name:"left",args:{y:10}}}},out:{position:{name:"right"},attrs:{".port-label":{fill:"#000"},".port-body":{fill:"#fff",stroke:"#000",r:10,magnet:!0}},label:{position:{name:"right",args:{y:10}}}}}}},{markup:'<g class="rotatable"><rect class="body"/><text class="label"/></g>',portMarkup:'<circle class="port-body"/>',portLabelMarkup:'<text class="port-label"/>',initialize:function(){joint.shapes.basic.Generic.prototype.initialize.apply(this,arguments),this.on("change:inPorts change:outPorts",this.updatePortItems,this),this.updatePortItems()},updatePortItems:function(a,b,c){var d=joint.util.uniq(this.get("inPorts")),e=joint.util.difference(joint.util.uniq(this.get("outPorts")),d),f=this.createPortItems("in",d),g=this.createPortItems("out",e);this.prop("ports/items",f.concat(g),joint.util.assign({rewrite:!0},c))},createPortItem:function(a,b){return{id:b,group:a,attrs:{".port-label":{text:b}}}},createPortItems:function(a,b){return joint.util.toArray(b).map(this.createPortItem.bind(this,a))},_addGroupPort:function(a,b,c){var d=this.get(b);return this.set(b,Array.isArray(d)?d.concat(a):[a],c)},addOutPort:function(a,b){return this._addGroupPort(a,"outPorts",b)},addInPort:function(a,b){return this._addGroupPort(a,"inPorts",b)},_removeGroupPort:function(a,b,c){return this.set(b,joint.util.without(this.get(b),a),c)},removeOutPort:function(a,b){return this._removeGroupPort(a,"outPorts",b)},removeInPort:function(a,b){return this._removeGroupPort(a,"inPorts",b)},_changeGroup:function(a,b,c){return this.prop("ports/groups/"+a,joint.util.isObject(b)?b:{},c)},changeInGroup:function(a,b){return this._changeGroup("in",a,b)},changeOutGroup:function(a,b){return this._changeGroup("out",a,b)}}
68),joint.shapes.devs.Model.define("devs.Atomic",{size:{width:80,height:80},attrs:{".label":{text:"Atomic"}}}),joint.shapes.devs.Model.define("devs.Coupled",{size:{width:200,height:300},attrs:{".label":{text:"Coupled"}}}),joint.dia.Link.define("devs.Link",{attrs:{".connection":{"stroke-width":2}}});
69joint.shapes.basic.Generic.define("uml.Class",{attrs:{rect:{width:200},".uml-class-name-rect":{stroke:"black","stroke-width":2,fill:"#3498db"},".uml-class-attrs-rect":{stroke:"black","stroke-width":2,fill:"#2980b9"},".uml-class-methods-rect":{stroke:"black","stroke-width":2,fill:"#2980b9"},".uml-class-name-text":{ref:".uml-class-name-rect","ref-y":.5,"ref-x":.5,"text-anchor":"middle","y-alignment":"middle","font-weight":"bold",fill:"black","font-size":12,"font-family":"Times New Roman"},".uml-class-attrs-text":{ref:".uml-class-attrs-rect","ref-y":5,"ref-x":5,fill:"black","font-size":12,"font-family":"Times New Roman"},".uml-class-methods-text":{ref:".uml-class-methods-rect","ref-y":5,"ref-x":5,fill:"black","font-size":12,"font-family":"Times New Roman"}},name:[],attributes:[],methods:[]},{markup:['<g class="rotatable">','<g class="scalable">','<rect class="uml-class-name-rect"/><rect class="uml-class-attrs-rect"/><rect class="uml-class-methods-rect"/>',"</g>",'<text class="uml-class-name-text"/><text class="uml-class-attrs-text"/><text class="uml-class-methods-text"/>',"</g>"].join(""),initialize:function(){this.on("change:name change:attributes change:methods",function(){this.updateRectangles(),this.trigger("uml-update")},this),this.updateRectangles(),joint.shapes.basic.Generic.prototype.initialize.apply(this,arguments)},getClassName:function(){return this.get("name")},updateRectangles:function(){var a=this.get("attrs"),b=[{type:"name",text:this.getClassName()},{type:"attrs",text:this.get("attributes")},{type:"methods",text:this.get("methods")}],c=0;b.forEach(function(b){var d=Array.isArray(b.text)?b.text:[b.text],e=20*d.length+20;a[".uml-class-"+b.type+"-text"].text=d.join("\n"),a[".uml-class-"+b.type+"-rect"].height=e,a[".uml-class-"+b.type+"-rect"].transform="translate(0,"+c+")",c+=e})}}),joint.shapes.uml.ClassView=joint.dia.ElementView.extend({initialize:function(){joint.dia.ElementView.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"uml-update",function(){this.update(),this.resize()})}}),joint.shapes.uml.Class.define("uml.Abstract",{attrs:{".uml-class-name-rect":{fill:"#e74c3c"},".uml-class-attrs-rect":{fill:"#c0392b"},".uml-class-methods-rect":{fill:"#c0392b"}}},{getClassName:function(){return["<<Abstract>>",this.get("name")]}}),joint.shapes.uml.AbstractView=joint.shapes.uml.ClassView,joint.shapes.uml.Class.define("uml.Interface",{attrs:{".uml-class-name-rect":{fill:"#f1c40f"},".uml-class-attrs-rect":{fill:"#f39c12"},".uml-class-methods-rect":{fill:"#f39c12"}}},{getClassName:function(){return["<<Interface>>",this.get("name")]}}),joint.shapes.uml.InterfaceView=joint.shapes.uml.ClassView,joint.dia.Link.define("uml.Generalization",{attrs:{".marker-target":{d:"M 20 0 L 0 10 L 20 20 z",fill:"white"}}}),joint.dia.Link.define("uml.Implementation",{attrs:{".marker-target":{d:"M 20 0 L 0 10 L 20 20 z",fill:"white"},".connection":{"stroke-dasharray":"3,3"}}}),joint.dia.Link.define("uml.Aggregation",{attrs:{".marker-target":{d:"M 40 10 L 20 20 L 0 10 L 20 0 z",fill:"white"}}}),joint.dia.Link.define("uml.Composition",{attrs:{".marker-target":{d:"M 40 10 L 20 20 L 0 10 L 20 0 z",fill:"black"}}}),joint.dia.Link.define("uml.Association"),joint.shapes.basic.Generic.define("uml.State",{attrs:{".uml-state-body":{width:200,height:200,rx:10,ry:10,fill:"#ecf0f1",stroke:"#bdc3c7","stroke-width":3},".uml-state-separator":{stroke:"#bdc3c7","stroke-width":2},".uml-state-name":{ref:".uml-state-body","ref-x":.5,"ref-y":5,"text-anchor":"middle",fill:"#000000","font-family":"Courier New","font-size":14},".uml-state-events":{ref:".uml-state-separator","ref-x":5,"ref-y":5,fill:"#000000","font-family":"Courier New","font-size":14}},name:"State",events:[]},{markup:['<g class="rotatable">','<g class="scalable">','<rect class="uml-state-body"/>',"</g>",'<path class="uml-state-separator"/>','<text class="uml-state-name"/>','<text class="uml-state-events"/>',"</g>"].join(""),initialize:function(){this.on({"change:name":this.updateName,"change:events":this.updateEvents,"change:size":this.updatePath},this),this.updateName(),this.updateEvents(),this.updatePath(),joint.shapes.basic.Generic.prototype.initialize.apply(this,arguments)},updateName:function(){this.attr(".uml-state-name/text",this.get("name"))},updateEvents:function(){this.attr(".uml-state-events/text",this.get("events").join("\n"))},updatePath:function(){var a="M 0 20 L "+this.get("size").width+" 20";this.attr(".uml-state-separator/d",a,{silent:!0})}}),joint.shapes.basic.Circle.define("uml.StartState",{type:"uml.StartState",attrs:{cir
69cle:{fill:"#34495e",stroke:"#2c3e50","stroke-width":2,rx:1}}}),joint.shapes.basic.Generic.define("uml.EndState",{size:{width:20,height:20},attrs:{"circle.outer":{transform:"translate(10, 10)",r:10,fill:"#ffffff",stroke:"#2c3e50"},"circle.inner":{transform:"translate(10, 10)",r:6,fill:"#34495e"}}},{markup:'<g class="rotatable"><g class="scalable"><circle class="outer"/><circle class="inner"/></g></g>'}),joint.dia.Link.define("uml.Transition",{attrs:{".marker-target":{d:"M 10 0 L 0 5 L 10 10 z",fill:"#34495e",stroke:"#2c3e50"},".connection":{stroke:"#2c3e50"}}});
70joint.shapes.basic.Generic.define("logic.Gate",{size:{width:80,height:40},attrs:{".":{magnet:!1},".body":{width:100,height:50},circle:{r:7,stroke:"black",fill:"transparent","stroke-width":2}}},{operation:function(){return!0}}),joint.shapes.logic.Gate.define("logic.IO",{size:{width:60,height:30},attrs:{".body":{fill:"white",stroke:"black","stroke-width":2},".wire":{ref:".body","ref-y":.5,stroke:"black"},text:{fill:"black",ref:".body","ref-x":.5,"ref-y":.5,"y-alignment":"middle","text-anchor":"middle","font-weight":"bold","font-variant":"small-caps","text-transform":"capitalize","font-size":"14px"}}},{markup:'<g class="rotatable"><g class="scalable"><rect class="body"/></g><path class="wire"/><circle/><text/></g>'}),joint.shapes.logic.IO.define("logic.Input",{attrs:{".wire":{"ref-dx":0,d:"M 0 0 L 23 0"},circle:{ref:".body","ref-dx":30,"ref-y":.5,magnet:!0,class:"output",port:"out"},text:{text:"input"}}}),joint.shapes.logic.IO.define("logic.Output",{attrs:{".wire":{"ref-x":0,d:"M 0 0 L -23 0"},circle:{ref:".body","ref-x":-30,"ref-y":.5,magnet:"passive",class:"input",port:"in"},text:{text:"output"}}}),joint.shapes.logic.Gate.define("logic.Gate11",{attrs:{".input":{ref:".body","ref-x":-2,"ref-y":.5,magnet:"passive",port:"in"},".output":{ref:".body","ref-dx":2,"ref-y":.5,magnet:!0,port:"out"}}},{markup:'<g class="rotatable"><g class="scalable"><image class="body"/></g><circle class="input"/><circle class="output"/>
70</g>'}),joint.shapes.logic.Gate.define("logic.Gate21",{attrs:{".input1":{ref:".body","ref-x":-2,"ref-y":.3,magnet:"passive",port:"in1"},".input2":{ref:".body","ref-x":-2,"ref-y":.7,magnet:"passive",port:"in2"},".output":{ref:".body","ref-dx":2,"ref-y":.5,magnet:!0,port:"out"}}},{markup:'<g class="rotatable"><g class="scalable"><image class="body"/></g><circle class="input input1"/><circle  class="input input2"/><circle class="output"/></g>'}),joint.shapes.logic.Gate11.define("logic.Repeater",{attrs:{image:{"xlink:href":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgo8c3ZnCiAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIKICAgeG1sbnM6Y2M9Imh0dHA6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL25zIyIKICAgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHdpZHRoPSIxMDAiCi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MzEuMTI1LDMuNjU2MjUgTCAyOC45Njg3NSwyLjU5Mzc1IHogTSAzMS45Njg3NSw3LjQwNjI1IEwgNjguMDkzNzUsMjUgTCAzMS45Njg3NSw0Mi41OTM3NSBMIDMxLjk2ODc1LDcuNDA2MjUgeiIKICAgICAgIGlkPSJwYXRoMjYzOCIKICAgICAgIHNvZGlwb2RpOm5vZGV0eXBlcz0iY2NjY2NjY2NjY2NjYyIgLz4KICA8L2c+Cjwvc3ZnPgo="}}},{operation:function(a){return a}}),joint.shapes.logic.Gate11.define("logic.Not",{attrs:{image:{"xlink:href":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgo8c3ZnCiAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIKICAgeG1sbnM6Y2M9Imh0dHA6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL25zIyIKICAgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHdpZHRoPSIxMDAiCiAgIGhlaWdodD0iNTAiCiAgIGlkPSJzdmcyIgogICBzb2RpcG9kaTp2ZXJzaW9uPSIwLjMyI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jI1IEwgNjguMDkzNzUsMjUgTCAzMS45Njg3NSw0Mi41OTM3NSBMIDMxLjk2ODc1LDcuNDA2MjUgeiIKICAgICAgIGlkPSJwYXRoMjYzOCIKICAgICAgIHNvZGlwb2RpOm5vZGV0eXBlcz0iY2NjY2NjY2NjY2NjYyIgLz4KICAgIDxwYXRoCiAgICAgICBzb2RpcG9kaTp0eXBlPSJhcmMiCiAgICAgICBzdHlsZT0iZmlsbDpub25lO2ZpbGwtb3BhY2l0eToxO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDozO3N0cm9rZS1saW5lam9pbjptaXRlcjttYXJrZXI6bm9uZTtzdHJva2Utb3BhY2l0eToxO3Zpc2liaWxpdHk6dmlzaWJsZTtkaXNwbGF5OmlubGluZTtvdmVyZmxvdzp2aXNpYmxlO2VuYWJsZS1iYWNrZ3JvdW5kOmFjY3VtdWxhdGUiCiAgICAgICBpZD0icGF0aDI2NzEiCiAgICAgICBzb2RpcG9kaTpjeD0iNzYiCiAgICAgICBzb2RpcG9kaTpjeT0iMjUiCiAgICAgICBzb2RpcG9kaTpyeD0iNCIKICAgICAgIHNvZGlwb2RpOnJ5PSI0IgogICAgICAgZD0iTSA4MCwyNSBBIDQsNCAwIDEgMSA3MiwyNSBBIDQsNCAwIDEgMSA4MCwyNSB6IgogICAgICAgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTEsMCkiIC8+CiAgPC9nPgo8L3N2Zz4K"}}},{operation:function(a){return!a}}),joint.shapes.logic.Gate21.define("logic.Or",{attrs:{image:{"xlink:href":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgo8c3ZnCiAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS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hcGU6d2luZG93LWhlaWdodD0iODc0IgogICAgIGlua3NjYXBlOndpbmRvdy14PSIzMyIKICAgICBpbmtzY2FwZTp3aW5kb3cteT0iMCIKICAgICBpbmtzY2FwZTpzbmFwLWJib3g9InRydWUiPgogICAgPGlua3NjYXBlOmdyaWQKICAgICAgIGl
70kPSJHcmlkRnJvbVByZTA0NlNldHRpbmdzIgogICAgICAgdHlwZT0ieHlncmlkIgogICAgICAgb3JpZ2lueD0iMHB4IgogICAgICAgb3JpZ2lueT0iMHB4IgogICAgICAgc3BhY2luZ3g9IjFweCIKICAgICAgIHNwYWNpbmd5PSIxcHgiCiAgICAgICBjb2xvcj0iIzAwMDBmZiIKICAgICAgIGVtcGNvbG9yPSIjMDAwMGZmIgogICAgICAgb3BhY2l0eT0iMC4yIgogICAgICAgZW1wb3BhY2l0eT0iMC40IgogICAgICAgZW1wc3BhY2luZz0iNSIKICAgICAgIHZpc2libGU9InRydWUiCiAgICAgICBlbmFibGVkPSJ0cnVlIiAvPgogIDwvc29kaXBvZGk6bmFtZWR2aWV3PgogIDxtZXRhZGF0YQogICAgIGlkPSJtZXRhZGF0YTciPgogICAgPHJkZjpSREY+CiAgICAgIDxjYzpXb3JrCiAgICAgICAgIHJkZjphYm91dD0iIj4KICAgICAgICA8ZGM6Zm9ybWF0PmltYWdlL3N2Zyt4bWw8L2RjOmZvcm1hdD4KICAgICAgICA8ZGM6dHlwZQogICAgICAgICAgIHJkZjpyZXNvdXJjZT0iaHR0cDovL3B1cmwub3JnL2RjL2RjbWl0eXBlL1N0aWxsSW1hZ2UiIC8+CiAgICAgIDwvY2M6V29yaz4KICAgIDwvcmRmOlJERj4KICA8L21ldGFkYXRhPgogIDxnCiAgICAgaW5rc2NhcGU6bGFiZWw9IkxheWVyIDEiCiAgICAgaW5rc2NhcGU6Z3JvdXBtb2RlPSJsYXllciIKICAgICBpZD0ibGF5ZXIxIj4KICAgIDxwYXRoCiAgICAgICBzdHlsZT0iZmlsbDpub25lO3N0cm9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g1Myw3Ljg1NzE0MyA2Ny4xNDI4NTcsMTUuNDk3MDk4IDY3LjE0Mjg1NywyNSBDIDY3LjE0Mjg1NywzNC41MDI5MDIgNTkuNzYwNjYyLDQyLjE0Mjg1NyA1MCw0Mi4xNDI4NTcgTCAzMi44NTcxNDMsNDIuMTQyODU3IEwgMzIuODU3MTQzLDcuODU3MTQyOSB6IgogICAgICAgaWQ9InBhdGgyODg0IgogICAgICAgc29kaXBvZGk6bm9kZXR5cGVzPSJjY2NjY2NzY2NjY3Nzc3NzY2NjIiAvPgogIDwvZz4KPC9zdmc+Cg=="}}},{operation:function(a,b){return a&&b}}),joint.shapes.logic.Gate21.define("logic.Nor",{attrs:{image:{"xlink:href":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgo8c3ZnCiAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIKICAgeG1sbnM6Y2M9Imh0dHA6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL25zIyIKICAgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHdpZHRoPSIxMDAiCiAgIGhl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gICBzb2RpcG9kaTpub2RldHlwZXM9ImNjc2NjY2NzY2NjY2NjY2Njc2Njc2MiIC8+CiAgICAgIDxwYXRoCiAgICAgICAgIHNvZGlwb2RpOnR5cGU9ImFyYyIKICAgICAgICAgc3R5bGU9ImZpbGw6bm9uZTtmaWxsLW9wYWNpdHk6MTtzdHJva2U6IzAwMDAwMDtzdHJva2Utd2lkdGg6MztzdHJva2UtbGluZWpvaW46bWl0ZXI7bWFya2VyOm5vbmU7c3Ryb2tlLW9wYWNpdHk6MTt2aXNpYmlsaXR5OnZpc2libGU7ZGlzcGxheTppbmxpbmU7b3ZlcmZsb3c6dmlzaWJsZTtlbmFibGUtYmFja2dyb3VuZDphY2N1bXVsYXRlIgogICAgICAgICBpZD0icGF0aDI2MDQiCiAgICAgICAgIHNvZGlwb2RpOmN4PSI3NSIKICAgICAgICAgc29kaXBvZGk6Y3k9IjI1IgogICAgICAgICBzb2RpcG9kaTpyeD0iNCIKICAgICAgICAgc29kaXBvZGk6cnk9IjQiCiAgICAgICAgIGQ9Ik0gNzksMjUgQSA0LDQgMCAxIDEgNzEsMjUgQSA0LDQgMCAxIDEgNzksMjUgeiIKICAgICAgICAgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTI2LjUsMzkuNSkiIC8+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4K"
71}}},{operation:function(a,b){return!(a||b)}}),joint.shapes.logic.Gate21.define("logic.Nand",{attrs:{image:{"xlink:href":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgo8c3ZnCiAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIKICAgeG1sbnM6Y2M9Imh0dHA6Ly9jcmVhdGl2ZWNvb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NjUuMjE4NzUgTCA0NC43NSw2NC41IEwgNDYuMDYyNSw2My43ODEyNSBDIDM1Ljc1OTM4Nyw0NC43MTU1OSAxOS41MDY1NzQsNDQuNSAxNC43NSw0NC41IEwgMC43NSw0NC41IEwgLTIuNDA2MjUsNDQuNSB6IE0gMy40Njg3NSw0Ny41IEwgMTQuNzUsNDcuNSBDIDE5LjQzNDE3Myw0Ny41IDMzLjAzNjg1LDQ3LjM2OTc5MyA0Mi43MTg3NSw2NC41IEMgMzcuOTUxOTY0LDcyLjkyOTA3NSAzMi4xOTc0NjksNzcuMTgzOTEgMjcsNzkuMzEyNSBDIDIxLjYzOTMzOSw4MS41MDc5MjQgMTcuMTU4MDc1LDgxLjUwMDAwMSAxNC43NSw4MS41IEwgMy41LDgxLjUgQyA1LjM3MzU4ODQsNzguMzkxNTY2IDguMjUsNzIuNDUwNjUgOC4yNSw2NC41IEMgOC4yNSw1Ni41MjY2NDYgNS4zNDE0Njg2LDUwLjU5OTgxNSAzLjQ2ODc1LDQ3LjUgeiIKICAgICAgICAgaWQ9InBhdGg0OTczIgogICAgICAgICBzb2RpcG9kaTpub2RldHlwZXM9ImNjc2NjY2NzY2NjY2NjY2Njc2Njc2MiIC8+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4K"}}},{operation:function(a,b){return(!a||b)&&(a||!b)}}),joint.shapes.logic.Gate21.define("logic.Xnor",{attrs:{image:{"xlink:href":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgo8c3ZnCiAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIKICAgeG1sbnM6Y2M9Imh0dHA6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL25zIyIKICAgeG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y4xNTgwNzUsODEuNTAwMDAxIDE0Ljc1LDgxLjUgTCAzLjUsODEuNSBDIDUuMzczNTg4NCw3OC4zOTE1NjYgOC4yNSw3Mi40NTA2NSA4LjI1LDY0LjUgQyA4LjI1LDU2LjUyNjY0NiA1LjM0MTQ2ODYsNTAuNTk5ODE1IDMuNDY4NzUsNDcuNSB6IgogICAgICAgICBpZD0icGF0aDQ5NzMiCiAgICAgICAgIHNvZGlwb2RpOm5vZGV0eXBlcz0iY2NzY2NjY3NjY2NjY2NjY2NzY2NzYyIgLz4KICAgIDwvZz4KICAgIDxwYXRoCiAgICAgICBzb2RpcG9kaTp0eXBlPSJhcmMiCiAgICAgICBzdHlsZT0iZmlsbDpub25lO2ZpbGwtb3BhY2l0eToxO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDozO3N0cm9rZS1saW5lam9pbjptaXRlcjttYXJrZXI6bm9uZTtzdHJva2Utb3BhY2l0eToxO3Zpc2liaWxpdHk6dmlzaWJsZTtkaXNwbGF5OmlubGluZTtvdmVyZmxvdzp2aXNpYmxlO2VuYWJsZS1iYWNrZ3JvdW5kOmFjY3VtdWxhdGUiCiAgICAgICBpZD0icGF0aDM1NTEiCiAgICAgICBzb2RpcG9kaTpjeD0iNzUiCiAgICAgICBzb2RpcG9kaTpjeT0iMjUiCiAgICAgICBzb2RpcG9kaTpyeD0iNCIKICAgICAgIHNvZGlwb2RpOnJ5PSI0IgogICAgICAgZD0iTSA3OSwyNSBBIDQsNCAwIDEgMSA3MSwyNSBBIDQsNCAwIDEgMSA3OSwyNSB6IiAvPgogIDwvZz4KPC9zdmc+Cg=="}}},{operation:function(a,b){return(!a||!b)&&(a||b)}}),joint.dia.Link.define("logic.Wire",{attrs:{".connection":{"stroke-width":2},".marker-vertex":{r:7}},router:{name:"orthogonal"},connector:{name:"rounded",args:{radius:10}}},{arrowheadMarkup:['<g class="marker-arrowhead-group marker-arrowhead-group-<%= end %>">','<circle class="marker-arrowhead" end="<%= end %>" r="7"/>',"</g>"].join(""),vertexMarkup:['<g class="marker-vertex-group" transform="translate(<%= x %>, <%= y %>)">','<circle class="marker-vertex" idx="<%= idx %>" r="10" />','<g class="marker-vertex-remove-group">','<path class="marker-vertex-remove-area" idx="<%= idx %>" d="M16,5.333c-7.732,0-14,4.701-14,10.5c0,1.982,0.741,3.833,2.016,5.414L2,25.667l5.613-1.441c2.339,1.317,5.237,2.107,8.387,2.107c7.732,0,14-4.701,14-10.5C30,10.034,23.732,5.333,16,5.333z" transform="translate(5, -33)"/>','<path class="marker-vertex-remove" idx="<%= idx %>" transform="scale(.8) translate(9.5, -37)" d="M24.778,21.419 19.276,15.917 24.777,10.415 21.949,7.585 16.447,13.087 10.945,7.585 8.117,10.415 13.618,15.917 8.116,21.419 10.946,24.248 16.447,18.746 21.948,24.248z">',"<title>Remove vertex.</title>","</path>","</g>","</g>"].join("")});
72if("object"==typeof exports)var graphlib=require("graphlib"),dagre=require("dagre");graphlib=graphlib||"undefined"!=typeof window&&window.graphlib,dagre=dagre||"undefined"!=typeof window&&window.dagre,joint.layout.DirectedGraph={exportElement:function(a){return a.size()},exportLink:function(a){var b=a.get("labelSize")||{},c={minLen:a.get("minLen")||1,weight:a.get("weight")||1,labelpos:a.get("labelPosition")||"c",labeloffset:a.get("labelOffset")||0,width:b.width||0,height:b.height||0};return c},importElement:function(a,b,c){var d=this.getCell(b),e=c.node(b);a.setPosition?a.setPosition(d,e):d.set("position",{x:e.x-e.width/2,y:e.y-e.height/2})},importLink:function(a,b,c){var d=this.getCell(b.name),e=c.edge(b),f=e.points||[];
72if((a.setVertices||a.setLinkVertices)&&(joint.util.isFunction(a.setVertices)?a.setVertices(d,f):d.set("vertices",f.slice(1,f.length-1))),a.setLabels&&"x"in e&&"y"in e){var h={x:e.x,y:e.y};if(joint.util.isFunction(a.setLabels))a.setLabels(d,h,f);else{var i=g.Polyline(f),j=i.closestPointLength(h),k=i.pointAtLength(j),l=j/i.length();d.label(0,{position:{distance:l,offset:g.Point(h).difference(k).toJSON()}})}}},layout:function(a,b){var c;c=a instanceof joint.dia.Graph?a:(new joint.dia.Graph).resetCells(a,{dry:!0,sort:!1}),a=null,b=joint.util.defaults(b||{},{resizeClusters:!0,clusterPadding:10,exportElement:this.exportElement,exportLink:this.exportLink});var d=c.toGraphLib({directed:!0,multigraph:!0,compound:!0,setNodeLabel:b.exportElement,setEdgeLabel:b.exportLink,setEdgeName:function(a){return a.id}}),e={},f=b.marginX||0,h=b.marginY||0;if(b.rankDir&&(e.rankdir=b.rankDir),b.align&&(e.align=b.align),b.nodeSep&&(e.nodesep=b.nodeSep),b.edgeSep&&(e.edgesep=b.edgeSep),b.rankSep&&(e.ranksep=b.rankSep),b.ranker&&(e.ranker=b.ranker),f&&(e.marginx=f),h&&(e.marginy=h),d.setGraph(e),dagre.layout(d,{debugTiming:!!b.debugTiming}),c.startBatch("layout"),c.fromGraphLib(d,{importNode:this.importElement.bind(c,b),importEdge:this.importLink.bind(c,b)}),b.resizeClusters){var i=d.nodes().filter(function(a){return d.children(a).length>0}).map(c.getCell.bind(c)).sort(function(a,b){return b.getAncestors().length-a.getAncestors().length});joint.util.invoke(i,"fitEmbeds",{padding:b.clusterPadding})}c.stopBatch("layout");var j=d.graph();return g.Rect(f,h,Math.abs(j.width-2*f),Math.abs(j.height-2*h))},fromGraphLib:function(a,b){b=b||{};
72var c=b.importNode||joint.util.noop,d=b.importEdge||joint.util.noop,e=this instanceof joint.dia.Graph?this:new joint.dia.Graph;return a.nodes().forEach(function(d){c.call(e,d,a,e,b)}),a.edges().forEach(function(c){d.call(e,c,a,e,b)}),e},toGraphLib:function(a,b){b=b||{};for(var c=joint.util.pick(b,"directed","compound","multigraph"),d=new graphlib.Graph(c),e=b.setNodeLabel||joint.util.noop,f=b.setEdgeLabel||joint.util.noop,g=b.setEdgeName||joint.util.noop,h=a.get("cells"),i=0,j=h.length;i<j;i++){var k=h.at(i);if(k.isLink()){var l=k.get("source"),m=k.get("target");if(!l.id||!m.id)break;d.setEdge(l.id,m.id,f(k),g(k))}else if(d.setNode(k.id,e(k)),d.isCompound()&&k.has("parent")){var n=k.get("parent");h.has(n)&&d.setParent(k.id,n)}}return d}},joint.dia.Graph.prototype.toGraphLib=function(a){return joint.layout.DirectedGraph.toGraphLib(this,a)},joint.dia.Graph.prototype.fromGraphLib=function(a,b){return joint.layout.DirectedGraph.fromGraphLib.call(this,a,b)};
73!function(){"use strict";"undefined"==typeof window||"SVGPathSeg"in window||(window.SVGPathSeg=function(a,b,c){this.pathSegType=a,this.pathSegTypeAsLetter=b,this._owningPathSegList=c},window.SVGPathSeg.prototype.classname="SVGPathSeg",window.SVGPathSeg.PATHSEG_UNKNOWN=0,window.SVGPathSeg.PATHSEG_CLOSEPATH=1,window.SVGPathSeg.PATHSEG_MOVETO_ABS=2,window.SVGPathSeg.PATHSEG_MOVETO_REL=3,window.SVGPathSeg.PATHSEG_LINETO_ABS=4,window.SVGPathSeg.PATHSEG_LINETO_REL=5,window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS=6,window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL=7,window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS=8,window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL=9,window.SVGPathSeg.PATHSEG_ARC_ABS=10,window.SVGPathSeg.PATHSEG_ARC_REL=11,window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS=12,window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL=13,window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS=14,window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL=15,window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS=16,window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL=17,window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS=18,window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL=19,window.SVGPathSeg.prototype._segmentChanged=function(){this._owningPathSegList&&this._owningPathSegList.segmentChanged(this)},window.SVGPathSegClosePath=function(a){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CLOSEPATH,"z",a)},window.SVGPathSegClosePath.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegClosePath.prototype.toString=function(){return"[object SVGPathSegClosePath]"},window.SVGPathSegClosePath.prototype._asPathString=function(){return this.pathSegTypeAsLetter},window.SVGPathSegClosePath.prototype.clone=function(){return new window.SVGPathSegClosePath((void 0))},window.SVGPathSegMovetoAbs=function(a,b,c){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_MOVETO_ABS,"M",a),this._x=b,this._y=c},window.SVGPathSegMovetoAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegMovetoAbs.prototype.toString=function(){return"[object SVGPathSegMovetoAbs]"},window.SVGPathSegMovetoAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y},window.SVGPathSegMovetoAbs.prototype.clone=function(){return new window.SVGPathSegMovetoAbs((void 0),this._x,this._y)},Object.defineProperty(window.SVGPathSegMovetoAbs.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegMovetoAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a,this._segmentChanged()},enumerable:!0}),window.SVGPathSegMovetoRel=function(a,b,c){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_MOVETO_REL,"m",a),this._x=b,this._y=c},window.SVGPathSegMovetoRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegMovetoRel.prototype.toString=function(){return"[object SVGPathSegMovetoRel]"},window.SVGPathSegMovetoRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y},window.SVGPathSegMovetoRel.prototype.clone=function(){return new window.SVGPathSegMovetoRel((void 0),this._x,this._y)}
vendor: 18,819 bytes, line 73
73,Object.defineProperty(window.SVGPathSegMovetoRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegMovetoRel.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a,this._segmentChanged()},enumerable:!0}),window.SVGPathSegLinetoAbs=function(a,b,c){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_LINETO_ABS,"L",a),this._x=b,this._y=c},window.SVGPathSegLinetoAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegLinetoAbs.prototype.toString=function(){return"[object SVGPathSegLinetoAbs]"},window.SVGPathSegLinetoAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y},window.SVGPathSegLinetoAbs.prototype.clone=function(){return new window.SVGPathSegLinetoAbs((void 0),this._x,this._y)},Object.defineProperty(window.SVGPathSegLinetoAbs.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegLinetoAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a,this._segmentChanged()},enumerable:!0}),window.SVGPathSegLinetoRel=function(a,b,c){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_LINETO_REL,"l",a),this._x=b,this._y=c},window.SVGPathSegLinetoRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegLinetoRel.prototype.toString=function(){return"[object SVGPathSegLinetoRel]"},window.SVGPathSegLinetoRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y},window.SVGPathSegLinetoRel.prototype.clone=function(){return new window.SVGPathSegLinetoRel((void 0),this._x,this._y)},Object.defineProperty(window.SVGPathSegLinetoRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegLinetoRel.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a,this._segmentChanged()},enumerable:!0}),window.SVGPathSegCurvetoCubicAbs=function(a,b,c,d,e,f,g){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS,"C",a),this._x=b,this._y=c,this._x1=d,this._y1=e,this._x2=f,this._y2=g},window.SVGPathSegCurvetoCubicAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegCurvetoCubicAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicAbs]"},window.SVGPathSegCurvetoCubicAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y},window.SVGPathSegCurvetoCubicAbs.prototype.clone=function(){return new window.SVGPathSegCurvetoCubicAbs((void 0),this._x,this._y,this._x1,this._y1,this._x2,this._y2)},Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype,"x1",{get:function(){return this._x1},set:function(a){this._x1=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype,"y1",{get:function(){return this._y1},set:function(a){this._y1=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype,"x2",{get:function(){return this._x2},set:function(a){this._x2=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype,"y2",{get:function(){return this._y2},set:function(a){this._y2=a,this._segmentChanged()},enumerable:!0}),window.SVGPathSegCurvetoCubicRel=function(a,b,c,d,e,f,g){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL,"c",a),this._x=b,this._y=c,this._x1=d,this._y1=e,this._x2=f,this._y2=g},window.SVGPathSegCurvetoCubicRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegCurvetoCubicRel.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicRel]"},window.SVGPathSegCurvetoCubicRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y},window.SVGPathSegCurvetoCubicRel.prototype.clone=function(){return new window.SVGPathSegCurvetoCubicRel((void 0),this._x,this._y,this._x1,this._y1,this._x2,this._y2)},Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype,"x1",{get:function(){return this._x1},set:function(a){this._x1=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype,"y1",{get:function(){return this._y1},set:function(a){this._y1=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype,"x2",{get:function(){return this._x2},set:function(a){this._x2=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype,"y2",{get:function(){return this._y2},set:function(a){this._y2=a,this._segmentChanged()},enumerable:!0}),window.SVGPathSegCurvetoQuadraticAbs=function(a,b,c,d,e){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS,"Q",a),this._x=b,this._y=c,this._x1=d,this._y1=e},window.SVGPathSegCurvetoQuadraticAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegCurvetoQuadraticAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticAbs]"},window.SVGPathSegCurvetoQuadraticAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x+" "+this._y},window.SVGPathSegCurvetoQuadraticAbs.prototype.clone=function(){return new window.SVGPathSegCurvetoQuadraticAbs((void 0),this._x,this._y,this._x1,this._y1)},Object.defineProperty(window.SVGPathSegCurvetoQuadraticAbs.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoQuadraticAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoQuadraticAbs.prototype,"x1",{get:function(){return this._x1},set:function(a){this._x1=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoQuadraticAbs.prototype,"y1",{get:function(){return this._y1},set:function(a){this._y1=a,this._segmentChanged()},enumerable:!0}),window.SVGPathSegCurvetoQuadraticRel=function(a,b,c,d,e){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL,"q",a),this._x=b,this._y=c,this._x1=d,this._y1=e},window.SVGPathSegCurvetoQuadraticRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegCurvetoQuadraticRel.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticRel]"},window.SVGPathSegCurvetoQuadraticRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x+" "+this._y},window.SVGPathSegCurvetoQuadraticRel.prototype.clone=function(){return new window.SVGPathSegCurvetoQuadraticRel((void 0),this._x,this._y,this._x1,this._y1)},Object.defineProperty(window.SVGPathSegCurvetoQuadraticRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoQuadraticRel.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoQuadraticRel.prototype,"x1",{get:function(){return this._x1},set:function(a){this._x1=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoQuadraticRel.prototype,"y1",{get:function(){return this._y1},set:function(a){this._y1=a,this._segmentChanged()},enumerable:!0}),window.SVGPathSegArcAbs=function(a,b,c,d,e,f,g,h){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_ARC_ABS,"A",a),this._x=b,this._y=c,this._r1=d,this._r2=e,this._angle=f,this._largeArcFlag=g,this._sweepFlag=h},window.SVGPathSegArcAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegArcAbs.prototype.toString=function(){return"[object SVGPathSegArcAbs]"},window.SVGPathSegArcAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._r1+" "+this._r2+" "+this._angle+" "+(this._largeArcFlag?"1":"0")+" "+(this._sweepFlag?"1":"0")+" "+this._x+" "+this._y},window.SVGPathSegArcAbs.prototype.clone=function(){return new window.SVGPathSegArcAbs((void 0),this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)},Object.defineProperty(window.SVGPathSegArcAbs.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcAbs.prototype,"r1",{get:function(){return this._r1},set:function(a){this._r1=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcAbs.prototype,"r2",{get:function(){return this._r2},set:function(a){this._r2=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcAbs.prototype,"angle",{get:function(){return this._angle},set:function(a){this._angle=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcAbs.prototype,"largeArcFlag",{get:function(){return this._largeArcFlag},set:function(a){this._largeArcFlag=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcAbs.prototype,"sweepFlag",{get:function(){return this._sweepFlag},set:function(a){this._sweepFlag=a,this._segmentChanged()},enumerable:!0}),window.SVGPathSegArcRel=function(a,b,c,d,e,f,g,h){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_ARC_REL,"a",a),this._x=b,this._y=c,this._r1=d,this._r2=e,this._angle=f,this._largeArcFlag=g,this._sweepFlag=h},window.SVGPathSegArcRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegArcRel.prototype.toString=function(){return"[object SVGPathSegArcRel]"},window.SVGPathSegArcRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._r1+" "+this._r2+" "+this._angle+" "+(this._largeArcFlag?"1":"0")+" "+(this._sweepFlag?"1":"0")+" "+this._x+" "+this._y},window.SVGPathSegArcRel.prototype.clone=function(){return new window.SVGPathSegArcRel((void 0),this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)},Object.defineProperty(window.SVGPathSegArcRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcRel.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcRel.prototype,"r1",{get:function(){return this._r1},set:function(a){this._r1=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcRel.prototype,"r2",{get:function(){return this._r2},set:function(a){this._r2=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcRel.prototype,"angle",{get:function(){return this._angle},set:function(a){this._angle=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcRel.prototype,"largeArcFlag",{get:function(){return this._largeArcFlag},set:function(a){this._largeArcFlag=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcRel.prototype,"sweepFlag",{get:function(){return this._sweepFlag},set:function(a){this._sweepFlag=a,this._segmentChanged()},enumerable:!0}),window.SVGPathSegLinetoHorizontalAbs=function(a,b){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS,"H",a),this._x=b},window.SVGPathSegLinetoHorizontalAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegLinetoHorizontalAbs.prototype.toString=function(){return"[object SVGPathSegLinetoHorizontalAbs]"},window.SVGPathSegLinetoHorizontalAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x},window.SVGPathSegLinetoHorizontalAbs.prototype.clone=function(){return new window.SVGPathSegLinetoHorizontalAbs((void 0),this._x)},Object.defineProperty(window.SVGPathSegLinetoHorizontalAbs.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a,this._segmentChanged()},enumerable:!0}),window.SVGPathSegLinetoHorizontalRel=function(a,b){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL,"h",a),this._x=b},window.SVGPathSegLinetoHorizontalRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegLinetoHorizontalRel.prototype.toString=function(){return"[object SVGPathSegLinetoHorizontalRel]"},window.SVGPathSegLinetoHorizontalRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x},window.SVGPathSegLinetoHorizontalRel.prototype.clone=function(){return new window.SVGPathSegLinetoHorizontalRel((void 0),this._x)},Object.defineProperty(window.SVGPathSegLinetoHorizontalRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a,this._segmentChanged()},enumerable:!0}),window.SVGPathSegLinetoVerticalAbs=function(a,b){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS,"V",a),this._y=b},window.SVGPathSegLinetoVerticalAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegLinetoVerticalAbs.prototype.toString=function(){return"[object SVGPathSegLinetoVerticalAbs]"},window.SVGPathSegLinetoVerticalAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._y},window.SVGPathSegLinetoVerticalAbs.prototype.clone=function(){return new window.SVGPathSegLinetoVerticalAbs((void 0),this._y)},Object.defineProperty(window.SVGPathSegLinetoVerticalAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a,this._segmentChanged()},enumerable:!0}),window.SVGPathSegLinetoVerticalRel=function(a,b){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL,"v",a),this._y=b},window.SVGPathSegLinetoVerticalRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegLinetoVerticalRel.prototype.toString=function(){return"[object SVGPathSegLinetoVerticalRel]"},window.SVGPathSegLinetoVerticalRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._y},window.SVGPathSegLinetoVerticalRel.prototype.clone=function(){return new window.SVGPathSegLinetoVerticalRel((void 0),this._y)},Object.defineProperty(window.SVGPathSegLinetoVerticalRel.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a,this._segmentChanged()},enumerable:!0}),window.SVGPathSegCurvetoCubicSmoothAbs=function(a,b,c,d,e){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS,"S",a),this._x=b,this._y=c,this._x2=d,this._y2=e},window.SVGPathSegCurvetoCubicSmoothAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegCurvetoCubicSmoothAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicSmoothAbs]"},window.SVGPathSegCurvetoCubicSmoothAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y},window.SVGPathSegCurvetoCubicSmoothAbs.prototype.clone=function(){return new window.SVGPathSegCurvetoCubicSmoothAbs((void 0),this._x,this._y,this._x2,this._y2)},Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothAbs.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothAbs.prototype,"x2",{get:function(){return this._x2},set:function(a){this._x2=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothAbs.prototype,"y2",{get:function(){return this._y2},set:function(a){this._y2=a,this._segmentChanged()},enumerable:!0}),window.SVGPathSegCurvetoCubicSmoothRel=function(a,b,c,d,e){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL,"s",a),this._x=b,this._y=c,this._x2=d,this._y2=e},window.SVGPathSegCurvetoCubicSmoothRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegCurvetoCubicSmoothRel.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicSmoothRel]"},window.SVGPathSegCurvetoCubicSmoothRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y},window.SVGPathSegCurvetoCubicSmoothRel.prototype.clone=function(){return new window.SVGPathSegCurvetoCubicSmoothRel((void 0),this._x,this._y,this._x2,this._y2)},Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothRel.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothRel.prototype,"x2",{get:function(){return this._x2},set:function(a){this._x2=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothRel.prototype,"y2",{get:function(){return this._y2},set:function(a){this._y2=a,this._segmentChanged()},enumerable:!0}),window.SVGPathSegCurvetoQuadraticSmoothAbs=function(a,b,c){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS,"T",a),this._x=b,this._y=c},window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticSmoothAbs]"},window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y},window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype.clone=function(){return new window.SVGPathSegCurvetoQuadraticSmoothAbs((void 0),this._x,this._y)}
73,Object.defineProperty(window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a,this._segmentChanged()},enumerable:!0}),window.SVGPathSegCurvetoQuadraticSmoothRel=function(a,b,c){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL,"t",a),this._x=b,this._y=c},window.SVGPathSegCurvetoQuadraticSmoothRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegCurvetoQuadraticSmoothRel.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticSmoothRel]"},window.SVGPathSegCurvetoQuadraticSmoothRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y},window.SVGPathSegCurvetoQuadraticSmoothRel.prototype.clone=function(){return new window.SVGPathSegCurvetoQuadraticSmoothRel((void 0),this._x,this._y)},Object.defineProperty(window.SVGPathSegCurvetoQuadraticSmoothRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoQuadraticSmoothRel.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a,this._segmentChanged()},enumerable:!0}),window.SVGPathElement.prototype.createSVGPathSegClosePath=function(){return new window.SVGPathSegClosePath((void 0))},window.SVGPathElement.prototype.createSVGPathSegMovetoAbs=function(a,b){return new window.SVGPathSegMovetoAbs((void 0),a,b)},window.SVGPathElement.prototype.createSVGPathSegMovetoRel=function(a,b){return new window.SVGPathSegMovetoRel((void 0),a,b)},window.SVGPathElement.prototype.createSVGPathSegLinetoAbs=function(a,b){return new window.SVGPathSegLinetoAbs((void 0),a,b)},window.SVGPathElement.prototype.createSVGPathSegLinetoRel=function(a,b){return new window.SVGPathSegLinetoRel((void 0),a,b)},window.SVGPathElement.prototype.createSVGPathSegCurvetoCubicAbs=function(a,b,c,d,e,f){return new window.SVGPathSegCurvetoCubicAbs((void 0),a,b,c,d,e,f)},window.SVGPathElement.prototype.createSVGPathSegCurvetoCubicRel=function(a,b,c,d,e,f){return new window.SVGPathSegCurvetoCubicRel((void 0),a,b,c,d,e,f)},window.SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticAbs=function(a,b,c,d){return new window.SVGPathSegCurvetoQuadraticAbs((void 0),a,b,c,d)},window.SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticRel=function(a,b,c,d){return new window.SVGPathSegCurvetoQuadraticRel((void 0),a,b,c,d)},window.SVGPathElement.prototype.createSVGPathSegArcAbs=function(a,b,c,d,e,f,g){return new window.SVGPathSegArcAbs((void 0),a,b,c,d,e,f,g)},window.SVGPathElement.prototype.createSVGPathSegArcRel=function(a,b,c,d,e,f,g){return new window.SVGPathSegArcRel((void 0),a,b,c,d,e,f,g)},window.SVGPathElement.prototype.createSVGPathSegLinetoHorizontalAbs=function(a){return new window.SVGPathSegLinetoHorizontalAbs((void 0),a)},window.SVGPathElement.prototype.createSVGPathSegLinetoHorizontalRel=function(a){return new window.SVGPathSegLinetoHorizontalRel((void 0),a)},window.SVGPathElement.prototype.createSVGPathSegLinetoVerticalAbs=function(a){return new window.SVGPathSegLinetoVerticalAbs((void 0),a)},window.SVGPathElement.prototype.createSVGPathSegLinetoVerticalRel=function(a){return new window.SVGPathSegLinetoVerticalRel((void 0),a)},window.SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothAbs=function(a,b,c,d){return new window.SVGPathSegCurvetoCubicSmoothAbs((void 0),a,b,c,d)},window.SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothRel=function(a,b,c,d){return new window.SVGPathSegCurvetoCubicSmoothRel((void 0),a,b,c,d)},window.SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothAbs=function(a,b){return new window.SVGPathSegCurvetoQuadraticSmoothAbs((void 0),a,b)},window.SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothRel=function(a,b){return new window.SVGPathSegCurvetoQuadraticSmoothRel((void 0),a,b)}),"undefined"==typeof window||"SVGPathSegList"in window||(window.SVGPathSegList=function(a){this._pathElement=a,this._list=this._parsePath(this._pathElement.getAttribute("d")),this._mutationObserverConfig={attributes:!0,attributeFilter:["d"]},this._pathElementMutationObserver=new MutationObserver(this._updateListFromPathMutations.bind(this)),this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)},window.SVGPathSegList.prototype.classname="SVGPathSegList",Object.defineProperty(window.SVGPathSegList.prototype,"numberOfItems",{get:function(){return this._checkPathSynchronizedToList(),this._list.length},enumerable:!0}),Object.defineProperty(window.SVGPathElement.prototype,"pathSegList",{get:function(){return this._pathSegList||(this._pathSegList=new window.SVGPathSegList(this)),this._pathSegList},enumerable:!0}),Object.defineProperty(window.SVGPathElement.prototype,"normalizedPathSegList",{get:function(){return this.pathSegList},enumerable:!0}),Object.defineProperty(window.SVGPathElement.prototype,"animatedPathSegList",{get:function(){return this.pathSegList},enumerable:!0}),Object.defineProperty(window.SVGPathElement.prototype,"animatedNormalizedPathSegList",{get:function(){return this.pathSegList},enumerable:!0}),window.SVGPathSegList.prototype._checkPathSynchronizedToList=function(){this._updateListFromPathMutations(this._pathElementMutationObserver.takeRecords())},window.SVGPathSegList.prototype._updateListFromPathMutations=function(a){if
vendor: 12,255 bytes, lines 73-75
73(this._pathElement){var b=!1;a.forEach(function(a){"d"==a.attributeName&&(b=!0)}),b&&(this._list=this._parsePath(this._pathElement.getAttribute("d")))}},window.SVGPathSegList.prototype._writeListToPath=function(){this._pathElementMutationObserver.disconnect(),this._pathElement.setAttribute("d",window.SVGPathSegList._pathSegArrayAsString(this._list)),this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)},window.SVGPathSegList.prototype.segmentChanged=function(a){this._writeListToPath()},window.SVGPathSegList.prototype.clear=function(){this._checkPathSynchronizedToList(),this._list.forEach(function(a){a._owningPathSegList=null}),this._list=[],this._writeListToPath()},window.SVGPathSegList.prototype.initialize=function(a){return this._checkPathSynchronizedToList(),this._list=[a],a._owningPathSegList=this,this._writeListToPath(),a},window.SVGPathSegList.prototype._checkValidIndex=function(a){if(isNaN(a)||a<0||a>=this.numberOfItems)throw"INDEX_SIZE_ERR"},window.SVGPathSegList.prototype.getItem=function(a){return this._checkPathSynchronizedToList(),this._checkValidIndex(a),this._list[a]},window.SVGPathSegList.prototype.insertItemBefore=function(a,b){return this._checkPathSynchronizedToList(),b>this.numberOfItems&&(b=this.numberOfItems),a._owningPathSegList&&(a=a.clone()),this._list.splice(b,0,a),a._owningPathSegList=this,this._writeListToPath(),a},window.SVGPathSegList.prototype.replaceItem=function(a,b){return this._checkPathSynchronizedToList(),a._owningPathSegList&&(a=a.clone()),this._checkValidIndex(b),this._list[b]=a,a._owningPathSegList=this,this._writeListToPath(),a},window.SVGPathSegList.prototype.removeItem=function(a){this._checkPathSynchronizedToList(),this._checkValidIndex(a);var b=this._list[a];return this._list.splice(a,1),this._writeListToPath(),b},window.SVGPathSegList.prototype.appendItem=function(a){return this._checkPathSynchronizedToList(),a._owningPathSegList&&(a=a.clone()),this._list.push(a),a._owningPathSegList=this,this._writeListToPath(),a},window.SVGPathSegList._pathSegArrayAsString=function(a){var b="",c=!0;return a.forEach(function(a){c?(c=!1,b+=a._asPathString()):b+=" "+a._asPathString()}),b},window.SVGPathSegList.prototype._parsePath=function(a){if(!a||0==a.length)return[];var b=this,c=function(){this.pathSegList=[]};c.prototype.appendSegment=function(a){this.pathSegList.push(a)};var d=function(a){this._string=a,this._currentIndex=0,this._endIndex=this._string.length,this._previousCommand=window.SVGPathSeg.PATHSEG_UNKNOWN,this._skipOptionalSpaces()};d.prototype._isCurrentSpace=function(){var a=this._string[this._currentIndex];return a<=" "&&(" "==a||"\n"==a||"\t"==a||"\r"==a||"\f"==a)},d.prototype._skipOptionalSpaces=function(){for(;this._currentIndex<this._endIndex&&this._isCurrentSpace();)this._currentIndex++;return this._currentIndex<this._endIndex},d.prototype._skipOptionalSpacesOrDelimiter=function(){return!(this._currentIndex<this._endIndex&&!this._isCurrentSpace()&&","!=this._string.charAt(this._currentIndex))&&(this._skipOptionalSpaces()&&this._currentIndex<this._endIndex&&","==this._string.charAt(this._currentIndex)&&(this._currentIndex++,this._skipOptionalSpaces()),this._currentIndex<this._endIndex)},d.prototype.hasMoreData=function(){return this._currentIndex<this._endIndex},d.prototype.peekSegmentType=function(){var a=this._string[this._currentIndex];return this._pathSegTypeFromChar(a)},d.prototype._pathSegTypeFromChar=function(a){switch(a){case"Z":case"z":return window.SVGPathSeg.PATHSEG_CLOSEPATH;case"M":return window.SVGPathSeg.PATHSEG_MOVETO_ABS;case"m":return window.SVGPathSeg.PATHSEG_MOVETO_REL;case"L":return window.SVGPathSeg.PATHSEG_LINETO_ABS;case"l":return window.SVGPathSeg.PATHSEG_LINETO_REL;case"C":return window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS;case"c":return window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL;case"Q":return window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS;case"q":return window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL;case"A":return window.SVGPathSeg.PATHSEG_ARC_ABS;case"a":return window.SVGPathSeg.PATHSEG_ARC_REL;case"H":return window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS;case"h":return window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL;case"V":return window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS;case"v":return window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL;case"S":return window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS;case"s":return window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL;
74case"T":return window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS;case"t":return window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL;default:return window.SVGPathSeg.PATHSEG_UNKNOWN}},d.prototype._nextCommandHelper=function(a,b){return("+"==a||"-"==a||"."==a||a>="0"&&a<="9")&&b!=window.SVGPathSeg.PATHSEG_CLOSEPATH?b==window.SVGPathSeg.PATHSEG_MOVETO_ABS?window.SVGPathSeg.PATHSEG_LINETO_ABS:b==window.SVGPathSeg.PATHSEG_MOVETO_REL?window.SVGPathSeg.PATHSEG_LINETO_REL:b:window.SVGPathSeg.PATHSEG_UNKNOWN},d.prototype.initialCommandIsMoveTo=function(){if(!this.hasMoreData())return!0;var a=this.peekSegmentType();return a==window.SVGPathSeg.PATHSEG_MOVETO_ABS||a==window.SVGPathSeg.PATHSEG_MOVETO_REL},d.prototype._parseNumber=function(){var a=0,b=0,c=1,d=0,e=1,f=1,g=this._currentIndex;if(this._skipOptionalSpaces(),this._currentIndex<this._endIndex&&"+"==this._string.charAt(this._currentIndex)?this._currentIndex++:this._currentIndex<this._endIndex&&"-"==this._string.charAt(this._currentIndex)&&(this._currentIndex++,e=-1),!(this._currentIndex==this._endIndex||(this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")&&"."!=this._string.charAt(this._currentIndex))){for(var h=this._currentIndex;this._currentIndex<this._endIndex&&this._string.charAt(this._currentIndex)>="0"&&this._string.charAt(this._currentIndex)<="9";)this._currentIndex++;if(this._currentIndex!=h)for(var i=this._currentIndex-1,j=1;i>=h;)b+=j*(this._string.charAt(i--)-"0"),j*=10;if(this._currentIndex<this._endIndex&&"."==this._string.charAt(this._currentIndex)){if(this._currentIndex++,this._currentIndex>=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex<this._endIndex&&this._string.charAt(this._currentIndex)>="0"&&this._string.charAt(this._currentIndex)<="9";)c*=10,d+=(this._string.charAt(this._currentIndex)-"0")/c,this._currentIndex+=1}if(this._currentIndex!=g&&this._currentIndex+1<this._endIndex&&("e"==this._string.charAt(this._currentIndex)||"E"==this._string.charAt(this._currentIndex))&&"x"!=this._string.charAt(this._currentIndex+1)&&"m"!=this._string.charAt(this._currentIndex+1)){if(this._currentIndex++,"+"==this._string.charAt(this._currentIndex)?this._currentIndex++:"-"==this._string.charAt(this._currentIndex)&&(this._currentIndex++,f=-1),this._currentIndex>=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex<this._endIndex&&this._string.charAt(this._currentIndex)>="0"&&this._string.charAt(this._currentIndex)<="9";)a*=10,a+=this._string.charAt(this._currentIndex)-"0",this._currentIndex++}var k=b+d;if(k*=e,a&&(k*=Math.pow(10,f*a)),g!=this._currentIndex)return this._skipOptionalSpacesOrDelimiter(),k}},d.prototype._parseArcFlag=function(){if(!(this._currentIndex>=this._endIndex)){var a=!1,b=this._string.charAt(this._currentIndex++);if("0"==b)a=!1;else{if("1"!=b)return;a=!0}return this._skipOptionalSpacesOrDelimiter(),a}},d.prototype.parseSegment=function(){var a=this._string[this._currentIndex],c=this._pathSegTypeFromChar(a);if(c==window.SVGPathSeg.PATHSEG_UNKNOWN){if(this._previousCommand==window.SVGPathSeg.PATHSEG_UNKNOWN)return null;if(c=this._nextCommandHelper(a,this._previousCommand),c==window.SVGPathSeg.PATHSEG_UNKNOWN)return null}else this._currentIndex++;switch(this._previousCommand=c,c){case window.SVGPathSeg.PATHSEG_MOVETO_REL:return new window.SVGPathSegMovetoRel(b,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_MOVETO_ABS:return new window.SVGPathSegMovetoAbs(b,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_REL:return new window.SVGPathSegLinetoRel(b,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_ABS:return new window.SVGPathSegLinetoAbs(b,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:return new window.SVGPathSegLinetoHorizontalRel(b,this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:return new window.SVGPathSegLinetoHorizontalAbs(b,this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:return new window.SVGPathSegLinetoVerticalRel(b,this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:return new window.SVGPathSegLinetoVerticalAbs(b,this._parseNumber());case window.SVGPathSeg.PATHSEG_CLOSEPATH:return this._skipOptionalSpaces(),new window.SVGPathSegClosePath(b);case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:var d={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new window.SVGPathSegCurvetoCubicRel(b,d.x,d.y,d.x1,d.y1,d.x2,d.y2);case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:var d={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new window.SVGPathSegCurvetoCubicAbs(b,d.x,d.y,d.x1,d.y1,d.x2,d.y2);case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:var d={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new window.SVGPathSegCurvetoCubicSmoothRel(b,d.x,d.y,d.x2,d.y2);case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:var d={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new window.SVGPathSegCurvetoCubicSmoothAbs(b,d.x,d.y,d.x2,d.y2);case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:var d={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new window.SVGPathSegCurvetoQuadraticRel(b,d.x,d.y,d.x1,d.y1);case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:var d={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new window.SVGPathSegCurvetoQuadraticAbs(b,d.x,d.y,d.x1,d.y1);case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:return new window.SVGPathSegCurvetoQuadraticSmoothRel(b,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:return new window.SVGPathSegCurvetoQuadraticSmoothAbs(b,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_ARC_REL:var d={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()};return new window.SVGPathSegArcRel(b,d.x,d.y,d.x1,d.y1,d.arcAngle,d.arcLarge,d.arcSweep);case window.SVGPathSeg.PATHSEG_ARC_ABS:var d={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()};return new window.SVGPathSegArcAbs(b,d.x,d.y,d.x1,d.y1,d.arcAngle,d.arcLarge,d.arcSweep);default:throw"Unknown path seg type."}};var e=new c,f=new d(a);if(!f.initialCommandIsMoveTo())return[];for(;f.hasMoreData();){var g=f.parseSegment();if(!g)return[];e.appendSegment(g)}return e.pathSegList})}();
75joint.shapes.chart={},joint.shapes.chart.Plot=joint.shapes.basic.Generic.extend({markup:['<clipPath class="clip"><rect/></clipPath>','<g class="rotatable">','<g class="scalable"></g>','<g class="background"><rect/><text/></g>','<g class="axis">','<g class="y-axis"><path/><g class="ticks"></g></g>','<g class="x-axis"><path/><g class="ticks"></g></g>','<g class="markings"></g>',"</g>",'<g class="data"><g class="series"></g></g>','<g class="foreground">','<rect/><text class="caption"/><text class="subcaption"/>','<g class="legend"><g class="legend-items"></g></g>','<line class="guideline x-guideline" /><line class="guideline y-guideline" />',"</g>","</g>"].join(""),tickMarkup:'<g class="tick">
75<line/><text/></g>',pointMarkup:'<g class="point"><circle/><text/></g>',barMarkup:'<path class="bar"/>',markingMarkup:'<g class="marking"><rect/><text/></g>',serieMarkup:'<g><clipPath class="serie-clip"><rect/></clipPath><path/><g class="bars"></g><g class="points"></g></g>',legendItemMarkup:'<g class="legend-item"><circle/><text/></g>',defaults:joint.util.deepSupplement({type:"chart.Plot",attrs:{".data path":{fill:"none",stroke:"black"},".data .bars rect":{fill:"none",stroke:"black"},".background rect":{fill:"white",stroke:"#e5e5e5",opacity:1},".background text":{fill:"black",text:"No data available.",ref:".","ref-x":.5,"ref-y":.5,"text-anchor":"middle","y-alignment":"middle",display:"none"},".foreground > rect":{fill:"white",stroke:"#e5e5e5",opacity:0,"pointer-events":"none"},".foreground .caption":{fill:"black",text:"",ref:".foreground > rect","ref-x":.5,"ref-y":10,"text-anchor":"middle","y-alignment":"middle","font-size":14},".foreground .subcaption":{fill:"black",text:"",ref:".foreground > rect","ref-x":.5,"ref-y":23,"text-anchor":"middle","y-alignment":"middle","font-size":10},".point":{display:"inline-block"},".point circle":{r:2,stroke:"black",fill:"black",opacity:.3},".point text":{fill:"black","font-size":8,"text-anchor":"middle",display:"none"},".axis path":{fill:"none",stroke:"black"},".axis .tick":{fill:"none",stroke:"black"},".y-axis .tick line":{fill:"none",stroke:"black",x2:2,y2:0,opacity:1},".x-axis .tick line":{fill:"none",stroke:"black",x2:0,y2:-3,opacity:1},".y-axis .tick text":{fill:"black",stroke:"none","font-size":10,"text-anchor":"end"},".x-axis .tick text":{fill:"black",stroke:"none","font-size":10,"text-anchor":"middle"},".y-axis .tick text > tspan":{dy:"-.5em",x:-5},".x-axis .tick text > tspan":{dy:".5em",x:0},".axis .markings":{fill:"black",stroke:"none","fill-opacity":1},".axis .markings text":{fill:"black","text-anchor":"end","font-size":10,dy:-5,dx:-5},".guideline":{"pointer-events":"none",display:"none"},".x-guideline":{stroke:"black",visibility:"hidden"},".y-guideline":{stroke:"black",visibility:"hidden"},".legend":{"ref-x":10,"ref-y":10},".legend-item text":{fill:"black",transform:"translate(14, 0)","font-size":11},".legend-item circle":{r:5,transform:"translate(5,5)"},".legend-item":{cursor:"pointer"},".legend-item.disabled circle":{fill:"gray"},".legend-item.disabled text":{opacity:.5}}},joint.shapes.basic.Generic.prototype.defaults),legendPosition:function(a,b){b=b||{},this.trigger("batch:start"),[".legend/ref-x",".legend/ref-y",".legend/ref-dx",".legend/ref-dy",".legend/x-alignment",".legend/y-alignment"].forEach(function(a){this.removeAttr(a,{silent:!0})},this);var c=b.padding||10,d={n:{".legend":{"ref-x":.5,"x-alignment":-.5,"ref-y":c}},ne:{".legend":{"ref-dx":-c,"x-alignment":-.999,"ref-y":c}},e:{".legend":{"ref-dx":-c,"x-alignment":-.999,"ref-y":.5,"y-alignment":-.5}},se:{".legend":{"ref-dx":-c,"ref-dy":-c,"x-alignment":-.999,"y-alignment":-.999}},s:{".legend":{"ref-x":.5,"ref-dy":-c,"x-alignment":-.5,"y-alignment":-.999}},sw:{".legend":{"ref-x":c,"ref-dy":-c,"y-alignment":-.999}},w:{".legend":{"ref-x":c,"ref-y":.5,"y-alignment":-.5}},nw:{".legend":{"ref-x":c,"ref-y":c}},nnw:{".legend":{"ref-x":c,"ref-y":-c,"y-alignment":-.999}},nn:{".legend":{"ref-x":.5,"ref-y":-c,"x-alignment":-.5,"y-alignment":-.999}},nne:{".legend":{"ref-dx":-c,"ref-y":-c,"x-alignment":-.999,"y-alignment":-.999}},nnee:{".legend":{"ref-dx":c,"ref-y":-c,"y-alignment":-.999}},nee:{".legend":{"ref-y":c,"ref-dx":c}},ee:{".legend":{"ref-dx":c,"ref-y":.5,"y-alignment":-.5}},see:{".legend":{"ref-dx":c,"ref-dy":-c,"y-alignment":-.999}},ssee:{".legend":{"ref-dx":c,"ref-dy":c}},sse:{".legend":{"ref-dx":-c,"ref-dy":c,"x-alignment":-.999}},ss:{".legend":{"ref-x":.5,"ref-dy":c,"x-alignment":-.5}},ssw:{".legend":{"ref-x":c,"ref-dy":c}},ssww:{".legend":{"ref-x":-c,"ref-dy":c,"x-alignment":-.999}},sww:{".legend":{"ref-x":-c,"ref-dy":-c,"x-alignment":-.999,"y-alignment":-.999}},ww:{".legend":{"ref-x":-c,"ref-y":.5,"x-alignment":-.999,"y-alignment":-.5}},nww:{".legend":{"ref-x":-c,"ref-y":c,"x-alignment":-.999}},nnww:{".legend":{"ref-x":-c,"ref-y":-c,"x-alignment":-.999,"y-alignment":-.999}}};d[a]&&this.attr(d[a]),this.trigger("batch:stop")},addPoint:function(a,b,c){c=c||{};var d=this.get("series"),e=joint.util.toArray(d).findIndex(function(a){return a.name===b});if(e===-1)throw new Error("Serie "+b+" was not found.");var f=joint.util.cloneDeep(d[e]);f.data.push(a),Number.isFinite(c.maxLen)&&f.data.length>c.maxLen&&f.data.shift(),d=d.slice(),d[e]=f,this.set("series",d,c)},lastPoint:function(a){var b=joint.util.toArray(this.get("series")).find(function(b){return b&&b.name===a}).data;return b[b.length-1]},firstPoint:function(a){return joint.util.toArray(this.get("series")).find(function(b){return b&&b.name===a}).data[0]}}),joint.shapes.chart.PlotView=joint.dia.ElementView.extend({events:{mousemove:"onMouseMove",mouseout:"onMouseOut"},initialize:function(){joint.dia.ElementView.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change:series change:interpolate change:padding change:canvas change:markings change:axis",function(){this.update()}),this.on("cell:pointerdown",this.onPointerDown,this),this._disabledSeries=[]},renderMarkup:function(){joint.dia.ElementView.prototype.renderMarkup.apply(this,arguments),this.elDataClipPath=this.$(".clip")[0],this.elDataClipPathRect=this.elDataClipPath.firstChild,this.elBackgroun
75dRect=this.$(".background rect")[0],this.elBackgroundText=this.$(".background text")[0],this.elForeground=this.$(".foreground")[0],this.elForegroundRect=this.$(".foreground rect")[0],this.elDataSeries=this.$(".data .series")[0],this.elYAxisPath=this.$(".y-axis path")[0],this.elYAxisTicks=this.$(".y-axis .ticks")[0],this.elXAxisPath=this.$(".x-axis path")[0],this.elXAxisTicks=this.$(".x-axis .ticks")[0],this.elMarkings=this.$(".axis .markings")[0],this.elXGuideline=this.$(".x-guideline")[0],this.elYGuideline=this.$(".y-guideline")[0],this.elLegend=this.$(".legend")[0],this.elLegendItems=this.$(".legend-items")[0],this.elTick=V(this.model.tickMarkup),this.elMarking=V(this.model.markingMarkup),this.elLegendItem=V(this.model.legendItemMarkup),this.elPoint=V(this.model.pointMarkup),this.elBar=V(this.model.barMarkup),this.elSerie=V(this.model.serieMarkup),this.elDataClipPath.id="clip_"+this.cid,V(this.$(".data")[0]).attr("clip-path","url(#"+this.elDataClipPath.id+")"),V(this.elMarkings).attr("clip-path","url(#"+this.elDataClipPath.id+")")},update:function(){var a=this.filterSeries();this.calculateStats(a);var b=this.model.get("size"),c=b.width,d=b.height;this.canvas=joint.util.assign({x:0,y:0,width:c,height:d},this.model.get("canvas"));var e,f={top:0,right:0,bottom:0,left:0},h=this.model.get("padding");e=joint.util.isObject(h)?joint.util.assign({},f,h):void 0!==h?{top:h,right:2*h,bottom:2*h,left:h}:f,this.canvas=g.rect(this.canvas).moveAndExpand(g.rect(e.left,e.top,-e.right,-e.bottom));var i={x:0,y:0,width:c,height:d};V(this.elDataClipPathRect).attr(i),V(this.elBackgroundRect).attr(i),V(this.elForegroundRect).attr(i),this.updateAxis(),this.updateMarkings(),this.isEmpty()?$(this.elBackgroundText).show():$(this.elBackgroundText).hide(),this.updateSeries(a),this.updateLegend(),joint.dia.ElementView.prototype.update.apply(this,arguments)},calculateStats:function(a){a=a||this.model.get("series");var b=[],c=[],d={},e={},f={};joint.util.toArray(a).forEach(function(a,g){var h=f[a.name||g]||(f[a.name||g]={});h.decreasingX=!0,h.decreasingY=!0,h.nonDecreasingX=!0,h.nonDecreasingY=!0;var i;joint.util.forIn(a.data,function(f){h.minX=void 0===h.minX?f.x:Math.min(h.minX,f.x),h.maxX=void 0===h.maxX?f.x:Math.max(h.maxX,f.x),h.minY=void 0===h.minY?f.y:Math.min(h.minY,f.y),h.maxY=void 0===h.maxY?f.y:Math.max(h.maxY,f.y),i&&(h.decreasingX=h.decreasingX&&f.x<i.x,h.decreasingY=h.decreasingY&&f.y<i.y,h.nonDecreasingX=h.nonDecreasingX&&f.x>=i.x,h.nonDecreasingY=h.nonDecreasingY&&f.y>=i.y),b.includes(f.x)||b.push(f.x),c.includes(f.y)||c.push(f.y),(d[f.x]||(d[f.x]=[])).push({serie:a,x:f.x,y:f.y}),(e[f.y]||(e[f.y]=[])).push({serie:a,x:f.x,y:f.y}),i=f})});var g=this.model.get("axis")||{},h=g["x-axis"]||{},i=g["y-axis"]||{};this.stats={minX:void 0===h.min?b.reduce(function(a,b){return b<a?b:a},1/0):h.min,maxX:void 0===h.max?b.reduce(function(a,b){return b>a?b:a},-(1/0)):h.max,minY:void 0===i.min?c.reduce(function(a,b){return b<a?b:a},1/0):i.min,maxY:void 0===i.max?c.reduce(function(a,b){return b>a?b:a},-(1/0)):i.max,bySerie:f,xValues:b,yValues:c,xMap:d,yMap:e}},isEmpty:function(){return!this.stats.xValues.length},updateSeries:function(a){if(a=a||this.model.get("series"),this.elDataSeries.textContent="",!this.isEmpty()){var b=[this.stats.minX,this.stats.maxX],c=[this.stats.minY,this.stats.maxY],d=[this.canvas.x,this.canvas.x+this.canvas.width],e=[this.canvas.y+this.canvas.height,this.canvas.y],f=this.model.get("attrs");joint.util.toArray(a).forEach(function(a,h){var i=a.data,j=[],k=this.elSerie.clone().attr("class",a.name||"serie-"+h);V(this.elDataSeries).append(k),joint.util.forIn(i,function(h){var i=g.scale.linear(b,d,h.x),k=g.scale.linear(c,e,h.y);j.push({x:i,y:k}),f[".point"]&&"none"!==f[".point"].display&&this.renderPoint(h,a),a.bars&&this.renderBar(h,a)}.bind(this));var l=k.findOne(".serie-clip"),m=this.model.get("size"),n=this.stats.bySerie[a.name||h],o=g.scale.linear(b,d,n.minX),p=g.scale.linear(b,d,n.maxX),q=l.findOne("rect");if(q.attr(g.rect(o,0,p-o,m.height)),!a.bars){var r=k.findOne("path");r.attr({d:this.seriePathData(j,a,h),"clip-path":"url(#"+l.node.id+")"})}},this)}},seriePathClipData:function(a,b){var c=10,d=this.model.get("size"),e=a[0],f=["M",e.x,e.y,"V",d.height+c];return f.join(" ")},renderBar:function(a,b){var c=[this.stats.minX,this.stats.maxX],d=[this.stats.minY,this.stats.maxY],e=[this.canvas.x,this.canvas.x+this.canvas.width],f=[this.canvas.y+this.canvas.height,this.canvas.y],h=g.scale.linear(c,e,a.x),i=g.scale.linear(d,f,a.y),j=b.bars.barWidth||.8,k=j>1?j:this.canvas.width/(this.stats.maxX-this.stats.minX)*j,l=g.scale.linear(d,f,0)-i,m=a["top-rx"]||b.bars["top-rx"],n=a["top-ry"]||b.bars["top-ry"],o=a["bottom-rx"]||b.bars["bottom-rx"],p=a["bottom-ry"]||b.bars["bottom-ry"],q={left:h,middle:h-k/2,right:h-k}[b.bars.align||"middle"],r=this.elBar.clone();r.attr({"data-serie":b.name,"data-x":a.x,"data-y":a.y,d:V.rectToPath({x:q,y:i,width:k,height:l,"top-rx":m,"top-ry":n,"bottom-rx":o,"bottom-ry":p})});var s=b.name||"serie-"+this.model.get("series").indexOf(b);
75return V(this.elDataSeries).findOne("."+s+" .bars").append(r),r.node},renderPoint:function(a,b){var c=[this.stats.minX,this.stats.maxX],d=[this.stats.minY,this.stats.maxY],e=[this.canvas.x,this.canvas.x+this.canvas.width],f=[this.canvas.y+this.canvas.height,this.canvas.y],h=g.scale.linear(c,e,a.x),i=g.scale.linear(d,f,a.y),j=this.elPoint.clone();j.attr({"data-serie":b.name,"data-x":a.x,"data-y":a.y}),j.findOne("circle").attr({cx:h,cy:i}),j.findOne("text").attr({x:h,dy:i}).text(this.pointLabel(a,b));var k=b.name||"serie-"+this.model.get("series").indexOf(b);return V(this.elDataSeries).findOne("."+k+" .points").append(j),j.node},seriePathData:function(a,b,c){var d,e,f,h=void 0===b.interpolate?this.model.get("interpolate"):b.interpolate,i=a.length;switch(h){case"bezier":d=new g.Path(g.Curve.throughPoints(a)).serialize();break;case"step":for(f=a[0],d=["M",f.x,f.y],e=1;e<i;e++)d.push("H",(f.x+a[e].x)/2,"V",a[e].y),f=a[e];break;case"stepBefore":for(d=["M",a[0].x,a[0].y],e=1;e<i;e++)d.push("V",a[e].y,"H",a[e].x);break;case"stepAfter":for(d=["M",a[0].x,a[0].y],e=1;e<i;e++)d.push("H",a[e].x,"V",a[e].y);break;default:for(d=["M"],e=0;e<i;e++)d.push(a[e].x,a[e].y)}return d=this.fixPathForFill(d,a,b,c),d.join(" ")},fixPathForFill:function(a,b,c,d){if(0===b.length)return a;var e=this.stats.bySerie[c.name||d];if(!e.nonDecreasingX)return a;var f=10,g=this.model.get("size"),h=b[0],i=b[b.length-1],j=["M",i.x,g.height+f,"H",h.x-f,"V",h.y];return a[0]="L",j.concat(a)},updateAxis:function(){var a=this.model.get("size"),b=a.width,c=a.height,d=this.model.get("axis"),e=this.canvas.height/c;if(V(this.elYAxisPath).attr("d",["M",0,0,"L",0,c].join(" ")),V(this.elXAxisPath).attr("d",["M",0,c,"L",b,c].join(" ")),this.elXAxisTicks.textContent="",this.elYAxisTicks.textContent="",!this.isEmpty()){for(var f=[this.stats.minX,this.stats.maxX],h=[this.stats.minY,this.stats.maxY],i=[this.canvas.x,this.canvas.x+this.canvas.width],j=[0,this.canvas.height],k=h[1]-h[0],l=d&&d["y-axis"]||{},m=d&&d["x-axis"]||{},n=k>0?l.ticks-1||10:0,o=k/n/e,p=h[0],q=0;q<n+1;q++){var r=g.scale.linear(h,j,p),s=this.elTick.clone();s.translate(0,r),V(this.elYAxisTicks).append(s);var t=h[1]-(p-h[0]);t+=g.scale.linear(j,h,this.canvas.y)-h[0],s.findOne("text").text(this.tickLabel(t,l)),p+=o}this.stats.xValues.forEach(function(a,d){if(d%(m.tickStep||1)===0){var e=g.scale.linear(f,i,a);if(!(e>b)){var h=this.elTick.clone();h.translate(e,c),V(this.elXAxisTicks).append(h),h.findOne("text").text(this.tickLabel(a,m))}}},this)}},tickLabel:function(a,b){if(joint.util.isFunction(b.tickFormat))return b.tickFormat(a);var c=b.tickFormat||".1f",d=joint.util.format.number(c,a);return d+(joint.util.isFunction(b.tickSuffix)?b.tickSuffix(a):b.tickSuffix||"")},pointLabel:function(a,b){if(joint.util.isFunction(b.pointFormat))return b.pointFormat(a);var c=b.pointFormat||".1f",d=joint.util.format.number(c,a.y);return d+(b.pointSuffix||"")},updateMarkings:function(){function a(a,b){return void 0===a?b:a}this.elMarkings.textContent="";var b=this.model.get("markings");if(b&&0!==b.length){var c=this.model.get("size"),d=c.width,e=c.height,f=[this.stats.minX,this.stats.maxX],h=[this.stats.minY,this.stats.maxY],i=[this.canvas.x,this.canvas.x+this.canvas.width],j=[this.canvas.y,this.canvas.y+this.canvas.height];joint.util.toArray(b).forEach(function(b,c){var k=b.start||b.end,l=b.end||b.start,m=Math.min(a(k.x,this.stats.minX),a(l.x,this.stats.minX)),n=Math.max(a(k.x,this.stats.maxX),a(l.x,this.stats.maxX)),o=Math.min(a(k.y,this.stats.minY),a(l.y,this.stats.minY)),p=Math.max(a(k.y,this.stats.maxY),a(l.y,this.stats.maxY)),q=void 0===k.x||void 0===l.x,r=void 0===k.y||void 0===l.y;q&&(i=[0,d]),r&&(j=[0,e]);var s=g.scale.linear(f,i,m),t=g.scale.linear(f,i,n),u=g.scale.linear(h,j,o),v=g.scale.linear(h,j,p),w=s,x=j[1]-v+j[0],y=t-s,z=v-u;y=Math.max(y,1),z=Math.max(z,1);var A=this.elMarking.clone();A.findOne("rect").attr({x:w,y:x,width:y,height:z}),A.findOne("text").text(b.label||"").attr({x:w+y,y:x});var B=A.attr("class")+" "+(b.name||"marking-"+c);A.attr(joint.util.assign({"class":B},b.attrs)),V(this.elMarkings).append(A)},this)}},updateLegend:function(){var a=this.model.get("series");
75this.elLegendItems.textContent="",joint.util.toArray(a).forEach(function(a,b){if((!joint.util.isFunction(a.showLegend)||a.showLegend(a,this.stats.bySerie[a.name||b]))&&a.showLegend!==!1){var c=this.elLegendItem.clone();this._disabledSeries.includes(a.name)&&c.addClass("disabled"),c.attr("data-serie",a.name),c.findOne("circle").attr({fill:this.getSerieColor(a.name)}),c.findOne("text").text(a.label||a.name),c.translate(0,b*(a.legendLabelLineHeight||16)),V(this.elLegendItems).append(c)}},this)},getSerieColor:function(a){var b=this.model.get("attrs"),c=Object.keys(b).find(function(b){return b.includes(a)});return c?b[c].stroke||b[c].fill:"black"},hideSerie:function(a){this._disabledSeries.includes(a)||this._disabledSeries.push(a);var b=this.filterSeries();this.update(b)},showSerie:function(a){this._disabledSeries=joint.util.without(this._disabledSeries,a);var b=this.filterSeries();this.update(b)},filterSeries:function(a){return a=a||this.model.get("series"),a=joint.util.toArray(a).filter(function(a){return!this._disabledSeries.includes(a.name)},this)},onPointerDown:function(a,b,c){var d=$(a.target).closest(".legend-item")[0];d&&(V(d).toggleClass("disabled"),V(d).hasClass("disabled")?this.hideSerie(V(d).attr("data-serie")):this.showSerie(V(d).attr("data-serie")))},onMouseMove:function(a){this.showGuidelines(a.clientX,a.clientY,a)},onMouseOut:function(a){this.hideGuidelines(),this.trigger("mouseout",a)},showGuidelines:function(a,b,c){var d=this.model.get("angle"),e=this.model.getBBox(),f=g.point(V(this.paper.viewport).toLocalPoint(a,b)).rotate(e.center(),d);if(g.rect(e).containsPoint(f)){var h=this.model.get("size"),i=f.x-e.x,j=f.y-e.y;V(this.elXGuideline).attr({x1:i,y1:0,x2:i,y2:h.height,visibility:"visible"}),V(this.elYGuideline).attr({x1:0,y1:j,x2:h.width,y2:j,visibility:"visible"});var k=g.scale.linear([this.canvas.x,this.canvas.x+this.canvas.width],[this.stats.minX,this.stats.maxX],i),l=g.scale.linear([this.canvas.y,this.canvas.y+this.canvas.height],[this.stats.minY,this.stats.maxY],j),m={x:k,y:this.stats.minY+this.stats.maxY-l},n={x:a,y:b},o=this.closestPoints(k);this.trigger("mouseover",m,n,o,c)}},closestPoints:function(a){var b=joint.util.sortedIndex(this.stats.xValues,a),c=this.stats.xValues[b],d=this.stats.xValues[b-1],e=void 0===d?c:Math.abs(a-c)<Math.abs(a-d)?c:d;return this.stats.xMap[e]},hideGuidelines:function(){V(this.elXGuideline).attr("visibility","hidden"),V(this.elYGuideline).attr("visibility","hidden")}}),joint.shapes.chart.Pie=joint.shapes.basic.Generic.extend({markup:['<g class="rotatable">','<g class="scalable"></g>','<g class="background"><rect/><text/></g>','<g class="data"></g>','<g class="foreground">','<rect/><text class="caption"/><text class="subcaption"/>','<g class="legend"><g class="legend-items"></g></g>',"</g>","</g>"].join(""),sliceMarkup:'<g class="slice"/>',sliceFillMarkup:'<path class="slice-fill"/>',sliceBorderMarkup:'<path class="slice-border"/>',sliceInnerLabelMarkup:'<text class="slice-inner-label"/>',legendSerieMarkup:'<g class="legend-serie"><text/></g>',legendSliceMarkup:'<g class="legend-slice"><circle/><text/></g>',defaults:joint.util.deepSupplement({type:"chart.Pie",size:{width:200,height:200},pieHole:0,serieDefaults:{startAngle:0,degree:360,label:null,showLegend:!0,labelLineHeight:6},sliceDefaults:{innerLabel:"{percentage:.0f}%",innerLabelMargin:6,legendLabel:"{label}: {value}",legendLabelLineHeight:6,legendLabelMargin:14,offset:0,onClickEffect:{type:"offset",offset:20},onHoverEffect:null},series:[],attrs:{".background > rect":{opacity:0}
75,".background > text":{fill:"black",text:"No data available.",ref:".background > rect","ref-x":.5,"ref-y":.5,"text-anchor":"middle","y-alignment":"middle",display:"none"},".foreground > rect":{fill:"white",stroke:"#e5e5e5",opacity:0,"pointer-events":"none"},".foreground .caption":{fill:"black",text:"",ref:".foreground > rect","ref-x":2,"ref-y":6,"text-anchor":"start","y-alignment":"middle","font-size":14},".foreground .subcaption":{fill:"black",text:"",ref:".foreground > rect","ref-x":2,"ref-y":18,"text-anchor":"start","y-alignment":"middle","font-size":10},".data":{ref:".background","ref-x":.5,"ref-y":.5},".slice":{cursor:"pointer"},".slice > .slice-fill":{stroke:"#ffffff","stroke-width":1,"fill-opacity":1},".slice.hover > .slice-fill":{"fill-opacity":.8},".slice > .slice-border":{"stroke-width":6,"stroke-opacity":.4,"fill-opacity":1,fill:"none",display:"none"},".slice.hover > .slice-border":{display:"block"},".slice > .slice-inner-label":{"text-anchor":"middle","font-size":"12",stroke:"none","stroke-width":"0",fill:"#ffffff"},".slice > .slice-inner-label > tspan":{dy:"-.5em"},".legend":{"ref-dx":20,"ref-y":5},".legend-serie text":{fill:"grey",transform:"translate(2, 0)","font-size":13},".legend-slice":{cursor:"pointer"},".legend-slice text":{"font-weight":"normal",fill:"black","font-size":11},".legend-slice.hover text":{"font-weight":"bold"},".legend-slice circle":{r:5,transform:"translate(5,5)"}}},joint.shapes.basic.Generic.prototype.defaults),addSlice:function(a,b,c){c=c||{},b=b||0;var d=this.get("series");void 0===d[b]&&(d[b]={data:[]});var e=joint.util.cloneDeep(d[b]);e.data.push(a),d=d.slice(),d[b]=e,c=e.data.length>1?joint.util.assign(c,{changedSerieIndex:b}):c,this.set("series",d,c)},editSlice:function(a,b,c,d){d=d||{},c=c||0;var e=this.get("series");if(void 0===e[c]||void 0===e[c].data[b])throw new Error("Slice "+b+" on serie "+c+" was not found.");var f=joint.util.cloneDeep(e[c]);f.data[b]=joint.util.assign(f.data[b],a),e=e.slice(),e[c]=f,this.set("series",e,joint.util.assign(d,{changedSerieIndex:c}))}}),joint.shapes.chart.PieView=joint.dia.ElementView.extend({events:{"mouseover .slice":"onMouseOverSlice","mouseout .slice":"onMouseOverSlice","mousemove .slice":"onMouseMoveSlice","mouseover .legend-slice":"onEventLegendItem","mouseout .legend-slice":"onEventLegendItem"},initialize:function(){joint.dia.ElementView.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change:series change:serieDefaults change:sliceDefaults change:pieHole",function(a,b,c){this.update(null,null,null,c.changedSerieIndex)}),this.on("cell:pointerclick",this.onClickSlice,this),this.on("cell:pointerclick",this.onEventLegendItem,this)},renderMarkup:function(){joint.dia.ElementView.prototype.renderMarkup.apply(this,arguments),this.elBackgroundRect=this.$(".background rect")[0],this.elBackgroundText=this.$(".background text")[0],this.elForegroundRect=this.$(".foreground rect")[0],this.elLegendItems=this.$(".legend-items")[0],this.elPie=this.$(".data")[0],this.elSlice=V(this.model.sliceMarkup),this.elSliceFill=V(this.model.sliceFillMarkup),this.elSliceBorder=V(this.model.sliceBorderMarkup),this.elSliceInnerLabel=V(this.model.sliceInnerLabelMarkup),this.elLegendSerie=V(this.model.legendSerieMarkup),this.elLegendSlice=V(this.model.legendSliceMarkup)},update:function(a,b,c,d){var e=this.calculateSeries(d);d in e?$(this.elPie).find(".serie-"+d).remove():$(this.elPie).empty();var f=this.model.get("size");V(this.elBackgroundRect).attr(f),V(this.elForegroundRect).attr(f),e.length?$(this.elBackgroundText).hide():$(this.elBackgroundText).show(),joint.util.toArray(e).forEach(function(a,b){void 0!==d&&d!==b||joint.util.forIn(a.data,this.updateSlice.bind(this))},this),this.updateLegend(),joint.dia.ElementView.prototype.update.apply(this,arguments)},calculateSeries:function(a){var b=joint.util.cloneDeep(this.model.get("series")),c=this.model.get("serieDefaults"),d=this.model.get("sliceDefaults"),e=this.model.get("size"),f=Math.min(e.width,e.height)/2,h=this.model.get("pieHole");h=h>1?h:f*h;var i=f,j=(f-h)/b.length;return this._series=b.map(function(b,e){if(void 0!==a&&a!==e)return b;b=joint.util.defaults(b,c);var f=b.startAngle,h=b.data.reduce(function(a,b){return a+b.value},0),k=b.degree/h||0,l=100/h;return b.data=b.data.map(function(a,b){a=joint.util.defaults(a,joint.util.omit(d,"offset","onClickEffect","onHoverEffect")),a.outerRadius=i,a.innerRadius=i-j,e||(a=joint.util.defaults(a,joint.util.pick(d,"offset","onClickEffect","onHoverEffect")),a.isOuter=!0,a.offset=a.offset>1?a.offset:a.offset*a.outerRadius,a.onClickEffect.offset=a.onClickEffect.offset>1?a.onClickEffect.offset:a.onClickEffect.offset*a.outerRadius),a.serieIndex=e,a.sliceIndex=b,a.innerLabelMargin=a.innerL
75abelMargin<-1||a.innerLabelMargin>1?a.innerLabelMargin:a.innerLabelMargin*a.outerRadius,a.percentage=a.value*l;var c=a.value*k;return a.degree={angle:c,start:f,end:c+f},a.rad={angle:g.toRad(a.degree.angle,!0),start:g.toRad(a.degree.start,!0),end:g.toRad(a.degree.end,!0)},a.middleangle=(a.rad.start+a.rad.end)/2,f=a.degree.end,a}),i-=j,b}),this._series},updateLegend:function(){var a=this._series;this.elLegendItems.textContent="";var b=0,c=parseInt(this.model.attr(".legend-serie text/font-size"),10),d=parseInt(this.model.attr(".legend-slice text/font-size"),10);joint.util.toArray(a).forEach(function(a,e){if(a.showLegend){if(a.label){var f=this.elLegendSerie.clone();a.name&&f.addClass(a.name),f.attr({"data-serie":e}),f.findOne("text").text(a.label),f.translate(0,b),V(this.elLegendItems).append(f),b+=c+a.labelLineHeight}joint.util.forIn(a.data,function(a,c){var f=this.elLegendSlice.clone(),g=this.getSliceFillColor(c,e);a.name&&f.addClass(a.name),f.attr({"data-serie":e,"data-slice":c}),f.findOne("text").text(joint.util.format.string(a.legendLabel,a)),f.findOne("text").translate(a.legendLabelMargin),f.translate(0,b),b+=d+a.legendLabelLineHeight,joint.util.isObject(g)?this.applyGradient(f.findOne("circle"),"fill",g):f.findOne("circle").attr({fill:g}),V(this.elLegendItems).append(f)}.bind(this))}},this)},applyGradient:function(a,b,c){var d=joint.util.isString(a)?this.findBySelector(a):$(a).toArray(),e=this.paper.defineGradient(c);d.forEach(function(a){V(a).attr(b,"url(#"+e+")")})},updateSlice:function(a){var b=this.elSlice.clone();V(this.elPie).append(b);var c=this.elSliceFill.clone(),d=this.getSliceFillColor(a.sliceIndex,a.serieIndex);c.attr({fill:d,d:V.createSlicePathData(a.innerRadius,a.outerRadius,a.rad.start,a.rad.end)}),b.append(c),joint.util.isObject(d)&&this.applyGradient("#"+c.attr("id"),"fill",d);var e=this.elSliceBorder.clone(),f=parseInt(this.model.attr(".slice > .slice-border/stroke-width"),10),h=g.point.fromPolar(a.outerRadius+f/2,-a.rad.start,g.point(0,0)),i=g.point.fromPolar(a.outerRadius+f/2,-a.rad.end,g.point(0,0));e.attr({stroke:d,d:this.drawArc(h,i,a.outerRadius+f/2,a.rad.start,a.rad.end)}),b.append(e),joint.util.isObject(d)&&this.applyGradient("#"+e.attr("id"),"stroke",d);var j=this.elSliceInnerLabel.clone();j.text(joint.util.format.string(a.innerLabel,a)),b.append(j);
75var k=j.bbox(),l=a.outerRadius-k.width/2-a.innerLabelMargin;j.translate(l*Math.cos(-a.middleangle),-l*Math.sin(-a.middleangle)),b.attr({"data-serie":a.serieIndex,"data-slice":a.sliceIndex,"data-value":a.value});var m=this._series[a.serieIndex].name;return m&&b.addClass(m),a.name&&b.addClass(a.name),b.addClass("serie-"+a.serieIndex+" slice-"+a.sliceIndex),a.isOuter&&(b.addClass("outer"),a.offset&&(b.addClass("clicked"),this.effectOnSlice(b,a,{type:"offset",offset:a.offset}))),b},getSliceFillColor:function(a,b){b=b||0;var c=this.model.get("attrs"),d=Object.keys(c).find(function(c){return c.indexOf(".serie-"+b+".slice-"+a+" > .slice-fill")>-1});return d?c[d].fill:this._series[b].data[a].fill},onMouseMoveSlice:function(a){var b=V(a.currentTarget),c=b.attr("data-serie"),d=b.attr("data-slice"),e=this._series[c].data[d];this.trigger(a.type,e,a)},mouseOverSlice:function(a,b){b=b||0;var c=V(this.$('.slice[data-serie="'+b+'"][data-slice="'+a+'"]')[0]),d=this._series[b].data[a];c.toggleClass("hover"),d.isOuter&&!joint.util.isEmpty(d.onHoverEffect)&&this.effectOnSlice(c,d,d.onHoverEffect,!c.hasClass("hover"));var e=V(this.$('.legend-slice[data-serie="'+b+'"][data-slice="'+a+'"]')[0]);e&&e.toggleClass("hover");var f=Object.keys(this.model.get("attrs")).filter(function(a){return a.indexOf(".slice")>-1||a.indexOf(".legend-slice")>-1});joint.dia.ElementView.prototype.update.call(this,this.model,joint.util.pick(this.model.get("attrs"),f))},onMouseOverSlice:function(a){var b=V(a.currentTarget),c=b.attr("data-serie"),d=b.attr("data-slice");this.mouseOverSlice(d,c);var e=this._series[c].data[d];this.trigger(a.type,e,a)},clickSlice:function(a,b){b=b||0;var c=V(this.$('.slice[data-serie="'+b+'"][data-slice="'+a+'"]')[0]),d=this._series[b].data[a];d.isOuter&&(c.hasClass("clicked")?(c.removeClass("clicked"),this.model.get("series")[b].data[a].offset=0,this.effectOnSlice(c,d,d.onClickEffect,!0)):(c.addClass("clicked"),this.model.get("series")[b].data[a].offset=d.onClickEffect.offset,this.effectOnSlice(c,d,d.onClickEffect)))},onClickSlice:function(a){var b=V($(a.target).closest(".slice.outer")[0]);if(b){var c=b.attr("data-serie"),d=b.attr("data-slice");this.clickSlice(d,c);var e=this._series[c].data[d];this.trigger(a.type,e,a)}},onEventLegendItem:function(a){var b=V($(a.target).closest(".legend-slice")[0]);if(b){var c=b.attr("data-serie"),d=b.attr("data-slice");switch(a.type){case"click":this.clickSlice(d,c);break;case"mouseover":case"mouseout":this.mouseOverSlice(d,c)}}},effectOnSlice:function(a,b,c,d){switch(d=d||!1,c.type){case"enlarge":d?a.scale(1):a.scale(c.scale||1.05);break;case"offset":d?a.translate(0,0,{absolute:!0}):a.translate(c.offset*Math.cos(-b.middleangle),-c.offset*Math.sin(-b.middleangle))}},svgArcMax:2*Math.PI-1e-6,drawArc:function(a,b,c,d,e){var f=0,g=1,h=e-d;return h>Math.PI&&(f=1,h>=this.svgArcMax&&(f=0,g=0)),"M"+a.x+","+a.y+" A"+c+","+c+" 0 "+f+","+g+" "+b.x+","+b.y}}),joint.shapes.chart.Knob=joint.shapes.chart.Pie.extend({defaults:joint.util.deepSupplement({type:"chart.Knob",sliceDefaults:{legendLabel:"{value:.0f}",outer:{offsetOnClick:0}},pieHole:.7,value:0,attrs:{".legend":{"ref-x":.5,"ref-y":.5,"ref-dx":null,"x-alignment":-.5,"y-alignment":-.5},".legend-slice text":{"font-size":30},".legend-slice circle":{display:"none"},".slice-inner-label":{display:"none"},".slice-fill":{stroke:"none"}}},joint.shapes.chart.Pie.prototype.defaults),initialize:function(){this.set("series",this.getKnobSeries(),{silent:!0}),joint.shapes.chart.Pie.prototype.initialize.apply(this,arguments),this.on("change:value change:min change:max change:fill",this.updateKnob,this)},getKnobSeries:function(){var a=Array.isArray(this.get("value"))?this.get("value"):[this.get("value")],b=Array.isArray(this.get("fill"))?this.get("fill"):[this.get("fill")],c=Array.isArray(this.get("min"))?this.get("min"):[this.get("min")],d=Array.isArray(this.get("max"))?this.get("max"):[this.get("max")],e=a.map(function(a,e){var f=void 0===c[e]?c[0]:c[e],h=void 0===d[e]?d[0]:d[e],i=void 0===b[e]?b[0]:b[e];return{degree:g.scale.linear([f,h],[0,360],a),data:[{value:a,fill:i}],showLegend:!(e>0)}});return e},updateKnob:function(){this.set("series",this.getKnobSeries())}}),joint.shapes.chart.KnobView=joint.shapes.chart.PieView,joint.shapes.chart.Matrix=joint.shapes.basic.Generic.extend({markup:['<g class="rotatable">','<g class="scalable">','<g class="background"><rect/></g>','<g class="cells"/>','<g class="foreground"/>',"</g>",'<g class="labels">','<g class="rows"/>','<g class="columns"/>',"</g>","</g>"].join(""),cellMarkup:'<rect class="cell"/>',labelMarkup:'<text class="label"/>',gridLineMarkup:'<path class="grid-line"/>',defaults:joint.util.deepSupplement({type:"chart.Matrix",attrs:{".background rect":{fill:"#eeeeee"},".grid-line":{stroke:"white","stroke-width":2},".label":{fill:"black","alignment-baseline":"middle"},".labels .rows .label":{"text-anchor":"end"},".labels .columns .label":{"text-anchor":"start"}}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.chart.MatrixView=joint.dia.ElementView.extend({initialize:function(){joint.dia.ElementView.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change:size",function(){this.renderLabels(),this.update()}),this.listenTo(this.model,"change:cells",function(){this.renderMarkup(),this.update()})},renderMarkup:function(){joint.dia.ElementView.prototype.renderMarkup.apply(this,arguments),this.elCells=this.$(".cells")[0],this.elRowLabels=this.$(".labels .rows")[0],this.elColumnLabels=this.$(".labels .columns")[0],this.elForeground=this.$(".foreground")[0],this.elCell=V(this.model.cellMarkup),this.elGridLine=V(this.model.gridLineMarkup);var a=this.model.get("cells")||[],b=this.model.get("size");
75this.elBackgroundRect=this.$(".background rect")[0],V(this.elBackgroundRect).attr(b);var c=b.height/a.length,d=b.width/a.length,e=document.createDocumentFragment();this.elCells.textContent="",this.elForeground.textContent="";for(var f,g,h,i,j,k=document.createDocumentFragment(),l=0;l<a.length;l++)for(h=this.elGridLine.clone(),h.addClass("horizontal"),
76h.attr("d","M 0 "+l*c+" "+b.width+" "+l*c),k.appendChild(h.node),f=a[l],g=0;g<f.length;g++)0===l&&(h=this.elGridLine.clone(),h.addClass("vertical"),h.attr("d","M "+g*d+" 0 "+g*d+" "+b.height),k.appendChild(h.node)),i=f[g],i&&(j=this.elCell.clone(),j.attr(joint.util.assign({x:g*d,y:l*c,width:d,height:c},i)),e.appendChild(j.node));this.elForeground.appendChild(k),this.elCells.appendChild(e),this.renderLabels()},renderLabels:function(){this.elLabel=V(this.model.labelMarkup);var a,b,c=this.model.get("cells")||[],d=this.model.get("labels")||{},e=d.rows||[],f=d.columns||[],g=this.model.get("size"),h=g.height/c.length,i=g.width/c.length;this.elRowLabels.textContent="",this.elColumnLabels.textContent="";for(var j=document.createDocumentFragment(),k=0;k<e.length;k++)a=d.rows[k],b=this.elLabel.clone(),b.text(a.text),b.attr(joint.util.assign({x:-(d.padding||5),y:k*h+h/2,"text-anchor":"end","dominant-baseline":"central","font-size":h,"data-row":k},joint.util.omit(a,"text"))),j.appendChild(b.node);this.elRowLabels.appendChild(j);for(var l,m,n=document.createDocumentFragment(),o=0;o<f.length;o++)a=d.columns[o],b=this.elLabel.clone(),l=o*i+i/2,m=-(d.padding||5),b.attr("x",l),b.text(a.text),b.attr(joint.util.assign({y:m,"text-anchor":"start","dominant-baseline":"central","font-size":i,"data-column":o},joint.util.omit(a,"text"))),b.rotate(-90,l,m),n.appendChild(b.node);this.elColumnLabels.appendChild(n)}});
77joint.shapes.bpmn={},joint.shapes.bpmn.icons={none:"",message:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjwhRE9DVFlQRSBzdmcgIFBVQkxJQyAnLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4nICAnaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkJz48c3ZnIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDUxMiA1MTIiIGhlaWdodD0iNTEycHgiIGlkPSJMYXllcl8xIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiB3aWR0aD0iNTEycHgiIHhtbDpzcGFjZT0icHJlc2VydmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxwYXRoIGQ9Ik00NzkuOTk4LDY0SDMyQzE0LjMyOSw2NCwwLDc4LjMxMiwwLDk2djMyMGMwLDE3LjY4OCwxNC4zMjksMzIsMzIsMzJoNDQ3Ljk5OEM0OTcuNjcxLDQ0OCw1MTIsNDMzLjY4OCw1MTIsNDE2Vjk2ICBDNTEyLDc4LjMx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MBAsWXLFrFnz54VmjAxMSE84U4KQqziTvYFapqSktIJnkbtXjNvW+DU5ioB8vDIOrlq7Xfu3GmgINNHl47lixcvIiO3QszsuY273ElFgFXcSSVGTBFfew7eBv4GHucoAHz6Y+I1r23UgFRmED6e1QD8XZBOW7zlTk4EgE28rKioaHBnbNgnPJ+vw8UGrO8rcoVzdJ2MqKmp0ZEbC7l58yaSWacJn0LqoKCgcc1/XOg0nHqhBDt6XI+TsXvnNXdycQJpUCHouzOagTkxN9/mrKqZAE7QgloEOtR7zZ1cCFABRqpkxNgIMuKnmIsvQGaOJ9UepzLelzupjJnlzI2mpqZ28KKvcspHy2vY4I0AMrhTDOMLQhXeXbt2zftAJikd7yl3AmZAxXFK3lIJH08lUUo++aBSo+ki7vQBGaHTRBjdwJ7TghGENFqtNoAuPTvUEmFkDxN0Z7ZSkBymvlqltUj5DOQpd/Kk4HbG6pct5fuYp9xJQlk8depUK1/8P5EqgDvcydPV4g6gVMcutNmWd5IlgEvuhA8ixJl63LjU64uKinS4g+AW5niauE+wKn0vUwB3uNMcvM+RI0faQcKU0ioHDx60pVWMtmQWvj9jLFtaBXNwWmWXbBvYThiAO8TO8UIMHHAQaOIIPyEQ7d+/v9NRgN27d3exfv/AhG4D9zVgLIzJ7heJrW3SjdgVd7Jr8zsybfZUATyKU4tXVXKt9Txml2pqUdbXdDXuZPf+OySPkX+1CQBixtzmjEqfQL6tJaqtxU/ix3I9n4JaeUEInZmZGSHasVIxNTU1wx9TulTGNNGf35zN67eOFL6X4Hv+/Hkr3aN14PNEPYL5atgvjde4+1HBy3/PaXb49xwwzD/eZyP/EWAAQ3AUnjpOYHIAAAAASUVORK5CYII="},joint.shapes.bpmn.IconInterface={initialize:function(){this._parent=(this._parent||this).constructor.__super__,this._parent.initialize.apply(this,arguments),this.listenTo(this,"change:icon",this._onIconChange),this._onIconChange(this,this.get("icon")||"none")},_onIconChange:function(a,b){var c=joint.shapes.bpmn.icons;
77if(!joint.util.has(c,b))throw"BPMN: Unknown icon: "+b;a.attr("image/xlink:href",c[b])}},joint.shapes.bpmn.SubProcessInterface={initialize:function(){this._parent=(this._parent||this).constructor.__super__,this._parent.initialize.apply(this,arguments),this.listenTo(this,"change:subProcess",this._onSubProcessChange),this._onSubProcessChange(this,this.get("subProcess")||null)},_onSubProcessChange:function(a,b){a.attr({".sub-process":{visibility:b?"visible":"hidden","data-sub-process":b||""}})}},joint.shapes.bpmn.ActivityView=joint.shapes.basic.TextBlockView,joint.shapes.bpmn.Activity=joint.shapes.basic.TextBlock.extend({markup:['<g class="rotatable">','<g class="scalable"><rect class="body outer"/><rect class="body inner"/></g>',joint.env.test("svgforeignobject")?'<foreignObject class="fobj"><body xmlns="http://www.w3.org/1999/xhtml"><div class="content"/></body></foreignObject>':'<text class="content"/>','<path class="sub-process"/><image class="icon"/></g>'].join(""),defaults:joint.util.deepSupplement({size:{width:100,height:100},type:"bpmn.Activity",attrs:{rect:{rx:8,ry:8,width:100,height:100},".body":{fill:"#ffffff",stroke:"#000000"},".inner":{transform:"scale(0.9,0.9) translate(5,5)"},path:{d:"M 0 0 L 30 0 30 30 0 30 z M 15 4 L 15 26 M 4 15 L 26 15",ref:".inner","ref-x":.5,"ref-dy":-30,"x-alignment":"middle",stroke:"#000000",fill:"transparent"},image:{ref:".inner","ref-x":5,width:20,height:20}},activityType:"task",subProcess:null},joint.shapes.basic.TextBlock.prototype.defaults),initialize:function(){joint.shapes.basic.TextBlock.prototype.initialize.apply(this,arguments),this.listenTo(this,"change:activityType",this.onActivityTypeChange),this.listenTo(this,"change:subProcess",this.onSubProcessChange),this.onSubProcessChange(this,this.get("subProcess")),this.onActivityTypeChange(this,this.get("activityType"))},onActivityTypeChange:function(a,b){switch(b){case"task":a.attr({".inner":{visibility:"hidden"},".outer":{"stroke-width":1,"stroke-dasharray":"none"},path:{ref:".outer"},image:{ref:".outer"}});break;case"transaction":a.attr({".inner":{visibility:"visible"},".outer":{"stroke-width":1,"stroke-dasharray":"none"},path:{ref:".inner"},image:{ref:".inner"}});break;case"event-sub-process":a.attr({".inner":{visibility:"hidden"},".outer":{"stroke-width":1,"stroke-dasharray":"1,2"},path:{ref:".outer"},image:{ref:".outer"}});break;case"call-activity":a.attr({".inner":{visibility:"hidden"},".outer":{"stroke-width":5,"stroke-dasharray":"none"},path:{ref:".outer"},image:{ref:".outer"}});break;default:throw"BPMN: Unknown Activity Type: "+b}},onSubProcessChange:function(a,b){b?a.attr({".fobj div":{style:{verticalAlign:"baseline",paddingTop:10}},image:{"ref-dy":-25,"ref-y":""},text:{"ref-y":25}}):a.attr({".fobj div":{style:{verticalAlign:"middle",paddingTop:0}},image:{"ref-dy":"","ref-y":5},text:{"ref-y":.5}})}}).extend(joint.shapes.bpmn.IconInterface).extend(joint.shapes.bpmn.SubProcessInterface),joint.shapes.bpmn.AnnotationView=joint.shapes.basic.TextBlockView,joint.shapes.bpmn.Annotation=joint.shapes.basic.TextBlock.extend({markup:['<g class="rotatable">','<g class="scalable"><rect class="body"/></g>',joint.env.test("svgforeignobject")?'<foreignObject class="fobj"><body xmlns="http://www.w3.org/1999/xhtml"><div class="content"/></body></foreignObject>':'<text class="content"/>','<path class="stroke"/></g>'].join(""),defaults:joint.util.deepSupplement({size:{width:100,height:100},type:"bpmn.Annotation",attrs:{rect:{width:100,height:100},".body":{"fill-opacity":.1,fill:"#ffffff",stroke:"none"},".fobj div":{style:{textAlign:"left",paddingLeft:10}},".stroke":{stroke:"#000000",fill:"none","stroke-width":3}},wingLength:20},joint.shapes.basic.TextBlock.prototype.defaults),initialize:function(){joint.shapes.basic.TextBlock.prototype.initialize.apply(this,arguments),this.listenTo(this,"change:size",this.onSizeChange),this.onSizeChange(this,this.get("size"))},onSizeChange:function(a,b){a.attr(".stroke",{d:a.getStrokePathData(b.width,b.height,a.get("wingLength"))})},getStrokePathData:function(a,b,c){return c=Math.min(c,a),["M",c,"0 L 0 0 0",b,c,b].join(" ")}}),joint.shapes.bpmn.Gateway=joint.dia.Element.extend({markup:'<g class="rotatable"><g class="scalable"><polygon class="body"/><image/></g></g><text class="label"/>',defaults:joint.util.deepSupplement({type:"bpmn.Gateway",size:{width:80,height:80},attrs:{".body":{points:"40,0 80,40 40,80 0,40",fill:"#ffffff",stroke:"#000000"},".label":{text:"",ref:".body","ref-x":.5,"ref-dy":20,"y-alignment":"middle","x-alignment":"middle","font-size":14,"font-family":"Arial, helvetica, sans-serif",fill:"#000000"},image:{width:40,height:40,"xlink:href":"",transform:"translate(20,20)"}}},joint.dia.Element.prototype.defaults)}).extend(joint.shapes.bpmn.IconInterface),joint.shapes.bpmn.Event=joint.dia.Element.extend({markup:'<g class="rotatable"><g class="scalable"><circle class="body outer"/><circle class="body inner"/><image/></g><text class="label"/></g>',defaults:joint.util.deepSupplement({type:"bpmn.Event",size:{width:60,height:60},attrs:{".body":{fill:"#ffffff",stroke:"#000000"},".outer":{"stroke-width":1,r:30,transform:"translate(30,30)"}
77,".inner":{"stroke-width":1,r:26,transform:"translate(30,30)"},image:{width:40,height:40,"xlink:href":"",transform:"translate(10,10)"},".label":{text:"",fill:"#000000","font-family":"Arial","font-size":14,ref:".outer","ref-x":.5,"ref-dy":20,"x-alignment":"middle","y-alignment":"middle"}},eventType:"start"},joint.dia.Element.prototype.defaults),initialize:function(){joint.dia.Element.prototype.initialize.apply(this,arguments),this.listenTo(this,"change:eventType",this.onEventTypeChange),this.onEventTypeChange(this,this.get("eventType"))},onEventTypeChange:function(a,b){switch(b){case"start":a.attr({".inner":{visibility:"hidden"},".outer":{"stroke-width":1}});break;case"end":a.attr({".inner":{visibility:"hidden"},".outer":{"stroke-width":5}});break;case"intermediate":a.attr({".inner":{visibility:"visible"},".outer":{"stroke-width":1}});break;default:throw"BPMN: Unknown Event Type: "+b}}}).extend(joint.shapes.bpmn.IconInterface),joint.shapes.bpmn.Pool=joint.dia.Element.extend({markup:['<g class="rotatable">','<g class="scalable"><rect class="body"/></g>','<svg overflow="hidden" class="blackbox-wrap"><text class="blackbox-label"/></svg>','<rect class="header"/><text class="label"/>','<g class="lanes"/>',"</g>"].join(""),laneMarkup:'<g class="lane"><rect class="lane-body"/><rect class="lane-header"/><text class="lane-label"/></g>',defaults:joint.util.deepSupplement({type:"bpmn.Pool",size:{width:600,height:300},attrs:{".body":{fill:"#ffffff",stroke:"#000000",width:500,height:200,"pointer-events":"stroke"},".header":{fill:"#ffffff",stroke:"#000000",width:20,ref:".body","ref-height":1,"pointer-events":"visiblePainted"},".label":{fill:"#000000",transform:"rotate(-90)",ref:".header","ref-x":10,"ref-y":.5,"font-family":"Arial","font-size":14,"x-alignment":"middle","text-anchor":"middle"},".lane-body":{fill:"#ffffff",stroke:"#000000","pointer-events":"stroke"},".lane-header":{fill:"#ffffff",stroke:"#000000","pointer-events":"visiblePainted"},".lane-label":{fill:"#000000",transform:"rotate(-90)","text-anchor":"middle","font-family":"Arial","font-size":13},".blackbox-wrap":{ref:".body","ref-width":1,"ref-height":1},".blackbox-label":{text:"Black Box","text-anchor":"middle",transform:"translate(0,-7)"},".blackbox-label > tspan":{dx:"50%",dy:"50%"}}},joint.dia.Element.prototype.defaults)}),joint.shapes.bpmn.PoolView=joint.dia.ElementView.extend({options:{headerWidth:20},initialize:function(){this.listenTo(this.model,"change:lanes",function(a,b){this.renderLanes(b)}),joint.dia.ElementView.prototype.initialize.apply(this,arguments)},update:function(){return void 0===this.lanesAttrs?this.renderLanes(this.model.get("lanes")):joint.dia.ElementView.prototype.update.call(this,this.model,joint.util.merge({},this.model.get("attrs"),this.lanesAttrs||{}))},renderMarkup:function(){joint.dia.ElementView.prototype.renderMarkup.apply(this,arguments),this.$lanes=this.$(".lanes"),this.laneMarkup=V(this.model.laneMarkup)},renderLanes:function(a){a=a||{},this.index=0;var b=void 0===a.headerWidth?this.options.headerWidth:a.headerWidth;this.lanesAttrs={".header":{width:b},".label":{text:a.label||""}},this.$lanes.empty(),a.sublanes&&this.renderSublanes(a.sublanes,b,0,1,"lanes"),this.update(this.model,joint.util.merge({},this.model.get("attrs"),this.lanesAttrs))},calculateRatios:function(a,b){for(var c=0,d=[],e=[],f=0,g=a.length;f<g;f++){var h=a[f],i=h.ratio;Number.isFinite(i)?(c+=i/10,e[f]=i/10/b):d.push(f)}for(var j=Math.max(1-c,0)*b/d.length,k=0,l=d.length;k<l;k++)e[d[k]]=j;return e},renderSublanes:function(a,b,c,d,e){var f=this.options.headerWidth,g=e+"/sublanes/",h=this.calculateRatios(a,d);joint.util.toArray(a).reduce(function(a,d,e){var i="lane"+this.index,j="."+i+" .lane-body",k="."+i+" .lane-header",l="."+i+" .lane-label";d.name&&(i+=" "+d.name);var m=g+e,n=this.laneMarkup.clone().addClass(i).attr({"data-lane-path":m,"data-lane-index":this.index});this.$lanes.append(n.node);var o=h[e],p=void 0===d.headerWidth?f:d.headerWidth,q=c+a;return this.lanesAttrs[j]={ref:".body","ref-height":o,"ref-width":-b,"ref-x":b,"ref-y":q}
77,this.lanesAttrs[k]={width:p,ref:".body","ref-height":o,"ref-x":b,"ref-y":q},this.lanesAttrs[l]={text:d.label,ref:k,"ref-x":10,"ref-y":.5,"x-alignment":"middle"},this.index++,d.sublanes&&this.renderSublanes(d.sublanes,b+p,q,o,m),a+o}.bind(this),0)}}),joint.shapes.bpmn.Group=joint.dia.Element.extend({markup:'<g class="rotatable"><g class="scalable"><rect class="body"/></g><rect class="label-rect"/><g class="label-group"><svg overflow="hidden" class="label-wrap"><text class="label"/></svg></g></g>',defaults:joint.util.deepSupplement({type:"bpmn.Group",size:{width:200,height:200},attrs:{".body":{width:200,height:200,stroke:"#000000","stroke-dasharray":"6,6","stroke-width":2,fill:"transparent",rx:15,ry:15,"pointer-events":"stroke"},".label-rect":{ref:".body","ref-width":.6,"ref-x":.4,"ref-y":-30,height:25,fill:"#ffffff",stroke:"#000000"},".label-group":{ref:".label-rect","ref-x":0,"ref-y":0},".label-wrap":{ref:".label-rect","ref-width":1,"ref-height":1},".label":{text:"",x:"50%",y:"1.3em","text-anchor":"middle","font-family":"Arial","font-size":14,fill:"#000000"}}},joint.dia.Element.prototype.defaults)}),joint.shapes.bpmn.DataObject=joint.dia.Element.extend({markup:'<g class="rotatable"><g class="scalable"><polygon class="body"/></g><text class="label"/></g>',defaults:joint.util.deepSupplement({type:"bpmn.DataObject",size:{width:60,height:80},attrs:{".body":{points:"20,0 60,0 60,80 0,80 0,20 20,0 20,20 0,20",stroke:"#000000",fill:"#ffffff"},".label":{ref:".body","ref-x":.5,"ref-dy":5,text:"","text-anchor":"middle"}}},joint.dia.Element.prototype.defaults)}),joint.shapes.bpmn.Conversation=joint.dia.Element.extend({markup:'<g class="rotatable"><g class="scalable"><polygon class="body"/></g><text class="label"/><path class="sub-process"/></g>',defaults:joint.util.deepSupplement({type:"bpmn.Conversation",size:{width:100,height:100},attrs:{".body":{points:"25,0 75,0 100,50 75,100 25,100 0,50",stroke:"#000000",fill:"#ffffff"},".label":{text:"",ref:".body","ref-x":.5,"ref-dy":5,"text-anchor":"middle"},path:{d:"M 0 0 L 30 0 30 30 0 30 z M 15 4 L 15 26 M 4 15 L 26 15",ref:".body","ref-x":.5,"ref-dy":-30,"x-alignment":"middle",fill:"#ffffff",stroke:"#000000","fill-opacity":0}},conversationType:"conversation"},joint.dia.Element.prototype.defaults),initialize:function(){joint.dia.Element.prototype.initialize.apply(this,arguments),this.listenTo(this,"change:conversationType",this.onConversationTypeChange),this.onConversationTypeChange(this,this.get("conversationType"))},onConversationTypeChange:function(a,b){switch(b){case"conversation":a.attr("polygon/stroke-width",1);break;case"call-conversation":a.attr("polygon/stroke-width",4);break;default:throw"BPMN: Unknown Conversation Type: "+b}}}).extend(joint.shapes.bpmn.SubProcessInterface),joint.shapes.bpmn.Choreography=joint.shapes.basic.TextBlock.extend({markup:['<g class="rotatable">','<g class="scalable"><rect class="body"/></g>',joint.env.test("svgforeignobject")?'<foreignObject class="fobj"><body xmlns="http://www.w3.org/1999/xhtml"><div class="content"/></body></foreignObject>':'<text class="content"/>','<text class="label"/><path class="sub-process"/><g class="participants"/>',"</g>"].join(""),participantMarkup:'<g class="participant"><rect class="participant-rect"/><text class="participant-label"/></g>',defaults:joint.util.deepSupplement({type:"bpmn.Choreography",size:{width:60,height:80},attrs:{rect:{},".body":{width:60,height:80,stroke:"#000000",fill:"#ffffff"},".label":{ref:".body","ref-x":.5,"ref-dy":5,text:"","text-anchor":"middle"},".participant-rect":{stroke:"#000000",fill:"#aaaaaa",ref:".body","ref-width":1},".participant-label":{"text-anchor":"middle",ref:".participant_0 .participant-rect","ref-x":.5,"ref-y":.5,"y-alignment":"middle"},".sub-process":{d:"M 0 0 L 30 0 30 30 0 30 z M 15 4 L 15 26 M 4 15 L 26 15",ref:".body","ref-x":.5,"ref-dy":-30,"x-alignment":"middle",fill:"transparent",stroke:"#000000"}},participants:[],initiatingParticipant:0},joint.shapes.basic.TextBlock.prototype.defaults)}).extend(joint.shapes.bpmn.SubProcessInterface),joint.shapes.bpmn.ChoreographyView=joint.shapes.basic.TextBlockView.extend({options:{participantHeight:20},initialize:function(){this.listenTo(this.model,"change:participants",function(a,b){this.renderParticipants(b)}),this.listenTo(this.model,"change:initiatingParticipant",this.layoutAndUpdate),joint.shapes.basic.TextBlockView.prototype.initialize.apply(this,arguments),joint.env.test("svgforeignobject")||this.stopListening(this.model,"change:content").listenTo(this.model,"change:content",function(a){this.updateContent(a,this.participantsAttrs)})},update:function(){return void 0===this.participantsAttrs?this.renderParticipants(this.model.get("participants")):(this.layoutAndUpdate(),this)},render:function(){this.participantsAttrs=void 0,joint.dia.ElementView.prototype.render.apply(this,arguments)},renderMarkup:function(){joint.dia.ElementView.prototype.renderMarkup.apply(this,arguments),this.$participants=this.$(".participants"),this.participantMarkup=V(this.model.participantMarkup)},renderParticipants:function(a){this.$participants.empty(),this.participantsAttrs={}
77,joint.util.toArray(a).forEach(function(a,b){var c="participant_"+b,d="."+c;this.participantsAttrs[d+" .participant-rect"]={height:this.options.participantHeight},this.participantsAttrs[d+" .participant-label"]={text:a},this.$participants.append(this.participantMarkup.clone().addClass(c).node)},this),this.layoutAndUpdate()},layoutAndUpdate:function(){var a=this.model.get("participants")||[],b=a.length,c=this.options.participantHeight,d=this.model.get("size").height,e=Math.max(0,d-c*b),f=0,g=this.model.get("initiatingParticipant"),h=Math.max(joint.util.isNumber(g)?Math.abs(g):a.indexOf(g),0),i=Math.min(h,b-2);joint.util.toArray(a).forEach(function(a,b){var d=".participant_"+b;this.participantsAttrs[d]={transform:"translate(0,"+f+")"},this.participantsAttrs[d+" .participant-rect"].fill=h==b?this.model.attr(".body/fill"):this.model.attr(".participant-rect/fill"),this.participantsAttrs[d+" .participant-rect"].stroke=h==b?this.model.attr(".body/stroke"):this.model.attr(".participant-rect/stroke"),f+=c+(i==b?e:0)},this);var j=b<2?0:i-b+1;this.participantsAttrs[".sub-process"]={"ref-dy":Math.max(-d,j*c-30)};var k=b<2?0:i+1;this.participantsAttrs[".fobj div"]={style:{height:e,paddingTop:c*k}},this.participantsAttrs[".content"]={"ref-y":c*k+e/2};var l=joint.util.merge({},this.model.get("attrs"),this.participantsAttrs||{});joint.util.unsetByPath(l,"div/html"),joint.shapes.basic.TextBlockView.prototype.update.call(this,this.model,l)}}),joint.shapes.bpmn.Message=joint.dia.Element.extend({markup:'<g class="rotatable"><g class="scalable"><polygon class="body"/></g><text class="label"/></g>',defaults:joint.util.deepSupplement({type:"bpmn.Message",size:{width:60,height:40},attrs:{".body":{points:"0,0 60,0 60,40 0,40 0,0 60,0 30,20 0,0",stroke:"#000000",fill:"#ffffff"},".label":{ref:".body","ref-x":.5,"ref-dy":5,text:"","text-anchor":"middle"}}},joint.dia.Element.prototype.defaults)}),joint.shapes.bpmn.Flow=joint.dia.Link.extend({defaults:{type:"bpmn.Flow",attrs:{".marker-source":{d:"M 0 0"},".marker-target":{d:"M 10 0 L 0 5 L 10 10 z",fill:"#000000"},".connection":{"stroke-dasharray":" ","stroke-width":1},".connection-wrap":{style:"",onMouseOver:"",onMouseOut:""}},flowType:"normal"},initialize:function(){joint.dia.Link.prototype.initialize.apply(this,arguments),this.listenTo(this,"change:flowType",this.onFlowTypeChange),this.onFlowTypeChange(this,this.get("flowType"))},onFlowTypeChange:function(a,b){var c;switch(b){case"default":c={".marker-source":{d:"M 0 5 L 20 5 M 20 0 L 10 10",fill:"none"}};break;case"conditional":c={".marker-source":{d:"M 20 8 L 10 0 L 0 8 L 10 16 z",fill:"#FFF"}};break;case"normal":c={};break;case"message":c={".marker-target":{fill:"#FFF"},".connection":{"stroke-dasharray":"4,4"}};break;case"association":c={".marker-target":{d:"M 0 0"},".connection":{"stroke-dasharray":"4,4"}};break;case"conversation":c={".marker-target":{d:"M 0 0"},".connection":{"stroke-width":"7px"},".connection-wrap":{style:"stroke: #fff; stroke-width: 5px; opacity: 1;",onMouseOver:"var s=this.style;s.stroke='#000';s.strokeWidth=15;s.opacity=.4",onMouseOut:"var s=this.style;s.stroke='#fff';s.strokeWidth=5;s.opacity=1"}};break;default:throw"BPMN: Unknown Flow Type: "+b}a.attr(joint.util.merge({},this.defaults.attrs,c))}});
78joint.dia.CommandManager=Backbone.Model.extend({defaults:{cmdBeforeAdd:null,cmdNameRegex:/^(?:add|remove|change:\w+)$/,applyOptionsList:["propertyPath"],revertOptionsList:["propertyPath"]},PREFIX_LENGTH:7,initialize:function(a){joint.util.bindAll(this,"initBatchCommand","storeBatchCommand"),this.graph=a.graph,this.reset(),this.listen()},listen:function(){this.listenTo(this.graph,"all",this.addCommand,this),this.listenTo(this.graph,"batch:start",this.initBatchCommand,this),this.listenTo(this.graph,"batch:stop",this.storeBatchCommand,this)},createCommand:function(a){var b={action:void 0,data:{id:void 0,type:void 0,previous:{},next:{}},batch:a&&a.batch};return b},push:function(a){this.redoStack=[],a.batch?(this.lastCmdIndex=Math.max(this.lastCmdIndex,0),this.trigger("batch",a)):(this.undoStack.push(a),this.trigger("add",a))},addCommand:function(a,b,c,d){if((!d||!d.dry)&&this.get("cmdNameRegex").test(a)&&("function"!=typeof this.get("cmdBeforeAdd")||this.get("cmdBeforeAdd").apply(this,arguments))){var e=void 0,f=b instanceof joint.dia.Graph;if(this.batchCommand){e=this.batchCommand[Math.max(this.lastCmdIndex,0)];var g=f&&!e.graphChange||e.data.id!==b.id,h=e.action!==a;if(this.lastCmdIndex>=0&&(g||h)){var i=this.batchCommand.findIndex(function(c,d){return(f&&c.graphChange||c.data.id===b.id)&&c.action===a});i<0||"add"===a||"remove"===a?e=this.createCommand({batch:!0}):(e=this.batchCommand[i],this.batchCommand.splice(i,1)),this.lastCmdIndex=this.batchCommand.push(e)-1}}else e=this.createCommand({batch:!1});if("add"===a||"remove"===a)return e.action=a,e.data.id=b.id,e.data.type=b.attributes.type,e.data.attributes=joint.util.merge({},b.toJSON()),e.options=d||{},void this.push(e);var j=a.substr(this.PREFIX_LENGTH);e.batch&&e.action||(e.action=a,e.data.previous[j]=joint.util.clone(b.previous(j)),e.options=d||{},f?e.graphChange=!0:(e.data.id=b.id,e.data.type=b.attributes.type)),e.data.next[j]=joint.util.clone(b.get(j)),this.push(e)}},initBatchCommand:function(){this.batchCommand?this.batchLevel++:(this.batchCommand=[this.createCommand({batch:!0})],this.lastCmdIndex=-1,this.batchLevel=0)},storeBatchCommand:function(){if(this.batchCommand&&this.batchLevel<=0){var a=this.filterBatchCommand(this.batchCommand);a.length>0&&(this.redoStack=[],this.undoStack.push(a),this.trigger("add",a)),this.batchCommand=null,this.lastCmdIndex=null,this.batchLevel=null}else this.batchCommand&&this.batchLevel>0&&this.batchLevel--},filterBatchCommand:function(a){for(var b=a.slice(),c=[];b.length>0;){var d=b.shift(),e=d.data.id;if(null!=d.action&&(null!=e||d.graphChange)){if("add"===d.action){var f=b.findIndex(function(a){return"remove"===a.action&&a.data&&a.data.id===e});if(f>=0){b=b.filter(function(a,b){return b>f||a.data.id!==e});continue}}else if("remove"===d.action){var g=b.findIndex(function(a){return"add"===a.action&&a.data&&a.data.id==e});if(g>=0){b.splice(g,1);continue}}else if(0===d.action.indexOf("change")&&joint.util.isEqual(d.data.previous,d.data.next))continue;c.push(d)}}return c},revertCommand:function(a,b){this.stopListening();var c;c=Array.isArray(a)?this.constructor.sortBatchCommands(a):[a];for(var d=this.graph,e=c.length-1;e>=0;e--){var f=c[e],g=f.graphChange?d:d.getCell(f.data.id),h=joint.util.assign({commandManager:this.id||this.cid},b,joint.util.pick(f.options,this.get("revertOptionsList")));switch(f.action){case"add":g.remove(h);break;case"remove":d.addCell(f.data.attributes,h);break;default:var i=f.action.substr(this.PREFIX_LENGTH);g.set(i,f.data.previous[i],h)}}this.listen()},applyCommand:function(a,b){this.stopListening();var c;c=Array.isArray(a)?this.constructor.sortBatchCommands(a):[a];for(var d=this.graph,e=0;e<c.length;e++){var f=c[e],g=f.graphChange?d:d.getCell(f.data.id),h=joint.util.assign({commandManager:this.id||this.cid},b,joint.util.pick(f.options,this.get("applyOptionsList")));switch(f.action){case"add":d.addCell(f.data.attributes,h);break;case"remove":g.remove(h);break;default:var i=f.action.substr(this.PREFIX_LENGTH);g.set(i,f.data.next[i],h)}}this.listen()},undo:function(a){var b=this.undoStack.pop();b&&(this.revertCommand(b,a),this.redoStack.push(b))},redo:function(a){var b=this.redoStack.pop();b&&(this.applyCommand(b,a),this.undoStack.push(b))},cancel:function(a){this.hasUndo()&&(this.revertCommand(this.undoStack.pop(),a),this.redoStack=[])},reset:function(){this.undoStack=[],this.redoStack=[]},hasUndo:function(){return this.undoStack.length>0},hasRedo:function(){return this.redoStack.length>0}},{sortBatchCommands:function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c],e=null;if("add"===d.action)for(var f=d.data.id,g=0;g<c;g++)if(a[g].data.id===f){e=g-1;break}null!==e?b.splice(e,0,d):b.push(d)}return b}});
79joint.dia.Validator=Backbone.Model.extend({initialize:function(a){this._map={},this._commandManager=a.commandManager,this.listenTo(this._commandManager,"add",this._onCommand)},defaults:{cancelInvalid:!0},_onCommand:function(a){return Array.isArray(a)?a.find(function(a){return!this._validateCommand(a)},this):this._validateCommand(a)},_validateCommand:function(a){if(a.options&&a.options.validation===!1)return!0;var b;return joint.util.toArray(this._map[a.action]).forEach(function(c){function d(f){var g=c[e++];try{if(!g)return void(b=f);g(f,a,d)}catch(f){d(f)}}var e=0;d(b)}),!b||(this.get("cancelInvalid")&&this._commandManager.cancel(),this.trigger("invalid",b),!1)},validate:function(a){var b=Array.prototype.slice.call(arguments,1);return b.forEach(function(b){if(!joint.util.isFunction(b))throw new Error(a+" requires callback functions.")}),a.split(" ").forEach(function(a){(this._map[a]=this._map[a]||[]).push(b)},this),this}});
80joint.dia.Graph.prototype.constructTree=function(a,b,c,d){d=d||[];var e=joint.util.isFunction(b.children)?b.children(a):a[b.children||"children"];return c||(c=b.makeElement(a),d.push(c)),joint.util.toArray(e).forEach(function(a){var e=b.makeElement(a),f=b.makeLink(c,e);d.push(e,f),this.constructTree(a,b,e,d)},this),d},joint.dia.Graph.prototype.shortestPath=function(a,b,c){c=c||{};var d={};this.getLinks().forEach(function(a){var b=a.get("source").id,e=a.get("target").id;d[b]||(d[b]=[]),d[e]||(d[e]=[]),d[b].push(e),c.directed||d[e].push(b)});var e=joint.alg.Dijkstra(d,a.id||a,c.weight),f=[],g=b.id||b;for(e[g]&&f.push(g);g=e[g];)f.unshift(g);return f};
81joint.ui.PaperScroller=joint.mvc.View.extend({className:"paper-scroller",options:{paper:void 0,padding:function(){var a=this.getClientSize(),b=Math.max(this.options.minVisiblePaperSize,1)||1,c={};return c.left=c.right=Math.max(a.width-b,0),c.top=c.bottom=Math.max(a.height-b,0),c},minVisiblePaperSize:50,autoResizePaper:!1,baseWidth:void 0,baseHeight:void 0,contentOptions:void 0,cursor:"default"},_padding:{left:0,top:0},init:function(){joint.util.bindAll(this,"startPanning","stopPanning","pan","onBackgroundEvent");var a=this.options.paper,b=a.scale();this._sx=b.sx,this._sy=b.sy,void 0===this.options.baseWidth&&(this.options.baseWidth=a.options.width),void 0===this.options.baseHeight&&(this.options.baseHeight=a.options.height),this.$background=$("<div/>").addClass("paper-scroller-background").css({width:a.options.width,height:a.options.height}).append(a.el).appendTo(this.el),this.listenTo(a,"scale",this.onScale).listenTo(a,"resize",this.onResize).listenTo(a,"beforeprint beforeexport",this.storeScrollPosition).listenTo(a,"afterprint afterexport",this.restoreScrollPosition),this.options.autoResizePaper&&(this.listenTo(a.model,"change add remove reset",this.adjustPaper),a.options.async&&this.listenTo(a,"render:done",this.adjustPaper)),this.delegateBackgroundEvents(),this.setCursor(this.options.cursor)},lock:function(){return this.$el.css("overflow","hidden"),this},unlock:function(){return this.$el.css("overflow","scroll"),this},setCursor:function(a){switch(a){case"grab":this.$el.css("cursor","");break;default:this.$el.css("cursor",a)}return this.$el.attr("data-cursor",a),this.options.cursor=a,this},delegateBackgroundEvents:function(a){function b(b,c){var d=a[c];return c.indexOf(" ")===-1&&(b[c]=joint.util.isFunction(d)?d:this.options.paper[d]),b}function c(a){this.delegate(a,{guarded:!1},this.onBackgroundEvent)}a||(a=joint.util.result(this.options.paper,"events"));var d=this.paperEvents=Object.keys(a||{}).reduce(b.bind(this),{});return Object.keys(d).forEach(c,this),this},onBackgroundEvent:function(a){if(this.$background.is(a.target)){var b=this.paperEvents[a.type];joint.util.isFunction(b)&&b.apply(this.options.paper,arguments)}},onResize:function(){this._center&&this.center(this._center.x,this._center.y)},onScale:function(a,b,c,d){this.adjustScale(a,b),this._sx=a,this._sy=b,(c||d)&&this.center(c,d)},storeScrollPosition:function(){this._scrollLeftBeforePrint=this.el.scrollLeft,this._scrollTopBeforePrint=this.el.scrollTop},restoreScrollPosition:function(){this.el.scrollLeft=this._scrollLeftBeforePrint,this.el.scrollTop=this._scrollTopBeforePrint,this._scrollLeftBeforePrint=null,this._scrollTopBeforePrint=null},beforePaperManipulation:function(){(joint.env.test("msie")||joint.env.test("msedge"))&&this.$el.css("visibility","hidden")},afterPaperManipulation:function(){(joint.env.test("msie")||joint.env.test("msedge"))&&this.$el.css("visibility","visible")},clientToLocalPoint:function(a,b){var c=this.options.paper.matrix();return a+=this.el.scrollLeft-this._padding.left-c.e,a/=c.a,b+=this.el.scrollTop-this._padding.top-c.f,b/=c.d,new g.Point(a,b)}
81,localToBackgroundPoint:function(a,b){var c=new g.Point(a,b),d=this.options.paper.matrix(),e=this._padding;return V.transformPoint(c,d).offset(e.left,e.top)},adjustPaper:function(){var a=this.getClientSize();this._center=this.clientToLocalPoint(a.width/2,a.height/2);var b=joint.util.assign({gridWidth:this.options.baseWidth,gridHeight:this.options.baseHeight,allowNewOrigin:"negative"},this.options.contentOptions);return this.options.paper.fitToContent(this.transformContentOptions(b)),this},adjustScale:function(a,b){var c=this.options.paper.options,d=a/this._sx,e=b/this._sy;this.options.paper.setOrigin(c.origin.x*d,c.origin.y*e),this.options.paper.setDimensions(c.width*d,c.height*e)},transformContentOptions:function(a){var b=this._sx,c=this._sy;return a.gridWidth&&(a.gridWidth*=b),a.gridHeight&&(a.gridHeight*=c),a.minWidth&&(a.minWidth*=b),a.minHeight&&(a.minHeight*=c),joint.util.isObject(a.padding)?a.padding={left:(a.padding.left||0)*b,right:(a.padding.right||0)*b,top:(a.padding.top||0)*c,bottom:(a.padding.bottom||0)*c}:joint.util.isNumber(a.padding)&&(a.padding=a.padding*b),a},center:function(a,b,c){var d,e=this.options.paper.matrix(),f=-e.e,g=-e.f,h=f+this.options.paper.options.width,i=g+this.options.paper.options.height,j=joint.util.isNumber(a),k=joint.util.isNumber(b);if(j||k){d=c;var l=this.getVisibleArea().center();j?a*=e.a:a=l.x,k?b*=e.d:b=l.y}else d=a,a=(f+h)/2,b=(g+i)/2;var m=this.getClientSize(),n=this.getPadding(),o=m.width/2,p=m.height/2,q=o-n.left-a+f,r=o-n.right+a-h,s=p-n.top-b+g,t=p-n.bottom+b-i;return this.addPadding(Math.max(q,0),Math.max(r,0),Math.max(s,0),Math.max(t,0)),this.scroll(a,b,d),this},centerContent:function(a){return this.positionContent("center",a)},centerElement:function(a,b){return this.checkElement(a,"centerElement"),this.positionElement(a,"center",b)},positionContent:function(a,b){var c=this.options.paper.getContentArea();return this.positionRect(c,a,b)},positionElement:function(a,b,c){this.checkElement(a,"positionElement");var d=a.getBBox();return this.positionRect(d,b,c)},positionRect:function(a,b,c){var d;switch(b){case"center":return d=a.center(),this.positionPoint(d,"50%","50%",c);case"top":return d=a.topMiddle(),this.positionPoint(d,"50%",0,c);case"top-right":return d=a.topRight(),this.positionPoint(d,"100%",0,c);case"right":return d=a.rightMiddle(),this.positionPoint(d,"100%","50%",c);case"bottom-right":return d=a.bottomRight(),this.positionPoint(d,"100%","100%",c);case"bottom":return d=a.bottomMiddle(),this.positionPoint(d,"50%","100%",c);case"bottom-left":return d=a.bottomLeft(),this.positionPoint(d,0,"100%",c);case"left":return d=a.leftMiddle(),this.positionPoint(d,0,"50%",c);case"top-left":return d=a.topLeft(),this.positionPoint(d,0,0,c);default:throw new Error("Provided positionName ('"+b+"') was not recognized.")}},positionPoint:function(a,b,c,d){d=d||{};var e=joint.util.normalizeSides(d.padding),f=new g.Rect(this.getClientSize()),h=f.clone().moveAndExpand({x:e.left,y:e.top,width:-e.right-e.left,height:-e.top-e.bottom}),i=joint.util.isPercentage(b);b=parseFloat(b),i&&(b=b/100*Math.max(0,h.width)),b<0&&(b=h.width+b);var j=joint.util.isPercentage(c);c=parseFloat(c),j&&(c=c/100*Math.max(0,h.height)),c<0&&(c=h.height+c);var k=h.origin().offset(b,c),l=f.center(),m=l.difference(k),n=this.zoom(),o=m.scale(1/n,1/n),p=a.clone().offset(o);return this.center(p.x,p.y,d)},scroll:function(a,b,c){var d=this.options.paper.matrix(),e=this.getClientSize(),f={};if(joint.util.isNumber(a)){var g=e.width/2;f.scrollLeft=a-g+d.e+(this._padding.left||0)}if(joint.util.isNumber(b)){var h=e.height/2;f.scrollTop=b-h+d.f+(this._padding.top||0)}c&&c.animation?this.$el.animate(f,c.animation):this.$el.prop(f)},scrollToContent:function(a){var b=this.options.paper.getContentArea().center(),c=this._sx,d=this._sy;return b.x*=c,b.y*=d,this.scroll(b.x,b.y,a)},scrollToElement:function(a,b){this.checkElement(a,"scrollToElement");var c=a.getBBox().center(),d=this._sx,e=this._sy;return c.x*=d,c.y*=e,this.scroll(c.x,c.y,b)},addPadding:function(a,b,c,d){var e=this.getPadding(),f=this._padding={left:Math.round(e.left+(a||0)),top:Math.round(e.top+(c||0)),bottom:Math.round(e.bottom+(d||0)),right:Math.round(e.right+(b||0))};return this.$background.css({width:f.left+this.options.paper.options.width+f.right,height:f.top+this.options.paper.options.height+f.bottom}),this.options.paper.$el.css({left:f.left,top:f.top}),this},zoom:function(a,b){if(void 0===a)return this._sx;b=b||{};var c,d,e=this.getClientSize(),f=this.clientToLocalPoint(e.width/2,e.height/2),g=a,h=a;if(b.absolute||(g+=this._sx,h+=this._sy),b.grid&&(g=Math.round(g/b.grid)*b.grid,h=Math.round(h/b.grid)*b.grid),b.max&&(g=Math.min(b.max,g),h=Math.min(b.max,h)),b.min&&(g=Math.max(b.min,g),h=Math.max(b.min,h)),void 0===b.ox||void 0===b.oy)c=f.x,d=f.y;else{var i=g/this._sx,j=h/this._sy;c=b.ox-(b.ox-f.x)/i,d=b.oy-(b.oy-f.y)/j}return this.beforePaperManipulation(),this.options.paper.scale(g,h),this.center(c,d),this.afterPaperManipulation(),this},zoomToFit:function(a){a=a||{};var b=this.options.paper,c=joint.util.assign({},b.options.origin);return a.fittingBBox=a.fittingBBox||joint.util.assign({},new g.Point(c),{width:this.$el.width(),height:this.$el.height()}),this.beforePaperManipulation(),b.scaleContentToFit(a),b.setOrigin(c.x,c.y),this.adjustPaper().centerContent(),this.afterPaperManipulation(),this},transitionClassName:"transition-in-progress",transitionEventName:"transitionend.paper-scroller-transition",transitionToPoint:function(a,b,c){joint.util.isObject(a)&&(c=b,b=a.y,a=a.x),c||(c={});var d,e,f=this._sx,h=Math.max(c.scale||f,1e-6),i=this.getClientSize(),j=new g.Point(a,b),k=this.clientToLocalPoint(i.width/2,i.height/2);if(f===h){var l=k.difference(j).scale(f,f).round();d="translate("+l.x+"px,"+l.y+"px)"}else{var m=h/(f-h)*j.distance(k),n=k.clone().move(j,m),o=this.localToBackgroun
81dPoint(n).round();d="scale("+h/f+")",e=o.x+"px "+o.y+"px"}return this.$el.addClass(this.transitionClassName),this.$background.off(this.transitionEventName).on(this.transitionEventName,function(a){var b=this.paperScroller;b.syncTransition(this.scale,{x:this.x,y:this.y});var c=this.onTransitionEnd;joint.util.isFunction(c)&&c.call(b,a)}.bind({paperScroller:this,scale:h,x:a,y:b,onTransitionEnd:c.onTransitionEnd})).css({transition:"transform",transitionDuration:c.duration||"1s",transitionDelay:c.delay,transitionTimingFunction:c.timingFunction,transformOrigin:e,transform:d}),this},syncTransition:function(a,b){return this.beforePaperManipulation(),this.options.paper.scale(a),this.removeTransition().center(b.x,b.y),this.afterPaperManipulation(),this},removeTransition:function(){return this.$el.removeClass(this.transitionClassName),this.$background.off(this.transitionEventName).css({transition:"",transitionDuration:"",transitionDelay:"",transitionTimingFunction:"",transform:"",transformOrigin:""}),this},transitionToRect:function(a,b){a=new g.Rect(a),b||(b={});var c=b.maxScale||1/0,d=b.minScale||Number.MIN_VALUE,e=b.scaleGrid||null,f=b.visibility||1,h=b.center?new g.Point(b.center):a.center(),i=this.getClientSize(),j=i.width*f,k=i.height*f,l=new g.Rect({x:h.x-j/2,y:h.y-k/2,width:j,height:k}),m=l.maxRectUniformScaleToFit(a,h);return m=Math.min(m,c),e&&(m=Math.floor(m/e)*e),m=Math.max(d,m),this.transitionToPoint(h,joint.util.defaults({scale:m},b))},startPanning:function(a){a=joint.util.normalizeEvent(a),this._clientX=a.clientX,this._clientY=a.clientY,this.$el.addClass("is-panning"),this.trigger("pan:start",a),$(document.body).on({"mousemove.panning touchmove.panning":this.pan,"mouseup.panning touchend.panning":this.stopPanning}),$(window).on("mouseup.panning",this.stopPanning)},pan:function(a){a=joint.util.normalizeEvent(a);var b=a.clientX-this._clientX,c=a.clientY-this._clientY;this.el.scrollTop-=c,this.el.scrollLeft-=b,this._clientX=a.clientX,this._clientY=a.clientY},stopPanning:function(a){$(document.body).off(".panning"),$(window).off(".panning"),this.$el.removeClass("is-panning"),this.trigger("pan:stop",a)},getClientSize:function(){return{width:this.el.clientWidth,height:this.el.clientHeight}},getPadding:function(){var a=this.options.padding;return joint.util.isFunction(a)&&(a=a.call(this)),joint.util.normalizeSides(a)},getVisibleArea:function(){var a=this.options.paper.matrix(),b=this.getClientSize(),c={x:this.el.scrollLeft||0,y:this.el.scrollTop||0,width:b.width,height:b.height},d=V.transformRect(c,a.inverse());return d.x-=(this._padding.left||0)/this._sx,d.y-=(this._padding.top||0)/this._sy,new g.Rect(d)},isElementVisible:function(a,b){this.checkElement(a,"isElementVisible"),b=b||{};var c=b.strict?"containsRect":"intersect";return!!this.getVisibleArea()[c](a.getBBox())},isPointVisible:function(a){return this.getVisibleArea().containsPoint(a)},checkElement:function(a,b){if(!(a&&a instanceof joint.dia.Element))throw new TypeError("ui.PaperScroller."+b+"() accepts instance of joint.dia.Element only")},onRemove:function(){this.stopPanning()}}),joint.env.addTest("msie",function(){var a=window.navigator.userAgent;return a.indexOf("MSIE")!==-1||a.indexOf("Trident")!==-1}),joint.env.addTest("msedge",function(){return/Edge\/\d+/.test(window.navigator.userAgent)});
82joint.ui.Selection=joint.mvc.View.extend({options:{paper:void 0,graph:void 0,boxContent:function(a){return joint.util.template("<%= length %> elements selected.")({length:this.model.length})},handles:[{name:"remove",position:"nw",events:{pointerdown:"removeElements"}},{name:"rotate",position:"sw",events:{pointerdown:"startRotating",pointermove:"doRotate",pointerup:"stopBatch"}},{name:"resize",position:"se",events:{pointerdown:"startResizing",pointermove:"doResize",pointerup:"stopBatch"}}],useModelGeometry:!1,strictSelection:!1,rotateAngleGrid:15,allowTranslate:!0},className:"selection",events:{"mousedown .selection-box":"onSelectionBoxPointerDown","touchstart .selection-box":"onSelectionBoxPointerDown","mousedown .handle":"onHandlePointerDown","touchstart .handle":"onHandlePointerDown"},init:function(){this.options.model&&(this.options.collection=this.options.model);var a=this.collection=this.options.collection||this.collection||new Backbone.Collection;if(a.comparator||(a.comparator=this.constructor.depthComparator,a.sort()),this.model=a,!this.options.paper)throw new Error("Selection: paper required");joint.util.defaults(this.options,{graph:this.options.paper.model}),joint.util.bindAll(this,"startSelecting","stopSelecting","adjustSelection","pointerup"),$(document.body).on("mousemove.selection touchmove.selection",this.adjustSelection),$(document).on("mouseup.selection touchend.selection",this.pointerup);var b=this.options.paper,c=this.options.graph;this.listenTo(c,"reset",this.cancelSelection),this.listenTo(b,"scale translate",this.updateSelectionBoxes),this.listenTo(c,"remove change",function(a,b){b.selection!==this.cid&&this.updateSelectionBoxes()}),this.listenTo(a,"remove",this.onRemoveElement),this.listenTo(a,"reset",this.onResetElements),this.listenTo(a,"add",this.onAddElement),b.$el.append(this.$el),this._boxCount=0,this.$selectionWrapper=this.createSelectionWrapper(),this.handles=[],joint.util.toArray(this.options.handles).forEac
82h(this.addHandle,this)},cancelSelection:function(){this.model.reset([],{ui:!0})},addHandle:function(a){this.handles.push(a);var b=$("<div/>",{"class":"handle "+(a.position||"")+" "+(a.name||""),"data-action":a.name});return a.icon&&b.css("background-image","url("+a.icon+")"),b.html(a.content||""),joint.util.setAttributesBySelector(b,a.attrs),this.$selectionWrapper.append(b),joint.util.forIn(a.events,function(b,c){joint.util.isString(b)?this.on("action:"+a.name+":"+c,this[b],this):this.on("action:"+a.name+":"+c,b)}.bind(this)),this},stopSelecting:function(a){var b,c=this.options.paper;switch(this._action){case"selecting":var d=this.$el.offset(),e=this.$el.width(),f=this.$el.height();b=c.pageToLocalPoint(d.left,d.top);var h=c.scale();e/=h.sx,f/=h.sy;var i=g.rect(b.x,b.y,e,f),j=this.getElementsInSelectedArea(i),k=this.options.filter;Array.isArray(k)?j=j.filter(function(a){return!k.includes(a.model)&&!k.includes(a.model.get("type"))}):joint.util.isFunction(k)&&(j=j.filter(function(a){return!k(a.model)}));var l=j.map(function(a){return a.model});this.model.reset(l,{ui:!0});break;case"translating":this.options.graph.stopBatch("selection-translate"),b=c.snapToGrid({x:a.clientX,y:a.clientY}),this.notify("selection-box:pointerup",a,b.x,b.y);break;default:this._action||this.cancelSelection()}this._action=null},removeHandle:function(a){var b=joint.util.toArray(this.handles).findIndex(function(b){return b.name===a}),c=this.handles[b];return c&&(joint.util.forIn(c.events,function(b,c){this.off("action:"+a+":"+c)}.bind(this)),this.$(".handle."+a).remove(),this.handles.splice(b,1)),this},startSelecting:function(a){a=joint.util.normalizeEvent(a),this.cancelSelection();var b,c,d=this.options.paper.el;if(null!=a.offsetX&&null!=a.offsetY&&$.contains(d,a.target))b=a.offsetX,c=a.offsetY;else{var e=$(d).offset(),f=d.scrollLeft,g=d.scrollTop;b=a.clientX-e.left+window.pageXOffset+f,c=a.clientY-e.top+window.pageYOffset+g}this.$el.css({width:1,height:1,left:b,top:c}),this.showLasso(),this._action="selecting",this._clientX=a.clientX,this._clientY=a.clientY,this._offsetX=b,this._offsetY=c},changeHandle:function(a,b){var c=joint.util.toArray(this.handles).find(function(b){return b&&b.name===a});return c&&(this.removeHandle(a),this.addHandle(joint.util.merge({name:a},c,b))),this},onSelectionBoxPointerDown:function(a){a.stopPropagation(),a=joint.util.normalizeEvent(a),this.options.allowTranslate&&this.startTranslatingSelection(a),this._activeElementView=this.getCellView(a.target);var b=this.options.paper.snapToGrid({x:a.clientX,y:a.clientY});this.notify("selection-box:pointerdown",a,b.x,b.y)},startTranslatingSelection:function(a){this._action="translating",this.options.graph.startBatch("selection-translate");var b=this.options.paper.snapToGrid({x:a.clientX,y:a.clientY});this._snappedClientX=b.x,this._snappedClientY=b.y},adjustSelection:function(a){a=joint.util.normalizeEvent(a);var b,c;switch(this._action){case"selecting":b=a.clientX-this._clientX,c=a.clientY-this._clientY;var d=parseInt(this.$el.css("left"),10),e=parseInt(this.$el.css("top"),10);this.$el.css({left:b<0?this._offsetX+b:d,top:c<0?this._offsetY+c:e,width:Math.abs(b),height:Math.abs(c)});break;case"translating":var f=this.options.paper.snapToGrid({x:a.clientX,y:a.clientY}),g=f.x,h=f.y;b=g-this._snappedClientX,c=h-this._snappedClientY;var i=this.options.paper.getRestrictedArea();if(i){var j=this.model.toArray(),k=this.options.graph.getCellsBBox(j),l=i.x-k.x,m=i.y-k.y,n=i.x+i.width-(k.x+k.width),o=i.y+i.height-(k.y+k.height);b<l&&(b=l),c<m&&(c=m),b>n&&(b=n),c>o&&(c=o)}if(b||c){if(this.translateSelectedElements(b,c),this.boxesUpdated)this.model.length>1&&this.updateSelectionBoxes();else{var p=this.options.paper.scale();this.$el.children(".selection-box").add(this.$selectionWrapper).css({left:"+="+b*p.sx,top:"+="+c*p.sy})}this._snappedClientX=g,this._snappedClientY=h}this.notify("selection-box:pointermove",a,g,h);break;default:this._action&&this.pointermove(a)}this.boxesUpdated=!1},translateSelectedElements:function(a,b){var c={};this.model.each(function(d){if(!c[d.id]){var e={selection:this.cid};d.translate(a,b,e),d.getEmbeddedCells({deep:!0}
82).forEach(function(a){c[a.id]=!0});var f=this.options.graph.getConnectedLinks(d);f.forEach(function(d){c[d.id]||(d.translate(a,b,e),c[d.id]=!0)})}}.bind(this))},notify:function(a,b){var c=Array.prototype.slice.call(arguments,1);this.trigger.apply(this,[a,this._activeElementView].concat(c))},getElementsInSelectedArea:function(a){var b=this.options.paper,c={strict:this.options.strictSelection};if(this.options.useModelGeometry){var d=b.model.findModelsInArea(a,c);return d.map(b.findViewByModel,b).filter(function(a){return!!a})}return b.findViewsInArea(a,c)},pointerup:function(a){this._action&&(this.triggerAction(this._action,"pointerup",a),this.stopSelecting(a),this._activeElementView=null,this._action=null)},destroySelectionBox:function(a){this.$('[data-model="'+a.get("id")+'"]').remove(),0===this.$el.children(".selection-box").length&&this.hide(),this._boxCount=Math.max(0,this._boxCount-1)},hide:function(){this.$el.removeClass("lasso selected")},showSelected:function(){this.$el.addClass("selected")},showLasso:function(){this.$el.addClass("lasso")},destroyAllSelectionBoxes:function(){this.hide(),this.$el.children(".selection-box").remove(),this._boxCount=0},createSelectionBox:function(a){var b=a.findView(this.options.paper);if(b){var c=b.getBBox({useModelGeometry:this.options.useModelGeometry});$("<div/>").addClass("selection-box").attr("data-model",a.get("id")).css({left:c.x,top:c.y,width:c.width,height:c.height}).appendTo(this.el),this.showSelected(),this._boxCount++}},createSelectionWrapper:function(){var a=$("<div/>",{"class":"selection-wrapper"}),b=$("<div/>",{"class":"box"});return a.append(b),a.attr("data-selection-length",this.model.length),this.$el.prepend(a),a},updateSelectionWrapper:function(){var a={x:1/0,y:1/0},b={x:0,y:0};if(this.model.each(function(c){var d=this.options.paper.findViewByModel(c);if(d){var e=d.getBBox({useModelGeometry:this.options.useModelGeometry});a.x=Math.min(a.x,e.x),a.y=Math.min(a.y,e.y),b.x=Math.max(b.x,e.x+e.width),b.y=Math.max(b.y,e.y+e.height)}}.bind(this)),this.$selectionWrapper.css({left:a.x,top:a.y,width:b.x-a.x,height:b.y-a.y}).attr("data-selection-length",this.model.length),joint.util.isFunction(this.options.boxContent)){var c=this.$(".box"),d=this.options.boxContent.call(this,c[0]);d&&c.html(d)}},updateSelectionBoxes:function(){if(this._boxCount){this.hide();for(var a=this.$el.children(".selection-box"),b=0,c=a.length;b<c;b++){var d=a[b],e=$(d).remove().attr("data-model"),f=this.model.get(e);f&&this.createSelectionBox(f)}this.updateSelectionWrapper(),this.boxesUpdated=!0}},onRemove:function(){$(document.body).off(".selection",this.adjustSelection),$(document).off(".selection",this.pointerup)},onHandlePointerDown:function(a){this._action=$(a.target).closest(".handle").attr("data-action"),this._action&&(a.preventDefault(),a.stopPropagation(),a=joint.util.normalizeEvent(a),this._clientX=a.clientX,this._clientY=a.clientY,this._startClientX=this._clientX,this._startClientY=this._clientY,this.triggerAction(this._action,"pointerdown",a))},getCellView:function(a){var b=this.model.get(a.getAttribute("data-model"));return b&&b.findView(this.options.paper)},pointermove:function(a){if(this._action){var b=this.options.paper.snapToGrid({x:a.clientX,y:a.clientY}),c=this.options.paper.snapToGrid({x:this._clientX,y:this._clientY}),d=b.x-c.x,e=b.y-c.y;this.triggerAction(this._action,"pointermove",a,d,e,a.clientX-this._startClientX,a.clientY-this._startClientY),this._clientX=a.clientX,this._clientY=a.clientY}},triggerAction:function(a,b,c){var d=Array.prototype.slice.call(arguments,2);d.unshift("action:"+a+":"+b),this.trigger.apply(this,d)},onRemoveElement:function(a){this.destroySelectionBox(a),this.updateSelectionWrapper()},onResetElements:function(a){this.destroyAllSelectionBoxes(),a.each(this.createSelectionBox.bind(this)),this.updateSelectionWrapper()},onAddElement:function(a){this.createSelectionBox(a),this.updateSelectionWrapper()},removeElements:function(a){var b=this.collection.toArray();this.cancelSelection(),this.options.graph.removeCells(b,{selection:this.cid})},startRotating:function(a){this.options.graph.trigger("batch:start");var b=this.options.graph.getBBox(this.model.models).center(),c=this.options.paper.snapToGri
82d({x:a.clientX,y:a.clientY}),d=this.model.toArray().reduce(function(a,b){return a[b.id]=g.normalizeAngle(b.get("angle")||0),a},{});this._rotation={center:b,clientAngle:g.point(c).theta(b),initialAngles:d}},startResizing:function(a){var b=this.options.paper,c=this.options.graph,d=b.options.gridSize,e=this.model.toArray(),f=c.getBBox(e),g=joint.util.invoke(e,"getBBox"),h=g.reduce(function(a,b){return b.width<a?b.width:a},1/0),i=g.reduce(function(a,b){return b.height<a?b.height:a},1/0);this._resize={cells:c.getSubgraph(e),bbox:f,minWidth:d*f.width/h,minHeight:d*f.height/i},c.trigger("batch:start")},doResize:function(a,b,c){var d=this._resize,e=d.bbox,f=e.width,g=e.height,h=Math.max(f+b,d.minWidth),i=Math.max(g+c,d.minHeight);(Math.abs(f-h)>.001||Math.abs(g-i)>.001)&&(this.options.graph.resizeCells(h,i,d.cells,{selection:this.cid}),e.width=h,e.height=i,this.updateSelectionBoxes())},doRotate:function(a){var b=this._rotation,c=this.options.rotateAngleGrid,d=this.options.paper.snapToGrid({x:a.clientX,y:a.clientY}),e=b.clientAngle-g.point(d).theta(b.center);Math.abs(e)>.001&&(this.model.each(function(a){var d=g.snapToGrid(b.initialAngles[a.id]+e,c);a.rotate(d,!0,b.center,{selection:this.cid})},this),this.updateSelectionBoxes())},stopBatch:function(){this.options.graph.trigger("batch:stop")},getAction:function(){return this._action}},{depthComparator:function(a){return a.getAncestors().length}}),joint.ui.SelectionView=joint.ui.Selection;
83joint.ui.Clipboard=Backbone.Collection.extend({LOCAL_STORAGE_KEY:"joint.ui.Clipboard.cells",defaults:{useLocalStorage:!0},copyElements:function(a,b,c){this.options=joint.util.assign({},this.defaults,c),c=this.options;var d=a.toArray(),e=joint.util.sortBy(b.cloneSubgraph(d,c),function(a){return a.isLink()?2:1});return this.reset(e),c.useLocalStorage&&window.localStorage&&localStorage.setItem(this.LOCAL_STORAGE_KEY,JSON.stringify(this.toJSON())),d},cutElements:function(a,b,c){var d=this.copyElements(a,b,c);return b.trigger("batch:start",{batchName:"cut"}),joint.util.invoke(d,"remove"),b.trigger("batch:stop",{batchName:"cut"}),d},pasteCells:function(a,b){if(b=joint.util.defaults(b||{},this.options),b.useLocalStorage&&this.isEmpty()&&window.localStorage){var c={cells:JSON.parse(localStorage.getItem(this.LOCAL_STORAGE_KEY))},d=(new joint.dia.Graph).fromJSON(c,{sort:!1});this.reset(d.getCells())}var e=this.map(function(a){return this.modifyCell(a,b)}.bind(this));return a.trigger("batch:start",{batchName:"paste"}),a.addCells(e),a.trigger("batch:stop",{batchName:"paste"}),this.copyElements(this,a),e},clear:function(){this.options={},this.reset([]),window.localStorage&&localStorage.removeItem(this.LOCAL_STORAGE_KEY)},modifyCell:function(a,b){return a.unset("z"),a.isLink()&&b.link&&a.set(b.link),b.translate&&a.translate(b.translate.dx||20,b.translate.dy||20),a.collection=null,a}});
84!function(a){"use strict";var b=function(){this.options={handles:[{name:"remove",position:"nw",events:{pointerdown:"removeElement"},icon:null},{name:"direction",position:"se",events:{pointerdown:"directionSwap"},icon:null}],bbox:function(a){var b=.5*a.getConnectionLength();return a.getPointAtLength(b)},typeCssName:"type-link",tinyThreshold:-1,smallThreshold:-1,boxContent:!1}};b.prototype.directionSwap=function(){var a=this.options.cellView.model;a.set({source:a.get("target"),target:a.get("source")},{halo:this.cid})};var c=function(){this.options={handles:[{name:"remove",position:"nw",events:{pointerdown:"removeElement"},icon:null},{name:"resize",position:"se",events:{pointerdown:"startResizing",pointermove:"doResize",pointerup:"stopBatch"},icon:null},{name:"clone",position:"n",events:{pointerdown:"startCloning",pointermove:"doClone",pointerup:"stopCloning"},icon:null},{name:"link",position:"e",events:{pointerdown:"startLinking",pointermove:"doLink",pointerup:"stopLinking"},icon:null},{name:"fork",position:"ne",events:{pointerdown:"startForking",pointermove:"doFork",pointerup:"stopForking"},icon:null},{name:"unlink",position:"w",events:{pointerdown:"unlinkElement"},icon:null},{name:"rotate",position:"sw",events:{pointerdown:"startRotating",pointermove:"doRotate",pointerup:"stopBatch"},icon:null}],bbox:function(a,b){return a.getBBox({useModelGeometry:b.options.useModelGeometry})},typeCssName:"type-element",tinyThreshold:40,smallThreshold:80,boxContent:function(b,c){var d=a.util.template("x: <%= x %>, y: <%= y %>, width: <%= width %>, height: <%= height %>, angle: <%= angle %>"),e=b.model,f=e.getBBox();return d({x:Math.floor(f.x),y:Math.floor(f.y),width:Math.floor(f.width),height:Math.floor(f.height),angle:Math.floor(e.get("angle")||0)})},magnet:function(a){return a.el},loopLinkPreferredSide:"top",loopLinkWidth:40,rotateAngleGrid:15,linkAttributes:{},smoothLinks:void 0}};c.prototype.startLinking=function(a,b,c){this.startBatch();var d=this.options,e=d.paper,f=d.graph,g=this.createLinkConnectedToSource();g.set({target:{x:b,y:c}}).addTo(f,{validation:!1,halo:this.cid,async:!1});var h=this._linkView=g.findView(e);h.startArrowheadMove("target",{whenNotAllowed:"remove"})},c.prototype.startForking=function(b,c,d){var e=this.options,f=e.paper,g=e.graph;this.startBatch();var h=e.clone(e.cellView.model,{fork:!0});if(!(h instanceof a.dia.Cell))throw new Error('ui.Halo: option "clone" has to return a cell.');this.centerElementAtCursor(h,c,d),h.addTo(g,{halo:this.cid,async:!1});var i=this.createLinkConnectedToSource(),j=this._cloneView=h.findView(f),k=this.getElementMagnet(j,"target"),l=this.getLinkEnd(j,k);i.set("target",l).addTo(g,{halo:this.cid,async:!1}),j.pointerdown(b,c,d)},c.prototype.getElementMagnet=function(b,c){var d=this.options.magnet;if(a.util.isFunction(d)){var e=d.call(this,b,c);if(e instanceof SVGElement)return e}throw new Error("ui.Halo: magnet() has to return an SVGElement.")},c.prototype.getLinkEnd=function(a,b){var c={id:a.model.id};if(b!==a.el){var d=b.getAttribute("port");d?c.port=d:c.selector=a.getSelector(b)}return c},c.prototype.createLinkConnectedToSource=function(){var b=this.options,c=b.paper,d=b.cellView,e=this.getElementMagnet(d,"source"),f=this.getLinkEnd(d,e),g=c.getDefaultLink(d,e).set("source",f);return g.attr(b.linkAttributes),a.util.isBoolean(b.smoothLinks)&&g.set("smooth",b.smoothLinks),g},c.prototype.startResizing=function(a){this.startBatch(),this._flip=[1,0,0,1,1,0,0,1][Math.floor(g.normalizeAngle(this.options.cellView.model.get("angle"))/45)]},c.prototype.startRotating=function(a,b,c){this.startBatch();var d=this.options.cellView.model.getBBox().center(),e=g.normalizeAngle(this.options.cellView.model.get("angle"));this._center=d,this._rotationStartAngle=e||0,this._clientStartAngle=g.point(b,c).theta(d)},c.prototype.doResize=function(a,b,c,d,e){var f=this.options.cellView.model.get("size"),g=Math.max(f.width+(this._flip?d:e),1),h=Math.max(f.height+(this._flip?e:d),1);this.options.cellView.model.resize(g,h,{absolute:!0})},c.prototype.doRotate=function(a,b,c){var d=this._clientStartAngle-g.point(b,c).theta(this._center),e=g.snapToGri
84d(this._rotationStartAngle+d,this.options.rotateAngleGrid);this.options.cellView.model.rotate(e,!0)},c.prototype.doClone=function(a,b,c){var d=this._cloneView;d&&d.pointermove(a,b,c)},c.prototype.startCloning=function(b,c,d){var e=this.options;this.startBatch();var f=e.clone(e.cellView.model,{clone:!0});if(!(f instanceof a.dia.Cell))throw new Error('ui.Halo: option "clone" has to return a cell.');this.centerElementAtCursor(f,c,d),f.addTo(e.graph,{halo:this.cid,async:!1}),this._cloneView=f.findView(e.paper),this._cloneView.pointerdown(b,c,d)},c.prototype.centerElementAtCursor=function(a,b,c){var d=a.getBBox().center(),e=b-d.x,f=c-d.y;a.translate(e,f)},c.prototype.doFork=function(a,b,c){var d=this._cloneView;d&&d.pointermove(a,b,c)},c.prototype.doLink=function(a,b,c){this._linkView&&this._linkView.pointermove(a,b,c)},c.prototype.stopLinking=function(a){this._linkView&&(this._linkView.pointerup(a),this._linkView.model.hasLoop()&&this.makeLoopLink(this._linkView.model),this.stopBatch(),this.triggerAction("link","add",this._linkView.model),this._linkView=null)},c.prototype.stopForking=function(a,b,c){var d=this._cloneView;d&&d.pointerup(a,b,c),this.stopBatch()},c.prototype.stopCloning=function(a,b,c){var d=this._cloneView;d&&d.pointerup(a,b,c),this.stopBatch()},c.prototype.unlinkElement=function(a){this.startBatch(),this.options.graph.removeLinks(this.options.cellView.model),this.stopBatch()},c.prototype.makeLoopLink=function(b){var c,d,e=this.options.loopLinkWidth,f=this.options.paper.options,h=g.rect({x:0,y:0,width:f.width,height:f.height}),i=V(this.options.cellView.el).bbox(!1,this.options.paper.viewport),j=a.util.uniq([this.options.loopLinkPreferredSide,"top","bottom","left","right"]),k=j.find(function(a){var b,f=0,j=0;switch(a){case"top":b=g.point(i.x+i.width/2,i.y-e),f=e/2;break;case"bottom":b=g.point(i.x+i.width/2,i.y+i.height+e),f=e/2;break;case"left":b=g.point(i.x-e,i.y+i.height/2),j=e/2;break;case"right":b=g.point(i.x+i.width+e,i.y+i.height/2),j=e/2}return c=g.point(b).offset(-f,-j),d=g.point(b).offset(f,j),h.containsPoint(c)&&h.containsPoint(d)},this);k&&b.set("vertices",[c,d])},a.ui.Halo=a.mvc.View.extend({PIE_INNER_RADIUS:20,PIE_OUTER_RADIUS:50,className:"halo",events:{"mousedown .handle":"onHandlePointerDown","touchstart .handle":"onHandlePointerDown","mousedown .pie-toggle":"onPieTogglePointerDown","touchstart .pie-toggle":"onPieTogglePointerDown"},documentEvents:{mousemove:"pointermove",touchmove:"pointermove",mouseup:"pointerup",touchend:"pointerup"},options:{clearAll:!0,clearOnBlankPointerdown:!0,useModelGeometry:!1,clone:function(a,b){return a.clone().unset("z")},type:"surrounding",pieSliceAngle:45,pieStartAngleOffset:0,pieIconSize:14,pieToggles:[{name:"default",position:"e"}]},init:function(){var d=this.options,e=d.cellView,f=e.model,g=f.isLink()?new b:new c;a.util.assign(this,a.util.omit(g,"options"));var h=e.paper,i=h.model;a.util.defaults(d,g.options,{paper:h,graph:i}),a.util.bindAll(this,"render","update"),d.clearAll&&this.constructor.clear(h),this.listenTo(i,"reset",this.remove),this.listenTo(f,"remove",this.remove),this.listenTo(h,"halo:create",this.remove),d.clearOnBlankPointerdown&&this.listenTo(h,"blank:pointerdown",this.remove),this.listenTo(i,"all",this.update),this.listenTo(h,"scale translate",this.update),this.handles=[],a.util.toArray(d.handles).forEach(this.addHandle,this)},render:function(){var b=this.options;switch(this.$el.empty(),this.$handles=$("<div/>").addClass("handles").appendTo(this.el),this.$box=$("<label/>").addClass("box").appendTo(this.el),this.$pieToggles={},this.$el.addClass(b.type),this.$el.addClass(this.cellTypeCssClass()),this.$el.attr("data-type",b.cellView.model.get("type")),this.$handles.append(a.util.toArray(this.handles).map(this.renderHandle,this)),b.type){case"toolbar":case"surrounding":this.hasHandle("fork")&&this.toggleFork();break;case"pie":a.util.toArray(this.options.pieToggles).forEach(function(b){var c=$("<div/>");c.addClass("pie-toggle "+(b.position||"e")),c.attr("data-name",b.name),a.util.setAttributesBySelector(c,b.attrs),c.appendTo(this.el),this.$pieToggles[b.name]=c},this);break;default:throw new Error("ui.Halo: unknown type")}return this.update(),this.$el.addClass("animate").appendTo(b.paper.el),this.setPieIcons(),this},setPieIcons:function(){"pie"===this.options.type&&this.$el.find(".handle").each(function(a,b){var c,d=$(b),e=d.attr("data-action"),f=this.getHandle(e);
84if(!f||!f.icon){var g=window.getComputedStyle(b,":before").getPropertyValue("content");g&&"none"!==g&&(c=d.find(".slice-text-icon"),c.length>0&&V(c[0]).text(g.replace(/['"]/g,"")));var h=d.css("background-image");if(h){var i=h.match(/url\(['"]?([^'"]+)['"]?\)/);if(i){var j=i[1];c=d.find(".slice-img-icon"),c.length>0&&V(c[0]).attr("xlink:href",j)}}}}.bind(this))},update:function(){if(this.isRendered()){this.updateBoxContent();var a=this.getBBox();this.$el.toggleClass("tiny",a.width<this.options.tinyThreshold&&a.height<this.options.tinyThreshold),this.$el.toggleClass("small",!this.$el.hasClass("tiny")&&a.width<this.options.smallThreshold&&a.height<this.options.smallThreshold),this.$el.css({width:a.width,height:a.height,left:a.x,top:a.y}),this.hasHandle("unlink")&&this.toggleUnlink()}},getBBox:function(){var b=this.options.cellView,c=this.options.bbox,d=a.util.isFunction(c)?c(b,this):c;return d=a.util.defaults({},d,{x:0,y:0,width:1,height:1}),g.rect(d)},cellTypeCssClass:function(){return this.options.typeCssName},updateBoxContent:function(){var b=this.options.boxContent,c=this.options.cellView;if(a.util.isFunction(b)){var d=b.call(this,c,this.$box[0]);d&&this.$box.html(d)}else b?this.$box.html(b):this.$box.remove()},extendHandles:function(b){a.util.forIn(b,function(b){var c=this.getHandle(b.name);c&&a.util.assign(c,b)}.bind(this))},addHandles:function(b){return a.util.toArray(b).forEach(this.addHandle,this),this},addHandle:function(b){var c=this.getHandle(b.name);return c||(this.handles.push(b),a.util.forIn(b.events,function(c,d){a.util.isString(c)?this.on("action:"+b.name+":"+d,this[c],this):this.on("action:"+b.name+":"+d,c)}.bind(this)),this.$handles&&this.renderHandle(b).appendTo(this.$handles)),this},renderHandle:function(b){var c=this.getHandleIdx(b.name),d=$("<div/>").addClass("handle").addClass(b.name).attr("data-action",b.name).prop("draggable",!1);switch(this.options.type){case"toolbar":case"surrounding":d.addClass(b.position),b.content&&d.html(b.content);break;case"pie":var e=this.PIE_OUTER_RADIUS,f=this.PIE_INNER_RADIUS,h=(e+f)/2,i=g.point(e,e),j=g.toRad(this.options.pieSliceAngle),k=c*j+g.toRad(this.options.pieStartAngleOffset),l=k+j,m=V.createSlicePathData(f,e,k,l),n=V("svg").addClass("slice-svg"),o=V("path").attr("d",m).translate(e,e).addClass("slice"),p=g.point.fromPolar(h,-k-j/2,i),q=this.options.pieIconSize,r=V("image").attr(p).addClass("slice-img-icon");p.y=p.y+q-2;var s=V("text",{"font-size":q}).attr(p).addClass("slice-text-icon");r.attr({width:q,height:q}),r.translate(-q/2,-q/2),s.translate(-q/2,-q/2),n.append([o,r,s]),d.append(n.node)}return b.icon&&this.setHandleIcon(d,b.icon),a.util.setAttributesBySelector(d,b.attrs),d},setHandleIcon:function(a,b){switch(this.options.type){case"pie":var c=a.find(".slice-img-icon");V(c[0]).attr("xlink:href",b);break;case"toolbar":case"surrounding":a.css("background-image","url("+b+")")}},removeHandles:function(){for(;this.handles.length;)this.removeHandle(this.handles[0].name);return this},removeHandle:function(b){var c=this.getHandleIdx(b),d=this.handles[c];return d&&(a.util.forIn(d.events,function(a,c){this.off("action:"+b+":"+c)}.bind(this)),this.$(".handle."+b).remove(),this.handles.splice(c,1)),this},changeHandle:function(b,c){var d=this.getHandle(b);return d&&(this.removeHandle(b),this.addHandle(a.util.merge({name:b},d,c))),this},hasHandle:function(a){return this.getHandleIdx(a)!==-1},getHandleIdx:function(b){return a.util.toArray(this.handles).findIndex(function(a){return a.name===b})},getHandle:function(b){return a.util.toArray(this.handles).find(function(a){return a.name===b})},toggleHandle:function(a,b){var c=this.getHandle(a);if(c){var d=this.$(".handle."+a);void 0===b&&(b=!d.hasClass("selected")),d.toggleClass("selected",b);var e=b?c.iconSelected:c.icon;e&&this.setHandleIcon(d,e)}return this},selectHandle:function(a){return this.toggleHandle(a,!0)},deselectHandle:function(a){return this.toggleHandle(a,!1)},deselectAllHandles:function(){return a.util.toArray(this.handles).forEach(function(a){this.deselectHandle(a.name)},this),this},onHandlePointerDown:function(b){var c=this._action=$(b.target).closest(".handle").attr("data-action");if(c){b.preventDefault(),b.stopPropagation(),b=a.util.normalizeEvent(b);
84var d=this.options.paper.snapToGrid({x:b.clientX,y:b.clientY}),e=d.x,f=d.y;this._localX=e,this._localY=f,this._evt=b,"mousedown"===b.type&&2===b.button?this.triggerAction(c,"contextmenu",b,e,f):(this.triggerAction(c,"pointerdown",b,e,f),this.delegateDocumentEvents(null,b.data))}},onPieTogglePointerDown:function(a){a.stopPropagation();var b=$(a.target).closest(".pie-toggle"),c=b.attr("data-name");this.isOpen(c)?this.toggleState(c):this.isOpen()?(this.toggleState(),this.toggleState(c)):this.toggleState(c)},triggerAction:function(a,b,c){var d=Array.prototype.slice.call(arguments,2);d.unshift("action:"+a+":"+b),this.trigger.apply(this,d)},stopBatch:function(){this.options.graph.stopBatch("halo",{halo:this.cid})},startBatch:function(){this.options.graph.startBatch("halo",{halo:this.cid})},pointermove:function(b){if(this._action){b.preventDefault(),b.stopPropagation(),b=a.util.normalizeEvent(b);var c=this.options.paper.snapToGrid({x:b.clientX,y:b.clientY}),d=c.x-this._localX,e=c.y-this._localY;this._localX=c.x,this._localY=c.y,this._evt=b,this.triggerAction(this._action,"pointermove",b,c.x,c.y,d,e)}},pointerup:function(a){var b=this._action;if(b){this._action=null,this._evt=null;var c=this.options.paper.snapToGrid({x:a.clientX,y:a.clientY});this.triggerAction(b,"pointerup",a,c.x,c.y),this.undelegateDocumentEvents()}},onRemove:function(){this._action&&this._evt&&this.pointerup(this._evt),this.options.graph.hasActiveBatch("halo")&&this.stopBatch()},onSetTheme:function(){this.setPieIcons()},removeElement:function(){this.options.cellView.model.remove()},toggleUnlink:function(){var a=this.options.graph.getConnectedLinks(this.options.cellView.model).length>0;this.$handles.children(".unlink").toggleClass("hidden",!a)},toggleFork:function(){var a=this.options.cellView.model.clone(),b=this.options.paper.createViewForModel(a),c=this.options.paper.options.validateConnection(this.options.cellView,null,b,null,"target");this.$handles.children(".fork").toggleClass("hidden",!c),b.remove(),a=null},toggleState:function(b){if(this.isRendered()){var c=this.$el;if(a.util.forIn(this.$pieToggles,function(a){a.removeClass("open")}),this.isOpen())this.trigger("state:close",b),c.removeClass("open");else{if(this.trigger("state:open",b),b){var d=a.util.toArray(this.options.pieToggles).find(function(a){return a.name===b});d&&c.attr({"data-pie-toggle-position":d.position,"data-pie-toggle-name":d.name}),this.$pieToggles[b].addClass("open")}c.addClass("open")}}},isOpen:function(a){return!!this.isRendered()&&(a?this.$pieToggles[a].hasClass("open"):this.$el.hasClass("open"))},isRendered:function(){return void 0!==this.$box}},{clear:function(a){a.trigger("halo:create")}})}(joint);
85!function(a){a.ui.Toolbar=a.mvc.View.extend({options:{},align:["left","right"],className:"toolbar",defaultGroup:"default",widgets:[],groupViews:[],init:function(){this.tools=a.util.toArray(this.options.tools),this.groups=this.options.groups||{}},getWidgetByName:function(a){return this.widgets.find(function(b){return b.options.name===a})},getWidgets:function(){return this.widgets},groupsWithItemsPairs:function(){var b={};this.tools.forEach(function(a){var c=a.group||this.defaultGroup;b[c]=b[c]||{items:[],group:{}},b[c].items.push(a),b[c].group=this.groups[c]||{}},this);for(var c=Object.keys(b),d=[],e=0,f=c.length;e<f;e++){var g=c[e];d.push([g,b[g]])}var h=a.util.sortBy(d,function(a){return a[1].group.index});return a.util.sortBy(h,function(a){return a[1].group.align||"left"})},render:function(){var a=this.groupsWithItemsPairs(),b=!1;return a.forEach(function(a){var c=a[0],d=a[1],e=this.renderGroup(c,d);!b&&d.group.align&&"right"===d.group.align&&(b=!0,e.addClass("group-first")),e.appendTo(this.el)},this),this},renderGroup:function(a,c){var d=new b({name:a,align:c.group.align,items:c.items,references:this.options.references});return this.groupViews.push(d),d.on("all",function(){this.trigger.apply(this,arguments)}.bind(this)),d.render(),this.widgets=this.widgets.concat(d.widgets),d.$el},onRemove:function(){a.util.invoke(this.groupViews,"off"),a.util.invoke(this.groupViews,"remove")}});var b=a.mvc.View.extend({className:"toolbar-group",init:function(){this.widgets=[]},onRender:function(){this.$el.attr("data-group",this.options.name),this.$el.addClass(this.options.align),this.renderItems()},renderItems:function(){a.util.toArray(this.options.items).forEac
85h(function(a){var b=this.createWidget(a);this.$el.append(b.$el)},this)},createWidget:function(b){var c=a.ui.Widget.create(b,this.options.references);return c.on("all",function(a){var c=Array.prototype.slice.call(arguments,1);this.trigger.apply(this,[b.name+":"+a].concat(c))}.bind(this)),this.widgets.push(c),c},onRemove:function(){a.util.invoke(this.widgets,"off"),a.util.invoke(this.widgets,"remove")}})}(joint),function(a,b){a.ui.Widget=a.mvc.View.extend({className:"widget",references:[],constructor:function(b,c){this.availableReferences=c||{},a.mvc.View.prototype.constructor.call(this,b)},updateAttrs:function(b){a.util.setAttributesBySelector(this.$el,b)},bindEvents:function(){},validateReferences:function(){var a=this.references||[],b=[];return a.forEach(function(a){void 0===this.availableReferences[a]&&b.push(a)},this),b},getReference:function(a){return this.availableReferences[a]},getReferences:function(){return this.availableReferences}},{create:function(b,c){var d=a.util.camelCase(a.util.isString(b)?b:b.type);if(!a.util.isFunction(a.ui.widgets[d]))throw new Error('Widget: unable to find widget: "'+d+'"');var e=new a.ui.widgets[d](b,c),f=e.validateReferences(c);if(f.length>0)throw new Error('Widget: "'+d+'" missing dependency: '+f.join(", "));return e.render(),e.updateAttrs(b.attrs),e.bindEvents(),e.$el.attr("data-type",d),b.name&&e.$el.attr("data-name",b.name),e}}),a.ui.widgets={checkbox:a.ui.Widget.extend({tagName:"label",events:{"change .input":"onChange",mousedown:"pointerdown",touchstart:"pointerdown",mouseup:"pointerup",touchend:"pointerup"},init:function(){a.util.bindAll(this,"pointerup")},render:function(){var a=this.options,c=b("<span/>").text(a.label||"");return this.$input=b("<input/>",{type:"checkbox","class":"input"}).prop("checked",!!a.value),this.$span=b("<span/>"),this.$el.append([c,this.$input,this.$span]),this},onChange:function(a){this.trigger("change",!!a.target.checked,a)},pointerdown:function(c){c=a.util.normalizeEvent(c),this.$el.addClass("is-in-action"),this.trigger("pointerdown",c),b(document).on("mouseup.checkbox touchend.checkbox",this.pointerup)},pointerup:function(c){c=a.util.normalizeEvent(c),b(document).off("mouseup.checkbox touchend.checkbox"),this.trigger("pointerdown",c),this.$el.removeClass("is-in-action")}}),toggle:a.ui.Widget.extend({tagName:"label",events:{"change input.toggle":"onChange",mousedown:"pointerdown",touchstart:"pointerdown",mouseup:"pointerup",touchend:"pointerup"},init:function(){a.util.bindAll(this,"pointerup")},render:function(){var a=this.options,c=b("<span/>").text(a.label||""),d=b("<span><i/></span>"),e=b("<input/>",{type:"checkbox","class":"toggle"}).prop("checked",!!a.value),f=b("<div/>").addClass(a.type);return this.$el.append([c,f.append(e,d)]),this},onChange:function(a){this.trigger("change",!!a.target.checked,a)},pointerdown:function(c){c=a.util.normalizeEvent(c),this.$el.addClass("is-in-action"),this.trigger("pointerdown",c),b(document).on("mouseup.toggle touchend.toggle",this.pointerup)},pointerup:function(c){c=a.util.normalizeEvent(c),b(document).off("mouseup.toggle touchend.toggle"),this.$el.removeClass("is-in-action"),this.trigger("pointerup",c)}}),separator:a.ui.Widget.extend({render:function(){return this.options.width&&this.$el.css({width:this.options.width}),this}}),label:a.ui.Widget.extend({tagName:"label",render:function(){return this.$el.text(this.options.text),this}}),range:a.ui.Widget.extend({events:{"change .input":"onChange","input .input":"onChange"},render:function(){var a,c=this.options;return this.$output=b("<output/>").text(c.value),a=b("<span/>").addClass("units").text(c.unit),this.$input=b("<input/>",{type:"range",name:c.type,min:c.min,max:c.max,step:c.step,"class":"input"}).val(c.value),this.$el.append([this.$input,this.$output,a]),this},onChange:function(a){var b=parseInt(this.$input.val(),10);b!==this.currentValue&&(this.currentValue=b,this.$output.text(b),this.trigger("change",b,a))},setValue:function(a){this.$input.val(a),this.$input.trigger("change")}}),selectBox:a.ui.Widget.extend({render:function(){var b=a.util.omit(this.options,"type","group","index");return this.selectBox=new a.ui.SelectBox(b),this.selectBox.render().$el.appendTo(this.el),this},bindEvents:function(){this.selectBox.on("all",this.trigger,this)}}),button:a.ui.Widget.extend({events:{mousedown:"pointerdown",touchstart:"pointerdown",click:"pointerclick",touchend:"pointerclick"},tagName:"button",render:function(){var a=this.options;return this.$el.text(a.text),this},pointerclick:function(b){b=a.util.normalizeEvent(b),this.trigger("pointerclick",b)},pointerdown:function(b){b=a.util.normalizeEvent(b),this.trigger("pointerdown",b)}}),inputText:a.ui.Widget.extend({events:{mousedown:"pointerdown",touchstart:"pointerdown",mouseup:"pointerup",touchend:"pointerup",click:"pointerclick",focusin:"pointerfocusin",focusout:"pointerfocusout"},tagName:"div",render:function(){var a=this.options;return this.$label=b("<label/>
85").text(a.label),this.$input=b("<div/>").addClass("input-wrapper").append(b("<input/>",{type:"text","class":"input"}).val(a.value)),this.$el.append([this.$label,this.$input]),this},pointerclick:function(b){b=a.util.normalizeEvent(b),this.trigger("pointerclick",b)},pointerdown:function(b){b=a.util.normalizeEvent(b),this.trigger("pointerdown",b)},pointerup:function(b){b=a.util.normalizeEvent(b),this.trigger("pointerup",b)},pointerfocusin:function(b){b=a.util.normalizeEvent(b),this.$el.addClass("is-focused"),this.trigger("pointerfocusin",b)},pointerfocusout:function(b){b=a.util.normalizeEvent(b),this.$el.removeClass("is-focused"),this.trigger("pointerfocusout",b)}}),inputNumber:a.ui.Widget.extend({events:{mousedown:"pointerdown",touchstart:"pointerdown",mouseup:"pointerup",touchend:"pointerup",click:"pointerclick",focusin:"pointerfocusin",focusout:"pointerfocusout"},tagName:"div",render:function(){var a=this.options;return this.$label=b("<label/>").text(a.label),this.$input=b("<div/>").addClass("input-wrapper").append(b("<input/>",{type:"number","class":"number",max:a.max,min:a.min}).val(a.value)),this.$el.append([this.$label,this.$input]),this},pointerclick:function(b){b=a.util.normalizeEvent(b),this.trigger("pointerclick",b)},pointerdown:function(b){b=a.util.normalizeEvent(b),this.trigger("pointerdown",b)},pointerup:function(b){b=a.util.normalizeEvent(b),this.trigger("pointerup",b)},pointerfocusin:function(b){b=a.util.normalizeEvent(b),this.$el.addClass("is-focused"),this.trigger("pointerfocusin",b)},pointerfocusout:function(b){b=a.util.normalizeEvent(b),this.$el.removeClass("is-focused"),this.trigger("pointerfocusout",b)}}),textarea:a.ui.Widget.extend({events:{mousedown:"pointerdown",touchstart:"pointerdown",mouseup:"pointerup",touchend:"pointerup",click:"pointerclick",focusin:"pointerfocusin",focusout:"pointerfocusout"},tagName:"div",render:function(){var a=this.options;return this.$label=b("<label/>").text(a.label),this.$input=b("<div/>").addClass("input-wrapper").append(b("<textarea/>",{"class":"textarea"}).text(a.value)),this.$el.append([this.$label,this.$input]),this},pointerclick:function(b){b=a.util.normalizeEvent(b),this.trigger("pointerclick",b)},pointerdown:function(b){b=a.util.normalizeEvent(b),this.trigger("pointerdown",b)},pointerup:function(b){b=a.util.normalizeEvent(b),this.trigger("pointerup",b)},pointerfocusin:function(b){b=a.util.normalizeEvent(b),this.$el.addClass("is-focused"),this.trigger("pointerfocusin",b)},pointerfocusout:function(b){b=a.util.normalizeEvent(b),this.$el.removeClass("is-focused"),this.trigger("pointerfocusout",b)}}),selectButtonGroup:a.ui.Widget.extend({render:function(){var b=a.util.omit(this.options,"type","group","index");return this.selectButtonGroup=new a.ui.SelectButtonGroup(b),this.selectButtonGroup.render().$el.appendTo(this.el),this},bindEvents:function(){this.selectButtonGroup.on("all",this.trigger,this)}})},a.ui.widgets.zoomIn=a.ui.widgets.button.extend({references:["paperScroller"],options:{min:.2,max:5,step:.2},pointerdown:function(b){var c=this.options;this.getReferences().paperScroller.zoom(c.step,{max:c.max,grid:c.step}),a.ui.widgets.button.prototype.pointerdown.call(this,b)}}),a.ui.widgets.zoomOut=a.ui.widgets.button.extend({references:["paperScroller"],options:{min:.2,max:5,step:.2},pointerdown:function(b){var c=this.options;this.getReferences().paperScroller.zoom(-c.step,{min:c.min,grid:c.step}),a.ui.widgets.button.prototype.pointerdown.call(this,b)}}),a.ui.widgets.zoomToFit=a.ui.widgets.button.extend({references:["paperScroller"],options:{min:.2,max:5,step:.2},pointerdown:function(b){var c=this.options;this.getReferences().paperScroller.zoomToFit({padding:20,scaleGrid:c.step,minScale:c.min,maxScale:c.max}),a.ui.widgets.button.prototype.pointerdown.call(this,b)}}),a.ui.widgets.zoomSlider=a.ui.widgets.range.extend({references:["paperScroller"],options:{min:20,max:500,step:20,value:100,unit:" %"},bindEvents:function(){this.on("change",function(a){this.getReferences().paperScroller.zoom(a/100,{absolute:!0,grid:this.options.step/100})},this),this.getReferences().paperScroller.options.paper.on("scale",function(a){this.setValue(Math.floor(100*a))},this)}}),a.ui.widgets.undo=a.ui.widgets.button.extend({references:["commandManager"],pointerclick:function(){this.getReferences().commandManager.undo()}}),a.ui.widgets.redo=a.ui.widgets.button.extend({references:["commandManager"],pointerclick:function(){this.getReferences().commandManager.redo()}}),a.ui.widgets.fullscreen=a.ui.widgets.button.extend({onRender:function(){var a=this.target=b(this.options.target)[0];a&&!b.contains(window.top.document,a)&&this.$el.hide()},pointerclick:function(){a.util.toggleFullScreen(this.target)}})}(joint,$);
86!function(a,b){var c={options:function(){return{columnWidth:this.options.width/2-10,columns:2,rowHeight:80,resizeToFit:!0,dy:10,dx:10}},layoutGroup:function(c,d){var e=this.options.layout;if(d=d||{},!a.layout.GridLayout)throw new Error("joint.ui.Stencil: joint.layout.GridLayout is not available.");a.layout.GridLayout.layout(c,b.assign({},e,d.layout))}};a.ui.Stencil=a.mvc.View.extend({className:"stencil",events:{"click .btn-expand":"openGroups","click .btn-collapse":"closeGroups","click .groups-toggle > .group-label":"openGroups","click .group > .group-label":"onGroupLabelClick","touchstart .group > .group-label":"onGroupLabelClick","input .search":"onSearch","focusin .search":"pointerFocusIn","focusout .search":"pointerFocusOut"},documentEvents:{mousemove:"onDrag",touchmove:"onDrag",mouseup:"onDragEnd",touchend:"onDragEnd",touchcancel:"onDragEnd"},options:{width:200,height:800,label:"Stencil",groups:null,groupsToggleButtons:!1,dropAnimation:!1,search:null,layout:null,snaplines:null,
86scaleClones:!1,dragStartClone:function(a){return a.clone()},dragEndClone:function(a){return a.clone()},layoutGroup:null,paperOptions:null},init:function(){this.setPaper(this.options.paperScroller||this.options.paper),this.graphs={},this.papers={},this.$groups={},this.onSearch=b.debounce(this.onSearch,200),this.delegateEvents(),this.initializeLayout()},initializeLayout:function(){var a=this.options.layout;a&&(b.isFunction(a)?this.layoutGroup=a:(this.layoutGroup=c.layoutGroup.bind(this),this.options.layout=b.isObject(a)?a:{},b.defaults(this.options.layout,c.options.call(this))))},setPaper:function(b){var c=this.options;if(b instanceof a.dia.Paper)c.paperScroller=null,c.paper=b,c.graph=b.model;else{if(!("function"==typeof a.ui.PaperScroller&&b instanceof a.ui.PaperScroller))throw new Error("Stencil: paper required");c.paperScroller=b,c.paper=b.options.paper,c.graph=b.options.paper.model}},renderContent:function(){return $("<div/>").addClass("content")},renderPaperDrag:function(){return $("<div/>").addClass("stencil-paper-drag")},renderSearch:function(){return $("<div/>").addClass("search-wrap").append($("<input/>",{type:"search",placeholder:"search"}).addClass("search"))},renderToggleAll:function(){return[$("<div/>").addClass("groups-toggle").append($("<label/>").addClass("group-label").html(this.options.label)).append($("<button/>",{text:"+"}).addClass("btn btn-expand")).append($("<button/>",{text:"-"}).addClass("btn btn-collapse"))]},renderElementsContainer:function(){return $("<div/>").addClass("elements")},renderGroup:function(a){a=a||{};var b=$("<div/>").addClass("group").attr("data-name",a.name).toggleClass("closed",!!a.closed),c=$("<h3/>").addClass("group-label").html(a.label||a.name),d=this.renderElementsContainer();return b.append(c,d)},render:function(){var c=this.options;this.$content=this.renderContent(),this.$paperDrag=this.renderPaperDrag(),this.$el.empty().append(this.$paperDrag,this.$content),c.search&&this.$el.addClass("searchable").prepend(this.renderSearch()),c.groupsToggleButtons&&this.$el.addClass("collapsible").prepend(this.renderToggleAll());var d=b.defaults({interactive:!1,preventDefaultBlankAction:!1},c.paperOptions),e=Object.keys(c.groups||{});if(e.length>0){var f=b.sortBy(e,function(a){return this[a].index}.bind(c.groups));f.forEach(function(e){var f=this.options.groups[e],g=this.$groups[e]=this.renderGroup({name:e,label:f.label,closed:f.closed}).appendTo(this.$content),h=new a.dia.Graph,i=b.assign({},d,f.paperOptions,{el:g.find(".elements"),model:h,width:f.width||c.width,height:f.height||c.height}),j=new a.dia.Paper(i);this.graphs[e]=h,this.papers[e]=j},this)}else{var g=this.renderElementsContainer().appendTo(this.$content),h=new a.dia.Graph,i=new a.dia.Paper(b.assign(d,{el:g,model:h,width:c.width,height:c.height}));this.graphs.__default__=h,this.papers.__default__=i}return this._graphDrag=new a.dia.Graph,this._paperDrag=new a.dia.Paper({el:this.$paperDrag,width:1,height:1,model:this._graphDrag}),this.startListening(),this},startListening:function(){this.stopListening(),b.forIn(this.papers,function(a){this.listenTo(a,"cell:pointerdown",this.onDragStart)}.bind(this))},load:function(a,c){Array.isArray(a)?this.loadGroup(a,c):b.isObject(a)&&b.forIn(this.options.groups,function(b,c){a[c]&&this.loadGroup(a[c],c)}.bind(this))},loadGroup:function(a,b){var c=this.getGraph(b);c.resetCells(a);var d=this.options.height;if(b&&(d=this.getGroup(b).height),this.isLayoutEnabled()&&this.layoutGroup(c,this.getGroup(b)),!d){var e=this.getPaper(b);e.fitToContent({minWidth:e.options.width,gridHeight:1,padding:this.options.paperPadding||10})}},isLayoutEnabled:function(){return!!this.options.layout},getGraph:function(a){var b=this.graphs[a||"__default__"];if(!b)throw new Error("Stencil: group "+a+" does not exist.");return b},getPaper:function(a){return this.papers[a||"__default__"]},preparePaperForDragging:function(a,b,c){var d=this._paperDrag,e=this._graphDrag;d.$el.addClass("dragging").appendTo(document.body);var f=this.options.dragStartClone(a.model).position(0,0),g=5,h=this.options.snaplines;if(h&&(g+=h.options.distance),h||this.options.scaleClones){var i=this.options.paper.scale();d.scale(i.sx,i.sy),g*=Math.max(i.sx,i.sy)}else d.scale(1,1);this.clearClone(),this.options.dropAnimation&&this._paperDrag.$el.stop(!0,!0),e.resetCells([f.position(0,0)]);var j=f.findView(d);j.stopListening(),d.fitToContent({padding:g,allowNewOrigin:"any"});var k=j.getBBox(),l=this._cloneGeometryBBox=j.getBBox({useModelGeometry:!0});this._cloneViewDeltaOrigin=l.origin().difference(k.origin()),this._cloneBBox=f.getBBox(),this._clone=f,this._cloneView=j,this._paperDragPadding=g,this._paperDragInitialOffset=this.setPaperDragOffset(b,c)},setPaperDragOffset:function(a,b){var c=document.body.scrollTop||document.documentElement.scrollTop,d=this._cloneViewDeltaOrigin,e=this._cloneGeometryBBox,f=this._paperDragPadding||5,g={left:a-d.x-e.width/2-f,top:b-d.y-e.height/2-f+c};return this._paperDrag.$el.offset(g),g},setCloneLocalPosition:function(a,b){var c=this.options.paper.clientToLocalPoint({x:a,y:b}),d=this._cloneBBox;return c.x-=d.width/2,c.y-=d.height/2,this._clone.set("position",c),c},onDragStart:function(a,b){b.preventDefault(),this.options.graph.startBatch("stencil-drag"),this.$el.addClass("dragging"),this.preparePaperForDragging(a,b.clientX,b.clientY);var c=this.setCloneLocalPosition(b.clientX,b.clientY),d=this._cloneView,e=this.options.snaplines;e&&(e.captureCursorOffset(this._cloneView,b,c.x,c.y),d.listenTo(this._clone,"change:position",this.onCloneSnapped.bind(this))),this.delegateDocumentEvents(null,b.data)},onCloneSnapped:function(a,b,c){if(c.snapped){var d=this._cloneBBox;a.position(d.x+c.tx,d.y+c.ty,{silent:!0}),this._cloneView.translate(),a.set("position",b,{silent:!0}),this._cloneSnapOffset={x:c.tx,y:c.ty}}else this._cloneSnapOffset=null},onDrag:function(a){var c=this._cloneView;if(c){a.preventDefault(),a=b.normalizeEvent(a);var d=a.clientX,e=a.clientY;this.setPaperDragOffset(d,e);var f=this.setCloneLocalPosition(d,e),g=this.options.paper.options.embeddingMode,h=this.options.snaplines,i=(g||h)&&this.insideValidArea({x:d,y:e});if(g){c.eventData(a,{paper:this.options.paper});var j=c.eventData(a);i?c.processEmbedding(j):c.clearEmbedding(j)}h&&(i?h.snapWhileMoving(c,a,f.x,f.y):h.hide())}},onDragEnd:function(a){var c=this._clone;if(c){a=b.normalizeEvent(a);var d=this._cloneView,e=this._cloneBBox,f=this._cloneSnapOffset,g=e.x,h=e.y;f&&(g+=f.x,h+=f.y),c.position(g,h,{silent:!0});var i=this.options.dragEndClone(c),j=this.drop(i,{x:a.clientX,y:a.clientY});j?this.onDropEnd(c):this.onDropInvalid(a,i),this.options.paper.options.embeddingMode&&d&&(d.eventData(a,{model:i,paper:this.options.paper}),d.finalizeEmbedding(d.eventData(a))),this.options.graph.stopBatch("stencil-drag")}},onDropEnd:function(a){this._clone===a&&(this.clearClone(),this.$el.append(this._paperDrag.$el),this.$el.removeClass("dragging"),this._paperDrag.$el.removeClass("dragging"))},clearClone:function(){this._clone&&(this._clone.remove(),this._clone=null,this._cloneView=null,this._cloneSnapOffset=null,this._paperDragInitialOffset=null,this._paperDragPadding=null)},onDropInvalid:function(a,c){var d=this._clone;if(d){a=b.normalizeEvent(a),c=c||this.options.dragEndClone(d),this.trigger("drop:invalid",a,c);var e=this.options.dropAnimation;if(e){var f=b.isObject(e)?e.duration:150,g=b.isObject(e)?e.easing:"swing";this._cloneView=null,this._paperDrag.$el.animate(this._paperDragInitialOffset,f,g,this.onDropEnd.bind(this,d))}else this.onDropEnd(d)}},insideValidArea:function(a){var b,c=this.options.paper,d=this.options.paperScroller,e=this.getDropArea(this.$el);if(d)if(d.options.autoResizePaper)b=this.getDropArea(d.$el);else{var f=this.getDropArea(d.$el),g=this.getDropArea(c.$el);b=g.intersect(f)}else b=this.getDropArea(c.$el);return!(!b||!b.containsPoint(a)||e.containsPoint(a))},getDropArea:function(a){var b=a.offset(),c=document.body.scrollTop||document.documentElement.scrollTop,d=document.body.scrollLeft||document.documentElement.scrollLeft;return g.rect({x:b.left+parseInt(a.css("border-left-width"),10)-d,y:b.top+parseInt(a.css("border-top-width"),10)-c,width:a.innerWidth(),height:a.innerHeight()})},drop:function(a,b){var c=this.options.paper,d=this.options.graph;
86if(this.insideValidArea(b)){var e=c.clientToLocalPoint(b),f=a.getBBox();e.x+=f.x-f.width/2,e.y+=f.y-f.height/2;var h=this._cloneSnapOffset?1:c.options.gridSize;return a.set("position",{x:g.snapToGrid(e.x,h),y:g.snapToGrid(e.y,h)}),a.unset("z"),d.addCell(a,{stencil:this.cid}),!0}return!1},filter:function(c,d){var e=c.toLowerCase()==c,f=Object.keys(this.papers).reduce(function(f,g){var h=this.papers[g],i=h.model.get("cells").filter(function(a){var f=h.findViewByModel(a),g=!c||Object.keys(d).some(function(f){var g=d[f];if("*"!=f&&a.get("type")!=f)return!1;var h=g.some(function(d){var f=b.getByPath(a.attributes,d,"/");return void 0!==f&&null!==f&&(f=f.toString(),e&&(f=f.toLowerCase()),f.indexOf(c)>=0)});return h});return V(f.el).toggleClass("unmatched",!g),g},this),j=!b.isEmpty(i),k=(new a.dia.Graph).resetCells(i);return this.trigger("filter",k,g,c),this.isLayoutEnabled()&&this.layoutGroup(k,this.getGroup(g)),this.$groups[g]&&this.$groups[g].toggleClass("unmatched",!j),h.fitToContent({gridWidth:1,gridHeight:1,padding:this.options.paperPadding||10}),f||j}.bind(this),!1);this.$el.toggleClass("not-found",!f)},getGroup:function(a){return this.options.groups&&this.options.groups[a]||{}},onSearch:function(a){this.filter(a.target.value,this.options.search)},pointerFocusIn:function(){this.$el.addClass("is-focused")},pointerFocusOut:function(){this.$el.removeClass("is-focused")},onGroupLabelClick:function(a){if("touchstart"===a.type)this._groupLabelClicked=!0;else if(this._groupLabelClicked&&"click"===a.type)return void(this._groupLabelClicked=!1);var b=$(a.target).closest(".group");this.toggleGroup(b.data("name"))},toggleGroup:function(a){this.$('.group[data-name="'+a+'"]').toggleClass("closed")},closeGroup:function(a){this.$('.group[data-name="'+a+'"]').addClass("closed")},openGroup:function(a){this.$('.group[data-name="'+a+'"]').removeClass("closed")},isGroupOpen:function(a){return!this.$('.group[data-name="'+a+'"]').hasClass("closed")},closeGroups:function(){this.$(".group").addClass("closed")},openGroups:function(){this.$(".group").removeClass("closed")},onRemove:function(){b.invoke(this.papers,"remove"),this.papers={},this._paperDrag&&(this._paperDrag.remove(),this._paperDrag=null),this.undelegateDocumentEvents()}})}(joint,joint.util);
87!function(a,b){"use strict";a.ui.Inspector=a.mvc.View.extend({className:"inspector",options:{cellView:void 0,cell:void 0,live:!0,validateInput:function(a,b,c){return!a.val
87idity||a.validity.valid},renderFieldContent:void 0,operators:{},multiOpenGroups:!0,stateKey:function(a){return a.id}},events:{"change [data-attribute]:not([data-custom-field])":"onChangeInput","click .group-label":"onGroupLabelClick","click .btn-list-add":"addListItem","click .btn-list-del":"deleteListItem","mousedown .field":"pointerdown","touchstart .field":"pointerdown","focusin .field":"pointerfocusin","focusout .field":"pointerfocusout"},HTMLEntities:{lt:"<",gt:">",amp:"&",nbsp:" ",quot:'"',cent:"¢",pound:"£",euro:"€",yen:"¥",copy:"©",reg:"®"},init:function(){var c=this.options.groups=this.options.groups||{};a.util.bindAll(this,"stopBatchCommand","pointerup","onContentEditableBlur","replaceHTMLEntity"),this.widgets={},this._attributeKeysInUse=[],this.flatAttributes=this.flattenInputs(this.options.inputs),this.expandAttributes=this.expandAttrs(this.options.inputs||{}),this._when={},this._bound={};var d=Object.keys(this.flatAttributes).map(function(a){var b=this.flatAttributes[a];if(b.when){var c={expression:b.when,path:a};this.extractExpressionPaths(c.expression).forEach(function(a){(this._when[a]||(this._when[a]=[])).push(c)},this)}return this.needsResolving(b)&&(this._bound[a]=b.options),b.path=a,b},this);for(var e in c){var f=c[e];f&&c.hasOwnProperty(e)&&this.extractExpressionPaths(f.when).forEach(function(a){this._when[a]||(this._when[a]=[])},this)}var g=b.sortBy(d,"index");this.groupedFlatAttributes=b.sortBy(g,function(a){var b=this.options.groups[a.group];return b&&b.index||Number.MAX_VALUE}.bind(this)),this.listenTo(this.getModel(),"all",this.onCellChange,this)},cacheInputs:function(){var a={};Array.from(this.$("[data-attribute]")).forEach(function(b){var c=$(b),d=c.attr("data-attribute");a[d]=c},this),this._byPath=a,this._attributeKeysInUse=this.getAttributeKeysInUse()},updateGroupsVisibility:function(){for(var a=this.$groups,b=0,c=a.length;b<c;b++){var d=$(a[b]),e=d.attr("data-name"),f=this.options.groups[e],g=0===d.find("> .field:not(.hidden)").length;d.toggleClass("empty",g);var h=!(!f||!f.when||this.isExpressionValid(f.when));d.toggleClass("hidden",h)}},expandAttrs:function(a,c){c=c||{};for(var d=Object.keys(a),e=0;e<d.length;e++){var f=d[e],g=a[f],h=f.split("/");h.length>1?b.setByPath(c,h,g):c[f]=b.isPlainObject(g)?this.expandAttrs(g):g}return c},flattenInputs:function(b){return a.util.flattenObject(b,"/",function(a){return"string"==typeof a.type})},getModel:function(){return this.options.cell||this.options.cellView.model},onCellChange:function(a,b,c,d){if(d=d||{},d.inspector!=this.cid)switch(a){case"remove":this.remove();break;case"change:position":this.updateInputPosition();break;case"change:size":this.updateInputSize();break;case"change:angle":this.updateInputAngle();break;case"change:source":case"change:target":case"change:vertices":break;default:var e="change:";if(a.slice(0,e.length)===e){var f=a.slice(e.length);this._attributeKeysInUse.includes(f)&&this.render({refresh:!0})}}},render:function(a){var b=a&&a.refresh;b&&this.options.storeGroupsState&&this.storeGroupsState(),this.$el.empty(),this.removeWidgets();var c,d,e=[];return this.groupedFlatAttributes.forEach(function(a){if(c!==a.group){var f=this.options.groups[a.group];d=this.renderGroup({name:a.group,label:f&&f.label}),b||(f&&f.closed?this.closeGroup(d,{init:!0}):this.openGroup(d,{init:!0})),e.push(d)}this.renderTemplate(d,a,a.path),c=a.group},this),this.$document=$(this.el.ownerDocument),this.$groups=$(e),this.$el.append(e),b&&this.options.restoreGroupsState&&this.restoreGroupsState(),this.afterRender(),this},getAttributeKeysInUse:function(){var a=Object.keys(this._byPath).map(function(a){return a.substring(0,a.indexOf("/"))||a}),c=b.toArray(this._bound),d=Object.keys(this._when);return b.uniq([].concat(a,c,d))},getCellAttributeValue:function(b,c){var d=this.getModel(),e=a.util.getByPath(d.attributes,b,"/");if(c=c||this.flatAttributes[b],!c)return e;if(void 0===e&&void 0!==c.defaultValue&&(e=c.defaultValue),c.valueRegExp){if(void 0===e)throw new Error("Inspector: defaultValue must be present when valueRegExp is used.");var f=e.match(new RegExp(c.valueRegExp));e=f&&f[2]}return e},resolvableTypes:["select","select-box","color-palette","select-button-group"],needsResolving:function(b){return!!b&&this.resolvableTypes.indexOf(b.type)>-1&&a.util.isString(b.options)},resolveBindings:function(c){if(this.resolvableTypes.indexOf(c.type)>-1){var d=c.options||[];a.util.isString(d)&&(d=a.util.getByPath(this.getModel().attributes,d,"/")||[]),a.util.isObject(d[0])||(d=b.toArray(d).map(function(a){return{value:a,content:a}})),c.items=d}},updateBindings:function(b){var c=Object.keys(this._bound).reduce(function(a,c){var d=this._bound[c];return 0===b.indexOf(d)&&a.push(c),a}.bind(this),[]);a.util.isEmpty(c)||(c.forEach(function(a){this.renderTemplate(null,this.flatAttributes[a],a,{replace:!0})},this),this.afterRender())},renderFieldContent:function(c,d,e){var f;if(a.util.isFunction(this.options.renderFieldContent)&&(f=this.options.renderFieldContent(c,d,e)))return $(f).attr({"data-attribute":d,"data-type":c.type,"data-custom-field":!0});var g,h,i,j;switch(c.type){case"select-box":h=a.util.toArray(c.items).findIndex(function(b){var d=b.value,f=e;if(void 0===d&&b.content===f)return!0;var g=c.key;return g&&(f=a.util.getByPath(f,g,"/"),d=a.util.getByPath(d,g,"/")),a.util.isEqual(d,f)});var k=a.util.assign({theme:this.options.theme},a.util.omit(c,"type","group","index","selectBoxOptionsClass","options"),{options:c.items,selected:h,selectBoxOptionsClass:[a.util.addClassNamePrefix("inspector-select-box-options"),c.selectBoxOptionsClass].filter(function(a){return!!a}).join(" ")});g=new a.ui.SelectBox(k),g.$el.attr({"data-attribute":d,"data-type":c.type,"data-overwrite":c.overwrite}),g.render(),j=$("<label/>",{html:c.label||d}),f=$("<div/>
87").append(j,g.el),c.previewMode?(i=g.selection,g.on("options:mouseout close",function(){g.selection=i,this.processInput(g.$el,{previewCancel:!0,dry:!0})},this),g.on("option:hover",function(a,b){g.selection=a,this.processInput(g.$el,{dry:!0})},this),g.on("option:select",function(a,b){var c=void 0===i?void 0:g.getSelectionValue(i),d=g.getSelectionValue(a),e=c===d;this.processInput(g.$el,{previewDone:!0,dry:e,originalValue:c}),i=a},this)):g.on("option:select",function(a,b){this.processInput(g.$el)},this),this.widgets[d]=g;break;case"color-palette":h=a.util.toArray(c.items).findIndex(function(a){return a.value===e||void 0===a.value&&a.content===e});var l=a.util.assign({theme:this.options.theme},a.util.omit(c,"type","group","index","options"),{options:c.items,selected:h});g=new a.ui.ColorPalette(l),g.$el.attr({"data-attribute":d,"data-type":c.type}),g.render(),j=$("<label/>",{html:c.label||d}),f=$("<div/>").append(j,g.el),c.previewMode?(i=g.selection,g.on("options:mouseout close",function(){g.selection=i,this.processInput(g.$el,{previewCancel:!0,dry:!0})},this),g.on("option:hover",function(a,b){g.selection=a,this.processInput(g.$el,{dry:!0})},this),g.on("option:select",function(a,b){var c=void 0===i?void 0:g.getSelectionValue(i),d=g.getSelectionValue(a),e=c===d;this.processInput(g.$el,{previewDone:!0,dry:e,originalValue:c}),i=a},this)):g.on("option:select",function(a,b){this.processInput(g.$el)},this),this.widgets[d]=g;break;case"select-button-group":c.multi?(h=[],a.util.toArray(c.items).forEach(function(b,d){var f=void 0===b.value?b.content:b.value,g=c.key;g&&(f=a.util.getByPath(f,g,"/"));var i=a.util.toArray(e).find(function(b){return g&&(b=a.util.getByPath(b,g,"/")),a.util.isEqual(f,b)});i&&h.push(d)})):h=a.util.toArray(c.items).findIndex(function(b){var d=b.value,f=e;if(void 0===d&&b.content===f)return!0;var g=c.key;return g&&(f=a.util.getByPath(f,g,"/"),d=a.util.getByPath(d,g,"/")),a.util.isEqual(d,f)});var m=a.util.assign({theme:this.options.theme},a.util.omit(c,"type","group","index","options"),{options:c.items,selected:h});g=new a.ui.SelectButtonGroup(m),g.$el.attr({"data-attribute":d,"data-type":c.type,"data-overwrite":c.overwrite}),g.render(),j=$("<label/>",{html:c.label||d}),f=$("<div/>").append(j,g.el),c.previewMode?(i=g.selection,g.on("mouseout",function(){g.selection=i,this.processInput(g.$el,{previewCancel:!0,dry:!0})},this),g.on("option:hover",function(a,d){c.multi?g.selection=b.uniq(g.selection.concat([a])):g.selection=a,this.processInput(g.$el,{dry:!0})},this),g.on("option:select",function(b,c){var d=void 0===i?void 0:g.getSelectionValue(i),e=g.getSelectionValue(b),f=a.util.isEqual(d,e);this.processInput(g.$el,{previewDone:!0,dry:f,originalValue:d}),i=b},this)):g.on("option:select",function(a,b){this.processInput(g.$el)},this),this.widgets[d]=g;break;default:f=this.renderOwnFieldContent({options:c,type:c.type,overwrite:c.overwrite,label:c.label||d,attribute:d,value:e})}return f},renderGroup:function(a){a=a||{};var b=$("<div/>").addClass("group").attr("data-name",a.name),c=$("<h3/>").addClass("group-label").text(a.label||a.name);return b.append(c)},renderOwnFieldContent:function(b){var c,d,e,f,g,h,i,j;switch(j=$("<label/>").text(b.label),b.type){case"number":d=$("<input/>",{type:"number",min:b.options.min,max:b.options.max,step:b.options.step}).val(b.value),c=[j,$("<div/>").addClass("input-wrapper").append(d)];break;case"range":j.addClass("with-output"),f=$("<output/>").text(b.value),g=$("<span/>").addClass("units").text(b.options.unit),d=$("<input/>",{type:"range",name:b.type,min:b.options.min,max:b.options.max,step:b.options.step}).val(b.value),d.on("change input",function(){f.text(d.val())}),c=[j,f,g,d];break;case"textarea":d=$("<textarea/>").text(b.value),c=[j,$("<div/>").addClass("input-wrapper").append(d)];break;case"content-editable":var k=a.util.isString(b.value)?b.value.replace(/\n/g,"<br>").replace(/ /g,"&nbsp;"):"";d=$("<div/>").prop("contenteditable",!0).css("display","inline-block").html(k).on("blur",this.onContentEditableBlur),c=[j,$("<div/>").addClass("input-wrapper").append(d)];break;case"select":var l=b.options.items;d=$("<select/>"),b.options.multiple&&d.prop({size:b.options.size||l.length,multiple:!0});var m=function(c){return b.options.multiple?a.util.toArray(b.value).find(function(b){return a.util.isEqual(c,b)}):a.util.isEqual(c,b.value)};a.util.toArray(l).forEach(function(a){var b=$("<option/>",{value:a.value}).text(a.content);m(a.value)&&b.attr("selected","selected"),d.append(b)}),c=[j,d];break;case"toggle":h=$("<span><i/></span>"),d=$("<input/>",{type:"checkbox"}).prop("checked",!!b.value),e=$("<div/>").addClass(b.type),c=[j,e.append(d,h)];break;case"color":d=$("<input/>",{type:"color"}).val(b.value),c=[j,d];break;case"text":d=$("<input/>",{type:"text"}).val(b.value),c=[j,$("<div/>").addClass("input-wrapper").append(d)];break;case"object":d=$("<div/>"),i=$("<div/>").addClass("object-properties"),c=[j,d.append(i)];break;case"list":h=$("<button/>").addClass("btn-list-add").text(b.options.addButtonLabel||"+"),i=$("<div/>").addClass("list-items"),d=$("<div/>"),c=[j,d.append(h,i)]}return d&&d.addClass(b.type).attr({"data-type":b.type,"data-attribute":b.attribute,"data-overwrite":b.overwrite}),$.fn.append.apply($("<div>"),c).children()},onContentEditableBlur:function(a){var b=$("<input/>",{disabled:!0,tabIndex:-1,style:{width:"1px",height:"1px",border:"none",margin:0,padding:0}}).appendTo(this.$el);b.focus(),b[0].setSelectionRange(0,0),b.blur().remove(),$(a.target).trigger("change")},replaceHTMLEntity:function(a,b){return this.HTMLEntities[b]||""},renderObjectProperty:function(a){a=a||{};var b=$("<div/>",{"data-property":a.property,"class":"object-property"});return b},renderListItem:function(a){a=a||{};var b=$("<button/>").addClass("btn-list-del").text(a.options.removeButtonLabel||"-"),c=$("<div/>",{"data-index":a.index,"class":"list-item"});return c.append(b)},renderFieldContainer:function(a){a=a||{};var b=$("<div/>",{"data-field":a.path,"class":"field "+a.type+"-field"});return b},renderTemplate:function(c,d,e,f){c=c||this.$el,f=f||{},this.resolveBindings(d);var g=this.renderFieldContainer({path:e,type:d.type});d.when&&!this.isExpressionValid(d.when)&&(g.addClass("hidden"),d.when.otherwise&&d.when.otherwise.unset&&this.unsetProperty(e));var h=this.getCellAttributeValue(e,d),i=this.renderFieldContent(d,e,h);if(g.append(i),a.util.setAttributesBySelector(g,d.attrs),"list"===d.type)a.util.toArray(h).forEac
87h(function(a,b){var c=this.renderListItem({index:b,options:d});this.renderTemplate(c,d.item,e+"/"+b),i.children(".list-items").append(c)},this);else if("object"===d.type){d.flatAttributes=this.flattenInputs(d.properties);var j=Object.keys(d.flatAttributes).map(function(a){var b=this[a];return b.path=a,b},d.flatAttributes);j=b.sortBy(j,function(a){return a.index}),j.forEach(function(a){var b=this.renderObjectProperty({property:a.path});this.renderTemplate(b,a,e+"/"+a.path),i.children(".object-properties").append(b)},this)}f.replace?c.find('[data-field="'+e+'"]').replaceWith(g):c.append(g)},updateInputPosition:function(){var a=this._byPath["position/x"],b=this._byPath["position/y"],c=this.getModel().get("position");a&&a.val(c.x),b&&b.val(c.y)},updateInputSize:function(){var a=this._byPath["size/width"],b=this._byPath["size/height"],c=this.getModel().get("size");a&&a.val(c.width),b&&b.val(c.height)},updateInputAngle:function(){var a=this._byPath.angle,b=this.getModel().get("angle");a&&a.val(b)},validateInput:function(a,b,c){switch(a){case"select-box":case"color-palette":var d=this.widgets[c];return!!d&&d.getSelectionIndex()!==-1;case"select-button-group":return!!this.widgets[c];default:return this.options.validateInput(b,c,a)}},onChangeInput:function(a){a.target===a.currentTarget&&this.processInput($(a.target))},processInput:function(a,b){var c=a.attr("data-attribute"),d=a.attr("data-type");if(this.validateInput(d,a[0],c)){this.options.live&&this.updateCell(a,c,b);var e=this.getFieldValue(a[0],d),f=this.parse(d,e,a[0]);this.trigger("change:"+c,f,a[0],b)}},updateDependants:function(b){a.util.toArray(this._when[b]).forEach(function(a){var b=this._byPath[a.path],c=b.closest(".field"),d=c.hasClass("hidden"),e=this.isExpressionValid(a.expression);c.toggleClass("hidden",!e),a.expression.otherwise&&a.expression.otherwise.unset&&this.options.live&&(e?d&&this.updateCell(b,a.path):(this.unsetProperty(a.path),this.renderTemplate(null,this.flatAttributes[a.path],a.path,{replace:!0}),this.afterRender()))},this)},unsetProperty:function(b,c){var d=this.getModel(),e=b.split("/"),f=e[0],g=e.slice(1).join("/");if(c=c||{},c.inspector=this.cid,c["inspector_"+this.cid]=!0,"attrs"==b)d.removeAttr(g,c);else if(b==f)d.unset(f,c);else{var h=a.util.merge({},d.get(f)),i=a.util.unsetByPath(h,g,"/");d.set(f,i,c)}},getOptions:function(a){if(0!==a.length){var b=a.attr("data-attribute"),c=this.flatAttributes[b];if(!c){var d=a.parent().closest("[data-attribute]"),e=d.attr("data-attribute");c=this.getOptions(d);var f=b.replace(e+"/",""),g=c;c=g.item||g.flatAttributes[f],c.parent=g}return c}},markForRemoval:function(a,b){var c=this.findParentListByPath(a);if(c){var d=a.substr(c.length+1),e=parseInt(d,10);Number.isFinite(e)&&(b.remove[c]=b.remove[c]||[],b.remove[c].includes(e)||b.remove[c].push(e))}},markForUpdate:function(b,c,d,e){var f=b.substr(e.length+1);c.update[e]&&a.util.setByPath(c.update[e].value,f,d,"/")},updateCell:function(b,c,d){var e=this.getModel(),f={};b?f[c]=b:f=this._byPath,this.startBatchCommand();var g={},h={update:{},remove:{}};a.util.forIn(f,function(b,c){if(!b.closest(".field").hasClass("hidden")){var d=b.attr("data-type"),f=b.attr("data-overwrite"),i="false"!==f&&void 0!==f,j=b.hasClass("remove");switch(d){case"list":j&&this.markForRemoval(c,h);break;case"object":j&&this.markForRemoval(c,h);break;default:if(!this.validateInput(d,b[0],c))return;var k=this.getFieldValue(b[0],d),l=this.parse(d,k,b[0]),m=this.getOptionsFromPath(c);if(m.valueRegExp){var n=a.util.getByPath(e.attributes,c,"/")||m.defaultValue;l=n.replace(new RegExp(m.valueRegExp),"$1"+l+"$3")}if(j)this.markForRemoval(c,h);else{var o=m.parent;if(o&&"object"===o.type&&void 0!==o.overwrite&&o.overwrite!==!1){var p={},q=c.split("/"),r=q[q.length-1];p[r]=l,h.update[o.path]={value:p,overwrite:!0}}else g[c]={value:l,overwrite:i}}}}}.bind(this)),a.util.forIn(g,function(b,c){this.setProperty(c,b.value,a.util.assign({overwrite:b.overwrite},d)),this.updateBindings(c),this.updateDependants(c)}.bind(this)),a.util.forIn(h.remove,function(b,c){this.removeProperty(c,b,a.util.assign({rewrite:!0},d))}.bind(this)),a.util.forIn(h.update,function(b,c){this.setProperty(c,this.compactDeep(b.value),a.util.assign({rewrite:!0,overwrite:b.overwrite},d)),this.updateBindings(c),this.updateDependants(c)}.bind(this)),this.updateGroupsVisibility(),this.stopBatchCommand()},compactDeep:function(a){return Array.isArray(a)?a.reduce(function(a,b){return b&&a.push(this.compactDeep(b)),a}.bind(this),[]):a},findParentListByPath:function(a){var c=a.split("/");c.pop();for(var d=c.map(function(a){return Number.isNaN(parseInt(a))?a:"item"}),e=this.options.inputs;d.length;){var f=b.getByPath(e,d);if(f&&"list"===f.type)return c.slice(0,d.length).join("/");d.pop()}return null},getOptionsFromPath:function(a){for(var c,d=a.split("/"),e=this.expandAttributes,f=[];d.length;){var g,h=g;if(e&&"object"===e.type?g="properties":(g=d.shift(),(d.length||"list"===e.type)&&(c=e,f.push(g))),g=Number.isNaN(parseInt(g))?g:"item",Object(e)!==e||!(g in e||e[a]))return;e=e[g]||e[a]}return e=b.assign({}
87,e),c=b.assign({},c),c.path=f.join("/"),h&&"properties"===h&&(c.type="object"),e.parent=c,e},getFieldValue:function(b,c){if(a.util.isFunction(this.options.getFieldValue)){var d=this.options.getFieldValue(b,c);if(d)return d.value}var e=$(b);switch(c){case"select-box":case"color-palette":case"select-button-group":var f=e.attr("data-attribute");return this.widgets[f].getSelectionValue();case"content-editable":return e.html().replace(/<br(\s*)\/*>/gi,"\n").replace(/<[p|div]\s/gi,"\n$0").replace(/(<([^>]+)>)/gi,"").replace(/&(\w+);/gi,this.replaceHTMLEntity).replace(/\n$/,"");default:return e.val()}},removeProperty:function(b,c,d){var e=this.getModel(),f=a.dia.Cell.prototype.prop,g=f.call(e,b);if(g){var h=g.reduce(function(a,b,d){return c.includes(d)||a.push(b),a},[]),i=this.flatAttributes[b];Array.isArray(h)&&0===h.length&&!i&&(h=null),f.call(e,b,h,d);var j=this.findParentListByPath(b);if(j){var k=f.call(e,j);f.call(e,j,this.compactDeep(k),{rewrite:!0})}}},setProperty:function(b,c,d){d=d||{},d.inspector=this.cid;var e=a.dia.Cell.prototype.prop,f=this.getModel(),g=d.overwrite||!1;if(d.previewDone&&e.call(f,b,d.originalValue,{rewrite:!0,silent:!0}),void 0===c)a.dia.Cell.prototype.removeProp.call(f,b,d);else{var h;if(a.util.isObject(c)&&!g){var i=e.call(f,b),j=Array.isArray(c)?[]:{};h=a.util.merge(j,i,c)}else h=a.util.clone(c);g&&(d.rewrite=!0),e.call(f,b,h,d)}},parse:function(a,b,c){switch(a){case"number":case"range":b=parseFloat(b);break;case"toggle":b=c.checked}return b},startBatchCommand:function(){this.inBatch||(this.inBatch=!0,this.getModel().startBatch("inspector",{cid:this.cid}))},stopBatchCommand:function(){this.inBatch&&(this.getModel().stopBatch("inspector",{cid:this.cid}),this.inBatch=!1)},afterRender:function(){this.cacheInputs(),this.updateGroupsVisibility(),this.trigger("render")},addListItem:function(a){var b=$(a.target),c=b.closest("[data-attribute]"),d=c.attr("data-attribute"),e=this.getOptions(c),f=c.children(".list-items").children(".list-item").last(),g=0===f.length?-1:parseInt(f.attr("data-index"),10),h=g+1,i=this.renderListItem({index:h,options:e});this.renderTemplate(i,e.item,d+"/"+h),b.parent().children(".list-items").append(i),i.find("input:first").focus(),this.afterRender(),this.options.live&&this.updateCell()},deleteListItem:function(a){var b=$(a.target).closest(".list-item");b.hide(),b.addClass("remove"),b.find("[data-field]").each(function(){$(this).hide().addClass("remove")}),b.find("[data-attribute]").each(function(){$(this).hide().addClass("remove")}),this.afterRender(),this.options.live&&this.updateCell()},bindDocumentEvents:function(){var a=this.getEventNamespace();this.$document.on("mouseup"+a+" touchend"+a,this.pointerup)},unbindDocumentEvents:function(){this.$document.off(this.getEventNamespace())},pointerdown:function(a){this.bindDocumentEvents(),this.startBatchCommand(),this._$activeField=$(a.currentTarget).addClass("is-in-action")},pointerup:function(){this.unbindDocumentEvents(),this.stopBatchCommand(),this._$activeField&&(this._$activeField.removeClass("is-in-action"),this._$activeField=null)},pointerfocusin:function(a){a.stopPropagation(),$(a.currentTarget).addClass("is-focused")},pointerfocusout:function(a){a.stopPropagation(),$(a.currentTarget).removeClass("is-focused")},onRemove:function(){this.unbindDocumentEvents(),this.removeWidgets(),this===this.constructor.instance&&(this.constructor.instance=null)},removeWidgets:function(){var a=this.widgets;for(var b in a)a[b].remove();this.widgets={}},onGroupLabelClick:function(a){a.preventDefault(),this.options.multiOpenGroups||this.closeGroups();var b=$(a.target).closest(".group");this.toggleGroup(b)},toggleGroup:function(b){var c=a.util.isString(b)?this.$('.group[data-name="'+b+'"]'):$(b);c.hasClass("closed")?this.openGroup(c):this.closeGroup(c)},closeGroup:function(b,c){c=c||{};var d=a.util.isString(b)?this.$('.group[data-name="'+b+'"]'):$(b);!c.init&&d.hasClass("closed")||(d.addClass("closed"),this.trigger("group:close",d.data("name"),c))},openGroup:function(b,c){c=c||{};var d=a.util.isString(b)?this.$('.group[data-name="'+b+'"]'):$(b);(c.init||d.hasClass("closed"))&&(d.removeClass("closed"),this.trigger("group:open",d.data("name"),c))},closeGroups:function(){for(var a=0,b=this.$groups.length;a<b;a++)this.closeGroup(this.$groups[a])},openGroups:function(){for(var a=0,b=this.$groups.length;a<b;a++)this.openGroup(this.$groups[a])},COMPOSITE_OPERATORS:["not","and","or","nor"],PRIMITIVE_OPERATORS:["eq","ne","regex","text","lt","lte","gt","gte","in","nin","equal"],_isComposite:function(a){return b.intersection(this.COMPOSITE_OPERATORS,Object.keys(a)).length>0},_isPrimitive:function(a){var c=Object.keys(this.options.operators).concat(this.PRIMITIVE_OPERATORS);return b.intersection(c,Object.keys(a)).length>0},_evalCustomPrimitive:function(a,b,c){return!!this.options.operators[a].apply(this,[this.getModel(),b].concat(c))},_evalPrimitive:function(b){return Object.keys(b).reduce(function(c,d){var e=b[d];return Object.keys(e).reduce(function(b,c){var f=e[c],g=this.getCellAttributeValue(c);if(a.util.isFunction(this.options.operators[d]))return this._evalCustomPrimitive(d,g,f);switch(d){case"eq":return f==g;case"ne":return f!=g;case"regex":return new RegExp(f).test(g);case"text":return!f||a.util.isString(g)&&g.toLowerCase().indexOf(f)>-1;case"lt":return g<f;case"lte":return g<=f;case"gt":return g>f;case"gte":return g>=f;case"in":return Array.isArray(f)&&f.includes(g);case"nin":return Array.isArray(f)&&!f.includes(g);case"equal":return a.util.isEqual(f,g);default:return b}}.bind(this),!1)}.bind(this),!1)},_evalExpression:function(a){return this._isPrimitive(a)?this._evalPrimitive(a):Object.keys(a).reduce(function(c,d){var e=a[d];if("not"==d)return!this._evalExpression(e);var f=b.toArray(e).map(this._evalExpression,this);switch(d){case"and":return f.every(function(a){return!!a});case"or":return f.some(function(a){return!!a});case"nor":return!f.some(function(a){return!!a});default:return c}}.bind(this),!1)},_extractVariables:function(a){return Array.isArray(a)||this._isComposite(a)?b.toArray(a).reduce(function(a,b){return a.concat(this._extractVariables(b))}.bind(this),[]):b.toArray(a).reduce(function(a,b){return Object.keys(b)},[])},isExpressionValid:function(b){return b=a.util.omit(b,"otherwise","dependencies"),this._evalExpression(b)},extractExpressionPaths:function(a){var c=a&&a.dependencies||[];return a=b.omit(a,"otherwise","dependencies"),b.uniq(this._extractVariables(a).concat(c))},getGroupsStateKey:function(){if(a.util.isFunction(this.options.stateKey))return this.options.stateKey(this.getModel());throw new Error("Inspector: Option stateKey must be a function")},storeGroupsState:function(){var c=this.getGroupsStateKey(),d=b.toArray(this.$(".group.closed"));a.ui.Inspector.groupStates[c]=d.map(function(a){return $(a).attr("data-name")})},getGroupsState:function(){return a.ui.Inspector.groupStates[this.getGroupsStateKey()]},restoreGroupsState:function(){var b=function(b,c){a.util.forIn(c.options.groups,function(a,c){b(a,c)?this.closeGroup(c):this.openGroup(c)}.bind(c))},c=this.getGroupsStateKey();a.ui.Inspector.groupStates[c]?b(function(b,d){return a.ui.Inspector.groupStates[c].includes(d)},this):b(function(a){return a.closed},this)}},{groupStates:{},instance:null,create:function(b,c){c=c||{},a.util.defaults(c,{restoreGroupsState:!0,storeGroupsState:!0});var d=c.cell||c.cellView.model,e=this.instance;return e&&e.options.cell===d||(e&&e.el.parentNode&&(c.storeGroupsState&&e.storeGroupsState(),e.updateCell(),e.remove()),e=new this(c).render(),this.instance=e,$(b).html(e.el),
87c.restoreGroupsState&&e.restoreGroupsState()),e},close:function(){var a=this.instance;a&&a.remove()}})}(joint,joint.util);
88joint.ui.FreeTransform=joint.mvc.View.extend({className:"free-transform",events:{"mousedown .resize":"startResizing","mousedown .rotate":"startRotating","touchstart .resize":"startResizing","touchstart .rotate":"startRotating"},DIRECTIONS:["nw","n","ne","e","se","s","sw","w"],POSITIONS:["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],options:{cellView:void 0,rotateAngleGrid:15,preserveAspectRatio:!1,minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0,allowOrthogonalResize:!0,allowRotation:!0,clearAll:!0,clearOnBlankPointerdown:!0},init:function(){var a=this.options;a.cellView&&joint.util.defaults(a,{cell:a.cellView.model,paper:a.cellView.paper,graph:a.cellView.paper.model}),joint.util.bindAll(this,"update","remove","pointerup","pointermove");var b=a.paper,c=a.graph;a.clearAll&&this.constructor.clear(b),$(document.body).on("mousemove touchmove",this.pointermove),$(document).on("mouseup touchend",this.pointerup),this.listenTo(c,"all",this.update),this.listenTo(b,"scale translate",this.update),this.listenTo(c,"reset",this.remove),this.listenTo(a.cell,"remove",this.remove),a.clearOnBlankPointerdown&&this.listenTo(b,"blank:pointerdown",this.remove),b.$el.append(this.el),this.constructor.registerInstanceToPaper(this,b)},renderHandles:function(){var a=$("<div/>").prop("draggable",!1),b=a.clone().addClass("rotate"),c=this.POSITIONS.map(function(b){return a.clone().addClass("resize").attr("data-position",b)});this.$el.empty().append(c,b)},render:function(){this.renderHandles(),this.$el.attr("data-type",this.options.cell.get("type")),this.$el.toggleClass("no-orthogonal-resize",this.options.preserveAspectRatio||!this.options.allowOrthogonalResize),this.$el.toggleClass("no-rotation",!this.options.allowRotation),this.update()},update:function(){var a=this.options.paper.matrix(),b=this.options.cell.getBBox();b.x*=a.a,b.x+=a.e,b.y*=a.d,b.y+=a.f,b.width*=a.a,b.height*=a.d;var c=g.normalizeAngle(this.options.cell.get("angle")||0),d="rotate("+c+"deg)";
88this.$el.css({width:b.width+4,height:b.height+4,left:b.x-3,top:b.y-3,transform:d,"-webkit-transform":d,"-ms-transform":d});var e=Math.floor(c*(this.DIRECTIONS.length/360));if(e!=this._previousDirectionsShift){var f=this.DIRECTIONS.slice(e).concat(this.DIRECTIONS.slice(0,e));this.$(".resize").removeClass(this.DIRECTIONS.join(" ")).each(function(a,b){$(b).addClass(f[a])}),this._previousDirectionsShift=e}},calculateTrueDirection:function(a){var b=this.options.cell,c=g.normalizeAngle(b.get("angle")),d=this.POSITIONS.indexOf(a);return d+=Math.floor(c*(this.POSITIONS.length/360)),d%=this.POSITIONS.length,this.POSITIONS[d]},startResizing:function(a){a.stopPropagation(),this.options.graph.startBatch("free-transform",{freeTransform:this.cid});var b=$(a.target).data("position"),c=this.calculateTrueDirection(b),d=0,e=0;b.split("-").forEach(function(a){d={left:-1,right:1}[a]||d,e={top:-1,bottom:1}[a]||e});var f=this.toValidResizeDirection(b),h={"top-right":"bottomLeft","top-left":"corner","bottom-left":"topRight","bottom-right":"origin"}[f];this._initial={angle:g.normalizeAngle(this.options.cell.get("angle")||0),resizeX:d,resizeY:e,selector:h,direction:f,relativeDirection:b,trueDirection:c},this._action="resize",this.startOp(a.target)},toValidResizeDirection:function(a){return{top:"top-left",bottom:"bottom-right",left:"bottom-left",right:"top-right"}[a]||a},startRotating:function(a){a.stopPropagation(),this.options.graph.startBatch("free-transform",{freeTransform:this.cid});var b=this.options.cell.getBBox().center(),c=this.options.paper.snapToGrid({x:a.clientX,y:a.clientY});this._initial={centerRotation:b,modelAngle:g.normalizeAngle(this.options.cell.get("angle")||0),startAngle:g.point(c).theta(b)},this._action="rotate",this.startOp(a.target)},pointermove:function(a){if(this._action){a=joint.util.normalizeEvent(a);var b=this.options,c=b.paper.snapToGrid({x:a.clientX,y:a.clientY}),d=b.paper.options.gridSize,e=b.cell,f=this._initial;switch(this._action){case"resize":var h=e.getBBox(),i=g.point(c).rotate(h.center(),f.angle),j=i.difference(h[f.selector]()),k=f.resizeX?j.x*f.resizeX:h.width,l=f.resizeY?j.y*f.resizeY:h.height;if(k=g.snapToGrid(k,d),l=g.snapToGrid(l,d),k=Math.max(k,b.minWidth||d),l=Math.max(l,b.minHeight||d),k=Math.min(k,b.maxWidth),l=Math.min(l,b.maxHeight),b.preserveAspectRatio){var m=h.width*l/h.height,n=h.height*k/h.width;m>k?l=n:k=m}h.width==k&&h.height==l||e.resize(k,l,{freeTransform:this.cid,direction:f.direction,relativeDirection:f.relativeDirection,trueDirection:f.trueDirection,ui:!0,minWidth:b.minWidth,minHeight:b.minHeight,maxWidth:b.maxWidth,maxHeight:b.maxHeight,preserveAspectRatio:b.preserveAspectRatio});break;case"rotate":var o=f.startAngle-g.point(c).theta(f.centerRotation);e.rotate(g.snapToGrid(f.modelAngle+o,b.rotateAngleGrid),!0)}}},pointerup:function(a){this._action&&(this.stopOp(),this.options.graph.stopBatch("free-transform",{freeTransform:this.cid}),this._action=null,this._initial=null)},onRemove:function(){$(document.body).off("mousemove touchmove",this.pointermove),$(document).off("mouseup touchend",this.pointerup),joint.ui.FreeTransform.unregisterInstanceFromPaper(this,this.options.paper)},startOp:function(a){a&&($(a).addClass("in-operation"),this._elementOp=a),this.$el.addClass("in-operation")},stopOp:function(){this._elementOp&&($(this._elementOp).removeClass("in-operation"),this._elementOp=null),this.$el.removeClass("in-operation")}},{instancesByPaper:{},clear:function(a){a.trigger("freetransform:create"),this.removeInstancesForPaper(a)},removeInstancesForPaper:function(a){joint.util.invoke(this.getInstancesForPaper(a),"remove")},getInstancesForPaper:function(a){return this.instancesByPaper[a.cid]||{}},registerInstanceToPaper:function(a,b){this.instancesByPaper[b.cid]||(this.instancesByPaper[b.cid]={}),this.instancesByPaper[b.cid][a.cid]=a},unregisterInstanceFromPaper:function(a,b){this.instancesByPaper[b.cid]&&(this.instancesByPaper[b.cid][a.cid]=null)}});
89joint.ui.Tooltip=joint.mvc.View.extend({className:"tooltip",options:{left:void 0,right:void 0,top:void 0,bottom:void 0,position:void 0,positionSelector:void 0,direction:"auto",minResizedWidth:100,padding:0,rootTarget:null,target:null,trigger:"hover",viewport:{selector:null,padding:0},dataAttributePrefix:"tooltip",template:'<div class="tooltip-arrow"/><div class="tooltip-arrow-mask"/><div class="tooltip-content"/>'},init:function(){this.eventNamespace=("."+this.className+this.cid).replace(/ /g,"_"),this.settings={};var a=this.options.trigger.split(" ");joint.util.bindAll(this,"render","hide","show","toggle","isVisible","position"),this.options.rootTarget?(this.$rootTarget=$(this.options.rootTarget),a.forEach(function(a){switch(a){case"click":this.$rootTarget.on("click"+this.eventNamespace,this.options.target,this.toggle);break;case"hover":this.$rootTarget.on("mouseover"+this.eventNamespace,this.options.target,this.render);break;case"focus":this.$rootTarget.on("focusin"+this.eventNamespace,this.options.target,this.render)}},this)):(this.$target=$(this.options.target),a.forEach(function(a){switch(a){case"click":this.$target.on("click"+this.eventNamespace,this.toggle);break;case"hover":this.$target.on("mouseover"+this.eventNamespace,this.render);break;case"focus":this.$target.on("focusin"+this.eventNamespace,this.render)}},this)),this.$el.append(this.options.template)},onRemove:function(){this.options.rootTarget?this.$rootTarget.off(this.eventNamespace):this.$target.off(this.eventNamespace)},hide:function(){var a=this.settings;a&&(this.unbindHideActions(a.currentTarget),this.$el.removeClass(a.className),this.$el.remove())},show:function(a){this.render(a||{target:this.options.target})},toggle:function(a){this.isVisible()?this.hide():this.show(a)},isVisible:function(){return document.body.contains(this.el)},render:function(a){var b=void 0!==a.x&&void 0!==a.y?a:null,c=$(a.target).closest(this.options.target)[0],d=this.settings=this.getTooltipSettings(c);d.currentTarget=c,this.bindHideActions(c);var e;e=b?{x:b.x,y:b.y,width:1,height:1}:joint.util.getElementBBox(c),this.$(".tooltip-content").html(d.content),this.$el.hide(),this.$el.removeClass("left right top bottom"),this.$el.addClass(d.className),$(document.body).append(this.$el);var f=this.$("img");f.length?f.on("load",function(){this.position(e),this.$el.addClass("rendered")}.bind(this)):(this.position(e),this.$el.addClass("rendered"))},getTooltipSettings:function(a){var b=this.loadDefinitionFromElementData(a);return this.evaluateOptions(a,b)},unbindHideActions:function(a){var b=this.eventNamespace+".remove";$(a).off(b),clearInterval(this.interval)},bindHideOnRemoveTarget:function(a){clearInterval(this.interval),this.interval=setInterval(function(){$.contains(document,a)||(clearInterval(this.interval),this.hide())}.bind(this),500)},bindHideActions:function(a){var b=this.settings,c=$(a),d=this.eventNamespace+".remove";this.bindHideOnRemoveTarget(a),this.options.trigger.split(" ").forEach(function(a){var e={hover:["mouseout","mousedown"],focus:["focusout"]},f=e[a]||[];b.hideTrigger&&(f=b.hideTrigger.split(" ")||[]),f.forEach(function(a){c.on(a+d,this.hide)},this)},this)},evaluateOptions:function(a,b){b=b||{};var c=joint.util.assign({},b,this.options);return joint.util.forIn(c,function(d,e){var f=joint.util.isFunction(d)?d(a):d;c[e]=void 0===f||null===f?b[e]:f}),this.normalizePosition(c),c}
89,loadDefinitionFromElementData:function(a){if(!a)return{};var b=function(a){return"left"===a||"bottom"===a||"top"===a||"right"===a},c=this.getAllAttrs(a,"data-"+this.options.dataAttributePrefix),d={};return joint.util.forIn(c,function(a,c){""===c&&(c="content"),b(c)||(d[c]=a)}),d},getAllAttrs:function(a,b){for(var c=b||"",d=a.attributes,e={},f=0,g=d.length;f<g;f++){var h=d[f];if(h&&h.name.startsWith(c)){var i=joint.util.camelCase(h.name.slice(c.length));e[i]=h.value}}return e},normalizePosition:function(a){var b=a.left||a.right||a.top||a.bottom;!a.position&&b&&(a.left&&(a.position="left"),a.right&&(a.position="right"),a.top&&(a.position="top"),a.bottom&&(a.position="bottom")),!a.positionSelector&&b&&(a.positionSelector=b)},position:function(a){var b=this.settings;this.$el.show(),this.$el.css("width","auto");var c=this.getViewportViewBBox(),d=this.getTooltipBBox(a,c),e={};"left"===b.position||"right"===b.position?e.top=a.y+a.height/2-d.y:"top"===b.position||"bottom"===b.position?e.left=a.x+a.width/2-d.x:e.top=a.y+a.height/2-d.y,this.$el.css({left:d.x,top:d.y,width:d.width||"auto"});var f=this.$(".tooltip-arrow, .tooltip-arrow-mask");f.removeAttr("style"),f.css(e),b.direction&&"off"!==b.direction&&this.$el.addClass("auto"===b.direction?b.position||"left":b.direction)},getViewportViewBBox:function(){var a=this.settings,b=a.viewport.selector?$(a.currentTarget).closest(a.viewport.selector):"html",c=joint.util.getElementBBox(b),d=$(window);a.viewport.selector||(c.width=d.width()+d.scrollLeft(),c.height=d.height()+d.scrollTop());var e=a.viewport.padding||0;return c.x+=e,c.y+=e,c.width-=2*e,c.height-=2*e,c},getPosition:function(a,b,c,d){var e=this.settings,f=e.position||"left",g=e.padding,h=Math.min(e.minResizedWidth,c.width+g),i={left:function(f){var i={x:a.x+a.width+g,y:b.y+b.height/2-c.height/2};if(f){var j=d.x+d.width-i.x;if(j>h&&j<c.width+g&&(i.width=j),j<h)return e.position="right",this.right(!1)}return i},right:function(f){var i={x:a.x-c.width-g,y:b.y+b.height/2-c.height/2};if(f){var j=a.x-g-d.x;if(j>h&&j<c.width+g&&(i.width=j,i.x=d.x),j<h)return e.position="left",this.left(!1)}return i},top:function(f){var h={x:b.x+b.width/2-c.width/2,y:a.y+a.height+g};if(f){var i=d.y+d.height-(a.y+a.height+g);if(i<c.height)return e.position="bottom",this.bottom(!1)}return h},bottom:function(f){var h={x:b.x+b.width/2-c.width/2,y:a.y-c.height-g};if(f){var i=a.y-g-d.y;if(i<c.height)return e.position="top",this.top(!1)}return h}};return i[f](h>0)},getTooltipBBox:function(a,b){var c,d,e=this.measureTooltipElement();c=$(this.settings.positionSelector),d=c[0]?joint.util.getElementBBox(c[0]):a;var f=this.getPosition(d,a,e,b);f.y<b.y?f.y=b.y:f.y+e.height>b.y+b.height&&(f.y=b.y+b.height-e.height);var g=f.width||e.width;return f.x<b.x?f.x=b.x:f.x+g>b.x+b.width&&(f.x=b.x+b.width-g),f},measureTooltipElement:function(){var a=this.$el.clone().appendTo($("body")).css({left:-1e3,top:-500}),b={width:a.outerWidth(),height:a.outerHeight()};return a.remove(),b}});
90joint.ui.Snaplines=joint.mvc.View.extend({options:{paper:void 0,distance:10},className:"snaplines",init:function(){joint.util.bindAll(this,"hide"),this.$horizontal=$("<div>").addClass("snapline horizontal").appendTo(this.el),this.$vertical=$("<div>").addClass("snapline vertical").appendTo(this.el),this.$el.hide().appendTo(this.options.paper.el),this.startListening()},startListening:function(){this.stopListening(),this.listenTo(this.options.paper,"cell:pointerdown",this.captureCursorOffset),this.listenTo(this.options.paper,"cell:pointermove",this.snapWhileMoving),this.listenTo(this.options.paper.model,"batch:stop",this.onBatchStop),$(document).on("mouseup touchend",this.hide),this.filterTypes={},this.filterCells={},this.filterFunction=void 0,Array.isArray(this.options.filter)?this.options.filter.forEach(function(a){joint.util.isString(a)?this.filterTypes[a]=!0:this.filterCells[a.id]=!0},this):joint.util.isFunction(this.options.filter)&&(this.filterFunction=this.options.filter)},onBatchStop:function(a){a=a||{},"resize"===a.batchName&&this.snapWhileResizing(a.cell,a)},captureCursorOffset:function(a,b,c,d){if(this.canElementMove(a)){var e=a.model.get("position");this._cursorOffset={x:c-e.x,y:d-e.y}}},snapWhileResizing:function(a,b){if(b.ui&&!b.snapped&&b.direction&&b.trueDirection){var c=this.options.paper.findViewByModel(a);if(c&&c.model.isElement()){var d=a.getBBox(),e=d.bbox(a.get("angle")),f=e.origin(),h=e.corner(),i=g.normalizeAngle(a.get("angle")),j=this.options.distance,k=null,l=null,m={vertical:0,horizontal:0},n=b.direction,o=b.trueDirection,p=b.relativeDirection;if(o.indexOf("right")!==-1?m.vertical=h.x:m.vertical=f.x,o.indexOf("bottom")!==-1?m.horizontal=h.y:m.horizontal=f.y,this.options.paper.model.getElements().find(function(b){if(b.id===a.id||b.isEmbeddedIn(a)||this.filterTypes[b.get("type")]||this.filterCells[b.id]||this.filterFunction&&this.filterFunction(b))return!1;var c=b.getBBox().bbox(b.get("angle")),d=c.origin(),e=c.corner(),f={vertical:[d.x,e.x],horizontal:[d.y,e.y]};return joint.util.forIn(f,function(a,b){a=a.map(function(a){return{position:a,distance:Math.abs(a-m[b])}}),a=a.filter(function(a){return a.distance<j}),a=joint.util.sortBy(a,function(a){return a.distance}),f[b]=a}),null===k&&f.vertical.length>0&&(k=f.vertical[0].position),null===l&&f.horizontal.length>0&&(l=f.horizontal[0].position),joint.util.isNumber(k)&&joint.util.isNumber(l)},this),this.hide(),joint.util.isNumber(k)||joint.util.isNumber(l)){var q=0;joint.util.isNumber(k)&&(q=o.indexOf("right")!==-1?k-e.corner().x:e.origin().x-k);var r=0;joint.util.isNumber(l)&&(r=o.indexOf("bottom")!==-1?l-e.corner().y:e.origin().y-l);var s=0,t=0,u=!(i%90);if(u)90===i||270===i?(s=r,t=q):(s=q,t=r);else{var v;v=i>=0&&i<90?1:i>=90&&i<180?4:i>=180&&i<270?3:2,l&&k&&(r>q?(r=0,l=null):(q=0,k=null));var w=g.toRad(i%90);q&&(s=3===v?q/Math.cos(w):q/Math.sin(w)),r&&(t=3===v?r/Math.cos(w):r/Math.sin(w));var x=1===v||3===v;
90switch(p){case"top":case"bottom":t=r?r/(x?Math.cos(w):Math.sin(w)):q/(x?Math.sin(w):Math.cos(w));break;case"left":case"right":s=q?q/(x?Math.cos(w):Math.sin(w)):r/(x?Math.sin(w):Math.cos(w))}}switch(p){case"top":case"bottom":s=0;break;case"left":case"right":t=0}var y=this.options.paper.options.gridSize,z=Math.max(d.width+s,y),A=Math.max(d.height+t,y);b.minWidth&&b.minWidth>y&&(z=Math.max(z,b.minWidth)),b.minHeight&&b.minHeight>y&&(A=Math.max(A,b.minHeight)),b.maxWidth&&(z=Math.min(z,b.maxWidth)),b.maxHeight&&(A=Math.min(A,b.maxHeight)),b.preserveAspectRatio&&(s>t?A=z*(d.height/d.width):z=A*(d.width/d.height)),z===d.width&&A===d.height||a.resize(z,A,{snaplines:this.cid,restrictedArea:this.options.paper.getRestrictedArea(c),direction:n,relativeDirection:p,trueDirection:o,snapped:!0});var B=a.getBBox().bbox(i),C=1;k&&Math.abs(B.x-k)>C&&Math.abs(B.width+B.x-k)>C&&(k=null),l&&Math.abs(B.y-l)>C&&Math.abs(B.height+B.y-l)>C&&(l=null),this.show({vertical:k,horizontal:l})}}}},canElementMove:function(a){return a&&a.model.isElement()&&a.can("elementMove")},snapWhileMoving:function(a,b,c,d){if(this.canElementMove(a)){var e=a.model,f=e.get("position"),h=e.get("size"),i=g.rect(joint.util.assign({x:c-this._cursorOffset.x,y:d-this._cursorOffset.y},h)),j=i.center(),k=i.bbox(e.get("angle")),l=k.origin(),m=k.corner(),n=this.options.distance,o=null,p=null,q=0,r=0;if(this.options.paper.model.getElements().find(function(a){if(a===e||a.isEmbeddedIn(e)||this.filterTypes[a.get("type")]||this.filterCells[a.id]||this.filterFunction&&this.filterFunction(a))return!1;var b=a.getBBox().bbox(a.get("angle")),c=b.center(),d=b.origin(),f=b.corner();return null===o&&(Math.abs(c.x-j.x)<n?(o=c.x,q=.5):Math.abs(d.x-l.x)<n?o=d.x:Math.abs(d.x-m.x)<n?(o=d.x,q=1):Math.abs(f.x-m.x)<n?(o=f.x,q=1):Math.abs(f.x-l.x)<n&&(o=f.x)),null===p&&(Math.abs(c.y-j.y)<n?(p=c.y,r=.5):Math.abs(d.y-l.y)<n?p=d.y:Math.abs(d.y-m.y)<n?(p=d.y,r=1):Math.abs(f.y-m.y)<n?(p=f.y,r=1):Math.abs(f.y-l.y)<n&&(p=f.y)),joint.util.isNumber(o)&&joint.util.isNumber(p)},this),this.hide(),joint.util.isNumber(o)||joint.util.isNumber(p)){joint.util.isNumber(o)&&(k.x=o-q*k.width),joint.util.isNumber(p)&&(k.y=p-r*k.height);var s=k.center(),t=s.x-i.width/2,u=s.y-i.height/2;e.translate(t-f.x,u-f.y,{restrictedArea:this.options.paper.getRestrictedArea(a),snapped:!0}),this.show({vertical:o,horizontal:p})}}},show:function(a){a=a||{};var b=this.options.paper.matrix();a.horizontal?this.$horizontal.css("top",a.horizontal*b.d+b.f).show():this.$horizontal.hide(),a.vertical?this.$vertical.css("left",a.vertical*b.a+b.e).show():this.$vertical.hide(),this.$el.show()},hide:function(){this.$el.hide()},onRemove:function(){$(document).off("mouseup",this.hide)}});
91joint.ui.TextEditor=joint.mvc.View.extend({options:{text:void 0,newlineCharacterBBoxWidth:10,placeholder:void 0,focus:!0,debug:!1,useNativeSelection:!0,annotateUrls:!1,urlAnnotation:{attrs:{"class":"url-annotation",fill:"lightblue","text-decoration":"underline"}},textareaAttributes:{autocorrect:"off",autocomplete:"off",autocapitalize:"off",spellcheck:"false",tabindex:"0"}},className:"text-editor",events:{"keyup textarea":"onKeyup","input textarea":"onInput","copy textarea":"onCopy","cut textarea":"onCut","paste textarea":"onPaste","mousedown .char-selection-box":"onMousedown","dblclick .char-selection-box":"onDoubleClick","click .char-selection-box":"onTripleClick"},selection:{start:null,end:null},selecting:!1,init:function(){joint.util.bindAll(this,"onMousedown","onMousemove","onMouseup","onDoubleClick","onTripleClick","onKeydown","onAfterPaste","onAfterKeydown"),this.setTextElement(this.options.text),$(document.body).on("mousemove",this.onMousemove),$(document.body).on("mouseup",this.onMouseup),$(document.body).on("keydown",this.onKeydown),this.options.cellView?this.$viewport=$(this.options.cellView.paper.viewport):this.$viewport=$(this.options.text),this.options.annotations&&this.setAnnotations(this.options.annotations)},setTextElement:function(a){this.$elText&&this.unbindTextElement(),this.options.text=a,this.$elText=$(a),this.$elText.on("mousedown",this.onMousedown),this.$elText.on("dblclick",this.onDoubleClick),this.$elText.on("click",this.onTripleClick)},render:function(a){this.$caret=$("<div>",{"class":"caret"}),this.$selection=$("<div>"),this.$selectionBox=$("<div>",{"class":"char-selection-box"}),this.$el.append(this.$caret,this.$selection),this.$textareaContainer=$("<div>",{"class":"textarea-container"}),this.$textarea=$("<textarea>",this.options.textareaAttributes),this.textarea=this.$textarea[0],this._textContent=this.textarea.value=this.getTextContent(),this._textareaValueBeforeInput=this.textarea.value,this.$textareaContainer.append(this.textarea),this.options.focus&&this.$el.append(this.$textareaContainer),$(a||document.body).append(this.$el);var b=V(this.options.text).bbox();return this.$textareaContainer.css({left:b.x,top:b.y}),this.focus(),V(this.options.text).attr("cursor","text"),this.selectAll(),this},annotateURLBeforeCaret:function(a){var b=this.getURLBoundary(Math.max(a-1,0));return!!b&&(this.annotateURL(this.getAnnotations()||[],b[0],b[1]),!0)},hasSelection:function(){return joint.util.isNumber(this.selection.start)&&joint.util.isNumber(this.selection.end)&&this.selection.start!==this.selection.end},textContentHasChanged:function(){return this._textContent!==this.textarea.value},restoreTextAreaSelectionDirection:function(){this._selectionDirection&&(this.textarea.selectionDirection=this._selectionDirection)},storeSelectionDirection:function(){this._selectionDirection=this.textarea.selectionDirection},onKeydown:function(a){this.options.debug&&console.log("onKeydown(): ",a.keyCode),this.hasSelection()&&(this.deselect(),this.restoreTextAreaSelectionDirection()),setTimeout(this.onAfterKeydown,0),this._copied=!1,this._selectionStartBeforeInput=this.textarea.selectionStart,this._selectionEndBeforeInput=this.textarea.selectionEnd},onAfterKeydown:function(){this.$textarea.is(":focus")&&(this.storeSelectionDirection(),this.textarea.selectionStart===this.textarea.selectionEnd?this.setCaret(this.textarea.selectionStart):this.select(this.textarea.selectionStart,this.textarea.selectionEnd))},onKeyup:function(a){this.textContentHasChanged()&&this.onInput(a)},onCopy:function(a){this._copied||this.copyToClipboard()},onCut:function(a){this._copied||this.copyToClipboard()},copyToClipboard:function(){var a=document.queryCommandSupported&&document.queryCommandSupported("copy");a&&(this._copied=!0,document.execCommand("copy"))}
91,onInput:function(a){if(this.textContentHasChanged()){var b=this.textarea.value.length-this._textareaValueBeforeInput.length,c={start:this._selectionStartBeforeInput,end:this._selectionEndBeforeInput},d={start:this.textarea.selectionStart,end:this.textarea.selectionEnd};this.options.debug&&console.log("onInput()",a,"selectionBeforeInput",c,"selectionAfterInput",d,"diffLength",b);var e=this.inferTextOperationType(c,d,b),f=!1,g=this.getAnnotations();if(this.options.annotateUrls&&"insert"===e){var h=this.textarea.value.substr(c.start,b);this.options.debug&&console.log("onInput()","inserted text",h),/\s/.test(h)&&(f=this.annotateURLBeforeCaret(c.start),f&&(g=this.shiftAnnotations(g,d.end,b)))}if(g&&(f||(g=this.annotate(g,c,d,b)),this.options.debug&&console.log("onInput()","modified annotations",g),this._currentAnnotationAttributes&&"insert"===e)){var i={start:c.start,end:d.end,attrs:this._currentAnnotationAttributes};g.push(i),this._currentAnnotationAttributes=void 0,this.options.debug&&console.log("onInput()","insert annotation",i,"final annotations",g)}this._annotations=g,this.trigger("text:change",this.textarea.value,this._textareaValueBeforeInput,g,c,d),this._selectionBeforeInput=d,this._textareaValueBeforeInput=this.textarea.value,this._textContent=this.textarea.value}},onPaste:function(a){this.options.debug&&console.log("onPaste()"),this._textareaValueBeforeInput=this.textarea.value,setTimeout(this.onAfterPaste,0)},onAfterPaste:function(){this.setCaret(this.textarea.selectionStart)},onMousedown:function(a){if(3!==a.originalEvent.detail){this.options.debug&&console.log("onMousedown()");var b=this.getCharNumFromEvent(a);this.startSelecting(),this.select(b),a.preventDefault(),a.stopPropagation()}},onMousemove:function(a){if(this.selectionInProgress()){this.options.debug&&console.log("onMousemove()");var b=this.getCharNumFromEvent(a);this.storeSelectionDirection(),this.select(null,b),a.preventDefault(),a.stopPropagation()}},onMouseup:function(a){this.selectionInProgress()&&(this.options.debug&&console.log("onMouseup()"),this.stopSelecting(),this.trigger("select:changed",this.selection.start,this.selection.end))},onDoubleClick:function(a){this.options.debug&&console.log("onDoubleClick()");var b=this.getCharNumFromEvent(a),c=this.getWordBoundary(b);this.select(c[0],c[1]),a.preventDefault(),a.stopPropagation()},onTripleClick:function(a){3===a.originalEvent.detail&&(this.options.debug&&console.log("onTripleClick()"),this.hideCaret(),this.selectAll(),a.preventDefault(),a.stopPropagation())},findAnnotationsUnderCursor:function(a,b){return V.findAnnotationsAtIndex(a,b)},findAnnotationsInSelection:function(a,b,c){return V.findAnnotationsBetweenIndexes(a,b,c)},inferTextOperationType:function(a,b,c){return a.start===a.end&&b.start===b.end&&c>0?"insert":a.start===a.end&&b.start===b.end&&c<=0?"delete-single":a.start!==a.end&&b.start===b.end&&b.start===a.start?"delete":a.start!==a.end&&b.start!==a.start?"delete-insert":void 0},annotate:function(a,b,c,d){var e=[],f=this.inferTextOperationType(b,c,d);return joint.util.toArray(a).forEach(function(a){var g,h;switch(f){case"insert":a.start<b.start&&b.start<=a.end?a.end+=d:a.start>=b.start&&(a.start+=d,a.end+=d);break;case"delete-single":a.start<b.start&&b.start<=a.end&&b.start!==c.start?a.end+=d:a.start<=b.start&&b.start<a.end&&b.start===c.start?a.end+=d:a.start>=b.start&&(a.start+=d,a.end+=d);break;case"delete":a.start<=b.start&&b.start<=a.end?b.end<=a.end?a.end+=d:a.end+=c.start-a.end:a.start>=b.start&&a.start<b.end?(g=a.end-a.start,h=b.end-a.start,a.start=b.start,a.end=a.start+g-h):a.start>=b.end&&(a.start+=d,a.end+=d);break;case"delete-insert":if(a.start<=b.start&&b.start<=a.end)b.start<a.end&&(b.end>a.end?a.end=c.end:a.end=c.end+(a.end-b.end));else if(a.start>=b.start&&a.start<=b.end){var i=c.start-b.start;h=b.end-a.start,g=a.end-a.start,a.start=b.start+i,a.end=a.start+g-h}else a.start>=b.start&&a.end<=b.end?a.start=a.end=0:a.start>=b.end&&(a.start+=d,a.end+=d);break;default:this.options.debug&&console.log("ui.TextEditor: Unknown text operation.")}a.end>a.start&&e.push(a)},this),e},shiftAnnotations:function(a,b,c){return V.shiftAnnotations(a,b,c)},setCurrentAnnotation:function(a){this._currentAnnotationAttributes=a},setAnnotations:function(a){this._annotations=a},getAnnotations:function(){return this._annotations},getCombinedAnnotationAttrsAtIndex:function(a,b){var c={};return joint.util.toArray(b).forEach(function(b){void 0===b.start&&void 0===b.end?V.mergeAttrs(c,b.attrs):a>=b.start&&a<b.end&&V.mergeAttrs(c,b.attrs)}),c},getSelectionAttrs:function(a,b){var c=a.start,d=a.end;if(c===d&&0===c)return this.getCombinedAnnotationAttrsAtIndex(c,b);if(c===d)return this.getCombinedAnnotationAttrsAtIndex(c-1,b);for(var e,f=c;f<d;f++){var g=this.getCombinedAnnotationAttrsAtIndex(f,b);if(e&&!joint.util.isEqual(e,g)){e=joint.util.flattenObject(V.mergeAttrs({},e)),g=joint.util.flattenObject(V.mergeAttrs({},g));var h={};joint.util.forIn(g,function(a,b){e[b]===g[b]&&joint.util.setByPath(h,b,a)}),e=h}else e=g}return e}
91,getTextContent:function(){var a=this.options.text,b=V(a).find(".v-line");return 0===b.length?a.textContent:b.reduce(function(a,b,c,d){var e=b.node.textContent;return b.hasClass("v-empty-line")&&(e=""),c===d.length-1?a+e:a+e+"\n"},"")},startSelecting:function(){this.selecting=!0},stopSelecting:function(){this.selecting=!1},selectionInProgress:function(){return this.selecting===!0},selectAll:function(){return this.select(0,this.getNumberOfChars())},select:function(a,b){return this.options.debug&&console.log("select(",a,b,")"),void 0===b&&(b=a),joint.util.isNumber(a)&&(this.selection.start=a),joint.util.isNumber(b)&&(this.selection.end=b),joint.util.isNumber(this.selection.end)||(this.selection.end=this.selection.start),joint.util.isNumber(this.selection.start)&&joint.util.isNumber(this.selection.end)&&(this.selection.start===this.selection.end?(this.clearSelection(),this.focus(),this.setCaret(this.selection.start)):(this.hideCaret(),this.renderSelection(this.selection.start,this.selection.end)),this.trigger("select:change",this.selection.start,this.selection.end)),this},setTextAreaSelection:function(a,b){var c={start:a,end:b};c=this.normalizeSelectionRange(c),this.textarea.focus(),this.textarea.selectionStart=c.start,this.textarea.selectionEnd=c.end},renderSelection:function(a,b){this.options.debug&&console.log("renderSelection()");var c={start:a,end:b};if(c=this.normalizeSelectionRange(c),this.clearSelection(),this.options.useNativeSelection){this.$viewport&&(this._viewportUserSelectBefore=this.$viewport.css("user-select"),this.$viewport.css({"-webkit-user-select":"all","-moz-user-select":"all","user-select":"all"}));var d=c.end-c.start;this.selectTextInElement(this.options.text,c.start,d)}else this.renderSelectionBoxes(c.start,c.end)},normalizeSelectionStartAndLength:function(a,b,c){var d=a.substr(0,b),e=a.substr(b,c),f=this.countLineBreaks(d),g=this.countLineBreaks(e);b-=f,c-=g;var h=this.countEmptyLines(d),i=this.countEmptyLines(e);return b+=h,c+=h,c-=h,c+=i,{start:b,length:c}},selectTextInElement:function(a,b,c){if(joint.util.isFunction(a.selectSubString)&&this.selectTextInElementUsingSelectSubString(a,b,c),!this.actualSelectionMatchesExpectedSelection(b,c))try{this.selectTextInElementUsingRanges(a,b,c)}catch(d){this.options.debug&&console.log(d),joint.util.isFunction(a.selectSubString)&&this.selectTextInElementUsingSelectSubString(a,b,c)}},selectTextInElementUsingSelectSubString:function(a,b,c){var d=this.normalizeSelectionStartAndLength(this.getTextContent(),b,c);try{a.selectSubString(d.start,d.length)}catch(e){this.options.debug&&console.log(e)}},selectTextInElementUsingRanges:function(a,b,c){var d=window.getSelection();d.removeAllRanges();var e=this.normalizeSelectionStartAndLength(this.getTextContent(),b,c);b=0+e.start,c=0+e.length;for(var f,g,h,i,j,k,l=this.getTextNodesFromDomElement(a),m=0,n=b+c;c>0&&l.length>0;)f=l.shift(),h=m,i=m+f.length,(h>=b&&h<n||i>b&&i<=n||b>=h&&b<i||n>h&&n<=i)&&(j=Math.max(b-h,0),k=Math.min(j+Math.min(c,f.length),i),g=document.createRange(),g.setStart(f,j),g.setEnd(f,k),d.addRange(g),c-=k-j),m+=f.length},actualSelectionMatchesExpectedSelection:function(a,b){var c=window.getSelection(),d=c.toString(),e=this.getExpectedSelectedContent(a,b);return d=d.replace(/\s/g," "),e===d},getExpectedSelectedContent:function(a,b){var c=this.getTextContent(),d=c.substr(a,b);return d=d.replace(/(\n\r|\r|\n){2,}/g,"-"),d=d.replace(/\n\r|\r|\n/g,""),d=d.replace(/\s/g," ")},getTextNodesFromDomElement:function(a){for(var b=[],c=0,d=a.childNodes.length;c<d;c++){var e=a.childNodes[c];void 0!==e.tagName?b=b.concat(this.getTextNodesFromDomElement(e)):b.push(e)}return b},renderSelectionBoxes:function(a,b){this.options.debug&&console.log("renderSelectionBoxes()"),this.$selection.empty();for(var c,d,e,f=this.getFontSize(),g=this.getTextTransforms(),h=g.rotation,i=a;i<b;i++){var j=this.$selectionBox.clone();try{e=this.getCharBBox(i)}catch(k){this.trigger("select:out-of-range",a,b);break}d&&0===h&&Math.round(e.y)===Math.round(d.y)&&Math.round(e.height)===Math.round(d.height)&&Math.round(e.x)===Math.round(d.x+d.width)?c.css({width:"+="+e.width}):(j.css({left:e.x,top:e.y-e.height,width:e.width,height:e.height,"-webkit-transform":"rotate("+h+"deg)","-webkit-transform-origin":"0% 100%","-moz-transform":"rotate("+h+"deg)","-moz-transform-origin":"0% 100%"}),this.$selection.append(j),c=j),d=e}e&&this.$textareaContainer.css({left:e.x,top:e.y-f*g.scaleY})},clearSelection:function(){return this.options.debug&&console.log("clearSelection()"),this.$selection.empty(),this.options.text.selectSubString&&(this.$viewport&&this._viewportUserSelectBefore&&this.$viewport.css({"-webkit-user-select":this._viewportUserSelectBefore,"-moz-user-select":this._viewportUserSelectBefore,"user-select":this._viewportUserSelectBefore}),window.getSelection().removeAllRanges()),this},deselect:function(){return this.options.debug&&console.log("deselect()"),this.stopSelecting(),this.clearSelection(),this.setTextAreaSelection(this.selection.start,this.selection.end),this},getSelectionStart:function(){return this.selection.start},getSelectionEnd:function(){return this.selection.end},getSelectionRange:function(){return this.normalizeSelectionRange(this.selection)},normalizeSelectionRange:function(a){return a=joint.util.clone(a),a.start>a.end&&(a.end=[a.start,a.start=a.end][0]),a},getSelectionLength:function(){var a=this.getSelectionRange();return a.end-a.start},getSelection:function(){var a=this.getSelectionRange();return this.getTextContent().slice(a.start,a.end)},getWordBoundary:function(a){for(var b=this.textarea.value,c=/\W/,d=a;d;){if(c.test(b[d])){d+=1;break}d-=1}for(var e=this.getNumberOfChars(),f=a;f<=e&&!c.test(b[f]);)f+=1;return d<f?[d,f]:[f,d]},getURLBoundary:function(a){for(var b=this.textarea.value,c=/\s/,d=/[-a-zA-Z0-9@:%_+.~#?&\/\/=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_+.~#?&\/\/=]*)?/,e=a;e;){if(c.test(b[e])){e+=1;break}e-=1}for(var f=this.getNumberOfChars(),g=a;g<=f&&!c.test(b[g]);)g+=1;if(d.test(b.substring(e,g)))return[e,g]},annotateURL:function(a,b,c){var d=this.textarea.value.substring(b,c),e=joint.util.assign({url:d},this.options.urlAnnotation);return e.start=b,e.end=c,joint.util.isEqual(e,a[a.length-1])||a.push(e),a}
91,getCharBBox:function(a){if(this.isLineEnding(a)){var b=this.getCharBBox(a-1);return b.x=b.x2,b.y=b.y2,b.width=this.options.newlineCharacterBBoxWidth||10,b}var c=this.realToSvgCharNum(a),d=this.options.text,e=d.getStartPositionOfChar(c),f=d.getEndPositionOfChar(c),g=d.getExtentOfChar(c);e=this.localToScreenCoordinates(e),f=this.localToScreenCoordinates(f);var h=this.getTextTransforms(),i=e.x,j=e.y,k=g.width*h.scaleX,l=g.height*h.scaleY;return{x:i,y:j,width:k,height:l,x2:f.x,y2:f.y}},realToSvgCharNum:function(a){for(var b=0,c=0;c<=a;c++)this.isLineEnding(c)&&(b+=1);return a-b},selectionStartToSvgCharNum:function(a){return a-this.nonEmptyLinesBefore(a)},isLineEnding:function(a){var b=this.textarea.value;return"\n"===b[a]&&a>0&&"\n"!==b[a-1]},svgToRealCharNum:function(a){for(var b=0,c=0;c<=a+b;c++)this.isLineEnding(c)&&(b+=1);return a+b},localToScreenCoordinates:function(a){return $(this.options.text).show(),V.transformPoint(a,this.options.text.getCTM())},getNumberOfChars:function(){return this.getTextContent().length},getCharNumFromEvent:function(a){var b=this.options.text,c=a.clientX,d=a.clientY,e=V(b).toLocalPoint(c,d),f=b.getCharNumAtPosition(e);if(f<0)return this.getNumberOfChars();var g=this.localToScreenCoordinates(e),h=this.getCharBBox(this.svgToRealCharNum(f));return Math.abs(h.x-g.x)<Math.abs(h.x+h.width-g.x)?this.svgToRealCharNum(f):this.svgToRealCharNum(f)+1},lineNumber:function(a){var b=this.textarea.value.substr(0,a);return this.countLineBreaks(b)},emptyLinesBefore:function(a){for(var b=this.textarea.value.split(/\n\r|\r|\n/g),c=this.lineNumber(a),d=0,e=c-1;e>=0;e--)b[e]||(d+=1);return d},countLineBreaks:function(a){return(a.match(/\n\r|\r|\n/g)||[]).length},countEmptyLines:function(a){return(a.match(/(\n\r|\r|\n){2,}/g)||[]).length},nonEmptyLinesBefore:function(a){return this.lineNumber(a)-this.emptyLinesBefore(a)},isEmptyLine:function(a){var b=this.textarea.value.split(/\n\r|\r|\n/g);return!b[a]},isEmptyLineUnderSelection:function(a){var b=this.lineNumber(a);return this.isEmptyLine(b)},getTextTransforms:function(){var a=this.options.text.getCTM();return V.decomposeMatrix(a)},getFontSize:function(){return parseInt(V(this.options.text).attr("font-size"),10)},getTextAnchor:function(){return V(this.options.text).attr("text-anchor")||""},setCaret:function(a,b){joint.util.isObject(a)&&(b=a,a=void 0),b=b||{};var c=this.options.text,d=this.getNumberOfChars(),e=this.selection.start,f=this.textarea.value;"undefined"!=typeof a&&(a=Math.min(Math.max(a,0),d),e=this.selection.start=this.selection.end=a),b.silent||this.trigger("caret:change",e),this.setTextAreaSelection(e,e),this.options.debug&&console.log("setCaret(",a,b,")","selectionStart",e,"isLineEnding",this.isLineEnding(e),"isEmptyLineUnderSelection",this.isEmptyLineUnderSelection(e),"svgCharNum",this.selectionStartToSvgCharNum(e),"nonEmptyLinesBefore",this.nonEmptyLinesBefore(e));var g;try{var h;this.isEmptyLineUnderSelection(e)||!this.isLineEnding(e)&&f.length!==e?(h=this.selectionStartToSvgCharNum(e),g=c.getStartPositionOfChar(h)):(h=this.selectionStartToSvgCharNum(e)-1,g=c.getEndPositionOfChar(h))}catch(i){this.trigger("caret:out-of-range",e),g={x:0,y:0}}var j=this.localToScreenCoordinates(g),k=this.getTextTransforms(),l=k.rotation,m=this.getFontSize()*k.scaleY;return this.options.placeholder&&this.$caret.toggleClass("placeholder",0===d),this.$caret.css({left:j.x,top:j.y+(d?-m:0),height:m,"line-height":m+"px","font-size":m+"px","-webkit-transform":"rotate("+l+"deg)","-webkit-transform-origin":"0% 100%","-moz-transform":"rotate("+l+"deg)","-moz-transform-origin":"0% 100%"}).attr({"text-anchor":this.getTextAnchor()}).show(),this.$textareaContainer.css({left:j.x,top:j.y+(d?-m:0)}),this.focus(),this},focus:function(){return this.options.debug&&console.log("focus()"),this.showCaret(),this},blur:function(){return this.options.debug&&console.log("blur()"),this.hideCaret(),this},showCaret:function(){return this.options.debug&&console.log("showCaret()"),this.$caret.show(),this},hideCaret:function(){return this.options.debug&&console.log("hideCaret()"),this.$caret.hide(),this},unbindTextElement:function(){this.$elText.off("mousedown",this.onMousedown),this.$elText.off("dblclick",this.onDoubleClick),this.$elText.off("click",this.onTripleClick)},onRemove:function(){this.deselect(),this.unbindTextElement(),$(document.body).off("mousemove",this.onMousemove),$(document.body).off("mouseup",this.onMouseup),$(document.body).off("keydown",this.onKeydown),V(this.options.text).attr("cursor","")}},joint.util.assign({getTextElement:function(a){var b=a.tagName.toUpperCase();if("TEXT"===b||"TSPAN"===b||"TEXTPATH"===b)return"TEXT"===b?a:this.getTextElement(a.parentNode)},edit:function(a,b){b=b||{};var c=b.update!==!1;this.options=joint.util.assign({},b,{update:c});var d=this.getTextElement(a);if(!d)return void(this.options.debug&&console.log("ui.TextEditor: cannot find a text element."));this.close(),this.ed=new joint.ui.TextEditor(joint.util.assign({text:d},b)),this.ed.on("all",this.trigger,this);var e;if(b.cellView){if(e=b.cellView.paper.el,this.cellViewUnderEdit=b.cellView,this.cellViewUnderEditInteractiveOption=this.cellViewUnderEdit.options.interactive,this.cellViewUnderEdit.options.interactive=!1,b.annotationsProperty&&!this.ed.getAnnotations()){var f=this.cellViewUnderEdit.model.prop(b.annotationsProperty);f&&this.ed.setAnnotations(this.deepCloneAnnotations(f))}}else{var g=V(d).svg();e=g.parentNode}return c&&this.ed.on("text:change",function(a,c,e){if(b.cellView){var f=null;if(b.textProperty&&(b.cellView.model.isLink()&&"labels"===b.textProperty.substr(0,"labels".length)&&(f=V($(V(d).node).closest(".label")[0]).index()),b.cellView.model.prop(b.textProperty,a,{textEditor:this.ed.cid})),b.annotationsProperty&&b.cellView.model.prop(b.annotationsProperty,this.deepCloneAnnotations(e),{rewrite:!0,textEditor:this.ed.cid}),null!==f){var g=V(b.cellView.el).find(".label");d=g[f].findOne("text"),this.ed.setTextElement(d.node)}}else V(d).text(a,e)},this),this.ed.render(e),this},close:function(){if(this.ed){if(this.ed.options.annotateUrls){var a=this.ed.getSelectionStart(),b=this.findAnnotationsUnderCursor(),c=b.find(function(a){return!!a.url&&a});if(!c){var d=this.ed.annotateURLBeforeCaret(a);d&&this.applyAnnotations(this.getAnnotations())}}this.ed.remove(),this.cellViewUnderEdit&&(this.cellViewUnderEdit.options.interactive=this.cellViewUnderEditInteractiveOption),this.ed=this.cellViewUnderEdit=this.cellViewUnderEditInteractiveOption=void 0}},applyAnnotations:function(a){var b=this.options;if(this.ed&&b.update){b.cellView&&b.annotationsProperty?(b.cellView.model.prop(b.annotationsProperty,this.deepCloneAnnotations(a),{rewrite:!0}),this.ed.setAnnotations(a)):V(this.ed.options.text).text(this.ed.getTextContent(),a);var c=this.getSelectionRange(),d=this.getSelectionLength();d>0?this.ed.select(c.start,c.end):this.ed.setCaret()}},deepCloneAnnotations:function(a){try{return JSON.parse(JSON.stringify(a))}catch(b){return}},proxy:function(a,b){if(this.ed)return this.ed[a].apply(this.ed,b)},setCurrentAnnotation:function(a){return this.proxy("setCurrentAnnotation",arguments)},getAnnotations:function(){return this.proxy("getAnnotations",arguments)},setCaret:function(){return this.proxy("setCaret",arguments)},deselect:function(){return this.proxy("deselect",arguments)},selectAll:function(){return this.proxy("selectAll",arguments)},select:function(){return this.proxy("select",arguments)},getNumberOfChars:function(){return this.proxy("getNumberOfChars",arguments)},getCharNumFromEvent:function(){return this.proxy("getCharNumFromEvent",arguments)},getWordBoundary:function(){return this.proxy("getWordBoundary",arguments)},findAnnotationsUnderCursor:function(){return this.proxy("findAnnotationsUnderCursor",[this.ed.getAnnotations(),this.ed.getSelectionStart()])},findAnnotationsInSelection:function(){if(this.ed){var a=this.ed.getSelectionRange();return this.proxy("findAnnotationsInSelection",[this.ed.getAnnotations(),a.start,a.end])}}
91,getSelectionAttrs:function(a){if(this.ed){var b=this.ed.getSelectionRange();return this.proxy("getSelectionAttrs",[b,a])}},getSelectionLength:function(){return this.proxy("getSelectionLength",arguments)},getSelectionRange:function(){return this.proxy("getSelectionRange",arguments)}},Backbone.Events));
92joint.ui.Dialog=joint.mvc.View.extend({className:"dialog",events:{"click .bg":"action","click .btn-close":"action","click .controls button":"action","mousedown .titlebar":"onDragStart","touchstart .titlebar":"onDragStart"},options:{draggable:!1,closeButtonContent:"&times;",closeButton:!0,inlined:!1,modal:!0,width:0,title:"",buttons:null,type:"",content:null},init:function(){joint.util.bindAll(this,"onDrag","onDragEnd"),this.buttons=this.options.buttons},render:function(){var a=$("<div/>",{"class":"bg","data-action":"close"}),b=$("<div/>",{"class":"fg"}),c=$("<div/>",{"class":"titlebar"}),d=$("<div/>",{"class":"body"}),e=$("<button/>",{"class":"btn-close","data-action":"close",html:this.options.closeButtonContent}),f=$("<div/>",{"class":"controls"});if(this.$el.toggleClass("draggable",!!this.options.draggable),this.options.type&&this.$el.attr("data-type",this.options.type),this.options.inlined&&this.$el.addClass("inlined"),this.options.modal&&this.$el.addClass("modal"),this.options.width&&b.width(this.options.width),this.options.title?c.append(this.options.title):c.addClass("empty"),this.options.content&&d.append(this.options.content),this.buttons){var g=[],h=[],i=[];this.buttons.forEach(function(a){var b=$("<button/>",{"class":"control-button",html:a.content,"data-action":a.action});a.position?"left"===a.position?(b.addClass(a.position),i.push(b)):"center"===a.position?(b.addClass(a.position),h.push(b)):(b.addClass(a.position),g.push(b)):g.push(b)}),g.reverse().forEach(function(a){f.append(a)}
92),i.forEach(function(a){f.append(a)}),h.forEach(function(a){f.append(a)})}return b.append(c,d,f),this.options.closeButton&&b.append(e),this.$el.empty().append(a,b),this},open:function(a){return this.delegateEvents(),this.on("action:close",this.close,this),$(document.body).on({"mousemove.dialog touchmove.dialog":this.onDrag,"mouseup.dialog touchend.dialog":this.onDragEnd}),$(a||document.body).append(this.render().el),this.$el.addClass("rendered"),this},close:function(){return this.remove(),this},onRemove:function(){$(document.body).off(".dialog",this.onDrag).off(".dialog",this.onDragStart)},action:function(a){var b=$(a.target).closest("[data-action]"),c=b.attr("data-action");c&&this.trigger("action:"+c)},onDragStart:function(a){this.options.draggable&&(a=joint.util.normalizeEvent(a),this._dx=a.clientX,this._dy=a.clientY,this._dragging=!0)},onDrag:function(a){if(this._dragging){a=joint.util.normalizeEvent(a);var b=this.$(".fg"),c=b.offset();b.css({top:c.top+(a.clientY-this._dy),left:c.left+(a.clientX-this._dx),margin:0}),this._dx=a.clientX,this._dy=a.clientY}},onDragEnd:function(){this._dragging=!1}});
93joint.ui.FlashMessage=joint.ui.Dialog.extend({className:joint.ui.Dialog.prototype.className+" flash-message",options:joint.util.merge({},joint.ui.Dialog.prototype.options,{closeButton:!0,modal:!1,cascade:!0,closeAnimation:{delay:2e3,duration:200,easing:"swing",properties:{opacity:0}},openAnimation:{duration:200,easing:"swing",properties:{opacity:1}}}),init:function(){joint.util.bindAll(this,"startCloseAnimation"),joint.ui.Dialog.prototype.init.apply(this,arguments),this.on("close:animation:complete",this.close,this)},open:function(){joint.ui.Dialog.prototype.open.apply(this,arguments);var a=this.$(".fg");return this._foregroundHeight=a.height(),this.addToCascade(),a.css("height",0),this.startOpenAnimation(),this.options.closeAnimation&&this.options.closeAnimation.delay&&setTimeout(this.startCloseAnimation,this.options.closeAnimation.delay),this},close:function(){return joint.ui.Dialog.prototype.close.apply(this,arguments),this.removeFromCascade(),this},addToCascade:function(){if(this.options.cascade){var a=this.constructor.top;this.$(".fg").css("top",a),this.constructor.top+=this._foregroundHeight+this.constructor.padding}this.constructor.opened.push(this)},removeFromCascade:function(){if(this.options.cascade){for(var a=this.constructor.opened,b=!1,c=0;c<a.length;c++){var d=a[c];if(d.options.cascade&&b){var e=parseInt(d.$(".fg").css("top"),10);d.$(".fg").css("top",e-this._foregroundHeight-this.constructor.padding)}d===this&&(b=!0)}b&&(this.constructor.top-=this._foregroundHeight+this.constructor.padding)}this.constructor.opened=joint.util.without(this.constructor.opened,this)},startCloseAnimation:function(){this.$(".fg").animate(this.options.closeAnimation.properties,joint.util.assign({complete:function(){this.trigger("close:animation:complete")}.bind(this)},this.options.closeAnimation))},startOpenAnimation:function(){var a=this.$(".fg");a.animate(joint.util.assign({},this.options.openAnimation.properties,{height:this._foregroundHeight}),joint.util.assign({complete:function(){this.trigger("open:animation:complete")}.bind(this)},this.options.openAnimation))}},{top:20,padding:15,opened:[],open:function(a,b,c){return c=c||{},new joint.ui.FlashMessage(joint.util.assign({title:b,type:"info",content:a},c)).open(c.target)},close:function(){joint.util.invoke(this.opened,"close")}});
94!function(a,b){"use strict";var c=function(){a.util.bindAll(this,"handleKey"),this.parser=new d,this.enable()};a.util.assign(c.prototype,b.Events),c.prototype.on=function(a,c,d){return b.Events.on.call(this,this.normalizeEvent(a),c,d),this},c.prototype.off=function(a,c,d){var e=a?this.normalizeEvent(a):null;return b.Events.off.call(this,e,c,d),this},c.prototype.normalizeEvent=function(a){if("object"==typeof a){for(var b=Object.keys(a),c={},d=0,e=b.length;d<e;d++){var f=b[d];c[this.normalizeEvent(f)]=a[f]}return c}return this.normalizeShortcut(a)},c.prototype.normalizeShortcut=function(a){if("all"===a.toLowerCase())return a;for(var b=this.parser.toEventObjectList(a),c=[],d=0;d<b.length;d++)c.push(this.hash(b[d]));return c.join(" ")},c.prototype.enable=function(){window.addEventListener?(document.addEventListener("keydown",this.handleKey,!1),document.addEventListener("keypress",this.handleKey,!1),document.addEventListener("keyup",this.handleKey,!1)):window.attachEvent&&(document.attachEvent("keydown",this.handleKey,!1),document.attachEvent("keypress",this.handleKey,!1),document.attachEvent("keyup",this.handleKey,!1))},c.prototype.disable=function(){window.removeEventListener?(document.removeEventListener("keydown",this.handleKey,!1),document.removeEventListener("keypress",this.handleKey,!1),document.removeEventListener("keyup",this.handleKey,!1)):window.detachEvent&&(document.detachEvent("keydown",this.handleKey,!1),document.detachEvent("keypress",this.handleKey,!1),document.detachEvent("keyup",this.handleKey,!1))},c.prototype.isActive=function(a,b){return this.isModifierActive(a,b)},c.prototype.isModifierActive=function(a,b){for(var c=this.parser.toEventObjectList(a),d=0;d<c.length;d++)if(c[d].modifiersCompare(b))return!0;return!1},c.prototype.hash=function(a){var b=function(a){return a?1:0}
94,c=[a.type,":",a.which,b(a.shiftKey),b(a.ctrlKey),b(a.altKey),b(a.metaKey)];return c.join("")},c.prototype.handleKey=function(a){if(!this.isUnsupportedElement(a)){var c=k.fromNative(a);b.Events.trigger.call(this,this.hash(c),a)}},c.prototype.isUnsupportedElement=function(a){var b=a.target||a.srcElement;if(b){var c=b.tagName.toUpperCase();return"INPUT"===c||"SELECT"===c||"TEXTAREA"===c||b.isContentEditable}return!1};var d=function(){};d.prototype={constructor:d,parseEventString:function(a){a=a||"";var b,c,e=a.split("+"),f=new k(0);for(c=0;c<e.length;c++){b=e[c];var g=this.getModifierPropertyName(b);g&&(f[g]=!0),1!==e.length&&void 0!==g||(f.which=d.getCode(b))}return f},toEventObjectList:function(a){var b=a.replace(/\s*\+\s*/gi,"+").split(" ");return b.map(this.composeEventObject,this)},composeEventObject:function(a){var b=a.split(":"),c=i.KEYDOWN,d=b[0];if(b.length>1&&(d=b[1],c=b[0]),j.indexOf(c)===-1)throw a+": invalid shortcut definition";var e=this.parseEventString(d);return c===i.KEYUP&&f[e.which]&&(e[f[e.which]]=!1),e.setType(c)},getModifierPropertyName:function(a){var b=e[a];return f[b]}},d.getCode=function(a){return h[a]||a.toUpperCase().charCodeAt(0)};var e={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,command:91,meta:91},f={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey"},g={226:"\\",57392:"ctrl",63289:"num",59:";",61:"=",173:"-"},h={backspace:8,tab:9,shift:16,ctrl:17,alt:18,meta:91,clear:12,enter:13,"return":13,esc:27,escape:27,capslock:20,space:32,left:37,up:38,right:39,down:40,del:46,"delete":46,home:36,end:35,insert:45,ins:45,pageup:33,pagedown:34,plus:187,minus:189,"-":189,",":188,".":190,"/":191,"`":192,"=":187,";":186,"'":222,"[":219,"]":221,"\\":220,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123},i={KEYPRESS:"keypress",KEYDOWN:"keydown",KEYUP:"keyup"},j=[i.KEYPRESS,i.KEYDOWN,i.KEYUP],k=function(a,b,c,d,e,f){this.which=a,this.shiftKey=b||!1,this.ctrlKey=c||!1,this.altKey=d||!1,this.metaKey=e||!1,this.type=f||i.KEYDOWN};k.fromNative=function(a){var b=a.which;a.type===i.KEYPRESS&&(b=String.fromCharCode(a.which).toUpperCase().charCodeAt(0)),g[b]&&(b=d.getCode(g[b]));var c=new k(b,a.shiftKey,a.ctrlKey,a.altKey,a.metaKey,a.type);return a.type===i.KEYUP&&f[b]&&(c[f[b]]=!1),c},k.prototype.modifiersCompare=function(a){return!(this.shiftKey&&this.shiftKey!==a.shiftKey||this.ctrlKey&&this.ctrlKey!==a.ctrlKey||this.altKey&&this.altKey!==a.altKey||this.metaKey&&this.metaKey!==a.metaKey)},k.prototype.setType=function(a){return this.type=a,this},a.ui.Keyboard=c}(joint,Backbone);
95joint.ui.Lightbox=joint.ui.Dialog.extend({className:joint.ui.Dialog.prototype.className+" lightbox",options:joint.util.merge({},joint.ui.Dialog.prototype.options,{closeButton:!0,modal:!0,downloadable:!1,downloadAction:"download",fileName:"Image",closeAnimation:{delay:2e3,duration:200,easing:"swing",properties:{opacity:0}},top:100,windowArea:.8,openAnimation:!1}),init:function(){if(joint.util.bindAll(this,"startCloseAnimation","positionAndScale"),joint.ui.Dialog.prototype.init.apply(this,arguments),this.options.image&&(this.$image=$("<img/>").on("load",this.positionAndScale),this.options.content=this.$image),this.options.downloadable){var a={action:this.options.downloadAction,content:"Download",position:"center"};this.buttons=Array.isArray(this.buttons)?this.buttons.slice():[],this.buttons.push(a)}this.on("action:"+this.options.downloadAction,this.download),$(window).on("resize",this.positionAndScale),this.on("close:animation:complete",this.remove,this)},open:function(){return joint.ui.Dialog.prototype.open.apply(this,arguments),this.$image&&this.$image.attr("src",this.options.image),this.positionAndScale(),this.startOpenAnimation(),this},positionAndScale:function(){var a=this.$(".fg"),b=this.$(".body > img"),c=this.$(".titlebar"),d=this.$(".controls"),e=this.options.windowArea,f=window.innerWidth*e;this.$el.css("margin-top",this.options.top),c.css("width",f);var g=c.height(),h=d.height(),i=window.innerHeight*e-this.options.top-g-h;a.css({width:f,height:i});var j=b.width(),k=b.height();a.css({width:j,height:k}),c.css("width","auto"),c.hasClass("empty")||d.css("top",c.outerHeight())},download:function(){joint.util.imageToDataUri(this.options.image,function(a,b){joint.util.downloadDataUri(b,this.options.fileName)}.bind(this))},close:function(){return this.options.closeAnimation?this.startCloseAnimation():joint.ui.Dialog.prototype.close.apply(this,arguments),this},onRemove:function(){joint.ui.Dialog.prototype.onRemove.apply(this,arguments),$(window).off("resize",this.positionAndScale),this.$image&&this.$image.off("load",this.positionAndScale)},startCloseAnimation:function(){this.$el.animate(this.options.closeAnimation.properties,joint.util.assign({complete:function(){this.trigger("close:animation:complete")}.bind(this)},this.options.closeAnimation))},startOpenAnimation:function(){this.$el.animate(joint.util.assign({},this.options.openAnimation.properties,{height:this._foregroundHeight}),joint.util.assign({complete:function(){this.trigger("open:animation:complete")}.bind(this)},this.options.openAnimation))}});
96joint.ui.ContextToolbar=joint.mvc.View.extend({className:"context-toolbar",eventNamespace:"context-toolbar",events:{"click .tool":"onToolPointerdown"},options:{padding:20,autoClose:!0},init:function(){joint.util.bindAll(this,"onDocumentMousedown")},render:function(){return this.constructor.opened&&this.constructor.close(),this.bind(),this.options.type&&this.$el.attr("data-type",this.options.type),$(this.getRoot()).append(this.$el),this.renderContent(),this.position(),this.constructor.opened=this,this}
96,renderContent:function(){var a=$("<div/>",{"class":"tools"});this.options.tools&&joint.util.toArray(this.options.tools).forEach(function(b){var c;c=b.icon?$("<img/>",{src:b.icon}):b.content;var d=$("<button/>",{"class":"tool",html:c,"data-action":b.action});b.attrs&&d.attr(b.attrs),a.append(d)}),this.$el.append(a)},getRoot:function(){return this.options.root||document.documentElement},position:function(){var a=joint.util.getElementBBox(this.options.target),b=joint.util.getElementBBox(this.getRoot()),c=this.$el.outerWidth(),d=a.x+a.width/2-c/2,e=a.y+a.height+this.options.padding;d-=b.x,e-=b.y,this.$el.css({left:d,top:e})},onRemove:function(){this.unbind(),this.constructor.opened=void 0},bind:function(){$(document).on("mousedown."+this.eventNamespace,this.onDocumentMousedown)},unbind:function(){return $(document).off("mousedown."+this.eventNamespace,this.onDocumentMousedown),this},onToolPointerdown:function(a){var b=$(a.target).closest("[data-action]"),c=b.attr("data-action");c&&this.trigger("action:"+c,a)},onDocumentMousedown:function(a){if(this.options.autoClose){var b=this.options.target;this.el.contains(a.target)||b.contains(a.target)||b===a.target||(this.constructor.close(),this.remove())}}},{opened:void 0,close:function(){this.opened&&(this.opened.remove(),this.opened=void 0)},update:function(){this.opened&&this.opened.position()}});
97joint.ui.Popup=joint.ui.ContextToolbar.extend({className:"popup",eventNamespace:"popup",events:{},renderContent:function(){var a=joint.util.isFunction(this.options.content)?this.options.content(this.el):this.options.content;a&&this.$el.html(a)}});
98joint.ui.SelectBox=joint.mvc.View.extend({className:"select-box",events:{"click .select-box-selection":"onToggle"},options:{options:[],width:void 0,openPolicy:"auto",target:null,keyboardNavigation:!0,selected:void 0,selectBoxOptionsClass:void 0,disabled:!1},init:function(){this.options.target=this.options.target||document.body,joint.util.bindAll(this,"onOutsideClick","onOptionSelect"),$(document).on("click.selectBox",this.onOutsideClick),this.$el.data("view",this),void 0===this.options.selected?this.selection=joint.util.toArray(this.options.options).find(function(a){return a.selected===!0})||this.options.options[0]:this.selection=this.options.options[this.options.selected]},render:function(){return this.$el.empty(),this.$selection=null,this.renderSelection(this.selection),this.options.width&&this.$el.css("width",this.options.width),this.options.disabled&&this.disable(),this.$el.append(this.$options),this},renderOptions:function(){this.removeOptions();var a=this.options,b={selectBoxView:this,parentClassName:joint.util.result(this,"className")||null,extraClassName:joint.util.result(a,"selectBoxOptionsClass")||null,options:a.options};a.width&&(b.width=a.width),a.theme&&(b.theme=a.theme);var c=this.optionsView=new this.constructor.OptionsView(b);c.render(),this.listenTo(c,"option:select",this.onOptionSelect),this.listenTo(c,"option:hover",this.onOptionHover),this.listenTo(c,"options:mouseout",this.onOptionsMouseOut),this.$options=c.$el,this.$optionsArrow=c.$arrow,this.$target=$(a.target)},onOptionHover:function(a,b){this.trigger("option:hover",a,b)},onOptionsMouseOut:function(a){this.trigger("options:mouseout",a)},onOptionSelect:function(a,b){this.select(a,b)},removeOptions:function(){this.optionsView&&(this.stopListening(this.optionsView),this.optionsView.remove(),this.optionsView=null)},renderSelection:function(a){if(this.$selection||(this.$selection=$("<div/>",{"class":"select-box-selection"}),this.$el.append(this.$selection)),this.$selection.empty(),a){var b=this.constructor.OptionsView.prototype.renderOptionContent.call(void 0,a);this.$selection.append(b)}else if(this.options.placeholder){var c=$("<div/>",{"class":"select-box-placeholder",html:this.options.placeholder});this.$selection.append(c)}},onToggle:function(a){this.toggle()},onOutsideClick:function(a){!this.el.contains(a.target)&&this.$el.hasClass("opened")&&this.close()},getSelection:function(){return this.selection},getSelectionValue:function(a){return a=a||this.selection,a&&(void 0===a.value?a.content:a.value)},getSelectionIndex:function(){return joint.util.toArray(this.options.options).findIndex(function(a){return a===this.selection}.bind(this))},select:function(a,b){this.selection=this.options.options[a],this.renderSelection(this.selection),this.trigger("option:select",this.selection,a,b),this.close()},selectByValue:function(a,b){for(var c=this.options.options||[],d=0;d<c.length;d++){var e=c[d];if(void 0===e.value&&e.content===a)return this.select(d,b);if(void 0!==e.value&&joint.util.isEqual(e.value,a))return this.select(d,b)}},isOpen:function(){return this.$el.hasClass("opened")},toggle:function(){this.isOpen()?this.close():this.open()},position:function(){var a=this.$(".select-box-selection"),b=a.outerHeight(),c=a.offset(),d=c.left,e=c.top,f=this.$options.outerHeight(),g={left:0,top:0};this.options.target!==document.body?(g=this.$target.offset(),g.width=this.$target.outerWidth(),g.height=this.$target.outerHeight(),g.left-=this.$target.scrollLeft(),g.top-=this.$target.scrollTop()):(g.width=$(window).width(),g.height=$(window).height());var h=d,i="auto",j=this.options.openPolicy;switch("selected"!==j||this.selection||(j="auto"),j){case"above":i=e-f;break;case"coverAbove":i=e-f+b;break;case"below":i=e+b;break;case"coverBelow":i=e;break;case"selected":var k=this.$options.find(".selected").position();i=e-k.top;break;default:var l=e-this.$target.scrollTop()+f>g.top+g.height;i=l?e-f+b:e}h-=g.left,i-=g.top,this.$options.css({left:h,top:i})},open:function(){this.isDisabled()||(this.renderOptions(),this.$options.appendTo(this.options.target),this.$options.addClass("rendered"),this.position(),this.$el.addClass("opened"),this.respectWindowBoundaries(),this.alignOptionsArrow())},respectWindowBoundaries:function(){var a=this.calculateElOverflow(this.$options),b={left:0,top:0};this.$options.outerWidth()<=this.$target.innerWidth()&&(a.left&&a.right||(a.left?b.left=a.left:a.right&&(b.left=-a.right))),this.$options.outerHeight()<=this.$target.innerHe
98ight()&&(a.top&&a.bottom||(a.top?b.top=a.top:a.bottom&&(b.top=-a.bottom))),this.$options.css({left:"+="+b.left,top:"+="+b.top})},alignOptionsArrow:function(){var a=this.$el[0].getBoundingClientRect(),b=this.$options[0].getBoundingClientRect(),c=a.left+a.width/2;c-=b.left,c-=this.$optionsArrow.outerWidth()/2,this.$optionsArrow.css({left:c})},close:function(){this.removeOptions(),this.$el.removeClass("opened"),this.trigger("close")},onRemove:function(){this.removeOptions(),$(document).off(".selectBox",this.onOutsideClick)},isDisabled:function(){return this.$el.hasClass("disabled")},enable:function(){this.$el.removeClass("disabled")},disable:function(){this.close(),this.$el.addClass("disabled")},onSetTheme:function(a,b){this.$options&&(a&&this.$options.removeClass(this.themeClassNamePrefix+a),this.$options.addClass(this.themeClassNamePrefix+b))},calculateElOverflow:function(a,b){b||(b=window),a instanceof $&&(a=a[0]),b instanceof $&&(b=b[0]);var c,d={},e=a.getBoundingClientRect();if(b===window){var f=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,g=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;c={width:f,height:g,left:0,top:0,right:f,bottom:g}}else c=b.getBoundingClientRect();return["left","top"].forEach(function(a){d[a]=Math.min(0,e[a]-c[a])}),["right","bottom"].forEach(function(a){d[a]=Math.min(0,c[a]-e[a])}),joint.util.forIn(d,function(a,b){d[b]=Math.abs(Math.round(a))}),d}},{OptionsView:joint.mvc.View.extend({events:{"mouseover .select-box-option":"onOptionHover","click .select-box-option":"onOptionClick"},className:function(){var a=["select-box-options"],b=this.options.parentClassName;return b&&a.push(b),a.join(" ")},init:function(){joint.util.bindAll(this,"onMouseout","onKeydown"),$(document).on({"keydown.selectBoxOptions":this.onKeydown,"mouseleave.
98selectBoxOptions mouseout.selectBoxOptions":this.onMouseout})},render:function(){var a=this.options.extraClassName;return a&&this.$el.addClass(a),this.options.width&&this.$el.css("width",this.options.width),joint.util.toArray(this.options.options).forEach(function(a,b){var c=this.renderOption(a,b);this.options.selectBoxView.selection===a&&c.addClass("selected hover"),this.$el.append(c)},this),this.$arrow=$("<div/>").addClass("select-box-options-arrow").appendTo(this.$el),this},renderOption:function(a,b){var c=this.renderOptionContent(a);return c.addClass("select-box-option"),c.data("index",b),c},renderOptionContent:function(a){var b=$("<div/>",{"class":"select-box-option-content",html:a.content});return a.icon&&b.prepend($("<img/>",{"class":"select-box-option-icon",src:a.icon})),b},select:function(a,b){this.trigger("option:select",a,b)},hover:function(a){var b=this.options.options[a];this.markOptionHover(a),this.trigger("option:hover",b,a)},onOptionClick:function(a){var b=this.getOptionIndex(a.target);this.select(b,{ui:!0})},onOptionHover:function(a){var b=this.getOptionIndex(a.target);this.hover(b)},onMouseout:function(a){this.trigger("options:mouseout",a)},onKeydown:function(a){var b=this.options.selectBoxView;if(b.options.keyboardNavigation&&b.isOpen()){var c;switch(a.which){case 39:case 40:c=1;break;case 38:case 37:c=-1;break;case 13:var d=this.getOptionHoverIndex();return void(d>=0&&this.select(d));case 27:return b.close();default:return}a.preventDefault();var e=this.getOptionHoverIndex(),f=e+c,g=this.options.options;f<0&&(f=g.length-1),f>=g.length&&(f=0),this.hover(f)}},onRemove:function(){$(document).off(".selectBoxOptions")},markOptionHover:function(a){this.$el.find(".hover").removeClass("hover"),$(this.$el.find(".select-box-option")[a]).addClass("hover")},getOptionHoverIndex:function(){return this.$el.find(".select-box-option.hover").index()},getOptionIndex:function(a){return $(a).closest(".select-box-option").data("index")}})});
99joint.ui.ColorPalette=joint.ui.SelectBox.extend({className:"select-box color-palette",position:function(){var a=this.$(".select-box-selection"),b=a.outerHeight(),c=a.offset(),d=c.left,e=c.top+b;if(this.options.target!==document.body){this.$target=this.$target||$(this.options.target);var f=this.$target.offset();d-=f.left-this.$target.scrollLeft(),e-=f.top-this.$target.scrollTop()}this.$options.css({left:d,top:e})}},{OptionsView:joint.ui.SelectBox.OptionsView.extend({renderOptionContent:function(a){var b=$("<div/>",{"class":"select-box-option-content"});return b.css("background-color",a.content),a.icon&&b.prepend($("<img/>",{"class":"select-box-option-icon",src:a.icon})),b}})});
100joint.ui.SelectButtonGroup=joint.mvc.View.extend({className:"select-button-group",events:{"click .select-button-group-button":"onSelect","mouseover .select-button-group-button":"onOptionHover",mouseleave:"onMouseOut","mousedown .select-button-group-button":"pointerdown","touchstart .select-button-group-button":"pointerdown","mouseup .select-button-group-button":"pointerup","touchend .select-button-group-button":"pointerup"},options:{buttonWidth:void 0,buttonHeight:void 0,options:[],disabled:!1,multi:!1,selected:void 0},init:function(){joint.util.bindAll(this,"onSelect","pointerup"),this.$el.data("view",this);var a=this.options.multi,b=this.options.options,c=this.options.selected;if(void 0===c){var d=joint.util.toArray(b).filter(function(a){return a&&a.selected===!0});this.selection=a?d:d[0]}else a?this.selection=Array.isArray(c)?b.filter(function(a,b){return c.includes(b)}):[b[c]]:this.selection=b[c]},render:function(){return this.renderOptions(this.selection),this.options.width&&this.$el.css("width",this.options.width),this.options.disabled&&this.disable(),this.$el.append(this.$options),this},renderOptions:function(){this.removeOptions();var a=this.options.multi;joint.util.toArray(this.options.options).forEach(function(b,c){var d=a?this.selection.includes(b):this.selection===b,e=this.renderOption(b,c,d);this.$el.append(e),d&&e.addClass("selected")},this)},removeOptions:function(){this.$el.empty()},renderOption:function(a,b,c){var d=this.renderOptionContent(a,c);d.data("index",b);var e=a.buttonWidth||this.options.buttonWidth;e&&d.css("width",e);var f=a.buttonHeight||this.options.buttonHeight;return f&&d.css("height",f),d},renderOptionContent:function(a,b){var c=$("<div/>",{"class":"select-button-group-button",html:a.content});if(a.icon||b&&a.iconSelected){var d=$("<img/>",{"class":"select-button-group-button-icon",src:b&&a.iconSelected?a.iconSelected:a.icon}),e=a.iconWidth||this.options.iconWidth;e&&d.css("width",e);var f=a.iconHeight||this.options.iconHeight;f&&d.css("height",f),c.prepend(d)}return joint.util.setAttributesBySelector(c,a.attrs),c},getOptionIndex:function(a){return $(a).closest(".select-button-group-button").data("index")}
100,onSelect:function(a){if(!this.isDisabled()){var b=this.getOptionIndex(a.target);this.select(b,{ui:!0})}},onOptionHover:function(a){if(!this.isDisabled()){var b=this.getOptionIndex(a.target);this.trigger("option:hover",this.options.options[b],b)}},onMouseOut:function(a){this.isDisabled()||this.trigger("mouseout",a)},getSelection:function(){return this.selection},getSelectionValue:function(a){if(a=a||this.selection)return this.options.multi?joint.util.toArray(a).map(function(a){return void 0===a.value?a.content:a.value}):void 0===a.value?a.content:a.value},select:function(a,b){var c=this.options.options[a],d=$(this.$(".select-button-group-button")[a]),e=this.options.multi;if(e){d.toggleClass("selected");var f=d.hasClass("selected");f?this.selection.indexOf(c)===-1&&this.selection.push(c):this.selection=joint.util.without(this.selection,c),c.iconSelected&&d.find(".select-button-group-button-icon").attr("src",f?c.iconSelected:c.icon)}else{this.selection=c;var g=this.$(".selected"),h=this.options.options[g.index()];g.removeClass("selected"),d.addClass("selected"),h&&h.iconSelected&&g.find(".select-button-group-button-icon").attr("src",h.icon),this.selection.iconSelected&&d.find(".select-button-group-button-icon").attr("src",this.selection.iconSelected)}this.trigger("option:select",this.selection,a,b)},selectByValue:function(a,b){Array.isArray(a)||(a=[a]);for(var c=this.options.options||[],d=0;d<c.length;d++){var e=c[d];if(void 0===e.value&&a.includes(e.content))this.select(d,b);else if(void 0!==e.value){var f=a.find(function(a){return joint.util.isEqual(a,e.value)});f&&this.select(d,b)}}},deselect:function(){this.$(".selected").removeClass("selected"),this.options.multi?this.selection=[]:this.selection=void 0},isDisabled:function(){return this.$el.hasClass("disabled")},enable:function(){this.$el.removeClass("disabled")},disable:function(){this.$el.addClass("disabled")},pointerdown:function(a){var b=this.getOptionIndex(a.target),c=$(this.$(".select-button-group-button")[b]);c.addClass("is-in-action"),$(document).on("mouseup.select-button-group touchend.select-button-group",this.pointerup)},pointerup:function(){this.$(".is-in-action").removeClass("is-in-action"),$(document).off("mouseup.select-button-group touchend.select-button-group")}});
101joint.ui.Navigator=joint.mvc.View.extend({className:"navigator",events:{mousedown:"startAction",touchstart:"startAction"},options:{paperConstructor:joint.dia.Paper,paperOptions:{},zoomOptions:null,zoom:{min:.5,max:2},width:300,height:200,padding:10},init:function(){this.options.zoomOptions?this.options.zoom=joint.util.assign({},this.options.zoom,this.options.zoomOptions):this.options.zoom&&(this.options.zoom=joint.util.defaults({},this.options.zoom,this.constructor.prototype.options.zoom)),joint.util.bindAll(this,"updateCurrentView","doAction","stopAction","scrollTo"),this.updateCurrentView=joint.util.debounce(this.updateCurrentView,0);var a=this.options.paperScroller;a.$el.on("scroll.navigator",this.updateCurrentView);var b=this.sourcePaper=a.options.paper;this.listenTo(b,"resize",this.updatePaper);var c=this.targetPaper=new this.options.paperConstructor(joint.util.merge({model:b.model,interactive:!1},this.options.paperOptions));c.$el.on({"mousedown.navigator":this.scrollTo,"touchstart.navigator":this.scrollTo}),$(document.body).on({"mousemove.navigator touchmove.navigator":this.doAction,"mouseup.navigator touchend.navigator":this.stopAction})},render:function(){this.targetPaper.$el.appendTo(this.el);var a=this.sourcePaper.model,b=a.getElements().concat(a.getLinks());if(b.forEach(this.targetPaper.renderView,this.targetPaper),this.$currentView=$("<div>").addClass("current-view"),this.options.zoom){var c=$("<div>").addClass("current-view-control");this.$currentView.append(c)}return this.$el.append(this.$currentView).css({width:this.options.width,height:this.options.height,padding:this.options.padding}),this.updatePaper(this.sourcePaper.options.width,this.sourcePaper.options.height),this},updatePaper:function(a,b){var c=this.sourcePaper.options.origin,d=this.sourcePaper.scale(),e=this.options.width-2*this.options.padding,f
101=this.options.height-2*this.options.padding;a/=d.sx,b/=d.sy;var g=this.ratio=Math.min(e/a,f/b),h=c.x*g/d.sx,i=c.y*g/d.sy;a*=g,b*=g,this.targetPaper.setDimensions(a,b),this.targetPaper.setOrigin(h,i),this.targetPaper.scale(g,g),this.updateCurrentView()},updateCurrentView:function(){var a=this.ratio,b=this.sourcePaper.scale(),c=this.options.paperScroller,d=c.clientToLocalPoint(0,0),e=this.targetPaper.$el.position(),f=this.targetPaper.translate();f.ty=f.ty||0,this.currentViewGeometry={top:e.top+d.y*a+f.ty,left:e.left+d.x*a+f.tx,width:c.$el.innerWidth()*a/b.sx,height:c.$el.innerHeight()*a/b.sy},this.$currentView.css(this.currentViewGeometry)},startAction:function(a){a=joint.util.normalizeEvent(a),this._action=$(a.target).hasClass("current-view-control")?"zooming":"panning",this._clientX=a.clientX,this._clientY=a.clientY},doAction:function(a){if(this._action){a=joint.util.normalizeEvent(a);var b=this.sourcePaper.scale(),c=(a.clientX-this._clientX)*b.sx,d=(a.clientY-this._clientY)*b.sy;switch(this._action){case"panning":this.options.paperScroller.el.scrollLeft+=c/this.ratio,this.options.paperScroller.el.scrollTop+=d/this.ratio;break;case"zooming":var e=-c/this.currentViewGeometry.width;this.options.paperScroller.zoom(e,this.options.zoom)}this._clientX=a.clientX,this._clientY=a.clientY}},stopAction:function(){this._action=null},scrollTo:function(a){a=joint.util.normalizeEvent(a);var b=this.targetPaper.translate();b.ty=b.ty||0;var c,d;if(void 0===a.offsetX){var e=this.targetPaper.$el.offset();c=a.pageX-e.left,d=a.pageY-e.top}else c=a.offsetX,d=a.offsetY;var f=(c-b.tx)/this.ratio,g=(d-b.ty)/this.ratio;this.options.paperScroller.center(f,g)},onRemove:function(){this.targetPaper.$el.off(".navigator"),this.targetPaper.remove(),this.options.paperScroller.$el.off(".navigator"),$(document.body).off(".navigator")}});
102joint.ui.TreeLayoutView=joint.mvc.View.extend({MINIMAL_PREVIEW_SIZE:10,className:"tree-layout",options:{previewAttrs:{parent:{rx:2,ry:2}},useModelGeometry:!1,clone:function(a){return a.clone()},canInteract:function(){return!0}},init:function(){joint.util.bindAll(this,"onPointermove","onPointerup"),this.toggleDefaultInteraction(!1),this.startListening(),this.render(),this.onSetTheme(null,this.theme)},startListening:function(){var a=this.options.paper;this.listenTo(a,"element:pointerdown",this.canInteract(this.onPointerdown))},toggleDefaultInteraction:function(a){this.options.paper.setInteractivity(a)},render:function(){var a=this.options.paper;return this.$activeBox=$("<div>").addClass("tree-layout-box active hidden").appendTo(this.el),this.draggingPaper=new joint.dia.Paper({model:new joint.dia.Graph,interactive:!1,width:"100%",height:"100%"}),this.$translateBox=$("<div>").addClass("tree-layout-box translate hidden").append(this.draggingPaper.render().el).appendTo(this.el),this.$mask=$("<div>").addClass("tree-layout-mask"),this.svgViewport=V(a.viewport),this.svgPreviewChild=V("circle").attr(this.options.previewAttrs.child||{}).addClass("tree-layout-preview child"),this.svgPreviewConnection=V("path").attr(this.options.previewAttrs.link||{}).addClass("tree-layout-preview link"),this.svgPreviewParent=V("rect").attr(this.options.previewAttrs.parent||{}).addClass("tree-layout-preview parent"),this.svgPreview=V("g").addClass("tree-layout-preview-group").append([this.svgPreviewConnection,this.svgPreviewParent,this.svgPreviewChild]),this.$el.appendTo(a.el),this},onSetTheme:function(a,b){var c=[this.svgPreview,this.$mask];c.forEach(function(c){c&&(a&&c.removeClass(this.themeClassNamePrefix+a),c.addClass(this.themeClassNamePrefix+b))},this)},onRemove:function(){this.svgPreview.remove()},toggleDropping:function(a){this.$mask.toggleClass("dropping-not-allowed",!a),this.$translateBox.toggleClass("no-drop",!a)},canDrop:function(){return this.isActive()&&!this.$translateBox.hasClass("no-drop")},isActive:function(){return!this.$translateBox.hasClass("hidden")},_startDrag:function(a,b,c){var d=this.options.paper;this.$mask.appendTo(d.el),this.toggleDropping(!1),this.ctm=d.matrix();var e=a[0],f=e.findView(d),g=f.getBBox({useModelGeometry:this.options.useModelGeometry});this.updateBox(this.$translateBox,joint.util.defaults({x:b,y:c},g)),this.updateBox(this.$activeBox,g),this.$activeBox.removeClass("hidden"),this.$translateBox.removeClass("hidden"),this.prepareDraggingPaper(e)}
102,updateBox:function(a,b){a.css({width:b.width,height:b.height,left:b.x,top:b.y})},positionTranslateBox:function(a){var b=V.transformPoint(a,this.ctm);this.$translateBox.css({left:b.x,top:b.y})},prepareDraggingPaper:function(a){var b=this.options.clone(a).position(0,0);this.draggingPaper.scale(this.ctm.a,this.ctm.d),this.draggingPaper.model.resetCells([b])},_doDrag:function(a,b,c){var d,e,f=this.model,g={x:b,y:c};if(this.candidate&&(this.candidate=null,this.hidePreview()),this.positionTranslateBox(g),d=f.getMinimalRootAreaByPoint(g),d&&(e=d.findMinimalAreaByPoint(g,{expandBy:Math.min(f.get("siblingGap"),f.get("gap"))/2})),e){var h=this.findDirection(e,g),i=e.getLayoutSiblings(h),j=i.getSiblingRankByPoint(g),k=joint.util.toArray(a).every(function(a){return this.isConnectionValid(a,i,j)},this);k?(this.candidate={id:e.root.id,direction:h,siblingRank:j+.5},this.updatePreview(i,j),this.showPreview(),this.toggleDropping(!0)):this.toggleDropping(!1)}else this.toggleDropping(!0)},_finishDrag:function(a,b,c){this.$mask.remove().removeClass("dropping-not-allowed"),this.candidate?(a.forEach(function(a){this.reconnectElement(a,this.candidate)},this),this.candidate=null,this.model.layout({ui:!0})):this.canDrop()&&(a.forEach(function(a){this.translateElement(a,b,c)},this),this.model.layout({ui:!0})),this.$activeBox.addClass("hidden"),this.$translateBox.addClass("hidden"),this.hidePreview()},reconnectElement:function(a,b){var c={direction:b.direction,siblingRank:b.siblingRank,ui:!0},d=this.model.reconnectElement(a,b.id,c);if(!d){var e=this.options.paper,f=e.getDefaultLink(a.findView(e));f.set({source:{id:b.id},target:{id:a.id}}),f.addTo(e.model,c),this.model.changeSiblingRank(a,b.siblingRank,c),this.model.changeDirection(a,b.direction,c);var g=this.model.getAttribute(a,"direction");this.model.updateDirections(a,[g,b.direction],c)}},translateElement:function(a,b,c){var d=this.model.graph.getConnectedLinks(a,{inbound:!0});joint.util.invoke(d,"remove");var e=a.get("size");a.set("position",{x:b-e.width/2,y:c-e.height/2},{ui:!0})},updatePreview:function(a,b){var c=a.parentArea.root,d=Math.max(this.model.get("siblingGap")/2,this.MINIMAL_PREVIEW_SIZE),e={width:d,height:d},f=a.getNeighborPointFromRank(b),g=a.getConnectionPoints(f,{ignoreSiblings:!0}),h=a.getParentConnectionPoint(),i=a.getChildConnectionPoint(f,e);this.updateParentPreview(c.get("position"),c.get("size")),this.updateChildPreview(f,e),this.updateConnectionPreview(h,i,g)},showPreview:function(){this.svgViewport.append(this.svgPreview)},hidePreview:function(){this.svgPreview.remove()},updateParentPreview:function(a,b){this.svgPreviewParent.attr({x:a.x,y:a.y,width:b.width,height:b.height})},updateChildPreview:function(a,b){this.svgPreviewChild.attr({cx:a.x,cy:a.y,r:b.width/2})},updateConnectionPreview:function(a,b,c){this.svgPreviewConnection.attr({d:joint.connectors.rounded(a,b,c,{})})},findDirection:function(a,b){var c,d=a.root.get("layout")||a.getType();switch(d){case"BL-BR":case"TL-TR":case"L-R":return c=d.split("-"),b.x>a.rootCX?c[1]:c[0];case"BL-TL":case"BR-TR":case"B-T":return c=d.split("-"),b.y>a.rootCY?c[0]:c[1];case"L":case"R":case"T":case"B":case"TR":case"TL":case"BR":case"BL":return d;default:return a.direction}},isConnectionValid:function(a,b,c){if(a.id==b.parentArea.root.id)return!1;if(this.model.graph.isSuccessor(a,b.parentArea.root))return!1;var d=this.model.getLayoutArea(a);if(d.parentArea&&d.parentArea==b.parentArea&&d.direction==b.direction){var e=d.siblingRank-c;if(0===e||1===e)return!1}return!0},canInteract:function(a){return function(b){this.options.canInteract(b)&&a.apply(this,arguments)}.bind(this)},startDragging:function(a){var b=Array.isArray(a)?a:[a];joint.util.isEmpty(b)||(this._registerPointerEvents(),this._moveCounter=0,this._draggedElements=b)},onPointerdown:function(a){this.startDragging(a.model)},onPointermove:function(a){var b=this.options.paper,c=b.clientToLocalPoint({x:a.clientX,y:a.clientY});this._moveCounter===b.options.clickThreshold?this._startDrag(this._draggedElements,c.x,c.y):this._moveCounter>b.options.clickThreshold&&this._doDrag(this._draggedElements,c.x,c.y),this._moveCounter++},onPointerup:function(a){var b=this.options.paper;if(this._moveCounter>=b.options.clickThreshold){var c=b.clientToLocalPoint({x:a.clientX,y:a.clientY});this._finishDrag(this._draggedElements,c.x,c.y)}this._draggedElements=null,this._unregisterPointerEvents()},_registerPointerEvents:function(){var a=this.getEventNamespace();$(document).on("mousemove"+a+" touchmove"+a,this.onPointermove).on("mouseup"+a+" touchend"+a,this.onPointerup)},_unregisterPointerEvents:function(){$(document).off(this.getEventNamespace())}});
103joint.ui.PathDrawer=joint.mvc.View.extend({tagName:"g",svgElement:!0,className:"path-drawer",events:{"mousedown .start-point":"onStartPointPointerDown",mousedown:"onPointerDown","touchstart .start-point":"onStartPointPointerDown",touchstart:"onPointerDown",dblclick:"onDoubleClick",contextmenu:"onContextMenu"},documentEvents:{mousemove:"onPointerMove",touchmove:"onPointerMove",mouseup:"onPointerUp",touchend:"onPointerUp",touchcancel:"onPointerUp"},options:{pathAttributes:{"class":null,fill:"#ffffff",stroke:"#000000","stroke-width":1,"pointer-events":"none"},startPointMarkup:'<circle r="5"/>'},init:function(){var a=this.svgTarget=V(this.options.target);this.$document=$(a.node.ownerDocument),this.action="awaiting-input",this.render()},onRemove:function(){var a=this.pathNode;a&&V(a).remove(),this.clear()},clear:function(){var a=this.pathNode;a&&a.pathSegList.numberOfItems<=1&&V(a).remove(),this.svgStart.remove(),this.svgControl.remove(),this.pathNode=null,this.undelegateDocumentEvents(),this.action="awaiting-input",this.trigger("clear")},render:function(){var a=this.options;return this.svgPathTemplate=V("path").attr(a.pathAttributes),this.svgStart=V(a.startPointMarkup).addClass("start-point"),this.svgControl=V("path").addClass("control-path"),this.vel.append(V("rect",{x:0,y:0,width:"100%",height:"100%",fill:"transparent",stroke:"none"})),this.svgTarget.append(this.el),this},createPath:function(a,b){var c=this.svgPathTemplate.clone(),d=this.pathNode=c.node,e=this.svgStart.translate(a,b,{absolute:!0});this.trigger("path:create",d),this.addMoveSegment(a,b),this.vel.before(c),this.vel.append(e)},closePath:function(){var a=this.pathNode,b=a.pathSegList.getItem(0),c=a.pathSegList.getItem(a.pathSegList.numberOfItems-1);c.pathSegType==SVGPathSeg.PATHSEG_LINETO_ABS?a.pathSegList.replaceItem(a.createSVGPathSegClosePath(),a.pathSegList.numberOfItems-1):(c.x=b.x,c.y=b.y,a.pathSegList.appendItem(a.createSVGPathSegClosePath())),this.finishPath("path:close")},finishPath:function(a){var b=this.pathNode;b&&this.numberOfVisibleSegments()>0?(this.trigger("path:finish",b),this.trigger(a,b)):this.trigger("path:abort",b),this.clear()},numberOfVisibleSegments:function(){var a=this.pathNode,b=a.pathSegList.numberOfItems;return b-=1,a.pathSegList.getItem(a.pathSegList.numberOfItems-1).pathSegType==SVGPathSeg.PATHSEG_CLOSEPATH&&(b-=1),b},addMoveSegment:function(a,b){var c=this.pathNode,d=c.createSVGPathSegMovetoAbs(a,b);
103c.pathSegList.appendItem(d),this.trigger("path:segment:add",c),this.trigger("path:move-segment:add",c)},addLineSegment:function(a,b){var c=this.pathNode,d=c.createSVGPathSegLinetoAbs(a,b);c.pathSegList.appendItem(d),this.trigger("path:segment:add",c),this.trigger("path:line-segment:add",c)},addCurveSegment:function(a,b,c,d,e,f){var g=this.pathNode,h=g.createSVGPathSegCurvetoCubicAbs(a,b,c,d,e||a,f||b);g.pathSegList.appendItem(h),this.trigger("path:segment:add",g),this.trigger("path:curve-segment:add",g)},adjustLastSegment:function(a,b,c,d,e,f){var g=this.pathNode,h=g.pathSegList.getItem(g.pathSegList.numberOfItems-1);null!==a&&(h.x=a),null!==b&&(h.y=b),null!==c&&(h.x1=c),null!==d&&(h.y1=d),null!==e&&(h.x2=e),null!==f&&(h.y2=f),this.trigger("path:edit",g),this.trigger("path:last-segment:adjust",g)},removeLastSegment:function(){var a=this.pathNode;a.pathSegList.removeItem(a.pathSegList.numberOfItems-1),this.trigger("path:edit",a),this.trigger("path:last-segment:remove",a)},findControlPoint:function(a,b){var c=this.pathNode,d=c.pathSegList.getItem(c.pathSegList.numberOfItems-1);return g.point(a,b).reflection(d)},replaceLastSegmentWithCurve:function(){var a=this.pathNode,b=a.pathSegList.getItem(a.pathSegList.numberOfItems-1),c=a.pathSegList.getItem(a.pathSegList.numberOfItems-2),d=a.createSVGPathSegCurvetoCubicAbs(b.x,b.y,c.x,c.y,b.x,b.y);a.pathSegList.replaceItem(d,a.pathSegList.numberOfItems-1),this.trigger("path:edit",a),this.trigger("path:last-segment:replace-with-curve",a)},adjustControlPath:function(a,b,c,d){var e=this.pathNode,f=this.svgControl.node;f.pathSegList.initialize(f.createSVGPathSegMovetoAbs(a,b)),f.pathSegList.appendItem(f.createSVGPathSegLinetoAbs(c,d)),this.vel.append(f),this.trigger("path:interact",e),this.trigger("path:control:adjust",e)},removeControlPath:function(){var a=this.pathNode,b=this.svgControl.node;b.pathSegList.clear(),this.vel.append(b),this.trigger("path:interact",a),this.trigger("path:control:remove",a)},onPointerDown:function(a){var b=joint.util.normalizeEvent(a);if(b.stopPropagation(),!(b.which>1)&&!(b.originalEvent.detail>1)&&this.el.parentNode){var c=this.vel.toLocalPoint(b.clientX,b.clientY);switch(this.action){case"awaiting-input":this.createPath(c.x,c.y),this.action="path-created",this.delegateDocumentEvents();break;case"adjusting-line-end":this.action="awaiting-line-end";break;case"adjusting-curve-end":this.action="awaiting-curve-control-2"}this._timeStamp=b.timeStamp}},MOVEMENT_DETECTION_THRESHOLD:150,onPointerMove:function(a){var b=joint.util.normalizeEvent(a);if(b.stopPropagation(),"awaiting-input"!=this.action){var c,d,e=this.vel.toLocalPoint(b.clientX,b.clientY),f=this._timeStamp;if(f)if(f&&b.timeStamp-f<this.MOVEMENT_DETECTION_THRESHOLD)switch(this.action){case"path-created":c=this.svgStart.translate(),this.adjustControlPath(c.tx,c.ty,e.x,e.y);break;case"awaiting-line-end":case"adjusting-curve-control-1":this.adjustLastSegment(e.x,e.y);break;case"awaiting-curve-control-2":this.adjustLastSegment(e.x,e.y,null,null,e.x,e.y)}else switch(this.action){case"path-created":this.action="adjusting-curve-control-1";break;case"awaiting-line-end":this.replaceLastSegmentWithCurve(),this.action="adjusting-curve-control-2";break;case"awaiting-curve-control-2":this.action="adjusting-curve-control-2";break;case"adjusting-curve-control-1":c=this.svgStart.translate(),this.adjustControlPath(c.tx,c.ty,e.x,e.y);break;case"adjusting-curve-control-2":d=this.findControlPoint(e.x,e.y),this.adjustLastSegment(null,null,null,null,d.x,d.y),this.adjustControlPath(d.x,d.y,e.x,e.y)}else switch(this.action){case"adjusting-line-end":this.adjustLastSegment(e.x,e.y);break;case"adjusting-curve-end":this.adjustLastSegment(e.x,e.y,null,null,e.x,e.y)}}},onPointerUp:function(a){this._timeStamp=null;var b=joint.util.normalizeEvent(a);if(b.stopPropagation(),!(b.which>1||b.originalEvent.detail>1)){var c=this.vel.toLocalPoint(b.clientX,b.clientY);switch(this.action){case"path-created":case"awaiting-line-end":this.addLineSegment(c.x,c.y),this.action="adjusting-line-end";break;case"awaiting-curve-control-2":this.removeControlPath(),this.addLineSegment(c.x,c.y),this.action="adjusting-line-end";break;case"adjusting-curve-control-1":case"adjusting-curve-control-2":this.addCurveSegment(c.x,c.y,c.x,c.y),this.action="adjusting-curve-end"}}},onStartPointPointerDown:function(a){var b=joint.util.normalizeEvent(a);b.stopPropagation(),b.which>1||b.originalEvent.detail>1||this.closePath()},onDoubleClick:function(a){var b=joint.util.normalizeEvent(a);b.preventDefault(),b.stopPropagation(),b.which>1||this.pathNode&&this.numberOfVisibleSegments()>0&&(this.removeLastSegment(),this.finishPath("path:stop"))},onContextMenu:function(a){var b=joint.util.normalizeEvent(a);b.preventDefault(),b.stopPropagation(),b.originalEvent.detail>1||this.pathNode&&this.numberOfVisibleSegments()>0&&(this.removeLastSegment(),this.finishPath("path:stop"))}});
104joint.ui.PathEditor=joint.mvc.View.extend({tagName:"g",svgElement:!0,className:"path-editor",events:{"mousedown .anchor-point":"onAnchorPointPointerDown","mousedown .control-point":"onControlPointPointerDown","mousedown .segment-path":"onSegmentPathPointerDown","touchstart .anchor-point":"onAnchorPointPointerDown","touchstart .control-point":"onControlPointPointerDown","touchstart .segment-path":"onSegmentPathPointerDown","dblclick .anchor-point":"onAnchorPointDoubleClick","dblclick .control-point":"onControlPointDoubleClick","dblclick .segment-path":"onSegmentPathDoubleClick"},documentEvents:{mousemove:"onPointerMove",touchmove:"onPointerMove",mouseup:"onPointerUp",touchend:"onPointerUp",touchcancel:"onPointerUp"},options:{anchorPointMarkup:'<circle r="2.5"/>',controlPointMarkup:'<circle r="2.5"/>'},init:function(){var a=this.pathNode=V(this.options.pathElement).normalizePath().node;this.segList=a.pathSegList,this.svgRoot=V(a.ownerSVGElement),this.$document=$(a.ownerDocument),this.render()},onRemove:function(){this.undelegateDocumentEvents(),this.clear()},clear:function(){var a=this.vel;a.empty(),this.directionPaths=[],this.segmentPaths=[],this.controlPoints=[],this.anchorPoints=[],this._subPathIndices=[0],this.trigger("clear",this.pathNode)},_transformPoint:function(a,b,c){return V.transformPoint(g.Point(a,b),c)},render:function(){this.clear();var a,b,c,d=this.vel,e=this.pathNode.getCTM(),f=V(this.options.anchorPointMarkup).addClass("anchor-point"),g=V(this.options.controlPointMarkup).addClass("control-point"),h=V('<path class="direction-
104path"/>'),i=V('<path class="segment-path"/>'),j=this.segList,k=this.anchorPoints,l=this.controlPoints,m=this.directionPaths,n=this.segmentPaths,o=this._subPathIndices;for(a=0,b=0,c=0;a<j.numberOfItems;a++){var p=j.getItem(a),q=this._transformPoint(p.x,p.y,e),r=q.x,s=q.y;if(p.pathSegType!=SVGPathSeg.PATHSEG_CLOSEPATH&&(k[a]=f.clone().attr({index:a,cx:r,cy:s})),p.pathSegType!=SVGPathSeg.PATHSEG_MOVETO_ABS){var t=i.clone().attr("index",a).node;switch(t.pathSegList.initialize(t.createSVGPathSegMovetoAbs(b,c)),p.pathSegType){case SVGPathSeg.PATHSEG_CLOSEPATH:var u=j.getItem(o[0]),v=this._transformPoint(u.x,u.y,e);r=v.x,s=v.y,t.pathSegList.appendItem(t.createSVGPathSegLinetoAbs(r,s)),o.unshift(a+1);break;case SVGPathSeg.PATHSEG_LINETO_ABS:t.pathSegList.appendItem(t.createSVGPathSegLinetoAbs(r,s));break;case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:var w=this._transformPoint(p.x1,p.y1,e),x=g.clone().attr({index:a,"attribute-index":1,cx:w.x,cy:w.y}),y=this._transformPoint(p.x2,p.y2,e),z=g.clone().attr({index:a,"attribute-index":2,cx:y.x,cy:y.y});l[a]=[x,z],t.pathSegList.appendItem(t.createSVGPathSegCurvetoCubicAbs(r,s,w.x,w.y,y.x,y.y)),m[a]=[h.clone().attr("d",["M",b,c,"L",w.x,w.y].join(" ")),h.clone().attr("d",["M",r,s,"L",y.x,y.y].join(" "))]}n[a]=t}b=r,c=s}var A=[];n.forEach(function(a){a&&A.push(a)}),m.forEach(function(a){a&&Array.prototype.push.apply(A,a)}),k.forEach(function(a){a&&A.push(a)}),l.forEach(function(a){a&&Array.prototype.push.apply(A,a)}),d.append(A),this.svgRoot.append(d)},startMoving:function(a){var b=joint.util.normalizeEvent(a),c=this.$point=$(b.target);this.prevClientX=b.clientX,this.prevClientY=b.clientY;var d=parseInt(this.$point.attr("index"),10);if(c.hasClass("anchor-point"))this.trigger("path:interact"),this.trigger("path:anchor-point:select",d);else if(c.hasClass("control-point")){var e=this.$point.attr("attribute-index");this.trigger("path:interact"),this.trigger("path:control-point:select",d,e)}else this.trigger("path:interact"),this.trigger("path:segment:select",d);b.stopPropagation(),b.preventDefault(),this.pathEditedEventType=null},move:function(a){var b=this.$point;if(b){var c=joint.util.normalizeEvent(a),d=c.clientX-this.prevClientX,e=c.clientY-this.prevClientY,f=parseInt(b.attr("index"),10);if(b.hasClass("anchor-point"))this.adjustAnchorPoint(f,d,e);else if(b.hasClass("control-point")){var g=b.attr("attribute-index");this.adjustControlPoint(f,g,d,e)}else this.adjustAnchorPoint(f-1,d,e),this.adjustAnchorPoint(f,d,e);this.prevClientX=c.clientX,this.prevClientY=c.clientY}},adjustControlPoint:function(a,b,c,d){var e=this.pathNode.getCTM(),f=this.segList,h=f.getItem(a),i=this.controlPoints,j=e.inverse();j.e=0,j.f=0;var k=this._transformPoint(c,d,j),l="x"+b,m="y"+b;h[l]+=k.x,h[m]+=k.y;var n=this._transformPoint(h[l],h[m],e),o=i[a][b-1].attr({cx:n.x,cy:n.y});if(o.hasClass("locked")){var p=this.getBoundIndex(a,b),q=1==b?2:1,r=f.getItem(p),s="x"+q,t="y"+q,u=g.point(1==b?r.x:h.x,1==b?r.y:h.y),v=g.point(h[l],h[m]),w=u.distance(g.Point(r[s],r[t])),x=u.move(v,w);r[s]=x.x,r[t]=x.y;var y=this._transformPoint(r[s],r[t],e);i[p][q-1].attr({cx:y.x,cy:y.y}),this.updateDirectionPaths(p),this.updateSegmentPath(p)}this.updateDirectionPaths(a),this.updateSegmentPath(a),this.pathEditedEventType="path:control-point:adjust"},findSubpathIndex:function(a){for(var b=this._subPathIndices,c=0,d=b.length;c<d;c++)if(b[c]<a)return b[c]},findReversedSubpathIndex:function(a){for(var b=this._subPathIndices,c=b.length-1;c>=0;c--)if(b[c]>a)return b[c]},adjustAnchorPoint:function(a,b,c){var d=this.pathNode.getCTM(),e=this.segList,f=e.getItem(a);f.pathSegType==SVGPathSeg.PATHSEG_CLOSEPATH&&(a=this.findSubpathIndex(a),f=e.getItem(a));var g=this.anchorPoints,h=this.controlPoints,i=g.length-1;if((0===a||a===i)&&h[1]&&h[i]){var j=h[1][0],k=h[i][1];j&&j.hasClass("locked")&&j.removeClass("locked"),k&&k.hasClass("locked")&&k.removeClass("locked")}var l=d.inverse();l.e=0,l.f=0;var m=this._transformPoint(b,c,l);f.x+=m.x,f.y+=m.y;var n=this._transformPoint(f.x,f.y,d);if(g[a].attr({cx:n.x,cy:n.y}),f.pathSegType==SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS){f.x2+=m.x,f.y2+=m.y;var o=this._transformPoint(f.x2,f.y2,d);h[a][1].attr({cx:o.x,cy:o.y})}var p=a+1<e.numberOfItems?e.getItem(a+1):0;if(p){if(p.pathSegType==SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS){p.x1+=m.x,p.y1+=m.y;var q=this._transformPoint(p.x1,p.y1,d);h[a+1][0].attr({cx:q.x,cy:q.y}),this.updateDirectionPaths(a+1)}this.updateSegmentPath(a+1)}this.updateDirectionPaths(a),this.updateSegmentPath(a),this.pathEditedEventType="path:anchor-point:adjust"},updateDirectionPaths:function(a){var b=this.pathNode.getCTM(),c=this.segList,d=c.getItem(a),e=this._transformPoint(d.x,d.y,b),f=a>0?c.getItem(a-1):null,g=f?this._transformPoint(f.x,f.y,b):null,h=this.directionPaths[a];Array.isArray(h)&&h.forEach(function(a,c){c++;var h=this._transformPoint(d["x"+c],d["y"+c],b);a.attr("d",["M",c>1||!f?e.x:g.x,c>1||!f?e.y:g.y,h.x,h.y].join(" "))},this)},updateSegmentPath:function(a){var b=this.segList,c=this._subPathIndices;if(c.includes(a)){var d=this.findReversedSubpathIndex(a)||b.numberOfItems;if(d--,b.getItem(d).pathSegType!=SVGPathSeg.PATHSEG_CLOSEPATH)return;a=d}var e=this.segmentPaths[a];if(e){var f=this.pathNode.getCTM(),g=b.getItem(a-1),h=this._transformPoint(g.x,g.y,f),i=e.createSVGPathSegMovetoAbs(h.x,h.y);e.pathSegList.initialize(i);var j=b.getItem(a),k=this._transformPoint(j.x,j.y,f);switch(j.pathSegType){case SVGPathSeg.PATHSEG_CLOSEPATH:var l=b.getItem(this.findSubpathIndex(a)),m=this._transformPoint(l.x,l.y,f);i=e.createSVGPathSegLinetoAbs(m.x,m.y);break;case SVGPathSeg.PATHSEG_LINETO_ABS:i=e.createSVGPathSegLinetoAbs(k.x,k.y);break;case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:var n=this._transformPoint(j.x1,j.y1,f),o=this._transformPoint(j.x2,j.y2,f);i=e.createSVGPathSegCurvetoCubicAbs(k.x,k.y,n.x,n.y,o.x,o.y)}e.pathSegList.appendItem(i)}},stopMoving:function(){if(this.$point=null,this.pathEditedEventType){var a=this.pathNode;this.trigger("path:edit",a),this.trigger(this.pathEditedEventType,a)}this.pathEditedEventType=null},createAnchorPoint:function(a){var b=joint.util.normalizeEvent(a),c=V(b.target).attr("index"),d=this.pathNode,e=this.segList,f=V(d).toLocalPoint(b.pageX,b.pageY),h=e.getItem(c);switch(h.pathSegType){case SVGPathSeg.PATHSEG_CLOSEPATH:case SVGPathSeg.PATHSEG_LINETO_ABS:e.insertItemBefore(d.createSVGPathSegLinetoAbs(f.x,f.y),c);break;case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:var i=e.getItem(c-1),j=g.point(i.x,i.y),k=g.point(h.x1,h.y1),l=g.point(h.x2,h.y2),m=g.point(h.x,h.y),n=g.bezier.getInversionSolver(j,k,l,m)(f);if(n<0)return;var o=g.bezier.getCurveDivider(j,k,l,m)(n);e.insertItemBefore(d.createSVGPathSegCurvetoCubicAbs(o[0].p3.x,o[0].p3.y,o[0].p1.x,o[0].p1.y,o[0].p2.x,o[0].p2.y),c),h.x1=o[1].p1.x,h.y1=o[1].p1.y,h.x2=o[1].p2.x,h.y2=o[1].p2.y}this.render(),this.trigger("path:edit",d),this.trigger("path:anchor-point:create",d)},removeAnchorPoint:function(a){var b,c,d=joint.util.normalizeEvent(a),e=parseInt($(d.target).attr("index"),10),f=this.pathNode,g=this.segList,h=g.getItem(e);switch(h.pathSegType){case SVGPathSeg.PATHSEG_MOVETO_ABS:b=g.getItem(e+1),c=f.createSVGPathSegMovetoAbs(b.x,b.y),g.replaceItem(c,e+1),g.removeItem(e);break;case SVGPathSeg.PATHSEG_LINETO_ABS:g.removeItem(e);break;case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:e+1<=g.numberOfItems-1&&(b=g.getItem(e+1),b.pathSegType==SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS&&(b.x1=h.x1,b.y1=h.y1)),g.removeItem(e)}this.render(),this.trigger("path:edit",f),this.trigger("path:anchor-point:remove",f);var i=g.numberOfItems;g.getItem(g.numberOfItems-1).pathSegType==SVGPathSeg.PATHSEG_CLOSEPATH&&(i-=1),i<2&&this.trigger("path:invalid",f)},lockControlPoint:function(a){var b=joint.util.normalizeEvent(a),c=$(b.target),d=this.pathNode,e=parseInt(c.attr("index")),f=c.attr("attribute-index"),g=this.getBoundIndex(e,f),h=1==f?2:1,i=this.controlPoints[g];if(i){var j=c.hasClass("locked");c.toggleClass("locked"),i[h-1].toggleClass("locked"),this.trigger("path:interact"),j?this.trigger("path:control-point:unlock",e,f):this.trigger("path:control-point:lock",e,f),this.adjustControlPoint(e,f,0,0),this.trigger("path:edit",d),this.trigger(this.pathEditedEventType,d),this.pathEditedEventType=null}},getBoundIndex:function(a,b){var c,d,e,f,g,h,i=this.segList,j=this.anchorPoints,k=j.length-1;
104return 1==b?(c=a-1,0===c&&(d=i.numberOfItems-1,e=i.getItem(d).pathSegType,f=e==SVGPathSeg.PATHSEG_CLOSEPATH,g=j[0].attr("cx")===j[k].attr("cx"),h=j[0].attr("cy")===j[k].attr("cy"),f&&g&&h&&(c=k))):(c=a+1,c===k+1&&(d=i.numberOfItems-1,e=i.getItem(d).pathSegType,f=e==SVGPathSeg.PATHSEG_CLOSEPATH,g=j[0].attr("cx")===j[k].attr("cx"),h=j[0].attr("cy")===j[k].attr("cy"),f&&g&&h&&(c=1))),c},getControlPointLockedStates:function(){for(var a=this.controlPoints,b=[],c=0;c<a.length;c++)if(a[c]){b[c]=[];for(var d=0;d<=1;d++)if(a[c][d]){var e=d+1;a[c][d].hasClass("locked")?b[c][e]=!0:b[c][e]=!1}}return b},setControlPointLockedStates:function(a){for(var b=this.controlPoints,c=0;c<b.length;c++)if(a[c]&&b[c])for(var d=1;d<=2;d++)a[c][d]&&b[c][d-1]&&(a[c][d]===!0?b[c][d-1].addClass("locked"):b[c][d-1].removeClass("locked"))},convertSegmentPath:function(a){var b,c,d=joint.util.normalizeEvent(a),e=V(d.target).attr("index"),f=this.pathNode,g=this.segList,h=g.getItem(e);switch(h.pathSegType){case SVGPathSeg.PATHSEG_CLOSEPATH:b=g.getItem(e-1),c=g.getItem(0),g.insertItemBefore(f.createSVGPathSegCurvetoCubicAbs(c.x,c.y,b.x,b.y,c.x,c.y),e);break;case SVGPathSeg.PATHSEG_LINETO_ABS:b=g.getItem(e-1),g.replaceItem(f.createSVGPathSegCurvetoCubicAbs(h.x,h.y,b.x,b.y,h.x,h.y),e);break;case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:g.replaceItem(f.createSVGPathSegLinetoAbs(h.x,h.y),e)}this.render(),this.trigger("path:edit",f),this.trigger("path:segment:convert",f)},addClosePathSegment:function(a){var b=joint.util.normalizeEvent(a),c=parseInt($(b.target).attr("index"),10),d=this.segList;if(0===c||c===d.numberOfItems-1){var e=d.getItem(d.numberOfItems-1);if(e.pathSegType!=SVGPathSeg.PATHSEG_CLOSEPATH){var f=this.pathNode;d.appendItem(f.createSVGPathSegClosePath()),this.render(),this.trigger("path:edit",f),this.trigger("path:closepath-segment:add",f)}}},removeClosePathSegment:function(a){var b=joint.util.normalizeEvent(a),c=V(b.target).attr("index"),d=this.segList,e=d.getItem(c);if(e.pathSegType==SVGPathSeg.PATHSEG_CLOSEPATH){var f=this.pathNode;d.removeItem(c),this.render(),this.trigger("path:edit",f),this.trigger("path:closepath-segment:remove",f)}},onAnchorPointPointerDown:function(a){var b=joint.util.normalizeEvent(a);
104b.stopPropagation(),1===b.which&&(b.originalEvent.detail>1||(this.startMoving(b),this.delegateDocumentEvents()))},onControlPointPointerDown:function(a){var b=joint.util.normalizeEvent(a);b.stopPropagation(),1===b.which&&(b.originalEvent.detail>1||(this.startMoving(b),this.delegateDocumentEvents()))},onSegmentPathPointerDown:function(a){var b=joint.util.normalizeEvent(a);b.stopPropagation(),1===b.which&&(b.originalEvent.detail>1||(this.startMoving(b),this.delegateDocumentEvents()))},onPointerMove:function(a){var b=joint.util.normalizeEvent(a);b.stopPropagation(),this.move(b)},onPointerUp:function(a){this.undelegateDocumentEvents();var b=joint.util.normalizeEvent(a);b.stopPropagation(),this.stopMoving()},onAnchorPointDoubleClick:function(a){var b=joint.util.normalizeEvent(a);b.stopPropagation(),b.preventDefault(),1===b.which&&this.removeAnchorPoint(b)},onControlPointDoubleClick:function(a){var b=joint.util.normalizeEvent(a);b.stopPropagation(),b.preventDefault(),1===b.which&&this.lockControlPoint(b)},onSegmentPathDoubleClick:function(a){var b=joint.util.normalizeEvent(a);b.stopPropagation(),b.preventDefault(),1===b.which&&this.createAnchorPoint(b)}});
105joint.layout.ForceDirected=Backbone.Model.extend({defaults:{linkDistance:10,linkStrength:1,charge:10},initialize:function(a){this.elements=this.get("graph").getElements(),this.links=this.get("graph").getLinks(),this.cells=this.get("graph").get("cells"),this.width=this.get("width"),this.height=this.get("height"),this.gravityCenter=this.get("gravityCenter"),this.t=1,this.energy=1/0,this.progress=0},start:function(){var a=this.get("width"),b=this.get("height");this.elements.forEach(function(c){c.set("position",{x:Math.random()*a,y:Math.random()*b}),c.charge=c.get("charge")||this.get("charge"),c.weight=c.get("weight")||1;var d=c.get("position");c.x=d.x,c.y=d.y,c.px=c.x,c.py=c.y,c.fx=0,c.fy=0},this),this.links.forEach(function(a){a.strength=a.get("strength")||this.get("linkStrength"),a.distance=a.get("distance")||this.get("linkDistance"),a.source=this.cells.get(a.get("source").id),a.target=this.cells.get(a.get("target").id)},this)},step:function(){if(.99*this.t<.005)return this.notifyEnd();var a=this.width,b=this.height,c=.1,d=this.gravityCenter,e=this.energy;this.energy=0;var f,g,h,i,j,k,l,m,n,o,p,q=0,r=0,s=0,t=0,u=this.elements.length,v=this.links.length;for(f=0;f<u-1;f++)for(h=this.elements[f],q+=h.x,r+=h.y,g=f+1;g<u;g++)i=this.elements[g],j=i.x-h.x,k=i.y-h.y,l=j*j+k*k,m=Math.sqrt(l),n=this.t*h.charge/l,o=n*j,p=n*k,h.fx-=o,h.fy-=p,i.fx+=o,i.fy+=p,this.energy+=o*o+p*p;q+=this.elements[u-1].x,r+=this.elements[u-1].y;var w,x,y;for(f=0;f<v;f++)w=this.links[f],h=w.source,i=w.target,j=i.x-h.x,k=i.y-h.y,l=j*j+k*k,m=Math.sqrt(l),x=this.t*w.strength*(m-w.distance)/m,o=x*j,p=x*k,y=h.weight/(h.weight+i.weight),h.x+=o*(1-y),h.y+=p*(1-y),i.x-=o*y,i.y-=p*y,this.energy+=o*o+p*p;var z,A;for(f=0;f<u;f++){z=this.elements[f],A={x:z.x,y:z.y},d&&(A.x+=(d.x-A.x)*this.t*c,A.y+=(d.y-A.y)*this.t*c),A.x+=z.fx,A.y+=z.fy,A.x=Math.max(0,Math.min(a,A.x)),A.y=Math.max(0,Math.min(b,A.y));var B=.9;A.x+=(z.px-A.x)*B,A.y+=(z.py-A.y)*B,z.px=A.x,z.py=A.y,z.fx=z.fy=0,z.x=A.x,z.y=A.y,s+=z.x,t+=z.y,this.notify(z,f,A)}this.t=this.cool(this.t,this.energy,e);var C=q-s,D=r-t,E=Math.sqrt(C*C+D*D);E<1&&this.notifyEnd()},cool:function(a,b,c){return b<c?(this.progress+=1,this.progress>=5?(this.progress=0,a/.99):a):(this.progress=0,.99*a)},notify:function(a,b,c){a.set("position",c)},notifyEnd:function(){this.trigger("end")}});
106joint.layout=joint.layout||{},joint.layout.GridLayout={layout:function(a,b){var c;c=a instanceof joint.dia.Graph?a:(new joint.dia.Graph).resetCells(a,{dry:!0,sort:!1}),a=null,b=b||{};var d=c.getElements(),e=b.columns||1,f=Math.ceil(d.length/e),g=b.dx||0,h=b.dy||0,i=void 0===b.centre||b.centre!==!1,j=!!b.resizeToFit,k=b.marginX||0,l=b.marginY||0,m=[],n=b.columnWidth;if("compact"===n)for(var o=0;o<e;o++){var p=this._elementsAtColumn(d,o,e);m.push(this._maxDim(p,"width")+g)}else{n&&!joint.util.isString(n)||(n=this._maxDim(d,"width")+g);for(var q=0;q<e;q++)m.push(n)}var r=this._accumulate(m,k),s=[],t=b.rowHeight;if("compact"===t)for(var u=0;u<f;u++){var v=this._elementsAtRow(d,u,e);s.push(this._maxDim(v,"height")+h)}
106else{t&&!joint.util.isString(t)||(t=this._maxDim(d,"height")+h);for(var w=0;w<f;w++)s.push(t)}var x=this._accumulate(s,l);c.startBatch("layout"),d.forEach(function(a,c){var d=c%e,f=Math.floor(c/e),k=m[d],l=s[f],n=0,o=0,p=a.get("size");if(j){var q=k-2*g,t=l-2*h,u=p.height*(p.width?q/p.width:1),v=p.width*(p.height?t/p.height:1);u>l?q=v:t=u,p={width:q,height:t},a.set("size",p,b)}i&&(n=(k-p.width)/2,o=(l-p.height)/2),a.position(r[d]+g+n,x[f]+h+o,b)}),c.stopBatch("layout")},_maxDim:function(a,b){return a.reduce(function(a,c){return Math.max(c.get("size")[b],a)},0)},_elementsAtRow:function(a,b,c){for(var d=[],e=c*b,f=e+c;e<f;e++)d.push(a[e]);return d},_elementsAtColumn:function(a,b,c){for(var d=[],e=b,f=a.length;e<f;e+=c)d.push(a[e]);return d},_accumulate:function(a,b){return a.reduce(function(a,b,c){return a.push(a[c]+b),a},[b||0])}};
107!function(a,b,c){function d(b,c,d){d=a.util.defaults(d||{},{siblingGap:0}),this.width=0,this.height=0,this.layoutAreas=this.sortLayoutAreas(b),this.parentArea=c,this.siblingGap=d.siblingGap,this.exists()&&this.computeSize(d)}function e(b,c){this.root=b;var d=a.util.assign({},c,this.getRootAttributes(b,c.attributeNames)),e=c.gap||0;a.util.defaults(d,{parentGap:e,siblingGap:e,firstChildGap:e}),this.siblingRank=d.siblingRank,this.rootOffset=d.rootOffset,this.rootMargin=d.rootMargin,this.siblingGap=d.siblingGap,this.gap=this.parentGap=d.parentGap,this.nextSiblingGap=d.nextSiblingGap,this.prevSiblingGap=d.prevSiblingGap,this.firstChildGap=d.firstChildGap,this.dx=0,this.dy=0,this.width=0,this.height=0}a.util.assign(d.prototype,{sortLayoutAreas:function(b){var c=a.util.sortBy(b,"siblingRank");return c.forEach(function(a,b){a.siblingRank=b}),c},move:function(a,b){for(var c=0,d=this.layoutAreas.length;c<d;c++)this.layoutAreas[c].dx+=a,this.layoutAreas[c].dy+=b},exists:function(){return this.layoutAreas.length>0},sumGaps:function(a){var b=Math.max(this.layoutAreas.length-1,0);return b*a},getSiblingRankByPoint:function(a){if(!this.exists())return-1;var b=this.findAreaByPoint(a);return b?b.siblingRank-1:this.layoutAreas.length-1},getFirstChildConnectionPoints:function(){return[]},getConnectionPoints:function(a,b){if(!this.exists())return this.getFirstChildConnectionPoints(a);var c={dx:a.x-this.parentArea.rootCX,dy:a.y-this.parentArea.rootCY};return this.layoutAreas[0].getRootVertices(c,b)},getParentConnectionPoint:function(){var a=this.parentArea,b=this.proxyLayoutArea("getConnectionPoint",a.rootSize),d=c.point(a.rootCX,a.rootCY);return d.offset(b.x,b.y)},getChildConnectionPoint:function(a,b){var d=this.proxyLayoutArea("getConnectionPoint",b);return c.point(a).difference(d)},proxyLayoutArea:function(a){var b=Array.prototype.slice.call(arguments,1);return e.fromDirection(this.direction).prototype[a].apply(this.parentArea,b)}}),d.extend=b.Model.extend;var f=d.extend({getTopDY:function(){return-this.height/2},findAreaByPoint:function(a){return this.layoutAreas.find(function(b){return b.rootCY>a.y})},computeSize:function(a){this.height=this.sumGaps(a.siblingGap);var b=this.layoutAreas;this.height+=b.reduce(function(a,b){return a+b.height+b.prevSiblingGap+b.nextSiblingGap},0),b.reduce(function(b,c){return this.width=Math.max(this.width,c.getExtendedWidth()),c.dy+=b+c.getCY(),b+c.prevSiblingGap+c.height+c.nextSiblingGap+a.siblingGap}.bind(this),this.getTopDY())},getYTowardsParent:function(){return this.parentArea.rootCY},getXTowardsParent:function(){var a=this.parentArea;return a.rootCX+this.LRSign*(a.rootSize.width/2+a.gap)},getNeighborPointFromRank:function(a){var b,c=this.siblingGap;if(this.exists()){var d=this.layoutAreas[a],e=this.layoutAreas[a+1];b=d?e?(d.y+d.height+e.y)/2:d.y+d.height+c/2:e.y-c/2}else b=this.getYTowardsParent();return{x:this.getXTowardsParent(),y:b}}}),g=f.extend({direction:"L",LRSign:-1}),h=f.extend({direction:"R",LRSign:1}),i={getXTowardsParent:function(){var a=this.parentArea;return a.rootCX+this.LRSign*a.gap},getYTowardsParent:function(){var a=this.parentArea,b=a.getLRHeight(a.siblings)/2;return b+=Math.min(a.firstChildGap,this.siblingGap/2),a.rootCY+this.TBSign*b},getFirstChildConnectionPoints:function(a){return[c.point(this.parentArea.rootCX,a.y)]},getChildConnectionPoint:function(a,b){return c.point(a).offset(-this.LRSign*b.width/2,0)},getParentConnectionPoint:function(){var a=this.parentArea,b=c.point(a.rootCX,a.rootCY);return b.offset(0,this.TBSign*a.rootSize.height/2)}},j={getTopDY:function(){return 0}},k={getTopDY:function(){return-this.height}}
107,l=f.extend({direction:"BR",LRSign:1,TBSign:1});a.util.assign(l.prototype,i,j);var m=f.extend({direction:"BL",LRSign:-1,TBSign:1});a.util.assign(m.prototype,i,j);var n=f.extend({direction:"TR",LRSign:1,TBSign:-1});a.util.assign(n.prototype,i,k);var o=f.extend({direction:"TL",LRSign:-1,TBSign:-1});a.util.assign(o.prototype,i,k);var p=d.extend({getLeftDX:function(){return-this.width/2},findAreaByPoint:function(a){return this.layoutAreas.find(function(b){return b.rootCX>a.x})},computeSize:function(a){this.width=this.sumGaps(a.siblingGap);var b=this.layoutAreas;this.width+=b.reduce(function(a,b){return a+b.width+b.prevSiblingGap+b.nextSiblingGap},0),b.reduce(function(b,c){return this.height=Math.max(this.height,c.getExtendedHeight()),c.dx+=b+c.getCX(),b+c.prevSiblingGap+c.width+c.nextSiblingGap+a.siblingGap}.bind(this),this.getLeftDX())},getNeighborPointFromRank:function(a){var b;if(this.exists()){var c=this.layoutAreas[a],d=this.layoutAreas[a+1];b=c?d?(c.x+c.width+d.x)/2:c.x+c.width+this.siblingGap/2:d.x-this.siblingGap/2}else b=this.parentArea.rootCX;return{x:b,y:this.getYTowardsParent()}}}),q=p.extend({direction:"T",getYTowardsParent:function(){var a=this.parentArea;return a.rootCY-a.getLRHeight()/2-a.gap}}),r=p.extend({direction:"B",getYTowardsParent:function(){var a=this.parentArea;return a.rootCY+a.getLRHeight()/2+a.gap}});a.util.assign(e,{create:function(a,b,c){var d=e.fromDirection(a,c);return new d(b,c)},fromDirection:function(a,b){var c;switch(a){case"L":c=t;break;case"T":c=u;break;case"R":c=s;break;case"B":c=v;break;case"BR":c=w;break;case"BL":c=x;break;case"TR":c=y;break;case"TL":c=z;break;default:c=e}return c}}),a.util.assign(e.prototype,{direction:null,compute:function(a){this.childAreas=a,this.computeRelativePosition(this.root,a)},getHeight:function(a,b){return this.getTHeight(a)+this.getBHeight(a)+this.getLRHeight()},getWidth:function(a,b){var c=Math.max(a.T.width,a.B.width)/2,d=Math.max(this.getLWidth(a,b)+b.width/2,c),e=Math.max(this.getRWidth(a,b)+b.width/2,c);return d+e},getLRHeight:function(){return Math.max(this.rootSize.height,this.siblings.L.height,this.siblings.R.height)},getTHeight:function(a){return a.T.height+this.getTXHeight(a)},getBHeight:function(a){return a.B.height+this.getBXHeight(a)},getXLRWidth:function(a,b){return this.getLWidth(a,b)+b.width+this.getRWidth(a,b)},getXRWidth:function(a,b){var c=Math.max(a.BR.width,a.TR.width);return c>0&&(c-=b.width/2),c},getTXHeight:function(a){var b=Math.max(a.TR.height,a.TL.height);return b>0&&(b+=this.firstChildGap),b},getBXHeight:function(a){var b=Math.max(a.BR.height,a.BL.height);return b>0&&(b+=this.firstChildGap),b},getXLWidth:function(a,b){var c=Math.max(a.BL.width,a.TL.width);return c>0&&(c-=b.width/2),c},getRWidth:function(a,b){return Math.max(a.R.width,this.getXRWidth(a,b))},getLWidth:function(a,b){return Math.max(a.L.width,this.getXLWidth(a,b))},getTBOverlap:function(a,b){var c=Math.max(a.T.width,a.B.width);return c>0&&(c-=b.width,c/=2),c},getRootDX:function(a,b){var c=this.getTBOverlap(a,b),d=Math.max(this.getLWidth(a,b),c);return d-=Math.max(this.getRWidth(a,b),c),d/2},getMinimalGap:function(a){return Math.min(a.siblingGap,this.firstChildGap,this.parentGap)},getBBox:function(a){var b=c.rect(this),d=a&&a.expandBy;return d&&b.moveAndExpand({x:-d,y:-d,width:2*d,height:2*d}),b},containsPoint:function(a,b){return this.getBBox(b).containsPoint(a)},getLayoutSiblings:function(a){return this.siblings[a]},getExtendedWidth:function(){return this.width+this.gap+this.rootOffset},getExtendedHeight:function(){return this.height+this.gap+this.rootOffset},findMinimalAreaByPoint:function(a,b){if(!this.containsPoint(a,b))return null;var c;return this.childAreas.some(function(d){return c=d.findMinimalAreaByPoint(a,b),!!c}),c||this},getType:function(){return Object.keys(this.siblings).reduce(function(a,b){var c=this.siblings[b];return c.exists()?a.concat(b):a}.bind(this),[]).sort().join("-")},getRootAttributes:function(b,c){var d={rootOffset:b.get(c.offset||"offset")||0,rootMargin:b.get(c.margin||"margin")||0,prevSiblingGap:b.get(c.prevSiblingGap||"prevSiblingGap")||0,nextSiblingGap:b.get(c.nextSiblingGap||"nextSiblingGap")||0},e=b.get(c.siblingRank||"siblingRank");a.util.isNumber(e)&&(d.siblingRank=e);var f=b.get(c.firstChildGap||"firstChildGap");return a.util.isNumber(f)&&(d.firstChildGap=f),d},getRootSize:function(a,b){var c=a.size();return c[this.marginDimension]+=b,c},createSiblings:function(b,c){var d=a.util.groupBy(b,"direction");return{L:new g(d.L,this,c),T:new q(d.T,this,c),R:new h(d.R,this,c),B:new r(d.B,this,c),BR:new l(d.BR,this,c),BL:new m(d.BL,this,c),TR:new n(d.TR,this,c),TL:new o(d.TL,this,c)}},computeSize:function(a,b){return{width:this.getWidth(a,b),height:this.getHeight(a,b)}},computeOrigin:function(){var a=this.siblings,b=this.rootSize,c=Math.max(this.getLWidth(a,b)+b.width/2,this.getXLWidth(a,b)+b.width/2,a.T.width/2,a.B.width/2);return{x:this.rootCX-c,y:this.rootCY-this.getTHeight(a)-this.getLRHeight()/2}},moveSiblings:function(a,b){if(this.hasHorizontalSiblings(a)){var c=b.width/2;a.L.move(-c,0),a.R.move(c,0)}if(this.hasVerticalSiblings(a)){var d=this.getLRHeight()/2;a.T.move(0,-d),a.B.move(0,d),a.BR.move(0,d),a.BL.move(0,d),a.B.move(0,this.getBXHeight(
107a)),a.TR.move(0,-d),a.TL.move(0,-d),a.T.move(0,-this.getTXHeight(a))}},moveRootToConnectionPoint:function(a){var b=this.getConnectionPoint(a);this.dx+=b.x,this.dy+=b.y},computeRelativePosition:function(b,c){var d=this.siblings=this.createSiblings(c,{siblingGap:this.siblingGap}),e=this.rootSize=this.getRootSize(b,this.rootMargin);a.util.assign(this,this.computeSize(d,e)),this.moveSiblings(d,e),this.moveRootToConnectionPoint(e),this.moveRootBehindSiblings(d,e),this.moveRootFromParent()},computeAbsolutePosition:function(){if(this.parentArea)this.rootCX=this.parentArea.rootCX+this.dx,this.rootCY=this.parentArea.rootCY+this.dy,this.level=this.parentArea.level+1;else{var b=this.root.getBBox().center();this.rootCX=b.x,this.rootCY=b.y,this.level=0}a.util.assign(this,this.computeOrigin())},hasVerticalSiblings:function(a){return a.T.exists()||a.B.exists()||a.BR.exists()||a.BL.exists()||a.TR.exists()||a.TL.exists()},hasHorizontalSiblings:function(a){return a.L.exists()||a.R.exists()},isSourceArea:function(){return!this.parentArea},isSinkArea:function(){return 0===this.childAreas.length},getRootPosition:function(){var a=this.root.get("size");return{x:this.rootCX-a.width/2,y:this.rootCY-a.height/2}},getRootVertices:function(b,c){if(c=c||{},b=b||this,0===b[this.deltaCoordinate]||!this.parentArea)return[];var d,e=this.parentArea.getInnerSize();if(!c.ignoreSiblings&&this.hasSiblingsBetweenParent()){var f=this.siblings[this.oppositeDirection];d=this.getRelativeVerticesAvoidingSiblings(e,b,f)}else d=this.getRelativeVertices(e,b);return a.util.invoke(d,"offset",this.parentArea.rootCX,this.parentArea.rootCY)},getInnerSize:function(){return{width:this.rootSize.width,height:this.getLRHeight()}},getConnectionPoint:function(){return null},getRelativeVertices:function(){return null},moveRootFromParent:function(){},moveRootBehindSiblings:function(){},hasSiblingsBetweenParent:function(){return!this.isSourceArea()&&this.siblings[this.oppositeDirection].exists()},getCY:function(){return this.height/2+this.prevSiblingGap},getCX:function(){return this.width/2+this.prevSiblingGap}}),e.extend=b.Model.extend;var s=e.extend({direction:"R",oppositeDirection:"L",deltaCoordinate:"dx",marginDimension:"height",getConnectionPoint:function(a){return c.point(a.width/2,0)},moveRootBehindSiblings:function(a,b){this.dx+=Math.max(this.getLWidth(a,b),this.getTBOverlap(a,b)),this.dy+=(this.getTHeight(a)-this.getBHeight(a))/2},moveRootFromParent:function(){this.dx+=this.parentGap+this.rootOffset},getRelativeVertices:function(a,b){var c=this.getConnectionPoint(a),d=this.parentGap/2;return[c.clone().offset(d,0),c.clone().offset(d,b.dy)]},getRelativeVerticesAvoidingSiblings:function(a,b,c){var d=this.getConnectionPoint(a),e=c.siblingGap/2,f=this.dx>0?-1:1,g=b.dy+f*(c.height+e)/2,h=b.dy+f*this.rootSize.height/4,i=this.gap/2,j=1.5*i+Math.max(this.getLWidth(this.siblings,this.rootSize),this.getTBOverlap(this.siblings,this.rootSize));return[d.clone().offset(i,0),d.clone().offset(i,g),d.clone().offset(j,g),d.clone().offset(j,h)]}}),t=e.extend({direction:"L",oppositeDirection:"R",deltaCoordinate:"dx",marginDimension:"height",getConnectionPoint:function(a){return c.point(-a.width/2,0)},moveRootBehindSiblings:function(a,b){this.dx-=Math.max(this.getRWidth(a,b),this.getTBOverlap(a,b)),this.dy+=(this.getTHeight(a)-this.getBHeight(a))/2},moveRootFromParent:function(){this.dx-=this.parentGap+this.rootOffset},getRelativeVertices:function(a,b){var c=this.getConnectionPoint(a),d=-this.parentGap/2;return[c.clone().offset(d,0),c.clone().offset(d,b.dy)]},getRelativeVerticesAvoidingSiblings:function(a,b,c){var d=this.getConnectionPoint(a),e=this.dx>0?-1:1,f=b.dy+e*(c.height+c.siblingGap/2)/2,g=b.dy+e*this.rootSize.height/4,h=this.gap/2,i=1.5*h+Math.max(this.getRWidth(this.siblings,this.rootSize),this.getTBOverlap(this.siblings,this.rootSize));return[d.clone().offset(-h,0),d.clone().offset(-h,f),d.clone().offset(-i,f),d.clone().offset(-i,g)]}}),u=e.extend({direction:"T",oppositeDirection:"B",deltaCoordinate:"dy",marginDimension:"width",getConnectionPoint:function(a){return c.point(0,-a.height/2)},moveRootBehindSiblings:function(a,b){this.dx+=this.getRootDX(a,b),this.hasHorizontalSiblings(a)&&(this.dy-=(this.getLRHeight()-b.height)/2),this.dy-=this.getBHeight(
107a)},moveRootFromParent:function(){this.dy-=this.parentGap+this.rootOffset},getRelativeVertices:function(a,b){var c=this.getConnectionPoint(a),d=-this.getTXHeight(this.parentArea.siblings)-this.parentGap/2;return[c.clone().offset(0,d),c.clone().offset(b.dx,d)]},getRelativeVerticesAvoidingSiblings:function(a,b){var c=this.getConnectionPoint(a),d=this.siblings,e=d.B,f=this.getTXHeight(this.parentArea.siblings)+this.parentGap/2,g=f+e.height;g+=this.getBXHeight(this.siblings)+this.parentGap/4;var h=this.dy<0?-1:1,i=d[h>0?"BR":"BL"].width,j=b.dx;j+=h*(Math.max(i,e.width/2)+e.siblingGap/4);var k=b.dx+h*this.rootSize.width/4;return[c.clone().offset(0,-f),c.clone().offset(j,-f),c.clone().offset(j,-g),c.clone().offset(k,-g)]}}),v=e.extend({direction:"B",oppositeDirection:"T",deltaCoordinate:"dy",marginDimension:"width",getConnectionPoint:function(a){return c.point(0,a.height/2)},moveRootBehindSiblings:function(a,b){this.dx+=this.getRootDX(a,b),this.dy+=this.getTHeight(a),this.hasHorizontalSiblings(a)&&(this.dy+=(this.getLRHeight()-b.height)/2)},moveRootFromParent:function(){this.dy+=this.parentGap+this.rootOffset},getRelativeVertices:function(a,b){var c=this.getConnectionPoint(a),d=this.getBXHeight(this.parentArea.siblings)+this.parentGap/2;return[c.clone().offset(0,d),c.clone().offset(b.dx,d)]},getRelativeVerticesAvoidingSiblings:function(a,b){var c=this.getConnectionPoint(a),d=this.siblings,e=d.T,f=this.getBXHeight(this.parentArea.siblings)+this.parentGap/2,g=f+e.height;g+=this.getTXHeight(d)+this.parentGap/4;var h=this.dy<0?-1:1,i=d[h>0?"TR":"TL"].width,j=b.dx;j+=h*(Math.max(i,e.width/2)+e.siblingGap/4);var k=b.dx+h*this.rootSize.width/4;return[c.clone().offset(0,f),c.clone().offset(j,f),c.clone().offset(j,g),c.clone().offset(k,g)]}}),w=e.extend({direction:"BR",oppositeDirection:"L",deltaCoordinate:"dy",marginDimension:"height",getConnectionPoint:function(a){return c.point(0,a.height/2)},getCY:function(){return this.prevSiblingGap},moveRootBehindSiblings:function(a,b){var c=Math.max(a.T.width,a.B.width);this.dx+=Math.max(this.getLWidth(a,b),(c-b.width)/2),this.dy+=this.getTHeight(a),this.hasHorizontalSiblings(a)&&(this.dy+=(this.getLRHeight()-b.height)/2)},moveRootFromParent:function(){var a=this.parentArea;a&&(this.dy+=a.firstChildGap),this.dx+=this.rootSize.width/2+this.rootOffset+this.parentGap},getRelativeVertices:function(a,b){var c=this.getConnectionPoint(a);return[c.clone().offset(0,b.dy-a.height/2)]},getRelativeVerticesAvoidingSiblings:function(a,b,d){var e=b.dx-this.rootSize.width/4,f=b.dy;return f+=Math.max(d.height,this.rootSize.height)/2,f+=this.getMinimalGap(d)/2,[c.point(0,f),c.point(e,f)]}}),x=e.extend({direction:"BL",oppositeDirection:"R",deltaCoordinate:"dy",marginDimension:"height",getConnectionPoint:function(a){return c.point(0,a.height/2)},getCY:function(){return this.prevSiblingGap},moveRootBehindSiblings:function(a,b){var c=Math.max(a.T.width,a.B.width);this.dx-=Math.max(this.getRWidth(a,b),(c-b.width)/2),this.dy+=this.getTHeight(a),this.hasHorizontalSiblings(a)&&(this.dy+=(this.getLRHeight()-b.height)/2)},moveRootFromParent:function(){var a=this.parentArea;a&&(this.dy+=a.firstChildGap),this.dx-=this.rootSize.width/2+this.rootOffset+this.parentGap},getRelativeVertices:function(a,b){var c=this.getConnectionPoint(a);return[c.clone().offset(0,b.dy-a.height/2)]},getRelativeVerticesAvoidingSiblings:function(a,b,d){var e=b.dx+this.rootSize.width/4,f=b.dy;return f+=Math.max(d.height,this.rootSize.height)/2,f+=this.getMinimalGap(d)/2,[c.point(0,f),c.point(e,f)]}}),y=e.extend({direction:"TR",oppositeDirection:"L",deltaCoordinate:"dy",marginDimension:"height",getConnectionPoint:function(a){return c.point(0,a.height/2)},getCY:function(){return this.height-this.rootSize.height+this.prevSiblingGap},moveRootBehindSiblings:function(a,b){this.dx+=Math.max(this.getLWidth(a,b),this.getTBOverlap(a,b)),this.dy-=this.getBHeight(a),this.hasHorizontalSiblings(a)&&(this.dy-=(this.getLRHeight()-b.height)/2)},moveRootFromParent:function(){var a=this.parentArea;a&&(this.dy-=a.firstChildGap),this.dx+=this.rootSize.width/2+this.rootOffset+this.parentGap},getRelativeVertices:function(a,b){var c=this.getConnectionPoint(a);return[c.clone().offset(0,b.dy-a.height/2)]},getRelativeVerticesAvoidingSiblings:function(a,b,d){var e=b.dx-this.rootSize.width/4,f=b.dy;return f-=Math.max(d.height,this.rootSize.height)/2,f-=this.getMinimalGap(d)/2,[c.point(0,f),c.point(e,f)]}}),z=e.extend({direction:"TL",oppositeDirection:"R",deltaCoordinate:"dy",marginDimension:"height",getConnectionPoint:function(a){return c.point(0,a.height/2)},getCY:function(){return this.height-this.rootSize.height+this.prevSiblingGap},moveRootBehindSiblings:function(a,b){this.dx-=Math.max(this.getRWidth(a,b),this.getTBOverlap(a,b)),this.dy-=this.getBHeight(
107a),this.hasHorizontalSiblings(a)&&(this.dy-=(this.getLRHeight()-b.height)/2)},moveRootFromParent:function(){var a=this.parentArea;a&&(this.dy-=a.firstChildGap),this.dx-=this.rootSize.width/2+this.rootOffset+this.parentGap},getRelativeVertices:function(a,b){var c=this.getConnectionPoint(a);return[c.clone().offset(0,b.dy-a.height/2)]},getRelativeVerticesAvoidingSiblings:function(a,b,d){var e=b.dx+this.rootSize.width/4,f=b.dy;return f-=Math.max(d.height,this.rootSize.height)/2,f-=this.getMinimalGap(d)/2,[c.point(0,f),c.point(e,f)]}}),A={rotate:function(a){var b="LRBT",c=b.indexOf(a[0])-b.indexOf(a[1]);return function(a){var d=b.indexOf(a);return d>=0?b[(4+d-c)%4]:a}},flip:function(a){var b=a[0],c=a[1];return function(a){return a===b?c:a===c?b:a}},straighten:function(a){return function(){return a[1]}}},B=b.Model.extend({defaults:{graph:void 0,gap:20,parentGap:20,siblingGap:20,firstChildGap:20,direction:"R",directionRule:A.straighten,updatePosition:function(a,b,c){a.set("position",b,c)},updateVertices:function(a,b,c){a.set("vertices",b,c)},updateAttributes:null,filter:null,attributeNames:{}},initialize:function(){this._cacheOptions(this.attributes),this.layoutAreas={}},layout:function(a){this.layoutAreas={};for(var b=this.getGraphSources(a),c=0,d=b.length;c<d;c++)this.layoutTree(b[c],a);return this.trigger("layout:done",a),this},layoutTree:function(a,b){b=b||{},b.treeLayout=!0;var c=this._computeLayoutAreas(a,null,b);return this._computeAbsolutePositions(c),this._updateCells(c,b),this},getLayoutArea:function(a){return this.layoutAreas[a.id||a]||null},getRootLayoutAreas:function(){return this.getGraphSources().map(this.getLayoutArea,this)},getGraphSources:function(a){var b=this.graph.getSources();return this.filter&&b.length>0&&(b=this.filter(b,null,a)||b),b},getMinimalRootAreaByPoint:function(b){var c=this.getRootLayoutAreas().filter(function(a){return a.containsPoint(b)});return a.util.isEmpty(c)?null:c.reduce(function(a,b){return b.width*b.height<a.min&&(a.min=b.width*b.height,a.item=b),a},{min:1/0,item:void 0}).item},_computeLayoutAreas:function(a,b,c){var d=b?b.direction:this.get("direction"),f=a.get(this.getAttributeName("direction"))||d,g=e.create(f,a,this.attributes);g.parentArea=b,g.link=this.graph.getConnectedLinks(a,{inbound:!0})[0];var h=this._getChildren(a,c);this.layoutAreas[a.id]=g;for(var i=[],j=0,k=h.length;j<k;j++)i.push(this._computeLayoutAreas(h[j],g,c));return g.compute(i),g},_cacheOptions:function(b){var c=["updateAttributes","updateVertices","updatePosition","filter"];c.forEach(function(c){this[c]=a.util.isFunction(b[c])?b[c]:null},this),this.graph=b.graph},_getChildren:function(a,b){if(this.layoutAreas[a.id])return[];var c=this.graph.getNeighbors(a,{outbound:!0});return this.filter&&c.length>0&&(c=this.filter(c,a,b)||c),c},_computeAbsolutePositions:function(a){a.computeAbsolutePosition(a);for(var b=0,c=a.childAreas.length;b<c;b++)this._computeAbsolutePositions(a.childAreas[b])},_updateCells:function(a,b){var c=a.root,d=a.link||null;d&&(this.updatePosition&&this.updatePosition(c,a.getRootPosition(),b),this.updateVertices&&this.updateVertices(d,a.getRootVertices(),b)),this.changeSiblingRank(c,a.siblingRank,b),this.updateAttributes&&this.updateAttributes(a,c,d,b);for(var e=0,f=a.childAreas.length;e<f;e++)this._updateCells(a.childAreas[e],b)},updateDirections:function(a,b,c){c=c||{};var d=this.getAttributeName("direction"),e=this.get("directionRule")(b);this.graph.search(a,function(a,b){if(0!==b){var f=e(a.get(d));this.changeDirection(a,f,c)}}.bind(this),{outbound:!0})},reconnectElement:function(a,b,c){c=c||{};var d=this.getLayoutArea(a),e=d.link;if(e){e.set("source",{id:b.id||b},c);var f=d.direction,g=c.direction||f,h=c.siblingRank||void 0;return this.changeSiblingRank(a,h,c),this.changeDirection(a,g,c),f!==g&&this.updateDirections(a,[f,c.direction],c),!0}return!1},changeSiblingRank:function(a,b,c){a.set(this.getAttributeName("siblingRank"),b,c)},changeDirection:function(a,b,c){a.set(this.getAttributeName("direction"),b,c)},getAttributeName:function(a){return this.get("attributeNames")[a]||a},getAttribute:function(a,b){return a.get(this.getAttributeName(b))},prepare:function(){return this}},{directionRules:A});a.layout.TreeLayout=B}(joint,Backbone,g);
108joint.format.gexf={},joint.format.gexf.toCellsArray=function(a,b,c){var d=new DOMParser,e=d.parseFromString(a,"text/xml");if("parsererror"==e.documentElement.nodeName)throw new Error("Error while parsing GEXF file.");var f=Array.from(e.documentElement.querySelectorAll("node")),g=Array.from(e.documentElement.querySelectorAll("edge")),h=[];return f.forEach(function(a){var c=parseFloat(a.querySelector("size").getAttribute("value")),d=b({id:a.getAttribute("id"),width:c,height:c,label:a.getAttribute("label")});h.push(d)}),g.forEach(function(a){var b=c({source:a.getAttribute("source"),target:a.getAttribute("target")});h.unshift(b)}),h};
109!function(a,b,c,d){function e(a){var b=c.Deferred(),e=a.attr("xlink:href")||a.attr("href");return d.imageToDataUri(e,function(c,d){!c&&d&&a.attr("xlink:href",d),b.resolve()}),b.promise()}function f(a){return(new XMLSerializer).serializeToString(a).replace(/&nbsp;/g," ")}function g(a,c){var d=a.ownerDocument,e=d.implementation.createDocument(null,"xml",null);
109b(a).prepend(b("style",{type:"text/css"},[e.createCDATASection(c)]))}function h(b,d){for(var e=Array.from(b.querySelectorAll("*")),f=Array.from(d.querySelectorAll("*")),g=b.ownerDocument,h=g.styleSheets.length,i=[],j=h-1;j>=0;j--)i[j]=g.styleSheets[j],g.styleSheets[j].disabled=!0;var k={};e.forEach(function(b,c){var d=window.getComputedStyle(b,null),e={};a.util.forIn(d,function(a){e[a]=d.getPropertyValue(a)}),k[c]=e}),h!=g.styleSheets.length&&i.forEach(function(a,b){g.styleSheets[b]=a});for(var l=0;l<h;l++)g.styleSheets[l].disabled=!1;var m={};e.forEach(function(b,c){var d=window.getComputedStyle(b,null),e=k[c],f={};a.util.forIn(d,function(a){isNaN(a)&&d.getPropertyValue(a)!==e[a]&&(f[a]=d.getPropertyValue(a))}),m[c]=f}),f.forEach(function(a,b){c(a).css(m[b])})}a.dia.Paper.prototype.toSVG=function(a,i){i=i||{},this.trigger("beforeexport",i);var j=b(this.svg).clone(),k=j.findOne("."+d.addClassNamePrefix("viewport")),l=i.area||this.paperToLocalRect(this.getContentBBox()),m=i.preserveDimensions;m&&j.attr({width:m.width||l.width,height:m.height||l.height}),j.removeAttr("style").attr("viewBox",[l.x,l.y,l.width,l.height].join(" ")),k.removeAttr("transform"),i.useComputedStyles!==!1&&h(this.svg,j.node);var n=i.stylesheet;if(d.isString(n)&&g(j.node,n),this.trigger("afterexport",i),i.convertImagesToDataUris){var o=j.find("image"),p=o.map(e);c.when.apply(c,p).then(function(){a(f(j.node))})}else a(f(j.node))},a.dia.Paper.prototype.openAsSVG=function(a){var b="menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes",c=d.uniqueId("svg_output");this.toSVG(function(a){var d=window.open("",c,b),e="data:image/svg+xml,"+encodeURIComponent(a);
109d.document.write('<img src="'+e+'" style="max-height:100%" />')},d.assign({convertImagesToDataUris:!0},a))}}(joint,V,$,joint.util);
110!function(a){function b(a){for(var b=a.data,c=a.width*a.height*4,d=0;d<c;d+=4){var e=b[d+3]/255;b[d]*=e,b[d+1]*=e,b[d+2]*=e}}function c(a){for(var b=a.data,c=a.width*a.height*4,d=0;d<c;d+=4){var e=b[d+3];0!=e&&(e=255/e,b[d]*=e,b[d+1]*=e,b[d+2]*=e)}}function d(a,b,c,d){var g=document.getElementById(a),h=g.naturalWidth,i=g.naturalHeight,j=document.getElementById(b);j.style.width=h+"px",j.style.height=i+"px",j.width=h,j.height=i;var k=j.getContext("2d");k.clearRect(0,0,h,i),k.drawImage(g,0,0),isNaN(c)||c<1||(d?e(b,0,0,h,i,c):f(b,0,0,h,i,c))}function e(a,d,e,f,j,k){if(!(isNaN(k)||k<1)){k|=0;var l,m=document.getElementById(a),n=m.getContext("2d");try{try{l=n.getImageData(d,e,f,j)}catch(o){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"),l=n.getImageData(d,e,f,j)}catch(o){throw alert("Cannot access local image"),new Error("unable to access local image data: "+o)}}}catch(o){throw alert("Cannot access image"),new Error("unable to access image data: "+o)}b(l);var p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N=l.data,O=k+k+1,P=f-1,Q=j-1,R=k+1,S=R*(R+1)/2,T=new g,U=T;for(r=1;r<O;r++)if(U=U.next=new g,r==R)var V=U;U.next=T;var W=null,X=null;v=u=0;var Y=h[k],Z=i[k];for(q=0;q<j;q++){for(E=F=G=H=w=x=y=z=0,A=R*(I=N[u]),B=R*(J=N[u+1]),C=R*(K=N[u+2]),D=R*(L=N[u+3]),w+=S*I,x+=S*J,y+=S*K,z+=S*L,U=T,r=0;r<R;r++)U.r=I,U.g=J,U.b=K,U.a=L,U=U.next;for(r=1;r<R;r++)s=u+((P<r?P:r)<<2),w+=(U.r=I=N[s])*(M=R-r),x+=(U.g=J=N[s+1])*M,y+=(U.b=K=N[s+2])*M,z+=(U.a=L=N[s+3])*M,E+=I,F+=J,G+=K,H+=L,U=U.next;for(W=T,X=V,p=0;p<f;p++)N[u]=w*Y>>Z,N[u+1]=x*Y>>Z,N[u+2]=y*Y>>Z,N[u+3]=z*Y>>Z,w-=A,x-=B,y-=C,z-=D,A-=W.r,B-=W.g,C-=W.b,D-=W.a,s=v+((s=p+k+1)<P?s:P)<<2,E+=W.r=N[s],F+=W.g=N[s+1],G+=W.b=N[s+2],H+=W.a=N[s+3],w+=E,x+=F,y+=G,z+=H,W=W.next,A+=I=X.r,B+=J=X.g,C+=K=X.b,D+=L=X.a,E-=I,F-=J,G-=K,H-=L,X=X.next,u+=4;v+=f}for(p=0;p<f;p++){for(F=G=H=E=x=y=z=w=0,u=p<<2,A=R*(I=N[u]),B=R*(J=N[u+1]),C=R*(K=N[u+2]),D=R*(L=N[u+3]),w+=S*I,x+=S*J,y+=S*K,z+=S*L,U=T,r=0;r<R;r++)U.r=I,U.g=J,U.b=K,U.a=L,U=U.next;for(t=f,r=1;r<=k;r++)u=t+p<<2,w+=(U.r=I=N[u])*(M=R-r),x+=(U.g=J=N[u+1])*M,y+=(U.b=K=N[u+2])*M,z+=(U.a=L=N[u+3])*M,E+=I,F+=J,G+=K,H+=L,U=U.next,r<Q&&(t+=f);for(u=p,W=T,X=V,q=0;q<j;q++)s=u<<2,N[s]=w*Y>>Z,N[s+1]=x*Y>>Z,N[s+2]=y*Y>>Z,N[s+3]=z*Y>>Z,w-=A,x-=B,y-=C,z-=D,A-=W.r,B-=W.g,C-=W.b,D-=W.a,s=p+((s=q+R)<Q?s:Q)*f<<2,w+=E+=W.r=N[s],x+=F+=W.g=N[s+1],y+=G+=W.b=N[s+2],z+=H+=W.a=N[s+3],W=W.next,A+=I=X.r,B+=J=X.g,C+=K=X.b,D+=L=X.a,E-=I,F-=J,G-=K,H-=L,X=X.next,u+=f}c(l),n.putImageData(l,d,e)}}function f(a,b,c,d,e,f){if(!(isNaN(f)||f<1)){f|=0;var j,k=document.getElementById(a),l=k.getContext("2d");try{try{j=l.getImageData(b,c,d,e)}catch(m){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"),j=l.getImageData(b,c,d,e)}catch(m){throw alert("Cannot access local image"),new Error("unable to access local image data: "+m)}}}catch(m){throw alert("Cannot access image"),new Error("unable to access image data: "+m)}var n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H=j.data,I=f+f+1,J=d-1,K=e-1,L=f+1,M=L*(L+1)/2,N=new g,O=N;for(p=1;p<I;p++)if(O=O.next=new g,p==L)var P=O;O.next=N;var Q=null,R=null;t=s=0;var S=h[f],T=i[f];for(o=0;o<e;o++){for(A=B=C=u=v=w=0,x=L*(D=H[s]),y=L*(E=H[s+1]),z=L*(F=H[s+2]),u+=M*D,v+=M*E,w+=M*F,O=N,p=0;p<L;p++)O.r=D,O.g=E,O.b=F,O=O.next;for(p=1;p<L;p++)q=s+((J<p?J:p)<<2),u+=(O.r=D=H[q])*(G=L-p),v+=(O.g=E=H[q+1])*G,w+=(O.b=F=H[q+2])*G,A+=D,B+=E,C+=F,O=O.next;for(Q=N,R=P,n=0;n<d;n++)H[s]=u*S>>T,H[s+1]=v*S>>T,H[s+2]=w*S>>T,u-=x,v-=y,w-=z,x-=Q.r,y-=Q.g,z-=Q.b,q=t+((q=n+f+1)<J?q:J)<<2,A+=Q.r=H[q],B+=Q.g=H[q+1],C+=Q.b=H[q+2],u+=A,v+=B,w+=C,Q=Q.next,x+=D=R.r,y+=E=R.g,z+=F=R.b,A-=D,B-=E,C-=F,R=R.next,s+=4;t+=d}for(n=0;n<d;n++){for(B=C=A=v=w=u=0,s=n<<2,x=L*(D=H[s]),y=L*(E=H[s+1]),z=L*(F=H[s+2]),u+=M*D,v+=M*E,w+=M*F,O=N,p=0;p<L;p++)O.r=D,O.g=E,O.b=F,O=O.next;for(r=d,p=1;p<=f;p++)s=r+n<<2,u+=(O.r=D=H[s])*(G=L-p),v+=(O.g=E=H[s+1])*G,w+=(O.b=F=H[s+2])*G,A+=D,B+=E,C+=F,O=O.next,p<K&&(r+=d);for(s=n,Q=N,R=P,o=0;o<e;o++)q=s<<2,H[q]=u*S>>T,H[q+1]=v*S>>T,H[q+2]=w*S>>T,u-=x,v-=y,w-=z,x-=Q.r,y-=Q.g,z-=Q.b,q=n+((q=o+L)<K?q:K)*d<<2,u+=A+=Q.r=H[q],v+=B+=Q.g=H[q+1],w+=C+=Q.b=H[q+2],Q=Q.next,x+=D=R.r,y+=E=R.g,z+=F=R.b,A-=D,B-=E,C-=F,R=R.next,s+=d}l.putImageData(j,b,c)}}function g(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var h=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,39
1106,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],i=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24],j={image:d,canvasRGBA:e,canvasRGB:f};"undefined"!=typeof define&&define.amd?define(function(){return j}):"undefined"!=typeof module&&module.exports&&(module.exports=j),a.stackBlur=j}("undefined"!=typeof window?window:this),function(a){function b(a){this.ok=!1,"#"==a.charAt(0)&&(a=a.substr(1,6)),a=a.replace(/ /g,""),a=a.toLowerCase();var c={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee9
1100",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};for(var d in c)a==d&&(a=c[d]);for(var e=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(a){return[parseInt(a[1]),parseInt(a[2]),parseInt(a[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(a){return[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(a){return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)]}}],f=0;f<e.length;f++){var g=e[f].re,h=e[f].process,i=g.exec(a);i&&(channels=h(i),this.r=channels[0],this.g=channels[1],this.b=channels[2],this.ok=!0)}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toHex=function(){var a=this.r.toString(16),b=this.g.toString(16),c=this.b.toString(16);return 1==a.length&&(a="0"+a),1==b.length&&(b="0"+b),1==c.length&&(c="0"+c),"#"+a+b+c},this.getHelpXML=function(){for(var a=new Array,d=0;d<e.length;d++)for(var f=e[d].example,g=0;g<f.length;g++)a[a.length]=f[g];for(var h in c)a[a.length]=h;var i=document.createElement("ul");i.setAttribute("id","rgbcolor-examples");for(var d=0;d<a.length;d++)try{var j=document.createElement("li"),k=new b(a[d]),l=document.createElement("div");l.style.cssText="margin: 3px; border: 1px solid black; background:"+k.toHex()+"; color:"+k.toHex(),l.appendChild(document.createTextNode("test"));var m=document.createTextNode(" "+a[d]+" -> "+k.toRGB()+" -> "+k.toHex());j.appendChild(l),j.appendChild(m),i.appendChild(j)}catch(n){}return i}}"undefined"!=typeof define&&define.amd?define(function(){return b}):"undefined"!=typeof module&&module.exports&&(module.exports=b),a.RGBColor=b}("undefined"!=typeof window?window:this),function(a,b){"use strict";"undefined"!=typeof define&&define.amd?define("canvgModule",["rgbcolor","stackblur"],b):"undefined"!=typeof module&&module.exports&&(module.exports=b(require("rgbcolor"),require("stackblur"))),a.canvg=b(a.RGBColor,a.stackBlur)}("undefined"!=typeof window?window:this,function(a,b){function c(a){var b=[0,0,0],c=function(c,d){var e=a.match(c);null!=e&&(b[d]+=e.length,a=a.replace(c," "))};return a=a.replace(/:not\(([^\)]*)\)/g,"     $1 "),a=a.replace(/{[\s\S]*/gm," "),c(g,1),c(h,0),c(j,1),c(k,2),c(l,1),c(m,1),a=a.replace(/[\*\s\+>~]/g," "),a=a.replace(/[#\.]/g," "),c(n,2),b.join("")}function d(d){var f={opts:d};f.FRAMERATE=30,f.MAX_VIRTUAL_PIXELS=3e4,f.log=function(a){},1==f.opts.log&&"undefined"!=typeof console&&(f.log=function(a){console.log(a)}),f.init=function(a){var b=0;f.UniqueId=function(){return b++,"canvg"+b},f.Definitions={},f.Styles={},f.StylesSpecificity={},f.Animations=[],f.Images=[],f.ctx=a,f.ViewPort=new function(){this.viewPorts=[],this.Clear=function(){this.viewPorts=[]},this.SetCurrent=function(a,b){this.viewPorts.push({width:a,height:b})},this.RemoveCurrent=function(){this.viewPorts.pop()},this.Current=function(){return this.viewPorts[this.viewPorts.length-1]},this.width=function(){return this.Current().width},this.height=function(){return this.Current().height},this.ComputeSize=function(a){return null!=a&&"number"==typeof a?a:"x"==a?this.width():"y"==a?this.height():Math.sqrt(Math.pow(this.width(),2)+Math.pow(this.height(),2))/Math.sqrt(2)}}},f.init(),f.ImagesLoaded=function(){for(var a=0;a<f.Images.length;a++)if(!f.Images[a].loaded)return!1;return!0},f.trim=function(a){return a.replace(/^\s+|\s+$/g,"")},f.compressSpaces=function(a){return a.replace(/[\s\r\t\n]+/gm," ")},f.ajax=function(a){var b;return b=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"),b?(b.open("GET",a,!1),b.send(null),b.responseText):null}
vendor: 5,310 bytes, line 110
110,f.parseXml=function(a){if("undefined"!=typeof Windows&&"undefined"!=typeof Windows.Data&&"undefined"!=typeof Windows.Data.Xml){var b=new Windows.Data.Xml.Dom.XmlDocument,c=new Windows.Data.Xml.Dom.XmlLoadSettings;return c.prohibitDtd=!1,b.loadXml(a,c),b}if(!window.DOMParser){a=a.replace(/<!DOCTYPE svg[^>]*>/,"");var b=new ActiveXObject("Microsoft.XMLDOM");return b.async="false",b.loadXML(a),b}try{var d=new DOMParser;return d.parseFromString(a,"image/svg+xml")}catch(e){return d=new DOMParser,d.parseFromString(a,"text/xml")}},f.Property=function(a,b){this.name=a,this.value=b},f.Property.prototype.getValue=function(){return this.value},f.Property.prototype.hasValue=function(){return null!=this.value&&""!==this.value},f.Property.prototype.numValue=function(){if(!this.hasValue())return 0;var a=parseFloat(this.value);return(this.value+"").match(/%$/)&&(a/=100),a},f.Property.prototype.valueOrDefault=function(a){return this.hasValue()?this.value:a},f.Property.prototype.numValueOrDefault=function(a){return this.hasValue()?this.numValue():a},f.Property.prototype.addOpacity=function(b){var c=this.value;if(null!=b.value&&""!=b.value&&"string"==typeof this.value){var d=new a(this.value);d.ok&&(c="rgba("+d.r+", "+d.g+", "+d.b+", "+b.numValue()+")")}return new f.Property(this.name,c)},f.Property.prototype.getDefinition=function(){var a=this.value.match(/#([^\)'"]+)/);return a&&(a=a[1]),a||(a=this.value),f.Definitions[a]},f.Property.prototype.isUrlDefinition=function(){return 0==this.value.indexOf("url(")},f.Property.prototype.getFillStyleDefinition=function(a,b){var c=this.getDefinition();if(null!=c&&c.createGradient)return c.createGradient(f.ctx,a,b);if(null!=c&&c.createPattern){if(c.getHrefAttribute().hasValue()){var d=c.attribute("patternTransform");c=c.getHrefAttribute().getDefinition(),d.hasValue()&&(c.attribute("patternTransform",!0).value=d.value)}return c.createPattern(f.ctx,a)}return null},f.Property.prototype.getDPI=function(a){return 96},f.Property.prototype.getEM=function(a){var b=12,c=new f.Property("fontSize",f.Font.Parse(f.ctx.font).fontSize);return c.hasValue()&&(b=c.toPixels(a)),b},f.Property.prototype.getUnits=function(){var a=this.value+"";return a.replace(/[0-9\.\-]/g,"")},f.Property.prototype.toPixels=function(a,b){if(!this.hasValue())return 0;var c=this.value+"";if(c.match(/em$/))return this.numValue()*this.getEM(a);if(c.match(/ex$/))return this.numValue()*this.getEM(a)/2;if(c.match(/px$/))return this.numValue();if(c.match(/pt$/))return this.numValue()*this.getDPI(a)*(1/72);if(c.match(/pc$/))return 15*this.numValue();if(c.match(/cm$/))return this.numValue()*this.getDPI(a)/2.54;if(c.match(/mm$/))return this.numValue()*this.getDPI(a)/25.4;if(c.match(/in$/))return this.numValue()*this.getDPI(a);if(c.match(/%$/))return this.numValue()*f.ViewPort.ComputeSize(a);var d=this.numValue();return b&&d<1?d*f.ViewPort.ComputeSize(a):d},f.Property.prototype.toMilliseconds=function(){if(!this.hasValue())return 0;var a=this.value+"";return a.match(/s$/)?1e3*this.numValue():a.match(/ms$/)?this.numValue():this.numValue()},f.Property.prototype.toRadians=function(){if(!this.hasValue())return 0;var a=this.value+"";return a.match(/deg$/)?this.numValue()*(Math.PI/180):a.match(/grad$/)?this.numValue()*(Math.PI/200):a.match(/rad$/)?this.numValue():this.numValue()*(Math.PI/180)};var g={baseline:"alphabetic","before-edge":"top","text-before-edge":"top",middle:"middle",central:"middle","after-edge":"bottom","text-after-edge":"bottom",ideographic:"ideographic",alphabetic:"alphabetic",hanging:"hanging",mathematical:"alphabetic"};return f.Property.prototype.toTextBaseline=function(){return this.hasValue()?g[this.value]:null},f.Font=new function(){this.Styles="normal|italic|oblique|inherit",this.Variants="normal|small-caps|inherit",this.Weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit",this.CreateFont=function(a,b,c,d,e,g){var h=null!=g?this.Parse(g):this.CreateFont("","","","","",f.ctx.font);return{fontFamily:e||h.fontFamily,fontSize:d||h.fontSize,fontStyle:a||h.fontStyle,fontWeight:c||h.fontWeight,fontVariant:b||h.fontVariant,toString:function(){return[this.fontStyle,this.fontVariant,this.fontWeight,this.fontSize,this.fontFamily].join(" ")}}};var a=this;this.Parse=function(b){for(var c={},d=f.trim(f.compressSpaces(b||"")).split(" "),e={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1},g="",h=0;h<d.length;h++)e.fontStyle||a.Styles.indexOf(d[h])==-1?e.fontVariant||a.Variants.indexOf(d[h])==-1?e.fontWeight||a.Weights.indexOf(d[h])==-1?e.fontSize?"inherit"!=d[h]&&(g+=d[h]):("inherit"!=d[h]&&(c.fontSize=d[h].split("/")[0]),e.fontStyle=e.fontVariant=e.fontWeight=e.fontSize=!0):("inherit"!=d[h]&&(c.fontWeight=d[h]),e.fontStyle=e.fontVariant=e.fontWeight=!0):("inherit"!=d[h]&&(c.fontVariant=d[h]),e.fontStyle=e.fontVariant=!0):("inherit"!=d[h]&&(c.fontStyle=d[h]),e.fontStyle=!0);return""!=g&&(c.fontFamily=g),c}},f.ToNumberArray=function(a){for(var b=f.trim(f.compressSpaces((a||"").replace(/,/g," "))).split(" "),c=0;c<b.length;c++)b[c]=parseFloat(b[c]);return b},f.Point=function(a,b){this.x=a,this.y=b},f.Point.prototype.angleTo=function(a){return Math.atan2(a.y-this.y,a.x-this.x)},f.Point.prototype.applyTransform=function(a){var b=this.x*a[0]+this.y*a[2]+a[4],c=this.x*a[1]+this.y*a[3]+a[5];this.x=b,this.y=c}
vendor: 6,535 bytes, line 110
110,f.CreatePoint=function(a){var b=f.ToNumberArray(a);return new f.Point(b[0],b[1])},f.CreatePath=function(a){for(var b=f.ToNumberArray(a),c=[],d=0;d<b.length;d+=2)c.push(new f.Point(b[d],b[d+1]));return c},f.BoundingBox=function(a,b,c,d){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN,this.x=function(){return this.x1},this.y=function(){return this.y1},this.width=function(){return this.x2-this.x1},this.height=function(){return this.y2-this.y1},this.addPoint=function(a,b){null!=a&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=a,this.x2=a),a<this.x1&&(this.x1=a),a>this.x2&&(this.x2=a)),null!=b&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=b,this.y2=b),b<this.y1&&(this.y1=b),b>this.y2&&(this.y2=b))},this.addX=function(a){this.addPoint(a,null)},this.addY=function(a){this.addPoint(null,a)},this.addBoundingBox=function(a){this.addPoint(a.x1,a.y1),this.addPoint(a.x2,a.y2)},this.addQuadraticCurve=function(a,b,c,d,e,f){var g=a+2/3*(c-a),h=b+2/3*(d-b),i=g+1/3*(e-a),j=h+1/3*(f-b);this.addBezierCurve(a,b,g,i,h,j,e,f)},this.addBezierCurve=function(a,b,c,d,e,f,g,h){var j=[a,b],k=[c,d],l=[e,f],m=[g,h];for(this.addPoint(j[0],j[1]),this.addPoint(m[0],m[1]),i=0;i<=1;i++){var n=function(a){return Math.pow(1-a,3)*j[i]+3*Math.pow(1-a,2)*a*k[i]+3*(1-a)*Math.pow(a,2)*l[i]+Math.pow(a,3)*m[i]},o=6*j[i]-12*k[i]+6*l[i],p=-3*j[i]+9*k[i]-9*l[i]+3*m[i],q=3*k[i]-3*j[i];if(0!=p){var r=Math.pow(o,2)-4*q*p;if(!(r<0)){var s=(-o+Math.sqrt(r))/(2*p);0<s&&s<1&&(0==i&&this.addX(n(s)),1==i&&this.addY(n(s)));var t=(-o-Math.sqrt(r))/(2*p);0<t&&t<1&&(0==i&&this.addX(n(t)),1==i&&this.addY(n(t)))}}else{if(0==o)continue;var u=-q/o;0<u&&u<1&&(0==i&&this.addX(n(u)),1==i&&this.addY(n(u)))}}},this.isPointInBox=function(a,b){return this.x1<=a&&a<=this.x2&&this.y1<=b&&b<=this.y2},this.addPoint(a,b),this.addPoint(c,d)},f.Transform=function(a){var b=this;this.Type={},this.Type.translate=function(a){this.p=f.CreatePoint(a),this.apply=function(a){a.translate(this.p.x||0,this.p.y||0)},this.unapply=function(a){a.translate(-1*this.p.x||0,-1*this.p.y||0)},this.applyToPoint=function(a){a.applyTransform([1,0,0,1,this.p.x||0,this.p.y||0])}},this.Type.rotate=function(a){var b=f.ToNumberArray(a);this.angle=new f.Property("angle",b[0]),this.cx=b[1]||0,this.cy=b[2]||0,this.apply=function(a){a.translate(this.cx,this.cy),a.rotate(this.angle.toRadians()),a.translate(-this.cx,-this.cy)},this.unapply=function(a){a.translate(this.cx,this.cy),a.rotate(-1*this.angle.toRadians()),a.translate(-this.cx,-this.cy)},this.applyToPoint=function(a){var b=this.angle.toRadians();a.applyTransform([1,0,0,1,this.p.x||0,this.p.y||0]),a.applyTransform([Math.cos(b),Math.sin(b),-Math.sin(b),Math.cos(b),0,0]),a.applyTransform([1,0,0,1,-this.p.x||0,-this.p.y||0])}},this.Type.scale=function(a){this.p=f.CreatePoint(a),this.apply=function(a){a.scale(this.p.x||1,this.p.y||this.p.x||1)},this.unapply=function(a){a.scale(1/this.p.x||1,1/this.p.y||this.p.x||1)},this.applyToPoint=function(a){a.applyTransform([this.p.x||0,0,0,this.p.y||0,0,0])}},this.Type.matrix=function(a){this.m=f.ToNumberArray(a),this.apply=function(a){a.transform(this.m[0],this.m[1],this.m[2],this.m[3],this.m[4],this.m[5])},this.unapply=function(a){var b=this.m[0],c=this.m[2],d=this.m[4],e=this.m[1],f=this.m[3],g=this.m[5],h=0,i=0,j=1,k=1/(b*(f*j-g*i)-c*(e*j-g*h)+d*(e*i-f*h));a.transform(k*(f*j-g*i),k*(g*h-e*j),k*(d*i-c*j),k*(b*j-d*h),k*(c*g-d*f),k*(d*e-b*g))},this.applyToPoint=function(a){a.applyTransform(this.m)}},this.Type.SkewBase=function(a){this.base=b.Type.matrix,this.base(a),this.angle=new f.Property("angle",a)},this.Type.SkewBase.prototype=new this.Type.matrix,this.Type.skewX=function(a){this.base=b.Type.SkewBase,this.base(a),this.m=[1,0,Math.tan(this.angle.toRadians()),1,0,0]},this.Type.skewX.prototype=new this.Type.SkewBase,this.Type.skewY=function(a){this.base=b.Type.SkewBase,this.base(a),this.m=[1,Math.tan(this.angle.toRadians()),0,1,0,0]},this.Type.skewY.prototype=new this.Type.SkewBase,this.transforms=[],this.apply=function(a){for(var b=0;b<this.transforms.length;b++)this.transforms[b].apply(a)},this.unapply=function(a){for(var b=this.transforms.length-1;b>=0;b--)this.transforms[b].unapply(a)},this.applyToPoint=function(a){for(var b=0;b<this.transforms.length;b++)this.transforms[b].applyToPoint(a)};for(var c=f.trim(f.compressSpaces(a)).replace(/\)([a-zA-Z])/g,") $1").replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/),d=0;d<c.length;d++){var e=f.trim(c[d].split("(")[0]),g=c[d].split("(")[1].replace(")",""),h=this.Type[e];if("undefined"!=typeof h){var i=new h(g);i.type=e,this.transforms.push(i)}}},f.AspectRatio=function(a,b,c,d,e,g,h,i,j,k){b=f.compressSpaces(b),b=b.replace(/^defer\s/,"");var l=b.split(" ")[0]||"xMidYMid",m=b.split(" ")[1]||"meet",n=c/d,o=e/g,p=Math.min(n,o),q=Math.max(n,o);"meet"==m&&(d*=p,g*=p),"slice"==m&&(d*=q,g*=q),j=new f.Property("refX",j),k=new f.Property("refY",k),j.hasValue()&&k.hasValue()?a.translate(-p*j.toPixels("x"),-p*k.toPixels("y")):(l.match(/^xMid/)&&("meet"==m&&p==o||"slice"==m&&q==o)&&a.translate(c/2-d/2,0),l.match(/YMid$/)&&("meet"==m&&p==n||"slice"==m&&q==n)&&a.translate(0,e/2-g/2),l.match(/^xMax/)&&("meet"==m&&p==o||"slice"==m&&q==o)&&a.translate(c-d,0),l.match(/YMax$/)&&("meet"==m&&p==n||"slice"==m&&q==n)&&a.translate(0,e-g)),"none"==l?a.scale(n,o):"meet"==m?a.scale(p,p):"slice"==m&&a.scale(q,q),a.translate(null==h?0:-h,null==i?0:-i)},f.Element={},f.EmptyProperty=new f.Property("EMPTY",""),f.Element.ElementBase=function(a){this.attributes={},this.styles={},this.stylesSpecificity={},this.children=[],this.attribute=function(a,b){var c=this.attributes[a];return null!=c?c:(1==b&&(c=new f.Property(a,""),this.attributes[a]=c),c||f.EmptyProperty)},this.getHrefAttribute=function(){for(var a in this.attributes)if("href"==a||a.match(/:href$/))return this.attributes[a];return f.EmptyProperty},this.style=function(a,b,c){var d=this.styles[a];if(null!=d)return d;var e=this.attribute(a);if(null!=e&&e.hasValue())return this.styles[a]=e,e;if(1!=c){var g=this.parent;if(null!=g){var h=g.style(a);if(null!=h&&h.hasValue())return h}}return 1==b&&(d=new f.Property(a,""),this.styles[a]=d),d||f.EmptyProperty},this.render=function(a){if("none"!=this.style("display").value&&"hidden"!=this.style("visibility").value){if(a.save(),this.style("mask").hasValue()){var b=this.style("mask").getDefinition();null!=b&&b.apply(a,this)}else if(this.style("filter").hasValue()){var c=this.style("filter").getDefinition();null!=c&&c.apply(a,this)}else this.setContext(a),this.renderChildren(a),this.clearContext(a);
110a.restore()}},this.setContext=function(a){},this.clearContext=function(a){},this.renderChildren=function(a){for(var b=0;b<this.children.length;b++)this.children[b].render(a)},this.addChild=function(a,b){var c=a;b&&(c=f.CreateElement(a)),c.parent=this,"title"!=c.type&&this.children.push(c)},this.addStylesFromStyleDefinition=function(){for(var b in f.Styles)if("@"!=b[0]&&e(a,b)){var c=f.Styles[b],d=f.StylesSpecificity[b];if(null!=c)for(var g in c){var h=this.stylesSpecificity[g];"undefined"==typeof h&&(h="000"),d>h&&(this.styles[g]=c[g],this.stylesSpecificity[g]=d)}}};var b=new RegExp("^[A-Z-]+$"),c=function(a){return b.test(a)?a.toLowerCase():a};if(null!=a&&1==a.nodeType){for(var d=0;d<a.attributes.length;d++){var g=a.attributes[d],h=c(g.nodeName);this.attributes[h]=new f.Property(h,g.value)}if(this.addStylesFromStyleDefinition(),this.attribute("style").hasValue())for(var i=this.attribute("style").value.split(";"),d=0;d<i.length;d++)if(""!=f.trim(i[d])){var j=i[d].split(":"),k=f.trim(j[0]),l=f.trim(j[1]);this.styles[k]=new f.Property(k,l)}this.attribute("id").hasValue()&&null==f.Definitions[this.attribute("id").value]&&(f.Definitions[this.attribute("id").value]=this);for(var d=0;d<a.childNodes.length;d++){var m=a.childNodes[d];if(1==m.nodeType&&this.addChild(m,!0),this.captureTextNodes&&(3==m.nodeType||4==m.nodeType)){var n=m.value||m.text||m.textContent||"";""!=f.compressSpaces(n)&&this.addChild(new f.Element.tspan(m),!1)}}}},f.Element.RenderedElementBase=function(a){this.base=f.Element.ElementBase,this.base(a),this.setContext=function(a){if(this.style("fill").isUrlDefinition()){var b=this.style("fill").getFillStyleDefinition(this,this.style("fill-opacity"));null!=b&&(a.fillStyle=b)}else if(this.style("fill").hasValue()){var c=this.style("fill");"currentColor"==c.value&&(c.value=this.style("color").value),"inherit"!=c.value&&(a.fillStyle="none"==c.value?"rgba(0,0,0,0)":c.value)}if(this.style("fill-opacity").hasValue()){var c=new f.Property("fill",a.fillStyle);c=c.addOpacity(this.style("fill-opacity")),a.fillStyle=c.value}if(this.style("stroke").isUrlDefinition()){var b=this.style("stroke").getFillStyleDefinition(this,this.style("stroke-opacity"));null!=b&&(a.strokeStyle=b)}else if(this.style("stroke").hasValue()){var d=this.style("stroke");"currentColor"==d.value&&(d.value=this.style("color").value),"inherit"!=d.value&&(a.strokeStyle="none"==d.value?"rgba(0,0,0,0)":d.value)}if(this.style("stroke-opacity").hasValue()){var d=new f.Property("stroke",a.strokeStyle);d=d.addOpacity(this.style("stroke-opacity")),a.strokeStyle=d.value}if(this.style("stroke-width").hasValue()){var e=this.style("stroke-width").toPixels();a.lineWidth=0==e?.001:e}if(this.style("stroke-linecap").hasValue()&&(a.lineCap=this.style("stroke-linecap").value),this.style("stroke-linejoin").hasValue()&&(a.lineJoin=this.style("stroke-linejoin").value),this.style("stroke-miterlimit").hasValue()&&(a.miterLimit=this.style("stroke-miterlimit").value),this.style("stroke-dasharray").hasValue()&&"none"!=this.style("stroke-dasharray").value){var g=f.ToNumberArray(this.style("stroke-dasharray").value);"undefined"!=typeof a.setLineDash?a.setLineDash(g):"undefined"!=typeof a.webkitLineDash?a.webkitLineDash=g:"undefined"==typeof a.mozDash||1==g.length&&0==g[0]||(a.mozDash=g);var h=this.style("stroke-dashoffset").numValueOrDefault(1);"undefined"!=typeof a.lineDashOffset?a.lineDashOffset=h:"undefined"!=typeof a.webkitLineDashOffset?a.webkitLineDashOffset=h:"undefined"!=typeof a.mozDashOffset&&(a.mozDashOffset=h)}if("undefined"!=typeof a.font&&(a.font=f.Font.CreateFont(this.style("font-style").value,this.style("font-variant").value,this.style("font-weight").value,this.style("font-size").hasValue()?this.style("font-size").toPixels()+"px":"",this.style("font-family").value).toString()),this.style("transform",!1,!0).hasValue()){var i=new f.Transform(this.style("transform",!1,!0).value);i.apply(a)}if(this.style("clip-path",!1,!0).hasValue()){var j=this.style("clip-path",!1,!0).getDefinition();null!=j&&j.apply(a)}this.style("opacity").hasValue()&&(a.globalAlpha=this.style("opacity").numValue())}},f.Element.RenderedElementBase.prototype=new f.Element.ElementBase,f.Element.PathElementBase=function(a){this.base=f.Element.RenderedElementBase,this.base(a),this.path=function(a){return null!=a&&a.beginPath(),new f.BoundingBox},this.renderChildren=function(a){this.path(a),f.Mouse.checkPath(this,a),""!=a.fillStyle&&("inherit"!=this.style("fill-rule").valueOrDefault("inherit")?a.fill(this.style("fill-rule").value):a.fill()),""!=a.strokeStyle&&a.stroke();var b=this.getMarkers();if(null!=b){if(this.style("marker-start").isUrlDefinition()){var c=this.style("marker-start").getDefinition();c.render(a,b[0][0],b[0][1])}if(this.style("marker-mid").isUrlDefinition())for(var c=this.style("marker-mid").getDefinition(),d=1;d<b.length-1;
vendor: 12,050 bytes, lines 110-111
110d++)c.render(a,b[d][0],b[d][1]);if(this.style("marker-end").isUrlDefinition()){var c=this.style("marker-end").getDefinition();c.render(a,b[b.length-1][0],b[b.length-1][1])}}},this.getBoundingBox=function(){return this.path()},this.getMarkers=function(){return null}},f.Element.PathElementBase.prototype=new f.Element.RenderedElementBase,f.Element.svg=function(a){this.base=f.Element.RenderedElementBase,this.base(a),this.baseClearContext=this.clearContext,this.clearContext=function(a){this.baseClearContext(a),f.ViewPort.RemoveCurrent()},this.baseSetContext=this.setContext,this.setContext=function(a){a.strokeStyle="rgba(0,0,0,0)",a.lineCap="butt",a.lineJoin="miter",a.miterLimit=4,"undefined"!=typeof a.font&&"undefined"!=typeof window.getComputedStyle&&(a.font=window.getComputedStyle(a.canvas).getPropertyValue("font")),this.baseSetContext(a),this.attribute("x").hasValue()||(this.attribute("x",!0).value=0),this.attribute("y").hasValue()||(this.attribute("y",!0).value=0),a.translate(this.attribute("x").toPixels("x"),this.attribute("y").toPixels("y"));var b=f.ViewPort.width(),c=f.ViewPort.height();if(this.attribute("width").hasValue()||(this.attribute("width",!0).value="100%"),this.attribute("height").hasValue()||(this.attribute("height",!0).value="100%"),"undefined"==typeof this.root){b=this.attribute("width").toPixels("x"),c=this.attribute("height").toPixels("y");var d=0,e=0;this.attribute("refX").hasValue()&&this.attribute("refY").hasValue()&&(d=-this.attribute("refX").toPixels("x"),e=-this.attribute("refY").toPixels("y")),"visible"!=this.attribute("overflow").valueOrDefault("hidden")&&(a.beginPath(),a.moveTo(d,e),a.lineTo(b,e),a.lineTo(b,c),a.lineTo(d,c),a.closePath(),a.clip())}if(f.ViewPort.SetCurrent(b,c),this.attribute("viewBox").hasValue()){var g=f.ToNumberArray(this.attribute("viewBox").value),h=g[0],i=g[1];b=g[2],c=g[3],f.AspectRatio(a,this.attribute("preserveAspectRatio").value,f.ViewPort.width(),b,f.ViewPort.height(),c,h,i,this.attribute("refX").value,this.attribute("refY").value),f.ViewPort.RemoveCurrent(),f.ViewPort.SetCurrent(g[2],g[3])}}},f.Element.svg.prototype=new f.Element.RenderedElementBase,f.Element.rect=function(a){this.base=f.Element.PathElementBase,this.base(a),this.path=function(a){var b=this.attribute("x").toPixels("x"),c=this.attribute("y").toPixels("y"),d=this.attribute("width").toPixels("x"),e=this.attribute("height").toPixels("y"),g=this.attribute("rx").toPixels("x"),h=this.attribute("ry").toPixels("y");
111return this.attribute("rx").hasValue()&&!this.attribute("ry").hasValue()&&(h=g),this.attribute("ry").hasValue()&&!this.attribute("rx").hasValue()&&(g=h),g=Math.min(g,d/2),h=Math.min(h,e/2),null!=a&&(a.beginPath(),a.moveTo(b+g,c),a.lineTo(b+d-g,c),a.quadraticCurveTo(b+d,c,b+d,c+h),a.lineTo(b+d,c+e-h),a.quadraticCurveTo(b+d,c+e,b+d-g,c+e),a.lineTo(b+g,c+e),a.quadraticCurveTo(b,c+e,b,c+e-h),a.lineTo(b,c+h),a.quadraticCurveTo(b,c,b+g,c),a.closePath()),new f.BoundingBox(b,c,b+d,c+e)}},f.Element.rect.prototype=new f.Element.PathElementBase,f.Element.circle=function(a){this.base=f.Element.PathElementBase,this.base(a),this.path=function(a){var b=this.attribute("cx").toPixels("x"),c=this.attribute("cy").toPixels("y"),d=this.attribute("r").toPixels();return null!=a&&(a.beginPath(),a.arc(b,c,d,0,2*Math.PI,!0),a.closePath()),new f.BoundingBox(b-d,c-d,b+d,c+d)}},f.Element.circle.prototype=new f.Element.PathElementBase,f.Element.ellipse=function(a){this.base=f.Element.PathElementBase,this.base(a),this.path=function(a){var b=4*((Math.sqrt(2)-1)/3),c=this.attribute("rx").toPixels("x"),d=this.attribute("ry").toPixels("y"),e=this.attribute("cx").toPixels("x"),g=this.attribute("cy").toPixels("y");return null!=a&&(a.beginPath(),a.moveTo(e,g-d),a.bezierCurveTo(e+b*c,g-d,e+c,g-b*d,e+c,g),a.bezierCurveTo(e+c,g+b*d,e+b*c,g+d,e,g+d),a.bezierCurveTo(e-b*c,g+d,e-c,g+b*d,e-c,g),a.bezierCurveTo(e-c,g-b*d,e-b*c,g-d,e,g-d),a.closePath()),new f.BoundingBox(e-c,g-d,e+c,g+d)}},f.Element.ellipse.prototype=new f.Element.PathElementBase,f.Element.line=function(a){this.base=f.Element.PathElementBase,this.base(a),this.getPoints=function(){return[new f.Point(this.attribute("x1").toPixels("x"),this.attribute("y1").toPixels("y")),new f.Point(this.attribute("x2").toPixels("x"),this.attribute("y2").toPixels("y"))]},this.path=function(a){var b=this.getPoints();return null!=a&&(a.beginPath(),a.moveTo(b[0].x,b[0].y),a.lineTo(b[1].x,b[1].y)),new f.BoundingBox(b[0].x,b[0].y,b[1].x,b[1].y)},this.getMarkers=function(){var a=this.getPoints(),b=a[0].angleTo(a[1]);return[[a[0],b],[a[1],b]]}},f.Element.line.prototype=new f.Element.PathElementBase,f.Element.polyline=function(a){this.base=f.Element.PathElementBase,this.base(a),this.points=f.CreatePath(this.attribute("points").value),this.path=function(a){var b=new f.BoundingBox(this.points[0].x,this.points[0].y);null!=a&&(a.beginPath(),a.moveTo(this.points[0].x,this.points[0].y));for(var c=1;c<this.points.length;c++)b.addPoint(this.points[c].x,this.points[c].y),null!=a&&a.lineTo(this.points[c].x,this.points[c].y);return b},this.getMarkers=function(){for(var a=[],b=0;b<this.points.length-1;b++)a.push([this.points[b],this.points[b].angleTo(this.points[b+1])]);return a.length>0&&a.push([this.points[this.points.length-1],a[a.length-1][1]]),a}},f.Element.polyline.prototype=new f.Element.PathElementBase,f.Element.polygon=function(a){this.base=f.Element.polyline,this.base(a),this.basePath=this.path,this.path=function(a){var b=this.basePath(a);return null!=a&&(a.lineTo(this.points[0].x,this.points[0].y),a.closePath()),b}},f.Element.polygon.prototype=new f.Element.polyline,f.Element.path=function(a){this.base=f.Element.PathElementBase,this.base(a);var b=this.attribute("d").value;b=b.replace(/,/gm," ");for(var c=0;c<2;c++)b=b.replace(/([MmZzLlHhVvCcSsQqTtAa])([^\s])/gm,"$1 $2");b=b.replace(/([^\s])([MmZzLlHhVvCcSsQqTtAa])/gm,"$1 $2"),b=b.replace(/([0-9])([+\-])/gm,"$1 $2");for(var c=0;c<2;c++)b=b.replace(/(\.[0-9]*)(\.)/gm,"$1 $2");b=b.replace(/([Aa](\s+[0-9]+){3})\s+([01])\s*([01])/gm,"$1 $3 $4 "),b=f.compressSpaces(b),b=f.trim(b),this.PathParser=new function(a){this.tokens=a.split(" "),this.reset=function(){this.i=-1,this.command="",this.previousCommand="",this.start=new f.Point(0,0),this.control=new f.Point(0,0),this.current=new f.Point(0,0),this.points=[],this.angles=[]},this.isEnd=function(){return this.i>=this.tokens.length-1},this.isCommandOrEnd=function(){return!!this.isEnd()||null!=this.tokens[this.i+1].match(/^[A-Za-z]$/)},this.isRelativeCommand=function(){switch(this.command){case"m":case"l":case"h":case"v":case"c":case"s":case"q":case"t":case"a":case"z":return!0}return!1},this.getToken=function(){return this.i++,this.tokens[this.i]},this.getScalar=function(){return parseFloat(this.getToken())},this.nextCommand=function(){this.previousCommand=this.command,this.command=this.getToken()},this.getPoint=function(){var a=new f.Point(this.getScalar(),this.getScalar());return this.makeAbsolute(a)},this.getAsControlPoint=function(){var a=this.getPoint();return this.control=a,a},this.getAsCurrentPoint=function(){var a=this.getPoint();return this.current=a,a},this.getReflectedControlPoint=function(){if("c"!=this.previousCommand.toLowerCase()&&"s"!=this.previousCommand.toLowerCase()&&"q"!=this.previousCommand.toLowerCase()&&"t"!=this.previousCommand.toLowerCase())return this.current;var a=new f.Point(2*this.current.x-this.control.x,2*this.current.y-this.control.y);return a},this.makeAbsolute=function(a){return this.isRelativeCommand()&&(a.x+=this.current.x,a.y+=this.current.y),a},this.addMarker=function(a,b,c){null!=c&&this.angles.length>0&&null==this.angles[this.angles.length-1]&&(this.angles[this.angles.length-1]=this.points[this.points.length-1].angleTo(c)),this.addMarkerAngle(a,null==b?null:b.angleTo(a))},this.addMarkerAngle=function(a,b){this.points.push(a),this.angles.push(b)},this.getMarkerPoints=function(){return this.points},this.getMarkerAngles=function(){for(var a=0;a<this.angles.length;a++)if(null==this.angles[a])for(var b=a+1;b<this.angles.length;b++)if(null!=this.angles[b]){this.angles[a]=this.angles[b];break}return this.angles}}(b),this.path=function(a){var b=this.PathParser;b.reset();var c=new f.BoundingBox;for(null!=a&&a.beginPath();!b.isEnd();)switch(b.nextCommand(),b.command){case"M":case"m":var d=b.getAsCurrentPoint();for(b.addMarker(d),c.addPoint(d.x,d.y),null!=a&&a.moveTo(d.x,d.y),b.start=b.current;!b.isCommandOrEnd();){var d=b.getAsCurrentPoint();b.addMarker(d,b.start),c.addPoint(d.x,d.y),null!=a&&a.lineTo(d.x,d.y)}break;case"L":case"l":for(;!b.isCommandOrEnd();){var e=b.current,d=b.getAsCurrentPoint();b.addMarker(d,e),c.addPoint(d.x,d.y),null!=a&&a.lineTo(d.x,d.y)}break;case"H":case"h":for(;!b.isCommandOrEnd();){var g=new f.Point((b.isRelativeCommand()?b.current.x:0)+b.getScalar(),b.current.y);b.addMarker(g,b.current),b.current=g,c.addPoint(b.current.x,b.current.y),null!=a&&a.lineTo(b.current.x,b.current.y)}break;case"V":case"v":for(;!b.isCommandOrEnd();){var g=new f.Point(b.current.x,(b.isRelativeCommand()?b.current.y:0)+b.getScalar());b.addMarker(g,b.current),b.current=g,c.addPoint(b.current.x,b.current.y),null!=a&&a.lineTo(b.current.x,b.current.y)}break;case"C":case"c":for(;!b.isCommandOrEnd();){var h=b.current,i=b.getPoint(),j=b.getAsControlPoint(),k=b.getAsCurrentPoint();b.addMarker(k,j,i),c.addBezierCurve(h.x,h.y,i.x,i.y,j.x,j.y,k.x,k.y),null!=a&&a.bezierCurveTo(i.x,i.y,j.x,j.y,k.x,k.y)}break;case"S":case"s":for(;!b.isCommandOrEnd();){var h=b.current,i=b.getReflectedControlPoint(),j=b.getAsControlPoint(),k=b.getAsCurrentPoint();b.addMarker(k,j,i),c.addBezierCurve(h.x,h.y,i.x,i.y,j.x,j.y,k.x,k.y),null!=a&&a.bezierCurveTo(i.x,i.y,j.x,j.y,k.x,k.y)}break;case"Q":case"q":for(;!b.isCommandOrEnd();){var h=b.current,j=b.getAsControlPoint(),k=b.getAsCurrentPoint();b.addMarker(k,j,j),c.addQuadraticCurve(h.x,h.y,j.x,j.y,k.x,k.y),null!=a&&a.quadraticCurveTo(j.x,j.y,k.x,k.y)}break;case"T":case"t":for(;!b.isCommandOrEnd();){var h=b.current,j=b.getReflectedControlPoint();b.control=j;var k=b.getAsCurrentPoint();b.addMarker(k,j,j),c.addQuadraticCurve(h.x,h.y,j.x,j.y,k.x,k.y),null!=a&&a.quadraticCurveTo(j.x,j.y,k.x,k.y)}break;case"A":case"a":for(;!b.isCommandOrEnd();){var h=b.current,l=b.getScalar(),m=b.getScalar(),n=b.getScalar()*(Math.PI/180),o=b.getScalar(),p=b.getScalar(),k=b.getAsCurrentPoint(),q=new f.Point(Math.cos(n)*(h.x-k.x)/2+Math.sin(n)*(h.y-k.y)/2,-Math.sin(n)*(h.x-k.x)/2+Math.cos(n)*(h.y-k.y)/2),r=Math.pow(q.x,2)/Math.pow(l,2)+Math.pow(q.y,2)/Math.pow(m,2);r>1&&(l*=Math.sqrt(r),m*=Math.sqrt(r));var s=(o==p?-1:1)*Math.sqrt((Math.pow(l,2)*Math.pow(m,2)-Math.pow(l,2)*Math.pow(q.y,2)-Math.pow(m,2)*Math.pow(q.x,2))/(Math.pow(l,2)*Math.pow(q.y,2)+Math.pow(m,2)*Math.pow(q.x,2)));isNaN(s)&&(s=0);var t=new f.Point(s*l*q.y/m,s*-m*q.x/l),u=new f.Point((h.x+k.x)/2+Math.cos(n)*t.x-Math.sin(n)*t.y,(h.y+k.y)/2+Math.sin(n)*t.x+Math.cos(n)*t.y),v=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2))},w=function(a,b){return(a[0]*b[0]+a[1]*b[1])/(v(a)*v(b))},x=function(a,b){return(a[0]*b[1]<a[1]*b[0]?-1:1)*Math.acos(w(a,b))},y=x([1,0],[(q.x-t.x)/l,(q.y-t.y)/m]),z=[(q.x-t.x)/l,(q.y-t.y)/m],A=[(-q.x-t.x)/l,(-q.y-t.y)/m],B=x(z,A);w(z,A)<=-1&&(B=Math.PI),w(z,A)>=1&&(B=0);var C=1-p?1:-1,D=y+C*(B/2),E=new f.Point(u.x+l*Math.cos(D),u.y+m*Math.sin(D));if(b.addMarkerAngle(E,D-C*Math.PI/2),b.addMarkerAngle(k,D-C*Math.PI),c.addPoint(k.x,k.y),null!=a){var w=l>m?l:m,F=l>m?1:l/m,G=l>m?m/l:1;a.translate(u.x,u.y),a.rotate(n),a.scale(F,G),a.arc(0,0,w,y,y+B,1-p),a.scale(1/F,1/G),a.rotate(-n),a.translate(-u.x,-u.y)}}break;case"Z":case"z":null!=a&&a.closePath(),b.current=b.start}return c},this.getMarkers=function(){for(var a=this.PathParser.getMarkerPoints(),b=this.PathParser.getMarkerAngles(),c=[],d=0;d<a.length;d++)c.push([a[d],b[d]]);return c}},f.Element.path.prototype=new f.Element.PathElementBase,f.Element.pattern=function(a){this.base=f.Element.ElementBase,this.base(a),this.createPattern=function(a,b){var c=this.attribute("width").toPixels("x",!0),d=this.attribute("height").toPixels("y",!0),e=new f.Element.svg;
vendor: 7,647 bytes, line 111
111e.attributes.viewBox=new f.Property("viewBox",this.attribute("viewBox").value),e.attributes.width=new f.Property("width",c+"px"),e.attributes.height=new f.Property("height",d+"px"),e.attributes.transform=new f.Property("transform",this.attribute("patternTransform").value),e.children=this.children;var g=document.createElement("canvas");g.width=c,g.height=d;var h=g.getContext("2d");this.attribute("x").hasValue()&&this.attribute("y").hasValue()&&h.translate(this.attribute("x").toPixels("x",!0),this.attribute("y").toPixels("y",!0));for(var i=-1;i<=1;i++)for(var j=-1;j<=1;j++)h.save(),e.attributes.x=new f.Property("x",i*g.width),e.attributes.y=new f.Property("y",j*g.height),e.render(h),h.restore();var k=a.createPattern(g,"repeat");return k}},f.Element.pattern.prototype=new f.Element.ElementBase,f.Element.marker=function(a){this.base=f.Element.ElementBase,this.base(a),this.baseRender=this.render,this.render=function(a,b,c){a.translate(b.x,b.y),"auto"==this.attribute("orient").valueOrDefault("auto")&&a.rotate(c),"strokeWidth"==this.attribute("markerUnits").valueOrDefault("strokeWidth")&&a.scale(a.lineWidth,a.lineWidth),a.save();var d=new f.Element.svg;d.attributes.viewBox=new f.Property("viewBox",this.attribute("viewBox").value),d.attributes.refX=new f.Property("refX",this.attribute("refX").value),d.attributes.refY=new f.Property("refY",this.attribute("refY").value),d.attributes.width=new f.Property("width",this.attribute("markerWidth").value),d.attributes.height=new f.Property("height",this.attribute("markerHeight").value),d.attributes.fill=new f.Property("fill",this.attribute("fill").valueOrDefault("black")),d.attributes.stroke=new f.Property("stroke",this.attribute("stroke").valueOrDefault("none")),d.children=this.children,d.render(a),a.restore(),"strokeWidth"==this.attribute("markerUnits").valueOrDefault("strokeWidth")&&a.scale(1/a.lineWidth,1/a.lineWidth),"auto"==this.attribute("orient").valueOrDefault("auto")&&a.rotate(-c),a.translate(-b.x,-b.y)}},f.Element.marker.prototype=new f.Element.ElementBase,f.Element.defs=function(a){this.base=f.Element.ElementBase,this.base(a),this.render=function(a){}},f.Element.defs.prototype=new f.Element.ElementBase,f.Element.GradientBase=function(a){this.base=f.Element.ElementBase,this.base(a),this.stops=[];for(var b=0;b<this.children.length;b++){var c=this.children[b];"stop"==c.type&&this.stops.push(c)}this.getGradient=function(){},this.gradientUnits=function(){return this.attribute("gradientUnits").valueOrDefault("objectBoundingBox")},this.attributesToInherit=["gradientUnits"],this.inheritStopContainer=function(a){for(var b=0;b<this.attributesToInherit.length;b++){var c=this.attributesToInherit[b];!this.attribute(c).hasValue()&&a.attribute(c).hasValue()&&(this.attribute(c,!0).value=a.attribute(c).value)}},this.createGradient=function(a,b,c){var d=this;this.getHrefAttribute().hasValue()&&(d=this.getHrefAttribute().getDefinition(),this.inheritStopContainer(d));var e=function(a){if(c.hasValue()){var b=new f.Property("color",a);return b.addOpacity(c).value}return a},g=this.getGradient(a,b);if(null==g)return e(d.stops[d.stops.length-1].color);for(var h=0;h<d.stops.length;h++)g.addColorStop(d.stops[h].offset,e(d.stops[h].color));if(this.attribute("gradientTransform").hasValue()){var i=f.ViewPort.viewPorts[0],j=new f.Element.rect;j.attributes.x=new f.Property("x",-f.MAX_VIRTUAL_PIXELS/3),j.attributes.y=new f.Property("y",-f.MAX_VIRTUAL_PIXELS/3),j.attributes.width=new f.Property("width",f.MAX_VIRTUAL_PIXELS),j.attributes.height=new f.Property("height",f.MAX_VIRTUAL_PIXELS);var k=new f.Element.g;k.attributes.transform=new f.Property("transform",this.attribute("gradientTransform").value),k.children=[j];var l=new f.Element.svg;l.attributes.x=new f.Property("x",0),l.attributes.y=new f.Property("y",0),l.attributes.width=new f.Property("width",i.width),l.attributes.height=new f.Property("height",i.height),l.children=[k];var m=document.createElement("canvas");m.width=i.width,m.height=i.height;var n=m.getContext("2d");return n.fillStyle=g,l.render(n),n.createPattern(m,"no-repeat")}return g}},f.Element.GradientBase.prototype=new f.Element.ElementBase,f.Element.linearGradient=function(a){this.base=f.Element.GradientBase,this.base(a),this.attributesToInherit.push("x1"),this.attributesToInherit.push("y1"),this.attributesToInherit.push("x2"),this.attributesToInherit.push("y2"),this.getGradient=function(a,b){var c="objectBoundingBox"==this.gradientUnits()?b.getBoundingBox():null;this.attribute("x1").hasValue()||this.attribute("y1").hasValue()||this.attribute("x2").hasValue()||this.attribute("y2").hasValue()||(this.attribute("x1",!0).value=0,this.attribute("y1",!0).value=0,this.attribute("x2",!0).value=1,this.attribute("y2",!0).value=0);var d="objectBoundingBox"==this.gradientUnits()?c.x()+c.width()*this.attribute("x1").numValue():this.attribute("x1").toPixels("x"),e="objectBoundingBox"==this.gradientUnits()?c.y()+c.height()*this.attribute("y1").numValue():this.attribute("y1").toPixels("y"),f="objectBoundingBox"==this.gradientUnits()?c.x()+c.width()*this.attribute("x2").numValue():this.attribute("x2").toPixels("x"),g="objectBoundingBox"==this.gradientUnits()?c.y()+c.height()*this.attribute("y2").numValue():this.attribute("y2").toPixels("y");return d==f&&e==g?null:a.createLinearGradient(d,e,f,g)}},f.Element.linearGradient.prototype=new f.Element.GradientBase,f.Element.radialGradient=function(a){this.base=f.Element.GradientBase,this.base(a),this.attributesToInherit.push("cx"),this.attributesToInherit.push("cy"),this.attributesToInherit.push("r"),this.attributesToInherit.push("fx"),this.attributesToInherit.push("fy"),this.getGradient=function(a,b){var c=b.getBoundingBox();this.attribute("cx").hasValue()||(this.attribute("cx",!0).value="50%"),this.attribute("cy").hasValue()||(this.attribute("cy",!0).value="50%"),this.attribute("r").hasValue()||(this.attribute("r",!0).value="50%");var d="objectBoundingBox"==this.gradientUnits()?c.x()+c.width()*this.attribute("cx").numValue():this.attribute("cx").toPixels("x"),e="objectBoundingBox"==this.gradientUnits()?c.y()+c.height()*this.attribute("cy").numValue():this.attribute("cy").toPixels("y"),f=d,g=e;this.attribute("fx").hasValue()&&(f="objectBoundingBox"==this.gradientUnits()?c.x()+c.width()*this.attribute("fx").numValue():this.attribute("fx").toPixels("x")),this.attribute("fy").hasValue()&&(g="objectBoundingBox"==this.gradientUnits()?c.y()+c.height()*this.attribute("fy").numValue():this.attribute("fy").toPixels("y"));var h="objectBoundingBox"==this.gradientUnits()?(c.width()+c.height())/2*this.attribute("r").numValue():this.attribute("r").toPixels();return a.createRadialGradient(f,g,0,d,e,h)}},f.Element.radialGradient.prototype=new f.Element.GradientBase,f.Element.stop=function(a){this.base=f.Element.ElementBase,this.base(a),this.offset=this.attribute("offset").numValue(),this.offset<0&&(this.offset=0),this.offset>1&&(this.offset=1);var b=this.style("stop-color",!0);""===b.value&&(b.value="#000"),this.style("stop-opacity").hasValue()&&(b=b.addOpacity(this.style("stop-opacity"))),this.color=b.value},f.Element.stop.prototype=new f.Element.ElementBase,f.Element.AnimateBase=function(a){this.base=f.Element.ElementBase,this.base(a),f.Animations.push(this),this.duration=0,this.begin=this.attribute("begin").toMilliseconds(),this.maxDuration=this.begin+this.attribute("dur").toMilliseconds(),this.getProperty=function(){var a=this.attribute("attributeType").value,b=this.attribute("attributeName").value;return"CSS"==a?this.parent.style(b,!0):this.parent.attribute(b,!0)},this.initialValue=null,this.initialUnits="",this.removed=!1,this.calcValue=function(){return""}
vendor: 8,220 bytes, line 111
111,this.update=function(a){if(null==this.initialValue&&(this.initialValue=this.getProperty().value,this.initialUnits=this.getProperty().getUnits()),this.duration>this.maxDuration){if("indefinite"==this.attribute("repeatCount").value||"indefinite"==this.attribute("repeatDur").value)this.duration=0;else if("freeze"!=this.attribute("fill").valueOrDefault("remove")||this.frozen){if("remove"==this.attribute("fill").valueOrDefault("remove")&&!this.removed)return this.removed=!0,this.getProperty().value=this.parent.animationFrozen?this.parent.animationFrozenValue:this.initialValue,!0}else this.frozen=!0,this.parent.animationFrozen=!0,this.parent.animationFrozenValue=this.getProperty().value;return!1}this.duration=this.duration+a;var b=!1;if(this.begin<this.duration){var c=this.calcValue();if(this.attribute("type").hasValue()){var d=this.attribute("type").value;c=d+"("+c+")"}this.getProperty().value=c,b=!0}return b},this.from=this.attribute("from"),this.to=this.attribute("to"),this.values=this.attribute("values"),this.values.hasValue()&&(this.values.value=this.values.value.split(";")),this.progress=function(){var a={progress:(this.duration-this.begin)/(this.maxDuration-this.begin)};if(this.values.hasValue()){var b=a.progress*(this.values.value.length-1),c=Math.floor(b),d=Math.ceil(b);a.from=new f.Property("from",parseFloat(this.values.value[c])),a.to=new f.Property("to",parseFloat(this.values.value[d])),a.progress=(b-c)/(d-c)}else a.from=this.from,a.to=this.to;return a}},f.Element.AnimateBase.prototype=new f.Element.ElementBase,f.Element.animate=function(a){this.base=f.Element.AnimateBase,this.base(a),this.calcValue=function(){var a=this.progress(),b=a.from.numValue()+(a.to.numValue()-a.from.numValue())*a.progress;return b+this.initialUnits}},f.Element.animate.prototype=new f.Element.AnimateBase,f.Element.animateColor=function(b){this.base=f.Element.AnimateBase,this.base(b),this.calcValue=function(){var b=this.progress(),c=new a(b.from.value),d=new a(b.to.value);if(c.ok&&d.ok){var e=c.r+(d.r-c.r)*b.progress,f=c.g+(d.g-c.g)*b.progress,g=c.b+(d.b-c.b)*b.progress;return"rgb("+parseInt(e,10)+","+parseInt(f,10)+","+parseInt(g,10)+")"}return this.attribute("from").value}},f.Element.animateColor.prototype=new f.Element.AnimateBase,f.Element.animateTransform=function(a){this.base=f.Element.AnimateBase,this.base(a),this.calcValue=function(){for(var a=this.progress(),b=f.ToNumberArray(a.from.value),c=f.ToNumberArray(a.to.value),d="",e=0;e<b.length;e++)d+=b[e]+(c[e]-b[e])*a.progress+" ";return d}},f.Element.animateTransform.prototype=new f.Element.animate,f.Element.font=function(a){this.base=f.Element.ElementBase,this.base(a),this.horizAdvX=this.attribute("horiz-adv-x").numValue(),this.isRTL=!1,this.isArabic=!1,this.fontFace=null,this.missingGlyph=null,this.glyphs=[];for(var b=0;b<this.children.length;b++){var c=this.children[b];"font-face"==c.type?(this.fontFace=c,c.style("font-family").hasValue()&&(f.Definitions[c.style("font-family").value]=this)):"missing-glyph"==c.type?this.missingGlyph=c:"glyph"==c.type&&(""!=c.arabicForm?(this.isRTL=!0,this.isArabic=!0,"undefined"==typeof this.glyphs[c.unicode]&&(this.glyphs[c.unicode]=[]),this.glyphs[c.unicode][c.arabicForm]=c):this.glyphs[c.unicode]=c)}},f.Element.font.prototype=new f.Element.ElementBase,f.Element.fontface=function(a){this.base=f.Element.ElementBase,this.base(a),this.ascent=this.attribute("ascent").value,this.descent=this.attribute("descent").value,this.unitsPerEm=this.attribute("units-per-em").numValue()},f.Element.fontface.prototype=new f.Element.ElementBase,f.Element.missingglyph=function(a){this.base=f.Element.path,this.base(a),this.horizAdvX=0},f.Element.missingglyph.prototype=new f.Element.path,f.Element.glyph=function(a){this.base=f.Element.path,this.base(a),this.horizAdvX=this.attribute("horiz-adv-x").numValue(),this.unicode=this.attribute("unicode").value,this.arabicForm=this.attribute("arabic-form").value},f.Element.glyph.prototype=new f.Element.path,f.Element.text=function(a){this.captureTextNodes=!0,this.base=f.Element.RenderedElementBase,this.base(a),this.baseSetContext=this.setContext,this.setContext=function(a){this.baseSetContext(a);var b=this.style("dominant-baseline").toTextBaseline();null==b&&(b=this.style("alignment-baseline").toTextBaseline()),null!=b&&(a.textBaseline=b)},this.getBoundingBox=function(){var a=this.attribute("x").toPixels("x"),b=this.attribute("y").toPixels("y"),c=this.parent.style("font-size").numValueOrDefault(f.Font.Parse(f.ctx.font).fontSize);return new f.BoundingBox(a,b-c,a+Math.floor(2*c/3)*this.children[0].getText().length,b)},this.renderChildren=function(a){this.x=this.attribute("x").toPixels("x"),this.y=this.attribute("y").toPixels("y"),this.attribute("dx").hasValue()&&(this.x+=this.attribute("dx").toPixels("x")),this.attribute("dy").hasValue()&&(this.y+=this.attribute("dy").toPixels("y")),this.x+=this.getAnchorDelta(a,this,0);for(var b=0;b<this.children.length;b++)this.renderChild(a,this,this,b)},this.getAnchorDelta=function(a,b,c){var d=this.style("text-anchor").valueOrDefault("start");if("start"!=d){for(var e=0,f=c;f<b.children.length;f++){var g=b.children[f];if(f>c&&g.attribute("x").hasValue())break;e+=g.measureTextRecursive(a)}return-1*("end"==d?e:e/2)}return 0},this.renderChild=function(a,b,c,d){var e=c.children[d];e.attribute("x").hasValue()?(e.x=e.attribute("x").toPixels("x")+b.getAnchorDelta(a,c,d),e.attribute("dx").hasValue()&&(e.x+=e.attribute("dx").toPixels("x"))):(e.attribute("dx").hasValue()&&(b.x+=e.attribute("dx").toPixels("x")),e.x=b.x),b.x=e.x+e.measureText(a),e.attribute("y").hasValue()?(e.y=e.attribute("y").toPixels("y"),e.attribute("dy").hasValue()&&(e.y+=e.attribute("dy").toPixels("y"))):(e.attribute("dy").hasValue()&&(b.y+=e.attribute("dy").toPixels("y")),e.y=b.y),b.y=e.y,e.render(a);for(var d=0;d<e.children.length;d++)b.renderChild(a,b,e,d)}},f.Element.text.prototype=new f.Element.RenderedElementBase,f.Element.TextElementBase=function(a){this.base=f.Element.RenderedElementBase,this.base(a),this.getGlyph=function(a,b,c){var d=b[c],e=null;if(a.isArabic){var f="isolated";(0==c||" "==b[c-1])&&c<b.length-2&&" "!=b[c+1]&&(f="terminal"),c>0&&" "!=b[c-1]&&c<b.length-2&&" "!=b[c+1]&&(f="medial"),c>0&&" "!=b[c-1]&&(c==b.length-1||" "==b[c+1])&&(f="initial"),"undefined"!=typeof a.glyphs[d]&&(e=a.glyphs[d][f],null==e&&"glyph"==a.glyphs[d].type&&(e=a.glyphs[d]))}else e=a.glyphs[d];return null==e&&(e=a.missingGlyph),e},this.renderChildren=function(a){var b=this.parent.style("font-family").getDefinition();if(null==b)""!=a.fillStyle&&a.fillText(f.compressSpaces(this.getText()),this.x,this.y),""!=a.strokeStyle&&a.strokeText(f.compressSpaces(this.getText()),this.x,this.y);else{var c=this.parent.style("font-size").numValueOrDefault(f.Font.Parse(f.ctx.font).fontSize),d=this.parent.style("font-style").valueOrDefault(f.Font.Parse(f.ctx.font).fontStyle),e=this.getText();b.isRTL&&(e=e.split("").reverse().join(""));for(var g=f.ToNumberArray(this.parent.attribute("dx").value),h=0;h<e.length;h++){var i=this.getGlyph(b,e,h),j=c/b.fontFace.unitsPerEm;a.translate(this.x,this.y),a.scale(j,-j);var k=a.lineWidth;a.lineWidth=a.lineWidth*b.fontFace.unitsPerEm/c,"italic"==d&&a.transform(1,0,.4,1,0,0),i.render(a),"italic"==d&&a.transform(1,0,-.4,1,0,0),a.lineWidth=k,a.scale(1/j,-1/j),a.translate(-this.x,-this.y),this.x+=c*(i.horizAdvX||b.horizAdvX)/b.fontFace.unitsPerEm,"undefined"==typeof g[h]||isNaN(g[h])||(this.x+=g[h])}}},this.getText=function(){},this.measureTextRecursive=function(a){for(var b=this.measureText(a),c=0;c<this.children.length;c++)b+=this.children[c].measureTextRecursive(a);return b},this.measureText=function(a){var b=this.parent.style("font-family").getDefinition();if(null!=b){var c=this.parent.style("font-size").numValueOrDefault(f.Font.Parse(f.ctx.font).fontSize),d=0,e=this.getText();b.isRTL&&(e=e.split("").reverse().join(""));for(var g=f.ToNumberArray(this.parent.attribute("dx").value),h=0;h<e.length;h++){var i=this.getGlyph(b,e,h);d+=(i.horizAdvX||b.horizAdvX)*c/b.fontFace.unitsPerEm,"undefined"==typeof g[h]||isNaN(g[h])||(d+=g[h])}return d}var j=f.compressSpaces(this.getText());if(!a.measureText)return 10*j.length;a.save(),this.setContext(a);var k=a.measureText(j).width;
vendor: 4,660 bytes, line 111
111return a.restore(),k}},f.Element.TextElementBase.prototype=new f.Element.RenderedElementBase,f.Element.tspan=function(a){this.captureTextNodes=!0,this.base=f.Element.TextElementBase,this.base(a),this.text=f.compressSpaces(a.value||a.text||a.textContent||""),this.getText=function(){return this.children.length>0?"":this.text}},f.Element.tspan.prototype=new f.Element.TextElementBase,f.Element.tref=function(a){this.base=f.Element.TextElementBase,this.base(a),this.getText=function(){var a=this.getHrefAttribute().getDefinition();if(null!=a)return a.children[0].getText()}},f.Element.tref.prototype=new f.Element.TextElementBase,f.Element.a=function(a){this.base=f.Element.TextElementBase,this.base(a),this.hasText=a.childNodes.length>0;for(var b=0;b<a.childNodes.length;b++)3!=a.childNodes[b].nodeType&&(this.hasText=!1);this.text=this.hasText?a.childNodes[0].value:"",this.getText=function(){return this.text},this.baseRenderChildren=this.renderChildren,this.renderChildren=function(a){if(this.hasText){this.baseRenderChildren(a);var b=new f.Property("fontSize",f.Font.Parse(f.ctx.font).fontSize);f.Mouse.checkBoundingBox(this,new f.BoundingBox(this.x,this.y-b.toPixels("y"),this.x+this.measureText(a),this.y))}else if(this.children.length>0){var c=new f.Element.g;c.children=this.children,c.parent=this,c.render(a)}},this.onclick=function(){window.open(this.getHrefAttribute().value)},this.onmousemove=function(){f.ctx.canvas.style.cursor="pointer"}},f.Element.a.prototype=new f.Element.TextElementBase,f.Element.image=function(a){this.base=f.Element.RenderedElementBase,this.base(a);var b=this.getHrefAttribute().value;if(""!=b){var c=b.match(/\.svg$/);if(f.Images.push(this),this.loaded=!1,c)this.img=f.ajax(b),this.loaded=!0;else{this.img=document.createElement("img"),1==f.opts.useCORS&&(this.img.crossOrigin="Anonymous");var d=this;this.img.onload=function(){d.loaded=!0},this.img.onerror=function(){f.log('ERROR: image "'+b+'" not found'),d.loaded=!0},this.img.src=b}this.renderChildren=function(a){var b=this.attribute("x").toPixels("x"),d=this.attribute("y").toPixels("y"),e=this.attribute("width").toPixels("x"),g=this.attribute("height").toPixels("y");0!=e&&0!=g&&(a.save(),c?a.drawSvg(this.img,b,d,e,g):(a.translate(b,d),f.AspectRatio(a,this.attribute("preserveAspectRatio").value,e,this.img.width,g,this.img.height,0,0),a.drawImage(this.img,0,0)),a.restore())},this.getBoundingBox=function(){var a=this.attribute("x").toPixels("x"),b=this.attribute("y").toPixels("y"),c=this.attribute("width").toPixels("x"),d=this.attribute("height").toPixels("y");return new f.BoundingBox(a,b,a+c,b+d)}}},f.Element.image.prototype=new f.Element.RenderedElementBase,f.Element.g=function(a){this.base=f.Element.RenderedElementBase,this.base(a),this.getBoundingBox=function(){for(var a=new f.BoundingBox,b=0;b<this.children.length;b++)a.addBoundingBox(this.children[b].getBoundingBox());return a}},f.Element.g.prototype=new f.Element.RenderedElementBase,f.Element.symbol=function(a){this.base=f.Element.RenderedElementBase,this.base(a),this.render=function(a){}},f.Element.symbol.prototype=new f.Element.RenderedElementBase,f.Element.style=function(a){this.base=f.Element.ElementBase,this.base(a);for(var b="",d=0;d<a.childNodes.length;d++)b+=a.childNodes[d].data;b=b.replace(/(\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,""),b=f.compressSpaces(b);for(var e=b.split("}"),d=0;d<e.length;d++)if(""!=f.trim(e[d]))for(var g=e[d].split("{"),h=g[0].split(","),i=g[1].split(";"),j=0;j<h.length;j++){var k=f.trim(h[j]);if(""!=k){for(var l=f.Styles[k]||{},m=0;m<i.length;m++){var n=i[m].indexOf(":"),o=i[m].substr(0,n),p=i[m].substr(n+1,i[m].length-n);null!=o&&null!=p&&(l[f.trim(o)]=new f.Property(f.trim(o),f.trim(p)))}if(f.Styles[k]=l,f.StylesSpecificity[k]=c(k),"@font-face"==k)for(var q=l["font-family"].value.replace(/"/g,""),r=l.src.value.split(","),s=0;s<r.length;s++)if(r[s].indexOf('format("svg")')>0)for(var t=r[s].indexOf("url"),u=r[s].indexOf(")",t),v=r[s].substr(t+5,u-t-6),w=f.parseXml(f.ajax(v)),x=w.getElementsByTagName("font"),y=0;y<x.length;y++){var z=f.CreateElement(x[y]);f.Definitions[q]=z}}}},f.Element.style.prototype=new f.Element.ElementBase,f.Element.use=function(a){this.base=f.Element.RenderedElementBase,this.base(a),this.baseSetContext=this.setContext,this.setContext=function(a){this.baseSetContext(a),this.attribute("x").hasValue()&&a.translate(this.attribute("x").toPixels("x"),0),this.attribute("y").hasValue()&&a.translate(0,this.attribute("y").toPixels("y"))};var b=this.getHrefAttribute().getDefinition();this.path=function(a){null!=b&&b.path(a)},this.getBoundingBox=function(){if(null!=b)return b.getBoundingBox()}
111,this.renderChildren=function(a){if(null!=b){var c=b;"symbol"==b.type&&(c=new f.Element.svg,c.type="svg",c.attributes.viewBox=new f.Property("viewBox",b.attribute("viewBox").value),c.attributes.preserveAspectRatio=new f.Property("preserveAspectRatio",b.attribute("preserveAspectRatio").value),c.attributes.overflow=new f.Property("overflow",b.attribute("overflow").value),c.children=b.children),"svg"==c.type&&(this.attribute("width").hasValue()&&(c.attributes.width=new f.Property("width",this.attribute("width").value)),this.attribute("height").hasValue()&&(c.attributes.height=new f.Property("height",this.attribute("height").value)));var d=c.parent;c.parent=null,c.render(a),c.parent=d}}},f.Element.use.prototype=new f.Element.RenderedElementBase,f.Element.mask=function(a){this.base=f.Element.ElementBase,this.base(a),this.apply=function(a,b){var c=this.attribute("x").toPixels("x"),d=this.attribute("y").toPixels("y"),e=this.attribute("width").toPixels("x"),g=this.attribute("height").toPixels("y");if(0==e&&0==g){for(var h=new f.BoundingBox,i=0;i<this.children.length;i++)h.addBoundingBox(this.children[i].getBoundingBox());var c=Math.floor(h.x1),d=Math.floor(h.y1),e=Math.floor(h.width()),g=Math.floor(h.height())}var j=b.attribute("mask").value;b.attribute("mask").value="";var k=document.createElement("canvas");k.width=c+e,k.height=d+g;var l=k.getContext("2d");this.renderChildren(l);var m=document.createElement("canvas");m.width=c+e,m.height=d+g;var n=m.getContext("2d");b.render(n),n.globalCompositeOperation="destination-in",n.fillStyle=l.createPattern(k,"no-repeat"),n.fillRect(0,0,c+e,d+g),a.fillStyle=n.createPattern(m,"no-repeat"),a.fillRect(0,0,c+e,d+g),b.attribute("mask").value=j},this.render=function(a){}},f.Element.mask.prototype=new f.Element.ElementBase,f.Element.clipPath=function(a){this.base=f.Element.ElementBase,this.base(a),this.apply=function(a){var b=CanvasRenderingContext2D.prototype.beginPath;
112CanvasRenderingContext2D.prototype.beginPath=function(){};var c=CanvasRenderingContext2D.prototype.closePath;CanvasRenderingContext2D.prototype.closePath=function(){},b.call(a);for(var d=0;d<this.children.length;d++){var e=this.children[d];if("undefined"!=typeof e.path){var g=null;e.style("transform",!1,!0).hasValue()&&(g=new f.Transform(e.style("transform",!1,!0).value),g.apply(a)),e.path(a),CanvasRenderingContext2D.prototype.closePath=c,g&&g.unapply(a)}}c.call(a),a.clip(),CanvasRenderingContext2D.prototype.beginPath=b,CanvasRenderingContext2D.prototype.closePath=c},this.render=function(a){}},f.Element.clipPath.prototype=new f.Element.ElementBase,f.Element.filter=function(a){this.base=f.Element.ElementBase,this.base(a),this.apply=function(a,b){var c=b.getBoundingBox(),d=Math.floor(c.x1),e=Math.floor(c.y1),f=Math.floor(c.width()),g=Math.floor(c.height()),h=b.style("filter").value;b.style("filter").value="";for(var i=0,j=0,k=0;k<this.children.length;k++){var l=this.children[k].extraFilterDistance||0;i=Math.max(i,l),j=Math.max(j,l)}var m=document.createElement("canvas");m.width=f+2*i,m.height=g+2*j;var n=m.getContext("2d");n.translate(-d+i,-e+j),b.render(n);for(var k=0;k<this.children.length;k++)"function"==typeof this.children[k].apply&&this.children[k].apply(n,0,0,f+2*i,g+2*j);a.drawImage(m,0,0,f+2*i,g+2*j,d-i,e-j,f+2*i,g+2*j),b.style("filter",!0).value=h},this.render=function(a){}},f.Element.filter.prototype=new f.Element.ElementBase,f.Element.feDropShadow=function(a){this.base=f.Element.ElementBase,this.base(a),this.addStylesFromStyleDefinition(),this.apply=function(a,b,c,d,e){}},f.Element.feDropShadow.prototype=new f.Element.ElementBase,f.Element.feMorphology=function(a){this.base=f.Element.ElementBase,this.base(a),this.apply=function(a,b,c,d,e){}},f.Element.feMorphology.prototype=new f.Element.ElementBase,f.Element.feComposite=function(a){this.base=f.Element.ElementBase,this.base(a),this.apply=function(a,b,c,d,e){}},f.Element.feComposite.prototype=new f.Element.ElementBase,f.Element.feColorMatrix=function(a){function b(a,b,c,d,e,f){return a[c*d*4+4*b+f]}function c(a,b,c,d,e,f,g){a[c*d*4+4*b+f]=g}function d(a,b){var c=e[a];return c*(c<0?b-255:b)}this.base=f.Element.ElementBase,this.base(a);var e=f.ToNumberArray(this.attribute("values").value);switch(this.attribute("type").valueOrDefault("matrix")){case"saturate":var g=e[0];e=[.213+.787*g,.715-.715*g,.072-.072*g,0,0,.213-.213*g,.715+.285*g,.072-.072*g,0,0,.213-.213*g,.715-.715*g,.072+.928*g,0,0,0,0,0,1,0,0,0,0,0,1];break;case"hueRotate":var h=e[0]*Math.PI/180,i=function(a,b,c){return a+Math.cos(h)*b+Math.sin(h)*c};e=[i(.213,.787,-.213),i(.715,-.715,-.715),i(.072,-.072,.928),0,0,i(.213,-.213,.143),i(.715,.285,.14),i(.072,-.072,-.283),0,0,i(.213,-.213,-.787),i(.715,-.715,.715),i(.072,.928,.072),0,0,0,0,0,1,0,0,0,0,0,1];break;case"luminanceToAlpha":e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,.2125,.7154,.0721,0,0,0,0,0,0,1]}this.apply=function(a,e,f,g,h){for(var i=a.getImageData(0,0,g,h),f=0;f<h;f++)for(var e=0;e<g;e++){var j=b(i.data,e,f,g,h,0),k=b(i.data,e,f,g,h,1),l=b(i.data,e,f,g,h,2),m=b(i.data,e,f,g,h,3);c(i.data,e,f,g,h,0,d(0,j)+d(1,k)+d(2,l)+d(3,m)+d(4,1)),c(i.data,e,f,g,h,1,d(5,j)+d(6,k)+d(7,l)+d(8,m)+d(9,1)),c(i.data,e,f,g,h,2,d(10,j)+d(11,k)+d(12,l)+d(13,m)+d(14,1)),c(i.data,e,f,g,h,3,d(15,j)+d(16,k)+d(17,l)+d(18,m)+d(19,1))}a.clearRect(0,0,g,h),a.putImageData(i,0,0)}},f.Element.feColorMatrix.prototype=new f.Element.ElementBase,f.Element.feGaussianBlur=function(a){this.base=f.Element.ElementBase,this.base(a),this.blurRadius=Math.floor(this.attribute("stdDeviation").numValue()),this.extraFilterDistance=this.blurRadius,this.apply=function(a,c,d,e,g){return"undefined"==typeof b.canvasRGBA?void f.log("ERROR: StackBlur.js must be included for blur to work"):(a.canvas.id=f.UniqueId(),a.canvas.style.display="none",document.body.appendChild(a.canvas),b.canvasRGBA(a.canvas.id,c,d,e,g,this.blurRadius),void document.body.removeChild(a.canvas))}},f.Element.feGaussianBlur.prototype=new f.Element.ElementBase,f.Element.title=function(a){},f.Element.title.prototype=new f.Element.ElementBase,f.Element.desc=function(a){},f.Element.desc.prototype=new f.Element.ElementBase,f.Element.MISSING=function(a){f.log("ERROR: Element '"+a.nodeName+"' not yet implemented.")},f.Element.MISSING.prototype=new f.Element.ElementBase,f.CreateElement=function(a){var b=a.nodeName.replace(/^[^:]+:/,"");b=b.replace(/\-/g,"");var c=null;return c="undefined"!=typeof f.Element[b]?new f.Element[b](a):new f.Element.MISSING(a),c.type=a.nodeName,c},f.load=function(a,b){f.loadXml(a,f.ajax(b))},f.loadXml=function(a,b){f.loadXmlDoc(a,f.parseXml(b))},f.loadXmlDoc=function(a,b){f.init(a);var c=function(b){for(var c=a.canvas;c;)b.x-=c.offsetLeft,b.y-=c.offsetTop,c=c.offsetParent;
112return window.scrollX&&(b.x+=window.scrollX),window.scrollY&&(b.y+=window.scrollY),b};1!=f.opts.ignoreMouse&&(a.canvas.onclick=function(a){var b=c(new f.Point(null!=a?a.clientX:event.clientX,null!=a?a.clientY:event.clientY));f.Mouse.onclick(b.x,b.y)},a.canvas.onmousemove=function(a){var b=c(new f.Point(null!=a?a.clientX:event.clientX,null!=a?a.clientY:event.clientY));f.Mouse.onmousemove(b.x,b.y)});var d=f.CreateElement(b.documentElement);d.root=!0,d.addStylesFromStyleDefinition();var e=!0,g=function(){f.ViewPort.Clear(),a.canvas.parentNode&&f.ViewPort.SetCurrent(a.canvas.parentNode.clientWidth,a.canvas.parentNode.clientHeight),1!=f.opts.ignoreDimensions&&(d.style("width").hasValue()&&(a.canvas.width=d.style("width").toPixels("x"),a.canvas.style.width=a.canvas.width+"px"),d.style("height").hasValue()&&(a.canvas.height=d.style("height").toPixels("y"),a.canvas.style.height=a.canvas.height+"px"));var c=a.canvas.clientWidth||a.canvas.width,g=a.canvas.clientHeight||a.canvas.height;if(1==f.opts.ignoreDimensions&&d.style("width").hasValue()&&d.style("height").hasValue()&&(c=d.style("width").toPixels("x"),g=d.style("height").toPixels("y")),f.ViewPort.SetCurrent(c,g),null!=f.opts.offsetX&&(d.attribute("x",!0).value=f.opts.offsetX),null!=f.opts.offsetY&&(d.attribute("y",!0).value=f.opts.offsetY),null!=f.opts.scaleWidth||null!=f.opts.scaleHeight){var h=null,i=null,j=f.ToNumberArray(d.attribute("viewBox").value);null!=f.opts.scaleWidth&&(d.attribute("width").hasValue()?h=d.attribute("width").toPixels("x")/f.opts.scaleWidth:isNaN(j[2])||(h=j[2]/f.opts.scaleWidth)),null!=f.opts.scaleHeight&&(d.attribute("height").hasValue()?i=d.attribute("height").toPixels("y")/f.opts.scaleHeight:isNaN(j[3])||(i=j[3]/f.opts.scaleHeight)),null==h&&(h=i),null==i&&(i=h),d.attribute("width",!0).value=f.opts.scaleWidth,d.attribute("height",!0).value=f.opts.scaleHeight,d.style("transform",!0,!0).value+=" scale("+1/h+","+1/i+")"}1!=f.opts.ignoreClear&&a.clearRect(0,0,c,g),d.render(a),e&&(e=!1,"function"==typeof f.opts.renderCallback&&f.opts.renderCallback(b))},h=!0;f.ImagesLoaded()&&(h=!1,g()),f.intervalID=setInterval(function(){var a=!1;if(h&&f.ImagesLoaded()&&(h=!1,a=!0),1!=f.opts.ignoreMouse&&(a|=f.Mouse.hasEvents()),1!=f.opts.ignoreAnimation)for(var b=0;b<f.Animations.length;b++)a|=f.Animations[b].update(1e3/f.FRAMERATE);"function"==typeof f.opts.forceRedraw&&1==f.opts.forceRedraw()&&(a=!0),a&&(g(),f.Mouse.runEvents())},1e3/f.FRAMERATE)},f.stop=function(){f.intervalID&&clearInterval(f.intervalID)},f.Mouse=new function(){this.events=[],this.hasEvents=function(){return 0!=this.events.length},this.onclick=function(a,b){this.events.push({type:"onclick",x:a,y:b,run:function(a){a.onclick&&a.onclick()}})},this.onmousemove=function(a,b){this.events.push({type:"onmousemove",x:a,y:b,run:function(a){a.onmousemove&&a.onmousemove()}})},this.eventElements=[],this.checkPath=function(a,b){for(var c=0;c<this.events.length;c++){var d=this.events[c];b.isPointInPath&&b.isPointInPath(d.x,d.y)&&(this.eventElements[c]=a)}},this.checkBoundingBox=function(a,b){for(var c=0;c<this.events.length;c++){var d=this.events[c];b.isPointInBox(d.x,d.y)&&(this.eventElements[c]=a)}},this.runEvents=function(){f.ctx.canvas.style.cursor="";for(var a=0;a<this.events.length;a++)for(var b=this.events[a],c=this.eventElements[a];c;)b.run(c),c=c.parent;this.events=[],this.eventElements=[]}},f}if("undefined"!=typeof Element){var e,f=function(a,b,c){if(null!=a||null!=b||null!=c){"string"==typeof a&&(a=document.getElementById(a)),null!=a.svg&&a.svg.stop();var e=d(c||{});1==a.childNodes.length&&"OBJECT"==a.childNodes[0].nodeName||(a.svg=e);var g=a.getContext("2d");"undefined"!=typeof b.documentElement?e.loadXmlDoc(g,b):"<"==b.substr(0,1)?e.loadXml(g,b):e.load(g,b)}else for(var h=document.querySelectorAll("svg"),i=0;i<h.length;i++){var j=h[i],k=document.createElement("canvas");k.width=j.clientWidth,k.height=j.clientHeight,j.parentNode.insertBefore(k,j),j.parentNode.removeChild(j);var l=document.createElement("div");l.appendChild(j),f(k,l.innerHTML)}};"undefined"!=typeof Element.prototype.matches?e=function(a,b){return a.matches(b)}:"undefined"!=typeof Element.prototype.webkitMatchesSelector?e=function(a,b){return a.webkitMatchesSelector(b)}:"undefined"!=typeof Element.prototype.mozMatchesSelector?e=function(a,b){return a.mozMatchesSelector(b)}:"undefined"!=typeof Element.prototype.msMatchesSelector?e=function(a,b){return a.msMatchesSelector(b)}:"undefined"!=typeof Element.prototype.oMatchesSelector?e=function(a,b){return a.oMatchesSelector(b)}:("function"!=typeof jQuery&&"function"!=typeof Zepto||(e=function(a,b){return $(a).is(b)}),"undefined"==typeof e&&(e=Sizzle.matchesSelector));var g=/(\[[^\]]+\])/g,h=/(#[^\s\+>~\.\[:]+)/g,j=/(\.[^\s\+>~\.\[:]+)/g,k=/(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/gi,l=/(:[\w-]+\([^\)]*\))/gi,m=/(:[^\s\+>~\.\[:]+)/g,n=/([^\s\+>~\.\[:]+)/g;return"undefined"!=typeof CanvasRenderingContext2D&&(CanvasRenderingContext2D.prototype.drawSvg=function(a,b,c,d,e,g){var h={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:b,offsetY:c,scaleWidth:d,scaleHeight:e};for(var i in g)g.hasOwnProperty(i)&&(h[i]=g[i]);f(this.canvas,a,h)}),f}}),function(a){"use strict";function b(a,b){var c=document.createElement("canvas");c.width=a,c.height=b;var d=a-1,e=b-1,f=c.getContext("2d");try{f.fillStyle="rgb(1,1,1)",f.fillRect(d,e,1,1);var g=f.getImageData(d,e,1,1).data;if(1!==g[0]||1!==g[1]||1!==g[2])return!1}catch(h){return!1}return!0}function c(a,b){var c=f(b),d=g.rect({x:-c.left,y:-c.top,width:c.left+c.right,height:c.top+c.bottom});if(b.width&&b.height){var e=a.width+c.left+c.right,h=a.height+c.top+c.bottom;d.scale(e/b.width,h/b.height)}return g.Rect(a).moveAndExpand(d)}function d(a){var b=1;if(void 0!==a&&(b=parseFloat(a),!Number.isFinite(b)||0===b))throw new Error("dia.Paper: invalid raster size ("+
112a+")");return b}function e(a,b){return{width:Math.max(Math.round(a.width*b),1),height:Math.max(Math.round(a.height*b),1)}}function f(b){var c=a.util.normalizeSides(b.padding);return b.width&&b.height&&(c.left+c.right>=b.width&&(c.left=c.right=0),c.top+c.bottom>=b.height&&(c.top=c.bottom=0)),c}function h(a){return a.replace(/<image[^>]*>/g,function(a){var b=a.match(/href="([^"]*)"/),c=b&&b[1],d="data:image/svg+xml";if(c&&c.substr(0,d.length)===d){var e=atob(c.substr(c.indexOf(",")+1));return e.substr(e.indexOf("<svg"))}return a})}a.dia.Paper.prototype.toDataURL=function(f,g){if("function"!=typeof this.toSVG)throw new Error("The joint.format.svg.js plugin must be loaded.");g=g||{};var i=g.area||this.paperToLocalRect(this.getContentBBox()),j=c(i,g),k=a.util.isNumber(g.width)&&a.util.isNumber(g.height)?g:j,l=e(k,d(g.size));if(!b(l.width,l.height))throw new Error("dia.Paper: raster size exceeded.");var m,n=new Image;n.onload=function(){function b(){j=document.createElement("canvas"),j.width=l.width,j.height=l.height,i=j.getContext("2d"),i.fillStyle=g.backgroundColor||"white",i.fillRect(0,0,l.width,l.height)}function c(){e=j.toDataURL(g.type,g.quality),f(e),d()}function d(){j.svg&&a.util.isFunction(j.svg.stop)&&setTimeout(j.svg.stop,1)}var e,i,j;b();try{i.drawImage(n,0,0,l.width,l.height),c()}catch(k){if("undefined"==typeof canvg)return void console.error("Canvas tainted. Canvg library required.");b();var o={ignoreDimensions:!0,ignoreClear:!0,ignoreMouse:!0,ignoreAnimation:!0,offsetX:0,offsetY:0,useCORS:!0};canvg(j,m,a.util.assign(o,{forceRedraw:function(){return!this.called&&(this.called=!0,!0)}.bind({called:!1}),renderCallback:function(){try{c()}catch(e){d(),m=h(m),b(),canvg(j,m,a.util.assign(o,{renderCallback:c}))}}}))}},this.toSVG(function(a){m=a,n.src="data:image/svg+xml,"+encodeURIComponent(a)},{convertImagesToDataUris:!0,area:j,useComputedStyles:g.useComputedStyles,stylesheet:g.stylesheet,preserveDimensions:{width:l.width,height:l.height}})},a.dia.Paper.prototype.toPNG=function(a,b){b=b||{},b.type="image/png",this.toDataURL(a,b)},a.dia.Paper.prototype.toJPEG=function(a,b){b=b||{},b.type="image/jpeg",this.toDataURL(a,b)},a.dia.Paper.prototype.openAsPNG=function(b){var c="menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes",d=a.util.uniqueId("png_output");this.toPNG(function(a){var b=window.open("",d,c);
112b.document.write('<img src="'+a+'"/>')},a.util.assign({padding:10},b))}}(joint);
113!function(a,b,c){var d=200,e=200;c.dia.Paper.prototype.print=function(b){var c,d=j(b),e=m.call(this,d),f=[],g=a(document.body);if(d.poster)for(var h=o(e,d.poster),i=n(e,h),k=0;k<i.length;k++)c=this.preparePrintArea(i[k],d),f.push(c.$el);else c=this.preparePrintArea(e,d),f.push(c.$el);c&&l(c.css,d),d.ready(f,function(c){if(c){g.addClass("joint-print");var d=this.$el.children().detach();c.forEach(function(a){a.removeClass("preview").addClass("print-ready"),a.prependTo(document.body)});var e=!1,f=function(){e||(e=!0,g.removeClass("joint-print"),c.forEach(function(a){a.remove()}),this.$el.append(d),this.trigger("afterprint",b),a(window).off("afterprint",f))}.bind(this);a(window).one("afterprint",f),setTimeout(f,200),window.print()}}.bind(this))},c.dia.Paper.prototype.preparePrintArea=function(c,d){this.trigger("beforeprint",d);var e=a("<div/>").addClass("printarea");d.size&&e.addClass("printarea-size-"+d.size);var f=this.scale();this.scale(1);var g=this.$el.clone().appendTo(e),h=i(this.getArea(),c,d),j=h.rect,k=h.scaleToFit;g.css({left:0,top:0,width:"200%",height:"200%"}),b(g.find("svg")[0]).attr({width:j.width,height:j.height,viewBox:[j.x,j.y,j.width,j.height].join(" ")});var l=this.options.gridSize;if(l>1){var m=e.find(".joint-paper-grid");m.css({transform:["translate(",-j.x%l,"px, ",-j.y%l,"px)"].join("")})}return this.scale(f.sx,f.sy),e.addClass("preview"),{$el:e,css:{width:j.width+"px",height:j.height+"px",transform:"scale("+k+")","transform-origin":"0 0"}}};var f=function(a){return Object.keys(a).map(function(b){return b+":"+a[b]}).join(";")+";"},h=function(a,b){var c=p.toPx(b.left+b.right,b.unit),d=p.toPx(b.top+b.bottom,b.unit);return{width:Math.max(p.toPx(a.width,a.unit)-c,1),height:Math.max(p.toPx(a.height,a.unit)-d,1)}},i=function(a,b,d){var e=g.Rect({x:b.x-a.x,y:b.y-a.y,width:b.width,height:b.height}),f=c.util.normalizeSides(d.margin),i=d.sheet;f.unit=d.marginUnit,i.unit=d.sheetUnit;var j,k=h(i,f),l=e.width/e.height,m=k.width/k.height;return j=l>m?k.width/e.width:k.height/e.height,{rect:e,scaleToFit:j}},j=function(a){var b=c.util.defaultsDeep({},a,{area:null,poster:!1,sheet:{width:210,height:297},sheetUnit:"mm",ready:function(a,b){b(a)},margin:.4,marginUnit:"in",padding:5});return b.area||(b.printingAll=!0),b},k=function(b){var c=a("#print-styles"),d='<style type="text/css" id="print-styles">'+b+"</style>";c.length?c.html(b):a("head").append(d)},l=function(a,b){var d=f(a),e=c.util.normalizeSides(b.margin),g=b.marginUnit,h=[e.top+g,e.right+g,e.bottom+g,e.left+g].join(" "),i=b.sheet.width>b.sheet.height?"landscape":"portrait",j=["@media print {",".printarea.print-ready {",d,"}","@page {","margin:"+h+";","size:"+i+";","}","}",".printarea.preview {",d,"}"];k(j.join(""))},m=function(a){var b=a.area;if(!b){var d=c.util.normalizeSides(a.padding);b=this.getContentArea().moveAndExpand({x:-d.left,y:-d.top,width:d.left+d.right,height:d.top+d.bottom})}return b},n=function(a,b){for(var c,f=b.width,h=b.height,i=[],j=0,k=0,l=0,m=0;j<a.height;){for(;k<a.width&&(c=g.Rect(a.x+k,a.y+j,f,h),i.push(c),k+=f,!(m>e));)m++;if(k=0,m=0,j+=h,l>d)break;l++}return i.reverse()},o=function(a,b){var c={width:b.width,height:b.height};return c.width||(c.width=Math.ceil(a.width/(b.columns||1))),c.height||(c.height=Math.ceil(a.height/(b.rows||1))),c},p={supportedUnits:{px:function(a){return a},mm:function(a){return this.millimeterSize*a},cm:function(a){return this.millimeterSize*a*10},"in":function(a){return this.millimeterSize*a*25.4},pt:function(a){return this.millimeterSize*(25.4*a/72)},pc:function(a){return this.millimeterSize*(25.4*a/6)}},measureMillimeter:function(){var b=a("<div/>").css({display:"inline-block",position:"absolute",left:-5e3,width:"1mm",height:"1mm"}).appendTo(document.body),c=b.width();return b.remove(),c},toPx:function(a,b){if(this.millimeterSize||(this.millimeterSize=this.measureMillimeter()),b=(b||"").toLowerCase(),!this.supportedUnits[b])throw new Error("Unsupportted unit "+b);return this.supportedUnits[b].call(this,a)}}}($,V,joint);
114if("object"==typeof exports)var WebSocketServer=require("ws").Server,WebSocket=require("ws"),url=require("url");WebSocket=WebSocket||"undefined"!=typeof window&&window.WebSocket,joint.com=joint.com||{},joint.com.Channel=function(a){if(this.options=a,!this.options||!this.options.graph)throw new Error("Channel: missing a graph.");this.options.ttl=this.options.ttl||60,this.options.healthCheckInterval=this.options.healthCheckInterval||36e5,this.options.reconnectInterval=this.options.reconnectInterval||1e4,this.options.serverShouldSendGraph=void 0===this.options.serverShouldSendGraph||this.options.serverShouldSendGraph,this._isClient=!!this.options.url,this._clients=[],this.messageQueue=[],this.id=this.options.id||(this._isClient?"c_":"s_")+joint.util.uuid(),this.state={},this.state[this.id]=0,this.sites={},this.sites[this.id]={socket:void 0,outgoing:[],ttl:this.options.ttl},this.initialize()},joint.util.assign(joint.com.Channel.prototype,Backbone.Events),joint.com.Channel.prototype.initialize=function(){this.options.graph.on("all",this.onGraphChange.bind(this)),this._isClient?this.connectClient():this.options.port&&(this.server=new WebSocketServer({port:this.options.port}),this.server.on("connection",this.onConnection.bind(this))),this._isClient||(this._healthCheckInterval=setInterval(this.healthCheck.bind(this),this.options.healthCheckInterval))},joint.com.Channel.prototype.connectClient=function(){var a=this.options.url+"/?channelId="+this.id+"&state="+JSON.stringify(this.state)+(this.options.query?"&query="+JSON.stringify(this.options.query):"");this.options.debugLevel>0&&this.log("connectClient",a);var b=new WebSocket(a);b.onopen=this.onConnection.bind(this,b),b.onclose=this.onClose.bind(this,b)},joint.com.Channel.prototype.close=function(){this._reconnectTimeout&&clearTimeout(this._reconnectTimeout),this._healthCheckInterval&&clearInterval(this._healthCheckInterval),this._closed=!0,joint.util.forIn(this.sites,function(a){a.socket&&a.socket.close()}),this.server&&this.server.close()},joint.com.Channel.prototype.healthCheck=function(){if(this.options.debugLevel>0){var a=Object.keys(this.sites).reduce(function(a,b){return a[b]=this[b].ttl,a}.bind(this.sites),{});this.log("healthCheck",a)}joint.util.forIn(this.sites,function(a,b){b!==this.id&&(a.socket&&1===a.socket.readyState?a.ttl=this.options.ttl:a.ttl-=1,a.ttl<=0&&(this.sites=joint.util.omit(this.sites,b),this.state=joint.util.omit(this.state,b)))}.bind(this))},joint.com.Channel.prototype.onConnection=function(a){if(this._clients.push(a),this.trigger("open",a),this._isClient)this.sites[this.id].socket=a,a.onmessage=function(b){this.onMessage(a,b.data)}.bind(this);else{var b=url.parse(a.upgradeReq.url,!0),c=b.query.channelId;if(this.sites[c])this.sites[c].socket=a;else if(this.debugLevel>1&&this.log("new_site",c),this.sites[c]={socket:a,outgoing:[],ttl:this.options.ttl},this.state[c]=0,this.options.serverShouldSendGraph){var d={channelId:this.id,state:JSON.parse(JSON.stringify(this.state)),action:"graph",graph:this.options.graph.toJSON()};this.messageQueue.push({type:"op",data:d,source:this.id,target:[c]}),this.send()}a.on("message",this.onMessage.bind(this,a)),a.on("close",this.onClose.bind(this,a))}},joint.com.Channel.prototype.onClose=function(a){var b=this._clients.indexOf(a);b!==-1&&this._clients.splice(b,1),this._isClient&&!this._closed&&(this._reconnectTimeout&&clearTimeout(this._reconnectTimeout),this._reconnectTimeout=setTimeout(this.connectClient.bind(this),this.options.reconnectInterval)),this.trigger("close",a)},joint.com.Channel.prototype.onMessage=function(a,b){this.trigger("message:received",b),this.options.debugLevel>1&&this.log("message",b);try{b=JSON.parse(b)}catch(c){return console.error("Channel: message parsing failed.",c)}if("notification"==b.type)return this.trigger(b.data.event,b.data.data),this.sendNotification(b);var d,e,f=b.data;this._isClient?(d=this.sites[this.id],f=this.receive(d,this.id,f)):(e=this.sites[f.channelId],f=this.receive(e,f.channelId,f),d=this.sites[this.id],f=this.receive(d,this.id,f)),"graph"===f.action?this.state[f.channelId]=f.state[f.channelId]:this.state[f.channelId]=(this.state[f.channelId]||0)+1,this.options.debugLevel>1&&this.log("new state",this.state),this.execute(f),joint.util.forIn(this.sites,function(a,b){b!==this.id&&b!==f.channelId&&this.receive(a,b,f)}
114.bind(this)),this._isClient||(b.op=f,this.messageQueue.push(b),this.broadcast(b)),this.trigger("message:processed",b)},joint.com.Channel.prototype.receive=function(a,b,c){if(!a)return c;this.options.debugLevel>1&&this.log("receive",b,c),this.options.debugLevel>1&&this.log("outgoing",a.outgoing),a.outgoing=a.outgoing.filter(function(a){return a.state[a.channelId]>=(c.state[a.channelId]||0)}),this.options.debugLevel>1&&this.log("outgoing.length",a.outgoing.length);for(var d=0;d<a.outgoing.length;d++){var e=a.outgoing[d],f=this.transform(c,e);c=f[0],a.outgoing[d]=f[1]}return c},joint.com.Channel.prototype.transform=function(a,b){return this.options.debugLevel>1&&this.log("transform",a,b),"change:target"===a.action&&"remove"===b.action&&a.cell.target.id===b.cell.id&&(a.cell.target={x:0,y:0}),"change:source"===a.action&&"remove"===b.action&&a.cell.source.id===b.cell.id&&(a.cell.source={x:0,y:0}),[a,b]},joint.com.Channel.prototype.execute=function(a){var b;switch(a.action){case"add":this.options.graph.addCell(a.cell,{remote:!0});break;case"remove":b=this.options.graph.getCell(a.cell.id),b&&b.remove({remote:!0,disconnectLinks:!0});break;case"graph":this.options.graph.fromJSON(a.graph);break;default:var c=a.action.substr("change:".length);b=this.options.graph.getCell(a.cell.id),b&&b.set(c,a.cell[c],{remote:!0})}},joint.com.Channel.prototype.broadcast=function(a){this._isClient?a.target=Object.keys(this.sites):a.target=Object.keys(joint.util.omit(this.sites,this.id,a.source)),this.send()},joint.com.Channel.prototype.send=function(){if(!this._paused){for(var a=[],b=0;b<this.messageQueue.length;b++){var c=this.messageQueue[b];this.sendMessage(c)&&a.push(b)}a.forEach(function(a){this.messageQueue.splice(a,1)},this)}},joint.com.Channel.prototype.sendMessage=function(a){this.debugLevel>1&&this.log("sendMessage",a);var b=[];return a.target.forEach(function(c,d){var e=this.sites[c];return e?void(e.socket&&1===e.socket.readyState&&(this.debugLevel>1&&this.log("sendMessage",c,a),e.socket.send(JSON.stringify(a)),b.push(d))):b.push(d)},this),b.forEach(function(b){a.target.splice(b,1)}),!a.target.length},joint.com.Channel.prototype.log=function(a,b){var c="Channel ["+this.id+"] "+a.toUpperCase()+": ";console.log.apply(console,[c].concat(Array.prototype.slice.call(arguments,1)))},joint.com.Channel.prototype.pause=function(){this._paused=!0},joint.com.Channel.prototype.unpause=function(){this._paused=!1,this.send()},joint.com.Channel.prototype.notify=function(a,b){var c={type:"notification",source:this.id,data:{event:a,data:b}};this.sendNotification(c)},joint.com.Channel.prototype.sendNotification=function(a){this._isClient?a.target=Object.keys(this.sites):a.target=Object.keys(joint.util.omit(this.sites,this.id,a.source)),this.sendMessage(a)},joint.com.Channel.prototype.onGraphChange=function(a,b,c,d){if(!d||!d.remote){var e="add"===a||"remove"===a||"change:"===a.substr(0,"change:".length);if(e){var f={channelId:this.id,state:JSON.parse(JSON.stringify(this.state)),action:a,cell:b.toJSON()},g={type:"op",data:f,source:this.id};this.options.debugLevel>1&&this.log("generate",g),this.messageQueue.push(g),this.broadcast(g),this.sites[this.id].outgoing.push(f),this.state[this.id]++}}},joint.com.ChannelHub=function(a){if(this.options=a,!this.options.port)throw new Error("ChannelHub: missing a port.");this.initialize()},joint.util.assign(joint.com.ChannelHub.prototype,Backbone.Events),joint.com.ChannelHub.prototype.initialize=function(){this.server=new WebSocketServer({port:this.options.port}),this.server.on("connection",this.onConnection.bind(this))},joint.com.ChannelHub.prototype.onConnection=function(a){var b=url.parse(a.upgradeReq.url,!0),c={query:b.query};if(!this.router)throw new Error("ChannelHub: missing a router.");var d=!1,e=this.router(c,function(b,c){if(b)throw new Error(b);c&&!d&&(c.onConnection(a),d=!0)});e instanceof joint.com.Channel&&(e.onConnection(a),d=!0)},joint.com.ChannelHub.prototype.route=function(a){this.router=a},joint.com.ChannelHub.prototype.close=function(){this.server.close()};
115joint.alg=joint.alg||{},joint.alg.Dijkstra=function(a,b,c){c=c||function(a,b){return 1};var d={};d[b]=0;var e={}
115,f=new joint.alg.PriorityQueue;for(var g in a)g!==b&&(d[g]=1/0),f.insert(d[g],g,g);for(var h,i,j,k,l={};!f.isEmpty();)for(h=f.remove(),l[h]=!0,i=a[h]||[],j=0;j<i.length;j++)g=i[j],l[g]||(k=d[h]+c(h,g),k<d[g]&&(d[g]=k,e[g]=h,f.updatePriority(g,k)));return e};
116joint.alg=joint.alg||{},joint.alg.PriorityQueue=function(a){a=a||{},this.comparator=a.comparator||function(a,b){return a-b},this.index={},this.data=a.data||[],this.heapify()},joint.alg.PriorityQueue.prototype.isEmpty=function(){return 0===this.data.length},joint.alg.PriorityQueue.prototype.insert=function(a,b,c){var d={priority:a,value:b};this.data.push(d);var e=this.data.length-1;c&&(d.id=c,this.index[c]=e),this.bubbleUp(e)},joint.alg.PriorityQueue.prototype.peek=function(){return this.data[0]&&this.data[0].value},joint.alg.PriorityQueue.prototype.peekPriority=function(){return this.data[0]&&this.data[0].priority},joint.alg.PriorityQueue.prototype.updatePriority=function(a,b){var c=this.index[a];if(null===c||"undefined"==typeof c)throw new Error("Node with id "+a+" was not found in the heap.");var d=this.data,e=d[c].priority,f=this.comparator(b,e);f<0?(d[c].priority=b,this.bubbleUp(c)):f>0&&(d[c].priority=b,this.bubbleDown(c))},joint.alg.PriorityQueue.prototype.remove=function(){var a=this.data,b=a[0],c=a.pop();return this.index[a.length]=null,a.length>0&&(a[0]=c,c.id&&(this.index[c.id]=0),this.bubbleDown(0)),b&&b.value},joint.alg.PriorityQueue.prototype.heapify=function(){for(var a=0;a<this.data.length;a++)this.bubbleUp(a)},joint.alg.PriorityQueue.prototype.bubbleUp=function(a){for(var b,c,d=this.data;a>0&&(b=a-1>>>1,this.comparator(d[a].priority,d[b].priority)<0);)c=d[b],d[b]=d[a],d[a].id&&(this.index[d[a].id]=b),d[a]=c,d[a].id&&(this.index[d[a].id]=a),a=b},joint.alg.PriorityQueue.prototype.bubbleDown=function(a){for(var b=this.data,c=b.length-1;;){var d=(a<<1)+1,e=d+1,f=a;if(d<=c&&this.comparator(b[d].priority,b[f].priority)<0&&(f=d),e<=c&&this.comparator(b[e].priority,b[f].priority)<0&&(f=e),f===a)break;var g=b[f];b[f]=b[a],b[a].id&&(this.index[b[a].id]=f),b[a]=g,b[a].id&&(this.index[b[a].id]=a),a=f}};
117joint.storage=joint.storage||{},joint.storage.Local={prefix:"joint.storage",insert:function(a,b,c){var d=b.id||joint.util.uuid(),e=this.loadIndex(a);e.keys.indexOf(d)===-1&&e.keys.push(d),this.setItem(this.docKey(a,d),b),this.setItem(this.indexKey(a),e),this.callback(c,null,joint.util.assign({},b,{id:d}))},find:function(a,b,c){var d=this.loadIndex(a),e=[];if(joint.util.isEmpty(b))d.keys.forEach(function(b){var d=this.getItem(this.docKey(a,b));d||this.callback(c,new Error("Storage incosistency. No document found for an ID "+b+" from index.")),e.push(d)},this),this.callback(c,null,e);else if(b.id){var f=this.getItem(this.docKey(a,b.id));this.callback(c,null,f?[f]:[])}else this.callback(c,null,[])},remove:function(a,b,c){var d=this.loadIndex(a);joint.util.isEmpty(b)?(d.keys.forEach(function(b){localStorage.removeItem(this.docKey(a,b))},this),localStorage.removeItem(this.indexKey(a)),this.callback(c,null)):b.id&&(d.keys=d.keys.filter(function(a){return a!==b.id}),localStorage.removeItem(this.docKey(a,b.id)),this.setItem(this.indexKey(a),d),this.callback(c,null))},callback:function(a,b,c){a&&setTimeout(function(){a(b,c)},1)},setItem:function(a,b){localStorage.setItem(a,JSON.stringify(b))},getItem:function(a){var b=localStorage.getItem(a);return b?JSON.parse(b):b},loadIndex:function(a){var b=this.getItem(this.indexKey(a))||{};return b.keys=b.keys||[],b},docKey:function(a,b){return this.prefix+"."+a+".docs."+b},indexKey:function(a){return this.prefix+"."+a+".index"}};
118
119	joint.g = g;
120	joint.V = joint.Vectorizer = V;
121
122	return joint;
123
124}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.