UNPKG

cytoscape-react-fe-ml

Version:
22 lines (19 loc) 55 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ReactCytoscape=t():e.ReactCytoscape=t()}(window,(function(){return function(e){var t={};function o(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,o),i.l=!0,i.exports}return o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(n,i,function(t){return e[t]}.bind(null,i));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=19)}([function(e,t){e.exports=require("prop-types")},function(e,t){e.exports=require("immutable")},function(e,t){e.exports=require("react")},function(e,t){e.exports=require("cytoscape")},function(e,t){e.exports=require("jquery")},function(e,t){e.exports=require("classnames")},function(e,t,o){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var o=function(e,t){var o=e[1]||"",n=e[3];if(!n)return o;if(t&&"function"==typeof btoa){var i=(r=n,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */"),a=n.sources.map((function(e){return"/*# sourceURL="+n.sourceRoot+e+" */"}));return[o].concat(a).concat([i]).join("\n")}var r;return[o].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+o+"}":o})).join("")},t.i=function(e,o){"string"==typeof e&&(e=[[null,e,""]]);for(var n={},i=0;i<this.length;i++){var a=this[i][0];null!=a&&(n[a]=!0)}for(i=0;i<e.length;i++){var r=e[i];null!=r[0]&&n[r[0]]||(o&&!r[2]?r[2]=o:o&&(r[2]="("+r[2]+") and ("+o+")"),t.push(r))}},t}},function(e,t,o){var n,i,a={},r=(n=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===i&&(i=n.apply(this,arguments)),i}),s=function(e,t){return t?t.querySelector(e):document.querySelector(e)},l=function(e){var t={};return function(e,o){if("function"==typeof e)return e();if(void 0===t[e]){var n=s.call(this,e,o);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}}(),c=null,u=0,p=[],d=o(16);function m(e,t){for(var o=0;o<e.length;o++){var n=e[o],i=a[n.id];if(i){i.refs++;for(var r=0;r<i.parts.length;r++)i.parts[r](n.parts[r]);for(;r<n.parts.length;r++)i.parts.push(b(n.parts[r],t))}else{var s=[];for(r=0;r<n.parts.length;r++)s.push(b(n.parts[r],t));a[n.id]={id:n.id,refs:1,parts:s}}}}function h(e,t){for(var o=[],n={},i=0;i<e.length;i++){var a=e[i],r=t.base?a[0]+t.base:a[0],s={css:a[1],media:a[2],sourceMap:a[3]};n[r]?n[r].parts.push(s):o.push(n[r]={id:r,parts:[s]})}return o}function f(e,t){var o=l(e.insertInto);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var n=p[p.length-1];if("top"===e.insertAt)n?n.nextSibling?o.insertBefore(t,n.nextSibling):o.appendChild(t):o.insertBefore(t,o.firstChild),p.push(t);else if("bottom"===e.insertAt)o.appendChild(t);else{if("object"!=typeof e.insertAt||!e.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var i=l(e.insertAt.before,o);o.insertBefore(t,i)}}function v(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=p.indexOf(e);t>=0&&p.splice(t,1)}function g(e){var t=document.createElement("style");if(void 0===e.attrs.type&&(e.attrs.type="text/css"),void 0===e.attrs.nonce){var n=function(){0;return o.nc}();n&&(e.attrs.nonce=n)}return y(t,e.attrs),f(e,t),t}function y(e,t){Object.keys(t).forEach((function(o){e.setAttribute(o,t[o])}))}function b(e,t){var o,n,i,a;if(t.transform&&e.css){if(!(a="function"==typeof t.transform?t.transform(e.css):t.transform.default(e.css)))return function(){};e.css=a}if(t.singleton){var r=u++;o=c||(c=g(t)),n=z.bind(null,o,r,!1),i=z.bind(null,o,r,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(o=function(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",y(t,e.attrs),f(e,t),t}(t),n=k.bind(null,o,t),i=function(){v(o),o.href&&URL.revokeObjectURL(o.href)}):(o=g(t),n=C.bind(null,o),i=function(){v(o)});return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else i()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=r()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var o=h(e,t);return m(o,t),function(e){for(var n=[],i=0;i<o.length;i++){var r=o[i];(s=a[r.id]).refs--,n.push(s)}e&&m(h(e,t),t);for(i=0;i<n.length;i++){var s;if(0===(s=n[i]).refs){for(var l=0;l<s.parts.length;l++)s.parts[l]();delete a[s.id]}}}};var w,x=(w=[],function(e,t){return w[e]=t,w.filter(Boolean).join("\n")});function z(e,t,o,n){var i=o?"":n.css;if(e.styleSheet)e.styleSheet.cssText=x(t,i);else{var a=document.createTextNode(i),r=e.childNodes;r[t]&&e.removeChild(r[t]),r.length?e.insertBefore(a,r[t]):e.appendChild(a)}}function C(e,t){var o=t.css,n=t.media;if(n&&e.setAttribute("media",n),e.styleSheet)e.styleSheet.cssText=o;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(o))}}function k(e,t,o){var n=o.css,i=o.sourceMap,a=void 0===t.convertToAbsoluteUrls&&i;(t.convertToAbsoluteUrls||a)&&(n=d(n)),i&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */");var r=new Blob([n],{type:"text/css"}),s=e.href;e.href=URL.createObjectURL(r),s&&URL.revokeObjectURL(s)}},function(e,t,o){var n; /*! Copyright (c) The Cytoscape Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */!function(){"use strict";var i=function(e,t){e&&t&&(t.fn.cyPanzoom=t.fn.cytoscapePanzoom=function(o){return r.apply(this,[o,e,t]),this},e("core","panzoom",(function(o){return r.apply(this,[o,e,t]),this})))},a={zoomFactor:.05,zoomDelay:45,minZoom:.1,maxZoom:10,fitPadding:50,panSpeed:10,panDistance:10,panDragAreaSize:75,panMinPercentSpeed:.25,panInactiveArea:8,panIndicatorMinOpacity:.5,zoomOnly:!1,fitSelector:void 0,animateOnFit:function(){return!1},fitAnimationDuration:1e3,sliderHandleIcon:"fa fa-minus",zoomInIcon:"fa fa-plus",zoomOutIcon:"fa fa-minus",resetIcon:"fa fa-expand"},r=function(e,t,o){var n=this,i=o.extend(!0,{},a,e),r=e,s={destroy:function(){var e=o(n.container()).find(".cy-panzoom");e.data("winbdgs").forEach((function(e){o(window).unbind(e.evt,e.fn)})),e.data("cybdgs").forEach((function(e){n.off(e.evt,e.fn)})),e.remove()},init:function(){window;return o(n.container()).each((function(){var e=o(this);e.cytoscape=t;var a=[],r=o(window),s=function(e,t){a.push({evt:e,fn:t}),r.bind(e,t)},l=function(e,t){for(var o=0;o<a.length;o++){var n=a[o];if(n.evt===e&&n.fn===t){a.splice(o,1);break}}r.unbind(e,t)},c=[],u=o('<div class="cy-panzoom"></div>');e.prepend(u),u.css("position","absolute"),u.data("winbdgs",a),u.data("cybdgs",c),i.zoomOnly&&u.addClass("cy-panzoom-zoom-only");var p=o('<div class="cy-panzoom-zoom-in cy-panzoom-zoom-button"><span class="icon '+i.zoomInIcon+'"></span></div>');u.append(p);var d=o('<div class="cy-panzoom-zoom-out cy-panzoom-zoom-button"><span class="icon '+i.zoomOutIcon+'"></span></div>');u.append(d);var m=o('<div class="cy-panzoom-reset cy-panzoom-zoom-button"><span class="icon '+i.resetIcon+'"></span></div>');u.append(m);var h=o('<div class="cy-panzoom-slider"></div>');u.append(h),h.append('<div class="cy-panzoom-slider-background"></div>');var f=o('<div class="cy-panzoom-slider-handle"><span class="icon '+i.sliderHandleIcon+'"></span></div>');h.append(f);var v=o('<div class="cy-panzoom-no-zoom-tick"></div>');h.append(v);var g=o('<div class="cy-panzoom-panner"></div>');u.append(g);var y=o('<div class="cy-panzoom-panner-handle"></div>');g.append(y);var b=o('<div class="cy-panzoom-pan-up cy-panzoom-pan-button"></div>'),w=o('<div class="cy-panzoom-pan-down cy-panzoom-pan-button"></div>'),x=o('<div class="cy-panzoom-pan-left cy-panzoom-pan-button"></div>'),z=o('<div class="cy-panzoom-pan-right cy-panzoom-pan-button"></div>');g.append(b).append(w).append(x).append(z);var C=o('<div class="cy-panzoom-pan-indicator"></div>');function k(){clearInterval(D),l("mousemove",j),C.hide()}function S(){n.pan(),n.zoom();O=e.width()/2,E=e.height()/2}g.append(C);var O,E,D,M=!1;function I(){M=!0,S()}function L(){M=!1}function T(e){M||S(),n.zoom({level:e,renderedPosition:{x:O,y:E}})}var j=function(e){e.stopPropagation(),e.preventDefault(),clearInterval(D);var t=function(e){var t={x:e.originalEvent.pageX-g.offset().left-g.width()/2,y:e.originalEvent.pageY-g.offset().top-g.height()/2},o=i.panDragAreaSize,n=Math.sqrt(t.x*t.x+t.y*t.y),a=Math.min(n/o,1);return n<i.panInactiveArea?{x:NaN,y:NaN}:(t={x:t.x/n,y:t.y/n},a=Math.max(i.panMinPercentSpeed,a),{x:-1*t.x*(a*i.panDistance),y:-1*t.y*(a*i.panDistance)})}(e);isNaN(t.x)||isNaN(t.y)?C.hide():(!function(e){var t=e,o=Math.sqrt(t.x*t.x+t.y*t.y),n=-1*t.x/o,a=-1*t.y/o,r=g.width(),s=g.height(),l=o/i.panDistance,c=Math.max(i.panIndicatorMinOpacity,l),u=255-Math.round(255*c);C.show().css({left:r/2*n+r/2,top:s/2*a+s/2,background:"rgb("+u+", "+u+", "+u+")"})}(t),D=setInterval((function(){n.panBy(t)}),i.panSpeed))};y.bind("mousedown",(function(e){j(e),s("mousemove",j)})),y.bind("mouseup",(function(){k()})),s("mouseup blur",(function(){k()})),h.bind("mousedown",(function(){return!1}));var P,_,q=!1;function Z(e,t){void 0===t&&(t=0);var o=h.height()-f.height()-4,n=e.pageY-h.offset().top-t;n<2&&(n=2),n>o&&(n=o);var a=1-(n-2)/(o-2);f.css("top",n);var r=i.minZoom,s=i.maxZoom,l=Math.log(r)/Math.log(s),c=(1-l)*a+l,u=Math.pow(s,c);u<r?u=r:u>s&&(u=s),T(u)}function B(){var e=n.zoom(),t=i.minZoom,o=i.maxZoom,a=Math.log(t)/Math.log(o),r=1-(Math.log(e)/Math.log(o)-a)/(1-a),s=h.height()-f.height()-4,l=r*(s-2);l<2&&(l=2),l>s&&(l=s),f.css("top",l)}function N(e,t){var o;e.bind("mousedown",(function(e){if(e.preventDefault(),e.stopPropagation(),0==e.button){var a=function(){var e=n.zoom(),o=n.zoom()*t;o<i.minZoom&&(o=i.minZoom),o>i.maxZoom&&(o=i.maxZoom),o==i.maxZoom&&e==i.maxZoom||o==i.minZoom&&e==i.minZoom||T(o)};return I(),a(),o=setInterval(a,i.zoomDelay),!1}})),s("mouseup blur",(function(){clearInterval(o),L()}))}f.bind("mousedown",P=function(e){var t=e.target===f[0]?e.offsetY:0;q=!0,I(),f.addClass("active");var o=0;return s("mousemove",_=function(e){var n=+new Date;return n>o+10&&(o=n,Z(e,t),!1)}),s("mouseup",(function(){l("mousemove",_),q=!1,f.removeClass("active"),L()})),!1}),h.bind("mousedown",(function(e){e.target!==f[0]&&(P(e),Z(e))})),B(),function(e,t){c.push({evt:e,fn:t}),n.on(e,t)}("zoom",(function(){q||B()})),function(){var e=i.minZoom,t=i.maxZoom,o=Math.log(e)/Math.log(t),n=1-(Math.log(1)/Math.log(t)-o)/(1-o);if(n>1||n<0)v.hide();else{var a=h.height()-f.height()-4,r=n*(a-2);r<2&&(r=2),r>a&&(r=a),v.css("top",r)}}(),N(p,1+i.zoomFactor),N(d,1-i.zoomFactor),m.bind("mousedown",(function(e){if(0==e.button){var t=i.fitSelector?n.elements(i.fitSelector):n.elements();if(0===t.size())n.reset();else("function"==typeof i.animateOnFit?i.animateOnFit.call():i.animateOnFit)?n.animate({fit:{eles:t,padding:i.fitPadding}},{duration:i.fitAnimationDuration}):n.fit(t,i.fitPadding);return!1}}))}))}};return s[r]?s[r].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof r&&r?(o.error("No such function `"+r+"` for jquery.cytoscapePanzoom"),o(this)):s.init.apply(this,arguments)};e.exports?e.exports=function(e,t){i(e,t||o(4))}:void 0===(n=function(){return i}.call(t,o,t,e))||(e.exports=n),"undefined"!=typeof cytoscape&&"undefined"!=typeof jQuery&&i(cytoscape,jQuery)}()},function(e,t){e.exports=require("cytoscape-euler")},function(e,t){e.exports=require("cytoscape-popper")},function(e,t){e.exports=require("cytoscape-node-html-label")},function(e,t,o){var n;!function(){"use strict";var i,a,r,s={container:!1,viewLiveFramerate:0,dblClickDelay:200,removeCustomContainer:!0,rerenderDelay:500},l=(a=Math.max,r=Date.now||function(){return(new Date).getTime()},function(e,t,o){var n,i,s,l,c,u,p,d,m,h=0,f=!1,v=!0;if("function"!=typeof e)throw new TypeError("Expected a function");if(t=t<0?0:+t||0,!0===o){var g=!0;v=!1}else m=typeof(d=o),!d||"object"!=m&&"function"!=m||(g=!!o.leading,f="maxWait"in o&&a(+o.maxWait||0,t),v="trailing"in o?!!o.trailing:v);function y(t,o){o&&clearTimeout(o),i=u=p=void 0,t&&(h=r(),s=e.apply(c,n),u||i||(n=c=void 0))}function b(){var e=t-(r()-l);e<=0||e>t?y(p,i):u=setTimeout(b,e)}function w(){y(v,u)}function x(){if(n=arguments,l=r(),c=this,p=v&&(u||!g),!1===f)var o=g&&!u;else{i||g||(h=l);var a=f-(l-h),d=a<=0||a>f;d?(i&&(i=clearTimeout(i)),h=l,s=e.apply(c,n)):i||(i=setTimeout(w,a))}return d&&u?u=clearTimeout(u):u||t===f||(u=setTimeout(b,t)),o&&(d=!0,s=e.apply(c,n)),!d||u||i||(n=c=void 0),s}return x.cancel=function(){u&&clearTimeout(u),i&&clearTimeout(i),h=0,i=u=p=void 0},x}),c=function(e,t){this._init(e,t)};c.prototype={constructor:c,bb:function(){var e=this.cy.elements().boundingBox();return 0===e.w||0===e.h?{x1:0,x2:1/0,y1:0,y2:1/0,w:1/0,h:1/0}:e},_addCyListener:function(e,t){this._cyListeners.push({events:e,handler:t}),this.cy.on(e,t)},_removeCyListeners:function(){var e=this.cy;this._cyListeners.forEach((function(t){e.off(t.events,t.handler)})),e.offRender(this._onRenderHandler)},_init:function(e,t){this._cyListeners=[],this.$element=i(e.container()),this.options=i.extend({},s,t),this.cy=e,this.boundingBox=this.bb(),this.width=this.$element.width(),this.height=this.$element.height(),this._initPanel(),this._initThumbnail(),this._initView(),this._initOverlay()},destroy:function(){this._removeEventsHandling(),this.options.container&&!this.options.removeCustomContainer?this.$panel.empty():this.$panel.remove(),this.$element.removeData("navigator")},_initPanel:function(){var e=this.options;if(e.container)if(e.container instanceof i){if(!(e.container.length>0))return void i.error("Container for jquery.cyNavigator is empty");this.$panel=e.container.first()}else{if(!(i(e.container).length>0))return void i.error("There is no any element matching your selector for jquery.cyNavigator");this.$panel=i(e.container).first()}else this.$panel=i('<div class="cytoscape-navigator"/>'),i("body").append(this.$panel);this._setupPanel(),this._addCyListener("resize",i.proxy(this.resize,this))},_setupPanel:function(){this.options;this.panelWidth=this.$panel.width(),this.panelHeight=this.$panel.height()},_initThumbnail:function(){this.$thumbnail=i("<img/>"),this.$panel.append(this.$thumbnail),this._setupThumbnailSizes(),this._setupThumbnail()},_setupThumbnail:function(){this._updateThumbnailImage()},_setupThumbnailSizes:function(){this.boundingBox=this.bb(),this.thumbnailZoom=Math.min(this.panelHeight/this.boundingBox.h,this.panelWidth/this.boundingBox.w),this.thumbnailPan={x:(this.panelWidth-this.thumbnailZoom*(this.boundingBox.x1+this.boundingBox.x2))/2,y:(this.panelHeight-this.thumbnailZoom*(this.boundingBox.y1+this.boundingBox.y2))/2}},_checkThumbnailSizesAndUpdate:function(){var e=this.thumbnailZoom,t=this.thumbnailPan.x,o=this.thumbnailPan.y;this._setupThumbnailSizes(),e!=this.thumbnailZoom||t!=this.thumbnailPan.x||o!=this.thumbnailPan.y?(this._setupThumbnail(),this._setupView()):this._updateThumbnailImage()},_initView:function(){this.$view=i('<div class="cytoscape-navigatorView"/>'),this.$panel.append(this.$view),this.viewBorderTop=parseInt(this.$view.css("border-top-width"),10),this.viewBorderRight=parseInt(this.$view.css("border-right-width"),10),this.viewBorderBottom=parseInt(this.$view.css("border-bottom-width"),10),this.viewBorderLeft=parseInt(this.$view.css("border-left-width"),10),this.viewBorderHorizontal=this.viewBorderLeft+this.viewBorderRight,this.viewBorderVertical=this.viewBorderTop+this.viewBorderBottom,this._setupView(),this._addCyListener("zoom pan",i.proxy(this._setupView,this))},_setupView:function(){if(!this.viewLocked){var e=this.cy.zoom(),t=this.cy.pan();this.viewW=this.width/e*this.thumbnailZoom,this.viewX=-t.x*this.viewW/this.width+this.thumbnailPan.x-this.viewBorderLeft,this.viewH=this.height/e*this.thumbnailZoom,this.viewY=-t.y*this.viewH/this.height+this.thumbnailPan.y-this.viewBorderTop,this.$view.width(this.viewW).height(this.viewH).css({position:"absolute",left:this.viewX,top:this.viewY})}},_initOverlay:function(){this.$overlay=i('<div class="cytoscape-navigatorOverlay"/>'),this.$panel.append(this.$overlay),this.overlayHookPointX=0,this.overlayHookPointY=0,this._initEventsHandling()},resize:function(){this.width=this.$element.width(),this.height=this.$element.height(),this._thumbnailSetup=!1,this._setupPanel(),this._checkThumbnailSizesAndUpdate(),this._setupView()},_initEventsHandling:function(){var e,t,o=this,n=["mousedown","mousewheel","DOMMouseScroll","touchstart"],a=["mouseup","mouseout","mousemove","touchmove","touchend"];this.$overlay.on(n.join(" "),e=function(e){if("touchstart"==e.type&&(e.offsetX=o.viewX+o.viewW/2,e.offsetY=o.viewY+o.viewH/2),void 0===e.offsetX||void 0===e.offsetY){var t=i(e.target).offset();e.offsetX=e.pageX-t.left,e.offsetY=e.pageY-t.top}return"mousedown"==e.type||"touchstart"==e.type?o._eventMoveStart(e):"mousewheel"!=e.type&&"DOMMouseScroll"!=e.type||o._eventZoom(e),!1}),i(window).on(a.join(" "),t=function(e){if(o.overlayInMovement){if("touchend"==e.type?(e.offsetX=o.viewX+o.viewW/2,e.offsetY=o.viewY+o.viewH/2):"touchmove"==e.type&&(e.pageX=e.originalEvent.touches[0].pageX,e.pageY=e.originalEvent.touches[0].pageY),void 0===e.offsetX||void 0===e.offsetY){var t=i(e.target).offset();e.offsetX=e.pageX-t.left,e.offsetY=e.pageY-t.top}if(e.target!==o.$overlay[0]){t=i(e.target).offset();var n=o.$overlay.offset();if(!t||!n)return!1;e.offsetX=e.offsetX-n.left+t.left,e.offsetY=e.offsetY-n.top+t.top}return"mousemove"==e.type||"touchmove"==e.type?o._eventMove(e):"mouseup"!=e.type&&"touchend"!=e.type||o._eventMoveEnd(e),!1}}),this._removeEventsHandling=function(){this.$overlay.off(n.join(" "),e),i(window).off(a.join(" "),t)}},_eventMoveStart:function(e){var t=(new Date).getTime();this.overlayLastMoveStartTime&&this.overlayLastMoveStartTime+this.options.dblClickDelay>t?(this.overlayLastMoveStartTime=0,this.overlayInMovement=!0,this.overlayHookPointX=this.viewW/2,this.overlayHookPointY=this.viewH/2,!1!==this.options.viewLiveFramerate?this._eventMove({offsetX:this.panelWidth/2,offsetY:this.panelHeight/2}):this._eventMoveEnd({offsetX:this.panelWidth/2,offsetY:this.panelHeight/2}),this.overlayInMovement=!1):(this.overlayLastMoveStartTime=t,this.overlayInMovement=!0,this.viewLocked=!0,e.offsetX>=this.viewX&&e.offsetX<=this.viewX+this.viewW&&e.offsetY>=this.viewY&&e.offsetY<=this.viewY+this.viewH?(this.overlayHookPointX=e.offsetX-this.viewX,this.overlayHookPointY=e.offsetY-this.viewY):(this.overlayHookPointX=this.viewW/2,this.overlayHookPointY=this.viewH/2,this._eventMove(e)))},_eventMove:function(e){var t=this;this._checkMousePosition(e),this.overlayInMovement&&(this.viewX=e.offsetX-this.overlayHookPointX,this.viewY=e.offsetY-this.overlayHookPointY,this.$view.css("left",this.viewX),this.$view.css("top",this.viewY),!1!==this.options.viewLiveFramerate&&(0==this.options.viewLiveFramerate?this._moveCy():this.overlayTimeout||(this.overlayTimeout=setTimeout((function(){t._moveCy(),t.overlayTimeout=!1}),1e3/this.options.viewLiveFramerate))))},_checkMousePosition:function(e){e.offsetX>this.viewX&&e.offsetX<this.viewX+this.viewBorderHorizontal+this.viewW&&e.offsetY>this.viewY&&e.offsetY<this.viewY+this.viewBorderVertical+this.viewH?this.$panel.addClass("mouseover-view"):this.$panel.removeClass("mouseover-view")},_eventMoveEnd:function(e){this.viewLocked=!1,this.$panel.removeClass("mouseover-view"),this.overlayInMovement&&(this._eventMove(e),!1===this.options.viewLiveFramerate&&this._moveCy(),this.overlayInMovement=!1)},_eventZoom:function(e){var t=Math.pow(10,e.originalEvent.wheelDeltaY/1e3||e.originalEvent.wheelDelta/1e3||e.originalEvent.detail/-32),o={left:e.offsetX,top:e.offsetY};this.cy.zoomingEnabled()&&this._zoomCy(t,o)},_updateThumbnailImage:function(){var e=this;if(!this._thumbnailUpdating){this._thumbnailUpdating=!0;var t,o,n,i,a;this._onRenderHandler=(t=function(){e._checkThumbnailSizesAndUpdate(),e._setupView();var t=e.$thumbnail,o=t[0],n=e.panelWidth,i=e.panelHeight,a=e.boundingBox,r=Math.min(n/a.w,i/a.h),s=(n-r*a.w)/2,l=(i-r*a.h)/2,c=e.cy.png({full:!0,scale:r});c.indexOf("image/png")<0?o.removeAttribute("src"):o.setAttribute("src",c),t.css({position:"absolute",left:s+"px",top:l+"px"})},o=e.options.rerenderDelay,i=!0,a=!0,!1===n?i=!1:typeof n==typeof{}&&(i="leading"in n?n.leading:i,a="trailing"in n?n.trailing:a),(n=n||{}).leading=i,n.maxWait=o,n.trailing=a,l(t,o,n)),this.cy.onRender(this._onRenderHandler)}},_moveCy:function(){this.cy.pan({x:-(this.viewX+this.viewBorderLeft-this.thumbnailPan.x)*this.width/this.viewW,y:-(this.viewY+this.viewBorderLeft-this.thumbnailPan.y)*this.height/this.viewH})},_zoomCy:function(e,t){var o;o={x:this.width/2,y:this.height/2},this.cy.zoom({level:this.cy.zoom()*e,renderedPosition:o})}};var u=function(e,t){e&&t&&(i=t,e("core","navigator",(function(e){return new c(this,e)})))};e.exports?e.exports=function(e,t){u(e,t||o(4))}:void 0===(n=function(){return u}.call(t,o,t,e))||(e.exports=n),"undefined"!=typeof cytoscape&&"undefined"!=typeof jQuery&&u(cytoscape,jQuery)}()},function(e,t){e.exports=require("cytoscape-navigator/cytoscape.js-navigator.css")},function(e,t,o){var n=o(15);"string"==typeof n&&(n=[[e.i,n,""]]);var i={hmr:!0,transform:void 0,insertInto:void 0};o(7)(n,i);n.locals&&(e.exports=n.locals)},function(e,t,o){(e.exports=o(6)(!1)).push([e.i,".navigator-cytoscape-ml{position:absolute;display:flex;flex-direction:column;width:240px;height:172px;right:8px;bottom:8px;background-color:#e8e8ea;box-shadow:0px 2px 8px 0px rgba(0,0,0,0.15)}.navigator-cytoscape-ml .cytoscape-navigator{position:relative;flex:1 1 auto;width:100%;border:0;background-color:transparent}.header-navigator-cytoscape-ml{height:32px;line-height:32px;background-color:#ffffff;color:#1D1F24;font-size:14px;padding:0 16px;cursor:move;user-select:none}\n",""])},function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var o=t.protocol+"//"+t.host,n=o+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(e,t){var i,a=t.trim().replace(/^"(.*)"$/,(function(e,t){return t})).replace(/^'(.*)'$/,(function(e,t){return t}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(a)?e:(i=0===a.indexOf("//")?a:0===a.indexOf("/")?o+a:n+a.replace(/^\.\//,""),"url("+JSON.stringify(i)+")")}))}},function(e,t,o){var n=o(18);"string"==typeof n&&(n=[[e.i,n,""]]);var i={hmr:!0,transform:void 0,insertInto:void 0};o(7)(n,i);n.locals&&(e.exports=n.locals)},function(e,t,o){(e.exports=o(6)(!1)).push([e.i,".ml-cytoscape{position:relative;overflow:hidden}.ml-cytoscape .cy-panzoom{right:50px;top:24px;z-index:10;box-sizing:border-box;display:flex;flex-direction:column}.ml-cytoscape .cy-panzoom .cy-panzoom-zoom-button,.ml-cytoscape .cy-panzoom .cy-panzoom-zoom-button:active{position:relative;width:22px;height:22px;line-height:22px;padding:0;font-weight:bold;text-align:center;color:#4A62E7;background-color:#fff;border:1px solid #d8d8d8;cursor:pointer}.ml-cytoscape .cy-panzoom .cy-panzoom-zoom-button:before,.ml-cytoscape .cy-panzoom .cy-panzoom-zoom-button:active:before{display:inline-block;width:100%;height:100%;position:absolute;top:-2px;left:0;font-size:24px}.ml-cytoscape .cy-panzoom .cy-panzoom-zoom-in{border-radius:2px 2px 0 0;order:1}.ml-cytoscape .cy-panzoom .cy-panzoom-zoom-in:before{content:'+'}.ml-cytoscape .cy-panzoom .cy-panzoom-zoom-out{border-radius:0 0 2px 2px;order:3}.ml-cytoscape .cy-panzoom .cy-panzoom-zoom-out:before{content:'-'}.ml-cytoscape .cy-panzoom .ml-cytoscape-panzoom-plus:before,.ml-cytoscape .cy-panzoom .ml-cytoscape-panzoom-minus:before{font-weight:normal;background-color:#fff;position:absolute;width:100%;height:100%;left:0;top:0}.ml-cytoscape .cy-panzoom .cy-panzoom-slider{position:relative;height:150px;width:22px;background:#fff;border:1px solid #D8D8D8;border-width:0 1px;order:2;overflow:hidden}.ml-cytoscape .cy-panzoom .cy-panzoom-slider-background{position:absolute;width:1px;height:100%;left:50%;background:#4A62E7}.ml-cytoscape .cy-panzoom .cy-panzoom-slider-handle{position:absolute;cursor:pointer;width:10px;height:10px;left:50%;transform:translate(-50%, 0);background:#4A62E7;border-radius:50%}.ml-cytoscape .cy-panzoom .cy-panzoom-slider-handle:before{position:absolute;display:block;content:'';top:10px;width:1px;height:150px;left:50%;background-color:#D8D8D8}.ml-cytoscape .cy-panzoom .ml-cytoscape-panzoom-slider{position:absolute;top:0;bottom:0;width:100%;height:100%;pointer-events:none}.ml-cytoscape .cy-panzoom .cy-panzoom-panner,.ml-cytoscape .cy-panzoom .cy-panzoom-reset,.ml-cytoscape .cy-panzoom .cy-panzoom-no-zoom-tick{display:none}.ml-cytoscape.pan-zoom-small .cy-panzoom-zoom-in{background-color:#4A62E7;color:#fff}.ml-cytoscape.pan-zoom-small .cy-panzoom-zoom-out{border-top-width:0}.ml-cytoscape.pan-zoom-small .cy-panzoom-slider{display:none}.ml-cytoscape-popper-div{z-index:1}\n",""])},function(e,t,o){"use strict";o.r(t);o(13);var n=o(2),i=o.n(n),a=o(0),r=o.n(a),s=o(3),l=o.n(s),c=o(1),u=o.n(c),p=o(5),d=o.n(p),m=o(4),h=o.n(m),f=o(8),v=o.n(f),g=o(9),y=o.n(g),b=o(10),w=o.n(b),x=o(11),z=o.n(x),C=o(12),k=o.n(C),S=(o(14),i.a.forwardRef((e,t)=>{var o,a,r,s,{className:l,headerClassName:c,afterDragging:u}=e,p=Object(n.useRef)(),m=Object(n.useRef)(),h=!1,f=e=>{if(h){var t=e.pageX-o,n=e.pageY-a,i=r+t,l=s+n,c=p.current.offsetParent.clientWidth,u=p.current.offsetParent.clientHeight,{offsetWidth:d,offsetHeight:m}=p.current;i+d>c&&(i=c-d);var f=getComputedStyle(p.current).padding||"",[v,,g]=f.split(" "),y=g;y||(y=v||"0px");var b=m-parseFloat(y);l+b>u&&(l=u-b),i<0&&(i=0),l<0&&(l=0),p.current.style.left="".concat(i,"px"),p.current.style.top="".concat(l,"px")}},v=()=>{var e=h;h=!1,window.removeEventListener("mouseup",v,!1),window.removeEventListener("mousemove",f,!1),e&&u&&u()},g=e=>{h=!0,o=e.pageX,a=e.pageY,r=p.current.offsetLeft,s=p.current.offsetTop,window.addEventListener("mouseup",v,!1),window.addEventListener("mousemove",f,!1)};Object(n.useEffect)(()=>(m.current.addEventListener("mousedown",g),()=>{m.current.removeEventListener("mousedown",g)}));return i.a.createElement("div",{ref:p,className:d()("navigator-cytoscape-ml",l),onDoubleClick:e=>{e.stopPropagation()}},i.a.createElement("div",{ref:m,className:d()("header-navigator-cytoscape-ml",c)},"导航器"),i.a.createElement("div",{className:"cytoscape-navigator",role:"presentation",ref:t}))}));S.defaultProps={className:"",headerClassName:"",afterDragging:null},S.propTypes={className:r.a.string,headerClassName:r.a.string,afterDragging:r.a.func};var O=S,E={core:{"selection-box-color":"rgba(72, 133, 184, 0.2)"},node:{width:"33px",height:"33px",shape:"ellipse","border-width":"3px","border-opacity":1,"border-color":"#3a9caa","background-width":function(e){return e.data("bgImages").width?e.data("bgImages").width:"auto"},"background-height":function(e){return e.data("bgImages").height?e.data("bgImages").height:"auto"},"background-color":"#3a9caa","background-opacity":1,"background-repeat":"no-repeat","background-fit":function(e){return e.data("bgImages")&&e.data("bgImages").fit?e.data("bgImages").fit:"none"},"background-image":function(e){return e.data("bgImages")?e.data("bgImages").image:"none"},"background-clip":function(e){return e.data("bgImages").clip?e.data("bgImages").clip:"none"},"background-position-x":"data(bgImages.positionX)","background-position-y":"data(bgImages.positionY)",content:"data(name)",color:"#707070","font-family":"Microsoft Yahei","font-size":"12px","text-halign":"center","text-valign":"bottom","text-wrap":"wrap","background-image-crossorigin":"anonymous","text-margin-y":"8px","overlay-color":"#000000","background-width-relative-to":"inner","background-height-relative-to":"inner",padding:"20px"},"node:locked":{"border-color":"#666666"},"node:selected":{"border-color":"#fbba0a"},"node.shape-hexagon":{shape:"polygon","shape-polygon-points":"0 1, 0.8660254037844386 0.5, 0.8660254037844386 -0.5, 0 -1, -0.8660254037844386 -0.5, -0.8660254037844386 0.5"},"node.shape-rectangle":{shape:"roundrectangle",width:"50px",height:"50px"},"node.shape-rectangle:selected":{width:"53px",height:"53px"},edge:{width:"2px","line-color":"#9bb7f0",content:"data(event)",color:"#707070","font-family":"Microsoft Yahei","font-size":"12px","min-zoomed-font-size":"12px","edge-text-rotation":"autorotate","curve-style":"bezier","text-background-color":"#f6f7f9","text-background-opacity":"1","text-background-shape":"roundrectangle"},"edge:selected":{"line-color":"#fbba0a"},".hidtxt":{content:""},".showbigger":{content:e=>e.data("showbigger")||e.data("name")},".showsmall":{content:""},"node.showtiny:selected":{"border-width":"10px"},"edge.directed":{"line-color":"#9bb7f0","target-arrow-shape":"triangle","target-arrow-color":"#9bb7f0"},"edge.directed:selected":{"line-color":"#fbba0a","target-arrow-shape":"triangle","target-arrow-color":"#fbba0a"},".hide":{opacity:"0"}},D={auto:{name:"cose",idealEdgeLength:100,nodeOverlap:1e3,refresh:20,fit:!0,padding:30,randomize:!1,componentSpacing:10,nodeRepulsion:4e5,edgeElasticity:100,nestingFactor:5,gravity:80,numIter:2e3,initialTemp:1e3,coolingFactor:.95,minTemp:1,nodeDimensionsIncludeLabels:!0},grid:{name:"grid",fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,rows:void 0,columns:void 0,position(){},animate:!0,animationDuration:300,ready:void 0,stop:void 0},circle:{name:"circle",fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,radius:void 0,startAngle:1.5*Math.PI,counterclockwise:!1,animate:!0,animationDuration:300,ready:void 0,stop:void 0},breadthfirst:{name:"breadthfirst",fit:!0,directed:!1,padding:30,circle:!1,spacingFactor:2,boundingBox:void 0,avoidOverlap:!0,roots:void 0,maximalAdjustments:0,maximal:!0,animate:!0,animationDuration:300,ready:void 0,stop:void 0},concentric:{name:"concentric",fit:!0,padding:30,startAngle:1.5*Math.PI,counterclockwise:!1,minNodeSpacing:80,boundingBox:void 0,avoidOverlap:!0,height:void 0,width:void 0,concentric:e=>e.degree(),levelWidth:e=>e.maxDegree()/4,animate:!0,animationDuration:300,ready:void 0,stop:void 0},euler:{name:"euler",springLength:()=>80,springCoeff:()=>8e-4,mass:()=>4,gravity:-100,pull:.03,theta:.666,dragCoeff:.02,movementThreshold:1,timeStep:20,refresh:100,animate:"end",animationDuration:!0,animationEasing:void 0,maxIterations:1e3,maxSimulationTime:4e3,ungrabifyWhileSimulating:!1,fit:!0,padding:30,boundingBox:void 0,ready:()=>{},stop:()=>{},randomize:!0}},M={zoomFactor:.05,zoomDelay:45,minZoom:0,maxZoom:5,fitPadding:50,panSpeed:1,panDistance:10,panDragAreaSize:75,panMinPercentSpeed:.25,panInactiveArea:8,panIndicatorMinOpacity:.5,autodisableForMobile:!0,sliderHandleIcon:"ml-cytoscape-panzoom-slider",zoomInIcon:"ml-cytoscape-panzoom-plus",zoomOutIcon:"ml-cytoscape-panzoom-minus",resetIcon:"ml-cytoscape-panzoom-full"},I={viewLiveFramerate:0,thumbnailEventFramerate:1,thumbnailLiveFramerate:!1,dblClickDelay:200,removeCustomContainer:!0,rerenderDelay:100};o(17);function L(){return(L=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}function T(e,t){if(null==e)return{};var o,n,i=function(e,t){if(null==e)return{};var o,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)o=a[n],t.indexOf(o)>=0||(i[o]=e[o]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)o=a[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(i[o]=e[o])}return i}function j(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function P(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?j(Object(o),!0).forEach((function(t){_(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):j(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function _(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}k()(l.a,h.a),v()(l.a,h.a),z()(l.a),l.a.use(w.a),l.a.use(y.a);var q=()=>{};class Z extends n.Component{constructor(e){super(e),_(this,"getBoundingBox",e=>{var t=[],o=[],n=this.cy;return(e&&0!==e.size?e:n.nodes()).forEach(e=>{var n=e.position();t.push(n&&n.x),o.push(n&&n.y)}),{x1:Math.min.apply(null,t),y1:Math.min.apply(null,o),x2:Math.max.apply(null,t),y2:Math.max.apply(null,o)}}),_(this,"getNodePosition",e=>this.cy.$("#".concat(e)).renderedPosition()),_(this,"getEventFrom",e=>{var t="empty";return e===this.cy?t="empty":e.isNode()?t="entity":e.isEdge()&&(t="relation"),t}),_(this,"formatGraphStyle",e=>{var t=[];return Object.keys(e).forEach(o=>{t.push({selector:o,style:e[o]})}),t}),_(this,"handleClick",e=>{var t=this.getEventFrom(e.target);this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null);var{onClick:o,onDblClick:n}=this.props;if(this.isDblClick)return n(t,"empty"!==t&&e.target.data(),e.target),void(this.isDblClick=!1);this.isDblClick=!0;var i=this;this.clickTimer=setTimeout(()=>{i.isDblClick=!1,o(t,"empty"!==t&&e.target.data(),e.target)},300)}),_(this,"handleTapEnd",e=>{var t=this,o=this.getEventFrom(e.target),{autoSelectEdges:n,onTap:i}=this.props;setTimeout(()=>{"entity"===o&&e.target.selected()&&n&&e.target.neighborhood("edge").select(),t.handleChangeDisplay(),i(o,"empty"!==o&&e.target.data())},100)}),_(this,"handleChangeZoom",()=>{var{zoomBig:e,zoomNormal:t,zoomSmall:o,onChangeZoom:n}=this.props,i=this.cy.zoom(),a=this.cy.elements();if(0!==a.length)if(this.changeZoomDefer&&clearTimeout(this.changeZoomDefer),this.changeZoomDefer=setTimeout(()=>{this.handleChangeDisplay(),n(i,this.cy)},100),i>e){if("showbigger"===this.zoomMode)return;a.addClass("showbigger").removeClass(this.zoomMode),this.zoomMode="showbigger"}else if(i>=t){if("shownormal"===this.zoomMode)return;a.addClass("shownormal").removeClass(this.zoomMode),this.zoomMode="shownormal"}else if(i>=o){if("showsmall"===this.zoomMode)return;a.addClass("showsmall").removeClass(this.zoomMode),this.zoomMode="showsmall"}else{if("showtiny"===this.zoomMode)return;a.addClass("showtiny").removeClass(this.zoomMode),this.zoomMode="showtiny"}}),_(this,"handleCxtTap",e=>{var t,o,{target:n}=e,i=this.getEventFrom(n),{selectSingleOnCxt:a,autoSelectEdges:r}=this.props;"entity"!==i||n.selected()?"relation"!==i||n.selected()||(a&&this.cy.elements(":selected").unselect(),n.select(),this.handleChangeDisplay()):(a&&this.cy.elements(":selected").unselect(),n.select(),r&&n.neighborhood("edge").select(),this.handleChangeDisplay()),({x:t,y:o}="entity"===i?n.renderedPosition():e.renderedPosition);var s={eventPosition:{left:e.originalEvent.x,top:e.originalEvent.y},position:{left:t,top:o},eventFrom:i},{onCxtTap:l}=this.props;l(s,e)}),_(this,"handleChangeDisplay",()=>{this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.timeout=setTimeout(this.changeDisplay,100)}),_(this,"handlePosition",e=>{if(0!==this.popperMap.size){var{target:t}=e;if("entity"===this.getEventFrom(t)){var o=t.id();this.popperMap.forEach(e=>{var t=e.get(o);t&&t.scheduleUpdate()})}}}),_(this,"changeDisplay",()=>{this.changeCurrentJsonData();var e={data:this.currentJsonData.toJS()},{onChangeDisplay:t}=this.props;t(e)}),_(this,"changeCurrentJsonData",()=>{var e=this.cy.json(),{elements:t,zoom:o,pan:n}=e;this.currentJsonData=u.a.fromJS({elements:t,zoom:o,pan:n})}),_(this,"handleLayoutStop",()=>{this.runningLayout=null;var{onLayoutStop:e}=this.props,t=this.cy;this.layoutConfig&&this.layoutConfig.fit&&t.zoom()>1&&t.zoom(1),this.cy.center(),this.handleChangeDisplay(),e(),console.timeEnd("布局")}),_(this,"generatePNG",e=>{if(this.cy){var t=Object.assign({},{full:!0,scale:1},e);return this.cy.png(t)}return null}),_(this,"getZoom",()=>this.cy.zoom()),_(this,"changePopperList",(e,t)=>{var o=u.a.Map(),{getZoom:n,container:{current:i}}=this,a=this.popperMap;e&&u.a.fromJS(e).forEach((e,r)=>{var s=a.get(r),l=u.a.Map(),c=t[r];e.forEach((e,t)=>{if(s&&s.has(t)){var o=s.get(t),a=c&&c.template&&c.template(e)||e;o.popper.innerHTML=a,l=l.set(t,o),s=s.delete(t)}else{var r=this.cy.$id(t);if(r.length>0){var u=r.popper({content:()=>{var t=document.createElement("div");t.classList.add("ml-cytoscape-popper-div");var o=c&&c.template&&c.template(e)||e;return t.innerHTML=o,i.appendChild(t),t},popper:{placement:c&&c.position||"right-start",removeOnDestroy:!0,modifiers:{computeStyle:{gpuAcceleration:!1},offset:{fn(e){var t=n();return c&&c.modifiersOffset&&c.modifiersOffset(e,t,i)||e}}}}});l=l.set(t,u)}}}),s&&(a=a.set(r,s)),o=o.set(r,l)}),a&&a.forEach(e=>{e&&e.forEach(e=>{e.destroy()})}),this.popperMap=o}),_(this,"updatePopper",()=>{this.popperMap.forEach(e=>{e.forEach(e=>{e.scheduleUpdate()})})}),_(this,"handleDoubleClick",e=>{e.stopPropagation()}),this.currentJsonData=u.a.fromJS({elements:{}}),this.zoomMode="shownormal",this.popperMap=u.a.Map(),this.dragging=!1,this.runningLayout=null,this.timeout=null,this.clickTimer=null,this.isDblClick=!1,this.layoutConfig=null,this.graphScapeContainer=i.a.createRef(),this.container=i.a.createRef(),this.graphNavigator=i.a.createRef()}componentDidMount(){var{graphStyle:e,layout:t,boxSelect:o,navigator:n,panZoom:i,zoom:a,pan:r,afterRender:s,elements:c,minZoom:p,maxZoom:d,wheelSensitivity:m,autoFit:h,floatingLayer:f,floatingLayerConfig:v,extensions:g,hideEdgesOnViewport:y,events:b}=this.props;g.length>0&&g.forEach(e=>{l.a.use(e)});var w=e||E,x={container:this.graphScapeContainer.current,boxSelectionEnabled:o,wheelSensitivity:m,layout:t||{name:"preset"},style:this.formatGraphStyle(w),minZoom:p,maxZoom:d,hideEdgesOnViewport:y};if(r&&(x.pan=r),a&&(x.zoom=a),this.cy=l()(x),this.cy.zoom()!==a&&this.cy.zoom(a),Object.keys(c).length>0){this.cy.json({elements:c});var z=u.a.fromJS(c),C=z.get("nodes")&&z.get("nodes").filter(e=>!e.get("position")).map(e=>e.getIn(["data","id"]));C&&C.size>0?this.changeLayout(t):(h&&(this.cy.fit(30),this.cy.center()),this.changeCurrentJsonData())}n&&this.initNavigator(n),i&&this.initPanZoom(i),this.changePopperList(f,v),this.bindEvent(b),s&&s(this.cy)}componentWillReceiveProps(e){var{layout:t,boxSelect:o,zoom:n,pan:i,elements:a,floatingLayer:r,graphStyle:s,autoFit:l,hideEdgesOnViewport:c}=e,{layout:p,boxSelect:d,zoom:m,pan:h,floatingLayer:f,graphStyle:v,elements:g,hideEdgesOnViewport:y}=this.props;if("object"==typeof t&&t.name!==p.name||"string"==typeof t&&t!==p)this.changeLayout(t);else{if(o!==d)return this.cy.boxSelectionEnabled(o),void this.cy.userPanningEnabled(!o);var b=u.a.fromJS(a),w=b.map(e=>u.a.Map(e.map(e=>[e.getIn(["data","id"]),e]))),x=this.currentJsonData.get("elements").map(e=>u.a.Map(e.map(e=>[e.getIn(["data","id"]),e])));if(u.a.is(w,x)){if(n&&n!==m)return this.cy.zoom(n),void this.changeCurrentJsonData();!i||h&&i.x===h.x&&i.y===h.y||(this.cy.pan(i),this.changeCurrentJsonData())}else{var z=b.get("nodes")||u.a.List(),C=u.a.List(),k=[];z.forEach(e=>{var t=e.getIn(["data","id"]),o=x&&x.getIn(["nodes",t]),n=o&&o.get("position"),i=e.get("position")||n;i||k.push(e),C=C.push(e.set("position",i))}),console.time("cytoscape.json");var S={elements:a};i&&(S.pan=i),n&&(S.zoom=n),c!==y&&(S.hideEdgesOnViewport=c),this.cy.json(S),k.length>0?(this.changeLayout(e.layout),this.changeCurrentJsonData()):(l&&z.size>1?(this.cy.fit(30),this.cy.center()):l&&z&&z.size>0&&this.cy.center(),this.changeCurrentJsonData(),this.handleChangeDisplay()),console.timeEnd("cytoscape.json")}s&&!u.a.is(u.a.fromJS(v),u.a.fromJS(s))&&this.cy.style().fromJson(this.formatGraphStyle(s)).update(),u.a.is(u.a.fromJS(r),u.a.fromJS(f))||this.changePopperList(r,e.floatingLayerConfig)}}shouldComponentUpdate(){return!1}componentWillUnmount(){this.cy.destroy()}initNavigator(e){var t=!0!==e&&e,o=P(P(P({},I),t),{},{container:this.graphNavigator.current});this.cy.navigator(o)}initPanZoom(e){var{minZoom:t,maxZoom:o}=this.props,{sliderHandleIcon:n,zoomInIcon:i,zoomOutIcon:a}=e,{sliderHandleIcon:r,zoomInIcon:s,zoomOutIcon:l}=M,c=P(P({},T(M,["sliderHandleIcon","zoomInIcon","zoomOutIcon"])),{},{sliderHandleIcon:"".concat(r," ").concat(n),zoomInIcon:"".concat(s," ").concat(i),zoomOutIcon:"".concat(l," ").concat(a),minZoom:t,maxZoom:o});this.cy.panzoom(c)}bindEvent(e){var{cy:t}=this;t.on("click",this.handleClick).on("tapend",this.handleTapEnd).on("zoom",this.handleChangeZoom).on("layoutstop",this.handleLayoutStop).on("cxttap",this.handleCxtTap).on("lock",this.changeCurrentJsonData).on("unlock",this.changeCurrentJsonData).on("position",this.handlePosition).on("pan",this.handleChangeDisplay),t.on("pan zoom resize",this.updatePopper),Object.keys(e).forEach(o=>{t.on(o,e[o])})}changeLayout(e){this.runningLayout&&this.runningLayout.stop(),console.time("布局");var t=this.cy;if("string"!=typeof e){var{name:o}=e,n=D[o];return this.layoutConfig=n?Object.assign({},n,e):e,this.runningLayout=t.layout(this.layoutConfig),void this.runningLayout.run()}if("auto"===e)return this.layoutConfig=D[e],this.runningLayout=t.layout(D[e]),void this.runningLayout.run();var i=t.nodes(":selected").not(":locked");if(i.length>1&&i.length!==t.nodes().length&&"breadthfirst"!==e){var a=this.getBoundingBox(t.nodes(":selected").not(":locked"));if("grid"===e){var r=63*t.nodes(":selected").not(":locked").length;a.x1===a.x2&&(a.x2+=r),a.y1===a.y2&&(a.y2+=r)}this.layoutConfig=Object.assign({},D[e],{boundingBox:a,stop:this.handleLayoutStop}),this.runningLayout=i.layout(this.layoutConfig),this.runningLayout.run()}else{var s=this;this.layoutConfig=Object.assign({},D[e],{stop(){var e=s.getBoundingBox(),o=t.extent();(e.x1<o.x1||e.x2>o.x2||e.y1<o.y1||e.y2>o.y2)&&t.animate({fit:{padding:20},center:{}},{duration:300,complete(){}})}}),this.runningLayout=t.layout(this.layoutConfig),this.runningLayout.run()}}render(){var e={},{width:t,height:o,background:n,className:a,navigator:r,panZoom:s}=this.props;t&&(e.width=t),o&&(e.height=o),n&&(e.background=n);var l="";return s&&s.mode&&(l+=" pan-zoom-".concat(s.mode)),s&&s.size&&(l+=" pan-zoom-".concat(s.size)),i.a.createElement("div",{className:d()("ml-cytoscape",a,l),style:e,ref:this.container},i.a.createElement("div",{ref:this.graphScapeContainer,style:{height:"100%"}}),r&&i.a.createElement(O,L({ref:this.graphNavigator},r)))}}Z.defaultProps={width:"100%",height:"100%",layout:"auto",layoutSelected:!1,pan:null,zoom:null,boxSelect:!1,background:"transparent",minZoom:.1,maxZoom:6,zoomBig:1,zoomNormal:.5,zoomSmall:.2,elements:{},graphStyle:null,floatingLayer:null,floatingLayerConfig:null,afterRender:null,className:null,wheelSensitivity:.1,autoFit:!1,onChangeZoom:q,onDblClick:q,onChangeDisplay:q,onLayoutStop:q,onCxtTap:q,onClick:q,selectSingleOnCxt:!1,autoSelectEdges:!0,extensions:[],onTap:q,hideEdgesOnViewport:!1,navigator:!0,panZoom:!0,events:{}},Z.propTypes={width:r.a.string,height:r.a.string,layout:r.a.oneOfType([r.a.object,r.a.string]),pan:r.a.shape({x:r.a.number,y:r.a.number}),zoom:r.a.number,boxSelect:r.a.bool,background:r.a.string,minZoom:r.a.number,maxZoom:r.a.number,zoomBig:r.a.number,zoomNormal:r.a.number,zoomSmall:r.a.number,graphStyle:r.a.object,elements:r.a.object,floatingLayer:r.a.object,floatingLayerConfig:r.a.object,onChangeDisplay:r.a.func,onLayoutStop:r.a.func,onCxtTap:r.a.func,onClick:r.a.func,onDblClick:r.a.func,afterRender:r.a.func,className:r.a.string,wheelSensitivity:r.a.number,autoFit:r.a.bool,layoutSelected:r.a.bool,onChangeZoom:r.a.func,selectSingleOnCxt:r.a.bool,autoSelectEdges:r.a.bool,onTap:r.a.func,extensions:r.a.array,hideEdgesOnViewport:r.a.bool,navigator:r.a.oneOfType([r.a.bool,r.a.shape({className:r.a.string,headerClassName:r.a.string,afterDragging:r.a.func})]),panZoom:r.a.oneOfType([r.a.bool,r.a.shape({className:r.a.string,sliderHandleIcon:r.a.string,zoomInIcon:r.a.string,zoomOutIcon:r.a.string,mode:r.a.string,size:r.a.string})]),events:r.a.object};t.default=Z;Z.__docgenInfo={description:"React封装的cytoscape.js组件",methods:[{name:"getBoundingBox",docblock:null,modifiers:[],params:[{name:"nodes",type:null}],returns:null},{name:"getNodePosition",docblock:"获取指定点的位置信息",modifiers:[],params:[{name:"nodeId"}],returns:null,description:"获取指定点的位置信息"},{name:"getEventFrom",docblock:"获取触发事件的对象类型(画布、节点、边)",modifiers:[],params:[{name:"eventTarget"}],returns:null,description:"获取触发事件的对象类型(画布、节点、边)"},{name:"formatGraphStyle",docblock:"格式化样式",modifiers:[],params:[{name:"graphStyle"}],returns:null,description:"格式化样式"},{name:"handleClick",docblock:"点击事件",modifiers:[],params:[{name:"event"}],returns:null,description:"点击事件"},{name:"handleTapEnd",docblock:"TapEnd事件,点击时自动选中边。因为要支持双击事件,所以click事件做了延迟,为了选中边的效果无延迟,所以在tapEnd事件中处理此逻辑",modifiers:[],params:[{name:"event"}],returns:null,description:"TapEnd事件,点击时自动选中边。因为要支持双击事件,所以click事件做了延迟,为了选中边的效果无延迟,所以在tapEnd事件中处理此逻辑"},{name:"handleChangeZoom",docblock:"改变缩放时,根据不同的缩放级别设置不同的classname",modifiers:[],params:[],returns:null,description:"改变缩放时,根据不同的缩放级别设置不同的classname"},{name:"handleCxtTap",docblock:"右键点击时的回调",modifiers:[],params:[{name:"event"}],returns:null,description:"右键点击时的回调"},{name:"handleChangeDisplay",docblock:null,modifiers:[],params:[],returns:null},{name:"handlePosition",docblock:null,modifiers:[],params:[{name:"event",type:null}],returns:null},{name:"changeDisplay",docblock:"在画布发生变化后,更新当前保存的数据,触发回调",modifiers:[],params:[],returns:null,description:"在画布发生变化后,更新当前保存的数据,触发回调"},{name:"changeCurrentJsonData",docblock:null,modifiers:[],params:[],returns:null},{name:"handleLayoutStop",docblock:"布局结束时的回调",modifiers:[],params:[],returns:null,description:"布局结束时的回调"},{name:"generatePNG",docblock:"生成png图片",modifiers:[],params:[{name:"params"}],returns:null,description:"生成png图片"},{name:"getZoom",docblock:null,modifiers:[],params:[],returns:null},{name:"changePopperList",docblock:"设置浮框",modifiers:[],params:[{name:"floatingLayer"},{name:"floatingLayerConfig"}],returns:null,description:"设置浮框"},{name:"updatePopper",docblock:"重新设置浮框的位置",modifiers:[],params:[],returns:null,description:"重新设置浮框的位置"},{name:"handleDoubleClick",docblock:null,modifiers:[],params:[{name:"event",type:null}],returns:null},{name:"initNavigator",docblock:"初始化导航器",modifiers:[],params:[{name:"navigatorConfig"}],returns:null,description:"初始化导航器"},{name:"initPanZoom",docblock:"初始化缩放按钮",modifiers:[],params:[{name:"panZoom"}],returns:null,description:"初始化缩放按钮"},{name:"bindEvent",docblock:"绑定事件",modifiers:[],params:[{name:"events"}],returns:null,description:"绑定事件"},{name:"changeLayout",docblock:null,modifiers:[],params:[{name:"layout",type:null}],returns:null}],displayName:"ReactCytoscape",props:{width:{defaultValue:{value:"'100%'",computed:!1},type:{name:"string"},required:!1,description:""},height:{defaultValue:{value:"'100%'",computed:!1},type:{name:"string"},required:!1,description:""},layout:{defaultValue:{value:"'auto'",computed:!1},type:{name:"union",value:[{name:"object"},{name:"string"}]},required:!1,description:'布局,支持以下几种类型的布局方式:"auto"-自动布局、"grid":-网格布局、"circle"-环形布局、"breadthfirst"-层次布局、"concentric"-同心轴布局'},layoutSelected:{defaultValue:{value:"false",computed:!1},type:{name:"bool"},required:!1,description:"是否只针对选中的元素布局"},pan:{defaultValue:{value:"null",computed:!1},type:{name:"shape",value:{x:{name:"number",required:!1},y:{name:"number",required:!1}}},required:!1,description:""},zoom:{defaultValue:{value:"null",computed:!1},type:{name:"number"},required:!1,description:"画布的缩放系数"},boxSelect:{defaultValue:{value:"false",computed:!1},type:{name:"bool"},required:!1,description:"是否开启区块选择,true-开启;false-不开启"},background:{defaultValue:{value:"'transparent'",computed:!1},type:{name:"string"},required:!1,description:"背景"},minZoom:{defaultValue:{value:"0.1",computed:!1},type:{name:"number"},required:!1,description:"画布支持的最小缩放级别"},maxZoom:{defaultValue:{value:"6",computed:!1},type:{name:"number"},re