ui-widget-toolkit
Version:
UI widgets built on top of D3, Pixi.js and ag-grid-community
1 lines • 168 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("d3"),require("pixi.js"),require("es6-promise"),require("d3-sankey"),require("dagre")):"function"==typeof define&&define.amd?define("UWT",["d3","pixi.js","es6-promise","d3-sankey","dagre"],e):"object"==typeof exports?exports.UWT=e(require("d3"),require("pixi.js"),require("es6-promise"),require("d3-sankey"),require("dagre")):t.UWT=e(t.d3,t.PIXI,t["es6-promise"],t.Sankey,t.dagre)}(window,(function(t,e,n,i,r){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=35)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t[t.Left=1]="Left",t[t.Right=2]="Right",t[t.Top=4]="Top",t[t.Bottom=8]="Bottom",t[t.None=0]="None"}(e.Alignment||(e.Alignment={})),function(t){t[t.CursorStart=0]="CursorStart",t[t.CursorMove=1]="CursorMove",t[t.CursorEnd=2]="CursorEnd",t[t.BrushStart=3]="BrushStart",t[t.BrushMove=4]="BrushMove",t[t.BrushEnd=5]="BrushEnd",t[t.HoverStart=6]="HoverStart",t[t.HoverEnd=7]="HoverEnd",t[t.HoverClear=8]="HoverClear",t[t.FocusStart=6]="FocusStart",t[t.FocusEnd=7]="FocusEnd",t[t.FocusClear=8]="FocusClear",t[t.SelectAdd=9]="SelectAdd",t[t.SelectRemove=10]="SelectRemove",t[t.SelectStart=9]="SelectStart",t[t.SelectEnd=10]="SelectEnd",t[t.SelectClear=11]="SelectClear",t[t.Zoom=12]="Zoom",t[t.Click=13]="Click",t[t.DoubleClick=14]="DoubleClick",t[t.RangeUpdate=15]="RangeUpdate"}(e.EventType||(e.EventType={})),function(t){t[t.Unrendered=0]="Unrendered",t[t.Cartesian=1]="Cartesian",t[t.Pie=2]="Pie",t[t.Grid=3]="Grid",t[t.FlowDiagram=4]="FlowDiagram",t[t.ForceDirectedGraph=5]="ForceDirectedGraph",t[t.Sunburst=6]="Sunburst",t[t.HierarchyGraph=7]="HierarchyGraph",t[t.PortDiagram=8]="PortDiagram",t[t.SimpleGraph=9]="SimpleGraph",t[t.TreeMap=10]="TreeMap",t[t.Axis=11]="Axis",t[t.Radar=12]="Radar"}(e.UIType||(e.UIType={})),function(t){t[t.Discrete=0]="Discrete",t[t.Gradient=1]="Gradient"}(e.LegendType||(e.LegendType={})),function(t){t[t.Vertical=0]="Vertical",t[t.Horizontal=1]="Horizontal"}(e.LegendOrientation||(e.LegendOrientation={})),function(t){t[t.Rectangle=0]="Rectangle",t[t.Line=1]="Line",t[t.Circle=2]="Circle"}(e.LegendItemShape||(e.LegendItemShape={}));e.Rect=class{constructor(t,e,n,i){this.x=0,this.y=0,this.width=0,this.height=0,this.x=t,this.y=e,this.width=n,this.height=i}contains(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}};e.Css=class{constructor(t,e){t?this.addClasses(t):this.classes={},this.style=e||{}}addClasses(t){let e=t.split(" ");for(let t=0;t<e.length;++t)this.classes[e[t]]=!0;return this}addStyles(t){for(let e in t)this.style[e]=t[e];return this}setColor(t){return this.addStyles({color:t}),this}setOpacity(t){return this.addStyles({opacity:t}),this}removeClass(t){return delete this.classes[t],this}removeStyle(t){return delete this.style[t],this}getClasses(){return Object.keys(this.classes)}getClassString(){let t="";for(let e in this.classes)t+=e+" ";return t}getStyles(){return this.style}getStyleString(){return JSON.stringify(this.style)}};e.Range=class{constructor(t,e){this.min=t,this.max=e}setMin(t){return this.min=t,this}getMin(){return this.min}setMax(t){return this.max=t,this}getMax(){return this.max}}},function(t,e,n){"use strict";function i(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function r(t){return function(e,n){return i(t(e),n)}}function o(t){return t||(t=i),1===t.length&&(t=r(t)),{left:function(e,n,i,r){for(null==i&&(i=0),null==r&&(r=e.length);i<r;){var o=i+r>>>1;t(e[o],n)<0?i=o+1:r=o}return i},right:function(e,n,i,r){for(null==i&&(i=0),null==r&&(r=e.length);i<r;){var o=i+r>>>1;t(e[o],n)>0?r=o:i=o+1}return i}}}Object.defineProperty(e,"__esModule",{value:!0}),e.getSelectionName=function(t){return"number"==typeof t?"n"+t:t?(t.length>0&&!isNaN(Number(t[0]))&&(t="z"+t),t=t.replace(/[\*\%\#\[\]\/\>\<\s\+\(\)\;\@\:\?\"=.,]/g,"-")):""},e.removeFromList=function(t,e){if(t){let n=e.indexOf(t);-1!==n&&e.splice(n,1)}},e.bisect=o,e.bucketData=function(t,e,n){let i=o().right,r=[];for(let t=0;t<e.length-1;++t)r[t]=[];let a=e[0],s=e[e.length-1],l=e.slice(1);for(let e=0;e<t.length;++e){let o=n(t[e]);o<a||o>s||r[i(l,o)].push(t[e])}let h={};for(let t=0;t<e.length-1;++t){h[e[t]+"-"+e[t+1]]=r[t]}return h},e.copy=function(t){let e={};for(let n in t)e[n]=t[n];return e},e.merge=function(t,e){for(let n in e)t[n]=e[n]},e.convertTraceToTrees=function(t){let e=[],n=[],i=[];for(let r=0;r<t.length;r++){let o=t[r],a=n[n.length-1];for(;n.length&&o.x>a.x+a.dx;)--n.length,--i.length,a=n[n.length-1];let s=i[i.length-1],l={key:o.key,value:o.dx,children:[],parent:s};o.name&&(l.name=o.name),s?s.children.push(l):e.push(l),n.push(o),i.push(l)}return e};e.SimpleBuffer=class{constructor(t){this._data=t||[]}push(t){this._data.push(t)}get(t){return this._data[t]}length(){return this._data.length}getData(){return this._data}};e.RingBuffer=class{constructor(t){this._data=new Array(t),this._startIdx=0,this._count=0,this._isRotating=!1}push(t){this._isRotating?(this._data[this._startIdx]=t,++this._startIdx,this._startIdx===this._count&&(this._startIdx=0),this._isRotating=!0):this._count===this._data.length-1?(this._data[this._count]=t,++this._count,this._isRotating=!0):(this._data[this._count]=t,++this._count)}get(t){return this._isRotating&&(t+=this._startIdx)>=this._count&&(t-=this._count),this._data[t]}length(){return this._count}getData(){if(this._isRotating){let t=[];for(let e=this._startIdx;e<this._data.length;++e)t.push(this._data[e]);for(let e=0;e<this._startIdx;++e)t.push(this._data[e]);return t}return this._data}},e.bisectBuffer=function(t){return t||(t=i),1===t.length&&(t=r(t)),{left:function(e,n,i,r){for(null==i&&(i=0),null==r&&(r=e.length());i<r;){var o=i+r>>>1;t(e.get(o),n)<0?i=o+1:r=o}return i},right:function(e,n,i,r){for(null==i&&(i=0),null==r&&(r=e.length());i<r;){var o=i+r>>>1;t(e.get(o),n)>0?r=o:i=o+1}return i}}},e.transposeKeys=function(t){let e={};function n(t,i,r,o){let a=[];for(let t=0;t<i.length;++t)a[t]=i[t];if(a.push(r.key),Array.isArray(r.data))for(let e=0;e<r.data.length;++e)n(t,a,r.data[e],o+1);else{let n=t;for(let t=a.length-1;t>=0;--t){let i,o=a[t];e.hasOwnProperty(o)?i=e[o]:(i=n.length,e[o]=i),n[i]||(n[i]={key:o,data:[]}),0===t?n[i].data=r.data:n=n[i].data}}}let i=[];for(let e=0;e<t.length;++e)n(i,[],t[e],0);return i},e.runFunctionOnLeaf=function t(e,n){if(e&&e.children&&e.children.length>0)for(let i=0;i<e.children.length;++i)t(e.children[i],n);else n(e)},e.isOverlapping=function(t,e){return t.x<=e.right&&t.right>=e.x&&t.y<=e.bottom&&t.bottom>=e.y}},function(e,n){e.exports=t},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=n(1),r=n(0),o=n(7),a=n(19),s=n(29),l=n(4),h=n(2);function c(t,e,n){return n=n&&"none"!==n?n:void 0,e.has(t.node())||e.set(t.node(),n),e.get(t.node())}function u(t,e,n){let i=t.style("fill");if(i=c(t,e,i),i){let e=a.InteractionState.getFocusColor(i);t.style("fill",e)}if(!t.classed("selected")){let e=t.style("stroke");if(e=c(t,n,e),e){let n=a.InteractionState.getFocusColor(e);t.style("stroke",n)}}t.classed("hover",!0)}function d(t,e,n){let i=c(t,e);if(i&&t.style("fill",i),!t.classed("selected")){let e=t.style("stroke");e&&(e=c(t,n),e&&t.style("stroke",e))}t.classed("hover",!1)}function g(t,e,n){let i=t.style("fill");i=c(t,e,i);let r=!i||"none"===i,o=t.style("stroke");o=c(t,n,o),(o||r)&&t.style("stroke",null),t.classed("selected",!0)}function p(t,e,n){let i=c(t,n);i&&t.style("stroke",i),t.classed("selected",!1)}function f(t,e,n){let i={caller:t,data:e,event:r.EventType.SelectClear},o={caller:t,event:r.EventType.SelectAdd,data:e,selection:n};t.api.select(i),t.api.select(o),t.onClick&&(t.onClick(i),t.onClick(o))}function m(t,e,n){if(t.getScreenCTM&&t.getScreenCTM()){let e=t.getScreenCTM().inverse();return n.matrixTransform(e)}return{x:n.x,y:n.y}}function _(t,e){let n=e.node().getBoundingClientRect(),i=t.node(),r=(e.node(),i.createSVGPoint());r.x=n.left,r.y=n.top;let o=m(i,0,r);r.x=n.right,r.y=n.bottom;let a=m(i,0,r);return{x:o.x,y:o.y,width:a.x-o.x,height:a.y-o.y,right:a.x,bottom:a.y}}e.getStyle=function(t){let e=t.node();return window.getComputedStyle(e)},e.mergeKeys=function(t,e){let n={};for(let e=0;e<t.length;++e)n[t[e]]=!0;for(let i=0;i<e.length;++i)n.hasOwnProperty(e[i])||t.push(e[i])},e.getKeys=function(t,e){let n={},i=[];for(let r=0;r<t.length;++r){let o=e(t[r]);for(let t=0;t<o.length;++t)"string"!=typeof o[t]&&"number"!=typeof o[t]||n.hasOwnProperty(o[t])||(n[o[t]]=!0,i.push(o[t]))}return i},e.focus=u,e.unfocus=d,e.select=g,e.unselect=p,e.onSelectHelper=f,e.addClickHelper=function(t,e,n,i,a,s,l,c,u){let d;t.on("click",(function(t){void 0!==c&&(t=c),i?d=setTimeout((function(){d&&(e.disableSelection||f(l,c,u),n&&n({caller:l,event:r.EventType.Click,data:t}),d=null)}),300):(e.disableSelection||f(l,c,u),n&&n({caller:l,event:r.EventType.Click,data:t}))})),i&&t.on("dblclick",(function(t){void 0!==c&&(t=c),window.clearTimeout(d),d=null,i({caller:l,event:r.EventType.DoubleClick,data:t})})),a&&a.length&&t.on("contextmenu",(function(t){event||(event=h.event),o.showContextMenu(h.event,c,a)}))},e.convertToSVGCoords=_,e.getTextRect=function(t,e){let n=t.append("text").text(e),i=_(t,n);return n.remove(),i},e.animatePath=function(t,e){let n=t.node().getTotalLength();t.attr("stroke-dasharray",n).attr("stroke-dashoffset",n).transition("add").duration(e).attr("stroke-dashoffset",0)};class y{static getAngle(t,e){return 180*Math.atan2(e.y-t.y,e.x-t.x)/Math.PI}static translateArrow(t){return function(e,n,i){return function(e){var n=t.getTotalLength(),i=t.getPointAtLength(e*n),r=t.getPointAtLength(Math.max(n-.01,0)*e),o=t.getPointAtLength((n+.01)*e);return"translate("+i.x+", "+i.y+") rotate( "+y.getAngle(r,o)+")"}}}static createArrow(t,e=4){let n=2*e;return t.append("path").attr("d",`M -${n}, -${e} L0,0 L-${n},${e} z`)}static animateArrow(t,e,n){e.transition().duration(n).attrTween("transform",y.translateArrow(t.node()))}}e.Arrow=y;e.Spinner=class{constructor(t,e){let n=this,i=Math.min(e.width,e.height)/2,r=2*Math.PI;n._svg=t;let o=h.arc().innerRadius(.5*i).outerRadius(.9*i).startAngle(0);n._svg.append("path").classed("spinner",!0).datum({endAngle:.66*r}).style("fill","rgb(0,113,197)").attr("d",o).call((function t(e,i){e.transition().ease(h.easeLinear).duration(i).attrTween("transform",(function(){return h.interpolateString("rotate(0)","rotate(360)")})),setTimeout((function(){n._svg&&t(e,i)}),i)}),1500)}};e.Brush=class{constructor(){let t=this;t._isXY=!1,this.onBrushStart=function(e){if(t._onStartCallback){let e=h.brushSelection(this);t._onStartCallback.call(this,e)}},this.onBrushMove=function(e){if(t._onMoveCallback){let e=h.brushSelection(this);t._onMoveCallback.call(this,e)}},this.onBrushEnd=function(e){if(t._onEndCallback){let e=h.brushSelection(this);t._onEndCallback.call(this,e)}}}moveToFront(){this._brushTargetGraph.each((function(){this.parentNode.appendChild(this)}))}moveToBack(){this._brushTargetGraph.each((function(){let t=this.parentNode.firstChild;t&&this.parentNode.insertBefore(this,t)}))}enableCallbacks(){return this._brush.on("start",this.onBrushStart).on("brush",this.onBrushMove).on("end",this.onBrushEnd),this}disableCallbacks(){return this._brush.on("start",void 0).on("brush",void 0).on("end",void 0),this}brushStart(t){this._brushTargetGraph.call(this._brush.move,null)}brushMove(t){this._brushTargetGraph.call(this._brush.move,t)}brushEnd(){this._brushTargetGraph.call(this._brush.move,null)}setXY(t){return this._isXY=t,this}setTarget(t){return this._brushTargetGraph=t,this}setStartCallback(t){return this._onStartCallback=t,this}setMoveCallback(t){return this._onMoveCallback=t,this}setEndCallback(t){return this._onEndCallback=t,this}setRect(t){return this._rect=t,this}ready(){return this._isXY?this._brush=h.brush().on("start",this.onBrushStart).on("brush",this.onBrushMove).on("end",this.onBrushEnd):this._brush=h.brushX().extent([[0,0],[this._rect.width,this._rect.height]]).on("start",this.onBrushStart).on("brush",this.onBrushMove).on("end",this.onBrushEnd),this._brushTargetGraph.call(this._brush),this}static releaseListeners(t){t.on("brush",null).on("brushend",null).on("brushstart",null)}};e.D3Legend=class{constructor(t,e,n,i){if(this._title=n||"",this._legend=e,this._itemMap={},this._items=[],e.definition){let t=[];for(let n=0;n<e.definition.items.length;++n){let i=e.definition.items[n];t.push({key:i.key,name:i.name?i.name:i.key,color:i.color,shape:this.getShapeString(i.shape),opacity:""})}this.addItems(t)}let o="ordinal";this._legend.definition&&this._legend.definition.type===r.LegendType.Gradient&&(o="gradient"),this._classes=`legend ${o} ${this._title} align-${this._legend.alignment}`,this._legendSvg=t.append("g").classed(this._classes,!0),this.setPosition(i)}getShapeString(t){if("string"==typeof t)return t;switch(t){case r.LegendItemShape.Rectangle:return"rect";case r.LegendItemShape.Line:return"line";case r.LegendItemShape.Circle:return"circle"}}setPosition(t){this._position=t}getPosition(){return this._position}setItems(t){this._items=[],this._itemMap={},this.addItems(t)}addItems(t){for(let e=0;e<t.length;++e){let n=t[e];this._itemMap.hasOwnProperty(n.key)?(this._itemMap[n.key].color=n.color,this._itemMap[n.key].opacity=n.opacity):(n.name||(n.name=n.key,this._legend.showValue&&void 0!==n.value&&(n.name+=": "+n.value,void 0!==n.units&&(n.name+=n.units))),this._itemMap[n.key]=n,this._items.push(n))}}getAlignment(){return this._legend.alignment}getRenderedRect(){return this._renderedRect}getRows(){return this._legend.orientation===r.LegendOrientation.Vertical?this._items.length:this._legendSvg.selectAll(".legendCells").size()}renderDiscreteLegend(t){let e=[],n=[];for(let t=0;t<this._items.length;++t){this._items[t].name;let i=this._items[t].color,r=this._items[t].opacity;r&&i.startsWith("rgb")&&(i="rgba"+i.substr(3,i.length-4)+" , "+r+")"),e.push(this._items[t].name),n.push(i)}let i=2,a=0,l=this,c=function(e,n,a){let c=h.scaleOrdinal().domain(n).range(a),u=s.legendColor();u.on("cellover",(function(t){this.setAttribute("title",t)})).orient(t).labelPosition("right").shape("rect").shapeWidth(10).shapeHeight(10).shapePadding(i).scale(c),l._legend.onClick&&u.on("cellclick",(function(t){l._legend.onClick({event:r.EventType.Click,data:t})})),l._legend.contextMenuItems&&u.on("cellcontextmenu",(function(t){o.showContextMenu(h.event,t,l._legend.contextMenuItems)})),e.call(u)};c(this._legendSvg,e,n);let u=this._position.x;if((this._legend.alignment===r.Alignment.Top||this._legend.alignment===r.Alignment.Bottom)&&this._legend.orientation!==r.LegendOrientation.Vertical){i=0;this._legendSvg.select(".legendCells").selectAll(".cell").each((function(){let t=this.getBBox();i=Math.max(i,t.width)}));a=i+10,this._legendSvg.selectAll("*").remove();let t=Math.max(1,Math.min(e.length,Math.floor(this._position.width/a)));Math.ceil(e.length/t),u=this._position.x+this._position.width/2-a*t/2;let r=0;for(let i=0;i<e.length;i+=t){let o=this._legendSvg.append("g").classed(this._classes,!0);c(o,e.slice(i,i+t),n.slice(i,i+t)),r&&o.attr("transform","translate(0,"+r+")"),r+=o.node().getBoundingClientRect().height}}u=Math.max(0,u),this._legendSvg.attr("transform","translate("+u+","+this._position.y+")")}renderGradientLegend(){this._legendSvg.selectAll("*").remove();let t=this._legend.definition.items,e=i.getSelectionName(`${this._title}align-${this._legend.alignment}`),n=this._legendSvg.append("linearGradient").attr("id",e).attr("x1","0%").attr("y1","0%");t.forEach(t=>{n.append("stop").attr("offset",`${t.key}%`).attr("style",`stop-color:${t.color};stop-opacity:${t.opacity}`)});let o,a=h.scaleLinear().domain(h.extent(t,t=>Number(t.key))),s=this._legendSvg.append("rect"),l=this._legendSvg.append("g");switch(this._legend.alignment){case r.Alignment.Left:n.attr("x2","0%").attr("y2","100%"),s.attr("x",30).attr("width",40).attr("y",0).attr("height",this._position.height),a.range([0,this._position.height]),l.attr("transform","translate(30, 0)"),o=h.axisLeft(a);break;case r.Alignment.Right:n.attr("x2","0%").attr("y2","100%"),s.attr("x",5).attr("width",40).attr("y",0).attr("height",this._position.height),a.range([0,this._position.height]),l.attr("transform","translate(45, 0)"),o=h.axisRight(a);break;case r.Alignment.Top:n.attr("x2","100%").attr("y2","0%"),s.attr("x",0).attr("width",this._position.width).attr("y",10).attr("height",40),a.range([0,this._position.width]),l.attr("transform","translate(0, 10)"),o=h.axisTop(a);break;case r.Alignment.Bottom:n.attr("x2","100%").attr("y2","0%"),s.attr("x",0).attr("width",this._position.width).attr("y",5).attr("height",40),a.range([0,this._position.width]),l.attr("transform","translate(0, 45)"),o=h.axisBottom(a)}s.attr("fill",`url(#${e})`),l.call(o),this._legendSvg.attr("transform","translate("+this._position.x+","+this._position.y+")")}render(){let t;if(t=this._legend.orientation===r.LegendOrientation.Vertical?"vertical":this._legend.orientation===r.LegendOrientation.Horizontal?"horizontal":this._legend.alignment===r.Alignment.Left||this._legend.alignment===r.Alignment.Right?"vertical":"horizontal",this._legendSvg.selectAll("*").remove(),this._legend.definition&&this._legend.definition.type&&this._legend.definition.type===r.LegendType.Gradient){this.renderGradientLegend();let t=this._legendSvg.node().getBoundingClientRect();this._renderedRect=new r.Rect(t.left,t.top,t.right-t.left+40,t.bottom-t.top)}else{this.renderDiscreteLegend(t);let e=this._legendSvg.node().getBoundingClientRect();this._renderedRect=new r.Rect(e.left,e.top,e.right-e.left,e.bottom-e.top)}}};class v extends l.UIElementRenderer{constructor(){super(),this.MIN_MARGIN={TOP:0,BOTTOM:10,LEFT:0,RIGHT:10},this.LEGEND_PADDING={X:10,Y:{TOP:10,BOTTOM:10}},this.AXIS_PADDING={X:10,Y:{TOP:10,BOTTOM:10}},this._fillColors=new WeakMap,this._strokeColors=new WeakMap;let t=this;this._options={},this._minSvgWidth=0,this._maxGraphWidth=Number.MAX_VALUE,this._maxSvgWidth=Number.MAX_VALUE,this._interactionState=new a.InteractionState((function(e){t._focus(e)}),(function(e){t._unfocus(e)}),!1,(function(e){t._select(e)}),(function(e){t._unselect(e)}))}cursorChange(t){}zoom(t){}brush(t){}render(t){}configureTooltip(){}createLayout(){}setColorManager(t){this._colorMgr=t}initialize(t,e,n){this._element=t,this._renderer=e,this._tooltipId="d3-tooltip",this._tooltipAnalyticsName="d3-ui-widget-toolkit",this._parent=n;let i=n.node();i&&(this._options.width||(this._options.width=i.getBoundingClientRect().width),this._svgRect=new r.Rect(0,0,this._options.width,0),this._svg=n.append("svg")),this._handleWidth=10,this._graphRect=new r.Rect(0,0,0,this.DEFAULT_GRAPH_HEIGHT),this._requiresRelayout=!0}loadOptions(t){void 0!==t&&(t.width&&t.width!==this._options.width&&(this._requiresRelayout=!0),t.height&&t.height!==this._options.height&&(this._requiresRelayout=!0),t.topMargin&&t.topMargin!==this._options.topMargin&&(this._requiresRelayout=!0),t.bottomMargin&&t.bottomMargin!==this._options.bottomMargin&&(this._requiresRelayout=!0),t.leftMargin&&t.leftMargin!==this._options.leftMargin&&(this._requiresRelayout=!0),t.rightMargin&&t.rightMargin!==this._options.rightMargin&&(this._requiresRelayout=!0),i.merge(this._options,t))}getElement(){return this._element}getOptions(){return this._options}getAnimateDuration(){return void 0!==this._options.animateDuration?this._options.animateDuration:1e3}getRenderedCss(){return new r.Css}getTooltipData(t){return[{source:this._element,group:"",metrics:{}}]}hover(t){this.focus(t)}focus(t){this._interactionState.focus(t)}select(t){this._interactionState.select(t)}_focus(t){let e=this;t&&e._svg.selectAll("."+t).each((function(){u(h.select(this),e._fillColors,e._strokeColors)}))}_unfocus(t){let e=this;t.length>0&&e._svg.selectAll("."+t).each((function(){d(h.select(this),e._fillColors,e._strokeColors)}))}_select(t){let e=this;t&&e._svg.selectAll("."+t).each((function(){g(h.select(this),e._fillColors,e._strokeColors)}))}_unselect(t){let e=this;t.length>0&&e._svg.selectAll("."+t).each((function(){p(h.select(this),e._fillColors,e._strokeColors)}))}invalidate(t){this.loadOptions(t),this.createLayout(),t.disableResize||this.createHandles(),this.configureTooltip(),this.render(t)}updateHandles(){this._svg.select(".chart-handle.bottom").attr("x",this._graphRect.x).attr("y",this._graphRect.y+this._graphRect.height).attr("width",this._graphRect.width),this._svg.select(".chart-handle.left").attr("x",this._graphRect.x-this._handleWidth-1).attr("y",this._graphRect.y).attr("height",this._graphRect.height),this._svg.select(".chart-handle.right").attr("x",this._graphRect.x+this._graphRect.width+1).attr("y",this._graphRect.y).attr("height",this._graphRect.height)}createHandles(){let t=this;t._options.disableResizeLeft||t._svg.append("rect").attr("opacity",0).attr("width",t._handleWidth).attr("cursor","ew-resize").classed("chart-handle vertical left",!0).call(h.drag().on("start",(function(){v.IS_RESIZING=!0})).on("drag",(function(){if(0===h.event.dx)return;let e=Math.min(t._options.leftMargin+t._graphRect.width,Math.max(t.MIN_MARGIN.LEFT,t._options.leftMargin+h.event.dx)),n={width:t._svg.node().getBoundingClientRect().width,leftMargin:e,xStart:t._options.xStart,xEnd:t._options.xEnd,animateDuration:0};t._element.handleUpdate?t._element.handleUpdate(t._element,n):t.render(n)})).on("end",(function(){v.IS_RESIZING=!1}))),t._options.disableResizeRight||t._svg.append("rect").attr("opacity",0).attr("width",t._handleWidth).attr("cursor","ew-resize").classed("chart-handle vertical right",!0).call(h.drag().on("start",(function(){v.IS_RESIZING=!0})).on("drag",(function(){if(0===h.event.dx)return;t._svg.node();let e=t._options.width+h.event.dx;e=Math.max(t._minSvgWidth,e),e=Math.min(t._maxSvgWidth,e);let n={width:e,xStart:t._options.xStart,xEnd:t._options.xEnd,animateDuration:0};t._element.handleUpdate?t._element.handleUpdate(t._element,n):t.render(n)})).on("end",(function(){v.IS_RESIZING=!1})))}createImage(){let t=this;return new Promise((function(e,n){let i=t._svg,r=Number(i.attr("width")),o=Number(i.attr("height")),a=function(t){t.setAttribute("xlink","http://www.w3.org/1999/xlink"),function(t,e){let n=document.createElement("style");n.setAttribute("type","text/css"),n.innerHTML=t;let i=e.hasChildNodes()?e.children[0]:null;e.insertBefore(n,i)}(function(t){let e=[];e.push("#"+t.id);for(let n=0;n<t.classList.length;n++)r("."+t.classList[n],e)||e.push("."+t.classList[n]);let n=t.getElementsByTagName("*");for(let t=0;t<n.length;t++){let i=n[t].id;r("#"+i,e)||e.push("#"+i);let o=n[t].classList;for(let t=0;t<o.length;t++)r("."+o[t],e)||e.push("."+o[t])}let i="";for(let t=0;t<document.styleSheets.length;t++){let n=document.styleSheets[t];try{if(!n.cssRules)continue}catch(t){if("SecurityError"!==t.name)throw t;continue}let o=n.cssRules;for(let t=0;t<o.length;t++)r(o[t].selectorText,e)&&(i+=o[t].cssText)}return i;function r(t,e){return-1!==e.indexOf(t)}}(t),t);let e=(new XMLSerializer).serializeToString(t);return e=e.replace(/(\w+)?:?xlink=/g,"xmlns:xlink="),e=e.replace(/NS\d+:href/g,"xlink:href"),e}(i.node()),s="data:image/svg+xml;base64,"+btoa(a),l=new Image;l.src=s,l.onload=function(){let t=document.createElement("canvas");t.height=o,t.width=r,t.getContext("2d").drawImage(l,0,0,r,o);let n=t.toDataURL("image/png");e({image:n,type:"image/png",height:o,width:r})}}))}saveImage(){this.createImage().then((function(t){let e=`<img src="${t.image}" height="${t.height}" width="${t.width}">`;h.select("#pngdataurl").html(e);let n=document.createElement("a");n.download="chart.png",n.href=t.image,n.click()}))}}e.SVGRenderer=v},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=n(0),r=n(8),o=n(2);let a,s={};"undefined"!=typeof document&&(a=document.createElement("canvas").getContext("2d")),e.getTextWidth=function(t,e,n){return a.font=n+"px "+e,a.measureText(t).width};e.UIElementRenderer=class{getOptions(){return this._options}getColorManager(){return this._colorMgr}setColorManager(t){this._colorMgr=t}};class l{constructor(t,e=new r.ColorManager){t&&(this._parentId=t,this._parent=o.select("body").select(t)),e&&(this._colorMgr=e),this._rendererMap=new WeakMap}static register(t,e){s[t]=e}setOnRenderCallback(t){this.onRender=t}clearDiv(t){if(t)for(;t.firstChild;)t.removeChild(t.firstChild)}setDiv(t){this._parent=o.select(t)}getRenderedCss(t){return this._rendererMap.has(t)?this._rendererMap.get(t).getRenderedCss():new i.Css}hover(t,e){this.focus(t,e)}focus(t,e){if(this._rendererMap.has(t))return this._rendererMap.get(t).focus||this._rendererMap.get(t).hover(e),this._rendererMap.get(t).focus(e)}select(t,e){this._rendererMap.has(t)&&this._rendererMap.get(t).select(e)}zoom(t,e){this._rendererMap.has(t)&&this._rendererMap.get(t).zoom(e)}getTooltipData(t,e){return this._rendererMap.has(t)?this._rendererMap.get(t).getTooltipData(e):[{source:t,group:"",metrics:{}}]}cursorChange(t,e){if(this._rendererMap.has(t))return this._rendererMap.get(t).cursorChange(e)}brush(t,e){if(this._rendererMap.has(t))return this._rendererMap.get(t).brush(e)}configureElement(t){if(t.renderer=this,!this._rendererMap.has(t)){this._parent.node()||(this._parent=o.select(this._parentId));let e=s[t.type];if(e){let n=new e(t,this,this._parent);n.setColorManager(this._colorMgr),this._rendererMap.set(t,n)}}}render(t,e={}){t.renderer=this,this.configureElement(t),this._rendererMap.has(t)&&(this._rendererMap.get(t).render(e),t.onRender&&t.onRender(e),this.onRender&&this.onRender(t,e))}invalidate(t,e={}){t.renderer=this,this.configureElement(t),this._rendererMap.has(t)&&(this._rendererMap.get(t).invalidate(e),t.onRender&&t.onRender(e),this.onRender&&this.onRender(t,e))}setColorManager(t){this._colorMgr=t}getColorManager(){return this._colorMgr}destroy(t){this._rendererMap.delete(t)}getOptions(t){if(this._rendererMap.has(t))return this._rendererMap.get(t).getOptions()}}e.D3Renderer=l,e.D3ChartRenderer=l,e.D3GraphRenderer=l},,,function(t,e,n){"use strict";function i(t,e,n,a,s){let l;if(l=document.createElement("div"),l.setAttribute("class","context-menu"),l.oncontextmenu=function(t){o(),t.preventDefault()},document.body.appendChild(l),n.length>0){let h=document.createElement("ul");l.appendChild(h);for(let a=0;a<n.length;++a){let l=n[a],c=document.createElement("li");l.divider?(c.className+=" is-divider",c.innerHTML="<hr>"):(l.title||console.error("No title attribute set. Check the spelling of your options."),l.disabled&&(c.className+=" is-disabled"),l.action||l.submenu||(c.className+=" is-header"),l.submenu?c.innerHTML=`<span><text>${l.title}</text>`+'<text style="width: 5px; float: right; color: #000000A0">►</text></span>':c.innerHTML=l.title,c.onclick=function(t){l.disabled||l.action&&(l.action(c,e,a),o())},c.onmouseenter=function(){if(r(n),l.submenu){let n=c.getBoundingClientRect(),r={top:n.top+window.scrollY,bottom:n.bottom+window.scrollY,left:n.left+window.scrollX,right:n.right+window.scrollX,height:n.height,width:n.width};l.submenuDiv=i(t,e,l.submenu,r,s)}}),h.appendChild(c)}l.style.display="block",function(t,e){let n=document.body.clientWidth,i=document.body.clientHeight,r=e.left,o=e.top;r=e.right+t.clientWidth<n?e.right:e.left-t.clientWidth,e.top+t.clientHeight>i&&(o=e.top-t.clientHeight),t.style.left=r-2+"px",t.style.top=o-2+"px"}(l,a),s||t.stopPropagation()}return l}function r(t){t.forEach((function(t,e,n){!function(t){t.submenuDiv&&(document.body.removeChild(t.submenuDiv),delete t.submenuDiv),t.submenu&&r(t.submenu)}(t)}))}function o(){r(a);let t=document.getElementsByClassName("context-menu");for(;t.length;)document.body.removeChild(t[0])}Object.defineProperty(e,"__esModule",{value:!0});let a=[];e.showContextMenu=function(t,e,n,r=!1){t&&(window.onkeyup=function(t){27===t.keyCode&&o()},o(),a=n,i(t,e,n,{left:t.pageX,top:t.pageY,right:t.pageX,bottom:t.pageY,height:0,width:0},r),t.preventDefault())}},function(t,e,n){"use strict";function i(t){var e=Number(t).toString(16);return 1==e.length?"0"+e:e}function r(t){let e=t.substring(t.indexOf("(")+1,t.indexOf(")")).split(",");return i(e[0])+i(e[1])+i(e[2])}Object.defineProperty(e,"__esModule",{value:!0});class o{constructor(t){this._colorMap={},this.getRandomColor=t||function(){for(var t="#",e=0;e<6;e++)t+="0123456789ABCDEF"[Math.floor(16*Math.random())];return t}}hasColor(t){return this._colorMap.hasOwnProperty(t)}setColor(t,e){0===e.indexOf("rgb")&&(e=o.RgbToHex(e)),this._colorMap[t]=e}getColor(t){return this.hasColor(t)||(this._colorMap[t]=this.getRandomColor()),this._colorMap[t]}static IntToHex(t){return"#"+t.toString(16).padStart(6,"0")}static RgbToHex(t){return"#"+r(t)}static RgbToInt(t){return parseInt(r(t),16)}}e.ColorManager=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=n(2);class r{constructor(t,e="tooltip-t"){if(document.getElementById(t)){let e=t;"#"!==t.charAt(0)&&(e="#"+t),this._tooltipDiv=document.querySelector(e)}else this._tooltipDiv=document.createElement("div"),this._tooltipDiv.style.overflow="auto",this._tooltipDiv.id=t,document.querySelector("body").appendChild(this._tooltipDiv);this._targets=[],this._analyticsName="",this._disabled=!1,this._visibilityTimeoutSecs=0,this._visibilityTimeoutCallLeaveFunction=!0,this._delayMS=r._defaultDelayMS,this._tooltipPlacementFunc=this.defaultTooltipPlacement,this._alwaysRecalcWidth=!1,this._tooltipLeftOfMouse=!0,this._lastShowTs=Date.now(),this._counter=r._counter,r._counter++,this._hide="none",this._tooltipOffset=0,this._tooltipHeight=0,this._tooltipWidth=0,this._windowWidth=0,this._windowHeight=0,this._tooltipDiv.classList.add(e),this._tooltipBackgroundColor=null,this._tooltipFontColor=null,this._tooltipFontType=null,this._tooltipFontSize=null;let n=this;this.onMouseEnter=function(t){n._disabled||(void 0===n._enterfunc||n._enterfunc.call(this,t)?(n.displayTooltip(n._delayMS),n._tooltipHeight=0,n._tooltipWidth=0,n._windowWidth=0,n._windowHeight=0):n.onMouseLeave.call(this,t))},this.onMouseLeave=function(t){if(null!=n._timerId&&window.clearTimeout(n._timerId),n._timerId=void 0,null!=n._visibilityTimerId&&window.clearTimeout(n._visibilityTimerId),void 0!==n._leavefunc){let e=!0;null===t&&(e=n._visibilityTimeoutCallLeaveFunction),e&&n._leavefunc.call(this,t)}n.hideTooltip()},this.onMouseMove=function(t,e){if(!n._disabled){if(void 0!==n._movefunc&&n._movefunc.call(this,t),n._alwaysRecalcWidth||0===n._tooltipWidth){n._tooltipWidth=n._tooltipDiv.offsetWidth;let t=n._tooltipDiv.offsetHeight,e=parseInt(n._tooltipDiv.style.marginTop),i=parseInt(n._tooltipDiv.style.marginBottom);e&&(t+=e),i&&(t+=i),n._tooltipHeight=t}0==n._windowWidth&&(n._windowWidth=window.innerWidth,n._windowHeight=window.innerHeight),e&&e.clientY||(e=i.event.clientY?i.event:i.event.sourceEvent),n._tooltipPlacementFunc(e)}}}adjustVerticalPosition(t,e){(t-=this._tooltipHeight/2)<window.pageYOffset&&(t=window.pageYOffset),(e=t+this._tooltipHeight)>this._windowHeight+window.pageYOffset&&(t-=e-(this._windowHeight+window.pageYOffset)),t<0&&(t=0),this._tooltipDiv.style.top=t+"px"}placeTooltipLeft(t){let e,n;e=window.pageYOffset+t.clientY,n=window.pageXOffset+t.clientX,n-=this._tooltipWidth+10,n<window.pageXOffset&&(n=window.pageXOffset),this._tooltipDiv.style.left=n+"px",this.adjustVerticalPosition(e,void 0)}placeTooltipLeftRight(t){let e,n;e=window.pageYOffset+t.clientY,n=window.pageXOffset+t.clientX,n<this._windowWidth/3&&(this._tooltipLeftOfMouse=!1),n>this._windowWidth/3*2&&(this._tooltipLeftOfMouse=!0),this._tooltipLeftOfMouse?n-=this._tooltipWidth+10:n+=10,n<window.pageXOffset&&(n=window.pageXOffset),this._tooltipDiv.style.left=n+"px",this.adjustVerticalPosition(e,void 0)}defaultTooltipPlacement(t){let e,n,i,r;if(e=window.pageYOffset+t.clientY,r=window.pageXOffset+t.clientX,t.y<this._windowHeight/2){if(e+=20+this._tooltipOffset,n=e+this._tooltipHeight,n<this._windowHeight+window.pageYOffset)return r-=this._tooltipWidth/2,i=r+this._tooltipWidth,i>this._windowWidth&&(r-=i-this._windowWidth),r<window.pageXOffset&&(r=window.pageXOffset),this._tooltipDiv.style.left=r+"px",void this.adjustVerticalPosition(e,n)}else if(e-=this._tooltipHeight+10+this._tooltipOffset,e>=window.pageYOffset)return r-=this._tooltipWidth/2,i=r+this._tooltipWidth,i>this._windowWidth&&(r-=i-this._windowWidth),r<window.pageXOffset&&(r=window.pageXOffset),this._tooltipDiv.style.left=r+"px",void this.adjustVerticalPosition(e,n);t.clientX>this._windowWidth/2?(r-=this._tooltipWidth+10,r<window.pageXOffset&&(r=window.pageXOffset)):(r+=10,i=r+this._tooltipWidth,i>this._windowWidth&&(r-=i-this._windowWidth)),this._tooltipDiv.style.left=r+"px",this.adjustVerticalPosition(e,n)}setOffset(t){return this._tooltipOffset=t,this}setEnabled(t){return this._disabled=!t,this}setHideDisplayValue(t){return this._hide=t,this}setDelay(t){return this._delayMS=t,this}setPlaceTooltipLeft(){return this._tooltipPlacementFunc=this.placeTooltipLeft,this}setPlaceTooltipLeftRight(){return this._tooltipPlacementFunc=this.placeTooltipLeftRight,this}releaseListeners(){this._targets.forEach(t=>{t.on("mouseenter.tooltip",null).on("mouseleave.tooltip",null).on("mousemove.tooltip",null)}),this._targets=[]}setVisibilityTimeout(t,e=!0){return this._visibilityTimeoutSecs=t,this._visibilityTimeoutCallLeaveFunction=e,this}alwaysRecalcWidth(t){return this._alwaysRecalcWidth=t,this}setBackgroundColor(t){return this._tooltipBackgroundColor=t,this._tooltipDiv.style["background-color"]=this._tooltipBackgroundColor,this}setFontColor(t){return this._tooltipFontColor=t,this._tooltipDiv.style.color=this._tooltipFontColor,this}setFontType(t){return this._tooltipFontType=t,this._tooltipDiv.style.font=this._tooltipFontType,this}setFontSize(t){return this._tooltipFontSize=t,this._tooltipDiv.style.font=this._tooltipFontSize,this}setAnalyticsName(t){return this._analyticsName=t,this}setCssClass(t){return this._tooltipDiv.classList.add(t),this}setTarget(t){return t&&(t.on("mouseenter.tooltip",this.onMouseEnter).on("mouseleave.tooltip",this.onMouseLeave).on("mousemove.tooltip",this.onMouseMove),this._targets.push(t)),this}setEnterCallback(t){return this._enterfunc=t,this}setLeaveCallback(t){return this._leavefunc=t,this}setMoveCallback(t){return this._movefunc=t,this}displayTooltip(t){if(this._disabled)return this;let e=this;return 0===t?(n(),this):void 0!==this._timerId?this:(this._timerId=window.setTimeout(n,t),this);function n(){e._disabled||(e._tooltipDiv.style.display="block",e._visibilityTimeoutSecs>0&&(e._visibilityTimerId=window.setTimeout((function(){e.onMouseLeave(null)}),1e3*e._visibilityTimeoutSecs)))}}hideTooltip(){return this._timerId&&window.clearTimeout(this._timerId),this._timerId=void 0,this._tooltipDiv.style.display=this._hide,this}}e.BaseTooltip=r,r._defaultDelayMS=500,r._counter=0;e.OneLineTooltip=class extends r{constructor(t,e="tooltip-t"){super(t,e)}getTitle(){return this._title}setData(t,e){for(;this._tooltipDiv.hasChildNodes();)this._tooltipDiv.removeChild(this._tooltipDiv.lastChild);this._title=t;let n=document.createElement("table");n.classList.add("tooltip-table"),this._tooltipDiv.appendChild(n);let i=document.createElement("tr");n.appendChild(i);let r=document.createElement("td");r.classList.add("tooltip-title"),r.setAttribute("colspan","2"),r.textContent=t,i.appendChild(r),null!=e&&(i=document.createElement("tr"),n.appendChild(i),r=document.createElement("td"),r.setAttribute("colspan","2"),r.textContent=e,i.appendChild(r))}};class o extends r{constructor(t,e="tooltip-t"){super(t,e)}getTitle(){return this._title}setData(t,e){for(;this._tooltipDiv.hasChildNodes();)this._tooltipDiv.removeChild(this._tooltipDiv.lastChild);this._title=t;let n=document.createElement("table");n.classList.add("tooltip-table"),this._tooltipDiv.appendChild(n);let i=document.createElement("tr");n.appendChild(i);let r=document.createElement("td");r.classList.add("tooltip-title"),r.setAttribute("colspan","2"),r.textContent=t,i.appendChild(r);let o=!1;if(e.length>0){let t=e[0].source;for(let n=1;n<e.length;++n)e[n].source!==t&&(o=!0)}for(let t=0;t<e.length;++t){let i=e[t];if(Object.keys(i.metrics).length>0){let t=i.source;if(t&&t.title&&o){let e=document.createElement("tr");n.appendChild(e);let i=document.createElement("td");i.classList.add("tooltip-group-title"),i.setAttribute("colspan","2"),i.textContent=t.title,e.appendChild(i)}if(i.group&&i.group.length>0){let t=document.createElement("tr");n.appendChild(t);let e=document.createElement("td");e.classList.add("tooltip-group-title"),e.setAttribute("colspan","2"),e.textContent=i.group,t.appendChild(e)}for(let t in i.metrics){let e=document.createElement("tr");n.appendChild(e);let r=document.createElement("td");r.classList.add("tooltip-metric-name"),r.textContent=t,e.appendChild(r),r=document.createElement("td"),r.classList.add("tooltip-metric-value"),r.textContent=i.metrics[t],e.appendChild(r)}}}}}e.MetricListTooltip=o;e.CustomDivTooltip=class extends o{constructor(t,e="tooltip-t"){super(t,e)}clearTooltip(){for(;this._tooltipDiv.hasChildNodes();)this._tooltipDiv.removeChild(this._tooltipDiv.lastChild)}getTooltipDiv(){return this._tooltipDiv}}},function(t,n){t.exports=e},,,function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=n(1),r=n(0);var o;!function(t){t[t.Tooltip=0]="Tooltip",t[t.Highlight=1]="Highlight",t[t.Render=2]="Render",t[t.Focus=3]="Focus",t[t.Select=4]="Select",t[t.None=5]="None"}(o||(o={}));class a{constructor(){this._nameMap={},this._objectMap=new Map}}function s(t){t.getTooltip||(t.getTooltip=function(e){return t.renderer&&t.renderer.getTooltipData?t.renderer.getTooltipData(t,e):[{source:t,group:"",metrics:{}}]})}function l(t){t.api||(t.api={}),t.api.select||(t.api.select=function(e){if(t.renderer&&t.renderer.select)return t.renderer.select(t,e)})}function h(t){t.api||(t.api={}),t.api.cursorChange||(t.api.cursorChange=function(e){if(t.renderer&&t.renderer.cursorChange)return t.renderer.cursorChange(t,e)}),t.api.focus||(t.api.focus=function(e){return t.renderer&&!t.renderer.focus&&t.renderer.hover?t.renderer.hover(t,e):t.renderer&&t.renderer.focus?t.renderer.focus(t,e):void 0},t.api.hover=t.api.focus),t.api.brush||(t.api.brush=function(e){if(t.renderer&&t.renderer.brush)return t.renderer.brush(t,e)}),t.api.zoom||(t.api.zoom=function(e){if(t.renderer&&t.renderer.zoom)return t.renderer.zoom(t,e)})}function c(t){t.api||(t.api={}),t.api.brush||(t.api.brush=function(e){if(t.renderer&&t.renderer.brush)return t.renderer.brush(t,e)}),t.api.render||(t.api.render=function(e,n){return e?t.renderer=e:e=t.renderer,new Promise((function(i,r){e&&(t.renderer.render(t,n),i("Ok")),r("No renderer available")}))})}function u(t){s(t),h(t),l(t),c(t)}e.GroupInfo=a,e.addCallbacks=u;e.ElementManager=class{constructor(){this._elems=[];let t=this;this._groupInfo=[];for(let t=0;t<5;++t)this._groupInfo.push(new a);this._onHoverCallback=function(e){e.caller||console.warn("Warning no caller specified for this event, cannot propoate changes",e);let n=t._groupInfo[3]._objectMap.get(e.caller);if(n)if(t._hoverCallback)t._hoverCallback(n,e);else for(let t=0;t<n.length;++t){let i=n[t];e.caller!==i&&i.api&&!i.api.focus&&i.api.hover&&i.api.hover(e),e.caller!==i&&i.api&&i.api.focus&&i.api.focus(e)}};let e=function(e,n,i){return function(r){r.caller||console.warn("Warning no caller specified for this event, cannot propagate changes",r);let o=t._groupInfo[e]._objectMap.get(r.caller);if(o)if(n)n(o,r);else for(let t=0;t<o.length;++t){let e=o[t];r.caller!==e&&e.api&&e.api[i]&&e.api[i](r)}}};this._onZoomCallback=e(1,this._zoomCallback,"zoom"),this._onCursorChangeCallback=e(1,this._cursorChangeCallback,"cursorChange"),this._onBrushCallback=e(1,this._brushCallback,"brush"),this._onClickCallback=e(4,this._clickCallback,"select"),this._onTooltipCallback=function(e){e.caller||console.warn("Warning no caller specified for this event, cannot propoate changes",e);let n=[],i=t._groupInfo[0]._objectMap.get(e.caller);if(i){if(t._tooltipCallback)n=n.concat(t._tooltipCallback(i,e));else for(let t=0;t<i.length;++t){let r=i[t].getTooltip(e);n=n.concat(r)}return e.data&&e.data.tooltip&&e.data.tooltip.setData(e.data.tooltip.getTitle(),n),n}},this._onUpdateCallback=function(e,n){e||console.warn("Warning no caller specified for this event, cannot propoate changes");let i=t._groupInfo[2]._objectMap.get(e);if(i)for(let t=0;t<i.length;++t){let e=i[t];e.renderer&&e.renderer.render(e,n)}}}removeFromGroup(t,e){let n=this._groupInfo[e]._objectMap.get(t);n&&i.removeFromList(t,n)}addToGroup(t,e,n){this._groupInfo[n]._nameMap.hasOwnProperty(e)||(this._groupInfo[n]._nameMap[e]=[]),this._groupInfo[n]._nameMap[e].push(t),this._groupInfo[n]._objectMap.set(t,this._groupInfo[n]._nameMap[e])}addElement(t,e,n,i){if(!t)return this;if(-1!==this._elems.indexOf(t))throw"Element already exists in this manager";{let r;u(t),this._elems.push(t),t.getElements||(t.getElements=function(){return[t]}),r=t.getElements();for(let t=0;t<r.length;++t){let o=r[t];e&&this.addToTooltipGroup(o,e),n&&this.addToHighlightGroup(o,n),i&&this.addToRenderGroup(o,i)}}return t.manager=this,this}removeElement(t){if(!t)return this;let e;e=t.getElements?t.getElements():[t];for(let t=0;t<e.length;++t){let n=e[t];this.removeFromTooltipGroup(n),this.removeFromHighlightGroup(n),this.removeFromRenderGroup(n)}return i.removeFromList(t,this._elems),delete t.manager,this}getElements(){return this._elems}setZoomCallback(t){return this._zoomCallback=t,this}setHoverCallback(t){return this._hoverCallback=t,this}setClickCallback(t){return this._clickCallback=t,this}setTooltipCallback(t){return this._tooltipCallback=t,this}setBrushCallback(t){return this._brushCallback=t,this}addToTooltipGroup(t,e){s(t),this.removeFromTooltipGroup(t),this.addToGroup(t,e,0);let n=this;if(t.onTooltip){let e=t.onTooltip;t.onTooltip=function(t){n._onTooltipCallback(t),e(t)}}else t.onTooltip=this._onTooltipCallback;return this}removeFromTooltipGroup(t){return this.removeFromGroup(t,0),this}addToFocusGroup(t,e){h(t),this.removeFromFocusGroup(t);let n=this;if(t.onHover){let e=t.onHover;t.onHover=function(t){n._onHoverCallback(t),e(t)}}else t.onHover=n._onHoverCallback;return this.addToGroup(t,e,3),this}removeFromFocusGroup(t){return this.removeFromGroup(t,3),this}addToSelectGroup(t,e){l(t),this.removeFromSelectGroup(t);let n=this;if(t.onClick){let e=t.onClick;t.onClick=function(t){n._onClickCallback(t),e(t)}}else t.onClick=n._onClickCallback;return this.addToGroup(t,e,4),this}removeFromSelectGroup(t){return this.removeFromGroup(t,4),this}addToHighlightGroup(t,e){h(t),this.removeFromHighlightGroup(t),this.addToFocusGroup(t,e),this.addToSelectGroup(t,e);let n=this;if(t.onBrush){let e=t.onBrush;t.onBrush=function(t){n._onBrushCallback(t),e(t)}}else t.onBrush=n._onBrushCallback;if(t.onCursorChanged){let e=t.onCursorChanged;t.onCursorChanged=function(t){n._onCursorChangeCallback(t),e(t)}}else t.onCursorChanged=this._onCursorChangeCallback;if(t.onZoom){let e=t.onZoom;t.onZoom=function(t){n._onZoomCallback(t),e(t)}}else t.onZoom=this._onZoomCallback;let o=this._groupInfo[1]._nameMap[e];if(o&&o.length){let e=o[0];if(e.api.getOptions&&t.api&&t.api.zoom){let n=e.api.getOptions(),o=i.copy(n);o.event=r.EventType.Zoom,setTimeout(()=>{t.api.zoom(o)})}}return this.addToGroup(t,e,1),this}removeFromHighlightGroup(t){return this.removeFromFocusGroup(t),this.removeFromSelectGroup(t),this.removeFromGroup(t,1),this}addToRenderGroup(t,e){c(t),this.removeFromRenderGroup(t),this.addToGroup(t,e,2);let n=this;if(t.handleUpdate){let e=t.handleUpdate;t.handleUpdate=function(t,i){n._onUpdateCallback(t,i),e(t,i)}}else t.handleUpdate=this._onUpdateCallback;return this}removeFromRenderGroup(t){return this.removeFromGroup(t,2),this}clear(){this._elems.length=0,this._groupInfo.length=0;for(let t=0;t<5;++t)this._groupInfo.push(new a)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=n(0),r=n(3),o=n(7),a=n(10);class s{constructor(t){this._graphicsMap={},this._renderer=t}add(t,e,n,i,r){let o;return t?(this._graphicsMap[t]||(this._graphicsMap[t]=this._renderer.generateTexture(r(),n,i)),o=new a.Sprite(this._graphicsMap[t])):(this._graphicsMap[e]||(this._graphicsMap[e]=this._renderer.generateTexture(r(),n,i)),o=new a.Sprite(this._graphicsMap[e])),o}}e.GraphicsManager=s;e.PIXIHelper=class{constructor(t=!0){this._selectionItems={},a.utils.skipHello(),this._renderer=t?new a.Renderer({transparent:!0,antialias:!0}):new a.CanvasRenderer({transparent:!0,antialias:!0});let e=new a.Graphics;e.beginFill(16777215),e.drawRect(0,0,1,1),e.endFill(),this._rectTexture=this._renderer.generateTexture(e,a.SCALE_MODES.LINEAR,128)}getRenderer(){return this._renderer}createGraphicsManager(){return new s(this._renderer)}addPixiSvg(t,e,n,i){let r=t.node().getElementsByClassName(e);for(let t=0;t<r.length;++t){let e=r[t];e.parentNode.removeChild(e)}let o=t.append("foreignObject").attr("class",e).attr("width",n).attr("height",i),a=o.node().appendChild(this._renderer.view),s=function(){let t=navigator.userAgent.match(/Chrom(?:e|ium)\/([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/);if(null==t||5!=t.length)return;let e=t.map(t=>parseInt(t,10));return{major:e[1],minor:e[2],build:e[3]}}();if(void 0!==s&&s.major<75){a.style.position="fixed",a.style.top=-window.scrollY+"px";let t=-window.scrollY,e=window.scrollY;document.addEventListener("scroll",(function(){t-=window.scrollY-e,a.style.top=t+"px",e=window.scrollY}))}return this._renderer.resize(n,i),o}createRectange(t,e,n){var i=new a.Sprite(this._rectTexture);return i.width=t,i.height=e,i.tint=n,i}createRectangleContainer(t,e,n,i,r){var o=new a.Container;let s=this.createRectange(n,i,r);return o.addChild(s),o.position.x=t,o.position.y=e,o}renderText(t,e,n=0,i=2,r=.5){this._useWebGLRenderer||(i=1,r=1);let o=e.style("font-size");o=Number(o.substring(0,o.length-2))*i+"px";let s=new a.Text(t,{fill:n,fontFamily:e.style("font-family"),fontSize:o,fontWeight:e.style("font-weight")});return s.scale=new a.Point(r,r),s}addInteractionHelper(t,e,n,a,s,l,h,c,u,d,g){t.interactive=!0;let p,f=this;function m(t){t.stopPropagation(),c&&c.onMouseLeave(t),o.showContextMenu(t.data.originalEvent,d,s)}(n||a)&&t.on("click",(function(t){t.stopPropagation(),a?p?(window.clearTimeout(p),p=null,a({caller:u,event:i.EventType.DoubleClick,data:d})):p=setTimeout((function(){p&&(e.disableSelection||r.onSelectHelper(u,d,g||d),n({caller:u,event:i.EventType.Click,data:d}),p=null)}),300):(e.disableSelection||r.onSelectHelper(u,d,g||d),n({caller:u,event:i.EventType.Click,data:d}))})),s&&s.length&&t.on("rightupoutside",m).on("rightup",m),l&&t.on("mouseover",(function(t){t.target&&(this.__data__=d,l.call(this),c&&(f._tooltipTarget=t.target,c.onMouseEnter(d),c.onMouseMove(d,t.data.originalEvent)))})),h&&t.on("mouseout",(function(t){h.call(this),c&&t.currentTarget===f._tooltipTarget&&c.onMouseLeave(d)}))}clearSelections(){this._selectionItems={}}addSelection(t,e){this._selectionItems.hasOwnProperty(t)||(this._selectionItems[t]=[]),this._selectionItems[t].push(e)}getSelection(t){return this._selectionItems[t]}getStage(){return this._stage}render(t){t?(this._stage=t,this._renderer.render(t)):this._stage&&this._renderer.render(this._stage)}}},,,function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=n(18);function r(){let t=window.navigator.userAgent,e=t.indexOf("MSIE ");if(e>0)return i.polyfill(),String.prototype.startsWith||(String.prototype.startsWith=function(t,e){return e=e||0,this.substr(e,t.length)===t}),parseInt(t.substring(e+5,t.indexOf(".",e)),10);if(t.indexOf("Trident/")>0){i.polyfill(),String.prototype.startsWith||(String.prototype.startsWith=function(t,e){return e=e||0,this.substr(e,t.length)===t});let e=t.indexOf("rv:");return parseInt(t.substring(e+3,t.indexOf(".",e)),10)}let n=t.indexOf("Edge/");return n>0&&parseInt(t.substring(n+5,t.indexOf(".",n)),10)}e.detectIE=r,document.addEventListener("DOMContentLoaded",(function(){r()}),!1),e.useIEPolyfill=function(t){try{new CustomEvent("test")}catch(e){let n=function(e,n){n=n||{bubbles:!1,cancelable:!1};var i=document.createEvent("MouseEvent");return i.initMouseEvent(e,n.bubbles,n.cancelable,t,0,0,0,0,0,!1,!1,!1,!1,0,null),i};n.prototype=Event.prototype,t.MouseEvent=n}}},function(t,e){t.exports=n},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=n(1),r=n(0),o=n(2);class a{constructor(t,e,n=!1,i,r){this._currFocus=[],this._currSelection=[],this._focus=t,this._unfocus=e,this._select=i,this._unselect=r,this._doBlink=n}static getFocusColor(t){let e=o.color(t),n=o.color(e).darker(2).toString();return n===e.toString()&&(e.opacity=.6*e.opacity,n=e.toString()),n}_addFocusHelper(t){let e=this;this._focus(t),e._doBlink&&(clearTimeout(this._highlightTimer),this._highlightTimer=setTimeout((function(){e._unfocusHelper(t,!0)}),500))}_unfocusHelper(t,e=!1){let n=this;this._unfocus(t),this._doBlink&&e&&(clearTimeout(this._highlightTimer),this._highlightTimer=setTimeout((function(){n._addFocusHelper(t)}),500))}_addSelectionHelper(t){let e=this;this._select(t),e._doBlink&&(clearTimeout(this._highlightTimer),this._highlightTimer=setTimeout((function(){e._removeSelectionHelper(t,!0)}),500))}_removeSelectionHelper(t,e=!1){let n=this;this._unselect(t),this._doBlink&&e&&(clearTimeout(this._highlightTimer),this._highlightTimer=setTimeout((function(){n._addSelectionHelper(t)}),500))}focus(t){if(!isNaN(Number(t.selection)))return void(void 0===t.selection?console.debug("Chart unable to fire focus event with undefined selection"):0===t.selection.length?console.debug("Chart unable to fire focus event with an empty string selection"):console.debug("Chart unable to fire focus event using a number as the selection class due to CSS limitations"));let e=i.getSelectionName(t.selection),n=this._currFocus.indexOf(e);switch(t.event){case r.EventType.SelectAdd:case r.EventType.HoverStart:case r.EventType.FocusStart:-1===n&&(this._currFocus.push(e),this._addFocusHelper(e));break;case r.EventType.SelectRemove:case r.EventType.HoverEnd:case r.EventType.FocusEnd:-1!==n&&(clearTimeout(this._highlightTimer),this._currFocus.splice(n,1),this._unfocusHelper(e));break;case r.EventType.SelectClear:case r.EventType.HoverClear:case r.EventType.FocusClear:clearTimeout(this._highlightTimer);for(let t=0;t<this._currFocus.length;++t)this._unfocusHelper(this._currFocus[t]);this._currFocus=[]}}select(t){if(!isNaN(Number(t.selection)))return void(void 0===t.selection?console.debug("Chart unable to fire focus event with undefined selection"):0===t.selection.length?console.debug("Chart unable to fire focus event with an empty string selection"):console.debug("Chart unable to fire focus event using a number as the selection class due to CSS limitations"));let e=i.getSelectionName(t.selection),n=this._currSelection.indexOf(e);switch(t.event){case r.EventType.SelectAdd:-1===n&&(this._currSelection.push(e),this._addSelectionHelper(e));break;case r.EventType.SelectRemove:-1!==n&&(clearTimeout(this._highlightTimer),this._currSelection.splice(n,1),this._removeSelectionHelper(e));break;case r.EventType.SelectClear:clearTimeout(this._highlightTimer);for(let t=0;t<this._currSelection.length;++t)this._removeSelectionHelper(this._currSelection[t]);this._currSelection=[]}}onRedraw(){this._currFocus.forEach(t=>{this._addFocusHelper(t)}),this._currSelection.forEach(t=>{this._addSelectionHelper(t)})}}e.InteractionState=a,e.SelectionHelper=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=n(0),r=n(26),o=n(7),a=n(19),s=n(1),l=n(9),h=n(4),c=n(3),u=n(14),d=n(2),g=n(10);class p{static addNode(t,e,n){return n.hasOwnProperty(t.key)?n[t.key]:(t.node=e.length,n[t.key]=t.node,e.push(t),t.node)}initializeGraph(t){t.nodes||(t.nodes=[]);let e={};for(let n=0;n<t.nodes.length;++n){let i=t.nodes[n];i.node=n,e[i.key]=n}for(let n=0;n<t.links.length;++n){let i=t.links[n];i.source=this.getLinkNode(i.from,t.nodes,e),i.target=this.getLinkNode(i.to,t.nodes,e)}}bind(t,e,n,r){let a,s=this;this.getSelectionString=n||(t=>t.source.key+"-"+t.target.key),this.getTooltipString=r||(t=>{let e;return t.source?e=t.source.key+" → "+t.target.key+"\n"+t.value:(e=t.key+"\n",void 0!==t.value&&(e+=t.value)),e}),this.onHoverChanged=function(n){if(!c.SVGRenderer.IS_RESIZING)return t.focus(e,n),e.onHover&&e.onHover(n),!0},this.nodeHoverStart=function(){let t=this.__data__.key;return a=t,s.onHoverChanged({caller:e,event:i.EventType.HoverStart,data:this.__data__,selection:t})},this.linkHoverStart=function(){let t=s.getSelectionString(this.__data__);return a=t,s.onHoverChanged({caller:e,event:i.EventType.HoverStart,data:this.__data__,selection:t})},this.hoverEnd=function(){let t=s.onHoverChanged({caller:e,event:i.EventType.HoverEnd,data:this.__data__,selection:a});return a=void 0,t},this.getTooltipData=function(t){let e=t.data.data;return e&&this._dataTooltip.setData(s.getTooltipString(e),[]),[]};let h=t=>{t.def&&(t=t.def);let n={tooltip:s._dataTooltip,data:t};return e.onTooltip?e.onTooltip({caller:e,data:n}):this.getTooltipData({caller:e,data:n}),!0};this._dataTooltip=new l.CustomDivTooltip(this._tooltipId,"tooltip-t"),this._dataTooltip.setAnalyticsName(this._tooltipAnalyticsName).setEnterCallback(h).setMoveCallback(h).setPlaceTooltipLeftRight().alwaysRecalcWidth(!0).setDelay(0),this.getLinkNode=(t,e,n)=>"string"==typeof t||t instanceof String?p.addNode({key:t},e,n):p.addNode(t,e,n),this.getNextXY=(t,e,n,r)=>{switch(e){case i.Alignment.Bottom:case i.Alignment.Top:return n.x<r.x?{x:t.x+t.width+10,y:n.y}:{x:t.x-10,y:n.y};case i.Alignment.Left:case i.Alignment.Right:return n.y<r.y?{x:n.x,y:t.y+t.height+10}:{x:n.x,y:t.y-10}}},this.addElbow=(t,e,n,r)=>{let o=e.source.node.from===e.source.node.to,a=0;switch(e.target.alignment){case i.Alignment.Bottom:a=o?(n.y+r.y)/2:(n.y-r.y)*Math.random()+r.y,t.push({x:n.x,y:a}),t.push({x:r.x,y:a});break;case i.Alignment.Top:a=o?(n.y+r.y)/2:(r.y-n.y)*Math.random()+n.y,t.push({x:n.x,y:a}),t.push({x:r.x,y:a});break;case i.Alignment.Left:a=o?(n.x+r.x)/2:(r.x-n.x)*Math.random()+n.x,t.push({x:a,y:n.y}),t.push({x:a,y:r.y});break;case i.Alignment.Right:a=o?(n.x+r.x)/2:(n.x-r.x)*Math.random()+n.x,t.push({x:a,y:n.y}),t.push({x:a,y:r.y})}},this.getElbowLinkPath=(t,e,n)=>{let r=this,o=[],a=t.source.alignment===i.Alignment.Left&&t.target.alignment===i.Alignment.Right||t.source.alignment===i.Alignment.Right&&t.target.alignment===i.Alignment.Left||t.source.alignment===i.Alignment.Top&&t.target.alignment===i.Alignment.Bottom||t.source.alignment===i.Alignment.Bottom&&t.target.alignment===i.Alignment.Top;if(a)switch(t.source.alignment){case i.Alignment.Left:n.x>e.x&&(a=!1);break;case i.Alignment.Right:n.x<e.x&&(a=!1);break;case i.Alignment.Top:n.y>e.y&&(a=!1);break;case i.Alignment.Bottom:n.y<e.y&&(a=!1)}if(a)switch(t.target.alignment){case i.Alignment.Left:n.x<e.x&&(a=!1);break;case i.Alignment.Right:n.x>e.x&&(a=!1);break;case i.Alignment.Top:n.y<e.y&&(a=!1);break;case i.Alignment.Bottom:n.y>e.y&&(a=!1)}if(a)o.push(e),this.addElbow(o,t,e,n),o.push(n);else{let i,a;o.push(e);t.source.node;i=r.getNextXY(_(r._graphContainer,t.source.node),t.source.alignment,e,n),o.push(i),a=r.getNextXY(_(r._graphContainer,t.target.node),t.target.alignment,n,e),this.addElbow(o,t,i,a),o.push(a),o.push(n)}return o},this.configureZoom=(t,e,n,i)=>{if(this._options.disableZoomViewUpdate)return;let r=this,o=t[1]-t[0],a=e[1]-e[0],s=o/2+t[0],l=a/2+e[0],h=n/a,c=i/o,u=Math.min(1,h,c);if(r._zoom.scaleExtent([u/3,1.5]),r._options.fitToWindow){let t=d.zoomIdentity.translate(i/2-s*u,n/2-l*u).scale(u);r._graphContainer.call(r._zoom.transform,t)}r._contextMenuItems.push({title:"Reset Graph",action(t,e,o){if(r._options.fitToWindow){let t=d.zoomIdentity.translate(i/2-s*u,n/2-l*u).scale(u);r._graphContainer.transition().duration(r.getAnimateDuration()).call(r._zoom.transform,t)}else r._graphContainer.transition().duration(r.getAnimateDuration()).call(r._zoom.transform,d.zoomIdentity)}})},this.configureBrush=()=>{let t=this;function e(e,n){if(!e)return!1;let i=t._element,r={event:n,xStart:e[0][0],xEnd:e[1][0],yStart:e[0][1],yEnd:e[1][1],caller:i};return i.onBrush&&i.onBrush(r),!0}let n=function(e){null!==e&&t._brushTooltip.setData("Selection","("+e[0][0].toFixed(2)+", "+e[0][1].toFixed(2)+") - ("+e[1][0].toFixed(2)+", "+e[1][1].toFixed(2)+")")};t._svg.select(".brush").remove(),t._brushTooltip=new l.OneLineTooltip("brush","tooltip-t"),t._brushTooltip.setPlaceTooltipLeftRight().alwaysRecalcWidth(!0).setDelay(0),t._brush=(new c.Brush).setXY(!0).setTarget(t._svg.append("g").attr("class","brush")).setStartCallback((function(r){return t._brush.moveToFront(),n(r),t._dataTooltip.onMouseLeave(d.event),t._brushTooltip.onMouseEnter(d.event),t._brushTooltip.onMouseMove(d.event),e(r,i.EventType.BrushStart)})).setMoveCallback((function(r){return n(r),t._dataTooltip.onMouseLeave(d.event),t._brushTooltip.onMouseMove(d.event),e(r,i.EventType.BrushMove)})).setEndCallback((function(n){t._brushTooltip.onMouseLeave(d.event);let r=t._element.brushContextMenuItems;if(n&&r){let a=[];for(let t=0;t<r.length;++t){let o=r[t];a.push({title:o.title,action(t,r,a){r.xStart=n[0][0],r.xEnd=n[1][0],r.yStart=n[0][1],r.yEnd=n[1][1],o.action(t,r,a),e(n,i.EventType.BrushEnd)}})}o.showContextMenu(d.event.sourceEvent,{event:i.EventType.BrushEnd,caller:t._element},a)}else{let t=document.getElementsByClassName("context-menu");t.length>0&&(t[0].style.display="none")}return t._options.forceBrushToFront||t._brush.moveToBack(),!0})).setRect(t._svgRect).ready(),t._brush.moveToBack()}}configureView(t,e){let n=[Number.MAX_VALUE,-Number.MAX_VALUE],i=[Number.MAX_VALUE,-Number.MAX_VALUE];if(this._element.nodes.forEach((function(t){n[0]=Math.min(n[0],t.x),n[1]=Math.max(n[1],t.x),i[0]=Math.min(i[0],t.y),i[1]=Math.max(i[1],t.y)})),t=this.renderLegend(t),this.bindZoom(),this.configureZoom(n,i,t,e),this.configureContextMenu(),this._svg&&!this._options.disableBrush){let t=this;setTimeout((function(){t.configureBrush()}),0)}}}e.ConnectedGraphBase=p;e.DiagramBase=class extends p{bind(t,e){p.prototype.bind.call(this,t,e,t=>t.source.key+"-"+t.target.key,t=>{let e;return e=t.from?t.linkType&&(t.linkType&r.LinkType.Directional)===r.LinkType.Directional?t.from+" → "+t.to+"\n":t.from+" ↔ "+t.to+"\n":t.port?t.node.key+":"+t.port.key:t.label?t.label:t.key,e})}};class f extends c.SVGRenderer{constructor(t,e,n){super(),this.initialize(t,e,n),this._graphContainer=this._svg,p.prototype.bind.call(this,e,t)}renderLegend(t){let e=this,n=e._element;if(n.legend){let r=[];for(let t=0;t<n.nodes.length;++t){let i=n.nodes[t],o=i.type&&i.type.length>0?i.type[0]:i.key,a=e._svg.select(".node."+o);r.push({key:o,color:a.style("fill"),opacity:a.style("opacity")})}let o={},a=0;for(let t=0;t<r.length;++t){let e=r[t];o.hasOwnProperty(e.key)||(o[e.key]=!0,a=Math.max(e.key.length,a))}let s,l=10;switch(n.legend.alignment){case i.Alignment.Top:s=new c.D3Legend(this._svg,n.legend,n.title,new i.Rect(0,l,this._svgRect.width,this._svgRect.height));break;case i.Alignment.Bottom:s=new c.D3Legend(this._svg,n.legend,n.title,new i.Rect(0,this._svgRect.height-this.LEGEND_PADDING.Y.BOTTOM,this._svgRect.width,this._svgRect.height));break;case i.Alignment.Left:s=new c.D3Legend(this._svg,n.legend,n.title,new i.Rect(0,l,this._svgRect.width,this._svgRect.height));break;case i.Alignment.Right:s=new c.D3Legend(this._svg,n.legend,n.title,new i.Rect(this._svgRect.width-10*a,l,this._svgRect.width,this._svgRect.height))}s.addItems(r),s.render(),t||(t=this._options.height),n.legend.alignment!==i.Alignment.Top&&n.legend.alignment!==i.Alignment.Bottom||(t+=s.getRenderedRect().height)}return t}bindZoom(){if(this._options.disableZoomViewUpdate)return;let t=this,e=t._svg.select(".graphArea");t._zoom=d.zoom().on("zoom",(function(){e.attr("transform",d.event.transform)})),t._svg.call(t._zoom),t._element.api||(t._element.api={}),t._element.api.zoom=function(e){e.data&&t._zoom.scaleTo(t._parent,e.data)},t._element.api.pan=function(e){t._zoom.translateTo(t._parent,e.xStart,e.yStart)}}configureContextMenu(){let t=this,e=t._element;if(e.contextMenuItems)for(let n=0;n<e.contextMenuItems.length;++n)t._contextMenuItems.push(e.contextMenuItems[n]);if(t.saveImage&&t._options.enableSaveAsImage){let e={title:"Save As Image",action:function(e,n,i){t.saveImage()},disabled:!1};t._contextMenuItems.push(e)}t._contextMenuItems.length>0&&t._parent.on("contextmenu",(function(e){o.showContextMenu(d.event,void 0,t._contextMenuItems)}))}initializeGraphArea(t){this.loadOptions(t),this._svg.selectAll("*").remove();let e=this._svg.append("g").classed("graphArea",!0);return this._contextMenuItems=[],e}configureLinkHover(t,e){t.on("mouseenter",this.linkHoverStart).on("mouseleave",this.hoverEnd);let n=this._element;c.addClickHelper(t,this.getOptions(),n.onClick,n.onDoubleClick,n.contextMenuItems,this._dataTooltip,n,e.def),t.node().__data__=e}initializeLinkLayer(t){t.append("g").classed("links",!0)}renderLinkHelper(t,e,n){let i=this,o=d.line().x((function(t){return t.x})).y((function(t){return t.y})),a=d.line().x((function(t){return t.x})).y((function(t){return t.y})).curve(d.curveBasis),l=t.select(".links"),h=function(t){let e=t.def.from+"-"+t.def.to+" "+t.def.from+" "+t.def.to;if(t.def.type&&t.def.type.length>0)for(let n=0;n<t.def.type.length;++n)e+=" "+s.getSelectionName(t.def.type[n]);return e},u=function(t){if(t.def.color)return t.def.color;if(t.def.type&&t.def.type.length>0)for(let e=0;e<t.def.type.length;++e)if(i._colorMgr.hasColor(t.def.type[e]))return i._colorMgr.getColor(t.def.type[e]);return"black"};n&&e.forEach((function(e){t.selectAll("."+e.def.from+"-"+e.def.to+"."+e.def.from+"."+e.def.to).remove()})),e.forEach((function(t){let e,s=t.def,d=i.getLinkStartXY(t),g=i.getLinkEndXY(t);(s.linkType&r.LinkType.Linear)===r.LinkType.Linear?t.path=[d,g]:t.path=i.getElbowLinkPath(t,d,g),e=s.linkType&r.LinkType.Curve?a:o;let p,f,m=l.append("path").attr("d",e(t.path)).classed(h(t),!0).classed("link",!0).attr("fill","none").style("stroke",u(t)).attr("stroke-width",s.width?s.width:2);(s.linkType&r.LinkType.Directional||s.linkType&r.LinkType.Bidirectional)&&(f=t.path[t.path.length-1],p=c.Arrow.createArrow(l,4).classed(h(t),!0).classed("arrow",!0).attr("fill",u(t)).attr("transform","translate("+f.x+","+f.y+") rotate( "+c.Arrow.getAngle(t.path[t.path.length-2],f)+")")),s.linkType&r.LinkType.Bidirectional&&c.Arrow.createArrow(l,4).classed(h(t),!0).classed("arrow",!0).attr("fill",u(t)).attr("transform","translate("+t.path[0].x+","+t.path[0].y+") rotate( "+c.Arrow.getAngle(t.path[1],t.path[0])+")"),n||0===i.getAnimateDuration()||(c.animatePath(m,i.getAnimateDuration()),p&&c.Arrow.animateArrow(m,p,i.getAnimateDuration())),i.configureLinkHover(m,t),i._dataTooltip.setTarget(m)}))}getHeightWidth(t){if(!t.height){let e=this._parent.node();if(e){let n=e.getBoundingClientRect();t.height=n.height,t.height||(t.height=400)}}t.width=t.width?t.width:this._parent.node().getBoundingClientRect().width}configureView(){let t=this._options.height,e=this._options.width;this._svg.attr("width",e).attr("height",t),p.prototype.configureView.call(this,t,e)}}e.D3ConnectedGraphSVG=f;class m extends h.UIElementRenderer{constructor(t,e,n){super(),this._element=t,this._renderer=e,this._options={},this._contextMenuItems=[],this._tooltipId="d3-tooltip",this._tooltipAnalyticsName="d3-ui-widget-toolkit",this._parent=n,this._graphContainer=n,p.prototype.bind.call(this,e,t)}hover(t){this.focus(t)}focus(t){this._interactionState.focus(t)}select(t){this._interactionState.select(t)}brush(t){}changeCursor(t){}getTooltipData(t){return[{source:this._element,group:"",metrics:{}}]}getAnimateDuration(){return void 0!==this._options.animateDuration?this._options.animateDuration:1e3}bindZoom(){if(this._options.disableZoomViewUpdate)return;let t=this,e=t._stage;t._zoom=d.zoom().on("zoom",(function(){e.itemDragging||(e.position.set(d.event.transform.x,d.event.transform.y),e.scale.set(d.event.transform.k,d.event.transform.k),t._pixiHelper.render())})),t._parent.call(t._zoom),t._element.api||(t._element.api={}),t._element.api.zoom=function(e){e.data&&t._zoom.scaleTo(t._parent,e.data)},t._element.api.pan=function(e){t._zoom.translateTo(t._parent,e.xStart,e.yStart)}}_focus(t){if(t){let e=this._pixiHelper.getSelection(t);e&&e.forEach((function(t){t._prevTint=t.tint,t.tint=8947848,t.alpha=136})),this._pixiHelper.render()}}_unfocus(t){let e=this._pixiHelper.getSelection(t);e&&e.forEach((function(t){t.tint=t._prevTint,t.alpha=255})),this._pixiHelper.render()}_select(t){if(t){let e=this._pixiHelper.getSelection(t);e&&e.forEach((function(t){t._prevTint=t.tint,t.tint=8947848,t.alpha=136})),this._pixiHelper.render()}}_unselect(t){let e=this._pixiHelper.getSelection(t);e&&e.forEach((function(t){t.tint=t._prevTint,t.alpha=255})),this._pixiHelper.render()}configureInteractionVisualization(){let t=this;this._interactionState=new a.InteractionState((function(e){t._focus(e)}),(function(e){t._unfocus(e)}),!1,(function(e){t._select(e)}),(function(e){t._unselect(e)}))}configureContextMenu(){let t=this,e=t._element;if(e.contextMenuItems)for(let n=0;n<e.contextMenuItems.length;++n)t._contextMenuItems.push(e.contextMenuItems[n]);t._contextMenuItems.length>0&&t._parent.on("contextmenu",(function(e){o.showContextMenu(d.event,void 0,t._contextMenuItems)}))}initializeGraphArea(t){return this._contextMenuItems=[],s.merge(this._options,t),void 0===this._pixiHelper&&(this._pixiHelper=new u.PIXIHelper(!this.getOptions().forceCanvasRenderer),this._pixi=this._pixiHelper.getRenderer(),this._parent.node().appendChild(this._pixi.view),this._stage=new g.Container,this._stage.interactive=!0,this.createArrowTexture(),this.configureInteractionVisualization()),this._stage.removeChildren(),this._stage}createArrowTexture(){let t=new g.Graphics;t.beginFill(0),t.lineStyle(0,0,0);t.moveTo(0,0),t.lineTo(9*Math.cos(1.1),9*Math.sin(1.1)),t.lineTo(-9*Math.cos(1.1),9*Math.sin(1.1)),t.lineTo(0,0),this._arrowTexture=this._pixi.generateTexture(t,g.SCALE_MODES.LINEAR,10)}createArrow(t,e,n,r,o){let a=new g.Sprite(this._arrowTexture);switch(a.anchor=new g.ObservablePoint(void 0,void 0,.5,0),a.x=e.x,a.y=e.y,a.rotation=-Math.atan2(e.x-n.x,e.y-n.y),o){case i.Alignment.Left:a.rotation+=Math.PI;break;case i.Alignment.Right:a.rotation+=-Math.PI;break;case i.Alignment.Top:a.rotation+=3*Math.PI/2;break;case i.Alignment.Bottom:a.rotation+=-Math.PI/2}t.addChild(a)}renderLinkHelper(t,e){let n=this;n._pixiLinks&&(t.removeChild(n._pixiLinks),n._pixiLinks.destroy(),t.removeChild(n._pixiArrows),n._pixiArrows.destroy()),n._pixiLinks=new g.Graphics,t.addChildAt(n._pixiLinks,0),n._pixiArrows=new g.Container,t.addChildAt(n._pixiArrows,1),e.forEach((function(t){let e=t.def;n._pixiLinks.lineStyle(2,8947848,.4);let i=n.getLinkStartXY(t),o=n.getLinkEndXY(t);if(e.linkType&r.LinkType.Linear?t.path=[i,o]:t.path=n.getElbowLinkPath(t,i,o),e.linkType&r.LinkType.Curve)n._pixiLinks.moveTo(t.path[0].x,t.path[0].y),n._pixiLinks.bezierCurveTo(t.path[1].x,t.path[1].y,t.path[t.path.length-2].x,t.path[t.path.length-2].y,t.path[t.path.length-1].x,t.path[t.path.length-1].y);else{n._pixiLinks.moveTo(t.path[0].x,t.path[0].y);for(let e=1;e<t.path.length;++e)n._pixiLinks.lineTo(t.path[e].x,t.path[e].y)}e.linkType&r.LinkType.Bidirectional&&n.createArrow(n._pixiArrows,t.path[0],t.path[1],e.linkType,t.source.alignment),(e.linkType&r.LinkType.Directional||e.linkType&r.LinkType.Bidirectional)&&n.createArrow(n._pixiArrows,t.path[t.path.length-1],t.path[t.path.length-2],e.linkType,t.target.alignment)}))}renderLegend(t){return t}getHeightWidth(t){if(!t.height){let e=this._parent.node();if(e){let n=e.getBoundingClientRect();t.height=n.height,t.height||(t.height=400)}}t.width=t.width?t.width:this._parent.node().getBoundingClientRect().width}configureView(){let t=this._options.height,e=this._options.width;this._pixi.resize(e,t),p.prototype.configureView.call(this,t,e)}}function _(t,e){return void 0===e.x&&(e.d3selection||(e.d3selection=d.select(this)),s.merge(e,c.convertToSVGCoords(t,e.d3selection))),e}e.D3ConnectedGraphPixi=m,e.getCoordsAndCache=_},,,,,,function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t[t.Linear=1]="Linear",t[t.Elbow=2]="Elbow",t[t.Directional=4]="Directional",t[t.Bidirectional=8]="Bidirectional",t[t.Curve=16]="Curve"}(e.LinkType||(e.LinkType={})),function(t){t[t.NodeSimple=0]="NodeSimple",t[t.NodeRectangle=1]="NodeRectangle"}(e.NodeType||(e.NodeType={}))},,,function(t,e,n){"use strict";function i(){}n.r(e);var r=function(t){return null==t?i:function(){return this.querySelector(t)}};function o(){return[]}var a=function(t){return new Array(t.length)};function s(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}s.prototype={constructor:s,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function l(t,e,n,i,r,o){for(var a,l=0,h=e.length,c=o.length;l<c;++l)(a=e[l])?(a.__data__=o[l],i[l]=a):n[l]=new s(t,o[l]);for(;l<h;++l)(a=e[l])&&(r[l]=a)}function h(t,e,n,i,r,o,a){var l,h,c,u={},d=e.length,g=o.length,p=new Array(d);for(l=0;l<d;++l)(h=e[l])&&(p[l]=c="$"+a.call(h,h.__data__,l,e),c in u?r[l]=h:u[c]=h);for(l=0;l<g;++l)(h=u[c="$"+a.call(t,o[l],l,o)])?(i[l]=h,h.__data__=o[l],u[c]=null):n[l]=new s(t,o[l]);for(l=0;l<d;++l)(h=e[l])&&u[p[l]]===h&&(r[l]=h)}function c(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}var u="http://www.w3.org/1999/xhtml",d={svg:"http://www.w3.org/2000/svg",xhtml:u,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},g=function(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),d.hasOwnProperty(e)?{space:d[e],local:t}:t};function p(t){return function(){this.removeAttribute(t)}}function f(t){return function(){this.removeAttributeNS(t.space,t.local)}}function m(t,e){return function(){this.setAttribute(t,e)}}function _(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function y(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function v(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}var x=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function w(t){return function(){this.style.removeProperty(t)}}function b(t,e,n){return function(){this.style.setProperty(t,e,n)}}function M(t,e,n){return function(){var i=e.apply(this,arguments);null==i?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function C(t,e){return t.style.getPropertyValue(e)||x(t).getComputedStyle(t,null).getPropertyValue(e)}function k(t){return function(){delete this[t]}}function T(t,e){return function(){this[t]=e}}function S(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function A(t){return t.trim().split(/^|\s+/)}function D(t){return t.classList||new L(t)}function L(t){this._node=t,this._names=A(t.getAttribute("class")||"")}function R(t,e){for(var n=D(t),i=-1,r=e.length;++i<r;)n.add(e[i])}function E(t,e){for(var n=D(t),i=-1,r=e.length;++i<r;)n.remove(e[i])}function N(t){return function(){R(this,t)}}function I(t){return function(){E(this,t)}}function P(t,e){return function(){(e.apply(this,arguments)?R:E)(this,t)}}L.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function H(){this.textContent=""}function O(t){return function(){this.textContent=t}}function F(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function G(){this.innerHTML=""}function B(t){return function(){this.innerHTML=t}}function z(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function U(){this.nextSibling&&this.parentNode.appendChild(this)}function W(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function V(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===u&&e.documentElement.namespaceURI===u?e.createElement(t):e.createElementNS(n,t)}}function Y(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}var j=function(t){var e=g(t);return(e.local?Y:V)(e)};function X(){return null}function $(){var t=this.parentNode;t&&t.removeChild(this)}function q(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Z(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}var J={},Q=null;"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(J={mouseenter:"mouseover",mouseleave:"mouseout"}));function K(t,e,n){return t=tt(t,e,n),function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t.call(this,e)}}function tt(t,e,n){return function(i){var r=Q;Q=i;try{t.call(this,this.__data__,e,n)}finally{Q=r}}}function et(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function nt(t){return function(){var e=this.__on;if(e){for(var n,i=0,r=-1,o=e.length;i<o;++i)n=e[i],t.type&&n.type!==t.type||n.name!==t.name?e[++r]=n:this.removeEventListener(n.type,n.listener,n.capture);++r?e.length=r:delete this.__on}}}function it(t,e,n){var i=J.hasOwnProperty(t.type)?K:tt;return function(r,o,a){var s,l=this.__on,h=i(e,o,a);if(l)for(var c=0,u=l.length;c<u;++c)if((s=l[c]).type===t.type&&s.name===t.name)return this.removeEventListener(s.type,s.listener,s.capture),this.addEventListener(s.type,s.listener=h,s.capture=n),void(s.value=e);this.addEventListener(t.type,h,n),s={type:t.type,name:t.name,value:e,listener:h,capture:n},l?l.push(s):this.__on=[s]}}function rt(t,e,n){var i=x(t),r=i.CustomEvent;"function"==typeof r?r=new r(e,n):(r=i.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function ot(t,e){return function(){return rt(this,t,e)}}function at(t,e){return function(){return rt(this,t,e.apply(this,arguments))}}var st=[null];function lt(t,e){this._groups=t,this._parents=e}function ht(){return new lt([[document.documentElement]],st)}lt.prototype=ht.prototype={constructor:lt,select:function(t){"function"!=typeof t&&(t=r(t));for(var e=this._groups,n=e.length,i=new Array(n),o=0;o<n;++o)for(var a,s,l=e[o],h=l.length,c=i[o]=new Array(h),u=0;u<h;++u)(a=l[u])&&(s=t.call(a,a.__data__,u,l))&&("__data__"in a&&(s.__data__=a.__data__),c[u]=s);return new lt(i,this._parents)},selectAll:function(t){var e;"function"!=typeof t&&(t=null==(e=t)?o:function(){return this.querySelectorAll(e)});for(var n=this._groups,i=n.length,r=[],a=[],s=0;s<i;++s)for(var l,h=n[s],c=h.length,u=0;u<c;++u)(l=h[u])&&(r.push(t.call(l,l.__data__,u,h)),a.push(l));return new lt(r,a)},filter:function(t){var e;"function"!=typeof t&&(e=t,t=function(){return this.matches(e)});for(var n=this._groups,i=n.length,r=new Array(i),o=0;o<i;++o)for(var a,s=n[o],l=s.length,h=r[o]=[],c=0;c<l;++c)(a=s[c])&&t.call(a,a.__data__,c,s)&&h.push(a);return new lt(r,this._parents)},data:function(t,e){if(!t)return m=new Array(this.size()),d=-1,this.each((function(t){m[++d]=t})),m;var n,i=e?h:l,r=this._parents,o=this._groups;"function"!=typeof t&&(n=t,t=function(){return n});for(var a=o.length,s=new Array(a),c=new Array(a),u=new Array(a),d=0;d<a;++d){var g=r[d],p=o[d],f=p.length,m=t.call(g,g&&g.__data__,d,r),_=m.length,y=c[d]=new Array(_),v=s[d]=new Array(_);i(g,p,y,v,u[d]=new Array(f),m,e);for(var x,w,b=0,M=0;b<_;++b)if(x=y[b]){for(b>=M&&(M=b+1);!(w=v[M])&&++M<_;);x._next=w||null}}return(s=new lt(s,r))._enter=c,s._exit=u,s},enter:function(){return new lt(this._enter||this._groups.map(a),this._parents)},exit:function(){return new lt(this._exit||this._groups.map(a),this._parents)},join:function(t,e,n){var i=this.enter(),r=this,o=this.exit();return i="function"==typeof t?t(i):i.append(t+""),null!=e&&(r=e(r)),null==n?o.remove():n(o),i&&r?i.merge(r).order():r},merge:function(t){for(var e=this._groups,n=t._groups,i=e.length,r=n.length,o=Math.min(i,r),a=new Array(i),s=0;s<o;++s)for(var l,h=e[s],c=n[s],u=h.length,d=a[s]=new Array(u),g=0;g<u;++g)(l=h[g]||c[g])&&(d[g]=l);for(;s<i;++s)a[s]=e[s];return new lt(a,this._parents)},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var i,r=t[e],o=r.length-1,a=r[o];--o>=0;)(i=r[o])&&(a&&4^i.compareDocumentPosition(a)&&a.parentNode.insertBefore(i,a),a=i);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=c);for(var n=this._groups,i=n.length,r=new Array(i),o=0;o<i;++o){for(var a,s=n[o],l=s.length,h=r[o]=new Array(l),u=0;u<l;++u)(a=s[u])&&(h[u]=a);h.sort(e)}return new lt(r,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){var t=new Array(this.size()),e=-1;return this.each((function(){t[++e]=this})),t},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,o=i.length;r<o;++r){var a=i[r];if(a)return a}return null},size:function(){var t=0;return this.each((function(){++t})),t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,i=e.length;n<i;++n)for(var r,o=e[n],a=0,s=o.length;a<s;++a)(r=o[a])&&t.call(r,r.__data__,a,o);return this},attr:function(t,e){var n=g(t);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((null==e?n.local?f:p:"function"==typeof e?n.local?v:y:n.local?_:m)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?w:"function"==typeof e?M:b)(t,e,null==n?"":n)):C(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?k:"function"==typeof e?S:T)(t,e)):this.node()[t]},classed:function(t,e){var n=A(t+"");if(arguments.length<2){for(var i=D(this.node()),r=-1,o=n.length;++r<o;)if(!i.contains(n[r]))return!1;return!0}return this.each(("function"==typeof e?P:e?N:I)(n,e))},text:function(t){return arguments.length?this.each(null==t?H:("function"==typeof t?F:O)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?G:("function"==typeof t?z:B)(t)):this.node().innerHTML},raise:function(){return this.each(U)},lower:function(){return this.each(W)},append:function(t){var e="function"==typeof t?t:j(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:j(t),i=null==e?X:"function"==typeof e?e:r(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)}))},remove:function(){return this.each($)},clone:function(t){return this.select(t?Z:q)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var i,r,o=et(t+""),a=o.length;if(!(arguments.length<2)){for(s=e?it:nt,null==n&&(n=!1),i=0;i<a;++i)this.each(s(o[i],e,n));return this}var s=this.node().__on;if(s)for(var l,h=0,c=s.length;h<c;++h)for(i=0,l=s[h];i<a;++i)if((r=o[i]).type===l.type&&r.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?at:ot)(t,e))}};var ct=function(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,i=t.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+t.slice(n+1)]},ut=function(t){return(t=ct(Math.abs(t)))?t[1]:NaN},dt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function gt(t){if(!(e=dt.exec(t)))throw new Error("invalid format: "+t);var e;return new pt({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function pt(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}gt.prototype=pt.prototype,pt.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var ft,mt,_t,yt,vt=function(t,e){var n=ct(t,e);if(!n)return t+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")},xt={"%":function(t,e){return(100*t).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return vt(100*t,e)},r:vt,s:function(t,e){var n=ct(t,e);if(!n)return t+"";var i=n[0],r=n[1],o=r-(ft=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,a=i.length;return o===a?i:o>a?i+new Array(o-a+1).join("0"):o>0?i.slice(0,o)+"."+i.slice(o):"0."+new Array(1-o).join("0")+ct(t,Math.max(0,e+o-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},wt=function(t){return t},bt=Array.prototype.map,Mt=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],Ct=function(t){var e,n,i=void 0===t.grouping||void 0===t.thousands?wt:(e=bt.call(t.grouping,Number),n=t.thousands+"",function(t,i){for(var r=t.length,o=[],a=0,s=e[0],l=0;r>0&&s>0&&(l+s+1>i&&(s=Math.max(1,i-l)),o.push(t.substring(r-=s,r+s)),!((l+=s+1)>i));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),r=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?wt:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(bt.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",h=void 0===t.minus?"-":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function u(t){var e=(t=gt(t)).fill,n=t.align,u=t.sign,d=t.symbol,g=t.zero,p=t.width,f=t.comma,m=t.precision,_=t.trim,y=t.type;"n"===y?(f=!0,y="g"):xt[y]||(void 0===m&&(m=12),_=!0,y="g"),(g||"0"===e&&"="===n)&&(g=!0,e="0",n="=");var v="$"===d?r:"#"===d&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",x="$"===d?o:/[%p]/.test(y)?l:"",w=xt[y],b=/[defgprs%]/.test(y);function M(t){var r,o,l,d=v,M=x;if("c"===y)M=w(t)+M,t="";else{var C=(t=+t)<0;if(t=isNaN(t)?c:w(Math.abs(t),m),_&&(t=function(t){t:for(var e,n=t.length,i=1,r=-1;i<n;++i)switch(t[i]){case".":r=e=i;break;case"0":0===r&&(r=i),e=i;break;default:if(!+t[i])break t;r>0&&(r=0)}return r>0?t.slice(0,r)+t.slice(e+1):t}(t)),C&&0==+t&&(C=!1),d=(C?"("===u?u:h:"-"===u||"("===u?"":u)+d,M=("s"===y?Mt[8+ft/3]:"")+M+(C&&"("===u?")":""),b)for(r=-1,o=t.length;++r<o;)if(48>(l=t.charCodeAt(r))||l>57){M=(46===l?a+t.slice(r+1):t.slice(r))+M,t=t.slice(0,r);break}}f&&!g&&(t=i(t,1/0));var k=d.length+t.length+M.length,T=k<p?new Array(p-k+1).join(e):"";switch(f&&g&&(t=i(T+t,T.length?p-M.length:1/0),T=""),n){case"<":t=d+t+M+T;break;case"=":t=d+T+t+M;break;case"^":t=T.slice(0,k=T.length>>1)+d+t+M+T.slice(k);break;default:t=T+d+t+M}return s(t)}return m=void 0===m?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),M.toString=function(){return t+""},M}return{format:u,formatPrefix:function(t,e){var n=u(((t=gt(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor(ut(e)/3))),r=Math.pow(10,-i),o=Mt[8+i/3];return function(t){return n(r*t)+o}}}};mt=Ct({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"}),_t=mt.format,yt=mt.formatPrefix;var kt={value:function(){}};function Tt(){for(var t,e=0,n=arguments.length,i={};e<n;++e){if(!(t=arguments[e]+"")||t in i||/[\s.]/.test(t))throw new Error("illegal type: "+t);i[t]=[]}return new St(i)}function St(t){this._=t}function At(t,e){return t.trim().split(/^|\s+/).map((function(t){var n="",i=t.indexOf(".");if(i>=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function Dt(t,e){for(var n,i=0,r=t.length;i<r;++i)if((n=t[i]).name===e)return n.value}function Lt(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=kt,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=n&&t.push({name:e,value:n}),t}St.prototype=Tt.prototype={constructor:St,on:function(t,e){var n,i=this._,r=At(t+"",i),o=-1,a=r.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<a;)if(n=(t=r[o]).type)i[n]=Lt(i[n],t.name,e);else if(null==e)for(n in i)i[n]=Lt(i[n],t.name,null);return this}for(;++o<a;)if((n=(t=r[o]).type)&&(n=Dt(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new St(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,i,r=new Array(n),o=0;o<n;++o)r[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(i=this._[t]).length;o<n;++o)i[o].value.apply(e,r)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,o=i.length;r<o;++r)i[r].value.apply(e,n)}};var Rt=Tt,Et=function(t,e){return t<e?-1:t>e?1:t>=e?0:NaN},Nt=function(t){var e;return 1===t.length&&(e=t,t=function(t,n){return Et(e(t),n)}),{left:function(e,n,i,r){for(null==i&&(i=0),null==r&&(r=e.length);i<r;){var o=i+r>>>1;t(e[o],n)<0?i=o+1:r=o}return i},right:function(e,n,i,r){for(null==i&&(i=0),null==r&&(r=e.length);i<r;){var o=i+r>>>1;t(e[o],n)>0?r=o:i=o+1}return i}}};var It=Nt(Et),Pt=It.right,Ht=(It.left,Pt);var Ot=Array.prototype,Ft=(Ot.slice,Ot.map,Math.sqrt(50)),Gt=Math.sqrt(10),Bt=Math.sqrt(2),zt=function(t,e,n){var i,r,o,a,s=-1;if(n=+n,(t=+t)===(e=+e)&&n>0)return[t];if((i=e<t)&&(r=t,t=e,e=r),0===(a=Ut(t,e,n))||!isFinite(a))return[];if(a>0)for(t=Math.ceil(t/a),e=Math.floor(e/a),o=new Array(r=Math.ceil(e-t+1));++s<r;)o[s]=(t+s)*a;else for(t=Math.floor(t*a),e=Math.ceil(e*a),o=new Array(r=Math.ceil(t-e+1));++s<r;)o[s]=(t-s)/a;return i&&o.reverse(),o};function Ut(t,e,n){var i=(e-t)/Math.max(0,n),r=Math.floor(Math.log(i)/Math.LN10),o=i/Math.pow(10,r);return r>=0?(o>=Ft?10:o>=Gt?5:o>=Bt?2:1)*Math.pow(10,r):-Math.pow(10,-r)/(o>=Ft?10:o>=Gt?5:o>=Bt?2:1)}function Wt(t,e,n){var i=Math.abs(e-t)/Math.max(0,n),r=Math.pow(10,Math.floor(Math.log(i)/Math.LN10)),o=i/r;return o>=Ft?r*=10:o>=Gt?r*=5:o>=Bt&&(r*=2),e<t?-r:r}var Vt=function(t,e){var n,i,r=t.length,o=-1;if(null==e){for(;++o<r;)if(null!=(n=t[o])&&n>=n)for(i=n;++o<r;)null!=(n=t[o])&&n>i&&(i=n)}else for(;++o<r;)if(null!=(n=e(t[o],o,t))&&n>=n)for(i=n;++o<r;)null!=(n=e(t[o],o,t))&&n>i&&(i=n);return i},Yt=function(t,e){var n,i=t.length,r=-1,o=0;if(null==e)for(;++r<i;)(n=+t[r])&&(o+=n);else for(;++r<i;)(n=+e(t[r],r,t))&&(o+=n);return o};function jt(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Xt(){}function $t(t,e){var n=new Xt;if(t instanceof Xt)t.each((function(t,e){n.set(e,t)}));else if(Array.isArray(t)){var i,r=-1,o=t.length;if(null==e)for(;++r<o;)n.set(r,t[r]);else for(;++r<o;)n.set(e(i=t[r],r,t),i)}else if(t)for(var a in t)n.set(a,t[a]);return n}Xt.prototype=$t.prototype={constructor:Xt,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,e){return this["$"+t]=e,this},remove:function(t){var e="$"+t;return e in this&&delete this[e]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)"$"===e[0]&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)"$"===e[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var e in this)"$"===e[0]&&t(this[e],e.slice(1),this)}};var qt=$t;function Zt(){}var Jt=qt.prototype;function Qt(t,e){var n=new Zt;if(t instanceof Zt)t.each((function(t){n.add(t)}));else if(t){var i=-1,r=t.length;if(null==e)for(;++i<r;)n.add(t[i]);else for(;++i<r;)n.add(e(t[i],i,t))}return n}Zt.prototype=Qt.prototype={constructor:Zt,has:Jt.has,add:function(t){return this["$"+(t+="")]=t,this},remove:Jt.remove,clear:Jt.clear,values:Jt.keys,size:Jt.size,empty:Jt.empty,each:Jt.each};var Kt=Array.prototype,te=Kt.map,ee=Kt.slice;var ne=function(t,e,n){t.prototype=e.prototype=n,n.constructor=t};function ie(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function re(){}var oe="\\s*([+-]?\\d+)\\s*",ae="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",se="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",le=/^#([0-9a-f]{3,8})$/,he=new RegExp("^rgb\\("+[oe,oe,oe]+"\\)$"),ce=new RegExp("^rgb\\("+[se,se,se]+"\\)$"),ue=new RegExp("^rgba\\("+[oe,oe,oe,ae]+"\\)$"),de=new RegExp("^rgba\\("+[se,se,se,ae]+"\\)$"),ge=new RegExp("^hsl\\("+[ae,se,se]+"\\)$"),pe=new RegExp("^hsla\\("+[ae,se,se,ae]+"\\)$"),fe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function me(){return this.rgb().formatHex()}function _e(){return this.rgb().formatRgb()}function ye(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=le.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?ve(e):3===n?new Me(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?new Me(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?new Me(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=he.exec(t))?new Me(e[1],e[2],e[3],1):(e=ce.exec(t))?new Me(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=ue.exec(t))?xe(e[1],e[2],e[3],e[4]):(e=de.exec(t))?xe(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=ge.exec(t))?Se(e[1],e[2]/100,e[3]/100,1):(e=pe.exec(t))?Se(e[1],e[2]/100,e[3]/100,e[4]):fe.hasOwnProperty(t)?ve(fe[t]):"transparent"===t?new Me(NaN,NaN,NaN,0):null}function ve(t){return new Me(t>>16&255,t>>8&255,255&t,1)}function xe(t,e,n,i){return i<=0&&(t=e=n=NaN),new Me(t,e,n,i)}function we(t){return t instanceof re||(t=ye(t)),t?new Me((t=t.rgb()).r,t.g,t.b,t.opacity):new Me}function be(t,e,n,i){return 1===arguments.length?we(t):new Me(t,e,n,null==i?1:i)}function Me(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function Ce(){return"#"+Te(this.r)+Te(this.g)+Te(this.b)}function ke(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function Te(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Se(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new De(t,e,n,i)}function Ae(t){if(t instanceof De)return new De(t.h,t.s,t.l,t.opacity);if(t instanceof re||(t=ye(t)),!t)return new De;if(t instanceof De)return t;var e=(t=t.rgb()).r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),o=Math.max(e,n,i),a=NaN,s=o-r,l=(o+r)/2;return s?(a=e===o?(n-i)/s+6*(n<i):n===o?(i-e)/s+2:(e-n)/s+4,s/=l<.5?o+r:2-o-r,a*=60):s=l>0&&l<1?0:a,new De(a,s,l,t.opacity)}function De(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function Le(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function Re(t,e,n,i,r){var o=t*t,a=o*t;return((1-3*t+3*o-a)*e+(4-6*o+3*a)*n+(1+3*t+3*o-3*a)*i+a*r)/6}ne(re,ye,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:me,formatHex:me,formatHsl:function(){return Ae(this).formatHsl()},formatRgb:_e,toString:_e}),ne(Me,be,ie(re,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Me(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Me(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ce,formatHex:Ce,formatRgb:ke,toString:ke})),ne(De,(function(t,e,n,i){return 1===arguments.length?Ae(t):new De(t,e,n,null==i?1:i)}),ie(re,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new De(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new De(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new Me(Le(t>=240?t-240:t+120,r,i),Le(t,r,i),Le(t<120?t+240:t-120,r,i),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var Ee=function(t){return function(){return t}};function Ne(t,e){return function(n){return t+n*e}}function Ie(t){return 1==(t=+t)?Pe:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}(e,n,t):Ee(isNaN(e)?n:e)}}function Pe(t,e){var n=e-t;return n?Ne(t,n):Ee(isNaN(t)?e:t)}var He=function t(e){var n=Ie(e);function i(t,e){var i=n((t=be(t)).r,(e=be(e)).r),r=n(t.g,e.g),o=n(t.b,e.b),a=Pe(t.opacity,e.opacity);return function(e){return t.r=i(e),t.g=r(e),t.b=o(e),t.opacity=a(e),t+""}}return i.gamma=t,i}(1);function Oe(t){return function(e){var n,i,r=e.length,o=new Array(r),a=new Array(r),s=new Array(r);for(n=0;n<r;++n)i=be(e[n]),o[n]=i.r||0,a[n]=i.g||0,s[n]=i.b||0;return o=t(o),a=t(a),s=t(s),i.opacity=1,function(t){return i.r=o(t),i.g=a(t),i.b=s(t),i+""}}}Oe((function(t){var e=t.length-1;return function(n){var i=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),r=t[i],o=t[i+1],a=i>0?t[i-1]:2*r-o,s=i<e-1?t[i+2]:2*o-r;return Re((n-i/e)*e,a,r,o,s)}})),Oe((function(t){var e=t.length;return function(n){var i=Math.floor(((n%=1)<0?++n:n)*e),r=t[(i+e-1)%e],o=t[i%e],a=t[(i+1)%e],s=t[(i+2)%e];return Re((n-i/e)*e,r,o,a,s)}}));var Fe=function(t,e){e||(e=[]);var n,i=t?Math.min(e.length,t.length):0,r=e.slice();return function(o){for(n=0;n<i;++n)r[n]=t[n]*(1-o)+e[n]*o;return r}};function Ge(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Be(t,e){var n,i=e?e.length:0,r=t?Math.min(i,t.length):0,o=new Array(r),a=new Array(i);for(n=0;n<r;++n)o[n]=Xe(t[n],e[n]);for(;n<i;++n)a[n]=e[n];return function(t){for(n=0;n<r;++n)a[n]=o[n](t);return a}}var ze=function(t,e){var n=new Date;return t=+t,e=+e,function(i){return n.setTime(t*(1-i)+e*i),n}},Ue=function(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}},We=function(t,e){var n,i={},r={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?i[n]=Xe(t[n],e[n]):r[n]=e[n];return function(t){for(n in i)r[n]=i[n](t);return r}},Ve=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ye=new RegExp(Ve.source,"g");var je=function(t,e){var n,i,r,o=Ve.lastIndex=Ye.lastIndex=0,a=-1,s=[],l=[];for(t+="",e+="";(n=Ve.exec(t))&&(i=Ye.exec(e));)(r=i.index)>o&&(r=e.slice(o,r),s[a]?s[a]+=r:s[++a]=r),(n=n[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,l.push({i:a,x:Ue(n,i)})),o=Ye.lastIndex;return o<e.length&&(r=e.slice(o),s[a]?s[a]+=r:s[++a]=r),s.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var n,i=0;i<e;++i)s[(n=l[i]).i]=n.x(t);return s.join("")})},Xe=function(t,e){var n,i=typeof e;return null==e||"boolean"===i?Ee(e):("number"===i?Ue:"string"===i?(n=ye(e))?(e=n,He):je:e instanceof ye?He:e instanceof Date?ze:Ge(e)?Fe:Array.isArray(e)?Be:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?We:Ue)(t,e)},$e=function(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}},qe=function(t){return+t},Ze=[0,1];function Je(t){return t}function Qe(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:(n=isNaN(e)?NaN:.5,function(){return n});var n}function Ke(t){var e,n=t[0],i=t[t.length-1];return n>i&&(e=n,n=i,i=e),function(t){return Math.max(n,Math.min(i,t))}}function tn(t,e,n){var i=t[0],r=t[1],o=e[0],a=e[1];return r<i?(i=Qe(r,i),o=n(a,o)):(i=Qe(i,r),o=n(o,a)),function(t){return o(i(t))}}function en(t,e,n){var i=Math.min(t.length,e.length)-1,r=new Array(i),o=new Array(i),a=-1;for(t[i]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<i;)r[a]=Qe(t[a],t[a+1]),o[a]=n(e[a],e[a+1]);return function(e){var n=Ht(t,e,1,i)-1;return o[n](r[n](e))}}function nn(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function rn(){var t,e,n,i,r,o,a=Ze,s=Ze,l=Xe,h=Je;function c(){return i=Math.min(a.length,s.length)>2?en:tn,r=o=null,u}function u(e){return isNaN(e=+e)?n:(r||(r=i(a.map(t),s,l)))(t(h(e)))}return u.invert=function(n){return h(e((o||(o=i(s,a.map(t),Ue)))(n)))},u.domain=function(t){return arguments.length?(a=te.call(t,qe),h===Je||(h=Ke(a)),c()):a.slice()},u.range=function(t){return arguments.length?(s=ee.call(t),c()):s.slice()},u.rangeRound=function(t){return s=ee.call(t),l=$e,c()},u.clamp=function(t){return arguments.length?(h=t?Ke(a):Je,u):h!==Je},u.interpolate=function(t){return arguments.length?(l=t,c()):l},u.unknown=function(t){return arguments.length?(n=t,u):n},function(n,i){return t=n,e=i,c()}}function on(t,e){return rn()(t,e)}var an=function(t,e,n,i){var r,o=Wt(t,e,n);switch((i=gt(null==i?",f":i)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=i.precision||isNaN(r=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(ut(e)/3)))-ut(Math.abs(t)))}(o,a))||(i.precision=r),yt(i,a);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(r=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,ut(e)-ut(t))+1}(o,Math.max(Math.abs(t),Math.abs(e))))||(i.precision=r-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(r=function(t){return Math.max(0,-ut(Math.abs(t)))}(o))||(i.precision=r-2*("%"===i.type))}return _t(i)};function sn(t){var e=t.domain;return t.ticks=function(t){var n=e();return zt(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var i=e();return an(i[0],i[i.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var i,r=e(),o=0,a=r.length-1,s=r[o],l=r[a];return l<s&&(i=s,s=l,l=i,i=o,o=a,a=i),(i=Ut(s,l,n))>0?i=Ut(s=Math.floor(s/i)*i,l=Math.ceil(l/i)*i,n):i<0&&(i=Ut(s=Math.ceil(s*i)/i,l=Math.floor(l*i)/i,n)),i>0?(r[o]=Math.floor(s/i)*i,r[a]=Math.ceil(l/i)*i,e(r)):i<0&&(r[o]=Math.ceil(s*i)/i,r[a]=Math.floor(l*i)/i,e(r)),t},t}function ln(){var t=on(Je,Je);return t.copy=function(){return nn(t,ln())},jt.apply(t,arguments),sn(t)}var hn=new Date,cn=new Date;function un(t,e,n,i){function r(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return r.floor=function(e){return t(e=new Date(+e)),e},r.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n},r.round=function(t){var e=r(t),n=r.ceil(t);return t-e<n-t?e:n},r.offset=function(t,n){return e(t=new Date(+t),null==n?1:Math.floor(n)),t},r.range=function(n,i,o){var a,s=[];if(n=r.ceil(n),o=null==o?1:Math.floor(o),!(n<i&&o>0))return s;do{s.push(a=new Date(+n)),e(n,o),t(n)}while(a<n&&n<i);return s},r.filter=function(n){return un((function(e){if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,i){if(t>=t)if(i<0)for(;++i<=0;)for(;e(t,-1),!n(t););else for(;--i>=0;)for(;e(t,1),!n(t););}))},n&&(r.count=function(e,i){return hn.setTime(+e),cn.setTime(+i),t(hn),t(cn),Math.floor(n(hn,cn))},r.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?r.filter(i?function(e){return i(e)%t==0}:function(e){return r.count(0,e)%t==0}):r:null}),r}var dn=un((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));dn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?un((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};var gn=dn,pn=(dn.range,un((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()})));pn.range;function fn(t){return un((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}var mn=fn(0),_n=fn(1),yn=fn(2),vn=fn(3),xn=fn(4),wn=fn(5),bn=fn(6),Mn=(mn.range,_n.range,yn.range,vn.range,xn.range,wn.range,bn.range,un((function(t){t.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5}),(function(t){return t.getDate()-1}))),Cn=Mn,kn=(Mn.range,un((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getHours()}))),Tn=(kn.range,un((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getMinutes()}))),Sn=(Tn.range,un((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+1e3*e)}),(function(t,e){return(e-t)/1e3}),(function(t){return t.getUTCSeconds()}))),An=(Sn.range,un((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t})));An.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?un((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,n){e.setTime(+e+n*t)}),(function(e,n){return(n-e)/t})):An:null};An.range;function Dn(t){return un((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/6048e5}))}var Ln=Dn(0),Rn=Dn(1),En=Dn(2),Nn=Dn(3),In=Dn(4),Pn=Dn(5),Hn=Dn(6),On=(Ln.range,Rn.range,En.range,Nn.range,In.range,Pn.range,Hn.range,un((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/864e5}),(function(t){return t.getUTCDate()-1}))),Fn=On,Gn=(On.range,un((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()})));Gn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?un((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};var Bn=Gn;Gn.range;function zn(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Un(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Wn(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}var Vn,Yn={"-":"",_:" ",0:"0"},jn=/^\s*\d+/,Xn=/^%/,$n=/[\\^$*+?|[\]().{}]/g;function qn(t,e,n){var i=t<0?"-":"",r=(i?-t:t)+"",o=r.length;return i+(o<n?new Array(n-o+1).join(e)+r:r)}function Zn(t){return t.replace($n,"\\$&")}function Jn(t){return new RegExp("^(?:"+t.map(Zn).join("|")+")","i")}function Qn(t){for(var e={},n=-1,i=t.length;++n<i;)e[t[n].toLowerCase()]=n;return e}function Kn(t,e,n){var i=jn.exec(e.slice(n,n+1));return i?(t.w=+i[0],n+i[0].length):-1}function ti(t,e,n){var i=jn.exec(e.slice(n,n+1));return i?(t.u=+i[0],n+i[0].length):-1}function ei(t,e,n){var i=jn.exec(e.slice(n,n+2));return i?(t.U=+i[0],n+i[0].length):-1}function ni(t,e,n){var i=jn.exec(e.slice(n,n+2));return i?(t.V=+i[0],n+i[0].length):-1}function ii(t,e,n){var i=jn.exec(e.slice(n,n+2));return i?(t.W=+i[0],n+i[0].length):-1}function ri(t,e,n){var i=jn.exec(e.slice(n,n+4));return i?(t.y=+i[0],n+i[0].length):-1}function oi(t,e,n){var i=jn.exec(e.slice(n,n+2));return i?(t.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function ai(t,e,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return i?(t.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function si(t,e,n){var i=jn.exec(e.slice(n,n+1));return i?(t.q=3*i[0]-3,n+i[0].length):-1}function li(t,e,n){var i=jn.exec(e.slice(n,n+2));return i?(t.m=i[0]-1,n+i[0].length):-1}function hi(t,e,n){var i=jn.exec(e.slice(n,n+2));return i?(t.d=+i[0],n+i[0].length):-1}function ci(t,e,n){var i=jn.exec(e.slice(n,n+3));return i?(t.m=0,t.d=+i[0],n+i[0].length):-1}function ui(t,e,n){var i=jn.exec(e.slice(n,n+2));return i?(t.H=+i[0],n+i[0].length):-1}function di(t,e,n){var i=jn.exec(e.slice(n,n+2));return i?(t.M=+i[0],n+i[0].length):-1}function gi(t,e,n){var i=jn.exec(e.slice(n,n+2));return i?(t.S=+i[0],n+i[0].length):-1}function pi(t,e,n){var i=jn.exec(e.slice(n,n+3));return i?(t.L=+i[0],n+i[0].length):-1}function fi(t,e,n){var i=jn.exec(e.slice(n,n+6));return i?(t.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function mi(t,e,n){var i=Xn.exec(e.slice(n,n+1));return i?n+i[0].length:-1}function _i(t,e,n){var i=jn.exec(e.slice(n));return i?(t.Q=+i[0],n+i[0].length):-1}function yi(t,e,n){var i=jn.exec(e.slice(n));return i?(t.s=+i[0],n+i[0].length):-1}function vi(t,e){return qn(t.getDate(),e,2)}function xi(t,e){return qn(t.getHours(),e,2)}function wi(t,e){return qn(t.getHours()%12||12,e,2)}function bi(t,e){return qn(1+Cn.count(gn(t),t),e,3)}function Mi(t,e){return qn(t.getMilliseconds(),e,3)}function Ci(t,e){return Mi(t,e)+"000"}function ki(t,e){return qn(t.getMonth()+1,e,2)}function Ti(t,e){return qn(t.getMinutes(),e,2)}function Si(t,e){return qn(t.getSeconds(),e,2)}function Ai(t){var e=t.getDay();return 0===e?7:e}function Di(t,e){return qn(mn.count(gn(t)-1,t),e,2)}function Li(t,e){var n=t.getDay();return t=n>=4||0===n?xn(t):xn.ceil(t),qn(xn.count(gn(t),t)+(4===gn(t).getDay()),e,2)}function Ri(t){return t.getDay()}function Ei(t,e){return qn(_n.count(gn(t)-1,t),e,2)}function Ni(t,e){return qn(t.getFullYear()%100,e,2)}function Ii(t,e){return qn(t.getFullYear()%1e4,e,4)}function Pi(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+qn(e/60|0,"0",2)+qn(e%60,"0",2)}function Hi(t,e){return qn(t.getUTCDate(),e,2)}function Oi(t,e){return qn(t.getUTCHours(),e,2)}function Fi(t,e){return qn(t.getUTCHours()%12||12,e,2)}function Gi(t,e){return qn(1+Fn.count(Bn(t),t),e,3)}function Bi(t,e){return qn(t.getUTCMilliseconds(),e,3)}function zi(t,e){return Bi(t,e)+"000"}function Ui(t,e){return qn(t.getUTCMonth()+1,e,2)}function Wi(t,e){return qn(t.getUTCMinutes(),e,2)}function Vi(t,e){return qn(t.getUTCSeconds(),e,2)}function Yi(t){var e=t.getUTCDay();return 0===e?7:e}function ji(t,e){return qn(Ln.count(Bn(t)-1,t),e,2)}function Xi(t,e){var n=t.getUTCDay();return t=n>=4||0===n?In(t):In.ceil(t),qn(In.count(Bn(t),t)+(4===Bn(t).getUTCDay()),e,2)}function $i(t){return t.getUTCDay()}function qi(t,e){return qn(Rn.count(Bn(t)-1,t),e,2)}function Zi(t,e){return qn(t.getUTCFullYear()%100,e,2)}function Ji(t,e){return qn(t.getUTCFullYear()%1e4,e,4)}function Qi(){return"+0000"}function Ki(){return"%"}function tr(t){return+t}function er(t){return Math.floor(+t/1e3)}!function(t){Vn=function(t){var e=t.dateTime,n=t.date,i=t.time,r=t.periods,o=t.days,a=t.shortDays,s=t.months,l=t.shortMonths,h=Jn(r),c=Qn(r),u=Jn(o),d=Qn(o),g=Jn(a),p=Qn(a),f=Jn(s),m=Qn(s),_=Jn(l),y=Qn(l),v={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:vi,e:vi,f:Ci,H:xi,I:wi,j:bi,L:Mi,m:ki,M:Ti,p:function(t){return r[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:tr,s:er,S:Si,u:Ai,U:Di,V:Li,w:Ri,W:Ei,x:null,X:null,y:Ni,Y:Ii,Z:Pi,"%":Ki},x={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return l[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:Hi,e:Hi,f:zi,H:Oi,I:Fi,j:Gi,L:Bi,m:Ui,M:Wi,p:function(t){return r[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:tr,s:er,S:Vi,u:Yi,U:ji,V:Xi,w:$i,W:qi,x:null,X:null,y:Zi,Y:Ji,Z:Qi,"%":Ki},w={a:function(t,e,n){var i=g.exec(e.slice(n));return i?(t.w=p[i[0].toLowerCase()],n+i[0].length):-1},A:function(t,e,n){var i=u.exec(e.slice(n));return i?(t.w=d[i[0].toLowerCase()],n+i[0].length):-1},b:function(t,e,n){var i=_.exec(e.slice(n));return i?(t.m=y[i[0].toLowerCase()],n+i[0].length):-1},B:function(t,e,n){var i=f.exec(e.slice(n));return i?(t.m=m[i[0].toLowerCase()],n+i[0].length):-1},c:function(t,n,i){return C(t,e,n,i)},d:hi,e:hi,f:fi,H:ui,I:ui,j:ci,L:pi,m:li,M:di,p:function(t,e,n){var i=h.exec(e.slice(n));return i?(t.p=c[i[0].toLowerCase()],n+i[0].length):-1},q:si,Q:_i,s:yi,S:gi,u:ti,U:ei,V:ni,w:Kn,W:ii,x:function(t,e,i){return C(t,n,e,i)},X:function(t,e,n){return C(t,i,e,n)},y:oi,Y:ri,Z:ai,"%":mi};function b(t,e){return function(n){var i,r,o,a=[],s=-1,l=0,h=t.length;for(n instanceof Date||(n=new Date(+n));++s<h;)37===t.charCodeAt(s)&&(a.push(t.slice(l,s)),null!=(r=Yn[i=t.charAt(++s)])?i=t.charAt(++s):r="e"===i?" ":"0",(o=e[i])&&(i=o(n,r)),a.push(i),l=s+1);return a.push(t.slice(l,s)),a.join("")}}function M(t,e){return function(n){var i,r,o=Wn(1900,void 0,1);if(C(o,t,n+="",0)!=n.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(!e||"Z"in o||(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(r=(i=Un(Wn(o.y,0,1))).getUTCDay(),i=r>4||0===r?Rn.ceil(i):Rn(i),i=Fn.offset(i,7*(o.V-1)),o.y=i.getUTCFullYear(),o.m=i.getUTCMonth(),o.d=i.getUTCDate()+(o.w+6)%7):(r=(i=zn(Wn(o.y,0,1))).getDay(),i=r>4||0===r?_n.ceil(i):_n(i),i=Cn.offset(i,7*(o.V-1)),o.y=i.getFullYear(),o.m=i.getMonth(),o.d=i.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),r="Z"in o?Un(Wn(o.y,0,1)).getUTCDay():zn(Wn(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(r+5)%7:o.w+7*o.U-(r+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,Un(o)):zn(o)}}function C(t,e,n,i){for(var r,o,a=0,s=e.length,l=n.length;a<s;){if(i>=l)return-1;if(37===(r=e.charCodeAt(a++))){if(r=e.charAt(a++),!(o=w[r in Yn?e.charAt(a++):r])||(i=o(t,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}return(v.x=b(n,v),v.X=b(i,v),v.c=b(e,v),x.x=b(n,x),x.X=b(i,x),x.c=b(e,x),{format:function(t){var e=b(t+="",v);return e.toString=function(){return t},e},parse:function(t){var e=M(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=b(t+="",x);return e.toString=function(){return t},e},utcParse:function(t){var e=M(t+="",!0);return e.toString=function(){return t},e}})}(t),Vn.format,Vn.parse,Vn.utcFormat,Vn.utcParse}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var nr=un((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()})),ir=(nr.range,un((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getUTCHours()}))),rr=(ir.range,un((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getUTCMinutes()})));rr.range;n.d(e,"legendColor",(function(){return cr})),n.d(e,"legendSize",(function(){return ur})),n.d(e,"legendSymbol",(function(){return dr})),n.d(e,"legendHelpers",(function(){return gr}));var or="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ar=function(t){return t},sr=function(t){for(var e=[],n=0,i=t.length;n<i;n++)e[n]=t[i-n-1];return e},lr=function(t,e){t.each((function(){for(var t,n,i="string"==typeof(n=this)?new lt([[document.querySelector(n)]],[document.documentElement]):new lt([[n]],st),r=i.text().split(/\s+/).reverse(),o=[],a=(i.attr("y"),parseFloat(i.attr("dy"))||0),s=i.text(null).append("tspan").attr("x",0).attr("dy",a+"em");t=r.pop();)o.push(t),s.text(o.join(" ")),s.node().getComputedTextLength()>e&&o.length>1&&(o.pop(),s.text(o.join(" ")),o=[t],s=i.append("tspan").attr("x",0).attr("dy",1.2+a+"em").text(t))}))},hr={d3_drawShapes:function(t,e,n,i,r,o){"rect"===t?e.attr("height",n).attr("width",i):"circle"===t?e.attr("r",r):"line"===t?e.attr("x1",0).attr("x2",i).attr("y1",0).attr("y2",0):"path"===t&&e.attr("d",o)},d3_addText:function(t,e,n,i,r){e.append("text").attr("class",i+"label");var o=t.selectAll("g."+i+"cell text."+i+"label").data(n).text(ar);return r&&t.selectAll("g."+i+"cell text."+i+"label").call(lr,r),o},d3_calcType:function(t,e,n,i,r,o){var a=t.invertExtent?function(t,e,n){var i=t.range().map((function(i){var r=t.invertExtent(i);return e(r[0])+" "+n+" "+e(r[1])}));return{data:t.range(),labels:i,feature:ar}}(t,r,o):t.ticks?function(t,e,n){var i=[];if(e.length>1)i=e;else for(var r=t.domain(),o=(r[r.length-1]-r[0])/(e-1),a=0;a<e;a++)i.push(r[0]+a*o);var s=i.map(n);return{data:i,labels:s,feature:function(e){return t(e)}}}(t,n,r):function(t){return{data:t.domain(),labels:t.domain(),feature:function(e){return t(e)}}}(t),s=t.range&&t.range()||t.domain();return a.labels=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments[1],n=arguments[2],i=arguments[3],r=arguments[4];if("object"===(void 0===e?"undefined":or(e))){if(0===e.length)return t;for(var o=e.length;o<t.length;o++)e.push(t[o]);return e}if("function"==typeof e){for(var a=[],s=t.length,l=0;l<s;l++)a.push(e({i:l,genLength:s,generatedLabels:t,domain:n,range:i,labelDelimiter:r}));return a}return t}(a.labels,i,t.domain(),s,o),e&&(a.labels=sr(a.labels),a.data=sr(a.data)),a},d3_filterCells:function(t,e){var n=t.data.map((function(e,n){return{data:e,label:t.labels[n]}})).filter(e),i=n.map((function(t){return t.data})),r=n.map((function(t){return t.label}));return t.data=t.data.filter((function(t){return-1!==i.indexOf(t)})),t.labels=t.labels.filter((function(t){return-1!==r.indexOf(t)})),t},d3_placement:function(t,e,n,i,r,o,a){e.attr("transform",n),i.attr("transform",r),"horizontal"===t&&"below"===a&&i.style("text-anchor",o)},d3_addEvents:function(t,e){t.on("mouseover.legend",(function(t){!function(t,e,n){t.call("cellover",n,e)}(e,t,this)})).on("mouseout.legend",(function(t){!function(t,e,n){t.call("cellout",n,e)}(e,t,this)})).on("click.legend",(function(t){!function(t,e,n){t.call("cellclick",n,e)}(e,t,this)})).on("contextmenu.legend",(function(t){!function(t,e,n){t.call("cellcontextmenu",n,e)}(e,t,this)}))},d3_title:function(t,e,n,i){if(""!==e){t.selectAll("text."+n+"legendTitle").data([e]).enter().append("text").attr("class",n+"legendTitle"),t.selectAll("text."+n+"legendTitle").text(e),i&&t.selectAll("text."+n+"legendTitle").call(lr,i);var r=t.select("."+n+"legendCells"),o=t.select("."+n+"legendTitle").nodes().map((function(t){return t.getBBox().height}))[0],a=-r.nodes().map((function(t){return t.getBBox().x}))[0];r.attr("transform","translate("+a+","+o+")")}},d3_defaultLocale:{format:_t,formatPrefix:yt},d3_defaultFormatSpecifier:".01f",d3_defaultDelimiter:"to"};function cr(){var t=ln(),e="rect",n=15,i=15,r=10,o=2,a=[5],s=void 0,l=[],h="",c=!1,u="",d=hr.d3_defaultLocale,g=hr.d3_defaultFormatSpecifier,p=10,f="middle",m="below",_=hr.d3_defaultDelimiter,y=void 0,v="vertical",x=!1,w=void 0,b=void 0,M=Rt("cellover","cellout","cellclick","cellcontextmenu");function C(C){var k=hr.d3_calcType(t,x,a,l,d.format(g),_);C.selectAll("g").data([t]).enter().append("g").attr("class",h+"legendCells"),s&&hr.d3_filterCells(k,s);var T=C.select("."+h+"legendCells").selectAll("."+h+"cell").data(k.data),S=T.enter().append("g").attr("class",h+"cell");S.append(e).attr("class",h+"swatch");var A=C.selectAll("g."+h+"cell "+e+"."+h+"swatch").data(k.data);hr.d3_addEvents(S,M),T.exit().transition().style("opacity",0).remove(),A.exit().transition().style("opacity",0).remove(),A=A.merge(A),hr.d3_drawShapes(e,A,i,n,r,w);var D=hr.d3_addText(C,S,k.labels,h,y);T=S.merge(T);var L=D.nodes().map((function(t){return t.getBBox()})),R=A.nodes().map((function(t){return t.getBBox()}));c?A.attr("class",(function(t){return h+"swatch "+k.feature(t)})):"line"==e?A.style("stroke",k.feature):A.style("fill",k.feature);var E=void 0,N=void 0,I="start"==f?0:"middle"==f?.5:1;if("vertical"===v){var P=L.map((function(t,e){return Math.max(t.height,R[e].height)}));E=function(t,e){return"translate(0, "+(Yt(P.slice(0,e))+e*o)+")"},N=function(t,e){return"translate( "+(R[e].width+R[e].x+p)+", "+(R[e].y+R[e].height/2+5)+")"}}else"horizontal"===v&&(E=function(t,e){return"translate("+e*(R[e].width+o)+",0)"},"below"===m?N=function(t,e){return"translate("+(R[e].width*I+R[e].x)+",\n "+(R[e].height+R[e].y+p+8)+")"}:"right"===m&&(N=function(t,e){return"translate("+(R[e].width+R[e].x+4)+",\n "+(R[e].height+R[e].y)+")"}));hr.d3_placement(v,T,E,D,N,f,m),hr.d3_title(C,u,h,b),T.transition().style("opacity",1)}return C.scale=function(e){return arguments.length?(t=e,C):t},C.cells=function(t){return arguments.length?((t.length>1||t>=2)&&(a=t),C):a},C.cellFilter=function(t){return arguments.length?(s=t,C):s},C.shape=function(t,n){return arguments.length?(("rect"==t||"circle"==t||"line"==t||"path"==t&&"string"==typeof n)&&(e=t,w=n),C):e},C.shapeWidth=function(t){return arguments.length?(n=+t,C):n},C.shapeHeight=function(t){return arguments.length?(i=+t,C):i},C.shapeRadius=function(t){return arguments.length?(r=+t,C):r},C.shapePadding=function(t){return arguments.length?(o=+t,C):o},C.labels=function(t){return arguments.length?(l=t,C):l},C.labelAlign=function(t){return arguments.length?("start"!=t&&"end"!=t&&"middle"!=t||(f=t),C):f},C.labelPosition=function(t){return arguments.length?("below"!=t&&"right"!=t||(m=t),C):m},C.locale=function(t){return arguments.length?(d=Ct(t),C):d},C.labelFormat=function(t){return arguments.length?(g=gt(t),C):C.locale().format(g)},C.labelOffset=function(t){return arguments.length?(p=+t,C):p},C.labelDelimiter=function(t){return arguments.length?(_=t,C):_},C.labelWrap=function(t){return arguments.length?(y=t,C):y},C.useClass=function(t){return arguments.length?(!0!==t&&!1!==t||(c=t),C):c},C.orient=function(t){return arguments.length?("horizontal"!=(t=t.toLowerCase())&&"vertical"!=t||(v=t),C):v},C.ascending=function(t){return arguments.length?(x=!!t,C):x},C.classPrefix=function(t){return arguments.length?(h=t,C):h},C.title=function(t){return arguments.length?(u=t,C):u},C.titleWidth=function(t){return arguments.length?(b=t,C):b},C.textWrap=function(t){return arguments.length?(textWrap=t,C):textWrap},C.on=function(){var t=M.on.apply(M,arguments);return t===M?C:t},C}function ur(){var t=ln(),e="rect",n=15,i=2,r=[5],o=void 0,a=[],s="",l="",h=hr.d3_defaultLocale,c=hr.d3_defaultFormatSpecifier,u=10,d="middle",g=hr.d3_defaultDelimiter,p=void 0,f="vertical",m=!1,_=void 0,y=void 0,v=Rt("cellover","cellout","cellclick","cellcontextmenu");function x(x){var w=hr.d3_calcType(t,m,r,a,h.format(c),g),b=x.selectAll("g").data([t]);o&&hr.d3_filterCells(w,o),b.enter().append("g").attr("class",s+"legendCells");var M=x.select("."+s+"legendCells").selectAll("."+s+"cell").data(w.data),C=M.enter().append("g").attr("class",s+"cell");C.append(e).attr("class",s+"swatch");var k=x.selectAll("g."+s+"cell "+e+"."+s+"swatch");hr.d3_addEvents(C,v),M.exit().transition().style("opacity",0).remove(),k.exit().transition().style("opacity",0).remove(),k=k.merge(k),"line"===e?(hr.d3_drawShapes(e,k,0,n),k.attr("stroke-width",w.feature)):hr.d3_drawShapes(e,k,w.feature,w.feature,w.feature,_);var T=hr.d3_addText(x,C,w.labels,s,p);M=C.merge(M);var S=T.nodes().map((function(t){return t.getBBox()})),A=k.nodes().map((function(n,i){var r=n.getBBox(),o=t(w.data[i]);return"line"===e&&"horizontal"===f?r.height=r.height+o:"line"===e&&"vertical"===f&&(r.width=r.width),r})),D=Vt(A,(function(t){return t.height+t.y})),L=Vt(A,(function(t){return t.width+t.x})),R=void 0,E=void 0,N="start"==d?0:"middle"==d?.5:1;if("vertical"===f){var I=S.map((function(t,e){return Math.max(t.height,A[e].height)})),P="circle"==e||"line"==e?A[0].height/2:0;R=function(t,e){var n=Yt(I.slice(0,e));return"translate(0, "+(P+n+e*i)+")"},E=function(t,e){return"translate( "+(L+u)+",\n "+(A[e].y+A[e].height/2+5)+")"}}else if("horizontal"===f){R=function(t,n){return"translate("+(Yt(A.slice(0,n),(function(t){return t.width}))+n*i)+", "+("circle"==e||"line"==e?D/2:0)+")"};var H="line"==e?D/2:D;E=function(t,e){return"translate( "+(A[e].width*N+A[e].x)+",\n "+(H+u)+")"}}hr.d3_placement(f,M,R,T,E,d),hr.d3_title(x,l,s,y),M.transition().style("opacity",1)}return x.scale=function(e){return arguments.length?(t=e,x):t},x.cells=function(t){return arguments.length?((t.length>1||t>=2)&&(r=t),x):r},x.cellFilter=function(t){return arguments.length?(o=t,x):o},x.shape=function(t,n){return arguments.length?("rect"!=t&&"circle"!=t&&"line"!=t||(e=t,_=n),x):e},x.shapeWidth=function(t){return arguments.length?(n=+t,x):n},x.shapePadding=function(t){return arguments.length?(i=+t,x):i},x.labels=function(t){return arguments.length?(a=t,x):a},x.labelAlign=function(t){return arguments.length?("start"!=t&&"end"!=t&&"middle"!=t||(d=t),x):d},x.locale=function(t){return arguments.length?(h=Ct(t),x):h},x.labelFormat=function(t){return arguments.length?(c=gt(t),x):x.locale().format(c)},x.labelOffset=function(t){return arguments.length?(u=+t,x):u},x.labelDelimiter=function(t){return arguments.length?(g=t,x):g},x.labelWrap=function(t){return arguments.length?(p=t,x):p},x.orient=function(t){return arguments.length?("horizontal"!=(t=t.toLowerCase())&&"vertical"!=t||(f=t),x):f},x.ascending=function(t){return arguments.length?(m=!!t,x):m},x.classPrefix=function(t){return arguments.length?(s=t,x):s},x.title=function(t){return arguments.length?(l=t,x):l},x.titleWidth=function(t){return arguments.length?(y=t,x):y},x.on=function(){var t=v.on.apply(v,arguments);return t===v?x:t},x}function dr(){var t=ln(),e=5,n=[5],i=void 0,r=[],o="",a="",s=hr.d3_defaultLocale,l=hr.d3_defaultFormatSpecifier,h="middle",c=10,u=hr.d3_defaultDelimiter,d=void 0,g="vertical",p=!1,f=void 0,m=Rt("cellover","cellout","cellclick","cellcontextmenu");function _(_){var y=hr.d3_calcType(t,p,n,r,s.format(l),u),v=_.selectAll("g").data([t]);i&&hr.d3_filterCells(y,i),v.enter().append("g").attr("class",o+"legendCells");var x=_.select("."+o+"legendCells").selectAll("."+o+"cell").data(y.data),w=x.enter().append("g").attr("class",o+"cell");w.append("path").attr("class",o+"swatch");var b=_.selectAll("g."+o+"cell path."+o+"swatch");hr.d3_addEvents(w,m),x.exit().transition().style("opacity",0).remove(),b.exit().transition().style("opacity",0).remove(),b=b.merge(b),hr.d3_drawShapes("path",b,15,15,10,y.feature);var M=hr.d3_addText(_,w,y.labels,o,d);x=w.merge(x);var C=M.nodes().map((function(t){return t.getBBox()})),k=b.nodes().map((function(t){return t.getBBox()})),T=Vt(k,(function(t){return t.height})),S=Vt(k,(function(t){return t.width})),A=void 0,D=void 0,L="start"==h?0:"middle"==h?.5:1;if("vertical"===g){var R=C.map((function(t,e){return Math.max(T,t.height)}));A=function(t,n){return"translate(0, "+(Yt(R.slice(0,n))+n*e)+" )"},D=function(t,e){return"translate( "+(S+c)+",\n "+(k[e].y+k[e].height/2+5)+")"}}else"horizontal"===g&&(A=function(t,n){return"translate( "+n*(S+e)+",0)"},D=function(t,e){return"translate( "+(k[e].width*L+k[e].x)+",\n "+(T+c)+")"});hr.d3_placement(g,x,A,M,D,h),hr.d3_title(_,a,o,f),x.transition().style("opacity",1)}return _.scale=function(e){return arguments.length?(t=e,_):t},_.cells=function(t){return arguments.length?((t.length>1||t>=2)&&(n=t),_):n},_.cellFilter=function(t){return arguments.length?(i=t,_):i},_.shapePadding=function(t){return arguments.length?(e=+t,_):e},_.labels=function(t){return arguments.length?(r=t,_):r},_.labelAlign=function(t){return arguments.length?("start"!=t&&"end"!=t&&"middle"!=t||(h=t),_):h},_.locale=function(t){return arguments.length?(s=Ct(t),_):s},_.labelFormat=function(t){return arguments.length?(l=gt(t),_):_.locale().format(l)},_.labelOffset=function(t){return arguments.length?(c=+t,_):c},_.labelDelimiter=function(t){return arguments.length?(u=t,_):u},_.labelWrap=function(t){return arguments.length?(d=t,_):d},_.orient=function(t){return arguments.length?("horizontal"!=(t=t.toLowerCase())&&"vertical"!=t||(g=t),_):g},_.ascending=function(t){return arguments.length?(p=!!t,_):p},_.classPrefix=function(t){return arguments.length?(o=t,_):o},_.title=function(t){return arguments.length?(a=t,_):a},_.titleWidth=function(t){return arguments.length?(f=t,_):f},_.on=function(){var t=m.on.apply(m,arguments);return t===m?_:t},_}var gr={thresholdLabels:function(t){var e=t.i,n=t.genLength,i=t.generatedLabels,r=t.labelDelimiter;return 0===e?"Less than "+i[e].split(" "+r+" ")[1]:e===n-1?i[e].split(" "+r+" ")[0]+" or more":i[e]}},pr={legendColor:cr,legendSize:ur,legendSymbol:dr,legendHelpers:gr};e.default=pr},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=n(0),r=n(3),o=n(4),a=n(2),s=n(20);class l extends s.D3ConnectedGraphSVG{constructor(t,e,n){super(t,e,n),s.ConnectedGraphBase.prototype.initializeGraph.call(this,t);let i=this._element;i.links.forEach((function(t){"number"==typeof t.source&&(t.source=i.nodes[t.source]),"number"==typeof t.target&&(t.target=i.nodes[t.target])}))}renderLinks(t){let e=this,n=e._element,i=t.append("g").classed("links",!0).selectAll("line").data(n.links).enter().append("line").attr("x1",(function(t){return t.source.x})).attr("y1",(function(t){return t.source.y})).attr("x2",(function(t){return t.target.x})).attr("y2",(function(t){return t.target.y})).attr("stroke-width",1).attr("class",(function(t){return t.source.key+"-"+t.target.key+" "+t.source.key+" "+t.target.key})).classed("link",!0).on("mouseenter",e.linkHoverStart).on("mouseleave",e.hoverEnd).each((function(t){r.addClickHelper(a.select(this),e.getOptions(),n.onClick,n.onDoubleClick,n.contextMenuItems,e._dataTooltip,n,t.key,t.key)}));return e._dataTooltip.setTarget(i),i}renderNodes(t,e,n,i){let o=this,s=o._element,l=o._renderer.getColorManager(),h=t.append("g").classed("nodes",!0).selectAll("circle").data(s.nodes).enter().append("circle").attr("r",5).attr("cx",(function(t){return t.x})).attr("cy",(function(t){return t.y})).attr("fill",(function(t){return t.type?l.getColor(t.type):l.getColor(t.key)})).attr("class",(function(t){return t.type?t.type+" "+t.key:t.key})).each((function(t){r.addClickHelper(a.select(this),o.getOptions(),s.onClick,s.onDoubleClick,s.contextMenuItems,o._dataTooltip,s,t.key,t.key)})).classed("node",!0).on("mouseenter",o.nodeHoverStart).on("mouseleave",o.hoverEnd).call(a.drag().on("start",e).on("drag",n).on("end",i));return o._dataTooltip.setTarget(h),h}render(t){this.getHeightWidth(t);let e=this.initializeGraphArea(t);this.renderLinks(e),this.renderNodes(e,void 0,(function(t){a.select(this).attr("cx",a.event.x).attr("cy",a.event.y),t.x=a.event.x,t.y=a.event.y,e.selectAll("."+t.key+".link").each((function(e){t.key===e.source.key?a.select(this).attr("x1",(function(t){return t.source.x})).attr("y1",(function(t){return t.source.y})):a.select(this).attr("x2",(function(t){return t.target.x})).attr("y2",(function(t){return t.target.y}))}))}),void 0),this.configureView()}}e.D3SimpleGraph=l,o.D3Renderer.register(i.UIType.SimpleGraph,l)},,,,,function(t,e,n){"use strict";function i(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),i(n(26)),i(n(0)),i(n(13)),i(n(8)),i(n(1)),i(n(17)),i(n(4)),i(n(3)),i(n(36)),i(n(37)),i(n(39)),i(n(40)),i(n(30))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=n(0),r=n(30),o=n(4),a=n(2),s=n(20);class l extends r.D3SimpleGraph{constructor(t,e,n){super(t,e,n),s.ConnectedGraphBase.prototype.initializeGraph.call(this,t)}render(t){let e=this._element;this.getHeightWidth(this._options);let n=this._options.height,i=this._options.width;var r=a.forceSimulation().force("link",a.forceLink().id((function(t){return t.node}))).force("charge",a.forceManyBody()).force("center",a.forceCenter(i/2,n/2));r.nodes(e.nodes).on("tick",(function(){s.attr("x1",(function(t){return t.source.x})).attr("y1",(function(t){return t.source.y})).attr("x2",(function(t){return t.target.x})).attr("y2",(function(t){return t.target.y})),l.attr("cx",(function(t){return t.x})).attr("cy",(function(t){return t.y}))})),r.force("link").links(e.links);let o=this.initializeGraphArea(t),s=this.renderLinks(o),l=this.renderNodes(o,(function(t){a.event.active||r.alphaTarget(.3).restart(),t.fx=t.x,t.fy=t.y}),(function(t){t.fx=a.event.x,t.fy=a.event.y}),(function(t){a.event.active||r.alphaTarget(0),t.fx=null,t.fy=null}));this.configureView()}}e.D3ForceGraph=l,o.D3Renderer.register(i.UIType.ForceDirectedGraph,l)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=n(0),r=n(3),o=n(4),a=n(2),s=n(38),l=n(20);class h extends l.D3ConnectedGraphSVG{constructor(t,e,n){super(t,e,n),l.ConnectedGraphBase.prototype.initializeGraph.call(this,t)}renderLinks(t){let e=this,n=e._element;var i=e._sankey.link(),o=t.append("g").classed("links",!0).selectAll(".link").data(n.links).enter().append("path").attr("class",(function(t){return t.from+"-"+t.to})).attr("d",i).classed("link",!0).style("stroke-width",(function(t){return Math.max(1,t.dy)})).sort((function(t,e){return e.dy-t.dy})).on("mouseenter",e.linkHoverStart).on("mouseleave",e.hoverEnd).each((function(t){r.addClickHelper(a.select(this),e.getOptions(),n.onClick,n.onDoubleClick,n.contextMenuItems,e._dataTooltip,n,t)}));return e._dataTooltip.setTarget(o),o}renderNodes(t,e){let n=this,i=n._element,o=this._options.width;var s=t.append("g").classed("nodes",!0).selectAll(".nodeGroup").data(i.nodes).enter().append("g").classed("nodeGroup",!0).attr("transform",(function(t){return"translate("+t.x+","+t.y+")"})).each((function(t){r.addClickHelper(a.select(this),n.getOptions(),i.onClick,i.onDoubleClick,i.contextMenuItems,n._dataTooltip,i,t)})).call(a.drag().subject((function(t){return n.getOptions().disableSelection||r.onSelectHelper(n._element,t,t.key),t})).on("start",(function(){r.SVGRenderer.IS_RESIZING=!0,this.parentNode.appendChild(this)})).on("drag",e).on("end",(function(){r.SVGRenderer.IS_RESIZING=!1})));let l=n._renderer.getColorManager();return s.append("rect").attr("height",(function(t){return t.dy})).attr("width",n._sankey.nodeWidth()).attr("class",(function(t){return t.type?t.type+" "+t.key:t.key})).classed("node",!0).style("fill",(function(t){return t.type?l.getColor(t.type):l.getColor(t.key)})).style("stroke",(function(t){return a.rgb(t.color).darker(2)})).on("mouseenter",n.nodeHoverStart).on("mouseleave",n.hoverEnd),s.append("text").attr("x",-6).attr("y",(function(t){return t.dy/2})).attr("dy",".35em").attr("text-anchor","end").attr("transform",null).text((function(t){return t.key})).filter((function(t){return t.x<o/2})).attr("x",6+n._sankey.nodeWidth()).attr("text-anchor","start"),n._dataTooltip.setTarget(s),s}render(t){let e=this,n=e._element;this.getHeightWidth(this._options);let i=this._options.width,r=this._options.height;void 0!==a.sankey?e._sankey=a.sankey().size([i,r]):e._sankey=s.sankey().size([i,r]);var o=e._sankey.link();this._sankey.nodes(n.nodes).links(n.links).layout(32);let l=e.initializeGraphArea(t),h=this.renderLinks(l);this.renderNodes(l,(function(t){a.select(this).attr("transform","translate("+(t.x=Math.max(0,Math.min(i-t.dx,a.event.x)))+","+(t.y=Math.max(0,Math.min(r-t.dy,a.event.y)))+")"),e._sankey.relayout(),h.attr("d",o)})),e.configureView()}}e.D3SankeyDiagram=h,o.D3Renderer.register(i.UIType.FlowDiagram,h)},function(t,e){t.exports=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=n(0),r=n(1),o=n(3),a=n(20),s=n(4);class l extends a.D3ConnectedGraphSVG{constructor(t,e,n){super(t,e,n),this._options.width=void 0,this._nodes={},this._graphRect=this._svgRect;let r=this;this.getLinkStartXY=function(t){let e=this._nodes[t.source.node.def.key],n=a.getCoordsAndCache(r._svg,e),o={x:void 0,y:void 0},s=0;switch(t.source.alignment){case i.Alignment.Bottom:s=t.source.endPoint*((n.right-n.x)/(e.ports.bottom.length+1)),o.x=n.x+s,o.y=n.bottom;break;case i.Alignment.Top:s=t.source.endPoint*((n.right-n.x)/(e.ports.top.length+1)),o.x=n.x+s,o.y=n.y;break;case i.Alignment.Left:s=t.source.endPoint*((n.bottom-n.y)/(e.ports.left.length+1)),o.x=n.x,o.y=n.y+s;break;case i.Alignment.Right:s=t.source.endPoint*((n.bottom-n.y)/(e.ports.right.length+1)),o.x=n.right,o.y=n.y+s}return o},this.getLinkEndXY=function(t){let e=this._nodes[t.target.node.def.key],n=a.getCoordsAndCache(r._svg,e),o={x:void 0,y:void 0},s=0;switch(t.target.alignment){case i.Alignment.Bottom:s=t.target.endPoint*((n.right-n.x)/(e.ports.bottom.length+1)),o.x=n.x+s,o.y=n.bottom;break;case i.Alignment.Top:s=t.target.endPoint*((n.right-n.x)/(e.ports.top.length+1)),o.x=n.x+s,o.y=n.y;break;case i.Alignment.Left:s=t.target.endPoint*((n.bottom-n.y)/(e.ports.left.length+1)),o.x=n.x,o.y=n.y+s;break;case i.Alignment.Right:s=t.target.endPoint*((n.bottom-n.y)/(e.ports.right.length+1)),o.x=n.right,o.y=n.y+s}return o}}static isNodeRendered(t){return t.d3selection}getRectPropertyMax(t,e){let n=0;if(t)for(let i=0;i<t.length;++i){let r=this._nodes[t[i].key];l.isNodeRendered(r)&&(n=Math.max(r.rect[e],n))}return n}getStylePropertyMax(t,e){let n=0;if(t)for(let i=0;i<t.length;++i){let r=this._nodes[t[i].key];if(l.isNodeRendered(r)){let t=parseInt(o.getStyle(r.d3selection)[e]);n=Math.max(t,n)}}return n}sumVertical(t,e){let n=0;if(t){let i,r=0,a=0,s=!1;for(let h=0;h<t.length;++h){let c=this._nodes[t[h].key];if(l.isNodeRendered(c)){s&&(i=parseInt(o.getStyle(c.d3selection)["margin-top"]),r=i||e,r>a&&(n+=r-a));let t=o.convertToSVGCoords(this._svg,c.d3selection);n+=Math.max(t.height,c.rect.height),i=parseInt(o.getStyle(c.d3selection)["margin-bottom"]),a=i||e,n+=a,s=!0}}s&&(n-=a)}return n}transformVerticalNodes(t,e,n,i){let r=!1;if(n){let a,s=0,h=0,c=!1;for(let u=0;u<n.length;++u){let d=this._nodes[n[u].key];if(l.isNodeRendered(d)){r=!0;let n=o.convertToSVGCoords(this._svg,d.d3selection),l=t-Math.max(n.width,d.rect.width)/2;if(c){let t=parseInt(o.getStyle(d.d3selection)["margin-top"]);s=t||i,s>h&&(e+=s-h)}d.d3selection.transition().duration(this.getAnimateDuration()).attr("transform","translate("+l+", "+e+")"),d.rect.x=l,d.rect.y=e,e+=d.rect.height,a=parseInt(o.getStyle(d.d3selection)["margin-bottom"]),h=a||i,e+=h,c=!0}}}return r}sumHorizontal(t,e){let n=0;if(t){let i,r=0,a=0,s=!1;for(let h=0;h<t.length;++h){let c=this._nodes[t[h].key];if(l.isNodeRendered(c)){s&&(i=parseInt(o.getStyle(c.d3selection)["margin-left"]),r=i||e,r>a&&(n+=r-a));let t=o.convertToSVGCoords(this._svg,c.d3selection);n+=Math.max(t.width,c.rect.width),i=parseInt(o.getStyle(c.d3selection)["margin-right"]),a=i||e,n+=a,s=!0}}s&&(n-=a)}return n}transformHorizontalNodes(t,e,n,i){let r=!1;if(n){let a,s=0,h=0,c=!1;for(let u=0;u<n.length;++u){let d=this._nodes[n[u].key];if(l.isNodeRendered(d)){r=!0;let n=o.convertToSVGCoords(this._svg,d.d3selection),l=e-Math.max(n.height,d.rect.height)/2;if(c){let e=parseInt(o.getStyle(d.d3selection)["margin-left"]);s=e||i,s>h&&(t+=s-h)}d.d3selection.transition().duration(this.getAnimateDuration()).attr("transform","translate("+t+", "+l+")"),d.rect.x=t,d.rect.y=l,t+=d.rect.width,a=parseInt(o.getStyle(d.d3selection)["margin-right"]),h=a||i,t+=h,c=!0}}}return r}calculateNodeWidth(t,e,n,i,r,a,s,l,h){let c=0;c=Math.max(c,e.width),c=Math.max(c,i.width),c=Math.max(c,n.width),c=Math.max(c,s.width);let u=0;return 0!==r.width?(u=r.width,0!==i.width?(u+=Math.max(l,Math.max(this.getStylePropertyMax(t.left,"margin-right"),parseInt(o.getStyle(this._nodes[t.center[0].key].d3selection)["margin-left"]))),u+=i.width,0!==a.width&&(u+=Math.max(l,Math.max(parseInt(o.getStyle(this._nodes[t.center[t.center.length-1].key].d3selection)["margin-right"],this.getStylePropertyMax(t.right,"margin-left")))),u+=a.width)):0!==a.width&&(u+=Math.max(l,Math.max(this.getStylePropertyMax(t.left,"margin-right"),this.getStylePropertyMax(t.right,"margin-left"))),u+=a.width)):0!==i.width?(0!==a.width&&(u+=Math.max(l,Math.max(parseInt(o.getStyle(this._nodes[t.center[t.center.length-1].key].d3selection)["margin-right"],this.getStylePropertyMax(t.right,"margin-left")))),u+=a.width),u+=i.width):u=a.width,c=Math.max(u,c),c+=Math.max(h,parseInt(o.getStyle(this._nodes[t.key].d3selection).paddingLeft)),c+=Math.max(h,parseInt(o.getStyle(this._nodes[t.key].d3selection).paddingRight)),c}calculateNodeHeight(t,e,n,i,r,a,s,l,h){let c=0,u=0,d=0,g=0;0!==r.height&&(c=r.height,0!==e.height&&(c+=Math.max(l,Math.max(this.getStylePropertyMax(t.top,"margin-bottom"),parseInt(o.getStyle(this._nodes[t.left[0].key].d3selection)["margin-top"]))),c+=e.height),0!==n.height&&(c+=Math.max(l,Math.max(parseInt(o.getStyle(this._nodes[t.left[t.left.length-1].key].d3selection)["margin-bottom"],this.getStylePropertyMax(t.bottom,"margin-top")))),c+=n.height)),0!==i.height&&(u=i.height,0!==e.height&&(u+=Math.max(l,Math.max(this.getStylePropertyMax(t.top,"margin-bottom"),this.getStylePropertyMax(t.center,"margin-top"))),u+=e.height),0!==n.height&&(u+=n.height,u+=Math.max(l,Math.max(this.getStylePropertyMax(t.center,"margin-bottom"),this.getStylePropertyMax(t.bottom,"margin-top"))))),0!==a.height&&(d=a.height,0!==e.height&&(d+=e.height,d+=Math.max(l,Math.max(this.getStylePropertyMax(t.top,"margin-bottom"),parseInt(o.getStyle(this._nodes[t.right[0].key].d3selection)["margin-top"])))),0!==n.height&&(d+=n.height,d+=Math.max(l,Math.max(parseInt(o.getStyle(this._nodes[t.right[t.right.length-1].key].d3selection)["margin-bottom"],this.getStylePropertyMax(t.bottom,"margin-top")))))),e.height&&n.height&&(g=e.height+n.height,g+=Math.max(l,Math.max(this.getStylePropertyMax(t.top,"margin-bottom"),this.getStylePropertyMax(t.bottom,"margin-top"))));let p=0;return p=Math.max(p,e.height),p=Math.max(p,n.height),p=Math.max(p,g),p=Math.max(p,c),p=Math.max(p,u),p=Math.max(p,d),s.height&&(p+=s.height),p+=Math.max(h,parseInt(o.getStyle(this._nodes[t.key].d3selection).paddingTop)),p+=Math.max(h,parseInt(o.getStyle(this._nodes[t.key].d3selection).paddingBottom)),p}transformNode(t,e,n,r,a){let s=this,l=s._nodes[t.key],h=new i.Rect(0,0,0,0),c=parseInt(o.getStyle(l.d3selection)["margin-top"]);r=c||r;let u=parseInt(o.getStyle(l.d3selection)["padding-top"]);a=u||a;let d=new i.Rect(0,0,s.sumHorizontal(t.top,r),s.getRectPropertyMax(t.top,"height")),g=new i.Rect(0,0,s.sumHorizontal(t.bottom,r),s.getRectPropertyMax(t.bottom,"height")),p=new i.Rect(0,0,s.getRectPropertyMax(t.left,"width"),s.sumVertical(t.left,r)),f=new i.Rect(0,0,s.getRectPropertyMax(t.right,"width"),s.sumVertical(t.right,r)),m=new i.Rect(0,0,s.sumHorizontal(t.center,r),s.getRectPropertyMax(t.center,"height")),_=new i.Rect(0,0,l.rect.width,l.rect.height);if(h.width=s.calculateNodeWidth(t,d,g,m,p,f,_,r,a),h.height=s.calculateNodeHeight(t,d,g,m,p,f,_,r,a),e){e.attr("height",h.height).attr("width",h.width);let t=o.convertToSVGCoords(s._svg,e);h.height=t.height,h.width=t.width,e.attr("height",0).attr("width",0).transition().duration(s.getAnimateDuration()).attr("x",0).attr("y",0).attr("height",h.height).attr("width",h.width)}if(l.rect=h,n){o.getStyle(n);let t=(h.width-_.width)/2,e=a;n.transition().duration(s.getAnimateDuration()).attr("transform","translate("+t+","+e+")")}let y=h.width/2,v=y-d.width/2,x=s._padding+_.height+d.height/2;s.transformHorizontalNodes(v,x,t.top,r);let w=p.width+(h.width-f.width-p.width)/2,b=d.height+_.height+(h.height-g.height-d.height-_.height)/2;if(v=s._padding+p.width/2,s.transformVerticalNodes(v,b-p.height/2,t.left,r),v=h.width-(f.width+s._padding)/2,s.transformVerticalNodes(v,b-f.height/2,t.right,r),v=y-g.width/2,x=h.height-g.height/2-s._padding,s.transformHorizontalNodes(v,x,t.bottom,r),t.center&&t.center.length>0){let e=w-m.width/2;p.width&&(e=Math.max(e,s._padding+p.width+Math.max(r,Math.max(this.getStylePropertyMax(t.left,"margin-right"),parseInt(o.getStyle(s._nodes[t.center[0].key].d3selection)["margin-left"]))))),f.width&&(e=Math.min(e,h.width-s._padding-f.width-m.width-Math.max(r,Math.max(this.getStylePropertyMax(t.right,"margin-left"),parseInt(o.getStyle(s._nodes[t.center[t.center.length-1].key].d3selection)["margin-left"])))));let n=b;d.height&&(n=Math.max(n,s._padding+d.height+Math.max(r,Math.max(this.getStylePropertyMax(t.top,"margin-bottom"),this.getStylePropertyMax(t.center,"margin-top")))+m.height/2)),g.height&&(n=Math.min(n,h.height-s._padding-g.height-m.height/2-Math.max(r,Math.max(this.getStylePropertyMax(t.center,"margin-bottom"),this.getStylePropertyMax(t.bottom,"margin-top"))))),s.transformHorizontalNodes(e,n,t.center,r)}}configureItemHover(t,e){let n=this;e.def.disableHover?t.on("mouseenter",(function(){t.classed("hover",!0)})).on("mouseleave",(function(){t.classed("hover",!1)})):t.on("mouseenter",n.nodeHoverStart).on("mouseleave",n.hoverEnd),e.def.hideTooltip||n._dataTooltip.setTarget(t);let i=this._element;o.addClickHelper(t,n.getOptions(),i.onClick,i.onDoubleClick,i.contextMenuItems,n._dataTooltip,i,e.def,e.def.key),t.node().__data__=e.def}renderNodes(t,e,n,a){let s=this;e.depth=a;let h={def:e,ports:{}};if(s._nodes[e.key]=h,e.parent=t,s._decimator&&!s._decimator.isVisible(e))return void delete h.d3selection;let c=function(){if(e.type&&e.type.length>0)for(let t=0;t<e.type.length;++t)if(s._colorMgr.hasColor(e.type[t]))return s._colorMgr.getColor(e.type[t]);return e.key&&s._colorMgr.hasColor(e.key)?s._colorMgr.getColor(e.key):"white"},u=r.getSelectionName(e.key)+" node ";if(e.type&&e.type.length>0)for(let t=0;t<e.type.length;++t)u+=" "+r.getSelectionName(e.type[t]);let d,g,p=n.append("g").classed(u,!0);h.d3selection=p,e.hideBorder||(d=p.append("rect").classed(u,!0).classed("border",!0).attr("fill",c).attr("stroke","black").attr("stroke-opacity",.2).attr("rx",6).attr("ry",6),s.configureItemHover(d,h));for(let t=0;t<l.CHILDREN.length;++t){let n=l.CHILDREN[t];if(e.hasOwnProperty(n))for(let t=0;t<e[n].length;++t)s.renderNodes(e,e[n][t],p,a+1)}let f,m,_,y,v=new i.Rect(0,0,0,0);if(!e.hideImageLabel&&(e.label||e.image)){if(g=p.append("g").classed(u,!0),e.image){f=g.append("image").attr("xlink:href",e.image).classed(u,!0).attr("x",s._renderOrigin.x).attr("y",s._renderOrigin.y);let t=parseInt(o.getStyle(f).height),n=parseInt(o.getStyle(f).width);f.attr("height",t||(e.imageHeight?e.imageHeight:40)),f.attr("width",n||(e.imageWidth?e.imageWidth:40)),s.configureItemHover(f,h),m=o.convertToSVGCoords(s._svg,f),v.width=Math.max(v.width,m.width),v.height+=m.height}e.label&&(_=g.append("text").classed(u,!0).attr("x",s._renderOrigin.x).attr("y",s._renderOrigin.y).attr("text-anchor","middle").attr("alignment-baseline","middle").text(e.label),s.configureItemHover(_,h),y=o.convertToSVGCoords(s._svg,_),v.width=Math.max(v.width,y.width),v.height+=y.height)}0!==s._renderOrigin.x||0!==s._renderOrigin.y?(d&&d.attr("x",s._renderOrigin.x).attr("y",s._renderOrigin.y),m&&f.transition().duration(s.getAnimateDuration()).attr("x",v.width/2-m.width/2).attr("y",0),y&&_.transition().duration(s.getAnimateDuration()).attr("x",v.width/2).attr("y",v.height-y.height/2)):(m&&f.attr("x",v.width/2-m.width/2).attr("y",0),y&&_.attr("x",v.width/2).attr("y",v.height-y.height/2)),h.rect=v,s.transformNode(e,d,g,s._margin,s._padding)}createLinks(t){let e=[],n=this;for(let r=0;r<t.length;++r){let a=n._nodes[t[r].from],s=n._nodes[t[r].to];if(n._decimator){for(;a&&!n._decimator.isVisible(a.def);)a=n._nodes[a.def.parent.key];for(;s&&!n._decimator.isVisible(s.def);)s=n._nodes[s.def.parent.key]}if(void 0===a||void 0===s)continue;let l=a.def.depth>s.def.depth?a:s,h=a.def.depth>s.def.depth?s:a;for(;h.def.depth!=l.def.depth;)l=n._nodes[l.def.parent.key];if(h===l)continue;let c={def:t[r],source:{node:a,endPoint:void 0,alignment:void 0},target:{node:s,endPoint:void 0,alignment:void 0}};e.push(c);let u=o.convertToSVGCoords(n._svg,a.d3selection),d=o.convertToSVGCoords(n._svg,s.d3selection);u.bottom<d.y?(a.ports.bottom||(a.ports.bottom=[]),s.ports.top||(s.ports.top=[]),a.ports.bottom.push(c),s.ports.top.push(c),c.source.alignment=i.Alignment.Bottom,c.target.alignment=i.Alignment.Top):u.y>d.bottom?(a.ports.top||(a.ports.top=[]),s.ports.bottom||(s.ports.bottom=[]),a.ports.top.push(c),s.ports.bottom.push(c),c.source.alignment=i.Alignment.Top,c.target.alignment=i.Alignment.Bottom):u.right<d.x?(a.ports.right||(a.ports.right=[]),s.ports.left||(s.ports.left=[]),a.ports.right.push(c),s.ports.left.push(c),c.source.alignment=i.Alignment.Right,c.target.alignment=i.Alignment.Left):(a.ports.left||(a.ports.left=[]),s.ports.right||(s.ports.right=[]),a.ports.left.push(c),s.ports.right.push(c),c.source.alignment=i.Alignment.Left,c.target.alignment=i.Alignment.Right)}return e}mergeNodePorts(t,e){let n={},i=0;for(let r=0;r<t.length;++r){let o=t[r],a=o.def;o.source.node===e?a.fromConnectionPoint?(void 0===n[a.fromConnectionPoint]&&(n[a.fromConnectionPoint]=++i),o.source.endPoint=n[a.fromConnectionPoint]):o.source.endPoint=++i:a.toConnectionPoint?(void 0===n[a.toConnectionPoint]&&(n[a.toConnectionPoint]=++i),o.target.endPoint=n[a.toConnectionPoint]):o.target.endPoint=++i}t.length=i}orderNodePorts(){for(let t in this._nodes){let e=this._nodes[t],n=function(t,n){let i=t.source.node===e?t.target.node:t.source.node,r=n.source.node===e?n.target.node:n.source.node;return i.d3selection.node().getBoundingClientRect().top-r.d3selection.node().getBoundingClientRect().top},i=function(t,n){let i=t.source.node===e?t.target.node:t.source.node,r=n.source.node===e?n.target.node:n.source.node;return i.d3selection.node().getBoundingClientRect().left-r.d3selection.node().getBoundingClientRect().left};e.ports.top&&(e.ports.top.sort(i),this.mergeNodePorts(e.ports.top,e)),e.ports.bottom&&(e.ports.bottom.sort(i),this.mergeNodePorts(e.ports.bottom,e)),e.ports.left&&(e.ports.left.sort(n),this.mergeNodePorts(e.ports.left,e)),e.ports.right&&(e.ports.right.sort(n),e.ports.right.sort(n),this.mergeNodePorts(e.ports.right,e))}}renderLinks(t,e){let n=this.createLinks(t);this.orderNodePorts(),this.renderLinkHelper(e,n)}sizeViewToFit(t){let e,n=this._nodes[t.key].rect;return this._options.fitToWindow?(e=this._svg.transition("resizeView").duration(this.getAnimateDuration()).attr("viewBox","0 0 "+n.width+" "+n.height).attr("preserveAspectRatio","xMidYMid meet"),this._options.width?e.attr("width",this._options.width).attr("height",void 0):this._options.height?e.attr("width",void 0).attr("height",this._options.height):e.attr("width","100%").attr("height",void 0)):e=this._svg.transition("resizeView").duration(this.getAnimateDuration()).attr("width",n.width).attr("height",n.height),e}renderHelper(t,e=!1){let n=this;n._nodes={};let i=n._svg.insert("g","g").classed("graph",!0),r=n.getAnimateDuration();e&&(n._options.animateDuration=0,i.attr("opacity",0)),n._decimator=n._element.decimator,n.renderNodes(void 0,t,i,0),n.initializeLinkLayer(i);let o=n._element.links;return i.transition("nodeWait").duration(n.getAnimateDuration()).on("end",(function(){n.renderLinks(o,i)})),e?n._options.animateDuration=r:n.sizeViewToFit(t),i}render(t){let e=this;e._element;e._margin=30,e._padding=10,e.loadOptions(t);let n=e._element.nodes,i=e._svg.select(".graph"),r=e.getAnimateDuration();if(0!==r){let t=e._nodes[n.key];e._renderOrigin={x:0,y:0};let a,s=e.renderHelper(n,!0),l=i.select("rect").node();if(l&&(a=e._nodes[l.__data__.key]),t){let a=e._nodes[n.key],l=o.convertToSVGCoords(e._svg,t.d3selection),h=i.transition("translateOldNode").duration(r).attr("transform","translate(-"+l.x+",-"+l.y+")"),c=e.sizeViewToFit(n);t.d3selection.selectAll("*").size()!==a.d3selection.selectAll("*").size()?(s.remove(),c.transition().duration(r/2).attr("width",0).attr("height",0).on("end",(function(){i.remove(),e.renderHelper(n)}))):h.on("end",(function(){i.remove(),s.attr("opacity",1)}))}else a&&a.d3selection?setTimeout((function(){let t=o.convertToSVGCoords(e._svg,a.d3selection),l=t.x,h=t.y;e._renderOrigin={x:(t.x+t.right)/2,y:(t.y+t.bottom)/2};let c=a.d3selection.selectAll("*").size()!==i.select(".node").selectAll("*").size();s.remove();i.transition("translateOldNode").duration(r).attr("width",0).attr("height",0).attr("transform","translate("+l+","+h+")").on("end",(function(){c&&i.remove(),e.renderHelper(n).transition().duration(e.getAnimateDuration()).on("end",(function(){c||i.remove()}))}));e.sizeViewToFit(n)}),0):(s.remove(),e._renderOrigin={x:0,y:0},e._svg.transition("hideView").duration(r).attr("width",0).attr("height",0).on("end",(function(){i.remove(),e.renderHelper(n)})))}else e._renderOrigin={x:0,y:0},i.remove(),e.renderHelper(n)}}e.D3HierarchyGraph=l,l.CHILDREN=["top","bottom","left","right","center"],s.D3Renderer.register(i.UIType.HierarchyGraph,l)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=n(1),r=n(0),o=n(26),a=n(4),s=n(3),l=n(2),h=n(10),c=n(41),u=n(20),d=n(14);class g{updatePosition(t){this.def.x+=t.dx,this.def.y+=t.dy,this._nodeContainer.attr("transform",`translate(${this.def.x}, ${this.def.y})`)}renderPort(t,e){return this._nodeContainer.append("circle").attr("class",this._portDiagram.getClasses(this.def)+" "+t.key).classed("port",!0).attr("cx",t.x).attr("cy",t.y).attr("r",f).attr("fill","white").attr("stroke-width",1).attr("stroke",this._portDiagram.getColor(this.def))}}class p{constructor(){this._selectTempItems={}}initializeNode(){this._nodeContainer=new h.Container}getNode(){return this._nodeContainer}updatePosition(t){this.def.x+=t.dx,this.def.y+=t.dy,this._nodeContainer.x=this.def.x,this._nodeContainer.y=this.def.y}renderPort(t,e){let n=e.manager.add(this.def.type[0],this.def.key,h.SCALE_MODES.LINEAR,1,(function(){let t=new h.Graphics;return t.beginFill(e.color),t.drawCircle(0,0,f),t.beginFill(16777215),t.drawCircle(0,0,f-1),t.endFill(),t}));return n.x=t.x-f,n.y=t.y-f,n.renderer=this,this._nodeContainer.addChild(n),n}select(t,e,n,i){let r=function(e){let n=e.width/2,r=n+m,o=i.add(t+r,t+r,h.SCALE_MODES.LINEAR,1,(function(){let t=new h.Graphics;return t.beginFill(16777215),t.drawCircle(0,0,r),t.endFill(),t}));return o.x=e.x+n-r,o.y=e.y+n-r,o.tint=_,o.__data__=e.__data__,o}(e);this._selectTempItems[`${t}Select${n}`]=r,e.parent.addChildAt(r,0)}unselect(t,e,n){let i=this._selectTempItems[`${t}Select${n}`];i.parent.removeChild(i),delete this._selectTempItems[`${t}Select`]}}let f=3,m=3,_=15921737,y={x:-25,y:-25,height:50,width:50};class v{constructor(t){this._selectTempItems={},this.def=t}configureNode(){this.def.height=50,this.def.width=50}getPortAreaRect(){return y}}class x{constructor(t){this.def=t}getXYOffset(){return{x:.5*-this.def.width,y:.5*-this.def.height}}getTitle(){return this.def.type.length>0?this.def.type[0]:"None"}getTitleTextRect(){throw"Error please implement this function"}configureNode(){let t=this.def,e=t.ports.top?t.ports.top.length:0,n=t.ports.bottom?t.ports.bottom.length:0,i=t.ports.left?t.ports.left.length:0,o=t.ports.right?t.ports.right.length:0,a=this.getTitleTextRect(),s=a.height+6,l=s+6+50,h=a.width+6,c=.5*-h,u=.5*-l;this._portRect=new r.Rect(c,s+u,Math.max(15*Math.max(e,n),h),Math.max(15*Math.max(i,o),l)),this.def.height=s+this._portRect.height,this.def.width=this._portRect.width}getPortAreaRect(){return this._portRect}}class w extends v{constructor(t,e){super(t),this._portDiagram=e,this.updatePosition=g.prototype.updatePosition.bind(this),this.renderPort=g.prototype.renderPort.bind(this)}renderNode(t){return this._nodeContainer=t.group.append("g"),this._nodeContainer.append("circle").attr("class",this._portDiagram.getClasses(this.def)).classed("node",!0).attr("r",25).attr("cx",0).attr("cy",0).attr("fill",this._portDiagram.getColor(this.def)),void 0!==this.def.x&&this.updatePosition({dx:0,dy:0}),this._nodeContainer}}class b extends v{constructor(t){super(t),this.initializeNode=p.prototype.initializeNode.bind(this),this.getNode=p.prototype.getNode.bind(this),this.updatePosition=p.prototype.updatePosition.bind(this),this.renderPort=p.prototype.renderPort.bind(this)}renderNode(t){this.initializeNode();let e=t.manager.add(this.def.type[0],this.def.key,h.SCALE_MODES.LINEAR,4,(function(){let e=new h.Graphics;return e.beginFill(16777215),e.drawCircle(-25,-25,25),e.beginFill(t.color),e.drawCircle(-25,-25,24),e.endFill(),e}));return e.x=-25,e.y=-25,this._nodeContainer.addChild(e),void 0!==this.def.x&&this.updatePosition({dx:0,dy:0}),e}select(t,e,n,i){console.log("need node select");let r=function(e){let n=e.width/2,r=n+m,o=i.add(t+r,t+r,h.SCALE_MODES.LINEAR,1,(function(){let t=new h.Graphics;return t.beginFill(16777215),t.drawCircle(0,0,r),t.endFill(),t}));return o.x=e.x+n-r,o.y=e.y+n-r,o.tint=_,o.__data__=e.__data__,o}(e);this._selectTempItems[`${t}Select${n}`]=r,e.parent.addChildAt(r,0)}unselect(t,e,n){let i=this._selectTempItems[`${t}Select${n}`];i.parent.removeChild(i),delete this._selectTempItems[`${t}Select${n}`]}}class M extends x{constructor(t,e,n){super(t),this._portDiagram=e,this._svg=n,this.updatePosition=g.prototype.updatePosition.bind(this),this.renderPort=g.prototype.renderPort.bind(this)}getTitleTextRect(){return s.getTextRect(this._svg,this.getTitle())}renderNode(t){this._nodeContainer=t.group.append("g");let e=this._nodeContainer.append("rect"),n=this._nodeContainer.append("rect"),i=this._nodeContainer.append("text"),r=this.getXYOffset(),o=r.x,a=r.y,s=this.getTitle();return i.text(s).attr("fill","white").attr("stroke","white").attr("alignment-baseline","hanging").attr("x",o+3).attr("y",a+3),e.attr("class",this._portDiagram.getClasses(this.def)).classed("node",!0).classed("border",!0).attr("fill","#FFFFFF").attr("stroke","#000000").attr("stroke-width",1).attr("x",o).attr("y",a).attr("width",this.def.width).attr("height",this.def.height).attr("rx",3).attr("ry",3),n.attr("class",this._portDiagram.getClasses(this.def)).classed("node",!0).classed("title-box",!0).attr("fill",this._portDiagram.getColor(this.def)).attr("x",o).attr("y",a).attr("width",this.def.width).attr("height",20).attr("rx",3).attr("ry",3),void 0!==this.def.x&&this.updatePosition({dx:0,dy:0}),this._nodeContainer}}class C extends x{constructor(t,e){super(t),this._selectTempItems={},this._pixiHelper=e,this.initializeNode=p.prototype.initializeNode.bind(this),this.getNode=p.prototype.getNode.bind(this),this.updatePosition=p.prototype.updatePosition.bind(this),this.renderPort=p.prototype.renderPort.bind(this)}getTitleTextRect(){let t=this.getTitle();return this._pixiHelper.renderText(t,l.select(this._pixiHelper.getRenderer().view.parentNode),16777215)}renderNode(t){this.initializeNode();let e=`${this.def.type[0]}H${this.def.height}W${this.def.width}`;e+=this.def.ports.top?`T${this.def.ports.top.length}`:"",e+=this.def.ports.left?`L${this.def.ports.left.length}`:"",e+=this.def.ports.right?`R${this.def.ports.right.length}`:"",e+=this.def.ports.bottom?`B${this.def.ports.bottom.length}`:"";let n=t.manager.add(e,this.def.key,h.SCALE_MODES.LINEAR,1,()=>{let e=this.getTitle();this._titleText=this._pixiHelper.renderText(e,l.select(this._pixiHelper.getRenderer().view.parentNode),16777215),this._titleText.x=3,this._titleText.y=3;let n=new h.Graphics;return n.beginFill(16777215,1),n.lineStyle(1,0,.7),n.drawRoundedRect(0,0,this._portRect.width,this.def.height,3),n.beginFill(t.color,1),n.drawRoundedRect(0,0,this._portRect.width,this._titleText.height+6,3),n.addChild(this._titleText),n}),i=this.getXYOffset();return n.x=i.x,n.y=i.y,this._nodeContainer.addChild(n),void 0!==this.def.x&&this.updatePosition({dx:0,dy:0}),n}select(t,e,n,i){let r=new h.Graphics;r.lineStyle(2*m,_),r.drawRoundedRect(0,0,this._portRect.width,this.def.height,3);let o=this.getXYOffset();r.x=o.x,r.y=o.y,this._nodeContainer.addChildAt(r,0),this._selectTempItems[`${t}Select${n}`]=r,e.parent.addChildAt(r,0)}unselect(t,e,n){let i=this._selectTempItems[`${t}Select${n}`];i.parent.removeChild(i),delete this._selectTempItems[`${t}Select${n}`]}}class k extends a.UIElementRenderer{constructor(t,e,n){super(),this._nodePortInfo={},this._options={},this.invalidate=this.render,this._element=t,this._rendererManager=e,this._parent=n,this._nodes={},this._requiresLayout=!1,this._renderedNodes=[];let i=this;this.getLinkStartXY=function(t){let e=i._nodes[t.def.from],n=t.def,r=i._nodePortInfo[e.key][n.fromPort];return{x:e.x+r.x,y:e.y+r.y}},this.getLinkEndXY=function(t){let e=i._nodes[t.def.to],n=t.def,r=i._nodePortInfo[e.key][n.toPort];return{x:e.x+r.x,y:e.y+r.y}}}hover(t){this.focus(t)}focus(t){this._renderer.focus(t)}select(t){this._renderer.select(t)}cursorChange(t){}brush(t){this._renderer.brush(t)}addNodePorts(t,e,n){let i=this;if(t){let o=e.def.key;i._nodePortInfo[o]||(i._nodePortInfo[o]={});let a=e.getPortAreaRect(),s=a.height/t.length,l=.5*s,h=a.width/t.length,c=.5*h,u=i._nodePortInfo[o];switch(n){case r.Alignment.Top:t.forEach((function(t,e){let i=a.x+c+h*e;u[t.key]={key:t.key,index:e,alignment:n,x:i,y:0}}));break;case r.Alignment.Bottom:t.forEach((function(t,i){let r=a.x+c+h*i;u[t.key]={key:t.key,index:i,alignment:n,x:r,y:e.def.height}}));break;case r.Alignment.Left:t.forEach((function(t,e){let i=l+s*e+a.y;u[t.key]={key:t.key,index:e,alignment:n,x:a.x,y:i}}));break;case r.Alignment.Right:t.forEach((function(t,i){let r=l+s*i+a.y;u[t.key]={key:t.key,index:i,alignment:n,x:a.x+e.def.width,y:r}}))}}}addPorts(t){this.addNodePorts(t.def.ports.left,t,r.Alignment.Left),this.addNodePorts(t.def.ports.right,t,r.Alignment.Right),this.addNodePorts(t.def.ports.top,t,r.Alignment.Top),this.addNodePorts(t.def.ports.bottom,t,r.Alignment.Bottom)}getColor(t){let e,n=this._rendererManager.getColorManager();return e=n.hasColor(t.key)?n.getColor(t.key):t.type?n.getColor(t.type[0]):n.getColor(t.key),e}getClasses(t){let e=t.key;return t.type.forEach((function(t){e+=" "+t})),e}addNode(t){t.configureNode(),this._nodes[t.def.key]=t.def}createRenderedLinks(){let t=this._element.links,e=[],n=this;return t.forEach((function(t){let i=n._nodes[t.from],r=n._nodes[t.to];if(!i||!r)return;let o=n._nodePortInfo[i.key][t.fromPort],a=n._nodePortInfo[r.key][t.toPort],s={def:t,source:{node:i,alignment:o.alignment},target:{node:r,alignment:a.alignment}};e.push(s)})),e}layout(t,e){let n=this._element;if(n.nodes&&n.nodes.length>0&&void 0===n.nodes[0].x){var i=new c.graphlib.Graph;i.setGraph({rankdir:"LR"}),i.setDefaultEdgeLabel((function(){return{}})),t.forEach(t=>{t.def.label=t.def.key,i.setNode(t.def.key,t.def)}),e.forEach(t=>{i.setEdge(t.def.from,t.def.to)}),c.layout(i),t.forEach(t=>{t.updatePosition({dx:0,dy:0})})}}render(t){i.merge(this._options,t),this._renderer||(this._options.forceSvgRenderer?this._renderer=new T(this._element,this._rendererManager,this._parent,this):this._renderer=new S(this._element,this._rendererManager,this._parent,this),this._renderer.setColorManager(this._colorMgr)),this._renderer.render(this._options)}}e.D3PortDiagram=k;class T extends u.D3ConnectedGraphSVG{constructor(t,e,n,i){super(t,e,n),u.DiagramBase.prototype.bind.call(this,this._renderer,this._element),this._portDiagram=i,this.getLinkStartXY=i.getLinkStartXY,this.getLinkEndXY=i.getLinkEndXY}render(t){this.getHeightWidth(t);let e=this.initializeGraphArea(t);this.initializeLinkLayer(e);let n=this.renderNodes(e),i=this._portDiagram.createRenderedLinks();this._portDiagram.layout(n,i),this.renderLinkHelper(e,i),this.configureView()}renderNodes(t){let e=this,n=e._element;e._portDiagram._nodePortInfo={};let i=[],r=t.append("g").attr("class","nodes");return n.nodes.forEach(a=>{if(n.decimator&&!n.decimator(a))return;let h;h=n.nodeRenderType===o.NodeType.NodeRectangle||a.renderType===o.NodeType.NodeRectangle?new M(a,e._portDiagram,e._svg):new w(a,e._portDiagram),e._portDiagram.addNode(h),e._portDiagram.addPorts(h),i.push(h);let c=h.renderNode({group:r}).on("mouseenter",e.nodeHoverStart).on("mouseleave",e.hoverEnd).call(l.drag().on("drag",(function(n){e._dataTooltip.hideTooltip(),h.updatePosition(l.event);let i=[];t.selectAll(".link."+n.key).each((function(t){i.push(t)})),e.renderLinkHelper(t,i,!0)})));if(c.node().__data__=h.def,s.addClickHelper(c,e.getOptions(),n.onClick,n.onDoubleClick,n.contextMenuItems,e._dataTooltip,n,h.def,h.def.key),e._dataTooltip.setTarget(c),!e._element.disablePortRendering){let t=this._portDiagram._nodePortInfo[h.def.key];for(let i in t){let r=t[i],o=h.renderPort(r);o.node().__data__=r,s.addClickHelper(o,e.getOptions(),n.onClick,n.onDoubleClick,n.contextMenuItems,this._dataTooltip,n,r),this._dataTooltip.setTarget(o)}}}),i}}e.D3PortDiagramSVG=T,a.D3Renderer.register(r.UIType.PortDiagram,k);class S extends u.D3ConnectedGraphPixi{constructor(t,e,n,i){super(t,e,n),this._portDiagram=i,this.getLinkStartXY=i.getLinkStartXY,this.getLinkEndXY=i.getLinkEndXY}renderNodes(t){let e=this,n=e._element;e._nodeGraphics=new d.GraphicsManager(e._pixi),e._element.disablePortRendering||(e._portGraphics=new d.GraphicsManager(e._pixi));let i=[];return n.nodes.forEach((function(r){let a;if(a=n.nodeRenderType===o.NodeType.NodeRectangle||r.renderType===o.NodeType.NodeRectangle?new C(r,e._pixiHelper):new b(r),e._portDiagram.addNode(a),e._portDiagram.addPorts(a),i.push(a),n.decimator&&!n.decimator(r))return;let s=parseInt(e._portDiagram.getColor(r).substring(1),16),l=a.renderNode({color:s,manager:e._nodeGraphics});if(l.__data__=r,l.renderer=a,e._pixiHelper.addSelection(r.key,l),e._pixiHelper.addInteractionHelper(l,e.getOptions(),n.onClick,n.onDoubleClick,n.contextMenuItems,e.nodeHoverStart,e.hoverEnd,e._dataTooltip,n,r,r.key),!e._element.disablePortRendering){let t=e._portDiagram._nodePortInfo[r.key];for(let i in t){let o=t[i],l=a.renderPort(o,{color:s,manager:e._portGraphics});e._pixiHelper.addSelection(r.key,l),e._pixiHelper.addSelection(r.key+o.key,l),e._pixiHelper.addInteractionHelper(l,e.getOptions(),n.onClick,n.onDoubleClick,n.contextMenuItems,e.nodeHoverStart,e.hoverEnd,e._dataTooltip,n,{def:o},r.key)}}let h,c=a.getNode();function u(e){this.data=e.data,this.dragging=!0,t.itemDragging=!0,h=this.data.getLocalPosition(c.parent),e.stopPropagation()}function d(n){if(this.dragging){e._dataTooltip.hideTooltip();let i=this.data.getLocalPosition(c.parent);i.dx=i.x-h.x,i.dy=i.y-h.y,a.updatePosition(i),e.renderLinkHelper(t,e._renderedLinks),e._pixiHelper.render(),n.stopPropagation(),h=i}}function g(){this.dragging=!1,t.itemDragging=!1,this.data=null}l.on("mousedown",u).on("touchstart",u).on("mouseup",g).on("mouseupoutside",g).on("touchend",g).on("touchendoutside",g).on("mousemove",d).on("touchmove",d),t.addChild(c)})),i}_select(t){if(t){let e=this._pixiHelper.getSelection(t);if(e){let n=this;e.forEach((function(e,i){e.renderer.select(t,e,i,n._nodeGraphics)}))}this._pixiHelper.render()}}_unselect(t){let e=this._pixiHelper.getSelection(t);e&&(e.forEach((function(e,n){e.renderer.unselect(t,e,n)})),this._pixiHelper.render())}render(t){i.merge(this._options,t),this.getHeightWidth(this._options);let e=this;e._element;if(!(void 0===this._pixiHelper)&&(t.height||t.width))return this._pixi.resize(e._options.width,e._options.height),void this._pixiHelper.render();e._portDiagram._nodePortInfo={};let n=e.initializeGraphArea(t),r=e.renderNodes(n);this._renderedLinks=e._portDiagram.createRenderedLinks(),e._portDiagram.layout(r,this._renderedLinks),e.renderLinkHelper(n,this._renderedLinks),e.configureView(),e._pixiHelper.render(n)}}e.D3PortDiagramPixi=S,a.D3Renderer.register(r.UIType.PortDiagram,k)},function(t,e){t.exports=r}])}));