UNPKG

@amit.rajput/react-infinite-canvas

Version:

An Infinite Canvas Component for React where you can place your component anywhere on the canvas with zoom in, zoom out and panning functionality. It also supports custom components to control the canvas.

2 lines 63.3 kB
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._dotSvgContainer_64xbd_1{position:absolute;width:100%;height:100%;inset-block-start:0;inset-inline-start:0}._container_1xxyl_1{position:relative;overflow:hidden;width:100%;height:100%}._canvasWrapper_1xxyl_8{position:relative;width:100%;height:100%;overflow:hidden;background-color:var(--kf-color-bg-gray);cursor:grab;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}._canvasWrapper_1xxyl_8._panning_1xxyl_21{cursor:grabbing}._canvas_1xxyl_8{position:relative;z-index:2;width:100%;height:100%}._canvas_1xxyl_8>div:first-of-type{position:absolute;inset-inline-start:0;inset-block-start:0;transition:transform .01s ease}._contentWrapper_1xxyl_39{position:absolute}._verticalScrollBar_17thb_1{position:absolute;inset-inline-end:2px;inset-block-start:0;inset-block-end:0;background:transparent}._horizontalScrollBar_17thb_9{position:absolute;inset-block-end:2px;inset-inline-start:0;inset-inline-end:0;background:transparent}._verticalScrollBar_17thb_1>div,._horizontalScrollBar_17thb_9>div{position:absolute;border-radius:50px;z-index:8;cursor:pointer}._verticalScrollBar_17thb_1>div{width:100%}._horizontalScrollBar_17thb_9>div{height:100%}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})(); (function(Q,$){typeof exports=="object"&&typeof module<"u"?$(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],$):(Q=typeof globalThis<"u"?globalThis:Q||self,$(Q.ReactInfiniteCanvas={},Q.jsxRuntime,Q.React))})(this,function(Q,$,z){"use strict";var Jt="http://www.w3.org/1999/xhtml";const we={svg:"http://www.w3.org/2000/svg",xhtml:Jt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Lt(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),we.hasOwnProperty(e)?{space:we[e],local:t}:t}function yn(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Jt&&e.documentElement.namespaceURI===Jt?e.createElement(t):e.createElementNS(n,t)}}function wn(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function xe(t){var e=Lt(t);return(e.local?wn:yn)(e)}function xn(){}function Wt(t){return t==null?xn:function(){return this.querySelector(t)}}function vn(t){typeof t!="function"&&(t=Wt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a=e[i],o=a.length,s=r[i]=new Array(o),u,f,c=0;c<o;++c)(u=a[c])&&(f=t.call(u,u.__data__,c,a))&&("__data__"in u&&(f.__data__=u.__data__),s[c]=f);return new G(r,this._parents)}function Sn(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function bn(){return[]}function ve(t){return t==null?bn:function(){return this.querySelectorAll(t)}}function En(t){return function(){return Sn(t.apply(this,arguments))}}function Tn(t){typeof t=="function"?t=En(t):t=ve(t);for(var e=this._groups,n=e.length,r=[],i=[],a=0;a<n;++a)for(var o=e[a],s=o.length,u,f=0;f<s;++f)(u=o[f])&&(r.push(t.call(u,u.__data__,f,o)),i.push(u));return new G(r,i)}function Se(t){return function(){return this.matches(t)}}function be(t){return function(e){return e.matches(t)}}var Cn=Array.prototype.find;function Nn(t){return function(){return Cn.call(this.children,t)}}function Mn(){return this.firstElementChild}function An(t){return this.select(t==null?Mn:Nn(typeof t=="function"?t:be(t)))}var zn=Array.prototype.filter;function Ln(){return Array.from(this.children)}function In(t){return function(){return zn.call(this.children,t)}}function $n(t){return this.selectAll(t==null?Ln:In(typeof t=="function"?t:be(t)))}function kn(t){typeof t!="function"&&(t=Se(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a=e[i],o=a.length,s=r[i]=[],u,f=0;f<o;++f)(u=a[f])&&t.call(u,u.__data__,f,a)&&s.push(u);return new G(r,this._parents)}function Ee(t){return new Array(t.length)}function Dn(){return new G(this._enter||this._groups.map(Ee),this._parents)}function It(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}It.prototype={constructor:It,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 Rn(t){return function(){return t}}function Pn(t,e,n,r,i,a){for(var o=0,s,u=e.length,f=a.length;o<f;++o)(s=e[o])?(s.__data__=a[o],r[o]=s):n[o]=new It(t,a[o]);for(;o<u;++o)(s=e[o])&&(i[o]=s)}function On(t,e,n,r,i,a,o){var s,u,f=new Map,c=e.length,d=a.length,g=new Array(c),m;for(s=0;s<c;++s)(u=e[s])&&(g[s]=m=o.call(u,u.__data__,s,e)+"",f.has(m)?i[s]=u:f.set(m,u));for(s=0;s<d;++s)m=o.call(t,a[s],s,a)+"",(u=f.get(m))?(r[s]=u,u.__data__=a[s],f.delete(m)):n[s]=new It(t,a[s]);for(s=0;s<c;++s)(u=e[s])&&f.get(g[s])===u&&(i[s]=u)}function Xn(t){return t.__data__}function Fn(t,e){if(!arguments.length)return Array.from(this,Xn);var n=e?On:Pn,r=this._parents,i=this._groups;typeof t!="function"&&(t=Rn(t));for(var a=i.length,o=new Array(a),s=new Array(a),u=new Array(a),f=0;f<a;++f){var c=r[f],d=i[f],g=d.length,m=Yn(t.call(c,c&&c.__data__,f,r)),T=m.length,S=s[f]=new Array(T),C=o[f]=new Array(T),w=u[f]=new Array(g);n(c,d,S,C,w,m,e);for(var N=0,M=0,O,X;N<T;++N)if(O=S[N]){for(N>=M&&(M=N+1);!(X=C[M])&&++M<T;);O._next=X||null}}return o=new G(o,r),o._enter=s,o._exit=u,o}function Yn(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function qn(){return new G(this._exit||this._groups.map(Ee),this._parents)}function Vn(t,e,n){var r=this.enter(),i=this,a=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function Hn(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,a=r.length,o=Math.min(i,a),s=new Array(i),u=0;u<o;++u)for(var f=n[u],c=r[u],d=f.length,g=s[u]=new Array(d),m,T=0;T<d;++T)(m=f[T]||c[T])&&(g[T]=m);for(;u<i;++u)s[u]=n[u];return new G(s,this._parents)}function Un(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function Kn(t){t||(t=Bn);function e(d,g){return d&&g?t(d.__data__,g.__data__):!d-!g}for(var n=this._groups,r=n.length,i=new Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,u=i[a]=new Array(s),f,c=0;c<s;++c)(f=o[c])&&(u[c]=f);u.sort(e)}return new G(i,this._parents).order()}function Bn(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function Gn(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function Zn(){return Array.from(this)}function Qn(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function Jn(){let t=0;for(const e of this)++t;return t}function Wn(){return!this.node()}function jn(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&t.call(s,s.__data__,a,i);return this}function tr(t){return function(){this.removeAttribute(t)}}function er(t){return function(){this.removeAttributeNS(t.space,t.local)}}function nr(t,e){return function(){this.setAttribute(t,e)}}function rr(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function ir(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function or(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function ar(t,e){var n=Lt(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?er:tr:typeof e=="function"?n.local?or:ir:n.local?rr:nr)(n,e))}function Te(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function sr(t){return function(){this.style.removeProperty(t)}}function cr(t,e,n){return function(){this.style.setProperty(t,e,n)}}function ur(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function lr(t,e,n){return arguments.length>1?this.each((e==null?sr:typeof e=="function"?ur:cr)(t,e,n==null?"":n)):dt(this.node(),t)}function dt(t,e){return t.style.getPropertyValue(e)||Te(t).getComputedStyle(t,null).getPropertyValue(e)}function fr(t){return function(){delete this[t]}}function hr(t,e){return function(){this[t]=e}}function pr(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function dr(t,e){return arguments.length>1?this.each((e==null?fr:typeof e=="function"?pr:hr)(t,e)):this.node()[t]}function Ce(t){return t.trim().split(/^|\s+/)}function jt(t){return t.classList||new Ne(t)}function Ne(t){this._node=t,this._names=Ce(t.getAttribute("class")||"")}Ne.prototype={add:function(t){var e=this._names.indexOf(t);e<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 Me(t,e){for(var n=jt(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function Ae(t,e){for(var n=jt(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function _r(t){return function(){Me(this,t)}}function gr(t){return function(){Ae(this,t)}}function mr(t,e){return function(){(e.apply(this,arguments)?Me:Ae)(this,t)}}function yr(t,e){var n=Ce(t+"");if(arguments.length<2){for(var r=jt(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof e=="function"?mr:e?_r:gr)(n,e))}function wr(){this.textContent=""}function xr(t){return function(){this.textContent=t}}function vr(t){return function(){var e=t.apply(this,arguments);this.textContent=e==null?"":e}}function Sr(t){return arguments.length?this.each(t==null?wr:(typeof t=="function"?vr:xr)(t)):this.node().textContent}function br(){this.innerHTML=""}function Er(t){return function(){this.innerHTML=t}}function Tr(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e==null?"":e}}function Cr(t){return arguments.length?this.each(t==null?br:(typeof t=="function"?Tr:Er)(t)):this.node().innerHTML}function Nr(){this.nextSibling&&this.parentNode.appendChild(this)}function Mr(){return this.each(Nr)}function Ar(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function zr(){return this.each(Ar)}function Lr(t){var e=typeof t=="function"?t:xe(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Ir(){return null}function $r(t,e){var n=typeof t=="function"?t:xe(t),r=e==null?Ir:typeof e=="function"?e:Wt(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function kr(){var t=this.parentNode;t&&t.removeChild(this)}function Dr(){return this.each(kr)}function Rr(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Pr(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Or(t){return this.select(t?Pr:Rr)}function Xr(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Fr(t){return function(e){t.call(this,e,this.__data__)}}function Yr(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function qr(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,i=e.length,a;n<i;++n)a=e[n],(!t.type||a.type===t.type)&&a.name===t.name?this.removeEventListener(a.type,a.listener,a.options):e[++r]=a;++r?e.length=r:delete this.__on}}}function Vr(t,e,n){return function(){var r=this.__on,i,a=Fr(e);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=e;return}}this.addEventListener(t.type,a,n),i={type:t.type,name:t.name,value:e,listener:a,options:n},r?r.push(i):this.__on=[i]}}function Hr(t,e,n){var r=Yr(t+""),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var u=0,f=s.length,c;u<f;++u)for(i=0,c=s[u];i<a;++i)if((o=r[i]).type===c.type&&o.name===c.name)return c.value}return}for(s=e?Vr:qr,i=0;i<a;++i)this.each(s(r[i],e,n));return this}function ze(t,e,n){var r=Te(t),i=r.CustomEvent;typeof i=="function"?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function Ur(t,e){return function(){return ze(this,t,e)}}function Kr(t,e){return function(){return ze(this,t,e.apply(this,arguments))}}function Br(t,e){return this.each((typeof e=="function"?Kr:Ur)(t,e))}function*Gr(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var Le=[null];function G(t,e){this._groups=t,this._parents=e}function yt(){return new G([[document.documentElement]],Le)}function Zr(){return this}G.prototype=yt.prototype={constructor:G,select:vn,selectAll:Tn,selectChild:An,selectChildren:$n,filter:kn,data:Fn,enter:Dn,exit:qn,join:Vn,merge:Hn,selection:Zr,order:Un,sort:Kn,call:Gn,nodes:Zn,node:Qn,size:Jn,empty:Wn,each:jn,attr:ar,style:lr,property:dr,classed:yr,text:Sr,html:Cr,raise:Mr,lower:zr,append:Lr,insert:$r,remove:Dr,clone:Or,datum:Xr,on:Hr,dispatch:Br,[Symbol.iterator]:Gr};function H(t){return typeof t=="string"?new G([[document.querySelector(t)]],[document.documentElement]):new G([[t]],Le)}function Qr(t){let e;for(;e=t.sourceEvent;)t=e;return t}function st(t,e){if(t=Qr(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}var Jr={value:()=>{}};function te(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new $t(n)}function $t(t){this._=t}function Wr(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}$t.prototype=te.prototype={constructor:$t,on:function(t,e){var n=this._,r=Wr(t+"",n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(t=r[a]).type)&&(i=jr(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++a<o;)if(i=(t=r[a]).type)n[i]=Ie(n[i],t.name,e);else if(e==null)for(i in n)n[i]=Ie(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new $t(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=this._[t],r=0,i=a.length;r<i;++r)a[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,a=r.length;i<a;++i)r[i].value.apply(e,n)}};function jr(t,e){for(var n=0,r=t.length,i;n<r;++n)if((i=t[n]).name===e)return i.value}function Ie(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Jr,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}const ee={capture:!0,passive:!1};function ne(t){t.preventDefault(),t.stopImmediatePropagation()}function ti(t){var e=t.document.documentElement,n=H(t).on("dragstart.drag",ne,ee);"onselectstart"in e?n.on("selectstart.drag",ne,ee):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function ei(t,e){var n=t.document.documentElement,r=H(t).on("dragstart.drag",null);e&&(r.on("click.drag",ne,ee),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function re(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function $e(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function wt(){}var xt=.7,kt=1/xt,_t="\\s*([+-]?\\d+)\\s*",vt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",tt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ni=/^#([0-9a-f]{3,8})$/,ri=new RegExp(`^rgb\\(${_t},${_t},${_t}\\)$`),ii=new RegExp(`^rgb\\(${tt},${tt},${tt}\\)$`),oi=new RegExp(`^rgba\\(${_t},${_t},${_t},${vt}\\)$`),ai=new RegExp(`^rgba\\(${tt},${tt},${tt},${vt}\\)$`),si=new RegExp(`^hsl\\(${vt},${tt},${tt}\\)$`),ci=new RegExp(`^hsla\\(${vt},${tt},${tt},${vt}\\)$`),ke={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};re(wt,St,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:De,formatHex:De,formatHex8:ui,formatHsl:li,formatRgb:Re,toString:Re});function De(){return this.rgb().formatHex()}function ui(){return this.rgb().formatHex8()}function li(){return Ye(this).formatHsl()}function Re(){return this.rgb().formatRgb()}function St(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=ni.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?Pe(e):n===3?new U(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Dt(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Dt(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=ri.exec(t))?new U(e[1],e[2],e[3],1):(e=ii.exec(t))?new U(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=oi.exec(t))?Dt(e[1],e[2],e[3],e[4]):(e=ai.exec(t))?Dt(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=si.exec(t))?Fe(e[1],e[2]/100,e[3]/100,1):(e=ci.exec(t))?Fe(e[1],e[2]/100,e[3]/100,e[4]):ke.hasOwnProperty(t)?Pe(ke[t]):t==="transparent"?new U(NaN,NaN,NaN,0):null}function Pe(t){return new U(t>>16&255,t>>8&255,t&255,1)}function Dt(t,e,n,r){return r<=0&&(t=e=n=NaN),new U(t,e,n,r)}function fi(t){return t instanceof wt||(t=St(t)),t?(t=t.rgb(),new U(t.r,t.g,t.b,t.opacity)):new U}function ie(t,e,n,r){return arguments.length===1?fi(t):new U(t,e,n,r==null?1:r)}function U(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}re(U,ie,$e(wt,{brighter(t){return t=t==null?kt:Math.pow(kt,t),new U(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?xt:Math.pow(xt,t),new U(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new U(lt(this.r),lt(this.g),lt(this.b),Rt(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:Oe,formatHex:Oe,formatHex8:hi,formatRgb:Xe,toString:Xe}));function Oe(){return`#${ft(this.r)}${ft(this.g)}${ft(this.b)}`}function hi(){return`#${ft(this.r)}${ft(this.g)}${ft(this.b)}${ft((isNaN(this.opacity)?1:this.opacity)*255)}`}function Xe(){const t=Rt(this.opacity);return`${t===1?"rgb(":"rgba("}${lt(this.r)}, ${lt(this.g)}, ${lt(this.b)}${t===1?")":`, ${t})`}`}function Rt(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function lt(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ft(t){return t=lt(t),(t<16?"0":"")+t.toString(16)}function Fe(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new W(t,e,n,r)}function Ye(t){if(t instanceof W)return new W(t.h,t.s,t.l,t.opacity);if(t instanceof wt||(t=St(t)),!t)return new W;if(t instanceof W)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=Math.max(e,n,r),o=NaN,s=a-i,u=(a+i)/2;return s?(e===a?o=(n-r)/s+(n<r)*6:n===a?o=(r-e)/s+2:o=(e-n)/s+4,s/=u<.5?a+i:2-a-i,o*=60):s=u>0&&u<1?0:o,new W(o,s,u,t.opacity)}function pi(t,e,n,r){return arguments.length===1?Ye(t):new W(t,e,n,r==null?1:r)}function W(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}re(W,pi,$e(wt,{brighter(t){return t=t==null?kt:Math.pow(kt,t),new W(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?xt:Math.pow(xt,t),new W(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new U(oe(t>=240?t-240:t+120,i,r),oe(t,i,r),oe(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new W(qe(this.h),Pt(this.s),Pt(this.l),Rt(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 t=Rt(this.opacity);return`${t===1?"hsl(":"hsla("}${qe(this.h)}, ${Pt(this.s)*100}%, ${Pt(this.l)*100}%${t===1?")":`, ${t})`}`}}));function qe(t){return t=(t||0)%360,t<0?t+360:t}function Pt(t){return Math.max(0,Math.min(1,t||0))}function oe(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Ve=t=>()=>t;function di(t,e){return function(n){return t+n*e}}function _i(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function gi(t){return(t=+t)==1?He:function(e,n){return n-e?_i(e,n,t):Ve(isNaN(e)?n:e)}}function He(t,e){var n=e-t;return n?di(t,n):Ve(isNaN(t)?e:t)}const Ue=function t(e){var n=gi(e);function r(i,a){var o=n((i=ie(i)).r,(a=ie(a)).r),s=n(i.g,a.g),u=n(i.b,a.b),f=He(i.opacity,a.opacity);return function(c){return i.r=o(c),i.g=s(c),i.b=u(c),i.opacity=f(c),i+""}}return r.gamma=t,r}(1);function ct(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var ae=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,se=new RegExp(ae.source,"g");function mi(t){return function(){return t}}function yi(t){return function(e){return t(e)+""}}function wi(t,e){var n=ae.lastIndex=se.lastIndex=0,r,i,a,o=-1,s=[],u=[];for(t=t+"",e=e+"";(r=ae.exec(t))&&(i=se.exec(e));)(a=i.index)>n&&(a=e.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,u.push({i:o,x:ct(r,i)})),n=se.lastIndex;return n<e.length&&(a=e.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?u[0]?yi(u[0].x):mi(e):(e=u.length,function(f){for(var c=0,d;c<e;++c)s[(d=u[c]).i]=d.x(f);return s.join("")})}var Ke=180/Math.PI,ce={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Be(t,e,n,r,i,a){var o,s,u;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(u=t*n+e*r)&&(n-=t*u,r-=e*u),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,u/=s),t*r<e*n&&(t=-t,e=-e,u=-u,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(e,t)*Ke,skewX:Math.atan(u)*Ke,scaleX:o,scaleY:s}}var Ot;function xi(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?ce:Be(e.a,e.b,e.c,e.d,e.e,e.f)}function vi(t){return t==null||(Ot||(Ot=document.createElementNS("http://www.w3.org/2000/svg","g")),Ot.setAttribute("transform",t),!(t=Ot.transform.baseVal.consolidate()))?ce:(t=t.matrix,Be(t.a,t.b,t.c,t.d,t.e,t.f))}function Ge(t,e,n,r){function i(f){return f.length?f.pop()+" ":""}function a(f,c,d,g,m,T){if(f!==d||c!==g){var S=m.push("translate(",null,e,null,n);T.push({i:S-4,x:ct(f,d)},{i:S-2,x:ct(c,g)})}else(d||g)&&m.push("translate("+d+e+g+n)}function o(f,c,d,g){f!==c?(f-c>180?c+=360:c-f>180&&(f+=360),g.push({i:d.push(i(d)+"rotate(",null,r)-2,x:ct(f,c)})):c&&d.push(i(d)+"rotate("+c+r)}function s(f,c,d,g){f!==c?g.push({i:d.push(i(d)+"skewX(",null,r)-2,x:ct(f,c)}):c&&d.push(i(d)+"skewX("+c+r)}function u(f,c,d,g,m,T){if(f!==d||c!==g){var S=m.push(i(m)+"scale(",null,",",null,")");T.push({i:S-4,x:ct(f,d)},{i:S-2,x:ct(c,g)})}else(d!==1||g!==1)&&m.push(i(m)+"scale("+d+","+g+")")}return function(f,c){var d=[],g=[];return f=t(f),c=t(c),a(f.translateX,f.translateY,c.translateX,c.translateY,d,g),o(f.rotate,c.rotate,d,g),s(f.skewX,c.skewX,d,g),u(f.scaleX,f.scaleY,c.scaleX,c.scaleY,d,g),f=c=null,function(m){for(var T=-1,S=g.length,C;++T<S;)d[(C=g[T]).i]=C.x(m);return d.join("")}}}var Si=Ge(xi,"px, ","px)","deg)"),bi=Ge(vi,", ",")",")"),Ei=1e-12;function Ze(t){return((t=Math.exp(t))+1/t)/2}function Ti(t){return((t=Math.exp(t))-1/t)/2}function Ci(t){return((t=Math.exp(2*t))-1)/(t+1)}const Ni=function t(e,n,r){function i(a,o){var s=a[0],u=a[1],f=a[2],c=o[0],d=o[1],g=o[2],m=c-s,T=d-u,S=m*m+T*T,C,w;if(S<Ei)w=Math.log(g/f)/e,C=function(k){return[s+k*m,u+k*T,f*Math.exp(e*k*w)]};else{var N=Math.sqrt(S),M=(g*g-f*f+r*S)/(2*f*n*N),O=(g*g-f*f-r*S)/(2*g*n*N),X=Math.log(Math.sqrt(M*M+1)-M),P=Math.log(Math.sqrt(O*O+1)-O);w=(P-X)/e,C=function(k){var L=k*w,D=Ze(X),K=f/(n*N)*(D*Ci(e*L+X)-Ti(X));return[s+K*m,u+K*T,f*D/Ze(e*L+X)]}}return C.duration=w*1e3*e/Math.SQRT2,C}return i.rho=function(a){var o=Math.max(.001,+a),s=o*o,u=s*s;return t(o,s,u)},i}(Math.SQRT2,2,4);var gt=0,bt=0,Et=0,Qe=1e3,Xt,Tt,Ft=0,ht=0,Yt=0,Ct=typeof performance=="object"&&performance.now?performance:Date,Je=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function ue(){return ht||(Je(Mi),ht=Ct.now()+Yt)}function Mi(){ht=0}function qt(){this._call=this._time=this._next=null}qt.prototype=We.prototype={constructor:qt,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?ue():+n)+(e==null?0:+e),!this._next&&Tt!==this&&(Tt?Tt._next=this:Xt=this,Tt=this),this._call=t,this._time=n,le()},stop:function(){this._call&&(this._call=null,this._time=1/0,le())}};function We(t,e,n){var r=new qt;return r.restart(t,e,n),r}function Ai(){ue(),++gt;for(var t=Xt,e;t;)(e=ht-t._time)>=0&&t._call.call(void 0,e),t=t._next;--gt}function je(){ht=(Ft=Ct.now())+Yt,gt=bt=0;try{Ai()}finally{gt=0,Li(),ht=0}}function zi(){var t=Ct.now(),e=t-Ft;e>Qe&&(Yt-=e,Ft=t)}function Li(){for(var t,e=Xt,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Xt=n);Tt=t,le(r)}function le(t){if(!gt){bt&&(bt=clearTimeout(bt));var e=t-ht;e>24?(t<1/0&&(bt=setTimeout(je,t-Ct.now()-Yt)),Et&&(Et=clearInterval(Et))):(Et||(Ft=Ct.now(),Et=setInterval(zi,Qe)),gt=1,Je(je))}}function tn(t,e,n){var r=new qt;return e=e==null?0:+e,r.restart(i=>{r.stop(),t(i+e)},e,n),r}var Ii=te("start","end","cancel","interrupt"),$i=[],en=0,nn=1,fe=2,Vt=3,rn=4,he=5,Ht=6;function Ut(t,e,n,r,i,a){var o=t.__transition;if(!o)t.__transition={};else if(n in o)return;ki(t,n,{name:e,index:r,group:i,on:Ii,tween:$i,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:en})}function pe(t,e){var n=j(t,e);if(n.state>en)throw new Error("too late; already scheduled");return n}function et(t,e){var n=j(t,e);if(n.state>Vt)throw new Error("too late; already running");return n}function j(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function ki(t,e,n){var r=t.__transition,i;r[e]=n,n.timer=We(a,0,n.time);function a(f){n.state=nn,n.timer.restart(o,n.delay,n.time),n.delay<=f&&o(f-n.delay)}function o(f){var c,d,g,m;if(n.state!==nn)return u();for(c in r)if(m=r[c],m.name===n.name){if(m.state===Vt)return tn(o);m.state===rn?(m.state=Ht,m.timer.stop(),m.on.call("interrupt",t,t.__data__,m.index,m.group),delete r[c]):+c<e&&(m.state=Ht,m.timer.stop(),m.on.call("cancel",t,t.__data__,m.index,m.group),delete r[c])}if(tn(function(){n.state===Vt&&(n.state=rn,n.timer.restart(s,n.delay,n.time),s(f))}),n.state=fe,n.on.call("start",t,t.__data__,n.index,n.group),n.state===fe){for(n.state=Vt,i=new Array(g=n.tween.length),c=0,d=-1;c<g;++c)(m=n.tween[c].value.call(t,t.__data__,n.index,n.group))&&(i[++d]=m);i.length=d+1}}function s(f){for(var c=f<n.duration?n.ease.call(null,f/n.duration):(n.timer.restart(u),n.state=he,1),d=-1,g=i.length;++d<g;)i[d].call(t,c);n.state===he&&(n.on.call("end",t,t.__data__,n.index,n.group),u())}function u(){n.state=Ht,n.timer.stop(),delete r[e];for(var f in r)return;delete t.__transition}}function Kt(t,e){var n=t.__transition,r,i,a=!0,o;if(n){e=e==null?null:e+"";for(o in n){if((r=n[o]).name!==e){a=!1;continue}i=r.state>fe&&r.state<he,r.state=Ht,r.timer.stop(),r.on.call(i?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[o]}a&&delete t.__transition}}function Di(t){return this.each(function(){Kt(this,t)})}function Ri(t,e){var n,r;return function(){var i=et(this,t),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===e){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function Pi(t,e,n){var r,i;if(typeof n!="function")throw new Error;return function(){var a=et(this,t),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:e,value:n},u=0,f=i.length;u<f;++u)if(i[u].name===e){i[u]=s;break}u===f&&i.push(s)}a.tween=i}}function Oi(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=j(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===t)return o.value;return null}return this.each((e==null?Ri:Pi)(n,t,e))}function de(t,e,n){var r=t._id;return t.each(function(){var i=et(this,r);(i.value||(i.value={}))[e]=n.apply(this,arguments)}),function(i){return j(i,r).value[e]}}function on(t,e){var n;return(typeof e=="number"?ct:e instanceof St?Ue:(n=St(e))?(e=n,Ue):wi)(t,e)}function Xi(t){return function(){this.removeAttribute(t)}}function Fi(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Yi(t,e,n){var r,i=n+"",a;return function(){var o=this.getAttribute(t);return o===i?null:o===r?a:a=e(r=o,n)}}function qi(t,e,n){var r,i=n+"",a;return function(){var o=this.getAttributeNS(t.space,t.local);return o===i?null:o===r?a:a=e(r=o,n)}}function Vi(t,e,n){var r,i,a;return function(){var o,s=n(this),u;return s==null?void this.removeAttribute(t):(o=this.getAttribute(t),u=s+"",o===u?null:o===r&&u===i?a:(i=u,a=e(r=o,s)))}}function Hi(t,e,n){var r,i,a;return function(){var o,s=n(this),u;return s==null?void this.removeAttributeNS(t.space,t.local):(o=this.getAttributeNS(t.space,t.local),u=s+"",o===u?null:o===r&&u===i?a:(i=u,a=e(r=o,s)))}}function Ui(t,e){var n=Lt(t),r=n==="transform"?bi:on;return this.attrTween(t,typeof e=="function"?(n.local?Hi:Vi)(n,r,de(this,"attr."+t,e)):e==null?(n.local?Fi:Xi)(n):(n.local?qi:Yi)(n,r,e))}function Ki(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Bi(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Gi(t,e){var n,r;function i(){var a=e.apply(this,arguments);return a!==r&&(n=(r=a)&&Bi(t,a)),n}return i._value=e,i}function Zi(t,e){var n,r;function i(){var a=e.apply(this,arguments);return a!==r&&(n=(r=a)&&Ki(t,a)),n}return i._value=e,i}function Qi(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=Lt(t);return this.tween(n,(r.local?Gi:Zi)(r,e))}function Ji(t,e){return function(){pe(this,t).delay=+e.apply(this,arguments)}}function Wi(t,e){return e=+e,function(){pe(this,t).delay=e}}function ji(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Ji:Wi)(e,t)):j(this.node(),e).delay}function to(t,e){return function(){et(this,t).duration=+e.apply(this,arguments)}}function eo(t,e){return e=+e,function(){et(this,t).duration=e}}function no(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?to:eo)(e,t)):j(this.node(),e).duration}function ro(t,e){if(typeof e!="function")throw new Error;return function(){et(this,t).ease=e}}function io(t){var e=this._id;return arguments.length?this.each(ro(e,t)):j(this.node(),e).ease}function oo(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;et(this,t).ease=n}}function ao(t){if(typeof t!="function")throw new Error;return this.each(oo(this._id,t))}function so(t){typeof t!="function"&&(t=Se(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a=e[i],o=a.length,s=r[i]=[],u,f=0;f<o;++f)(u=a[f])&&t.call(u,u.__data__,f,a)&&s.push(u);return new rt(r,this._parents,this._name,this._id)}function co(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,a=Math.min(r,i),o=new Array(r),s=0;s<a;++s)for(var u=e[s],f=n[s],c=u.length,d=o[s]=new Array(c),g,m=0;m<c;++m)(g=u[m]||f[m])&&(d[m]=g);for(;s<r;++s)o[s]=e[s];return new rt(o,this._parents,this._name,this._id)}function uo(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function lo(t,e,n){var r,i,a=uo(e)?pe:et;return function(){var o=a(this,t),s=o.on;s!==r&&(i=(r=s).copy()).on(e,n),o.on=i}}function fo(t,e){var n=this._id;return arguments.length<2?j(this.node(),n).on.on(t):this.each(lo(n,t,e))}function ho(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function po(){return this.on("end.remove",ho(this._id))}function _o(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Wt(t));for(var r=this._groups,i=r.length,a=new Array(i),o=0;o<i;++o)for(var s=r[o],u=s.length,f=a[o]=new Array(u),c,d,g=0;g<u;++g)(c=s[g])&&(d=t.call(c,c.__data__,g,s))&&("__data__"in c&&(d.__data__=c.__data__),f[g]=d,Ut(f[g],e,n,g,f,j(c,n)));return new rt(a,this._parents,e,n)}function go(t){var e=this._name,n=this._id;typeof t!="function"&&(t=ve(t));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var u=r[s],f=u.length,c,d=0;d<f;++d)if(c=u[d]){for(var g=t.call(c,c.__data__,d,u),m,T=j(c,n),S=0,C=g.length;S<C;++S)(m=g[S])&&Ut(m,e,n,S,g,T);a.push(g),o.push(c)}return new rt(a,o,e,n)}var mo=yt.prototype.constructor;function yo(){return new mo(this._groups,this._parents)}function wo(t,e){var n,r,i;return function(){var a=dt(this,t),o=(this.style.removeProperty(t),dt(this,t));return a===o?null:a===n&&o===r?i:i=e(n=a,r=o)}}function an(t){return function(){this.style.removeProperty(t)}}function xo(t,e,n){var r,i=n+"",a;return function(){var o=dt(this,t);return o===i?null:o===r?a:a=e(r=o,n)}}function vo(t,e,n){var r,i,a;return function(){var o=dt(this,t),s=n(this),u=s+"";return s==null&&(u=s=(this.style.removeProperty(t),dt(this,t))),o===u?null:o===r&&u===i?a:(i=u,a=e(r=o,s))}}function So(t,e){var n,r,i,a="style."+e,o="end."+a,s;return function(){var u=et(this,t),f=u.on,c=u.value[a]==null?s||(s=an(e)):void 0;(f!==n||i!==c)&&(r=(n=f).copy()).on(o,i=c),u.on=r}}function bo(t,e,n){var r=(t+="")=="transform"?Si:on;return e==null?this.styleTween(t,wo(t,r)).on("end.style."+t,an(t)):typeof e=="function"?this.styleTween(t,vo(t,r,de(this,"style."+t,e))).each(So(this._id,t)):this.styleTween(t,xo(t,r,e),n).on("end.style."+t,null)}function Eo(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function To(t,e,n){var r,i;function a(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&Eo(t,o,n)),r}return a._value=e,a}function Co(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,To(t,e,n==null?"":n))}function No(t){return function(){this.textContent=t}}function Mo(t){return function(){var e=t(this);this.textContent=e==null?"":e}}function Ao(t){return this.tween("text",typeof t=="function"?Mo(de(this,"text",t)):No(t==null?"":t+""))}function zo(t){return function(e){this.textContent=t.call(this,e)}}function Lo(t){var e,n;function r(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&zo(i)),e}return r._value=t,r}function Io(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,Lo(t))}function $o(){for(var t=this._name,e=this._id,n=sn(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,u,f=0;f<s;++f)if(u=o[f]){var c=j(u,e);Ut(u,t,n,f,o,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new rt(r,this._parents,t,n)}function ko(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},u={value:function(){--i===0&&a()}};n.each(function(){var f=et(this,r),c=f.on;c!==t&&(e=(t=c).copy(),e._.cancel.push(s),e._.interrupt.push(s),e._.end.push(u)),f.on=e}),i===0&&a()})}var Do=0;function rt(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function sn(){return++Do}var it=yt.prototype;rt.prototype={constructor:rt,select:_o,selectAll:go,selectChild:it.selectChild,selectChildren:it.selectChildren,filter:so,merge:co,selection:yo,transition:$o,call:it.call,nodes:it.nodes,node:it.node,size:it.size,empty:it.empty,each:it.each,on:fo,attr:Ui,attrTween:Qi,style:bo,styleTween:Co,text:Ao,textTween:Io,remove:po,tween:Oi,delay:ji,duration:no,ease:io,easeVarying:ao,end:ko,[Symbol.iterator]:it[Symbol.iterator]};function Ro(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Po={time:null,delay:0,duration:250,ease:Ro};function Oo(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Xo(t){var e,n;t instanceof rt?(e=t._id,t=t._name):(e=sn(),(n=Po).time=ue(),t=t==null?null:t+"");for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,u,f=0;f<s;++f)(u=o[f])&&Ut(u,t,e,f,o,n||Oo(u,e));return new rt(r,this._parents,t,e)}yt.prototype.interrupt=Di,yt.prototype.transition=Xo;const Bt=t=>()=>t;function Fo(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function ot(t,e,n){this.k=t,this.x=e,this.y=n}ot.prototype={constructor:ot,scale:function(t){return t===1?this:new ot(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new ot(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Nt=new ot(1,0,0);ot.prototype;function _e(t){t.stopImmediatePropagation()}function Mt(t){t.preventDefault(),t.stopImmediatePropagation()}function Yo(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function qo(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function cn(){return this.__zoom||Nt}function Vo(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Ho(){return navigator.maxTouchPoints||"ontouchstart"in this}function Uo(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],a=t.invertY(e[0][1])-n[0][1],o=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function un(){var t=Yo,e=qo,n=Uo,r=Vo,i=Ho,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,u=Ni,f=te("start","zoom","end"),c,d,g,m=500,T=150,S=0,C=10;function w(l){l.property("__zoom",cn).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",K).filter(i).on("touchstart.zoom",nt).on("touchmove.zoom",J).on("touchend.zoom touchcancel.zoom",A).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}w.transform=function(l,p,h,_){var y=l.selection?l.selection():l;y.property("__zoom",cn),l!==y?X(l,p,h,_):y.interrupt().each(function(){P(this,arguments).event(_).start().zoom(null,typeof p=="function"?p.apply(this,arguments):p).end()})},w.scaleBy=function(l,p,h,_){w.scaleTo(l,function(){var y=this.__zoom.k,x=typeof p=="function"?p.apply(this,arguments):p;return y*x},h,_)},w.scaleTo=function(l,p,h,_){w.transform(l,function(){var y=e.apply(this,arguments),x=this.__zoom,v=h==null?O(y):typeof h=="function"?h.apply(this,arguments):h,E=x.invert(v),b=typeof p=="function"?p.apply(this,arguments):p;return n(M(N(x,b),v,E),y,o)},h,_)},w.translateBy=function(l,p,h,_){w.transform(l,function(){return n(this.__zoom.translate(typeof p=="function"?p.apply(this,arguments):p,typeof h=="function"?h.apply(this,arguments):h),e.apply(this,arguments),o)},null,_)},w.translateTo=function(l,p,h,_,y){w.transform(l,function(){var x=e.apply(this,arguments),v=this.__zoom,E=_==null?O(x):typeof _=="function"?_.apply(this,arguments):_;return n(Nt.translate(E[0],E[1]).scale(v.k).translate(typeof p=="function"?-p.apply(this,arguments):-p,typeof h=="function"?-h.apply(this,arguments):-h),x,o)},_,y)};function N(l,p){return p=Math.max(a[0],Math.min(a[1],p)),p===l.k?l:new ot(p,l.x,l.y)}function M(l,p,h){var _=p[0]-h[0]*l.k,y=p[1]-h[1]*l.k;return _===l.x&&y===l.y?l:new ot(l.k,_,y)}function O(l){return[(+l[0][0]+ +l[1][0])/2,(+l[0][1]+ +l[1][1])/2]}function X(l,p,h,_){l.on("start.zoom",function(){P(this,arguments).event(_).start()}).on("interrupt.zoom end.zoom",function(){P(this,arguments).event(_).end()}).tween("zoom",function(){var y=this,x=arguments,v=P(y,x).event(_),E=e.apply(y,x),b=h==null?O(E):typeof h=="function"?h.apply(y,x):h,R=Math.max(E[1][0]-E[0][0],E[1][1]-E[0][1]),I=y.__zoom,Y=typeof p=="function"?p.apply(y,x):p,q=u(I.invert(b).concat(R/I.k),Y.invert(b).concat(R/Y.k));return function(V){if(V===1)V=Y;else{var B=q(V),ut=R/B[2];V=new ot(ut,b[0]-B[0]*ut,b[1]-B[1]*ut)}v.zoom(null,V)}})}function P(l,p,h){return!h&&l.__zooming||new k(l,p)}function k(l,p){this.that=l,this.args=p,this.active=0,this.sourceEvent=null,this.extent=e.apply(l,p),this.taps=0}k.prototype={event:function(l){return l&&(this.sourceEvent=l),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(l,p){return this.mouse&&l!=="mouse"&&(this.mouse[1]=p.invert(this.mouse[0])),this.touch0&&l!=="touch"&&(this.touch0[1]=p.invert(this.touch0[0])),this.touch1&&l!=="touch"&&(this.touch1[1]=p.invert(this.touch1[0])),this.that.__zoom=p,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(l){var p=H(this.that).datum();f.call(l,this.that,new Fo(l,{sourceEvent:this.sourceEvent,target:w,transform:this.that.__zoom,dispatch:f}),p)}};function L(l,...p){if(!t.apply(this,arguments))return;var h=P(this,p).event(l),_=this.__zoom,y=Math.max(a[0],Math.min(a[1],_.k*Math.pow(2,r.apply(this,arguments)))),x=st(l);if(h.wheel)(h.mouse[0][0]!==x[0]||h.mouse[0][1]!==x[1])&&(h.mouse[1]=_.invert(h.mouse[0]=x)),clearTimeout(h.wheel);else{if(_.k===y)return;h.mouse=[x,_.invert(x)],Kt(this),h.start()}Mt(l),h.wheel=setTimeout(v,T),h.zoom("mouse",n(M(N(_,y),h.mouse[0],h.mouse[1]),h.extent,o));function v(){h.wheel=null,h.end()}}function D(l,...p){if(g||!t.apply(this,arguments))return;var h=l.currentTarget,_=P(this,p,!0).event(l),y=H(l.view).on("mousemove.zoom",b,!0).on("mouseup.zoom",R,!0),x=st(l,h),v=l.clientX,E=l.clientY;ti(l.view),_e(l),_.mouse=[x,this.__zoom.invert(x)],Kt(this),_.start();function b(I){if(Mt(I),!_.moved){var Y=I.clientX-v,q=I.clientY-E;_.moved=Y*Y+q*q>S}_.event(I).zoom("mouse",n(M(_.that.__zoom,_.mouse[0]=st(I,h),_.mouse[1]),_.extent,o))}function R(I){y.on("mousemove.zoom mouseup.zoom",null),ei(I.view,_.moved),Mt(I),_.event(I).end()}}function K(l,...p){if(t.apply(this,arguments)){var h=this.__zoom,_=st(l.changedTouches?l.changedTouches[0]:l,this),y=h.invert(_),x=h.k*(l.shiftKey?.5:2),v=n(M(N(h,x),_,y),e.apply(this,p),o);Mt(l),s>0?H(this).transition().duration(s).call(X,v,_,l):H(this).call(w.transform,v,_,l)}}function nt(l,...p){if(t.apply(this,arguments)){var h=l.touches,_=h.length,y=P(this,p,l.changedTouches.length===_).event(l),x,v,E,b;for(_e(l),v=0;v<_;++v)E=h[v],b=st(E,this),b=[b,this.__zoom.invert(b),E.identifier],y.touch0?!y.touch1&&y.touch0[2]!==b[2]&&(y.touch1=b,y.taps=0):(y.touch0=b,x=!0,y.taps=1+!!c);c&&(c=clearTimeout(c)),x&&(y.taps<2&&(d=b[0],c=setTimeout(function(){c=null},m)),Kt(this),y.start())}}function J(l,...p){if(this.__zooming){var h=P(this,p).event(l),_=l.changedTouches,y=_.length,x,v,E,b;for(Mt(l),x=0;x<y;++x)v=_[x],E=st(v,this),h.touch0&&h.touch0[2]===v.identifier?h.touch0[0]=E:h.touch1&&h.touch1[2]===v.identifier&&(h.touch1[0]=E);if(v=h.that.__zoom,h.touch1){var R=h.touch0[0],I=h.touch0[1],Y=h.touch1[0],q=h.touch1[1],V=(V=Y[0]-R[0])*V+(V=Y[1]-R[1])*V,B=(B=q[0]-I[0])*B+(B=q[1]-I[1])*B;v=N(v,Math.sqrt(V/B)),E=[(R[0]+Y[0])/2,(R[1]+Y[1])/2],b=[(I[0]+q[0])/2,(I[1]+q[1])/2]}else if(h.touch0)E=h.touch0[0],b=h.touch0[1];else return;h.zoom("touch",n(M(v,E,b),h.extent,o))}}function A(l,...p){if(this.__zooming){var h=P(this,p).event(l),_=l.changedTouches,y=_.length,x,v;for(_e(l),g&&clearTimeout(g),g=setTimeout(function(){g=null},m),x=0;x<y;++x)v=_[x],h.touch0&&h.touch0[2]===v.identifier?delete h.touch0:h.touch1&&h.touch1[2]===v.identifier&&delete h.touch1;if(h.touch1&&!h.touch0&&(h.touch0=h.touch1,delete h.touch1),h.touch0)h.touch0[1]=this.__zoom.invert(h.touch0[0]);else if(h.end(),h.taps===2&&(v=st(v,this),Math.hypot(d[0]-v[0],d[1]-v[1])<C)){var E=H(this).on("dblclick.zoom");E&&E.apply(this,arguments)}}}return w.wheelDelta=function(l){return arguments.length?(r=typeof l=="function"?l:Bt(+l),w):r},w.filter=function(l){return arguments.length?(t=typeof l=="function"?l:Bt(!!l),w):t},w.touchable=function(l){return arguments.length?(i=typeof l=="function"?l:Bt(!!l),w):i},w.extent=function(l){return arguments.length?(e=typeof l=="function"?l:Bt([[+l[0][0],+l[0][1]],[+l[1][0],+l[1][1]]]),w):e},w.scaleExtent=function(l){return arguments.length?(a[0]=+l[0],a[1]=+l[1],w):[a[0],a[1]]},w.translateExtent=function(l){return arguments.length?(o[0][0]=+l[0][0],o[1][0]=+l[1][0],o[0][1]=+l[0][1],o[1][1]=+l[1][1],w):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},w.constrain=function(l){return arguments.length?(n=l,w):n},w.duration=function(l){return arguments.length?(s=+l,w):s},w.interpolate=function(l){return arguments.length?(u=l,w):u},w.on=function(){var l=f.on.apply(f,arguments);return l===f?w:l},w.clickDistance=function(l){return arguments.length?(S=(l=+l)*l,w):Math.sqrt(S)},w.tapDistance=function(l){return arguments.length?(C=+l,w):C},w}const F={DEFAULT_MIN_ZOOM:.1,DEFAULT_MAX_ZOOM:4,FIT_TO_VIEW_MAX_ZOOM:1,INITIAL_POSITION_X:0,INITIAL_POSITION_Y:0,SCROLL_POS_RATIO:3,DEFAULT_LAYOUT:1e6,INITIAL_SCROLLBAR_SIZE:50,MIN_SCROLLBAR_SIZE:15,SCROLL_DELTA_DIFF:1.5,DEFAULT_ZOOM_DELTA:.01},At={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",BOTTOM_LEFT:"bottom-left",BOTTOM_CENTER:"bottom-center"},Z={...At,TOP_CENTER:"top-center",BOTTOM_RIGHT:"bottom-right",CENTER_LEFT:"center-left",CENTER_RIGHT:"center-right",CENTER_CENTER:"center-center"},at={BLOCK_EVENTS:"react-infinite-canvas-block-events",BLOCK_SCROLL_CLASS:"react-infinite-canvas-block-scroll",BLOCK_ZOOM_CLASS:"react-infinite-canvas-block-zoom",BLOCK_PAN_CLASS:"react-infinite-canvas-block-pan"},zt=({value:t,min:e=0,max:n})=>Math.min(Math.max(t,e),n),Ko=({position:t,svgBounds:e,nodeBounds:n,currentTranslateX:r,currentTranslateY:i,currentScale:a,updatedScale:o,customOffset:s})=>{let[u,f,c]=[0,0,1];switch(o!==a&&(c=o/a,r*=c,i*=c),t){case Z.TOP_LEFT:return{updatedX:r+((e.x-n.x)*c+s.x),updat