reactflow-velocity
Version:
React Flow - A highly customizable React library for building node-based editors and interactive flow charts.
1 lines • 164 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react/jsx-runtime"),require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime","react","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactFlow={},e.jsxRuntime,e.React,e.ReactDOM)}(this,(function(e,t,n,o){"use strict";function r(e){if("string"==typeof e||"number"==typeof e)return""+e;let t="";if(Array.isArray(e))for(let n,o=0;o<e.length;o++)""!==(n=r(e[o]))&&(t+=(t&&" ")+n);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var i={value:()=>{}};function s(){for(var e,t=0,n=arguments.length,o={};t<n;++t){if(!(e=arguments[t]+"")||e in o||/[\s.]/.test(e))throw new Error("illegal type: "+e);o[e]=[]}return new a(o)}function a(e){this._=e}function l(e,t){for(var n,o=0,r=e.length;o<r;++o)if((n=e[o]).name===t)return n.value}function c(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=i,e=e.slice(0,o).concat(e.slice(o+1));break}return null!=n&&e.push({name:t,value:n}),e}a.prototype=s.prototype={constructor:a,on:function(e,t){var n,o,r=this._,i=(o=r,(e+"").trim().split(/^|\s+/).map((function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!o.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}}))),s=-1,a=i.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++s<a;)if(n=(e=i[s]).type)r[n]=c(r[n],e.name,t);else if(null==t)for(n in r)r[n]=c(r[n],e.name,null);return this}for(;++s<a;)if((n=(e=i[s]).type)&&(n=l(r[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new a(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,o,r=new Array(n),i=0;i<n;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,n=(o=this._[e]).length;i<n;++i)o[i].value.apply(t,r)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};var d="http://www.w3.org/1999/xhtml",u={svg:"http://www.w3.org/2000/svg",xhtml:d,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function h(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),u.hasOwnProperty(t)?{space:u[t],local:e}:e}function f(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===d&&t.documentElement.namespaceURI===d?t.createElement(e):t.createElementNS(n,e)}}function p(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function g(e){var t=h(e);return(t.local?p:f)(t)}function m(){}function y(e){return null==e?m:function(){return this.querySelector(e)}}function v(){return[]}function x(e){return null==e?v:function(){return this.querySelectorAll(e)}}function w(e){return function(){return null==(t=e.apply(this,arguments))?[]:Array.isArray(t)?t:Array.from(t);var t}}function b(e){return function(){return this.matches(e)}}function S(e){return function(t){return t.matches(e)}}var C=Array.prototype.find;function E(){return this.firstElementChild}var _=Array.prototype.filter;function N(){return Array.from(this.children)}function M(e){return new Array(e.length)}function k(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function P(e,t,n,o,r,i){for(var s,a=0,l=t.length,c=i.length;a<c;++a)(s=t[a])?(s.__data__=i[a],o[a]=s):n[a]=new k(e,i[a]);for(;a<l;++a)(s=t[a])&&(r[a]=s)}function O(e,t,n,o,r,i,s){var a,l,c,d=new Map,u=t.length,h=i.length,f=new Array(u);for(a=0;a<u;++a)(l=t[a])&&(f[a]=c=s.call(l,l.__data__,a,t)+"",d.has(c)?r[a]=l:d.set(c,l));for(a=0;a<h;++a)c=s.call(e,i[a],a,i)+"",(l=d.get(c))?(o[a]=l,l.__data__=i[a],d.delete(c)):n[a]=new k(e,i[a]);for(a=0;a<u;++a)(l=t[a])&&d.get(f[a])===l&&(r[a]=l)}function z(e){return e.__data__}function A(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function I(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function D(e){return function(){this.removeAttribute(e)}}function R(e){return function(){this.removeAttributeNS(e.space,e.local)}}function $(e,t){return function(){this.setAttribute(e,t)}}function T(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function B(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function j(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function L(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function V(e){return function(){this.style.removeProperty(e)}}function H(e,t,n){return function(){this.style.setProperty(e,t,n)}}function X(e,t,n){return function(){var o=t.apply(this,arguments);null==o?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Y(e,t){return e.style.getPropertyValue(t)||L(e).getComputedStyle(e,null).getPropertyValue(t)}function Z(e){return function(){delete this[e]}}function U(e,t){return function(){this[e]=t}}function W(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function F(e){return e.trim().split(/^|\s+/)}function K(e){return e.classList||new G(e)}function G(e){this._node=e,this._names=F(e.getAttribute("class")||"")}function q(e,t){for(var n=K(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Q(e,t){for(var n=K(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function J(e){return function(){q(this,e)}}function ee(e){return function(){Q(this,e)}}function te(e,t){return function(){(t.apply(this,arguments)?q:Q)(this,e)}}function ne(){this.textContent=""}function oe(e){return function(){this.textContent=e}}function re(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function ie(){this.innerHTML=""}function se(e){return function(){this.innerHTML=e}}function ae(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function le(){this.nextSibling&&this.parentNode.appendChild(this)}function ce(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function de(){return null}function ue(){var e=this.parentNode;e&&e.removeChild(this)}function he(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function fe(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function pe(e){return function(){var t=this.__on;if(t){for(var n,o=0,r=-1,i=t.length;o<i;++o)n=t[o],e.type&&n.type!==e.type||n.name!==e.name?t[++r]=n:this.removeEventListener(n.type,n.listener,n.options);++r?t.length=r:delete this.__on}}}function ge(e,t,n){return function(){var o,r=this.__on,i=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(r)for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===e.type&&o.name===e.name)return this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),void(o.value=t);this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function me(e,t,n){var o=L(e),r=o.CustomEvent;"function"==typeof r?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function ye(e,t){return function(){return me(this,e,t)}}function ve(e,t){return function(){return me(this,e,t.apply(this,arguments))}}k.prototype={constructor:k,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},G.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var xe=[null];function we(e,t){this._groups=e,this._parents=t}function be(){return new we([[document.documentElement]],xe)}function Se(e){return"string"==typeof e?new we([[document.querySelector(e)]],[document.documentElement]):new we([[e]],xe)}function Ce(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,[(o=o.matrixTransform(t.getScreenCTM().inverse())).x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}we.prototype=be.prototype={constructor:we,select:function(e){"function"!=typeof e&&(e=y(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,s,a=t[r],l=a.length,c=o[r]=new Array(l),d=0;d<l;++d)(i=a[d])&&(s=e.call(i,i.__data__,d,a))&&("__data__"in i&&(s.__data__=i.__data__),c[d]=s);return new we(o,this._parents)},selectAll:function(e){e="function"==typeof e?w(e):x(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s,a=t[i],l=a.length,c=0;c<l;++c)(s=a[c])&&(o.push(e.call(s,s.__data__,c,a)),r.push(s));return new we(o,r)},selectChild:function(e){return this.select(null==e?E:function(e){return function(){return C.call(this.children,e)}}("function"==typeof e?e:S(e)))},selectChildren:function(e){return this.selectAll(null==e?N:function(e){return function(){return _.call(this.children,e)}}("function"==typeof e?e:S(e)))},filter:function(e){"function"!=typeof e&&(e=b(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,s=t[r],a=s.length,l=o[r]=[],c=0;c<a;++c)(i=s[c])&&e.call(i,i.__data__,c,s)&&l.push(i);return new we(o,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,z);var n,o=t?O:P,r=this._parents,i=this._groups;"function"!=typeof e&&(n=e,e=function(){return n});for(var s=i.length,a=new Array(s),l=new Array(s),c=new Array(s),d=0;d<s;++d){var u=r[d],h=i[d],f=h.length,p=A(e.call(u,u&&u.__data__,d,r)),g=p.length,m=l[d]=new Array(g),y=a[d]=new Array(g);o(u,h,m,y,c[d]=new Array(f),p,t);for(var v,x,w=0,b=0;w<g;++w)if(v=m[w]){for(w>=b&&(b=w+1);!(x=y[b])&&++b<g;);v._next=x||null}}return(a=new we(a,r))._enter=l,a._exit=c,a},enter:function(){return new we(this._enter||this._groups.map(M),this._parents)},exit:function(){return new we(this._exit||this._groups.map(M),this._parents)},join:function(e,t,n){var o=this.enter(),r=this,i=this.exit();return"function"==typeof e?(o=e(o))&&(o=o.selection()):o=o.append(e+""),null!=t&&(r=t(r))&&(r=r.selection()),null==n?i.remove():n(i),o&&r?o.merge(r).order():r},merge:function(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c,d=n[l],u=o[l],h=d.length,f=a[l]=new Array(h),p=0;p<h;++p)(c=d[p]||u[p])&&(f[p]=c);for(;l<r;++l)a[l]=n[l];return new we(a,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o,r=e[t],i=r.length-1,s=r[i];--i>=0;)(o=r[i])&&(s&&4^o.compareDocumentPosition(s)&&s.parentNode.insertBefore(o,s),s=o);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=I);for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s,a=n[i],l=a.length,c=r[i]=new Array(l),d=0;d<l;++d)(s=a[d])&&(c[d]=s);c.sort(t)}return new we(r,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null},size:function(){let e=0;for(const t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r,i=t[n],s=0,a=i.length;s<a;++s)(r=i[s])&&e.call(r,r.__data__,s,i);return this},attr:function(e,t){var n=h(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((null==t?n.local?R:D:"function"==typeof t?n.local?j:B:n.local?T:$)(n,t))},style:function(e,t,n){return arguments.length>1?this.each((null==t?V:"function"==typeof t?X:H)(e,t,null==n?"":n)):Y(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?Z:"function"==typeof t?W:U)(e,t)):this.node()[e]},classed:function(e,t){var n=F(e+"");if(arguments.length<2){for(var o=K(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each(("function"==typeof t?te:t?J:ee)(n,t))},text:function(e){return arguments.length?this.each(null==e?ne:("function"==typeof e?re:oe)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?ie:("function"==typeof e?ae:se)(e)):this.node().innerHTML},raise:function(){return this.each(le)},lower:function(){return this.each(ce)},append:function(e){var t="function"==typeof e?e:g(e);return this.select((function(){return this.appendChild(t.apply(this,arguments))}))},insert:function(e,t){var n="function"==typeof e?e:g(e),o=null==t?de:"function"==typeof t?t:y(t);return this.select((function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)}))},remove:function(){return this.each(ue)},clone:function(e){return this.select(e?fe:he)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,n){var o,r,i=function(e){return e.trim().split(/^|\s+/).map((function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}}))}(e+""),s=i.length;if(!(arguments.length<2)){for(a=t?ge:pe,o=0;o<s;++o)this.each(a(i[o],t,n));return this}var a=this.node().__on;if(a)for(var l,c=0,d=a.length;c<d;++c)for(o=0,l=a[c];o<s;++o)if((r=i[o]).type===l.type&&r.name===l.name)return l.value},dispatch:function(e,t){return this.each(("function"==typeof t?ve:ye)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o,r=e[t],i=0,s=r.length;i<s;++i)(o=r[i])&&(yield o)}};const Ee={passive:!1},_e={capture:!0,passive:!1};function Ne(e){e.stopImmediatePropagation()}function Me(e){e.preventDefault(),e.stopImmediatePropagation()}function ke(e){var t=e.document.documentElement,n=Se(e).on("dragstart.drag",Me,_e);"onselectstart"in t?n.on("selectstart.drag",Me,_e):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Pe(e,t){var n=e.document.documentElement,o=Se(e).on("dragstart.drag",null);t&&(o.on("click.drag",Me,_e),setTimeout((function(){o.on("click.drag",null)}),0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var Oe=e=>()=>e;function ze(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:l,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}function Ae(e){return!e.ctrlKey&&!e.button}function Ie(){return this.parentNode}function De(e,t){return null==t?{x:e.x,y:e.y}:t}function Re(){return navigator.maxTouchPoints||"ontouchstart"in this}function $e(){var e,t,n,o,r=Ae,i=Ie,a=De,l=Re,c={},d=s("start","drag","end"),u=0,h=0;function f(e){e.on("mousedown.drag",p).filter(l).on("touchstart.drag",y).on("touchmove.drag",v,Ee).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(s,a){if(!o&&r.call(this,s,a)){var l=w(this,i.call(this,s,a),s,a,"mouse");l&&(Se(s.view).on("mousemove.drag",g,_e).on("mouseup.drag",m,_e),ke(s.view),Ne(s),n=!1,e=s.clientX,t=s.clientY,l("start",s))}}function g(o){if(Me(o),!n){var r=o.clientX-e,i=o.clientY-t;n=r*r+i*i>h}c.mouse("drag",o)}function m(e){Se(e.view).on("mousemove.drag mouseup.drag",null),Pe(e.view,n),Me(e),c.mouse("end",e)}function y(e,t){if(r.call(this,e,t)){var n,o,s=e.changedTouches,a=i.call(this,e,t),l=s.length;for(n=0;n<l;++n)(o=w(this,a,e,t,s[n].identifier,s[n]))&&(Ne(e),o("start",e,s[n]))}}function v(e){var t,n,o=e.changedTouches,r=o.length;for(t=0;t<r;++t)(n=c[o[t].identifier])&&(Me(e),n("drag",e,o[t]))}function x(e){var t,n,r=e.changedTouches,i=r.length;for(o&&clearTimeout(o),o=setTimeout((function(){o=null}),500),t=0;t<i;++t)(n=c[r[t].identifier])&&(Ne(e),n("end",e,r[t]))}function w(e,t,n,o,r,i){var s,l,h,p=d.copy(),g=Ce(i||n,t);if(null!=(h=a.call(e,new ze("beforestart",{sourceEvent:n,target:f,identifier:r,active:u,x:g[0],y:g[1],dx:0,dy:0,dispatch:p}),o)))return s=h.x-g[0]||0,l=h.y-g[1]||0,function n(i,a,d){var m,y=g;switch(i){case"start":c[r]=n,m=u++;break;case"end":delete c[r],--u;case"drag":g=Ce(d||a,t),m=u}p.call(i,e,new ze(i,{sourceEvent:a,subject:h,target:f,identifier:r,active:m,x:g[0]+s,y:g[1]+l,dx:g[0]-y[0],dy:g[1]-y[1],dispatch:p}),o)}}return f.filter=function(e){return arguments.length?(r="function"==typeof e?e:Oe(!!e),f):r},f.container=function(e){return arguments.length?(i="function"==typeof e?e:Oe(e),f):i},f.subject=function(e){return arguments.length?(a="function"==typeof e?e:Oe(e),f):a},f.touchable=function(e){return arguments.length?(l="function"==typeof e?e:Oe(!!e),f):l},f.on=function(){var e=d.on.apply(d,arguments);return e===d?f:e},f.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,f):Math.sqrt(h)},f}function Te(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Be(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function je(){}ze.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var Le=.7,Ve=1/Le,He="\\s*([+-]?\\d+)\\s*",Xe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ye="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ze=/^#([0-9a-f]{3,8})$/,Ue=new RegExp(`^rgb\\(${He},${He},${He}\\)$`),We=new RegExp(`^rgb\\(${Ye},${Ye},${Ye}\\)$`),Fe=new RegExp(`^rgba\\(${He},${He},${He},${Xe}\\)$`),Ke=new RegExp(`^rgba\\(${Ye},${Ye},${Ye},${Xe}\\)$`),Ge=new RegExp(`^hsl\\(${Xe},${Ye},${Ye}\\)$`),qe=new RegExp(`^hsla\\(${Xe},${Ye},${Ye},${Xe}\\)$`),Qe={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 Je(){return this.rgb().formatHex()}function et(){return this.rgb().formatRgb()}function tt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Ze.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?nt(t):3===n?new it(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?ot(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?ot(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=Ue.exec(e))?new it(t[1],t[2],t[3],1):(t=We.exec(e))?new it(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Fe.exec(e))?ot(t[1],t[2],t[3],t[4]):(t=Ke.exec(e))?ot(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Ge.exec(e))?ut(t[1],t[2]/100,t[3]/100,1):(t=qe.exec(e))?ut(t[1],t[2]/100,t[3]/100,t[4]):Qe.hasOwnProperty(e)?nt(Qe[e]):"transparent"===e?new it(NaN,NaN,NaN,0):null}function nt(e){return new it(e>>16&255,e>>8&255,255&e,1)}function ot(e,t,n,o){return o<=0&&(e=t=n=NaN),new it(e,t,n,o)}function rt(e,t,n,o){return 1===arguments.length?((r=e)instanceof je||(r=tt(r)),r?new it((r=r.rgb()).r,r.g,r.b,r.opacity):new it):new it(e,t,n,null==o?1:o);var r}function it(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}function st(){return`#${dt(this.r)}${dt(this.g)}${dt(this.b)}`}function at(){const e=lt(this.opacity);return`${1===e?"rgb(":"rgba("}${ct(this.r)}, ${ct(this.g)}, ${ct(this.b)}${1===e?")":`, ${e})`}`}function lt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ct(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function dt(e){return((e=ct(e))<16?"0":"")+e.toString(16)}function ut(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ft(e,t,n,o)}function ht(e){if(e instanceof ft)return new ft(e.h,e.s,e.l,e.opacity);if(e instanceof je||(e=tt(e)),!e)return new ft;if(e instanceof ft)return e;var t=(e=e.rgb()).r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),s=NaN,a=i-r,l=(i+r)/2;return a?(s=t===i?(n-o)/a+6*(n<o):n===i?(o-t)/a+2:(t-n)/a+4,a/=l<.5?i+r:2-i-r,s*=60):a=l>0&&l<1?0:s,new ft(s,a,l,e.opacity)}function ft(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}function pt(e){return(e=(e||0)%360)<0?e+360:e}function gt(e){return Math.max(0,Math.min(1,e||0))}function mt(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}Te(je,tt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Je,formatHex:Je,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return ht(this).formatHsl()},formatRgb:et,toString:et}),Te(it,rt,Be(je,{brighter(e){return e=null==e?Ve:Math.pow(Ve,e),new it(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?Le:Math.pow(Le,e),new it(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new it(ct(this.r),ct(this.g),ct(this.b),lt(this.opacity))},displayable(){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:st,formatHex:st,formatHex8:function(){return`#${dt(this.r)}${dt(this.g)}${dt(this.b)}${dt(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:at,toString:at})),Te(ft,(function(e,t,n,o){return 1===arguments.length?ht(e):new ft(e,t,n,null==o?1:o)}),Be(je,{brighter(e){return e=null==e?Ve:Math.pow(Ve,e),new ft(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Le:Math.pow(Le,e),new ft(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new it(mt(e>=240?e-240:e+120,r,o),mt(e,r,o),mt(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new ft(pt(this.h),gt(this.s),gt(this.l),lt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=lt(this.opacity);return`${1===e?"hsl(":"hsla("}${pt(this.h)}, ${100*gt(this.s)}%, ${100*gt(this.l)}%${1===e?")":`, ${e})`}`}}));var yt=e=>()=>e;function vt(e){return 1==(e=+e)?xt:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}(t,n,e):yt(isNaN(t)?n:t)}}function xt(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):yt(isNaN(e)?t:e)}var wt=function e(t){var n=vt(t);function o(e,t){var o=n((e=rt(e)).r,(t=rt(t)).r),r=n(e.g,t.g),i=n(e.b,t.b),s=xt(e.opacity,t.opacity);return function(t){return e.r=o(t),e.g=r(t),e.b=i(t),e.opacity=s(t),e+""}}return o.gamma=e,o}(1);function bt(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var St=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ct=new RegExp(St.source,"g");function Et(e,t){var n,o,r,i=St.lastIndex=Ct.lastIndex=0,s=-1,a=[],l=[];for(e+="",t+="";(n=St.exec(e))&&(o=Ct.exec(t));)(r=o.index)>i&&(r=t.slice(i,r),a[s]?a[s]+=r:a[++s]=r),(n=n[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,l.push({i:s,x:bt(n,o)})),i=Ct.lastIndex;return i<t.length&&(r=t.slice(i),a[s]?a[s]+=r:a[++s]=r),a.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,o=0;o<t;++o)a[(n=l[o]).i]=n.x(e);return a.join("")})}var _t,Nt=180/Math.PI,Mt={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function kt(e,t,n,o,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*Nt,skewX:Math.atan(l)*Nt,scaleX:s,scaleY:a}}function Pt(e,t,n,o){function r(e){return e.length?e.pop()+" ":""}return function(i,s){var a=[],l=[];return i=e(i),s=e(s),function(e,o,r,i,s,a){if(e!==r||o!==i){var l=s.push("translate(",null,t,null,n);a.push({i:l-4,x:bt(e,r)},{i:l-2,x:bt(o,i)})}else(r||i)&&s.push("translate("+r+t+i+n)}(i.translateX,i.translateY,s.translateX,s.translateY,a,l),function(e,t,n,i){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),i.push({i:n.push(r(n)+"rotate(",null,o)-2,x:bt(e,t)})):t&&n.push(r(n)+"rotate("+t+o)}(i.rotate,s.rotate,a,l),function(e,t,n,i){e!==t?i.push({i:n.push(r(n)+"skewX(",null,o)-2,x:bt(e,t)}):t&&n.push(r(n)+"skewX("+t+o)}(i.skewX,s.skewX,a,l),function(e,t,n,o,i,s){if(e!==n||t!==o){var a=i.push(r(i)+"scale(",null,",",null,")");s.push({i:a-4,x:bt(e,n)},{i:a-2,x:bt(t,o)})}else 1===n&&1===o||i.push(r(i)+"scale("+n+","+o+")")}(i.scaleX,i.scaleY,s.scaleX,s.scaleY,a,l),i=s=null,function(e){for(var t,n=-1,o=l.length;++n<o;)a[(t=l[n]).i]=t.x(e);return a.join("")}}}var Ot=Pt((function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Mt:kt(t.a,t.b,t.c,t.d,t.e,t.f)}),"px, ","px)","deg)"),zt=Pt((function(e){return null==e?Mt:(_t||(_t=document.createElementNS("http://www.w3.org/2000/svg","g")),_t.setAttribute("transform",e),(e=_t.transform.baseVal.consolidate())?kt((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Mt)}),", ",")",")");function At(e){return((e=Math.exp(e))+1/e)/2}var It,Dt,Rt=function e(t,n,o){function r(e,r){var i,s,a=e[0],l=e[1],c=e[2],d=r[0],u=r[1],h=r[2],f=d-a,p=u-l,g=f*f+p*p;if(g<1e-12)s=Math.log(h/c)/t,i=function(e){return[a+e*f,l+e*p,c*Math.exp(t*e*s)]};else{var m=Math.sqrt(g),y=(h*h-c*c+o*g)/(2*c*n*m),v=(h*h-c*c-o*g)/(2*h*n*m),x=Math.log(Math.sqrt(y*y+1)-y),w=Math.log(Math.sqrt(v*v+1)-v);s=(w-x)/t,i=function(e){var o,r=e*s,i=At(x),d=c/(n*m)*(i*(o=t*r+x,((o=Math.exp(2*o))-1)/(o+1))-function(e){return((e=Math.exp(e))-1/e)/2}(x));return[a+d*f,l+d*p,c*i/At(t*r+x)]}}return i.duration=1e3*s*t/Math.SQRT2,i}return r.rho=function(t){var n=Math.max(.001,+t),o=n*n;return e(n,o,o*o)},r}(Math.SQRT2,2,4),$t=0,Tt=0,Bt=0,jt=1e3,Lt=0,Vt=0,Ht=0,Xt="object"==typeof performance&&performance.now?performance:Date,Yt="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Zt(){return Vt||(Yt(Ut),Vt=Xt.now()+Ht)}function Ut(){Vt=0}function Wt(){this._call=this._time=this._next=null}function Ft(e,t,n){var o=new Wt;return o.restart(e,t,n),o}function Kt(){Vt=(Lt=Xt.now())+Ht,$t=Tt=0;try{!function(){Zt(),++$t;for(var e,t=It;t;)(e=Vt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--$t}()}finally{$t=0,function(){var e,t,n=It,o=1/0;for(;n;)n._call?(o>n._time&&(o=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:It=t);Dt=e,qt(o)}(),Vt=0}}function Gt(){var e=Xt.now(),t=e-Lt;t>jt&&(Ht-=t,Lt=e)}function qt(e){$t||(Tt&&(Tt=clearTimeout(Tt)),e-Vt>24?(e<1/0&&(Tt=setTimeout(Kt,e-Xt.now()-Ht)),Bt&&(Bt=clearInterval(Bt))):(Bt||(Lt=Xt.now(),Bt=setInterval(Gt,jt)),$t=1,Yt(Kt)))}function Qt(e,t,n){var o=new Wt;return t=null==t?0:+t,o.restart((n=>{o.stop(),e(n+t)}),t,n),o}Wt.prototype=Ft.prototype={constructor:Wt,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?Zt():+n)+(null==t?0:+t),this._next||Dt===this||(Dt?Dt._next=this:It=this,Dt=this),this._call=e,this._time=n,qt()},stop:function(){this._call&&(this._call=null,this._time=1/0,qt())}};var Jt=s("start","end","cancel","interrupt"),en=[],tn=0,nn=1,on=2,rn=3,sn=4,an=5,ln=6;function cn(e,t,n,o,r,i){var s=e.__transition;if(s){if(n in s)return}else e.__transition={};!function(e,t,n){var o,r=e.__transition;function i(e){n.state=nn,n.timer.restart(s,n.delay,n.time),n.delay<=e&&s(e-n.delay)}function s(i){var c,d,u,h;if(n.state!==nn)return l();for(c in r)if((h=r[c]).name===n.name){if(h.state===rn)return Qt(s);h.state===sn?(h.state=ln,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[c]):+c<t&&(h.state=ln,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[c])}if(Qt((function(){n.state===rn&&(n.state=sn,n.timer.restart(a,n.delay,n.time),a(i))})),n.state=on,n.on.call("start",e,e.__data__,n.index,n.group),n.state===on){for(n.state=rn,o=new Array(u=n.tween.length),c=0,d=-1;c<u;++c)(h=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(o[++d]=h);o.length=d+1}}function a(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(l),n.state=an,1),i=-1,s=o.length;++i<s;)o[i].call(e,r);n.state===an&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){for(var o in n.state=ln,n.timer.stop(),delete r[t],r)return;delete e.__transition}r[t]=n,n.timer=Ft(i,0,n.time)}(e,n,{name:t,index:o,group:r,on:Jt,tween:en,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:tn})}function dn(e,t){var n=hn(e,t);if(n.state>tn)throw new Error("too late; already scheduled");return n}function un(e,t){var n=hn(e,t);if(n.state>rn)throw new Error("too late; already running");return n}function hn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function fn(e,t){var n,o,r,i=e.__transition,s=!0;if(i){for(r in t=null==t?null:t+"",i)(n=i[r]).name===t?(o=n.state>on&&n.state<an,n.state=ln,n.timer.stop(),n.on.call(o?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete i[r]):s=!1;s&&delete e.__transition}}function pn(e,t){var n,o;return function(){var r=un(this,e),i=r.tween;if(i!==n)for(var s=0,a=(o=n=i).length;s<a;++s)if(o[s].name===t){(o=o.slice()).splice(s,1);break}r.tween=o}}function gn(e,t,n){var o,r;if("function"!=typeof n)throw new Error;return function(){var i=un(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}i.tween=r}}function mn(e,t,n){var o=e._id;return e.each((function(){var e=un(this,o);(e.value||(e.value={}))[t]=n.apply(this,arguments)})),function(e){return hn(e,o).value[t]}}function yn(e,t){var n;return("number"==typeof t?bt:t instanceof tt?wt:(n=tt(t))?(t=n,wt):Et)(e,t)}function vn(e){return function(){this.removeAttribute(e)}}function xn(e){return function(){this.removeAttributeNS(e.space,e.local)}}function wn(e,t,n){var o,r,i=n+"";return function(){var s=this.getAttribute(e);return s===i?null:s===o?r:r=t(o=s,n)}}function bn(e,t,n){var o,r,i=n+"";return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===o?r:r=t(o=s,n)}}function Sn(e,t,n){var o,r,i;return function(){var s,a,l=n(this);if(null!=l)return(s=this.getAttribute(e))===(a=l+"")?null:s===o&&a===r?i:(r=a,i=t(o=s,l));this.removeAttribute(e)}}function Cn(e,t,n){var o,r,i;return function(){var s,a,l=n(this);if(null!=l)return(s=this.getAttributeNS(e.space,e.local))===(a=l+"")?null:s===o&&a===r?i:(r=a,i=t(o=s,l));this.removeAttributeNS(e.space,e.local)}}function En(e,t){var n,o;function r(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&function(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}(e,r)),n}return r._value=t,r}function _n(e,t){var n,o;function r(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&function(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}(e,r)),n}return r._value=t,r}function Nn(e,t){return function(){dn(this,e).delay=+t.apply(this,arguments)}}function Mn(e,t){return t=+t,function(){dn(this,e).delay=t}}function kn(e,t){return function(){un(this,e).duration=+t.apply(this,arguments)}}function Pn(e,t){return t=+t,function(){un(this,e).duration=t}}var On=be.prototype.constructor;function zn(e){return function(){this.style.removeProperty(e)}}var An=0;function In(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Dn(){return++An}var Rn=be.prototype;In.prototype={constructor:In,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=y(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a,l,c=o[s],d=c.length,u=i[s]=new Array(d),h=0;h<d;++h)(a=c[h])&&(l=e.call(a,a.__data__,h,c))&&("__data__"in a&&(l.__data__=a.__data__),u[h]=l,cn(u[h],t,n,h,u,hn(a,n)));return new In(i,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=x(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l,c=o[a],d=c.length,u=0;u<d;++u)if(l=c[u]){for(var h,f=e.call(l,l.__data__,u,c),p=hn(l,n),g=0,m=f.length;g<m;++g)(h=f[g])&&cn(h,t,n,g,f,p);i.push(f),s.push(l)}return new In(i,s,t,n)},selectChild:Rn.selectChild,selectChildren:Rn.selectChildren,filter:function(e){"function"!=typeof e&&(e=b(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,s=t[r],a=s.length,l=o[r]=[],c=0;c<a;++c)(i=s[c])&&e.call(i,i.__data__,c,s)&&l.push(i);return new In(o,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var l,c=t[a],d=n[a],u=c.length,h=s[a]=new Array(u),f=0;f<u;++f)(l=c[f]||d[f])&&(h[f]=l);for(;a<o;++a)s[a]=t[a];return new In(s,this._parents,this._name,this._id)},selection:function(){return new On(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=Dn(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s,a=o[i],l=a.length,c=0;c<l;++c)if(s=a[c]){var d=hn(s,t);cn(s,e,n,c,a,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new In(o,this._parents,e,n)},call:Rn.call,nodes:Rn.nodes,node:Rn.node,size:Rn.size,empty:Rn.empty,each:Rn.each,on:function(e,t){var n=this._id;return arguments.length<2?hn(this.node(),n).on.on(e):this.each(function(e,t,n){var o,r,i=function(e){return(e+"").trim().split(/^|\s+/).every((function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e}))}(t)?dn:un;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}(n,e,t))},attr:function(e,t){var n=h(e),o="transform"===n?zt:yn;return this.attrTween(e,"function"==typeof t?(n.local?Cn:Sn)(n,o,mn(this,"attr."+e,t)):null==t?(n.local?xn:vn)(n):(n.local?bn:wn)(n,o,t))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var o=h(e);return this.tween(n,(o.local?En:_n)(o,t))},style:function(e,t,n){var o="transform"==(e+="")?Ot:yn;return null==t?this.styleTween(e,function(e,t){var n,o,r;return function(){var i=Y(this,e),s=(this.style.removeProperty(e),Y(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}(e,o)).on("end.style."+e,zn(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var o,r,i;return function(){var s=Y(this,e),a=n(this),l=a+"";return null==a&&(this.style.removeProperty(e),l=a=Y(this,e)),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}(e,o,mn(this,"style."+e,t))).each(function(e,t){var n,o,r,i,s="style."+t,a="end."+s;return function(){var l=un(this,e),c=l.on,d=null==l.value[s]?i||(i=zn(t)):void 0;c===n&&r===d||(o=(n=c).copy()).on(a,r=d),l.on=o}}(this._id,e)):this.styleTween(e,function(e,t,n){var o,r,i=n+"";return function(){var s=Y(this,e);return s===i?null:s===o?r:r=t(o=s,n)}}(e,o,t),n).on("end.style."+e,null)},styleTween:function(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(null==t)return this.tween(o,null);if("function"!=typeof t)throw new Error;return this.tween(o,function(e,t,n){var o,r;function i(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&function(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}(e,i,n)),o}return i._value=t,i}(e,t,null==n?"":n))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(mn(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function o(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&function(e){return function(t){this.textContent=e.call(this,t)}}(o)),t}return o._value=e,o}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o,r=hn(this.node(),n).tween,i=0,s=r.length;i<s;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((null==t?pn:gn)(n,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?Nn:Mn)(t,e)):hn(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?kn:Pn)(t,e)):hn(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw new Error;return function(){un(this,e).ease=t}}(t,e)):hn(this.node(),t).ease},easeVarying:function(e){if("function"!=typeof e)throw new Error;return this.each(function(e,t){return function(){var n=t.apply(this,arguments);if("function"!=typeof n)throw new Error;un(this,e).ease=n}}(this._id,e))},end:function(){var e,t,n=this,o=n._id,r=n.size();return new Promise((function(i,s){var a={value:s},l={value:function(){0==--r&&i()}};n.each((function(){var n=un(this,o),r=n.on;r!==e&&((t=(e=r).copy())._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),n.on=t})),0===r&&i()}))},[Symbol.iterator]:Rn[Symbol.iterator]};var $n={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Tn(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}be.prototype.interrupt=function(e){return this.each((function(){fn(this,e)}))},be.prototype.transition=function(e){var t,n;e instanceof In?(t=e._id,e=e._name):(t=Dn(),(n=$n).time=Zt(),e=null==e?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s,a=o[i],l=a.length,c=0;c<l;++c)(s=a[c])&&cn(s,e,t,c,a,n||Tn(s,t));return new In(o,this._parents,e,t)};var Bn=e=>()=>e;function jn(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Ln(e,t,n){this.k=e,this.x=t,this.y=n}Ln.prototype={constructor:Ln,scale:function(e){return 1===e?this:new Ln(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new Ln(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Vn=new Ln(1,0,0);function Hn(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Vn;return e.__zoom}function Xn(e){e.stopImmediatePropagation()}function Yn(e){e.preventDefault(),e.stopImmediatePropagation()}function Zn(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function Un(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function Wn(){return this.__zoom||Vn}function Fn(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Kn(){return navigator.maxTouchPoints||"ontouchstart"in this}function Gn(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function qn(){var e,t,n,o=Zn,r=Un,i=Gn,a=Fn,l=Kn,c=[0,1/0],d=[[-1/0,-1/0],[1/0,1/0]],u=250,h=Rt,f=s("start","zoom","end"),p=500,g=150,m=0,y=10;function v(e){e.property("__zoom",Wn).on("wheel.zoom",_,{passive:!1}).on("mousedown.zoom",N).on("dblclick.zoom",M).filter(l).on("touchstart.zoom",k).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(e,t){return(t=Math.max(c[0],Math.min(c[1],t)))===e.k?e:new Ln(t,e.x,e.y)}function w(e,t,n){var o=t[0]-n[0]*e.k,r=t[1]-n[1]*e.k;return o===e.x&&r===e.y?e:new Ln(e.k,o,r)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function S(e,t,n,o){e.on("start.zoom",(function(){C(this,arguments).event(o).start()})).on("interrupt.zoom end.zoom",(function(){C(this,arguments).event(o).end()})).tween("zoom",(function(){var e=this,i=arguments,s=C(e,i).event(o),a=r.apply(e,i),l=null==n?b(a):"function"==typeof n?n.apply(e,i):n,c=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),d=e.__zoom,u="function"==typeof t?t.apply(e,i):t,f=h(d.invert(l).concat(c/d.k),u.invert(l).concat(c/u.k));return function(e){if(1===e)e=u;else{var t=f(e),n=c/t[2];e=new Ln(n,l[0]-t[0]*n,l[1]-t[1]*n)}s.zoom(null,e)}}))}function C(e,t,n){return!n&&e.__zooming||new E(e,t)}function E(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=r.apply(e,t),this.taps=0}function _(e,...t){if(o.apply(this,arguments)){var n=C(this,t).event(e),r=this.__zoom,s=Math.max(c[0],Math.min(c[1],r.k*Math.pow(2,a.apply(this,arguments)))),l=Ce(e);if(n.wheel)n.mouse[0][0]===l[0]&&n.mouse[0][1]===l[1]||(n.mouse[1]=r.invert(n.mouse[0]=l)),clearTimeout(n.wheel);else{if(r.k===s)return;n.mouse=[l,r.invert(l)],fn(this),n.start()}Yn(e),n.wheel=setTimeout((function(){n.wheel=null,n.end()}),g),n.zoom("mouse",i(w(x(r,s),n.mouse[0],n.mouse[1]),n.extent,d))}}function N(e,...t){if(!n&&o.apply(this,arguments)){var r=e.currentTarget,s=C(this,t,!0).event(e),a=Se(e.view).on("mousemove.zoom",(function(e){if(Yn(e),!s.moved){var t=e.clientX-c,n=e.clientY-u;s.moved=t*t+n*n>m}s.event(e).zoom("mouse",i(w(s.that.__zoom,s.mouse[0]=Ce(e,r),s.mouse[1]),s.extent,d))}),!0).on("mouseup.zoom",(function(e){a.on("mousemove.zoom mouseup.zoom",null),Pe(e.view,s.moved),Yn(e),s.event(e).end()}),!0),l=Ce(e,r),c=e.clientX,u=e.clientY;ke(e.view),Xn(e),s.mouse=[l,this.__zoom.invert(l)],fn(this),s.start()}}function M(e,...t){if(o.apply(this,arguments)){var n=this.__zoom,s=Ce(e.changedTouches?e.changedTouches[0]:e,this),a=n.invert(s),l=n.k*(e.shiftKey?.5:2),c=i(w(x(n,l),s,a),r.apply(this,t),d);Yn(e),u>0?Se(this).transition().duration(u).call(S,c,s,e):Se(this).call(v.transform,c,s,e)}}function k(n,...r){if(o.apply(this,arguments)){var i,s,a,l,c=n.touches,d=c.length,u=C(this,r,n.changedTouches.length===d).event(n);for(Xn(n),s=0;s<d;++s)l=[l=Ce(a=c[s],this),this.__zoom.invert(l),a.identifier],u.touch0?u.touch1||u.touch0[2]===l[2]||(u.touch1=l,u.taps=0):(u.touch0=l,i=!0,u.taps=1+!!e);e&&(e=clearTimeout(e)),i&&(u.taps<2&&(t=l[0],e=setTimeout((function(){e=null}),p)),fn(this),u.start())}}function P(e,...t){if(this.__zooming){var n,o,r,s,a=C(this,t).event(e),l=e.changedTouches,c=l.length;for(Yn(e),n=0;n<c;++n)r=Ce(o=l[n],this),a.touch0&&a.touch0[2]===o.identifier?a.touch0[0]=r:a.touch1&&a.touch1[2]===o.identifier&&(a.touch1[0]=r);if(o=a.that.__zoom,a.touch1){var u=a.touch0[0],h=a.touch0[1],f=a.touch1[0],p=a.touch1[1],g=(g=f[0]-u[0])*g+(g=f[1]-u[1])*g,m=(m=p[0]-h[0])*m+(m=p[1]-h[1])*m;o=x(o,Math.sqrt(g/m)),r=[(u[0]+f[0])/2,(u[1]+f[1])/2],s=[(h[0]+p[0])/2,(h[1]+p[1])/2]}else{if(!a.touch0)return;r=a.touch0[0],s=a.touch0[1]}a.zoom("touch",i(w(o,r,s),a.extent,d))}}function O(e,...o){if(this.__zooming){var r,i,s=C(this,o).event(e),a=e.changedTouches,l=a.length;for(Xn(e),n&&clearTimeout(n),n=setTimeout((function(){n=null}),p),r=0;r<l;++r)i=a[r],s.touch0&&s.touch0[2]===i.identifier?delete s.touch0:s.touch1&&s.touch1[2]===i.identifier&&delete s.touch1;if(s.touch1&&!s.touch0&&(s.touch0=s.touch1,delete s.touch1),s.touch0)s.touch0[1]=this.__zoom.invert(s.touch0[0]);else if(s.end(),2===s.taps&&(i=Ce(i,this),Math.hypot(t[0]-i[0],t[1]-i[1])<y)){var c=Se(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return v.transform=function(e,t,n,o){var r=e.selection?e.selection():e;r.property("__zoom",Wn),e!==r?S(e,t,n,o):r.interrupt().each((function(){C(this,arguments).event(o).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()}))},v.scaleBy=function(e,t,n,o){v.scaleTo(e,(function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)}),n,o)},v.scaleTo=function(e,t,n,o){v.transform(e,(function(){var e=r.apply(this,arguments),o=this.__zoom,s=null==n?b(e):"function"==typeof n?n.apply(this,arguments):n,a=o.invert(s),l="function"==typeof t?t.apply(this,arguments):t;return i(w(x(o,l),s,a),e,d)}),n,o)},v.translateBy=function(e,t,n,o){v.transform(e,(function(){return i(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),r.apply(this,arguments),d)}),null,o)},v.translateTo=function(e,t,n,o,s){v.transform(e,(function(){var e=r.apply(this,arguments),s=this.__zoom,a=null==o?b(e):"function"==typeof o?o.apply(this,arguments):o;return i(Vn.translate(a[0],a[1]).scale(s.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,d)}),o,s)},E.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=Se(this.that).datum();f.call(e,this.that,new jn(e,{sourceEvent:this.sourceEvent,target:v,type:e,transform:this.that.__zoom,dispatch:f}),t)}},v.wheelDelta=function(e){return arguments.length?(a="function"==typeof e?e:Bn(+e),v):a},v.filter=function(e){return arguments.length?(o="function"==typeof e?e:Bn(!!e),v):o},v.touchable=function(e){return arguments.length?(l="function"==typeof e?e:Bn(!!e),v):l},v.extent=function(e){return arguments.length?(r="function"==typeof e?e:Bn([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),v):r},v.scaleExtent=function(e){return arguments.length?(c[0]=+e[0],c[1]=+e[1],v):[c[0],c[1]]},v.translateExtent=function(e){return arguments.length?(d[0][0]=+e[0][0],d[1][0]=+e[1][0],d[0][1]=+e[0][1],d[1][1]=+e[1][1],v):[[d[0][0],d[0][1]],[d[1][0],d[1][1]]]},v.constrain=function(e){return arguments.length?(i=e,v):i},v.duration=function(e){return arguments.leng