18 lines
436 KiB
JavaScript
18 lines
436 KiB
JavaScript
window.dash_cytoscape=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){e.exports=window.React},function(e,t,n){e.exports=n(5)()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Cytoscape=void 0;var r,i=n(4),a=(r=i)&&r.__esModule?r:{default:r};t.Cytoscape=a.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(1),a=c(i),o=c(n(2)),s=c(n(7)),u=c(n(16)),l=c(n(18));function c(e){return e&&e.__esModule?e:{default:e}}var d=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.handleCy=n.handleCy.bind(n),n._handleCyCalled=!1,n.handleImageGeneration=n.handleImageGeneration.bind(n),n.cyResponsiveClass=!1,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),r(t,[{key:"generateNode",value:function(e){var t=e.target,n=t.isParent(),r=t.isChildless(),i=t.isChild(),a=t.isOrphan(),o=t.renderedPosition(),s=t.relativePosition(),u=t.parent(),l=t.style(),c=t.connectedEdges().map((function(e){return e.data()})),d=t.children().map((function(e){return e.data()})),h=t.ancestors().map((function(e){return e.data()})),f=t.descendants().map((function(e){return e.data()})),p=t.siblings().map((function(e){return e.data()})),v=e.timeStamp,g=t.json(),y=g.classes,m=g.data,b=g.grabbable,x=g.group,w=g.locked,_=g.position,E=g.selected;return{edgesData:c,renderedPosition:o,timeStamp:v,classes:y,data:m,grabbable:b,group:x,locked:w,position:_,selectable:g.selectable,selected:E,ancestorsData:h,childrenData:d,descendantsData:f,parentData:u?u.data():null,siblingsData:p,isParent:n,isChildless:r,isChild:i,isOrphan:a,relativePosition:s,style:l}}},{key:"generateEdge",value:function(e){var t=e.target,n=t.midpoint(),r=t.isLoop(),i=t.isSimple(),a=t.source().data(),o=t.sourceEndpoint(),s=t.style(),u=t.target().data(),l=t.targetEndpoint(),c=e.timeStamp,d=t.json();return{isLoop:r,isSimple:i,midpoint:n,sourceData:a,sourceEndpoint:o,targetData:u,targetEndpoint:l,timeStamp:c,classes:d.classes,data:d.data,grabbable:d.grabbable,group:d.group,locked:d.locked,selectable:d.selectable,selected:d.selected,style:s}}},{key:"handleCy",value:function(e){var t=this;if(e!==this._cy||!this._handleCyCalled){this._cy=e,window.cy=e,this._handleCyCalled=!0;var n=e.collection(),r=e.collection(),i=u.default.debounce((function(){var n=t.props,r=n.autoRefreshLayout,i=n.layout;r&&e.layout(i).run()}),100),a=u.default.debounce((function(){var e=n.map((function(e){return e.data()}));"function"==typeof t.props.setProps&&t.props.setProps({selectedNodeData:e})}),100),o=u.default.debounce((function(){var e=r.map((function(e){return e.data()}));"function"==typeof t.props.setProps&&t.props.setProps({selectedEdgeData:e})}),100);e.on("tap","node",(function(e){var n=t.generateNode(e);"function"==typeof t.props.setProps&&t.props.setProps({tapNode:n,tapNodeData:n.data})})),e.on("tap","edge",(function(e){var n=t.generateEdge(e);"function"==typeof t.props.setProps&&t.props.setProps({tapEdge:n,tapEdgeData:n.data})})),e.on("mouseover","node",(function(e){"function"==typeof t.props.setProps&&t.props.setProps({mouseoverNodeData:e.target.data()})})),e.on("mouseover","edge",(function(e){"function"==typeof t.props.setProps&&t.props.setProps({mouseoverEdgeData:e.target.data()})})),e.on("select","node",(function(e){var t=e.target;n.merge(t),a()})),e.on("unselect remove","node",(function(e){var t=e.target;n.unmerge(t),a()})),e.on("select","edge",(function(e){var t=e.target;r.merge(t),o()})),e.on("unselect remove","edge",(function(e){var t=e.target;r.unmerge(t),o()})),e.on("add remove",(function(){i()})),this.cyResponsiveClass=new l.default(e),this.cyResponsiveClass.toggle(this.props.responsive)}}},{key:"handleImageGeneration",value:function(e,t,n,r){var i=this,a={};t&&(a=t);var o=a.output;a.output="blob";var s=void 0,u=void 0;switch(n){case"store":s=!1,u=!0;break;case"download":s=!0,u=!1;break;case"both":s=!0,u=!0;break;default:s=!1,u=!0}var l=void 0;if("png"===e&&(l=this._cy.png(a)),"jpg"!==e&&"jpeg"!==e||(l=this._cy.jpg(a)),"svg"===e&&(l=this._cy.svg(a)),l&&s){var c=r;if(r||(c="cyto"),"svg"!==e)this.downloadBlob(l,c+"."+e);else{var d=new Blob([l],{type:"image/svg+xml;charset=utf-8"});this.downloadBlob(d,c+"."+e)}}if(l&&u){if(o||(o="base64uri"),"base64uri"!==o&&"base64"!==o)return;var h=new FileReader;h.onload=function(){var e=h.result;"base64"===o&&(e=e.replace(/^data:.+;base64,/,"")),i.props.setProps({imageData:e})},h.readAsDataURL(l)}}},{key:"downloadBlob",value:function(e,t){var n=document.createElement("a");n.style="display: none",document.body.appendChild(n);var r=window.URL.createObjectURL(e);n.href=r,n.download=t,n.click(),window.URL.revokeObjectURL(r),document.body.removeChild(n)}},{key:"render",value:function(){var e=this.props,t=e.id,n=e.style,r=e.className,i=e.elements,o=e.stylesheet,u=e.layout,l=e.pan,c=e.zoom,d=e.panningEnabled,h=e.userPanningEnabled,f=e.minZoom,p=e.maxZoom,v=e.zoomingEnabled,g=e.userZoomingEnabled,y=e.boxSelectionEnabled,m=e.autoungrabify,b=e.autolock,x=e.autounselectify,w=e.generateImage,_=e.responsive;return Object.keys(w).length>0&&(this.props.setProps({generateImage:{}}),this._cy&&this.handleImageGeneration(w.type,w.options,w.action,w.filename)),this.cyResponsiveClass&&this.cyResponsiveClass.toggle(_),a.default.createElement(s.default,{id:t,cy:this.handleCy,className:r,style:n,elements:s.default.normalizeElements(i),stylesheet:o,layout:u,pan:l,zoom:c,panningEnabled:d,userPanningEnabled:h,minZoom:f,maxZoom:p,zoomingEnabled:v,userZoomingEnabled:g,boxSelectionEnabled:y,autoungrabify:m,autolock:b,autounselectify:x})}}]),t}(i.Component);d.propTypes={id:o.default.string,className:o.default.string,style:o.default.object,setProps:o.default.func,elements:o.default.oneOfType([o.default.arrayOf(o.default.shape({group:o.default.string,data:o.default.shape({id:o.default.string,label:o.default.string,parent:o.default.string,source:o.default.string,target:o.default.string}),position:o.default.shape({x:o.default.number,y:o.default.number}),selected:o.default.bool,selectable:o.default.bool,locked:o.default.bool,grabbable:o.default.bool,classes:o.default.string})),o.default.exact({nodes:o.default.array,edges:o.default.array})]),stylesheet:o.default.arrayOf(o.default.exact({selector:o.default.string.isRequired,style:o.default.object.isRequired})),layout:o.default.shape({name:o.default.oneOf(["random","preset","circle","concentric","grid","breadthfirst","cose","close-bilkent","cola","euler","spread","dagre","klay"]).isRequired,fit:o.default.bool,padding:o.default.number,animate:o.default.bool,animationDuration:o.default.number,boundingBox:o.default.object}),pan:o.default.exact({x:o.default.number,y:o.default.number}),zoom:o.default.number,panningEnabled:o.default.bool,userPanningEnabled:o.default.bool,minZoom:o.default.number,maxZoom:o.default.number,zoomingEnabled:o.default.bool,userZoomingEnabled:o.default.bool,boxSelectionEnabled:o.default.bool,autoungrabify:o.default.bool,autolock:o.default.bool,autounselectify:o.default.bool,autoRefreshLayout:o.default.bool,tapNode:o.default.exact({edgesData:o.default.array,renderedPosition:o.default.object,timeStamp:o.default.number,classes:o.default.string,data:o.default.object,grabbable:o.default.bool,group:o.default.string,locked:o.default.bool,position:o.default.object,selectable:o.default.bool,selected:o.default.bool,style:o.default.object,ancestorsData:o.default.oneOfType([o.default.object,o.default.array]),childrenData:o.default.oneOfType([o.default.object,o.default.array]),descendantsData:o.default.oneOfType([o.default.object,o.default.array]),parentData:o.default.oneOfType([o.default.object,o.default.array]),siblingsData:o.default.oneOfType([o.default.object,o.default.array]),isParent:o.default.bool,isChildless:o.default.bool,isChild:o.default.bool,isOrphan:o.default.bool,relativePosition:o.default.object}),tapNodeData:o.default.object,tapEdge:o.default.exact({isLoop:o.default.bool,isSimple:o.default.bool,midpoint:o.default.object,sourceData:o.default.object,sourceEndpoint:o.default.object,targetData:o.default.object,targetEndpoint:o.default.object,timeStamp:o.default.number,classes:o.default.string,data:o.default.object,grabbable:o.default.bool,group:o.default.string,locked:o.default.bool,selectable:o.default.bool,selected:o.default.bool,style:o.default.object}),tapEdgeData:o.default.object,mouseoverNodeData:o.default.object,mouseoverEdgeData:o.default.object,selectedNodeData:o.default.array,selectedEdgeData:o.default.array,generateImage:o.default.shape({type:o.default.oneOf(["svg","png","jpg","jpeg"]),options:o.default.object,action:o.default.oneOf(["store","download","both"]),filename:o.default.string}),imageData:o.default.string,responsive:o.default.bool},d.defaultProps={style:{width:"600px",height:"600px"},layout:{name:"grid"},pan:{x:0,y:0},zoom:1,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:!0,userZoomingEnabled:!0,panningEnabled:!0,userPanningEnabled:!0,boxSelectionEnabled:!1,autolock:!1,autoungrabify:!1,autounselectify:!1,autoRefreshLayout:!0,generateImage:{},imageData:null,responsive:!1,elements:[]},t.default=d},function(e,t,n){"use strict";var r=n(6);function i(){}function a(){}a.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,a,o){if(o!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:i};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){var r,i,a,o;window,e.exports=(r=n(1),i=n(8),a=n(2),o=n(9),function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="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},i=r({}),a=function(e,t){return null==e||null==t};t.hashDiff=function(e,t){return a(e,t)||e.hash()!==t.hash()},t.shallowObjDiff=function(e,t){if(a(e,t)&&(null!=e||null!=t))return!0;if(e===t)return!1;if((void 0===e?"undefined":r(e))!==i||(void 0===t?"undefined":r(t))!==i)return e!==t;var n=Object.keys(e),o=Object.keys(t),s=function(n){return e[n]!==t[n]};return n.length!==o.length||!(!n.some(s)&&!o.some(s))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.get=function(e,t){return null!=e?e[t]:null},t.toJson=function(e){return e},t.forEach=function(e,t){return e.forEach(t)}},function(e,t,n){"use strict";e.exports=n(3).default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=c(n(4)),a=c(n(5)),o=n(6),s=n(8),u=c(n(9)),l=n(10);function c(e){return e&&e.__esModule?e:{default:e}}var d=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.displayName="CytoscapeComponent",n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i.default.Component),r(t,null,[{key:"normalizeElements",value:function(e){if(null!=e.length)return e;var t=e.nodes,n=e.edges;return null==t&&(t=[]),null==n&&(n=[]),t.concat(n)}},{key:"propTypes",get:function(){return o.types}},{key:"defaultProps",get:function(){return s.defaults}}]),r(t,[{key:"componentDidMount",value:function(){var e=a.default.findDOMNode(this),t=this.props,n=t.global,r=t.headless,i=t.styleEnabled,o=t.hideEdgesOnViewport,s=t.textureOnViewport,l=t.motionBlur,c=t.motionBlurOpacity,d=t.wheelSensitivity,h=t.pixelRatio,f=this._cy=new u.default({container:e,headless:r,styleEnabled:i,hideEdgesOnViewport:o,textureOnViewport:s,motionBlur:l,motionBlurOpacity:c,wheelSensitivity:d,pixelRatio:h});n&&(window[n]=f),this.updateCytoscape(null,this.props)}},{key:"updateCytoscape",value:function(e,t){var n=this._cy,r=t.diff,i=t.toJson,a=t.get,o=t.forEach;(0,l.patch)(n,e,t,r,i,a,o),null!=t.cy&&t.cy(n)}},{key:"componentDidUpdate",value:function(e){this.updateCytoscape(e,this.props)}},{key:"componentWillUnmount",value:function(){this._cy.destroy()}},{key:"render",value:function(){var e=this.props,t=e.id,n=e.className,r=e.style;return i.default.createElement("div",{id:t,className:n,style:r})}}]),t}();t.default=d},function(e,t){e.exports=r},function(e,t){e.exports=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.types=void 0;var r=function(e){return e&&e.__esModule?e:{default:e}}(n(7)),i=r.default.string,a=r.default.array,o=r.default.object,s=r.default.number,u=r.default.bool,l=r.default.oneOfType,c=r.default.any,d=r.default.func;t.types={id:i,className:i,style:l([i,o]),elements:l([a,c]),stylesheet:l([a,c]),layout:l([o,c]),pan:l([o,c]),zoom:s,panningEnabled:u,userPanningEnabled:u,minZoom:s,maxZoom:s,zoomingEnabled:u,userZoomingEnabled:u,boxSelectionEnabled:u,autoungrabify:u,autolock:u,autounselectify:u,get:d,toJson:d,diff:d,forEach:d,cy:d,headless:u,styleEnabled:u,hideEdgesOnViewport:u,textureOnViewport:u,motionBlur:u,motionBlurOpacity:s,wheelSensitivity:s,pixelRatio:l([i,o])}},function(e,t){e.exports=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaults=t.pan=t.zoom=t.stylesheet=t.elements=t.identity=void 0;var r=n(0),i=n(1),a=(t.identity=function(e){return e},t.elements=[{data:{id:"a",label:"Example node A"}},{data:{id:"b",label:"Example node B"}},{data:{id:"e",source:"a",target:"b"}}]),o=t.stylesheet=[{selector:"node",style:{label:"data(label)"}}],s=t.zoom=1,u=t.pan={x:0,y:0};t.defaults={diff:r.shallowObjDiff,get:i.get,toJson:i.toJson,forEach:i.forEach,elements:a,stylesheet:o,zoom:s,pan:u}},function(e,t){e.exports=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.patch=void 0;var r=n(1),i=n(0),a=function(e,t,n,i){return n((0,r.get)(e,i),(0,r.get)(t,i))},o=(t.patch=function(e,t,n,c,d,h,f){e.batch((function(){(c===i.shallowObjDiff||a(t,n,c,"elements"))&&l(e,(0,r.get)(t,"elements"),(0,r.get)(n,"elements"),d,h,f,c),a(t,n,c,"stylesheet")&&u(e,(0,r.get)(t,"stylesheet"),(0,r.get)(n,"stylesheet"),d),["zoom","minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","pan","panningEnabled","userPanningEnabled","boxSelectionEnabled","autoungrabify","autolock","autounselectify"].forEach((function(i){a(t,n,c,i)&&o(e,i,(0,r.get)(t,i),(0,r.get)(n,i),d)}))})),a(t,n,c,"layout")&&s(e,(0,r.get)(t,"layout"),(0,r.get)(n,"layout"),d)},function(e,t,n,r,i){e[t](i(r))}),s=function(e,t,n,r){var i=r(n);null!=i&&e.layout(i).run()},u=function(e,t,n,r){var i=e.style();null!=i&&i.fromJson(r(n)).update()},l=function(e,t,n,r,i,a,o){var s=[],u=e.collection(),l=[],d={},h={},f=function(e){return i(i(e,"data"),"id")};a(n,(function(e){var t=f(e);h[t]=e})),null!=t&&a(t,(function(t){var n=f(t);d[n]=t,function(e){return null!=h[e]}(n)||u.merge(e.getElementById(n))})),a(n,(function(e){var t=f(e),n=function(e){return d[e]}(t);!function(e){return null!=d[e]}(t)?s.push(r(e)):l.push({ele1:n,ele2:e})})),u.length>0&&e.remove(u),s.length>0&&e.add(s),l.forEach((function(t){var n=t.ele1,a=t.ele2;return c(e,n,a,r,i,o)}))},c=function(e,t,n,r,i,a){var o=i(i(n,"data"),"id"),s=e.getElementById(o),u={};["data","position","selected","selectable","locked","grabbable","classes"].forEach((function(e){var o=i(n,e);a(o,i(t,e))&&(u[e]=r(o))}));var l=i(n,"scratch");a(l,i(t,"scratch"))&&s.scratch(r(l)),Object.keys(u).length>0&&s.json(u)}}]))},function(e,t){e.exports=window.ReactDOM},function(e,t,n){"use strict";(function(t){function r(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var i=r(n(13)),a=r(n(14));function o(e){return(o="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})(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var h="undefined"==typeof window?null:window,f=h?h.navigator:null,p=(h&&h.document,o("")),v=o({}),g=o((function(){})),y="undefined"==typeof HTMLElement?"undefined":o(HTMLElement),m=function(e){return e&&e.instanceString&&x(e.instanceString)?e.instanceString():null},b=function(e){return null!=e&&o(e)==p},x=function(e){return null!=e&&o(e)===g},w=function(e){return Array.isArray?Array.isArray(e):null!=e&&e instanceof Array},_=function(e){return null!=e&&o(e)===v&&!w(e)&&e.constructor===Object},E=function(e){return null!=e&&o(e)===o(1)&&!isNaN(e)},k=function(e){return"undefined"===y?void 0:null!=e&&e instanceof HTMLElement},C=function(e){return S(e)||P(e)},S=function(e){return"collection"===m(e)&&e._private.single},P=function(e){return"collection"===m(e)&&!e._private.single},T=function(e){return"core"===m(e)},D=function(e){return"stylesheet"===m(e)},B=function(e){return null==e||!(""!==e&&!e.match(/^\s+$/))},M=function(e){return function(e){return null!=e&&o(e)===v}(e)&&x(e.then)},z=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 r,i=this,a=arguments,o=t.apply(i,a),s=n.cache;return(r=s[o])||(r=s[o]=e.apply(i,a)),r};return n.cache={},n},O=z((function(e){return e.replace(/([A-Z])/g,(function(e){return"-"+e.toLowerCase()}))})),I=z((function(e){return e.replace(/(-\w)/g,(function(e){return e[1].toUpperCase()}))})),A=z((function(e,t){return e+t[0].toUpperCase()+t.substring(1)}),(function(e,t){return e+"$"+t})),N=function(e){return B(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},L="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",R=function(e,t){return e<t?-1:e>t?1:0},j=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n<t.length;n++){var r=t[n];if(null!=r)for(var i=Object.keys(r),a=0;a<i.length;a++){var o=i[a];e[o]=r[o]}}return e},V=function(e){return(w(e)?e:null)||function(e){return F[e.toLowerCase()]}(e)||function(e){if((4===e.length||7===e.length)&&"#"===e[0]){var t,n,r;return 4===e.length?(t=parseInt(e[1]+e[1],16),n=parseInt(e[2]+e[2],16),r=parseInt(e[3]+e[3],16)):(t=parseInt(e[1]+e[2],16),n=parseInt(e[3]+e[4],16),r=parseInt(e[5]+e[6],16)),[t,n,r]}}(e)||function(e){var t,n=new RegExp("^rgb[a]?\\(((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%]?)\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%]?)\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%]?)(?:\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))))?\\)$").exec(e);if(n){t=[];for(var r=[],i=1;i<=3;i++){var a=n[i];if("%"===a[a.length-1]&&(r[i]=!0),a=parseFloat(a),r[i]&&(a=a/100*255),a<0||a>255)return;t.push(Math.floor(a))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var u=n[4];if(void 0!==u){if((u=parseFloat(u))<0||u>1)return;t.push(u)}}return t}(e)||function(e){var t,n,r,i,a,o,s,u;function l(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 c=new RegExp("^hsl[a]?\\(((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?)))\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])(?:\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))))?\\)$").exec(e);if(c){if((n=parseInt(c[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(r=parseFloat(c[2]))<0||r>100)return;if(r/=100,(i=parseFloat(c[3]))<0||i>100)return;if(i/=100,void 0!==(a=c[4])&&((a=parseFloat(a))<0||a>1))return;if(0===r)o=s=u=Math.round(255*i);else{var d=i<.5?i*(1+r):i+r-i*r,h=2*i-d;o=Math.round(255*l(h,d,n+1/3)),s=Math.round(255*l(h,d,n)),u=Math.round(255*l(h,d,n-1/3))}t=[o,s,u,a]}return t}(e)},F={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]},q=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(_(a))throw Error("Tried to set map with object key");i<n.length-1?(null==t[a]&&(t[a]={}),t=t[a]):t[a]=e.value}},W=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(_(a))throw Error("Tried to get map with object key");if(null==(t=t[a]))return t}return t},Y=h?h.performance:null,X=Y&&Y.now?function(){return Y.now()}:function(){return Date.now()},H=function(){if(h){if(h.requestAnimationFrame)return function(e){h.requestAnimationFrame(e)};if(h.mozRequestAnimationFrame)return function(e){h.mozRequestAnimationFrame(e)};if(h.webkitRequestAnimationFrame)return function(e){h.webkitRequestAnimationFrame(e)};if(h.msRequestAnimationFrame)return function(e){h.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout((function(){e(X())}),1e3/60)}}(),Z=function(e){return H(e)},U=X,K=65599,G=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261,r=n;!(t=e.next()).done;)r=r*K+t.value|0;return r},$=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261;return t*K+e|0},Q=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5381;return(t<<5)+t+e|0},J=function(e){return 2097152*e[0]+e[1]},ee=function(e,t){return[$(e[0],t[0]),Q(e[1],t[1])]},te=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return G({next:function(){return r<i?n.value=e.charCodeAt(r++):n.done=!0,n}},t)},ne=function(){return re(arguments)},re=function(e){for(var t,n=0;n<e.length;n++){var r=e[n];t=0===n?te(r):te(r,t)}return t},ie=!0,ae=null!=console.warn,oe=null!=console.trace,se=Number.MAX_SAFE_INTEGER||9007199254740991,ue=function(){return!0},le=function(){return!1},ce=function(){return 0},de=function(){},he=function(e){throw new Error(e)},fe=function(e){if(void 0===e)return ie;ie=!!e},pe=function(e){fe()&&(ae?console.warn(e):(console.log(e),oe&&console.trace()))},ve=function(e){return null==e?e:w(e)?e.slice():_(e)?function(e){return j({},e)}(e):e},ge=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},ye={},me=function(){return ye},be=function(e){var t=Object.keys(e);return function(n){for(var r={},i=0;i<t.length;i++){var a=t[i],o=null==n?void 0:n[a];r[a]=void 0===o?e[a]:o}return r}},xe=function(e,t,n){for(var r=e.length;r>=0&&(e[r]!==t||(e.splice(r,1),n));r--);},we=function(e){e.splice(0,e.length)},_e=function(e,t,n){return n&&(t=A(n,t)),e[t]},Ee=function(e,t,n,r){n&&(t=A(n,t)),e[t]=r},ke="undefined"!=typeof Map?Map:function(){function e(){s(this,e),this._obj={}}return l(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}(),Ce=function(){function e(t){if(s(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 l(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}(),Se="undefined"!==("undefined"==typeof Set?"undefined":o(Set))?Set:Ce,Pe=function(e,t,n){if(n=!(void 0!==n&&!n),void 0!==e&&void 0!==t&&T(e)){var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"===r||"edges"===r){this.length=1,this[0]=this;var i=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:r,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"===r:!!t.pannable,active:!1,classes:new Se,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],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==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var u=[];w(t.classes)?u=t.classes:b(t.classes)&&(u=t.classes.split(/\s+/));for(var l=0,c=u.length;l<c;l++){var d=u[l];d&&""!==d&&i.classes.add(d)}this.createEmitter();var h=t.style||t.css;h&&(pe("Setting a `style` bypass at element creation is deprecated"),this.style(h)),(void 0===n||n)&&this.restore()}else he("An element must be of type `nodes` or `edges`; you specified `"+r+"`")}else he("An element must have a core reference and parameters set")},Te=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,n,r){var i;_(t)&&!C(t)&&(t=(i=t).roots||i.root,n=i.visit,r=i.directed),r=2!==arguments.length||x(n)?r:n,n=x(n)?n:function(){};for(var a,o=this._private.cy,s=t=b(t)?this.filter(t):t,u=[],l=[],c={},d={},h={},f=0,p=this.byGroup(),v=p.nodes,g=p.edges,y=0;y<s.length;y++){var m=s[y],w=m.id();m.isNode()&&(u.unshift(m),e.bfs&&(h[w]=!0,l.push(m)),d[w]=0)}var E=function(){var t=e.bfs?u.shift():u.pop(),i=t.id();if(e.dfs){if(h[i])return"continue";h[i]=!0,l.push(t)}var o,s=d[i],p=c[i],y=null!=p?p.source():null,m=null!=p?p.target():null,b=null==p?void 0:t.same(y)?m[0]:y[0];if(!0===(o=n(t,p,b,f++,s)))return a=t,"break";if(!1===o)return"break";for(var x=t.connectedEdges().filter((function(e){return(!r||e.source().same(t))&&g.has(e)})),w=0;w<x.length;w++){var _=x[w],E=_.connectedNodes().filter((function(e){return!e.same(t)&&v.has(e)})),k=E.id();0===E.length||h[k]||(E=E[0],u.push(E),e.bfs&&(h[k]=!0,l.push(E)),c[k]=_,d[k]=d[i]+1)}};e:for(;0!==u.length;){var k=E();switch(k){case"continue":continue;case"break":break e}}for(var S=o.collection(),P=0;P<l.length;P++){var T=l[P],D=c[T.id()];null!=D&&S.merge(D),S.merge(T)}return{path:o.collection(S),found:o.collection(a)}}},De={breadthFirstSearch:Te({bfs:!0}),depthFirstSearch:Te({dfs:!0})};De.bfs=De.breadthFirstSearch,De.dfs=De.depthFirstSearch;var Be=be({root:null,weight:function(e){return 1},directed:!1}),Me={dijkstra:function(e){if(!_(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=Be(e),r=n.root,i=n.weight,o=n.directed,s=this,u=i,l=b(r)?this.filter(r)[0]:r[0],c={},d={},h={},f=this.byGroup(),p=f.nodes,v=f.edges;v.unmergeBy((function(e){return e.isLoop()}));for(var g=function(e){return c[e.id()]},y=function(e,t){c[e.id()]=t,m.updateItem(e)},m=new a((function(e,t){return g(e)-g(t)})),x=0;x<p.length;x++){var w=p[x];c[w.id()]=w.same(l)?0:1/0,m.push(w)}for(var E=function(e,t){for(var n,r=(o?e.edgesTo(t):e.edgesWith(t)).intersect(v),i=1/0,a=0;a<r.length;a++){var s=r[a],l=u(s);(l<i||!n)&&(i=l,n=s)}return{edge:n,dist:i}};m.size()>0;){var k=m.pop(),C=g(k),S=k.id();if(h[S]=C,C!==1/0)for(var P=k.neighborhood().intersect(p),T=0;T<P.length;T++){var D=P[T],B=D.id(),M=E(k,D),z=C+M.dist;z<g(D)&&(y(D,z),d[B]={node:k,edge:M.edge})}}return{distanceTo:function(e){var t=b(e)?p.filter(e)[0]:e[0];return h[t.id()]},pathTo:function(e){var t=b(e)?p.filter(e)[0]:e[0],n=[],r=t,i=r.id();if(t.length>0)for(n.unshift(t);d[i];){var a=d[i];n.unshift(a.edge),n.unshift(a.node),i=(r=a.node).id()}return s.spawn(n)}}}},ze={kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=new Array(i),o=n,s=function(e){for(var t=0;t<a.length;t++){if(a[t].has(e))return t}},u=0;u<i;u++)a[u]=this.spawn(n[u]);for(var l=r.sort((function(t,n){return e(t)-e(n)})),c=0;c<l.length;c++){var d=l[c],h=d.source()[0],f=d.target()[0],p=s(h),v=s(f),g=a[p],y=a[v];p!==v&&(o.merge(d),g.merge(y),a.splice(v,1))}return o}},Oe=be({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),Ie={aStar:function(e){var t=this.cy(),n=Oe(e),r=n.root,i=n.goal,o=n.heuristic,s=n.directed,u=n.weight;r=t.collection(r)[0],i=t.collection(i)[0];var l,c,d=r.id(),h=i.id(),f={},p={},v={},g=new a((function(e,t){return p[e.id()]-p[t.id()]})),y=new Se,m={},b={},x=function(e,t){g.push(e),y.add(t)};x(r,d),f[d]=0,p[d]=o(r);for(var w,_=0;g.size()>0;){if(l=g.pop(),c=l.id(),y.delete(c),_++,c===h){for(var E=[],k=i,C=h,S=b[C];E.unshift(k),null!=S&&E.unshift(S),null!=(k=m[C]);)S=b[C=k.id()];return{found:!0,distance:f[c],path:this.spawn(E),steps:_}}v[c]=!0;for(var P=l._private.edges,T=0;T<P.length;T++){var D=P[T];if(this.hasElementWithId(D.id())&&(!s||D.data("source")===c)){var B=D.source(),M=D.target(),z=B.id()!==c?B:M,O=z.id();if(this.hasElementWithId(O)&&!v[O]){var I=f[c]+u(D);w=O,y.has(w)?I<f[O]&&(f[O]=I,p[O]=I+o(z),m[O]=l):(f[O]=I,p[O]=I+o(z),x(z,O),m[O]=l,b[O]=D)}}}}return{found:!1,distance:void 0,path:void 0,steps:_}}},Ae=be({weight:function(e){return 1},directed:!1}),Ne={floydWarshall:function(e){for(var t=this.cy(),n=Ae(e),r=n.weight,i=n.directed,a=r,o=this.byGroup(),s=o.nodes,u=o.edges,l=s.length,c=l*l,d=function(e){return s.indexOf(e)},h=function(e){return s[e]},f=new Array(c),p=0;p<c;p++){var v=p%l,g=(p-v)/l;f[p]=g===v?0:1/0}for(var y=new Array(c),m=new Array(c),x=0;x<u.length;x++){var w=u[x],_=w.source()[0],E=w.target()[0];if(_!==E){var k=d(_),C=d(E),S=k*l+C,P=a(w);if(f[S]>P&&(f[S]=P,y[S]=C,m[S]=w),!i){var T=C*l+k;!i&&f[T]>P&&(f[T]=P,y[T]=k,m[T]=w)}}}for(var D=0;D<l;D++)for(var B=0;B<l;B++)for(var M=B*l+D,z=0;z<l;z++){var O=B*l+z,I=D*l+z;f[M]+f[I]<f[O]&&(f[O]=f[M]+f[I],y[O]=y[M])}var A=function(e){return d(function(e){return(b(e)?t.filter(e):e)[0]}(e))};return{distance:function(e,t){var n=A(e),r=A(t);return f[n*l+r]},path:function(e,n){var r=A(e),i=A(n),a=h(r);if(r===i)return a.collection();if(null==y[r*l+i])return t.collection();var o,s=t.collection(),u=r;for(s.merge(a);r!==i;)u=r,r=y[r*l+i],o=m[u*l+r],s.merge(o),s.merge(h(r));return s}}}},Le=be({weight:function(e){return 1},directed:!1,root:null}),Re={bellmanFord:function(e){var t=this,n=Le(e),r=n.weight,i=n.directed,a=n.root,o=r,s=this,u=this.cy(),l=this.byGroup(),c=l.edges,d=l.nodes,h=d.length,f=new ke,p=!1;a=u.collection(a)[0],c.unmergeBy((function(e){return e.isLoop()}));for(var v=c.length,g=function(e){var t=f.get(e.id());return t||(t={},f.set(e.id(),t)),t},y=function(e){return(b(e)?u.$(e):e)[0]},m=0;m<h;m++){var x=d[m],w=g(x);x.same(a)?w.dist=0:w.dist=1/0,w.pred=null,w.edge=null}for(var _=!1,E=function(e,t,n,r,i,a){var o=r.dist+a;o<i.dist&&!n.same(r.edge)&&(i.dist=o,i.pred=e,i.edge=n,_=!0)},k=1;k<h;k++){_=!1;for(var C=0;C<v;C++){var S=c[C],P=S.source(),T=S.target(),D=o(S),B=g(P),M=g(T);E(P,0,S,B,M,D),i||E(T,0,S,M,B,D)}if(!_)break}if(_)for(var z=0;z<v;z++){var O=c[z],I=O.source(),A=O.target(),N=o(O),L=g(I).dist,R=g(A).dist;if(L+N<R||!i&&R+N<L){pe("Graph contains a negative weight cycle for Bellman-Ford"),p=!0;break}}return{distanceTo:function(e){return g(y(e)).dist},pathTo:function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a,r=y(e),i=[],o=r;;){if(null==o)return t.spawn();var u=g(o),l=u.edge,c=u.pred;if(i.unshift(o[0]),o.same(n)&&i.length>0)break;null!=l&&i.unshift(l),o=c}return s.spawn(i)},hasNegativeWeightCycle:p,negativeWeightCycles:[]}}},je=Math.sqrt(2),Ve=function(e,t,n){0===n.length&&he("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],i=r[1],a=r[2],o=t[i],s=t[a],u=n,l=u.length-1;l>=0;l--){var c=u[l],d=c[1],h=c[2];(t[d]===o&&t[h]===s||t[d]===s&&t[h]===o)&&u.splice(l,1)}for(var f=0;f<u.length;f++){var p=u[f];p[1]===s?(u[f]=p.slice(),u[f][1]=o):p[2]===s&&(u[f]=p.slice(),u[f][2]=o)}for(var v=0;v<t.length;v++)t[v]===s&&(t[v]=o);return u},Fe=function(e,t,n,r){for(;n>r;){var i=Math.floor(Math.random()*t.length);t=Ve(i,e,t),n--}return t},qe={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy((function(e){return e.isLoop()}));var i=n.length,a=r.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/je);if(!(i<2)){for(var u=[],l=0;l<a;l++){var c=r[l];u.push([l,n.indexOf(c.source()),n.indexOf(c.target())])}for(var d=1/0,h=[],f=new Array(i),p=new Array(i),v=new Array(i),g=function(e,t){for(var n=0;n<i;n++)t[n]=e[n]},y=0;y<=o;y++){for(var m=0;m<i;m++)p[m]=m;var b=Fe(p,u.slice(),i,s),x=b.slice();g(p,v);var w=Fe(p,b,s,2),_=Fe(v,x,s,2);w.length<=_.length&&w.length<d?(d=w.length,h=w,g(p,f)):_.length<=w.length&&_.length<d&&(d=_.length,h=_,g(v,f))}for(var E=this.spawn(h.map((function(e){return r[e[0]]}))),k=this.spawn(),C=this.spawn(),S=f[0],P=0;P<f.length;P++){var T=f[P],D=n[P];T===S?k.merge(D):C.merge(D)}var B=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},M=[B(k),B(C)];return{cut:E,components:M,partition1:k,partition2:C}}he("At least 2 nodes are required for Karger-Stein algorithm")}},We=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},Ye=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},Xe=function(e){return{x:e[0],y:e[1]}},He=function(e,t){return Math.atan2(t,e)-Math.PI/2},Ze=Math.log2||function(e){return Math.log(e)/Math.log(2)},Ue=function(e){return e>0?1:e<0?-1:0},Ke=function(e,t){return Math.sqrt(Ge(e,t))},Ge=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},$e=function(e){for(var t=e.length,n=0,r=0;r<t;r++)n+=e[r];for(var i=0;i<t;i++)e[i]=e[i]/n;return e},Qe=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},Je=function(e,t,n,r){return{x:Qe(e.x,t.x,n.x,r),y:Qe(e.y,t.y,n.y,r)}},et=function(e,t,n){return Math.max(e,Math.min(n,t))},tt=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}}},nt=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},rt=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},it=function(e){var t,n,r,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===a.length)t=n=r=i=a[0];else if(2===a.length)t=r=a[0],i=n=a[1];else if(4===a.length){var o=d(a,4);t=o[0],n=o[1],r=o[2],i=o[3]}return e.x1-=i,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},at=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},ot=function(e,t){e.x1+=t.x,e.x2+=t.x,e.y1+=t.y,e.y2+=t.y},st=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)))))))},ut=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},lt=function(e,t){return ut(e,t.x1,t.y1)&&ut(e,t.x2,t.y2)},ct=function(e,t,n,r,i,a,o){var s,u=Tt(i,a),l=i/2,c=a/2,d=r-c-o;if((s=_t(e,t,n,r,n-l+u-o,d,n+l-u+o,d,!1)).length>0)return s;var h=n+l+o;if((s=_t(e,t,n,r,h,r-c+u-o,h,r+c-u+o,!1)).length>0)return s;var f=r+c+o;if((s=_t(e,t,n,r,n-l+u-o,f,n+l-u+o,f,!1)).length>0)return s;var p,v=n-l-o;if((s=_t(e,t,n,r,v,r-c+u-o,v,r+c-u+o,!1)).length>0)return s;var g=n-l+u,y=r-c+u;if((p=xt(e,t,n,r,g,y,u+o)).length>0&&p[0]<=g&&p[1]<=y)return[p[0],p[1]];var m=n+l-u,b=r-c+u;if((p=xt(e,t,n,r,m,b,u+o)).length>0&&p[0]>=m&&p[1]<=b)return[p[0],p[1]];var x=n+l-u,w=r+c-u;if((p=xt(e,t,n,r,x,w,u+o)).length>0&&p[0]>=x&&p[1]>=w)return[p[0],p[1]];var _=n-l+u,E=r+c-u;return(p=xt(e,t,n,r,_,E,u+o)).length>0&&p[0]<=_&&p[1]>=E?[p[0],p[1]]:[]},dt=function(e,t,n,r,i,a,o){var s=o,u=Math.min(n,i),l=Math.max(n,i),c=Math.min(r,a),d=Math.max(r,a);return u-s<=e&&e<=l+s&&c-s<=t&&t<=d+s},ht=function(e,t,n,r,i,a,o,s,u){var l=Math.min(n,o,i)-u,c=Math.max(n,o,i)+u,d=Math.min(r,s,a)-u,h=Math.max(r,s,a)+u;return!(e<l||e>c||t<d||t>h)},ft=function(e,t,n,r,i,a,o,s){var u=[];!function(e,t,n,r,i){var a,o,s,u,l,c,d,h;0===e&&(e=1e-5),s=-27*(r/=e)+(t/=e)*(9*(n/=e)-t*t*2),a=(o=(3*n-t*t)/9)*o*o+(s/=54)*s,i[1]=0,d=t/3,a>0?(l=(l=s+Math.sqrt(a))<0?-Math.pow(-l,1/3):Math.pow(l,1/3),c=(c=s-Math.sqrt(a))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-d+l+c,d+=(l+c)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-c+l)/2,i[3]=d,i[5]=-d):(i[5]=i[3]=0,0===a?(h=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=2*h-d,i[4]=i[2]=-(h+d)):(u=(o=-o)*o*o,u=Math.acos(s/Math.sqrt(u)),h=2*Math.sqrt(o),i[0]=-d+h*Math.cos(u/3),i[2]=-d+h*Math.cos((u+2*Math.PI)/3),i[4]=-d+h*Math.cos((u+4*Math.PI)/3)))}(1*n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,u);for(var l=[],c=0;c<6;c+=2)Math.abs(u[c+1])<1e-7&&u[c]>=0&&u[c]<=1&&l.push(u[c]);l.push(1),l.push(0);for(var d,h,f,p=-1,v=0;v<l.length;v++)d=Math.pow(1-l[v],2)*n+2*(1-l[v])*l[v]*i+l[v]*l[v]*o,h=Math.pow(1-l[v],2)*r+2*(1-l[v])*l[v]*a+l[v]*l[v]*s,f=Math.pow(d-e,2)+Math.pow(h-t,2),p>=0?f<p&&(p=f):p=f;return p},pt=function(e,t,n,r,i,a){var o=[e-n,t-r],s=[i-n,a-r],u=s[0]*s[0]+s[1]*s[1],l=o[0]*o[0]+o[1]*o[1],c=o[0]*s[0]+o[1]*s[1],d=c*c/u;return c<0?l:d>u?(e-i)*(e-i)+(t-a)*(t-a):l-d},vt=function(e,t,n){for(var r,i,a,o,s=0,u=0;u<n.length/2;u++)if(r=n[2*u],i=n[2*u+1],u+1<n.length/2?(a=n[2*(u+1)],o=n[2*(u+1)+1]):(a=n[2*(u+1-n.length/2)],o=n[2*(u+1-n.length/2)+1]),r==e&&a==e);else{if(!(r>=e&&e>=a||r<=e&&e<=a))continue;(e-r)/(a-r)*(o-i)+i>t&&s++}return s%2!=0},gt=function(e,t,n,r,i,a,o,s,u){var l,c=new Array(n.length);null!=s[0]?(l=Math.atan(s[1]/s[0]),s[0]<0?l+=Math.PI/2:l=-l-Math.PI/2):l=s;for(var d,h=Math.cos(-l),f=Math.sin(-l),p=0;p<c.length/2;p++)c[2*p]=a/2*(n[2*p]*h-n[2*p+1]*f),c[2*p+1]=o/2*(n[2*p+1]*h+n[2*p]*f),c[2*p]+=r,c[2*p+1]+=i;if(u>0){var v=mt(c,-u);d=yt(v)}else d=c;return vt(e,t,d)},yt=function(e){for(var t,n,r,i,a,o,s,u,l=new Array(e.length/2),c=0;c<e.length/4;c++){t=e[4*c],n=e[4*c+1],r=e[4*c+2],i=e[4*c+3],c<e.length/4-1?(a=e[4*(c+1)],o=e[4*(c+1)+1],s=e[4*(c+1)+2],u=e[4*(c+1)+3]):(a=e[0],o=e[1],s=e[2],u=e[3]);var d=_t(t,n,r,i,a,o,s,u,!0);l[2*c]=d[0],l[2*c+1]=d[1]}return l},mt=function(e,t){for(var n,r,i,a,o=new Array(2*e.length),s=0;s<e.length/2;s++){n=e[2*s],r=e[2*s+1],s<e.length/2-1?(i=e[2*(s+1)],a=e[2*(s+1)+1]):(i=e[0],a=e[1]);var u=a-r,l=-(i-n),c=Math.sqrt(u*u+l*l),d=u/c,h=l/c;o[4*s]=n+d*t,o[4*s+1]=r+h*t,o[4*s+2]=i+d*t,o[4*s+3]=a+h*t}return o},bt=function(e,t,n,r,i,a,o){return e-=i,t-=a,(e/=n/2+o)*e+(t/=r/2+o)*t<=1},xt=function(e,t,n,r,i,a,o){var s=[n-e,r-t],u=[e-i,t-a],l=s[0]*s[0]+s[1]*s[1],c=2*(u[0]*s[0]+u[1]*s[1]),d=c*c-4*l*(u[0]*u[0]+u[1]*u[1]-o*o);if(d<0)return[];var h=(-c+Math.sqrt(d))/(2*l),f=(-c-Math.sqrt(d))/(2*l),p=Math.min(h,f),v=Math.max(h,f),g=[];if(p>=0&&p<=1&&g.push(p),v>=0&&v<=1&&g.push(v),0===g.length)return[];var y=g[0]*s[0]+e,m=g[0]*s[1]+t;return g.length>1?g[0]==g[1]?[y,m]:[y,m,g[1]*s[0]+e,g[1]*s[1]+t]:[y,m]},wt=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},_t=function(e,t,n,r,i,a,o,s,u){var l=e-i,c=n-e,d=o-i,h=t-a,f=r-t,p=s-a,v=d*h-p*l,g=c*h-f*l,y=p*c-d*f;if(0!==y){var m=v/y,b=g/y;return-.001<=m&&m<=1.001&&-.001<=b&&b<=1.001||u?[e+m*c,t+m*f]:[]}return 0===v||0===g?wt(e,n,o)===o?[o,s]:wt(e,n,i)===i?[i,a]:wt(i,o,n)===n?[n,r]:[]:[]},Et=function(e,t,n,r,i,a,o,s){var u,l,c,d,h,f,p=[],v=new Array(n.length),g=!0;if(null==a&&(g=!1),g){for(var y=0;y<v.length/2;y++)v[2*y]=n[2*y]*a+r,v[2*y+1]=n[2*y+1]*o+i;if(s>0){var m=mt(v,-s);l=yt(m)}else l=v}else l=n;for(var b=0;b<l.length/2;b++)c=l[2*b],d=l[2*b+1],b<l.length/2-1?(h=l[2*(b+1)],f=l[2*(b+1)+1]):(h=l[0],f=l[1]),0!==(u=_t(e,t,r,i,c,d,h,f)).length&&p.push(u[0],u[1]);return p},kt=function(e,t,n){var r=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(r[0]*r[0]+r[1]*r[1]),a=(i-n)/i;return a<0&&(a=1e-5),[t[0]+a*r[0],t[1]+a*r[1]]},Ct=function(e,t){var n=Pt(e,t);return n=St(n)},St=function(e){for(var t,n,r=e.length/2,i=1/0,a=1/0,o=-1/0,s=-1/0,u=0;u<r;u++)t=e[2*u],n=e[2*u+1],i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);for(var l=2/(o-i),c=2/(s-a),d=0;d<r;d++)t=e[2*d]=e[2*d]*l,n=e[2*d+1]=e[2*d+1]*c,i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);if(a<-1)for(var h=0;h<r;h++)n=e[2*h+1]=e[2*h+1]+(-1-a);return e},Pt=function(e,t){var n=1/e*2*Math.PI,r=e%2==0?Math.PI/2+n/2:Math.PI/2;r+=t;for(var i,a=new Array(2*e),o=0;o<e;o++)i=o*n+r,a[2*o]=Math.cos(i),a[2*o+1]=Math.sin(-i);return a},Tt=function(e,t){return Math.min(e/4,t/4,8)},Dt=function(e,t){return Math.min(e/10,t/10,8)},Bt=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}},Mt=be({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),zt={pageRank:function(e){for(var t=Mt(e),n=t.dampingFactor,r=t.precision,i=t.iterations,a=t.weight,o=this._private.cy,s=this.byGroup(),u=s.nodes,l=s.edges,c=u.length,d=c*c,h=l.length,f=new Array(d),p=new Array(c),v=(1-n)/c,g=0;g<c;g++){for(var y=0;y<c;y++){f[g*c+y]=0}p[g]=0}for(var m=0;m<h;m++){var b=l[m],x=b.data("source"),w=b.data("target");if(x!==w){var _=u.indexOfId(x),E=u.indexOfId(w),k=a(b);f[E*c+_]+=k,p[_]+=k}}for(var C=1/c+v,S=0;S<c;S++)if(0===p[S])for(var P=0;P<c;P++){f[P*c+S]=C}else for(var T=0;T<c;T++){var D=T*c+S;f[D]=f[D]/p[S]+v}for(var B,M=new Array(c),z=new Array(c),O=0;O<c;O++)M[O]=1;for(var I=0;I<i;I++){for(var A=0;A<c;A++)z[A]=0;for(var N=0;N<c;N++)for(var L=0;L<c;L++){var R=N*c+L;z[N]+=f[R]*M[L]}$e(z),B=M,M=z,z=B;for(var j=0,V=0;V<c;V++){var F=B[V]-M[V];j+=F*F}if(j<r)break}return{rank:function(e){return e=o.collection(e)[0],M[u.indexOf(e)]}}}},Ot=be({root:null,weight:function(e){return 1},directed:!1,alpha:0}),It={degreeCentralityNormalized:function(e){e=Ot(e);var t=this.cy(),n=this.nodes(),r=n.length;if(e.directed){for(var i={},a={},o=0,s=0,u=0;u<r;u++){var l=n[u],c=l.id();e.root=l;var d=this.degreeCentrality(e);o<d.indegree&&(o=d.indegree),s<d.outdegree&&(s=d.outdegree),i[c]=d.indegree,a[c]=d.outdegree}return{indegree:function(e){return 0==o?0:(b(e)&&(e=t.filter(e)),i[e.id()]/o)},outdegree:function(e){return 0===s?0:(b(e)&&(e=t.filter(e)),a[e.id()]/s)}}}for(var h={},f=0,p=0;p<r;p++){var v=n[p];e.root=v;var g=this.degreeCentrality(e);f<g.degree&&(f=g.degree),h[v.id()]=g.degree}return{degree:function(e){return 0===f?0:(b(e)&&(e=t.filter(e)),h[e.id()]/f)}}},degreeCentrality:function(e){e=Ot(e);var t=this.cy(),n=this,r=e,i=r.root,a=r.weight,o=r.directed,s=r.alpha;if(i=t.collection(i)[0],o){for(var u=i.connectedEdges(),l=u.filter((function(e){return e.target().same(i)&&n.has(e)})),c=u.filter((function(e){return e.source().same(i)&&n.has(e)})),d=l.length,h=c.length,f=0,p=0,v=0;v<l.length;v++)f+=a(l[v]);for(var g=0;g<c.length;g++)p+=a(c[g]);return{indegree:Math.pow(d,1-s)*Math.pow(f,s),outdegree:Math.pow(h,1-s)*Math.pow(p,s)}}for(var y=i.connectedEdges().intersection(n),m=y.length,b=0,x=0;x<y.length;x++)b+=a(y[x]);return{degree:Math.pow(m,1-s)*Math.pow(b,s)}}};It.dc=It.degreeCentrality,It.dcn=It.degreeCentralityNormalised=It.degreeCentralityNormalized;var At=be({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Nt={closenessCentralityNormalized:function(e){for(var t=At(e),n=t.harmonic,r=t.weight,i=t.directed,a=this.cy(),o={},s=0,u=this.nodes(),l=this.floydWarshall({weight:r,directed:i}),c=0;c<u.length;c++){for(var d=0,h=u[c],f=0;f<u.length;f++)if(c!==f){var p=l.distance(h,u[f]);d+=n?1/p:p}n||(d=1/d),s<d&&(s=d),o[h.id()]=d}return{closeness:function(e){return 0==s?0:(e=b(e)?a.filter(e)[0].id():e.id(),o[e]/s)}}},closenessCentrality:function(e){var t=At(e),n=t.root,r=t.weight,i=t.directed,a=t.harmonic;n=this.filter(n)[0];for(var o=this.dijkstra({root:n,weight:r,directed:i}),s=0,u=this.nodes(),l=0;l<u.length;l++){var c=u[l];if(!c.same(n)){var d=o.distanceTo(c);s+=a?1/d:d}}return a?s:1/s}};Nt.cc=Nt.closenessCentrality,Nt.ccn=Nt.closenessCentralityNormalised=Nt.closenessCentralityNormalized;var Lt=be({weight:null,directed:!1}),Rt={betweennessCentrality:function(e){for(var t=Lt(e),n=t.directed,r=t.weight,i=null!=r,o=this.cy(),s=this.nodes(),u={},l={},c=0,d=function(e,t){l[e]=t,t>c&&(c=t)},h=function(e){return l[e]},f=0;f<s.length;f++){var p=s[f],v=p.id();u[v]=n?p.outgoers().nodes():p.openNeighborhood().nodes(),d(v,0)}for(var g=function(e){for(var t=s[e].id(),n=[],l={},c={},f={},p=new a((function(e,t){return f[e]-f[t]})),v=0;v<s.length;v++){var g=s[v].id();l[g]=[],c[g]=0,f[g]=1/0}for(c[t]=1,f[t]=0,p.push(t);!p.empty();){var y=p.pop();if(n.push(y),i)for(var m=0;m<u[y].length;m++){var b=u[y][m],x=o.getElementById(y),w=void 0;w=x.edgesTo(b).length>0?x.edgesTo(b)[0]:b.edgesTo(x)[0];var _=r(w);b=b.id(),f[b]>f[y]+_&&(f[b]=f[y]+_,p.nodes.indexOf(b)<0?p.push(b):p.updateItem(b),c[b]=0,l[b]=[]),f[b]==f[y]+_&&(c[b]=c[b]+c[y],l[b].push(y))}else for(var E=0;E<u[y].length;E++){var k=u[y][E].id();f[k]==1/0&&(p.push(k),f[k]=f[y]+1),f[k]==f[y]+1&&(c[k]=c[k]+c[y],l[k].push(y))}}for(var C={},S=0;S<s.length;S++)C[s[S].id()]=0;for(;n.length>0;)for(var P=n.pop(),T=0;T<l[P].length;T++){var D=l[P][T];C[D]=C[D]+c[D]/c[P]*(1+C[P]),P!=s[e].id()&&d(P,h(P)+C[P])}},y=0;y<s.length;y++)g(y);var m={betweenness:function(e){var t=o.collection(e).id();return h(t)},betweennessNormalized:function(e){if(0==c)return 0;var t=o.collection(e).id();return h(t)/c}};return m.betweennessNormalised=m.betweennessNormalized,m}};Rt.bc=Rt.betweennessCentrality;var jt=be({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),Vt=function(e,t){for(var n=0,r=0;r<t.length;r++)n+=t[r](e);return n},Ft=function(e,t){for(var n,r=0;r<t;r++){n=0;for(var i=0;i<t;i++)n+=e[i*t+r];for(var a=0;a<t;a++)e[a*t+r]=e[a*t+r]/n}},qt=function(e,t,n){for(var r=new Array(n*n),i=0;i<n;i++){for(var a=0;a<n;a++)r[i*n+a]=0;for(var o=0;o<n;o++)for(var s=0;s<n;s++)r[i*n+s]+=e[i*n+o]*t[o*n+s]}return r},Wt=function(e,t,n){for(var r=e.slice(0),i=1;i<n;i++)e=qt(e,r,t);return e},Yt=function(e,t,n){for(var r=new Array(t*t),i=0;i<t*t;i++)r[i]=Math.pow(e[i],n);return Ft(r,t),r},Xt=function(e,t,n,r){for(var i=0;i<n;i++){if(Math.round(e[i]*Math.pow(10,r))/Math.pow(10,r)!==Math.round(t[i]*Math.pow(10,r))/Math.pow(10,r))return!1}return!0},Ht=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},Zt=function(e){for(var t=this.nodes(),n=this.edges(),r=this.cy(),i=function(e){return jt(e)}(e),a={},o=0;o<t.length;o++)a[t[o].id()]=o;for(var s,u=t.length,l=u*u,c=new Array(l),d=0;d<l;d++)c[d]=0;for(var h=0;h<n.length;h++){var f=n[h],p=a[f.source().id()],v=a[f.target().id()],g=Vt(f,i.attributes);c[p*u+v]+=g,c[v*u+p]+=g}!function(e,t,n){for(var r=0;r<t;r++)e[r*t+r]=n}(c,u,i.multFactor),Ft(c,u);for(var y=!0,m=0;y&&m<i.maxIterations;)y=!1,s=Wt(c,u,i.expandFactor),c=Yt(s,u,i.inflateFactor),Xt(c,s,l,4)||(y=!0),m++;var b=function(e,t,n,r){for(var i=[],a=0;a<t;a++){for(var o=[],s=0;s<t;s++)Math.round(1e3*e[a*t+s])/1e3>0&&o.push(n[s]);0!==o.length&&i.push(r.collection(o))}return i}(c,u,t,r);return b=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&Ht(e[t],e[n])&&e.splice(n,1);return e}(b)},Ut={markovClustering:Zt,mcl:Zt},Kt=function(e){return e},Gt=function(e,t){return Math.abs(t-e)},$t=function(e,t,n){return e+Gt(t,n)},Qt=function(e,t,n){return e+Math.pow(n-t,2)},Jt=function(e){return Math.sqrt(e)},en=function(e,t,n){return Math.max(e,Gt(t,n))},tn=function(e,t,n,r,i){for(var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:Kt,o=r,s=0;s<e;s++)o=i(o,t(s),n(s));return a(o)},nn={euclidean:function(e,t,n){return e>=2?tn(e,t,n,0,Qt,Jt):tn(e,t,n,0,$t)},squaredEuclidean:function(e,t,n){return tn(e,t,n,0,Qt)},manhattan:function(e,t,n){return tn(e,t,n,0,$t)},max:function(e,t,n){return tn(e,t,n,-1/0,en)}};function rn(e,t,n,r,i,a){var o;return o=x(e)?e:nn[e]||nn.euclidean,0===t&&x(e)?o(i,a):o(t,n,r,i,a)}nn["squared-euclidean"]=nn.squaredEuclidean,nn.squaredeuclidean=nn.squaredEuclidean;var an=be({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),on=function(e){return an(e)},sn=function(e,t,n,r,i){var a="kMedoids"!==i?function(e){return n[e]}:function(e){return r[e](n)},o=n,s=t;return rn(e,r.length,a,(function(e){return r[e](t)}),o,s)},un=function(e,t,n){for(var r=n.length,i=new Array(r),a=new Array(r),o=new Array(t),s=null,u=0;u<r;u++)i[u]=e.min(n[u]).value,a[u]=e.max(n[u]).value;for(var l=0;l<t;l++){s=[];for(var c=0;c<r;c++)s[c]=Math.random()*(a[c]-i[c])+i[c];o[l]=s}return o},ln=function(e,t,n,r,i){for(var a=1/0,o=0,s=0;s<t.length;s++){var u=sn(n,e,t[s],r,i);u<a&&(a=u,o=s)}return o},cn=function(e,t,n){for(var r=[],i=null,a=0;a<t.length;a++)n[(i=t[a]).id()]===e&&r.push(i);return r},dn=function(e,t,n){for(var r=0;r<e.length;r++)for(var i=0;i<e[r].length;i++){if(Math.abs(e[r][i]-t[r][i])>n)return!1}return!0},hn=function(e,t,n){for(var r=0;r<n;r++)if(e===t[r])return!0;return!1},fn=function(e,t){var n=new Array(t);if(e.length<50)for(var r=0;r<t;r++){for(var i=e[Math.floor(Math.random()*e.length)];hn(i,n,r);)i=e[Math.floor(Math.random()*e.length)];n[r]=i}else for(var a=0;a<t;a++)n[a]=e[Math.floor(Math.random()*e.length)];return n},pn=function(e,t,n){for(var r=0,i=0;i<t.length;i++)r+=sn("manhattan",t[i],e,n,"kMedoids");return r},vn=function(e,t,n,r,i){for(var a,o,s=0;s<t.length;s++)for(var u=0;u<e.length;u++)r[s][u]=Math.pow(n[s][u],i.m);for(var l=0;l<e.length;l++)for(var c=0;c<i.attributes.length;c++){a=0,o=0;for(var d=0;d<t.length;d++)a+=r[d][l]*i.attributes[c](t[d]),o+=r[d][l];e[l][c]=a/o}},gn=function(e,t,n,r,i){for(var a=0;a<e.length;a++)t[a]=e[a].slice();for(var o,s,u,l=2/(i.m-1),c=0;c<n.length;c++)for(var d=0;d<r.length;d++){o=0;for(var h=0;h<n.length;h++)s=sn(i.distance,r[d],n[c],i.attributes,"cmeans"),u=sn(i.distance,r[d],n[h],i.attributes,"cmeans"),o+=Math.pow(s/u,l);e[d][c]=1/o}},yn=function(e){var t,n,r,i,a=this.cy(),o=this.nodes(),s=on(e);r=new Array(o.length);for(var u=0;u<o.length;u++)r[u]=new Array(s.k);n=new Array(o.length);for(var l=0;l<o.length;l++)n[l]=new Array(s.k);for(var c=0;c<o.length;c++){for(var d=0,h=0;h<s.k;h++)n[c][h]=Math.random(),d+=n[c][h];for(var f=0;f<s.k;f++)n[c][f]=n[c][f]/d}t=new Array(s.k);for(var p=0;p<s.k;p++)t[p]=new Array(s.attributes.length);i=new Array(o.length);for(var v=0;v<o.length;v++)i[v]=new Array(s.k);for(var g=!0,y=0;g&&y<s.maxIterations;)g=!1,vn(t,o,n,i,s),gn(n,r,t,o,s),dn(n,r,s.sensitivityThreshold)||(g=!0),y++;return{clusters:function(e,t,n,r){for(var i,a,o=new Array(n.k),s=0;s<o.length;s++)o[s]=[];for(var u=0;u<t.length;u++){i=-1/0,a=-1;for(var l=0;l<t[0].length;l++)t[u][l]>i&&(i=t[u][l],a=l);o[a].push(e[u])}for(var c=0;c<o.length;c++)o[c]=r.collection(o[c]);return o}(o,n,s,a),degreeOfMembership:n}},mn={kMeans:function(e){var t,n=this.cy(),r=this.nodes(),i=null,a=on(e),s=new Array(a.k),u={};t=a.testMode?"number"==typeof a.testCentroids?un(r,a.k,a.attributes):"object"===o(a.testCentroids)?a.testCentroids:un(r,a.k,a.attributes):un(r,a.k,a.attributes);for(var l,c,d,h=!0,f=0;h&&f<a.maxIterations;){for(var p=0;p<r.length;p++)u[(i=r[p]).id()]=ln(i,t,a.distance,a.attributes,"kMeans");h=!1;for(var v=0;v<a.k;v++){var g=cn(v,r,u);if(0!==g.length){for(var y=a.attributes.length,m=t[v],b=new Array(y),x=new Array(y),w=0;w<y;w++){x[w]=0;for(var _=0;_<g.length;_++)i=g[_],x[w]+=a.attributes[w](i);b[w]=x[w]/g.length,l=b[w],c=m[w],d=a.sensitivityThreshold,Math.abs(c-l)<=d||(h=!0)}t[v]=b,s[v]=n.collection(g)}}f++}return s},kMedoids:function(e){var t,n,r=this.cy(),i=this.nodes(),a=null,s=on(e),u=new Array(s.k),l={},c=new Array(s.k);s.testMode?"number"==typeof s.testCentroids||(t="object"===o(s.testCentroids)?s.testCentroids:fn(i,s.k)):t=fn(i,s.k);for(var d=!0,h=0;d&&h<s.maxIterations;){for(var f=0;f<i.length;f++)l[(a=i[f]).id()]=ln(a,t,s.distance,s.attributes,"kMedoids");d=!1;for(var p=0;p<t.length;p++){var v=cn(p,i,l);if(0!==v.length){c[p]=pn(t[p],v,s.attributes);for(var g=0;g<v.length;g++)(n=pn(v[g],v,s.attributes))<c[p]&&(c[p]=n,t[p]=v[g],d=!0);u[p]=r.collection(v)}}h++}return u},fuzzyCMeans:yn,fcm:yn},bn=be({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),xn={single:"min",complete:"max"},wn=function(e,t,n,r,i){for(var a,o=0,s=1/0,u=i.attributes,l=function(e,t){return rn(i.distance,u.length,(function(t){return u[t](e)}),(function(e){return u[e](t)}),e,t)},c=0;c<e.length;c++){var d=e[c].key,h=n[d][r[d]];h<s&&(o=d,s=h)}if("threshold"===i.mode&&s>=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var f,p=t[o],v=t[r[o]];f="dendrogram"===i.mode?{left:p,right:v,key:p.key}:{value:p.value.concat(v.value),key:p.key},e[p.index]=f,e.splice(v.index,1),t[p.key]=f;for(var g=0;g<e.length;g++){var y=e[g];p.key===y.key?a=1/0:"min"===i.linkage?(a=n[p.key][y.key],n[p.key][y.key]>n[v.key][y.key]&&(a=n[v.key][y.key])):"max"===i.linkage?(a=n[p.key][y.key],n[p.key][y.key]<n[v.key][y.key]&&(a=n[v.key][y.key])):a="mean"===i.linkage?(n[p.key][y.key]*p.size+n[v.key][y.key]*v.size)/(p.size+v.size):"dendrogram"===i.mode?l(y.value,p.value):l(y.value[0],p.value[0]),n[p.key][y.key]=n[y.key][p.key]=a}for(var m=0;m<e.length;m++){var b=e[m].key;if(r[b]===p.key||r[b]===v.key){for(var x=b,w=0;w<e.length;w++){var _=e[w].key;n[b][_]<n[b][x]&&(x=_)}r[b]=x}e[m].index=m}return p.key=v.key=p.index=v.index=null,!0},_n=function e(t,n,r){t&&(t.value?n.push(t.value):(t.left&&e(t.left,n),t.right&&e(t.right,n)))},En=function(e){for(var t=this.cy(),n=this.nodes(),r=function(e){var t=bn(e),n=xn[t.linkage];return null!=n&&(t.linkage=n),t}(e),i=r.attributes,a=function(e,t){return rn(r.distance,i.length,(function(t){return i[t](e)}),(function(e){return i[e](t)}),e,t)},o=[],s=[],u=[],l=[],c=0;c<n.length;c++){var d={value:"dendrogram"===r.mode?n[c]:[n[c]],key:c,index:c};o[c]=d,l[c]=d,s[c]=[],u[c]=0}for(var h=0;h<o.length;h++)for(var f=0;f<=h;f++){var p=void 0;p="dendrogram"===r.mode?h===f?1/0:a(o[h].value,o[f].value):h===f?1/0:a(o[h].value[0],o[f].value[0]),s[h][f]=p,s[f][h]=p,p<s[h][u[h]]&&(u[h]=f)}for(var v,g=wn(o,l,s,u,r);g;)g=wn(o,l,s,u,r);return"dendrogram"===r.mode?(v=function e(t,n,r){if(!t)return[];var i=[],a=[],o=[];return 0===n?(t.left&&_n(t.left,i),t.right&&_n(t.right,a),o=i.concat(a),[r.collection(o)]):1===n?t.value?[r.collection(t.value)]:(t.left&&_n(t.left,i),t.right&&_n(t.right,a),[r.collection(i),r.collection(a)]):t.value?[r.collection(t.value)]:(t.left&&(i=e(t.left,n-1,r)),t.right&&(a=e(t.right,n-1,r)),i.concat(a))}(o[0],r.dendrogramDepth,t),r.addDendrogram&&function e(t,n){if(!t)return"";if(t.left&&t.right){var r=e(t.left,n),i=e(t.right,n),a=n.add({group:"nodes",data:{id:r+","+i}});return n.add({group:"edges",data:{source:r,target:a.id()}}),n.add({group:"edges",data:{source:i,target:a.id()}}),a.id()}return t.value?t.value.id():void 0}(o[0],t)):(v=new Array(o.length),o.forEach((function(e,n){e.key=e.index=null,v[n]=t.collection(e.value)}))),v},kn={hierarchicalClustering:En,hca:En},Cn=be({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),Sn=function(e,t,n,r){var i=function(e,t){return r[t](e)};return-rn(e,r.length,(function(e){return i(t,e)}),(function(e){return i(n,e)}),t,n)},Pn=function(e,t){return"median"===t?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];r?e=e.slice(t,n):(n<e.length&&e.splice(n,e.length-n),t>0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var u=e[s];a?isFinite(u)||(e[s]=-1/0,o++):e.splice(s,1)}i&&e.sort((function(e,t){return e-t}));var l=e.length,c=Math.floor(l/2);return l%2!=0?e[c+1+o]:(e[c-1+o]+e[c+o])/2}(e):"mean"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,i=0,a=t;a<n;a++){var o=e[a];isFinite(o)&&(r+=o,i++)}return r/i}(e):"min"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.min(a,r))}return r}(e):"max"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.max(a,r))}return r}(e):t},Tn=function(e,t,n){for(var r=[],i=0;i<e;i++){for(var a=-1,o=-1/0,s=0;s<n.length;s++){var u=n[s];t[i*e+u]>o&&(a=u,o=t[i*e+u])}a>0&&r.push(a)}for(var l=0;l<n.length;l++)r[n[l]]=n[l];return r},Dn=function(e){for(var t,n,r,i,a,o,s=this.cy(),u=this.nodes(),l=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||he("Damping must range on [0.5, 1). Got: ".concat(t));var r=["median","mean","min","max"];return r.some((function(e){return e===n}))||E(n)||he("Preference must be one of [".concat(r.map((function(e){return"'".concat(e,"'")})).join(", "),"] or a number. Got: ").concat(n)),Cn(e)}(e),c={},d=0;d<u.length;d++)c[u[d].id()]=d;n=(t=u.length)*t,r=new Array(n);for(var h=0;h<n;h++)r[h]=-1/0;for(var f=0;f<t;f++)for(var p=0;p<t;p++)f!==p&&(r[f*t+p]=Sn(l.distance,u[f],u[p],l.attributes));i=Pn(r,l.preference);for(var v=0;v<t;v++)r[v*t+v]=i;a=new Array(n);for(var g=0;g<n;g++)a[g]=0;o=new Array(n);for(var y=0;y<n;y++)o[y]=0;for(var m=new Array(t),b=new Array(t),x=new Array(t),w=0;w<t;w++)m[w]=0,b[w]=0,x[w]=0;for(var _,k=new Array(t*l.minIterations),C=0;C<k.length;C++)k[C]=0;for(_=0;_<l.maxIterations;_++){for(var S=0;S<t;S++){for(var P=-1/0,T=-1/0,D=-1,B=0,M=0;M<t;M++)m[M]=a[S*t+M],(B=o[S*t+M]+r[S*t+M])>=P?(T=P,P=B,D=M):B>T&&(T=B);for(var z=0;z<t;z++)a[S*t+z]=(1-l.damping)*(r[S*t+z]-P)+l.damping*m[z];a[S*t+D]=(1-l.damping)*(r[S*t+D]-T)+l.damping*m[D]}for(var O=0;O<t;O++){for(var I=0,A=0;A<t;A++)m[A]=o[A*t+O],b[A]=Math.max(0,a[A*t+O]),I+=b[A];I-=b[O],b[O]=a[O*t+O],I+=b[O];for(var N=0;N<t;N++)o[N*t+O]=(1-l.damping)*Math.min(0,I-b[N])+l.damping*m[N];o[O*t+O]=(1-l.damping)*(I-b[O])+l.damping*m[O]}for(var L=0,R=0;R<t;R++){var j=o[R*t+R]+a[R*t+R]>0?1:0;k[_%l.minIterations*t+R]=j,L+=j}if(L>0&&(_>=l.minIterations-1||_==l.maxIterations-1)){for(var V=0,F=0;F<t;F++){x[F]=0;for(var q=0;q<l.minIterations;q++)x[F]+=k[q*t+F];0!==x[F]&&x[F]!==l.minIterations||V++}if(V===t)break}}for(var W=function(e,t,n){for(var r=[],i=0;i<e;i++)t[i*e+i]+n[i*e+i]>0&&r.push(i);return r}(t,a,o),Y=function(e,t,n){for(var r=Tn(e,t,n),i=0;i<n.length;i++){for(var a=[],o=0;o<r.length;o++)r[o]===n[i]&&a.push(o);for(var s=-1,u=-1/0,l=0;l<a.length;l++){for(var c=0,d=0;d<a.length;d++)c+=t[a[d]*e+a[l]];c>u&&(s=l,u=c)}n[i]=a[s]}return r=Tn(e,t,n)}(t,r,W),X={},H=0;H<W.length;H++)X[W[H]]=[];for(var Z=0;Z<u.length;Z++){var U=Y[c[u[Z].id()]];null!=U&&X[U].push(u[Z])}for(var K=new Array(W.length),G=0;G<W.length;G++)K[G]=s.collection(X[W[G]]);return K},Bn={affinityPropagation:Dn,ap:Dn},Mn=be({root:void 0,directed:!1}),zn=function(){var e=this,t={},n=0,r=0,i=[],a=[],o={},s=function s(u,l,c){u===c&&(r+=1),t[l]={id:n,low:n++,cutVertex:!1};var d,h,f,p,v=e.getElementById(l).connectedEdges().intersection(e);0===v.size()?i.push(e.spawn(e.getElementById(l))):v.forEach((function(n){d=n.source().id(),h=n.target().id(),(f=d===l?h:d)!==c&&(p=n.id(),o[p]||(o[p]=!0,a.push({x:l,y:f,edge:n})),f in t?t[l].low=Math.min(t[l].low,t[f].id):(s(u,f,l),t[l].low=Math.min(t[l].low,t[f].low),t[l].id<=t[f].low&&(t[l].cutVertex=!0,function(n,r){for(var o=a.length-1,s=[],u=e.spawn();a[o].x!=n||a[o].y!=r;)s.push(a.pop().edge),o--;s.push(a.pop().edge),s.forEach((function(n){var r=n.connectedNodes().intersection(e);u.merge(n),r.forEach((function(n){var r=n.id(),i=n.connectedEdges().intersection(e);u.merge(n),t[r].cutVertex?u.merge(i.filter((function(e){return e.isLoop()}))):u.merge(i)}))})),i.push(u)}(l,f))))}))};e.forEach((function(e){if(e.isNode()){var n=e.id();n in t||(r=0,s(n,n),t[n].cutVertex=r>1)}}));var u=Object.keys(t).filter((function(e){return t[e].cutVertex})).map((function(t){return e.getElementById(t)}));return{cut:e.spawn(u),components:i}},On=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e);return e.forEach((function(o){if(o.isNode()){var s=o.id();s in t||function o(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach((function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))})),t[s].index===t[s].low){for(var u=e.spawn();;){var l=i.pop();if(u.merge(e.getElementById(l)),t[l].low=t[s].index,t[l].explored=!0,l===s)break}var c=u.edgesWith(u),d=u.merge(c);r.push(d),a=a.difference(d)}}(s)}})),{cut:a,components:r}},In={};[De,Me,ze,Ie,Ne,Re,qe,zt,It,Nt,Rt,Ut,mn,kn,Bn,{hierholzer:function(e){if(!_(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n,r,i,a=Mn(e),o=a.root,s=a.directed,u=this,l=!1;o&&(i=b(o)?this.filter(o)[0].id():o[0].id());var c={},d={};s?u.forEach((function(e){var t=e.id();if(e.isNode()){var i=e.indegree(!0),a=e.outdegree(!0),o=i-a,s=a-i;1==o?n?l=!0:n=t:1==s?r?l=!0:r=t:(s>1||o>1)&&(l=!0),c[t]=[],e.outgoers().forEach((function(e){e.isEdge()&&c[t].push(e.id())}))}else d[t]=[void 0,e.target().id()]})):u.forEach((function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(n?r?l=!0:r=t:n=t),c[t]=[],e.connectedEdges().forEach((function(e){return c[t].push(e.id())}))):d[t]=[e.source().id(),e.target().id()]}));var h={found:!1,trail:void 0};if(l)return h;if(r&&n)if(s){if(i&&r!=i)return h;i=r}else{if(i&&r!=i&&n!=i)return h;i||(i=r)}else i||(i=u[0].id());var f=function(e){for(var t,n,r,i=e,a=[e];c[i].length;)t=c[i].shift(),n=d[t][0],i!=(r=d[t][1])?(c[r]=c[r].filter((function(e){return e!=t})),i=r):s||i==n||(c[n]=c[n].filter((function(e){return e!=t})),i=n),a.unshift(t),a.unshift(i);return a},p=[],v=[];for(v=f(i);1!=v.length;)0==c[v[0]].length?(p.unshift(u.getElementById(v.shift())),p.unshift(u.getElementById(v.shift()))):v=f(v.shift()).concat(v);for(var g in p.unshift(u.getElementById(v.shift())),c)if(c[g].length)return h;return h.found=!0,h.trail=this.spawn(p),h}},{hopcroftTarjanBiconnected:zn,htbc:zn,htb:zn,hopcroftTarjanBiconnectedComponents:zn},{tarjanStronglyConnected:On,tsc:On,tscc:On,tarjanStronglyConnectedComponents:On}].forEach((function(e){j(In,e)}));
|
||
/*!
|
||
Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
|
||
Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
|
||
Licensed under The MIT License (http://opensource.org/licenses/MIT)
|
||
*/
|
||
var An=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};An.prototype={fulfill:function(e){return Nn(this,1,"fulfillValue",e)},reject:function(e){return Nn(this,2,"rejectReason",e)},then:function(e,t){var n=new An;return this.onFulfilled.push(jn(e,n,"fulfill")),this.onRejected.push(jn(t,n,"reject")),Ln(this),n.proxy}};var Nn=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,Ln(e)),e},Ln=function(e){1===e.state?Rn(e,"onFulfilled",e.fulfillValue):2===e.state&&Rn(e,"onRejected",e.rejectReason)},Rn=function(e,n,r){if(0!==e[n].length){var i=e[n];e[n]=[];var a=function(){for(var e=0;e<i.length;e++)i[e](r)};"function"==typeof t?t(a):setTimeout(a,0)}},jn=function(e,t,n){return function(r){if("function"!=typeof e)t[n].call(t,r);else{var i;try{i=e(r)}catch(e){return void t.reject(e)}Vn(t,i)}}},Vn=function e(t,n){if(t!==n&&t.proxy!==n){var r;if("object"===o(n)&&null!==n||"function"==typeof n)try{r=n.then}catch(e){return void t.reject(e)}if("function"!=typeof r)t.fulfill(n);else{var i=!1;try{r.call(n,(function(r){i||(i=!0,r===n?t.reject(new TypeError("circular thenable chain")):e(t,r))}),(function(e){i||(i=!0,t.reject(e))}))}catch(e){i||t.reject(e)}}}else t.reject(new TypeError("cannot resolve promise with itself"))};An.all=function(e){return new An((function(t,n){for(var r=new Array(e.length),i=0,a=function(n,a){r[n]=a,++i===e.length&&t(r)},o=0;o<e.length;o++)!function(t){var r=e[t];null!=r&&null!=r.then?r.then((function(e){a(t,e)}),(function(e){n(e)})):a(t,r)}(o)}))},An.resolve=function(e){return new An((function(t,n){t(e)}))},An.reject=function(e){return new An((function(t,n){n(e)}))};var Fn="undefined"!=typeof Promise?Promise:An,qn=function(e,t,n){var r=T(e),i=!r,a=this._private=j({duration:1e3},t,n);if(a.target=e,a.style=a.style||a.css,a.started=!1,a.playing=!1,a.hooked=!1,a.applying=!1,a.progress=0,a.completes=[],a.frames=[],a.complete&&x(a.complete)&&a.completes.push(a.complete),i){var o=e.position();a.startPosition=a.startPosition||{x:o.x,y:o.y},a.startStyle=a.startStyle||e.cy().style().getAnimationStartStyle(e,a.style)}if(r){var s=e.pan();a.startPan={x:s.x,y:s.y},a.startZoom=e.zoom()}this.length=1,this[0]=this},Wn=qn.prototype;j(Wn,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var t=e.target._private.animation;(e.queue?t.queue:t.current).push(this),C(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return 1===e.progress&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return void 0===e?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,n=t.playing;return void 0===e?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&this.play(),this)},completed:function(){return 1===this._private.progress},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(t,n){var r=e[t];null!=r&&(e[t]=e[n],e[n]=r)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var r=0;r<e.style.length;r++){var i=e.style[r],a=i.name,o=e.startStyle[a];e.startStyle[a]=i,e.style[r]=o}return t&&this.play(),this},promise:function(e){var t,n=this._private;switch(e){case"frame":t=n.frames;break;default:case"complete":case"completed":t=n.completes}return new Fn((function(e,n){t.push((function(){e()}))}))}}),Wn.complete=Wn.completed,Wn.run=Wn.play,Wn.running=Wn.playing;var Yn={};[{animated:function(){return function(){var e=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return!1;var t=e[0];return t?t._private.animation.current.length>0:void 0}},clearQueue:function(){return function(){var e=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;for(var t=0;t<e.length;t++){e[t]._private.animation.queue=[]}return this}},delay:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animate({delay:e,duration:e,complete:t}):this}},delayAnimation:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animation({delay:e,duration:e,complete:t}):this}},animation:function(){return function(e,t){var n=void 0!==this.length,r=n?this:[this],i=this._private.cy||this,a=!n,o=!a;if(!i.styleEnabled())return this;var s=i.style();if(e=j({},e,t),0===Object.keys(e).length)return new qn(r[0],e);switch(void 0===e.duration&&(e.duration=400),e.duration){case"slow":e.duration=600;break;case"fast":e.duration=200}if(o&&(e.style=s.getPropsList(e.style||e.css),e.css=void 0),o&&null!=e.renderedPosition){var u=e.renderedPosition,l=i.pan(),c=i.zoom();e.position=Ye(u,c,l)}if(a&&null!=e.panBy){var d=e.panBy,h=i.pan();e.pan={x:h.x+d.x,y:h.y+d.y}}var f=e.center||e.centre;if(a&&null!=f){var p=i.getCenterPan(f.eles,e.zoom);null!=p&&(e.pan=p)}if(a&&null!=e.fit){var v=e.fit,g=i.getFitViewport(v.eles||v.boundingBox,v.padding);null!=g&&(e.pan=g.pan,e.zoom=g.zoom)}if(a&&_(e.zoom)){var y=i.getZoomedViewport(e.zoom);null!=y?(y.zoomed&&(e.zoom=y.zoom),y.panned&&(e.pan=y.pan)):e.zoom=null}return new qn(r[0],e)}},animate:function(){return function(e,t){var n=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;t&&(e=j({},e,t));for(var r=0;r<n.length;r++){var i=n[r],a=i.animated()&&(void 0===e.queue||e.queue);i.animation(e,a?{queue:!0}:void 0).play()}return this}},stop:function(){return function(e,t){var n=void 0!==this.length?this:[this],r=this._private.cy||this;if(!r.styleEnabled())return this;for(var i=0;i<n.length;i++){for(var a=n[i]._private,o=a.animation.current,s=0;s<o.length;s++){var u=o[s]._private;t&&(u.duration=0)}e&&(a.animation.queue=[]),t||(a.animation.current=[])}return r.notify("draw"),this}}},{data:function(e){return e=j({},{field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(e){},beforeSet:function(e,t){},onSet:function(e){},canSet:function(e){return!0}},e),function(t,n){var r=e,i=void 0!==this.length,a=i?this:[this],o=i?this[0]:this;if(b(t)){var s;if(r.allowGetting&&void 0===n)return o&&(r.beforeGet(o),s=o._private[r.field][t]),s;if(r.allowSetting&&void 0!==n&&!r.immutableKeys[t]){var u=c({},t,n);r.beforeSet(this,u);for(var l=0,d=a.length;l<d;l++){var h=a[l];r.canSet(h)&&(h._private[r.field][t]=n)}r.updateStyle&&this.updateStyle(),r.onSet(this),r.settingTriggersEvent&&this[r.triggerFnName](r.settingEvent)}}else if(r.allowSetting&&_(t)){var f,p,v=t,g=Object.keys(v);r.beforeSet(this,v);for(var y=0;y<g.length;y++){if(p=v[f=g[y]],!r.immutableKeys[f])for(var m=0;m<a.length;m++){var w=a[m];r.canSet(w)&&(w._private[r.field][f]=p)}}r.updateStyle&&this.updateStyle(),r.onSet(this),r.settingTriggersEvent&&this[r.triggerFnName](r.settingEvent)}else if(r.allowBinding&&x(t)){var E=t;this.on(r.bindingEvent,E)}else if(r.allowGetting&&void 0===t){var k;return o&&(r.beforeGet(o),k=o._private[r.field]),k}return this}},removeData:function(e){return e=j({},{field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}},e),function(t){var n=e,r=void 0!==this.length?this:[this];if(b(t)){for(var i=t.split(/\s+/),a=i.length,o=0;o<a;o++){var s=i[o];if(!B(s))if(!n.immutableKeys[s])for(var u=0,l=r.length;u<l;u++)r[u]._private[n.field][s]=void 0}n.triggerEvent&&this[n.triggerFnName](n.event)}else if(void 0===t){for(var c=0,d=r.length;c<d;c++)for(var h=r[c]._private[n.field],f=Object.keys(h),p=0;p<f.length;p++){var v=f[p];!n.immutableKeys[v]&&(h[v]=void 0)}n.triggerEvent&&this[n.triggerFnName](n.event)}return this}}},{eventAliasesOn:function(e){var t=e;t.addListener=t.listen=t.bind=t.on,t.unlisten=t.unbind=t.off=t.removeListener,t.trigger=t.emit,t.pon=t.promiseOn=function(e,t){var n=this,r=Array.prototype.slice.call(arguments,0);return new Fn((function(e,t){var i=r.concat([function(t){n.off.apply(n,a),e(t)}]),a=i.concat([]);n.on.apply(n,i)}))}}}].forEach((function(e){j(Yn,e)}));var Xn={animate:Yn.animate(),animation:Yn.animation(),animated:Yn.animated(),clearQueue:Yn.clearQueue(),delay:Yn.delay(),delayAnimation:Yn.delayAnimation(),stop:Yn.stop()},Hn={classes:function(e){if(void 0===e){var t=[];return this[0]._private.classes.forEach((function(e){return t.push(e)})),t}w(e)||(e=(e||"").match(/\S+/g)||[]);for(var n=[],r=new Se(e),i=0;i<this.length;i++){for(var a=this[i],o=a._private,s=o.classes,u=!1,l=0;l<e.length;l++){var c=e[l];if(!s.has(c)){u=!0;break}}u||(u=s.size!==e.length),u&&(o.classes=r,n.push(a))}return n.length>0&&this.spawn(n).updateStyle().emit("class"),this},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){w(e)||(e=e.match(/\S+/g)||[]);for(var n=void 0===t,r=[],i=0,a=this.length;i<a;i++)for(var o=this[i],s=o._private.classes,u=!1,l=0;l<e.length;l++){var c=e[l],d=s.has(c),h=!1;t||n&&!d?(s.add(c),h=!0):(!t||n&&d)&&(s.delete(c),h=!0),!u&&h&&(r.push(o),u=!0)}return r.length>0&&this.spawn(r).updateStyle().emit("class"),this},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout((function(){n.removeClass(e)}),t),n}};Hn.className=Hn.classNames=Hn.classes;var Zn={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:L,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Zn.variable="(?:[\\w-]|(?:\\\\"+Zn.metaChar+"))+",Zn.value=Zn.string+"|"+Zn.number,Zn.className=Zn.variable,Zn.id=Zn.variable,function(){var e,t,n;for(e=Zn.comparatorOp.split("|"),n=0;n<e.length;n++)t=e[n],Zn.comparatorOp+="|@"+t;for(e=Zn.comparatorOp.split("|"),n=0;n<e.length;n++)(t=e[n]).indexOf("!")>=0||"="!==t&&(Zn.comparatorOp+="|\\!"+t)}();var Un=0,Kn=1,Gn=2,$n=3,Qn=4,Jn=5,er=6,tr=7,nr=8,rr=9,ir=10,ar=11,or=12,sr=13,ur=14,lr=15,cr=16,dr=17,hr=18,fr=19,pr=20,vr=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort((function(e,t){return function(e,t){return-1*R(e,t)}(e.selector,t.selector)})),gr=function(){for(var e,t={},n=0;n<vr.length;n++)t[(e=vr[n]).selector]=e.matches;return t}(),yr="("+vr.map((function(e){return e.selector})).join("|")+")",mr=function(e){return e.replace(new RegExp("\\\\("+Zn.metaChar+")","g"),(function(e,t){return t}))},br=function(e,t,n){e[e.length-1]=n},xr=[{name:"group",query:!0,regex:"("+Zn.group+")",populate:function(e,t,n){var r=d(n,1)[0];t.checks.push({type:Un,value:"*"===r?r:r+"s"})}},{name:"state",query:!0,regex:yr,populate:function(e,t,n){var r=d(n,1)[0];t.checks.push({type:tr,value:r})}},{name:"id",query:!0,regex:"\\#("+Zn.id+")",populate:function(e,t,n){var r=d(n,1)[0];t.checks.push({type:nr,value:mr(r)})}},{name:"className",query:!0,regex:"\\.("+Zn.className+")",populate:function(e,t,n){var r=d(n,1)[0];t.checks.push({type:rr,value:mr(r)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Zn.variable+")\\s*\\]",populate:function(e,t,n){var r=d(n,1)[0];t.checks.push({type:Qn,field:mr(r)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Zn.variable+")\\s*("+Zn.comparatorOp+")\\s*("+Zn.value+")\\s*\\]",populate:function(e,t,n){var r=d(n,3),i=r[0],a=r[1],o=r[2];o=null!=new RegExp("^"+Zn.string+"$").exec(o)?o.substring(1,o.length-1):parseFloat(o),t.checks.push({type:$n,field:mr(i),operator:a,value:o})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Zn.boolOp+")\\s*("+Zn.variable+")\\s*\\]",populate:function(e,t,n){var r=d(n,2),i=r[0],a=r[1];t.checks.push({type:Jn,field:mr(a),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Zn.meta+")\\s*("+Zn.comparatorOp+")\\s*("+Zn.number+")\\s*\\]\\]",populate:function(e,t,n){var r=d(n,3),i=r[0],a=r[1],o=r[2];t.checks.push({type:er,field:mr(i),operator:a,value:parseFloat(o)})}},{name:"nextQuery",separator:!0,regex:Zn.separator,populate:function(e,t){var n=e.currentSubject,r=e.edgeCount,i=e.compoundCount,a=e[e.length-1];return null!=n&&(a.subject=n,e.currentSubject=null),a.edgeCount=r,a.compoundCount=i,e.edgeCount=0,e.compoundCount=0,e[e.length++]={checks:[]}}},{name:"directedEdge",separator:!0,regex:Zn.directedEdge,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},r=t,i={checks:[]};return n.checks.push({type:ar,source:r,target:i}),br(e,0,n),e.edgeCount++,i}var a={checks:[]},o=t,s={checks:[]};return a.checks.push({type:or,source:o,target:s}),br(e,0,a),e.edgeCount++,s}},{name:"undirectedEdge",separator:!0,regex:Zn.undirectedEdge,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},r=t,i={checks:[]};return n.checks.push({type:ir,nodes:[r,i]}),br(e,0,n),e.edgeCount++,i}var a={checks:[]},o=t,s={checks:[]};return a.checks.push({type:ur,node:o,neighbor:s}),br(e,0,a),s}},{name:"child",separator:!0,regex:Zn.child,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},r={checks:[]},i=e[e.length-1];return n.checks.push({type:lr,parent:i,child:r}),br(e,0,n),e.compoundCount++,r}if(e.currentSubject===t){var a={checks:[]},o=e[e.length-1],s={checks:[]},u={checks:[]},l={checks:[]},c={checks:[]};return a.checks.push({type:fr,left:o,right:s,subject:u}),u.checks=t.checks,t.checks=[{type:pr}],c.checks.push({type:pr}),s.checks.push({type:dr,parent:c,child:l}),br(e,0,a),e.currentSubject=u,e.compoundCount++,l}var d={checks:[]},h={checks:[]},f=[{type:dr,parent:d,child:h}];return d.checks=t.checks,t.checks=f,e.compoundCount++,h}},{name:"descendant",separator:!0,regex:Zn.descendant,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},r={checks:[]},i=e[e.length-1];return n.checks.push({type:cr,ancestor:i,descendant:r}),br(e,0,n),e.compoundCount++,r}if(e.currentSubject===t){var a={checks:[]},o=e[e.length-1],s={checks:[]},u={checks:[]},l={checks:[]},c={checks:[]};return a.checks.push({type:fr,left:o,right:s,subject:u}),u.checks=t.checks,t.checks=[{type:pr}],c.checks.push({type:pr}),s.checks.push({type:hr,ancestor:c,descendant:l}),br(e,0,a),e.currentSubject=u,e.compoundCount++,l}var d={checks:[]},h={checks:[]},f=[{type:hr,ancestor:d,descendant:h}];return d.checks=t.checks,t.checks=f,e.compoundCount++,h}},{name:"subject",modifier:!0,regex:Zn.subject,populate:function(e,t){if(null!=e.currentSubject&&e.currentSubject!==t)return pe("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var n=e[e.length-1].checks[0],r=null==n?null:n.type;r===ar?n.type=sr:r===ir&&(n.type=ur,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];xr.forEach((function(e){return e.regexObj=new RegExp("^"+e.regex)}));var wr=function(e){for(var t,n,r,i=0;i<xr.length;i++){var a=xr[i],o=a.name,s=e.match(a.regexObj);if(null!=s){n=s,t=a,r=o;var u=s[0];e=e.substring(u.length);break}}return{expr:t,match:n,name:r,remaining:e}},_r={parse:function(e){var t=this.inputText=e,n=this[0]={checks:[]};for(this.length=1,t=function(e){var t=e.match(/^\s+/);if(t){var n=t[0];e=e.substring(n.length)}return e}(t);;){var r=wr(t);if(null==r.expr)return pe("The selector `"+e+"`is invalid"),!1;var i=r.match.slice(1),a=r.expr.populate(this,n,i);if(!1===a)return!1;if(null!=a&&(n=a),(t=r.remaining).match(/^\s*$/))break}var o=this[this.length-1];null!=this.currentSubject&&(o.subject=this.currentSubject),o.edgeCount=this.edgeCount,o.compoundCount=this.compoundCount;for(var s=0;s<this.length;s++){var u=this[s];if(u.compoundCount>0&&u.edgeCount>0)return pe("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(u.edgeCount>1)return pe("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===u.edgeCount&&pe("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return b(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,a){var o=r.type,s=r.value;switch(o){case Un:var u=e(s);return u.substring(0,u.length-1);case $n:var l=r.field,c=r.operator;return"["+l+n(e(c))+t(s)+"]";case Jn:var d=r.operator,h=r.field;return"["+e(d)+h+"]";case Qn:return"["+r.field+"]";case er:var f=r.operator;return"[["+r.field+n(e(f))+t(s)+"]]";case tr:return s;case nr:return"#"+s;case rr:return"."+s;case dr:case lr:return i(r.parent,a)+n(">")+i(r.child,a);case hr:case cr:return i(r.ancestor,a)+" "+i(r.descendant,a);case fr:var p=i(r.left,a),v=i(r.subject,a),g=i(r.right,a);return p+(p.length>0?" ":"")+v+g;case pr:return""}},i=function(e,t){return e.checks.reduce((function(n,i,a){return n+(t===e&&0===a?"$":"")+r(i,t)}),"")},a="",o=0;o<this.length;o++){var s=this[o];a+=i(s,s.subject),this.length>1&&o<this.length-1&&(a+=", ")}return this.toStringCache=a,a}},Er=function(e,t,n){var r,i,a,o=b(e),s=E(e),u=b(n),l=!1,c=!1,d=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),l=!0),(o||u||l)&&(i=o||s?""+e:"",a=""+n),l&&(e=i=i.toLowerCase(),n=a=a.toLowerCase()),t){case"*=":r=i.indexOf(a)>=0;break;case"$=":r=i.indexOf(a,i.length-a.length)>=0;break;case"^=":r=0===i.indexOf(a);break;case"=":r=e===n;break;case">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e<n;break;case"<=":d=!0,r=e<=n;break;default:r=!1}return!c||null==e&&d||(r=!r),r},kr=function(e,t){return e.data(t)},Cr=[],Sr=function(e,t){return e.checks.every((function(e){return Cr[e.type](e,t)}))};Cr[Un]=function(e,t){var n=e.value;return"*"===n||n===t.group()},Cr[tr]=function(e,t){return function(e,t){return gr[e](t)}(e.value,t)},Cr[nr]=function(e,t){var n=e.value;return t.id()===n},Cr[rr]=function(e,t){var n=e.value;return t.hasClass(n)},Cr[er]=function(e,t){var n=e.field,r=e.operator,i=e.value;return Er(function(e,t){return e[t]()}(t,n),r,i)},Cr[$n]=function(e,t){var n=e.field,r=e.operator,i=e.value;return Er(kr(t,n),r,i)},Cr[Jn]=function(e,t){var n=e.field,r=e.operator;return function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return void 0===e}}(kr(t,n),r)},Cr[Qn]=function(e,t){var n=e.field;e.operator;return void 0!==kr(t,n)},Cr[ir]=function(e,t){var n=e.nodes[0],r=e.nodes[1],i=t.source(),a=t.target();return Sr(n,i)&&Sr(r,a)||Sr(r,i)&&Sr(n,a)},Cr[ur]=function(e,t){return Sr(e.node,t)&&t.neighborhood().some((function(t){return t.isNode()&&Sr(e.neighbor,t)}))},Cr[ar]=function(e,t){return Sr(e.source,t.source())&&Sr(e.target,t.target())},Cr[or]=function(e,t){return Sr(e.source,t)&&t.outgoers().some((function(t){return t.isNode()&&Sr(e.target,t)}))},Cr[sr]=function(e,t){return Sr(e.target,t)&&t.incomers().some((function(t){return t.isNode()&&Sr(e.source,t)}))},Cr[lr]=function(e,t){return Sr(e.child,t)&&Sr(e.parent,t.parent())},Cr[dr]=function(e,t){return Sr(e.parent,t)&&t.children().some((function(t){return Sr(e.child,t)}))},Cr[cr]=function(e,t){return Sr(e.descendant,t)&&t.ancestors().some((function(t){return Sr(e.ancestor,t)}))},Cr[hr]=function(e,t){return Sr(e.ancestor,t)&&t.descendants().some((function(t){return Sr(e.descendant,t)}))},Cr[fr]=function(e,t){return Sr(e.subject,t)&&Sr(e.left,t)&&Sr(e.right,t)},Cr[pr]=function(){return!0},Cr[Kn]=function(e,t){return e.value.has(t)},Cr[Gn]=function(e,t){return(0,e.value)(t)};var Pr=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,null==e||b(e)&&e.match(/^\s*$/)||(C(e)?this.addQuery({checks:[{type:Kn,value:e.collection()}]}):x(e)?this.addQuery({checks:[{type:Gn,value:e}]}):b(e)?this.parse(e)||(this.invalid=!0):he("A selector must be created from a string; found "))},Tr=Pr.prototype;[_r,{matches:function(e){for(var t=0;t<this.length;t++){var n=this[t];if(Sr(n,e))return!0}return!1},filter:function(e){var t=this;if(1===t.length&&1===t[0].checks.length&&t[0].checks[0].type===nr)return e.getElementById(t[0].checks[0].value).collection();var n=function(e){for(var n=0;n<t.length;n++){var r=t[n];if(Sr(r,e))return!0}return!1};return null==t.text()&&(n=function(){return!0}),e.filter(n)}}].forEach((function(e){return j(Tr,e)})),Tr.text=function(){return this.inputText},Tr.size=function(){return this.length},Tr.eq=function(e){return this[e]},Tr.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},Tr.addQuery=function(e){this[this.length++]=e},Tr.selector=Tr.toString;var Dr={allAre:function(e){var t=new Pr(e);return this.every((function(e){return t.matches(e)}))},is:function(e){var t=new Pr(e);return this.some((function(e){return t.matches(e)}))},some:function(e,t){for(var n=0;n<this.length;n++){if(t?e.apply(t,[this[n],n,this]):e(this[n],n,this))return!0}return!1},every:function(e,t){for(var n=0;n<this.length;n++){if(!(t?e.apply(t,[this[n],n,this]):e(this[n],n,this)))return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length;return t===e.length&&(1===t?this[0]===e[0]:this.every((function(t){return e.hasElementWithId(t.id())})))},anySame:function(e){return e=this.cy().collection(e),this.some((function(t){return e.hasElementWithId(t.id())}))},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every((function(e){return t.hasElementWithId(e.id())}))},contains:function(e){e=this.cy().collection(e);var t=this;return e.every((function(e){return t.hasElementWithId(e.id())}))}};Dr.allAreNeighbours=Dr.allAreNeighbors,Dr.has=Dr.contains,Dr.equal=Dr.equals=Dr.same;var Br,Mr,zr=function(e,t){return function(n,r,i,a){var o,s=n;if(null==s?o="":C(s)&&1===s.length&&(o=s.id()),1===this.length&&o){var u=this[0]._private,l=u.traversalCache=u.traversalCache||{},c=l[t]=l[t]||[],d=te(o),h=c[d];return h||(c[d]=e.call(this,n,r,i,a))}return e.call(this,n,r,i,a)}},Or={parent:function(e){var t=[];if(1===this.length){var n=this[0]._private.parent;if(n)return n}for(var r=0;r<this.length;r++){var i=this[r]._private.parent;i&&t.push(i)}return this.spawn(t,{unique:!0}).filter(e)},parents:function(e){for(var t=[],n=this.parent();n.nonempty();){for(var r=0;r<n.length;r++){var i=n[r];t.push(i)}n=n.parent()}return this.spawn(t,{unique:!0}).filter(e)},commonAncestors:function(e){for(var t,n=0;n<this.length;n++){var r=this[n].parents();t=(t=t||r).intersect(r)}return t.filter(e)},orphans:function(e){return this.stdFilter((function(e){return e.isOrphan()})).filter(e)},nonorphans:function(e){return this.stdFilter((function(e){return e.isChild()})).filter(e)},children:zr((function(e){for(var t=[],n=0;n<this.length;n++)for(var r=this[n]._private.children,i=0;i<r.length;i++)t.push(r[i]);return this.spawn(t,{unique:!0}).filter(e)}),"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&0!==e._private.children.length},isChildless:function(){var e=this[0];if(e)return e.isNode()&&0===e._private.children.length},isChild:function(){var e=this[0];if(e)return e.isNode()&&null!=e._private.parent},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&null==e._private.parent},descendants:function(e){var t=[];return function e(n){for(var r=0;r<n.length;r++){var i=n[r];t.push(i),i.children().nonempty()&&e(i.children())}}(this.children()),this.spawn(t,{unique:!0}).filter(e)}};function Ir(e,t,n,r){for(var i=[],a=new Se,o=e.cy().hasCompoundNodes(),s=0;s<e.length;s++){var u=e[s];n?i.push(u):o&&r(i,a,u)}for(;i.length>0;){var l=i.shift();t(l),a.add(l.id()),o&&r(i,a,l)}return e}function Ar(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i<r.length;i++){var a=r[i];t.has(a.id())||e.push(a)}}function Nr(e,t,n){if(n.isChild()){var r=n._private.parent;t.has(r.id())||e.push(r)}}function Lr(e,t,n){Nr(e,t,n),Ar(e,t,n)}Or.forEachDown=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Ir(this,e,t,Ar)},Or.forEachUp=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Ir(this,e,t,Nr)},Or.forEachUpAndDown=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Ir(this,e,t,Lr)},Or.ancestors=Or.parents,(Br=Mr={data:Yn.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Yn.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Yn.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Yn.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Yn.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Yn.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=Br.data,Br.removeAttr=Br.removeData;var Rr,jr,Vr=Mr,Fr={};function qr(e){return function(t){if(void 0===t&&(t=!0),0!==this.length&&this.isNode()&&!this.removed()){for(var n=0,r=this[0],i=r._private.edges,a=0;a<i.length;a++){var o=i[a];!t&&o.isLoop()||(n+=e(r,o))}return n}}}function Wr(e,t){return function(n){for(var r,i=this.nodes(),a=0;a<i.length;a++){var o=i[a][e](n);void 0===o||void 0!==r&&!t(o,r)||(r=o)}return r}}j(Fr,{degree:qr((function(e,t){return t.source().same(t.target())?2:1})),indegree:qr((function(e,t){return t.target().same(e)?1:0})),outdegree:qr((function(e,t){return t.source().same(e)?1:0}))}),j(Fr,{minDegree:Wr("degree",(function(e,t){return e<t})),maxDegree:Wr("degree",(function(e,t){return e>t})),minIndegree:Wr("indegree",(function(e,t){return e<t})),maxIndegree:Wr("indegree",(function(e,t){return e>t})),minOutdegree:Wr("outdegree",(function(e,t){return e<t})),maxOutdegree:Wr("outdegree",(function(e,t){return e>t}))}),j(Fr,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r<n.length;r++)t+=n[r].degree(e);return t}});var Yr=function(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(!i.locked()){var a=i._private.position,o={x:null!=t.x?t.x-a.x:0,y:null!=t.y?t.y-a.y:0};!i.isParent()||0===o.x&&0===o.y||i.children().shift(o,n),i.shiftCachedBoundingBox(o)}}},Xr={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,t){Yr(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};(Rr=jr={position:Yn.data(Xr),silentPosition:Yn.data(j({},Xr,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){Yr(e,t,!0)}})),positions:function(e,t){if(_(e))t?this.silentPosition(e):this.position(e);else if(x(e)){var n=e,r=this.cy();r.startBatch();for(var i=0;i<this.length;i++){var a,o=this[i];(a=n(o,i))&&(t?o.silentPosition(a):o.position(a))}r.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var r;if(_(e)?(r={x:E(e.x)?e.x:0,y:E(e.y)?e.y:0},n=t):b(e)&&E(t)&&((r={x:0,y:0})[e]=t),null!=r){var i=this.cy();i.startBatch();for(var a=0;a<this.length;a++){var o=this[a],s=o.position(),u={x:s.x+r.x,y:s.y+r.y};n?o.silentPosition(u):o.position(u)}i.endBatch()}return this},silentShift:function(e,t){return _(e)?this.shift(e,!0):b(e)&&E(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],r=this.cy(),i=r.zoom(),a=r.pan(),o=_(e)?e:void 0,s=void 0!==o||void 0!==t&&b(e);if(n&&n.isNode()){if(!s){var u=n.position();return o=We(u,i,a),void 0===e?o:o[e]}for(var l=0;l<this.length;l++){var c=this[l];void 0!==t?c.position(e,(t-a[e])/i):void 0!==o&&c.position(Ye(o,i,a))}}else if(!s)return;return this},relativePosition:function(e,t){var n=this[0],r=this.cy(),i=_(e)?e:void 0,a=void 0!==i||void 0!==t&&b(e),o=r.hasCompoundNodes();if(n&&n.isNode()){if(!a){var s=n.position(),u=o?n.parent():null,l=u&&u.length>0,c=l;l&&(u=u[0]);var d=c?u.position():{x:0,y:0};return i={x:s.x-d.x,y:s.y-d.y},void 0===e?i:i[e]}for(var h=0;h<this.length;h++){var f=this[h],p=o?f.parent():null,v=p&&p.length>0,g=v;v&&(p=p[0]);var y=g?p.position():{x:0,y:0};void 0!==t?f.position(e,t+y[e]):void 0!==i&&f.position({x:i.x+y.x,y:i.y+y.y})}}else if(!a)return;return this}}).modelPosition=Rr.point=Rr.position,Rr.modelPositions=Rr.points=Rr.positions,Rr.renderedPoint=Rr.renderedPosition,Rr.relativePoint=Rr.relativePosition;var Hr,Zr,Ur=jr;Hr=Zr={},Zr.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,u=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:u,w:o-a,h:u-s}},Zr.dirtyCompoundBoundsCache=function(){var e=this.cy();return e.styleEnabled()&&e.hasCompoundNodes()?(this.forEachUp((function(e){if(e.isParent()){var t=e._private;t.compoundBoundsClean=!1,t.bbCache=null,e.emitAndNotify("bounds")}})),this):this},Zr.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,i={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},a=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;0!==a.w&&0!==a.h||((a={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);var s=i.width.left.value;"px"===i.width.left.units&&i.width.val>0&&(s=100*s/i.width.val);var u=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(u=100*u/i.width.val);var l=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(l=100*l/i.height.val);var c=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(c=100*c/i.height.val);var d=y(i.width.val-a.w,s,u),h=d.biasDiff,f=d.biasComplementDiff,p=y(i.height.val-a.h,l,c),v=p.biasDiff,g=p.biasComplementDiff;t.autoPadding=function(e,t,n,r){if("%"!==n.units)return"px"===n.units?n.pfValue:0;switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}}(a.w,a.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-h+a.x1+a.x2+f)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-v+a.y1+a.y2+g)/2}function y(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}}for(var r=0;r<this.length;r++){var i=this[r],a=i._private;a.compoundBoundsClean||(n(i),t.batching()||(a.compoundBoundsClean=!0))}return this};var Kr=function(e){return e===1/0||e===-1/0?0:e},Gr=function(e,t,n,r,i){r-t!=0&&i-n!=0&&null!=t&&null!=n&&null!=r&&null!=i&&(e.x1=t<e.x1?t:e.x1,e.x2=r>e.x2?r:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},$r=function(e,t){return null==t?e:Gr(e,t.x1,t.y1,t.x2,t.y2)},Qr=function(e,t,n){return _e(e,t,n)},Jr=function(e,t,n){if(!t.cy().headless()){var r,i,a=t._private,o=a.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,i=o.srcY):"target"===n?(r=o.tgtX,i=o.tgtY):(r=o.midX,i=o.midY);var u=a.arrowBounds=a.arrowBounds||{},l=u[n]=u[n]||{};l.x1=r-s,l.y1=i-s,l.x2=r+s,l.y2=i+s,l.w=l.x2-l.x1,l.h=l.y2-l.y1,rt(l,1),Gr(e,l.x1,l.y1,l.x2,l.y2)}}},ei=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var i=t._private,a=i.rstyle;if(t.pstyle(r+"label").strValue){var o,s,u,l,c=t.pstyle("text-halign"),d=t.pstyle("text-valign"),h=Qr(a,"labelWidth",n),f=Qr(a,"labelHeight",n),p=Qr(a,"labelX",n),v=Qr(a,"labelY",n),g=t.pstyle(r+"text-margin-x").pfValue,y=t.pstyle(r+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle(r+"text-rotation"),x=t.pstyle("text-outline-width").pfValue,w=t.pstyle("text-border-width").pfValue/2,_=t.pstyle("text-background-padding").pfValue,E=f,k=h,C=k/2,S=E/2;if(m)o=p-C,s=p+C,u=v-S,l=v+S;else{switch(c.value){case"left":o=p-k,s=p;break;case"center":o=p-C,s=p+C;break;case"right":o=p,s=p+k}switch(d.value){case"top":u=v-E,l=v;break;case"center":u=v-S,l=v+S;break;case"bottom":u=v,l=v+E}}o+=g-Math.max(x,w)-_,s+=g+Math.max(x,w)+_,u+=y-Math.max(x,w)-_,l+=y+Math.max(x,w)+_;var P=n||"main",T=i.labelBounds,D=T[P]=T[P]||{};D.x1=o,D.y1=u,D.x2=s,D.y2=l,D.w=s-o,D.h=l-u,rt(D,1);var B=m&&"autorotate"===b.strValue,M=null!=b.pfValue&&0!==b.pfValue;if(B||M){var z=B?Qr(i.rstyle,"labelAngle",n):b.pfValue,O=Math.cos(z),I=Math.sin(z),A=(o+s)/2,N=(u+l)/2;if(!m){switch(c.value){case"left":A=s;break;case"right":A=o}switch(d.value){case"top":N=l;break;case"bottom":N=u}}var L=function(e,t){return{x:(e-=A)*O-(t-=N)*I+A,y:e*I+t*O+N}},R=L(o,u),j=L(o,l),V=L(s,u),F=L(s,l);o=Math.min(R.x,j.x,V.x,F.x),s=Math.max(R.x,j.x,V.x,F.x),u=Math.min(R.y,j.y,V.y,F.y),l=Math.max(R.y,j.y,V.y,F.y)}var q=P+"Rot",W=T[q]=T[q]||{};W.x1=o,W.y1=u,W.x2=s,W.y2=l,W.w=s-o,W.h=l-u,Gr(e,o,u,s,l),Gr(i.labelBounds.all,o,u,s,l)}return e}},ti=function(e){var t=0,n=function(e){return(e?1:0)<<t++},r=0;return r+=n(e.incudeNodes),r+=n(e.includeEdges),r+=n(e.includeLabels),r+=n(e.includeMainLabels),r+=n(e.includeSourceLabels),r+=n(e.includeTargetLabels),r+=n(e.includeOverlays)},ni=function(e){if(e.isEdge()){var t=e.source().position(),n=e.target().position(),r=function(e){return Math.round(e)};return function(e,t){var n={value:0,done:!1},r=0,i=e.length;return G({next:function(){return r<i?n.value=e[r++]:n.done=!0,n}},t)}([r(t.x),r(t.y),r(n.x),r(n.y)])}return 0},ri=function(e,t){var n,r=e._private,i=e.isEdge(),a=(null==t?ai:ti(t))===ai,o=ni(e),s=r.bbCachePosKey===o,u=function(e){return null==e._private.bbCache},l=!(t.useCache&&s)||u(e)||i&&u(e.source())||u(e.target());if(l?(s||e.recalculateRenderedStyle(),n=function(e,t){var n,r,i,a,o,s,u,l=e._private.cy,c=l.styleEnabled(),d=l.headless(),h=tt(),f=e._private,p=e.isNode(),v=e.isEdge(),g=f.rstyle,y=p&&c?e.pstyle("bounds-expansion").pfValue:[0],m=function(e){return"none"!==e.pstyle("display").value},b=!c||m(e)&&(!v||m(e.source())&&m(e.target()));if(b){var x=0;c&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(x=e.pstyle("overlay-padding").value);var w=0;if(c&&(w=e.pstyle("width").pfValue/2),p&&t.includeNodes){var _=e.position();o=_.x,s=_.y;var E=e.outerWidth()/2,k=e.outerHeight()/2;Gr(h,n=o-E,i=s-k,r=o+E,a=s+k)}else if(v&&t.includeEdges)if(c&&!d){var C=e.pstyle("curve-style").strValue;if(n=Math.min(g.srcX,g.midX,g.tgtX),r=Math.max(g.srcX,g.midX,g.tgtX),i=Math.min(g.srcY,g.midY,g.tgtY),a=Math.max(g.srcY,g.midY,g.tgtY),Gr(h,n-=w,i-=w,r+=w,a+=w),"haystack"===C){var S=g.haystackPts;if(S&&2===S.length){if(n=S[0].x,i=S[0].y,n>(r=S[1].x)){var P=n;n=r,r=P}if(i>(a=S[1].y)){var T=i;i=a,a=T}Gr(h,n-w,i-w,r+w,a+w)}}else if("bezier"===C||"unbundled-bezier"===C||"segments"===C||"taxi"===C){var D;switch(C){case"bezier":case"unbundled-bezier":D=g.bezierPts;break;case"segments":case"taxi":D=g.linePts}if(null!=D)for(var B=0;B<D.length;B++){var M=D[B];n=M.x-w,r=M.x+w,i=M.y-w,a=M.y+w,Gr(h,n,i,r,a)}}}else{var z=e.source().position(),O=e.target().position();if((n=z.x)>(r=O.x)){var I=n;n=r,r=I}if((i=z.y)>(a=O.y)){var A=i;i=a,a=A}Gr(h,n-=w,i-=w,r+=w,a+=w)}if(c&&t.includeEdges&&v&&(Jr(h,e,"mid-source"),Jr(h,e,"mid-target"),Jr(h,e,"source"),Jr(h,e,"target")),c)if("yes"===e.pstyle("ghost").value){var N=e.pstyle("ghost-offset-x").pfValue,L=e.pstyle("ghost-offset-y").pfValue;Gr(h,h.x1+N,h.y1+L,h.x2+N,h.y2+L)}var R=f.bodyBounds=f.bodyBounds||{};at(R,h),it(R,y),rt(R,1),c&&(n=h.x1,r=h.x2,i=h.y1,a=h.y2,Gr(h,n-x,i-x,r+x,a+x));var j=f.overlayBounds=f.overlayBounds||{};at(j,h),it(j,y),rt(j,1);var V=f.labelBounds=f.labelBounds||{};null!=V.all?((u=V.all).x1=1/0,u.y1=1/0,u.x2=-1/0,u.y2=-1/0,u.w=0,u.h=0):V.all=tt(),c&&t.includeLabels&&(t.includeMainLabels&&ei(h,e,null),v&&(t.includeSourceLabels&&ei(h,e,"source"),t.includeTargetLabels&&ei(h,e,"target")))}return h.x1=Kr(h.x1),h.y1=Kr(h.y1),h.x2=Kr(h.x2),h.y2=Kr(h.y2),h.w=Kr(h.x2-h.x1),h.h=Kr(h.y2-h.y1),h.w>0&&h.h>0&&b&&(it(h,y),rt(h,1)),h}(e,ii),r.bbCache=n,r.bbCacheShift.x=r.bbCacheShift.y=0,r.bbCachePosKey=o):n=r.bbCache,!l&&(0!==r.bbCacheShift.x||0!==r.bbCacheShift.y)){var c=ot,d=r.bbCacheShift,h=function(e,t){null!=e&&c(e,t)};c(n,d);var f=r.bodyBounds,p=r.overlayBounds,v=r.labelBounds,g=r.arrowBounds;h(f,d),h(p,d),null!=g&&(h(g.source,d),h(g.target,d),h(g["mid-source"],d),h(g["mid-target"],d)),null!=v&&(h(v.main,d),h(v.all,d),h(v.source,d),h(v.target,d))}if(r.bbCacheShift.x=r.bbCacheShift.y=0,!a){var y=e.isNode();n=tt(),(t.includeNodes&&y||t.includeEdges&&!y)&&(t.includeOverlays?$r(n,r.overlayBounds):$r(n,r.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?$r(n,r.labelBounds.all):(t.includeMainLabels&&$r(n,r.labelBounds.mainRot),t.includeSourceLabels&&$r(n,r.labelBounds.sourceRot),t.includeTargetLabels&&$r(n,r.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},ii={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,useCache:!0},ai=ti(ii),oi=be(ii);Zr.boundingBox=function(e){var t;if(1!==this.length||null==this[0]._private.bbCache||void 0!==e&&void 0!==e.useCache&&!0!==e.useCache){t=tt();var n=oi(e=e||ii);if(this.cy().styleEnabled())for(var r=0;r<this.length;r++){var i=this[r],a=i._private,o=ni(i),s=a.bbCachePosKey===o,u=n.useCache&&s;i.recalculateRenderedStyle(u)}this.updateCompoundBounds();for(var l=0;l<this.length;l++){var c=this[l];$r(t,ri(c,n))}}else e=void 0===e?ii:oi(e),t=ri(this[0],e);return t.x1=Kr(t.x1),t.y1=Kr(t.y1),t.x2=Kr(t.x2),t.y2=Kr(t.y2),t.w=Kr(t.x2-t.x1),t.h=Kr(t.y2-t.y1),t},Zr.dirtyBoundingBoxCache=function(){for(var e=0;e<this.length;e++){var t=this[e]._private;t.bbCache=null,t.bbCacheShift.x=t.bbCacheShift.y=0,t.bbCachePosKey=null,t.bodyBounds=null,t.overlayBounds=null,t.labelBounds.all=null,t.labelBounds.source=null,t.labelBounds.target=null,t.labelBounds.main=null,t.labelBounds.sourceRot=null,t.labelBounds.targetRot=null,t.labelBounds.mainRot=null,t.arrowBounds.source=null,t.arrowBounds.target=null,t.arrowBounds["mid-source"]=null,t.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this},Zr.shiftCachedBoundingBox=function(e){for(var t=0;t<this.length;t++){var n=this[t]._private;null!=n.bbCache&&(n.bbCacheShift.x+=e.x,n.bbCacheShift.y+=e.y)}return this.emitAndNotify("bounds"),this},Zr.boundingBoxAt=function(e){var t=this.nodes(),n=this.cy(),r=n.hasCompoundNodes();if(r&&(t=t.filter((function(e){return!e.isParent()}))),_(e)){var i=e;e=function(){return i}}n.startBatch(),t.forEach((function(t,n){return t._private.bbAtOldPos=e(t,n)})).silentPositions(e),r&&this.updateCompoundBounds(!0);var a=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}}(this.boundingBox({useCache:!1}));return t.silentPositions((function(e){return e._private.bbAtOldPos})),n.endBatch(),a},Hr.boundingbox=Hr.bb=Hr.boundingBox,Hr.renderedBoundingbox=Hr.renderedBoundingBox;var si,ui,li=Zr;si=ui={};var ci=function(e){e.uppercaseName=N(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=N(e.outerName),si[e.name]=function(){var t=this[0],n=t._private,r=n.cy._private.styleEnabled;if(t){if(!r)return 1;if(t.isParent())return t.updateCompoundBounds(),n[e.autoName]||0;var i=t.pstyle(e.name);switch(i.strValue){case"label":return t.recalculateRenderedStyle(),n.rstyle[e.labelName]||0;default:return i.pfValue}}},si["outer"+e.uppercaseName]=function(){var t=this[0],n=t._private.cy._private.styleEnabled;if(t)return n?t[e.name]()+t.pstyle("border-width").pfValue+2*t.padding():1},si["rendered"+e.uppercaseName]=function(){var t=this[0];if(t)return t[e.name]()*this.cy().zoom()},si["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t)return t[e.outerName]()*this.cy().zoom()}};ci({name:"width"}),ci({name:"height"}),ui.padding=function(){var e=this[0],t=e._private;return e.isParent()?(e.updateCompoundBounds(),void 0!==t.autoPadding?t.autoPadding:e.pstyle("padding").pfValue):e.pstyle("padding").pfValue},ui.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()},ui.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var di=ui,hi={controlPoints:{get:function(e){return e.renderer().getControlPoints(e)},mult:!0},segmentPoints:{get:function(e){return e.renderer().getSegmentPoints(e)},mult:!0},sourceEndpoint:{get:function(e){return e.renderer().getSourceEndpoint(e)}},targetEndpoint:{get:function(e){return e.renderer().getTargetEndpoint(e)}},midpoint:{get:function(e){return e.renderer().getEdgeMidpoint(e)}}},fi=Object.keys(hi).reduce((function(e,t){var n=hi[t],r=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)}(t);return e[t]=function(){return function(e,t){if(e.isEdge())return t(e)}(this,n.get)},n.mult?e[r]=function(){return function(e,t){if(e.isEdge()){var n=e.cy(),r=n.pan(),i=n.zoom();return t(e).map((function(e){return We(e,i,r)}))}}(this,n.get)}:e[r]=function(){return function(e,t){if(e.isEdge()){var n=e.cy();return We(t(e),n.zoom(),n.pan())}}(this,n.get)},e}),{}),pi=j({},Ur,li,di,fi),vi=function(e,t){this.recycle(e,t)};function gi(){return!1}function yi(){return!0}vi.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=gi,null!=e&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?yi:gi):null!=e&&e.type?t=e:this.type=e,null!=t&&(this.originalEvent=t.originalEvent,this.type=null!=t.type?t.type:this.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),null!=this.cy&&null!=this.position&&null==this.renderedPosition){var n=this.position,r=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:n.x*r+i.x,y:n.y*r+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=yi;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=yi;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=yi,this.stopPropagation()},isDefaultPrevented:gi,isPropagationStopped:gi,isImmediatePropagationStopped:gi};var mi=/^([^.]+)(\.(?:[^.]+))?$/,bi={qualifierCompare:function(e,t){return e===t},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},xi=Object.keys(bi),wi={};function _i(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:wi,t=arguments.length>1?arguments[1]:void 0,n=0;n<xi.length;n++){var r=xi[n];this[r]=e[r]||bi[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var Ei=_i.prototype,ki=function(e,t,n,r,i,a,o){x(r)&&(i=r,r=null),o&&(a=null==a?o:j({},a,o));for(var s=w(n)?n:n.split(/\s+/),u=0;u<s.length;u++){var l=s[u];if(!B(l)){var c=l.match(mi);if(c)if(!1===t(e,l,c[1],c[2]?c[2]:null,r,i,a))break}}},Ci=function(e,t){return e.addEventFields(e.context,t),new vi(t.type,t)},Si=function(e,t,n){if("event"!==m(n))if(_(n))t(e,Ci(e,n));else for(var r=w(n)?n:n.split(/\s+/),i=0;i<r.length;i++){var a=r[i];if(!B(a)){var o=a.match(mi);if(o){var s=o[1],u=o[2]?o[2]:null;t(e,Ci(e,{type:s,namespace:u,target:e.context}))}}}else t(e,n)};Ei.on=Ei.addListener=function(e,t,n,r,i){return ki(this,(function(e,t,n,r,i,a,o){x(a)&&e.listeners.push({event:t,callback:a,type:n,namespace:r,qualifier:i,conf:o})}),e,t,n,r,i),this},Ei.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})},Ei.removeListener=Ei.off=function(e,t,n,r){var i=this;0!==this.emitting&&(this.listeners=this.listeners.slice());for(var a=this.listeners,o=function(o){var s=a[o];ki(i,(function(t,n,r,i,u,l){if((s.type===r||"*"===e)&&(!i&&".*"!==s.namespace||s.namespace===i)&&(!u||t.qualifierCompare(s.qualifier,u))&&(!l||s.callback===l))return a.splice(o,1),!1}),e,t,n,r)},s=a.length-1;s>=0;s--)o(s);return this},Ei.removeAllListeners=function(){return this.removeListener("*")},Ei.emit=Ei.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,w(t)||(t=[t]),Si(this,(function(e,a){null!=n&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],i=r.length);for(var o=function(n){var i=r[n];if(i.type===a.type&&(!i.namespace||i.namespace===a.namespace||".*"===i.namespace)&&e.eventMatches(e.context,i,a)){var o=[a];null!=t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.push(r)}}(o,t),e.beforeEmit(e.context,i,a),i.conf&&i.conf.one&&(e.listeners=e.listeners.filter((function(e){return e!==i})));var s=e.callbackContext(e.context,i,a),u=i.callback.apply(s,o);e.afterEmit(e.context,i,a),!1===u&&(a.stopPropagation(),a.preventDefault())}},s=0;s<i;s++)o(s);e.bubble(e.context)&&!a.isPropagationStopped()&&e.parent(e.context).emit(a,t)}),e),this.emitting--,this};var Pi={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&S(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},Ti=function(e){return b(e)?new Pr(e):e},Di={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||(n.emitter=new _i(Pi,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var r=Ti(t),i=0;i<this.length;i++){this[i].emitter().on(e,r,n)}return this},removeListener:function(e,t,n){for(var r=Ti(t),i=0;i<this.length;i++){this[i].emitter().removeListener(e,r,n)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){this[e].emitter().removeAllListeners()}return this},one:function(e,t,n){for(var r=Ti(t),i=0;i<this.length;i++){this[i].emitter().one(e,r,n)}return this},once:function(e,t,n){for(var r=Ti(t),i=0;i<this.length;i++){this[i].emitter().on(e,r,n,{once:!0,onceCollection:this})}},emit:function(e,t){for(var n=0;n<this.length;n++){this[n].emitter().emit(e,t)}return this},emitAndNotify:function(e,t){if(0!==this.length)return this.cy().notify(e,this),this.emit(e,t),this}};Yn.eventAliasesOn(Di);var Bi={nodes:function(e){return this.filter((function(e){return e.isNode()})).filter(e)},edges:function(e){return this.filter((function(e){return e.isEdge()})).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),n=0;n<this.length;n++){var r=this[n];r.isNode()?e.merge(r):t.merge(r)}return{nodes:e,edges:t}},filter:function(e,t){if(void 0===e)return this;if(b(e)||C(e))return new Pr(e).filter(this);if(x(e)){for(var n=this.spawn(),r=0;r<this.length;r++){var i=this[r];(t?e.apply(t,[i,r,this]):e(i,r,this))&&n.merge(i)}return n}return this.spawn()},not:function(e){if(e){b(e)&&(e=this.filter(e));for(var t=[],n=e._private.map,r=0;r<this.length;r++){var i=this[r];n.has(i.id())||t.push(i)}return this.spawn(t)}return this},absoluteComplement:function(){return this.cy().mutableElements().not(this)},intersect:function(e){if(b(e)){var t=e;return this.filter(t)}for(var n=[],r=e,i=this.length<e.length,a=i?r._private.map:this._private.map,o=i?this:r,s=0;s<o.length;s++){var u=o[s]._private.data.id,l=a.get(u);l&&n.push(l.ele)}return this.spawn(n)},xor:function(e){var t=this._private.cy;b(e)&&(e=t.$(e));var n=[],r=e,i=function(e,t){for(var r=0;r<e.length;r++){var i=e[r],a=i._private.data.id;t.hasElementWithId(a)||n.push(i)}};return i(this,r),i(r,this),this.spawn(n)},diff:function(e){var t=this._private.cy;b(e)&&(e=t.$(e));var n=[],r=[],i=[],a=e,o=function(e,t,n){for(var r=0;r<e.length;r++){var a=e[r],o=a._private.data.id;t.hasElementWithId(o)?i.push(a):n.push(a)}};return o(this,a,n),o(a,this,r),{left:this.spawn(n,{unique:!0}),right:this.spawn(r,{unique:!0}),both:this.spawn(i,{unique:!0})}},add:function(e){var t=this._private.cy;if(!e)return this;if(b(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=[],i=0;i<this.length;i++)r.push(this[i]);for(var a=this._private.map,o=0;o<e.length;o++){var s=!a.has(e[o].id());s&&r.push(e[o])}return this.spawn(r)},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&b(e)){var r=e;e=n.mutableElements().filter(r)}for(var i=t.map,a=0;a<e.length;a++){var o=e[a],s=o._private.data.id;if(!i.has(s)){var u=this.length++;this[u]=o,i.set(s,{ele:o,index:u})}else{var l=i.get(s).index;this[l]=o,i.set(s,{ele:o,index:l})}}return this},unmergeAt:function(e){var t=this[e].id(),n=this._private.map;this[e]=void 0,n.delete(t);var r=e===this.length-1;if(this.length>1&&!r){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&b(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r<e.length;r++)this.unmergeOne(e[r]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--){e(this[t])&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=0;r<this.length;r++){var i=this[r],a=t?e.apply(t,[i,r,this]):e(i,r,this);n.push(a)}return n},reduce:function(e,t){for(var n=t,r=0;r<this.length;r++)n=e(n,this[r],r,this);return n},max:function(e,t){for(var n,r=-1/0,i=0;i<this.length;i++){var a=this[i],o=t?e.apply(t,[a,i,this]):e(a,i,this);o>r&&(r=o,n=a)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=0;i<this.length;i++){var a=this[i],o=t?e.apply(t,[a,i,this]):e(a,i,this);o<r&&(r=o,n=a)}return{value:r,ele:n}}},Mi=Bi;Mi.u=Mi["|"]=Mi["+"]=Mi.union=Mi.or=Mi.add,Mi["\\"]=Mi["!"]=Mi["-"]=Mi.difference=Mi.relativeComplement=Mi.subtract=Mi.not,Mi.n=Mi["&"]=Mi["."]=Mi.and=Mi.intersection=Mi.intersect,Mi["^"]=Mi["(+)"]=Mi["(-)"]=Mi.symmetricDifference=Mi.symdiff=Mi.xor,Mi.fnFilter=Mi.filterFn=Mi.stdFilter=Mi.filter,Mi.complement=Mi.abscomp=Mi.absoluteComplement;var zi=function(e,t){var n=e.cy().hasCompoundNodes();function r(e){var t=e.pstyle("z-compound-depth");return"auto"===t.value?n?e.zDepth():0:"bottom"===t.value?-1:"top"===t.value?se:0}var i=r(e)-r(t);if(0!==i)return i;function a(e){return"auto"===e.pstyle("z-index-compare").value&&e.isNode()?1:0}var o=a(e)-a(t);if(0!==o)return o;var s=e.pstyle("z-index").value-t.pstyle("z-index").value;return 0!==s?s:e.poolIndex()-t.poolIndex()},Oi={forEach:function(e,t){if(x(e))for(var n=this.length,r=0;r<n;r++){var i=this[r];if(!1===(t?e.apply(t,[i,r,this]):e(i,r,this)))break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var n=[],r=this.length;null==t&&(t=r),null==e&&(e=0),e<0&&(e=r+e),t<0&&(t=r+t);for(var i=e;i>=0&&i<t&&i<r;i++)n.push(this[i]);return this.spawn(n)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return 0===this.length},nonempty:function(){return!this.empty()},sort:function(e){if(!x(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(zi)},zDepth:function(){var e=this[0];if(e){var t=e._private;if("nodes"===t.group){var n=t.data.parent?e.parents().size():0;return e.isParent()?n:se-1}var r=t.source,i=t.target,a=r.zDepth(),o=i.zDepth();return Math.max(a,o,0)}}};Oi.each=Oi.forEach;"undefined"!=("undefined"==typeof Symbol?"undefined":o(Symbol))&&"undefined"!=o(Symbol.iterator)&&(Oi[Symbol.iterator]=function(){var e=this,t={value:void 0,done:!1},n=0,r=this.length;return c({next:function(){return n<r?t.value=e[n++]:(t.value=void 0,t.done=!0),t}},Symbol.iterator,(function(){return this}))});var Ii=be({nodeDimensionsIncludeLabels:!1}),Ai={layoutDimensions:function(e){var t;if(e=Ii(e),this.takesUpSpace())if(e.nodeDimensionsIncludeLabels){var n=this.boundingBox();t={w:n.w,h:n.h}}else t={w:this.outerWidth(),h:this.outerHeight()};else t={w:0,h:0};return 0!==t.w&&0!==t.h||(t.w=t.h=1),t},layoutPositions:function(e,t,n){var r=this.nodes(),i=this.cy(),a=t.eles,o=function(e){return e.id()},s=z(n,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var u=t.spacingFactor&&1!==t.spacingFactor,l=function(){if(!u)return null;for(var e=tt(),t=0;t<r.length;t++){var n=r[t],i=s(n,t);nt(e,i.x,i.y)}return e}(),c=z((function(e,n){var r=s(e,n);u&&(r=function(e,t,n){var r=t.x1+t.w/2,i=t.y1+t.h/2;return{x:r+(n.x-r)*e,y:i+(n.y-i)*e}}(Math.abs(t.spacingFactor),l,r));return null!=t.transform&&(r=t.transform(e,r)),r}),o);if(t.animate){for(var d=0;d<r.length;d++){var h=r[d],f=c(h,d);if(null==t.animateFilter||t.animateFilter(h,d)){var p=h.animation({position:f,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(p)}else h.position(f)}if(t.fit){var v=i.animation({fit:{boundingBox:a.boundingBoxAt(c),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(v)}else if(void 0!==t.zoom&&void 0!==t.pan){var g=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(g)}e.animations.forEach((function(e){return e.play()})),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),Fn.all(e.animations.map((function(e){return e.promise()}))).then((function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})}))}else r.positions(c),t.fit&&i.fit(t.eles,t.padding),null!=t.zoom&&i.zoom(t.zoom),t.pan&&i.pan(t.pan),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){return this.cy().makeLayout(j({},e,{eles:this}))}};function Ni(e,t,n){var r,i=n._private,a=i.styleCache=i.styleCache||[];return null!=(r=a[e])?r:r=a[e]=t(n)}function Li(e,t){return e=te(e),function(n){return Ni(e,t,n)}}function Ri(e,t){e=te(e);var n=function(e){return t.call(e)};return function(){var t=this[0];if(t)return Ni(e,n,t)}}Ai.createLayout=Ai.makeLayout=Ai.layout;var ji={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),r=t.styleEnabled();return n&&r&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e,t=this.cy(),n=function(e){return e._private.styleCache=null};t.hasCompoundNodes()?((e=this.spawnSelf().merge(this.descendants()).merge(this.parents())).merge(e.connectedEdges()),e.forEach(n)):this.forEach((function(e){n(e),e.connectedEdges().forEach(n)}));return this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching())return t._private.batchStyleEles.merge(this),this;var n=t.hasCompoundNodes(),r=t.style(),i=this;e=!(!e&&void 0!==e),n&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var a=r.apply(i);return e?a.emitAndNotify("style"):a.emit("style"),this},parsedStyle:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){var i=n._private.style[e];return null!=i?i:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=n.style();if(_(e)){var i=e;r.applyBypass(this,i,!1),this.emitAndNotify("style")}else if(b(e)){if(void 0===t){var a=this[0];return a?r.getStylePropertyValue(a,e):void 0}r.applyBypass(this,e,t,!1),this.emitAndNotify("style")}else if(void 0===e){var o=this[0];return o?r.getRawStyle(o):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=t.style();if(void 0===e)for(var r=0;r<this.length;r++){var i=this[r];n.removeAllBypasses(i,!1)}else{e=e.split(/\s+/);for(var a=0;a<this.length;a++){var o=this[a];n.removeBypasses(o,e,!1)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),n=this[0];if(n){var r=n._private,i=n.pstyle("opacity").value;if(!t)return i;var a=r.data.parent?n.parents():null;if(a)for(var o=0;o<a.length;o++){i*=a[o].pstyle("opacity").value}return i}},transparent:function(){if(!this.cy().styleEnabled())return!1;var e=this[0],t=e.cy().hasCompoundNodes();return e?t?0===e.effectiveOpacity():0===e.pstyle("opacity").value:void 0},backgrounding:function(){return!!this.cy().styleEnabled()&&!!this[0]._private.backgrounding}};function Vi(e,t){var n=e._private.data.parent?e.parents():null;if(n)for(var r=0;r<n.length;r++){if(!t(n[r]))return!1}return!0}function Fi(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,r=e.parentOk||e.ok;return function(){var e=this.cy();if(!e.styleEnabled())return!0;var i=this[0],a=e.hasCompoundNodes();if(i){var o=i._private;if(!t(i))return!1;if(i.isNode())return!a||Vi(i,r);var s=o.source,u=o.target;return n(s)&&(!a||Vi(s,n))&&(s===u||n(u)&&(!a||Vi(u,n)))}}}var qi=Li("eleTakesUpSpace",(function(e){return"element"===e.pstyle("display").value&&0!==e.width()&&(!e.isNode()||0!==e.height())}));ji.takesUpSpace=Ri("takesUpSpace",Fi({ok:qi}));var Wi=Li("eleInteractive",(function(e){return"yes"===e.pstyle("events").value&&"visible"===e.pstyle("visibility").value&&qi(e)})),Yi=Li("parentInteractive",(function(e){return"visible"===e.pstyle("visibility").value&&qi(e)}));ji.interactive=Ri("interactive",Fi({ok:Wi,parentOk:Yi,edgeOkViaNode:qi})),ji.noninteractive=function(){var e=this[0];if(e)return!e.interactive()};var Xi=Li("eleVisible",(function(e){return"visible"===e.pstyle("visibility").value&&0!==e.pstyle("opacity").pfValue&&qi(e)})),Hi=qi;ji.visible=Ri("visible",Fi({ok:Xi,edgeOkViaNode:Hi})),ji.hidden=function(){var e=this[0];if(e)return!e.visible()},ji.isBundledBezier=Ri("isBundledBezier",(function(){return!!this.cy().styleEnabled()&&(!this.removed()&&"bezier"===this.pstyle("curve-style").value&&this.takesUpSpace())})),ji.bypass=ji.css=ji.style,ji.renderedCss=ji.renderedStyle,ji.removeBypass=ji.removeCss=ji.removeStyle,ji.pstyle=ji.parsedStyle;var Zi={};function Ui(e){return function(){var t=arguments,n=[];if(2===t.length){var r=t[0],i=t[1];this.on(e.event,r,i)}else if(1===t.length&&x(t[0])){var a=t[0];this.on(e.event,a)}else if(0===t.length||1===t.length&&w(t[0])){for(var o=1===t.length?t[0]:null,s=0;s<this.length;s++){var u=this[s],l=!e.ableField||u._private[e.ableField],c=u._private[e.field]!=e.value;if(e.overrideAble){var d=e.overrideAble(u);if(void 0!==d&&(l=d,!d))return this}l&&(u._private[e.field]=e.value,c&&n.push(u))}var h=this.spawn(n);h.updateStyle(),h.emit(e.event),o&&h.emit(o)}return this}}function Ki(e){Zi[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(void 0!==n)return n}return t._private[e.field]}},Zi[e.on]=Ui({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),Zi[e.off]=Ui({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}Ki({field:"locked",overrideField:function(e){return!!e.cy().autolock()||void 0},on:"lock",off:"unlock"}),Ki({field:"grabbable",overrideField:function(e){return!e.cy().autoungrabify()&&!e.pannable()&&void 0},on:"grabify",off:"ungrabify"}),Ki({field:"selected",ableField:"selectable",overrideAble:function(e){return!e.cy().autounselectify()&&void 0},on:"select",off:"unselect"}),Ki({field:"selectable",overrideField:function(e){return!e.cy().autounselectify()&&void 0},on:"selectify",off:"unselectify"}),Zi.deselect=Zi.unselect,Zi.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},Ki({field:"active",on:"activate",off:"unactivate"}),Ki({field:"pannable",on:"panify",off:"unpanify"}),Zi.inactive=function(){var e=this[0];if(e)return!e._private.active};var Gi={},$i=function(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r];if(i.isNode()){for(var a=!1,o=i.connectedEdges(),s=0;s<o.length;s++){var u=o[s],l=u.source(),c=u.target();if(e.noIncomingEdges&&c===i&&l!==i||e.noOutgoingEdges&&l===i&&c!==i){a=!0;break}}a||n.push(i)}}return this.spawn(n,{unique:!0}).filter(t)}},Qi=function(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r];if(i.isNode())for(var a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],u=s.source(),l=s.target();e.outgoing&&u===i?(n.push(s),n.push(l)):e.incoming&&l===i&&(n.push(s),n.push(u))}}return this.spawn(n,{unique:!0}).filter(t)}},Ji=function(e){return function(t){for(var n=this,r=[],i={};;){var a=e.outgoing?n.outgoers():n.incomers();if(0===a.length)break;for(var o=!1,s=0;s<a.length;s++){var u=a[s],l=u.id();i[l]||(i[l]=!0,r.push(u),o=!0)}if(!o)break;n=a}return this.spawn(r,{unique:!0}).filter(t)}};function ea(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r]._private[e.attr];i&&n.push(i)}return this.spawn(n,{unique:!0}).filter(t)}}function ta(e){return function(t){var n=[],r=this._private.cy,i=e||{};b(t)&&(t=r.$(t));for(var a=0;a<t.length;a++)for(var o=t[a]._private.edges,s=0;s<o.length;s++){var u=o[s],l=u._private.data,c=this.hasElementWithId(l.source)&&t.hasElementWithId(l.target),d=t.hasElementWithId(l.source)&&this.hasElementWithId(l.target);if(c||d){if(i.thisIsSrc||i.thisIsTgt){if(i.thisIsSrc&&!c)continue;if(i.thisIsTgt&&!d)continue}n.push(u)}}return this.spawn(n,{unique:!0})}}function na(e){return e=j({},{codirected:!1},e),function(t){for(var n=[],r=this.edges(),i=e,a=0;a<r.length;a++)for(var o=r[a]._private,s=o.source,u=s._private.data.id,l=o.data.target,c=s._private.edges,d=0;d<c.length;d++){var h=c[d],f=h._private.data,p=f.target,v=f.source,g=p===l&&v===u,y=u===p&&l===v;(i.codirected&&g||!i.codirected&&(g||y))&&n.push(h)}return this.spawn(n,{unique:!0}).filter(t)}}Gi.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},j(Gi,{roots:$i({noIncomingEdges:!0}),leaves:$i({noOutgoingEdges:!0}),outgoers:zr(Qi({outgoing:!0}),"outgoers"),successors:Ji({outgoing:!0}),incomers:zr(Qi({incoming:!0}),"incomers"),predecessors:Ji({incoming:!0})}),j(Gi,{neighborhood:zr((function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var i=n[r],a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],u=s.source(),l=s.target(),c=i===u?l:u;c.length>0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,{unique:!0}).filter(e)}),"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),Gi.neighbourhood=Gi.neighborhood,Gi.closedNeighbourhood=Gi.closedNeighborhood,Gi.openNeighbourhood=Gi.openNeighborhood,j(Gi,{source:zr((function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t}),"source"),target:zr((function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t}),"target"),sources:ea({attr:"source"}),targets:ea({attr:"target"})}),j(Gi,{edgesWith:zr(ta(),"edgesWith"),edgesTo:zr(ta({thisIsSrc:!0}),"edgesTo")}),j(Gi,{connectedEdges:zr((function(e){for(var t=[],n=0;n<this.length;n++){var r=this[n];if(r.isNode())for(var i=r._private.edges,a=0;a<i.length;a++){var o=i[a];t.push(o)}}return this.spawn(t,{unique:!0}).filter(e)}),"connectedEdges"),connectedNodes:zr((function(e){for(var t=[],n=0;n<this.length;n++){var r=this[n];r.isEdge()&&(t.push(r.source()[0]),t.push(r.target()[0]))}return this.spawn(t,{unique:!0}).filter(e)}),"connectedNodes"),parallelEdges:zr(na(),"parallelEdges"),codirectedEdges:zr(na({codirected:!0}),"codirectedEdges")}),j(Gi,{components:function(e){var t=this,n=t.cy(),r=n.collection(),i=null==e?t.nodes():e.nodes(),a=[];null!=e&&i.empty()&&(i=e.sources());var o=function(e,t){r.merge(e),i.unmerge(e),t.merge(e)};if(i.empty())return t.spawn();var s=function(){var e=n.collection();a.push(e);var r=i[0];o(r,e),t.bfs({directed:!1,roots:r,visit:function(t){return o(t,e)}}),e.forEach((function(n){n.connectedEdges().forEach((function(n){t.has(n)&&e.has(n.source())&&e.has(n.target())&&e.merge(n)}))}))};do{s()}while(i.length>0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),Gi.componentsOf=Gi.components;var ra=function(e,t,n){for(var r=null!=n?n:ge();e.hasElementWithId(r);)r=ge();return r},ia=function(e,t,n){if(void 0!==e&&T(e)){var r=new ke,i=!1;if(t){if(t.length>0&&_(t[0])&&!S(t[0])){i=!0;for(var a=[],o=new Se,s=0,u=t.length;s<u;s++){var l=t[s];null==l.data&&(l.data={});var c=l.data;if(null==c.id)c.id=ra(e,l);else if(e.hasElementWithId(c.id)||o.has(c.id))continue;var d=new Pe(e,l,!1);a.push(d),o.add(c.id)}t=a}}else t=[];this.length=0;for(var h=0,f=t.length;h<f;h++){var p=t[h][0];if(null!=p){var v=p._private.data.id;(null==n||n.unique&&!r.has(v))&&(r.set(v,{index:this.length,ele:p}),this[this.length]=p,this.length++)}}this._private={cy:e,map:r},i&&this.restore()}else he("A collection must have a reference to the core")},aa=Pe.prototype=ia.prototype;aa.instanceString=function(){return"collection"},aa.spawn=function(e,t,n){return T(e)||(n=t,t=e,e=this.cy()),new ia(e,t,n)},aa.spawnSelf=function(){return this.spawn(this)},aa.cy=function(){return this._private.cy},aa.renderer=function(){return this._private.cy.renderer()},aa.element=function(){return this[0]},aa.collection=function(){return P(this)?this:new ia(this._private.cy,[this])},aa.unique=function(){return new ia(this._private.cy,this,{unique:!0})},aa.hasElementWithId=function(e){return e=""+e,this._private.map.has(e)},aa.getElementById=function(e){e=""+e;var t=this._private.cy,n=this._private.map.get(e);return n?n.ele:new ia(t)},aa.$id=aa.getElementById,aa.poolIndex=function(){var e=this._private.cy._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index},aa.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},aa.indexOfId=function(e){return e=""+e,this._private.map.get(e).index},aa.json=function(e){var t=this.element(),n=this.cy();if(null==t&&e)return this;if(null!=t){var r=t._private;if(_(e)){if(n.startBatch(),e.data){t.data(e.data);var i=r.data;if(t.isEdge()){var a=!1,o={},s=e.data.source,u=e.data.target;null!=s&&s!=i.source&&(o.source=""+s,a=!0),null!=u&&u!=i.target&&(o.target=""+u,a=!0),a&&(t=t.move(o))}else{var l="parent"in e.data,c=e.data.parent;!l||null==c&&null==i.parent||c==i.parent||(void 0===c&&(c=null),null!=c&&(c=""+c),t=t.move({parent:c}))}}e.position&&t.position(e.position);var d=function(n,i,a){var o=e[n];null!=o&&o!==r[n]&&(o?t[i]():t[a]())};return d("removed","remove","restore"),d("selected","select","unselect"),d("selectable","selectify","unselectify"),d("locked","lock","unlock"),d("grabbable","grabify","ungrabify"),d("pannable","panify","unpanify"),null!=e.classes&&t.classes(e.classes),n.endBatch(),this}if(void 0===e){var h={data:ve(r.data),position:ve(r.position),group:r.group,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbable:r.grabbable,pannable:r.pannable,classes:null};h.classes="";var f=0;return r.classes.forEach((function(e){return h.classes+=0==f++?e:" "+e})),h}}},aa.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t].json();e.push(n)}return e},aa.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=this[n].json(),i=new Pe(e,r,!1);t.push(i)}return new ia(e,t)},aa.copy=aa.clone,aa.restore=function(){for(var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this,a=i.cy(),o=a._private,s=[],u=[],l=0,c=i.length;l<c;l++){var d=i[l];r&&!d.removed()||(d.isNode()?s.push(d):u.push(d))}e=s.concat(u);var h=function(){e.splice(t,1),t--};for(t=0;t<e.length;t++){var f=e[t],p=f._private,v=p.data;if(f.clearTraversalCache(),r||p.removed)if(void 0===v.id)v.id=ra(a,f);else if(E(v.id))v.id=""+v.id;else{if(B(v.id)||!b(v.id)){he("Can not create element with invalid string ID `"+v.id+"`"),h();continue}if(a.hasElementWithId(v.id)){he("Can not create second element with ID `"+v.id+"`"),h();continue}}else;var g=v.id;if(f.isNode()){var y=p.position;null==y.x&&(y.x=0),null==y.y&&(y.y=0)}if(f.isEdge()){for(var m=f,x=["source","target"],w=x.length,_=!1,k=0;k<w;k++){var C=x[k],S=v[C];E(S)&&(S=v[C]=""+v[C]),null==S||""===S?(he("Can not create edge `"+g+"` with unspecified "+C),_=!0):a.hasElementWithId(S)||(he("Can not create edge `"+g+"` with nonexistant "+C+" `"+S+"`"),_=!0)}if(_){h();continue}var P=a.getElementById(v.source),T=a.getElementById(v.target);P.same(T)?P._private.edges.push(m):(P._private.edges.push(m),T._private.edges.push(m)),m._private.source=P,m._private.target=T}p.map=new ke,p.map.set(g,{ele:f,index:0}),p.removed=!1,r&&a.addToPool(f)}for(var D=0;D<s.length;D++){var M=s[D],z=M._private.data;E(z.parent)&&(z.parent=""+z.parent);var O=z.parent,I=null!=O;if(I){var A=a.getElementById(O);if(A.empty())z.parent=void 0;else{for(var N=!1,L=A;!L.empty();){if(M.same(L)){N=!0,z.parent=void 0;break}L=L.parent()}N||(A[0]._private.children.push(M),M._private.parent=A[0],o.hasCompoundNodes=!0)}}}if(e.length>0){for(var R=new ia(a,e),j=0;j<R.length;j++){var V=R[j];V.isNode()||(V.parallelEdges().clearTraversalCache(),V.source().clearTraversalCache(),V.target().clearTraversalCache())}(o.hasCompoundNodes?a.collection().merge(R).merge(R.connectedNodes()).merge(R.parent()):R).dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(n),n?R.emitAndNotify("add"):r&&R.emit("add")}return i},aa.removed=function(){var e=this[0];return e&&e._private.removed},aa.inside=function(){var e=this[0];return e&&!e._private.removed},aa.remove=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this,r=[],i={},a=n._private.cy;function o(e){for(var t=e._private.edges,n=0;n<t.length;n++)u(t[n])}function s(e){for(var t=e._private.children,n=0;n<t.length;n++)u(t[n])}function u(e){var n=i[e.id()];t&&e.removed()||n||(i[e.id()]=!0,e.isNode()?(r.push(e),o(e),s(e)):r.unshift(e))}for(var l=0,c=n.length;l<c;l++){var d=n[l];u(d)}function h(e,t){var n=e._private.edges;xe(n,t),e.clearTraversalCache()}function f(e){e.clearTraversalCache()}var p=[];function v(e,t){t=t[0];var n=(e=e[0])._private.children,r=e.id();xe(n,t),t._private.parent=null,p.ids[r]||(p.ids[r]=!0,p.push(e))}p.ids={},n.dirtyCompoundBoundsCache(),t&&a.removeFromPool(r);for(var g=0;g<r.length;g++){var y=r[g];if(y.isEdge()){var m=y.source()[0],b=y.target()[0];h(m,y),h(b,y);for(var x=y.parallelEdges(),w=0;w<x.length;w++){var _=x[w];f(_),_.isBundledBezier()&&_.dirtyBoundingBoxCache()}}else{var E=y.parent();0!==E.length&&v(E,y)}t&&(y._private.removed=!0)}var k=a._private.elements;a._private.hasCompoundNodes=!1;for(var C=0;C<k.length;C++){var S=k[C];if(S.isParent()){a._private.hasCompoundNodes=!0;break}}var P=new ia(this.cy(),r);P.size()>0&&(e?P.emitAndNotify("remove"):t&&P.emit("remove"));for(var T=0;T<p.length;T++){var D=p[T];t&&D.removed()||D.updateStyle()}return P},aa.move=function(e){var t=this._private.cy,n=this,r=function(e){return null==e?e:""+e};if(void 0!==e.source||void 0!==e.target){var i=r(e.source),a=r(e.target),o=null!=i&&t.hasElementWithId(i),s=null!=a&&t.hasElementWithId(a);(o||s)&&(t.batch((function(){n.remove(!1,!1),n.emitAndNotify("moveout");for(var e=0;e<n.length;e++){var t=n[e],r=t._private.data;t.isEdge()&&(o&&(r.source=i),s&&(r.target=a))}n.restore(!1,!1)})),n.emitAndNotify("move"))}else if(void 0!==e.parent){var u=r(e.parent);if(null===u||t.hasElementWithId(u)){var l=null===u?void 0:u;t.batch((function(){var e=n.remove(!1,!1);e.emitAndNotify("moveout");for(var t=0;t<n.length;t++){var r=n[t],i=r._private.data;r.isNode()&&(i.parent=l)}e.restore(!1,!1)})),n.emitAndNotify("move")}}return this},[In,Xn,Hn,Dr,Or,Vr,Fr,pi,Di,Bi,{isNode:function(){return"nodes"===this.group()},isEdge:function(){return"edges"===this.group()},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},Oi,Ai,ji,Zi,Gi].forEach((function(e){j(aa,e)}));var oa={add:function(e){var t,n=this;if(C(e)){var r=e;if(r._private.cy===n)t=r.restore();else{for(var i=[],a=0;a<r.length;a++){var o=r[a];i.push(o.json())}t=new ia(n,i)}}else if(w(e)){t=new ia(n,e)}else if(_(e)&&(w(e.nodes)||w(e.edges))){for(var s=e,u=[],l=["nodes","edges"],c=0,d=l.length;c<d;c++){var h=l[c],f=s[h];if(w(f))for(var p=0,v=f.length;p<v;p++){var g=j({group:h},f[p]);u.push(g)}}t=new ia(n,u)}else{t=new Pe(n,e).collection()}return t},remove:function(e){if(C(e));else if(b(e)){var t=e;e=this.$(t)}return e.remove()}};
|
||
/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */
|
||
/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */
|
||
var sa=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){var i={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction};return{dx:i.v,dv:e(i)}}function n(n,r){var i={dx:n.v,dv:e(n)},a=t(n,.5*r,i),o=t(n,.5*r,a),s=t(n,r,o),u=1/6*(i.dx+2*(a.dx+o.dx)+s.dx),l=1/6*(i.dv+2*(a.dv+o.dv)+s.dv);return n.x=n.x+u*r,n.v=n.v+l*r,n}return function e(t,r,i){var a,o,s,u={x:-1,v:0,tension:null,friction:null},l=[0],c=0;for(t=parseFloat(t)||500,r=parseFloat(r)||20,i=i||null,u.tension=t,u.friction=r,o=(a=null!==i)?(c=e(t,r))/i*.016:.016;s=n(s||u,o),l.push(1+s.x),c+=16,Math.abs(s.x)>1e-4&&Math.abs(s.v)>1e-4;);return a?function(e){return l[e*(l.length-1)|0]}:c}}(),ua=function(e,t,n,r){var i=function(e,t,n,r){var i=4,a=.001,o=1e-7,s=10,u=11,l=1/(u-1),c="undefined"!=typeof Float32Array;if(4!==arguments.length)return!1;for(var d=0;d<4;++d)if("number"!=typeof arguments[d]||isNaN(arguments[d])||!isFinite(arguments[d]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var h=c?new Float32Array(u):new Array(u);function f(e,t){return 1-3*t+3*e}function p(e,t){return 3*t-6*e}function v(e){return 3*e}function g(e,t,n){return((f(t,n)*e+p(t,n))*e+v(t))*e}function y(e,t,n){return 3*f(t,n)*e*e+2*p(t,n)*e+v(t)}function m(t,r){for(var a=0;a<i;++a){var o=y(r,e,n);if(0===o)return r;r-=(g(r,e,n)-t)/o}return r}function b(){for(var t=0;t<u;++t)h[t]=g(t*l,e,n)}function x(t,r,i){var a,u,l=0;do{(a=g(u=r+(i-r)/2,e,n)-t)>0?i=u:r=u}while(Math.abs(a)>o&&++l<s);return u}function w(t){for(var r=0,i=1,o=u-1;i!==o&&h[i]<=t;++i)r+=l;--i;var s=r+(t-h[i])/(h[i+1]-h[i])*l,c=y(s,e,n);return c>=a?m(t,s):0===c?s:x(t,r,r+l)}var _=!1;function E(){_=!0,e===t&&n===r||b()}var k=function(i){return _||E(),e===t&&n===r?i:0===i?0:1===i?1:g(w(i),t,r)};k.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var C="generateBezier("+[e,t,n,r]+")";return k.toString=function(){return C},k}(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},la={linear:function(e,t,n){return e+(t-e)*n},ease:ua(.25,.1,.25,1),"ease-in":ua(.42,0,1,1),"ease-out":ua(0,0,.58,1),"ease-in-out":ua(.42,0,.58,1),"ease-in-sine":ua(.47,0,.745,.715),"ease-out-sine":ua(.39,.575,.565,1),"ease-in-out-sine":ua(.445,.05,.55,.95),"ease-in-quad":ua(.55,.085,.68,.53),"ease-out-quad":ua(.25,.46,.45,.94),"ease-in-out-quad":ua(.455,.03,.515,.955),"ease-in-cubic":ua(.55,.055,.675,.19),"ease-out-cubic":ua(.215,.61,.355,1),"ease-in-out-cubic":ua(.645,.045,.355,1),"ease-in-quart":ua(.895,.03,.685,.22),"ease-out-quart":ua(.165,.84,.44,1),"ease-in-out-quart":ua(.77,0,.175,1),"ease-in-quint":ua(.755,.05,.855,.06),"ease-out-quint":ua(.23,1,.32,1),"ease-in-out-quint":ua(.86,0,.07,1),"ease-in-expo":ua(.95,.05,.795,.035),"ease-out-expo":ua(.19,1,.22,1),"ease-in-out-expo":ua(1,0,0,1),"ease-in-circ":ua(.6,.04,.98,.335),"ease-out-circ":ua(.075,.82,.165,1),"ease-in-out-circ":ua(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return la.linear;var r=sa(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":ua};function ca(e,t,n,r,i){if(1===r)return n;if(t===n)return n;var a=i(t,n,r);return null==e||((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max))),a}function da(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function ha(e,t,n,r,i){var a=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var o=da(e,i),s=da(t,i);if(E(o)&&E(s))return ca(a,o,s,n,r);if(w(o)&&w(s)){for(var u=[],l=0;l<s.length;l++){var c=o[l],d=s[l];if(null!=c&&null!=d){var h=ca(a,c,d,n,r);u.push(h)}else u.push(d)}return u}}function fa(e,t,n,r){var i=!r,a=e._private,o=t._private,s=o.easing,u=o.startTime,l=(r?e:e.cy()).style();if(!o.easingImpl)if(null==s)o.easingImpl=la.linear;else{var c,d,h;if(b(s))c=l.parse("transition-timing-function",s).value;else c=s;b(c)?(d=c,h=[]):(d=c[1],h=c.slice(2).map((function(e){return+e}))),h.length>0?("spring"===d&&h.push(o.duration),o.easingImpl=la[d].apply(null,h)):o.easingImpl=la[d]}var f,p=o.easingImpl;if(f=0===o.duration?1:(n-u)/o.duration,o.applying&&(f=o.progress),f<0?f=0:f>1&&(f=1),null==o.delay){var v=o.startPosition,g=o.position;if(g&&i&&!e.locked()){var y={};pa(v.x,g.x)&&(y.x=ha(v.x,g.x,f,p)),pa(v.y,g.y)&&(y.y=ha(v.y,g.y,f,p)),e.position(y)}var m=o.startPan,x=o.pan,w=a.pan,_=null!=x&&r;_&&(pa(m.x,x.x)&&(w.x=ha(m.x,x.x,f,p)),pa(m.y,x.y)&&(w.y=ha(m.y,x.y,f,p)),e.emit("pan"));var E=o.startZoom,k=o.zoom,C=null!=k&&r;C&&(pa(E,k)&&(a.zoom=et(a.minZoom,ha(E,k,f,p),a.maxZoom)),e.emit("zoom")),(_||C)&&e.emit("viewport");var S=o.style;if(S&&S.length>0&&i){for(var P=0;P<S.length;P++){var T=S[P],D=T.name,B=T,M=o.startStyle[D],z=ha(M,B,f,p,l.properties[M.name]);l.overrideBypass(e,D,z)}e.emit("style")}}return o.progress=f,f}function pa(e,t){return null!=e&&null!=t&&(!(!E(e)||!E(t))||!(!e||!t))}function va(e,t,n,r){var i=t._private;i.started=!0,i.startTime=n-i.progress*i.duration}function ga(e,t){var n=t._private.aniEles,r=[];function i(t,n){var i=t._private,a=i.animation.current,o=i.animation.queue,s=!1;if(0===a.length){var u=o.shift();u&&a.push(u)}for(var l=function(e){for(var t=e.length-1;t>=0;t--){(0,e[t])()}e.splice(0,e.length)},c=a.length-1;c>=0;c--){var d=a[c],h=d._private;h.stopped?(a.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,l(h.frames)):(h.playing||h.applying)&&(h.playing&&h.applying&&(h.applying=!1),h.started||va(0,d,e),fa(t,d,e,n),h.applying&&(h.applying=!1),l(h.frames),null!=h.step&&h.step(e),d.completed()&&(a.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,l(h.completes)),s=!0)}return n||0!==a.length||0!==o.length||r.push(t),s}for(var a=!1,o=0;o<n.length;o++){var s=i(n[o]);a=a||s}var u=i(t,!0);(a||u)&&(n.length>0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var ya={animate:Yn.animate(),animation:Yn.animation(),animated:Yn.animated(),clearQueue:Yn.clearQueue(),delay:Yn.delay(),delayAnimation:Yn.delayAnimation(),stop:Yn.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender((function(t,n){ga(n,e)}),t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&Z((function(n){ga(n,e),t()}))}()}}},ma={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&S(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},ba=function(e){return b(e)?new Pr(e):e},xa={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new _i(ma,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,ba(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,ba(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,ba(t),n),this},once:function(e,t,n){return this.emitter().one(e,ba(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};Yn.eventAliasesOn(xa);var wa={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};wa.jpeg=wa.jpg;var _a={layout:function(e){if(null!=e)if(null!=e.name){var t=e.name,n=this.extension("layout",t);if(null!=n){var r;r=b(e.eles)?this.$(e.eles):null!=e.eles?e.eles:this.$();var i=new n(j({},e,{cy:this,eles:r}));return i}he("No such layout `"+t+"` found. Did you forget to import it and `cytoscape.use()` it?")}else he("A `name` must be specified to make a layout");else he("Layout options must be specified to make a layout")}};_a.createLayout=_a.makeLayout=_a.layout;var Ea={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t)}else if(n.notificationsEnabled){var i=this.renderer();!this.destroyed()&&i&&i.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach((function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)}))}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch((function(){for(var n=Object.keys(e),r=0;r<n.length;r++){var i=n[r],a=e[i];t.getElementById(i).data(a)}}))}},ka=be({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1}),Ca={renderTo:function(e,t,n,r){return this._private.renderer.renderTo(e,t,n,r),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var t=this.extension("renderer",e.name);if(null!=t){void 0!==e.wheelSensitivity&&pe("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var n=ka(e);n.cy=this,this._private.renderer=new t(n),this.notify("init")}else he("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"))},destroyRenderer:function(){this.notify("destroy");var e=this.container();if(e)for(e._cyreg=null;e.childNodes.length>0;)e.removeChild(e.childNodes[0]);this._private.renderer=null,this.mutableElements().forEach((function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]}))},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Ca.invalidateDimensions=Ca.resize;var Sa={collection:function(e,t){return b(e)?this.$(e):C(e)?e.collection():w(e)?new ia(this,e,t):new ia(this)},nodes:function(e){var t=this.$((function(e){return e.isNode()}));return e?t.filter(e):t},edges:function(e){var t=this.$((function(e){return e.isEdge()}));return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};Sa.elements=Sa.filter=Sa.$;var Pa={};Pa.apply=function(e){var t=this._private,n=t.cy.collection();t.newStyle&&(t.contextStyles={},t.propDiffs={},this.cleanElements(e,!0));for(var r=0;r<e.length;r++){var i=e[r],a=this.getContextMeta(i);if(!a.empty){var o=this.getContextStyle(a),s=this.applyContextStyle(a,o,i);t.newStyle||this.updateTransitions(i,s.diffProps),this.updateStyleHints(i)&&n.merge(i)}}return t.newStyle=!1,n},Pa.getPropertiesDiff=function(e,t){var n=this._private.propDiffs=this._private.propDiffs||{},r=e+"-"+t,i=n[r];if(i)return i;for(var a=[],o={},s=0;s<this.length;s++){var u=this[s],l="t"===e[s],c="t"===t[s],d=l!==c,h=u.mappedProperties.length>0;if(d||c&&h){var f=void 0;d&&h||d?f=u.properties:h&&(f=u.mappedProperties);for(var p=0;p<f.length;p++){for(var v=f[p],g=v.name,y=!1,m=s+1;m<this.length;m++){var b=this[m];if("t"===t[m]&&(y=null!=b.properties[v.name]))break}o[g]||y||(o[g]=!0,a.push(g))}}}return n[r]=a,a},Pa.getContextMeta=function(e){var t,n="",r=e._private.styleCxtKey||"";this._private.newStyle&&(r="");for(var i=0;i<this.length;i++){var a=this[i];n+=a.selector&&a.selector.matches(e)?"t":"f"}return t=this.getPropertiesDiff(r,n),e._private.styleCxtKey=n,{key:n,diffPropNames:t,empty:0===t.length}},Pa.getContextStyle=function(e){var t=e.key,n=this._private.contextStyles=this._private.contextStyles||{};if(n[t])return n[t];for(var r={_private:{key:t}},i=0;i<this.length;i++){var a=this[i];if("t"===t[i])for(var o=0;o<a.properties.length;o++){var s=a.properties[o];r[s.name]=s}}return n[t]=r,r},Pa.applyContextStyle=function(e,t,n){for(var r=e.diffPropNames,i={},a=this.types,o=0;o<r.length;o++){var s=r[o],u=t[s],l=n.pstyle(s);if(!u){if(!l)continue;u=l.bypass?{name:s,deleteBypassed:!0}:{name:s,delete:!0}}if(l!==u){if(u.mapped===a.fn&&null!=l&&null!=l.mapping&&l.mapping.value===u.value){var c=l.mapping;if((c.fnValue=u.value(n))===c.prevFnValue)continue}var d=i[s]={prev:l};this.applyParsedProperty(n,u),d.next=n.pstyle(s),d.next&&d.next.bypass&&(d.next=d.next.bypassed)}}return{diffProps:i}},Pa.updateStyleHints=function(e){var t=e._private,n=this,r=n.propertyGroupNames,i=n.propertyGroupKeys,a=function(e,t,r){return n.getPropertiesHash(e,t,r)},o=t.styleKey;if(e.removed())return!1;var s="nodes"===t.group,u=e._private.style;r=Object.keys(u);for(var l=0;l<i.length;l++){var c=i[l];t.styleKeys[c]=[9261,5381]}for(var d=function(e,n){return t.styleKeys[n][0]=$(e,t.styleKeys[n][0])},h=function(e,n){return t.styleKeys[n][1]=Q(e,t.styleKeys[n][1])},f=function(e,t){d(e,t),h(e,t)},p=function(e,t){for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);d(r,t),h(r,t)}},v=function(e){return-128<e&&e<128&&Math.floor(e)!==e?2e9-(1024*e|0):e},g=0;g<r.length;g++){var y=r[g],m=u[y];if(null!=m){var b=this.properties[y],x=b.type,w=b.groupKey,_=void 0;null!=b.hashOverride?_=b.hashOverride(e,m):null!=m.pfValue&&(_=m.pfValue);var E=null==b.enums?m.value:null,k=null!=_,C=k||null!=E,S=m.units;if(x.number&&C){var P=k?_:E;if(x.multiple)for(var T=0;T<P.length;T++)f(v(P[T]),w);else f(v(P),w);k||null==S||p(S,w)}else p(m.strValue,w)}}for(var D,B,M=[9261,5381],z=0;z<i.length;z++){var O=i[z],I=t.styleKeys[O];M[0]=$(I[0],M[0]),M[1]=Q(I[1],M[1])}t.styleKey=(D=M[0],B=M[1],2097152*D+B);var A=t.styleKeys;t.labelDimsKey=J(A.labelDimensions);var N=a(e,["label"],A.labelDimensions);if(t.labelKey=J(N),t.labelStyleKey=J(ee(A.commonLabel,N)),!s){var L=a(e,["source-label"],A.labelDimensions);t.sourceLabelKey=J(L),t.sourceLabelStyleKey=J(ee(A.commonLabel,L));var R=a(e,["target-label"],A.labelDimensions);t.targetLabelKey=J(R),t.targetLabelStyleKey=J(ee(A.commonLabel,R))}if(s){var j=t.styleKeys,V=j.nodeBody,F=j.nodeBorder,q=j.backgroundImage,W=j.compound,Y=j.pie,X=[F,q,W,Y].reduce(ee,V);t.nodeKey=J(X),t.hasPie=9261!==Y[0]&&5381!==Y[1]}return o!==t.styleKey},Pa.clearStyleHints=function(e){var t=e._private;t.styleKeys={},t.styleKey=null,t.labelKey=null,t.labelStyleKey=null,t.sourceLabelKey=null,t.sourceLabelStyleKey=null,t.targetLabelKey=null,t.targetLabelStyleKey=null,t.nodeKey=null,t.hasPie=null},Pa.applyParsedProperty=function(e,t){var n,r=this,i=t,a=e._private.style,o=r.types,s=r.properties[i.name].type,u=i.bypass,l=a[i.name],c=l&&l.bypass,d=e._private,h=function(e){return null==e?null:null!=e.pfValue?e.pfValue:e.value},f=function(){var t=h(l),n=h(i);r.checkTriggers(e,i.name,t,n)};if("curve-style"===t.name&&e.isEdge()&&("bezier"!==t.value&&e.isLoop()||"haystack"===t.value&&(e.source().isParent()||e.target().isParent()))&&(i=t=this.parse(t.name,"bezier",u)),i.delete)return a[i.name]=void 0,f(),!0;if(i.deleteBypassed)return l?!!l.bypass&&(l.bypassed=void 0,f(),!0):(f(),!0);if(i.deleteBypass)return l?!!l.bypass&&(a[i.name]=l.bypassed,f(),!0):(f(),!0);var p=function(){pe("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+i.name+"` with data field `"+i.field+"`); try a `["+i.field+"]` selector to limit scope to elements with `"+i.field+"` defined")};switch(i.mapped){case o.mapData:for(var v,g=i.field.split("."),y=d.data,m=0;m<g.length&&y;m++){y=y[g[m]]}if(null==y)return p(),!1;if(!E(y))return pe("Do not use continuous mappers without specifying numeric data (i.e. `"+i.field+": "+y+"` for `"+e.id()+"` is non-numeric)"),!1;var b=i.fieldMax-i.fieldMin;if((v=0===b?0:(y-i.fieldMin)/b)<0?v=0:v>1&&(v=1),s.color){var x=i.valueMin[0],w=i.valueMax[0],_=i.valueMin[1],k=i.valueMax[1],C=i.valueMin[2],S=i.valueMax[2],P=null==i.valueMin[3]?1:i.valueMin[3],T=null==i.valueMax[3]?1:i.valueMax[3],D=[Math.round(x+(w-x)*v),Math.round(_+(k-_)*v),Math.round(C+(S-C)*v),Math.round(P+(T-P)*v)];n={bypass:i.bypass,name:i.name,value:D,strValue:"rgb("+D[0]+", "+D[1]+", "+D[2]+")"}}else{if(!s.number)return!1;var B=i.valueMin+(i.valueMax-i.valueMin)*v;n=this.parse(i.name,B,i.bypass,"mapping")}if(!n)return p(),!1;n.mapping=i,i=n;break;case o.data:for(var M=i.field.split("."),z=d.data,O=0;O<M.length&&z;O++){z=z[M[O]]}if(null!=z&&(n=this.parse(i.name,z,i.bypass,"mapping")),!n)return p(),!1;n.mapping=i,i=n;break;case o.fn:var I=i.value,A=null!=i.fnValue?i.fnValue:I(e);if(i.prevFnValue=A,null==A)return pe("Custom function mappers may not return null (i.e. `"+i.name+"` for ele `"+e.id()+"` is null)"),!1;if(!(n=this.parse(i.name,A,i.bypass,"mapping")))return pe("Custom function mappers may not return invalid values for the property type (i.e. `"+i.name+"` for ele `"+e.id()+"` is invalid)"),!1;n.mapping=ve(i),i=n;break;case void 0:break;default:return!1}return u?(i.bypassed=c?l.bypassed:l,a[i.name]=i):c?l.bypassed=i:a[i.name]=i,f(),!0},Pa.cleanElements=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(this.clearStyleHints(r),r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),t)for(var i=r._private.style,a=Object.keys(i),o=0;o<a.length;o++){var s=a[o],u=i[s];null!=u&&(u.bypass?u.bypassed=null:i[s]=null)}else r._private.style={}}},Pa.update=function(){this._private.cy.mutableElements().updateStyle()},Pa.updateTransitions=function(e,t){var n=this,r=e._private,i=e.pstyle("transition-property").value,a=e.pstyle("transition-duration").pfValue,o=e.pstyle("transition-delay").pfValue;if(i.length>0&&a>0){for(var s={},u=!1,l=0;l<i.length;l++){var c=i[l],d=e.pstyle(c),h=t[c];if(h){var f=h.prev,p=null!=h.next?h.next:d,v=!1,g=void 0;f&&(E(f.pfValue)&&E(p.pfValue)?(v=p.pfValue-f.pfValue,g=f.pfValue+1e-6*v):E(f.value)&&E(p.value)?(v=p.value-f.value,g=f.value+1e-6*v):w(f.value)&&w(p.value)&&(v=f.value[0]!==p.value[0]||f.value[1]!==p.value[1]||f.value[2]!==p.value[2],g=f.strValue),v&&(s[c]=p.strValue,this.applyBypass(e,c,g),u=!0))}}if(!u)return;r.transitioning=!0,new Fn((function(t){o>0?e.delayAnimation(o).play().promise().then(t):t()})).then((function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()})).then((function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1}))}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},Pa.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);null!=s&&s(n,r)&&a(o)},Pa.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,(function(e){return e.triggersZOrder}),(function(){i._private.cy.notify("zorder",e)}))},Pa.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBounds}),(function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),"bezier"!==e.pstyle("curve-style").value&&("curve-style"!==t||"bezier"!==n&&"bezier"!==r)||!i.triggersBoundsOfParallelBeziers||e.parallelEdges().forEach((function(e){e.isBundledBezier()&&e.dirtyBoundingBoxCache()}))}))},Pa.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var Ta={applyBypass:function(e,t,n,r){var i=[];if("*"===t||"**"===t){if(void 0!==n)for(var a=0;a<this.properties.length;a++){var o=this.properties[a].name,s=this.parse(o,n,!0);s&&i.push(s)}}else if(b(t)){var u=this.parse(t,n,!0);u&&i.push(u)}else{if(!_(t))return!1;var l=t;r=n;for(var c=Object.keys(l),d=0;d<c.length;d++){var h=c[d],f=l[h];if(void 0===f&&(f=l[I(h)]),void 0!==f){var p=this.parse(h,f,!0);p&&i.push(p)}}}if(0===i.length)return!1;for(var v=!1,g=0;g<e.length;g++){for(var y=e[g],m={},x=void 0,w=0;w<i.length;w++){var E=i[w];if(r){var k=y.pstyle(E.name);x=m[E.name]={prev:k}}v=this.applyParsedProperty(y,E)||v,r&&(x.next=y.pstyle(E.name))}v&&this.updateStyleHints(y),r&&this.updateTransitions(y,m,!0)}return v},overrideBypass:function(e,t,n){t=O(t);for(var r=0;r<e.length;r++){var i=e[r],a=i._private.style[t],o=this.properties[t].type,s=o.color,u=o.mutiple,l=a?null!=a.pfValue?a.pfValue:a.value:null;a&&a.bypass?(a.value=n,null!=a.pfValue&&(a.pfValue=n),a.strValue=s?"rgb("+n.join(",")+")":u?n.join(" "):""+n,this.updateStyleHints(i)):this.applyBypass(i,t,n),this.checkTriggers(i,t,l,n)}},removeAllBypasses:function(e,t){return this.removeBypasses(e,this.propertyNames,t)},removeBypasses:function(e,t,n){for(var r=0;r<e.length;r++){for(var i=e[r],a={},o=0;o<t.length;o++){var s=t[o],u=this.properties[s],l=i.pstyle(u.name);if(l&&l.bypass){var c=this.parse(s,"",!0),d=a[u.name]={prev:l};this.applyParsedProperty(i,c),d.next=i.pstyle(u.name)}}this.updateStyleHints(i),n&&this.updateTransitions(i,a,!0)}}},Da={getEmSizeInPixels:function(){var e=this.containerCss("font-size");return null!=e?parseFloat(e):1},containerCss:function(e){var t=this._private.cy.container();if(h&&t&&h.getComputedStyle)return h.getComputedStyle(t).getPropertyValue(e)}},Ba={getRenderedStyle:function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},getRawStyle:function(e,t){if(e=e[0]){for(var n={},r=0;r<this.properties.length;r++){var i=this.properties[r],a=this.getStylePropertyValue(e,i.name,t);null!=a&&(n[i.name]=a,n[I(i.name)]=a)}return n}},getIndexedStyle:function(e,t,n,r){var i=e.pstyle(t)[n][r];return null!=i?i:e.cy().style().getDefaultProperty(t)[n][0]},getStylePropertyValue:function(e,t,n){if(e=e[0]){var r=this.properties[t];r.alias&&(r=r.pointsTo);var i=r.type,a=e.pstyle(r.name);if(a){var o=a.value,s=a.units,u=a.strValue;if(n&&i.number&&null!=o&&E(o)){var l=e.cy().zoom(),c=function(e){return e*l},d=function(e,t){return c(e)+t},h=w(o);return(h?s.every((function(e){return null!=e})):null!=s)?h?o.map((function(e,t){return d(e,s[t])})).join(" "):d(o,s):h?o.map((function(e){return b(e)?e:""+c(e)})).join(" "):""+c(o)}if(null!=u)return u}return null}},getAnimationStartStyle:function(e,t){for(var n={},r=0;r<t.length;r++){var i=t[r].name,a=e.pstyle(i);void 0!==a&&(a=_(a)?this.parse(i,a.strValue):this.parse(i,a)),a&&(n[i]=a)}return n},getPropsList:function(e){var t=[],n=e,r=this.properties;if(n)for(var i=Object.keys(n),a=0;a<i.length;a++){var o=i[a],s=n[o],u=r[o]||r[O(o)],l=this.parse(u.name,s);l&&t.push(l)}return t},getNonDefaultPropertiesHash:function(e,t,n){var r,i,a,o,s,u,l=n.slice();for(s=0;s<t.length;s++)if(r=t[s],null!=(i=e.pstyle(r,!1)))if(null!=i.pfValue)l[0]=$(o,l[0]),l[1]=Q(o,l[1]);else for(a=i.strValue,u=0;u<a.length;u++)o=a.charCodeAt(u),l[0]=$(o,l[0]),l[1]=Q(o,l[1]);return l}};Ba.getPropertiesHash=Ba.getNonDefaultPropertiesHash;var Ma={appendFromJson:function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n.selector,i=n.style||n.css,a=Object.keys(i);this.selector(r);for(var o=0;o<a.length;o++){var s=a[o],u=i[s];this.css(s,u)}}return this},fromJson:function(e){return this.resetToDefault(),this.appendFromJson(e),this},json:function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],r=n.selector,i=n.properties,a={},o=0;o<i.length;o++){var s=i[o];a[s.name]=s.strValue}e.push({selector:r?r.toString():"core",style:a})}return e}},za={appendFromString:function(e){var t,n,r,i=""+e;function a(){i=i.length>t.length?i.substr(t.length):""}function o(){n=n.length>r.length?n.substr(r.length):""}for(i=i.replace(/[/][*](\s|.)+?[*][/]/g,"");;){if(i.match(/^\s*$/))break;var s=i.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!s){pe("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+i);break}t=s[0];var u=s[1];if("core"!==u)if(new Pr(u).invalid){pe("Skipping parsing of block: Invalid selector found in string stylesheet: "+u),a();continue}var l=s[2],c=!1;n=l;for(var d=[];;){if(n.match(/^\s*$/))break;var h=n.match(/^\s*(.+?)\s*:\s*(.+?)\s*;/);if(!h){pe("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+l),c=!0;break}r=h[0];var f=h[1],p=h[2];if(this.properties[f])this.parse(f,p)?(d.push({name:f,val:p}),o()):(pe("Skipping property: Invalid property definition in: "+r),o());else pe("Skipping property: Invalid property name in: "+r),o()}if(c){a();break}this.selector(u);for(var v=0;v<d.length;v++){var g=d[v];this.css(g.name,g.val)}a()}return this},fromString:function(e){return this.resetToDefault(),this.appendFromString(e),this}},Oa={};!function(){var e=L,t=function(e){return"^"+e+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},n=function(t){var n=e+"|\\w+|rgb[a]?\\((?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%]?)\\s*,\\s*(?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%]?)\\s*,\\s*(?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%]?)(?:\\s*,\\s*(?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))))?\\)|hsl[a]?\\((?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?)))\\s*,\\s*(?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])\\s*,\\s*(?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])(?:\\s*,\\s*(?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))))?\\)|\\#[0-9a-fA-F]{3}|\\#[0-9a-fA-F]{6}";return"^"+t+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+e+")\\s*\\,\\s*("+e+")\\s*,\\s*("+n+")\\s*\\,\\s*("+n+")\\)$"},r=["^url\\s*\\(\\s*['\"]?(.+?)['\"]?\\s*\\)$","^(none)$","^(.+)$"];Oa.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","taxi"]},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","polygon"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:t("data")},layoutData:{mapping:!0,regex:t("layoutData")},scratch:{mapping:!0,regex:t("scratch")},mapData:{mapping:!0,regex:n("mapData")},mapLayoutData:{mapping:!0,regex:n("mapLayoutData")},mapScratch:{mapping:!0,regex:n("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:r,singleRegexMatchValue:!0},urls:{regexes:r,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(e,t){switch(e.length){case 2:return"deg"!==t[0]&&"rad"!==t[0]&&"deg"!==t[1]&&"rad"!==t[1];case 1:return b(e[0])||"deg"===t[0]||"rad"===t[0];default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(e){var t=e.length;return 1===t||2===t||4===t}}};var i={zeroNonZero:function(e,t){return(null==e||null==t)&&e!==t||(0==e&&0!=t||0!=e&&0==t)},any:function(e,t){return e!=t},emptyNonEmpty:function(e,t){var n=B(e),r=B(t);return n&&!r||!n&&r}},a=Oa.types,o=[{name:"label",type:a.text,triggersBounds:i.any,triggersZOrder:i.emptyNonEmpty},{name:"text-rotation",type:a.textRotation,triggersBounds:i.any},{name:"text-margin-x",type:a.bidirectionalSize,triggersBounds:i.any},{name:"text-margin-y",type:a.bidirectionalSize,triggersBounds:i.any}],s=[{name:"source-label",type:a.text,triggersBounds:i.any},{name:"source-text-rotation",type:a.textRotation,triggersBounds:i.any},{name:"source-text-margin-x",type:a.bidirectionalSize,triggersBounds:i.any},{name:"source-text-margin-y",type:a.bidirectionalSize,triggersBounds:i.any},{name:"source-text-offset",type:a.size,triggersBounds:i.any}],u=[{name:"target-label",type:a.text,triggersBounds:i.any},{name:"target-text-rotation",type:a.textRotation,triggersBounds:i.any},{name:"target-text-margin-x",type:a.bidirectionalSize,triggersBounds:i.any},{name:"target-text-margin-y",type:a.bidirectionalSize,triggersBounds:i.any},{name:"target-text-offset",type:a.size,triggersBounds:i.any}],l=[{name:"font-family",type:a.fontFamily,triggersBounds:i.any},{name:"font-style",type:a.fontStyle,triggersBounds:i.any},{name:"font-weight",type:a.fontWeight,triggersBounds:i.any},{name:"font-size",type:a.size,triggersBounds:i.any},{name:"text-transform",type:a.textTransform,triggersBounds:i.any},{name:"text-wrap",type:a.textWrap,triggersBounds:i.any},{name:"text-overflow-wrap",type:a.textOverflowWrap,triggersBounds:i.any},{name:"text-max-width",type:a.size,triggersBounds:i.any},{name:"text-outline-width",type:a.size,triggersBounds:i.any},{name:"line-height",type:a.positiveNumber,triggersBounds:i.any}],c=[{name:"text-valign",type:a.valign,triggersBounds:i.any},{name:"text-halign",type:a.halign,triggersBounds:i.any},{name:"color",type:a.color},{name:"text-outline-color",type:a.color},{name:"text-outline-opacity",type:a.zeroOneNumber},{name:"text-background-color",type:a.color},{name:"text-background-opacity",type:a.zeroOneNumber},{name:"text-background-padding",type:a.size,triggersBounds:i.any},{name:"text-border-opacity",type:a.zeroOneNumber},{name:"text-border-color",type:a.color},{name:"text-border-width",type:a.size,triggersBounds:i.any},{name:"text-border-style",type:a.borderStyle,triggersBounds:i.any},{name:"text-background-shape",type:a.textBackgroundShape,triggersBounds:i.any},{name:"text-justification",type:a.justification}],d=[{name:"events",type:a.bool},{name:"text-events",type:a.bool}],h=[{name:"display",type:a.display,triggersZOrder:i.any,triggersBounds:i.any,triggersBoundsOfParallelBeziers:!0},{name:"visibility",type:a.visibility,triggersZOrder:i.any},{name:"opacity",type:a.zeroOneNumber,triggersZOrder:i.zeroNonZero},{name:"text-opacity",type:a.zeroOneNumber},{name:"min-zoomed-font-size",type:a.size},{name:"z-compound-depth",type:a.zCompoundDepth,triggersZOrder:i.any},{name:"z-index-compare",type:a.zIndexCompare,triggersZOrder:i.any},{name:"z-index",type:a.nonNegativeInt,triggersZOrder:i.any}],f=[{name:"overlay-padding",type:a.size,triggersBounds:i.any},{name:"overlay-color",type:a.color},{name:"overlay-opacity",type:a.zeroOneNumber,triggersBounds:i.zeroNonZero}],p=[{name:"transition-property",type:a.propList},{name:"transition-duration",type:a.time},{name:"transition-delay",type:a.time},{name:"transition-timing-function",type:a.easing}],v=function(e,t){return"label"===t.value?-e.poolIndex():t.pfValue},g=[{name:"height",type:a.nodeSize,triggersBounds:i.any,hashOverride:v},{name:"width",type:a.nodeSize,triggersBounds:i.any,hashOverride:v},{name:"shape",type:a.nodeShape,triggersBounds:i.any},{name:"shape-polygon-points",type:a.polygonPointList,triggersBounds:i.any},{name:"background-color",type:a.color},{name:"background-fill",type:a.fill},{name:"background-opacity",type:a.zeroOneNumber},{name:"background-blacken",type:a.nOneOneNumber},{name:"background-gradient-stop-colors",type:a.colors},{name:"background-gradient-stop-positions",type:a.percentages},{name:"background-gradient-direction",type:a.gradientDirection},{name:"padding",type:a.sizeMaybePercent,triggersBounds:i.any},{name:"padding-relative-to",type:a.paddingRelativeTo,triggersBounds:i.any},{name:"bounds-expansion",type:a.boundsExpansion,triggersBounds:i.any}],y=[{name:"border-color",type:a.color},{name:"border-opacity",type:a.zeroOneNumber},{name:"border-width",type:a.size,triggersBounds:i.any},{name:"border-style",type:a.borderStyle}],m=[{name:"background-image",type:a.urls},{name:"background-image-crossorigin",type:a.bgCrossOrigin},{name:"background-image-opacity",type:a.zeroOneNumbers},{name:"background-position-x",type:a.bgPos},{name:"background-position-y",type:a.bgPos},{name:"background-width-relative-to",type:a.bgRelativeTo},{name:"background-height-relative-to",type:a.bgRelativeTo},{name:"background-repeat",type:a.bgRepeat},{name:"background-fit",type:a.bgFit},{name:"background-clip",type:a.bgClip},{name:"background-width",type:a.bgWH},{name:"background-height",type:a.bgWH},{name:"background-offset-x",type:a.bgPos},{name:"background-offset-y",type:a.bgPos}],x=[{name:"position",type:a.position,triggersBounds:i.any},{name:"compound-sizing-wrt-labels",type:a.compoundIncludeLabels,triggersBounds:i.any},{name:"min-width",type:a.size,triggersBounds:i.any},{name:"min-width-bias-left",type:a.sizeMaybePercent,triggersBounds:i.any},{name:"min-width-bias-right",type:a.sizeMaybePercent,triggersBounds:i.any},{name:"min-height",type:a.size,triggersBounds:i.any},{name:"min-height-bias-top",type:a.sizeMaybePercent,triggersBounds:i.any},{name:"min-height-bias-bottom",type:a.sizeMaybePercent,triggersBounds:i.any}],w=[{name:"line-style",type:a.lineStyle},{name:"line-color",type:a.color},{name:"line-fill",type:a.fill},{name:"line-cap",type:a.lineCap},{name:"line-dash-pattern",type:a.numbers},{name:"line-dash-offset",type:a.number},{name:"line-gradient-stop-colors",type:a.colors},{name:"line-gradient-stop-positions",type:a.percentages},{name:"curve-style",type:a.curveStyle,triggersBounds:i.any,triggersBoundsOfParallelBeziers:!0},{name:"haystack-radius",type:a.zeroOneNumber,triggersBounds:i.any},{name:"source-endpoint",type:a.edgeEndpoint,triggersBounds:i.any},{name:"target-endpoint",type:a.edgeEndpoint,triggersBounds:i.any},{name:"control-point-step-size",type:a.size,triggersBounds:i.any},{name:"control-point-distances",type:a.bidirectionalSizes,triggersBounds:i.any},{name:"control-point-weights",type:a.numbers,triggersBounds:i.any},{name:"segment-distances",type:a.bidirectionalSizes,triggersBounds:i.any},{name:"segment-weights",type:a.numbers,triggersBounds:i.any},{name:"taxi-turn",type:a.bidirectionalSizeMaybePercent,triggersBounds:i.any},{name:"taxi-turn-min-distance",type:a.size,triggersBounds:i.any},{name:"taxi-direction",type:a.axisDirection,triggersBounds:i.any},{name:"edge-distances",type:a.edgeDistances,triggersBounds:i.any},{name:"arrow-scale",type:a.positiveNumber,triggersBounds:i.any},{name:"loop-direction",type:a.angle,triggersBounds:i.any},{name:"loop-sweep",type:a.angle,triggersBounds:i.any},{name:"source-distance-from-node",type:a.size,triggersBounds:i.any},{name:"target-distance-from-node",type:a.size,triggersBounds:i.any}],_=[{name:"ghost",type:a.bool,triggersBounds:i.any},{name:"ghost-offset-x",type:a.bidirectionalSize,triggersBounds:i.any},{name:"ghost-offset-y",type:a.bidirectionalSize,triggersBounds:i.any},{name:"ghost-opacity",type:a.zeroOneNumber}],E=[{name:"selection-box-color",type:a.color},{name:"selection-box-opacity",type:a.zeroOneNumber},{name:"selection-box-border-color",type:a.color},{name:"selection-box-border-width",type:a.size},{name:"active-bg-color",type:a.color},{name:"active-bg-opacity",type:a.zeroOneNumber},{name:"active-bg-size",type:a.size},{name:"outside-texture-bg-color",type:a.color},{name:"outside-texture-bg-opacity",type:a.zeroOneNumber}],k=[];Oa.pieBackgroundN=16,k.push({name:"pie-size",type:a.sizeMaybePercent});for(var C=1;C<=Oa.pieBackgroundN;C++)k.push({name:"pie-"+C+"-background-color",type:a.color}),k.push({name:"pie-"+C+"-background-size",type:a.percent}),k.push({name:"pie-"+C+"-background-opacity",type:a.zeroOneNumber});var S=[],P=Oa.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:a.arrowShape,triggersBounds:i.any},{name:"arrow-color",type:a.color},{name:"arrow-fill",type:a.arrowFill}].forEach((function(e){P.forEach((function(t){var n=t+"-"+e.name,r=e.type,i=e.triggersBounds;S.push({name:n,type:r,triggersBounds:i})}))}),{});var T=Oa.properties=[].concat(d,p,h,f,_,c,l,o,s,u,g,y,m,k,x,w,S,E),D=Oa.propertyGroups={behavior:d,transition:p,visibility:h,overlay:f,ghost:_,commonLabel:c,labelDimensions:l,mainLabel:o,sourceLabel:s,targetLabel:u,nodeBody:g,nodeBorder:y,backgroundImage:m,pie:k,compound:x,edgeLine:w,edgeArrow:S,core:E},M=Oa.propertyGroupNames={};(Oa.propertyGroupKeys=Object.keys(D)).forEach((function(e){M[e]=D[e].map((function(e){return e.name})),D[e].forEach((function(t){return t.groupKey=e}))}));var z=Oa.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];Oa.propertyNames=T.map((function(e){return e.name}));for(var O=0;O<T.length;O++){var I=T[O];T[I.name]=I}for(var A=0;A<z.length;A++){var N=z[A],R=T[N.pointsTo],j={name:N.name,alias:!0,pointsTo:R};T.push(j),T[N.name]=j}}(),Oa.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},Oa.getDefaultProperties=function(){var e=this._private;if(null!=e.defaultProperties)return e.defaultProperties;for(var t=j({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce((function(e,t){for(var n=1;n<=Oa.pieBackgroundN;n++){var r=t.name.replace("{{i}}",n),i=t.value;e[r]=i}return e}),{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"taxi-turn":"50%","taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"}].reduce((function(e,t){return Oa.arrowPrefixes.forEach((function(n){var r=n+"-"+t.name,i=t.value;e[r]=i})),e}),{})),n={},r=0;r<this.properties.length;r++){var i=this.properties[r];if(!i.pointsTo){var a=i.name,o=t[a],s=this.parse(a,o);n[a]=s}}return e.defaultProperties=n,e.defaultProperties},Oa.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var Ia={parse:function(e,t,n,r){if(x(t))return this.parseImplWarn(e,t,n,r);var i,a=ne(e,""+t,n?"t":"f","mapping"===r||!0===r||!1===r||null==r?"dontcare":r),o=this.propCache=this.propCache||[];return(i=o[a])||(i=o[a]=this.parseImplWarn(e,t,n,r)),(n||"mapping"===r)&&(i=ve(i))&&(i.value=ve(i.value)),i},parseImplWarn:function(e,t,n,r){var i=this.parseImpl(e,t,n,r);return i||null==t||pe("The style property `".concat(e,": ").concat(t,"` is invalid")),i}};Ia.parseImpl=function(e,t,n,r){e=O(e);var i=this.properties[e],a=t,o=this.types;if(!i)return null;if(void 0===t)return null;i.alias&&(i=i.pointsTo,e=i.name);var s=b(t);s&&(t=t.trim());var u,l,c=i.type;if(!c)return null;if(n&&(""===t||null===t))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(x(t))return{name:e,value:t,strValue:"fn",mapped:o.fn,bypass:n};if(!s||r||t.length<7||"a"!==t[1]);else{if(t.length>=7&&"d"===t[0]&&(u=new RegExp(o.data.regex).exec(t))){if(n)return!1;var d=o.data;return{name:e,value:u,strValue:""+t,mapped:d,field:u[1],bypass:n}}if(t.length>=10&&"m"===t[0]&&(l=new RegExp(o.mapData.regex).exec(t))){if(n)return!1;if(c.multiple)return!1;var h=o.mapData;if(!c.color&&!c.number)return!1;var f=this.parse(e,l[4]);if(!f||f.mapped)return!1;var p=this.parse(e,l[5]);if(!p||p.mapped)return!1;if(f.pfValue===p.pfValue||f.strValue===p.strValue)return pe("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+f.strValue+"`"),this.parse(e,f.strValue);if(c.color){var v=f.value,g=p.value;if(!(v[0]!==g[0]||v[1]!==g[1]||v[2]!==g[2]||v[3]!==g[3]&&(null!=v[3]&&1!==v[3]||null!=g[3]&&1!==g[3])))return!1}return{name:e,value:l,strValue:""+t,mapped:h,field:l[1],fieldMin:parseFloat(l[2]),fieldMax:parseFloat(l[3]),valueMin:f.value,valueMax:p.value,bypass:n}}}if(c.multiple&&"multiple"!==r){var y;if(y=s?t.split(/\s+/):w(t)?t:[t],c.evenMultiple&&y.length%2!=0)return null;for(var m=[],_=[],k=[],C="",S=!1,P=0;P<y.length;P++){var T=this.parse(e,y[P],n,"multiple");S=S||b(T.value),m.push(T.value),k.push(null!=T.pfValue?T.pfValue:T.value),_.push(T.units),C+=(P>0?" ":"")+T.strValue}return c.validate&&!c.validate(m,_)?null:c.singleEnum&&S?1===m.length&&b(m[0])?{name:e,value:m[0],strValue:m[0],bypass:n}:null:{name:e,value:m,pfValue:k,strValue:C,bypass:n,units:_}}var D,B,M=function(){for(var r=0;r<c.enums.length;r++){if(c.enums[r]===t)return{name:e,value:t,strValue:""+t,bypass:n}}return null};if(c.number){var z,I="px";if(c.units&&(z=c.units),c.implicitUnits&&(I=c.implicitUnits),!c.unitless)if(s){var A="px|em"+(c.allowPercent?"|\\%":"");z&&(A=z);var N=t.match("^("+L+")("+A+")?$");N&&(t=N[1],z=N[2]||I)}else z&&!c.implicitUnits||(z=I);if(t=parseFloat(t),isNaN(t)&&void 0===c.enums)return null;if(isNaN(t)&&void 0!==c.enums)return t=a,M();if(c.integer&&(!E(B=t)||Math.floor(B)!==B))return null;if(void 0!==c.min&&(t<c.min||c.strictMin&&t===c.min)||void 0!==c.max&&(t>c.max||c.strictMax&&t===c.max))return null;var R={name:e,value:t,strValue:""+t+(z||""),units:z,bypass:n};return c.unitless||"px"!==z&&"em"!==z?R.pfValue=t:R.pfValue="px"!==z&&z?this.getEmSizeInPixels()*t:t,"ms"!==z&&"s"!==z||(R.pfValue="ms"===z?t:1e3*t),"deg"!==z&&"rad"!==z||(R.pfValue="rad"===z?t:(D=t,Math.PI*D/180)),"%"===z&&(R.pfValue=t/100),R}if(c.propList){var j=[],F=""+t;if("none"===F);else{for(var q=F.split(/\s*,\s*|\s+/),W=0;W<q.length;W++){var Y=q[W].trim();this.properties[Y]?j.push(Y):pe("`"+Y+"` is not a valid property name")}if(0===j.length)return null}return{name:e,value:j,strValue:0===j.length?"none":j.join(" "),bypass:n}}if(c.color){var X=V(t);return X?{name:e,value:X,pfValue:X,strValue:"rgb("+X[0]+","+X[1]+","+X[2]+")",bypass:n}:null}if(c.regex||c.regexes){if(c.enums){var H=M();if(H)return H}for(var Z=c.regexes?c.regexes:[c.regex],U=0;U<Z.length;U++){var K=new RegExp(Z[U]).exec(t);if(K)return{name:e,value:c.singleRegexMatchValue?K[1]:K,strValue:""+t,bypass:n}}return null}return c.string?{name:e,value:""+t,strValue:""+t,bypass:n}:c.enums?M():null};var Aa=function e(t){if(!(this instanceof e))return new e(t);T(t)?(this._private={cy:t,coreStyle:{}},this.length=0,this.resetToDefault()):he("A style must have a core reference")},Na=Aa.prototype;Na.instanceString=function(){return"style"},Na.clear=function(){for(var e=0;e<this.length;e++)this[e]=void 0;return this.length=0,this._private.newStyle=!0,this},Na.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},Na.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},Na.selector=function(e){var t="core"===e?null:new Pr(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this},Na.css=function(){var e=this,t=arguments;if(1===t.length)for(var n=t[0],r=0;r<e.properties.length;r++){var i=e.properties[r],a=n[i.name];void 0===a&&(a=n[I(i.name)]),void 0!==a&&this.cssRule(i.name,a)}else 2===t.length&&this.cssRule(t[0],t[1]);return this},Na.style=Na.css,Na.cssRule=function(e,t){var n=this.parse(e,t);if(n){var r=this.length-1;this[r].properties.push(n),this[r].properties[n.name]=n,n.name.match(/pie-(\d+)-background-size/)&&n.value&&(this._private.hasPie=!0),n.mapped&&this[r].mappedProperties.push(n),!this[r].selector&&(this._private.coreStyle[n.name]=n)}return this},Na.append=function(e){return D(e)?e.appendToStyle(this):w(e)?this.appendFromJson(e):b(e)&&this.appendFromString(e),this},Aa.fromJson=function(e,t){var n=new Aa(e);return n.fromJson(t),n},Aa.fromString=function(e,t){return new Aa(e).fromString(t)},[Pa,Ta,Da,Ba,Ma,za,Oa,Ia].forEach((function(e){j(Na,e)})),Aa.types=Na.types,Aa.properties=Na.properties,Aa.propertyGroups=Na.propertyGroups,Aa.propertyGroupNames=Na.propertyGroupNames,Aa.propertyGroupKeys=Na.propertyGroupKeys;var La={style:function(e){e&&this.setStyle(e).update();return this._private.style},setStyle:function(e){var t=this._private;return D(e)?t.style=e.generateStyle(this):w(e)?t.style=Aa.fromJson(this,e):b(e)?t.style=Aa.fromString(this,e):t.style=Aa(this),t.style}},Ra={autolock:function(e){return void 0===e?this._private.autolock:(this._private.autolock=!!e,this)},autoungrabify:function(e){return void 0===e?this._private.autoungrabify:(this._private.autoungrabify=!!e,this)},autounselectify:function(e){return void 0===e?this._private.autounselectify:(this._private.autounselectify=!!e,this)},selectionType:function(e){var t=this._private;return null==t.selectionType&&(t.selectionType="single"),void 0===e?t.selectionType:("additive"!==e&&"single"!==e||(t.selectionType=e),this)},panningEnabled:function(e){return void 0===e?this._private.panningEnabled:(this._private.panningEnabled=!!e,this)},userPanningEnabled:function(e){return void 0===e?this._private.userPanningEnabled:(this._private.userPanningEnabled=!!e,this)},zoomingEnabled:function(e){return void 0===e?this._private.zoomingEnabled:(this._private.zoomingEnabled=!!e,this)},userZoomingEnabled:function(e){return void 0===e?this._private.userZoomingEnabled:(this._private.userZoomingEnabled=!!e,this)},boxSelectionEnabled:function(e){return void 0===e?this._private.boxSelectionEnabled:(this._private.boxSelectionEnabled=!!e,this)},pan:function(){var e,t,n,r,i,a=arguments,o=this._private.pan;switch(a.length){case 0:return o;case 1:if(b(a[0]))return o[e=a[0]];if(_(a[0])){if(!this._private.panningEnabled)return this;r=(n=a[0]).x,i=n.y,E(r)&&(o.x=r),E(i)&&(o.y=i),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;e=a[0],t=a[1],"x"!==e&&"y"!==e||!E(t)||(o[e]=t),this.emit("pan viewport")}return this.notify("viewport"),this},panBy:function(e,t){var n,r,i,a,o,s=arguments,u=this._private.pan;if(!this._private.panningEnabled)return this;switch(s.length){case 1:_(e)&&(a=(i=s[0]).x,o=i.y,E(a)&&(u.x+=a),E(o)&&(u.y+=o),this.emit("pan viewport"));break;case 2:r=t,"x"!==(n=e)&&"y"!==n||!E(r)||(u[n]+=r),this.emit("pan viewport")}return this.notify("viewport"),this},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var r=this._private;r.zoom=n.zoom,r.pan=n.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,t){if(E(e)&&void 0===t&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled){var n,r;if(b(e)){var i=e;e=this.$(i)}else if(_(r=e)&&E(r.x1)&&E(r.x2)&&E(r.y1)&&E(r.y2)){var a=e;(n={x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2}).w=n.x2-n.x1,n.h=n.y2-n.y1}else C(e)||(e=this.mutableElements());if(!C(e)||!e.empty()){n=n||e.boundingBox();var o,s=this.width(),u=this.height();if(t=E(t)?t:0,!isNaN(s)&&!isNaN(u)&&s>0&&u>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:o=(o=(o=Math.min((s-2*t)/n.w,(u-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:o)<this._private.minZoom?this._private.minZoom:o,pan:{x:(s-o*(n.x1+n.x2))/2,y:(u-o*(n.y1+n.y2))/2}}}}},zoomRange:function(e,t){var n=this._private;if(null==t){var r=e;e=r.min,t=r.max}return E(e)&&E(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):E(e)&&void 0===t&&e<=n.maxZoom?n.minZoom=e:E(t)&&void 0===e&&t>=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,i=r.pan,a=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),E(e)?n=e:_(e)&&(n=e.level,null!=e.position?t=We(e.position,a,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)<r.minZoom?r.minZoom:n,o||!E(n)||n===a||null!=t&&(!E(t.x)||!E(t.y)))return null;if(null!=t){var s=i,u=a,l=n;return{zoomed:!0,panned:!0,zoom:l,pan:{x:-l/u*(t.x-s.x)+t.x,y:-l/u*(t.y-s.y)+t.y}}}return{zoomed:!0,panned:!1,zoom:n,pan:i}},zoom:function(e){if(void 0===e)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return null!=t&&t.zoomed?(n.zoom=t.zoom,t.panned&&(n.pan.x=t.pan.x,n.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport"),this):this},viewport:function(e){var t=this._private,n=!0,r=!0,i=[],a=!1,o=!1;if(!e)return this;if(E(e.zoom)||(n=!1),_(e.pan)||(r=!1),!n&&!r)return this;if(n){var s=e.zoom;s<t.minZoom||s>t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push("zoom"))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var u=e.pan;E(u.x)&&(t.pan.x=u.x,o=!1),E(u.y)&&(t.pan.y=u.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(b(e)){var n=e;e=this.mutableElements().filter(n)}else C(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),i=this.width(),a=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,r=n.container;return n.sizeCache=n.sizeCache||(r?(e=h.getComputedStyle(r),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}}};Ra.centre=Ra.center,Ra.autolockNodes=Ra.autolock,Ra.autoungrabifyNodes=Ra.autoungrabify;var ja={data:Yn.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0}),removeData:Yn.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0}),scratch:Yn.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0}),removeScratch:Yn.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0})};ja.attr=ja.data,ja.removeAttr=ja.removeData;var Va=function(e){var t=this,n=(e=j({},e)).container;n&&!k(n)&&k(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=void 0!==h&&void 0!==n&&!e.headless,o=e;o.layout=j({name:a?"grid":"null"},o.layout),o.renderer=j({name:a?"canvas":"null"},o.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},u=this._private={container:n,ready:!1,options:o,elements:new ia(this),listeners:[],aniEles:new ia(this),data:{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?a:o.styleEnabled,zoom:E(o.zoom)?o.zoom:1,pan:{x:_(o.pan)&&E(o.pan.x)?o.pan.x:0,y:_(o.pan)&&E(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});u.styleEnabled&&t.setStyle([]);var l=j({},o,o.renderer);t.initRenderer(l);!function(e,t){if(e.some(M))return Fn.all(e).then(t);t(e)}([o.style,o.elements],(function(e){var n=e[0],a=e[1];u.styleEnabled&&t.style().append(n),function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(_(e)||w(e))&&t.add(e),t.one("layoutready",(function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")})).one("layoutstop",(function(){t.one("done",r),t.emit("done")}));var a=j({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()}(a,(function(){t.startAnimationLoop(),u.ready=!0,x(o.ready)&&t.on("ready",o.ready);for(var e=0;e<i.length;e++){var n=i[e];t.on("ready",n)}r&&(r.readies=[]),t.emit("ready")}),o.done)}))},Fa=Va.prototype;j(Fa,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},mount:function(e){if(null!=e){var t=this,n=t._private,r=n.options;return!k(e)&&k(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),n.container=e,n.styleEnabled=!0,t.invalidateSize(),t.initRenderer(j({},r,r.renderer,{name:"null"===r.renderer.name?"canvas":r.renderer.name})),t.startAnimationLoop(),t.style(r.style),t.emit("mount"),t}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return ve(this._private.options)},json:function(e){var t=this,n=t._private,r=t.mutableElements();if(_(e)){if(t.startBatch(),e.elements){var i={},a=function(e,n){for(var r=[],a=[],o=0;o<e.length;o++){var s=e[o],u=""+s.data.id,l=t.getElementById(u);i[u]=!0,0!==l.length?a.push({ele:l,json:s}):n?(s.group=n,r.push(s)):r.push(s)}t.add(r);for(var c=0;c<a.length;c++){var d=a[c],h=d.ele,f=d.json;h.json(f)}};if(w(e.elements))a(e.elements);else for(var o=["nodes","edges"],s=0;s<o.length;s++){var u=o[s],l=e.elements[u];w(l)&&a(l,u)}var c=t.collection();r.filter((function(e){return!i[e.id()]})).forEach((function(e){e.isParent()?c.merge(e):e.remove()})),c.forEach((function(e){return e.children().move({parent:null})})),c.forEach((function(e){return function(e){return t.getElementById(e.id())}(e).remove()}))}e.style&&t.style(e.style),null!=e.zoom&&e.zoom!==n.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x===n.pan.x&&e.pan.y===n.pan.y||t.pan(e.pan)),e.data&&t.data(e.data);for(var d=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify"],h=0;h<d.length;h++){var f=d[h];null!=e[f]&&t[f](e[f])}return t.endBatch(),this}var p={};!!e?p.elements=this.elements().map((function(e){return e.json()})):(p.elements={},r.forEach((function(e){var t=e.group();p.elements[t]||(p.elements[t]=[]),p.elements[t].push(e.json())}))),this._private.styleEnabled&&(p.style=t.style().json()),p.data=ve(t.data());var v=n.options;return p.zoomingEnabled=n.zoomingEnabled,p.userZoomingEnabled=n.userZoomingEnabled,p.zoom=n.zoom,p.minZoom=n.minZoom,p.maxZoom=n.maxZoom,p.panningEnabled=n.panningEnabled,p.userPanningEnabled=n.userPanningEnabled,p.pan=ve(n.pan),p.boxSelectionEnabled=n.boxSelectionEnabled,p.renderer=ve(v.renderer),p.hideEdgesOnViewport=v.hideEdgesOnViewport,p.textureOnViewport=v.textureOnViewport,p.wheelSensitivity=v.wheelSensitivity,p.motionBlur=v.motionBlur,p}}),Fa.$id=Fa.getElementById,[oa,ya,xa,wa,_a,Ea,Ca,Sa,La,Ra,ja].forEach((function(e){j(Fa,e)}));var qa={fit:!0,directed:!1,padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,maximal:!1,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}},Wa=function(e){return e.scratch("breadthfirst")},Ya=function(e,t){return e.scratch("breadthfirst",t)};function Xa(e){this.options=j({},qa,e)}Xa.prototype.run=function(){var e,t=this.options,n=t,r=t.cy,i=n.eles,a=i.nodes().filter((function(e){return!e.isParent()})),o=i,s=n.directed,u=n.maximal||n.maximalAdjustments>0,l=tt(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(C(n.roots))e=n.roots;else if(w(n.roots)){for(var c=[],d=0;d<n.roots.length;d++){var h=n.roots[d],f=r.getElementById(h);c.push(f)}e=r.collection(c)}else if(b(n.roots))e=r.$(n.roots);else if(s)e=a.roots();else{var p=i.components();e=r.collection();for(var v=function(t){var n=p[t],r=n.maxDegree(!1),i=n.filter((function(e){return e.degree(!1)===r}));e=e.add(i)},g=0;g<p.length;g++)v(g)}var y=[],m={},x=function(e,t){null==y[t]&&(y[t]=[]);var n=y[t].length;y[t].push(e),Ya(e,{index:n,depth:t})};o.bfs({roots:e,directed:n.directed,visit:function(e,t,n,r,i){var a=e[0],o=a.id();x(a,i),m[o]=!0}});for(var _=[],E=0;E<a.length;E++){var k=a[E];m[k.id()]||_.push(k)}var S=function(e){for(var t=y[e],n=0;n<t.length;n++){var r=t[n];null!=r?Ya(r,{depth:e,index:n}):(t.splice(n,1),n--)}},P=function(){for(var e=0;e<y.length;e++)S(e)},T=function(e,t){for(var n=Wa(e),r=e.incomers().filter((function(e){return e.isNode()&&i.has(e)})),a=-1,o=e.id(),s=0;s<r.length;s++){var u=r[s],l=Wa(u);a=Math.max(a,l.depth)}return n.depth<=a&&(t[o]?null:(function(e,t){var n=Wa(e),r=n.depth,i=n.index;y[r][i]=null,x(e,t)}(e,a+1),t[o]=!0,!0))};if(s&&u){var D=[],B={},M=function(e){return D.push(e)};for(a.forEach((function(e){return D.push(e)}));D.length>0;){var z=D.shift(),O=T(z,B);if(O)z.outgoers().filter((function(e){return e.isNode()&&i.has(e)})).forEach(M);else if(null===O){pe("Detected double maximal shift for node `"+z.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}P();var I=0;if(n.avoidOverlap)for(var A=0;A<a.length;A++){var N=a[A].layoutDimensions(n),L=N.w,j=N.h;I=Math.max(I,L,j)}for(var V={},F=function(e){if(V[e.id()])return V[e.id()];for(var t=Wa(e).depth,n=e.neighborhood(),r=0,i=0,o=0;o<n.length;o++){var s=n[o];if(!s.isEdge()&&!s.isParent()&&a.has(s)){var u=Wa(s),l=u.index,c=u.depth;if(null!=l&&null!=c){var d=y[c].length;c<t&&(r+=l/d,i++)}}}return r/=i=Math.max(1,i),0===i&&(r=0),V[e.id()]=r,r},q=function(e,t){var n=F(e)-F(t);return 0===n?R(e.id(),t.id()):n},W=0;W<y.length;W++)y[W].sort(q),S(W);for(var Y=[],X=0;X<_.length;X++)Y.push(_[X]);y.unshift(Y),P();for(var H=0,Z=0;Z<y.length;Z++)H=Math.max(y[Z].length,H);var U=l.x1+l.w/2,K=l.x1+l.h/2,G=y.reduce((function(e,t){return Math.max(e,t.length)}),0);return a.layoutPositions(this,n,(function(e){var t=Wa(e),r=t.depth,i=t.index,a=y[r].length,o=Math.max(l.w/((n.grid?G:a)+1),I),s=Math.max(l.h/(y.length+1),I),u=Math.min(l.w/2/y.length,l.h/2/y.length);if(u=Math.max(u,I),n.circle){var c=u*r+u-(y.length>0&&y[0].length<=3?u/2:0),d=2*Math.PI/y[r].length*i;return 0===r&&1===y[0].length&&(c=1),{x:U+c*Math.cos(d),y:K+c*Math.sin(d)}}return{x:U+(i+1-(a+1)/2)*o,y:(r+1)*s}})),this};var Ha={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Za(e){this.options=j({},Ha,e)}Za.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o,s=tt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),u=s.x1+s.w/2,l=s.y1+s.h/2,c=(void 0===t.sweep?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),d=0,h=0;h<a.length;h++){var f=a[h].layoutDimensions(t),p=f.w,v=f.h;d=Math.max(d,p,v)}if(o=E(t.radius)?t.radius:a.length<=1?0:Math.min(s.h,s.w)/2-d,a.length>1&&t.avoidOverlap){d*=1.75;var g=Math.cos(c)-Math.cos(0),y=Math.sin(c)-Math.sin(0),m=Math.sqrt(d*d/(g*g+y*y));o=Math.max(m,o)}return a.layoutPositions(this,t,(function(e,n){var r=t.startAngle+n*c*(i?1:-1),a=o*Math.cos(r),s=o*Math.sin(r);return{x:u+a,y:l+s}})),this};var Ua,Ka={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Ga(e){this.options=j({},Ka,e)}Ga.prototype.run=function(){for(var e=this.options,t=e,n=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,r=e.cy,i=t.eles.nodes().not(":parent"),a=tt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),o=a.x1+a.w/2,s=a.y1+a.h/2,u=[],l=0,c=0;c<i.length;c++){var d,h=i[c];d=t.concentric(h),u.push({value:d,node:h}),h._private.scratch.concentric=d}i.updateStyle();for(var f=0;f<i.length;f++){var p=i[f].layoutDimensions(t);l=Math.max(l,p.w,p.h)}u.sort((function(e,t){return t.value-e.value}));for(var v=t.levelWidth(i),g=[[]],y=g[0],m=0;m<u.length;m++){var b=u[m];if(y.length>0)Math.abs(y[0].value-b.value)>=v&&(y=[],g.push(y));y.push(b)}var x=l+t.minNodeSpacing;if(!t.avoidOverlap){var w=g.length>0&&g[0].length>1,_=(Math.min(a.w,a.h)/2-x)/(g.length+w?1:0);x=Math.min(x,_)}for(var E=0,k=0;k<g.length;k++){var C=g[k],S=void 0===t.sweep?2*Math.PI-2*Math.PI/C.length:t.sweep,P=C.dTheta=S/Math.max(1,C.length-1);if(C.length>1&&t.avoidOverlap){var T=Math.cos(P)-Math.cos(0),D=Math.sin(P)-Math.sin(0),B=Math.sqrt(x*x/(T*T+D*D));E=Math.max(B,E)}C.r=E,E+=x}if(t.equidistant){for(var M=0,z=0,O=0;O<g.length;O++){var I=g[O].r-z;M=Math.max(M,I)}z=0;for(var A=0;A<g.length;A++){var N=g[A];0===A&&(z=N.r),N.r=z,z+=M}}for(var L={},R=0;R<g.length;R++)for(var j=g[R],V=j.dTheta,F=j.r,q=0;q<j.length;q++){var W=j[q],Y=t.startAngle+(n?1:-1)*V*q,X={x:o+F*Math.cos(Y),y:s+F*Math.sin(Y)};L[W.node.id()]=X}return i.layoutPositions(this,t,(function(e){var t=e.id();return L[t]})),this};var $a={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,t){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function Qa(e){this.options=j({},$a,e),this.options.layout=this}Qa.prototype.run=function(){var e=this.options,t=e.cy,n=this;n.stopped=!1,!0!==e.animate&&!1!==e.animate||n.emit({type:"layoutstart",layout:n}),Ua=!0===e.debug;var r=Ja(t,n,e);Ua&&(void 0)(r),e.randomize&&no(r);var i=U(),a=function(){io(r,t,e),!0===e.fit&&t.fit(e.padding)},o=function(t){return!(n.stopped||t>=e.numIter)&&(ao(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature<e.minTemp))},s=function(){if(!0===e.animate||!1===e.animate)a(),n.one("layoutstop",e.stop),n.emit({type:"layoutstop",layout:n});else{var t=e.eles.nodes(),i=ro(r,e,t);t.layoutPositions(n,e,i)}},u=0,l=!0;if(!0===e.animate){!function t(){for(var n=0;l&&n<e.refresh;)l=o(u),u++,n++;l?(U()-i>=e.animationThreshold&&a(),Z(t)):(mo(r,e),s())}()}else{for(;l;)l=o(u),u++;mo(r,e),s()}return this},Qa.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},Qa.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Ja=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:e.width(),clientHeight:e.width(),boundingBox:tt(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()})},o=n.eles.components(),s={},u=0;u<o.length;u++)for(var l=o[u],c=0;c<l.length;c++){s[l[c].id()]=u}for(u=0;u<a.nodeSize;u++){var d=(g=i[u]).layoutDimensions(n);(O={}).isLocked=g.locked(),O.id=g.data("id"),O.parentId=g.data("parent"),O.cmptId=s[g.id()],O.children=[],O.positionX=g.position("x"),O.positionY=g.position("y"),O.offsetX=0,O.offsetY=0,O.height=d.w,O.width=d.h,O.maxX=O.positionX+O.width/2,O.minX=O.positionX-O.width/2,O.maxY=O.positionY+O.height/2,O.minY=O.positionY-O.height/2,O.padLeft=parseFloat(g.style("padding")),O.padRight=parseFloat(g.style("padding")),O.padTop=parseFloat(g.style("padding")),O.padBottom=parseFloat(g.style("padding")),O.nodeRepulsion=x(n.nodeRepulsion)?n.nodeRepulsion(g):n.nodeRepulsion,a.layoutNodes.push(O),a.idToIndex[O.id]=u}var h=[],f=0,p=-1,v=[];for(u=0;u<a.nodeSize;u++){var g,y=(g=a.layoutNodes[u]).parentId;null!=y?a.layoutNodes[a.idToIndex[y]].children.push(g.id):(h[++p]=g.id,v.push(g.id))}for(a.graphSet.push(v);f<=p;){var m=h[f++],b=a.idToIndex[m],w=a.layoutNodes[b].children;if(w.length>0){a.graphSet.push(w);for(u=0;u<w.length;u++)h[++p]=w[u]}}for(u=0;u<a.graphSet.length;u++){var _=a.graphSet[u];for(c=0;c<_.length;c++){var E=a.idToIndex[_[c]];a.indexToGraph[E]=u}}for(u=0;u<a.edgeSize;u++){var k=r[u],C={};C.id=k.data("id"),C.sourceId=k.data("source"),C.targetId=k.data("target");var S=x(n.idealEdgeLength)?n.idealEdgeLength(k):n.idealEdgeLength,P=x(n.edgeElasticity)?n.edgeElasticity(k):n.edgeElasticity,T=a.idToIndex[C.sourceId],D=a.idToIndex[C.targetId];if(a.indexToGraph[T]!=a.indexToGraph[D]){for(var B=eo(C.sourceId,C.targetId,a),M=a.graphSet[B],z=0,O=a.layoutNodes[T];-1===M.indexOf(O.id);)O=a.layoutNodes[a.idToIndex[O.parentId]],z++;for(O=a.layoutNodes[D];-1===M.indexOf(O.id);)O=a.layoutNodes[a.idToIndex[O.parentId]],z++;S*=z*n.nestingFactor}C.idealLength=S,C.elasticity=P,a.layoutEdges.push(C)}return a},eo=function(e,t,n){var r=to(e,t,0,n);return 2>r.count?0:r.graph},to=function e(t,n,r,i){var a=i.graphSet[r];if(-1<a.indexOf(t)&&-1<a.indexOf(n))return{count:2,graph:r};for(var o=0,s=0;s<a.length;s++){var u=a[s],l=i.idToIndex[u],c=i.layoutNodes[l].children;if(0!==c.length){var d=e(t,n,i.indexToGraph[i.idToIndex[c[0]]],i);if(0!==d.count){if(1!==d.count)return d;if(2===++o)break}}}return{count:o,graph:r}},no=function(e,t){for(var n=e.clientWidth,r=e.clientHeight,i=0;i<e.nodeSize;i++){var a=e.layoutNodes[i];0!==a.children.length||a.isLocked||(a.positionX=Math.random()*n,a.positionY=Math.random()*r)}},ro=function(e,t,n){var r=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.forEach((function(t){var n=e.layoutNodes[e.idToIndex[t.data("id")]];i.x1=Math.min(i.x1,n.positionX),i.x2=Math.max(i.x2,n.positionX),i.y1=Math.min(i.y1,n.positionY),i.y2=Math.max(i.y2,n.positionY)})),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(n,a){var o=e.layoutNodes[e.idToIndex[n.data("id")]];if(t.boundingBox){var s=(o.positionX-i.x1)/i.w,u=(o.positionY-i.y1)/i.h;return{x:r.x1+s*r.w,y:r.y1+u*r.h}}return{x:o.positionX,y:o.positionY}}},io=function(e,t,n){var r=n.layout,i=n.eles.nodes(),a=ro(e,n,i);i.positions(a),!0!==e.ready&&(e.ready=!0,r.one("layoutready",n.ready),r.emit({type:"layoutready",layout:this}))},ao=function(e,t,n){oo(e,t),ho(e),fo(e,t),po(e),vo(e)},oo=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var r=e.graphSet[n],i=r.length,a=0;a<i;a++)for(var o=e.layoutNodes[e.idToIndex[r[a]]],s=a+1;s<i;s++){var u=e.layoutNodes[e.idToIndex[r[s]]];uo(o,u,e,t)}},so=function(e){return-e+2*e*Math.random()},uo=function(e,t,n,r){if(e.cmptId===t.cmptId||n.isCompound){var i=t.positionX-e.positionX,a=t.positionY-e.positionY;0===i&&0===a&&(i=so(1),a=so(1));var o=lo(e,t,i,a);if(o>0)var s=(l=r.nodeOverlap*o)*i/(v=Math.sqrt(i*i+a*a)),u=l*a/v;else{var l,c=co(e,i,a),d=co(t,-1*i,-1*a),h=d.x-c.x,f=d.y-c.y,p=h*h+f*f,v=Math.sqrt(p);s=(l=(e.nodeRepulsion+t.nodeRepulsion)/p)*h/v,u=l*f/v}e.isLocked||(e.offsetX-=s,e.offsetY-=u),t.isLocked||(t.offsetX+=s,t.offsetY+=u)}},lo=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},co=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,u=a/o,l={};return 0===t&&0<n||0===t&&0>n?(l.x=r,l.y=i+a/2,l):0<t&&-1*u<=s&&s<=u?(l.x=r+o/2,l.y=i+o*n/2/t,l):0>t&&-1*u<=s&&s<=u?(l.x=r-o/2,l.y=i-o*n/2/t,l):0<n&&(s<=-1*u||s>=u)?(l.x=r+a*t/2/n,l.y=i+a/2,l):0>n&&(s<=-1*u||s>=u)?(l.x=r-a*t/2/n,l.y=i-a/2,l):l},ho=function(e,t){for(var n=0;n<e.edgeSize;n++){var r=e.layoutEdges[n],i=e.idToIndex[r.sourceId],a=e.layoutNodes[i],o=e.idToIndex[r.targetId],s=e.layoutNodes[o],u=s.positionX-a.positionX,l=s.positionY-a.positionY;if(0!==u||0!==l){var c=co(a,u,l),d=co(s,-1*u,-1*l),h=d.x-c.x,f=d.y-c.y,p=Math.sqrt(h*h+f*f),v=Math.pow(r.idealLength-p,2)/r.elasticity;if(0!==p)var g=v*h/p,y=v*f/p;else g=0,y=0;a.isLocked||(a.offsetX+=g,a.offsetY+=y),s.isLocked||(s.offsetX-=g,s.offsetY-=y)}}},fo=function(e,t){for(var n=0;n<e.graphSet.length;n++){var r=e.graphSet[n],i=r.length;if(0===n)var a=e.clientHeight/2,o=e.clientWidth/2;else{var s=e.layoutNodes[e.idToIndex[r[0]]],u=e.layoutNodes[e.idToIndex[s.parentId]];a=u.positionX,o=u.positionY}for(var l=0;l<i;l++){var c=e.layoutNodes[e.idToIndex[r[l]]];if(!c.isLocked){var d=a-c.positionX,h=o-c.positionY,f=Math.sqrt(d*d+h*h);if(f>1){var p=t.gravity*d/f,v=t.gravity*h/f;c.offsetX+=p,c.offsetY+=v}}}}},po=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],u=s.children;if(0<u.length&&!s.isLocked){for(var l=s.offsetX,c=s.offsetY,d=0;d<u.length;d++){var h=e.layoutNodes[e.idToIndex[u[d]]];h.offsetX+=l,h.offsetY+=c,n[++i]=u[d]}s.offsetX=0,s.offsetY=0}}},vo=function(e,t){for(var n=0;n<e.nodeSize;n++){0<(i=e.layoutNodes[n]).children.length&&(i.maxX=void 0,i.minX=void 0,i.maxY=void 0,i.minY=void 0)}for(n=0;n<e.nodeSize;n++){if(!(0<(i=e.layoutNodes[n]).children.length||i.isLocked)){var r=go(i.offsetX,i.offsetY,e.temperature);i.positionX+=r.x,i.positionY+=r.y,i.offsetX=0,i.offsetY=0,i.minX=i.positionX-i.width,i.maxX=i.positionX+i.width,i.minY=i.positionY-i.height,i.maxY=i.positionY+i.height,yo(i,e)}}for(n=0;n<e.nodeSize;n++){var i;0<(i=e.layoutNodes[n]).children.length&&!i.isLocked&&(i.positionX=(i.maxX+i.minX)/2,i.positionY=(i.maxY+i.minY)/2,i.width=i.maxX-i.minX,i.height=i.maxY-i.minY)}},go=function(e,t,n){var r=Math.sqrt(e*e+t*t);if(r>n)var i={x:n*e/r,y:n*t/r};else i={x:e,y:t};return i},yo=function e(t,n){var r=t.parentId;if(null!=r){var i=n.layoutNodes[n.idToIndex[r]],a=!1;return(null==i.maxX||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,a=!0),(null==i.minX||t.minX-i.padLeft<i.minX)&&(i.minX=t.minX-i.padLeft,a=!0),(null==i.maxY||t.maxY+i.padBottom>i.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(null==i.minY||t.minY-i.padTop<i.minY)&&(i.minY=t.minY-i.padTop,a=!0),a?e(i,n):void 0}},mo=function(e,t){for(var n=e.layoutNodes,r=[],i=0;i<n.length;i++){var a=n[i],o=a.cmptId;(r[o]=r[o]||[]).push(a)}var s=0;for(i=0;i<r.length;i++){if(v=r[i]){v.x1=1/0,v.x2=-1/0,v.y1=1/0,v.y2=-1/0;for(var u=0;u<v.length;u++){var l=v[u];v.x1=Math.min(v.x1,l.positionX-l.width/2),v.x2=Math.max(v.x2,l.positionX+l.width/2),v.y1=Math.min(v.y1,l.positionY-l.height/2),v.y2=Math.max(v.y2,l.positionY+l.height/2)}v.w=v.x2-v.x1,v.h=v.y2-v.y1,s+=v.w*v.h}}r.sort((function(e,t){return t.w*t.h-e.w*e.h}));var c=0,d=0,h=0,f=0,p=Math.sqrt(s)*e.clientWidth/e.clientHeight;for(i=0;i<r.length;i++){var v;if(v=r[i]){for(u=0;u<v.length;u++){(l=v[u]).isLocked||(l.positionX+=c-v.x1,l.positionY+=d-v.y1)}c+=v.w+t.componentSpacing,h+=v.w+t.componentSpacing,f=Math.max(f,v.h),h>p&&(d+=f+t.componentSpacing,c=0,h=0,f=0)}}},bo={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function xo(e){this.options=j({},bo,e)}xo.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles.nodes().not(":parent");t.sort&&(r=r.sort(t.sort));var i=tt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===i.h||0===i.w)r.layoutPositions(this,t,(function(e){return{x:i.x1,y:i.y1}}));else{var a=r.size(),o=Math.sqrt(a*i.h/i.w),s=Math.round(o),u=Math.round(i.w/i.h*o),l=function(e){if(null==e)return Math.min(s,u);Math.min(s,u)==s?s=e:u=e},c=function(e){if(null==e)return Math.max(s,u);Math.max(s,u)==s?s=e:u=e},d=t.rows,h=null!=t.cols?t.cols:t.columns;if(null!=d&&null!=h)s=d,u=h;else if(null!=d&&null==h)s=d,u=Math.ceil(a/s);else if(null==d&&null!=h)u=h,s=Math.ceil(a/u);else if(u*s>a){var f=l(),p=c();(f-1)*p>=a?l(f-1):(p-1)*f>=a&&c(p-1)}else for(;u*s<a;){var v=l(),g=c();(g+1)*v>=a?c(g+1):l(v+1)}var y=i.w/u,m=i.h/s;if(t.condense&&(y=0,m=0),t.avoidOverlap)for(var b=0;b<r.length;b++){var x=r[b],w=x._private.position;null!=w.x&&null!=w.y||(w.x=0,w.y=0);var _=x.layoutDimensions(t),E=t.avoidOverlapPadding,k=_.w+E,C=_.h+E;y=Math.max(y,k),m=Math.max(m,C)}for(var S={},P=function(e,t){return!!S["c-"+e+"-"+t]},T=function(e,t){S["c-"+e+"-"+t]=!0},D=0,B=0,M=function(){++B>=u&&(B=0,D++)},z={},O=0;O<r.length;O++){var I=r[O],A=t.position(I);if(A&&(void 0!==A.row||void 0!==A.col)){var N={row:A.row,col:A.col};if(void 0===N.col)for(N.col=0;P(N.row,N.col);)N.col++;else if(void 0===N.row)for(N.row=0;P(N.row,N.col);)N.row++;z[I.id()]=N,T(N.row,N.col)}}r.layoutPositions(this,t,(function(e,t){var n,r;if(e.locked()||e.isParent())return!1;var a=z[e.id()];if(a)n=a.col*y+y/2+i.x1,r=a.row*m+m/2+i.y1;else{for(;P(D,B);)M();n=B*y+y/2+i.x1,r=D*m+m/2+i.y1,T(D,B),M()}return{x:n,y:r}}))}return this};var wo={ready:function(){},stop:function(){}};function _o(e){this.options=j({},wo,e)}_o.prototype.run=function(){var e=this.options,t=e.eles;e.cy;return this.emit("layoutstart"),t.nodes().positions((function(){return{x:0,y:0}})),this.one("layoutready",e.ready),this.emit("layoutready"),this.one("layoutstop",e.stop),this.emit("layoutstop"),this},_o.prototype.stop=function(){return this};var Eo={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function ko(e){this.options=j({},Eo,e)}ko.prototype.run=function(){var e=this.options,t=e.eles.nodes(),n=x(e.positions);return t.layoutPositions(this,e,(function(t,r){var i=function(t){if(null==e.positions)return function(e){return{x:e.x,y:e.y}}(t.position());if(n)return e.positions(t);var r=e.positions[t._private.data.id];return null==r?null:r}(t);return!t.locked()&&null!=i&&i})),this};var Co={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function So(e){this.options=j({},Co,e)}So.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles.nodes().not(":parent"),r=tt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});return n.layoutPositions(this,e,(function(e,t){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}})),this};var Po=[{name:"breadthfirst",impl:Xa},{name:"circle",impl:Za},{name:"concentric",impl:Ga},{name:"cose",impl:Qa},{name:"grid",impl:xo},{name:"null",impl:_o},{name:"preset",impl:ko},{name:"random",impl:So}];function To(e){this.options=e,this.notifications=0}var Do=function(){},Bo=function(){throw new Error("A headless instance can not render images")};To.prototype={recalculateRenderedStyle:Do,notify:function(){this.notifications++},init:Do,isHeadless:function(){return!0},png:Bo,jpg:Bo};var Mo={arrowShapeWidth:.3,registerArrowShapes:function(){var e=this.arrowShapes={},t=this,n=function(e,t,n,r,i,a,o){var s=i.x-n/2-o,u=i.x+n/2+o,l=i.y-n/2-o,c=i.y+n/2+o;return s<=e&&e<=u&&l<=t&&t<=c},r=function(e,t,n,r,i){var a=e*Math.cos(r)-t*Math.sin(r),o=(e*Math.sin(r)+t*Math.cos(r))*n;return{x:a*n+i.x,y:o+i.y}},i=function(e,t,n,i){for(var a=[],o=0;o<e.length;o+=2){var s=e[o],u=e[o+1];a.push(r(s,u,t,n,i))}return a},a=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];t.push(r.x,r.y)}return t},o=function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").pfValue*2},s=function(r,s){b(s)&&(s=e[s]),e[r]=j({name:r,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(e,t,n,r,o,s){var u=a(i(this.points,n+2*s,r,o));return vt(e,t,u)},roughCollide:n,draw:function(e,n,r,a){var o=i(this.points,n,r,a);t.arrowShapeImpl("polygon")(e,o)},spacing:function(e){return 0},gap:o},s)};s("none",{collide:le,roughCollide:le,draw:de,spacing:ce,gap:ce}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:n,draw:function(e,n,a,o,s){var u=i(this.points,n,a,o),l=this.controlPoint,c=r(l[0],l[1],n,a,o);t.arrowShapeImpl(this.name)(e,u,c)},gap:function(e){return.8*o(e)}}),s("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(e,t,n,r,o,s,u){var l=a(i(this.points,n+2*u,r,o)),c=a(i(this.pointsTee,n+2*u,r,o));return vt(e,t,l)||vt(e,t,c)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),u=i(this.pointsTee,n,r,a);t.arrowShapeImpl(this.name)(e,s,u)}}),s("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(e,t,n,r,o,s,u){var l=o,c=Math.pow(l.x-e,2)+Math.pow(l.y-t,2)<=Math.pow((n+2*u)*this.radius,2),d=a(i(this.points,n+2*u,r,o));return vt(e,t,d)||c},draw:function(e,n,r,a,o){var s=i(this.pointsTr,n,r,a);t.arrowShapeImpl(this.name)(e,s,a.x,a.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),s("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(e,t){var n=this.baseCrossLinePts.slice(),r=t/e;return n[3]=n[3]-r,n[5]=n[5]-r,n},collide:function(e,t,n,r,o,s,u){var l=a(i(this.points,n+2*u,r,o)),c=a(i(this.crossLinePts(n,s),n+2*u,r,o));return vt(e,t,l)||vt(e,t,c)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),u=i(this.crossLinePts(n,o),n,r,a);t.arrowShapeImpl(this.name)(e,s,u)}}),s("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(e){return.525*o(e)}}),s("circle",{radius:.15,collide:function(e,t,n,r,i,a,o){var s=i;return Math.pow(s.x-e,2)+Math.pow(s.y-t,2)<=Math.pow((n+2*o)*this.radius,2)},draw:function(e,n,r,i,a){t.arrowShapeImpl(this.name)(e,i.x,i.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),s("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(e){return 1},gap:function(e){return 1}}),s("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}}),s("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(e){return.95*e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}})}},zo={projectIntoViewport:function(e,t){var n=this.cy,r=this.findContainerClientCoords(),i=r[0],a=r[1],o=r[4],s=n.pan(),u=n.zoom();return[((e-i)/o-s.x)/u,((t-a)/o-s.y)/u]},findContainerClientCoords:function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),n=h.getComputedStyle(e),r=function(e){return parseFloat(n.getPropertyValue(e))},i=r("padding-left"),a=r("padding-right"),o=r("padding-top"),s=r("padding-bottom"),u=r("border-left-width"),l=r("border-right-width"),c=r("border-top-width"),d=(r("border-bottom-width"),e.clientWidth),f=e.clientHeight,p=i+a,v=o+s,g=u+l,y=t.width/(d+g),m=d-p,b=f-v,x=t.left+i+u,w=t.top+o+c;return this.containerBB=[x,w,m,b,y]},invalidateContainerClientCoordsCache:function(){this.containerBB=null},findNearestElement:function(e,t,n,r){return this.findNearestElements(e,t,n,r)[0]},findNearestElements:function(e,t,n,r){var i,a,o=this,s=this,u=s.getCachedZSortedEles(),l=[],c=s.cy.zoom(),d=s.cy.hasCompoundNodes(),h=(r?24:8)/c,f=(r?8:2)/c,p=(r?8:2)/c,v=1/0;function g(e,t){if(e.isNode()){if(a)return;a=e,l.push(e)}if(e.isEdge()&&(null==t||t<v))if(i){if(i.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value&&i.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value)for(var n=0;n<l.length;n++)if(l[n].isEdge()){l[n]=e,i=e,v=null!=t?t:v;break}}else l.push(e),i=e,v=null!=t?t:v}function y(n){var r=n.outerWidth()+2*f,i=n.outerHeight()+2*f,a=r/2,u=i/2,l=n.position();if(l.x-a<=e&&e<=l.x+a&&l.y-u<=t&&t<=l.y+u&&s.nodeShapes[o.getNodeShape(n)].checkPoint(e,t,0,r,i,l.x,l.y))return g(n,0),!0}function m(n){var r,i=n._private,a=i.rscratch,u=n.pstyle("width").pfValue,c=n.pstyle("arrow-scale").value,f=u/2+h,p=f*f,v=2*f,m=i.source,b=i.target;if("segments"===a.edgeType||"straight"===a.edgeType||"haystack"===a.edgeType){for(var x=a.allpts,w=0;w+3<x.length;w+=2)if(dt(e,t,x[w],x[w+1],x[w+2],x[w+3],v)&&p>(r=pt(e,t,x[w],x[w+1],x[w+2],x[w+3])))return g(n,r),!0}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType)for(x=a.allpts,w=0;w+5<a.allpts.length;w+=4)if(ht(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5],v)&&p>(r=ft(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5])))return g(n,r),!0;m=m||i.source,b=b||i.target;var _=o.getArrowWidth(u,c),E=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}];for(w=0;w<E.length;w++){var k=E[w],C=s.arrowShapes[n.pstyle(k.name+"-arrow-shape").value],S=n.pstyle("width").pfValue;if(C.roughCollide(e,t,_,k.angle,{x:k.x,y:k.y},S,h)&&C.collide(e,t,_,k.angle,{x:k.x,y:k.y},S,h))return g(n),!0}d&&l.length>0&&(y(m),y(b))}function b(e,t,n){return _e(e,t,n)}function x(n,r){var i,a=n._private,o=p;i=r?r+"-":"",n.boundingBox();var s=a.labelBounds[r||"main"],u=n.pstyle(i+"label").value;if("yes"===n.pstyle("text-events").strValue&&u){var l=a.rstyle,c=b(l,"labelX",r),d=b(l,"labelY",r),h=b(a.rscratch,"labelAngle",r),f=s.x1-o,v=s.x2+o,y=s.y1-o,m=s.y2+o;if(h){var x=Math.cos(h),w=Math.sin(h),_=function(e,t){return{x:(e-=c)*x-(t-=d)*w+c,y:e*w+t*x+d}},E=_(f,y),k=_(f,m),C=_(v,y),S=_(v,m),P=[E.x,E.y,C.x,C.y,S.x,S.y,k.x,k.y];if(vt(e,t,P))return g(n),!0}else if(ut(s,e,t))return g(n),!0}}n&&(u=u.interactive);for(var w=u.length-1;w>=0;w--){var _=u[w];_.isNode()?y(_)||x(_):m(_)||x(_)||x(_,"source")||x(_,"target")}return l},getAllInBox:function(e,t,n,r){for(var i,a,o=this.getCachedZSortedEles().interactive,s=[],u=Math.min(e,n),l=Math.max(e,n),c=Math.min(t,r),d=Math.max(t,r),h=tt({x1:e=u,y1:t=c,x2:n=l,y2:r=d}),f=0;f<o.length;f++){var p=o[f];if(p.isNode()){var v=p,g=v.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:!1});st(h,g)&&!lt(g,h)&&s.push(v)}else{var y=p,m=y._private,b=m.rscratch;if(null!=b.startX&&null!=b.startY&&!ut(h,b.startX,b.startY))continue;if(null!=b.endX&&null!=b.endY&&!ut(h,b.endX,b.endY))continue;if("bezier"===b.edgeType||"multibezier"===b.edgeType||"self"===b.edgeType||"compound"===b.edgeType||"segments"===b.edgeType||"haystack"===b.edgeType){for(var x=m.rstyle.bezierPts||m.rstyle.linePts||m.rstyle.haystackPts,w=!0,_=0;_<x.length;_++)if(i=h,a=x[_],!ut(i,a.x,a.y)){w=!1;break}w&&s.push(y)}else"haystack"!==b.edgeType&&"straight"!==b.edgeType||s.push(y)}}return s}},Oo={calculateArrowAngles:function(e){var t,n,r,i,a,o,s=e._private.rscratch,u="haystack"===s.edgeType,l="bezier"===s.edgeType,c="multibezier"===s.edgeType,d="segments"===s.edgeType,h="compound"===s.edgeType,f="self"===s.edgeType;if(u?(r=s.haystackPts[0],i=s.haystackPts[1],a=s.haystackPts[2],o=s.haystackPts[3]):(r=s.arrowStartX,i=s.arrowStartY,a=s.arrowEndX,o=s.arrowEndY),v=s.midX,g=s.midY,d)t=r-s.segpts[0],n=i-s.segpts[1];else if(c||h||f||l){var p=s.allpts;t=r-Qe(p[0],p[2],p[4],.1),n=i-Qe(p[1],p[3],p[5],.1)}else t=r-v,n=i-g;s.srcArrowAngle=He(t,n);var v=s.midX,g=s.midY;if(u&&(v=(r+a)/2,g=(i+o)/2),t=a-r,n=o-i,d)if((p=s.allpts).length/2%2==0){var y=(m=p.length/2)-2;t=p[m]-p[y],n=p[m+1]-p[y+1]}else{y=(m=p.length/2-1)-2;var m,b=m+2;t=p[m]-p[y],n=p[m+1]-p[y+1]}else if(c||h||f){var x,w,_,E,p=s.allpts;if(s.ctrlpts.length/2%2==0){var k=(C=(S=p.length/2-1)+2)+2;x=Qe(p[S],p[C],p[k],0),w=Qe(p[S+1],p[C+1],p[k+1],0),_=Qe(p[S],p[C],p[k],1e-4),E=Qe(p[S+1],p[C+1],p[k+1],1e-4)}else{var C,S;k=(C=p.length/2-1)+2;x=Qe(p[S=C-2],p[C],p[k],.4999),w=Qe(p[S+1],p[C+1],p[k+1],.4999),_=Qe(p[S],p[C],p[k],.5),E=Qe(p[S+1],p[C+1],p[k+1],.5)}t=_-x,n=E-w}(s.midtgtArrowAngle=He(t,n),s.midDispX=t,s.midDispY=n,t*=-1,n*=-1,d)&&((p=s.allpts).length/2%2==0||(t=-(p[b=(m=p.length/2-1)+2]-p[m]),n=-(p[b+1]-p[m+1])));if(s.midsrcArrowAngle=He(t,n),d)t=a-s.segpts[s.segpts.length-2],n=o-s.segpts[s.segpts.length-1];else if(c||h||f||l){var P=(p=s.allpts).length;t=a-Qe(p[P-6],p[P-4],p[P-2],.9),n=o-Qe(p[P-5],p[P-3],p[P-1],.9)}else t=a-v,n=o-g;s.tgtArrowAngle=He(t,n)}};Oo.getArrowWidth=Oo.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[e+", "+t];return r||(r=Math.max(Math.pow(13.37*e,.9),29)*t,n[e+", "+t]=r,r)};var Io={};function Ao(e){var t=[];if(null!=e){for(var n=0;n<e.length;n+=2){var r=e[n],i=e[n+1];t.push({x:r,y:i})}return t}}Io.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n._private,i=r.rscratch;if(!i.haystack){var a=2*Math.random()*Math.PI;i.source={x:Math.cos(a),y:Math.sin(a)},a=2*Math.random()*Math.PI,i.target={x:Math.cos(a),y:Math.sin(a)}}var o=r.source,s=r.target,u=o.position(),l=s.position(),c=o.width(),d=s.width(),h=o.height(),f=s.height(),p=n.pstyle("haystack-radius").value/2;i.haystackPts=i.allpts=[i.source.x*c*p+u.x,i.source.y*h*p+u.y,i.target.x*d*p+l.x,i.target.y*f*p+l.y],i.midX=(i.allpts[0]+i.allpts[2])/2,i.midY=(i.allpts[1]+i.allpts[3])/2,i.edgeType="haystack",i.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}},Io.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=t.posPts,i=t.intersectionPts,a=t.vectorNormInverse,o=e.pstyle("edge-distances").value,s=e.pstyle("segment-weights"),u=e.pstyle("segment-distances"),l=Math.min(s.pfValue.length,u.pfValue.length);n.edgeType="segments",n.segpts=[];for(var c=0;c<l;c++){var d=s.pfValue[c],h=u.pfValue[c],f=1-d,p=d,v="node-position"===o?r:i,g={x:v.x1*f+v.x2*p,y:v.y1*f+v.y2*p};n.segpts.push(g.x+a.x*h,g.y+a.y*h)}},Io.findLoopPoints=function(e,t,n,r){var i=e._private.rscratch,a=t.dirCounts,o=t.srcPos,s=e.pstyle("control-point-distances"),u=s?s.pfValue[0]:void 0,l=e.pstyle("loop-direction").pfValue,c=e.pstyle("loop-sweep").pfValue,d=e.pstyle("control-point-step-size").pfValue;i.edgeType="self";var h=n,f=d;r&&(h=0,f=u);var p=l-Math.PI/2,v=p-c/2,g=p+c/2,y=String(l+"_"+c);h=void 0===a[y]?a[y]=0:++a[y],i.ctrlpts=[o.x+1.4*Math.cos(v)*f*(h/3+1),o.y+1.4*Math.sin(v)*f*(h/3+1),o.x+1.4*Math.cos(g)*f*(h/3+1),o.y+1.4*Math.sin(g)*f*(h/3+1)]},Io.findCompoundLoopPoints=function(e,t,n,r){var i=e._private.rscratch;i.edgeType="compound";var a=t.srcPos,o=t.tgtPos,s=t.srcW,u=t.srcH,l=t.tgtW,c=t.tgtH,d=e.pstyle("control-point-step-size").pfValue,h=e.pstyle("control-point-distances"),f=h?h.pfValue[0]:void 0,p=n,v=d;r&&(p=0,v=f);var g={x:a.x-s/2,y:a.y-u/2},y={x:o.x-l/2,y:o.y-c/2},m={x:Math.min(g.x,y.x),y:Math.min(g.y,y.y)},b=Math.max(.5,Math.log(.01*s)),x=Math.max(.5,Math.log(.01*l));i.ctrlpts=[m.x,m.y-(1+Math.pow(50,1.12)/100)*v*(p/3+1)*b,m.x-(1+Math.pow(50,1.12)/100)*v*(p/3+1)*x,m.y]},Io.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"},Io.findBezierPoints=function(e,t,n,r,i){var a=e._private.rscratch,o=t.vectorNormInverse,s=t.posPts,u=t.intersectionPts,l=e.pstyle("edge-distances").value,c=e.pstyle("control-point-step-size").pfValue,d=e.pstyle("control-point-distances"),h=e.pstyle("control-point-weights"),f=d&&h?Math.min(d.value.length,h.value.length):1,p=d?d.pfValue[0]:void 0,v=h.value[0],g=r;a.edgeType=g?"multibezier":"bezier",a.ctrlpts=[];for(var y=0;y<f;y++){var m=(.5-t.eles.length/2+n)*c*(i?-1:1),b=void 0,x=Ue(m);g&&(p=d?d.pfValue[y]:c,v=h.value[y]);var w=void 0!==(b=r?p:void 0!==p?x*p:void 0)?b:m,_=1-v,E=v,k="node-position"===l?s:u,C={x:k.x1*_+k.x2*E,y:k.y1*_+k.y2*E};a.ctrlpts.push(C.x+o.x*w,C.y+o.y*w)}},Io.findTaxiPoints=function(e,t){var n=e._private.rscratch;n.edgeType="segments";var r=t.posPts,i=t.srcW,a=t.srcH,o=t.tgtW,s=t.tgtH,u="node-position"!==e.pstyle("edge-distances").value,l=e.pstyle("taxi-direction").value,c=l,d=e.pstyle("taxi-turn"),h="%"===d.units,f=d.pfValue,p=f<0,v=e.pstyle("taxi-turn-min-distance").pfValue,g=u?(i+o)/2:0,y=u?(a+s)/2:0,m=r.x2-r.x1,b=r.y2-r.y1,x=function(e,t){return e>0?Math.max(e-t,0):Math.min(e+t,0)},w=x(m,g),_=x(b,y),E=!1;"auto"===c?l=Math.abs(w)>Math.abs(_)?"horizontal":"vertical":"upward"===c||"downward"===c?(l="vertical",E=!0):"leftward"!==c&&"rightward"!==c||(l="horizontal",E=!0);var k,C="vertical"===l,S=C?_:w,P=C?b:m,T=Ue(P),D=!1;(E&&(h||p)||!("downward"===c&&P<0||"upward"===c&&P>0||"leftward"===c&&P>0||"rightward"===c&&P<0)||(S=(T*=-1)*Math.abs(S),D=!0),h)?k=(f<0?1+f:f)*S:k=(f<0?S:0)+f*T;var B=function(e){return Math.abs(e)<v||Math.abs(e)>=Math.abs(S)},M=B(k),z=B(Math.abs(S)-Math.abs(k));if((M||z)&&!D)if(C){var O=Math.abs(P)<=a/2,I=Math.abs(m)<=o/2;if(O){var A=(r.x1+r.x2)/2,N=r.y1,L=r.y2;n.segpts=[A,N,A,L]}else if(I){var R=(r.y1+r.y2)/2,j=r.x1,V=r.x2;n.segpts=[j,R,V,R]}else n.segpts=[r.x1,r.y2]}else{var F=Math.abs(P)<=i/2,q=Math.abs(b)<=s/2;if(F){var W=(r.y1+r.y2)/2,Y=r.x1,X=r.x2;n.segpts=[Y,W,X,W]}else if(q){var H=(r.x1+r.x2)/2,Z=r.y1,U=r.y2;n.segpts=[H,Z,H,U]}else n.segpts=[r.x2,r.y1]}else if(C){var K=r.y1+k+(u?a/2*T:0),G=r.x1,$=r.x2;n.segpts=[G,K,$,K]}else{var Q=r.x1+k+(u?i/2*T:0),J=r.y1,ee=r.y2;n.segpts=[Q,J,Q,ee]}},Io.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,u=t.tgtH,l=t.srcShape,c=t.tgtShape,d=!E(n.startX)||!E(n.startY),h=!E(n.arrowStartX)||!E(n.arrowStartY),f=!E(n.endX)||!E(n.endY),p=!E(n.arrowEndX)||!E(n.arrowEndY),v=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),g=Ke({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),y=g<v,m=Ke({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),b=m<v,x=!1;if(d||h||y){x=!0;var w={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},_=Math.sqrt(w.x*w.x+w.y*w.y),k={x:w.x/_,y:w.y/_},C=Math.max(a,o),S={x:n.ctrlpts[0]+2*k.x*C,y:n.ctrlpts[1]+2*k.y*C},P=l.intersectLine(r.x,r.y,a,o,S.x,S.y,0);y?(n.ctrlpts[0]=n.ctrlpts[0]+k.x*(v-g),n.ctrlpts[1]=n.ctrlpts[1]+k.y*(v-g)):(n.ctrlpts[0]=P[0]+k.x*v,n.ctrlpts[1]=P[1]+k.y*v)}if(f||p||b){x=!0;var T={x:n.ctrlpts[0]-i.x,y:n.ctrlpts[1]-i.y},D=Math.sqrt(T.x*T.x+T.y*T.y),B={x:T.x/D,y:T.y/D},M=Math.max(a,o),z={x:n.ctrlpts[0]+2*B.x*M,y:n.ctrlpts[1]+2*B.y*M},O=c.intersectLine(i.x,i.y,s,u,z.x,z.y,0);b?(n.ctrlpts[0]=n.ctrlpts[0]+B.x*(v-m),n.ctrlpts[1]=n.ctrlpts[1]+B.y*(v-m)):(n.ctrlpts[0]=O[0]+B.x*v,n.ctrlpts[1]=O[1]+B.y*v)}x&&this.findEndpoints(e)}},Io.storeAllpts=function(e){var t=e._private.rscratch;if("multibezier"===t.edgeType||"bezier"===t.edgeType||"self"===t.edgeType||"compound"===t.edgeType){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var n=0;n+1<t.ctrlpts.length;n+=2)t.allpts.push(t.ctrlpts[n],t.ctrlpts[n+1]),n+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[n]+t.ctrlpts[n+2])/2,(t.ctrlpts[n+1]+t.ctrlpts[n+3])/2);var r;t.allpts.push(t.endX,t.endY),t.ctrlpts.length/2%2==0?(r=t.allpts.length/2-1,t.midX=t.allpts[r],t.midY=t.allpts[r+1]):(r=t.allpts.length/2-3,.5,t.midX=Qe(t.allpts[r],t.allpts[r+2],t.allpts[r+4],.5),t.midY=Qe(t.allpts[r+1],t.allpts[r+3],t.allpts[r+5],.5))}else if("straight"===t.edgeType)t.allpts=[t.startX,t.startY,t.endX,t.endY],t.midX=(t.startX+t.endX+t.arrowStartX+t.arrowEndX)/4,t.midY=(t.startY+t.endY+t.arrowStartY+t.arrowEndY)/4;else if("segments"===t.edgeType)if(t.allpts=[],t.allpts.push(t.startX,t.startY),t.allpts.push.apply(t.allpts,t.segpts),t.allpts.push(t.endX,t.endY),t.segpts.length%4==0){var i=t.segpts.length/2,a=i-2;t.midX=(t.segpts[a]+t.segpts[i])/2,t.midY=(t.segpts[a+1]+t.segpts[i+1])/2}else{var o=t.segpts.length/2-1;t.midX=t.segpts[o],t.midY=t.segpts[o+1]}},Io.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||E(t.startX)&&E(t.startY)&&E(t.endX)&&E(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,pe("Edge `"+e.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))},Io.findEdgeControlPoints=function(e){var t=this;if(e&&0!==e.length){for(var n=this,r=n.cy.hasCompoundNodes(),i={map:new ke,get:function(e){var t=this.map.get(e[0]);return null!=t?t.get(e[1]):null},set:function(e,t){var n=this.map.get(e[0]);null==n&&(n=new ke,this.map.set(e[0],n)),n.set(e[1],t)}},a=[],o=[],s=0;s<e.length;s++){var u=e[s],l=u._private,c=u.pstyle("curve-style").value;if(!u.removed()&&u.takesUpSpace())if("haystack"!==c){var d="unbundled-bezier"===c||"segments"===c||"straight"===c||"taxi"===c,h="unbundled-bezier"===c||"bezier"===c,f=l.source,p=l.target,v=[f.poolIndex(),p.poolIndex()].sort(),g=i.get(v);null==g&&(g={eles:[]},i.set(v,g),a.push(v)),g.eles.push(u),d&&(g.hasUnbundled=!0),h&&(g.hasBezier=!0)}else o.push(u)}for(var y=function(e){var o=a[e],s=i.get(o),u=void 0;if(!s.hasUnbundled){var l=s.eles[0].parallelEdges().filter((function(e){return e.isBundledBezier()}));we(s.eles),l.forEach((function(e){return s.eles.push(e)})),s.eles.sort((function(e,t){return e.poolIndex()-t.poolIndex()}))}var c=s.eles[0],d=c.source(),h=c.target();if(d.poolIndex()>h.poolIndex()){var f=d;d=h,h=f}var p=s.srcPos=d.position(),v=s.tgtPos=h.position(),g=s.srcW=d.outerWidth(),y=s.srcH=d.outerHeight(),m=s.tgtW=h.outerWidth(),b=s.tgtH=h.outerHeight(),x=s.srcShape=n.nodeShapes[t.getNodeShape(d)],w=s.tgtShape=n.nodeShapes[t.getNodeShape(h)];s.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var _=0;_<s.eles.length;_++){var k=s.eles[_],C=k[0]._private.rscratch,S=k.pstyle("curve-style").value,P="unbundled-bezier"===S||"segments"===S||"taxi"===S,T=!d.same(k.source());if(!s.calculatedIntersection&&d!==h&&(s.hasBezier||s.hasUnbundled)){s.calculatedIntersection=!0;var D=x.intersectLine(p.x,p.y,g,y,v.x,v.y,0),B=s.srcIntn=D,M=w.intersectLine(v.x,v.y,m,b,p.x,p.y,0),z=s.tgtIntn=M,O=s.intersectionPts={x1:D[0],x2:M[0],y1:D[1],y2:M[1]},I=s.posPts={x1:p.x,x2:v.x,y1:p.y,y2:v.y},A=M[1]-D[1],N=M[0]-D[0],L=Math.sqrt(N*N+A*A),R=s.vector={x:N,y:A},j=s.vectorNorm={x:R.x/L,y:R.y/L},V={x:-j.y,y:j.x};s.nodesOverlap=!E(L)||w.checkPoint(D[0],D[1],0,m,b,v.x,v.y)||x.checkPoint(M[0],M[1],0,g,y,p.x,p.y),s.vectorNormInverse=V,u={nodesOverlap:s.nodesOverlap,dirCounts:s.dirCounts,calculatedIntersection:!0,hasBezier:s.hasBezier,hasUnbundled:s.hasUnbundled,eles:s.eles,srcPos:v,tgtPos:p,srcW:m,srcH:b,tgtW:g,tgtH:y,srcIntn:z,tgtIntn:B,srcShape:w,tgtShape:x,posPts:{x1:I.x2,y1:I.y2,x2:I.x1,y2:I.y1},intersectionPts:{x1:O.x2,y1:O.y2,x2:O.x1,y2:O.y1},vector:{x:-R.x,y:-R.y},vectorNorm:{x:-j.x,y:-j.y},vectorNormInverse:{x:-V.x,y:-V.y}}}var F=T?u:s;C.nodesOverlap=F.nodesOverlap,C.srcIntn=F.srcIntn,C.tgtIntn=F.tgtIntn,r&&(d.isParent()||d.isChild()||h.isParent()||h.isChild())&&(d.parents().anySame(h)||h.parents().anySame(d)||d.same(h)&&d.isParent())?t.findCompoundLoopPoints(k,F,_,P):d===h?t.findLoopPoints(k,F,_,P):"segments"===S?t.findSegmentsPoints(k,F):"taxi"===S?t.findTaxiPoints(k,F):"straight"===S||!P&&s.eles.length%2==1&&_===Math.floor(s.eles.length/2)?t.findStraightEdgePoints(k):t.findBezierPoints(k,F,_,P,T),t.findEndpoints(k),t.tryToCorrectInvalidPoints(k,F),t.checkForInvalidEdgeWarning(k),t.storeAllpts(k),t.storeEdgeProjections(k),t.calculateArrowAngles(k),t.recalculateEdgeLabelProjections(k),t.calculateLabelAngles(k)}},m=0;m<a.length;m++)y(m);this.findHaystackPoints(o)}},Io.getSegmentPoints=function(e){var t=e[0]._private.rscratch;if("segments"===t.edgeType)return this.recalculateRenderedStyle(e),Ao(t.segpts)},Io.getControlPoints=function(e){var t=e[0]._private.rscratch,n=t.edgeType;if("bezier"===n||"multibezier"===n||"self"===n||"compound"===n)return this.recalculateRenderedStyle(e),Ao(t.ctrlpts)},Io.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var No={manualEndptToPx:function(e,t){var n=e.position(),r=e.outerWidth(),i=e.outerHeight();if(2===t.value.length){var a=[t.pfValue[0],t.pfValue[1]];return"%"===t.units[0]&&(a[0]=a[0]*r),"%"===t.units[1]&&(a[1]=a[1]*i),a[0]+=n.x,a[1]+=n.y,a}var o=t.pfValue[0];o=-Math.PI/2+o;var s=2*Math.max(r,i),u=[n.x+Math.cos(o)*s,n.y+Math.sin(o)*s];return this.nodeShapes[this.getNodeShape(e)].intersectLine(n.x,n.y,r,i,u[0],u[1],0)},findEndpoints:function(e){var t,n,r,i,a,o=this,s=e.source()[0],u=e.target()[0],l=s.position(),c=u.position(),d=e.pstyle("target-arrow-shape").value,h=e.pstyle("source-arrow-shape").value,f=e.pstyle("target-distance-from-node").pfValue,p=e.pstyle("source-distance-from-node").pfValue,v=e.pstyle("curve-style").value,g=e._private.rscratch,y=g.edgeType,m="self"===y||"compound"===y,b="bezier"===y||"multibezier"===y||m,x="bezier"!==y,w="straight"===y||"segments"===y,_="segments"===y,k=b||x||w,C=m||"taxi"===v,S=e.pstyle("source-endpoint"),P=C?"outside-to-node":S.value,T=e.pstyle("target-endpoint"),D=C?"outside-to-node":T.value;if(g.srcManEndpt=S,g.tgtManEndpt=T,b){var B=[g.ctrlpts[0],g.ctrlpts[1]];n=x?[g.ctrlpts[g.ctrlpts.length-2],g.ctrlpts[g.ctrlpts.length-1]]:B,r=B}else if(w){var M=_?g.segpts.slice(0,2):[c.x,c.y];n=_?g.segpts.slice(g.segpts.length-2):[l.x,l.y],r=M}if("inside-to-node"===D)t=[c.x,c.y];else if(T.units)t=this.manualEndptToPx(u,T);else if("outside-to-line"===D)t=g.tgtIntn;else if("outside-to-node"===D||"outside-to-node-or-label"===D?i=n:"outside-to-line"!==D&&"outside-to-line-or-label"!==D||(i=[l.x,l.y]),t=o.nodeShapes[this.getNodeShape(u)].intersectLine(c.x,c.y,u.outerWidth(),u.outerHeight(),i[0],i[1],0),"outside-to-node-or-label"===D||"outside-to-line-or-label"===D){var z=u._private.rscratch,O=z.labelWidth,I=z.labelHeight,A=z.labelX,N=z.labelY,L=O/2,R=I/2,j=u.pstyle("text-valign").value;"top"===j?N-=R:"bottom"===j&&(N+=R);var V=u.pstyle("text-halign").value;"left"===V?A-=L:"right"===V&&(A+=L);var F=Et(i[0],i[1],[A-L,N-R,A+L,N-R,A+L,N+R,A-L,N+R],c.x,c.y);if(F.length>0){var q=l,W=Ge(q,Xe(t)),Y=Ge(q,Xe(F)),X=W;if(Y<W&&(t=F,X=Y),F.length>2)Ge(q,{x:F[2],y:F[3]})<X&&(t=[F[2],F[3]])}}var H=kt(t,n,o.arrowShapes[d].spacing(e)+f),Z=kt(t,n,o.arrowShapes[d].gap(e)+f);if(g.endX=Z[0],g.endY=Z[1],g.arrowEndX=H[0],g.arrowEndY=H[1],"inside-to-node"===P)t=[l.x,l.y];else if(S.units)t=this.manualEndptToPx(s,S);else if("outside-to-line"===P)t=g.srcIntn;else if("outside-to-node"===P||"outside-to-node-or-label"===P?a=r:"outside-to-line"!==P&&"outside-to-line-or-label"!==P||(a=[c.x,c.y]),t=o.nodeShapes[this.getNodeShape(s)].intersectLine(l.x,l.y,s.outerWidth(),s.outerHeight(),a[0],a[1],0),"outside-to-node-or-label"===P||"outside-to-line-or-label"===P){var U=s._private.rscratch,K=U.labelWidth,G=U.labelHeight,$=U.labelX,Q=U.labelY,J=K/2,ee=G/2,te=s.pstyle("text-valign").value;"top"===te?Q-=ee:"bottom"===te&&(Q+=ee);var ne=s.pstyle("text-halign").value;"left"===ne?$-=J:"right"===ne&&($+=J);var re=Et(a[0],a[1],[$-J,Q-ee,$+J,Q-ee,$+J,Q+ee,$-J,Q+ee],l.x,l.y);if(re.length>0){var ie=c,ae=Ge(ie,Xe(t)),oe=Ge(ie,Xe(re)),se=ae;if(oe<ae&&(t=[re[0],re[1]],se=oe),re.length>2)Ge(ie,{x:re[2],y:re[3]})<se&&(t=[re[2],re[3]])}}var ue=kt(t,r,o.arrowShapes[h].spacing(e)+p),le=kt(t,r,o.arrowShapes[h].gap(e)+p);g.startX=le[0],g.startY=le[1],g.arrowStartX=ue[0],g.arrowStartY=ue[1],k&&(E(g.startX)&&E(g.startY)&&E(g.endX)&&E(g.endY)?g.badLine=!1:g.badLine=!0)},getSourceEndpoint:function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case"haystack":return{x:t.haystackPts[0],y:t.haystackPts[1]};default:return{x:t.arrowStartX,y:t.arrowStartY}}},getTargetEndpoint:function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case"haystack":return{x:t.haystackPts[2],y:t.haystackPts[3]};default:return{x:t.arrowEndX,y:t.arrowEndY}}}},Lo={};function Ro(e,t,n){for(var r=function(e,t,n,r){return Qe(e,t,n,r)},i=t._private.rstyle.bezierPts,a=0;a<e.bezierProjPcts.length;a++){var o=e.bezierProjPcts[a];i.push({x:r(n[0],n[2],n[4],o),y:r(n[1],n[3],n[5],o)})}}Lo.storeEdgeProjections=function(e){var t=e._private,n=t.rscratch,r=n.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,"multibezier"===r||"bezier"===r||"self"===r||"compound"===r){t.rstyle.bezierPts=[];for(var i=0;i+5<n.allpts.length;i+=4)Ro(this,e,n.allpts.slice(i,i+6))}else if("segments"===r){var a=t.rstyle.linePts=[];for(i=0;i+1<n.allpts.length;i+=2)a.push({x:n.allpts[i],y:n.allpts[i+1]})}else if("haystack"===r){var o=n.haystackPts;t.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth},Lo.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var jo={recalculateNodeLabelProjection:function(e){var t=e.pstyle("label").strValue;if(!B(t)){var n,r,i=e._private,a=e.width(),o=e.height(),s=e.padding(),u=e.position(),l=e.pstyle("text-halign").strValue,c=e.pstyle("text-valign").strValue,d=i.rscratch,h=i.rstyle;switch(l){case"left":n=u.x-a/2-s;break;case"right":n=u.x+a/2+s;break;default:n=u.x}switch(c){case"top":r=u.y-o/2-s;break;case"bottom":r=u.y+o/2+s;break;default:r=u.y}d.labelX=n,d.labelY=r,h.labelX=n,h.labelY=r,this.applyLabelDimensions(e)}}},Vo=function(e,t){var n=Math.atan(t/e);return 0===e&&n<0&&(n*=-1),n},Fo=function(e,t){var n=t.x-e.x,r=t.y-e.y;return Vo(n,r)};jo.recalculateEdgeLabelProjections=function(e){var t,n=e._private,r=n.rscratch,i=this,a={mid:e.pstyle("label").strValue,source:e.pstyle("source-label").strValue,target:e.pstyle("target-label").strValue};if(a.mid||a.source||a.target){t={x:r.midX,y:r.midY};var o=function(e,t,r){Ee(n.rscratch,e,t,r),Ee(n.rstyle,e,t,r)};o("labelX",null,t.x),o("labelY",null,t.y);var s=Vo(r.midDispX,r.midDispY);o("labelAutoAngle",null,s);var u=function(s){var u,l="source"===s;if(a[s]){var c=e.pstyle(s+"-text-offset").pfValue;switch(r.edgeType){case"self":case"compound":case"bezier":case"multibezier":for(var d,h=function e(){if(e.cache)return e.cache;for(var t=[],a=0;a+5<r.allpts.length;a+=4){var o={x:r.allpts[a],y:r.allpts[a+1]},s={x:r.allpts[a+2],y:r.allpts[a+3]},u={x:r.allpts[a+4],y:r.allpts[a+5]};t.push({p0:o,p1:s,p2:u,startDist:0,length:0,segments:[]})}var l=n.rstyle.bezierPts,c=i.bezierProjPcts.length;function d(e,t,n,r,i){var a=Ke(t,n),o=e.segments[e.segments.length-1],s={p0:t,p1:n,t0:r,t1:i,startDist:o?o.startDist+o.length:0,length:a};e.segments.push(s),e.length+=a}for(var h=0;h<t.length;h++){var f=t[h],p=t[h-1];p&&(f.startDist=p.startDist+p.length),d(f,f.p0,l[h*c],0,i.bezierProjPcts[0]);for(var v=0;v<c-1;v++)d(f,l[h*c+v],l[h*c+v+1],i.bezierProjPcts[v],i.bezierProjPcts[v+1]);d(f,l[h*c+c-1],f.p2,i.bezierProjPcts[c-1],1)}return e.cache=t}(),f=0,p=0,v=0;v<h.length;v++){for(var g=h[l?v:h.length-1-v],y=0;y<g.segments.length;y++){var m=g.segments[l?y:g.segments.length-1-y],b=v===h.length-1&&y===g.segments.length-1;if(f=p,(p+=m.length)>=c||b){d={cp:g,segment:m};break}}if(d)break}var x=d.cp,w=d.segment,_=(c-f)/w.length,E=w.t1-w.t0,k=l?w.t0+E*_:w.t1-E*_;k=et(0,k,1),t=Je(x.p0,x.p1,x.p2,k),u=function(e,t,n,r){var i=et(0,r-.001,1),a=et(0,r+.001,1),o=Je(e,t,n,i),s=Je(e,t,n,a);return Fo(o,s)}(x.p0,x.p1,x.p2,k);break;case"straight":case"segments":case"haystack":for(var C,S,P,T,D=0,B=r.allpts.length,M=0;M+3<B&&(l?(P={x:r.allpts[M],y:r.allpts[M+1]},T={x:r.allpts[M+2],y:r.allpts[M+3]}):(P={x:r.allpts[B-2-M],y:r.allpts[B-1-M]},T={x:r.allpts[B-4-M],y:r.allpts[B-3-M]}),S=D,!((D+=C=Ke(P,T))>=c));M+=2);var z=(c-S)/C;z=et(0,z,1),t=function(e,t,n,r){var i=t.x-e.x,a=t.y-e.y,o=Ke(e,t),s=i/o,u=a/o;return n=null==n?0:n,r=null!=r?r:n*o,{x:e.x+s*r,y:e.y+u*r}}(P,T,z),u=Fo(P,T)}o("labelX",s,t.x),o("labelY",s,t.y),o("labelAutoAngle",s,u)}};u("source"),u("target"),this.applyLabelDimensions(e)}},jo.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},jo.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r),a=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,s=_e(n.rscratch,"labelWrapCachedLines",t)||[],u="wrap"!==o?1:Math.max(s.length,1),l=i.height/u,c=l*a,d=i.width,h=i.height+(u-1)*(a-1)*l;Ee(n.rstyle,"labelWidth",t,d),Ee(n.rscratch,"labelWidth",t,d),Ee(n.rstyle,"labelHeight",t,h),Ee(n.rscratch,"labelHeight",t,h),Ee(n.rscratch,"labelLineHeight",t,c)},jo.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,o=function(e,r){return r?(Ee(n.rscratch,e,t,r),r):_e(n.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var u=o("labelKey");if(null!=u&&o("labelWrapKey")===u)return o("labelWrapCachedText");for(var l=i.split("\n"),c=e.pstyle("text-max-width").pfValue,d="anywhere"===e.pstyle("text-overflow-wrap").value,h=[],f=/[\s\u200b]+/,p=d?"":" ",v=0;v<l.length;v++){var g=l[v],y=this.calculateLabelDimensions(e,g).width;if(d){var m=g.split("").join("");g=m}if(y>c){for(var b=g.split(f),x="",w=0;w<b.length;w++){var _=b[w],E=0===x.length?_:x+p+_;this.calculateLabelDimensions(e,E).width<=c?x+=_+p:(x&&h.push(x),x=_+p)}x.match(/^[\s\u200b]+$/)||h.push(x)}else h.push(g)}o("labelWrapCachedLines",h),i=o("labelWrapCachedText",h.join("\n")),o("labelWrapKey",u)}else if("ellipsis"===s){for(var k=e.pstyle("text-max-width").pfValue,C="",S=!1,P=0;P<i.length;P++){if(this.calculateLabelDimensions(e,C+i[P]+"…").width>k)break;C+=i[P],P===i.length-1&&(S=!0)}return S||(C+="…"),C}return i},jo.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},jo.calculateLabelDimensions=function(e,t){var n=te(t,e._private.labelDimsKey),r=this.labelDimCache||(this.labelDimCache=[]),i=r[n];if(null!=i)return i;var a=e.pstyle("font-style").strValue,o=1*e.pstyle("font-size").pfValue+"px",s=e.pstyle("font-family").strValue,u=e.pstyle("font-weight").strValue,l=this.labelCalcDiv;l||(l=this.labelCalcDiv=document.createElement("div"),document.body.appendChild(l));var c=l.style;return c.fontFamily=s,c.fontStyle=a,c.fontSize=o,c.fontWeight=u,c.position="absolute",c.left="-9999px",c.top="-9999px",c.zIndex="-1",c.visibility="hidden",c.pointerEvents="none",c.padding="0",c.lineHeight="1",c.whiteSpace="pre",l.textContent=t,r[n]={width:Math.ceil(l.clientWidth/1),height:Math.ceil(l.clientHeight/1)}},jo.calculateLabelAngle=function(e,t){var n=e._private.rscratch,r=e.isEdge(),i=t?t+"-":"",a=e.pstyle(i+"text-rotation"),o=a.strValue;return"none"===o?0:r&&"autorotate"===o?n.labelAutoAngle:"autorotate"===o?0:a.pfValue},jo.calculateLabelAngles=function(e){var t=this,n=e.isEdge(),r=e._private.rscratch;r.labelAngle=t.calculateLabelAngle(e),n&&(r.sourceLabelAngle=t.calculateLabelAngle(e,"source"),r.targetLabelAngle=t.calculateLabelAngle(e,"target"))};var qo={},Wo=!1;qo.getNodeShape=function(e){var t=e.pstyle("shape").value;if("cutrectangle"===t&&(e.width()<28||e.height()<28))return Wo||(pe("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),Wo=!0),"rectangle";if(e.isParent())return"rectangle"===t||"roundrectangle"===t||"round-rectangle"===t||"cutrectangle"===t||"cut-rectangle"===t||"barrel"===t?t:"rectangle";if("polygon"===t){var n=e.pstyle("shape-polygon-points").value;return this.nodeShapes.makePolygon(n).name}return t};var Yo={registerCalculationListeners:function(){var e=this.cy,t=e.collection(),n=this,r=function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(t.merge(e),n)for(var r=0;r<e.length;r++){var i=e[r],a=i._private,o=a.rstyle;o.clean=!1,o.cleanConnected=!1}};n.binder(e).on("bounds.* dirty.*",(function(e){var t=e.target;r(t)})).on("style.* background.*",(function(e){var t=e.target;r(t,!1)}));var i=function(i){if(i){for(var a=n.onUpdateEleCalcsFns,o=0;o<t.length;o++){var s=t[o],u=s._private.rstyle;s.isNode()&&!u.cleanConnected&&(r(s.connectedEdges()),u.cleanConnected=!0)}if(a)for(var l=0;l<a.length;l++){(0,a[l])(i,t)}n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){i(!0)},n.beforeRender(i,n.beforeRenderPriorities.eleCalcs)},onUpdateEleCalcs:function(e){(this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[]).push(e)},recalculateRenderedStyle:function(e,t){var n=function(e){return e._private.rstyle.cleanConnected},r=[],i=[];if(!this.destroyed){void 0===t&&(t=!0);for(var a=0;a<e.length;a++){var o=e[a],s=o._private,u=s.rstyle;!o.isEdge()||n(o.source())&&n(o.target())||(u.clean=!1),t&&u.clean||o.removed()||"none"!==o.pstyle("display").value&&("nodes"===s.group?i.push(o):r.push(o),u.clean=!0)}for(var l=0;l<i.length;l++){var c=i[l],d=c._private.rstyle,h=c.position();this.recalculateNodeLabelProjection(c),d.nodeX=h.x,d.nodeY=h.y,d.nodeW=c.pstyle("width").pfValue,d.nodeH=c.pstyle("height").pfValue}this.recalculateEdgeProjections(r);for(var f=0;f<r.length;f++){var p=r[f]._private,v=p.rstyle,g=p.rscratch;v.srcX=g.arrowStartX,v.srcY=g.arrowStartY,v.tgtX=g.arrowEndX,v.tgtY=g.arrowEndY,v.midX=g.midX,v.midY=g.midY,v.labelAngle=g.labelAngle,v.sourceLabelAngle=g.sourceLabelAngle,v.targetLabelAngle=g.targetLabelAngle}}}},Xo={updateCachedGrabbedEles:function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var r=(i=e[n])._private.rscratch;i.grabbed()&&!i.isParent()?t.push(i):r.inDragLayer?e.drag.push(i):e.nondrag.push(i)}for(n=0;n<t.length;n++){var i=t[n];e.drag.push(i)}}},invalidateCachedZSortedEles:function(){this.cachedZSortedEles=null},getCachedZSortedEles:function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(zi),t.interactive=t.filter((function(e){return e.interactive()})),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t}},Ho={};[zo,Oo,Io,No,Lo,jo,qo,Yo,Xo].forEach((function(e){j(Ho,e)}));var Zo={getCachedImage:function(e,t,n){var r=this.imageCache=this.imageCache||{},i=r[e];if(i)return i.image.complete||i.image.addEventListener("load",n),i.image;var a=(i=r[e]=r[e]||{}).image=new Image;a.addEventListener("load",n),a.addEventListener("error",(function(){a.error=!0}));return"data:"===e.substring(0,"data:".length).toLowerCase()||(a.crossOrigin=t),a.src=e,a}},Uo={registerBinding:function(e,t,n,r){var i=Array.prototype.slice.apply(arguments,[1]),a=this.binder(e);return a.on.apply(a,i)}};Uo.binder=function(e){var t,n=this,r=e===window||e===document||e===document.body||(t=e,"undefined"!=typeof HTMLElement&&t instanceof HTMLElement);if(null==n.supportsPassiveEvents){var i=!1;try{var a=Object.defineProperty({},"passive",{get:function(){return i=!0,!0}});window.addEventListener("test",null,a)}catch(e){}n.supportsPassiveEvents=i}var o=function(t,i,a){var o=Array.prototype.slice.call(arguments);return r&&n.supportsPassiveEvents&&(o[2]={capture:null!=a&&a,passive:!1,once:!1}),n.bindings.push({target:e,args:o}),(e.addEventListener||e.on).apply(e,o),this};return{on:o,addEventListener:o,addListener:o,bind:o}},Uo.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},Uo.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()},Uo.load=function(){var e=this,t=function(e){return e.selected()},n=function(t,n,r,i){null==t&&(t=e.cy);for(var a=0;a<n.length;a++){var o=n[a];t.emit({originalEvent:r,type:o,position:i})}},r=function(e){return e.shiftKey||e.metaKey||e.ctrlKey},a=function(t,n){var r=!0;if(e.cy.hasCompoundNodes()&&t&&t.pannable())for(var i=0;n&&i<n.length;i++){if((t=n[i]).isNode()&&t.isParent()){r=!1;break}}else r=!0;return r},o=function(e){e[0]._private.rscratch.inDragLayer=!0},s=function(e){e[0]._private.rscratch.isGrabTarget=!0},u=function(e,t){var n=t.addToList;n.has(e)||(n.merge(e),function(e){e[0]._private.grabbed=!0}(e))},l=function(t,n){n=n||{};var r=t.cy().hasCompoundNodes();n.inDragLayer&&(t.forEach(o),t.neighborhood().stdFilter((function(e){return!r||e.isEdge()})).forEach(o)),n.addToList&&t.forEach((function(e){u(e,n)})),function(e,t){if(e.cy().hasCompoundNodes()&&(null!=t.inDragLayer||null!=t.addToList)){var n=e.descendants();t.inDragLayer&&(n.forEach(o),n.connectedEdges().forEach(o)),t.addToList&&t.addToList.unmerge(n)}}(t,n),h(t,{inDragLayer:n.inDragLayer}),e.updateCachedGrabbedEles()},c=l,d=function(t){t&&(e.getCachedZSortedEles().forEach((function(e){!function(e){e[0]._private.grabbed=!1}(e),function(e){e[0]._private.rscratch.inDragLayer=!1}(e),function(e){e[0]._private.rscratch.isGrabTarget=!1}(e)})),e.updateCachedGrabbedEles())},h=function(e,t){if((null!=t.inDragLayer||null!=t.addToList)&&e.cy().hasCompoundNodes()){var n=e.ancestors().orphans();if(!n.same(e)){var r=n.descendants().spawnSelf().merge(n).unmerge(e).unmerge(e.descendants()),i=r.connectedEdges();t.inDragLayer&&(i.forEach(o),r.forEach(o)),t.addToList&&r.forEach((function(e){u(e,t)}))}}},f=function(){null!=document.activeElement&&null!=document.activeElement.blur&&document.activeElement.blur()},p="undefined"!=typeof MutationObserver,v="undefined"!=typeof ResizeObserver;p?(e.removeObserver=new MutationObserver((function(t){for(var n=0;n<t.length;n++){var r=t[n].removedNodes;if(r)for(var i=0;i<r.length;i++){if(r[i]===e.container){e.destroy();break}}}})),e.container.parentNode&&e.removeObserver.observe(e.container.parentNode,{childList:!0})):e.registerBinding(e.container,"DOMNodeRemoved",(function(t){e.destroy()}));var g=i((function(){e.cy.resize()}),100);p&&(e.styleObserver=new MutationObserver(g),e.styleObserver.observe(e.container,{attributes:!0})),e.registerBinding(window,"resize",g),v&&(e.resizeObserver=new ResizeObserver(g),e.resizeObserver.observe(e.container));var y=function(){e.invalidateContainerClientCoordsCache()};!function(e,t){for(;null!=e;)t(e),e=e.parentNode}(e.container,(function(t){e.registerBinding(t,"transitionend",y),e.registerBinding(t,"animationend",y),e.registerBinding(t,"scroll",y)})),e.registerBinding(e.container,"contextmenu",(function(e){e.preventDefault()}));var m=function(t){for(var n=e.findContainerClientCoords(),r=n[0],i=n[1],a=n[2],o=n[3],s=t.touches?t.touches:[t],u=!1,l=0;l<s.length;l++){var c=s[l];if(r<=c.clientX&&c.clientX<=r+a&&i<=c.clientY&&c.clientY<=i+o){u=!0;break}}if(!u)return!1;for(var d=e.container,h=t.target.parentNode,f=!1;h;){if(h===d){f=!0;break}h=h.parentNode}return!!f};e.registerBinding(e.container,"mousedown",(function(t){if(m(t)){t.preventDefault(),f(),e.hoverData.capture=!0,e.hoverData.which=t.which;var r=e.cy,i=[t.clientX,t.clientY],a=e.projectIntoViewport(i[0],i[1]),o=e.selection,u=e.findNearestElements(a[0],a[1],!0,!1),d=u[0],h=e.dragData.possibleDragElements;e.hoverData.mdownPos=a,e.hoverData.mdownGPos=i;if(3==t.which){e.hoverData.cxtStarted=!0;var p={originalEvent:t,type:"cxttapstart",position:{x:a[0],y:a[1]}};d?(d.activate(),d.emit(p),e.hoverData.down=d):r.emit(p),e.hoverData.downTime=(new Date).getTime(),e.hoverData.cxtDragged=!1}else if(1==t.which){if(d&&d.activate(),null!=d&&e.nodeIsGrabbable(d)){var v=function(e){return{originalEvent:t,type:e,position:{x:a[0],y:a[1]}}};if(s(d),d.selected()){h=e.dragData.possibleDragElements=r.collection();var g=r.$((function(t){return t.isNode()&&t.selected()&&e.nodeIsGrabbable(t)}));l(g,{addToList:h}),d.emit(v("grabon")),g.forEach((function(e){e.emit(v("grab"))}))}else h=e.dragData.possibleDragElements=r.collection(),c(d,{addToList:h}),d.emit(v("grabon")).emit(v("grab"));e.redrawHint("eles",!0),e.redrawHint("drag",!0)}e.hoverData.down=d,e.hoverData.downs=u,e.hoverData.downTime=(new Date).getTime(),n(d,["mousedown","tapstart","vmousedown"],t,{x:a[0],y:a[1]}),null==d?(o[4]=1,e.data.bgActivePosistion={x:a[0],y:a[1]},e.redrawHint("select",!0),e.redraw()):d.pannable()&&(o[4]=1),e.hoverData.tapholdCancelled=!1,clearTimeout(e.hoverData.tapholdTimeout),e.hoverData.tapholdTimeout=setTimeout((function(){if(!e.hoverData.tapholdCancelled){var n=e.hoverData.down;n?n.emit({originalEvent:t,type:"taphold",position:{x:a[0],y:a[1]}}):r.emit({originalEvent:t,type:"taphold",position:{x:a[0],y:a[1]}})}}),e.tapholdDuration)}o[0]=o[2]=a[0],o[1]=o[3]=a[1]}}),!1),e.registerBinding(window,"mousemove",(function(t){if(e.hoverData.capture||m(t)){var i=!1,o=e.cy,s=o.zoom(),u=[t.clientX,t.clientY],c=e.projectIntoViewport(u[0],u[1]),h=e.hoverData.mdownPos,f=e.hoverData.mdownGPos,p=e.selection,v=null;e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.selecting||(v=e.findNearestElement(c[0],c[1],!0,!1));var g,y=e.hoverData.last,b=e.hoverData.down,x=[c[0]-p[2],c[1]-p[3]],w=e.dragData.possibleDragElements;if(f){var _=u[0]-f[0],k=_*_,C=u[1]-f[1],S=k+C*C;e.hoverData.isOverThresholdDrag=g=S>=e.desktopTapThreshold2}var P=r(t);g&&(e.hoverData.tapholdCancelled=!0);i=!0,n(v,["mousemove","vmousemove","tapdrag"],t,{x:c[0],y:c[1]});var T=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:c[0],y:c[1]}}),p[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(g){var D={originalEvent:t,type:"cxtdrag",position:{x:c[0],y:c[1]}};b?b.emit(D):o.emit(D),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&v===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:c[0],y:c[1]}}),e.hoverData.cxtOver=v,v&&v.emit({originalEvent:t,type:"cxtdragover",position:{x:c[0],y:c[1]}}))}}else if(e.hoverData.dragging){if(i=!0,o.panningEnabled()&&o.userPanningEnabled()){var B;if(e.hoverData.justStartedPan){var M=e.hoverData.mdownPos;B={x:(c[0]-M[0])*s,y:(c[1]-M[1])*s},e.hoverData.justStartedPan=!1}else B={x:x[0]*s,y:x[1]*s};o.panBy(B),e.hoverData.dragged=!0}c=e.projectIntoViewport(t.clientX,t.clientY)}else if(1!=p[4]||null!=b&&!b.pannable()){if(b&&b.pannable()&&b.active()&&b.unactivate(),b&&b.grabbed()||v==y||(y&&n(y,["mouseout","tapdragout"],t,{x:c[0],y:c[1]}),v&&n(v,["mouseover","tapdragover"],t,{x:c[0],y:c[1]}),e.hoverData.last=v),b)if(g){if(o.boxSelectionEnabled()&&P)b&&b.grabbed()&&(d(w),b.emit("freeon"),w.emit("free"),e.dragData.didDrag&&(b.emit("dragfreeon"),w.emit("dragfree"))),T();else if(b&&b.grabbed()&&e.nodeIsDraggable(b)){var z=!e.dragData.didDrag;z&&e.redrawHint("eles",!0),e.dragData.didDrag=!0;var O=o.collection();e.hoverData.draggingEles||l(w,{inDragLayer:!0});var I={x:0,y:0};if(E(x[0])&&E(x[1])&&(I.x+=x[0],I.y+=x[1],z)){var A=e.hoverData.dragDelta;A&&E(A[0])&&E(A[1])&&(I.x+=A[0],I.y+=A[1])}for(var N=0;N<w.length;N++){var L=w[N];e.nodeIsDraggable(L)&&L.grabbed()&&O.merge(L)}e.hoverData.draggingEles=!0,O.silentShift(I).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else!function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];0===t.length?(t.push(x[0]),t.push(x[1])):(t[0]+=x[0],t[1]+=x[1])}();i=!0}else if(g){if(e.hoverData.dragging||!o.boxSelectionEnabled()||!P&&o.panningEnabled()&&o.userPanningEnabled()){if(!e.hoverData.selecting&&o.panningEnabled()&&o.userPanningEnabled()){a(b,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,p[4]=0,e.data.bgActivePosistion=Xe(h),e.redrawHint("select",!0),e.redraw())}}else T();b&&b.pannable()&&b.active()&&b.unactivate()}return p[2]=c[0],p[3]=c[1],i?(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1):void 0}}),!1),e.registerBinding(window,"mouseup",(function(i){if(e.hoverData.capture){e.hoverData.capture=!1;var a=e.cy,o=e.projectIntoViewport(i.clientX,i.clientY),s=e.selection,u=e.findNearestElement(o[0],o[1],!0,!1),l=e.dragData.possibleDragElements,c=e.hoverData.down,h=r(i);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,c&&c.unactivate(),3===e.hoverData.which){var f={originalEvent:i,type:"cxttapend",position:{x:o[0],y:o[1]}};if(c?c.emit(f):a.emit(f),!e.hoverData.cxtDragged){var p={originalEvent:i,type:"cxttap",position:{x:o[0],y:o[1]}};c?c.emit(p):a.emit(p)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(1===e.hoverData.which){if(n(u,["mouseup","tapend","vmouseup"],i,{x:o[0],y:o[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||n(c,["click","tap","vclick"],i,{x:o[0],y:o[1]}),null!=c||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||r(i)||(a.$(t).unselect(["tapunselect"]),l.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=l=a.collection()),u!=c||e.dragData.didDrag||e.hoverData.selecting||null!=u&&u._private.selectable&&(e.hoverData.dragging||("additive"===a.selectionType()||h?u.selected()?u.unselect(["tapunselect"]):u.select(["tapselect"]):h||(a.$(t).unmerge(u).unselect(["tapunselect"]),u.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var v=a.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint("select",!0),v.length>0&&e.redrawHint("eles",!0),a.emit({type:"boxend",originalEvent:i,position:{x:o[0],y:o[1]}});var g=function(e){return e.selectable()&&!e.selected()};"additive"===a.selectionType()||h||a.$(t).unmerge(v).unselect(),v.emit("box").stdFilter(g).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!s[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var y=c&&c.grabbed();d(l),y&&(c.emit("freeon"),l.emit("free"),e.dragData.didDrag&&(c.emit("dragfreeon"),l.emit("dragfree")))}}s[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null}}),!1);var b,x,w,_,k,C,S,P,T,D,B,M,z,O=function(t){if(!e.scrollingPage){var n=e.cy,r=n.zoom(),i=n.pan(),a=e.projectIntoViewport(t.clientX,t.clientY),o=[a[0]*r+i.x,a[1]*r+i.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||0!==e.selection[4])t.preventDefault();else if(n.panningEnabled()&&n.userPanningEnabled()&&n.zoomingEnabled()&&n.userZoomingEnabled()){var s;t.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout((function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()}),150),s=null!=t.deltaY?t.deltaY/-250:null!=t.wheelDeltaY?t.wheelDeltaY/1e3:t.wheelDelta/1e3,s*=e.wheelSensitivity,1===t.deltaMode&&(s*=33);var u=n.zoom()*Math.pow(10,s);"gesturechange"===t.type&&(u=e.gestureStartZoom*t.scale),n.zoom({level:u,renderedPosition:{x:o[0],y:o[1]}})}}};e.registerBinding(e.container,"wheel",O,!0),e.registerBinding(window,"scroll",(function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout((function(){e.scrollingPage=!1}),250)}),!0),e.registerBinding(e.container,"gesturestart",(function(t){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||t.preventDefault()}),!0),e.registerBinding(e.container,"gesturechange",(function(t){e.hasTouchStarted||O(t)}),!0),e.registerBinding(e.container,"mouseout",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseout",position:{x:n[0],y:n[1]}})}),!1),e.registerBinding(e.container,"mouseover",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseover",position:{x:n[0],y:n[1]}})}),!1);var I,A,N,L,R=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},j=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(e.registerBinding(e.container,"touchstart",I=function(t){if(e.hasTouchStarted=!0,m(t)){f(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var r=e.cy,i=e.touchData.now,a=e.touchData.earlier;if(t.touches[0]){var o=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);i[0]=o[0],i[1]=o[1]}if(t.touches[1]){o=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);i[2]=o[0],i[3]=o[1]}if(t.touches[2]){o=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);i[4]=o[0],i[5]=o[1]}if(t.touches[1]){e.touchData.singleTouchMoved=!0,d(e.dragData.touchDragEles);var u=e.findContainerClientCoords();T=u[0],D=u[1],B=u[2],M=u[3],b=t.touches[0].clientX-T,x=t.touches[0].clientY-D,w=t.touches[1].clientX-T,_=t.touches[1].clientY-D,z=0<=b&&b<=B&&0<=w&&w<=B&&0<=x&&x<=M&&0<=_&&_<=M;var h=r.pan(),p=r.zoom();k=R(b,x,w,_),C=j(b,x,w,_),P=[((S=[(b+w)/2,(x+_)/2])[0]-h.x)/p,(S[1]-h.y)/p];if(C<4e4&&!t.touches[2]){var v=e.findNearestElement(i[0],i[1],!0,!0),g=e.findNearestElement(i[2],i[3],!0,!0);return v&&v.isNode()?(v.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=v):g&&g.isNode()?(g.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=g):r.emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,void e.redraw()}}if(t.touches[2])r.boxSelectionEnabled()&&t.preventDefault();else if(t.touches[1]);else if(t.touches[0]){var y=e.findNearestElements(i[0],i[1],!0,!0),E=y[0];if(null!=E&&(E.activate(),e.touchData.start=E,e.touchData.starts=y,e.nodeIsGrabbable(E))){var O=e.dragData.touchDragEles=r.collection(),I=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),E.selected()?(I=r.$((function(t){return t.selected()&&e.nodeIsGrabbable(t)})),l(I,{addToList:O})):c(E,{addToList:O}),s(E);var A=function(e){return{originalEvent:t,type:e,position:{x:i[0],y:i[1]}}};E.emit(A("grabon")),I?I.forEach((function(e){e.emit(A("grab"))})):E.emit(A("grab"))}n(E,["touchstart","tapstart","vmousedown"],t,{x:i[0],y:i[1]}),null==E&&(e.data.bgActivePosistion={x:o[0],y:o[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout((function(){!1!==e.touchData.singleTouchMoved||e.pinching||e.touchData.selecting||n(e.touchData.start,["taphold"],t,{x:i[0],y:i[1]})}),e.tapholdDuration)}if(t.touches.length>=1){for(var N=e.touchData.startPosition=[],L=0;L<i.length;L++)N[L]=a[L]=i[L];var V=t.touches[0];e.touchData.startGPosition=[V.clientX,V.clientY]}}},!1),e.registerBinding(window,"touchmove",A=function(t){var r=e.touchData.capture;if(r||m(t)){var i=e.selection,o=e.cy,s=e.touchData.now,u=e.touchData.earlier,c=o.zoom();if(t.touches[0]){var h=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=h[0],s[1]=h[1]}if(t.touches[1]){h=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);s[2]=h[0],s[3]=h[1]}if(t.touches[2]){h=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);s[4]=h[0],s[5]=h[1]}var f,p=e.touchData.startGPosition;if(r&&t.touches[0]&&p){for(var v=[],g=0;g<s.length;g++)v[g]=s[g]-u[g];var y=t.touches[0].clientX-p[0],S=y*y,B=t.touches[0].clientY-p[1];f=S+B*B>=e.touchTapThreshold2}if(r&&e.touchData.cxt){t.preventDefault();var M=t.touches[0].clientX-T,O=t.touches[0].clientY-D,I=t.touches[1].clientX-T,A=t.touches[1].clientY-D,N=j(M,O,I,A);if(N/C>=2.25||N>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var L={originalEvent:t,type:"cxttapend",position:{x:s[0],y:s[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(L),e.touchData.start=null):o.emit(L)}}if(r&&e.touchData.cxt){L={originalEvent:t,type:"cxtdrag",position:{x:s[0],y:s[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(L):o.emit(L),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var V=e.findNearestElement(s[0],s[1],!0,!0);e.touchData.cxtOver&&V===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:s[0],y:s[1]}}),e.touchData.cxtOver=V,V&&V.emit({originalEvent:t,type:"cxtdragover",position:{x:s[0],y:s[1]}}))}else if(r&&t.touches[2]&&o.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:s[0],y:s[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,i[4]=1,i&&0!==i.length&&void 0!==i[0]?(i[2]=(s[0]+s[2]+s[4])/3,i[3]=(s[1]+s[3]+s[5])/3):(i[0]=(s[0]+s[2]+s[4])/3,i[1]=(s[1]+s[3]+s[5])/3,i[2]=(s[0]+s[2]+s[4])/3+1,i[3]=(s[1]+s[3]+s[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(r&&t.touches[1]&&!e.touchData.didSelect&&o.zoomingEnabled()&&o.panningEnabled()&&o.userZoomingEnabled()&&o.userPanningEnabled()){if(t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),ee=e.dragData.touchDragEles){e.redrawHint("drag",!0);for(var F=0;F<ee.length;F++){var q=ee[F]._private;q.grabbed=!1,q.rscratch.inDragLayer=!1}}var W=e.touchData.start,Y=(M=t.touches[0].clientX-T,O=t.touches[0].clientY-D,I=t.touches[1].clientX-T,A=t.touches[1].clientY-D,R(M,O,I,A)),X=Y/k;if(z){var H=(M-b+(I-w))/2,Z=(O-x+(A-_))/2,U=o.zoom(),K=U*X,G=o.pan(),$=P[0]*U+G.x,Q=P[1]*U+G.y,J={x:-K/U*($-G.x-H)+$,y:-K/U*(Q-G.y-Z)+Q};if(W&&W.active()){var ee=e.dragData.touchDragEles;d(ee),e.redrawHint("drag",!0),e.redrawHint("eles",!0),W.unactivate().emit("freeon"),ee.emit("free"),e.dragData.didDrag&&(W.emit("dragfreeon"),ee.emit("dragfree"))}o.viewport({zoom:K,pan:J,cancelOnFailedZoom:!0}),k=Y,b=M,x=O,w=I,_=A,e.pinching=!0}if(t.touches[0]){h=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=h[0],s[1]=h[1]}if(t.touches[1]){h=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);s[2]=h[0],s[3]=h[1]}if(t.touches[2]){h=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);s[4]=h[0],s[5]=h[1]}}else if(t.touches[0]&&!e.touchData.didSelect){var te=e.touchData.start,ne=e.touchData.last;if(e.hoverData.draggingEles||e.swipePanning||(V=e.findNearestElement(s[0],s[1],!0,!0)),r&&null!=te&&t.preventDefault(),r&&null!=te&&e.nodeIsDraggable(te))if(f){ee=e.dragData.touchDragEles;var re=!e.dragData.didDrag;re&&l(ee,{inDragLayer:!0}),e.dragData.didDrag=!0;var ie={x:0,y:0};if(E(v[0])&&E(v[1]))if(ie.x+=v[0],ie.y+=v[1],re)e.redrawHint("eles",!0),(ae=e.touchData.dragDelta)&&E(ae[0])&&E(ae[1])&&(ie.x+=ae[0],ie.y+=ae[1]);e.hoverData.draggingEles=!0,ee.silentShift(ie).emit("position drag"),e.redrawHint("drag",!0),e.touchData.startPosition[0]==u[0]&&e.touchData.startPosition[1]==u[1]&&e.redrawHint("eles",!0),e.redraw()}else{var ae;0===(ae=e.touchData.dragDelta=e.touchData.dragDelta||[]).length?(ae.push(v[0]),ae.push(v[1])):(ae[0]+=v[0],ae[1]+=v[1])}if(n(te||V,["touchmove","tapdrag","vmousemove"],t,{x:s[0],y:s[1]}),te&&te.grabbed()||V==ne||(ne&&ne.emit({originalEvent:t,type:"tapdragout",position:{x:s[0],y:s[1]}}),V&&V.emit({originalEvent:t,type:"tapdragover",position:{x:s[0],y:s[1]}})),e.touchData.last=V,r)for(F=0;F<s.length;F++)s[F]&&e.touchData.startPosition[F]&&f&&(e.touchData.singleTouchMoved=!0);if(r&&(null==te||te.pannable())&&o.panningEnabled()&&o.userPanningEnabled()){a(te,e.touchData.starts)&&(t.preventDefault(),e.data.bgActivePosistion||(e.data.bgActivePosistion=Xe(e.touchData.startPosition)),e.swipePanning?o.panBy({x:v[0]*c,y:v[1]*c}):f&&(e.swipePanning=!0,o.panBy({x:y*c,y:B*c}),te&&(te.unactivate(),e.redrawHint("select",!0),e.touchData.start=null)));h=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=h[0],s[1]=h[1]}}for(g=0;g<s.length;g++)u[g]=s[g];r&&t.touches.length>0&&!e.hoverData.draggingEles&&!e.swipePanning&&null!=e.data.bgActivePosistion&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1),e.registerBinding(window,"touchcancel",N=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()}),e.registerBinding(window,"touchend",L=function(r){var i=e.touchData.start;if(e.touchData.capture){0===r.touches.length&&(e.touchData.capture=!1),r.preventDefault();var a=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var o,s=e.cy,u=s.zoom(),l=e.touchData.now,c=e.touchData.earlier;if(r.touches[0]){var h=e.projectIntoViewport(r.touches[0].clientX,r.touches[0].clientY);l[0]=h[0],l[1]=h[1]}if(r.touches[1]){h=e.projectIntoViewport(r.touches[1].clientX,r.touches[1].clientY);l[2]=h[0],l[3]=h[1]}if(r.touches[2]){h=e.projectIntoViewport(r.touches[2].clientX,r.touches[2].clientY);l[4]=h[0],l[5]=h[1]}if(i&&i.unactivate(),e.touchData.cxt){if(o={originalEvent:r,type:"cxttapend",position:{x:l[0],y:l[1]}},i?i.emit(o):s.emit(o),!e.touchData.cxtDragged){var f={originalEvent:r,type:"cxttap",position:{x:l[0],y:l[1]}};i?i.emit(f):s.emit(f)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!r.touches[2]&&s.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var p=s.collection(e.getAllInBox(a[0],a[1],a[2],a[3]));a[0]=void 0,a[1]=void 0,a[2]=void 0,a[3]=void 0,a[4]=0,e.redrawHint("select",!0),s.emit({type:"boxend",originalEvent:r,position:{x:l[0],y:l[1]}});p.emit("box").stdFilter((function(e){return e.selectable()&&!e.selected()})).select().emit("boxselect"),p.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(null!=i&&i.unactivate(),r.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(r.touches[1]);else if(r.touches[0]);else if(!r.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var v=e.dragData.touchDragEles;if(null!=i){var g=i._private.grabbed;d(v),e.redrawHint("drag",!0),e.redrawHint("eles",!0),g&&(i.emit("freeon"),v.emit("free"),e.dragData.didDrag&&(i.emit("dragfreeon"),v.emit("dragfree"))),n(i,["touchend","tapend","vmouseup","tapdragout"],r,{x:l[0],y:l[1]}),i.unactivate(),e.touchData.start=null}else{var y=e.findNearestElement(l[0],l[1],!0,!0);n(y,["touchend","tapend","vmouseup","tapdragout"],r,{x:l[0],y:l[1]})}var m=e.touchData.startPosition[0]-l[0],b=m*m,x=e.touchData.startPosition[1]-l[1],w=(b+x*x)*u*u;e.touchData.singleTouchMoved||(i||s.$(":selected").unselect(["tapunselect"]),n(i,["tap","vclick"],r,{x:l[0],y:l[1]})),null!=i&&!e.dragData.didDrag&&i._private.selectable&&w<e.touchTapThreshold2&&!e.pinching&&("single"===s.selectionType()?(s.$(t).unmerge(i).unselect(["tapunselect"]),i.select(["tapselect"])):i.selected()?i.unselect(["tapunselect"]):i.select(["tapselect"]),e.redrawHint("eles",!0)),e.touchData.singleTouchMoved=!0}for(var _=0;_<l.length;_++)c[_]=l[_];e.dragData.didDrag=!1,0===r.touches.length&&(e.touchData.dragDelta=[],e.touchData.startPosition=null,e.touchData.startGPosition=null,e.touchData.didSelect=!1),r.touches.length<2&&(1===r.touches.length&&(e.touchData.startGPosition=[r.touches[0].clientX,r.touches[0].clientY]),e.pinching=!1,e.redrawHint("eles",!0),e.redraw())}},!1),"undefined"==typeof TouchEvent){var V=[],F=function(e){return{clientX:e.clientX,clientY:e.clientY,force:1,identifier:e.pointerId,pageX:e.pageX,pageY:e.pageY,radiusX:e.width/2,radiusY:e.height/2,screenX:e.screenX,screenY:e.screenY,target:e.target}},q=function(e){V.push(function(e){return{event:e,touch:F(e)}}(e))},W=function(e){for(var t=0;t<V.length;t++){if(V[t].event.pointerId===e.pointerId)return void V.splice(t,1)}},Y=function(e){e.touches=V.map((function(e){return e.touch}))},X=function(e){return"mouse"===e.pointerType||4===e.pointerType};e.registerBinding(e.container,"pointerdown",(function(e){X(e)||(e.preventDefault(),q(e),Y(e),I(e))})),e.registerBinding(e.container,"pointerup",(function(e){X(e)||(W(e),Y(e),L(e))})),e.registerBinding(e.container,"pointercancel",(function(e){X(e)||(W(e),Y(e),N())})),e.registerBinding(e.container,"pointermove",(function(e){X(e)||(e.preventDefault(),function(e){var t=V.filter((function(t){return t.event.pointerId===e.pointerId}))[0];t.event=e,t.touch=F(e)}(e),Y(e),A(e))}))}};var Ko={generatePolygon:function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl("polygon",e,t,n,r,i,this.points)},intersectLine:function(e,t,n,r,i,a,o){return Et(i,a,this.points,e,t,n/2,r/2,o)},checkPoint:function(e,t,n,r,i,a,o){return gt(e,t,this.points,a,o,r,i,[0,-1],n)}}}};Ko.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o){return function(e,t,n,r,i,a){var o=n-e,s=r-t;o/=i,s/=a;var u=Math.sqrt(o*o+s*s),l=u-1;if(l<0)return[];var c=l/u;return[(n-e)*c+e,(r-t)*c+t]}(i,a,e,t,n/2+o,r/2+o)},checkPoint:function(e,t,n,r,i,a,o){return bt(e,t,r,i,a,o,n)}}},Ko.generateRoundPolygon=function(e,t){for(var n=new Array(2*t.length),r=0;r<t.length/2;r++){var i=2*r,a=void 0;a=r<t.length/2-1?2*(r+1):0,n[4*r]=t[i],n[4*r+1]=t[i+1];var o=t[a]-t[i],s=t[a+1]-t[i+1],u=Math.sqrt(o*o+s*s);n[4*r+2]=o/u,n[4*r+3]=s/u}return this.nodeShapes[e]={renderer:this,name:e,points:n,draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl("round-polygon",e,t,n,r,i,this.points)},intersectLine:function(e,t,n,r,i,a,o){return function(e,t,n,r,i,a,o,s){for(var u,l=[],c=new Array(n.length),d=a/2,h=o/2,f=Dt(a,o),p=0;p<n.length/4;p++){var v,g=void 0;g=0===p?n.length-2:4*p-2,v=4*p+2;var y=r+d*n[4*p],m=i+h*n[4*p+1],b=-n[g]*n[v]-n[g+1]*n[v+1],x=f/Math.tan(Math.acos(b)/2),w=y-x*n[g],_=m-x*n[g+1],E=y+x*n[v],k=m+x*n[v+1];0===p?(c[n.length-2]=w,c[n.length-1]=_):(c[4*p-2]=w,c[4*p-1]=_),c[4*p]=E,c[4*p+1]=k;var C=n[g+1],S=-n[g];C*n[v]+S*n[v+1]<0&&(C*=-1,S*=-1),0!==(u=xt(e,t,r,i,w+C*f,_+S*f,f)).length&&l.push(u[0],u[1])}for(var P=0;P<c.length/4;P++)0!==(u=_t(e,t,r,i,c[4*P],c[4*P+1],c[4*P+2],c[4*P+3],!1)).length&&l.push(u[0],u[1]);if(l.length>2){for(var T=[l[0],l[1]],D=Math.pow(T[0]-e,2)+Math.pow(T[1]-t,2),B=1;B<l.length/2;B++){var M=Math.pow(l[2*B]-e,2)+Math.pow(l[2*B+1]-t,2);M<=D&&(T[0]=l[2*B],T[1]=l[2*B+1],D=M)}return T}return l}(i,a,this.points,e,t,n,r)},checkPoint:function(e,t,n,r,i,a,o){return function(e,t,n,r,i,a,o){for(var s=new Array(n.length),u=a/2,l=o/2,c=Dt(a,o),d=c*c,h=0;h<n.length/4;h++){var f,p=void 0;p=0===h?n.length-2:4*h-2,f=4*h+2;var v=r+u*n[4*h],g=i+l*n[4*h+1],y=-n[p]*n[f]-n[p+1]*n[f+1],m=c/Math.tan(Math.acos(y)/2),b=v-m*n[p],x=g-m*n[p+1],w=v+m*n[f],_=g+m*n[f+1];s[4*h]=b,s[4*h+1]=x,s[4*h+2]=w,s[4*h+3]=_;var E=n[p+1],k=-n[p];E*n[f]+k*n[f+1]<0&&(E*=-1,k*=-1);var C=b+E*c,S=x+k*c;if(Math.pow(C-e,2)+Math.pow(S-t,2)<=d)return!0}return vt(e,t,s)}(e,t,this.points,a,o,r,i)}}},Ko.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:Ct(4,0),draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o){return ct(i,a,e,t,n,r,o)},checkPoint:function(e,t,n,r,i,a,o){var s=Tt(r,i),u=2*s;return!!gt(e,t,this.points,a,o,r,i-u,[0,-1],n)||(!!gt(e,t,this.points,a,o,r-u,i,[0,-1],n)||(!!bt(e,t,u,u,a-r/2+s,o-i/2+s,n)||(!!bt(e,t,u,u,a+r/2-s,o-i/2+s,n)||(!!bt(e,t,u,u,a+r/2-s,o+i/2-s,n)||!!bt(e,t,u,u,a-r/2+s,o+i/2-s,n)))))}}},Ko.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:8,points:Ct(4,0),draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},generateCutTrianglePts:function(e,t,n,r){var i=this.cornerLength,a=t/2,o=e/2,s=n-o,u=n+o,l=r-a,c=r+a;return{topLeft:[s,l+i,s+i,l,s+i,l+i],topRight:[u-i,l,u,l+i,u-i,l+i],bottomRight:[u,c-i,u-i,c,u-i,c-i],bottomLeft:[s+i,c,s,c-i,s+i,c-i]}},intersectLine:function(e,t,n,r,i,a,o){var s=this.generateCutTrianglePts(n+2*o,r+2*o,e,t),u=[].concat.apply([],[s.topLeft.splice(0,4),s.topRight.splice(0,4),s.bottomRight.splice(0,4),s.bottomLeft.splice(0,4)]);return Et(i,a,u,e,t)},checkPoint:function(e,t,n,r,i,a,o){if(gt(e,t,this.points,a,o,r,i-2*this.cornerLength,[0,-1],n))return!0;if(gt(e,t,this.points,a,o,r-2*this.cornerLength,i,[0,-1],n))return!0;var s=this.generateCutTrianglePts(r,i,a,o);return vt(e,t,s.topLeft)||vt(e,t,s.topRight)||vt(e,t,s.bottomRight)||vt(e,t,s.bottomLeft)}}},Ko.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:Ct(4,0),draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o){var s=this.generateBarrelBezierPts(n+2*o,r+2*o,e,t),u=function(e){var t=Je({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.15),n=Je({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.5),r=Je({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.85);return[e[0],e[1],t.x,t.y,n.x,n.y,r.x,r.y,e[4],e[5]]},l=[].concat(u(s.topLeft),u(s.topRight),u(s.bottomRight),u(s.bottomLeft));return Et(i,a,l,e,t)},generateBarrelBezierPts:function(e,t,n,r){var i=t/2,a=e/2,o=n-a,s=n+a,u=r-i,l=r+i,c=Bt(e,t),d=c.heightOffset,h=c.widthOffset,f=c.ctrlPtOffsetPct*e,p={topLeft:[o,u+d,o+f,u,o+h,u],topRight:[s-h,u,s-f,u,s,u+d],bottomRight:[s,l-d,s-f,l,s-h,l],bottomLeft:[o+h,l,o+f,l,o,l-d]};return p.topLeft.isTop=!0,p.topRight.isTop=!0,p.bottomLeft.isBottom=!0,p.bottomRight.isBottom=!0,p},checkPoint:function(e,t,n,r,i,a,o){var s=Bt(r,i),u=s.heightOffset,l=s.widthOffset;if(gt(e,t,this.points,a,o,r,i-2*u,[0,-1],n))return!0;if(gt(e,t,this.points,a,o,r-2*l,i,[0,-1],n))return!0;for(var c=this.generateBarrelBezierPts(r,i,a,o),d=function(e,t,n){var r,i,a=n[4],o=n[2],s=n[0],u=n[5],l=n[1],c=Math.min(a,s),d=Math.max(a,s),h=Math.min(u,l),f=Math.max(u,l);if(c<=e&&e<=d&&h<=t&&t<=f){var p=[(r=a)-2*(i=o)+s,2*(i-r),r],v=function(e,t,n,r){var i=t*t-4*e*(n-=r);if(i<0)return[];var a=Math.sqrt(i),o=2*e;return[(-t+a)/o,(-t-a)/o]}(p[0],p[1],p[2],e).filter((function(e){return 0<=e&&e<=1}));if(v.length>0)return v[0]}return null},h=Object.keys(c),f=0;f<h.length;f++){var p=c[h[f]],v=d(e,t,p);if(null!=v){var g=p[5],y=p[3],m=p[1],b=Qe(g,y,m,v);if(p.isTop&&b<=t)return!0;if(p.isBottom&&t<=b)return!0}}return!1}}},Ko.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:Ct(4,0),draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o){var s=t-(r/2+o),u=_t(i,a,e,t,e-(n/2+o),s,e+(n/2+o),s,!1);return u.length>0?u:ct(i,a,e,t,n,r,o)},checkPoint:function(e,t,n,r,i,a,o){var s=Tt(r,i),u=2*s;if(gt(e,t,this.points,a,o,r,i-u,[0,-1],n))return!0;if(gt(e,t,this.points,a,o,r-u,i,[0,-1],n))return!0;var l=r/2+2*n,c=i/2+2*n;return!!vt(e,t,[a-l,o-c,a-l,o,a+l,o,a+l,o-c])||(!!bt(e,t,u,u,a+r/2-s,o+i/2-s,n)||!!bt(e,t,u,u,a-r/2+s,o+i/2-s,n))}}},Ko.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",Ct(3,0)),this.generateRoundPolygon("round-triangle",Ct(3,0)),this.generatePolygon("rectangle",Ct(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",Ct(5,0)),this.generateRoundPolygon("round-pentagon",Ct(5,0)),this.generatePolygon("hexagon",Ct(6,0)),this.generateRoundPolygon("round-hexagon",Ct(6,0)),this.generatePolygon("heptagon",Ct(7,0)),this.generateRoundPolygon("round-heptagon",Ct(7,0)),this.generatePolygon("octagon",Ct(8,0)),this.generateRoundPolygon("round-octagon",Ct(8,0));var r=new Array(20),i=Pt(5,0),a=Pt(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<a.length/2;s++)a[2*s]*=o,a[2*s+1]*=o;for(s=0;s<5;s++)r[4*s]=i[2*s],r[4*s+1]=i[2*s+1],r[4*s+2]=a[2*s],r[4*s+3]=a[2*s+1];r=St(r),this.generatePolygon("star",r),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);var u=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",u),this.generateRoundPolygon("round-tag",u),e.makePolygon=function(e){var n,r="polygon-"+e.join("$");return(n=this[r])?n:t.generatePolygon(r,e)}};var Go={timeToRender:function(){return this.redrawTotalTime/this.redrawCount},redraw:function(e){e=e||me();var t=this;void 0===t.averageRedrawTime&&(t.averageRedrawTime=0),void 0===t.lastRedrawTime&&(t.lastRedrawTime=0),void 0===t.lastDrawTime&&(t.lastDrawTime=0),t.requestedFrame=!0,t.renderOptions=e},beforeRender:function(e,t){if(!this.destroyed){null==t&&he("Priority is not optional for beforeRender");var n=this.beforeRenderCallbacks;n.push({fn:e,priority:t}),n.sort((function(e,t){return t.priority-e.priority}))}}},$o=function(e,t,n){for(var r=e.beforeRenderCallbacks,i=0;i<r.length;i++)r[i].fn(t,n)};Go.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;Z((function n(r){if(!e.destroyed){if(t.batching());else if(e.requestedFrame&&!e.skipFrame){$o(e,!0,r);var i=U();e.render(e.renderOptions);var a=e.lastDrawTime=U();void 0===e.averageRedrawTime&&(e.averageRedrawTime=a-i),void 0===e.redrawCount&&(e.redrawCount=0),e.redrawCount++,void 0===e.redrawTotalTime&&(e.redrawTotalTime=0);var o=a-i;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else $o(e,!1,r);e.skipFrame=!1,Z(n)}}))}};var Qo=function(e){this.init(e)},Jo=Qo.prototype;Jo.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],Jo.init=function(e){var t=this;t.options=e,t.cy=e.cy;var n=t.container=e.cy.container();if(h){var r=h.document,i=r.head,a="__________cytoscape_container",o=null!=r.getElementById("__________cytoscape_stylesheet");if(n.className.indexOf(a)<0&&(n.className=(n.className||"")+" "+a),!o){var s=r.createElement("style");s.id="__________cytoscape_stylesheet",s.innerHTML="."+a+" { position: relative; }",i.insertBefore(s,i.children[0])}"static"===h.getComputedStyle(n).getPropertyValue("position")&&pe("A Cytoscape container has style position:static and so can not use UI extensions properly")}t.selection=[void 0,void 0,void 0,void 0,0],t.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],t.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},t.dragData={possibleDragElements:[]},t.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},t.redraws=0,t.showFps=e.showFps,t.debug=e.debug,t.hideEdgesOnViewport=e.hideEdgesOnViewport,t.textureOnViewport=e.textureOnViewport,t.wheelSensitivity=e.wheelSensitivity,t.motionBlurEnabled=e.motionBlur,t.forcedPixelRatio=E(e.pixelRatio)?e.pixelRatio:null,t.motionBlur=e.motionBlur,t.motionBlurOpacity=e.motionBlurOpacity,t.motionBlurTransparency=1-t.motionBlurOpacity,t.motionBlurPxRatio=1,t.mbPxRBlurry=1,t.minMbLowQualFrames=4,t.fullQualityMb=!1,t.clearedForMotionBlur=[],t.desktopTapThreshold=e.desktopTapThreshold,t.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,t.touchTapThreshold=e.touchTapThreshold,t.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,t.tapholdDuration=500,t.bindings=[],t.beforeRenderCallbacks=[],t.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},t.registerNodeShapes(),t.registerArrowShapes(),t.registerCalculationListeners()},Jo.notify=function(e,t){var n=this,r=n.cy;this.destroyed||("init"!==e?"destroy"!==e?(("add"===e||"remove"===e||"move"===e&&r.hasCompoundNodes()||"load"===e||"zorder"===e||"mount"===e)&&n.invalidateCachedZSortedEles(),"viewport"===e&&n.redrawHint("select",!0),"load"!==e&&"resize"!==e&&"mount"!==e||(n.invalidateContainerClientCoordsCache(),n.matchCanvasSize(n.container)),n.redrawHint("eles",!0),n.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()):n.destroy():n.load())},Jo.destroy=function(){var e=this;e.destroyed=!0,e.cy.stopAnimationLoop();for(var t=0;t<e.bindings.length;t++){var n=e.bindings[t],r=n.target;(r.off||r.removeEventListener).apply(r,n.args)}if(e.bindings=[],e.beforeRenderCallbacks=[],e.onUpdateEleCalcsFns=[],e.removeObserver&&e.removeObserver.disconnect(),e.styleObserver&&e.styleObserver.disconnect(),e.resizeObserver&&e.resizeObserver.disconnect(),e.labelCalcDiv)try{document.body.removeChild(e.labelCalcDiv)}catch(e){}},Jo.isHeadless=function(){return!1},[Mo,Ho,Zo,Uo,Ko,Go].forEach((function(e){j(Jo,e)}));var es=function(e){return function(){var t=this,n=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var r=i((function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()}),e.deqRedrawThreshold),a=e.priority||de;n.beforeRender((function(i,a){var o=U(),s=n.averageRedrawTime,u=n.lastRedrawTime,l=[],c=n.cy.extent(),d=n.getPixelRatio();for(i||n.flushRenderedStyleQueue();;){var h=U(),f=h-o,p=h-a;if(u<1e3/60){var v=1e3/60-(i?s:0);if(p>=e.deqFastCost*v)break}else if(i){if(f>=e.deqCost*u||f>=e.deqAvgCost*s)break}else if(p>=e.deqNoDrawCost*(1e3/60))break;var g=e.deq(t,d,c);if(!(g.length>0))break;for(var y=0;y<g.length;y++)l.push(g[y])}l.length>0&&(e.onDeqd(t,l),!i&&e.shouldRedraw(t,l,d,c)&&r())}),a(t))}}},ts=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:le;s(this,e),this.idsByKey=new ke,this.keyForId=new ke,this.cachesByLvl=new ke,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return l(e,[{key:"getIdsFor",value:function(e){null==e&&he("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new Se,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new ke,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach((function(n){return t.deleteCache(e,n)}))}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}]),e}(),ns={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},rs=be({getKey:null,doesEleInvalidateKey:le,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:ue,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),is=function(e,t){this.renderer=e,this.onDequeues=[];var n=rs(t);j(this,n),this.lookup=new ts(n.getKey,n.doesEleInvalidateKey),this.setupDequeueing()},as=is.prototype;as.reasons=ns,as.getTextureQueue=function(e){return this.eleImgCaches=this.eleImgCaches||{},this.eleImgCaches[e]=this.eleImgCaches[e]||[]},as.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},as.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new a((function(e,t){return t.reqs-e.reqs}))},as.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},as.getElement=function(e,t,n,r,i){var a=this,o=this.renderer,s=o.cy.zoom(),u=this.lookup;if(0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible())return null;if(!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(Ze(s*n))),r<-4)r=-4;else if(s>=7.99||r>3)return null;var l=Math.pow(2,r),c=t.h*l,d=t.w*l,h=o.eleTextBiggerThanMin(e,l);if(!this.isVisible(e,h))return null;var f,p=u.get(e,r);if(p&&p.invalidated&&(p.invalidated=!1,p.texture.invalidatedWidth-=p.width),p)return p;if(f=c<=25?25:c<=50?50:50*Math.ceil(c/50),c>1024||d>1024)return null;var v=a.getTextureQueue(f),g=v[v.length-2],y=function(){return a.recycleTexture(f,d)||a.addTexture(f,d)};g||(g=v[v.length-1]),g||(g=y()),g.width-g.usedWidth<d&&(g=y());for(var m,b=function(e){return e&&e.scaledLabelShown===h},x=i&&i===ns.dequeue,w=i&&i===ns.highQuality,_=i&&i===ns.downscale,E=r+1;E<=3;E++){var k=u.get(e,E);if(k){m=k;break}}var C=m&&m.level===r+1?m:null,S=function(){g.context.drawImage(C.texture.canvas,C.x,0,C.width,C.height,g.usedWidth,0,d,c)};if(g.context.setTransform(1,0,0,1,0,0),g.context.clearRect(g.usedWidth,0,d,f),b(C))S();else if(b(m)){if(!w)return a.queueElement(e,m.level-1),m;for(var P=m.level;P>r;P--)C=a.getElement(e,t,n,P,ns.downscale);S()}else{var T;if(!x&&!w&&!_)for(var D=r-1;D>=-4;D--){var B=u.get(e,D);if(B){T=B;break}}if(b(T))return a.queueElement(e,r),T;g.context.translate(g.usedWidth,0),g.context.scale(l,l),this.drawElement(g.context,e,t,h,!1),g.context.scale(1/l,1/l),g.context.translate(-g.usedWidth,0)}return p={x:g.usedWidth,texture:g,level:r,scale:l,width:d,height:c,scaledLabelShown:h},g.usedWidth+=Math.ceil(d+8),g.eleCaches.push(p),u.set(e,r,p),a.checkTextureFullness(g),p},as.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},as.invalidateElement=function(e){var t=this.lookup,n=[];if(t.isInvalid(e)){for(var r=-4;r<=3;r++){var i=t.getForCachedKey(e,r);i&&n.push(i)}if(t.invalidate(e))for(var a=0;a<n.length;a++){var o=n[a],s=o.texture;s.invalidatedWidth+=o.width,o.invalidated=!0,this.checkTextureUtility(s)}this.removeFromQueue(e)}},as.checkTextureUtility=function(e){e.invalidatedWidth>=.2*e.width&&this.retireTexture(e)},as.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?xe(t,e):e.fullnessChecks++},as.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;xe(n,e),e.retired=!0;for(var i=e.eleCaches,a=0;a<i.length;a++){var o=i[a];r.deleteCache(o.key,o.level)}we(i),this.getRetiredTextureQueue(t).push(e)},as.addTexture=function(e,t){var n={};return this.getTextureQueue(e).push(n),n.eleCaches=[],n.height=e,n.width=Math.max(1024,t),n.usedWidth=0,n.invalidatedWidth=0,n.fullnessChecks=0,n.canvas=this.renderer.makeOffscreenCanvas(n.width,n.height),n.context=n.canvas.getContext("2d"),n},as.recycleTexture=function(e,t){for(var n=this.getTextureQueue(e),r=this.getRetiredTextureQueue(e),i=0;i<r.length;i++){var a=r[i];if(a.width>=t)return a.retired=!1,a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,we(a.eleCaches),a.context.setTransform(1,0,0,1,0,0),a.context.clearRect(0,0,a.width,a.height),xe(r,a),n.push(a),a}},as.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),i=this.getKey(e),a=r[i];if(a)a.level=Math.max(a.level,t),a.eles.merge(e),a.reqs++,n.updateItem(a);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:i};n.push(o),r[i]=o}},as.dequeue=function(e){for(var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=[],i=this.lookup,a=0;a<1&&t.size()>0;a++){var o=t.pop(),s=o.key,u=o.eles[0],l=i.hasCache(u,o.level);if(n[s]=null,!l){r.push(o);var c=this.getBoundingBox(u);this.getElement(u,c,e,o.level,ns.dequeue)}}return r},as.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),i=n[r];null!=i&&(1===i.eles.length?(i.reqs=se,t.updateItem(i),t.pop(),n[r]=null):i.eles.unmerge(e))},as.onDequeue=function(e){this.onDequeues.push(e)},as.offDequeue=function(e){xe(this.onDequeues,e)},as.setupDequeueing=es({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n<e.onDequeues.length;n++){(0,e.onDequeues[n])(t)}},shouldRedraw:function(e,t,n,r){for(var i=0;i<t.length;i++)for(var a=t[i].eles,o=0;o<a.length;o++){var s=a[o].boundingBox();if(st(s,r))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var os=function(e){var t=this,n=t.renderer=e,r=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=U()-500,t.skipping=!1,t.eleTxrDeqs=r.collection(),t.scheduleElementRefinement=i((function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)}),50),n.beforeRender((function(e,n){n-t.lastInvalidationTime<=250?t.skipping=!0:t.skipping=!1}),n.beforeRenderPriorities.lyrTxrSkip);t.layersQueue=new a((function(e,t){return t.reqs-e.reqs})),t.setupDequeueing()},ss=os.prototype,us=0,ls=Math.pow(2,53)-1;ss.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),i=Math.ceil(e.h*n),a=this.renderer.makeOffscreenCanvas(r,i),o={id:us=++us%ls,bb:e,level:t,width:r,height:i,canvas:a,context:a.getContext("2d"),eles:[],elesQueue:[],reqs:0},s=o.context,u=-o.bb.x1,l=-o.bb.y1;return s.scale(n,n),s.translate(u,l),o},ss.getLayers=function(e,t,n){var r=this,i=r.renderer.cy.zoom(),a=r.firstGet;if(r.firstGet=!1,null==n)if((n=Math.ceil(Ze(i*t)))<-4)n=-4;else if(i>=3.99||n>2)return null;r.validateLayersElesOrdering(n,e);var o,s,u=r.layersByLevel,l=Math.pow(2,n),c=u[n]=u[n]||[];if(r.levelIsComplete(n,e))return c;!function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return s=u[t],!0},i=function(e){if(!s)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};i(1),i(-1);for(var a=c.length-1;a>=0;a--){var o=c[a];o.invalid&&xe(c,o)}}();var d=function(t){var i=(t=t||{}).after;if(function(){if(!o){o=tt();for(var t=0;t<e.length;t++)n=o,r=e[t].boundingBox(),n.x1=Math.min(n.x1,r.x1),n.x2=Math.max(n.x2,r.x2),n.w=n.x2-n.x1,n.y1=Math.min(n.y1,r.y1),n.y2=Math.max(n.y2,r.y2),n.h=n.y2-n.y1}var n,r}(),o.w*l*(o.h*l)>16e6)return null;var a=r.makeLayer(o,n);if(null!=i){var s=c.indexOf(i)+1;c.splice(s,0,a)}else(void 0===t.insert||t.insert)&&c.unshift(a);return a};if(r.skipping&&!a)return null;for(var h=null,f=e.length/1,p=!a,v=0;v<e.length;v++){var g=e[v],y=g._private.rscratch,m=y.imgLayerCaches=y.imgLayerCaches||{},b=m[n];if(b)h=b;else{if((!h||h.eles.length>=f||!lt(h.bb,g.boundingBox()))&&!(h=d({insert:!0,after:h})))return null;s||p?r.queueLayer(h,g):r.drawEleInLayer(h,g,n,t),h.eles.push(g),m[n]=h}}return s||(p?null:c)},ss.getEleLevelForLayerLevel=function(e,t){return e},ss.drawEleInLayer=function(e,t,n,r){var i=this.renderer,a=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(a,!1),i.drawCachedElement(a,t,null,null,n,!0),i.setImgSmoothing(a,!0))},ss.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,i=0;i<n.length;i++){var a=n[i];if(a.reqs>0)return!1;if(a.invalid)return!1;r+=a.eles.length}return r===t.length},ss.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var i=n[r],a=-1,o=0;o<t.length;o++)if(i.eles[0]===t[o]){a=o;break}if(a<0)this.invalidateLayer(i);else{var s=a;for(o=0;o<i.eles.length;o++)if(i.eles[o]!==t[s+o]){this.invalidateLayer(i);break}}}},ss.updateElementsInLayers=function(e,t){for(var n=S(e[0]),r=0;r<e.length;r++)for(var i=n?null:e[r],a=n?e[r]:e[r].ele,o=a._private.rscratch,s=o.imgLayerCaches=o.imgLayerCaches||{},u=-4;u<=2;u++){var l=s[u];l&&(i&&this.getEleLevelForLayerLevel(l.level)!==i.level||t(l,a,i))}},ss.haveLayers=function(){for(var e=!1,t=-4;t<=2;t++){var n=this.layersByLevel[t];if(n&&n.length>0){e=!0;break}}return e},ss.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=U(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,(function(e,n,r){t.invalidateLayer(e)})))},ss.invalidateLayer=function(e){if(this.lastInvalidationTime=U(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];xe(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i<n.length;i++){var a=n[i]._private.rscratch.imgLayerCaches;a&&(a[t]=null)}}},ss.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,(function(e,n,r){var i=e.replacement;if(i||((i=e.replacement=t.makeLayer(e.bb,e.level)).replaces=e,i.eles=e.eles),!i.reqs)for(var a=0;a<i.eles.length;a++)t.queueLayer(i,i.eles[a])}))},ss.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},ss.queueLayer=function(e,t){var n=this.layersQueue,r=e.elesQueue,i=r.hasId=r.hasId||{};if(!e.replacement){if(t){if(i[t.id()])return;r.push(t),i[t.id()]=!0}e.reqs?(e.reqs++,n.updateItem(e)):(e.reqs=1,n.push(e))}},ss.dequeue=function(e){for(var t=this.layersQueue,n=[],r=0;r<1&&0!==t.size();){var i=t.peek();if(i.replacement)t.pop();else if(i.replaces&&i!==i.replaces.replacement)t.pop();else if(i.invalid)t.pop();else{var a=i.elesQueue.shift();a&&(this.drawEleInLayer(i,a,i.level,e),r++),0===n.length&&n.push(!0),0===i.elesQueue.length&&(t.pop(),i.reqs=0,i.replaces&&this.applyLayerReplacement(i),this.requestRedraw())}}return n},ss.applyLayerReplacement=function(e){var t=this.layersByLevel[e.level],n=e.replaces,r=t.indexOf(n);if(!(r<0||n.invalid)){t[r]=e;for(var i=0;i<e.eles.length;i++){var a=e.eles[i]._private,o=a.imgLayerCaches=a.imgLayerCaches||{};o&&(o[e.level]=e)}this.requestRedraw()}},ss.requestRedraw=i((function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()}),100),ss.setupDequeueing=es({deqRedrawThreshold:50,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t){return e.dequeue(t)},onDeqd:de,shouldRedraw:ue,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var cs,ds={};function hs(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function fs(e,t,n){for(var r,i=0;i<t.length;i++){var a=t[i];0===i&&(r=a),e.lineTo(a.x,a.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function ps(e,t,n){e.beginPath&&e.beginPath();for(var r=t,i=0;i<r.length;i++){var a=r[i];e.lineTo(a.x,a.y)}var o=n,s=n[0];e.moveTo(s.x,s.y);for(i=1;i<o.length;i++){a=o[i];e.lineTo(a.x,a.y)}e.closePath&&e.closePath()}function vs(e,t,n,r,i){e.beginPath&&e.beginPath(),e.arc(n,r,i,0,2*Math.PI,!1);var a=t,o=a[0];e.moveTo(o.x,o.y);for(var s=0;s<a.length;s++){var u=a[s];e.lineTo(u.x,u.y)}e.closePath&&e.closePath()}function gs(e,t,n,r){e.arc(t,n,r,0,2*Math.PI,!1)}ds.arrowShapeImpl=function(e){return(cs||(cs={polygon:hs,"triangle-backcurve":fs,"triangle-tee":ps,"circle-triangle":vs,"triangle-cross":ps,circle:gs}))[e]};var ys={drawElement:function(e,t,n,r,i,a){t.isNode()?this.drawNode(e,t,n,r,i,a):this.drawEdge(e,t,n,r,i,a)},drawElementOverlay:function(e,t){t.isNode()?this.drawNodeOverlay(e,t):this.drawEdgeOverlay(e,t)},drawCachedElementPortion:function(e,t,n,r,i,a,o,s){var u=this,l=n.getBoundingBox(t);if(0!==l.w&&0!==l.h){var c=n.getElement(t,l,r,i,a);if(null!=c){var d=s(u,t);if(0===d)return;var h,f,p,v,g,y,m=o(u,t),b=l.x1,x=l.y1,w=l.w,_=l.h;if(0!==m){var E=n.getRotationPoint(t);p=E.x,v=E.y,e.translate(p,v),e.rotate(m),(g=u.getImgSmoothing(e))||u.setImgSmoothing(e,!0);var k=n.getRotationOffset(t);h=k.x,f=k.y}else h=b,f=x;1!==d&&(y=e.globalAlpha,e.globalAlpha=y*d),e.drawImage(c.texture.canvas,c.x,0,c.width,c.height,h,f,w,_),1!==d&&(e.globalAlpha=y),0!==m&&(e.rotate(-m),e.translate(-p,-v),g||u.setImgSmoothing(e,!1))}else n.drawElement(e,t)}}},ms=function(){return 0},bs=function(e,t){return e.getTextAngle(t,null)},xs=function(e,t){return e.getTextAngle(t,"source")},ws=function(e,t){return e.getTextAngle(t,"target")},_s=function(e,t){return t.effectiveOpacity()},Es=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};ys.drawCachedElement=function(e,t,n,r,i,a){var o=this,s=o.data,u=s.eleTxrCache,l=s.lblTxrCache,c=s.slbTxrCache,d=s.tlbTxrCache,h=t.boundingBox(),f=!0===a?u.reasons.highQuality:null;if(0!==h.w&&0!==h.h&&t.visible()&&(!r||st(h,r))){var p=t.isEdge(),v=t.element()._private.rscratch.badLine;o.drawCachedElementPortion(e,t,u,n,i,f,ms,_s),p&&v||o.drawCachedElementPortion(e,t,l,n,i,f,bs,Es),p&&!v&&(o.drawCachedElementPortion(e,t,c,n,i,f,xs,Es),o.drawCachedElementPortion(e,t,d,n,i,f,ws,Es)),o.drawElementOverlay(e,t)}},ys.drawElements=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];this.drawElement(e,r)}},ys.drawCachedElements=function(e,t,n,r){for(var i=0;i<t.length;i++){var a=t[i];this.drawCachedElement(e,a,n,r)}},ys.drawCachedNodes=function(e,t,n,r){for(var i=0;i<t.length;i++){var a=t[i];a.isNode()&&this.drawCachedElement(e,a,n,r)}},ys.drawLayeredElements=function(e,t,n,r){var i=this.data.lyrTxrCache.getLayers(t,n);if(i)for(var a=0;a<i.length;a++){var o=i[a],s=o.bb;0!==s.w&&0!==s.h&&e.drawImage(o.canvas,s.x1,s.y1,s.w,s.h)}else this.drawCachedElements(e,t,n,r)};var ks={drawEdge:function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this,s=t._private.rscratch;if((!a||t.visible())&&!s.badLine&&null!=s.allpts&&!isNaN(s.allpts[0])){var u;n&&(u=n,e.translate(-u.x1,-u.y1));var l=a?t.pstyle("opacity").value:1,c=t.pstyle("line-style").value,d=t.pstyle("width").pfValue,h=t.pstyle("line-cap").value,f=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l;e.lineWidth=d,e.lineCap=h,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,c),e.lineCap="butt"},p=function(){i&&o.drawEdgeOverlay(e,t)},v=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l;o.drawArrowheads(e,t,n)},g=function(){o.drawElementText(e,t,null,r)};e.lineJoin="round";var y="yes"===t.pstyle("ghost").value;if(y){var m=t.pstyle("ghost-offset-x").pfValue,b=t.pstyle("ghost-offset-y").pfValue,x=t.pstyle("ghost-opacity").value,w=l*x;e.translate(m,b),f(w),v(w),e.translate(-m,-b)}f(),v(),p(),g(),n&&e.translate(u.x1,u.y1)}},drawEdgeOverlay:function(e,t){if(t.visible()){var n=t.pstyle("overlay-opacity").value;if(0!==n){var r=this,i=r.usePaths(),a=t._private.rscratch,o=2*t.pstyle("overlay-padding").pfValue,s=t.pstyle("overlay-color").value;e.lineWidth=o,"self"!==a.edgeType||i?e.lineCap="round":e.lineCap="butt",r.colorStrokeStyle(e,s[0],s[1],s[2],n),r.drawEdgePath(t,e,a.allpts,"solid")}}},drawEdgePath:function(e,t,n,r){var i,a=e._private.rscratch,o=t,s=!1,u=this.usePaths(),l=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(u){var d=n.join("$");a.pathCacheKey&&a.pathCacheKey===d?(i=t=a.pathCache,s=!0):(i=t=new Path2D,a.pathCacheKey=d,a.pathCache=i)}if(o.setLineDash)switch(r){case"dotted":o.setLineDash([1,1]);break;case"dashed":o.setLineDash(l),o.lineDashOffset=c;break;case"solid":o.setLineDash([])}if(!s&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var h=2;h+3<n.length;h+=4)t.quadraticCurveTo(n[h],n[h+1],n[h+2],n[h+3]);break;case"straight":case"segments":case"haystack":for(var f=2;f+1<n.length;f+=2)t.lineTo(n[f],n[f+1])}t=o,u?t.stroke(i):t.stroke(),t.setLineDash&&t.setLineDash([])},drawArrowheads:function(e,t,n){var r=t._private.rscratch,i="haystack"===r.edgeType;i||this.drawArrowhead(e,t,"source",r.arrowStartX,r.arrowStartY,r.srcArrowAngle,n),this.drawArrowhead(e,t,"mid-target",r.midX,r.midY,r.midtgtArrowAngle,n),this.drawArrowhead(e,t,"mid-source",r.midX,r.midY,r.midsrcArrowAngle,n),i||this.drawArrowhead(e,t,"target",r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)},drawArrowhead:function(e,t,n,r,i,a,o){if(!(isNaN(r)||null==r||isNaN(i)||null==i||isNaN(a)||null==a)){var s=t.pstyle(n+"-arrow-shape").value;if("none"!==s){var u="hollow"===t.pstyle(n+"-arrow-fill").value?"both":"filled",l=t.pstyle(n+"-arrow-fill").value,c=t.pstyle("width").pfValue,d=t.pstyle("opacity").value;void 0===o&&(o=d);var h=e.globalCompositeOperation;1===o&&"hollow"!==l||(e.globalCompositeOperation="destination-out",this.colorFillStyle(e,255,255,255,1),this.colorStrokeStyle(e,255,255,255,1),this.drawArrowShape(t,e,u,c,s,r,i,a),e.globalCompositeOperation=h);var f=t.pstyle(n+"-arrow-color").value;this.colorFillStyle(e,f[0],f[1],f[2],o),this.colorStrokeStyle(e,f[0],f[1],f[2],o),this.drawArrowShape(t,e,l,c,s,r,i,a)}}},drawArrowShape:function(e,t,n,r,i,a,o,s){var u,l=this,c=this.usePaths()&&"triangle-cross"!==i,d=!1,h=t,f={x:a,y:o},p=e.pstyle("arrow-scale").value,v=this.getArrowWidth(r,p),g=l.arrowShapes[i];if(c){var y=l.arrowPathCache=l.arrowPathCache||[],m=te(i),b=y[m];null!=b?(u=t=b,d=!0):(u=t=new Path2D,y[m]=u)}d||(t.beginPath&&t.beginPath(),c?g.draw(t,1,0,{x:0,y:0},1):g.draw(t,v,s,f,r),t.closePath&&t.closePath()),t=h,c&&(t.translate(a,o),t.rotate(s),t.scale(v,v)),"filled"!==n&&"both"!==n||(c?t.fill(u):t.fill()),"hollow"!==n&&"both"!==n||(t.lineWidth=(g.matchEdgeWidth?r:1)/(c?v:1),t.lineJoin="miter",c?t.stroke(u):t.stroke()),c&&(t.scale(1/v,1/v),t.rotate(-s),t.translate(-a,-o))}},Cs={safeDrawImage:function(e,t,n,r,i,a,o,s,u,l){i<=0||a<=0||u<=0||l<=0||e.drawImage(t,n,r,i,a,o,s,u,l)},drawInscribedImage:function(e,t,n,r,i){var a=this,o=n.position(),s=o.x,u=o.y,l=n.cy().style(),c=l.getIndexedStyle.bind(l),d=c(n,"background-fit","value",r),h=c(n,"background-repeat","value",r),f=n.width(),p=n.height(),v=2*n.padding(),g=f+("inner"===c(n,"background-width-relative-to","value",r)?0:v),y=p+("inner"===c(n,"background-height-relative-to","value",r)?0:v),m=n._private.rscratch,b="node"===c(n,"background-clip","value",r),x=c(n,"background-image-opacity","value",r)*i,w=t.width||t.cachedW,_=t.height||t.cachedH;null!=w&&null!=_||(document.body.appendChild(t),w=t.cachedW=t.width||t.offsetWidth,_=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var E=w,k=_;if("auto"!==c(n,"background-width","value",r)&&(E="%"===c(n,"background-width","units",r)?c(n,"background-width","pfValue",r)*g:c(n,"background-width","pfValue",r)),"auto"!==c(n,"background-height","value",r)&&(k="%"===c(n,"background-height","units",r)?c(n,"background-height","pfValue",r)*y:c(n,"background-height","pfValue",r)),0!==E&&0!==k){if("contain"===d)E*=C=Math.min(g/E,y/k),k*=C;else if("cover"===d){var C;E*=C=Math.max(g/E,y/k),k*=C}var S=s-g/2,P=c(n,"background-position-x","units",r),T=c(n,"background-position-x","pfValue",r);S+="%"===P?(g-E)*T:T;var D=c(n,"background-offset-x","units",r),B=c(n,"background-offset-x","pfValue",r);S+="%"===D?(g-E)*B:B;var M=u-y/2,z=c(n,"background-position-y","units",r),O=c(n,"background-position-y","pfValue",r);M+="%"===z?(y-k)*O:O;var I=c(n,"background-offset-y","units",r),A=c(n,"background-offset-y","pfValue",r);M+="%"===I?(y-k)*A:A,m.pathCache&&(S-=s,M-=u,s=0,u=0);var N=e.globalAlpha;if(e.globalAlpha=x,"no-repeat"===h)b&&(e.save(),m.pathCache?e.clip(m.pathCache):(a.nodeShapes[a.getNodeShape(n)].draw(e,s,u,g,y),e.clip())),a.safeDrawImage(e,t,0,0,w,_,S,M,E,k),b&&e.restore();else{var L=e.createPattern(t,h);e.fillStyle=L,a.nodeShapes[a.getNodeShape(n)].draw(e,s,u,g,y),e.translate(S,M),e.fill(),e.translate(-S,-M)}e.globalAlpha=N}}},Ss={};function Ps(e,t,n,r,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:5;e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath(),e.fill()}Ss.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),i=Math.ceil(Ze(n*r));t=Math.pow(2,i)}return!(e.pstyle("font-size").pfValue*t<e.pstyle("min-zoomed-font-size").pfValue)},Ss.drawElementText=function(e,t,n,r,i){var a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this;if(null==r){if(a&&!o.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var u=o.getLabelJustification(t);e.textAlign=u,e.textBaseline="bottom"}else{var l=t.element()._private.rscratch.badLine,c=t.pstyle("label"),d=t.pstyle("source-label"),h=t.pstyle("target-label");if(l||(!c||!c.value)&&(!d||!d.value)&&(!h||!h.value))return;e.textAlign="center",e.textBaseline="bottom"}var f,p=!n;n&&(f=n,e.translate(-f.x1,-f.y1)),null==i?(o.drawText(e,t,null,p,a),t.isEdge()&&(o.drawText(e,t,"source",p,a),o.drawText(e,t,"target",p,a))):o.drawText(e,t,i,p,a),n&&e.translate(f.x1,f.y1)},Ss.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if((t=this.fontCaches[n]).context===e)return t;return t={context:e},this.fontCaches.push(t),t},Ss.setupTextStyle=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,u=t.pstyle("text-outline-opacity").value*s,l=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,l[0],l[1],l[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],u)},Ss.getTextAngle=function(e,t){var n=e._private.rscratch,r=t?t+"-":"",i=e.pstyle(r+"text-rotation"),a=_e(n,"labelAngle",t);return"autorotate"===i.strValue?e.isEdge()?a:0:"none"===i.strValue?0:i.pfValue},Ss.drawText=function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=t._private,o=a.rscratch,s=i?t.effectiveOpacity():1;if(!i||0!==s&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var u,l,c=_e(o,"labelX",n),d=_e(o,"labelY",n),h=this.getLabelText(t,n);if(null!=h&&""!==h&&!isNaN(c)&&!isNaN(d)){this.setupTextStyle(e,t,i);var f,p=n?n+"-":"",v=_e(o,"labelWidth",n),g=_e(o,"labelHeight",n),y=t.pstyle(p+"text-margin-x").pfValue,m=t.pstyle(p+"text-margin-y").pfValue,b=t.isEdge(),x=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;switch(b&&(x="center",w="center"),c+=y,d+=m,0!==(f=r?this.getTextAngle(t,n):0)&&(u=c,l=d,e.translate(u,l),e.rotate(f),c=0,d=0),w){case"top":break;case"center":d+=g/2;break;case"bottom":d+=g}var _=t.pstyle("text-background-opacity").value,E=t.pstyle("text-border-opacity").value,k=t.pstyle("text-border-width").pfValue,C=t.pstyle("text-background-padding").pfValue;if(_>0||k>0&&E>0){var S=c-C;switch(x){case"left":S-=v;break;case"center":S-=v/2}var P=d-g-C,T=v+2*C,D=g+2*C;if(_>0){var B=e.fillStyle,M=t.pstyle("text-background-color").value;e.fillStyle="rgba("+M[0]+","+M[1]+","+M[2]+","+_*s+")";var z=t.pstyle("text-background-shape").strValue;0===z.indexOf("round")?Ps(e,S,P,T,D,2):e.fillRect(S,P,T,D),e.fillStyle=B}if(k>0&&E>0){var O=e.strokeStyle,I=e.lineWidth,A=t.pstyle("text-border-color").value,N=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+A[0]+","+A[1]+","+A[2]+","+E*s+")",e.lineWidth=k,e.setLineDash)switch(N){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=k/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(e.strokeRect(S,P,T,D),"double"===N){var L=k/2;e.strokeRect(S+L,P+L,T-2*L,D-2*L)}e.setLineDash&&e.setLineDash([]),e.lineWidth=I,e.strokeStyle=O}}var R=2*t.pstyle("text-outline-width").pfValue;if(R>0&&(e.lineWidth=R),"wrap"===t.pstyle("text-wrap").value){var j=_e(o,"labelWrapCachedLines",n),V=_e(o,"labelLineHeight",n),F=v/2,q=this.getLabelJustification(t);switch("auto"===q||("left"===x?"left"===q?c+=-v:"center"===q&&(c+=-F):"center"===x?"left"===q?c+=-F:"right"===q&&(c+=F):"right"===x&&("center"===q?c+=F:"right"===q&&(c+=v))),w){case"top":d-=(j.length-1)*V;break;case"center":case"bottom":d-=(j.length-1)*V}for(var W=0;W<j.length;W++)R>0&&e.strokeText(j[W],c,d),e.fillText(j[W],c,d),d+=V}else R>0&&e.strokeText(h,c,d),e.fillText(h,c,d);0!==f&&(e.rotate(-f),e.translate(-u,-l))}}};var Ts={drawNode:function(e,t,n){var r,i,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],u=this,l=t._private,c=l.rscratch,d=t.position();if(E(d.x)&&E(d.y)&&(!s||t.visible())){var h,f,p=s?t.effectiveOpacity():1,v=u.usePaths(),g=!1,y=t.padding();r=t.width()+2*y,i=t.height()+2*y,n&&(f=n,e.translate(-f.x1,-f.y1));for(var m=t.pstyle("background-image"),b=m.value,x=new Array(b.length),w=new Array(b.length),_=0,k=0;k<b.length;k++){var C=b[k],S=x[k]=null!=C&&"none"!==C;if(S){var P=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",k);_++,w[k]=u.getCachedImage(C,P,(function(){l.backgroundTimestamp=Date.now(),t.emitAndNotify("background")}))}}var T=t.pstyle("background-blacken").value,D=t.pstyle("border-width").pfValue,B=t.pstyle("background-opacity").value*p,M=t.pstyle("border-color").value,z=t.pstyle("border-style").value,O=t.pstyle("border-opacity").value*p;e.lineJoin="miter";var I=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:B;u.eleFillStyle(e,t,n)},A=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:O;u.colorStrokeStyle(e,M[0],M[1],M[2],t)},N=t.pstyle("shape").strValue,L=t.pstyle("shape-polygon-points").pfValue;if(v){e.translate(d.x,d.y);var R=u.nodePathCache=u.nodePathCache||[],j=ne("polygon"===N?N+","+L.join(","):N,""+i,""+r),V=R[j];null!=V?(h=V,g=!0,c.pathCache=h):(h=new Path2D,R[j]=c.pathCache=h)}var F=function(){if(!g){var n=d;v&&(n={x:0,y:0}),u.nodeShapes[u.getNodeShape(t)].draw(h||e,n.x,n.y,r,i)}v?e.fill(h):e.fill()},q=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,r=l.backgrounding,i=0,a=0;a<w.length;a++)x[a]&&w[a].complete&&!w[a].error&&(i++,u.drawInscribedImage(e,w[a],t,a,n));l.backgrounding=!(i===_),r!==l.backgrounding&&t.updateStyle(!1)},W=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;u.hasPie(t)&&(u.drawPie(e,t,a),n&&(v||u.nodeShapes[u.getNodeShape(t)].draw(e,d.x,d.y,r,i)))},Y=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,n=(T>0?T:-T)*t,r=T>0?0:255;0!==T&&(u.colorFillStyle(e,r,r,r,n),v?e.fill(h):e.fill())},X=function(){if(D>0){if(e.lineWidth=D,e.lineCap="butt",e.setLineDash)switch(z){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}if(v?e.stroke(h):e.stroke(),"double"===z){e.lineWidth=D/3;var t=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",v?e.stroke(h):e.stroke(),e.globalCompositeOperation=t}e.setLineDash&&e.setLineDash([])}},H=function(){o&&u.drawNodeOverlay(e,t,d,r,i)},Z=function(){u.drawElementText(e,t,null,a)},U="yes"===t.pstyle("ghost").value;if(U){var K=t.pstyle("ghost-offset-x").pfValue,G=t.pstyle("ghost-offset-y").pfValue,$=t.pstyle("ghost-opacity").value,Q=$*p;e.translate(K,G),I($*B),F(),q(Q),W(0!==T||0!==D),Y(Q),A($*O),X(),e.translate(-K,-G)}I(),F(),q(),W(0!==T||0!==D),Y(),A(),X(),v&&e.translate(-d.x,-d.y),Z(),H(),n&&e.translate(f.x1,f.y1)}},drawNodeOverlay:function(e,t,n,r,i){if(t.visible()){var a=t.pstyle("overlay-padding").pfValue,o=t.pstyle("overlay-opacity").value,s=t.pstyle("overlay-color").value;if(o>0){if(n=n||t.position(),null==r||null==i){var u=t.padding();r=t.width()+2*u,i=t.height()+2*u}this.colorFillStyle(e,s[0],s[1],s[2],o),this.nodeShapes.roundrectangle.draw(e,n.x,n.y,r+2*a,i+2*a),e.fill()}}},hasPie:function(e){return(e=e[0])._private.hasPie},drawPie:function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),a=t.pstyle("pie-size"),o=r.x,s=r.y,u=t.width(),l=t.height(),c=Math.min(u,l)/2,d=0;this.usePaths()&&(o=0,s=0),"%"===a.units?c*=a.pfValue:void 0!==a.pfValue&&(c=a.pfValue/2);for(var h=1;h<=i.pieBackgroundN;h++){var f=t.pstyle("pie-"+h+"-background-size").value,p=t.pstyle("pie-"+h+"-background-color").value,v=t.pstyle("pie-"+h+"-background-opacity").value*n,g=f/100;g+d>1&&(g=1-d);var y=1.5*Math.PI+2*Math.PI*d,m=y+2*Math.PI*g;0===f||d>=1||d+g>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,c,y,m),e.closePath(),this.colorFillStyle(e,p[0],p[1],p[2],v),e.fill(),d+=g)}}},Ds={};Ds.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t},Ds.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;i<n.length;i++)if((t=n[i]).context===e){r=!1;break}return r&&(t={context:e},n.push(t)),t},Ds.createGradientStyleFor=function(e,t,n,r,i){var a,o=this.usePaths(),s=n.pstyle(t+"-gradient-stop-colors").value,u=n.pstyle(t+"-gradient-stop-positions").pfValue;if("radial-gradient"===r)if(n.isEdge()){var l=n.sourceEndpoint(),c=n.targetEndpoint(),d=n.midpoint(),h=Ke(l,d),f=Ke(c,d);a=e.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(h,f))}else{var p=o?{x:0,y:0}:n.position(),v=n.paddedWidth(),g=n.paddedHeight();a=e.createRadialGradient(p.x,p.y,0,p.x,p.y,Math.max(v,g))}else if(n.isEdge()){var y=n.sourceEndpoint(),m=n.targetEndpoint();a=e.createLinearGradient(y.x,y.y,m.x,m.y)}else{var b=o?{x:0,y:0}:n.position(),x=n.paddedWidth()/2,w=n.paddedHeight()/2;switch(n.pstyle("background-gradient-direction").value){case"to-bottom":a=e.createLinearGradient(b.x,b.y-w,b.x,b.y+w);break;case"to-top":a=e.createLinearGradient(b.x,b.y+w,b.x,b.y-w);break;case"to-left":a=e.createLinearGradient(b.x+x,b.y,b.x-x,b.y);break;case"to-right":a=e.createLinearGradient(b.x-x,b.y,b.x+x,b.y);break;case"to-bottom-right":case"to-right-bottom":a=e.createLinearGradient(b.x-x,b.y-w,b.x+x,b.y+w);break;case"to-top-right":case"to-right-top":a=e.createLinearGradient(b.x-x,b.y+w,b.x+x,b.y-w);break;case"to-bottom-left":case"to-left-bottom":a=e.createLinearGradient(b.x+x,b.y-w,b.x-x,b.y+w);break;case"to-top-left":case"to-left-top":a=e.createLinearGradient(b.x+x,b.y+w,b.x-x,b.y-w)}}if(!a)return null;for(var _=u.length===s.length,E=s.length,k=0;k<E;k++)a.addColorStop(_?u[k]:k/(E-1),"rgba("+s[k][0]+","+s[k][1]+","+s[k][2]+","+i+")");return a},Ds.gradientFillStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,"background",t,n,r);if(!i)return null;e.fillStyle=i},Ds.colorFillStyle=function(e,t,n,r,i){e.fillStyle="rgba("+t+","+n+","+r+","+i+")"},Ds.eleFillStyle=function(e,t,n){var r=t.pstyle("background-fill").value;if("linear-gradient"===r||"radial-gradient"===r)this.gradientFillStyle(e,t,r,n);else{var i=t.pstyle("background-color").value;this.colorFillStyle(e,i[0],i[1],i[2],n)}},Ds.gradientStrokeStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,"line",t,n,r);if(!i)return null;e.strokeStyle=i},Ds.colorStrokeStyle=function(e,t,n,r,i){e.strokeStyle="rgba("+t+","+n+","+r+","+i+")"},Ds.eleStrokeStyle=function(e,t,n){var r=t.pstyle("line-fill").value;if("linear-gradient"===r||"radial-gradient"===r)this.gradientStrokeStyle(e,t,r,n);else{var i=t.pstyle("line-color").value;this.colorStrokeStyle(e,i[0],i[1],i[2],n)}},Ds.matchCanvasSize=function(e){var t=this,n=t.data,r=t.findContainerClientCoords(),i=r[2],a=r[3],o=t.getPixelRatio(),s=t.motionBlurPxRatio;e!==t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE]&&e!==t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG]||(o=s);var u,l=i*o,c=a*o;if(l!==t.canvasWidth||c!==t.canvasHeight){t.fontCaches=null;var d=n.canvasContainer;d.style.width=i+"px",d.style.height=a+"px";for(var h=0;h<t.CANVAS_LAYERS;h++)(u=n.canvases[h]).width=l,u.height=c,u.style.width=i+"px",u.style.height=a+"px";for(h=0;h<t.BUFFER_COUNT;h++)(u=n.bufferCanvases[h]).width=l,u.height=c,u.style.width=i+"px",u.style.height=a+"px";t.textureMult=1,o<=1&&(u=n.bufferCanvases[t.TEXTURE_BUFFER],t.textureMult=2,u.width=l*t.textureMult,u.height=c*t.textureMult),t.canvasWidth=l,t.canvasHeight=c}},Ds.renderTo=function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})},Ds.render=function(e){var t=(e=e||me()).forcedContext,n=e.drawAllLayers,r=e.drawOnlyNodeLayer,i=e.forcedZoom,a=e.forcedPan,o=this,s=void 0===e.forcedPxRatio?this.getPixelRatio():e.forcedPxRatio,u=o.cy,l=o.data,c=l.canvasNeedsRedraw,d=o.textureOnViewport&&!t&&(o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming),h=void 0!==e.motionBlur?e.motionBlur:o.motionBlur,f=o.motionBlurPxRatio,p=u.hasCompoundNodes(),v=o.hoverData.draggingEles,g=!(!o.hoverData.selecting&&!o.touchData.selecting),y=h=h&&!t&&o.motionBlurEnabled&&!g;t||(o.prevPxRatio!==s&&(o.invalidateContainerClientCoordsCache(),o.matchCanvasSize(o.container),o.redrawHint("eles",!0),o.redrawHint("drag",!0)),o.prevPxRatio=s),!t&&o.motionBlurTimeout&&clearTimeout(o.motionBlurTimeout),h&&(null==o.mbFrames&&(o.mbFrames=0),o.mbFrames++,o.mbFrames<3&&(y=!1),o.mbFrames>o.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!d&&(c[o.NODE]=!0,c[o.SELECT_BOX]=!0);var m=u.style(),b=u.zoom(),x=void 0!==i?i:b,w=u.pan(),_={x:w.x,y:w.y},E={zoom:b,pan:{x:w.x,y:w.y}},k=o.prevViewport;void 0===k||E.zoom!==k.zoom||E.pan.x!==k.pan.x||E.pan.y!==k.pan.y||v&&!p||(o.motionBlurPxRatio=1),a&&(_=a),x*=s,_.x*=s,_.y*=s;var C=o.getCachedZSortedEles();function S(e,t,n,r,i){var a=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",o.colorFillStyle(e,255,255,255,o.motionBlurTransparency),e.fillRect(t,n,r,i),e.globalCompositeOperation=a}function P(e,r){var s,u,c,d;o.clearingMotionBlur||e!==l.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]&&e!==l.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]?(s=_,u=x,c=o.canvasWidth,d=o.canvasHeight):(s={x:w.x*f,y:w.y*f},u=b*f,c=o.canvasWidth*f,d=o.canvasHeight*f),e.setTransform(1,0,0,1,0,0),"motionBlur"===r?S(e,0,0,c,d):t||void 0!==r&&!r||e.clearRect(0,0,c,d),n||(e.translate(s.x,s.y),e.scale(u,u)),a&&e.translate(a.x,a.y),i&&e.scale(i,i)}if(d||(o.textureDrawLastFrame=!1),d){if(o.textureDrawLastFrame=!0,!o.textureCache){o.textureCache={},o.textureCache.bb=u.mutableElements().boundingBox(),o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var T=o.data.bufferContexts[o.TEXTURE_BUFFER];T.setTransform(1,0,0,1,0,0),T.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult),o.render({forcedContext:T,drawOnlyNodeLayer:!0,forcedPxRatio:s*o.textureMult}),(E=o.textureCache.viewport={zoom:u.zoom(),pan:u.pan(),width:o.canvasWidth,height:o.canvasHeight}).mpan={x:(0-E.pan.x)/E.zoom,y:(0-E.pan.y)/E.zoom}}c[o.DRAG]=!1,c[o.NODE]=!1;var D=l.contexts[o.NODE],B=o.textureCache.texture;E=o.textureCache.viewport;D.setTransform(1,0,0,1,0,0),h?S(D,0,0,E.width,E.height):D.clearRect(0,0,E.width,E.height);var M=m.core("outside-texture-bg-color").value,z=m.core("outside-texture-bg-opacity").value;o.colorFillStyle(D,M[0],M[1],M[2],z),D.fillRect(0,0,E.width,E.height);b=u.zoom();P(D,!1),D.clearRect(E.mpan.x,E.mpan.y,E.width/E.zoom/s,E.height/E.zoom/s),D.drawImage(B,E.mpan.x,E.mpan.y,E.width/E.zoom/s,E.height/E.zoom/s)}else o.textureOnViewport&&!t&&(o.textureCache=null);var O=u.extent(),I=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated(),A=o.hideEdgesOnViewport&&I,N=[];if(N[o.NODE]=!c[o.NODE]&&h&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,N[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),N[o.DRAG]=!c[o.DRAG]&&h&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,N[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),c[o.NODE]||n||r||N[o.NODE]){var L=h&&!N[o.NODE]&&1!==f;P(D=t||(L?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:l.contexts[o.NODE]),h&&!L?"motionBlur":void 0),A?o.drawCachedNodes(D,C.nondrag,s,O):o.drawLayeredElements(D,C.nondrag,s,O),o.debug&&o.drawDebugPoints(D,C.nondrag),n||h||(c[o.NODE]=!1)}if(!r&&(c[o.DRAG]||n||N[o.DRAG])){L=h&&!N[o.DRAG]&&1!==f;P(D=t||(L?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:l.contexts[o.DRAG]),h&&!L?"motionBlur":void 0),A?o.drawCachedNodes(D,C.drag,s,O):o.drawCachedElements(D,C.drag,s,O),o.debug&&o.drawDebugPoints(D,C.drag),n||h||(c[o.DRAG]=!1)}if(o.showFps||!r&&c[o.SELECT_BOX]&&!n){if(P(D=t||l.contexts[o.SELECT_BOX]),1==o.selection[4]&&(o.hoverData.selecting||o.touchData.selecting)){b=o.cy.zoom();var R=m.core("selection-box-border-width").value/b;D.lineWidth=R,D.fillStyle="rgba("+m.core("selection-box-color").value[0]+","+m.core("selection-box-color").value[1]+","+m.core("selection-box-color").value[2]+","+m.core("selection-box-opacity").value+")",D.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),R>0&&(D.strokeStyle="rgba("+m.core("selection-box-border-color").value[0]+","+m.core("selection-box-border-color").value[1]+","+m.core("selection-box-border-color").value[2]+","+m.core("selection-box-opacity").value+")",D.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(l.bgActivePosistion&&!o.hoverData.selecting){b=o.cy.zoom();var j=l.bgActivePosistion;D.fillStyle="rgba("+m.core("active-bg-color").value[0]+","+m.core("active-bg-color").value[1]+","+m.core("active-bg-color").value[2]+","+m.core("active-bg-opacity").value+")",D.beginPath(),D.arc(j.x,j.y,m.core("active-bg-size").pfValue/b,0,2*Math.PI),D.fill()}var V=o.lastRedrawTime;if(o.showFps&&V){V=Math.round(V);var F=Math.round(1e3/V);D.setTransform(1,0,0,1,0,0),D.fillStyle="rgba(255, 0, 0, 0.75)",D.strokeStyle="rgba(255, 0, 0, 0.75)",D.lineWidth=1,D.fillText("1 frame = "+V+" ms = "+F+" fps",0,20);D.strokeRect(0,30,250,20),D.fillRect(0,30,250*Math.min(F/60,1),20)}n||(c[o.SELECT_BOX]=!1)}if(h&&1!==f){var q=l.contexts[o.NODE],W=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],Y=l.contexts[o.DRAG],X=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],H=function(e,t,n){e.setTransform(1,0,0,1,0,0),n||!y?e.clearRect(0,0,o.canvasWidth,o.canvasHeight):S(e,0,0,o.canvasWidth,o.canvasHeight);var r=f;e.drawImage(t,0,0,o.canvasWidth*r,o.canvasHeight*r,0,0,o.canvasWidth,o.canvasHeight)};(c[o.NODE]||N[o.NODE])&&(H(q,W,N[o.NODE]),c[o.NODE]=!1),(c[o.DRAG]||N[o.DRAG])&&(H(Y,X,N[o.DRAG]),c[o.DRAG]=!1)}o.prevViewport=E,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),h&&(o.motionBlurTimeout=setTimeout((function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!d,o.mbFrames=0,c[o.NODE]=!0,c[o.DRAG]=!0,o.redraw()}),100)),t||u.emit("render")};for(var Bs={drawPolygonPath:function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var u=1;u<a.length/2;u++)e.lineTo(t+o*a[2*u],n+s*a[2*u+1]);e.closePath()},drawRoundPolygonPath:function(e,t,n,r,i,a){var o=r/2,s=i/2,u=Dt(r,i);e.beginPath&&e.beginPath();for(var l=0;l<a.length/4;l++){var c,d=void 0;d=0===l?a.length-2:4*l-2,c=4*l+2;var h=t+o*a[4*l],f=n+s*a[4*l+1],p=-a[d]*a[c]-a[d+1]*a[c+1],v=u/Math.tan(Math.acos(p)/2),g=h-v*a[d],y=f-v*a[d+1],m=h+v*a[c],b=f+v*a[c+1];0===l?e.moveTo(g,y):e.lineTo(g,y),e.arcTo(h,f,m,b,u)}e.closePath()},drawRoundRectanglePath:function(e,t,n,r,i){var a=r/2,o=i/2,s=Tt(r,i);e.beginPath&&e.beginPath(),e.moveTo(t,n-o),e.arcTo(t+a,n-o,t+a,n,s),e.arcTo(t+a,n+o,t,n+o,s),e.arcTo(t-a,n+o,t-a,n,s),e.arcTo(t-a,n-o,t,n-o,s),e.lineTo(t,n-o),e.closePath()},drawBottomRoundRectanglePath:function(e,t,n,r,i){var a=r/2,o=i/2,s=Tt(r,i);e.beginPath&&e.beginPath(),e.moveTo(t,n-o),e.lineTo(t+a,n-o),e.lineTo(t+a,n),e.arcTo(t+a,n+o,t,n+o,s),e.arcTo(t-a,n+o,t-a,n,s),e.lineTo(t-a,n-o),e.lineTo(t,n-o),e.closePath()},drawCutRectanglePath:function(e,t,n,r,i){var a=r/2,o=i/2;e.beginPath&&e.beginPath(),e.moveTo(t-a+8,n-o),e.lineTo(t+a-8,n-o),e.lineTo(t+a,n-o+8),e.lineTo(t+a,n+o-8),e.lineTo(t+a-8,n+o),e.lineTo(t-a+8,n+o),e.lineTo(t-a,n+o-8),e.lineTo(t-a,n-o+8),e.closePath()},drawBarrelPath:function(e,t,n,r,i){var a=r/2,o=i/2,s=t-a,u=t+a,l=n-o,c=n+o,d=Bt(r,i),h=d.widthOffset,f=d.heightOffset,p=d.ctrlPtOffsetPct*h;e.beginPath&&e.beginPath(),e.moveTo(s,l+f),e.lineTo(s,c-f),e.quadraticCurveTo(s+p,c,s+h,c),e.lineTo(u-h,c),e.quadraticCurveTo(u-p,c,u,c-f),e.lineTo(u,l+f),e.quadraticCurveTo(u-p,l,u-h,l),e.lineTo(s+h,l),e.quadraticCurveTo(s+p,l,s,l+f),e.closePath()}},Ms=Math.sin(0),zs=Math.cos(0),Os={},Is={},As=Math.PI/40,Ns=0*Math.PI;Ns<2*Math.PI;Ns+=As)Os[Ns]=Math.sin(Ns),Is[Ns]=Math.cos(Ns);Bs.drawEllipsePath=function(e,t,n,r,i){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,i/2,0,0,2*Math.PI);else for(var a,o,s=r/2,u=i/2,l=0*Math.PI;l<2*Math.PI;l+=As)a=t-s*Os[l]*Ms+s*Is[l]*zs,o=n+u*Is[l]*Ms+u*Os[l]*zs,0===l?e.moveTo(a,o):e.lineTo(a,o);e.closePath()};var Ls={};function Rs(e){var t=e.indexOf(",");return e.substr(t+1)}function js(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case"blob-promise":return new Fn((function(r,i){try{t.toBlob((function(e){null!=e?r(e):i(new Error("`canvas.toBlob()` sent a null value in its callback"))}),n,e.quality)}catch(e){i(e)}}));case"blob":return function(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),i=new Uint8Array(r),a=0;a<n.length;a++)i[a]=n.charCodeAt(a);return new Blob([r],{type:t})}(Rs(r()),n);case"base64":return Rs(r());case"base64uri":default:return r()}}Ls.createBuffer=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,[n,n.getContext("2d")]},Ls.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements().boundingBox(),r=this.findContainerClientCoords(),i=e.full?Math.ceil(n.w):r[2],a=e.full?Math.ceil(n.h):r[3],o=E(e.maxWidth)||E(e.maxHeight),s=this.getPixelRatio(),u=1;if(void 0!==e.scale)i*=e.scale,a*=e.scale,u=e.scale;else if(o){var l=1/0,c=1/0;E(e.maxWidth)&&(l=u*e.maxWidth/i),E(e.maxHeight)&&(c=u*e.maxHeight/a),i*=u=Math.min(l,c),a*=u}o||(i*=s,a*=s,u*=s);var d=document.createElement("canvas");d.width=i,d.height=a,d.style.width=i+"px",d.style.height=a+"px";var h=d.getContext("2d");if(i>0&&a>0){h.clearRect(0,0,i,a),h.globalCompositeOperation="source-over";var f=this.getCachedZSortedEles();if(e.full)h.translate(-n.x1*u,-n.y1*u),h.scale(u,u),this.drawElements(h,f),h.scale(1/u,1/u),h.translate(n.x1*u,n.y1*u);else{var p=t.pan(),v={x:p.x*u,y:p.y*u};u*=t.zoom(),h.translate(v.x,v.y),h.scale(u,u),this.drawElements(h,f),h.scale(1/u,1/u),h.translate(-v.x,-v.y)}e.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=e.bg,h.rect(0,0,i,a),h.fill())}return d},Ls.png=function(e){return js(e,this.bufferCanvasImage(e),"image/png")},Ls.jpg=function(e){return js(e,this.bufferCanvasImage(e),"image/jpeg")};var Vs={nodeShapeImpl:function(e,t,n,r,i,a,o){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,a);case"polygon":return this.drawPolygonPath(t,n,r,i,a,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,a,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,a);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,a);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,a);case"barrel":return this.drawBarrelPath(t,n,r,i,a)}}},Fs=Ws,qs=Ws.prototype;function Ws(e){var t=this;t.data={canvases:new Array(qs.CANVAS_LAYERS),contexts:new Array(qs.CANVAS_LAYERS),canvasNeedsRedraw:new Array(qs.CANVAS_LAYERS),bufferCanvases:new Array(qs.BUFFER_COUNT),bufferContexts:new Array(qs.CANVAS_LAYERS)};t.data.canvasContainer=document.createElement("div");var n=t.data.canvasContainer.style;t.data.canvasContainer.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",n.position="relative",n.zIndex="0",n.overflow="hidden";var r=e.cy.container();r.appendChild(t.data.canvasContainer),r.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)";var i={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};f&&f.userAgent.match(/msie|trident|edge/i)&&(i["-ms-touch-action"]="none",i["touch-action"]="none");for(var a=0;a<qs.CANVAS_LAYERS;a++){var o=t.data.canvases[a]=document.createElement("canvas");t.data.contexts[a]=o.getContext("2d"),Object.keys(i).forEach((function(e){o.style[e]=i[e]})),o.style.position="absolute",o.setAttribute("data-id","layer"+a),o.style.zIndex=String(qs.CANVAS_LAYERS-a),t.data.canvasContainer.appendChild(o),t.data.canvasNeedsRedraw[a]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[qs.NODE].setAttribute("data-id","layer"+qs.NODE+"-node"),t.data.canvases[qs.SELECT_BOX].setAttribute("data-id","layer"+qs.SELECT_BOX+"-selectbox"),t.data.canvases[qs.DRAG].setAttribute("data-id","layer"+qs.DRAG+"-drag");for(a=0;a<qs.BUFFER_COUNT;a++)t.data.bufferCanvases[a]=document.createElement("canvas"),t.data.bufferContexts[a]=t.data.bufferCanvases[a].getContext("2d"),t.data.bufferCanvases[a].style.position="absolute",t.data.bufferCanvases[a].setAttribute("data-id","buffer"+a),t.data.bufferCanvases[a].style.zIndex=String(-a-1),t.data.bufferCanvases[a].style.visibility="hidden";t.pathsEnabled=!0;var s=tt(),u=function(e){return{x:-e.w/2,y:-e.h/2}},l=function(e){return e.boundingBox(),e[0]._private.bodyBounds},c=function(e){return e.boundingBox(),e[0]._private.labelBounds.main||s},d=function(e){return e.boundingBox(),e[0]._private.labelBounds.source||s},h=function(e){return e.boundingBox(),e[0]._private.labelBounds.target||s},p=function(e,t){return t},v=function(e,t,n){var r=e?e+"-":"";return{x:t.x+n.pstyle(r+"text-margin-x").pfValue,y:t.y+n.pstyle(r+"text-margin-y").pfValue}},g=function(e,t,n){var r=e[0]._private.rscratch;return{x:r[t],y:r[n]}},y=t.data.eleTxrCache=new is(t,{getKey:function(e){return e[0]._private.nodeKey},doesEleInvalidateKey:function(e){var t=e[0]._private;return!(t.oldBackgroundTimestamp===t.backgroundTimestamp)},drawElement:function(e,n,r,i,a){return t.drawElement(e,n,r,!1,!1,a)},getBoundingBox:l,getRotationPoint:function(e){return{x:((t=l(e)).x1+t.x2)/2,y:(t.y1+t.y2)/2};var t},getRotationOffset:function(e){return u(l(e))},allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),m=t.data.lblTxrCache=new is(t,{getKey:function(e){return e[0]._private.labelStyleKey},drawElement:function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"main",a)},getBoundingBox:c,getRotationPoint:function(e){return v("",g(e,"labelX","labelY"),e)},getRotationOffset:function(e){var t=c(e),n=u(c(e));if(e.isNode()){switch(e.pstyle("text-halign").value){case"left":n.x=-t.w;break;case"right":n.x=0}switch(e.pstyle("text-valign").value){case"top":n.y=-t.h;break;case"bottom":n.y=0}}return n},isVisible:p}),b=t.data.slbTxrCache=new is(t,{getKey:function(e){return e[0]._private.sourceLabelStyleKey},drawElement:function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"source",a)},getBoundingBox:d,getRotationPoint:function(e){return v("source",g(e,"sourceLabelX","sourceLabelY"),e)},getRotationOffset:function(e){return u(d(e))},isVisible:p}),x=t.data.tlbTxrCache=new is(t,{getKey:function(e){return e[0]._private.targetLabelStyleKey},drawElement:function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"target",a)},getBoundingBox:h,getRotationPoint:function(e){return v("target",g(e,"targetLabelX","targetLabelY"),e)},getRotationOffset:function(e){return u(h(e))},isVisible:p}),w=t.data.lyrTxrCache=new os(t);t.onUpdateEleCalcs((function(e,t){y.invalidateElements(t),m.invalidateElements(t),b.invalidateElements(t),x.invalidateElements(t),w.invalidateElements(t);for(var n=0;n<t.length;n++){var r=t[n]._private;r.oldBackgroundTimestamp=r.backgroundTimestamp}}));var _=function(e){for(var t=0;t<e.length;t++)w.enqueueElementRefinement(e[t].ele)};y.onDequeue(_),m.onDequeue(_),b.onDequeue(_),x.onDequeue(_)}qs.CANVAS_LAYERS=3,qs.SELECT_BOX=0,qs.DRAG=1,qs.NODE=2,qs.BUFFER_COUNT=3,qs.TEXTURE_BUFFER=0,qs.MOTIONBLUR_BUFFER_NODE=1,qs.MOTIONBLUR_BUFFER_DRAG=2,qs.redrawHint=function(e,t){var n=this;switch(e){case"eles":n.data.canvasNeedsRedraw[qs.NODE]=t;break;case"drag":n.data.canvasNeedsRedraw[qs.DRAG]=t;break;case"select":n.data.canvasNeedsRedraw[qs.SELECT_BOX]=t}};var Ys="undefined"!=typeof Path2D;qs.path2dEnabled=function(e){if(void 0===e)return this.pathsEnabled;this.pathsEnabled=!!e},qs.usePaths=function(){return Ys&&this.pathsEnabled},qs.setImgSmoothing=function(e,t){null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)},qs.getImgSmoothing=function(e){return null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled},qs.makeOffscreenCanvas=function(e,t){var n;return"undefined"!==("undefined"==typeof OffscreenCanvas?"undefined":o(OffscreenCanvas))?n=new OffscreenCanvas(e,t):((n=document.createElement("canvas")).width=e,n.height=t),n},[ds,ys,ks,Cs,Ss,Ts,Ds,Bs,Ls,Vs].forEach((function(e){j(qs,e)}));var Xs=[{type:"layout",extensions:Po},{type:"renderer",extensions:[{name:"null",impl:To},{name:"base",impl:Qo},{name:"canvas",impl:Fs}]}],Hs={},Zs={};function Us(e,t,n){var r=n,i=function(n){he("Can not register `"+t+"` for `"+e+"` since `"+n+"` already exists in the prototype and can not be overridden")};if("core"===e){if(Va.prototype[t])return i(t);Va.prototype[t]=n}else if("collection"===e){if(ia.prototype[t])return i(t);ia.prototype[t]=n}else if("layout"===e){for(var a=function(e){this.options=e,n.call(this,e),_(this._private)||(this._private={}),this._private.cy=e.cy,this._private.listeners=[],this.createEmitter()},o=a.prototype=Object.create(n.prototype),s=[],u=0;u<s.length;u++){var l=s[u];o[l]=o[l]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var c=n.prototype.stop;o.stop=function(){var e=this.options;if(e&&e.animate){var t=this.animations;if(t)for(var n=0;n<t.length;n++)t[n].stop()}return c?c.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var d=function(e){return e._private.cy},h={addEventFields:function(e,t){t.layout=e,t.cy=d(e),t.target=e},bubble:function(){return!0},parent:function(e){return d(e)}};j(o,{createEmitter:function(){return this._private.emitter=new _i(h,this),this},emitter:function(){return this._private.emitter},on:function(e,t){return this.emitter().on(e,t),this},one:function(e,t){return this.emitter().one(e,t),this},once:function(e,t){return this.emitter().one(e,t),this},removeListener:function(e,t){return this.emitter().removeListener(e,t),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(e,t){return this.emitter().emit(e,t),this}}),Yn.eventAliasesOn(o),r=a}else if("renderer"===e&&"null"!==t&&"base"!==t){var f=Ks("renderer","base"),p=f.prototype,v=n,g=n.prototype,y=function(){f.apply(this,arguments),v.apply(this,arguments)},m=y.prototype;for(var b in p){var x=p[b];if(null!=g[b])return i(b);m[b]=x}for(var w in g)m[w]=g[w];p.clientFunctions.forEach((function(e){m[e]=m[e]||function(){he("Renderer does not implement `renderer."+e+"()` on its prototype")}})),r=y}return q({map:Hs,keys:[e,t],value:r})}function Ks(e,t){return W({map:Hs,keys:[e,t]})}function Gs(e,t,n,r,i){return q({map:Zs,keys:[e,t,n,r],value:i})}function $s(e,t,n,r){return W({map:Zs,keys:[e,t,n,r]})}var Qs=function(){return 2===arguments.length?Ks.apply(null,arguments):3===arguments.length?Us.apply(null,arguments):4===arguments.length?$s.apply(null,arguments):5===arguments.length?Gs.apply(null,arguments):void he("Invalid extension access syntax")};Va.prototype.extension=Qs,Xs.forEach((function(e){e.extensions.forEach((function(t){Us(e.type,t.name,t.impl)}))}));var Js=function e(){if(!(this instanceof e))return new e;this.length=0},eu=Js.prototype;eu.instanceString=function(){return"stylesheet"},eu.selector=function(e){return this[this.length++]={selector:e,properties:[]},this},eu.css=function(e,t){var n=this.length-1;if(b(e))this[n].properties.push({name:e,value:t});else if(_(e))for(var r=e,i=Object.keys(r),a=0;a<i.length;a++){var o=i[a],s=r[o];if(null!=s){var u=Aa.properties[o]||Aa.properties[I(o)];if(null!=u){var l=u.name,c=s;this[n].properties.push({name:l,value:c})}}}return this},eu.style=eu.css,eu.generateStyle=function(e){var t=new Aa(e);return this.appendToStyle(t)},eu.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,i=n.properties;e.selector(r);for(var a=0;a<i.length;a++){var o=i[a];e.css(o.name,o.value)}}return e};var tu=function(e){return void 0===e&&(e={}),_(e)?new Va(e):b(e)?Qs.apply(Qs,arguments):void 0};tu.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(tu),e.apply(null,t),this},tu.warnings=function(e){return fe(e)},tu.version="3.15.1",tu.stylesheet=tu.Stylesheet=Js,e.exports=tu}).call(this,n(10).setImmediate)},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function a(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new a(i.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new a(i.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(11),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(0))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,i,a,o,s,u=1,l={},c=!1,d=e.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(e);h=h&&h.setTimeout?h:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick((function(){p(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((a=new MessageChannel).port1.onmessage=function(e){p(e.data)},r=function(e){a.port2.postMessage(e)}):d&&"onreadystatechange"in d.createElement("script")?(i=d.documentElement,r=function(e){var t=d.createElement("script");t.onreadystatechange=function(){p(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):r=function(e){setTimeout(p,0,e)}:(o="setImmediate$"+Math.random()+"$",s=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(o)&&p(+t.data.slice(o.length))},e.addEventListener?e.addEventListener("message",s,!1):e.attachEvent("onmessage",s),r=function(t){e.postMessage(o+t,"*")}),h.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var i={callback:e,args:t};return l[u]=i,r(u),u++},h.clearImmediate=f}function f(e){delete l[e]}function p(e){if(c)setTimeout(p,0,e);else{var t=l[e];if(t){c=!0;try{!function(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(void 0,n)}}(t)}finally{f(e),c=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,n(0),n(12))},function(e,t){var n,r,i=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a}catch(e){n=a}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var u,l=[],c=!1,d=-1;function h(){c&&u&&(c=!1,u.length?l=u.concat(l):d=-1,l.length&&f())}function f(){if(!c){var e=s(h);c=!0;for(var t=l.length;t;){for(u=l,l=[];++d<t;)u&&u[d].run();d=-1,t=l.length}u=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new p(e,t)),1!==l.length||c||s(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,n){(function(t){var n=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,a=/^0o[0-7]+$/i,o=parseInt,s="object"==typeof t&&t&&t.Object===Object&&t,u="object"==typeof self&&self&&self.Object===Object&&self,l=s||u||Function("return this")(),c=Object.prototype.toString,d=Math.max,h=Math.min,f=function(){return l.Date.now()};function p(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function v(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==c.call(e)}(e))return NaN;if(p(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=p(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(n,"");var s=i.test(e);return s||a.test(e)?o(e.slice(2),s?2:8):r.test(e)?NaN:+e}e.exports=function(e,t,n){var r,i,a,o,s,u,l=0,c=!1,g=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function m(t){var n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n)}function b(e){return l=e,s=setTimeout(w,t),c?m(e):o}function x(e){var n=e-u;return void 0===u||n>=t||n<0||g&&e-l>=a}function w(){var e=f();if(x(e))return _(e);s=setTimeout(w,function(e){var n=t-(e-u);return g?h(n,a-(e-l)):n}(e))}function _(e){return s=void 0,y&&r?m(e):(r=i=void 0,o)}function E(){var e=f(),n=x(e);if(r=arguments,i=this,u=e,n){if(void 0===s)return b(u);if(g)return s=setTimeout(w,t),m(u)}return void 0===s&&(s=setTimeout(w,t)),o}return t=v(t)||0,p(n)&&(c=!!n.leading,a=(g="maxWait"in n)?d(v(n.maxWait)||0,t):a,y="trailing"in n?!!n.trailing:y),E.cancel=function(){void 0!==s&&clearTimeout(s),l=0,r=u=i=s=void 0},E.flush=function(){return void 0===s?o:_(f())},E}}).call(this,n(0))},function(e,t,n){e.exports=n(15)},function(e,t,n){var r,i,a;(function(){var n,o,s,u,l,c,d,h,f,p,v,g,y,m,b;s=Math.floor,p=Math.min,o=function(e,t){return e<t?-1:e>t?1:0},f=function(e,t,n,r,i){var a;if(null==n&&(n=0),null==i&&(i=o),n<0)throw new Error("lo must be non-negative");for(null==r&&(r=e.length);n<r;)i(t,e[a=s((n+r)/2)])<0?r=a:n=a+1;return[].splice.apply(e,[n,n-n].concat(t)),t},c=function(e,t,n){return null==n&&(n=o),e.push(t),m(e,0,e.length-1,n)},l=function(e,t){var n,r;return null==t&&(t=o),n=e.pop(),e.length?(r=e[0],e[0]=n,b(e,0,t)):r=n,r},h=function(e,t,n){var r;return null==n&&(n=o),r=e[0],e[0]=t,b(e,0,n),r},d=function(e,t,n){var r;return null==n&&(n=o),e.length&&n(e[0],t)<0&&(t=(r=[e[0],t])[0],e[0]=r[1],b(e,0,n)),t},u=function(e,t){var n,r,i,a,u,l;for(null==t&&(t=o),u=[],r=0,i=(a=function(){l=[];for(var t=0,n=s(e.length/2);0<=n?t<n:t>n;0<=n?t++:t--)l.push(t);return l}.apply(this).reverse()).length;r<i;r++)n=a[r],u.push(b(e,n,t));return u},y=function(e,t,n){var r;if(null==n&&(n=o),-1!==(r=e.indexOf(t)))return m(e,0,r,n),b(e,r,n)},v=function(e,t,n){var r,i,a,s,l;if(null==n&&(n=o),!(i=e.slice(0,t)).length)return i;for(u(i,n),a=0,s=(l=e.slice(t)).length;a<s;a++)r=l[a],d(i,r,n);return i.sort(n).reverse()},g=function(e,t,n){var r,i,a,s,c,d,h,v,g;if(null==n&&(n=o),10*t<=e.length){if(!(a=e.slice(0,t).sort(n)).length)return a;for(i=a[a.length-1],s=0,d=(h=e.slice(t)).length;s<d;s++)n(r=h[s],i)<0&&(f(a,r,0,null,n),a.pop(),i=a[a.length-1]);return a}for(u(e,n),g=[],c=0,v=p(t,e.length);0<=v?c<v:c>v;0<=v?++c:--c)g.push(l(e,n));return g},m=function(e,t,n,r){var i,a,s;for(null==r&&(r=o),i=e[n];n>t&&r(i,a=e[s=n-1>>1])<0;)e[n]=a,n=s;return e[n]=i},b=function(e,t,n){var r,i,a,s,u;for(null==n&&(n=o),i=e.length,u=t,a=e[t],r=2*t+1;r<i;)(s=r+1)<i&&!(n(e[r],e[s])<0)&&(r=s),e[t]=e[r],r=2*(t=r)+1;return e[t]=a,m(e,u,t,n)},n=function(){function e(e){this.cmp=null!=e?e:o,this.nodes=[]}return e.push=c,e.pop=l,e.replace=h,e.pushpop=d,e.heapify=u,e.updateItem=y,e.nlargest=v,e.nsmallest=g,e.prototype.push=function(e){return c(this.nodes,e,this.cmp)},e.prototype.pop=function(){return l(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 h(this.nodes,e,this.cmp)},e.prototype.pushpop=function(e){return d(this.nodes,e,this.cmp)},e.prototype.heapify=function(){return u(this.nodes,this.cmp)},e.prototype.updateItem=function(e){return y(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}(),i=[],void 0===(a="function"==typeof(r=function(){return n})?r.apply(t,i):r)||(e.exports=a)}).call(this)},function(e,t,n){(function(e,r){var i;
|
||
/**
|
||
* @license
|
||
* Lodash <https://lodash.com/>
|
||
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
||
* Released under MIT license <https://lodash.com/license>
|
||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||
*/(function(){var a="Expected a function",o="__lodash_placeholder__",s=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],u="[object Arguments]",l="[object Array]",c="[object Boolean]",d="[object Date]",h="[object Error]",f="[object Function]",p="[object GeneratorFunction]",v="[object Map]",g="[object Number]",y="[object Object]",m="[object RegExp]",b="[object Set]",x="[object String]",w="[object Symbol]",_="[object WeakMap]",E="[object ArrayBuffer]",k="[object DataView]",C="[object Float32Array]",S="[object Float64Array]",P="[object Int8Array]",T="[object Int16Array]",D="[object Int32Array]",B="[object Uint8Array]",M="[object Uint16Array]",z="[object Uint32Array]",O=/\b__p \+= '';/g,I=/\b(__p \+=) '' \+/g,A=/(__e\(.*?\)|\b__t\)) \+\n'';/g,N=/&(?:amp|lt|gt|quot|#39);/g,L=/[&<>"']/g,R=RegExp(N.source),j=RegExp(L.source),V=/<%-([\s\S]+?)%>/g,F=/<%([\s\S]+?)%>/g,q=/<%=([\s\S]+?)%>/g,W=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Y=/^\w*$/,X=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,H=/[\\^$.*+?()[\]{}|]/g,Z=RegExp(H.source),U=/^\s+|\s+$/g,K=/^\s+/,G=/\s+$/,$=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Q=/\{\n\/\* \[wrapped with (.+)\] \*/,J=/,? & /,ee=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,te=/\\(\\)?/g,ne=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,re=/\w*$/,ie=/^[-+]0x[0-9a-f]+$/i,ae=/^0b[01]+$/i,oe=/^\[object .+?Constructor\]$/,se=/^0o[0-7]+$/i,ue=/^(?:0|[1-9]\d*)$/,le=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ce=/($^)/,de=/['\n\r\u2028\u2029\\]/g,he="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",fe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",pe="[\\ud800-\\udfff]",ve="["+fe+"]",ge="["+he+"]",ye="\\d+",me="[\\u2700-\\u27bf]",be="[a-z\\xdf-\\xf6\\xf8-\\xff]",xe="[^\\ud800-\\udfff"+fe+ye+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",we="\\ud83c[\\udffb-\\udfff]",_e="[^\\ud800-\\udfff]",Ee="(?:\\ud83c[\\udde6-\\uddff]){2}",ke="[\\ud800-\\udbff][\\udc00-\\udfff]",Ce="[A-Z\\xc0-\\xd6\\xd8-\\xde]",Se="(?:"+be+"|"+xe+")",Pe="(?:"+Ce+"|"+xe+")",Te="(?:"+ge+"|"+we+")"+"?",De="[\\ufe0e\\ufe0f]?"+Te+("(?:\\u200d(?:"+[_e,Ee,ke].join("|")+")[\\ufe0e\\ufe0f]?"+Te+")*"),Be="(?:"+[me,Ee,ke].join("|")+")"+De,Me="(?:"+[_e+ge+"?",ge,Ee,ke,pe].join("|")+")",ze=RegExp("['’]","g"),Oe=RegExp(ge,"g"),Ie=RegExp(we+"(?="+we+")|"+Me+De,"g"),Ae=RegExp([Ce+"?"+be+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[ve,Ce,"$"].join("|")+")",Pe+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[ve,Ce+Se,"$"].join("|")+")",Ce+"?"+Se+"+(?:['’](?:d|ll|m|re|s|t|ve))?",Ce+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ye,Be].join("|"),"g"),Ne=RegExp("[\\u200d\\ud800-\\udfff"+he+"\\ufe0e\\ufe0f]"),Le=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Re=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],je=-1,Ve={};Ve[C]=Ve[S]=Ve[P]=Ve[T]=Ve[D]=Ve[B]=Ve["[object Uint8ClampedArray]"]=Ve[M]=Ve[z]=!0,Ve[u]=Ve[l]=Ve[E]=Ve[c]=Ve[k]=Ve[d]=Ve[h]=Ve[f]=Ve[v]=Ve[g]=Ve[y]=Ve[m]=Ve[b]=Ve[x]=Ve[_]=!1;var Fe={};Fe[u]=Fe[l]=Fe[E]=Fe[k]=Fe[c]=Fe[d]=Fe[C]=Fe[S]=Fe[P]=Fe[T]=Fe[D]=Fe[v]=Fe[g]=Fe[y]=Fe[m]=Fe[b]=Fe[x]=Fe[w]=Fe[B]=Fe["[object Uint8ClampedArray]"]=Fe[M]=Fe[z]=!0,Fe[h]=Fe[f]=Fe[_]=!1;var qe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},We=parseFloat,Ye=parseInt,Xe="object"==typeof e&&e&&e.Object===Object&&e,He="object"==typeof self&&self&&self.Object===Object&&self,Ze=Xe||He||Function("return this")(),Ue=t&&!t.nodeType&&t,Ke=Ue&&"object"==typeof r&&r&&!r.nodeType&&r,Ge=Ke&&Ke.exports===Ue,$e=Ge&&Xe.process,Qe=function(){try{var e=Ke&&Ke.require&&Ke.require("util").types;return e||$e&&$e.binding&&$e.binding("util")}catch(e){}}(),Je=Qe&&Qe.isArrayBuffer,et=Qe&&Qe.isDate,tt=Qe&&Qe.isMap,nt=Qe&&Qe.isRegExp,rt=Qe&&Qe.isSet,it=Qe&&Qe.isTypedArray;function at(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function ot(e,t,n,r){for(var i=-1,a=null==e?0:e.length;++i<a;){var o=e[i];t(r,o,n(o),e)}return r}function st(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function ut(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function lt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function ct(e,t){for(var n=-1,r=null==e?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}function dt(e,t){return!!(null==e?0:e.length)&&wt(e,t,0)>-1}function ht(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function ft(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function pt(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function vt(e,t,n,r){var i=-1,a=null==e?0:e.length;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}function gt(e,t,n,r){var i=null==e?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function yt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var mt=Ct("length");function bt(e,t,n){var r;return n(e,(function(e,n,i){if(t(e,n,i))return r=n,!1})),r}function xt(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function wt(e,t,n){return t==t?function(e,t,n){var r=n-1,i=e.length;for(;++r<i;)if(e[r]===t)return r;return-1}(e,t,n):xt(e,Et,n)}function _t(e,t,n,r){for(var i=n-1,a=e.length;++i<a;)if(r(e[i],t))return i;return-1}function Et(e){return e!=e}function kt(e,t){var n=null==e?0:e.length;return n?Tt(e,t)/n:NaN}function Ct(e){return function(t){return null==t?void 0:t[e]}}function St(e){return function(t){return null==e?void 0:e[t]}}function Pt(e,t,n,r,i){return i(e,(function(e,i,a){n=r?(r=!1,e):t(n,e,i,a)})),n}function Tt(e,t){for(var n,r=-1,i=e.length;++r<i;){var a=t(e[r]);void 0!==a&&(n=void 0===n?a:n+a)}return n}function Dt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Bt(e){return function(t){return e(t)}}function Mt(e,t){return ft(t,(function(t){return e[t]}))}function zt(e,t){return e.has(t)}function Ot(e,t){for(var n=-1,r=e.length;++n<r&&wt(t,e[n],0)>-1;);return n}function It(e,t){for(var n=e.length;n--&&wt(t,e[n],0)>-1;);return n}function At(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var Nt=St({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Lt=St({"&":"&","<":"<",">":">",'"':""","'":"'"});function Rt(e){return"\\"+qe[e]}function jt(e){return Ne.test(e)}function Vt(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function Ft(e,t){return function(n){return e(t(n))}}function qt(e,t){for(var n=-1,r=e.length,i=0,a=[];++n<r;){var s=e[n];s!==t&&s!==o||(e[n]=o,a[i++]=n)}return a}function Wt(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}function Yt(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}function Xt(e){return jt(e)?function(e){var t=Ie.lastIndex=0;for(;Ie.test(e);)++t;return t}(e):mt(e)}function Ht(e){return jt(e)?function(e){return e.match(Ie)||[]}(e):function(e){return e.split("")}(e)}var Zt=St({"&":"&","<":"<",">":">",""":'"',"'":"'"});var Ut=function e(t){var n,r=(t=null==t?Ze:Ut.defaults(Ze.Object(),t,Ut.pick(Ze,Re))).Array,i=t.Date,he=t.Error,fe=t.Function,pe=t.Math,ve=t.Object,ge=t.RegExp,ye=t.String,me=t.TypeError,be=r.prototype,xe=fe.prototype,we=ve.prototype,_e=t["__core-js_shared__"],Ee=xe.toString,ke=we.hasOwnProperty,Ce=0,Se=(n=/[^.]+$/.exec(_e&&_e.keys&&_e.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Pe=we.toString,Te=Ee.call(ve),De=Ze._,Be=ge("^"+Ee.call(ke).replace(H,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Me=Ge?t.Buffer:void 0,Ie=t.Symbol,Ne=t.Uint8Array,qe=Me?Me.allocUnsafe:void 0,Xe=Ft(ve.getPrototypeOf,ve),He=ve.create,Ue=we.propertyIsEnumerable,Ke=be.splice,$e=Ie?Ie.isConcatSpreadable:void 0,Qe=Ie?Ie.iterator:void 0,mt=Ie?Ie.toStringTag:void 0,St=function(){try{var e=Ji(ve,"defineProperty");return e({},"",{}),e}catch(e){}}(),Kt=t.clearTimeout!==Ze.clearTimeout&&t.clearTimeout,Gt=i&&i.now!==Ze.Date.now&&i.now,$t=t.setTimeout!==Ze.setTimeout&&t.setTimeout,Qt=pe.ceil,Jt=pe.floor,en=ve.getOwnPropertySymbols,tn=Me?Me.isBuffer:void 0,nn=t.isFinite,rn=be.join,an=Ft(ve.keys,ve),on=pe.max,sn=pe.min,un=i.now,ln=t.parseInt,cn=pe.random,dn=be.reverse,hn=Ji(t,"DataView"),fn=Ji(t,"Map"),pn=Ji(t,"Promise"),vn=Ji(t,"Set"),gn=Ji(t,"WeakMap"),yn=Ji(ve,"create"),mn=gn&&new gn,bn={},xn=Sa(hn),wn=Sa(fn),_n=Sa(pn),En=Sa(vn),kn=Sa(gn),Cn=Ie?Ie.prototype:void 0,Sn=Cn?Cn.valueOf:void 0,Pn=Cn?Cn.toString:void 0;function Tn(e){if(Yo(e)&&!Oo(e)&&!(e instanceof zn)){if(e instanceof Mn)return e;if(ke.call(e,"__wrapped__"))return Pa(e)}return new Mn(e)}var Dn=function(){function e(){}return function(t){if(!Wo(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Bn(){}function Mn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function zn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function On(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function In(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function An(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Nn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new An;++t<n;)this.add(e[t])}function Ln(e){var t=this.__data__=new In(e);this.size=t.size}function Rn(e,t){var n=Oo(e),r=!n&&zo(e),i=!n&&!r&&Lo(e),a=!n&&!r&&!i&&Qo(e),o=n||r||i||a,s=o?Dt(e.length,ye):[],u=s.length;for(var l in e)!t&&!ke.call(e,l)||o&&("length"==l||i&&("offset"==l||"parent"==l)||a&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||oa(l,u))||s.push(l);return s}function jn(e){var t=e.length;return t?e[Nr(0,t-1)]:void 0}function Vn(e,t){return Ea(yi(e),Kn(t,0,e.length))}function Fn(e){return Ea(yi(e))}function qn(e,t,n){(void 0!==n&&!Do(e[t],n)||void 0===n&&!(t in e))&&Zn(e,t,n)}function Wn(e,t,n){var r=e[t];ke.call(e,t)&&Do(r,n)&&(void 0!==n||t in e)||Zn(e,t,n)}function Yn(e,t){for(var n=e.length;n--;)if(Do(e[n][0],t))return n;return-1}function Xn(e,t,n,r){return er(e,(function(e,i,a){t(r,e,n(e),a)})),r}function Hn(e,t){return e&&mi(t,xs(t),e)}function Zn(e,t,n){"__proto__"==t&&St?St(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Un(e,t){for(var n=-1,i=t.length,a=r(i),o=null==e;++n<i;)a[n]=o?void 0:vs(e,t[n]);return a}function Kn(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function Gn(e,t,n,r,i,a){var o,s=1&t,l=2&t,h=4&t;if(n&&(o=i?n(e,r,i,a):n(e)),void 0!==o)return o;if(!Wo(e))return e;var _=Oo(e);if(_){if(o=function(e){var t=e.length,n=new e.constructor(t);t&&"string"==typeof e[0]&&ke.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!s)return yi(e,o)}else{var O=na(e),I=O==f||O==p;if(Lo(e))return di(e,s);if(O==y||O==u||I&&!i){if(o=l||I?{}:ia(e),!s)return l?function(e,t){return mi(e,ta(e),t)}(e,function(e,t){return e&&mi(t,ws(t),e)}(o,e)):function(e,t){return mi(e,ea(e),t)}(e,Hn(o,e))}else{if(!Fe[O])return i?e:{};o=function(e,t,n){var r=e.constructor;switch(t){case E:return hi(e);case c:case d:return new r(+e);case k:return function(e,t){var n=t?hi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case C:case S:case P:case T:case D:case B:case"[object Uint8ClampedArray]":case M:case z:return fi(e,n);case v:return new r;case g:case x:return new r(e);case m:return function(e){var t=new e.constructor(e.source,re.exec(e));return t.lastIndex=e.lastIndex,t}(e);case b:return new r;case w:return i=e,Sn?ve(Sn.call(i)):{}}var i}(e,O,s)}}a||(a=new Ln);var A=a.get(e);if(A)return A;a.set(e,o),Ko(e)?e.forEach((function(r){o.add(Gn(r,t,n,r,e,a))})):Xo(e)&&e.forEach((function(r,i){o.set(i,Gn(r,t,n,i,e,a))}));var N=_?void 0:(h?l?Hi:Xi:l?ws:xs)(e);return st(N||e,(function(r,i){N&&(r=e[i=r]),Wn(o,i,Gn(r,t,n,i,e,a))})),o}function $n(e,t,n){var r=n.length;if(null==e)return!r;for(e=ve(e);r--;){var i=n[r],a=t[i],o=e[i];if(void 0===o&&!(i in e)||!a(o))return!1}return!0}function Qn(e,t,n){if("function"!=typeof e)throw new me(a);return ba((function(){e.apply(void 0,n)}),t)}function Jn(e,t,n,r){var i=-1,a=dt,o=!0,s=e.length,u=[],l=t.length;if(!s)return u;n&&(t=ft(t,Bt(n))),r?(a=ht,o=!1):t.length>=200&&(a=zt,o=!1,t=new Nn(t));e:for(;++i<s;){var c=e[i],d=null==n?c:n(c);if(c=r||0!==c?c:0,o&&d==d){for(var h=l;h--;)if(t[h]===d)continue e;u.push(c)}else a(t,d,r)||u.push(c)}return u}Tn.templateSettings={escape:V,evaluate:F,interpolate:q,variable:"",imports:{_:Tn}},Tn.prototype=Bn.prototype,Tn.prototype.constructor=Tn,Mn.prototype=Dn(Bn.prototype),Mn.prototype.constructor=Mn,zn.prototype=Dn(Bn.prototype),zn.prototype.constructor=zn,On.prototype.clear=function(){this.__data__=yn?yn(null):{},this.size=0},On.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},On.prototype.get=function(e){var t=this.__data__;if(yn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return ke.call(t,e)?t[e]:void 0},On.prototype.has=function(e){var t=this.__data__;return yn?void 0!==t[e]:ke.call(t,e)},On.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=yn&&void 0===t?"__lodash_hash_undefined__":t,this},In.prototype.clear=function(){this.__data__=[],this.size=0},In.prototype.delete=function(e){var t=this.__data__,n=Yn(t,e);return!(n<0)&&(n==t.length-1?t.pop():Ke.call(t,n,1),--this.size,!0)},In.prototype.get=function(e){var t=this.__data__,n=Yn(t,e);return n<0?void 0:t[n][1]},In.prototype.has=function(e){return Yn(this.__data__,e)>-1},In.prototype.set=function(e,t){var n=this.__data__,r=Yn(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},An.prototype.clear=function(){this.size=0,this.__data__={hash:new On,map:new(fn||In),string:new On}},An.prototype.delete=function(e){var t=$i(this,e).delete(e);return this.size-=t?1:0,t},An.prototype.get=function(e){return $i(this,e).get(e)},An.prototype.has=function(e){return $i(this,e).has(e)},An.prototype.set=function(e,t){var n=$i(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Nn.prototype.add=Nn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Nn.prototype.has=function(e){return this.__data__.has(e)},Ln.prototype.clear=function(){this.__data__=new In,this.size=0},Ln.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Ln.prototype.get=function(e){return this.__data__.get(e)},Ln.prototype.has=function(e){return this.__data__.has(e)},Ln.prototype.set=function(e,t){var n=this.__data__;if(n instanceof In){var r=n.__data__;if(!fn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new An(r)}return n.set(e,t),this.size=n.size,this};var er=wi(ur),tr=wi(lr,!0);function nr(e,t){var n=!0;return er(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function rr(e,t,n){for(var r=-1,i=e.length;++r<i;){var a=e[r],o=t(a);if(null!=o&&(void 0===s?o==o&&!$o(o):n(o,s)))var s=o,u=a}return u}function ir(e,t){var n=[];return er(e,(function(e,r,i){t(e,r,i)&&n.push(e)})),n}function ar(e,t,n,r,i){var a=-1,o=e.length;for(n||(n=aa),i||(i=[]);++a<o;){var s=e[a];t>0&&n(s)?t>1?ar(s,t-1,n,r,i):pt(i,s):r||(i[i.length]=s)}return i}var or=_i(),sr=_i(!0);function ur(e,t){return e&&or(e,t,xs)}function lr(e,t){return e&&sr(e,t,xs)}function cr(e,t){return ct(t,(function(t){return Vo(e[t])}))}function dr(e,t){for(var n=0,r=(t=si(t,e)).length;null!=e&&n<r;)e=e[Ca(t[n++])];return n&&n==r?e:void 0}function hr(e,t,n){var r=t(e);return Oo(e)?r:pt(r,n(e))}function fr(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":mt&&mt in ve(e)?function(e){var t=ke.call(e,mt),n=e[mt];try{e[mt]=void 0;var r=!0}catch(e){}var i=Pe.call(e);r&&(t?e[mt]=n:delete e[mt]);return i}(e):function(e){return Pe.call(e)}(e)}function pr(e,t){return e>t}function vr(e,t){return null!=e&&ke.call(e,t)}function gr(e,t){return null!=e&&t in ve(e)}function yr(e,t,n){for(var i=n?ht:dt,a=e[0].length,o=e.length,s=o,u=r(o),l=1/0,c=[];s--;){var d=e[s];s&&t&&(d=ft(d,Bt(t))),l=sn(d.length,l),u[s]=!n&&(t||a>=120&&d.length>=120)?new Nn(s&&d):void 0}d=e[0];var h=-1,f=u[0];e:for(;++h<a&&c.length<l;){var p=d[h],v=t?t(p):p;if(p=n||0!==p?p:0,!(f?zt(f,v):i(c,v,n))){for(s=o;--s;){var g=u[s];if(!(g?zt(g,v):i(e[s],v,n)))continue e}f&&f.push(v),c.push(p)}}return c}function mr(e,t,n){var r=null==(e=va(e,t=si(t,e)))?e:e[Ca(Ra(t))];return null==r?void 0:at(r,e,n)}function br(e){return Yo(e)&&fr(e)==u}function xr(e,t,n,r,i){return e===t||(null==e||null==t||!Yo(e)&&!Yo(t)?e!=e&&t!=t:function(e,t,n,r,i,a){var o=Oo(e),s=Oo(t),f=o?l:na(e),p=s?l:na(t),_=(f=f==u?y:f)==y,C=(p=p==u?y:p)==y,S=f==p;if(S&&Lo(e)){if(!Lo(t))return!1;o=!0,_=!1}if(S&&!_)return a||(a=new Ln),o||Qo(e)?Wi(e,t,n,r,i,a):function(e,t,n,r,i,a,o){switch(n){case k:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case E:return!(e.byteLength!=t.byteLength||!a(new Ne(e),new Ne(t)));case c:case d:case g:return Do(+e,+t);case h:return e.name==t.name&&e.message==t.message;case m:case x:return e==t+"";case v:var s=Vt;case b:var u=1&r;if(s||(s=Wt),e.size!=t.size&&!u)return!1;var l=o.get(e);if(l)return l==t;r|=2,o.set(e,t);var f=Wi(s(e),s(t),r,i,a,o);return o.delete(e),f;case w:if(Sn)return Sn.call(e)==Sn.call(t)}return!1}(e,t,f,n,r,i,a);if(!(1&n)){var P=_&&ke.call(e,"__wrapped__"),T=C&&ke.call(t,"__wrapped__");if(P||T){var D=P?e.value():e,B=T?t.value():t;return a||(a=new Ln),i(D,B,n,r,a)}}if(!S)return!1;return a||(a=new Ln),function(e,t,n,r,i,a){var o=1&n,s=Xi(e),u=s.length,l=Xi(t).length;if(u!=l&&!o)return!1;var c=u;for(;c--;){var d=s[c];if(!(o?d in t:ke.call(t,d)))return!1}var h=a.get(e),f=a.get(t);if(h&&f)return h==t&&f==e;var p=!0;a.set(e,t),a.set(t,e);var v=o;for(;++c<u;){d=s[c];var g=e[d],y=t[d];if(r)var m=o?r(y,g,d,t,e,a):r(g,y,d,e,t,a);if(!(void 0===m?g===y||i(g,y,n,r,a):m)){p=!1;break}v||(v="constructor"==d)}if(p&&!v){var b=e.constructor,x=t.constructor;b==x||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof x&&x instanceof x||(p=!1)}return a.delete(e),a.delete(t),p}(e,t,n,r,i,a)}(e,t,n,r,xr,i))}function wr(e,t,n,r){var i=n.length,a=i,o=!r;if(null==e)return!a;for(e=ve(e);i--;){var s=n[i];if(o&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<a;){var u=(s=n[i])[0],l=e[u],c=s[1];if(o&&s[2]){if(void 0===l&&!(u in e))return!1}else{var d=new Ln;if(r)var h=r(l,c,u,e,t,d);if(!(void 0===h?xr(c,l,3,r,d):h))return!1}}return!0}function _r(e){return!(!Wo(e)||(t=e,Se&&Se in t))&&(Vo(e)?Be:oe).test(Sa(e));var t}function Er(e){return"function"==typeof e?e:null==e?Hs:"object"==typeof e?Oo(e)?Dr(e[0],e[1]):Tr(e):tu(e)}function kr(e){if(!da(e))return an(e);var t=[];for(var n in ve(e))ke.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Cr(e){if(!Wo(e))return function(e){var t=[];if(null!=e)for(var n in ve(e))t.push(n);return t}(e);var t=da(e),n=[];for(var r in e)("constructor"!=r||!t&&ke.call(e,r))&&n.push(r);return n}function Sr(e,t){return e<t}function Pr(e,t){var n=-1,i=Ao(e)?r(e.length):[];return er(e,(function(e,r,a){i[++n]=t(e,r,a)})),i}function Tr(e){var t=Qi(e);return 1==t.length&&t[0][2]?fa(t[0][0],t[0][1]):function(n){return n===e||wr(n,e,t)}}function Dr(e,t){return ua(e)&&ha(t)?fa(Ca(e),t):function(n){var r=vs(n,e);return void 0===r&&r===t?gs(n,e):xr(t,r,3)}}function Br(e,t,n,r,i){e!==t&&or(t,(function(a,o){if(i||(i=new Ln),Wo(a))!function(e,t,n,r,i,a,o){var s=ya(e,n),u=ya(t,n),l=o.get(u);if(l)return void qn(e,n,l);var c=a?a(s,u,n+"",e,t,o):void 0,d=void 0===c;if(d){var h=Oo(u),f=!h&&Lo(u),p=!h&&!f&&Qo(u);c=u,h||f||p?Oo(s)?c=s:No(s)?c=yi(s):f?(d=!1,c=di(u,!0)):p?(d=!1,c=fi(u,!0)):c=[]:Zo(u)||zo(u)?(c=s,zo(s)?c=os(s):Wo(s)&&!Vo(s)||(c=ia(u))):d=!1}d&&(o.set(u,c),i(c,u,r,a,o),o.delete(u));qn(e,n,c)}(e,t,o,n,Br,r,i);else{var s=r?r(ya(e,o),a,o+"",e,t,i):void 0;void 0===s&&(s=a),qn(e,o,s)}}),ws)}function Mr(e,t){var n=e.length;if(n)return oa(t+=t<0?n:0,n)?e[t]:void 0}function zr(e,t,n){t=t.length?ft(t,(function(e){return Oo(e)?function(t){return dr(t,1===e.length?e[0]:e)}:e})):[Hs];var r=-1;return t=ft(t,Bt(Gi())),function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(Pr(e,(function(e,n,i){return{criteria:ft(t,(function(t){return t(e)})),index:++r,value:e}})),(function(e,t){return function(e,t,n){var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;for(;++r<o;){var u=pi(i[r],a[r]);if(u){if(r>=s)return u;var l=n[r];return u*("desc"==l?-1:1)}}return e.index-t.index}(e,t,n)}))}function Or(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=dr(e,o);n(s,o)&&Fr(a,si(o,e),s)}return a}function Ir(e,t,n,r){var i=r?_t:wt,a=-1,o=t.length,s=e;for(e===t&&(t=yi(t)),n&&(s=ft(e,Bt(n)));++a<o;)for(var u=0,l=t[a],c=n?n(l):l;(u=i(s,c,u,r))>-1;)s!==e&&Ke.call(s,u,1),Ke.call(e,u,1);return e}function Ar(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==a){var a=i;oa(i)?Ke.call(e,i,1):Jr(e,i)}}return e}function Nr(e,t){return e+Jt(cn()*(t-e+1))}function Lr(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=Jt(t/2))&&(e+=e)}while(t);return n}function Rr(e,t){return xa(pa(e,t,Hs),e+"")}function jr(e){return jn(Ds(e))}function Vr(e,t){var n=Ds(e);return Ea(n,Kn(t,0,n.length))}function Fr(e,t,n,r){if(!Wo(e))return e;for(var i=-1,a=(t=si(t,e)).length,o=a-1,s=e;null!=s&&++i<a;){var u=Ca(t[i]),l=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(i!=o){var c=s[u];void 0===(l=r?r(c,u,s):void 0)&&(l=Wo(c)?c:oa(t[i+1])?[]:{})}Wn(s,u,l),s=s[u]}return e}var qr=mn?function(e,t){return mn.set(e,t),e}:Hs,Wr=St?function(e,t){return St(e,"toString",{configurable:!0,enumerable:!1,value:Ws(t),writable:!0})}:Hs;function Yr(e){return Ea(Ds(e))}function Xr(e,t,n){var i=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var o=r(a);++i<a;)o[i]=e[i+t];return o}function Hr(e,t){var n;return er(e,(function(e,r,i){return!(n=t(e,r,i))})),!!n}function Zr(e,t,n){var r=0,i=null==e?r:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;r<i;){var a=r+i>>>1,o=e[a];null!==o&&!$o(o)&&(n?o<=t:o<t)?r=a+1:i=a}return i}return Ur(e,t,Hs,n)}function Ur(e,t,n,r){var i=0,a=null==e?0:e.length;if(0===a)return 0;for(var o=(t=n(t))!=t,s=null===t,u=$o(t),l=void 0===t;i<a;){var c=Jt((i+a)/2),d=n(e[c]),h=void 0!==d,f=null===d,p=d==d,v=$o(d);if(o)var g=r||p;else g=l?p&&(r||h):s?p&&h&&(r||!f):u?p&&h&&!f&&(r||!v):!f&&!v&&(r?d<=t:d<t);g?i=c+1:a=c}return sn(a,4294967294)}function Kr(e,t){for(var n=-1,r=e.length,i=0,a=[];++n<r;){var o=e[n],s=t?t(o):o;if(!n||!Do(s,u)){var u=s;a[i++]=0===o?0:o}}return a}function Gr(e){return"number"==typeof e?e:$o(e)?NaN:+e}function $r(e){if("string"==typeof e)return e;if(Oo(e))return ft(e,$r)+"";if($o(e))return Pn?Pn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Qr(e,t,n){var r=-1,i=dt,a=e.length,o=!0,s=[],u=s;if(n)o=!1,i=ht;else if(a>=200){var l=t?null:Li(e);if(l)return Wt(l);o=!1,i=zt,u=new Nn}else u=t?[]:s;e:for(;++r<a;){var c=e[r],d=t?t(c):c;if(c=n||0!==c?c:0,o&&d==d){for(var h=u.length;h--;)if(u[h]===d)continue e;t&&u.push(d),s.push(c)}else i(u,d,n)||(u!==s&&u.push(d),s.push(c))}return s}function Jr(e,t){return null==(e=va(e,t=si(t,e)))||delete e[Ca(Ra(t))]}function ei(e,t,n,r){return Fr(e,t,n(dr(e,t)),r)}function ti(e,t,n,r){for(var i=e.length,a=r?i:-1;(r?a--:++a<i)&&t(e[a],a,e););return n?Xr(e,r?0:a,r?a+1:i):Xr(e,r?a+1:0,r?i:a)}function ni(e,t){var n=e;return n instanceof zn&&(n=n.value()),vt(t,(function(e,t){return t.func.apply(t.thisArg,pt([e],t.args))}),n)}function ri(e,t,n){var i=e.length;if(i<2)return i?Qr(e[0]):[];for(var a=-1,o=r(i);++a<i;)for(var s=e[a],u=-1;++u<i;)u!=a&&(o[a]=Jn(o[a]||s,e[u],t,n));return Qr(ar(o,1),t,n)}function ii(e,t,n){for(var r=-1,i=e.length,a=t.length,o={};++r<i;){var s=r<a?t[r]:void 0;n(o,e[r],s)}return o}function ai(e){return No(e)?e:[]}function oi(e){return"function"==typeof e?e:Hs}function si(e,t){return Oo(e)?e:ua(e,t)?[e]:ka(ss(e))}var ui=Rr;function li(e,t,n){var r=e.length;return n=void 0===n?r:n,!t&&n>=r?e:Xr(e,t,n)}var ci=Kt||function(e){return Ze.clearTimeout(e)};function di(e,t){if(t)return e.slice();var n=e.length,r=qe?qe(n):new e.constructor(n);return e.copy(r),r}function hi(e){var t=new e.constructor(e.byteLength);return new Ne(t).set(new Ne(e)),t}function fi(e,t){var n=t?hi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function pi(e,t){if(e!==t){var n=void 0!==e,r=null===e,i=e==e,a=$o(e),o=void 0!==t,s=null===t,u=t==t,l=$o(t);if(!s&&!l&&!a&&e>t||a&&o&&u&&!s&&!l||r&&o&&u||!n&&u||!i)return 1;if(!r&&!a&&!l&&e<t||l&&n&&i&&!r&&!a||s&&n&&i||!o&&i||!u)return-1}return 0}function vi(e,t,n,i){for(var a=-1,o=e.length,s=n.length,u=-1,l=t.length,c=on(o-s,0),d=r(l+c),h=!i;++u<l;)d[u]=t[u];for(;++a<s;)(h||a<o)&&(d[n[a]]=e[a]);for(;c--;)d[u++]=e[a++];return d}function gi(e,t,n,i){for(var a=-1,o=e.length,s=-1,u=n.length,l=-1,c=t.length,d=on(o-u,0),h=r(d+c),f=!i;++a<d;)h[a]=e[a];for(var p=a;++l<c;)h[p+l]=t[l];for(;++s<u;)(f||a<o)&&(h[p+n[s]]=e[a++]);return h}function yi(e,t){var n=-1,i=e.length;for(t||(t=r(i));++n<i;)t[n]=e[n];return t}function mi(e,t,n,r){var i=!n;n||(n={});for(var a=-1,o=t.length;++a<o;){var s=t[a],u=r?r(n[s],e[s],s,n,e):void 0;void 0===u&&(u=e[s]),i?Zn(n,s,u):Wn(n,s,u)}return n}function bi(e,t){return function(n,r){var i=Oo(n)?ot:Xn,a=t?t():{};return i(n,e,Gi(r,2),a)}}function xi(e){return Rr((function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&"function"==typeof a?(i--,a):void 0,o&&sa(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=ve(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t}))}function wi(e,t){return function(n,r){if(null==n)return n;if(!Ao(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=ve(n);(t?a--:++a<i)&&!1!==r(o[a],a,o););return n}}function _i(e){return function(t,n,r){for(var i=-1,a=ve(t),o=r(t),s=o.length;s--;){var u=o[e?s:++i];if(!1===n(a[u],u,a))break}return t}}function Ei(e){return function(t){var n=jt(t=ss(t))?Ht(t):void 0,r=n?n[0]:t.charAt(0),i=n?li(n,1).join(""):t.slice(1);return r[e]()+i}}function ki(e){return function(t){return vt(Vs(zs(t).replace(ze,"")),e,"")}}function Ci(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Dn(e.prototype),r=e.apply(n,t);return Wo(r)?r:n}}function Si(e){return function(t,n,r){var i=ve(t);if(!Ao(t)){var a=Gi(n,3);t=xs(t),n=function(e){return a(i[e],e,i)}}var o=e(t,n,r);return o>-1?i[a?t[o]:o]:void 0}}function Pi(e){return Yi((function(t){var n=t.length,r=n,i=Mn.prototype.thru;for(e&&t.reverse();r--;){var o=t[r];if("function"!=typeof o)throw new me(a);if(i&&!s&&"wrapper"==Ui(o))var s=new Mn([],!0)}for(r=s?r:n;++r<n;){var u=Ui(o=t[r]),l="wrapper"==u?Zi(o):void 0;s=l&&la(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?s[Ui(l[0])].apply(s,l[3]):1==o.length&&la(o)?s[u]():s.thru(o)}return function(){var e=arguments,r=e[0];if(s&&1==e.length&&Oo(r))return s.plant(r).value();for(var i=0,a=n?t[i].apply(this,e):r;++i<n;)a=t[i].call(this,a);return a}}))}function Ti(e,t,n,i,a,o,s,u,l,c){var d=128&t,h=1&t,f=2&t,p=24&t,v=512&t,g=f?void 0:Ci(e);return function y(){for(var m=arguments.length,b=r(m),x=m;x--;)b[x]=arguments[x];if(p)var w=Ki(y),_=At(b,w);if(i&&(b=vi(b,i,a,p)),o&&(b=gi(b,o,s,p)),m-=_,p&&m<c){var E=qt(b,w);return Ai(e,t,Ti,y.placeholder,n,b,E,u,l,c-m)}var k=h?n:this,C=f?k[e]:e;return m=b.length,u?b=ga(b,u):v&&m>1&&b.reverse(),d&&l<m&&(b.length=l),this&&this!==Ze&&this instanceof y&&(C=g||Ci(C)),C.apply(k,b)}}function Di(e,t){return function(n,r){return function(e,t,n,r){return ur(e,(function(e,i,a){t(r,n(e),i,a)})),r}(n,e,t(r),{})}}function Bi(e,t){return function(n,r){var i;if(void 0===n&&void 0===r)return t;if(void 0!==n&&(i=n),void 0!==r){if(void 0===i)return r;"string"==typeof n||"string"==typeof r?(n=$r(n),r=$r(r)):(n=Gr(n),r=Gr(r)),i=e(n,r)}return i}}function Mi(e){return Yi((function(t){return t=ft(t,Bt(Gi())),Rr((function(n){var r=this;return e(t,(function(e){return at(e,r,n)}))}))}))}function zi(e,t){var n=(t=void 0===t?" ":$r(t)).length;if(n<2)return n?Lr(t,e):t;var r=Lr(t,Qt(e/Xt(t)));return jt(t)?li(Ht(r),0,e).join(""):r.slice(0,e)}function Oi(e){return function(t,n,i){return i&&"number"!=typeof i&&sa(t,n,i)&&(n=i=void 0),t=ns(t),void 0===n?(n=t,t=0):n=ns(n),function(e,t,n,i){for(var a=-1,o=on(Qt((t-e)/(n||1)),0),s=r(o);o--;)s[i?o:++a]=e,e+=n;return s}(t,n,i=void 0===i?t<n?1:-1:ns(i),e)}}function Ii(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=as(t),n=as(n)),e(t,n)}}function Ai(e,t,n,r,i,a,o,s,u,l){var c=8&t;t|=c?32:64,4&(t&=~(c?64:32))||(t&=-4);var d=[e,t,i,c?a:void 0,c?o:void 0,c?void 0:a,c?void 0:o,s,u,l],h=n.apply(void 0,d);return la(e)&&ma(h,d),h.placeholder=r,wa(h,e,t)}function Ni(e){var t=pe[e];return function(e,n){if(e=as(e),(n=null==n?0:sn(rs(n),292))&&nn(e)){var r=(ss(e)+"e").split("e");return+((r=(ss(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Li=vn&&1/Wt(new vn([,-0]))[1]==1/0?function(e){return new vn(e)}:$s;function Ri(e){return function(t){var n=na(t);return n==v?Vt(t):n==b?Yt(t):function(e,t){return ft(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function ji(e,t,n,i,s,u,l,c){var d=2&t;if(!d&&"function"!=typeof e)throw new me(a);var h=i?i.length:0;if(h||(t&=-97,i=s=void 0),l=void 0===l?l:on(rs(l),0),c=void 0===c?c:rs(c),h-=s?s.length:0,64&t){var f=i,p=s;i=s=void 0}var v=d?void 0:Zi(e),g=[e,t,n,i,s,f,p,u,l,c];if(v&&function(e,t){var n=e[1],r=t[1],i=n|r,a=i<131,s=128==r&&8==n||128==r&&256==n&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!a&&!s)return e;1&r&&(e[2]=t[2],i|=1&n?0:4);var u=t[3];if(u){var l=e[3];e[3]=l?vi(l,u,t[4]):u,e[4]=l?qt(e[3],o):t[4]}(u=t[5])&&(l=e[5],e[5]=l?gi(l,u,t[6]):u,e[6]=l?qt(e[5],o):t[6]);(u=t[7])&&(e[7]=u);128&r&&(e[8]=null==e[8]?t[8]:sn(e[8],t[8]));null==e[9]&&(e[9]=t[9]);e[0]=t[0],e[1]=i}(g,v),e=g[0],t=g[1],n=g[2],i=g[3],s=g[4],!(c=g[9]=void 0===g[9]?d?0:e.length:on(g[9]-h,0))&&24&t&&(t&=-25),t&&1!=t)y=8==t||16==t?function(e,t,n){var i=Ci(e);return function a(){for(var o=arguments.length,s=r(o),u=o,l=Ki(a);u--;)s[u]=arguments[u];var c=o<3&&s[0]!==l&&s[o-1]!==l?[]:qt(s,l);if((o-=c.length)<n)return Ai(e,t,Ti,a.placeholder,void 0,s,c,void 0,void 0,n-o);var d=this&&this!==Ze&&this instanceof a?i:e;return at(d,this,s)}}(e,t,c):32!=t&&33!=t||s.length?Ti.apply(void 0,g):function(e,t,n,i){var a=1&t,o=Ci(e);return function t(){for(var s=-1,u=arguments.length,l=-1,c=i.length,d=r(c+u),h=this&&this!==Ze&&this instanceof t?o:e;++l<c;)d[l]=i[l];for(;u--;)d[l++]=arguments[++s];return at(h,a?n:this,d)}}(e,t,n,i);else var y=function(e,t,n){var r=1&t,i=Ci(e);return function t(){var a=this&&this!==Ze&&this instanceof t?i:e;return a.apply(r?n:this,arguments)}}(e,t,n);return wa((v?qr:ma)(y,g),e,t)}function Vi(e,t,n,r){return void 0===e||Do(e,we[n])&&!ke.call(r,n)?t:e}function Fi(e,t,n,r,i,a){return Wo(e)&&Wo(t)&&(a.set(t,e),Br(e,t,void 0,Fi,a),a.delete(t)),e}function qi(e){return Zo(e)?void 0:e}function Wi(e,t,n,r,i,a){var o=1&n,s=e.length,u=t.length;if(s!=u&&!(o&&u>s))return!1;var l=a.get(e),c=a.get(t);if(l&&c)return l==t&&c==e;var d=-1,h=!0,f=2&n?new Nn:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var p=e[d],v=t[d];if(r)var g=o?r(v,p,d,t,e,a):r(p,v,d,e,t,a);if(void 0!==g){if(g)continue;h=!1;break}if(f){if(!yt(t,(function(e,t){if(!zt(f,t)&&(p===e||i(p,e,n,r,a)))return f.push(t)}))){h=!1;break}}else if(p!==v&&!i(p,v,n,r,a)){h=!1;break}}return a.delete(e),a.delete(t),h}function Yi(e){return xa(pa(e,void 0,Oa),e+"")}function Xi(e){return hr(e,xs,ea)}function Hi(e){return hr(e,ws,ta)}var Zi=mn?function(e){return mn.get(e)}:$s;function Ui(e){for(var t=e.name+"",n=bn[t],r=ke.call(bn,t)?n.length:0;r--;){var i=n[r],a=i.func;if(null==a||a==e)return i.name}return t}function Ki(e){return(ke.call(Tn,"placeholder")?Tn:e).placeholder}function Gi(){var e=Tn.iteratee||Zs;return e=e===Zs?Er:e,arguments.length?e(arguments[0],arguments[1]):e}function $i(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Qi(e){for(var t=xs(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,ha(i)]}return t}function Ji(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return _r(n)?n:void 0}var ea=en?function(e){return null==e?[]:(e=ve(e),ct(en(e),(function(t){return Ue.call(e,t)})))}:iu,ta=en?function(e){for(var t=[];e;)pt(t,ea(e)),e=Xe(e);return t}:iu,na=fr;function ra(e,t,n){for(var r=-1,i=(t=si(t,e)).length,a=!1;++r<i;){var o=Ca(t[r]);if(!(a=null!=e&&n(e,o)))break;e=e[o]}return a||++r!=i?a:!!(i=null==e?0:e.length)&&qo(i)&&oa(o,i)&&(Oo(e)||zo(e))}function ia(e){return"function"!=typeof e.constructor||da(e)?{}:Dn(Xe(e))}function aa(e){return Oo(e)||zo(e)||!!($e&&e&&e[$e])}function oa(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&ue.test(e))&&e>-1&&e%1==0&&e<t}function sa(e,t,n){if(!Wo(n))return!1;var r=typeof t;return!!("number"==r?Ao(n)&&oa(t,n.length):"string"==r&&t in n)&&Do(n[t],e)}function ua(e,t){if(Oo(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!$o(e))||(Y.test(e)||!W.test(e)||null!=t&&e in ve(t))}function la(e){var t=Ui(e),n=Tn[t];if("function"!=typeof n||!(t in zn.prototype))return!1;if(e===n)return!0;var r=Zi(n);return!!r&&e===r[0]}(hn&&na(new hn(new ArrayBuffer(1)))!=k||fn&&na(new fn)!=v||pn&&"[object Promise]"!=na(pn.resolve())||vn&&na(new vn)!=b||gn&&na(new gn)!=_)&&(na=function(e){var t=fr(e),n=t==y?e.constructor:void 0,r=n?Sa(n):"";if(r)switch(r){case xn:return k;case wn:return v;case _n:return"[object Promise]";case En:return b;case kn:return _}return t});var ca=_e?Vo:au;function da(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||we)}function ha(e){return e==e&&!Wo(e)}function fa(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in ve(n)))}}function pa(e,t,n){return t=on(void 0===t?e.length-1:t,0),function(){for(var i=arguments,a=-1,o=on(i.length-t,0),s=r(o);++a<o;)s[a]=i[t+a];a=-1;for(var u=r(t+1);++a<t;)u[a]=i[a];return u[t]=n(s),at(e,this,u)}}function va(e,t){return t.length<2?e:dr(e,Xr(t,0,-1))}function ga(e,t){for(var n=e.length,r=sn(t.length,n),i=yi(e);r--;){var a=t[r];e[r]=oa(a,n)?i[a]:void 0}return e}function ya(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var ma=_a(qr),ba=$t||function(e,t){return Ze.setTimeout(e,t)},xa=_a(Wr);function wa(e,t,n){var r=t+"";return xa(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace($,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return st(s,(function(n){var r="_."+n[0];t&n[1]&&!dt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(Q);return t?t[1].split(J):[]}(r),n)))}function _a(e){var t=0,n=0;return function(){var r=un(),i=16-(r-n);if(n=r,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Ea(e,t){var n=-1,r=e.length,i=r-1;for(t=void 0===t?r:t;++n<t;){var a=Nr(n,i),o=e[a];e[a]=e[n],e[n]=o}return e.length=t,e}var ka=function(e){var t=Eo(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(X,(function(e,n,r,i){t.push(r?i.replace(te,"$1"):n||e)})),t}));function Ca(e){if("string"==typeof e||$o(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Sa(e){if(null!=e){try{return Ee.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Pa(e){if(e instanceof zn)return e.clone();var t=new Mn(e.__wrapped__,e.__chain__);return t.__actions__=yi(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Ta=Rr((function(e,t){return No(e)?Jn(e,ar(t,1,No,!0)):[]})),Da=Rr((function(e,t){var n=Ra(t);return No(n)&&(n=void 0),No(e)?Jn(e,ar(t,1,No,!0),Gi(n,2)):[]})),Ba=Rr((function(e,t){var n=Ra(t);return No(n)&&(n=void 0),No(e)?Jn(e,ar(t,1,No,!0),void 0,n):[]}));function Ma(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:rs(n);return i<0&&(i=on(r+i,0)),xt(e,Gi(t,3),i)}function za(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r-1;return void 0!==n&&(i=rs(n),i=n<0?on(r+i,0):sn(i,r-1)),xt(e,Gi(t,3),i,!0)}function Oa(e){return(null==e?0:e.length)?ar(e,1):[]}function Ia(e){return e&&e.length?e[0]:void 0}var Aa=Rr((function(e){var t=ft(e,ai);return t.length&&t[0]===e[0]?yr(t):[]})),Na=Rr((function(e){var t=Ra(e),n=ft(e,ai);return t===Ra(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?yr(n,Gi(t,2)):[]})),La=Rr((function(e){var t=Ra(e),n=ft(e,ai);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?yr(n,void 0,t):[]}));function Ra(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var ja=Rr(Va);function Va(e,t){return e&&e.length&&t&&t.length?Ir(e,t):e}var Fa=Yi((function(e,t){var n=null==e?0:e.length,r=Un(e,t);return Ar(e,ft(t,(function(e){return oa(e,n)?+e:e})).sort(pi)),r}));function qa(e){return null==e?e:dn.call(e)}var Wa=Rr((function(e){return Qr(ar(e,1,No,!0))})),Ya=Rr((function(e){var t=Ra(e);return No(t)&&(t=void 0),Qr(ar(e,1,No,!0),Gi(t,2))})),Xa=Rr((function(e){var t=Ra(e);return t="function"==typeof t?t:void 0,Qr(ar(e,1,No,!0),void 0,t)}));function Ha(e){if(!e||!e.length)return[];var t=0;return e=ct(e,(function(e){if(No(e))return t=on(e.length,t),!0})),Dt(t,(function(t){return ft(e,Ct(t))}))}function Za(e,t){if(!e||!e.length)return[];var n=Ha(e);return null==t?n:ft(n,(function(e){return at(t,void 0,e)}))}var Ua=Rr((function(e,t){return No(e)?Jn(e,t):[]})),Ka=Rr((function(e){return ri(ct(e,No))})),Ga=Rr((function(e){var t=Ra(e);return No(t)&&(t=void 0),ri(ct(e,No),Gi(t,2))})),$a=Rr((function(e){var t=Ra(e);return t="function"==typeof t?t:void 0,ri(ct(e,No),void 0,t)})),Qa=Rr(Ha);var Ja=Rr((function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,Za(e,n)}));function eo(e){var t=Tn(e);return t.__chain__=!0,t}function to(e,t){return t(e)}var no=Yi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,i=function(t){return Un(t,e)};return!(t>1||this.__actions__.length)&&r instanceof zn&&oa(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:to,args:[i],thisArg:void 0}),new Mn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(void 0),e}))):this.thru(i)}));var ro=bi((function(e,t,n){ke.call(e,n)?++e[n]:Zn(e,n,1)}));var io=Si(Ma),ao=Si(za);function oo(e,t){return(Oo(e)?st:er)(e,Gi(t,3))}function so(e,t){return(Oo(e)?ut:tr)(e,Gi(t,3))}var uo=bi((function(e,t,n){ke.call(e,n)?e[n].push(t):Zn(e,n,[t])}));var lo=Rr((function(e,t,n){var i=-1,a="function"==typeof t,o=Ao(e)?r(e.length):[];return er(e,(function(e){o[++i]=a?at(t,e,n):mr(e,t,n)})),o})),co=bi((function(e,t,n){Zn(e,n,t)}));function ho(e,t){return(Oo(e)?ft:Pr)(e,Gi(t,3))}var fo=bi((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var po=Rr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&sa(e,t[0],t[1])?t=[]:n>2&&sa(t[0],t[1],t[2])&&(t=[t[0]]),zr(e,ar(t,1),[])})),vo=Gt||function(){return Ze.Date.now()};function go(e,t,n){return t=n?void 0:t,ji(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function yo(e,t){var n;if("function"!=typeof t)throw new me(a);return e=rs(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}var mo=Rr((function(e,t,n){var r=1;if(n.length){var i=qt(n,Ki(mo));r|=32}return ji(e,r,t,n,i)})),bo=Rr((function(e,t,n){var r=3;if(n.length){var i=qt(n,Ki(bo));r|=32}return ji(t,r,e,n,i)}));function xo(e,t,n){var r,i,o,s,u,l,c=0,d=!1,h=!1,f=!0;if("function"!=typeof e)throw new me(a);function p(t){var n=r,a=i;return r=i=void 0,c=t,s=e.apply(a,n)}function v(e){return c=e,u=ba(y,t),d?p(e):s}function g(e){var n=e-l;return void 0===l||n>=t||n<0||h&&e-c>=o}function y(){var e=vo();if(g(e))return m(e);u=ba(y,function(e){var n=t-(e-l);return h?sn(n,o-(e-c)):n}(e))}function m(e){return u=void 0,f&&r?p(e):(r=i=void 0,s)}function b(){var e=vo(),n=g(e);if(r=arguments,i=this,l=e,n){if(void 0===u)return v(l);if(h)return ci(u),u=ba(y,t),p(l)}return void 0===u&&(u=ba(y,t)),s}return t=as(t)||0,Wo(n)&&(d=!!n.leading,o=(h="maxWait"in n)?on(as(n.maxWait)||0,t):o,f="trailing"in n?!!n.trailing:f),b.cancel=function(){void 0!==u&&ci(u),c=0,r=l=i=u=void 0},b.flush=function(){return void 0===u?s:m(vo())},b}var wo=Rr((function(e,t){return Qn(e,1,t)})),_o=Rr((function(e,t,n){return Qn(e,as(t)||0,n)}));function Eo(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new me(a);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(Eo.Cache||An),n}function ko(e){if("function"!=typeof e)throw new me(a);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Eo.Cache=An;var Co=ui((function(e,t){var n=(t=1==t.length&&Oo(t[0])?ft(t[0],Bt(Gi())):ft(ar(t,1),Bt(Gi()))).length;return Rr((function(r){for(var i=-1,a=sn(r.length,n);++i<a;)r[i]=t[i].call(this,r[i]);return at(e,this,r)}))})),So=Rr((function(e,t){return ji(e,32,void 0,t,qt(t,Ki(So)))})),Po=Rr((function(e,t){return ji(e,64,void 0,t,qt(t,Ki(Po)))})),To=Yi((function(e,t){return ji(e,256,void 0,void 0,void 0,t)}));function Do(e,t){return e===t||e!=e&&t!=t}var Bo=Ii(pr),Mo=Ii((function(e,t){return e>=t})),zo=br(function(){return arguments}())?br:function(e){return Yo(e)&&ke.call(e,"callee")&&!Ue.call(e,"callee")},Oo=r.isArray,Io=Je?Bt(Je):function(e){return Yo(e)&&fr(e)==E};function Ao(e){return null!=e&&qo(e.length)&&!Vo(e)}function No(e){return Yo(e)&&Ao(e)}var Lo=tn||au,Ro=et?Bt(et):function(e){return Yo(e)&&fr(e)==d};function jo(e){if(!Yo(e))return!1;var t=fr(e);return t==h||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!Zo(e)}function Vo(e){if(!Wo(e))return!1;var t=fr(e);return t==f||t==p||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Fo(e){return"number"==typeof e&&e==rs(e)}function qo(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Wo(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Yo(e){return null!=e&&"object"==typeof e}var Xo=tt?Bt(tt):function(e){return Yo(e)&&na(e)==v};function Ho(e){return"number"==typeof e||Yo(e)&&fr(e)==g}function Zo(e){if(!Yo(e)||fr(e)!=y)return!1;var t=Xe(e);if(null===t)return!0;var n=ke.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ee.call(n)==Te}var Uo=nt?Bt(nt):function(e){return Yo(e)&&fr(e)==m};var Ko=rt?Bt(rt):function(e){return Yo(e)&&na(e)==b};function Go(e){return"string"==typeof e||!Oo(e)&&Yo(e)&&fr(e)==x}function $o(e){return"symbol"==typeof e||Yo(e)&&fr(e)==w}var Qo=it?Bt(it):function(e){return Yo(e)&&qo(e.length)&&!!Ve[fr(e)]};var Jo=Ii(Sr),es=Ii((function(e,t){return e<=t}));function ts(e){if(!e)return[];if(Ao(e))return Go(e)?Ht(e):yi(e);if(Qe&&e[Qe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Qe]());var t=na(e);return(t==v?Vt:t==b?Wt:Ds)(e)}function ns(e){return e?(e=as(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function rs(e){var t=ns(e),n=t%1;return t==t?n?t-n:t:0}function is(e){return e?Kn(rs(e),0,4294967295):0}function as(e){if("number"==typeof e)return e;if($o(e))return NaN;if(Wo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Wo(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(U,"");var n=ae.test(e);return n||se.test(e)?Ye(e.slice(2),n?2:8):ie.test(e)?NaN:+e}function os(e){return mi(e,ws(e))}function ss(e){return null==e?"":$r(e)}var us=xi((function(e,t){if(da(t)||Ao(t))mi(t,xs(t),e);else for(var n in t)ke.call(t,n)&&Wn(e,n,t[n])})),ls=xi((function(e,t){mi(t,ws(t),e)})),cs=xi((function(e,t,n,r){mi(t,ws(t),e,r)})),ds=xi((function(e,t,n,r){mi(t,xs(t),e,r)})),hs=Yi(Un);var fs=Rr((function(e,t){e=ve(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&sa(t[0],t[1],i)&&(r=1);++n<r;)for(var a=t[n],o=ws(a),s=-1,u=o.length;++s<u;){var l=o[s],c=e[l];(void 0===c||Do(c,we[l])&&!ke.call(e,l))&&(e[l]=a[l])}return e})),ps=Rr((function(e){return e.push(void 0,Fi),at(Es,void 0,e)}));function vs(e,t,n){var r=null==e?void 0:dr(e,t);return void 0===r?n:r}function gs(e,t){return null!=e&&ra(e,t,gr)}var ys=Di((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Pe.call(t)),e[t]=n}),Ws(Hs)),ms=Di((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Pe.call(t)),ke.call(e,t)?e[t].push(n):e[t]=[n]}),Gi),bs=Rr(mr);function xs(e){return Ao(e)?Rn(e):kr(e)}function ws(e){return Ao(e)?Rn(e,!0):Cr(e)}var _s=xi((function(e,t,n){Br(e,t,n)})),Es=xi((function(e,t,n,r){Br(e,t,n,r)})),ks=Yi((function(e,t){var n={};if(null==e)return n;var r=!1;t=ft(t,(function(t){return t=si(t,e),r||(r=t.length>1),t})),mi(e,Hi(e),n),r&&(n=Gn(n,7,qi));for(var i=t.length;i--;)Jr(n,t[i]);return n}));var Cs=Yi((function(e,t){return null==e?{}:function(e,t){return Or(e,t,(function(t,n){return gs(e,n)}))}(e,t)}));function Ss(e,t){if(null==e)return{};var n=ft(Hi(e),(function(e){return[e]}));return t=Gi(t),Or(e,n,(function(e,n){return t(e,n[0])}))}var Ps=Ri(xs),Ts=Ri(ws);function Ds(e){return null==e?[]:Mt(e,xs(e))}var Bs=ki((function(e,t,n){return t=t.toLowerCase(),e+(n?Ms(t):t)}));function Ms(e){return js(ss(e).toLowerCase())}function zs(e){return(e=ss(e))&&e.replace(le,Nt).replace(Oe,"")}var Os=ki((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Is=ki((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),As=Ei("toLowerCase");var Ns=ki((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));var Ls=ki((function(e,t,n){return e+(n?" ":"")+js(t)}));var Rs=ki((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),js=Ei("toUpperCase");function Vs(e,t,n){return e=ss(e),void 0===(t=n?void 0:t)?function(e){return Le.test(e)}(e)?function(e){return e.match(Ae)||[]}(e):function(e){return e.match(ee)||[]}(e):e.match(t)||[]}var Fs=Rr((function(e,t){try{return at(e,void 0,t)}catch(e){return jo(e)?e:new he(e)}})),qs=Yi((function(e,t){return st(t,(function(t){t=Ca(t),Zn(e,t,mo(e[t],e))})),e}));function Ws(e){return function(){return e}}var Ys=Pi(),Xs=Pi(!0);function Hs(e){return e}function Zs(e){return Er("function"==typeof e?e:Gn(e,1))}var Us=Rr((function(e,t){return function(n){return mr(n,e,t)}})),Ks=Rr((function(e,t){return function(n){return mr(e,n,t)}}));function Gs(e,t,n){var r=xs(t),i=cr(t,r);null!=n||Wo(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=cr(t,xs(t)));var a=!(Wo(n)&&"chain"in n&&!n.chain),o=Vo(e);return st(i,(function(n){var r=t[n];e[n]=r,o&&(e.prototype[n]=function(){var t=this.__chain__;if(a||t){var n=e(this.__wrapped__),i=n.__actions__=yi(this.__actions__);return i.push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,pt([this.value()],arguments))})})),e}function $s(){}var Qs=Mi(ft),Js=Mi(lt),eu=Mi(yt);function tu(e){return ua(e)?Ct(Ca(e)):function(e){return function(t){return dr(t,e)}}(e)}var nu=Oi(),ru=Oi(!0);function iu(){return[]}function au(){return!1}var ou=Bi((function(e,t){return e+t}),0),su=Ni("ceil"),uu=Bi((function(e,t){return e/t}),1),lu=Ni("floor");var cu,du=Bi((function(e,t){return e*t}),1),hu=Ni("round"),fu=Bi((function(e,t){return e-t}),0);return Tn.after=function(e,t){if("function"!=typeof t)throw new me(a);return e=rs(e),function(){if(--e<1)return t.apply(this,arguments)}},Tn.ary=go,Tn.assign=us,Tn.assignIn=ls,Tn.assignInWith=cs,Tn.assignWith=ds,Tn.at=hs,Tn.before=yo,Tn.bind=mo,Tn.bindAll=qs,Tn.bindKey=bo,Tn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Oo(e)?e:[e]},Tn.chain=eo,Tn.chunk=function(e,t,n){t=(n?sa(e,t,n):void 0===t)?1:on(rs(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var a=0,o=0,s=r(Qt(i/t));a<i;)s[o++]=Xr(e,a,a+=t);return s},Tn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var a=e[t];a&&(i[r++]=a)}return i},Tn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=r(e-1),n=arguments[0],i=e;i--;)t[i-1]=arguments[i];return pt(Oo(n)?yi(n):[n],ar(t,1))},Tn.cond=function(e){var t=null==e?0:e.length,n=Gi();return e=t?ft(e,(function(e){if("function"!=typeof e[1])throw new me(a);return[n(e[0]),e[1]]})):[],Rr((function(n){for(var r=-1;++r<t;){var i=e[r];if(at(i[0],this,n))return at(i[1],this,n)}}))},Tn.conforms=function(e){return function(e){var t=xs(e);return function(n){return $n(n,e,t)}}(Gn(e,1))},Tn.constant=Ws,Tn.countBy=ro,Tn.create=function(e,t){var n=Dn(e);return null==t?n:Hn(n,t)},Tn.curry=function e(t,n,r){var i=ji(t,8,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return i.placeholder=e.placeholder,i},Tn.curryRight=function e(t,n,r){var i=ji(t,16,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return i.placeholder=e.placeholder,i},Tn.debounce=xo,Tn.defaults=fs,Tn.defaultsDeep=ps,Tn.defer=wo,Tn.delay=_o,Tn.difference=Ta,Tn.differenceBy=Da,Tn.differenceWith=Ba,Tn.drop=function(e,t,n){var r=null==e?0:e.length;return r?Xr(e,(t=n||void 0===t?1:rs(t))<0?0:t,r):[]},Tn.dropRight=function(e,t,n){var r=null==e?0:e.length;return r?Xr(e,0,(t=r-(t=n||void 0===t?1:rs(t)))<0?0:t):[]},Tn.dropRightWhile=function(e,t){return e&&e.length?ti(e,Gi(t,3),!0,!0):[]},Tn.dropWhile=function(e,t){return e&&e.length?ti(e,Gi(t,3),!0):[]},Tn.fill=function(e,t,n,r){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&sa(e,t,n)&&(n=0,r=i),function(e,t,n,r){var i=e.length;for((n=rs(n))<0&&(n=-n>i?0:i+n),(r=void 0===r||r>i?i:rs(r))<0&&(r+=i),r=n>r?0:is(r);n<r;)e[n++]=t;return e}(e,t,n,r)):[]},Tn.filter=function(e,t){return(Oo(e)?ct:ir)(e,Gi(t,3))},Tn.flatMap=function(e,t){return ar(ho(e,t),1)},Tn.flatMapDeep=function(e,t){return ar(ho(e,t),1/0)},Tn.flatMapDepth=function(e,t,n){return n=void 0===n?1:rs(n),ar(ho(e,t),n)},Tn.flatten=Oa,Tn.flattenDeep=function(e){return(null==e?0:e.length)?ar(e,1/0):[]},Tn.flattenDepth=function(e,t){return(null==e?0:e.length)?ar(e,t=void 0===t?1:rs(t)):[]},Tn.flip=function(e){return ji(e,512)},Tn.flow=Ys,Tn.flowRight=Xs,Tn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var i=e[t];r[i[0]]=i[1]}return r},Tn.functions=function(e){return null==e?[]:cr(e,xs(e))},Tn.functionsIn=function(e){return null==e?[]:cr(e,ws(e))},Tn.groupBy=uo,Tn.initial=function(e){return(null==e?0:e.length)?Xr(e,0,-1):[]},Tn.intersection=Aa,Tn.intersectionBy=Na,Tn.intersectionWith=La,Tn.invert=ys,Tn.invertBy=ms,Tn.invokeMap=lo,Tn.iteratee=Zs,Tn.keyBy=co,Tn.keys=xs,Tn.keysIn=ws,Tn.map=ho,Tn.mapKeys=function(e,t){var n={};return t=Gi(t,3),ur(e,(function(e,r,i){Zn(n,t(e,r,i),e)})),n},Tn.mapValues=function(e,t){var n={};return t=Gi(t,3),ur(e,(function(e,r,i){Zn(n,r,t(e,r,i))})),n},Tn.matches=function(e){return Tr(Gn(e,1))},Tn.matchesProperty=function(e,t){return Dr(e,Gn(t,1))},Tn.memoize=Eo,Tn.merge=_s,Tn.mergeWith=Es,Tn.method=Us,Tn.methodOf=Ks,Tn.mixin=Gs,Tn.negate=ko,Tn.nthArg=function(e){return e=rs(e),Rr((function(t){return Mr(t,e)}))},Tn.omit=ks,Tn.omitBy=function(e,t){return Ss(e,ko(Gi(t)))},Tn.once=function(e){return yo(2,e)},Tn.orderBy=function(e,t,n,r){return null==e?[]:(Oo(t)||(t=null==t?[]:[t]),Oo(n=r?void 0:n)||(n=null==n?[]:[n]),zr(e,t,n))},Tn.over=Qs,Tn.overArgs=Co,Tn.overEvery=Js,Tn.overSome=eu,Tn.partial=So,Tn.partialRight=Po,Tn.partition=fo,Tn.pick=Cs,Tn.pickBy=Ss,Tn.property=tu,Tn.propertyOf=function(e){return function(t){return null==e?void 0:dr(e,t)}},Tn.pull=ja,Tn.pullAll=Va,Tn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Ir(e,t,Gi(n,2)):e},Tn.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Ir(e,t,void 0,n):e},Tn.pullAt=Fa,Tn.range=nu,Tn.rangeRight=ru,Tn.rearg=To,Tn.reject=function(e,t){return(Oo(e)?ct:ir)(e,ko(Gi(t,3)))},Tn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,i=[],a=e.length;for(t=Gi(t,3);++r<a;){var o=e[r];t(o,r,e)&&(n.push(o),i.push(r))}return Ar(e,i),n},Tn.rest=function(e,t){if("function"!=typeof e)throw new me(a);return Rr(e,t=void 0===t?t:rs(t))},Tn.reverse=qa,Tn.sampleSize=function(e,t,n){return t=(n?sa(e,t,n):void 0===t)?1:rs(t),(Oo(e)?Vn:Vr)(e,t)},Tn.set=function(e,t,n){return null==e?e:Fr(e,t,n)},Tn.setWith=function(e,t,n,r){return r="function"==typeof r?r:void 0,null==e?e:Fr(e,t,n,r)},Tn.shuffle=function(e){return(Oo(e)?Fn:Yr)(e)},Tn.slice=function(e,t,n){var r=null==e?0:e.length;return r?(n&&"number"!=typeof n&&sa(e,t,n)?(t=0,n=r):(t=null==t?0:rs(t),n=void 0===n?r:rs(n)),Xr(e,t,n)):[]},Tn.sortBy=po,Tn.sortedUniq=function(e){return e&&e.length?Kr(e):[]},Tn.sortedUniqBy=function(e,t){return e&&e.length?Kr(e,Gi(t,2)):[]},Tn.split=function(e,t,n){return n&&"number"!=typeof n&&sa(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=ss(e))&&("string"==typeof t||null!=t&&!Uo(t))&&!(t=$r(t))&&jt(e)?li(Ht(e),0,n):e.split(t,n):[]},Tn.spread=function(e,t){if("function"!=typeof e)throw new me(a);return t=null==t?0:on(rs(t),0),Rr((function(n){var r=n[t],i=li(n,0,t);return r&&pt(i,r),at(e,this,i)}))},Tn.tail=function(e){var t=null==e?0:e.length;return t?Xr(e,1,t):[]},Tn.take=function(e,t,n){return e&&e.length?Xr(e,0,(t=n||void 0===t?1:rs(t))<0?0:t):[]},Tn.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?Xr(e,(t=r-(t=n||void 0===t?1:rs(t)))<0?0:t,r):[]},Tn.takeRightWhile=function(e,t){return e&&e.length?ti(e,Gi(t,3),!1,!0):[]},Tn.takeWhile=function(e,t){return e&&e.length?ti(e,Gi(t,3)):[]},Tn.tap=function(e,t){return t(e),e},Tn.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new me(a);return Wo(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),xo(e,t,{leading:r,maxWait:t,trailing:i})},Tn.thru=to,Tn.toArray=ts,Tn.toPairs=Ps,Tn.toPairsIn=Ts,Tn.toPath=function(e){return Oo(e)?ft(e,Ca):$o(e)?[e]:yi(ka(ss(e)))},Tn.toPlainObject=os,Tn.transform=function(e,t,n){var r=Oo(e),i=r||Lo(e)||Qo(e);if(t=Gi(t,4),null==n){var a=e&&e.constructor;n=i?r?new a:[]:Wo(e)&&Vo(a)?Dn(Xe(e)):{}}return(i?st:ur)(e,(function(e,r,i){return t(n,e,r,i)})),n},Tn.unary=function(e){return go(e,1)},Tn.union=Wa,Tn.unionBy=Ya,Tn.unionWith=Xa,Tn.uniq=function(e){return e&&e.length?Qr(e):[]},Tn.uniqBy=function(e,t){return e&&e.length?Qr(e,Gi(t,2)):[]},Tn.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Qr(e,void 0,t):[]},Tn.unset=function(e,t){return null==e||Jr(e,t)},Tn.unzip=Ha,Tn.unzipWith=Za,Tn.update=function(e,t,n){return null==e?e:ei(e,t,oi(n))},Tn.updateWith=function(e,t,n,r){return r="function"==typeof r?r:void 0,null==e?e:ei(e,t,oi(n),r)},Tn.values=Ds,Tn.valuesIn=function(e){return null==e?[]:Mt(e,ws(e))},Tn.without=Ua,Tn.words=Vs,Tn.wrap=function(e,t){return So(oi(t),e)},Tn.xor=Ka,Tn.xorBy=Ga,Tn.xorWith=$a,Tn.zip=Qa,Tn.zipObject=function(e,t){return ii(e||[],t||[],Wn)},Tn.zipObjectDeep=function(e,t){return ii(e||[],t||[],Fr)},Tn.zipWith=Ja,Tn.entries=Ps,Tn.entriesIn=Ts,Tn.extend=ls,Tn.extendWith=cs,Gs(Tn,Tn),Tn.add=ou,Tn.attempt=Fs,Tn.camelCase=Bs,Tn.capitalize=Ms,Tn.ceil=su,Tn.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=as(n))==n?n:0),void 0!==t&&(t=(t=as(t))==t?t:0),Kn(as(e),t,n)},Tn.clone=function(e){return Gn(e,4)},Tn.cloneDeep=function(e){return Gn(e,5)},Tn.cloneDeepWith=function(e,t){return Gn(e,5,t="function"==typeof t?t:void 0)},Tn.cloneWith=function(e,t){return Gn(e,4,t="function"==typeof t?t:void 0)},Tn.conformsTo=function(e,t){return null==t||$n(e,t,xs(t))},Tn.deburr=zs,Tn.defaultTo=function(e,t){return null==e||e!=e?t:e},Tn.divide=uu,Tn.endsWith=function(e,t,n){e=ss(e),t=$r(t);var r=e.length,i=n=void 0===n?r:Kn(rs(n),0,r);return(n-=t.length)>=0&&e.slice(n,i)==t},Tn.eq=Do,Tn.escape=function(e){return(e=ss(e))&&j.test(e)?e.replace(L,Lt):e},Tn.escapeRegExp=function(e){return(e=ss(e))&&Z.test(e)?e.replace(H,"\\$&"):e},Tn.every=function(e,t,n){var r=Oo(e)?lt:nr;return n&&sa(e,t,n)&&(t=void 0),r(e,Gi(t,3))},Tn.find=io,Tn.findIndex=Ma,Tn.findKey=function(e,t){return bt(e,Gi(t,3),ur)},Tn.findLast=ao,Tn.findLastIndex=za,Tn.findLastKey=function(e,t){return bt(e,Gi(t,3),lr)},Tn.floor=lu,Tn.forEach=oo,Tn.forEachRight=so,Tn.forIn=function(e,t){return null==e?e:or(e,Gi(t,3),ws)},Tn.forInRight=function(e,t){return null==e?e:sr(e,Gi(t,3),ws)},Tn.forOwn=function(e,t){return e&&ur(e,Gi(t,3))},Tn.forOwnRight=function(e,t){return e&&lr(e,Gi(t,3))},Tn.get=vs,Tn.gt=Bo,Tn.gte=Mo,Tn.has=function(e,t){return null!=e&&ra(e,t,vr)},Tn.hasIn=gs,Tn.head=Ia,Tn.identity=Hs,Tn.includes=function(e,t,n,r){e=Ao(e)?e:Ds(e),n=n&&!r?rs(n):0;var i=e.length;return n<0&&(n=on(i+n,0)),Go(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&wt(e,t,n)>-1},Tn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:rs(n);return i<0&&(i=on(r+i,0)),wt(e,t,i)},Tn.inRange=function(e,t,n){return t=ns(t),void 0===n?(n=t,t=0):n=ns(n),function(e,t,n){return e>=sn(t,n)&&e<on(t,n)}(e=as(e),t,n)},Tn.invoke=bs,Tn.isArguments=zo,Tn.isArray=Oo,Tn.isArrayBuffer=Io,Tn.isArrayLike=Ao,Tn.isArrayLikeObject=No,Tn.isBoolean=function(e){return!0===e||!1===e||Yo(e)&&fr(e)==c},Tn.isBuffer=Lo,Tn.isDate=Ro,Tn.isElement=function(e){return Yo(e)&&1===e.nodeType&&!Zo(e)},Tn.isEmpty=function(e){if(null==e)return!0;if(Ao(e)&&(Oo(e)||"string"==typeof e||"function"==typeof e.splice||Lo(e)||Qo(e)||zo(e)))return!e.length;var t=na(e);if(t==v||t==b)return!e.size;if(da(e))return!kr(e).length;for(var n in e)if(ke.call(e,n))return!1;return!0},Tn.isEqual=function(e,t){return xr(e,t)},Tn.isEqualWith=function(e,t,n){var r=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===r?xr(e,t,void 0,n):!!r},Tn.isError=jo,Tn.isFinite=function(e){return"number"==typeof e&&nn(e)},Tn.isFunction=Vo,Tn.isInteger=Fo,Tn.isLength=qo,Tn.isMap=Xo,Tn.isMatch=function(e,t){return e===t||wr(e,t,Qi(t))},Tn.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,wr(e,t,Qi(t),n)},Tn.isNaN=function(e){return Ho(e)&&e!=+e},Tn.isNative=function(e){if(ca(e))throw new he("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return _r(e)},Tn.isNil=function(e){return null==e},Tn.isNull=function(e){return null===e},Tn.isNumber=Ho,Tn.isObject=Wo,Tn.isObjectLike=Yo,Tn.isPlainObject=Zo,Tn.isRegExp=Uo,Tn.isSafeInteger=function(e){return Fo(e)&&e>=-9007199254740991&&e<=9007199254740991},Tn.isSet=Ko,Tn.isString=Go,Tn.isSymbol=$o,Tn.isTypedArray=Qo,Tn.isUndefined=function(e){return void 0===e},Tn.isWeakMap=function(e){return Yo(e)&&na(e)==_},Tn.isWeakSet=function(e){return Yo(e)&&"[object WeakSet]"==fr(e)},Tn.join=function(e,t){return null==e?"":rn.call(e,t)},Tn.kebabCase=Os,Tn.last=Ra,Tn.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r;return void 0!==n&&(i=(i=rs(n))<0?on(r+i,0):sn(i,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,i):xt(e,Et,i,!0)},Tn.lowerCase=Is,Tn.lowerFirst=As,Tn.lt=Jo,Tn.lte=es,Tn.max=function(e){return e&&e.length?rr(e,Hs,pr):void 0},Tn.maxBy=function(e,t){return e&&e.length?rr(e,Gi(t,2),pr):void 0},Tn.mean=function(e){return kt(e,Hs)},Tn.meanBy=function(e,t){return kt(e,Gi(t,2))},Tn.min=function(e){return e&&e.length?rr(e,Hs,Sr):void 0},Tn.minBy=function(e,t){return e&&e.length?rr(e,Gi(t,2),Sr):void 0},Tn.stubArray=iu,Tn.stubFalse=au,Tn.stubObject=function(){return{}},Tn.stubString=function(){return""},Tn.stubTrue=function(){return!0},Tn.multiply=du,Tn.nth=function(e,t){return e&&e.length?Mr(e,rs(t)):void 0},Tn.noConflict=function(){return Ze._===this&&(Ze._=De),this},Tn.noop=$s,Tn.now=vo,Tn.pad=function(e,t,n){e=ss(e);var r=(t=rs(t))?Xt(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return zi(Jt(i),n)+e+zi(Qt(i),n)},Tn.padEnd=function(e,t,n){e=ss(e);var r=(t=rs(t))?Xt(e):0;return t&&r<t?e+zi(t-r,n):e},Tn.padStart=function(e,t,n){e=ss(e);var r=(t=rs(t))?Xt(e):0;return t&&r<t?zi(t-r,n)+e:e},Tn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),ln(ss(e).replace(K,""),t||0)},Tn.random=function(e,t,n){if(n&&"boolean"!=typeof n&&sa(e,t,n)&&(t=n=void 0),void 0===n&&("boolean"==typeof t?(n=t,t=void 0):"boolean"==typeof e&&(n=e,e=void 0)),void 0===e&&void 0===t?(e=0,t=1):(e=ns(e),void 0===t?(t=e,e=0):t=ns(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var i=cn();return sn(e+i*(t-e+We("1e-"+((i+"").length-1))),t)}return Nr(e,t)},Tn.reduce=function(e,t,n){var r=Oo(e)?vt:Pt,i=arguments.length<3;return r(e,Gi(t,4),n,i,er)},Tn.reduceRight=function(e,t,n){var r=Oo(e)?gt:Pt,i=arguments.length<3;return r(e,Gi(t,4),n,i,tr)},Tn.repeat=function(e,t,n){return t=(n?sa(e,t,n):void 0===t)?1:rs(t),Lr(ss(e),t)},Tn.replace=function(){var e=arguments,t=ss(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Tn.result=function(e,t,n){var r=-1,i=(t=si(t,e)).length;for(i||(i=1,e=void 0);++r<i;){var a=null==e?void 0:e[Ca(t[r])];void 0===a&&(r=i,a=n),e=Vo(a)?a.call(e):a}return e},Tn.round=hu,Tn.runInContext=e,Tn.sample=function(e){return(Oo(e)?jn:jr)(e)},Tn.size=function(e){if(null==e)return 0;if(Ao(e))return Go(e)?Xt(e):e.length;var t=na(e);return t==v||t==b?e.size:kr(e).length},Tn.snakeCase=Ns,Tn.some=function(e,t,n){var r=Oo(e)?yt:Hr;return n&&sa(e,t,n)&&(t=void 0),r(e,Gi(t,3))},Tn.sortedIndex=function(e,t){return Zr(e,t)},Tn.sortedIndexBy=function(e,t,n){return Ur(e,t,Gi(n,2))},Tn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=Zr(e,t);if(r<n&&Do(e[r],t))return r}return-1},Tn.sortedLastIndex=function(e,t){return Zr(e,t,!0)},Tn.sortedLastIndexBy=function(e,t,n){return Ur(e,t,Gi(n,2),!0)},Tn.sortedLastIndexOf=function(e,t){if(null==e?0:e.length){var n=Zr(e,t,!0)-1;if(Do(e[n],t))return n}return-1},Tn.startCase=Ls,Tn.startsWith=function(e,t,n){return e=ss(e),n=null==n?0:Kn(rs(n),0,e.length),t=$r(t),e.slice(n,n+t.length)==t},Tn.subtract=fu,Tn.sum=function(e){return e&&e.length?Tt(e,Hs):0},Tn.sumBy=function(e,t){return e&&e.length?Tt(e,Gi(t,2)):0},Tn.template=function(e,t,n){var r=Tn.templateSettings;n&&sa(e,t,n)&&(t=void 0),e=ss(e),t=cs({},t,r,Vi);var i,a,o=cs({},t.imports,r.imports,Vi),s=xs(o),u=Mt(o,s),l=0,c=t.interpolate||ce,d="__p += '",h=ge((t.escape||ce).source+"|"+c.source+"|"+(c===q?ne:ce).source+"|"+(t.evaluate||ce).source+"|$","g"),f="//# sourceURL="+(ke.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++je+"]")+"\n";e.replace(h,(function(t,n,r,o,s,u){return r||(r=o),d+=e.slice(l,u).replace(de,Rt),n&&(i=!0,d+="' +\n__e("+n+") +\n'"),s&&(a=!0,d+="';\n"+s+";\n__p += '"),r&&(d+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=u+t.length,t})),d+="';\n";var p=ke.call(t,"variable")&&t.variable;p||(d="with (obj) {\n"+d+"\n}\n"),d=(a?d.replace(O,""):d).replace(I,"$1").replace(A,"$1;"),d="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var v=Fs((function(){return fe(s,f+"return "+d).apply(void 0,u)}));if(v.source=d,jo(v))throw v;return v},Tn.times=function(e,t){if((e=rs(e))<1||e>9007199254740991)return[];var n=4294967295,r=sn(e,4294967295);e-=4294967295;for(var i=Dt(r,t=Gi(t));++n<e;)t(n);return i},Tn.toFinite=ns,Tn.toInteger=rs,Tn.toLength=is,Tn.toLower=function(e){return ss(e).toLowerCase()},Tn.toNumber=as,Tn.toSafeInteger=function(e){return e?Kn(rs(e),-9007199254740991,9007199254740991):0===e?e:0},Tn.toString=ss,Tn.toUpper=function(e){return ss(e).toUpperCase()},Tn.trim=function(e,t,n){if((e=ss(e))&&(n||void 0===t))return e.replace(U,"");if(!e||!(t=$r(t)))return e;var r=Ht(e),i=Ht(t);return li(r,Ot(r,i),It(r,i)+1).join("")},Tn.trimEnd=function(e,t,n){if((e=ss(e))&&(n||void 0===t))return e.replace(G,"");if(!e||!(t=$r(t)))return e;var r=Ht(e);return li(r,0,It(r,Ht(t))+1).join("")},Tn.trimStart=function(e,t,n){if((e=ss(e))&&(n||void 0===t))return e.replace(K,"");if(!e||!(t=$r(t)))return e;var r=Ht(e);return li(r,Ot(r,Ht(t))).join("")},Tn.truncate=function(e,t){var n=30,r="...";if(Wo(t)){var i="separator"in t?t.separator:i;n="length"in t?rs(t.length):n,r="omission"in t?$r(t.omission):r}var a=(e=ss(e)).length;if(jt(e)){var o=Ht(e);a=o.length}if(n>=a)return e;var s=n-Xt(r);if(s<1)return r;var u=o?li(o,0,s).join(""):e.slice(0,s);if(void 0===i)return u+r;if(o&&(s+=u.length-s),Uo(i)){if(e.slice(s).search(i)){var l,c=u;for(i.global||(i=ge(i.source,ss(re.exec(i))+"g")),i.lastIndex=0;l=i.exec(c);)var d=l.index;u=u.slice(0,void 0===d?s:d)}}else if(e.indexOf($r(i),s)!=s){var h=u.lastIndexOf(i);h>-1&&(u=u.slice(0,h))}return u+r},Tn.unescape=function(e){return(e=ss(e))&&R.test(e)?e.replace(N,Zt):e},Tn.uniqueId=function(e){var t=++Ce;return ss(e)+t},Tn.upperCase=Rs,Tn.upperFirst=js,Tn.each=oo,Tn.eachRight=so,Tn.first=Ia,Gs(Tn,(cu={},ur(Tn,(function(e,t){ke.call(Tn.prototype,t)||(cu[t]=e)})),cu),{chain:!1}),Tn.VERSION="4.17.19",st(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Tn[e].placeholder=Tn})),st(["drop","take"],(function(e,t){zn.prototype[e]=function(n){n=void 0===n?1:on(rs(n),0);var r=this.__filtered__&&!t?new zn(this):this.clone();return r.__filtered__?r.__takeCount__=sn(n,r.__takeCount__):r.__views__.push({size:sn(n,4294967295),type:e+(r.__dir__<0?"Right":"")}),r},zn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),st(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;zn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Gi(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),st(["head","last"],(function(e,t){var n="take"+(t?"Right":"");zn.prototype[e]=function(){return this[n](1).value()[0]}})),st(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");zn.prototype[e]=function(){return this.__filtered__?new zn(this):this[n](1)}})),zn.prototype.compact=function(){return this.filter(Hs)},zn.prototype.find=function(e){return this.filter(e).head()},zn.prototype.findLast=function(e){return this.reverse().find(e)},zn.prototype.invokeMap=Rr((function(e,t){return"function"==typeof e?new zn(this):this.map((function(n){return mr(n,e,t)}))})),zn.prototype.reject=function(e){return this.filter(ko(Gi(e)))},zn.prototype.slice=function(e,t){e=rs(e);var n=this;return n.__filtered__&&(e>0||t<0)?new zn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=rs(t))<0?n.dropRight(-t):n.take(t-e)),n)},zn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},zn.prototype.toArray=function(){return this.take(4294967295)},ur(zn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),i=Tn[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);i&&(Tn.prototype[t]=function(){var t=this.__wrapped__,o=r?[1]:arguments,s=t instanceof zn,u=o[0],l=s||Oo(t),c=function(e){var t=i.apply(Tn,pt([e],o));return r&&d?t[0]:t};l&&n&&"function"==typeof u&&1!=u.length&&(s=l=!1);var d=this.__chain__,h=!!this.__actions__.length,f=a&&!d,p=s&&!h;if(!a&&l){t=p?t:new zn(this);var v=e.apply(t,o);return v.__actions__.push({func:to,args:[c],thisArg:void 0}),new Mn(v,d)}return f&&p?e.apply(this,o):(v=this.thru(c),f?r?v.value()[0]:v.value():v)})})),st(["pop","push","shift","sort","splice","unshift"],(function(e){var t=be[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Tn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Oo(i)?i:[],e)}return this[n]((function(n){return t.apply(Oo(n)?n:[],e)}))}})),ur(zn.prototype,(function(e,t){var n=Tn[t];if(n){var r=n.name+"";ke.call(bn,r)||(bn[r]=[]),bn[r].push({name:t,func:n})}})),bn[Ti(void 0,2).name]=[{name:"wrapper",func:void 0}],zn.prototype.clone=function(){var e=new zn(this.__wrapped__);return e.__actions__=yi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=yi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=yi(this.__views__),e},zn.prototype.reverse=function(){if(this.__filtered__){var e=new zn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},zn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Oo(e),r=t<0,i=n?e.length:0,a=function(e,t,n){var r=-1,i=n.length;for(;++r<i;){var a=n[r],o=a.size;switch(a.type){case"drop":e+=o;break;case"dropRight":t-=o;break;case"take":t=sn(t,e+o);break;case"takeRight":e=on(e,t-o)}}return{start:e,end:t}}(0,i,this.__views__),o=a.start,s=a.end,u=s-o,l=r?s:o-1,c=this.__iteratees__,d=c.length,h=0,f=sn(u,this.__takeCount__);if(!n||!r&&i==u&&f==u)return ni(e,this.__actions__);var p=[];e:for(;u--&&h<f;){for(var v=-1,g=e[l+=t];++v<d;){var y=c[v],m=y.iteratee,b=y.type,x=m(g);if(2==b)g=x;else if(!x){if(1==b)continue e;break e}}p[h++]=g}return p},Tn.prototype.at=no,Tn.prototype.chain=function(){return eo(this)},Tn.prototype.commit=function(){return new Mn(this.value(),this.__chain__)},Tn.prototype.next=function(){void 0===this.__values__&&(this.__values__=ts(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},Tn.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Pa(n);r.__index__=0,r.__values__=void 0,t?i.__wrapped__=r:t=r;var i=r;n=n.__wrapped__}return i.__wrapped__=e,t},Tn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof zn){var t=e;return this.__actions__.length&&(t=new zn(this)),(t=t.reverse()).__actions__.push({func:to,args:[qa],thisArg:void 0}),new Mn(t,this.__chain__)}return this.thru(qa)},Tn.prototype.toJSON=Tn.prototype.valueOf=Tn.prototype.value=function(){return ni(this.__wrapped__,this.__actions__)},Tn.prototype.first=Tn.prototype.head,Qe&&(Tn.prototype[Qe]=function(){return this}),Tn}();Ze._=Ut,void 0===(i=function(){return Ut}.call(t,n,t,r))||(r.exports=i)}).call(this)}).call(this,n(0),n(17)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var i=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.shouldResize=!1,this.cy=t,this.curr={},this.prev={},this.marginPercentage={},this.containedZoomMargin=.05,this.toggle=this.toggle.bind(this),this.getViewport=this.getViewport.bind(this),this.updateViewport=this.updateViewport.bind(this),this._xConstrainedZoom=this._xConstrainedZoom.bind(this),this._xChangeMargin=this._xChangeMargin.bind(this),this._yConstrainedZoom=this._yConstrainedZoom.bind(this),this._yChangeMargin=this._yChangeMargin.bind(this),this.resize=this.resize.bind(this)}return r(e,[{key:"toggle",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:!this.shouldResize,t=this.cy;e!==this.shouldResize&&(e?(t.on("render",this.updateViewport),t.on("resize",this.resize),this.updateViewport(t)):(t.removeListener("render",this.updateViewport),t.removeListener("resize",this.resize)),this.shouldResize=e)}},{key:"getViewport",value:function(){var e=this.cy;return{position:e.pan(),zoom:e.zoom(),renderedBB:Object.assign({},e.elements().renderedBoundingBox()),height:e.height(),width:e.width()}}},{key:"updateViewport",value:function(){var e=this.cy;this.prev=this.getViewport(e)}},{key:"_xConstrainedZoom",value:function(e){var t=this.curr,n=this.prev,r=this.marginPercentage.left*t.width;t.position.x=r+(n.position.x-n.renderedBB.x1);var i=t.renderedBB.y1+t.renderedBB.h/2-t.renderedBB.h/n.zoom*e/2;i+=(t.height-n.height)/2,t.position.y=i+(n.position.y-n.renderedBB.y1)}},{key:"_xChangeMargin",value:function(e){var t=this.curr,n=this.prev,r=n.renderedBB.x1+n.renderedBB.w/2,i=r/n.width*e;t.position.x=t.position.x+(i-r)}},{key:"_yConstrainedZoom",value:function(e){var t=this.curr,n=this.prev,r=this.marginPercentage.top*t.height;t.position.y=r+(n.position.y-n.renderedBB.y1);var i=t.renderedBB.x1+t.renderedBB.w/2-t.renderedBB.w/n.zoom*e/2;i+=(t.width-n.width)/2,t.position.x=i+(n.position.x-n.renderedBB.x1)}},{key:"_yChangeMargin",value:function(){var e=this.curr,t=this.prev,n=t.renderedBB.y1+t.renderedBB.h/2,r=n/t.height*e.height;e.position.y=e.position.y+(r-n)}},{key:"resize",value:function(){var e=this.cy;this.curr=this.getViewport(e);var t=this.curr,n=this.prev,r=n.renderedBB.x1>=0&&n.renderedBB.y1>=0&&n.renderedBB.x2<=n.width&&n.renderedBB.y2<=n.height;if(this.marginPercentage={left:n.renderedBB.x1/n.width,top:n.renderedBB.y1/n.height},Math.abs(1-t.width/n.width)>Math.abs(1-t.height/n.height)){var i=n.zoom/n.width*t.width;if(r)for(var a=Math.min((t.renderedBB.y1+t.renderedBB.h/2)*n.zoom*2/t.renderedBB.h,-(t.renderedBB.y1+t.renderedBB.h/2-n.height)*n.zoom*2/t.renderedBB.h)-this.containedZoomMargin,o=n.width/n.zoom*a,s=t.zoom<a?-1:1,u=i<a?-1:1;Math.abs(s)<=1;){if(-1===s){var l=1===u?a:i;this._xConstrainedZoom(l),t.zoom=l,1===u&&(this.prev.position=this.curr.position,this.prev.width=o)}else{var c=-1===u?o:t.width;this._xChangeMargin(c),-1===u&&(this.prev.position=this.curr.position,this.prev.width=o)}s+=2*u}else t.zoom=i,this._xConstrainedZoom(t.zoom)}else{var d=n.zoom/n.height*t.height;if(r)for(var h=Math.min((t.renderedBB.x1+t.renderedBB.w/2)*n.zoom*2/t.renderedBB.w,-(t.renderedBB.x1+t.renderedBB.w/2-n.width)*n.zoom*2/t.renderedBB.w)-this.containedZoomMargin,f=n.height/n.zoom*h,p=t.zoom<h?-1:1,v=d<h?-1:1;Math.abs(p)<=1;){if(-1===p){var g=1===v?h:d;this._yConstrainedZoom(g),t.zoom=g,1===v&&(this.prev.position=this.curr.position,this.prev.height=f)}else{var y=-1===v?f:t.height;this._yChangeMargin(y),-1===v&&(this.prev.position=this.curr.position,this.prev.height=f)}p+=2*v}else t.zoom=d,this._yConstrainedZoom(t.zoom)}return e.zoom({level:t.zoom}),e.pan(t.position),this.prev=this.curr,t}}]),e}();t.default=i}]); |