UNPKG

grapholscape

Version:
25 lines (24 loc) 1.01 MB
/** * MIT License * * Copyright (c) 2018-2024 OBDA Systems * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ function e(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a}function t(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{l(i.next(e))}catch(e){o(e)}}function s(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((i=i.apply(e,t||[])).next())}))}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function o(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var i,r,o=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(i=n.next()).done)&&(o.push(i.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw r}}return o}(e,t)||l(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function u(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=l(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}"function"==typeof SuppressedError&&SuppressedError;var d="undefined"==typeof window?null:window,h=d?d.navigator:null;d&&d.document;var p=n(""),g=n({}),f=n((function(){})),v="undefined"==typeof HTMLElement?"undefined":n(HTMLElement),y=function(e){return e&&e.instanceString&&b(e.instanceString)?e.instanceString():null},m=function(e){return null!=e&&n(e)==p},b=function(e){return null!=e&&n(e)===f},w=function(e){return!T(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},x=function(e){return null!=e&&n(e)===g&&!w(e)&&e.constructor===Object},_=function(e){return null!=e&&n(e)===n(1)&&!isNaN(e)},E=function(e){return"undefined"===v?void 0:null!=e&&e instanceof HTMLElement},T=function(e){return C(e)||S(e)},C=function(e){return"collection"===y(e)&&e._private.single},S=function(e){return"collection"===y(e)&&!e._private.single},I=function(e){return"core"===y(e)},O=function(e){return"stylesheet"===y(e)},N=function(e){return null==e||!(""!==e&&!e.match(/^\s+$/))},P=function(e){return function(e){return null!=e&&n(e)===g}(e)&&b(e.then)},A=function(e,t){t||(t=function(){if(1===arguments.length)return arguments[0];if(0===arguments.length)return"undefined";for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);return e.join("$")});var n=function n(){var i,r=arguments,o=t.apply(this,r),a=n.cache;return(i=a[o])||(i=a[o]=e.apply(this,r)),i};return n.cache={},n},k=A((function(e){return e.replace(/([A-Z])/g,(function(e){return"-"+e.toLowerCase()}))})),R=A((function(e){return e.replace(/(-\w)/g,(function(e){return e[1].toUpperCase()}))})),L=A((function(e,t){return e+t[0].toUpperCase()+t.substring(1)}),(function(e,t){return e+"$"+t})),D=function(e){return N(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},M="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",$="rgb[a]?\\(("+M+"[%]?)\\s*,\\s*("+M+"[%]?)\\s*,\\s*("+M+"[%]?)(?:\\s*,\\s*("+M+"))?\\)",B="rgb[a]?\\((?:"+M+"[%]?)\\s*,\\s*(?:"+M+"[%]?)\\s*,\\s*(?:"+M+"[%]?)(?:\\s*,\\s*(?:"+M+"))?\\)",z="hsl[a]?\\(("+M+")\\s*,\\s*("+M+"[%])\\s*,\\s*("+M+"[%])(?:\\s*,\\s*("+M+"))?\\)",V="hsl[a]?\\((?:"+M+")\\s*,\\s*(?:"+M+"[%])\\s*,\\s*(?:"+M+"[%])(?:\\s*,\\s*(?:"+M+"))?\\)",F=function(e,t){return e<t?-1:e>t?1:0},q=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n<t.length;n++){var i=t[n];if(null!=i)for(var r=Object.keys(i),o=0;o<r.length;o++){var a=r[o];e[a]=i[a]}}return e},j=function(e){return(w(e)?e:null)||function(e){return H[e.toLowerCase()]}(e)||function(e){if((4===e.length||7===e.length)&&"#"===e[0]){var t,n,i,r=16;return 4===e.length?(t=parseInt(e[1]+e[1],r),n=parseInt(e[2]+e[2],r),i=parseInt(e[3]+e[3],r)):(t=parseInt(e[1]+e[2],r),n=parseInt(e[3]+e[4],r),i=parseInt(e[5]+e[6],r)),[t,n,i]}}(e)||function(e){var t,n=new RegExp("^"+$+"$").exec(e);if(n){t=[];for(var i=[],r=1;r<=3;r++){var o=n[r];if("%"===o[o.length-1]&&(i[r]=!0),o=parseFloat(o),i[r]&&(o=o/100*255),o<0||o>255)return;t.push(Math.floor(o))}var a=i[1]||i[2]||i[3],s=i[1]&&i[2]&&i[3];if(a&&!s)return;var l=n[4];if(void 0!==l){if((l=parseFloat(l))<0||l>1)return;t.push(l)}}return t}(e)||function(e){var t,n,i,r,o,a,s,l;function c(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var u=new RegExp("^"+z+"$").exec(e);if(u){if((n=parseInt(u[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(i=parseFloat(u[2]))<0||i>100)return;if(i/=100,(r=parseFloat(u[3]))<0||r>100)return;if(r/=100,void 0!==(o=u[4])&&((o=parseFloat(o))<0||o>1))return;if(0===i)a=s=l=Math.round(255*r);else{var d=r<.5?r*(1+i):r+i-r*i,h=2*r-d;a=Math.round(255*c(h,d,n+1/3)),s=Math.round(255*c(h,d,n)),l=Math.round(255*c(h,d,n-1/3))}t=[a,s,l,o]}return t}(e)},H={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},U=function(e){for(var t=e.map,n=e.keys,i=n.length,r=0;r<i;r++){var o=n[r];if(x(o))throw Error("Tried to set map with object key");r<n.length-1?(null==t[o]&&(t[o]={}),t=t[o]):t[o]=e.value}},G=function(e){for(var t=e.map,n=e.keys,i=n.length,r=0;r<i;r++){var o=n[r];if(x(o))throw Error("Tried to get map with object key");if(null==(t=t[o]))return t}return t};var Y=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Q="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var Z="object"==typeof Q&&Q&&Q.Object===Object&&Q,W="object"==typeof self&&self&&self.Object===Object&&self,X=Z||W||Function("return this")(),J=function(){return X.Date.now()},K=/\s/;var ee=function(e){for(var t=e.length;t--&&K.test(e.charAt(t)););return t},te=/^\s+/;var ne=function(e){return e?e.slice(0,ee(e)+1).replace(te,""):e},ie=X.Symbol,re=Object.prototype,oe=re.hasOwnProperty,ae=re.toString,se=ie?ie.toStringTag:void 0;var le=function(e){var t=oe.call(e,se),n=e[se];try{e[se]=void 0;var i=!0}catch(e){}var r=ae.call(e);return i&&(t?e[se]=n:delete e[se]),r},ce=Object.prototype.toString;var ue=function(e){return ce.call(e)},de=ie?ie.toStringTag:void 0;var he=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":de&&de in Object(e)?le(e):ue(e)};var pe=function(e){return null!=e&&"object"==typeof e};var ge=function(e){return"symbol"==typeof e||pe(e)&&"[object Symbol]"==he(e)},fe=/^[-+]0x[0-9a-f]+$/i,ve=/^0b[01]+$/i,ye=/^0o[0-7]+$/i,me=parseInt;var be=function(e){if("number"==typeof e)return e;if(ge(e))return NaN;if(Y(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Y(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=ne(e);var n=ve.test(e);return n||ye.test(e)?me(e.slice(2),n?2:8):fe.test(e)?NaN:+e},we=Math.max,xe=Math.min;var _e=function(e,t,n){var i,r,o,a,s,l,c=0,u=!1,d=!1,h=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function p(t){var n=i,o=r;return i=r=void 0,c=t,a=e.apply(o,n)}function g(e){var n=e-l;return void 0===l||n>=t||n<0||d&&e-c>=o}function f(){var e=J();if(g(e))return v(e);s=setTimeout(f,function(e){var n=t-(e-l);return d?xe(n,o-(e-c)):n}(e))}function v(e){return s=void 0,h&&i?p(e):(i=r=void 0,a)}function y(){var e=J(),n=g(e);if(i=arguments,r=this,l=e,n){if(void 0===s)return function(e){return c=e,s=setTimeout(f,t),u?p(e):a}(l);if(d)return clearTimeout(s),s=setTimeout(f,t),p(l)}return void 0===s&&(s=setTimeout(f,t)),a}return t=be(t)||0,Y(n)&&(u=!!n.leading,o=(d="maxWait"in n)?we(be(n.maxWait)||0,t):o,h="trailing"in n?!!n.trailing:h),y.cancel=function(){void 0!==s&&clearTimeout(s),c=0,i=l=r=s=void 0},y.flush=function(){return void 0===s?a:v(J())},y},Ee=d?d.performance:null,Te=Ee&&Ee.now?function(){return Ee.now()}:function(){return Date.now()},Ce=function(){if(d){if(d.requestAnimationFrame)return function(e){d.requestAnimationFrame(e)};if(d.mozRequestAnimationFrame)return function(e){d.mozRequestAnimationFrame(e)};if(d.webkitRequestAnimationFrame)return function(e){d.webkitRequestAnimationFrame(e)};if(d.msRequestAnimationFrame)return function(e){d.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout((function(){e(Te())}),1e3/60)}}(),Se=function(e){return Ce(e)},Ie=Te,Oe=9261,Ne=5381,Pe=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Oe;!(t=e.next()).done;)n=65599*n+t.value|0;return n},Ae=function(e){return 65599*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:Oe)+e|0},ke=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ne;return(t<<5)+t+e|0},Re=function(e){return 2097152*e[0]+e[1]},Le=function(e,t){return[Ae(e[0],t[0]),ke(e[1],t[1])]},De=function(e,t){var n={value:0,done:!1},i=0,r=e.length;return Pe({next:function(){return i<r?n.value=e.charCodeAt(i++):n.done=!0,n}},t)},Me=function(){return $e(arguments)},$e=function(e){for(var t,n=0;n<e.length;n++){var i=e[n];t=0===n?De(i):De(i,t)}return t},Be=!0,ze=null!=console.warn,Ve=null!=console.trace,Fe=Number.MAX_SAFE_INTEGER||9007199254740991,qe=function(){return!0},je=function(){return!1},He=function(){return 0},Ue=function(){},Ge=function(e){throw new Error(e)},Ye=function(e){if(void 0===e)return Be;Be=!!e},Qe=function(e){Ye()&&(ze?console.warn(e):(console.log(e),Ve&&console.trace()))},Ze=function(e){return null==e?e:w(e)?e.slice():x(e)?function(e){return q({},e)}(e):e},We=function(e,t){for(t=e="";e++<36;t+=51*e&52?(15^e?8^Math.random()*(20^e?16:4):4).toString(16):"-");return t},Xe={},Je=function(){return Xe},Ke=function(e){var t=Object.keys(e);return function(n){for(var i={},r=0;r<t.length;r++){var o=t[r],a=null==n?void 0:n[o];i[o]=void 0===a?e[o]:a}return i}},et=function(e,t,n){for(var i=e.length-1;i>=0&&(e[i]!==t||(e.splice(i,1),!n));i--);},tt=function(e){e.splice(0,e.length)},nt=function(e,t,n){return n&&(t=L(n,t)),e[t]},it=function(e,t,n,i){n&&(t=L(n,t)),e[t]=i},rt="undefined"!=typeof Map?Map:function(){function e(){i(this,e),this._obj={}}return o(e,[{key:"set",value:function(e,t){return this._obj[e]=t,this}},{key:"delete",value:function(e){return this._obj[e]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(e){return void 0!==this._obj[e]}},{key:"get",value:function(e){return this._obj[e]}}]),e}(),ot=function(){function e(t){if(i(this,e),this._obj=Object.create(null),this.size=0,null!=t){var n;n=null!=t.instanceString&&t.instanceString()===this.instanceString()?t.toArray():t;for(var r=0;r<n.length;r++)this.add(n[r])}}return o(e,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(e){var t=this._obj;1!==t[e]&&(t[e]=1,this.size++)}},{key:"delete",value:function(e){var t=this._obj;1===t[e]&&(t[e]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(e){return 1===this._obj[e]}},{key:"toArray",value:function(){var e=this;return Object.keys(this._obj).filter((function(t){return e.has(t)}))}},{key:"forEach",value:function(e,t){return this.toArray().forEach(e,t)}}]),e}(),at="undefined"!==("undefined"==typeof Set?"undefined":n(Set))?Set:ot,st=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0!==e&&void 0!==t&&I(e)){var i=t.group;if(null==i&&(i=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"===i||"edges"===i){this.length=1,this[0]=this;var r=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:i,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===i:!!t.pannable,active:!1,classes:new at,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==r.position.x&&(r.position.x=0),null==r.position.y&&(r.position.y=0),t.renderedPosition){var o=t.renderedPosition,a=e.pan(),s=e.zoom();r.position={x:(o.x-a.x)/s,y:(o.y-a.y)/s}}var l=[];w(t.classes)?l=t.classes:m(t.classes)&&(l=t.classes.split(/\s+/));for(var c=0,u=l.length;c<u;c++){var d=l[c];d&&""!==d&&r.classes.add(d)}this.createEmitter();var h=t.style||t.css;h&&(Qe("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(h)),(void 0===n||n)&&this.restore()}else Ge("An element must be of type `nodes` or `edges`; you specified `"+i+"`")}else Ge("An element must have a core reference and parameters set")},lt=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,n,i){var r;x(t)&&!T(t)&&(t=(r=t).roots||r.root,n=r.visit,i=r.directed),i=2!==arguments.length||b(n)?i:n,n=b(n)?n:function(){};for(var o,a=this._private.cy,s=t=m(t)?this.filter(t):t,l=[],c=[],u={},d={},h={},p=0,g=this.byGroup(),f=g.nodes,v=g.edges,y=0;y<s.length;y++){var w=s[y],_=w.id();w.isNode()&&(l.unshift(w),e.bfs&&(h[_]=!0,c.push(w)),d[_]=0)}for(var E=function(){var t=e.bfs?l.shift():l.pop(),r=t.id();if(e.dfs){if(h[r])return"continue";h[r]=!0,c.push(t)}var a,s=d[r],g=u[r],y=null!=g?g.source():null,m=null!=g?g.target():null,b=null==g?void 0:t.same(y)?m[0]:y[0];if(!0===(a=n(t,g,b,p++,s)))return o=t,"break";if(!1===a)return"break";for(var w=t.connectedEdges().filter((function(e){return(!i||e.source().same(t))&&v.has(e)})),x=0;x<w.length;x++){var _=w[x],E=_.connectedNodes().filter((function(e){return!e.same(t)&&f.has(e)})),T=E.id();0===E.length||h[T]||(E=E[0],l.push(E),e.bfs&&(h[T]=!0,c.push(E)),u[T]=_,d[T]=d[r]+1)}};0!==l.length;){var C=E();if("continue"!==C&&"break"===C)break}for(var S=a.collection(),I=0;I<c.length;I++){var O=c[I],N=u[O.id()];null!=N&&S.push(N),S.push(O)}return{path:a.collection(S),found:a.collection(o)}}},ct={breadthFirstSearch:lt({bfs:!0}),depthFirstSearch:lt({dfs:!0})};ct.bfs=ct.breadthFirstSearch,ct.dfs=ct.depthFirstSearch;var ut=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,t){(function(){var t,n,i,r,o,a,s,l,c,u,d,h,p,g,f;i=Math.floor,u=Math.min,n=function(e,t){return e<t?-1:e>t?1:0},c=function(e,t,r,o,a){var s;if(null==r&&(r=0),null==a&&(a=n),r<0)throw new Error("lo must be non-negative");for(null==o&&(o=e.length);r<o;)a(t,e[s=i((r+o)/2)])<0?o=s:r=s+1;return[].splice.apply(e,[r,r-r].concat(t)),t},a=function(e,t,i){return null==i&&(i=n),e.push(t),g(e,0,e.length-1,i)},o=function(e,t){var i,r;return null==t&&(t=n),i=e.pop(),e.length?(r=e[0],e[0]=i,f(e,0,t)):r=i,r},l=function(e,t,i){var r;return null==i&&(i=n),r=e[0],e[0]=t,f(e,0,i),r},s=function(e,t,i){var r;return null==i&&(i=n),e.length&&i(e[0],t)<0&&(t=(r=[e[0],t])[0],e[0]=r[1],f(e,0,i)),t},r=function(e,t){var r,o,a,s,l,c;for(null==t&&(t=n),l=[],o=0,a=(s=function(){c=[];for(var t=0,n=i(e.length/2);0<=n?t<n:t>n;0<=n?t++:t--)c.push(t);return c}.apply(this).reverse()).length;o<a;o++)r=s[o],l.push(f(e,r,t));return l},p=function(e,t,i){var r;if(null==i&&(i=n),-1!==(r=e.indexOf(t)))return g(e,0,r,i),f(e,r,i)},d=function(e,t,i){var o,a,l,c,u;if(null==i&&(i=n),!(a=e.slice(0,t)).length)return a;for(r(a,i),l=0,c=(u=e.slice(t)).length;l<c;l++)o=u[l],s(a,o,i);return a.sort(i).reverse()},h=function(e,t,i){var a,s,l,d,h,p,g,f,v;if(null==i&&(i=n),10*t<=e.length){if(!(l=e.slice(0,t).sort(i)).length)return l;for(s=l[l.length-1],d=0,p=(g=e.slice(t)).length;d<p;d++)i(a=g[d],s)<0&&(c(l,a,0,null,i),l.pop(),s=l[l.length-1]);return l}for(r(e,i),v=[],h=0,f=u(t,e.length);0<=f?h<f:h>f;0<=f?++h:--h)v.push(o(e,i));return v},g=function(e,t,i,r){var o,a,s;for(null==r&&(r=n),o=e[i];i>t&&r(o,a=e[s=i-1>>1])<0;)e[i]=a,i=s;return e[i]=o},f=function(e,t,i){var r,o,a,s,l;for(null==i&&(i=n),o=e.length,l=t,a=e[t],r=2*t+1;r<o;)(s=r+1)<o&&!(i(e[r],e[s])<0)&&(r=s),e[t]=e[r],r=2*(t=r)+1;return e[t]=a,g(e,l,t,i)},t=function(){function e(e){this.cmp=null!=e?e:n,this.nodes=[]}return e.push=a,e.pop=o,e.replace=l,e.pushpop=s,e.heapify=r,e.updateItem=p,e.nlargest=d,e.nsmallest=h,e.prototype.push=function(e){return a(this.nodes,e,this.cmp)},e.prototype.pop=function(){return o(this.nodes,this.cmp)},e.prototype.peek=function(){return this.nodes[0]},e.prototype.contains=function(e){return-1!==this.nodes.indexOf(e)},e.prototype.replace=function(e){return l(this.nodes,e,this.cmp)},e.prototype.pushpop=function(e){return s(this.nodes,e,this.cmp)},e.prototype.heapify=function(){return r(this.nodes,this.cmp)},e.prototype.updateItem=function(e){return p(this.nodes,e,this.cmp)},e.prototype.clear=function(){return this.nodes=[]},e.prototype.empty=function(){return 0===this.nodes.length},e.prototype.size=function(){return this.nodes.length},e.prototype.clone=function(){var t;return(t=new e).nodes=this.nodes.slice(0),t},e.prototype.toArray=function(){return this.nodes.slice(0)},e.prototype.insert=e.prototype.push,e.prototype.top=e.prototype.peek,e.prototype.front=e.prototype.peek,e.prototype.has=e.prototype.contains,e.prototype.copy=e.prototype.clone,e}(),e.exports=t}).call(Q)})),dt=ut,ht=Ke({root:null,weight:function(e){return 1},directed:!1}),pt={dijkstra:function(e){if(!x(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=ht(e),i=n.root,r=n.weight,o=n.directed,a=this,s=r,l=m(i)?this.filter(i)[0]:i[0],c={},u={},d={},h=this.byGroup(),p=h.nodes,g=h.edges;g.unmergeBy((function(e){return e.isLoop()}));for(var f=function(e){return c[e.id()]},v=function(e,t){c[e.id()]=t,y.updateItem(e)},y=new dt((function(e,t){return f(e)-f(t)})),b=0;b<p.length;b++){var w=p[b];c[w.id()]=w.same(l)?0:1/0,y.push(w)}for(var _=function(e,t){for(var n,i=(o?e.edgesTo(t):e.edgesWith(t)).intersect(g),r=1/0,a=0;a<i.length;a++){var l=i[a],c=s(l);(c<r||!n)&&(r=c,n=l)}return{edge:n,dist:r}};y.size()>0;){var E=y.pop(),T=f(E),C=E.id();if(d[C]=T,T!==1/0)for(var S=E.neighborhood().intersect(p),I=0;I<S.length;I++){var O=S[I],N=O.id(),P=_(E,O),A=T+P.dist;A<f(O)&&(v(O,A),u[N]={node:E,edge:P.edge})}}return{distanceTo:function(e){var t=m(e)?p.filter(e)[0]:e[0];return d[t.id()]},pathTo:function(e){var t=m(e)?p.filter(e)[0]:e[0],n=[],i=t,r=i.id();if(t.length>0)for(n.unshift(t);u[r];){var o=u[r];n.unshift(o.edge),n.unshift(o.node),r=(i=o.node).id()}return a.spawn(n)}}}},gt={kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,i=t.edges,r=n.length,o=new Array(r),a=n,s=function(e){for(var t=0;t<o.length;t++){if(o[t].has(e))return t}},l=0;l<r;l++)o[l]=this.spawn(n[l]);for(var c=i.sort((function(t,n){return e(t)-e(n)})),u=0;u<c.length;u++){var d=c[u],h=d.source()[0],p=d.target()[0],g=s(h),f=s(p),v=o[g],y=o[f];g!==f&&(a.merge(d),v.merge(y),o.splice(f,1))}return a}},ft=Ke({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),vt={aStar:function(e){var t=this.cy(),n=ft(e),i=n.root,r=n.goal,o=n.heuristic,a=n.directed,s=n.weight;i=t.collection(i)[0],r=t.collection(r)[0];var l,c,u=i.id(),d=r.id(),h={},p={},g={},f=new dt((function(e,t){return p[e.id()]-p[t.id()]})),v=new at,y={},m={},b=function(e,t){f.push(e),v.add(t)};b(i,u),h[u]=0,p[u]=o(i);for(var w,x=0;f.size()>0;){if(l=f.pop(),c=l.id(),v.delete(c),x++,c===d){for(var _=[],E=r,T=d,C=m[T];_.unshift(E),null!=C&&_.unshift(C),null!=(E=y[T]);)C=m[T=E.id()];return{found:!0,distance:h[c],path:this.spawn(_),steps:x}}g[c]=!0;for(var S=l._private.edges,I=0;I<S.length;I++){var O=S[I];if(this.hasElementWithId(O.id())&&(!a||O.data("source")===c)){var N=O.source(),P=O.target(),A=N.id()!==c?N:P,k=A.id();if(this.hasElementWithId(k)&&!g[k]){var R=h[c]+s(O);w=k,v.has(w)?R<h[k]&&(h[k]=R,p[k]=R+o(A),y[k]=l,m[k]=O):(h[k]=R,p[k]=R+o(A),b(A,k),y[k]=l,m[k]=O)}}}}return{found:!1,distance:void 0,path:void 0,steps:x}}},yt=Ke({weight:function(e){return 1},directed:!1}),mt={floydWarshall:function(e){for(var t=this.cy(),n=yt(e),i=n.weight,r=n.directed,o=i,a=this.byGroup(),s=a.nodes,l=a.edges,c=s.length,u=c*c,d=function(e){return s.indexOf(e)},h=function(e){return s[e]},p=new Array(u),g=0;g<u;g++){var f=g%c,v=(g-f)/c;p[g]=v===f?0:1/0}for(var y=new Array(u),b=new Array(u),w=0;w<l.length;w++){var x=l[w],_=x.source()[0],E=x.target()[0];if(_!==E){var T=d(_),C=d(E),S=T*c+C,I=o(x);if(p[S]>I&&(p[S]=I,y[S]=C,b[S]=x),!r){var O=C*c+T;!r&&p[O]>I&&(p[O]=I,y[O]=T,b[O]=x)}}}for(var N=0;N<c;N++)for(var P=0;P<c;P++)for(var A=P*c+N,k=0;k<c;k++){var R=P*c+k,L=N*c+k;p[A]+p[L]<p[R]&&(p[R]=p[A]+p[L],y[R]=y[A])}var D=function(e){return d(function(e){return(m(e)?t.filter(e):e)[0]}(e))},M={distance:function(e,t){var n=D(e),i=D(t);return p[n*c+i]},path:function(e,n){var i=D(e),r=D(n),o=h(i);if(i===r)return o.collection();if(null==y[i*c+r])return t.collection();var a,s=t.collection(),l=i;for(s.merge(o);i!==r;)l=i,i=y[i*c+r],a=b[l*c+i],s.merge(a),s.merge(h(i));return s}};return M}},bt=Ke({weight:function(e){return 1},directed:!1,root:null}),wt={bellmanFord:function(e){var t=this,n=bt(e),i=n.weight,r=n.directed,o=n.root,a=i,s=this,l=this.cy(),c=this.byGroup(),u=c.edges,d=c.nodes,h=d.length,p=new rt,g=!1,f=[];o=l.collection(o)[0],u.unmergeBy((function(e){return e.isLoop()}));for(var v=u.length,y=function(e){var t=p.get(e.id());return t||(t={},p.set(e.id(),t)),t},b=function(e){return(m(e)?l.$(e):e)[0]},w=0;w<h;w++){var x=d[w],_=y(x);x.same(o)?_.dist=0:_.dist=1/0,_.pred=null,_.edge=null}for(var E=!1,T=function(e,t,n,i,r,o){var a=i.dist+o;a<r.dist&&!n.same(i.edge)&&(r.dist=a,r.pred=e,r.edge=n,E=!0)},C=1;C<h;C++){E=!1;for(var S=0;S<v;S++){var I=u[S],O=I.source(),N=I.target(),P=a(I),A=y(O),k=y(N);T(O,0,I,A,k,P),r||T(N,0,I,k,A,P)}if(!E)break}if(E)for(var R=[],L=0;L<v;L++){var D=u[L],M=D.source(),$=D.target(),B=a(D),z=y(M).dist,V=y($).dist;if(z+B<V||!r&&V+B<z){if(g||(Qe("Graph contains a negative weight cycle for Bellman-Ford"),g=!0),!1===e.findNegativeWeightCycles)break;var F=[];z+B<V&&F.push(M),!r&&V+B<z&&F.push($);for(var q=F.length,j=0;j<q;j++){var H=F[j],U=[H];U.push(y(H).edge);for(var G=y(H).pred;-1===U.indexOf(G);)U.push(G),U.push(y(G).edge),G=y(G).pred;for(var Y=(U=U.slice(U.indexOf(G)))[0].id(),Q=0,Z=2;Z<U.length;Z+=2)U[Z].id()<Y&&(Y=U[Z].id(),Q=Z);(U=U.slice(Q).concat(U.slice(0,Q))).push(U[0]);var W=U.map((function(e){return e.id()})).join(",");-1===R.indexOf(W)&&(f.push(s.spawn(U)),R.push(W))}}}return{distanceTo:function(e){return y(b(e)).dist},pathTo:function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o,i=[],r=b(e);;){if(null==r)return t.spawn();var a=y(r),l=a.edge,c=a.pred;if(i.unshift(r[0]),r.same(n)&&i.length>0)break;null!=l&&i.unshift(l),r=c}return s.spawn(i)},hasNegativeWeightCycle:g,negativeWeightCycles:f}}},xt=Math.sqrt(2),_t=function(e,t,n){0===n.length&&Ge("Karger-Stein must be run on a connected (sub)graph");for(var i=n[e],r=i[1],o=i[2],a=t[r],s=t[o],l=n,c=l.length-1;c>=0;c--){var u=l[c],d=u[1],h=u[2];(t[d]===a&&t[h]===s||t[d]===s&&t[h]===a)&&l.splice(c,1)}for(var p=0;p<l.length;p++){var g=l[p];g[1]===s?(l[p]=g.slice(),l[p][1]=a):g[2]===s&&(l[p]=g.slice(),l[p][2]=a)}for(var f=0;f<t.length;f++)t[f]===s&&(t[f]=a);return l},Et=function(e,t,n,i){for(;n>i;){var r=Math.floor(Math.random()*t.length);t=_t(r,e,t),n--}return t},Tt={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,i=t.edges;i.unmergeBy((function(e){return e.isLoop()}));var r=n.length,o=i.length,a=Math.ceil(Math.pow(Math.log(r)/Math.LN2,2)),s=Math.floor(r/xt);if(!(r<2)){for(var l=[],c=0;c<o;c++){var u=i[c];l.push([c,n.indexOf(u.source()),n.indexOf(u.target())])}for(var d=1/0,h=[],p=new Array(r),g=new Array(r),f=new Array(r),v=function(e,t){for(var n=0;n<r;n++)t[n]=e[n]},y=0;y<=a;y++){for(var m=0;m<r;m++)g[m]=m;var b=Et(g,l.slice(),r,s),w=b.slice();v(g,f);var x=Et(g,b,s,2),_=Et(f,w,s,2);x.length<=_.length&&x.length<d?(d=x.length,h=x,v(g,p)):_.length<=x.length&&_.length<d&&(d=_.length,h=_,v(f,p))}for(var E=this.spawn(h.map((function(e){return i[e[0]]}))),T=this.spawn(),C=this.spawn(),S=p[0],I=0;I<p.length;I++){var O=p[I],N=n[I];O===S?T.merge(N):C.merge(N)}var P=function(t){var n=e.spawn();return t.forEach((function(t){n.merge(t),t.connectedEdges().forEach((function(t){e.contains(t)&&!E.contains(t)&&n.merge(t)}))})),n},A=[P(T),P(C)];return{cut:E,components:A,partition1:T,partition2:C}}Ge("At least 2 nodes are required for Karger-Stein algorithm")}},Ct=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},St=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},It=function(e){return{x:e[0],y:e[1]}},Ot=function(e,t){return Math.atan2(t,e)-Math.PI/2},Nt=Math.log2||function(e){return Math.log(e)/Math.log(2)},Pt=function(e){return e>0?1:e<0?-1:0},At=function(e,t){return Math.sqrt(kt(e,t))},kt=function(e,t){var n=t.x-e.x,i=t.y-e.y;return n*n+i*i},Rt=function(e){for(var t=e.length,n=0,i=0;i<t;i++)n+=e[i];for(var r=0;r<t;r++)e[r]=e[r]/n;return e},Lt=function(e,t,n,i){return(1-i)*(1-i)*e+2*(1-i)*i*t+i*i*n},Dt=function(e,t,n,i){return{x:Lt(e.x,t.x,n.x,i),y:Lt(e.y,t.y,n.y,i)}},Mt=function(e,t,n){return Math.max(e,Math.min(n,t))},$t=function(e){if(null==e)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(null!=e.x1&&null!=e.y1){if(null!=e.x2&&null!=e.y2&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(null!=e.w&&null!=e.h&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},Bt=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},zt=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},Vt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Ft=function(e){var t,n,i,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===o.length)t=n=i=r=o[0];else if(2===o.length)t=i=o[0],r=n=o[1];else if(4===o.length){var a=s(o,4);t=a[0],n=a[1],i=a[2],r=a[3]}return e.x1-=r,e.x2+=n,e.y1-=t,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},qt=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},jt=function(e,t){return!(e.x1>t.x2)&&(!(t.x1>e.x2)&&(!(e.x2<t.x1)&&(!(t.x2<e.x1)&&(!(e.y2<t.y1)&&(!(t.y2<e.y1)&&(!(e.y1>t.y2)&&!(t.y1>e.y2)))))))},Ht=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},Ut=function(e,t){return Ht(e,t.x1,t.y1)&&Ht(e,t.x2,t.y2)},Gt=function(e,t,n,i,r,o,a){var s,l,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"auto",u="auto"===c?dn(r,o):c,d=r/2,h=o/2,p=(u=Math.min(u,d,h))!==d,g=u!==h;if(p){var f=i-h-a;if((s=on(e,t,n,i,n-d+u-a,f,n+d-u+a,f,!1)).length>0)return s}if(g){var v=n+d+a;if((s=on(e,t,n,i,v,i-h+u-a,v,i+h-u+a,!1)).length>0)return s}if(p){var y=i+h+a;if((s=on(e,t,n,i,n-d+u-a,y,n+d-u+a,y,!1)).length>0)return s}if(g){var m=n-d-a;if((s=on(e,t,n,i,m,i-h+u-a,m,i+h-u+a,!1)).length>0)return s}var b=n-d+u,w=i-h+u;if((l=nn(e,t,n,i,b,w,u+a)).length>0&&l[0]<=b&&l[1]<=w)return[l[0],l[1]];var x=n+d-u,_=i-h+u;if((l=nn(e,t,n,i,x,_,u+a)).length>0&&l[0]>=x&&l[1]<=_)return[l[0],l[1]];var E=n+d-u,T=i+h-u;if((l=nn(e,t,n,i,E,T,u+a)).length>0&&l[0]>=E&&l[1]>=T)return[l[0],l[1]];var C=n-d+u,S=i+h-u;return(l=nn(e,t,n,i,C,S,u+a)).length>0&&l[0]<=C&&l[1]>=S?[l[0],l[1]]:[]},Yt=function(e,t,n,i,r,o,a){var s=a,l=Math.min(n,r),c=Math.max(n,r),u=Math.min(i,o),d=Math.max(i,o);return l-s<=e&&e<=c+s&&u-s<=t&&t<=d+s},Qt=function(e,t,n,i,r,o,a,s,l){var c=Math.min(n,a,r)-l,u=Math.max(n,a,r)+l,d=Math.min(i,s,o)-l,h=Math.max(i,s,o)+l;return!(e<c||e>u||t<d||t>h)},Zt=function(e,t,n,i,r,o,a,s){var l=[];!function(e,t,n,i,r){var o,a,s,l,c,u,d,h;0===e&&(e=1e-5),s=-27*(i/=e)+(t/=e)*(9*(n/=e)-t*t*2),o=(a=(3*n-t*t)/9)*a*a+(s/=54)*s,r[1]=0,d=t/3,o>0?(c=(c=s+Math.sqrt(o))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),u=(u=s-Math.sqrt(o))<0?-Math.pow(-u,1/3):Math.pow(u,1/3),r[0]=-d+c+u,d+=(c+u)/2,r[4]=r[2]=-d,d=Math.sqrt(3)*(-u+c)/2,r[3]=d,r[5]=-d):(r[5]=r[3]=0,0===o?(h=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),r[0]=2*h-d,r[4]=r[2]=-(h+d)):(l=(a=-a)*a*a,l=Math.acos(s/Math.sqrt(l)),h=2*Math.sqrt(a),r[0]=-d+h*Math.cos(l/3),r[2]=-d+h*Math.cos((l+2*Math.PI)/3),r[4]=-d+h*Math.cos((l+4*Math.PI)/3)))}(1*n*n-4*n*r+2*n*a+4*r*r-4*r*a+a*a+i*i-4*i*o+2*i*s+4*o*o-4*o*s+s*s,9*n*r-3*n*n-3*n*a-6*r*r+3*r*a+9*i*o-3*i*i-3*i*s-6*o*o+3*o*s,3*n*n-6*n*r+n*a-n*e+2*r*r+2*r*e-a*e+3*i*i-6*i*o+i*s-i*t+2*o*o+2*o*t-s*t,1*n*r-n*n+n*e-r*e+i*o-i*i+i*t-o*t,l);for(var c=[],u=0;u<6;u+=2)Math.abs(l[u+1])<1e-7&&l[u]>=0&&l[u]<=1&&c.push(l[u]);c.push(1),c.push(0);for(var d,h,p,g=-1,f=0;f<c.length;f++)d=Math.pow(1-c[f],2)*n+2*(1-c[f])*c[f]*r+c[f]*c[f]*a,h=Math.pow(1-c[f],2)*i+2*(1-c[f])*c[f]*o+c[f]*c[f]*s,p=Math.pow(d-e,2)+Math.pow(h-t,2),g>=0?p<g&&(g=p):g=p;return g},Wt=function(e,t,n,i,r,o){var a=[e-n,t-i],s=[r-n,o-i],l=s[0]*s[0]+s[1]*s[1],c=a[0]*a[0]+a[1]*a[1],u=a[0]*s[0]+a[1]*s[1],d=u*u/l;return u<0?c:d>l?(e-r)*(e-r)+(t-o)*(t-o):c-d},Xt=function(e,t,n){for(var i,r,o,a,s=0,l=0;l<n.length/2;l++)if(i=n[2*l],r=n[2*l+1],l+1<n.length/2?(o=n[2*(l+1)],a=n[2*(l+1)+1]):(o=n[2*(l+1-n.length/2)],a=n[2*(l+1-n.length/2)+1]),i==e&&o==e);else{if(!(i>=e&&e>=o||i<=e&&e<=o))continue;(e-i)/(o-i)*(a-r)+r>t&&s++}return s%2!=0},Jt=function(e,t,n,i,r,o,a,s,l){var c,u=new Array(n.length);null!=s[0]?(c=Math.atan(s[1]/s[0]),s[0]<0?c+=Math.PI/2:c=-c-Math.PI/2):c=s;for(var d,h=Math.cos(-c),p=Math.sin(-c),g=0;g<u.length/2;g++)u[2*g]=o/2*(n[2*g]*h-n[2*g+1]*p),u[2*g+1]=a/2*(n[2*g+1]*h+n[2*g]*p),u[2*g]+=i,u[2*g+1]+=r;if(l>0){var f=en(u,-l);d=Kt(f)}else d=u;return Xt(e,t,d)},Kt=function(e){for(var t,n,i,r,o,a,s,l,c=new Array(e.length/2),u=0;u<e.length/4;u++){t=e[4*u],n=e[4*u+1],i=e[4*u+2],r=e[4*u+3],u<e.length/4-1?(o=e[4*(u+1)],a=e[4*(u+1)+1],s=e[4*(u+1)+2],l=e[4*(u+1)+3]):(o=e[0],a=e[1],s=e[2],l=e[3]);var d=on(t,n,i,r,o,a,s,l,!0);c[2*u]=d[0],c[2*u+1]=d[1]}return c},en=function(e,t){for(var n,i,r,o,a=new Array(2*e.length),s=0;s<e.length/2;s++){n=e[2*s],i=e[2*s+1],s<e.length/2-1?(r=e[2*(s+1)],o=e[2*(s+1)+1]):(r=e[0],o=e[1]);var l=o-i,c=-(r-n),u=Math.sqrt(l*l+c*c),d=l/u,h=c/u;a[4*s]=n+d*t,a[4*s+1]=i+h*t,a[4*s+2]=r+d*t,a[4*s+3]=o+h*t}return a},tn=function(e,t,n,i,r,o,a){return e-=r,t-=o,(e/=n/2+a)*e+(t/=i/2+a)*t<=1},nn=function(e,t,n,i,r,o,a){var s=[n-e,i-t],l=[e-r,t-o],c=s[0]*s[0]+s[1]*s[1],u=2*(l[0]*s[0]+l[1]*s[1]),d=u*u-4*c*(l[0]*l[0]+l[1]*l[1]-a*a);if(d<0)return[];var h=(-u+Math.sqrt(d))/(2*c),p=(-u-Math.sqrt(d))/(2*c),g=Math.min(h,p),f=Math.max(h,p),v=[];if(g>=0&&g<=1&&v.push(g),f>=0&&f<=1&&v.push(f),0===v.length)return[];var y=v[0]*s[0]+e,m=v[0]*s[1]+t;return v.length>1?v[0]==v[1]?[y,m]:[y,m,v[1]*s[0]+e,v[1]*s[1]+t]:[y,m]},rn=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},on=function(e,t,n,i,r,o,a,s,l){var c=e-r,u=n-e,d=a-r,h=t-o,p=i-t,g=s-o,f=d*h-g*c,v=u*h-p*c,y=g*u-d*p;if(0!==y){var m=f/y,b=v/y,w=-.001;return w<=m&&m<=1.001&&w<=b&&b<=1.001||l?[e+m*u,t+m*p]:[]}return 0===f||0===v?rn(e,n,a)===a?[a,s]:rn(e,n,r)===r?[r,o]:rn(r,a,n)===n?[n,i]:[]:[]},an=function(e,t,n,i,r,o,a,s){var l,c,u,d,h,p,g=[],f=new Array(n.length),v=!0;if(null==o&&(v=!1),v){for(var y=0;y<f.length/2;y++)f[2*y]=n[2*y]*o+i,f[2*y+1]=n[2*y+1]*a+r;if(s>0){var m=en(f,-s);c=Kt(m)}else c=f}else c=n;for(var b=0;b<c.length/2;b++)u=c[2*b],d=c[2*b+1],b<c.length/2-1?(h=c[2*(b+1)],p=c[2*(b+1)+1]):(h=c[0],p=c[1]),0!==(l=on(e,t,i,r,u,d,h,p)).length&&g.push(l[0],l[1]);return g},sn=function(e,t,n){var i=[e[0]-t[0],e[1]-t[1]],r=Math.sqrt(i[0]*i[0]+i[1]*i[1]),o=(r-n)/r;return o<0&&(o=1e-5),[t[0]+o*i[0],t[1]+o*i[1]]},ln=function(e,t){var n=un(e,t);return n=cn(n)},cn=function(e){for(var t,n,i=e.length/2,r=1/0,o=1/0,a=-1/0,s=-1/0,l=0;l<i;l++)t=e[2*l],n=e[2*l+1],r=Math.min(r,t),a=Math.max(a,t),o=Math.min(o,n),s=Math.max(s,n);for(var c=2/(a-r),u=2/(s-o),d=0;d<i;d++)t=e[2*d]=e[2*d]*c,n=e[2*d+1]=e[2*d+1]*u,r=Math.min(r,t),a=Math.max(a,t),o=Math.min(o,n),s=Math.max(s,n);if(o<-1)for(var h=0;h<i;h++)n=e[2*h+1]=e[2*h+1]+(-1-o);return e},un=function(e,t){var n=1/e*2*Math.PI,i=e%2==0?Math.PI/2+n/2:Math.PI/2;i+=t;for(var r,o=new Array(2*e),a=0;a<e;a++)r=a*n+i,o[2*a]=Math.cos(r),o[2*a+1]=Math.sin(-r);return o},dn=function(e,t){return Math.min(e/4,t/4,8)},hn=function(e,t){return Math.min(e/10,t/10,8)},pn=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}},gn=Ke({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),fn={pageRank:function(e){for(var t=gn(e),n=t.dampingFactor,i=t.precision,r=t.iterations,o=t.weight,a=this._private.cy,s=this.byGroup(),l=s.nodes,c=s.edges,u=l.length,d=u*u,h=c.length,p=new Array(d),g=new Array(u),f=(1-n)/u,v=0;v<u;v++){for(var y=0;y<u;y++){p[v*u+y]=0}g[v]=0}for(var m=0;m<h;m++){var b=c[m],w=b.data("source"),x=b.data("target");if(w!==x){var _=l.indexOfId(w),E=l.indexOfId(x),T=o(b);p[E*u+_]+=T,g[_]+=T}}for(var C=1/u+f,S=0;S<u;S++)if(0===g[S])for(var I=0;I<u;I++){p[I*u+S]=C}else for(var O=0;O<u;O++){var N=O*u+S;p[N]=p[N]/g[S]+f}for(var P,A=new Array(u),k=new Array(u),R=0;R<u;R++)A[R]=1;for(var L=0;L<r;L++){for(var D=0;D<u;D++)k[D]=0;for(var M=0;M<u;M++)for(var $=0;$<u;$++){var B=M*u+$;k[M]+=p[B]*A[$]}Rt(k),P=A,A=k,k=P;for(var z=0,V=0;V<u;V++){var F=P[V]-A[V];z+=F*F}if(z<i)break}return{rank:function(e){return e=a.collection(e)[0],A[l.indexOf(e)]}}}},vn=Ke({root:null,weight:function(e){return 1},directed:!1,alpha:0}),yn={degreeCentralityNormalized:function(e){e=vn(e);var t=this.cy(),n=this.nodes(),i=n.length;if(e.directed){for(var r={},o={},a=0,s=0,l=0;l<i;l++){var c=n[l],u=c.id();e.root=c;var d=this.degreeCentrality(e);a<d.indegree&&(a=d.indegree),s<d.outdegree&&(s=d.outdegree),r[u]=d.indegree,o[u]=d.outdegree}return{indegree:function(e){return 0==a?0:(m(e)&&(e=t.filter(e)),r[e.id()]/a)},outdegree:function(e){return 0===s?0:(m(e)&&(e=t.filter(e)),o[e.id()]/s)}}}for(var h={},p=0,g=0;g<i;g++){var f=n[g];e.root=f;var v=this.degreeCentrality(e);p<v.degree&&(p=v.degree),h[f.id()]=v.degree}return{degree:function(e){return 0===p?0:(m(e)&&(e=t.filter(e)),h[e.id()]/p)}}},degreeCentrality:function(e){e=vn(e);var t=this.cy(),n=this,i=e,r=i.root,o=i.weight,a=i.directed,s=i.alpha;if(r=t.collection(r)[0],a){for(var l=r.connectedEdges(),c=l.filter((function(e){return e.target().same(r)&&n.has(e)})),u=l.filter((function(e){return e.source().same(r)&&n.has(e)})),d=c.length,h=u.length,p=0,g=0,f=0;f<c.length;f++)p+=o(c[f]);for(var v=0;v<u.length;v++)g+=o(u[v]);return{indegree:Math.pow(d,1-s)*Math.pow(p,s),outdegree:Math.pow(h,1-s)*Math.pow(g,s)}}for(var y=r.connectedEdges().intersection(n),m=y.length,b=0,w=0;w<y.length;w++)b+=o(y[w]);return{degree:Math.pow(m,1-s)*Math.pow(b,s)}}};yn.dc=yn.degreeCentrality,yn.dcn=yn.degreeCentralityNormalised=yn.degreeCentralityNormalized;var mn=Ke({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),bn={closenessCentralityNormalized:function(e){for(var t=mn(e),n=t.harmonic,i=t.weight,r=t.directed,o=this.cy(),a={},s=0,l=this.nodes(),c=this.floydWarshall({weight:i,directed:r}),u=0;u<l.length;u++){for(var d=0,h=l[u],p=0;p<l.length;p++)if(u!==p){var g=c.distance(h,l[p]);d+=n?1/g:g}n||(d=1/d),s<d&&(s=d),a[h.id()]=d}return{closeness:function(e){return 0==s?0:(e=m(e)?o.filter(e)[0].id():e.id(),a[e]/s)}}},closenessCentrality:function(e){var t=mn(e),n=t.root,i=t.weight,r=t.directed,o=t.harmonic;n=this.filter(n)[0];for(var a=this.dijkstra({root:n,weight:i,directed:r}),s=0,l=this.nodes(),c=0;c<l.length;c++){var u=l[c];if(!u.same(n)){var d=a.distanceTo(u);s+=o?1/d:d}}return o?s:1/s}};bn.cc=bn.closenessCentrality,bn.ccn=bn.closenessCentralityNormalised=bn.closenessCentralityNormalized;var wn=Ke({weight:null,directed:!1}),xn={betweennessCentrality:function(e){for(var t=wn(e),n=t.directed,i=t.weight,r=null!=i,o=this.cy(),a=this.nodes(),s={},l={},c=0,u=function(e,t){l[e]=t,t>c&&(c=t)},d=function(e){return l[e]},h=0;h<a.length;h++){var p=a[h],g=p.id();s[g]=n?p.outgoers().nodes():p.openNeighborhood().nodes(),u(g,0)}for(var f=function(e){for(var t=a[e].id(),n=[],l={},c={},h={},p=new dt((function(e,t){return h[e]-h[t]})),g=0;g<a.length;g++){var f=a[g].id();l[f]=[],c[f]=0,h[f]=1/0}for(c[t]=1,h[t]=0,p.push(t);!p.empty();){var v=p.pop();if(n.push(v),r)for(var y=0;y<s[v].length;y++){var m=s[v][y],b=o.getElementById(v),w=void 0;w=b.edgesTo(m).length>0?b.edgesTo(m)[0]:m.edgesTo(b)[0];var x=i(w);m=m.id(),h[m]>h[v]+x&&(h[m]=h[v]+x,p.nodes.indexOf(m)<0?p.push(m):p.updateItem(m),c[m]=0,l[m]=[]),h[m]==h[v]+x&&(c[m]=c[m]+c[v],l[m].push(v))}else for(var _=0;_<s[v].length;_++){var E=s[v][_].id();h[E]==1/0&&(p.push(E),h[E]=h[v]+1),h[E]==h[v]+1&&(c[E]=c[E]+c[v],l[E].push(v))}}for(var T={},C=0;C<a.length;C++)T[a[C].id()]=0;for(;n.length>0;){for(var S=n.pop(),I=0;I<l[S].length;I++){var O=l[S][I];T[O]=T[O]+c[O]/c[S]*(1+T[S])}S!=a[e].id()&&u(S,d(S)+T[S])}},v=0;v<a.length;v++)f(v);var y={betweenness:function(e){var t=o.collection(e).id();return d(t)},betweennessNormalized:function(e){if(0==c)return 0;var t=o.collection(e).id();return d(t)/c}};return y.betweennessNormalised=y.betweennessNormalized,y}};xn.bc=xn.betweennessCentrality;var _n=Ke({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),En=function(e,t){for(var n=0,i=0;i<t.length;i++)n+=t[i](e);return n},Tn=function(e,t){for(var n,i=0;i<t;i++){n=0;for(var r=0;r<t;r++)n+=e[r*t+i];for(var o=0;o<t;o++)e[o*t+i]=e[o*t+i]/n}},Cn=function(e,t,n){for(var i=new Array(n*n),r=0;r<n;r++){for(var o=0;o<n;o++)i[r*n+o]=0;for(var a=0;a<n;a++)for(var s=0;s<n;s++)i[r*n+s]+=e[r*n+a]*t[a*n+s]}return i},Sn=function(e,t,n){for(var i=e.slice(0),r=1;r<n;r++)e=Cn(e,i,t);return e},In=function(e,t,n){for(var i=new Array(t*t),r=0;r<t*t;r++)i[r]=Math.pow(e[r],n);return Tn(i,t),i},On=function(e,t,n,i){for(var r=0;r<n;r++){if(Math.round(e[r]*Math.pow(10,i))/Math.pow(10,i)!==Math.round(t[r]*Math.pow(10,i))/Math.pow(10,i))return!1}return!0},Nn=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},Pn=function(e){for(var t=this.nodes(),n=this.edges(),i=this.cy(),r=function(e){return _n(e)}(e),o={},a=0;a<t.length;a++)o[t[a].id()]=a;for(var s,l=t.length,c=l*l,u=new Array(c),d=0;d<c;d++)u[d]=0;for(var h=0;h<n.length;h++){var p=n[h],g=o[p.source().id()],f=o[p.target().id()],v=En(p,r.attributes);u[g*l+f]+=v,u[f*l+g]+=v}!function(e,t,n){for(var i=0;i<t;i++)e[i*t+i]=n}(u,l,r.multFactor),Tn(u,l);for(var y=!0,m=0;y&&m<r.maxIterations;)y=!1,s=Sn(u,l,r.expandFactor),u=In(s,l,r.inflateFactor),On(u,s,c,4)||(y=!0),m++;var b=function(e,t,n,i){for(var r=[],o=0;o<t;o++){for(var a=[],s=0;s<t;s++)Math.round(1e3*e[o*t+s])/1e3>0&&a.push(n[s]);0!==a.length&&r.push(i.collection(a))}return r}(u,l,t,i);return b=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&Nn(e[t],e[n])&&e.splice(n,1);return e}(b),b},An={markovClustering:Pn,mcl:Pn},kn=function(e){return e},Rn=function(e,t){return Math.abs(t-e)},Ln=function(e,t,n){return e+Rn(t,n)},Dn=function(e,t,n){return e+Math.pow(n-t,2)},Mn=function(e){return Math.sqrt(e)},$n=function(e,t,n){return Math.max(e,Rn(t,n))},Bn=function(e,t,n,i,r){for(var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:kn,a=i,s=0;s<e;s++)a=r(a,t(s),n(s));return o(a)},zn={euclidean:function(e,t,n){return e>=2?Bn(e,t,n,0,Dn,Mn):Bn(e,t,n,0,Ln)},squaredEuclidean:function(e,t,n){return Bn(e,t,n,0,Dn)},manhattan:function(e,t,n){return Bn(e,t,n,0,Ln)},max:function(e,t,n){return Bn(e,t,n,-1/0,$n)}};function Vn(e,t,n,i,r,o){var a;return a=b(e)?e:zn[e]||zn.euclidean,0===t&&b(e)?a(r,o):a(t,n,i,r,o)}zn["squared-euclidean"]=zn.squaredEuclidean,zn.squaredeuclidean=zn.squaredEuclidean;var Fn=Ke({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),qn=function(e){return Fn(e)},jn=function(e,t,n,i,r){var o="kMedoids"!==r?function(e){return n[e]}:function(e){return i[e](n)},a=n,s=t;return Vn(e,i.length,o,(function(e){return i[e](t)}),a,s)},Hn=function(e,t,n){for(var i=n.length,r=new Array(i),o=new Array(i),a=new Array(t),s=null,l=0;l<i;l++)r[l]=e.min(n[l]).value,o[l]=e.max(n[l]).value;for(var c=0;c<t;c++){s=[];for(var u=0;u<i;u++)s[u]=Math.random()*(o[u]-r[u])+r[u];a[c]=s}return a},Un=function(e,t,n,i,r){for(var o=1/0,a=0,s=0;s<t.length;s++){var l=jn(n,e,t[s],i,r);l<o&&(o=l,a=s)}return a},Gn=function(e,t,n){for(var i=[],r=null,o=0;o<t.length;o++)n[(r=t[o]).id()]===e&&i.push(r);return i},Yn=function(e,t,n){return Math.abs(t-e)<=n},Qn=function(e,t,n){for(var i=0;i<e.length;i++)for(var r=0;r<e[i].length;r++){if(Math.abs(e[i][r]-t[i][r])>n)return!1}return!0},Zn=function(e,t,n){for(var i=0;i<n;i++)if(e===t[i])return!0;return!1},Wn=function(e,t){var n=new Array(t);if(e.length<50)for(var i=0;i<t;i++){for(var r=e[Math.floor(Math.random()*e.length)];Zn(r,n,i);)r=e[Math.floor(Math.random()*e.length)];n[i]=r}else for(var o=0;o<t;o++)n[o]=e[Math.floor(Math.random()*e.length)];return n},Xn=function(e,t,n){for(var i=0,r=0;r<t.length;r++)i+=jn("manhattan",t[r],e,n,"kMedoids");return i},Jn=function(e,t,n,i,r){for(var o,a,s=0;s<t.length;s++)for(var l=0;l<e.length;l++)i[s][l]=Math.pow(n[s][l],r.m);for(var c=0;c<e.length;c++)for(var u=0;u<r.attributes.length;u++){o=0,a=0;for(var d=0;d<t.length;d++)o+=i[d][c]*r.attributes[u](t[d]),a+=i[d][c];e[c][u]=o/a}},Kn=function(e,t,n,i,r){for(var o=0;o<e.length;o++)t[o]=e[o].slice();for(var a,s,l,c=2/(r.m-1),u=0;u<n.length;u++)for(var d=0;d<i.length;d++){a=0;for(var h=0;h<n.length;h++)s=jn(r.distance,i[d],n[u],r.attributes,"cmeans"),l=jn(r.distance,i[d],n[h],r.attributes,"cmeans"),a+=Math.pow(s/l,c);e[d][u]=1/a}},ei=function(e){var t,n,i,r,o,a=this.cy(),s=this.nodes(),l=qn(e);r=new Array(s.length);for(var c=0;c<s.length;c++)r[c]=new Array(l.k);i=new Array(s.length);for(var u=0;u<s.length;u++)i[u]=new Array(l.k);for(var d=0;d<s.length;d++){for(var h=0,p=0;p<l.k;p++)i[d][p]=Math.random(),h+=i[d][p];for(var g=0;g<l.k;g++)i[d][g]=i[d][g]/h}n=new Array(l.k);for(var f=0;f<l.k;f++)n[f]=new Array(l.attributes.length);o=new Array(s.length);for(var v=0;v<s.length;v++)o[v]=new Array(l.k);for(var y=!0,m=0;y&&m<l.maxIterations;)y=!1,Jn(n,s,i,o,l),Kn(i,r,n,s,l),Qn(i,r,l.sensitivityThreshold)||(y=!0),m++;return t=function(e,t,n,i){for(var r,o,a=new Array(n.k),s=0;s<a.length;s++)a[s]=[];for(var l=0;l<t.length;l++){r=-1/0,o=-1;for(var c=0;c<t[0].length;c++)t[l][c]>r&&(r=t[l][c],o=c);a[o].push(e[l])}for(var u=0;u<a.length;u++)a[u]=i.collection(a[u]);return a}(s,i,l,a),{clusters:t,degreeOfMembership:i}},ti={kMeans:function(e){var t,i=this.cy(),r=this.nodes(),o=null,a=qn(e),s=new Array(a.k),l={};a.testMode?"number"==typeof a.testCentroids?(a.testCentroids,t=Hn(r,a.k,a.attributes)):t="object"===n(a.testCentroids)?a.testCentroids:Hn(r,a.k,a.attributes):t=Hn(r,a.k,a.attributes);for(var c=!0,u=0;c&&u<a.maxIterations;){for(var d=0;d<r.length;d++)l[(o=r[d]).id()]=Un(o,t,a.distance,a.attributes,"kMeans");c=!1;for(var h=0;h<a.k;h++){var p=Gn(h,r,l);if(0!==p.length){for(var g=a.attributes.length,f=t[h],v=new Array(g),y=new Array(g),m=0;m<g;m++){y[m]=0;for(var b=0;b<p.length;b++)o=p[b],y[m]+=a.attributes[m](o);v[m]=y[m]/p.length,Yn(v[m],f[m],a.sensitivityThreshold)||(c=!0)}t[h]=v,s[h]=i.collection(p)}}u++}return s},kMedoids:function(e){var t,i,r=this.cy(),o=this.nodes(),a=null,s=qn(e),l=new Array(s.k),c={},u=new Array(s.k);s.testMode?"number"==typeof s.testCentroids||(t="object"===n(s.testCentroids)?s.testCentroids:Wn(o,s.k)):t=Wn(o,s.k);for(var d=!0,h=0;d&&h<s.maxIterations;){for(var p=0;p<o.length;p++)c[(a=o[p]).id()]=Un(a,t,s.distance,s.attributes,"kMedoids");d=!1;for(var g=0;g<t.length;g++){var f=Gn(g,o,c);if(0!==f.length){u[g]=Xn(t[g],f,s.attributes);for(var v=0;v<f.length;v++)(i=Xn(f[v],f,s.attributes))<u[g]&&(u[g]=i,t[g]=f[v],d=!0);l[g]=r.collection(f)}}h++}return l},fuzzyCMeans:ei,fcm:ei},ni=Ke({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),ii={single:"min",complete:"max"},ri=function(e,t,n,i,r){