@tanishraj/ui-kit 2.4.0 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -130,9 +130,9 @@ return(0,ft.jsx)(ml,{value:(0,Ve.useMemo)(()=>({baseId:r,disabled:a,focusTab:g,g
130
130
  return Ve.createElement("li",{tabIndex:0,ref:te,className:Wl(C,oe,null==R?void 0:R.toast,null==u||null==(t=u.classNames)?void 0:t.toast,null==R?void 0:R.default,null==R?void 0:R[ae],null==u||null==(n=u.classNames)?void 0:n[ae]),"data-sonner-toast":"","data-rich-colors":null!=(_e=u.richColors)?_e:w,"data-styled":!Boolean(u.jsx||u.unstyled||f),"data-mounted":I,"data-promise":Boolean(u.promise),"data-swiped":q,"data-removed":D,"data-visible":re,"data-y-position":me,"data-x-position":ge,"data-index":v,"data-front":ne,"data-swiping":X,"data-dismissible":ie,"data-type":ae,"data-invert":ye,"data-swipe-out":W,"data-swipe-direction":B,"data-expanded":Boolean(y||M&&I),"data-testid":u.testId,style:{"--index":v,"--toasts-before":v,"--z-index":b.length-v,"--offset":`${D?G:fe.current}px`,"--initial-height":M?"auto":`${Z}px`,..._,...u.style},onDragEnd:()=>{F(!1),A(null),he.current=null},onPointerDown:e=>{2!==e.button&&!xe&&ie&&(ee.current=/* @__PURE__ */new Date,K(fe.current),e.target.setPointerCapture(e.pointerId),"BUTTON"!==e.target.tagName&&(F(!0),he.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{var e,t,n;if(W||!ie)return;he.current=null;const r=Number((null==(e=te.current)?void 0:e.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),a=Number((null==(t=te.current)?void 0:t.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),i=/* @__PURE__ */(new Date).getTime()-(null==(n=ee.current)?void 0:n.getTime()),o="x"===L?r:a,s=Math.abs(o)/i;if(Math.abs(o)>=45||s>.11)return K(fe.current),null==u.onDismiss||u.onDismiss.call(u,u),P("x"===L?r>0?"right":"left":a>0?"down":"up"),we(),void Y(!0);var l,c;null==(l=te.current)||l.style.setProperty("--swipe-amount-x","0px"),null==(c=te.current)||c.style.setProperty("--swipe-amount-y","0px"),U(!1),F(!1),A(null)},onPointerMove:t=>{var n,r,a;if(!he.current||!ie)return;if((null==(n=window.getSelection())?void 0:n.toString().length)>0)return;const i=t.clientY-he.current.y,o=t.clientX-he.current.x;var s;const l=null!=(s=e.swipeDirections)?s:function(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}(j);!L&&(Math.abs(o)>1||Math.abs(i)>1)&&A(Math.abs(o)>Math.abs(i)?"x":"y");let c={x:0,y:0};const d=e=>1/(1.5+Math.abs(e)/20);if("y"===L){if(l.includes("top")||l.includes("bottom"))if(l.includes("top")&&i<0||l.includes("bottom")&&i>0)c.y=i;else{const e=i*d(i);c.y=Math.abs(e)<Math.abs(i)?e:i}}else if("x"===L&&(l.includes("left")||l.includes("right")))if(l.includes("left")&&o<0||l.includes("right")&&o>0)c.x=o;else{const e=o*d(o);c.x=Math.abs(e)<Math.abs(o)?e:o}(Math.abs(c.x)>0||Math.abs(c.y)>0)&&U(!0),null==(r=te.current)||r.style.setProperty("--swipe-amount-x",`${c.x}px`),null==(a=te.current)||a.style.setProperty("--swipe-amount-y",`${c.y}px`)}},ce&&!u.jsx&&"loading"!==ae?/*#__PURE__*/Ve.createElement("button",{"aria-label":O,"data-disabled":xe,"data-close-button":!0,onClick:xe||!ie?()=>{}:()=>{we(),null==u.onDismiss||u.onDismiss.call(u,u)},className:Wl(null==R?void 0:R.closeButton,null==u||null==(r=u.classNames)?void 0:r.closeButton)},null!=(Ne=null==T?void 0:T.close)?Ne:Al):null,(ae||u.icon||u.promise)&&null!==u.icon&&(null!==(null==T?void 0:T[ae])||u.icon)?/*#__PURE__*/Ve.createElement("div",{"data-icon":"",className:Wl(null==R?void 0:R.icon,null==u||null==(a=u.classNames)?void 0:a.icon)},u.promise||"loading"===u.type&&!u.icon?u.icon||function(){var e,t;return(null==T?void 0:T.loading)?/*#__PURE__*/Ve.createElement("div",{className:Wl(null==R?void 0:R.loader,null==u||null==(t=u.classNames)?void 0:t.loader,"sonner-loader"),"data-visible":"loading"===ae},T.loading):/*#__PURE__*/Ve.createElement(Ml,{className:Wl(null==R?void 0:R.loader,null==u||null==(e=u.classNames)?void 0:e.loader),visible:"loading"===ae})}():null,"loading"!==u.type?ke:null):null,/*#__PURE__*/Ve.createElement("div",{"data-content":"",className:Wl(null==R?void 0:R.content,null==u||null==(i=u.classNames)?void 0:i.content)},/*#__PURE__*/Ve.createElement("div",{"data-title":"",className:Wl(null==R?void 0:R.title,null==u||null==(o=u.classNames)?void 0:o.title)},u.jsx?u.jsx:"function"==typeof u.title?u.title():u.title),u.description?/*#__PURE__*/Ve.createElement("div",{"data-description":"",className:Wl(E,se,null==R?void 0:R.description,null==u||null==(s=u.classNames)?void 0:s.description)},"function"==typeof u.description?u.description():u.description):null),/*#__PURE__*/Ve.isValidElement(u.cancel)?u.cancel:u.cancel&&Hl(u.cancel)?/*#__PURE__*/Ve.createElement("button",{"data-button":!0,"data-cancel":!0,style:u.cancelButtonStyle||N,onClick:e=>{Hl(u.cancel)&&ie&&(null==u.cancel.onClick||u.cancel.onClick.call(u.cancel,e),we())},className:Wl(null==R?void 0:R.cancelButton,null==u||null==(l=u.classNames)?void 0:l.cancelButton)},u.cancel.label):null,/*#__PURE__*/Ve.isValidElement(u.action)?u.action:u.action&&Hl(u.action)?/*#__PURE__*/Ve.createElement("button",{"data-button":!0,"data-action":!0,style:u.actionButtonStyle||z,onClick:e=>{Hl(u.action)&&(null==u.action.onClick||u.action.onClick.call(u.action,e),e.defaultPrevented||we())},className:Wl(null==R?void 0:R.actionButton,null==u||null==(c=u.classNames)?void 0:c.actionButton)},u.action.label):null)};function ql(){if("undefined"==typeof window)return"ltr";if("undefined"==typeof document)return"ltr";const e=document.documentElement.getAttribute("dir");return"auto"!==e&&e?e:window.getComputedStyle(document.documentElement).direction}function Ul(e,t){const n={};return[e,t].forEach((e,t)=>{const r=1===t,a=r?"--mobile-offset":"--offset",i=r?"16px":"24px";function o(e){["top","right","bottom","left"].forEach(t=>{n[`${a}-${t}`]="number"==typeof e?`${e}px`:e})}"number"==typeof e||"string"==typeof e?o(e):"object"==typeof e?["top","right","bottom","left"].forEach(t=>{void 0===e[t]?n[`${a}-${t}`]=i:n[`${a}-${t}`]="number"==typeof e[t]?`${e[t]}px`:e[t]}):o(i)}),n}var Gl=/*#__PURE__*/Ve.forwardRef(function(e,t){const{id:n,invert:r,position:a="bottom-right",hotkey:i=["altKey","KeyT"],expand:o,closeButton:s,className:l,offset:c,mobileOffset:d,theme:u="light",richColors:f,duration:p,style:h,visibleToasts:m=Xl,toastOptions:g,dir:v=ql(),gap:b=Fl,icons:y,containerAriaLabel:x="Notifications"}=e,[w,k]=Ve.useState([]),_=Ve.useMemo(()=>n?w.filter(e=>e.toasterId===n):w.filter(e=>!e.toasterId),[w,n]),N=Ve.useMemo(()=>Array.from(new Set([a].concat(_.filter(e=>e.position).map(e=>e.position)))),[_,a]),[z,C]=Ve.useState([]),[E,S]=Ve.useState(!1),[j,$]=Ve.useState(!1),[M,R]=Ve.useState("system"!==u?u:"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),T=Ve.useRef(null),O=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),L=Ve.useRef(null),A=Ve.useRef(!1),B=Ve.useCallback(e=>{k(t=>{var n;return(null==(n=t.find(t=>t.id===e.id))?void 0:n.delete)||Pl.dismiss(e.id),t.filter(({id:t})=>t!==e.id)})},[]);return Ve.useEffect(()=>Pl.subscribe(e=>{e.dismiss?requestAnimationFrame(()=>{k(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))}):setTimeout(()=>{oa.flushSync(()=>{k(t=>{const n=t.findIndex(t=>t.id===e.id);return-1!==n?[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]:[e,...t]})})})}),[w]),Ve.useEffect(()=>{if("system"!==u)return void R(u);if("system"===u&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?R("dark"):R("light")),"undefined"==typeof window)return;const e=window.matchMedia("(prefers-color-scheme: dark)");try{e.addEventListener("change",({matches:e})=>{R(e?"dark":"light")})}catch(t){e.addListener(({matches:e})=>{try{R(e?"dark":"light")}catch(t){}})}},[u]),Ve.useEffect(()=>{w.length<=1&&S(!1)},[w]),Ve.useEffect(()=>{const e=e=>{var t,n;i.every(t=>e[t]||e.code===t)&&(S(!0),null==(n=T.current)||n.focus());"Escape"!==e.code||document.activeElement!==T.current&&!(null==(t=T.current)?void 0:t.contains(document.activeElement))||S(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[i]),Ve.useEffect(()=>{if(T.current)return()=>{L.current&&(L.current.focus({preventScroll:!0}),L.current=null,A.current=!1)}},[T.current]),/*#__PURE__*/Ve.createElement("section",{ref:t,"aria-label":`${x} ${O}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},N.map((t,n)=>{var a;const[i,u]=t.split("-");return _.length?/*#__PURE__*/Ve.createElement("ol",{key:t,dir:"auto"===v?ql():v,tabIndex:-1,ref:T,className:l,"data-sonner-toaster":!0,"data-sonner-theme":M,"data-y-position":i,"data-x-position":u,style:{"--front-toast-height":`${(null==(a=z[0])?void 0:a.height)||0}px`,"--width":"356px","--gap":`${b}px`,...h,...Ul(c,d)},onBlur:e=>{A.current&&!e.currentTarget.contains(e.relatedTarget)&&(A.current=!1,L.current&&(L.current.focus({preventScroll:!0}),L.current=null))},onFocus:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||A.current||(A.current=!0,L.current=e.relatedTarget)},onMouseEnter:()=>S(!0),onMouseMove:()=>S(!0),onMouseLeave:()=>{j||S(!1)},onDragEnd:()=>S(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||$(!0)},onPointerUp:()=>$(!1)},_.filter(e=>!e.position&&0===n||e.position===t).map((n,a)=>{var i,l;/*#__PURE__*/
131
131
  return Ve.createElement(Yl,{key:n.id,icons:y,index:a,toast:n,defaultRichColors:f,duration:null!=(i=null==g?void 0:g.duration)?i:p,className:null==g?void 0:g.className,descriptionClassName:null==g?void 0:g.descriptionClassName,invert:r,visibleToasts:m,closeButton:null!=(l=null==g?void 0:g.closeButton)?l:s,interacting:j,position:t,style:null==g?void 0:g.style,unstyled:null==g?void 0:g.unstyled,classNames:null==g?void 0:g.classNames,cancelButtonStyle:null==g?void 0:g.cancelButtonStyle,actionButtonStyle:null==g?void 0:g.actionButtonStyle,closeButtonAriaLabel:null==g?void 0:g.closeButtonAriaLabel,removeToast:B,toasts:_.filter(e=>e.position==n.position),heights:z.filter(e=>e.position==n.position),setHeights:C,expandByDefault:o,gap:b,expanded:E,swipeDirections:e.swipeDirections})})):null}))}),Kl=e=>{const t=/* @__PURE__ */ /* @__PURE__ */(0,ft.jsx)(Gl,{...e,position:"bottom-right",className:"toast",toastOptions:{className:"w-full rounded-md border-none p-0 shadow-lg"}});return"undefined"==typeof window?t:(0,oa.createPortal)(t,document.body)},Zl=()=>{const e=e=>{const{duration:t=5e3,position:n,dismissable:r,children:a,...i}=e,o=n?{duration:t,position:n}:{duration:t};return Dl.custom(e=>{const t=r?{onClose:()=>Dl.dismiss(e)}:{};/* @__PURE__ */ /* @__PURE__ */
132
132
  return(0,ft.jsx)(pt,{...i,...t,children:a})},o)};return{toast:e,default:t=>e({...t,variant:"default"}),primary:t=>e({...t,variant:"primary"}),info:t=>e({...t,variant:"info"}),success:t=>e({...t,variant:"success"}),warning:t=>e({...t,variant:"warning"}),danger:t=>e({...t,variant:"danger"}),error:t=>e({...t,variant:"danger"}),dismiss:Dl.dismiss}},Jl=rt("inline-flex items-center -space-x-[8px]",{variants:{size:{xs:"",sm:"",md:"",lg:""}},defaultVariants:{size:"md"}}),Ql=rt("inline-flex shrink-0 items-center justify-center border border-base text-white font-medium leading-none z-10",{variants:{variant:{default:"bg-default-pressed",primary:"bg-primary-pressed",info:"bg-info-pressed",success:"bg-success-pressed",warning:"bg-warning-pressed",danger:"bg-danger-pressed"},size:{xs:"size-4 text-xs",sm:"size-6 text-xs",md:"size-9 text-sm",lg:"size-10 text-base"},shape:{circle:"rounded-full",square:"rounded"}},defaultVariants:{variant:"default",size:"md",shape:"circle"},compoundVariants:[]}),ec=({items:e,size:t="md",variant:n="default",shape:r="circle",max:a=4,inverted:i=!1,stroke:o=!0,className:s,role:l="group",...c})=>{const{"aria-label":d,...u}=c,f=e??[],p=Math.max(1,a),h=f.slice(0,p),m=Math.max(0,f.length-h.length),g=d??"Avatar group";/* @__PURE__ */ /* @__PURE__ */
133
- return(0,ft.jsxs)("div",{...u,role:l,"aria-label":g,className:$e(Jl({size:t}),s),children:[h.map((e,a)=>/* @__PURE__ */ /* @__PURE__ */(0,ft.jsx)(xn,{...e,variant:n,size:t,shape:r,inverted:i,stroke:o},e.id??a)),m>0&&/* @__PURE__ */ /* @__PURE__ */(0,ft.jsxs)("span",{"aria-hidden":"true",className:Ql({size:t,shape:r,variant:n}),children:["+",m]})]})},tc={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function nc(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),tc.hasOwnProperty(t)?{space:tc[t],local:e}:e}function rc(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return"http://www.w3.org/1999/xhtml"===n&&"http://www.w3.org/1999/xhtml"===t.documentElement.namespaceURI?t.createElement(e):t.createElementNS(n,e)}}function ac(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ic(e){var t=nc(e);return(t.local?ac:rc)(t)}function oc(){}function sc(e){return null==e?oc:function(){return this.querySelector(e)}}function lc(){return[]}function cc(e){return null==e?lc:function(){return this.querySelectorAll(e)}}function dc(e){return function(){return function(e){return null==e?[]:Array.isArray(e)?e:Array.from(e)}(e.apply(this,arguments))}}function uc(e){return function(){return this.matches(e)}}function fc(e){return function(t){return t.matches(e)}}var pc=Array.prototype.find;function hc(){return this.firstElementChild}var mc=Array.prototype.filter;function gc(){return Array.from(this.children)}function vc(e){return new Array(e.length)}function bc(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function yc(e,t,n,r,a,i){for(var o,s=0,l=t.length,c=i.length;s<c;++s)(o=t[s])?(o.__data__=i[s],r[s]=o):n[s]=new bc(e,i[s]);for(;s<l;++s)(o=t[s])&&(a[s]=o)}function xc(e,t,n,r,a,i,o){var s,l,c,d=/* @__PURE__ */new Map,u=t.length,f=i.length,p=new Array(u);for(s=0;s<u;++s)(l=t[s])&&(p[s]=c=o.call(l,l.__data__,s,t)+"",d.has(c)?a[s]=l:d.set(c,l));for(s=0;s<f;++s)c=o.call(e,i[s],s,i)+"",(l=d.get(c))?(r[s]=l,l.__data__=i[s],d.delete(c)):n[s]=new bc(e,i[s]);for(s=0;s<u;++s)(l=t[s])&&d.get(p[s])===l&&(a[s]=l)}function wc(e){return e.__data__}function kc(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function _c(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Nc(e){return function(){this.removeAttribute(e)}}function zc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Cc(e,t){return function(){this.setAttribute(e,t)}}function Ec(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Sc(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function jc(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 $c(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Mc(e){return function(){this.style.removeProperty(e)}}function Rc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Tc(e,t,n){return function(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Oc(e,t){return e.style.getPropertyValue(t)||$c(e).getComputedStyle(e,null).getPropertyValue(t)}function Lc(e){return function(){delete this[e]}}function Ac(e,t){return function(){this[e]=t}}function Bc(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function Pc(e){return e.trim().split(/^|\s+/)}function Ic(e){return e.classList||new Vc(e)}function Vc(e){this._node=e,this._names=Pc(e.getAttribute("class")||"")}function Dc(e,t){for(var n=Ic(e),r=-1,a=t.length;++r<a;)n.add(t[r])}function Hc(e,t){for(var n=Ic(e),r=-1,a=t.length;++r<a;)n.remove(t[r])}function Xc(e){return function(){Dc(this,e)}}function Fc(e){return function(){Hc(this,e)}}function Wc(e,t){return function(){(t.apply(this,arguments)?Dc:Hc)(this,e)}}function Yc(){this.textContent=""}function qc(e){return function(){this.textContent=e}}function Uc(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function Gc(){this.innerHTML=""}function Kc(e){return function(){this.innerHTML=e}}function Zc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function Jc(){this.nextSibling&&this.parentNode.appendChild(this)}function Qc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ed(){return null}function td(){var e=this.parentNode;e&&e.removeChild(this)}function nd(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function rd(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ad(e){return function(){var t=this.__on;if(t){for(var n,r=0,a=-1,i=t.length;r<i;++r)n=t[r],e.type&&n.type!==e.type||n.name!==e.name?t[++a]=n:this.removeEventListener(n.type,n.listener,n.options);++a?t.length=a:delete this.__on}}}function id(e,t,n){return function(){var r,a=this.__on,i=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(a)for(var o=0,s=a.length;o<s;++o)if((r=a[o]).type===e.type&&r.name===e.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),void(r.value=t);this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},a?a.push(r):this.__on=[r]}}function od(e,t,n){var r=$c(e),a=r.CustomEvent;"function"==typeof a?a=new a(t,n):(a=r.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function sd(e,t){return function(){return od(this,e,t)}}function ld(e,t){return function(){return od(this,e,t.apply(this,arguments))}}bc.prototype={constructor:bc,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)}},Vc.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 cd=[null];function dd(e,t){this._groups=e,this._parents=t}function ud(){return new dd([[document.documentElement]],cd)}function fd(e){return"string"==typeof e?new dd([[document.querySelector(e)]],[document.documentElement]):new dd([[e]],cd)}function pd(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 r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}function hd(e){var t=0,n=e.children,r=n&&n.length;if(r)for(;--r>=0;)t+=n[r].value;else t=1;e.value=t}function md(e,t){e instanceof Map?(e=[void 0,e],void 0===t&&(t=vd)):void 0===t&&(t=gd);for(var n,r,a,i,o,s=new xd(e),l=[s];n=l.pop();)if((a=t(n.data))&&(o=(a=Array.from(a)).length))for(n.children=a,i=o-1;i>=0;--i)l.push(r=a[i]=new xd(a[i])),r.parent=n,r.depth=n.depth+1;return s.eachBefore(yd)}function gd(e){return e.children}function vd(e){return Array.isArray(e)?e[1]:null}function bd(e){void 0!==e.data.value&&(e.value=e.data.value),e.data=e.data.data}function yd(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function xd(e){this.data=e,this.depth=this.height=0,this.parent=null}function wd(e){return null==e?null:function(e){if("function"!=typeof e)throw new Error;return e}(e)}dd.prototype=ud.prototype={constructor:dd,select:function(e){"function"!=typeof e&&(e=sc(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var i,o,s=t[a],l=s.length,c=r[a]=new Array(l),d=0;d<l;++d)(i=s[d])&&(o=e.call(i,i.__data__,d,s))&&("__data__"in i&&(o.__data__=i.__data__),c[d]=o);return new dd(r,this._parents)},selectAll:function(e){e="function"==typeof e?dc(e):cc(e);for(var t=this._groups,n=t.length,r=[],a=[],i=0;i<n;++i)for(var o,s=t[i],l=s.length,c=0;c<l;++c)(o=s[c])&&(r.push(e.call(o,o.__data__,c,s)),a.push(o));return new dd(r,a)},selectChild:function(e){return this.select(null==e?hc:function(e){return function(){return pc.call(this.children,e)}}("function"==typeof e?e:fc(e)))},selectChildren:function(e){return this.selectAll(null==e?gc:function(e){return function(){return mc.call(this.children,e)}}("function"==typeof e?e:fc(e)))},filter:function(e){"function"!=typeof e&&(e=uc(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var i,o=t[a],s=o.length,l=r[a]=[],c=0;c<s;++c)(i=o[c])&&e.call(i,i.__data__,c,o)&&l.push(i);return new dd(r,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,wc);var n=t?xc:yc,r=this._parents,a=this._groups;"function"!=typeof e&&(e=function(e){return function(){return e}}(e));for(var i=a.length,o=new Array(i),s=new Array(i),l=new Array(i),c=0;c<i;++c){var d=r[c],u=a[c],f=u.length,p=kc(e.call(d,d&&d.__data__,c,r)),h=p.length,m=s[c]=new Array(h),g=o[c]=new Array(h);n(d,u,m,g,l[c]=new Array(f),p,t);for(var v,b,y=0,x=0;y<h;++y)if(v=m[y]){for(y>=x&&(x=y+1);!(b=g[x])&&++x<h;);v._next=b||null}}return(o=new dd(o,r))._enter=s,o._exit=l,o},enter:function(){return new dd(this._enter||this._groups.map(vc),this._parents)},exit:function(){return new dd(this._exit||this._groups.map(vc),this._parents)},join:function(e,t,n){var r=this.enter(),a=this,i=this.exit();return"function"==typeof e?(r=e(r))&&(r=r.selection()):r=r.append(e+""),null!=t&&(a=t(a))&&(a=a.selection()),null==n?i.remove():n(i),r&&a?r.merge(a).order():a},merge:function(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,a=n.length,i=r.length,o=Math.min(a,i),s=new Array(a),l=0;l<o;++l)for(var c,d=n[l],u=r[l],f=d.length,p=s[l]=new Array(f),h=0;h<f;++h)(c=d[h]||u[h])&&(p[h]=c);for(;l<a;++l)s[l]=n[l];return new dd(s,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r,a=e[t],i=a.length-1,o=a[i];--i>=0;)(r=a[i])&&(o&&4^r.compareDocumentPosition(o)&&o.parentNode.insertBefore(r,o),o=r);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=_c);for(var n=this._groups,r=n.length,a=new Array(r),i=0;i<r;++i){for(var o,s=n[i],l=s.length,c=a[i]=new Array(l),d=0;d<l;++d)(o=s[d])&&(c[d]=o);c.sort(t)}return new dd(a,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 r=e[t],a=0,i=r.length;a<i;++a){var o=r[a];if(o)return o}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,r=t.length;n<r;++n)for(var a,i=t[n],o=0,s=i.length;o<s;++o)(a=i[o])&&e.call(a,a.__data__,o,i);return this},attr:function(e,t){var n=nc(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==t?n.local?zc:Nc:"function"==typeof t?n.local?jc:Sc:n.local?Ec:Cc)(n,t))},style:function(e,t,n){return arguments.length>1?this.each((null==t?Mc:"function"==typeof t?Tc:Rc)(e,t,null==n?"":n)):Oc(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?Lc:"function"==typeof t?Bc:Ac)(e,t)):this.node()[e]},classed:function(e,t){var n=Pc(e+"");if(arguments.length<2){for(var r=Ic(this.node()),a=-1,i=n.length;++a<i;)if(!r.contains(n[a]))return!1;return!0}return this.each(("function"==typeof t?Wc:t?Xc:Fc)(n,t))},text:function(e){return arguments.length?this.each(null==e?Yc:("function"==typeof e?Uc:qc)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?Gc:("function"==typeof e?Zc:Kc)(e)):this.node().innerHTML},raise:function(){return this.each(Jc)},lower:function(){return this.each(Qc)},append:function(e){var t="function"==typeof e?e:ic(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var n="function"==typeof e?e:ic(e),r=null==t?ed:"function"==typeof t?t:sc(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(td)},clone:function(e){return this.select(e?rd:nd)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,n){var r,a,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+""),o=i.length;if(!(arguments.length<2)){for(s=t?id:ad,r=0;r<o;++r)this.each(s(i[r],t,n));return this}var s=this.node().__on;if(s)for(var l,c=0,d=s.length;c<d;++c)for(r=0,l=s[c];r<o;++r)if((a=i[r]).type===l.type&&a.name===l.name)return l.value},dispatch:function(e,t){return this.each(("function"==typeof t?ld:sd)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r,a=e[t],i=0,o=a.length;i<o;++i)(r=a[i])&&(yield r)}},xd.prototype=md.prototype={constructor:xd,count:function(){return this.eachAfter(hd)},each:function(e,t){let n=-1;for(const r of this)e.call(t,r,++n,this);return this},eachAfter:function(e,t){for(var n,r,a,i=this,o=[i],s=[],l=-1;i=o.pop();)if(s.push(i),n=i.children)for(r=0,a=n.length;r<a;++r)o.push(n[r]);for(;i=s.pop();)e.call(t,i,++l,this);return this},eachBefore:function(e,t){for(var n,r,a=this,i=[a],o=-1;a=i.pop();)if(e.call(t,a,++o,this),n=a.children)for(r=n.length-1;r>=0;--r)i.push(n[r]);return this},find:function(e,t){let n=-1;for(const r of this)if(e.call(t,r,++n,this))return r},sum:function(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,a=r&&r.length;--a>=0;)n+=r[a].value;t.value=n})},sort:function(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})},path:function(e){for(var t=this,n=function(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),a=null;e=n.pop(),t=r.pop();for(;e===t;)a=e,e=n.pop(),t=r.pop();return a}(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var a=r.length;e!==n;)r.splice(a,0,e),e=e.parent;return r},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){return Array.from(this)},leaves:function(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e},links:function(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t},copy:function(){return md(this).eachBefore(bd)},[Symbol.iterator]:function*(){var e,t,n,r,a=this,i=[a];do{for(e=i.reverse(),i=[];a=e.pop();)if(yield a,t=a.children)for(n=0,r=t.length;n<r;++n)i.push(t[n])}while(i.length)}};var kd={depth:-1},_d={},Nd={};function zd(e){return e.id}function Cd(e){return e.parentId}function Ed(e){let t=e.length;if(t<2)return"";for(;--t>1&&!Sd(e,t););return e.slice(0,t)}function Sd(e,t){if("/"===e[t]){let n=0;for(;t>0&&"\\"===e[--t];)++n;if(!(1&n))return!0}return!1}function jd(e,t){return e.parent===t.parent?1:2}function $d(e){var t=e.children;return t?t[0]:e.t}function Md(e){var t=e.children;return t?t[t.length-1]:e.t}function Rd(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function Td(e,t,n){return e.a.parent===t.parent?e.a:n}function Od(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}Od.prototype=Object.create(xd.prototype);var Ld={value:()=>{}};function Ad(){for(var e,t=0,n=arguments.length,r={};t<n;++t){if(!(e=arguments[t]+"")||e in r||/[\s.]/.test(e))throw new Error("illegal type: "+e);r[e]=[]}return new Bd(r)}function Bd(e){this._=e}function Pd(e,t){for(var n,r=0,a=e.length;r<a;++r)if((n=e[r]).name===t)return n.value}function Id(e,t,n){for(var r=0,a=e.length;r<a;++r)if(e[r].name===t){e[r]=Ld,e=e.slice(0,r).concat(e.slice(r+1));break}return null!=n&&e.push({name:t,value:n}),e}Bd.prototype=Ad.prototype={constructor:Bd,on:function(e,t){var n,r,a=this._,i=(r=a,(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&&!r.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})),o=-1,s=i.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++o<s;)if(n=(e=i[o]).type)a[n]=Id(a[n],e.name,t);else if(null==t)for(n in a)a[n]=Id(a[n],e.name,null);return this}for(;++o<s;)if((n=(e=i[o]).type)&&(n=Pd(a[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Bd(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,r,a=new Array(n),i=0;i<n;++i)a[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,n=(r=this._[e]).length;i<n;++i)r[i].value.apply(t,a)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],a=0,i=r.length;a<i;++a)r[a].value.apply(t,n)}};var Vd={capture:!0,passive:!1};function Dd(e){e.preventDefault(),e.stopImmediatePropagation()}function Hd(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Xd(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Fd(){}var Wd=.7,Yd=1/Wd,qd="\\s*([+-]?\\d+)\\s*",Ud="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Gd="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Kd=/^#([0-9a-f]{3,8})$/,Zd=new RegExp(`^rgb\\(${qd},${qd},${qd}\\)$`),Jd=new RegExp(`^rgb\\(${Gd},${Gd},${Gd}\\)$`),Qd=new RegExp(`^rgba\\(${qd},${qd},${qd},${Ud}\\)$`),eu=new RegExp(`^rgba\\(${Gd},${Gd},${Gd},${Ud}\\)$`),tu=new RegExp(`^hsl\\(${Ud},${Gd},${Gd}\\)$`),nu=new RegExp(`^hsla\\(${Ud},${Gd},${Gd},${Ud}\\)$`),ru={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 au(){return this.rgb().formatHex()}function iu(){return this.rgb().formatRgb()}function ou(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Kd.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?su(t):3===n?new du(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?lu(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?lu(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=Zd.exec(e))?new du(t[1],t[2],t[3],1):(t=Jd.exec(e))?new du(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Qd.exec(e))?lu(t[1],t[2],t[3],t[4]):(t=eu.exec(e))?lu(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=tu.exec(e))?gu(t[1],t[2]/100,t[3]/100,1):(t=nu.exec(e))?gu(t[1],t[2]/100,t[3]/100,t[4]):ru.hasOwnProperty(e)?su(ru[e]):"transparent"===e?new du(NaN,NaN,NaN,0):null}function su(e){return new du(e>>16&255,e>>8&255,255&e,1)}function lu(e,t,n,r){return r<=0&&(e=t=n=NaN),new du(e,t,n,r)}function cu(e,t,n,r){return 1===arguments.length?((a=e)instanceof Fd||(a=ou(a)),a?new du((a=a.rgb()).r,a.g,a.b,a.opacity):new du):new du(e,t,n,null==r?1:r);var a}function du(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function uu(){return`#${mu(this.r)}${mu(this.g)}${mu(this.b)}`}function fu(){const e=pu(this.opacity);return`${1===e?"rgb(":"rgba("}${hu(this.r)}, ${hu(this.g)}, ${hu(this.b)}${1===e?")":`, ${e})`}`}function pu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function hu(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function mu(e){return((e=hu(e))<16?"0":"")+e.toString(16)}function gu(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new bu(e,t,n,r)}function vu(e){if(e instanceof bu)return new bu(e.h,e.s,e.l,e.opacity);if(e instanceof Fd||(e=ou(e)),!e)return new bu;if(e instanceof bu)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,s=i-a,l=(i+a)/2;return s?(o=t===i?(n-r)/s+6*(n<r):n===i?(r-t)/s+2:(t-n)/s+4,s/=l<.5?i+a:2-i-a,o*=60):s=l>0&&l<1?0:o,new bu(o,s,l,e.opacity)}function bu(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function yu(e){return(e=(e||0)%360)<0?e+360:e}function xu(e){return Math.max(0,Math.min(1,e||0))}function wu(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function ku(e,t,n,r,a){var i=e*e,o=i*e;return((1-3*e+3*i-o)*t+(4-6*i+3*o)*n+(1+3*e+3*i-3*o)*r+o*a)/6}Hd(Fd,ou,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:au,formatHex:au,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return vu(this).formatHsl()},formatRgb:iu,toString:iu}),Hd(du,cu,Xd(Fd,{brighter(e){return e=null==e?Yd:Math.pow(Yd,e),new du(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?Wd:Math.pow(Wd,e),new du(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new du(hu(this.r),hu(this.g),hu(this.b),pu(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:uu,formatHex:uu,formatHex8:function(){return`#${mu(this.r)}${mu(this.g)}${mu(this.b)}${mu(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:fu,toString:fu})),Hd(bu,function(e,t,n,r){return 1===arguments.length?vu(e):new bu(e,t,n,null==r?1:r)},Xd(Fd,{brighter(e){return e=null==e?Yd:Math.pow(Yd,e),new bu(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Wd:Math.pow(Wd,e),new bu(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,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new du(wu(e>=240?e-240:e+120,a,r),wu(e,a,r),wu(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new bu(yu(this.h),xu(this.s),xu(this.l),pu(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=pu(this.opacity);return`${1===e?"hsl(":"hsla("}${yu(this.h)}, ${100*xu(this.s)}%, ${100*xu(this.l)}%${1===e?")":`, ${e})`}`}}));var _u=e=>()=>e;function Nu(e){return 1===(e=+e)?zu: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(r){return Math.pow(e+r*t,n)}}(t,n,e):_u(isNaN(t)?n:t)}}function zu(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):_u(isNaN(e)?t:e)}var Cu=function e(t){var n=Nu(t);function r(e,t){var r=n((e=cu(e)).r,(t=cu(t)).r),a=n(e.g,t.g),i=n(e.b,t.b),o=zu(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=a(t),e.b=i(t),e.opacity=o(t),e+""}}return r.gamma=e,r}(1);function Eu(e){return function(t){var n,r,a=t.length,i=new Array(a),o=new Array(a),s=new Array(a);for(n=0;n<a;++n)r=cu(t[n]),i[n]=r.r||0,o[n]=r.g||0,s[n]=r.b||0;return i=e(i),o=e(o),s=e(s),r.opacity=1,function(e){return r.r=i(e),r.g=o(e),r.b=s(e),r+""}}}Eu(function(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),a=e[r],i=e[r+1],o=r>0?e[r-1]:2*a-i,s=r<t-1?e[r+2]:2*i-a;return ku((n-r/t)*t,o,a,i,s)}}),Eu(function(e){var t=e.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*t),a=e[(r+t-1)%t],i=e[r%t],o=e[(r+1)%t],s=e[(r+2)%t];return ku((n-r/t)*t,a,i,o,s)}});function Su(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var ju=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,$u=new RegExp(ju.source,"g");function Mu(e,t){var n,r,a,i=ju.lastIndex=$u.lastIndex=0,o=-1,s=[],l=[];for(e+="",t+="";(n=ju.exec(e))&&(r=$u.exec(t));)(a=r.index)>i&&(a=t.slice(i,a),s[o]?s[o]+=a:s[++o]=a),(n=n[0])===(r=r[0])?s[o]?s[o]+=r:s[++o]=r:(s[++o]=null,l.push({i:o,x:Su(n,r)})),i=$u.lastIndex;return i<t.length&&(a=t.slice(i),s[o]?s[o]+=a:s[++o]=a),s.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,r=0;r<t;++r)s[(n=l[r]).i]=n.x(e);return s.join("")})}var Ru,Tu=180/Math.PI,Ou={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Lu(e,t,n,r,a,i){var o,s,l;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(l=e*n+t*r)&&(n-=e*l,r-=t*l),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,l/=s),e*r<t*n&&(e=-e,t=-t,l=-l,o=-o),{translateX:a,translateY:i,rotate:Math.atan2(t,e)*Tu,skewX:Math.atan(l)*Tu,scaleX:o,scaleY:s}}function Au(e,t,n,r){function a(e){return e.length?e.pop()+" ":""}return function(i,o){var s=[],l=[];return i=e(i),o=e(o),function(e,r,a,i,o,s){if(e!==a||r!==i){var l=o.push("translate(",null,t,null,n);s.push({i:l-4,x:Su(e,a)},{i:l-2,x:Su(r,i)})}else(a||i)&&o.push("translate("+a+t+i+n)}(i.translateX,i.translateY,o.translateX,o.translateY,s,l),function(e,t,n,i){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),i.push({i:n.push(a(n)+"rotate(",null,r)-2,x:Su(e,t)})):t&&n.push(a(n)+"rotate("+t+r)}(i.rotate,o.rotate,s,l),function(e,t,n,i){e!==t?i.push({i:n.push(a(n)+"skewX(",null,r)-2,x:Su(e,t)}):t&&n.push(a(n)+"skewX("+t+r)}(i.skewX,o.skewX,s,l),function(e,t,n,r,i,o){if(e!==n||t!==r){var s=i.push(a(i)+"scale(",null,",",null,")");o.push({i:s-4,x:Su(e,n)},{i:s-2,x:Su(t,r)})}else 1===n&&1===r||i.push(a(i)+"scale("+n+","+r+")")}(i.scaleX,i.scaleY,o.scaleX,o.scaleY,s,l),i=o=null,function(e){for(var t,n=-1,r=l.length;++n<r;)s[(t=l[n]).i]=t.x(e);return s.join("")}}}var Bu=Au(function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Ou:Lu(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),Pu=Au(function(e){return null==e?Ou:(Ru||(Ru=document.createElementNS("http://www.w3.org/2000/svg","g")),Ru.setAttribute("transform",e),(e=Ru.transform.baseVal.consolidate())?Lu((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Ou)},", ",")",")");function Iu(e){return((e=Math.exp(e))+1/e)/2}var Vu,Du,Hu=function e(t,n,r){function a(e,a){var i,o,s=e[0],l=e[1],c=e[2],d=a[0],u=a[1],f=a[2],p=d-s,h=u-l,m=p*p+h*h;if(m<1e-12)o=Math.log(f/c)/t,i=function(e){return[s+e*p,l+e*h,c*Math.exp(t*e*o)]};else{var g=Math.sqrt(m),v=(f*f-c*c+r*m)/(2*c*n*g),b=(f*f-c*c-r*m)/(2*f*n*g),y=Math.log(Math.sqrt(v*v+1)-v);o=(Math.log(Math.sqrt(b*b+1)-b)-y)/t,i=function(e){var r=e*o,a=Iu(y),i=c/(n*g)*(a*function(e){return((e=Math.exp(2*e))-1)/(e+1)}(t*r+y)-function(e){return((e=Math.exp(e))-1/e)/2}(y));return[s+i*p,l+i*h,c*a/Iu(t*r+y)]}}return i.duration=1e3*o*t/Math.SQRT2,i}return a.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},a}(Math.SQRT2,2,4),Xu=0,Fu=0,Wu=0,Yu=0,qu=0,Uu=0,Gu="object"==typeof performance&&performance.now?performance:Date,Ku="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Zu(){return qu||(Ku(Ju),qu=Gu.now()+Uu)}function Ju(){qu=0}function Qu(){this._call=this._time=this._next=null}function ef(e,t,n){var r=new Qu;return r.restart(e,t,n),r}function tf(){qu=(Yu=Gu.now())+Uu,Xu=Fu=0;try{!function(){Zu(),++Xu;for(var e,t=Vu;t;)(e=qu-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Xu}()}finally{Xu=0,function(){var e,t,n=Vu,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:Vu=t);Du=e,rf(r)}(),qu=0}}function nf(){var e=Gu.now(),t=e-Yu;t>1e3&&(Uu-=t,Yu=e)}function rf(e){Xu||(Fu&&(Fu=clearTimeout(Fu)),e-qu>24?(e<1/0&&(Fu=setTimeout(tf,e-Gu.now()-Uu)),Wu&&(Wu=clearInterval(Wu))):(Wu||(Yu=Gu.now(),Wu=setInterval(nf,1e3)),Xu=1,Ku(tf)))}function af(e,t,n){var r=new Qu;return t=null==t?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}Qu.prototype=ef.prototype={constructor:Qu,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?Zu():+n)+(null==t?0:+t),this._next||Du===this||(Du?Du._next=this:Vu=this,Du=this),this._call=e,this._time=n,rf()},stop:function(){this._call&&(this._call=null,this._time=1/0,rf())}};var of=Ad("start","end","cancel","interrupt"),sf=[];function lf(e,t,n,r,a,i){var o=e.__transition;if(o){if(n in o)return}else e.__transition={};!function(e,t,n){var r,a=e.__transition;function i(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(i){var c,d,u,f;if(1!==n.state)return l();for(c in a)if((f=a[c]).name===n.name){if(3===f.state)return af(o);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete a[c]):+c<t&&(f.state=6,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete a[c])}if(af(function(){3===n.state&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(i))}),n.state=2,n.on.call("start",e,e.__data__,n.index,n.group),2===n.state){for(n.state=3,r=new Array(u=n.tween.length),c=0,d=-1;c<u;++c)(f=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=f);r.length=d+1}}function s(t){for(var a=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(l),n.state=5,1),i=-1,o=r.length;++i<o;)r[i].call(e,a);5===n.state&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){for(var r in n.state=6,n.timer.stop(),delete a[t],a)return;delete e.__transition}a[t]=n,n.timer=ef(i,0,n.time)}(e,n,{name:t,index:r,group:a,on:of,tween:sf,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function cf(e,t){var n=uf(e,t);if(n.state>0)throw new Error("too late; already scheduled");return n}function df(e,t){var n=uf(e,t);if(n.state>3)throw new Error("too late; already running");return n}function uf(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function ff(e,t){var n,r,a,i=e.__transition,o=!0;if(i){for(a in t=null==t?null:t+"",i)(n=i[a]).name===t?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete i[a]):o=!1;o&&delete e.__transition}}function pf(e,t){var n,r;return function(){var a=df(this,e),i=a.tween;if(i!==n)for(var o=0,s=(r=n=i).length;o<s;++o)if(r[o].name===t){(r=r.slice()).splice(o,1);break}a.tween=r}}function hf(e,t,n){var r,a;if("function"!=typeof n)throw new Error;return function(){var i=df(this,e),o=i.tween;if(o!==r){a=(r=o).slice();for(var s={name:t,value:n},l=0,c=a.length;l<c;++l)if(a[l].name===t){a[l]=s;break}l===c&&a.push(s)}i.tween=a}}function mf(e,t,n){var r=e._id;return e.each(function(){var e=df(this,r);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return uf(e,r).value[t]}}function gf(e,t){var n;return("number"==typeof t?Su:t instanceof ou?Cu:(n=ou(t))?(t=n,Cu):Mu)(e,t)}function vf(e){return function(){this.removeAttribute(e)}}function bf(e){return function(){this.removeAttributeNS(e.space,e.local)}}function yf(e,t,n){var r,a,i=n+"";return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function xf(e,t,n){var r,a,i=n+"";return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function wf(e,t,n){var r,a,i;return function(){var o,s,l=n(this);if(null!=l)return(o=this.getAttribute(e))===(s=l+"")?null:o===r&&s===a?i:(a=s,i=t(r=o,l));this.removeAttribute(e)}}function kf(e,t,n){var r,a,i;return function(){var o,s,l=n(this);if(null!=l)return(o=this.getAttributeNS(e.space,e.local))===(s=l+"")?null:o===r&&s===a?i:(a=s,i=t(r=o,l));this.removeAttributeNS(e.space,e.local)}}function _f(e,t){var n,r;function a(){var a=t.apply(this,arguments);return a!==r&&(n=(r=a)&&function(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}(e,a)),n}return a._value=t,a}function Nf(e,t){var n,r;function a(){var a=t.apply(this,arguments);return a!==r&&(n=(r=a)&&function(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}(e,a)),n}return a._value=t,a}function zf(e,t){return function(){cf(this,e).delay=+t.apply(this,arguments)}}function Cf(e,t){return t=+t,function(){cf(this,e).delay=t}}function Ef(e,t){return function(){df(this,e).duration=+t.apply(this,arguments)}}function Sf(e,t){return t=+t,function(){df(this,e).duration=t}}var jf=ud.prototype.constructor;function $f(e){return function(){this.style.removeProperty(e)}}var Mf=0;function Rf(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Tf(){return++Mf}var Of=ud.prototype;Rf.prototype=function(e){return ud().transition(e)}.prototype={constructor:Rf,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=sc(e));for(var r=this._groups,a=r.length,i=new Array(a),o=0;o<a;++o)for(var s,l,c=r[o],d=c.length,u=i[o]=new Array(d),f=0;f<d;++f)(s=c[f])&&(l=e.call(s,s.__data__,f,c))&&("__data__"in s&&(l.__data__=s.__data__),u[f]=l,lf(u[f],t,n,f,u,uf(s,n)));return new Rf(i,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=cc(e));for(var r=this._groups,a=r.length,i=[],o=[],s=0;s<a;++s)for(var l,c=r[s],d=c.length,u=0;u<d;++u)if(l=c[u]){for(var f,p=e.call(l,l.__data__,u,c),h=uf(l,n),m=0,g=p.length;m<g;++m)(f=p[m])&&lf(f,t,n,m,p,h);i.push(p),o.push(l)}return new Rf(i,o,t,n)},selectChild:Of.selectChild,selectChildren:Of.selectChildren,filter:function(e){"function"!=typeof e&&(e=uc(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var i,o=t[a],s=o.length,l=r[a]=[],c=0;c<s;++c)(i=o[c])&&e.call(i,i.__data__,c,o)&&l.push(i);return new Rf(r,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,r=t.length,a=n.length,i=Math.min(r,a),o=new Array(r),s=0;s<i;++s)for(var l,c=t[s],d=n[s],u=c.length,f=o[s]=new Array(u),p=0;p<u;++p)(l=c[p]||d[p])&&(f[p]=l);for(;s<r;++s)o[s]=t[s];return new Rf(o,this._parents,this._name,this._id)},selection:function(){return new jf(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=Tf(),r=this._groups,a=r.length,i=0;i<a;++i)for(var o,s=r[i],l=s.length,c=0;c<l;++c)if(o=s[c]){var d=uf(o,t);lf(o,e,n,c,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Rf(r,this._parents,e,n)},call:Of.call,nodes:Of.nodes,node:Of.node,size:Of.size,empty:Of.empty,each:Of.each,on:function(e,t){var n=this._id;return arguments.length<2?uf(this.node(),n).on.on(e):this.each(function(e,t,n){var r,a,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)?cf:df;return function(){var o=i(this,e),s=o.on;s!==r&&(a=(r=s).copy()).on(t,n),o.on=a}}(n,e,t))},attr:function(e,t){var n=nc(e),r="transform"===n?Pu:gf;return this.attrTween(e,"function"==typeof t?(n.local?kf:wf)(n,r,mf(this,"attr."+e,t)):null==t?(n.local?bf:vf)(n):(n.local?xf:yf)(n,r,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 r=nc(e);return this.tween(n,(r.local?_f:Nf)(r,t))},style:function(e,t,n){var r="transform"==(e+="")?Bu:gf;return null==t?this.styleTween(e,function(e,t){var n,r,a;return function(){var i=Oc(this,e),o=(this.style.removeProperty(e),Oc(this,e));return i===o?null:i===n&&o===r?a:a=t(n=i,r=o)}}(e,r)).on("end.style."+e,$f(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var r,a,i;return function(){var o=Oc(this,e),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(e),l=s=Oc(this,e)),o===l?null:o===r&&l===a?i:(a=l,i=t(r=o,s))}}(e,r,mf(this,"style."+e,t))).each(function(e,t){var n,r,a,i,o="style."+t,s="end."+o;return function(){var l=df(this,e),c=l.on,d=null==l.value[o]?i||(i=$f(t)):void 0;c===n&&a===d||(r=(n=c).copy()).on(s,a=d),l.on=r}}(this._id,e)):this.styleTween(e,function(e,t,n){var r,a,i=n+"";return function(){var o=Oc(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}(e,r,t),n).on("end.style."+e,null)},styleTween:function(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw new Error;return this.tween(r,function(e,t,n){var r,a;function i(){var i=t.apply(this,arguments);return i!==a&&(r=(a=i)&&function(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}(e,i,n)),r}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}}(mf(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 r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&function(e){return function(t){this.textContent=e.call(this,t)}}(r)),t}return r._value=e,r}(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 r,a=uf(this.node(),n).tween,i=0,o=a.length;i<o;++i)if((r=a[i]).name===e)return r.value;return null}return this.each((null==t?pf:hf)(n,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?zf:Cf)(t,e)):uf(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?Ef:Sf)(t,e)):uf(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(){df(this,e).ease=t}}(t,e)):uf(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;df(this,e).ease=n}}(this._id,e))},end:function(){var e,t,n=this,r=n._id,a=n.size();return new Promise(function(i,o){var s={value:o},l={value:function(){0===--a&&i()}};n.each(function(){var n=df(this,r),a=n.on;a!==e&&((t=(e=a).copy())._.cancel.push(s),t._.interrupt.push(s),t._.end.push(l)),n.on=t}),0===a&&i()})},[Symbol.iterator]:Of[Symbol.iterator]};var Lf={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Af(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}ud.prototype.interrupt=function(e){return this.each(function(){ff(this,e)})},ud.prototype.transition=function(e){var t,n;e instanceof Rf?(t=e._id,e=e._name):(t=Tf(),(n=Lf).time=Zu(),e=null==e?null:e+"");for(var r=this._groups,a=r.length,i=0;i<a;++i)for(var o,s=r[i],l=s.length,c=0;c<l;++c)(o=s[c])&&lf(o,e,t,c,s,n||Af(o,t));return new Rf(r,this._parents,e,t)};var Bf=e=>()=>e;function Pf(e,{sourceEvent:t,target:n,transform:r,dispatch:a}){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:r,enumerable:!0,configurable:!0},_:{value:a}})}function If(e,t,n){this.k=e,this.x=t,this.y=n}If.prototype={constructor:If,scale:function(e){return 1===e?this:new If(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new If(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 Vf=new If(1,0,0);function Df(e){e.stopImmediatePropagation()}function Hf(e){e.preventDefault(),e.stopImmediatePropagation()}function Xf(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function Ff(){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 Wf(){return this.__zoom||Vf}function Yf(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function qf(){return navigator.maxTouchPoints||"ontouchstart"in this}function Uf(e,t,n){var r=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a),o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o))}function Gf(e){var t=0,n=e.children,r=n&&n.length;if(r)for(;--r>=0;)t+=n[r].value;else t=1;e.value=t}function Kf(e,t){var n,r,a,i,o,s=new ep(e),l=+e.value&&(s.value=e.value),c=[s];for(null==t&&(t=Zf);n=c.pop();)if(l&&(n.value=+n.data.value),(a=t(n.data))&&(o=a.length))for(n.children=new Array(o),i=o-1;i>=0;--i)c.push(r=n.children[i]=new ep(a[i])),r.parent=n,r.depth=n.depth+1;return s.eachBefore(Qf)}function Zf(e){return e.children}function Jf(e){e.data=e.data.data}function Qf(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function ep(e){this.data=e,this.depth=this.height=0,this.parent=null}If.prototype,ep.prototype=Kf.prototype={constructor:ep,count:function(){return this.eachAfter(Gf)},each:function(e){var t,n,r,a,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(e(i),n=i.children)for(r=0,a=n.length;r<a;++r)o.push(n[r])}while(o.length);return this},eachAfter:function(e){for(var t,n,r,a=this,i=[a],o=[];a=i.pop();)if(o.push(a),t=a.children)for(n=0,r=t.length;n<r;++n)i.push(t[n]);for(;a=o.pop();)e(a);return this},eachBefore:function(e){for(var t,n,r=this,a=[r];r=a.pop();)if(e(r),t=r.children)for(n=t.length-1;n>=0;--n)a.push(t[n]);return this},sum:function(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,a=r&&r.length;--a>=0;)n+=r[a].value;t.value=n})},sort:function(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})},path:function(e){for(var t=this,n=function(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),a=null;e=n.pop(),t=r.pop();for(;e===t;)a=e,e=n.pop(),t=r.pop();return a}(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var a=r.length;e!==n;)r.splice(a,0,e),e=e.parent;return r},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){var e=[];return this.each(function(t){e.push(t)}),e},leaves:function(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e},links:function(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t},copy:function(){return Kf(this).eachBefore(Jf)}};var tp={name:"d3-flextree",version:"2.1.2",main:"build/d3-flextree.js",module:"index","jsnext:main":"index",author:{name:"Chris Maloney",url:"http://chrismaloney.org"},description:"Flexible tree layout algorithm that allows for variable node sizes.",keywords:["d3","d3-module","layout","tree","hierarchy","d3-hierarchy","plugin","d3-plugin","infovis","visualization","2d"],homepage:"https://github.com/klortho/d3-flextree",license:"WTFPL",repository:{type:"git",url:"https://github.com/klortho/d3-flextree.git"},scripts:{clean:"rm -rf build demo test","build:demo":"rollup -c --environment BUILD:demo","build:dev":"rollup -c --environment BUILD:dev","build:prod":"rollup -c --environment BUILD:prod","build:test":"rollup -c --environment BUILD:test",build:"rollup -c",lint:"eslint index.js src","test:main":"node test/bundle.js","test:browser":"node test/browser-tests.js",test:"npm-run-all test:*",prepare:"npm-run-all clean build lint test"},dependencies:{"d3-hierarchy":"^1.1.5"},devDependencies:{"babel-plugin-external-helpers":"^6.22.0","babel-preset-es2015-rollup":"^3.0.0",d3:"^4.13.0","d3-selection-multi":"^1.0.1",eslint:"^4.19.1",jsdom:"^11.6.2","npm-run-all":"^4.1.2",rollup:"^0.55.3","rollup-plugin-babel":"^2.7.1","rollup-plugin-commonjs":"^8.0.2","rollup-plugin-copy":"^0.2.3","rollup-plugin-json":"^2.3.0","rollup-plugin-node-resolve":"^3.0.2","rollup-plugin-uglify":"^3.0.0","uglify-es":"^3.3.9"}},{version:np}=tp,rp=Object.freeze({children:e=>e.children,nodeSize:e=>e.data.size,spacing:0});function ap(e){const t=Object.assign({},rp,e);function n(e){const n=t[e];return"function"==typeof n?n:()=>n}function r(e){const t=i(function(){const e=a(),t=n("nodeSize"),r=n("spacing");return class extends e{constructor(e){super(e),Object.assign(this,{x:0,y:0,relX:0,prelim:0,shift:0,change:0,lExt:this,lExtRelX:0,lThr:null,rExt:this,rExtRelX:0,rThr:null})}get size(){return t(this.data)}spacing(e){return r(this.data,e.data)}get x(){return this.data.x}set x(e){this.data.x=e}get y(){return this.data.y}set y(e){this.data.y=e}update(){return ip(this),op(this),this}}}(),e,e=>e.children);return t.update(),t.data}function a(){const e=n("nodeSize"),t=n("spacing");return class n extends Kf.prototype.constructor{constructor(e){super(e)}copy(){const e=i(this.constructor,this,e=>e.children);return e.each(e=>e.data=e.data.data),e}get size(){return e(this)}spacing(e){return t(this,e)}get nodes(){return this.descendants()}get xSize(){return this.size[0]}get ySize(){return this.size[1]}get top(){return this.y}get bottom(){return this.y+this.ySize}get left(){return this.x-this.xSize/2}get right(){return this.x+this.xSize/2}get root(){const e=this.ancestors();return e[e.length-1]}get numChildren(){return this.hasChildren?this.children.length:0}get hasChildren(){return!this.noChildren}get noChildren(){return null===this.children}get firstChild(){return this.hasChildren?this.children[0]:null}get lastChild(){return this.hasChildren?this.children[this.numChildren-1]:null}get extents(){return(this.children||[]).reduce((e,t)=>n.maxExtents(e,t.extents),this.nodeExtents)}get nodeExtents(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}static maxExtents(e,t){return{top:Math.min(e.top,t.top),bottom:Math.max(e.bottom,t.bottom),left:Math.min(e.left,t.left),right:Math.max(e.right,t.right)}}}}function i(e,t,n){const r=(t,a)=>{const i=new e(t);Object.assign(i,{parent:a,depth:null===a?0:a.depth+1,height:0,length:1});const o=n(t)||[];return i.children=0===o.length?null:o.map(e=>r(e,i)),i.children&&Object.assign(i,i.children.reduce((e,t)=>({height:Math.max(e.height,t.height+1),length:e.length+t.length}),i)),i};return r(t,null)}return Object.assign(r,{nodeSize(e){return arguments.length?(t.nodeSize=e,r):t.nodeSize},spacing(e){return arguments.length?(t.spacing=e,r):t.spacing},children(e){return arguments.length?(t.children=e,r):t.children},hierarchy(e,n){const r=void 0===n?t.children:n;return i(a(),e,r)},dump(e){const t=n("nodeSize"),r=e=>n=>{const a=e+" ",i=e+" ",{x:o,y:s}=n,l=t(n),c=n.children||[],d=0===c.length?" ":`,${a}children: [${i}${c.map(r(i)).join(i)}${a}],${e}`;return`{ size: [${l.join(", ")}],${a}x: ${o}, y: ${s}${d}},`};return r("\n")(e)}}),r}ap.version=np;var ip=(e,t=0)=>(e.y=t,(e.children||[]).reduce((t,n)=>{const[r,a]=t;ip(n,e.y+e.ySize);const i=(0===r?n.lExt:n.rExt).bottom;0!==r&&lp(e,r,a);return[r+1,gp(i,r,a)]},[0,null]),sp(e),mp(e),e),op=(e,t,n)=>{void 0===t&&(t=-e.relX-e.prelim,n=0);const r=t+e.relX;return e.relX=r+e.prelim-n,e.prelim=0,e.x=n+e.relX,(e.children||[]).forEach(t=>op(t,r,e.x)),e},sp=e=>{(e.children||[]).reduce((e,t)=>{const[n,r]=e,a=n+t.shift,i=r+a+t.change;return t.relX+=i,[a,i]},[0,0])},lp=(e,t,n)=>{const r=e.children[t-1],a=e.children[t];let i=r,o=r.relX,s=a,l=a.relX,c=!0;for(;i&&s;){i.bottom>n.lowY&&(n=n.next);const r=o+i.prelim-(l+s.prelim)+i.xSize/2+s.xSize/2+i.spacing(s);(r>0||r<0&&c)&&(l+=r,cp(a,r),dp(e,t,n.index,r)),c=!1;const d=i.bottom,u=s.bottom;d<=u&&(i=fp(i),i&&(o+=i.relX)),d>=u&&(s=up(s),s&&(l+=s.relX))}!i&&s?pp(e,t,s,l):i&&!s&&hp(e,t,i,o)},cp=(e,t)=>{e.relX+=t,e.lExtRelX+=t,e.rExtRelX+=t},dp=(e,t,n,r)=>{const a=e.children[t],i=t-n;if(i>1){const t=r/i;e.children[n+1].shift+=t,a.shift-=t,a.change-=r-t}},up=e=>e.hasChildren?e.firstChild:e.lThr,fp=e=>e.hasChildren?e.lastChild:e.rThr,pp=(e,t,n,r)=>{const a=e.firstChild,i=a.lExt,o=e.children[t];i.lThr=n;const s=r-n.relX-a.lExtRelX;i.relX+=s,i.prelim-=s,a.lExt=o.lExt,a.lExtRelX=o.lExtRelX},hp=(e,t,n,r)=>{const a=e.children[t],i=a.rExt,o=e.children[t-1];i.rThr=n;const s=r-n.relX-a.rExtRelX;i.relX+=s,i.prelim-=s,a.rExt=o.rExt,a.rExtRelX=o.rExtRelX},mp=e=>{if(e.hasChildren){const t=e.firstChild,n=e.lastChild,r=(t.prelim+t.relX-t.xSize/2+n.relX+n.prelim+n.xSize/2)/2;Object.assign(e,{prelim:r,lExt:t.lExt,lExtRelX:t.lExtRelX,rExt:n.rExt,rExtRelX:n.rExtRelX})}},gp=(e,t,n)=>{for(;null!==n&&e>=n.lowY;)n=n.next;return{lowY:e,index:t,next:n}};function vp(e){return function(){return e}}var bp=Math.PI,yp=2*bp,xp=1e-6,wp=yp-xp;function kp(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}var _p=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==e?kp:function(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return kp;const n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,a,i){this._append`C${+e},${+t},${+n},${+r},${this._x1=+a},${this._y1=+i}`}arcTo(e,t,n,r,a){if(e=+e,t=+t,n=+n,r=+r,(a=+a)<0)throw new Error(`negative radius: ${a}`);let i=this._x1,o=this._y1,s=n-e,l=r-t,c=i-e,d=o-t,u=c*c+d*d;if(null===this._x1)this._append`M${this._x1=e},${this._y1=t}`;else if(u>xp)if(Math.abs(d*s-l*c)>xp&&a){let f=n-i,p=r-o,h=s*s+l*l,m=f*f+p*p,g=Math.sqrt(h),v=Math.sqrt(u),b=a*Math.tan((bp-Math.acos((h+u-m)/(2*g*v)))/2),y=b/v,x=b/g;Math.abs(y-1)>xp&&this._append`L${e+y*c},${t+y*d}`,this._append`A${a},${a},0,0,${+(d*f>c*p)},${this._x1=e+x*s},${this._y1=t+x*l}`}else this._append`L${this._x1=e},${this._y1=t}`;else;}arc(e,t,n,r,a,i){if(e=+e,t=+t,i=!!i,(n=+n)<0)throw new Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),l=e+o,c=t+s,d=1^i,u=i?r-a:a-r;null===this._x1?this._append`M${l},${c}`:(Math.abs(this._x1-l)>xp||Math.abs(this._y1-c)>xp)&&this._append`L${l},${c}`,n&&(u<0&&(u=u%yp+yp),u>wp?this._append`A${n},${n},0,1,${d},${e-o},${t-s}A${n},${n},0,1,${d},${this._x1=l},${this._y1=c}`:u>xp&&this._append`A${n},${n},0,${+(u>=bp)},${d},${this._x1=e+n*Math.cos(a)},${this._y1=t+n*Math.sin(a)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};var Np=Array.prototype.slice;function zp(e){return e[0]}function Cp(e){return e[1]}var Ep=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function Sp(e){return new Ep(e,!0)}function jp(e){return e.source}function $p(e){return e.target}function Mp(e){let t=jp,n=$p,r=zp,a=Cp,i=null,o=null,s=function(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(null==n)t=null;else{const e=Math.floor(n);if(!(e>=0))throw new RangeError(`invalid digits: ${n}`);t=e}return e},()=>new _p(t)}(l);function l(){let l;const c=Np.call(arguments),d=t.apply(this,c),u=n.apply(this,c);if(null==i&&(o=e(l=s())),o.lineStart(),c[0]=d,o.point(+r.apply(this,c),+a.apply(this,c)),c[0]=u,o.point(+r.apply(this,c),+a.apply(this,c)),o.lineEnd(),l)return o=null,l+""||null}return l.source=function(e){return arguments.length?(t=e,l):t},l.target=function(e){return arguments.length?(n=e,l):n},l.x=function(e){return arguments.length?(r="function"==typeof e?e:vp(+e),l):r},l.y=function(e){return arguments.length?(a="function"==typeof e?e:vp(+e),l):a},l.context=function(t){return arguments.length?(null==t?i=o=null:o=e(i=t),l):i},l}var Rp={selection:ud,select:fd,max:function(e,t){let n;if(void 0===t)for(const r of e)null!=r&&(n<r||void 0===n&&r>=r)&&(n=r);else{let r=-1;for(let a of e)null!=(a=t(a,++r,e))&&(n<a||void 0===n&&a>=a)&&(n=a)}return n},min:function(e,t){let n;if(void 0===t)for(const r of e)null!=r&&(n>r||void 0===n&&r>=r)&&(n=r);else{let r=-1;for(let a of e)null!=(a=t(a,++r,e))&&(n>a||void 0===n&&a>=a)&&(n=a)}return n},sum:function(e,t){let n=0;if(void 0===t)for(let r of e)(r=+r)&&(n+=r);else{let r=-1;for(let a of e)(a=+t(a,++r,e))&&(n+=a)}return n},cumsum:function(e,t){var n=0,r=0;return Float64Array.from(e,void 0===t?e=>n+=+e||0:a=>n+=+t(a,r++,e)||0)},tree:function(){var e=jd,t=1,n=1,r=null;function a(a){var l=function(e){for(var t,n,r,a,i,o=new Od(e,0),s=[o];t=s.pop();)if(r=t._.children)for(t.children=new Array(i=r.length),a=i-1;a>=0;--a)s.push(n=t.children[a]=new Od(r[a],a)),n.parent=t;return(o.parent=new Od(null,0)).children=[o],o}(a);if(l.eachAfter(i),l.parent.m=-l.z,l.eachBefore(o),r)a.eachBefore(s);else{var c=a,d=a,u=a;a.eachBefore(function(e){e.x<c.x&&(c=e),e.x>d.x&&(d=e),e.depth>u.depth&&(u=e)});var f=c===d?1:e(c,d)/2,p=f-c.x,h=t/(d.x+f+p),m=n/(u.depth||1);a.eachBefore(function(e){e.x=(e.x+p)*h,e.y=e.depth*m})}return a}function i(t){var n=t.children,r=t.parent.children,a=t.i?r[t.i-1]:null;if(n){!function(e){for(var t,n=0,r=0,a=e.children,i=a.length;--i>=0;)(t=a[i]).z+=n,t.m+=n,n+=t.s+(r+=t.c)}(t);var i=(n[0].z+n[n.length-1].z)/2;a?(t.z=a.z+e(t._,a._),t.m=t.z-i):t.z=i}else a&&(t.z=a.z+e(t._,a._));t.parent.A=function(t,n,r){if(n){for(var a,i=t,o=t,s=n,l=i.parent.children[0],c=i.m,d=o.m,u=s.m,f=l.m;s=Md(s),i=$d(i),s&&i;)l=$d(l),(o=Md(o)).a=t,(a=s.z+u-i.z-c+e(s._,i._))>0&&(Rd(Td(s,t,r),t,a),c+=a,d+=a),u+=s.m,c+=i.m,f+=l.m,d+=o.m;s&&!Md(o)&&(o.t=s,o.m+=u-d),i&&!$d(l)&&(l.t=i,l.m+=c-f,r=t)}return r}(t,a,t.parent.A||r[0])}function o(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function s(e){e.x*=t,e.y=e.depth*n}return a.separation=function(t){return arguments.length?(e=t,a):e},a.size=function(e){return arguments.length?(r=!1,t=+e[0],n=+e[1],a):r?null:[t,n]},a.nodeSize=function(e){return arguments.length?(r=!0,t=+e[0],n=+e[1],a):r?[t,n]:null},a},stratify:function(){var e,t=zd,n=Cd;function r(r){var a,i,o,s,l,c,d,u,f=Array.from(r),p=t,h=n,m=/* @__PURE__ */new Map;if(null!=e){const t=f.map((t,n)=>function(e){e=`${e}`;let t=e.length;Sd(e,t-1)&&!Sd(e,t-2)&&(e=e.slice(0,-1));return"/"===e[0]?e:`/${e}`}(e(t,n,r))),n=t.map(Ed),a=new Set(t).add("");for(const e of n)a.has(e)||(a.add(e),t.push(e),n.push(Ed(e)),f.push(Nd));p=(e,n)=>t[n],h=(e,t)=>n[t]}for(o=0,a=f.length;o<a;++o)i=f[o],c=f[o]=new xd(i),null!=(d=p(i,o,r))&&(d+="")&&(u=c.id=d,m.set(u,m.has(u)?_d:c)),null!=(d=h(i,o,r))&&(d+="")&&(c.parent=d);for(o=0;o<a;++o)if(d=(c=f[o]).parent){if(!(l=m.get(d)))throw new Error("missing: "+d);if(l===_d)throw new Error("ambiguous: "+d);l.children?l.children.push(c):l.children=[c],c.parent=l}else{if(s)throw new Error("multiple roots");s=c}if(!s)throw new Error("no root");if(null!=e){for(;s.data===Nd&&1===s.children.length;)s=s.children[0],--a;for(let e=f.length-1;e>=0&&(c=f[e]).data===Nd;--e)c.data=null}if(s.parent=kd,s.eachBefore(function(e){e.depth=e.parent.depth+1,--a}).eachBefore(yd),s.parent=null,a>0)throw new Error("cycle");return s}return r.id=function(e){return arguments.length?(t=wd(e),r):t},r.parentId=function(e){return arguments.length?(n=wd(e),r):n},r.path=function(t){return arguments.length?(e=wd(t),r):e},r},zoom:function(){var e,t,n,r=Xf,a=Ff,i=Uf,o=Yf,s=qf,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],d=250,u=Hu,f=Ad("start","zoom","end"),p=0,h=10;function m(e){e.property("__zoom",Wf).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",_).on("dblclick.zoom",N).filter(s).on("touchstart.zoom",z).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",E).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(e,t){return(t=Math.max(l[0],Math.min(l[1],t)))===e.k?e:new If(t,e.x,e.y)}function v(e,t,n){var r=t[0]-n[0]*e.k,a=t[1]-n[1]*e.k;return r===e.x&&a===e.y?e:new If(e.k,r,a)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function y(e,t,n,r){e.on("start.zoom",function(){x(this,arguments).event(r).start()}).on("interrupt.zoom end.zoom",function(){x(this,arguments).event(r).end()}).tween("zoom",function(){var e=this,i=arguments,o=x(e,i).event(r),s=a.apply(e,i),l=null==n?b(s):"function"==typeof n?n.apply(e,i):n,c=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f="function"==typeof t?t.apply(e,i):t,p=u(d.invert(l).concat(c/d.k),f.invert(l).concat(c/f.k));return function(e){if(1===e)e=f;else{var t=p(e),n=c/t[2];e=new If(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function x(e,t,n){return!n&&e.__zooming||new w(e,t)}function w(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=a.apply(e,t),this.taps=0}function k(e,...t){if(r.apply(this,arguments)){var n=x(this,t).event(e),a=this.__zoom,s=Math.max(l[0],Math.min(l[1],a.k*Math.pow(2,o.apply(this,arguments)))),d=pd(e);if(n.wheel)n.mouse[0][0]===d[0]&&n.mouse[0][1]===d[1]||(n.mouse[1]=a.invert(n.mouse[0]=d)),clearTimeout(n.wheel);else{if(a.k===s)return;n.mouse=[d,a.invert(d)],ff(this),n.start()}Hf(e),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",i(v(g(a,s),n.mouse[0],n.mouse[1]),n.extent,c))}}function _(e,...t){if(!n&&r.apply(this,arguments)){var a=e.currentTarget,o=x(this,t,!0).event(e),s=fd(e.view).on("mousemove.zoom",function(e){if(Hf(e),!o.moved){var t=e.clientX-d,n=e.clientY-u;o.moved=t*t+n*n>p}o.event(e).zoom("mouse",i(v(o.that.__zoom,o.mouse[0]=pd(e,a),o.mouse[1]),o.extent,c))},!0).on("mouseup.zoom",function(e){s.on("mousemove.zoom mouseup.zoom",null),function(e,t){var n=e.document.documentElement,r=fd(e).on("dragstart.drag",null);t&&(r.on("click.drag",Dd,Vd),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}(e.view,o.moved),Hf(e),o.event(e).end()},!0),l=pd(e,a),d=e.clientX,u=e.clientY;!function(e){var t=e.document.documentElement,n=fd(e).on("dragstart.drag",Dd,Vd);"onselectstart"in t?n.on("selectstart.drag",Dd,Vd):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}(e.view),Df(e),o.mouse=[l,this.__zoom.invert(l)],ff(this),o.start()}}function N(e,...t){if(r.apply(this,arguments)){var n=this.__zoom,o=pd(e.changedTouches?e.changedTouches[0]:e,this),s=n.invert(o),l=n.k*(e.shiftKey?.5:2),u=i(v(g(n,l),o,s),a.apply(this,t),c);Hf(e),d>0?fd(this).transition().duration(d).call(y,u,o,e):fd(this).call(m.transform,u,o,e)}}function z(n,...a){if(r.apply(this,arguments)){var i,o,s,l,c=n.touches,d=c.length,u=x(this,a,n.changedTouches.length===d).event(n);for(Df(n),o=0;o<d;++o)l=[l=pd(s=c[o],this),this.__zoom.invert(l),s.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},500)),ff(this),u.start())}}function C(e,...t){if(this.__zooming){var n,r,a,o,s=x(this,t).event(e),l=e.changedTouches,d=l.length;for(Hf(e),n=0;n<d;++n)a=pd(r=l[n],this),s.touch0&&s.touch0[2]===r.identifier?s.touch0[0]=a:s.touch1&&s.touch1[2]===r.identifier&&(s.touch1[0]=a);if(r=s.that.__zoom,s.touch1){var u=s.touch0[0],f=s.touch0[1],p=s.touch1[0],h=s.touch1[1],m=(m=p[0]-u[0])*m+(m=p[1]-u[1])*m,b=(b=h[0]-f[0])*b+(b=h[1]-f[1])*b;r=g(r,Math.sqrt(m/b)),a=[(u[0]+p[0])/2,(u[1]+p[1])/2],o=[(f[0]+h[0])/2,(f[1]+h[1])/2]}else{if(!s.touch0)return;a=s.touch0[0],o=s.touch0[1]}s.zoom("touch",i(v(r,a,o),s.extent,c))}}function E(e,...r){if(this.__zooming){var a,i,o=x(this,r).event(e),s=e.changedTouches,l=s.length;for(Df(e),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),a=0;a<l;++a)i=s[a],o.touch0&&o.touch0[2]===i.identifier?delete o.touch0:o.touch1&&o.touch1[2]===i.identifier&&delete o.touch1;if(o.touch1&&!o.touch0&&(o.touch0=o.touch1,delete o.touch1),o.touch0)o.touch0[1]=this.__zoom.invert(o.touch0[0]);else if(o.end(),2===o.taps&&(i=pd(i,this),Math.hypot(t[0]-i[0],t[1]-i[1])<h)){var c=fd(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return m.transform=function(e,t,n,r){var a=e.selection?e.selection():e;a.property("__zoom",Wf),e!==a?y(e,t,n,r):a.interrupt().each(function(){x(this,arguments).event(r).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()})},m.scaleBy=function(e,t,n,r){m.scaleTo(e,function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)},n,r)},m.scaleTo=function(e,t,n,r){m.transform(e,function(){var e=a.apply(this,arguments),r=this.__zoom,o=null==n?b(e):"function"==typeof n?n.apply(this,arguments):n,s=r.invert(o),l="function"==typeof t?t.apply(this,arguments):t;return i(v(g(r,l),o,s),e,c)},n,r)},m.translateBy=function(e,t,n,r){m.transform(e,function(){return i(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),a.apply(this,arguments),c)},null,r)},m.translateTo=function(e,t,n,r,o){m.transform(e,function(){var e=a.apply(this,arguments),o=this.__zoom,s=null==r?b(e):"function"==typeof r?r.apply(this,arguments):r;return i(Vf.translate(s[0],s[1]).scale(o.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,c)},r,o)},w.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=fd(this.that).datum();f.call(e,this.that,new Pf(e,{sourceEvent:this.sourceEvent,target:m,type:e,transform:this.that.__zoom,dispatch:f}),t)}},m.wheelDelta=function(e){return arguments.length?(o="function"==typeof e?e:Bf(+e),m):o},m.filter=function(e){return arguments.length?(r="function"==typeof e?e:Bf(!!e),m):r},m.touchable=function(e){return arguments.length?(s="function"==typeof e?e:Bf(!!e),m):s},m.extent=function(e){return arguments.length?(a="function"==typeof e?e:Bf([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),m):a},m.scaleExtent=function(e){return arguments.length?(l[0]=+e[0],l[1]=+e[1],m):[l[0],l[1]]},m.translateExtent=function(e){return arguments.length?(c[0][0]=+e[0][0],c[1][0]=+e[1][0],c[0][1]=+e[0][1],c[1][1]=+e[1][1],m):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},m.constrain=function(e){return arguments.length?(i=e,m):i},m.duration=function(e){return arguments.length?(d=+e,m):d},m.interpolate=function(e){return arguments.length?(u=e,m):u},m.on=function(){var e=f.on.apply(f,arguments);return e===f?m:e},m.clickDistance=function(e){return arguments.length?(p=(e=+e)*e,m):Math.sqrt(p)},m.tapDistance=function(e){return arguments.length?(h=+e,m):h},m},zoomIdentity:Vf,linkHorizontal:function(){return Mp(Sp)},flextree:ap},Tp=class{constructor(){const e={id:`ID${Math.floor(1e6*Math.random())}`,firstDraw:!0,ctx:document.createElement("canvas").getContext("2d"),initialExpandLevel:1,nodeDefaultBackground:"none",lastTransform:{x:0,y:0,k:1},allowedNodesCount:{},zoomBehavior:null,generateRoot:null,svgWidth:800,svgHeight:window.innerHeight-100,container:"body",data:null,connections:[],defaultFont:"Helvetica",nodeId:e=>e.nodeId||e.id,parentNodeId:e=>e.parentNodeId||e.parentId,rootMargin:40,nodeWidth:e=>250,nodeHeight:e=>150,neighbourMargin:(e,t)=>80,siblingsMargin:e=>20,childrenMargin:e=>60,compactMarginPair:e=>100,compactMarginBetween:e=>20,nodeButtonWidth:e=>40,nodeButtonHeight:e=>40,nodeButtonX:e=>-20,nodeButtonY:e=>-20,linkYOffset:30,pagingStep:e=>5,minPagingVisibleNodes:e=>2e3,scaleExtent:[.001,20],duration:400,imageName:"Chart",setActiveNodeCentered:!0,layout:"top",compact:!0,createZoom:e=>Rp.zoom(),onZoomStart:e=>{},onZoom:e=>{},onZoomEnd:e=>{},onNodeClick:e=>e,onExpandOrCollapse:e=>e,nodeContent:e=>`<div style="padding:5px;font-size:10px;">Sample Node(id=${e.id}), override using <br/> \n <code>chart.nodeContent({data}=>{ <br/>\n &nbsp;&nbsp;&nbsp;&nbsp;return '' // Custom HTML <br/>\n })</code>\n <br/> \n Or check different <a href="https://github.com/bumbeishvili/org-chart#jump-to-examples" target="_blank">layout examples</a>\n </div>`,buttonContent:({node:e,state:t})=>`<div style="border:1px solid #E4E2E9;border-radius:3px;padding:3px;font-size:9px;margin:auto auto;background-color:white"> ${{left:t=>t?`<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M14.283 3.50094L6.51 11.4749C6.37348 11.615 6.29707 11.8029 6.29707 11.9984C6.29707 12.194 6.37348 12.3819 6.51 12.5219L14.283 20.4989C14.3466 20.5643 14.4226 20.6162 14.5066 20.6516C14.5906 20.6871 14.6808 20.7053 14.772 20.7053C14.8632 20.7053 14.9534 20.6871 15.0374 20.6516C15.1214 20.6162 15.1974 20.5643 15.261 20.4989C15.3918 20.365 15.4651 20.1852 15.4651 19.9979C15.4651 19.8107 15.3918 19.6309 15.261 19.4969L7.9515 11.9984L15.261 4.50144C15.3914 4.36756 15.4643 4.18807 15.4643 4.00119C15.4643 3.81431 15.3914 3.63482 15.261 3.50094C15.1974 3.43563 15.1214 3.38371 15.0374 3.34827C14.9534 3.31282 14.8632 3.29456 14.772 3.29456C14.6808 3.29456 14.5906 3.31282 14.5066 3.34827C14.4226 3.38371 14.3466 3.43563 14.283 3.50094V3.50094Z" fill="#716E7B" stroke="#716E7B"/>\n </svg></span><span style="color:#716E7B">${e.data._directSubordinatesPaging} </span></div>`:`<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M7.989 3.49944C7.85817 3.63339 7.78492 3.8132 7.78492 4.00044C7.78492 4.18768 7.85817 4.36749 7.989 4.50144L15.2985 11.9999L7.989 19.4969C7.85817 19.6309 7.78492 19.8107 7.78492 19.9979C7.78492 20.1852 7.85817 20.365 7.989 20.4989C8.05259 20.5643 8.12863 20.6162 8.21261 20.6516C8.2966 20.6871 8.38684 20.7053 8.478 20.7053C8.56916 20.7053 8.6594 20.6871 8.74338 20.6516C8.82737 20.6162 8.90341 20.5643 8.967 20.4989L16.74 12.5234C16.8765 12.3834 16.9529 12.1955 16.9529 11.9999C16.9529 11.8044 16.8765 11.6165 16.74 11.4764L8.967 3.50094C8.90341 3.43563 8.82737 3.38371 8.74338 3.34827C8.6594 3.31282 8.56916 3.29456 8.478 3.29456C8.38684 3.29456 8.2966 3.31282 8.21261 3.34827C8.12863 3.38371 8.05259 3.43563 7.989 3.50094V3.49944Z" fill="#716E7B" stroke="#716E7B"/>\n </svg></span><span style="color:#716E7B">${e.data._directSubordinatesPaging} </span></div>`,bottom:t=>t?`<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M19.497 7.98903L12 15.297L4.503 7.98903C4.36905 7.85819 4.18924 7.78495 4.002 7.78495C3.81476 7.78495 3.63495 7.85819 3.501 7.98903C3.43614 8.05257 3.38462 8.12842 3.34944 8.21213C3.31427 8.29584 3.29615 8.38573 3.29615 8.47653C3.29615 8.56733 3.31427 8.65721 3.34944 8.74092C3.38462 8.82463 3.43614 8.90048 3.501 8.96403L11.4765 16.74C11.6166 16.8765 11.8044 16.953 12 16.953C12.1956 16.953 12.3834 16.8765 12.5235 16.74L20.499 8.96553C20.5643 8.90193 20.6162 8.8259 20.6517 8.74191C20.6871 8.65792 20.7054 8.56769 20.7054 8.47653C20.7054 8.38537 20.6871 8.29513 20.6517 8.21114C20.6162 8.12715 20.5643 8.05112 20.499 7.98753C20.3651 7.85669 20.1852 7.78345 19.998 7.78345C19.8108 7.78345 19.6309 7.85669 19.497 7.98753V7.98903Z" fill="#716E7B" stroke="#716E7B"/>\n </svg></span><span style="margin-left:1px;color:#716E7B" >${e.data._directSubordinatesPaging} </span></div>\n `:`<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M11.457 8.07005L3.49199 16.4296C3.35903 16.569 3.28485 16.7543 3.28485 16.9471C3.28485 17.1398 3.35903 17.3251 3.49199 17.4646L3.50099 17.4736C3.56545 17.5414 3.64304 17.5954 3.72904 17.6324C3.81504 17.6693 3.90765 17.6883 4.00124 17.6883C4.09483 17.6883 4.18745 17.6693 4.27344 17.6324C4.35944 17.5954 4.43703 17.5414 4.50149 17.4736L12.0015 9.60155L19.4985 17.4736C19.563 17.5414 19.6405 17.5954 19.7265 17.6324C19.8125 17.6693 19.9052 17.6883 19.9987 17.6883C20.0923 17.6883 20.1849 17.6693 20.2709 17.6324C20.3569 17.5954 20.4345 17.5414 20.499 17.4736L20.508 17.4646C20.641 17.3251 20.7151 17.1398 20.7151 16.9471C20.7151 16.7543 20.641 16.569 20.508 16.4296L12.543 8.07005C12.4729 7.99653 12.3887 7.93801 12.2954 7.89801C12.202 7.85802 12.1015 7.8374 12 7.8374C11.8984 7.8374 11.798 7.85802 11.7046 7.89801C11.6113 7.93801 11.527 7.99653 11.457 8.07005Z" fill="#716E7B" stroke="#716E7B"/>\n </svg></span><span style="margin-left:1px;color:#716E7B" >${e.data._directSubordinatesPaging} </span></div>\n `,right:t=>t?`<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M7.989 3.49944C7.85817 3.63339 7.78492 3.8132 7.78492 4.00044C7.78492 4.18768 7.85817 4.36749 7.989 4.50144L15.2985 11.9999L7.989 19.4969C7.85817 19.6309 7.78492 19.8107 7.78492 19.9979C7.78492 20.1852 7.85817 20.365 7.989 20.4989C8.05259 20.5643 8.12863 20.6162 8.21261 20.6516C8.2966 20.6871 8.38684 20.7053 8.478 20.7053C8.56916 20.7053 8.6594 20.6871 8.74338 20.6516C8.82737 20.6162 8.90341 20.5643 8.967 20.4989L16.74 12.5234C16.8765 12.3834 16.9529 12.1955 16.9529 11.9999C16.9529 11.8044 16.8765 11.6165 16.74 11.4764L8.967 3.50094C8.90341 3.43563 8.82737 3.38371 8.74338 3.34827C8.6594 3.31282 8.56916 3.29456 8.478 3.29456C8.38684 3.29456 8.2966 3.31282 8.21261 3.34827C8.12863 3.38371 8.05259 3.43563 7.989 3.50094V3.49944Z" fill="#716E7B" stroke="#716E7B"/>\n </svg></span><span style="color:#716E7B">${e.data._directSubordinatesPaging} </span></div>`:`<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M14.283 3.50094L6.51 11.4749C6.37348 11.615 6.29707 11.8029 6.29707 11.9984C6.29707 12.194 6.37348 12.3819 6.51 12.5219L14.283 20.4989C14.3466 20.5643 14.4226 20.6162 14.5066 20.6516C14.5906 20.6871 14.6808 20.7053 14.772 20.7053C14.8632 20.7053 14.9534 20.6871 15.0374 20.6516C15.1214 20.6162 15.1974 20.5643 15.261 20.4989C15.3918 20.365 15.4651 20.1852 15.4651 19.9979C15.4651 19.8107 15.3918 19.6309 15.261 19.4969L7.9515 11.9984L15.261 4.50144C15.3914 4.36756 15.4643 4.18807 15.4643 4.00119C15.4643 3.81431 15.3914 3.63482 15.261 3.50094C15.1974 3.43563 15.1214 3.38371 15.0374 3.34827C14.9534 3.31282 14.8632 3.29456 14.772 3.29456C14.6808 3.29456 14.5906 3.31282 14.5066 3.34827C14.4226 3.38371 14.3466 3.43563 14.283 3.50094V3.50094Z" fill="#716E7B" stroke="#716E7B"/>\n </svg></span><span style="color:#716E7B">${e.data._directSubordinatesPaging} </span></div>`,top:t=>t?`<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M11.457 8.07005L3.49199 16.4296C3.35903 16.569 3.28485 16.7543 3.28485 16.9471C3.28485 17.1398 3.35903 17.3251 3.49199 17.4646L3.50099 17.4736C3.56545 17.5414 3.64304 17.5954 3.72904 17.6324C3.81504 17.6693 3.90765 17.6883 4.00124 17.6883C4.09483 17.6883 4.18745 17.6693 4.27344 17.6324C4.35944 17.5954 4.43703 17.5414 4.50149 17.4736L12.0015 9.60155L19.4985 17.4736C19.563 17.5414 19.6405 17.5954 19.7265 17.6324C19.8125 17.6693 19.9052 17.6883 19.9987 17.6883C20.0923 17.6883 20.1849 17.6693 20.2709 17.6324C20.3569 17.5954 20.4345 17.5414 20.499 17.4736L20.508 17.4646C20.641 17.3251 20.7151 17.1398 20.7151 16.9471C20.7151 16.7543 20.641 16.569 20.508 16.4296L12.543 8.07005C12.4729 7.99653 12.3887 7.93801 12.2954 7.89801C12.202 7.85802 12.1015 7.8374 12 7.8374C11.8984 7.8374 11.798 7.85802 11.7046 7.89801C11.6113 7.93801 11.527 7.99653 11.457 8.07005Z" fill="#716E7B" stroke="#716E7B"/>\n </svg></span><span style="margin-left:1px;color:#716E7B">${e.data._directSubordinatesPaging} </span></div>\n `:`<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M19.497 7.98903L12 15.297L4.503 7.98903C4.36905 7.85819 4.18924 7.78495 4.002 7.78495C3.81476 7.78495 3.63495 7.85819 3.501 7.98903C3.43614 8.05257 3.38462 8.12842 3.34944 8.21213C3.31427 8.29584 3.29615 8.38573 3.29615 8.47653C3.29615 8.56733 3.31427 8.65721 3.34944 8.74092C3.38462 8.82463 3.43614 8.90048 3.501 8.96403L11.4765 16.74C11.6166 16.8765 11.8044 16.953 12 16.953C12.1956 16.953 12.3834 16.8765 12.5235 16.74L20.499 8.96553C20.5643 8.90193 20.6162 8.8259 20.6517 8.74191C20.6871 8.65792 20.7054 8.56769 20.7054 8.47653C20.7054 8.38537 20.6871 8.29513 20.6517 8.21114C20.6162 8.12715 20.5643 8.05112 20.499 7.98753C20.3651 7.85669 20.1852 7.78345 19.998 7.78345C19.8108 7.78345 19.6309 7.85669 19.497 7.98753V7.98903Z" fill="#716E7B" stroke="#716E7B"/>\n </svg></span><span style="margin-left:1px;color:#716E7B">${e.data._directSubordinatesPaging} </span></div>\n `}[t.layout](e.children)} </div>`,pagingButton:(e,t,n,r)=>{const a=r.pagingStep(e.parent),i=e.parent.data._pagingStep,o=e.parent.data._directSubordinatesPaging-i;return`\n <div style="margin-top:90px;">\n <div style="display:flex;width:170px;border-radius:20px;padding:5px 15px; padding-bottom:4px;;background-color:#E5E9F2">\n <div><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M5.59 7.41L10.18 12L5.59 16.59L7 18L13 12L7 6L5.59 7.41ZM16 6H18V18H16V6Z" fill="#716E7B" stroke="#716E7B"/>\n </svg>\n </div><div style="line-height:2"> Show next ${Math.min(o,a)} nodes </div></div>\n </div>\n `},nodeUpdate:function(e,t,n){Rp.select(this).select(".node-rect").attr("stroke",e=>e.data._highlighted||e.data._upToTheRootHighlighted?"#E27396":"none").attr("stroke-width",e.data._highlighted||e.data._upToTheRootHighlighted?10:1)},nodeEnter:e=>e,nodeExit:e=>e,linkUpdate:function(e,t,n){Rp.select(this).attr("stroke",e=>e.data._upToTheRootHighlighted?"#E27396":"#E4E2E9").attr("stroke-width",e=>e.data._upToTheRootHighlighted?5:1),e.data._upToTheRootHighlighted&&Rp.select(this).raise()},hdiagonal:function(e,t,n){const r=e.x,a=e.y,i=t.x,o=t.y;let s=n&&null!=n.x?n.x:r,l=n&&null!=n.y?n.y:a,c=i-r<0?-1:1,d=o-a<0?-1:1,u=Math.abs(i-r)/2<35?Math.abs(i-r)/2:35;u=Math.abs(o-a)/2<u?Math.abs(o-a)/2:u,Math.abs(o-a);let f=Math.abs(i-r)/2-u;return`\n M ${s} ${l}\n L ${s} ${a}\n L ${r} ${a}\n L ${r+f*c} ${a}\n C ${r+f*c+u*c} ${a} \n ${r+f*c+u*c} ${a} \n ${r+f*c+u*c} ${a+u*d}\n L ${r+f*c+u*c} ${o-u*d} \n C ${r+f*c+u*c} ${o} \n ${r+f*c+u*c} ${o} \n ${i-f*c} ${o}\n L ${i} ${o}\n `},diagonal:function(e,t,n,r={sy:0}){const a=e.x;let i=e.y;const o=t.x,s=t.y;let l=n&&null!=n.x?n.x:a,c=n&&null!=n.y?n.y:i,d=o-a<0?-1:1,u=s-i<0?-1:1;i+=r.sy;let f=Math.abs(o-a)/2<35?Math.abs(o-a)/2:35;f=Math.abs(s-i)/2<f?Math.abs(s-i)/2:f;let p=Math.abs(s-i)/2-f;return`\n M ${l} ${c}\n L ${a} ${c}\n L ${a} ${i}\n L ${a} ${i+p*u}\n C ${a} ${i+p*u+f*u} ${a} ${i+p*u+f*u} ${a+f*d} ${i+p*u+f*u}\n L ${a+(Math.abs(o-a)-2*f)*d+f*d} ${i+p*u+f*u}\n C ${o} ${i+p*u+f*u} ${o} ${i+p*u+f*u} ${o} ${s-p*u}\n L ${o} ${s}\n `},defs:function(e,t){return`<defs>\n ${t.map(t=>{const n=this.getTextWidth(t.label,{ctx:e.ctx,fontSize:2,defaultFont:e.defaultFont});return`\n <marker id="${t.from+"_"+t.to}" refX="${t._source.x<t._target.x?-7:7}" refY="5" markerWidth="500" markerHeight="500" orient="${t._source.x<t._target.x?"auto":"auto-start-reverse"}" >\n <rect rx=0.5 width=${t.label?n+3:0} height=3 y=1 fill="#E27396"></rect>\n <text font-size="2px" x=1 fill="white" y=3>${t.label||""}</text>\n </marker>\n\n <marker id="arrow-${t.from+"_"+t.to}" markerWidth="500" markerHeight="500" refY="2" refX="1" orient="${t._source.x<t._target.x?"auto":"auto-start-reverse"}" >\n <path transform="translate(0)" d='M0,0 V4 L2,2 Z' fill='#E27396' />\n </marker>\n `}).join("")}\n </defs>\n `},connectionsUpdate:function(e,t,n){Rp.select(this).attr("stroke",e=>"#E27396").attr("stroke-linecap","round").attr("stroke-width",e=>"5").attr("pointer-events","none").attr("marker-start",e=>`url(#${e.from+"_"+e.to})`).attr("marker-end",e=>`url(#arrow-${e.from+"_"+e.to})`)},linkGroupArc:Rp.linkHorizontal().x(e=>e.x).y(e=>e.y),layoutBindings:{left:{nodeLeftX:e=>0,nodeRightX:e=>e.width,nodeTopY:e=>-e.height/2,nodeBottomY:e=>e.height/2,nodeJoinX:e=>e.x+e.width,nodeJoinY:e=>e.y-e.height/2,linkJoinX:e=>e.x+e.width,linkJoinY:e=>e.y,linkX:e=>e.x,linkY:e=>e.y,linkCompactXStart:e=>e.x+e.width/2,linkCompactYStart:e=>e.y+(e.compactEven?e.height/2:-e.height/2),compactLinkMidX:(e,t)=>e.firstCompactNode.x,compactLinkMidY:(e,t)=>e.firstCompactNode.y+e.firstCompactNode.flexCompactDim[0]/4+t.compactMarginPair(e)/4,linkParentX:e=>e.parent.x+e.parent.width,linkParentY:e=>e.parent.y,buttonX:e=>e.width,buttonY:e=>e.height/2,centerTransform:({root:e,rootMargin:t,centerY:n,scale:r,centerX:a})=>`translate(${t},${n}) scale(${r})`,compactDimension:{sizeColumn:e=>e.height,sizeRow:e=>e.width,reverse:e=>e.slice().reverse()},nodeFlexSize:({height:e,width:t,siblingsMargin:n,childrenMargin:r,state:a,node:i})=>a.compact&&i.flexCompactDim?[i.flexCompactDim[0],i.flexCompactDim[1]]:[e+n,t+r],zoomTransform:({centerY:e,scale:t})=>`translate(0,${e}) scale(${t})`,diagonal:this.hdiagonal.bind(this),swap:e=>{const t=e.x;e.x=e.y,e.y=t},nodeUpdateTransform:({x:e,y:t,width:n,height:r})=>`translate(${e},${t-r/2})`},top:{nodeLeftX:e=>-e.width/2,nodeRightX:e=>e.width/2,nodeTopY:e=>0,nodeBottomY:e=>e.height,nodeJoinX:e=>e.x-e.width/2,nodeJoinY:e=>e.y+e.height,linkJoinX:e=>e.x,linkJoinY:e=>e.y+e.height,linkCompactXStart:e=>e.x+(e.compactEven?e.width/2:-e.width/2),linkCompactYStart:e=>e.y+e.height/2,compactLinkMidX:(e,t)=>e.firstCompactNode.x+e.firstCompactNode.flexCompactDim[0]/4+t.compactMarginPair(e)/4,compactLinkMidY:e=>e.firstCompactNode.y,compactDimension:{sizeColumn:e=>e.width,sizeRow:e=>e.height,reverse:e=>e},linkX:e=>e.x,linkY:e=>e.y,linkParentX:e=>e.parent.x,linkParentY:e=>e.parent.y+e.parent.height,buttonX:e=>e.width/2,buttonY:e=>e.height,centerTransform:({root:e,rootMargin:t,centerY:n,scale:r,centerX:a})=>`translate(${a},${t}) scale(${r})`,nodeFlexSize:({height:e,width:t,siblingsMargin:n,childrenMargin:r,state:a,node:i,compactViewIndex:o})=>a.compact&&i.flexCompactDim?[i.flexCompactDim[0],i.flexCompactDim[1]]:[t+n,e+r],zoomTransform:({centerX:e,scale:t})=>`translate(${e},0}) scale(${t})`,diagonal:this.diagonal.bind(this),swap:e=>{},nodeUpdateTransform:({x:e,y:t,width:n,height:r})=>`translate(${e-n/2},${t})`},bottom:{nodeLeftX:e=>-e.width/2,nodeRightX:e=>e.width/2,nodeTopY:e=>-e.height,nodeBottomY:e=>0,nodeJoinX:e=>e.x-e.width/2,nodeJoinY:e=>e.y-e.height-e.height,linkJoinX:e=>e.x,linkJoinY:e=>e.y-e.height,linkCompactXStart:e=>e.x+(e.compactEven?e.width/2:-e.width/2),linkCompactYStart:e=>e.y-e.height/2,compactLinkMidX:(e,t)=>e.firstCompactNode.x+e.firstCompactNode.flexCompactDim[0]/4+t.compactMarginPair(e)/4,compactLinkMidY:e=>e.firstCompactNode.y,linkX:e=>e.x,linkY:e=>e.y,compactDimension:{sizeColumn:e=>e.width,sizeRow:e=>e.height,reverse:e=>e},linkParentX:e=>e.parent.x,linkParentY:e=>e.parent.y-e.parent.height,buttonX:e=>e.width/2,buttonY:e=>0,centerTransform:({root:e,rootMargin:t,centerY:n,scale:r,centerX:a,chartHeight:i})=>`translate(${a},${i-t}) scale(${r})`,nodeFlexSize:({height:e,width:t,siblingsMargin:n,childrenMargin:r,state:a,node:i})=>a.compact&&i.flexCompactDim?[i.flexCompactDim[0],i.flexCompactDim[1]]:[t+n,e+r],zoomTransform:({centerX:e,scale:t})=>`translate(${e},0}) scale(${t})`,diagonal:this.diagonal.bind(this),swap:e=>{e.y=-e.y},nodeUpdateTransform:({x:e,y:t,width:n,height:r})=>`translate(${e-n/2},${t-r})`},right:{nodeLeftX:e=>-e.width,nodeRightX:e=>0,nodeTopY:e=>-e.height/2,nodeBottomY:e=>e.height/2,nodeJoinX:e=>e.x-e.width-e.width,nodeJoinY:e=>e.y-e.height/2,linkJoinX:e=>e.x-e.width,linkJoinY:e=>e.y,linkX:e=>e.x,linkY:e=>e.y,linkParentX:e=>e.parent.x-e.parent.width,linkParentY:e=>e.parent.y,buttonX:e=>0,buttonY:e=>e.height/2,linkCompactXStart:e=>e.x-e.width/2,linkCompactYStart:e=>e.y+(e.compactEven?e.height/2:-e.height/2),compactLinkMidX:(e,t)=>e.firstCompactNode.x,compactLinkMidY:(e,t)=>e.firstCompactNode.y+e.firstCompactNode.flexCompactDim[0]/4+t.compactMarginPair(e)/4,centerTransform:({root:e,rootMargin:t,centerY:n,scale:r,centerX:a,chartWidth:i})=>`translate(${i-t},${n}) scale(${r})`,nodeFlexSize:({height:e,width:t,siblingsMargin:n,childrenMargin:r,state:a,node:i})=>a.compact&&i.flexCompactDim?[i.flexCompactDim[0],i.flexCompactDim[1]]:[e+n,t+r],compactDimension:{sizeColumn:e=>e.height,sizeRow:e=>e.width,reverse:e=>e.slice().reverse()},zoomTransform:({centerY:e,scale:t})=>`translate(0,${e}) scale(${t})`,diagonal:this.hdiagonal.bind(this),swap:e=>{const t=e.x;e.x=-e.y,e.y=t},nodeUpdateTransform:({x:e,y:t,width:n,height:r})=>`translate(${e-n},${t-r/2})`}}};this.getChartState=()=>e,Object.keys(e).forEach(t=>{this[t]=function(n){return arguments.length?(e[t]=n,this):e[t]}}),this.initializeEnterExitUpdatePattern()}initializeEnterExitUpdatePattern(){Rp.selection.prototype.patternify=function(e){var t=e.selector,n=e.tag,r=e.data||[t],a=this.selectAll("."+t).data(r,(e,t)=>"object"==typeof e&&e.id?e.id:t);return a.exit().remove(),(a=a.enter().append(n).merge(a)).attr("class",t),a}}getNodeChildren({data:e,children:t,_children:n},r){return r.push(e),t&&t.forEach(e=>{this.getNodeChildren(e,r)}),n&&n.forEach(e=>{this.getNodeChildren(e,r)}),r}initialZoom(e){return this.getChartState().lastTransform.k=e,this}render(){const e=this.getChartState();if(!e.data||0==e.data.length)return e.container&&(fd(e.container).select(".nodes-wrapper").remove(),fd(e.container).select(".links-wrapper").remove(),fd(e.container).select(".connections-wrapper").remove()),this;const t=Rp.select(e.container),n=t.node().getBoundingClientRect();n.width>0&&(e.svgWidth=n.width);const r={id:`ID${Math.floor(1e6*Math.random())}`,chartWidth:e.svgWidth,chartHeight:e.svgHeight};if(e.calc=r,r.centerX=r.chartWidth/2,r.centerY=r.chartHeight/2,e.firstDraw){const t={zoom:null};t.zoom=e.createZoom().clickDistance(10).on("start",(t,n)=>e.onZoomStart(t)).on("end",(t,n)=>e.onZoomEnd(t)).on("zoom",(t,n)=>{e.onZoom(t),this.zoomed(t,n)}).scaleExtent(e.scaleExtent),e.zoomBehavior=t.zoom}e.flexTreeLayout=ap({nodeSize:t=>{const n=e.nodeWidth(t),r=e.nodeHeight(t),a=e.siblingsMargin(t),i=e.childrenMargin(t);return e.layoutBindings[e.layout].nodeFlexSize({state:e,node:t,width:n,height:r,siblingsMargin:a,childrenMargin:i})}}).spacing((t,n)=>t.parent==n.parent?0:e.neighbourMargin(t,n)),this.setLayouts({expandNodesFirst:!1});const a=t.patternify({tag:"svg",selector:"svg-chart-container"}).attr("width",e.svgWidth).attr("height",e.svgHeight).attr("font-family",e.defaultFont);e.firstDraw&&a.call(e.zoomBehavior).on("dblclick.zoom",null).attr("cursor","move"),e.svg=a;const i=a.patternify({tag:"g",selector:"chart"});return e.centerG=i.patternify({tag:"g",selector:"center-group"}),e.linksWrapper=e.centerG.patternify({tag:"g",selector:"links-wrapper"}),e.nodesWrapper=e.centerG.patternify({tag:"g",selector:"nodes-wrapper"}),e.connectionsWrapper=e.centerG.patternify({tag:"g",selector:"connections-wrapper"}),e.defsWrapper=a.patternify({tag:"g",selector:"defs-wrapper"}),e.firstDraw&&e.centerG.attr("transform",()=>e.layoutBindings[e.layout].centerTransform({centerX:r.centerX,centerY:r.centerY,scale:e.lastTransform.k,rootMargin:e.rootMargin,root:e.root,chartHeight:r.chartHeight,chartWidth:r.chartWidth})),e.chart=i,this.update(e.root),Rp.select(window).on(`resize.${e.id}`,()=>{const t=Rp.select(e.container).node().getBoundingClientRect();e.svg.attr("width",t.width)}),e.firstDraw&&(e.firstDraw=!1),this}addNode(e){const t=this.getChartState();if(e&&(null==t.parentNodeId(e)||t.parentNodeId(e)==t.nodeId(e))&&0==t.data.length)return t.data.push(e),this.render(),this;const n=t.generateRoot(t.data).descendants(),r=n.filter(({data:n})=>t.nodeId(n).toString()===t.nodeId(e).toString())[0];return n.filter(({data:n})=>t.nodeId(n).toString()===t.parentNodeId(e).toString())[0],r||(e._centered&&!e._expanded&&(e._expanded=!0),t.data.push(e),this.updateNodesState()),this}removeNode(e){const t=this.getChartState(),n=t.generateRoot(t.data).descendants().filter(({data:n})=>t.nodeId(n)==e)[0];return n?(n.descendants().forEach(e=>e.data._filteredOut=!0),t.data=t.data.filter(e=>!e._filteredOut),0==t.data.length?this.render():this.updateNodesState.bind(this)(),this):this}groupBy(e,t,n){const r={};return e.forEach(e=>{const n=t(e);r[n]||(r[n]=[]),r[n].push(e)}),Object.keys(r).forEach(e=>{r[e]=n(r[e])}),Object.entries(r)}calculateCompactFlexDimensions(e){const t=this.getChartState();e.eachBefore(e=>{e.firstCompact=null,e.compactEven=null,e.flexCompactDim=null,e.firstCompactNode=null}),e.eachBefore(e=>{if(e.children&&e.children.length>1){const n=e.children.filter(e=>!e.children);if(n.length<2)return;n.forEach((e,t)=>{t||(e.firstCompact=!0),e.compactEven=!(t%2),e.row=Math.floor(t/2)});const r=Rp.max(n.filter(e=>e.compactEven),t.layoutBindings[t.layout].compactDimension.sizeColumn),a=Rp.max(n.filter(e=>!e.compactEven),t.layoutBindings[t.layout].compactDimension.sizeColumn),i=2*Math.max(r,a),o=this.groupBy(n,e=>e.row,e=>Rp.max(e,e=>t.layoutBindings[t.layout].compactDimension.sizeRow(e)+t.compactMarginBetween(e))),s=Rp.sum(o.map(e=>e[1]));n.forEach(e=>{e.firstCompactNode=n[0],e.firstCompact?e.flexCompactDim=[i+t.compactMarginPair(e),s-t.compactMarginBetween(e)]:e.flexCompactDim=[0,0]}),e.flexCompactDim=null}})}calculateCompactFlexPositions(e){const t=this.getChartState();e.eachBefore(e=>{if(e.children){const n=e.children.filter(e=>e.flexCompactDim),r=n[0];if(!r)return;n.forEach((e,n,a)=>{0==n&&(r.x-=r.flexCompactDim[0]/2),n&n%2-1?e.x=r.x+.25*r.flexCompactDim[0]-t.compactMarginPair(e)/4:n&&(e.x=r.x+.75*r.flexCompactDim[0]+t.compactMarginPair(e)/4)});const a=r.x+.5*r.flexCompactDim[0];r.x=r.x+.25*r.flexCompactDim[0]-t.compactMarginPair(r)/4;const i=e.x-a;Math.abs(i)<10&&n.forEach(e=>e.x+=i);const o=this.groupBy(n,e=>e.row,e=>Rp.max(e,e=>t.layoutBindings[t.layout].compactDimension.sizeRow(e))),s=Rp.cumsum(o.map(e=>e[1]+t.compactMarginBetween(e)));n.forEach((e,t)=>{e.row?e.y=r.y+s[e.row-1]:e.y=r.y})}})}update({x0:e,y0:t,x:n=0,y:r=0,width:a,height:i}){const o=this.getChartState();o.calc,o.compact&&this.calculateCompactFlexDimensions(o.root);const s=o.flexTreeLayout(o.root);o.compact&&this.calculateCompactFlexPositions(o.root);const l=s.descendants(),c=s.descendants().slice(1);l.forEach(o.layoutBindings[o.layout].swap);const d=o.connections,u={};o.allNodes.forEach(e=>u[o.nodeId(e.data)]=e);const f={};l.forEach(e=>f[o.nodeId(e.data)]=e),d.forEach(e=>{const t=u[e.from],n=u[e.to];e._source=t,e._target=n});const p=d.filter(e=>f[e.from]&&f[e.to]),h=o.defs.bind(this)(o,p);h!==o.defsWrapper.html()&&o.defsWrapper.html(h);const m=o.linksWrapper.selectAll("path.link").data(c,e=>o.nodeId(e.data)),g=m.enter().insert("path","g").attr("class","link").attr("d",n=>{const r={x:o.layoutBindings[o.layout].linkJoinX({x:e,y:t,width:a,height:i}),y:o.layoutBindings[o.layout].linkJoinY({x:e,y:t,width:a,height:i})};return o.layoutBindings[o.layout].diagonal(r,r,r)}).merge(m);g.attr("fill","none"),this.isEdge()?g.style("display",e=>e.data._pagingButton?"none":"auto"):g.attr("display",e=>e.data._pagingButton?"none":"auto"),g.each(o.linkUpdate),g.transition().duration(o.duration).attr("d",e=>{const t=o.compact&&e.flexCompactDim?{x:o.layoutBindings[o.layout].compactLinkMidX(e,o),y:o.layoutBindings[o.layout].compactLinkMidY(e,o)}:{x:o.layoutBindings[o.layout].linkX(e),y:o.layoutBindings[o.layout].linkY(e)},n={x:o.layoutBindings[o.layout].linkParentX(e),y:o.layoutBindings[o.layout].linkParentY(e)},r=o.compact&&e.flexCompactDim?{x:o.layoutBindings[o.layout].linkCompactXStart(e),y:o.layoutBindings[o.layout].linkCompactYStart(e)}:t;return o.layoutBindings[o.layout].diagonal(t,n,r,{sy:o.linkYOffset})}),m.exit().transition().duration(o.duration).attr("d",e=>{const t={x:o.layoutBindings[o.layout].linkJoinX({x:n,y:r,width:a,height:i}),y:o.layoutBindings[o.layout].linkJoinY({x:n,y:r,width:a,height:i})};return o.layoutBindings[o.layout].diagonal(t,t,null,{sy:o.linkYOffset})}).remove();const v=o.connectionsWrapper.selectAll("path.connection").data(p),b=v.enter().insert("path","g").attr("class","connection").attr("d",n=>{const r={x:o.layoutBindings[o.layout].linkJoinX({x:e,y:t,width:a,height:i}),y:o.layoutBindings[o.layout].linkJoinY({x:e,y:t,width:a,height:i})};return o.layoutBindings[o.layout].diagonal(r,r,null,{sy:o.linkYOffset})}).merge(v);b.attr("fill","none"),b.transition().duration(o.duration).attr("d",e=>{const t=o.layoutBindings[o.layout].linkX({x:e._source.x,y:e._source.y,width:e._source.width,height:e._source.height}),n=o.layoutBindings[o.layout].linkY({x:e._source.x,y:e._source.y,width:e._source.width,height:e._source.height}),r=o.layoutBindings[o.layout].linkJoinX({x:e._target.x,y:e._target.y,width:e._target.width,height:e._target.height}),a=o.layoutBindings[o.layout].linkJoinY({x:e._target.x,y:e._target.y,width:e._target.width,height:e._target.height});return o.linkGroupArc({source:{x:t,y:n},target:{x:r,y:a}})}),b.each(o.connectionsUpdate),v.exit().transition().duration(o.duration).attr("opacity",0).remove();const y=o.nodesWrapper.selectAll("g.node").data(l,({data:e})=>o.nodeId(e)),x=y.enter().append("g").attr("class","node").attr("transform",n=>n==o.root?`translate(${e},${t})`:`translate(${o.layoutBindings[o.layout].nodeJoinX({x:e,y:t,width:a,height:i})},${o.layoutBindings[o.layout].nodeJoinY({x:e,y:t,width:a,height:i})})`).attr("cursor","pointer").on("click.node",(e,t)=>{const{data:n}=t;[...e.srcElement.classList].includes("node-button-foreign-object")||([...e.srcElement.classList].includes("paging-button-wrapper")?this.loadPagingNodes(t):n._pagingButton||o.onNodeClick(t))}).on("keydown.node",(e,t)=>{const{data:n}=t;if("Enter"===e.key||" "===e.key||"Spacebar"===e.key){if([...e.srcElement.classList].includes("node-button-foreign-object"))return;if([...e.srcElement.classList].includes("paging-button-wrapper"))return void this.loadPagingNodes(t);"Enter"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||this.onButtonClick(e,t)}});x.each(o.nodeEnter),x.patternify({tag:"rect",selector:"node-rect",data:e=>[e]});const w=x.merge(y).style("font","12px sans-serif");w.patternify({tag:"foreignObject",selector:"node-foreign-object",data:e=>[e]}).style("overflow","visible").patternify({tag:"xhtml:div",selector:"node-foreign-object-div",data:e=>[e]}),this.restyleForeignObjectElements();const k=x.patternify({tag:"g",selector:"node-button-g",data:e=>[e]}).on("click",(e,t)=>this.onButtonClick(e,t)).on("keydown",(e,t)=>{"Enter"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||this.onButtonClick(e,t)});k.patternify({tag:"rect",selector:"node-button-rect",data:e=>[e]}).attr("opacity",0).attr("pointer-events","all").attr("width",e=>o.nodeButtonWidth(e)).attr("height",e=>o.nodeButtonHeight(e)).attr("x",e=>o.nodeButtonX(e)).attr("y",e=>o.nodeButtonY(e)),k.patternify({tag:"foreignObject",selector:"node-button-foreign-object",data:e=>[e]}).attr("width",e=>o.nodeButtonWidth(e)).attr("height",e=>o.nodeButtonHeight(e)).attr("x",e=>o.nodeButtonX(e)).attr("y",e=>o.nodeButtonY(e)).style("overflow","visible").patternify({tag:"xhtml:div",selector:"node-button-div",data:e=>[e]}).style("pointer-events","none").style("display","flex").style("width","100%").style("height","100%"),w.transition().attr("opacity",0).duration(o.duration).attr("transform",({x:e,y:t,width:n,height:r})=>o.layoutBindings[o.layout].nodeUpdateTransform({x:e,y:t,width:n,height:r})).attr("opacity",1),w.select(".node-rect").attr("width",({width:e})=>e).attr("height",({height:e})=>e).attr("x",({width:e})=>0).attr("y",({height:e})=>0).attr("cursor","pointer").attr("rx",3).attr("fill",o.nodeDefaultBackground),w.select(".node-button-g").attr("transform",({data:e,width:t,height:n})=>`translate(${o.layoutBindings[o.layout].buttonX({width:t,height:n})},${o.layoutBindings[o.layout].buttonY({width:t,height:n})})`).attr("display",({data:e})=>e._directSubordinates>0?null:"none").attr("opacity",({data:e,children:t,_children:n})=>e._pagingButton?0:t||n?1:0),w.select(".node-button-foreign-object .node-button-div").html(e=>o.buttonContent({node:e,state:o})),w.select(".node-button-text").attr("text-anchor","middle").attr("alignment-baseline","middle").attr("font-size",({children:e})=>e?40:26).text(({children:e})=>e?"-":"+").attr("y",this.isEdge()?10:0),w.each(o.nodeUpdate);const _=y.exit();_.each(o.nodeExit);const N=_.data().reduce((e,t)=>e.depth<t.depth?e:t,{depth:1/0});_.attr("opacity",1).transition().duration(o.duration).attr("transform",e=>{let{x:t,y:n,width:r,height:a}=N.parent||{};return`translate(${o.layoutBindings[o.layout].nodeJoinX({x:t,y:n,width:r,height:a})},${o.layoutBindings[o.layout].nodeJoinY({x:t,y:n,width:r,height:a})})`}).on("end",function(){Rp.select(this).remove()}).attr("opacity",0),l.forEach(e=>{e.x0=e.x,e.y0=e.y});const z=o.allNodes.filter(e=>e.data._centered)[0];if(z){let e=[z];z.data._centeredWithDescendants&&(e=o.compact?z.descendants().filter((e,t)=>t<7):z.descendants().filter((e,t,n)=>{const r=Math.round(n.length/2);return n.length%2?t>r-2&&t<r+2-1:t>r-2&&t<r+2})),z.data._centeredWithDescendants=null,z.data._centered=null,this.fit({animate:!0,scale:!1,nodes:e})}}isEdge(){return window.navigator.userAgent.includes("Edge")}hdiagonal(e,t,n,r){return this.getChartState().hdiagonal(e,t,n,r)}diagonal(e,t,n,r){return this.getChartState().diagonal(e,t,n,r)}restyleForeignObjectElements(){const e=this.getChartState();e.svg.selectAll(".node-foreign-object").attr("width",({width:e})=>e).attr("height",({height:e})=>e).attr("x",({width:e})=>0).attr("y",({height:e})=>0),e.svg.selectAll(".node-foreign-object-div").style("width",({width:e})=>`${e}px`).style("height",({height:e})=>`${e}px`).html(function(t,n,r){return t.data._pagingButton?`<div class="paging-button-wrapper"><div style="pointer-events:none">${e.pagingButton(t,n,r,e)}</div></div>`:e.nodeContent.bind(this)(t,n,r,e)})}onButtonClick(e,t){const n=this.getChartState();t.data._pagingButton||(n.setActiveNodeCentered&&(t.data._centered=!0,t.data._centeredWithDescendants=!0),t.children?(t._children=t.children,t.children=null,this.setExpansionFlagToChildren(t,!1)):(t.children=t._children,t._children=null,t.children&&t.children.forEach(({data:e})=>e._expanded=!0)),this.update(t),e.stopPropagation(),n.onExpandOrCollapse(t))}setExpansionFlagToChildren({data:e,children:t,_children:n},r){e._expanded=r,t&&t.forEach(e=>{this.setExpansionFlagToChildren(e,r)}),n&&n.forEach(e=>{this.setExpansionFlagToChildren(e,r)})}expandSomeNodes(e){if(e.data._expanded){let t=e.parent;for(;t&&t._children;)t.children=t._children,t._children=null,t=t.parent}e._children&&e._children.forEach(e=>this.expandSomeNodes(e)),e.children&&e.children.forEach(e=>this.expandSomeNodes(e))}updateNodesState(){const e=this.getChartState();this.setLayouts({expandNodesFirst:!0}),this.update(e.root)}setLayouts({expandNodesFirst:e=!0}){const t=this.getChartState();t.generateRoot=Rp.stratify().id(e=>t.nodeId(e)).parentId(e=>t.parentNodeId(e)),t.root=t.generateRoot(t.data);const n=t.root.descendants();t.initialExpandLevel>1&&n.length>0&&(n.forEach(e=>{e.depth<=t.initialExpandLevel&&(e.data._expanded=!0)}),t.initialExpandLevel=1);const r={};t.root.descendants().filter(e=>e.children).filter(e=>!e.data._pagingStep).forEach(e=>{e.data._pagingStep=t.minPagingVisibleNodes(e)}),t.root.eachBefore((e,t)=>{e.data._directSubordinatesPaging=e.children?e.children.length:0,e.children&&e.children.forEach((t,n)=>{if(t.data._pagingButton=!1,n>e.data._pagingStep&&(r[t.id]=!0),n===e.data._pagingStep&&e.children.length-1>e.data._pagingStep&&(t.data._pagingButton=!0),r[t.parent.id]&&(r[t.id]=!0),t.data._expanded||t.data._centered||t.data._highlighted||t.data._upToTheRootHighlighted){let e=t;for(;e&&(r[e.id]||e.data._pagingButton);)r[e.id]=!1,e.data._pagingButton&&(e.data._pagingButton=!1,e.parent.children.forEach(e=>{e.data._expanded=!0,r[e.id]=!1})),e=e.parent}})}),t.root=Rp.stratify().id(e=>t.nodeId(e)).parentId(e=>t.parentNodeId(e))(t.data.filter(e=>!0!==r[e.id])),t.root.each((e,n,r)=>{let a=e._hierarchyHeight||e.height,i=t.nodeWidth(e),o=t.nodeHeight(e);Object.assign(e,{width:i,height:o,_hierarchyHeight:a})}),t.root.x0=0,t.root.y0=0,t.allNodes=t.root.descendants(),t.allNodes.forEach(e=>{Object.assign(e.data,{_directSubordinates:e.children?e.children.length:0,_totalSubordinates:e.descendants().length-1})}),t.root.children&&(e&&t.root.children.forEach(this.expand),t.root.children.forEach(e=>this.collapse(e)),0==t.initialExpandLevel&&(t.root._children=t.root.children,t.root.children=null),[t.root].forEach(e=>this.expandSomeNodes(e)))}collapse(e){e.children&&(e._children=e.children,e._children.forEach(e=>this.collapse(e)),e.children=null)}expand(e){e._children&&(e.children=e._children,e.children.forEach(e=>this.expand(e)),e._children=null)}zoomed(e,t){const n=this.getChartState(),r=n.chart,a=e.transform;n.lastTransform=a,r.attr("transform",a),this.isEdge()&&this.restyleForeignObjectElements()}zoomTreeBounds({x0:e,x1:t,y0:n,y1:r,params:a={animate:!0,scale:!0,onCompleted:()=>{}}}){const{centerG:i,svgWidth:o,svgHeight:s,svg:l,zoomBehavior:c,duration:d,lastTransform:u}=this.getChartState();let f=Math.min(8,.9/Math.max((t-e)/o,(r-n)/s)),p=Rp.zoomIdentity.translate(o/2,s/2);p=p.scale(a.scale?f:u.k),p=p.translate(-(e+t)/2,-(n+r)/2),l.transition().duration(a.animate?d:0).call(c.transform,p),i.transition().duration(a.animate?d:0).attr("transform","translate(0,0)").on("end",function(){a.onCompleted&&a.onCompleted()})}fit({animate:e=!0,nodes:t,scale:n=!0,onCompleted:r=()=>{}}={}){const a=this.getChartState(),{root:i}=a;let o=t||i.descendants();const s=Rp.min(o,e=>e.x+a.layoutBindings[a.layout].nodeLeftX(e)),l=Rp.max(o,e=>e.x+a.layoutBindings[a.layout].nodeRightX(e)),c=Rp.min(o,e=>e.y+a.layoutBindings[a.layout].nodeTopY(e)),d=Rp.max(o,e=>e.y+a.layoutBindings[a.layout].nodeBottomY(e));return this.zoomTreeBounds({params:{animate:e,scale:n,onCompleted:r},x0:s-50,x1:l+50,y0:c-50,y1:d+50}),this}loadPagingNodes(e){const t=this.getChartState();e.data._pagingButton=!1;const n=e.parent.data._pagingStep+t.pagingStep(e.parent);e.parent.data._pagingStep=n,this.updateNodesState()}setExpanded(e,t=!0){const n=this.getChartState(),r=n.allNodes.filter(({data:t})=>n.nodeId(t)==e)[0];if(!r)return this;if(r.data._expanded=t,0==t){const e=r.parent||{descendants:()=>[]};e.descendants().filter(t=>t!=e).forEach(e=>e.data._expanded=!1)}return this}setCentered(e){const t=this.getChartState(),n=t.generateRoot(t.data).descendants().filter(({data:n})=>t.nodeId(n).toString()==e.toString())[0];return n?(n.ancestors().forEach(e=>e.data._expanded=!0),n.data._centered=!0,n.data._expanded=!0,this):this}setHighlighted(e){const t=this.getChartState(),n=t.generateRoot(t.data).descendants().filter(n=>t.nodeId(n.data).toString()===e.toString())[0];return n?(n.ancestors().forEach(e=>e.data._expanded=!0),n.data._highlighted=!0,n.data._expanded=!0,n.data._centered=!0,this):this}setUpToTheRootHighlighted(e){const t=this.getChartState(),n=t.generateRoot(t.data).descendants().filter(n=>t.nodeId(n.data).toString()===e.toString())[0];return n?(n.ancestors().forEach(e=>e.data._expanded=!0),n.data._upToTheRootHighlighted=!0,n.data._expanded=!0,n.ancestors().forEach(e=>e.data._upToTheRootHighlighted=!0),this):this}clearHighlighting(){const e=this.getChartState();return e.allNodes.forEach(e=>{e.data._highlighted=!1,e.data._upToTheRootHighlighted=!1}),this.update(e.root),this}fullscreen(e){const t=this.getChartState(),n=Rp.select(e||t.container).node();Rp.select(document).on("fullscreenchange."+t.id,function(e){(document.fullscreenElement||document.mozFullscreenElement||document.webkitFullscreenElement)==n?setTimeout(e=>{t.svg.attr("height",window.innerHeight-40)},500):t.svg.attr("height",t.svgHeight)}),n.requestFullscreen?n.requestFullscreen():n.mozRequestFullScreen?n.mozRequestFullScreen():n.webkitRequestFullscreen?n.webkitRequestFullscreen():n.msRequestFullscreen&&n.msRequestFullscreen()}zoomIn(){const{svg:e,zoomBehavior:t}=this.getChartState();e.transition().call(t.scaleBy,1.3)}zoomOut(){const{svg:e,zoomBehavior:t}=this.getChartState();e.transition().call(t.scaleBy,.78)}toDataURL(e,t){var n=new XMLHttpRequest;n.onload=function(){var e=new FileReader;e.onloadend=function(){t(e.result)},e.readAsDataURL(n.response)},n.open("GET",e),n.responseType="blob",n.send()}exportImg({full:e=!1,scale:t=3,onLoad:n=e=>e,save:r=!0,backgroundColor:a="#FAFAFA"}={}){const i=this,o=this.getChartState(),{svg:s,root:l}=o;let c=0;const d=s.selectAll("img");let u=d.size();const f=()=>{JSON.parse(JSON.stringify(i.lastTransform()));const s=i.duration();e&&i.fit();const{svg:c}=i.getChartState();setTimeout(e=>{i.downloadImage({node:c.node(),scale:t,isSvg:!1,backgroundColor:a,onAlreadySerialized:e=>{i.update(l)},imageName:o.imageName,onLoad:n,save:r})},e?s+10:0)};u>0?d.each(function(){i.toDataURL(this.src,e=>{this.src=e,++c==u&&f()})}):f()}exportSvg(){const{svg:e,imageName:t}=this.getChartState();return this.downloadImage({imageName:t,node:e.node(),scale:3,isSvg:!0}),this}expandAll(){const{allNodes:e,root:t,data:n}=this.getChartState();return n.forEach(e=>e._expanded=!0),this.render(),this}collapseAll(){const{allNodes:e,root:t}=this.getChartState();return e.forEach(e=>e.data._expanded=!1),this.initialExpandLevel(0),this.render(),this}downloadImage({node:e,scale:t=2,imageName:n="graph",isSvg:r=!1,save:a=!0,backgroundColor:i="#FAFAFA",onAlreadySerialized:o=e=>{},onLoad:s=e=>{}}){const l=e;function c(e,t){var n=document.createElement("a");"string"==typeof n.download?(document.body.appendChild(n),n.download=t,n.href=e,n.click(),document.body.removeChild(n)):location.replace(e)}function d(e){const t="http://www.w3.org/2000/xmlns/";e=e.cloneNode(!0);const n=window.location.href+"#",r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,null,!1);for(;r.nextNode();)for(const e of r.currentNode.attributes)e.value.includes(n)&&(e.value=e.value.replace(n,"#"));return e.setAttributeNS(t,"xmlns","http://www.w3.org/2000/svg"),e.setAttributeNS(t,"xmlns:xlink","http://www.w3.org/1999/xlink"),(new XMLSerializer).serializeToString(e)}if(r){let e=d(l);return e='<?xml version="1.0" standalone="no"?>\r\n'+e,c(p="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(e),n+".svg"),void o()}const u=t,f=document.createElement("img");f.onload=function(){const e=document.createElement("canvas"),t=l.getBoundingClientRect();e.width=t.width*u,e.height=t.height*u;const r=e.getContext("2d");r.fillStyle=i,r.fillRect(0,0,t.width*u,t.height*u),r.drawImage(f,0,0,t.width*u,t.height*u);let o=e.toDataURL("image/png");s&&s(o),a&&c(o,n+".png")};var p="data:image/svg+xml; charset=utf8, "+encodeURIComponent(d(l));o(),f.src=p}getTextWidth(e,{fontSize:t=14,fontWeight:n=400,defaultFont:r="Helvetice",ctx:a}={}){return a.font=`${n||""} ${t}px ${r} `,a.measureText(e).width}clear(){const e=this.getChartState();Rp.select(window).on(`resize.${e.id}`,null),e.svg&&e.svg.selectAll("*").remove()}},Op="var(--border-color-primary)",Lp="var(--border-color-danger)",Ap="color-mix(in srgb, var(--background-color-default) 86%, var(--text-color-white) 14%)",Bp="var(--border-color-default)",Pp="var(--text-color-default)",Ip="var(--text-color-caption)",Vp="var(--background-color-primary-inverted)",Dp="var(--border-color-primary)",Hp="var(--text-color-primary)",Xp="var(--text-color-primary)",Fp="var(--background-color-primary)",Wp="var(--border-color-primary)",Yp="var(--text-color-white)",qp=e=>e?e.replace(/_/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\s+/g," ").trim():"—",Up=e=>{const t=qp(e);return"—"===t||"not applicable"===t.toLowerCase()?null:t},Gp=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),Kp=e=>(e=>"entityName"in e)(e)?{id:e.id,parentId:e.parent?.id??null,name:e.entityName,position:e.entityType??"Entity",countryCode:e.country?.country_code??null,countryName:e.country?.name??null,entityType:e.entityType??null,role:e.role??null,revenue:e.revenue??null,revenueShare:e.revenueAllocPct??null,securityPosition:e.securityPosition??null}:{...e,countryName:e.countryName??e.location??e.position,entityType:e.entityType??e.position,role:e.role??null,securityPosition:e.securityPosition??"Secured"},Zp=(e,t,n)=>{const r="Borrower"===Up(e.role),a="Unsecured"===e.securityPosition,i=(o=e.countryCode)&&2===o.length?`https://flagcdn.com/24x18/${o.toLowerCase()}.png`:null;var o;const s=void 0!==e.revenue?"Revenue":"Headcount",l=void 0!==e.revenue?(e=>{if(null==e)return"-";if(e>=1e6){const t=e/1e6;return`$${new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(t).replace(/\.0+$/,"").replace(/(\.\d*[1-9])0+$/,"$1")} M`}return`$${new Intl.NumberFormat("en-US").format(e)}`})(e.revenue):e.headcount||"-",c=void 0!==e.revenue?null==(d=e.revenueShare)?null:`${Math.round(100*d)}% of group`:null;var d;const u=(e=>{const t=[],n=e.entityType?qp(e.entityType):e.position,r=Up(e.role);return n&&"—"!==n&&t.push(n),r&&"Borrower"!==r&&t.push(r),!t.length&&e.companyCode&&t.push(e.companyCode),t})(e),f=e.countryName??e.location??e.position;return`\n <div style="\n box-sizing: border-box;\n position: absolute;\n width: ${t}px;\n height: ${n}px;\n border-radius: 16px;\n border: 2px ${a?"dashed":"solid"} ${a?Lp:Op};\n background: ${Ap};\n font-family: var(--font-body);\n color: ${Pp};\n padding: 20px;\n overflow: visible;\n ">\n ${r?`<div style="\n position: absolute;\n top: -20px;\n right: 24px;\n border: 2px solid ${Dp};\n border-radius: 999px;\n background: ${Vp};\n padding: 8px 16px;\n color: ${Hp};\n font-size: 14px;\n font-weight: 700;\n line-height: 1;\n text-transform: uppercase;\n ">BORROWER</div>`:""}\n <div style="font-size: 18px; font-weight: 700; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;" title="${Gp(e.name)}">${Gp(e.name)}</div>\n <div style="display:flex; align-items:center; gap:10px; margin-top:16px; font-size:14px; line-height:20px; color:${Pp}; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">\n ${i?`<img src="${i}" alt="" width="24" height="18" style="display:block; border-radius:2px; flex:0 0 auto;" />`:""}\n <span style="overflow:hidden; text-overflow:ellipsis;">${Gp(f)}</span>\n </div>\n <div style="margin-top:20px; font-size:16px; line-height:24px; color:${Ip}; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">\n ${s}: <span style="font-weight:700; color:${Pp};">${Gp(l)}</span>\n ${c?`<span> (${Gp(c)})</span>`:""}\n </div>\n <div style="height:1px; margin:18px 0 16px; background:${Bp};"></div>\n <div style="display:flex; flex-wrap:wrap; gap:8px;">\n ${u.map(e=>`<span style="\n display:inline-flex;\n align-items:center;\n width:fit-content;\n max-width:100%;\n padding:6px 12px;\n border:2px solid ${Dp};\n border-radius:999px;\n background:${Vp};\n color:${Hp};\n font-size:13px;\n font-weight:700;\n line-height:1.2;\n white-space:normal;\n overflow-wrap:anywhere;\n text-align:center;\n " title="${Gp(e)}">${Gp(e)}</span>`).join("")}\n </div>\n </div>\n `},Jp=[{label:"Secured Entity",indicatorClassName:"border-primary"},{label:"Unsecured Entity",indicatorClassName:"border-danger border-dashed"}],Qp=(0,Ve.forwardRef)(function({data:e,orientation:t,onOrientationChange:n,initialDepth:r=1,imageName:a="organization-chart",onNodeClick:i,onZoomChange:o,className:s,emptyMessage:l="No organization chart data available.",showZoomBadge:c=!0,dataTestId:d,...u},f){const p=(0,Ve.useRef)(null),h=(0,Ve.useRef)(null),m=(0,Ve.useRef)(null),g=(0,Ve.useRef)(null),[v,b]=(0,Ve.useState)(t??"top"),[y,x]=(0,Ve.useState)({width:0,height:0}),w=(0,Ve.useMemo)(()=>e.map(Kp),[e]),k=t??v,_=(0,Ve.useCallback)(e=>{void 0===t&&b(e),n?.(e)},[t,n]);return(0,Ve.useImperativeHandle)(f,()=>({zoomIn:()=>m.current?.zoomIn(),zoomOut:()=>m.current?.zoomOut(),resetZoom:()=>{m.current?.render().fit()},resetLevel:()=>{m.current?.collapseAll().initialExpandLevel(r).render().fit()},resetOrientation:()=>{_("top")},exportImg:()=>m.current?.exportImg({full:!0}),exportSvg:()=>{m.current&&(m.current.render().fit(),window.setTimeout(()=>{m.current?.exportSvg()},1e3))},expandAll:()=>{m.current?.expandAll().fit()},collapseAll:()=>{m.current?.collapseAll().fit()}}),[_,r]),(0,Ve.useLayoutEffect)(()=>{const e=p.current,t=h.current;if(!t||!e||0===w.length)return;t.replaceChildren();const n=new Tp;return m.current=n,n.container(t).data(w).layout(k).imageName(a).initialExpandLevel(r).svgHeight(Math.max(e.clientHeight,720)).nodeWidth(()=>445).nodeHeight(()=>215).childrenMargin(()=>64).siblingsMargin(()=>80).neighbourMargin(()=>96).compact(!1).buttonContent(({node:e})=>(e=>{const t=e.data._directSubordinates??0,n=Boolean(e.children);return`\n <div style="\n display:flex;\n align-items:center;\n justify-content:center;\n min-width:32px;\n height:32px;\n margin:auto;\n border:2px solid ${n?Dp:Wp};\n border-radius:999px;\n background:${n?Vp:Fp};\n color:${n?Xp:Yp};\n font-family:var(--font-body);\n font-size:13px;\n font-weight:700;\n line-height:1;\n box-sizing:border-box;\n padding:0 10px;\n ">${t}</div>\n `})(e)).nodeButtonWidth(()=>44).nodeButtonHeight(()=>32).nodeUpdate((e,t,n)=>{const r=n[t],a=r.querySelector(".node-button-g"),i=r.querySelector(".node-button-circle"),o=r.querySelector(".node-button-text");a?.setAttribute("display",""),i&&(i.setAttribute("fill","transparent"),i.setAttribute("stroke","transparent")),o&&o.setAttribute("display","none")}).linkUpdate((e,t,n)=>{const r=n[t];r.setAttribute("stroke","var(--border-color-default)"),r.setAttribute("stroke-width","2"),r.setAttribute("fill","none")}).onZoom(e=>{const t=Math.round(100*(e.transform?.k??1));g.current&&(g.current.textContent=`Zoom: ${t}%`),o?.(t)}).onNodeClick(e=>{e?.id&&i?.(String(e.id))}).nodeContent(e=>Zp(e.data,445,215)).render().fit(),()=>{n.clear(),m.current===n&&(m.current=null),t.replaceChildren()}},[a,r,w,i,o,k]),(0,Ve.useLayoutEffect)(()=>{const e=p.current;if(!e||0===w.length)return;const t=()=>{x({width:e.clientWidth,height:e.clientHeight})};t();const n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[w.length]),(0,Ve.useLayoutEffect)(()=>{m.current&&y.width&&y.height&&0!==w.length&&m.current.render().fit()},[y.height,y.width,w.length]),0===w.length?/* @__PURE__ */ /* @__PURE__ */(0,ft.jsx)("div",{...u,"data-test-id":d,ref:p,className:$e("flex h-full min-h-60 w-full min-w-0 items-center justify-center rounded-md bg-primary p-6 text-base text-caption",s),children:l}):/* @__PURE__ */ /* @__PURE__ */(0,ft.jsxs)("div",{...u,"data-test-id":d,ref:p,className:$e("relative h-full w-full min-h-0 min-w-0 overflow-hidden rounded-md bg-default",s),children:[
133
+ return(0,ft.jsxs)("div",{...u,role:l,"aria-label":g,className:$e(Jl({size:t}),s),children:[h.map((e,a)=>/* @__PURE__ */ /* @__PURE__ */(0,ft.jsx)(xn,{...e,variant:n,size:t,shape:r,inverted:i,stroke:o},e.id??a)),m>0&&/* @__PURE__ */ /* @__PURE__ */(0,ft.jsxs)("span",{"aria-hidden":"true",className:Ql({size:t,shape:r,variant:n}),children:["+",m]})]})},tc={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function nc(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),tc.hasOwnProperty(t)?{space:tc[t],local:e}:e}function rc(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return"http://www.w3.org/1999/xhtml"===n&&"http://www.w3.org/1999/xhtml"===t.documentElement.namespaceURI?t.createElement(e):t.createElementNS(n,e)}}function ac(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ic(e){var t=nc(e);return(t.local?ac:rc)(t)}function oc(){}function sc(e){return null==e?oc:function(){return this.querySelector(e)}}function lc(){return[]}function cc(e){return null==e?lc:function(){return this.querySelectorAll(e)}}function dc(e){return function(){return function(e){return null==e?[]:Array.isArray(e)?e:Array.from(e)}(e.apply(this,arguments))}}function uc(e){return function(){return this.matches(e)}}function fc(e){return function(t){return t.matches(e)}}var pc=Array.prototype.find;function hc(){return this.firstElementChild}var mc=Array.prototype.filter;function gc(){return Array.from(this.children)}function vc(e){return new Array(e.length)}function bc(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function yc(e,t,n,r,a,i){for(var o,s=0,l=t.length,c=i.length;s<c;++s)(o=t[s])?(o.__data__=i[s],r[s]=o):n[s]=new bc(e,i[s]);for(;s<l;++s)(o=t[s])&&(a[s]=o)}function xc(e,t,n,r,a,i,o){var s,l,c,d=/* @__PURE__ */new Map,u=t.length,f=i.length,p=new Array(u);for(s=0;s<u;++s)(l=t[s])&&(p[s]=c=o.call(l,l.__data__,s,t)+"",d.has(c)?a[s]=l:d.set(c,l));for(s=0;s<f;++s)c=o.call(e,i[s],s,i)+"",(l=d.get(c))?(r[s]=l,l.__data__=i[s],d.delete(c)):n[s]=new bc(e,i[s]);for(s=0;s<u;++s)(l=t[s])&&d.get(p[s])===l&&(a[s]=l)}function wc(e){return e.__data__}function kc(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function _c(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Nc(e){return function(){this.removeAttribute(e)}}function zc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Cc(e,t){return function(){this.setAttribute(e,t)}}function Ec(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Sc(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function jc(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 $c(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Mc(e){return function(){this.style.removeProperty(e)}}function Rc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Tc(e,t,n){return function(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Oc(e,t){return e.style.getPropertyValue(t)||$c(e).getComputedStyle(e,null).getPropertyValue(t)}function Lc(e){return function(){delete this[e]}}function Ac(e,t){return function(){this[e]=t}}function Bc(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function Pc(e){return e.trim().split(/^|\s+/)}function Ic(e){return e.classList||new Vc(e)}function Vc(e){this._node=e,this._names=Pc(e.getAttribute("class")||"")}function Dc(e,t){for(var n=Ic(e),r=-1,a=t.length;++r<a;)n.add(t[r])}function Hc(e,t){for(var n=Ic(e),r=-1,a=t.length;++r<a;)n.remove(t[r])}function Xc(e){return function(){Dc(this,e)}}function Fc(e){return function(){Hc(this,e)}}function Wc(e,t){return function(){(t.apply(this,arguments)?Dc:Hc)(this,e)}}function Yc(){this.textContent=""}function qc(e){return function(){this.textContent=e}}function Uc(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function Gc(){this.innerHTML=""}function Kc(e){return function(){this.innerHTML=e}}function Zc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function Jc(){this.nextSibling&&this.parentNode.appendChild(this)}function Qc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ed(){return null}function td(){var e=this.parentNode;e&&e.removeChild(this)}function nd(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function rd(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ad(e){return function(){var t=this.__on;if(t){for(var n,r=0,a=-1,i=t.length;r<i;++r)n=t[r],e.type&&n.type!==e.type||n.name!==e.name?t[++a]=n:this.removeEventListener(n.type,n.listener,n.options);++a?t.length=a:delete this.__on}}}function id(e,t,n){return function(){var r,a=this.__on,i=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(a)for(var o=0,s=a.length;o<s;++o)if((r=a[o]).type===e.type&&r.name===e.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),void(r.value=t);this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},a?a.push(r):this.__on=[r]}}function od(e,t,n){var r=$c(e),a=r.CustomEvent;"function"==typeof a?a=new a(t,n):(a=r.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function sd(e,t){return function(){return od(this,e,t)}}function ld(e,t){return function(){return od(this,e,t.apply(this,arguments))}}bc.prototype={constructor:bc,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)}},Vc.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 cd=[null];function dd(e,t){this._groups=e,this._parents=t}function ud(){return new dd([[document.documentElement]],cd)}function fd(e){return"string"==typeof e?new dd([[document.querySelector(e)]],[document.documentElement]):new dd([[e]],cd)}function pd(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 r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}function hd(e){var t=0,n=e.children,r=n&&n.length;if(r)for(;--r>=0;)t+=n[r].value;else t=1;e.value=t}function md(e,t){e instanceof Map?(e=[void 0,e],void 0===t&&(t=vd)):void 0===t&&(t=gd);for(var n,r,a,i,o,s=new xd(e),l=[s];n=l.pop();)if((a=t(n.data))&&(o=(a=Array.from(a)).length))for(n.children=a,i=o-1;i>=0;--i)l.push(r=a[i]=new xd(a[i])),r.parent=n,r.depth=n.depth+1;return s.eachBefore(yd)}function gd(e){return e.children}function vd(e){return Array.isArray(e)?e[1]:null}function bd(e){void 0!==e.data.value&&(e.value=e.data.value),e.data=e.data.data}function yd(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function xd(e){this.data=e,this.depth=this.height=0,this.parent=null}function wd(e){return null==e?null:function(e){if("function"!=typeof e)throw new Error;return e}(e)}dd.prototype=ud.prototype={constructor:dd,select:function(e){"function"!=typeof e&&(e=sc(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var i,o,s=t[a],l=s.length,c=r[a]=new Array(l),d=0;d<l;++d)(i=s[d])&&(o=e.call(i,i.__data__,d,s))&&("__data__"in i&&(o.__data__=i.__data__),c[d]=o);return new dd(r,this._parents)},selectAll:function(e){e="function"==typeof e?dc(e):cc(e);for(var t=this._groups,n=t.length,r=[],a=[],i=0;i<n;++i)for(var o,s=t[i],l=s.length,c=0;c<l;++c)(o=s[c])&&(r.push(e.call(o,o.__data__,c,s)),a.push(o));return new dd(r,a)},selectChild:function(e){return this.select(null==e?hc:function(e){return function(){return pc.call(this.children,e)}}("function"==typeof e?e:fc(e)))},selectChildren:function(e){return this.selectAll(null==e?gc:function(e){return function(){return mc.call(this.children,e)}}("function"==typeof e?e:fc(e)))},filter:function(e){"function"!=typeof e&&(e=uc(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var i,o=t[a],s=o.length,l=r[a]=[],c=0;c<s;++c)(i=o[c])&&e.call(i,i.__data__,c,o)&&l.push(i);return new dd(r,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,wc);var n=t?xc:yc,r=this._parents,a=this._groups;"function"!=typeof e&&(e=function(e){return function(){return e}}(e));for(var i=a.length,o=new Array(i),s=new Array(i),l=new Array(i),c=0;c<i;++c){var d=r[c],u=a[c],f=u.length,p=kc(e.call(d,d&&d.__data__,c,r)),h=p.length,m=s[c]=new Array(h),g=o[c]=new Array(h);n(d,u,m,g,l[c]=new Array(f),p,t);for(var v,b,y=0,x=0;y<h;++y)if(v=m[y]){for(y>=x&&(x=y+1);!(b=g[x])&&++x<h;);v._next=b||null}}return(o=new dd(o,r))._enter=s,o._exit=l,o},enter:function(){return new dd(this._enter||this._groups.map(vc),this._parents)},exit:function(){return new dd(this._exit||this._groups.map(vc),this._parents)},join:function(e,t,n){var r=this.enter(),a=this,i=this.exit();return"function"==typeof e?(r=e(r))&&(r=r.selection()):r=r.append(e+""),null!=t&&(a=t(a))&&(a=a.selection()),null==n?i.remove():n(i),r&&a?r.merge(a).order():a},merge:function(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,a=n.length,i=r.length,o=Math.min(a,i),s=new Array(a),l=0;l<o;++l)for(var c,d=n[l],u=r[l],f=d.length,p=s[l]=new Array(f),h=0;h<f;++h)(c=d[h]||u[h])&&(p[h]=c);for(;l<a;++l)s[l]=n[l];return new dd(s,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r,a=e[t],i=a.length-1,o=a[i];--i>=0;)(r=a[i])&&(o&&4^r.compareDocumentPosition(o)&&o.parentNode.insertBefore(r,o),o=r);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=_c);for(var n=this._groups,r=n.length,a=new Array(r),i=0;i<r;++i){for(var o,s=n[i],l=s.length,c=a[i]=new Array(l),d=0;d<l;++d)(o=s[d])&&(c[d]=o);c.sort(t)}return new dd(a,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 r=e[t],a=0,i=r.length;a<i;++a){var o=r[a];if(o)return o}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,r=t.length;n<r;++n)for(var a,i=t[n],o=0,s=i.length;o<s;++o)(a=i[o])&&e.call(a,a.__data__,o,i);return this},attr:function(e,t){var n=nc(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==t?n.local?zc:Nc:"function"==typeof t?n.local?jc:Sc:n.local?Ec:Cc)(n,t))},style:function(e,t,n){return arguments.length>1?this.each((null==t?Mc:"function"==typeof t?Tc:Rc)(e,t,null==n?"":n)):Oc(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?Lc:"function"==typeof t?Bc:Ac)(e,t)):this.node()[e]},classed:function(e,t){var n=Pc(e+"");if(arguments.length<2){for(var r=Ic(this.node()),a=-1,i=n.length;++a<i;)if(!r.contains(n[a]))return!1;return!0}return this.each(("function"==typeof t?Wc:t?Xc:Fc)(n,t))},text:function(e){return arguments.length?this.each(null==e?Yc:("function"==typeof e?Uc:qc)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?Gc:("function"==typeof e?Zc:Kc)(e)):this.node().innerHTML},raise:function(){return this.each(Jc)},lower:function(){return this.each(Qc)},append:function(e){var t="function"==typeof e?e:ic(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var n="function"==typeof e?e:ic(e),r=null==t?ed:"function"==typeof t?t:sc(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(td)},clone:function(e){return this.select(e?rd:nd)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,n){var r,a,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+""),o=i.length;if(!(arguments.length<2)){for(s=t?id:ad,r=0;r<o;++r)this.each(s(i[r],t,n));return this}var s=this.node().__on;if(s)for(var l,c=0,d=s.length;c<d;++c)for(r=0,l=s[c];r<o;++r)if((a=i[r]).type===l.type&&a.name===l.name)return l.value},dispatch:function(e,t){return this.each(("function"==typeof t?ld:sd)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r,a=e[t],i=0,o=a.length;i<o;++i)(r=a[i])&&(yield r)}},xd.prototype=md.prototype={constructor:xd,count:function(){return this.eachAfter(hd)},each:function(e,t){let n=-1;for(const r of this)e.call(t,r,++n,this);return this},eachAfter:function(e,t){for(var n,r,a,i=this,o=[i],s=[],l=-1;i=o.pop();)if(s.push(i),n=i.children)for(r=0,a=n.length;r<a;++r)o.push(n[r]);for(;i=s.pop();)e.call(t,i,++l,this);return this},eachBefore:function(e,t){for(var n,r,a=this,i=[a],o=-1;a=i.pop();)if(e.call(t,a,++o,this),n=a.children)for(r=n.length-1;r>=0;--r)i.push(n[r]);return this},find:function(e,t){let n=-1;for(const r of this)if(e.call(t,r,++n,this))return r},sum:function(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,a=r&&r.length;--a>=0;)n+=r[a].value;t.value=n})},sort:function(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})},path:function(e){for(var t=this,n=function(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),a=null;e=n.pop(),t=r.pop();for(;e===t;)a=e,e=n.pop(),t=r.pop();return a}(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var a=r.length;e!==n;)r.splice(a,0,e),e=e.parent;return r},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){return Array.from(this)},leaves:function(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e},links:function(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t},copy:function(){return md(this).eachBefore(bd)},[Symbol.iterator]:function*(){var e,t,n,r,a=this,i=[a];do{for(e=i.reverse(),i=[];a=e.pop();)if(yield a,t=a.children)for(n=0,r=t.length;n<r;++n)i.push(t[n])}while(i.length)}};var kd={depth:-1},_d={},Nd={};function zd(e){return e.id}function Cd(e){return e.parentId}function Ed(e){let t=e.length;if(t<2)return"";for(;--t>1&&!Sd(e,t););return e.slice(0,t)}function Sd(e,t){if("/"===e[t]){let n=0;for(;t>0&&"\\"===e[--t];)++n;if(!(1&n))return!0}return!1}function jd(e,t){return e.parent===t.parent?1:2}function $d(e){var t=e.children;return t?t[0]:e.t}function Md(e){var t=e.children;return t?t[t.length-1]:e.t}function Rd(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function Td(e,t,n){return e.a.parent===t.parent?e.a:n}function Od(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}Od.prototype=Object.create(xd.prototype);var Ld={value:()=>{}};function Ad(){for(var e,t=0,n=arguments.length,r={};t<n;++t){if(!(e=arguments[t]+"")||e in r||/[\s.]/.test(e))throw new Error("illegal type: "+e);r[e]=[]}return new Bd(r)}function Bd(e){this._=e}function Pd(e,t){for(var n,r=0,a=e.length;r<a;++r)if((n=e[r]).name===t)return n.value}function Id(e,t,n){for(var r=0,a=e.length;r<a;++r)if(e[r].name===t){e[r]=Ld,e=e.slice(0,r).concat(e.slice(r+1));break}return null!=n&&e.push({name:t,value:n}),e}Bd.prototype=Ad.prototype={constructor:Bd,on:function(e,t){var n,r,a=this._,i=(r=a,(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&&!r.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})),o=-1,s=i.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++o<s;)if(n=(e=i[o]).type)a[n]=Id(a[n],e.name,t);else if(null==t)for(n in a)a[n]=Id(a[n],e.name,null);return this}for(;++o<s;)if((n=(e=i[o]).type)&&(n=Pd(a[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Bd(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,r,a=new Array(n),i=0;i<n;++i)a[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,n=(r=this._[e]).length;i<n;++i)r[i].value.apply(t,a)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],a=0,i=r.length;a<i;++a)r[a].value.apply(t,n)}};var Vd={capture:!0,passive:!1};function Dd(e){e.preventDefault(),e.stopImmediatePropagation()}function Hd(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Xd(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Fd(){}var Wd=.7,Yd=1/Wd,qd="\\s*([+-]?\\d+)\\s*",Ud="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Gd="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Kd=/^#([0-9a-f]{3,8})$/,Zd=new RegExp(`^rgb\\(${qd},${qd},${qd}\\)$`),Jd=new RegExp(`^rgb\\(${Gd},${Gd},${Gd}\\)$`),Qd=new RegExp(`^rgba\\(${qd},${qd},${qd},${Ud}\\)$`),eu=new RegExp(`^rgba\\(${Gd},${Gd},${Gd},${Ud}\\)$`),tu=new RegExp(`^hsl\\(${Ud},${Gd},${Gd}\\)$`),nu=new RegExp(`^hsla\\(${Ud},${Gd},${Gd},${Ud}\\)$`),ru={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 au(){return this.rgb().formatHex()}function iu(){return this.rgb().formatRgb()}function ou(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Kd.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?su(t):3===n?new du(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?lu(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?lu(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=Zd.exec(e))?new du(t[1],t[2],t[3],1):(t=Jd.exec(e))?new du(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Qd.exec(e))?lu(t[1],t[2],t[3],t[4]):(t=eu.exec(e))?lu(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=tu.exec(e))?gu(t[1],t[2]/100,t[3]/100,1):(t=nu.exec(e))?gu(t[1],t[2]/100,t[3]/100,t[4]):ru.hasOwnProperty(e)?su(ru[e]):"transparent"===e?new du(NaN,NaN,NaN,0):null}function su(e){return new du(e>>16&255,e>>8&255,255&e,1)}function lu(e,t,n,r){return r<=0&&(e=t=n=NaN),new du(e,t,n,r)}function cu(e,t,n,r){return 1===arguments.length?((a=e)instanceof Fd||(a=ou(a)),a?new du((a=a.rgb()).r,a.g,a.b,a.opacity):new du):new du(e,t,n,null==r?1:r);var a}function du(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function uu(){return`#${mu(this.r)}${mu(this.g)}${mu(this.b)}`}function fu(){const e=pu(this.opacity);return`${1===e?"rgb(":"rgba("}${hu(this.r)}, ${hu(this.g)}, ${hu(this.b)}${1===e?")":`, ${e})`}`}function pu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function hu(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function mu(e){return((e=hu(e))<16?"0":"")+e.toString(16)}function gu(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new bu(e,t,n,r)}function vu(e){if(e instanceof bu)return new bu(e.h,e.s,e.l,e.opacity);if(e instanceof Fd||(e=ou(e)),!e)return new bu;if(e instanceof bu)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,s=i-a,l=(i+a)/2;return s?(o=t===i?(n-r)/s+6*(n<r):n===i?(r-t)/s+2:(t-n)/s+4,s/=l<.5?i+a:2-i-a,o*=60):s=l>0&&l<1?0:o,new bu(o,s,l,e.opacity)}function bu(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function yu(e){return(e=(e||0)%360)<0?e+360:e}function xu(e){return Math.max(0,Math.min(1,e||0))}function wu(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function ku(e,t,n,r,a){var i=e*e,o=i*e;return((1-3*e+3*i-o)*t+(4-6*i+3*o)*n+(1+3*e+3*i-3*o)*r+o*a)/6}Hd(Fd,ou,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:au,formatHex:au,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return vu(this).formatHsl()},formatRgb:iu,toString:iu}),Hd(du,cu,Xd(Fd,{brighter(e){return e=null==e?Yd:Math.pow(Yd,e),new du(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?Wd:Math.pow(Wd,e),new du(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new du(hu(this.r),hu(this.g),hu(this.b),pu(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:uu,formatHex:uu,formatHex8:function(){return`#${mu(this.r)}${mu(this.g)}${mu(this.b)}${mu(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:fu,toString:fu})),Hd(bu,function(e,t,n,r){return 1===arguments.length?vu(e):new bu(e,t,n,null==r?1:r)},Xd(Fd,{brighter(e){return e=null==e?Yd:Math.pow(Yd,e),new bu(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Wd:Math.pow(Wd,e),new bu(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,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new du(wu(e>=240?e-240:e+120,a,r),wu(e,a,r),wu(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new bu(yu(this.h),xu(this.s),xu(this.l),pu(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=pu(this.opacity);return`${1===e?"hsl(":"hsla("}${yu(this.h)}, ${100*xu(this.s)}%, ${100*xu(this.l)}%${1===e?")":`, ${e})`}`}}));var _u=e=>()=>e;function Nu(e){return 1===(e=+e)?zu: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(r){return Math.pow(e+r*t,n)}}(t,n,e):_u(isNaN(t)?n:t)}}function zu(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):_u(isNaN(e)?t:e)}var Cu=function e(t){var n=Nu(t);function r(e,t){var r=n((e=cu(e)).r,(t=cu(t)).r),a=n(e.g,t.g),i=n(e.b,t.b),o=zu(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=a(t),e.b=i(t),e.opacity=o(t),e+""}}return r.gamma=e,r}(1);function Eu(e){return function(t){var n,r,a=t.length,i=new Array(a),o=new Array(a),s=new Array(a);for(n=0;n<a;++n)r=cu(t[n]),i[n]=r.r||0,o[n]=r.g||0,s[n]=r.b||0;return i=e(i),o=e(o),s=e(s),r.opacity=1,function(e){return r.r=i(e),r.g=o(e),r.b=s(e),r+""}}}Eu(function(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),a=e[r],i=e[r+1],o=r>0?e[r-1]:2*a-i,s=r<t-1?e[r+2]:2*i-a;return ku((n-r/t)*t,o,a,i,s)}}),Eu(function(e){var t=e.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*t),a=e[(r+t-1)%t],i=e[r%t],o=e[(r+1)%t],s=e[(r+2)%t];return ku((n-r/t)*t,a,i,o,s)}});function Su(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var ju=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,$u=new RegExp(ju.source,"g");function Mu(e,t){var n,r,a,i=ju.lastIndex=$u.lastIndex=0,o=-1,s=[],l=[];for(e+="",t+="";(n=ju.exec(e))&&(r=$u.exec(t));)(a=r.index)>i&&(a=t.slice(i,a),s[o]?s[o]+=a:s[++o]=a),(n=n[0])===(r=r[0])?s[o]?s[o]+=r:s[++o]=r:(s[++o]=null,l.push({i:o,x:Su(n,r)})),i=$u.lastIndex;return i<t.length&&(a=t.slice(i),s[o]?s[o]+=a:s[++o]=a),s.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,r=0;r<t;++r)s[(n=l[r]).i]=n.x(e);return s.join("")})}var Ru,Tu=180/Math.PI,Ou={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Lu(e,t,n,r,a,i){var o,s,l;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(l=e*n+t*r)&&(n-=e*l,r-=t*l),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,l/=s),e*r<t*n&&(e=-e,t=-t,l=-l,o=-o),{translateX:a,translateY:i,rotate:Math.atan2(t,e)*Tu,skewX:Math.atan(l)*Tu,scaleX:o,scaleY:s}}function Au(e,t,n,r){function a(e){return e.length?e.pop()+" ":""}return function(i,o){var s=[],l=[];return i=e(i),o=e(o),function(e,r,a,i,o,s){if(e!==a||r!==i){var l=o.push("translate(",null,t,null,n);s.push({i:l-4,x:Su(e,a)},{i:l-2,x:Su(r,i)})}else(a||i)&&o.push("translate("+a+t+i+n)}(i.translateX,i.translateY,o.translateX,o.translateY,s,l),function(e,t,n,i){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),i.push({i:n.push(a(n)+"rotate(",null,r)-2,x:Su(e,t)})):t&&n.push(a(n)+"rotate("+t+r)}(i.rotate,o.rotate,s,l),function(e,t,n,i){e!==t?i.push({i:n.push(a(n)+"skewX(",null,r)-2,x:Su(e,t)}):t&&n.push(a(n)+"skewX("+t+r)}(i.skewX,o.skewX,s,l),function(e,t,n,r,i,o){if(e!==n||t!==r){var s=i.push(a(i)+"scale(",null,",",null,")");o.push({i:s-4,x:Su(e,n)},{i:s-2,x:Su(t,r)})}else 1===n&&1===r||i.push(a(i)+"scale("+n+","+r+")")}(i.scaleX,i.scaleY,o.scaleX,o.scaleY,s,l),i=o=null,function(e){for(var t,n=-1,r=l.length;++n<r;)s[(t=l[n]).i]=t.x(e);return s.join("")}}}var Bu=Au(function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Ou:Lu(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),Pu=Au(function(e){return null==e?Ou:(Ru||(Ru=document.createElementNS("http://www.w3.org/2000/svg","g")),Ru.setAttribute("transform",e),(e=Ru.transform.baseVal.consolidate())?Lu((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Ou)},", ",")",")");function Iu(e){return((e=Math.exp(e))+1/e)/2}var Vu,Du,Hu=function e(t,n,r){function a(e,a){var i,o,s=e[0],l=e[1],c=e[2],d=a[0],u=a[1],f=a[2],p=d-s,h=u-l,m=p*p+h*h;if(m<1e-12)o=Math.log(f/c)/t,i=function(e){return[s+e*p,l+e*h,c*Math.exp(t*e*o)]};else{var g=Math.sqrt(m),v=(f*f-c*c+r*m)/(2*c*n*g),b=(f*f-c*c-r*m)/(2*f*n*g),y=Math.log(Math.sqrt(v*v+1)-v);o=(Math.log(Math.sqrt(b*b+1)-b)-y)/t,i=function(e){var r=e*o,a=Iu(y),i=c/(n*g)*(a*function(e){return((e=Math.exp(2*e))-1)/(e+1)}(t*r+y)-function(e){return((e=Math.exp(e))-1/e)/2}(y));return[s+i*p,l+i*h,c*a/Iu(t*r+y)]}}return i.duration=1e3*o*t/Math.SQRT2,i}return a.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},a}(Math.SQRT2,2,4),Xu=0,Fu=0,Wu=0,Yu=0,qu=0,Uu=0,Gu="object"==typeof performance&&performance.now?performance:Date,Ku="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Zu(){return qu||(Ku(Ju),qu=Gu.now()+Uu)}function Ju(){qu=0}function Qu(){this._call=this._time=this._next=null}function ef(e,t,n){var r=new Qu;return r.restart(e,t,n),r}function tf(){qu=(Yu=Gu.now())+Uu,Xu=Fu=0;try{!function(){Zu(),++Xu;for(var e,t=Vu;t;)(e=qu-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Xu}()}finally{Xu=0,function(){var e,t,n=Vu,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:Vu=t);Du=e,rf(r)}(),qu=0}}function nf(){var e=Gu.now(),t=e-Yu;t>1e3&&(Uu-=t,Yu=e)}function rf(e){Xu||(Fu&&(Fu=clearTimeout(Fu)),e-qu>24?(e<1/0&&(Fu=setTimeout(tf,e-Gu.now()-Uu)),Wu&&(Wu=clearInterval(Wu))):(Wu||(Yu=Gu.now(),Wu=setInterval(nf,1e3)),Xu=1,Ku(tf)))}function af(e,t,n){var r=new Qu;return t=null==t?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}Qu.prototype=ef.prototype={constructor:Qu,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?Zu():+n)+(null==t?0:+t),this._next||Du===this||(Du?Du._next=this:Vu=this,Du=this),this._call=e,this._time=n,rf()},stop:function(){this._call&&(this._call=null,this._time=1/0,rf())}};var of=Ad("start","end","cancel","interrupt"),sf=[];function lf(e,t,n,r,a,i){var o=e.__transition;if(o){if(n in o)return}else e.__transition={};!function(e,t,n){var r,a=e.__transition;function i(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(i){var c,d,u,f;if(1!==n.state)return l();for(c in a)if((f=a[c]).name===n.name){if(3===f.state)return af(o);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete a[c]):+c<t&&(f.state=6,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete a[c])}if(af(function(){3===n.state&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(i))}),n.state=2,n.on.call("start",e,e.__data__,n.index,n.group),2===n.state){for(n.state=3,r=new Array(u=n.tween.length),c=0,d=-1;c<u;++c)(f=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=f);r.length=d+1}}function s(t){for(var a=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(l),n.state=5,1),i=-1,o=r.length;++i<o;)r[i].call(e,a);5===n.state&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){for(var r in n.state=6,n.timer.stop(),delete a[t],a)return;delete e.__transition}a[t]=n,n.timer=ef(i,0,n.time)}(e,n,{name:t,index:r,group:a,on:of,tween:sf,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function cf(e,t){var n=uf(e,t);if(n.state>0)throw new Error("too late; already scheduled");return n}function df(e,t){var n=uf(e,t);if(n.state>3)throw new Error("too late; already running");return n}function uf(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function ff(e,t){var n,r,a,i=e.__transition,o=!0;if(i){for(a in t=null==t?null:t+"",i)(n=i[a]).name===t?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete i[a]):o=!1;o&&delete e.__transition}}function pf(e,t){var n,r;return function(){var a=df(this,e),i=a.tween;if(i!==n)for(var o=0,s=(r=n=i).length;o<s;++o)if(r[o].name===t){(r=r.slice()).splice(o,1);break}a.tween=r}}function hf(e,t,n){var r,a;if("function"!=typeof n)throw new Error;return function(){var i=df(this,e),o=i.tween;if(o!==r){a=(r=o).slice();for(var s={name:t,value:n},l=0,c=a.length;l<c;++l)if(a[l].name===t){a[l]=s;break}l===c&&a.push(s)}i.tween=a}}function mf(e,t,n){var r=e._id;return e.each(function(){var e=df(this,r);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return uf(e,r).value[t]}}function gf(e,t){var n;return("number"==typeof t?Su:t instanceof ou?Cu:(n=ou(t))?(t=n,Cu):Mu)(e,t)}function vf(e){return function(){this.removeAttribute(e)}}function bf(e){return function(){this.removeAttributeNS(e.space,e.local)}}function yf(e,t,n){var r,a,i=n+"";return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function xf(e,t,n){var r,a,i=n+"";return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function wf(e,t,n){var r,a,i;return function(){var o,s,l=n(this);if(null!=l)return(o=this.getAttribute(e))===(s=l+"")?null:o===r&&s===a?i:(a=s,i=t(r=o,l));this.removeAttribute(e)}}function kf(e,t,n){var r,a,i;return function(){var o,s,l=n(this);if(null!=l)return(o=this.getAttributeNS(e.space,e.local))===(s=l+"")?null:o===r&&s===a?i:(a=s,i=t(r=o,l));this.removeAttributeNS(e.space,e.local)}}function _f(e,t){var n,r;function a(){var a=t.apply(this,arguments);return a!==r&&(n=(r=a)&&function(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}(e,a)),n}return a._value=t,a}function Nf(e,t){var n,r;function a(){var a=t.apply(this,arguments);return a!==r&&(n=(r=a)&&function(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}(e,a)),n}return a._value=t,a}function zf(e,t){return function(){cf(this,e).delay=+t.apply(this,arguments)}}function Cf(e,t){return t=+t,function(){cf(this,e).delay=t}}function Ef(e,t){return function(){df(this,e).duration=+t.apply(this,arguments)}}function Sf(e,t){return t=+t,function(){df(this,e).duration=t}}var jf=ud.prototype.constructor;function $f(e){return function(){this.style.removeProperty(e)}}var Mf=0;function Rf(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Tf(){return++Mf}var Of=ud.prototype;Rf.prototype=function(e){return ud().transition(e)}.prototype={constructor:Rf,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=sc(e));for(var r=this._groups,a=r.length,i=new Array(a),o=0;o<a;++o)for(var s,l,c=r[o],d=c.length,u=i[o]=new Array(d),f=0;f<d;++f)(s=c[f])&&(l=e.call(s,s.__data__,f,c))&&("__data__"in s&&(l.__data__=s.__data__),u[f]=l,lf(u[f],t,n,f,u,uf(s,n)));return new Rf(i,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=cc(e));for(var r=this._groups,a=r.length,i=[],o=[],s=0;s<a;++s)for(var l,c=r[s],d=c.length,u=0;u<d;++u)if(l=c[u]){for(var f,p=e.call(l,l.__data__,u,c),h=uf(l,n),m=0,g=p.length;m<g;++m)(f=p[m])&&lf(f,t,n,m,p,h);i.push(p),o.push(l)}return new Rf(i,o,t,n)},selectChild:Of.selectChild,selectChildren:Of.selectChildren,filter:function(e){"function"!=typeof e&&(e=uc(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var i,o=t[a],s=o.length,l=r[a]=[],c=0;c<s;++c)(i=o[c])&&e.call(i,i.__data__,c,o)&&l.push(i);return new Rf(r,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,r=t.length,a=n.length,i=Math.min(r,a),o=new Array(r),s=0;s<i;++s)for(var l,c=t[s],d=n[s],u=c.length,f=o[s]=new Array(u),p=0;p<u;++p)(l=c[p]||d[p])&&(f[p]=l);for(;s<r;++s)o[s]=t[s];return new Rf(o,this._parents,this._name,this._id)},selection:function(){return new jf(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=Tf(),r=this._groups,a=r.length,i=0;i<a;++i)for(var o,s=r[i],l=s.length,c=0;c<l;++c)if(o=s[c]){var d=uf(o,t);lf(o,e,n,c,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Rf(r,this._parents,e,n)},call:Of.call,nodes:Of.nodes,node:Of.node,size:Of.size,empty:Of.empty,each:Of.each,on:function(e,t){var n=this._id;return arguments.length<2?uf(this.node(),n).on.on(e):this.each(function(e,t,n){var r,a,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)?cf:df;return function(){var o=i(this,e),s=o.on;s!==r&&(a=(r=s).copy()).on(t,n),o.on=a}}(n,e,t))},attr:function(e,t){var n=nc(e),r="transform"===n?Pu:gf;return this.attrTween(e,"function"==typeof t?(n.local?kf:wf)(n,r,mf(this,"attr."+e,t)):null==t?(n.local?bf:vf)(n):(n.local?xf:yf)(n,r,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 r=nc(e);return this.tween(n,(r.local?_f:Nf)(r,t))},style:function(e,t,n){var r="transform"==(e+="")?Bu:gf;return null==t?this.styleTween(e,function(e,t){var n,r,a;return function(){var i=Oc(this,e),o=(this.style.removeProperty(e),Oc(this,e));return i===o?null:i===n&&o===r?a:a=t(n=i,r=o)}}(e,r)).on("end.style."+e,$f(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var r,a,i;return function(){var o=Oc(this,e),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(e),l=s=Oc(this,e)),o===l?null:o===r&&l===a?i:(a=l,i=t(r=o,s))}}(e,r,mf(this,"style."+e,t))).each(function(e,t){var n,r,a,i,o="style."+t,s="end."+o;return function(){var l=df(this,e),c=l.on,d=null==l.value[o]?i||(i=$f(t)):void 0;c===n&&a===d||(r=(n=c).copy()).on(s,a=d),l.on=r}}(this._id,e)):this.styleTween(e,function(e,t,n){var r,a,i=n+"";return function(){var o=Oc(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}(e,r,t),n).on("end.style."+e,null)},styleTween:function(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw new Error;return this.tween(r,function(e,t,n){var r,a;function i(){var i=t.apply(this,arguments);return i!==a&&(r=(a=i)&&function(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}(e,i,n)),r}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}}(mf(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 r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&function(e){return function(t){this.textContent=e.call(this,t)}}(r)),t}return r._value=e,r}(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 r,a=uf(this.node(),n).tween,i=0,o=a.length;i<o;++i)if((r=a[i]).name===e)return r.value;return null}return this.each((null==t?pf:hf)(n,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?zf:Cf)(t,e)):uf(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?Ef:Sf)(t,e)):uf(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(){df(this,e).ease=t}}(t,e)):uf(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;df(this,e).ease=n}}(this._id,e))},end:function(){var e,t,n=this,r=n._id,a=n.size();return new Promise(function(i,o){var s={value:o},l={value:function(){0===--a&&i()}};n.each(function(){var n=df(this,r),a=n.on;a!==e&&((t=(e=a).copy())._.cancel.push(s),t._.interrupt.push(s),t._.end.push(l)),n.on=t}),0===a&&i()})},[Symbol.iterator]:Of[Symbol.iterator]};var Lf={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Af(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}ud.prototype.interrupt=function(e){return this.each(function(){ff(this,e)})},ud.prototype.transition=function(e){var t,n;e instanceof Rf?(t=e._id,e=e._name):(t=Tf(),(n=Lf).time=Zu(),e=null==e?null:e+"");for(var r=this._groups,a=r.length,i=0;i<a;++i)for(var o,s=r[i],l=s.length,c=0;c<l;++c)(o=s[c])&&lf(o,e,t,c,s,n||Af(o,t));return new Rf(r,this._parents,e,t)};var Bf=e=>()=>e;function Pf(e,{sourceEvent:t,target:n,transform:r,dispatch:a}){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:r,enumerable:!0,configurable:!0},_:{value:a}})}function If(e,t,n){this.k=e,this.x=t,this.y=n}If.prototype={constructor:If,scale:function(e){return 1===e?this:new If(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new If(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 Vf=new If(1,0,0);function Df(e){e.stopImmediatePropagation()}function Hf(e){e.preventDefault(),e.stopImmediatePropagation()}function Xf(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function Ff(){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 Wf(){return this.__zoom||Vf}function Yf(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function qf(){return navigator.maxTouchPoints||"ontouchstart"in this}function Uf(e,t,n){var r=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a),o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o))}function Gf(e){var t=0,n=e.children,r=n&&n.length;if(r)for(;--r>=0;)t+=n[r].value;else t=1;e.value=t}function Kf(e,t){var n,r,a,i,o,s=new ep(e),l=+e.value&&(s.value=e.value),c=[s];for(null==t&&(t=Zf);n=c.pop();)if(l&&(n.value=+n.data.value),(a=t(n.data))&&(o=a.length))for(n.children=new Array(o),i=o-1;i>=0;--i)c.push(r=n.children[i]=new ep(a[i])),r.parent=n,r.depth=n.depth+1;return s.eachBefore(Qf)}function Zf(e){return e.children}function Jf(e){e.data=e.data.data}function Qf(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function ep(e){this.data=e,this.depth=this.height=0,this.parent=null}If.prototype,ep.prototype=Kf.prototype={constructor:ep,count:function(){return this.eachAfter(Gf)},each:function(e){var t,n,r,a,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(e(i),n=i.children)for(r=0,a=n.length;r<a;++r)o.push(n[r])}while(o.length);return this},eachAfter:function(e){for(var t,n,r,a=this,i=[a],o=[];a=i.pop();)if(o.push(a),t=a.children)for(n=0,r=t.length;n<r;++n)i.push(t[n]);for(;a=o.pop();)e(a);return this},eachBefore:function(e){for(var t,n,r=this,a=[r];r=a.pop();)if(e(r),t=r.children)for(n=t.length-1;n>=0;--n)a.push(t[n]);return this},sum:function(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,a=r&&r.length;--a>=0;)n+=r[a].value;t.value=n})},sort:function(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})},path:function(e){for(var t=this,n=function(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),a=null;e=n.pop(),t=r.pop();for(;e===t;)a=e,e=n.pop(),t=r.pop();return a}(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var a=r.length;e!==n;)r.splice(a,0,e),e=e.parent;return r},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){var e=[];return this.each(function(t){e.push(t)}),e},leaves:function(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e},links:function(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t},copy:function(){return Kf(this).eachBefore(Jf)}};var tp={name:"d3-flextree",version:"2.1.2",main:"build/d3-flextree.js",module:"index","jsnext:main":"index",author:{name:"Chris Maloney",url:"http://chrismaloney.org"},description:"Flexible tree layout algorithm that allows for variable node sizes.",keywords:["d3","d3-module","layout","tree","hierarchy","d3-hierarchy","plugin","d3-plugin","infovis","visualization","2d"],homepage:"https://github.com/klortho/d3-flextree",license:"WTFPL",repository:{type:"git",url:"https://github.com/klortho/d3-flextree.git"},scripts:{clean:"rm -rf build demo test","build:demo":"rollup -c --environment BUILD:demo","build:dev":"rollup -c --environment BUILD:dev","build:prod":"rollup -c --environment BUILD:prod","build:test":"rollup -c --environment BUILD:test",build:"rollup -c",lint:"eslint index.js src","test:main":"node test/bundle.js","test:browser":"node test/browser-tests.js",test:"npm-run-all test:*",prepare:"npm-run-all clean build lint test"},dependencies:{"d3-hierarchy":"^1.1.5"},devDependencies:{"babel-plugin-external-helpers":"^6.22.0","babel-preset-es2015-rollup":"^3.0.0",d3:"^4.13.0","d3-selection-multi":"^1.0.1",eslint:"^4.19.1",jsdom:"^11.6.2","npm-run-all":"^4.1.2",rollup:"^0.55.3","rollup-plugin-babel":"^2.7.1","rollup-plugin-commonjs":"^8.0.2","rollup-plugin-copy":"^0.2.3","rollup-plugin-json":"^2.3.0","rollup-plugin-node-resolve":"^3.0.2","rollup-plugin-uglify":"^3.0.0","uglify-es":"^3.3.9"}},{version:np}=tp,rp=Object.freeze({children:e=>e.children,nodeSize:e=>e.data.size,spacing:0});function ap(e){const t=Object.assign({},rp,e);function n(e){const n=t[e];return"function"==typeof n?n:()=>n}function r(e){const t=i(function(){const e=a(),t=n("nodeSize"),r=n("spacing");return class extends e{constructor(e){super(e),Object.assign(this,{x:0,y:0,relX:0,prelim:0,shift:0,change:0,lExt:this,lExtRelX:0,lThr:null,rExt:this,rExtRelX:0,rThr:null})}get size(){return t(this.data)}spacing(e){return r(this.data,e.data)}get x(){return this.data.x}set x(e){this.data.x=e}get y(){return this.data.y}set y(e){this.data.y=e}update(){return ip(this),op(this),this}}}(),e,e=>e.children);return t.update(),t.data}function a(){const e=n("nodeSize"),t=n("spacing");return class n extends Kf.prototype.constructor{constructor(e){super(e)}copy(){const e=i(this.constructor,this,e=>e.children);return e.each(e=>e.data=e.data.data),e}get size(){return e(this)}spacing(e){return t(this,e)}get nodes(){return this.descendants()}get xSize(){return this.size[0]}get ySize(){return this.size[1]}get top(){return this.y}get bottom(){return this.y+this.ySize}get left(){return this.x-this.xSize/2}get right(){return this.x+this.xSize/2}get root(){const e=this.ancestors();return e[e.length-1]}get numChildren(){return this.hasChildren?this.children.length:0}get hasChildren(){return!this.noChildren}get noChildren(){return null===this.children}get firstChild(){return this.hasChildren?this.children[0]:null}get lastChild(){return this.hasChildren?this.children[this.numChildren-1]:null}get extents(){return(this.children||[]).reduce((e,t)=>n.maxExtents(e,t.extents),this.nodeExtents)}get nodeExtents(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}static maxExtents(e,t){return{top:Math.min(e.top,t.top),bottom:Math.max(e.bottom,t.bottom),left:Math.min(e.left,t.left),right:Math.max(e.right,t.right)}}}}function i(e,t,n){const r=(t,a)=>{const i=new e(t);Object.assign(i,{parent:a,depth:null===a?0:a.depth+1,height:0,length:1});const o=n(t)||[];return i.children=0===o.length?null:o.map(e=>r(e,i)),i.children&&Object.assign(i,i.children.reduce((e,t)=>({height:Math.max(e.height,t.height+1),length:e.length+t.length}),i)),i};return r(t,null)}return Object.assign(r,{nodeSize(e){return arguments.length?(t.nodeSize=e,r):t.nodeSize},spacing(e){return arguments.length?(t.spacing=e,r):t.spacing},children(e){return arguments.length?(t.children=e,r):t.children},hierarchy(e,n){const r=void 0===n?t.children:n;return i(a(),e,r)},dump(e){const t=n("nodeSize"),r=e=>n=>{const a=e+" ",i=e+" ",{x:o,y:s}=n,l=t(n),c=n.children||[],d=0===c.length?" ":`,${a}children: [${i}${c.map(r(i)).join(i)}${a}],${e}`;return`{ size: [${l.join(", ")}],${a}x: ${o}, y: ${s}${d}},`};return r("\n")(e)}}),r}ap.version=np;var ip=(e,t=0)=>(e.y=t,(e.children||[]).reduce((t,n)=>{const[r,a]=t;ip(n,e.y+e.ySize);const i=(0===r?n.lExt:n.rExt).bottom;0!==r&&lp(e,r,a);return[r+1,gp(i,r,a)]},[0,null]),sp(e),mp(e),e),op=(e,t,n)=>{void 0===t&&(t=-e.relX-e.prelim,n=0);const r=t+e.relX;return e.relX=r+e.prelim-n,e.prelim=0,e.x=n+e.relX,(e.children||[]).forEach(t=>op(t,r,e.x)),e},sp=e=>{(e.children||[]).reduce((e,t)=>{const[n,r]=e,a=n+t.shift,i=r+a+t.change;return t.relX+=i,[a,i]},[0,0])},lp=(e,t,n)=>{const r=e.children[t-1],a=e.children[t];let i=r,o=r.relX,s=a,l=a.relX,c=!0;for(;i&&s;){i.bottom>n.lowY&&(n=n.next);const r=o+i.prelim-(l+s.prelim)+i.xSize/2+s.xSize/2+i.spacing(s);(r>0||r<0&&c)&&(l+=r,cp(a,r),dp(e,t,n.index,r)),c=!1;const d=i.bottom,u=s.bottom;d<=u&&(i=fp(i),i&&(o+=i.relX)),d>=u&&(s=up(s),s&&(l+=s.relX))}!i&&s?pp(e,t,s,l):i&&!s&&hp(e,t,i,o)},cp=(e,t)=>{e.relX+=t,e.lExtRelX+=t,e.rExtRelX+=t},dp=(e,t,n,r)=>{const a=e.children[t],i=t-n;if(i>1){const t=r/i;e.children[n+1].shift+=t,a.shift-=t,a.change-=r-t}},up=e=>e.hasChildren?e.firstChild:e.lThr,fp=e=>e.hasChildren?e.lastChild:e.rThr,pp=(e,t,n,r)=>{const a=e.firstChild,i=a.lExt,o=e.children[t];i.lThr=n;const s=r-n.relX-a.lExtRelX;i.relX+=s,i.prelim-=s,a.lExt=o.lExt,a.lExtRelX=o.lExtRelX},hp=(e,t,n,r)=>{const a=e.children[t],i=a.rExt,o=e.children[t-1];i.rThr=n;const s=r-n.relX-a.rExtRelX;i.relX+=s,i.prelim-=s,a.rExt=o.rExt,a.rExtRelX=o.rExtRelX},mp=e=>{if(e.hasChildren){const t=e.firstChild,n=e.lastChild,r=(t.prelim+t.relX-t.xSize/2+n.relX+n.prelim+n.xSize/2)/2;Object.assign(e,{prelim:r,lExt:t.lExt,lExtRelX:t.lExtRelX,rExt:n.rExt,rExtRelX:n.rExtRelX})}},gp=(e,t,n)=>{for(;null!==n&&e>=n.lowY;)n=n.next;return{lowY:e,index:t,next:n}};function vp(e){return function(){return e}}var bp=Math.PI,yp=2*bp,xp=1e-6,wp=yp-xp;function kp(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}var _p=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==e?kp:function(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return kp;const n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,a,i){this._append`C${+e},${+t},${+n},${+r},${this._x1=+a},${this._y1=+i}`}arcTo(e,t,n,r,a){if(e=+e,t=+t,n=+n,r=+r,(a=+a)<0)throw new Error(`negative radius: ${a}`);let i=this._x1,o=this._y1,s=n-e,l=r-t,c=i-e,d=o-t,u=c*c+d*d;if(null===this._x1)this._append`M${this._x1=e},${this._y1=t}`;else if(u>xp)if(Math.abs(d*s-l*c)>xp&&a){let f=n-i,p=r-o,h=s*s+l*l,m=f*f+p*p,g=Math.sqrt(h),v=Math.sqrt(u),b=a*Math.tan((bp-Math.acos((h+u-m)/(2*g*v)))/2),y=b/v,x=b/g;Math.abs(y-1)>xp&&this._append`L${e+y*c},${t+y*d}`,this._append`A${a},${a},0,0,${+(d*f>c*p)},${this._x1=e+x*s},${this._y1=t+x*l}`}else this._append`L${this._x1=e},${this._y1=t}`;else;}arc(e,t,n,r,a,i){if(e=+e,t=+t,i=!!i,(n=+n)<0)throw new Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),l=e+o,c=t+s,d=1^i,u=i?r-a:a-r;null===this._x1?this._append`M${l},${c}`:(Math.abs(this._x1-l)>xp||Math.abs(this._y1-c)>xp)&&this._append`L${l},${c}`,n&&(u<0&&(u=u%yp+yp),u>wp?this._append`A${n},${n},0,1,${d},${e-o},${t-s}A${n},${n},0,1,${d},${this._x1=l},${this._y1=c}`:u>xp&&this._append`A${n},${n},0,${+(u>=bp)},${d},${this._x1=e+n*Math.cos(a)},${this._y1=t+n*Math.sin(a)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};var Np=Array.prototype.slice;function zp(e){return e[0]}function Cp(e){return e[1]}var Ep=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function Sp(e){return new Ep(e,!0)}function jp(e){return e.source}function $p(e){return e.target}function Mp(e){let t=jp,n=$p,r=zp,a=Cp,i=null,o=null,s=function(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(null==n)t=null;else{const e=Math.floor(n);if(!(e>=0))throw new RangeError(`invalid digits: ${n}`);t=e}return e},()=>new _p(t)}(l);function l(){let l;const c=Np.call(arguments),d=t.apply(this,c),u=n.apply(this,c);if(null==i&&(o=e(l=s())),o.lineStart(),c[0]=d,o.point(+r.apply(this,c),+a.apply(this,c)),c[0]=u,o.point(+r.apply(this,c),+a.apply(this,c)),o.lineEnd(),l)return o=null,l+""||null}return l.source=function(e){return arguments.length?(t=e,l):t},l.target=function(e){return arguments.length?(n=e,l):n},l.x=function(e){return arguments.length?(r="function"==typeof e?e:vp(+e),l):r},l.y=function(e){return arguments.length?(a="function"==typeof e?e:vp(+e),l):a},l.context=function(t){return arguments.length?(null==t?i=o=null:o=e(i=t),l):i},l}var Rp={selection:ud,select:fd,max:function(e,t){let n;if(void 0===t)for(const r of e)null!=r&&(n<r||void 0===n&&r>=r)&&(n=r);else{let r=-1;for(let a of e)null!=(a=t(a,++r,e))&&(n<a||void 0===n&&a>=a)&&(n=a)}return n},min:function(e,t){let n;if(void 0===t)for(const r of e)null!=r&&(n>r||void 0===n&&r>=r)&&(n=r);else{let r=-1;for(let a of e)null!=(a=t(a,++r,e))&&(n>a||void 0===n&&a>=a)&&(n=a)}return n},sum:function(e,t){let n=0;if(void 0===t)for(let r of e)(r=+r)&&(n+=r);else{let r=-1;for(let a of e)(a=+t(a,++r,e))&&(n+=a)}return n},cumsum:function(e,t){var n=0,r=0;return Float64Array.from(e,void 0===t?e=>n+=+e||0:a=>n+=+t(a,r++,e)||0)},tree:function(){var e=jd,t=1,n=1,r=null;function a(a){var l=function(e){for(var t,n,r,a,i,o=new Od(e,0),s=[o];t=s.pop();)if(r=t._.children)for(t.children=new Array(i=r.length),a=i-1;a>=0;--a)s.push(n=t.children[a]=new Od(r[a],a)),n.parent=t;return(o.parent=new Od(null,0)).children=[o],o}(a);if(l.eachAfter(i),l.parent.m=-l.z,l.eachBefore(o),r)a.eachBefore(s);else{var c=a,d=a,u=a;a.eachBefore(function(e){e.x<c.x&&(c=e),e.x>d.x&&(d=e),e.depth>u.depth&&(u=e)});var f=c===d?1:e(c,d)/2,p=f-c.x,h=t/(d.x+f+p),m=n/(u.depth||1);a.eachBefore(function(e){e.x=(e.x+p)*h,e.y=e.depth*m})}return a}function i(t){var n=t.children,r=t.parent.children,a=t.i?r[t.i-1]:null;if(n){!function(e){for(var t,n=0,r=0,a=e.children,i=a.length;--i>=0;)(t=a[i]).z+=n,t.m+=n,n+=t.s+(r+=t.c)}(t);var i=(n[0].z+n[n.length-1].z)/2;a?(t.z=a.z+e(t._,a._),t.m=t.z-i):t.z=i}else a&&(t.z=a.z+e(t._,a._));t.parent.A=function(t,n,r){if(n){for(var a,i=t,o=t,s=n,l=i.parent.children[0],c=i.m,d=o.m,u=s.m,f=l.m;s=Md(s),i=$d(i),s&&i;)l=$d(l),(o=Md(o)).a=t,(a=s.z+u-i.z-c+e(s._,i._))>0&&(Rd(Td(s,t,r),t,a),c+=a,d+=a),u+=s.m,c+=i.m,f+=l.m,d+=o.m;s&&!Md(o)&&(o.t=s,o.m+=u-d),i&&!$d(l)&&(l.t=i,l.m+=c-f,r=t)}return r}(t,a,t.parent.A||r[0])}function o(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function s(e){e.x*=t,e.y=e.depth*n}return a.separation=function(t){return arguments.length?(e=t,a):e},a.size=function(e){return arguments.length?(r=!1,t=+e[0],n=+e[1],a):r?null:[t,n]},a.nodeSize=function(e){return arguments.length?(r=!0,t=+e[0],n=+e[1],a):r?[t,n]:null},a},stratify:function(){var e,t=zd,n=Cd;function r(r){var a,i,o,s,l,c,d,u,f=Array.from(r),p=t,h=n,m=/* @__PURE__ */new Map;if(null!=e){const t=f.map((t,n)=>function(e){e=`${e}`;let t=e.length;Sd(e,t-1)&&!Sd(e,t-2)&&(e=e.slice(0,-1));return"/"===e[0]?e:`/${e}`}(e(t,n,r))),n=t.map(Ed),a=new Set(t).add("");for(const e of n)a.has(e)||(a.add(e),t.push(e),n.push(Ed(e)),f.push(Nd));p=(e,n)=>t[n],h=(e,t)=>n[t]}for(o=0,a=f.length;o<a;++o)i=f[o],c=f[o]=new xd(i),null!=(d=p(i,o,r))&&(d+="")&&(u=c.id=d,m.set(u,m.has(u)?_d:c)),null!=(d=h(i,o,r))&&(d+="")&&(c.parent=d);for(o=0;o<a;++o)if(d=(c=f[o]).parent){if(!(l=m.get(d)))throw new Error("missing: "+d);if(l===_d)throw new Error("ambiguous: "+d);l.children?l.children.push(c):l.children=[c],c.parent=l}else{if(s)throw new Error("multiple roots");s=c}if(!s)throw new Error("no root");if(null!=e){for(;s.data===Nd&&1===s.children.length;)s=s.children[0],--a;for(let e=f.length-1;e>=0&&(c=f[e]).data===Nd;--e)c.data=null}if(s.parent=kd,s.eachBefore(function(e){e.depth=e.parent.depth+1,--a}).eachBefore(yd),s.parent=null,a>0)throw new Error("cycle");return s}return r.id=function(e){return arguments.length?(t=wd(e),r):t},r.parentId=function(e){return arguments.length?(n=wd(e),r):n},r.path=function(t){return arguments.length?(e=wd(t),r):e},r},zoom:function(){var e,t,n,r=Xf,a=Ff,i=Uf,o=Yf,s=qf,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],d=250,u=Hu,f=Ad("start","zoom","end"),p=0,h=10;function m(e){e.property("__zoom",Wf).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",_).on("dblclick.zoom",N).filter(s).on("touchstart.zoom",z).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",E).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(e,t){return(t=Math.max(l[0],Math.min(l[1],t)))===e.k?e:new If(t,e.x,e.y)}function v(e,t,n){var r=t[0]-n[0]*e.k,a=t[1]-n[1]*e.k;return r===e.x&&a===e.y?e:new If(e.k,r,a)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function y(e,t,n,r){e.on("start.zoom",function(){x(this,arguments).event(r).start()}).on("interrupt.zoom end.zoom",function(){x(this,arguments).event(r).end()}).tween("zoom",function(){var e=this,i=arguments,o=x(e,i).event(r),s=a.apply(e,i),l=null==n?b(s):"function"==typeof n?n.apply(e,i):n,c=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f="function"==typeof t?t.apply(e,i):t,p=u(d.invert(l).concat(c/d.k),f.invert(l).concat(c/f.k));return function(e){if(1===e)e=f;else{var t=p(e),n=c/t[2];e=new If(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function x(e,t,n){return!n&&e.__zooming||new w(e,t)}function w(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=a.apply(e,t),this.taps=0}function k(e,...t){if(r.apply(this,arguments)){var n=x(this,t).event(e),a=this.__zoom,s=Math.max(l[0],Math.min(l[1],a.k*Math.pow(2,o.apply(this,arguments)))),d=pd(e);if(n.wheel)n.mouse[0][0]===d[0]&&n.mouse[0][1]===d[1]||(n.mouse[1]=a.invert(n.mouse[0]=d)),clearTimeout(n.wheel);else{if(a.k===s)return;n.mouse=[d,a.invert(d)],ff(this),n.start()}Hf(e),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",i(v(g(a,s),n.mouse[0],n.mouse[1]),n.extent,c))}}function _(e,...t){if(!n&&r.apply(this,arguments)){var a=e.currentTarget,o=x(this,t,!0).event(e),s=fd(e.view).on("mousemove.zoom",function(e){if(Hf(e),!o.moved){var t=e.clientX-d,n=e.clientY-u;o.moved=t*t+n*n>p}o.event(e).zoom("mouse",i(v(o.that.__zoom,o.mouse[0]=pd(e,a),o.mouse[1]),o.extent,c))},!0).on("mouseup.zoom",function(e){s.on("mousemove.zoom mouseup.zoom",null),function(e,t){var n=e.document.documentElement,r=fd(e).on("dragstart.drag",null);t&&(r.on("click.drag",Dd,Vd),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}(e.view,o.moved),Hf(e),o.event(e).end()},!0),l=pd(e,a),d=e.clientX,u=e.clientY;!function(e){var t=e.document.documentElement,n=fd(e).on("dragstart.drag",Dd,Vd);"onselectstart"in t?n.on("selectstart.drag",Dd,Vd):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}(e.view),Df(e),o.mouse=[l,this.__zoom.invert(l)],ff(this),o.start()}}function N(e,...t){if(r.apply(this,arguments)){var n=this.__zoom,o=pd(e.changedTouches?e.changedTouches[0]:e,this),s=n.invert(o),l=n.k*(e.shiftKey?.5:2),u=i(v(g(n,l),o,s),a.apply(this,t),c);Hf(e),d>0?fd(this).transition().duration(d).call(y,u,o,e):fd(this).call(m.transform,u,o,e)}}function z(n,...a){if(r.apply(this,arguments)){var i,o,s,l,c=n.touches,d=c.length,u=x(this,a,n.changedTouches.length===d).event(n);for(Df(n),o=0;o<d;++o)l=[l=pd(s=c[o],this),this.__zoom.invert(l),s.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},500)),ff(this),u.start())}}function C(e,...t){if(this.__zooming){var n,r,a,o,s=x(this,t).event(e),l=e.changedTouches,d=l.length;for(Hf(e),n=0;n<d;++n)a=pd(r=l[n],this),s.touch0&&s.touch0[2]===r.identifier?s.touch0[0]=a:s.touch1&&s.touch1[2]===r.identifier&&(s.touch1[0]=a);if(r=s.that.__zoom,s.touch1){var u=s.touch0[0],f=s.touch0[1],p=s.touch1[0],h=s.touch1[1],m=(m=p[0]-u[0])*m+(m=p[1]-u[1])*m,b=(b=h[0]-f[0])*b+(b=h[1]-f[1])*b;r=g(r,Math.sqrt(m/b)),a=[(u[0]+p[0])/2,(u[1]+p[1])/2],o=[(f[0]+h[0])/2,(f[1]+h[1])/2]}else{if(!s.touch0)return;a=s.touch0[0],o=s.touch0[1]}s.zoom("touch",i(v(r,a,o),s.extent,c))}}function E(e,...r){if(this.__zooming){var a,i,o=x(this,r).event(e),s=e.changedTouches,l=s.length;for(Df(e),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),a=0;a<l;++a)i=s[a],o.touch0&&o.touch0[2]===i.identifier?delete o.touch0:o.touch1&&o.touch1[2]===i.identifier&&delete o.touch1;if(o.touch1&&!o.touch0&&(o.touch0=o.touch1,delete o.touch1),o.touch0)o.touch0[1]=this.__zoom.invert(o.touch0[0]);else if(o.end(),2===o.taps&&(i=pd(i,this),Math.hypot(t[0]-i[0],t[1]-i[1])<h)){var c=fd(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return m.transform=function(e,t,n,r){var a=e.selection?e.selection():e;a.property("__zoom",Wf),e!==a?y(e,t,n,r):a.interrupt().each(function(){x(this,arguments).event(r).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()})},m.scaleBy=function(e,t,n,r){m.scaleTo(e,function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)},n,r)},m.scaleTo=function(e,t,n,r){m.transform(e,function(){var e=a.apply(this,arguments),r=this.__zoom,o=null==n?b(e):"function"==typeof n?n.apply(this,arguments):n,s=r.invert(o),l="function"==typeof t?t.apply(this,arguments):t;return i(v(g(r,l),o,s),e,c)},n,r)},m.translateBy=function(e,t,n,r){m.transform(e,function(){return i(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),a.apply(this,arguments),c)},null,r)},m.translateTo=function(e,t,n,r,o){m.transform(e,function(){var e=a.apply(this,arguments),o=this.__zoom,s=null==r?b(e):"function"==typeof r?r.apply(this,arguments):r;return i(Vf.translate(s[0],s[1]).scale(o.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,c)},r,o)},w.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=fd(this.that).datum();f.call(e,this.that,new Pf(e,{sourceEvent:this.sourceEvent,target:m,type:e,transform:this.that.__zoom,dispatch:f}),t)}},m.wheelDelta=function(e){return arguments.length?(o="function"==typeof e?e:Bf(+e),m):o},m.filter=function(e){return arguments.length?(r="function"==typeof e?e:Bf(!!e),m):r},m.touchable=function(e){return arguments.length?(s="function"==typeof e?e:Bf(!!e),m):s},m.extent=function(e){return arguments.length?(a="function"==typeof e?e:Bf([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),m):a},m.scaleExtent=function(e){return arguments.length?(l[0]=+e[0],l[1]=+e[1],m):[l[0],l[1]]},m.translateExtent=function(e){return arguments.length?(c[0][0]=+e[0][0],c[1][0]=+e[1][0],c[0][1]=+e[0][1],c[1][1]=+e[1][1],m):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},m.constrain=function(e){return arguments.length?(i=e,m):i},m.duration=function(e){return arguments.length?(d=+e,m):d},m.interpolate=function(e){return arguments.length?(u=e,m):u},m.on=function(){var e=f.on.apply(f,arguments);return e===f?m:e},m.clickDistance=function(e){return arguments.length?(p=(e=+e)*e,m):Math.sqrt(p)},m.tapDistance=function(e){return arguments.length?(h=+e,m):h},m},zoomIdentity:Vf,linkHorizontal:function(){return Mp(Sp)},flextree:ap},Tp=class{constructor(){const e={id:`ID${Math.floor(1e6*Math.random())}`,firstDraw:!0,ctx:document.createElement("canvas").getContext("2d"),initialExpandLevel:1,nodeDefaultBackground:"none",lastTransform:{x:0,y:0,k:1},allowedNodesCount:{},zoomBehavior:null,generateRoot:null,svgWidth:800,svgHeight:window.innerHeight-100,container:"body",data:null,connections:[],defaultFont:"Helvetica",nodeId:e=>e.nodeId||e.id,parentNodeId:e=>e.parentNodeId||e.parentId,rootMargin:40,nodeWidth:e=>250,nodeHeight:e=>150,neighbourMargin:(e,t)=>80,siblingsMargin:e=>20,childrenMargin:e=>60,compactMarginPair:e=>100,compactMarginBetween:e=>20,nodeButtonWidth:e=>40,nodeButtonHeight:e=>40,nodeButtonX:e=>-20,nodeButtonY:e=>-20,linkYOffset:30,pagingStep:e=>5,minPagingVisibleNodes:e=>2e3,scaleExtent:[.001,20],duration:400,imageName:"Chart",setActiveNodeCentered:!0,layout:"top",compact:!0,createZoom:e=>Rp.zoom(),onZoomStart:e=>{},onZoom:e=>{},onZoomEnd:e=>{},onNodeClick:e=>e,onExpandOrCollapse:e=>e,nodeContent:e=>`<div style="padding:5px;font-size:10px;">Sample Node(id=${e.id}), override using <br/> \n <code>chart.nodeContent({data}=>{ <br/>\n &nbsp;&nbsp;&nbsp;&nbsp;return '' // Custom HTML <br/>\n })</code>\n <br/> \n Or check different <a href="https://github.com/bumbeishvili/org-chart#jump-to-examples" target="_blank">layout examples</a>\n </div>`,buttonContent:({node:e,state:t})=>`<div style="border:1px solid #E4E2E9;border-radius:3px;padding:3px;font-size:9px;margin:auto auto;background-color:white"> ${{left:t=>t?`<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M14.283 3.50094L6.51 11.4749C6.37348 11.615 6.29707 11.8029 6.29707 11.9984C6.29707 12.194 6.37348 12.3819 6.51 12.5219L14.283 20.4989C14.3466 20.5643 14.4226 20.6162 14.5066 20.6516C14.5906 20.6871 14.6808 20.7053 14.772 20.7053C14.8632 20.7053 14.9534 20.6871 15.0374 20.6516C15.1214 20.6162 15.1974 20.5643 15.261 20.4989C15.3918 20.365 15.4651 20.1852 15.4651 19.9979C15.4651 19.8107 15.3918 19.6309 15.261 19.4969L7.9515 11.9984L15.261 4.50144C15.3914 4.36756 15.4643 4.18807 15.4643 4.00119C15.4643 3.81431 15.3914 3.63482 15.261 3.50094C15.1974 3.43563 15.1214 3.38371 15.0374 3.34827C14.9534 3.31282 14.8632 3.29456 14.772 3.29456C14.6808 3.29456 14.5906 3.31282 14.5066 3.34827C14.4226 3.38371 14.3466 3.43563 14.283 3.50094V3.50094Z" fill="#716E7B" stroke="#716E7B"/>\n </svg></span><span style="color:#716E7B">${e.data._directSubordinatesPaging} </span></div>`:`<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M7.989 3.49944C7.85817 3.63339 7.78492 3.8132 7.78492 4.00044C7.78492 4.18768 7.85817 4.36749 7.989 4.50144L15.2985 11.9999L7.989 19.4969C7.85817 19.6309 7.78492 19.8107 7.78492 19.9979C7.78492 20.1852 7.85817 20.365 7.989 20.4989C8.05259 20.5643 8.12863 20.6162 8.21261 20.6516C8.2966 20.6871 8.38684 20.7053 8.478 20.7053C8.56916 20.7053 8.6594 20.6871 8.74338 20.6516C8.82737 20.6162 8.90341 20.5643 8.967 20.4989L16.74 12.5234C16.8765 12.3834 16.9529 12.1955 16.9529 11.9999C16.9529 11.8044 16.8765 11.6165 16.74 11.4764L8.967 3.50094C8.90341 3.43563 8.82737 3.38371 8.74338 3.34827C8.6594 3.31282 8.56916 3.29456 8.478 3.29456C8.38684 3.29456 8.2966 3.31282 8.21261 3.34827C8.12863 3.38371 8.05259 3.43563 7.989 3.50094V3.49944Z" fill="#716E7B" stroke="#716E7B"/>\n </svg></span><span style="color:#716E7B">${e.data._directSubordinatesPaging} </span></div>`,bottom:t=>t?`<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M19.497 7.98903L12 15.297L4.503 7.98903C4.36905 7.85819 4.18924 7.78495 4.002 7.78495C3.81476 7.78495 3.63495 7.85819 3.501 7.98903C3.43614 8.05257 3.38462 8.12842 3.34944 8.21213C3.31427 8.29584 3.29615 8.38573 3.29615 8.47653C3.29615 8.56733 3.31427 8.65721 3.34944 8.74092C3.38462 8.82463 3.43614 8.90048 3.501 8.96403L11.4765 16.74C11.6166 16.8765 11.8044 16.953 12 16.953C12.1956 16.953 12.3834 16.8765 12.5235 16.74L20.499 8.96553C20.5643 8.90193 20.6162 8.8259 20.6517 8.74191C20.6871 8.65792 20.7054 8.56769 20.7054 8.47653C20.7054 8.38537 20.6871 8.29513 20.6517 8.21114C20.6162 8.12715 20.5643 8.05112 20.499 7.98753C20.3651 7.85669 20.1852 7.78345 19.998 7.78345C19.8108 7.78345 19.6309 7.85669 19.497 7.98753V7.98903Z" fill="#716E7B" stroke="#716E7B"/>\n </svg></span><span style="margin-left:1px;color:#716E7B" >${e.data._directSubordinatesPaging} </span></div>\n `:`<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M11.457 8.07005L3.49199 16.4296C3.35903 16.569 3.28485 16.7543 3.28485 16.9471C3.28485 17.1398 3.35903 17.3251 3.49199 17.4646L3.50099 17.4736C3.56545 17.5414 3.64304 17.5954 3.72904 17.6324C3.81504 17.6693 3.90765 17.6883 4.00124 17.6883C4.09483 17.6883 4.18745 17.6693 4.27344 17.6324C4.35944 17.5954 4.43703 17.5414 4.50149 17.4736L12.0015 9.60155L19.4985 17.4736C19.563 17.5414 19.6405 17.5954 19.7265 17.6324C19.8125 17.6693 19.9052 17.6883 19.9987 17.6883C20.0923 17.6883 20.1849 17.6693 20.2709 17.6324C20.3569 17.5954 20.4345 17.5414 20.499 17.4736L20.508 17.4646C20.641 17.3251 20.7151 17.1398 20.7151 16.9471C20.7151 16.7543 20.641 16.569 20.508 16.4296L12.543 8.07005C12.4729 7.99653 12.3887 7.93801 12.2954 7.89801C12.202 7.85802 12.1015 7.8374 12 7.8374C11.8984 7.8374 11.798 7.85802 11.7046 7.89801C11.6113 7.93801 11.527 7.99653 11.457 8.07005Z" fill="#716E7B" stroke="#716E7B"/>\n </svg></span><span style="margin-left:1px;color:#716E7B" >${e.data._directSubordinatesPaging} </span></div>\n `,right:t=>t?`<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M7.989 3.49944C7.85817 3.63339 7.78492 3.8132 7.78492 4.00044C7.78492 4.18768 7.85817 4.36749 7.989 4.50144L15.2985 11.9999L7.989 19.4969C7.85817 19.6309 7.78492 19.8107 7.78492 19.9979C7.78492 20.1852 7.85817 20.365 7.989 20.4989C8.05259 20.5643 8.12863 20.6162 8.21261 20.6516C8.2966 20.6871 8.38684 20.7053 8.478 20.7053C8.56916 20.7053 8.6594 20.6871 8.74338 20.6516C8.82737 20.6162 8.90341 20.5643 8.967 20.4989L16.74 12.5234C16.8765 12.3834 16.9529 12.1955 16.9529 11.9999C16.9529 11.8044 16.8765 11.6165 16.74 11.4764L8.967 3.50094C8.90341 3.43563 8.82737 3.38371 8.74338 3.34827C8.6594 3.31282 8.56916 3.29456 8.478 3.29456C8.38684 3.29456 8.2966 3.31282 8.21261 3.34827C8.12863 3.38371 8.05259 3.43563 7.989 3.50094V3.49944Z" fill="#716E7B" stroke="#716E7B"/>\n </svg></span><span style="color:#716E7B">${e.data._directSubordinatesPaging} </span></div>`:`<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M14.283 3.50094L6.51 11.4749C6.37348 11.615 6.29707 11.8029 6.29707 11.9984C6.29707 12.194 6.37348 12.3819 6.51 12.5219L14.283 20.4989C14.3466 20.5643 14.4226 20.6162 14.5066 20.6516C14.5906 20.6871 14.6808 20.7053 14.772 20.7053C14.8632 20.7053 14.9534 20.6871 15.0374 20.6516C15.1214 20.6162 15.1974 20.5643 15.261 20.4989C15.3918 20.365 15.4651 20.1852 15.4651 19.9979C15.4651 19.8107 15.3918 19.6309 15.261 19.4969L7.9515 11.9984L15.261 4.50144C15.3914 4.36756 15.4643 4.18807 15.4643 4.00119C15.4643 3.81431 15.3914 3.63482 15.261 3.50094C15.1974 3.43563 15.1214 3.38371 15.0374 3.34827C14.9534 3.31282 14.8632 3.29456 14.772 3.29456C14.6808 3.29456 14.5906 3.31282 14.5066 3.34827C14.4226 3.38371 14.3466 3.43563 14.283 3.50094V3.50094Z" fill="#716E7B" stroke="#716E7B"/>\n </svg></span><span style="color:#716E7B">${e.data._directSubordinatesPaging} </span></div>`,top:t=>t?`<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M11.457 8.07005L3.49199 16.4296C3.35903 16.569 3.28485 16.7543 3.28485 16.9471C3.28485 17.1398 3.35903 17.3251 3.49199 17.4646L3.50099 17.4736C3.56545 17.5414 3.64304 17.5954 3.72904 17.6324C3.81504 17.6693 3.90765 17.6883 4.00124 17.6883C4.09483 17.6883 4.18745 17.6693 4.27344 17.6324C4.35944 17.5954 4.43703 17.5414 4.50149 17.4736L12.0015 9.60155L19.4985 17.4736C19.563 17.5414 19.6405 17.5954 19.7265 17.6324C19.8125 17.6693 19.9052 17.6883 19.9987 17.6883C20.0923 17.6883 20.1849 17.6693 20.2709 17.6324C20.3569 17.5954 20.4345 17.5414 20.499 17.4736L20.508 17.4646C20.641 17.3251 20.7151 17.1398 20.7151 16.9471C20.7151 16.7543 20.641 16.569 20.508 16.4296L12.543 8.07005C12.4729 7.99653 12.3887 7.93801 12.2954 7.89801C12.202 7.85802 12.1015 7.8374 12 7.8374C11.8984 7.8374 11.798 7.85802 11.7046 7.89801C11.6113 7.93801 11.527 7.99653 11.457 8.07005Z" fill="#716E7B" stroke="#716E7B"/>\n </svg></span><span style="margin-left:1px;color:#716E7B">${e.data._directSubordinatesPaging} </span></div>\n `:`<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M19.497 7.98903L12 15.297L4.503 7.98903C4.36905 7.85819 4.18924 7.78495 4.002 7.78495C3.81476 7.78495 3.63495 7.85819 3.501 7.98903C3.43614 8.05257 3.38462 8.12842 3.34944 8.21213C3.31427 8.29584 3.29615 8.38573 3.29615 8.47653C3.29615 8.56733 3.31427 8.65721 3.34944 8.74092C3.38462 8.82463 3.43614 8.90048 3.501 8.96403L11.4765 16.74C11.6166 16.8765 11.8044 16.953 12 16.953C12.1956 16.953 12.3834 16.8765 12.5235 16.74L20.499 8.96553C20.5643 8.90193 20.6162 8.8259 20.6517 8.74191C20.6871 8.65792 20.7054 8.56769 20.7054 8.47653C20.7054 8.38537 20.6871 8.29513 20.6517 8.21114C20.6162 8.12715 20.5643 8.05112 20.499 7.98753C20.3651 7.85669 20.1852 7.78345 19.998 7.78345C19.8108 7.78345 19.6309 7.85669 19.497 7.98753V7.98903Z" fill="#716E7B" stroke="#716E7B"/>\n </svg></span><span style="margin-left:1px;color:#716E7B">${e.data._directSubordinatesPaging} </span></div>\n `}[t.layout](e.children)} </div>`,pagingButton:(e,t,n,r)=>{const a=r.pagingStep(e.parent),i=e.parent.data._pagingStep,o=e.parent.data._directSubordinatesPaging-i;return`\n <div style="margin-top:90px;">\n <div style="display:flex;width:170px;border-radius:20px;padding:5px 15px; padding-bottom:4px;;background-color:#E5E9F2">\n <div><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M5.59 7.41L10.18 12L5.59 16.59L7 18L13 12L7 6L5.59 7.41ZM16 6H18V18H16V6Z" fill="#716E7B" stroke="#716E7B"/>\n </svg>\n </div><div style="line-height:2"> Show next ${Math.min(o,a)} nodes </div></div>\n </div>\n `},nodeUpdate:function(e,t,n){Rp.select(this).select(".node-rect").attr("stroke",e=>e.data._highlighted||e.data._upToTheRootHighlighted?"#E27396":"none").attr("stroke-width",e.data._highlighted||e.data._upToTheRootHighlighted?10:1)},nodeEnter:e=>e,nodeExit:e=>e,linkUpdate:function(e,t,n){Rp.select(this).attr("stroke",e=>e.data._upToTheRootHighlighted?"#E27396":"#E4E2E9").attr("stroke-width",e=>e.data._upToTheRootHighlighted?5:1),e.data._upToTheRootHighlighted&&Rp.select(this).raise()},hdiagonal:function(e,t,n){const r=e.x,a=e.y,i=t.x,o=t.y;let s=n&&null!=n.x?n.x:r,l=n&&null!=n.y?n.y:a,c=i-r<0?-1:1,d=o-a<0?-1:1,u=Math.abs(i-r)/2<35?Math.abs(i-r)/2:35;u=Math.abs(o-a)/2<u?Math.abs(o-a)/2:u,Math.abs(o-a);let f=Math.abs(i-r)/2-u;return`\n M ${s} ${l}\n L ${s} ${a}\n L ${r} ${a}\n L ${r+f*c} ${a}\n C ${r+f*c+u*c} ${a} \n ${r+f*c+u*c} ${a} \n ${r+f*c+u*c} ${a+u*d}\n L ${r+f*c+u*c} ${o-u*d} \n C ${r+f*c+u*c} ${o} \n ${r+f*c+u*c} ${o} \n ${i-f*c} ${o}\n L ${i} ${o}\n `},diagonal:function(e,t,n,r={sy:0}){const a=e.x;let i=e.y;const o=t.x,s=t.y;let l=n&&null!=n.x?n.x:a,c=n&&null!=n.y?n.y:i,d=o-a<0?-1:1,u=s-i<0?-1:1;i+=r.sy;let f=Math.abs(o-a)/2<35?Math.abs(o-a)/2:35;f=Math.abs(s-i)/2<f?Math.abs(s-i)/2:f;let p=Math.abs(s-i)/2-f;return`\n M ${l} ${c}\n L ${a} ${c}\n L ${a} ${i}\n L ${a} ${i+p*u}\n C ${a} ${i+p*u+f*u} ${a} ${i+p*u+f*u} ${a+f*d} ${i+p*u+f*u}\n L ${a+(Math.abs(o-a)-2*f)*d+f*d} ${i+p*u+f*u}\n C ${o} ${i+p*u+f*u} ${o} ${i+p*u+f*u} ${o} ${s-p*u}\n L ${o} ${s}\n `},defs:function(e,t){return`<defs>\n ${t.map(t=>{const n=this.getTextWidth(t.label,{ctx:e.ctx,fontSize:2,defaultFont:e.defaultFont});return`\n <marker id="${t.from+"_"+t.to}" refX="${t._source.x<t._target.x?-7:7}" refY="5" markerWidth="500" markerHeight="500" orient="${t._source.x<t._target.x?"auto":"auto-start-reverse"}" >\n <rect rx=0.5 width=${t.label?n+3:0} height=3 y=1 fill="#E27396"></rect>\n <text font-size="2px" x=1 fill="white" y=3>${t.label||""}</text>\n </marker>\n\n <marker id="arrow-${t.from+"_"+t.to}" markerWidth="500" markerHeight="500" refY="2" refX="1" orient="${t._source.x<t._target.x?"auto":"auto-start-reverse"}" >\n <path transform="translate(0)" d='M0,0 V4 L2,2 Z' fill='#E27396' />\n </marker>\n `}).join("")}\n </defs>\n `},connectionsUpdate:function(e,t,n){Rp.select(this).attr("stroke",e=>"#E27396").attr("stroke-linecap","round").attr("stroke-width",e=>"5").attr("pointer-events","none").attr("marker-start",e=>`url(#${e.from+"_"+e.to})`).attr("marker-end",e=>`url(#arrow-${e.from+"_"+e.to})`)},linkGroupArc:Rp.linkHorizontal().x(e=>e.x).y(e=>e.y),layoutBindings:{left:{nodeLeftX:e=>0,nodeRightX:e=>e.width,nodeTopY:e=>-e.height/2,nodeBottomY:e=>e.height/2,nodeJoinX:e=>e.x+e.width,nodeJoinY:e=>e.y-e.height/2,linkJoinX:e=>e.x+e.width,linkJoinY:e=>e.y,linkX:e=>e.x,linkY:e=>e.y,linkCompactXStart:e=>e.x+e.width/2,linkCompactYStart:e=>e.y+(e.compactEven?e.height/2:-e.height/2),compactLinkMidX:(e,t)=>e.firstCompactNode.x,compactLinkMidY:(e,t)=>e.firstCompactNode.y+e.firstCompactNode.flexCompactDim[0]/4+t.compactMarginPair(e)/4,linkParentX:e=>e.parent.x+e.parent.width,linkParentY:e=>e.parent.y,buttonX:e=>e.width,buttonY:e=>e.height/2,centerTransform:({root:e,rootMargin:t,centerY:n,scale:r,centerX:a})=>`translate(${t},${n}) scale(${r})`,compactDimension:{sizeColumn:e=>e.height,sizeRow:e=>e.width,reverse:e=>e.slice().reverse()},nodeFlexSize:({height:e,width:t,siblingsMargin:n,childrenMargin:r,state:a,node:i})=>a.compact&&i.flexCompactDim?[i.flexCompactDim[0],i.flexCompactDim[1]]:[e+n,t+r],zoomTransform:({centerY:e,scale:t})=>`translate(0,${e}) scale(${t})`,diagonal:this.hdiagonal.bind(this),swap:e=>{const t=e.x;e.x=e.y,e.y=t},nodeUpdateTransform:({x:e,y:t,width:n,height:r})=>`translate(${e},${t-r/2})`},top:{nodeLeftX:e=>-e.width/2,nodeRightX:e=>e.width/2,nodeTopY:e=>0,nodeBottomY:e=>e.height,nodeJoinX:e=>e.x-e.width/2,nodeJoinY:e=>e.y+e.height,linkJoinX:e=>e.x,linkJoinY:e=>e.y+e.height,linkCompactXStart:e=>e.x+(e.compactEven?e.width/2:-e.width/2),linkCompactYStart:e=>e.y+e.height/2,compactLinkMidX:(e,t)=>e.firstCompactNode.x+e.firstCompactNode.flexCompactDim[0]/4+t.compactMarginPair(e)/4,compactLinkMidY:e=>e.firstCompactNode.y,compactDimension:{sizeColumn:e=>e.width,sizeRow:e=>e.height,reverse:e=>e},linkX:e=>e.x,linkY:e=>e.y,linkParentX:e=>e.parent.x,linkParentY:e=>e.parent.y+e.parent.height,buttonX:e=>e.width/2,buttonY:e=>e.height,centerTransform:({root:e,rootMargin:t,centerY:n,scale:r,centerX:a})=>`translate(${a},${t}) scale(${r})`,nodeFlexSize:({height:e,width:t,siblingsMargin:n,childrenMargin:r,state:a,node:i,compactViewIndex:o})=>a.compact&&i.flexCompactDim?[i.flexCompactDim[0],i.flexCompactDim[1]]:[t+n,e+r],zoomTransform:({centerX:e,scale:t})=>`translate(${e},0}) scale(${t})`,diagonal:this.diagonal.bind(this),swap:e=>{},nodeUpdateTransform:({x:e,y:t,width:n,height:r})=>`translate(${e-n/2},${t})`},bottom:{nodeLeftX:e=>-e.width/2,nodeRightX:e=>e.width/2,nodeTopY:e=>-e.height,nodeBottomY:e=>0,nodeJoinX:e=>e.x-e.width/2,nodeJoinY:e=>e.y-e.height-e.height,linkJoinX:e=>e.x,linkJoinY:e=>e.y-e.height,linkCompactXStart:e=>e.x+(e.compactEven?e.width/2:-e.width/2),linkCompactYStart:e=>e.y-e.height/2,compactLinkMidX:(e,t)=>e.firstCompactNode.x+e.firstCompactNode.flexCompactDim[0]/4+t.compactMarginPair(e)/4,compactLinkMidY:e=>e.firstCompactNode.y,linkX:e=>e.x,linkY:e=>e.y,compactDimension:{sizeColumn:e=>e.width,sizeRow:e=>e.height,reverse:e=>e},linkParentX:e=>e.parent.x,linkParentY:e=>e.parent.y-e.parent.height,buttonX:e=>e.width/2,buttonY:e=>0,centerTransform:({root:e,rootMargin:t,centerY:n,scale:r,centerX:a,chartHeight:i})=>`translate(${a},${i-t}) scale(${r})`,nodeFlexSize:({height:e,width:t,siblingsMargin:n,childrenMargin:r,state:a,node:i})=>a.compact&&i.flexCompactDim?[i.flexCompactDim[0],i.flexCompactDim[1]]:[t+n,e+r],zoomTransform:({centerX:e,scale:t})=>`translate(${e},0}) scale(${t})`,diagonal:this.diagonal.bind(this),swap:e=>{e.y=-e.y},nodeUpdateTransform:({x:e,y:t,width:n,height:r})=>`translate(${e-n/2},${t-r})`},right:{nodeLeftX:e=>-e.width,nodeRightX:e=>0,nodeTopY:e=>-e.height/2,nodeBottomY:e=>e.height/2,nodeJoinX:e=>e.x-e.width-e.width,nodeJoinY:e=>e.y-e.height/2,linkJoinX:e=>e.x-e.width,linkJoinY:e=>e.y,linkX:e=>e.x,linkY:e=>e.y,linkParentX:e=>e.parent.x-e.parent.width,linkParentY:e=>e.parent.y,buttonX:e=>0,buttonY:e=>e.height/2,linkCompactXStart:e=>e.x-e.width/2,linkCompactYStart:e=>e.y+(e.compactEven?e.height/2:-e.height/2),compactLinkMidX:(e,t)=>e.firstCompactNode.x,compactLinkMidY:(e,t)=>e.firstCompactNode.y+e.firstCompactNode.flexCompactDim[0]/4+t.compactMarginPair(e)/4,centerTransform:({root:e,rootMargin:t,centerY:n,scale:r,centerX:a,chartWidth:i})=>`translate(${i-t},${n}) scale(${r})`,nodeFlexSize:({height:e,width:t,siblingsMargin:n,childrenMargin:r,state:a,node:i})=>a.compact&&i.flexCompactDim?[i.flexCompactDim[0],i.flexCompactDim[1]]:[e+n,t+r],compactDimension:{sizeColumn:e=>e.height,sizeRow:e=>e.width,reverse:e=>e.slice().reverse()},zoomTransform:({centerY:e,scale:t})=>`translate(0,${e}) scale(${t})`,diagonal:this.hdiagonal.bind(this),swap:e=>{const t=e.x;e.x=-e.y,e.y=t},nodeUpdateTransform:({x:e,y:t,width:n,height:r})=>`translate(${e-n},${t-r/2})`}}};this.getChartState=()=>e,Object.keys(e).forEach(t=>{this[t]=function(n){return arguments.length?(e[t]=n,this):e[t]}}),this.initializeEnterExitUpdatePattern()}initializeEnterExitUpdatePattern(){Rp.selection.prototype.patternify=function(e){var t=e.selector,n=e.tag,r=e.data||[t],a=this.selectAll("."+t).data(r,(e,t)=>"object"==typeof e&&e.id?e.id:t);return a.exit().remove(),(a=a.enter().append(n).merge(a)).attr("class",t),a}}getNodeChildren({data:e,children:t,_children:n},r){return r.push(e),t&&t.forEach(e=>{this.getNodeChildren(e,r)}),n&&n.forEach(e=>{this.getNodeChildren(e,r)}),r}initialZoom(e){return this.getChartState().lastTransform.k=e,this}render(){const e=this.getChartState();if(!e.data||0==e.data.length)return e.container&&(fd(e.container).select(".nodes-wrapper").remove(),fd(e.container).select(".links-wrapper").remove(),fd(e.container).select(".connections-wrapper").remove()),this;const t=Rp.select(e.container),n=t.node().getBoundingClientRect();n.width>0&&(e.svgWidth=n.width);const r={id:`ID${Math.floor(1e6*Math.random())}`,chartWidth:e.svgWidth,chartHeight:e.svgHeight};if(e.calc=r,r.centerX=r.chartWidth/2,r.centerY=r.chartHeight/2,e.firstDraw){const t={zoom:null};t.zoom=e.createZoom().clickDistance(10).on("start",(t,n)=>e.onZoomStart(t)).on("end",(t,n)=>e.onZoomEnd(t)).on("zoom",(t,n)=>{e.onZoom(t),this.zoomed(t,n)}).scaleExtent(e.scaleExtent),e.zoomBehavior=t.zoom}e.flexTreeLayout=ap({nodeSize:t=>{const n=e.nodeWidth(t),r=e.nodeHeight(t),a=e.siblingsMargin(t),i=e.childrenMargin(t);return e.layoutBindings[e.layout].nodeFlexSize({state:e,node:t,width:n,height:r,siblingsMargin:a,childrenMargin:i})}}).spacing((t,n)=>t.parent==n.parent?0:e.neighbourMargin(t,n)),this.setLayouts({expandNodesFirst:!1});const a=t.patternify({tag:"svg",selector:"svg-chart-container"}).attr("width",e.svgWidth).attr("height",e.svgHeight).attr("font-family",e.defaultFont);e.firstDraw&&a.call(e.zoomBehavior).on("dblclick.zoom",null).attr("cursor","move"),e.svg=a;const i=a.patternify({tag:"g",selector:"chart"});return e.centerG=i.patternify({tag:"g",selector:"center-group"}),e.linksWrapper=e.centerG.patternify({tag:"g",selector:"links-wrapper"}),e.nodesWrapper=e.centerG.patternify({tag:"g",selector:"nodes-wrapper"}),e.connectionsWrapper=e.centerG.patternify({tag:"g",selector:"connections-wrapper"}),e.defsWrapper=a.patternify({tag:"g",selector:"defs-wrapper"}),e.firstDraw&&e.centerG.attr("transform",()=>e.layoutBindings[e.layout].centerTransform({centerX:r.centerX,centerY:r.centerY,scale:e.lastTransform.k,rootMargin:e.rootMargin,root:e.root,chartHeight:r.chartHeight,chartWidth:r.chartWidth})),e.chart=i,this.update(e.root),Rp.select(window).on(`resize.${e.id}`,()=>{const t=Rp.select(e.container).node().getBoundingClientRect();e.svg.attr("width",t.width)}),e.firstDraw&&(e.firstDraw=!1),this}addNode(e){const t=this.getChartState();if(e&&(null==t.parentNodeId(e)||t.parentNodeId(e)==t.nodeId(e))&&0==t.data.length)return t.data.push(e),this.render(),this;const n=t.generateRoot(t.data).descendants(),r=n.filter(({data:n})=>t.nodeId(n).toString()===t.nodeId(e).toString())[0];return n.filter(({data:n})=>t.nodeId(n).toString()===t.parentNodeId(e).toString())[0],r||(e._centered&&!e._expanded&&(e._expanded=!0),t.data.push(e),this.updateNodesState()),this}removeNode(e){const t=this.getChartState(),n=t.generateRoot(t.data).descendants().filter(({data:n})=>t.nodeId(n)==e)[0];return n?(n.descendants().forEach(e=>e.data._filteredOut=!0),t.data=t.data.filter(e=>!e._filteredOut),0==t.data.length?this.render():this.updateNodesState.bind(this)(),this):this}groupBy(e,t,n){const r={};return e.forEach(e=>{const n=t(e);r[n]||(r[n]=[]),r[n].push(e)}),Object.keys(r).forEach(e=>{r[e]=n(r[e])}),Object.entries(r)}calculateCompactFlexDimensions(e){const t=this.getChartState();e.eachBefore(e=>{e.firstCompact=null,e.compactEven=null,e.flexCompactDim=null,e.firstCompactNode=null}),e.eachBefore(e=>{if(e.children&&e.children.length>1){const n=e.children.filter(e=>!e.children);if(n.length<2)return;n.forEach((e,t)=>{t||(e.firstCompact=!0),e.compactEven=!(t%2),e.row=Math.floor(t/2)});const r=Rp.max(n.filter(e=>e.compactEven),t.layoutBindings[t.layout].compactDimension.sizeColumn),a=Rp.max(n.filter(e=>!e.compactEven),t.layoutBindings[t.layout].compactDimension.sizeColumn),i=2*Math.max(r,a),o=this.groupBy(n,e=>e.row,e=>Rp.max(e,e=>t.layoutBindings[t.layout].compactDimension.sizeRow(e)+t.compactMarginBetween(e))),s=Rp.sum(o.map(e=>e[1]));n.forEach(e=>{e.firstCompactNode=n[0],e.firstCompact?e.flexCompactDim=[i+t.compactMarginPair(e),s-t.compactMarginBetween(e)]:e.flexCompactDim=[0,0]}),e.flexCompactDim=null}})}calculateCompactFlexPositions(e){const t=this.getChartState();e.eachBefore(e=>{if(e.children){const n=e.children.filter(e=>e.flexCompactDim),r=n[0];if(!r)return;n.forEach((e,n,a)=>{0==n&&(r.x-=r.flexCompactDim[0]/2),n&n%2-1?e.x=r.x+.25*r.flexCompactDim[0]-t.compactMarginPair(e)/4:n&&(e.x=r.x+.75*r.flexCompactDim[0]+t.compactMarginPair(e)/4)});const a=r.x+.5*r.flexCompactDim[0];r.x=r.x+.25*r.flexCompactDim[0]-t.compactMarginPair(r)/4;const i=e.x-a;Math.abs(i)<10&&n.forEach(e=>e.x+=i);const o=this.groupBy(n,e=>e.row,e=>Rp.max(e,e=>t.layoutBindings[t.layout].compactDimension.sizeRow(e))),s=Rp.cumsum(o.map(e=>e[1]+t.compactMarginBetween(e)));n.forEach((e,t)=>{e.row?e.y=r.y+s[e.row-1]:e.y=r.y})}})}update({x0:e,y0:t,x:n=0,y:r=0,width:a,height:i}){const o=this.getChartState();o.calc,o.compact&&this.calculateCompactFlexDimensions(o.root);const s=o.flexTreeLayout(o.root);o.compact&&this.calculateCompactFlexPositions(o.root);const l=s.descendants(),c=s.descendants().slice(1);l.forEach(o.layoutBindings[o.layout].swap);const d=o.connections,u={};o.allNodes.forEach(e=>u[o.nodeId(e.data)]=e);const f={};l.forEach(e=>f[o.nodeId(e.data)]=e),d.forEach(e=>{const t=u[e.from],n=u[e.to];e._source=t,e._target=n});const p=d.filter(e=>f[e.from]&&f[e.to]),h=o.defs.bind(this)(o,p);h!==o.defsWrapper.html()&&o.defsWrapper.html(h);const m=o.linksWrapper.selectAll("path.link").data(c,e=>o.nodeId(e.data)),g=m.enter().insert("path","g").attr("class","link").attr("d",n=>{const r={x:o.layoutBindings[o.layout].linkJoinX({x:e,y:t,width:a,height:i}),y:o.layoutBindings[o.layout].linkJoinY({x:e,y:t,width:a,height:i})};return o.layoutBindings[o.layout].diagonal(r,r,r)}).merge(m);g.attr("fill","none"),this.isEdge()?g.style("display",e=>e.data._pagingButton?"none":"auto"):g.attr("display",e=>e.data._pagingButton?"none":"auto"),g.each(o.linkUpdate),g.transition().duration(o.duration).attr("d",e=>{const t=o.compact&&e.flexCompactDim?{x:o.layoutBindings[o.layout].compactLinkMidX(e,o),y:o.layoutBindings[o.layout].compactLinkMidY(e,o)}:{x:o.layoutBindings[o.layout].linkX(e),y:o.layoutBindings[o.layout].linkY(e)},n={x:o.layoutBindings[o.layout].linkParentX(e),y:o.layoutBindings[o.layout].linkParentY(e)},r=o.compact&&e.flexCompactDim?{x:o.layoutBindings[o.layout].linkCompactXStart(e),y:o.layoutBindings[o.layout].linkCompactYStart(e)}:t;return o.layoutBindings[o.layout].diagonal(t,n,r,{sy:o.linkYOffset})}),m.exit().transition().duration(o.duration).attr("d",e=>{const t={x:o.layoutBindings[o.layout].linkJoinX({x:n,y:r,width:a,height:i}),y:o.layoutBindings[o.layout].linkJoinY({x:n,y:r,width:a,height:i})};return o.layoutBindings[o.layout].diagonal(t,t,null,{sy:o.linkYOffset})}).remove();const v=o.connectionsWrapper.selectAll("path.connection").data(p),b=v.enter().insert("path","g").attr("class","connection").attr("d",n=>{const r={x:o.layoutBindings[o.layout].linkJoinX({x:e,y:t,width:a,height:i}),y:o.layoutBindings[o.layout].linkJoinY({x:e,y:t,width:a,height:i})};return o.layoutBindings[o.layout].diagonal(r,r,null,{sy:o.linkYOffset})}).merge(v);b.attr("fill","none"),b.transition().duration(o.duration).attr("d",e=>{const t=o.layoutBindings[o.layout].linkX({x:e._source.x,y:e._source.y,width:e._source.width,height:e._source.height}),n=o.layoutBindings[o.layout].linkY({x:e._source.x,y:e._source.y,width:e._source.width,height:e._source.height}),r=o.layoutBindings[o.layout].linkJoinX({x:e._target.x,y:e._target.y,width:e._target.width,height:e._target.height}),a=o.layoutBindings[o.layout].linkJoinY({x:e._target.x,y:e._target.y,width:e._target.width,height:e._target.height});return o.linkGroupArc({source:{x:t,y:n},target:{x:r,y:a}})}),b.each(o.connectionsUpdate),v.exit().transition().duration(o.duration).attr("opacity",0).remove();const y=o.nodesWrapper.selectAll("g.node").data(l,({data:e})=>o.nodeId(e)),x=y.enter().append("g").attr("class","node").attr("transform",n=>n==o.root?`translate(${e},${t})`:`translate(${o.layoutBindings[o.layout].nodeJoinX({x:e,y:t,width:a,height:i})},${o.layoutBindings[o.layout].nodeJoinY({x:e,y:t,width:a,height:i})})`).attr("cursor","pointer").on("click.node",(e,t)=>{const{data:n}=t;[...e.srcElement.classList].includes("node-button-foreign-object")||([...e.srcElement.classList].includes("paging-button-wrapper")?this.loadPagingNodes(t):n._pagingButton||o.onNodeClick(t))}).on("keydown.node",(e,t)=>{const{data:n}=t;if("Enter"===e.key||" "===e.key||"Spacebar"===e.key){if([...e.srcElement.classList].includes("node-button-foreign-object"))return;if([...e.srcElement.classList].includes("paging-button-wrapper"))return void this.loadPagingNodes(t);"Enter"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||this.onButtonClick(e,t)}});x.each(o.nodeEnter),x.patternify({tag:"rect",selector:"node-rect",data:e=>[e]});const w=x.merge(y).style("font","12px sans-serif");w.patternify({tag:"foreignObject",selector:"node-foreign-object",data:e=>[e]}).style("overflow","visible").patternify({tag:"xhtml:div",selector:"node-foreign-object-div",data:e=>[e]}),this.restyleForeignObjectElements();const k=x.patternify({tag:"g",selector:"node-button-g",data:e=>[e]}).on("click",(e,t)=>this.onButtonClick(e,t)).on("keydown",(e,t)=>{"Enter"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||this.onButtonClick(e,t)});k.patternify({tag:"rect",selector:"node-button-rect",data:e=>[e]}).attr("opacity",0).attr("pointer-events","all").attr("width",e=>o.nodeButtonWidth(e)).attr("height",e=>o.nodeButtonHeight(e)).attr("x",e=>o.nodeButtonX(e)).attr("y",e=>o.nodeButtonY(e)),k.patternify({tag:"foreignObject",selector:"node-button-foreign-object",data:e=>[e]}).attr("width",e=>o.nodeButtonWidth(e)).attr("height",e=>o.nodeButtonHeight(e)).attr("x",e=>o.nodeButtonX(e)).attr("y",e=>o.nodeButtonY(e)).style("overflow","visible").patternify({tag:"xhtml:div",selector:"node-button-div",data:e=>[e]}).style("pointer-events","none").style("display","flex").style("width","100%").style("height","100%"),w.transition().attr("opacity",0).duration(o.duration).attr("transform",({x:e,y:t,width:n,height:r})=>o.layoutBindings[o.layout].nodeUpdateTransform({x:e,y:t,width:n,height:r})).attr("opacity",1),w.select(".node-rect").attr("width",({width:e})=>e).attr("height",({height:e})=>e).attr("x",({width:e})=>0).attr("y",({height:e})=>0).attr("cursor","pointer").attr("rx",3).attr("fill",o.nodeDefaultBackground),w.select(".node-button-g").attr("transform",({data:e,width:t,height:n})=>`translate(${o.layoutBindings[o.layout].buttonX({width:t,height:n})},${o.layoutBindings[o.layout].buttonY({width:t,height:n})})`).attr("display",({data:e})=>e._directSubordinates>0?null:"none").attr("opacity",({data:e,children:t,_children:n})=>e._pagingButton?0:t||n?1:0),w.select(".node-button-foreign-object .node-button-div").html(e=>o.buttonContent({node:e,state:o})),w.select(".node-button-text").attr("text-anchor","middle").attr("alignment-baseline","middle").attr("font-size",({children:e})=>e?40:26).text(({children:e})=>e?"-":"+").attr("y",this.isEdge()?10:0),w.each(o.nodeUpdate);const _=y.exit();_.each(o.nodeExit);const N=_.data().reduce((e,t)=>e.depth<t.depth?e:t,{depth:1/0});_.attr("opacity",1).transition().duration(o.duration).attr("transform",e=>{let{x:t,y:n,width:r,height:a}=N.parent||{};return`translate(${o.layoutBindings[o.layout].nodeJoinX({x:t,y:n,width:r,height:a})},${o.layoutBindings[o.layout].nodeJoinY({x:t,y:n,width:r,height:a})})`}).on("end",function(){Rp.select(this).remove()}).attr("opacity",0),l.forEach(e=>{e.x0=e.x,e.y0=e.y});const z=o.allNodes.filter(e=>e.data._centered)[0];if(z){let e=[z];z.data._centeredWithDescendants&&(e=o.compact?z.descendants().filter((e,t)=>t<7):z.descendants().filter((e,t,n)=>{const r=Math.round(n.length/2);return n.length%2?t>r-2&&t<r+2-1:t>r-2&&t<r+2})),z.data._centeredWithDescendants=null,z.data._centered=null,this.fit({animate:!0,scale:!1,nodes:e})}}isEdge(){return window.navigator.userAgent.includes("Edge")}hdiagonal(e,t,n,r){return this.getChartState().hdiagonal(e,t,n,r)}diagonal(e,t,n,r){return this.getChartState().diagonal(e,t,n,r)}restyleForeignObjectElements(){const e=this.getChartState();e.svg.selectAll(".node-foreign-object").attr("width",({width:e})=>e).attr("height",({height:e})=>e).attr("x",({width:e})=>0).attr("y",({height:e})=>0),e.svg.selectAll(".node-foreign-object-div").style("width",({width:e})=>`${e}px`).style("height",({height:e})=>`${e}px`).html(function(t,n,r){return t.data._pagingButton?`<div class="paging-button-wrapper"><div style="pointer-events:none">${e.pagingButton(t,n,r,e)}</div></div>`:e.nodeContent.bind(this)(t,n,r,e)})}onButtonClick(e,t){const n=this.getChartState();t.data._pagingButton||(n.setActiveNodeCentered&&(t.data._centered=!0,t.data._centeredWithDescendants=!0),t.children?(t._children=t.children,t.children=null,this.setExpansionFlagToChildren(t,!1)):(t.children=t._children,t._children=null,t.children&&t.children.forEach(({data:e})=>e._expanded=!0)),this.update(t),e.stopPropagation(),n.onExpandOrCollapse(t))}setExpansionFlagToChildren({data:e,children:t,_children:n},r){e._expanded=r,t&&t.forEach(e=>{this.setExpansionFlagToChildren(e,r)}),n&&n.forEach(e=>{this.setExpansionFlagToChildren(e,r)})}expandSomeNodes(e){if(e.data._expanded){let t=e.parent;for(;t&&t._children;)t.children=t._children,t._children=null,t=t.parent}e._children&&e._children.forEach(e=>this.expandSomeNodes(e)),e.children&&e.children.forEach(e=>this.expandSomeNodes(e))}updateNodesState(){const e=this.getChartState();this.setLayouts({expandNodesFirst:!0}),this.update(e.root)}setLayouts({expandNodesFirst:e=!0}){const t=this.getChartState();t.generateRoot=Rp.stratify().id(e=>t.nodeId(e)).parentId(e=>t.parentNodeId(e)),t.root=t.generateRoot(t.data);const n=t.root.descendants();t.initialExpandLevel>1&&n.length>0&&(n.forEach(e=>{e.depth<=t.initialExpandLevel&&(e.data._expanded=!0)}),t.initialExpandLevel=1);const r={};t.root.descendants().filter(e=>e.children).filter(e=>!e.data._pagingStep).forEach(e=>{e.data._pagingStep=t.minPagingVisibleNodes(e)}),t.root.eachBefore((e,t)=>{e.data._directSubordinatesPaging=e.children?e.children.length:0,e.children&&e.children.forEach((t,n)=>{if(t.data._pagingButton=!1,n>e.data._pagingStep&&(r[t.id]=!0),n===e.data._pagingStep&&e.children.length-1>e.data._pagingStep&&(t.data._pagingButton=!0),r[t.parent.id]&&(r[t.id]=!0),t.data._expanded||t.data._centered||t.data._highlighted||t.data._upToTheRootHighlighted){let e=t;for(;e&&(r[e.id]||e.data._pagingButton);)r[e.id]=!1,e.data._pagingButton&&(e.data._pagingButton=!1,e.parent.children.forEach(e=>{e.data._expanded=!0,r[e.id]=!1})),e=e.parent}})}),t.root=Rp.stratify().id(e=>t.nodeId(e)).parentId(e=>t.parentNodeId(e))(t.data.filter(e=>!0!==r[e.id])),t.root.each((e,n,r)=>{let a=e._hierarchyHeight||e.height,i=t.nodeWidth(e),o=t.nodeHeight(e);Object.assign(e,{width:i,height:o,_hierarchyHeight:a})}),t.root.x0=0,t.root.y0=0,t.allNodes=t.root.descendants(),t.allNodes.forEach(e=>{Object.assign(e.data,{_directSubordinates:e.children?e.children.length:0,_totalSubordinates:e.descendants().length-1})}),t.root.children&&(e&&t.root.children.forEach(this.expand),t.root.children.forEach(e=>this.collapse(e)),0==t.initialExpandLevel&&(t.root._children=t.root.children,t.root.children=null),[t.root].forEach(e=>this.expandSomeNodes(e)))}collapse(e){e.children&&(e._children=e.children,e._children.forEach(e=>this.collapse(e)),e.children=null)}expand(e){e._children&&(e.children=e._children,e.children.forEach(e=>this.expand(e)),e._children=null)}zoomed(e,t){const n=this.getChartState(),r=n.chart,a=e.transform;n.lastTransform=a,r.attr("transform",a),this.isEdge()&&this.restyleForeignObjectElements()}zoomTreeBounds({x0:e,x1:t,y0:n,y1:r,params:a={animate:!0,scale:!0,onCompleted:()=>{}}}){const{centerG:i,svgWidth:o,svgHeight:s,svg:l,zoomBehavior:c,duration:d,lastTransform:u}=this.getChartState();let f=Math.min(8,.9/Math.max((t-e)/o,(r-n)/s)),p=Rp.zoomIdentity.translate(o/2,s/2);p=p.scale(a.scale?f:u.k),p=p.translate(-(e+t)/2,-(n+r)/2),l.transition().duration(a.animate?d:0).call(c.transform,p),i.transition().duration(a.animate?d:0).attr("transform","translate(0,0)").on("end",function(){a.onCompleted&&a.onCompleted()})}fit({animate:e=!0,nodes:t,scale:n=!0,onCompleted:r=()=>{}}={}){const a=this.getChartState(),{root:i}=a;let o=t||i.descendants();const s=Rp.min(o,e=>e.x+a.layoutBindings[a.layout].nodeLeftX(e)),l=Rp.max(o,e=>e.x+a.layoutBindings[a.layout].nodeRightX(e)),c=Rp.min(o,e=>e.y+a.layoutBindings[a.layout].nodeTopY(e)),d=Rp.max(o,e=>e.y+a.layoutBindings[a.layout].nodeBottomY(e));return this.zoomTreeBounds({params:{animate:e,scale:n,onCompleted:r},x0:s-50,x1:l+50,y0:c-50,y1:d+50}),this}loadPagingNodes(e){const t=this.getChartState();e.data._pagingButton=!1;const n=e.parent.data._pagingStep+t.pagingStep(e.parent);e.parent.data._pagingStep=n,this.updateNodesState()}setExpanded(e,t=!0){const n=this.getChartState(),r=n.allNodes.filter(({data:t})=>n.nodeId(t)==e)[0];if(!r)return this;if(r.data._expanded=t,0==t){const e=r.parent||{descendants:()=>[]};e.descendants().filter(t=>t!=e).forEach(e=>e.data._expanded=!1)}return this}setCentered(e){const t=this.getChartState(),n=t.generateRoot(t.data).descendants().filter(({data:n})=>t.nodeId(n).toString()==e.toString())[0];return n?(n.ancestors().forEach(e=>e.data._expanded=!0),n.data._centered=!0,n.data._expanded=!0,this):this}setHighlighted(e){const t=this.getChartState(),n=t.generateRoot(t.data).descendants().filter(n=>t.nodeId(n.data).toString()===e.toString())[0];return n?(n.ancestors().forEach(e=>e.data._expanded=!0),n.data._highlighted=!0,n.data._expanded=!0,n.data._centered=!0,this):this}setUpToTheRootHighlighted(e){const t=this.getChartState(),n=t.generateRoot(t.data).descendants().filter(n=>t.nodeId(n.data).toString()===e.toString())[0];return n?(n.ancestors().forEach(e=>e.data._expanded=!0),n.data._upToTheRootHighlighted=!0,n.data._expanded=!0,n.ancestors().forEach(e=>e.data._upToTheRootHighlighted=!0),this):this}clearHighlighting(){const e=this.getChartState();return e.allNodes.forEach(e=>{e.data._highlighted=!1,e.data._upToTheRootHighlighted=!1}),this.update(e.root),this}fullscreen(e){const t=this.getChartState(),n=Rp.select(e||t.container).node();Rp.select(document).on("fullscreenchange."+t.id,function(e){(document.fullscreenElement||document.mozFullscreenElement||document.webkitFullscreenElement)==n?setTimeout(e=>{t.svg.attr("height",window.innerHeight-40)},500):t.svg.attr("height",t.svgHeight)}),n.requestFullscreen?n.requestFullscreen():n.mozRequestFullScreen?n.mozRequestFullScreen():n.webkitRequestFullscreen?n.webkitRequestFullscreen():n.msRequestFullscreen&&n.msRequestFullscreen()}zoomIn(){const{svg:e,zoomBehavior:t}=this.getChartState();e.transition().call(t.scaleBy,1.3)}zoomOut(){const{svg:e,zoomBehavior:t}=this.getChartState();e.transition().call(t.scaleBy,.78)}toDataURL(e,t){var n=new XMLHttpRequest;n.onload=function(){var e=new FileReader;e.onloadend=function(){t(e.result)},e.readAsDataURL(n.response)},n.open("GET",e),n.responseType="blob",n.send()}exportImg({full:e=!1,scale:t=3,onLoad:n=e=>e,save:r=!0,backgroundColor:a="#FAFAFA"}={}){const i=this,o=this.getChartState(),{svg:s,root:l}=o;let c=0;const d=s.selectAll("img");let u=d.size();const f=()=>{JSON.parse(JSON.stringify(i.lastTransform()));const s=i.duration();e&&i.fit();const{svg:c}=i.getChartState();setTimeout(e=>{i.downloadImage({node:c.node(),scale:t,isSvg:!1,backgroundColor:a,onAlreadySerialized:e=>{i.update(l)},imageName:o.imageName,onLoad:n,save:r})},e?s+10:0)};u>0?d.each(function(){i.toDataURL(this.src,e=>{this.src=e,++c==u&&f()})}):f()}exportSvg(){const{svg:e,imageName:t}=this.getChartState();return this.downloadImage({imageName:t,node:e.node(),scale:3,isSvg:!0}),this}expandAll(){const{allNodes:e,root:t,data:n}=this.getChartState();return n.forEach(e=>e._expanded=!0),this.render(),this}collapseAll(){const{allNodes:e,root:t}=this.getChartState();return e.forEach(e=>e.data._expanded=!1),this.initialExpandLevel(0),this.render(),this}downloadImage({node:e,scale:t=2,imageName:n="graph",isSvg:r=!1,save:a=!0,backgroundColor:i="#FAFAFA",onAlreadySerialized:o=e=>{},onLoad:s=e=>{}}){const l=e;function c(e,t){var n=document.createElement("a");"string"==typeof n.download?(document.body.appendChild(n),n.download=t,n.href=e,n.click(),document.body.removeChild(n)):location.replace(e)}function d(e){const t="http://www.w3.org/2000/xmlns/";e=e.cloneNode(!0);const n=window.location.href+"#",r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,null,!1);for(;r.nextNode();)for(const e of r.currentNode.attributes)e.value.includes(n)&&(e.value=e.value.replace(n,"#"));return e.setAttributeNS(t,"xmlns","http://www.w3.org/2000/svg"),e.setAttributeNS(t,"xmlns:xlink","http://www.w3.org/1999/xlink"),(new XMLSerializer).serializeToString(e)}if(r){let e=d(l);return e='<?xml version="1.0" standalone="no"?>\r\n'+e,c(p="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(e),n+".svg"),void o()}const u=t,f=document.createElement("img");f.onload=function(){const e=document.createElement("canvas"),t=l.getBoundingClientRect();e.width=t.width*u,e.height=t.height*u;const r=e.getContext("2d");r.fillStyle=i,r.fillRect(0,0,t.width*u,t.height*u),r.drawImage(f,0,0,t.width*u,t.height*u);let o=e.toDataURL("image/png");s&&s(o),a&&c(o,n+".png")};var p="data:image/svg+xml; charset=utf8, "+encodeURIComponent(d(l));o(),f.src=p}getTextWidth(e,{fontSize:t=14,fontWeight:n=400,defaultFont:r="Helvetice",ctx:a}={}){return a.font=`${n||""} ${t}px ${r} `,a.measureText(e).width}clear(){const e=this.getChartState();Rp.select(window).on(`resize.${e.id}`,null),e.svg&&e.svg.selectAll("*").remove()}},Op="var(--border-color-primary)",Lp="var(--border-color-danger)",Ap="var(--border-color-default)",Bp="var(--text-color-default)",Pp="var(--text-color-caption)",Ip="var(--background-color-primary-inverted)",Vp="var(--border-color-primary)",Dp="var(--text-color-primary)",Hp="var(--text-color-primary)",Xp="var(--background-color-primary)",Fp="var(--border-color-primary)",Wp="var(--text-color-white)",Yp=e=>{if("undefined"==typeof window||"undefined"==typeof document||!e)return e;if(e.startsWith("var(")){const t=e.slice(4,-1).trim(),n=window.getComputedStyle(document.documentElement).getPropertyValue(t).trim()||document.documentElement.style.getPropertyValue(t);if(n&&n!==e)return Yp(n.trim())}const t=document.createElement("span");t.style.color=e,t.style.position="absolute",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t);const n=window.getComputedStyle(t).color;return t.remove(),n||e},qp=e=>{const t=e.match(/rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i);if(t)return t.slice(1,4).map(e=>Number(e));const n=e.match(/^#([\da-f]{6}|[\da-f]{3})$/i);if(!n)return null;const r=3===n[1].length?n[1].split("").map(e=>`${e}${e}`).join(""):n[1];return[Number.parseInt(r.slice(0,2),16),Number.parseInt(r.slice(2,4),16),Number.parseInt(r.slice(4,6),16)]},Up=(e,t,n)=>{const r=Yp(e),a=Yp(t),i=qp(r),o=qp(a);if(!i||!o)return`color-mix(in srgb, ${e} ${Math.round(100*n)}%, ${t} ${Math.round(100*(1-n))}%)`;const s=i.map((e,t)=>Math.round(e*n+o[t]*(1-n)));return`rgb(${s[0]}, ${s[1]}, ${s[2]})`},Gp=()=>({secured:Yp(Op),unsecured:Yp(Lp),surface:Up("var(--background-color-default)","var(--text-color-white)",.86),border:Yp(Ap),textPrimary:Yp(Bp),textSecondary:Yp(Pp),chipBackground:Yp(Ip),chipBorder:Yp(Vp),chipText:Yp(Dp),chipTextStrong:Yp(Hp),chipBackgroundActive:Yp(Xp),chipBorderActive:Yp(Fp),chipTextOnActive:Yp(Wp)}),Kp=e=>e?e.replace(/_/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\s+/g," ").trim():"—",Zp=e=>{const t=Kp(e);return"—"===t||"not applicable"===t.toLowerCase()?null:t},Jp=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),Qp=e=>(e=>"entityName"in e)(e)?{id:e.id,parentId:e.parent?.id??null,name:e.entityName,position:e.entityType??"Entity",countryCode:e.country?.country_code??null,countryName:e.country?.name??null,entityType:e.entityType??null,role:e.role??null,revenue:e.revenue??null,revenueShare:e.revenueAllocPct??null,securityPosition:e.securityPosition??null}:{...e,countryName:e.countryName??e.location??e.position,entityType:e.entityType??e.position,role:e.role??null,securityPosition:e.securityPosition??"Secured"},eh=(e,t,n)=>{const r="Borrower"===Zp(e.role),a="Unsecured"===e.securityPosition,i=(o=e.countryCode)&&2===o.length?`https://flagcdn.com/24x18/${o.toLowerCase()}.png`:null;var o;const s=void 0!==e.revenue?"Revenue":"Headcount",l=void 0!==e.revenue?(e=>{if(null==e)return"-";if(e>=1e6){const t=e/1e6;return`$${new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(t).replace(/\.0+$/,"").replace(/(\.\d*[1-9])0+$/,"$1")} M`}return`$${new Intl.NumberFormat("en-US").format(e)}`})(e.revenue):e.headcount||"-",c=void 0!==e.revenue?null==(d=e.revenueShare)?null:`${Math.round(100*d)}% of group`:null;var d;const u=(e=>{const t=[],n=e.entityType?Kp(e.entityType):e.position,r=Zp(e.role);return n&&"—"!==n&&t.push(n),r&&"Borrower"!==r&&t.push(r),!t.length&&e.companyCode&&t.push(e.companyCode),t})(e),f=e.countryName??e.location??e.position,p=Gp();return`\n <div style="\n box-sizing: border-box;\n position: absolute;\n width: ${t}px;\n height: ${n}px;\n border-radius: 16px;\n border: 2px ${a?"dashed":"solid"} ${a?p.unsecured:p.secured};\n background: ${p.surface};\n font-family: var(--font-body);\n color: ${p.textPrimary};\n padding: 20px;\n overflow: visible;\n ">\n ${r?`<div style="\n position: absolute;\n top: -20px;\n right: 24px;\n border: 2px solid ${p.chipBorder};\n border-radius: 999px;\n background: ${p.chipBackground};\n padding: 8px 16px;\n color: ${p.chipText};\n font-size: 14px;\n font-weight: 700;\n line-height: 1;\n text-transform: uppercase;\n ">BORROWER</div>`:""}\n <div style="font-size: 18px; font-weight: 700; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;" title="${Jp(e.name)}">${Jp(e.name)}</div>\n <div style="display:flex; align-items:center; gap:10px; margin-top:16px; font-size:14px; line-height:20px; color:${p.textPrimary}; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">\n ${i?`<img src="${i}" alt="" width="24" height="18" style="display:block; border-radius:2px; flex:0 0 auto;" />`:""}\n <span style="overflow:hidden; text-overflow:ellipsis;">${Jp(f)}</span>\n </div>\n <div style="margin-top:20px; font-size:16px; line-height:24px; color:${p.textSecondary}; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">\n ${s}: <span style="font-weight:700; color:${p.textPrimary};">${Jp(l)}</span>\n ${c?`<span> (${Jp(c)})</span>`:""}\n </div>\n <div style="height:1px; margin:18px 0 16px; background:${p.border};"></div>\n <div style="display:flex; flex-wrap:wrap; gap:8px;">\n ${u.map(e=>`<span style="\n display:inline-flex;\n align-items:center;\n width:fit-content;\n max-width:100%;\n padding:6px 12px;\n border:2px solid ${p.chipBorder};\n border-radius:999px;\n background:${p.chipBackground};\n color:${p.chipText};\n font-size:13px;\n font-weight:700;\n line-height:1.2;\n white-space:normal;\n overflow-wrap:anywhere;\n text-align:center;\n " title="${Jp(e)}">${Jp(e)}</span>`).join("")}\n </div>\n </div>\n `},th=[{label:"Secured Entity",indicatorClassName:"border-primary"},{label:"Unsecured Entity",indicatorClassName:"border-danger border-dashed"}],nh=(0,Ve.forwardRef)(function({data:e,orientation:t,onOrientationChange:n,initialDepth:r=1,imageName:a="organization-chart",onNodeClick:i,onZoomChange:o,className:s,emptyMessage:l="No organization chart data available.",showZoomBadge:c=!0,dataTestId:d,...u},f){const p=(0,Ve.useRef)(null),h=(0,Ve.useRef)(null),m=(0,Ve.useRef)(null),g=(0,Ve.useRef)(null),[v,b]=(0,Ve.useState)(t??"top"),[y,x]=(0,Ve.useState)({width:0,height:0}),w=(0,Ve.useMemo)(()=>e.map(Qp),[e]),k=t??v,_=(0,Ve.useCallback)(e=>{void 0===t&&b(e),n?.(e)},[t,n]);return(0,Ve.useImperativeHandle)(f,()=>({zoomIn:()=>m.current?.zoomIn(),zoomOut:()=>m.current?.zoomOut(),resetZoom:()=>{m.current?.render().fit()},resetLevel:()=>{m.current?.collapseAll().initialExpandLevel(r).render().fit()},resetOrientation:()=>{_("top")},exportImg:()=>m.current?.exportImg({full:!0}),exportSvg:()=>{m.current&&(m.current.render().fit(),window.setTimeout(()=>{m.current?.exportSvg()},1e3))},expandAll:()=>{m.current?.expandAll().fit()},collapseAll:()=>{m.current?.collapseAll().fit()}}),[_,r]),(0,Ve.useLayoutEffect)(()=>{const e=p.current,t=h.current;if(!t||!e||0===w.length)return;t.replaceChildren();const n=new Tp;return m.current=n,n.container(t).data(w).layout(k).imageName(a).initialExpandLevel(r).svgHeight(Math.max(e.clientHeight,720)).nodeWidth(()=>445).nodeHeight(()=>215).childrenMargin(()=>64).siblingsMargin(()=>80).neighbourMargin(()=>96).compact(!1).buttonContent(({node:e})=>(e=>{const t=e.data._directSubordinates??0,n=Boolean(e.children),r=Gp(),a=n?r.chipBackground:r.chipBackgroundActive;return`\n <div style="\n display:flex;\n align-items:center;\n justify-content:center;\n min-width:32px;\n height:32px;\n margin:auto;\n border:2px solid ${n?r.chipBorder:r.chipBorderActive};\n border-radius:999px;\n background:${a};\n color:${n?r.chipTextStrong:r.chipTextOnActive};\n font-family:var(--font-body);\n font-size:13px;\n font-weight:700;\n line-height:1;\n box-sizing:border-box;\n padding:0 10px;\n ">${t}</div>\n `})(e)).nodeButtonWidth(()=>44).nodeButtonHeight(()=>32).nodeUpdate((e,t,n)=>{const r=n[t],a=r.querySelector(".node-button-g"),i=r.querySelector(".node-button-circle"),o=r.querySelector(".node-button-text");a?.setAttribute("display",""),i&&(i.setAttribute("fill","transparent"),i.setAttribute("stroke","transparent")),o&&o.setAttribute("display","none")}).linkUpdate((e,t,n)=>{const r=n[t];r.setAttribute("stroke",Yp("var(--border-color-default)")),r.setAttribute("stroke-width","2"),r.setAttribute("fill","none")}).onZoom(e=>{const t=Math.round(100*(e.transform?.k??1));g.current&&(g.current.textContent=`Zoom: ${t}%`),o?.(t)}).onNodeClick(e=>{e?.id&&i?.(String(e.id))}).nodeContent(e=>eh(e.data,445,215)).render().fit(),()=>{n.clear(),m.current===n&&(m.current=null),t.replaceChildren()}},[a,r,w,i,o,k]),(0,Ve.useLayoutEffect)(()=>{const e=p.current;if(!e||0===w.length)return;const t=()=>{x({width:e.clientWidth,height:e.clientHeight})};t();const n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[w.length]),(0,Ve.useLayoutEffect)(()=>{m.current&&y.width&&y.height&&0!==w.length&&m.current.render().fit()},[y.height,y.width,w.length]),0===w.length?/* @__PURE__ */ /* @__PURE__ */(0,ft.jsx)("div",{...u,"data-test-id":d,ref:p,className:$e("flex h-full min-h-60 w-full min-w-0 items-center justify-center rounded-md bg-primary p-6 text-base text-caption",s),children:l}):/* @__PURE__ */ /* @__PURE__ */(0,ft.jsxs)("div",{...u,"data-test-id":d,ref:p,className:$e("relative h-full w-full min-h-0 min-w-0 overflow-hidden rounded-md bg-default",s),children:[
134
134
  /* @__PURE__ */
135
- /* @__PURE__ */(0,ft.jsx)("div",{className:"pointer-events-none absolute bottom-6 right-6 z-10 px-3 py-2",children:/* @__PURE__ */ /* @__PURE__ */(0,ft.jsx)("div",{className:"flex items-center gap-3 text-sm text-default",children:Jp.map(e=>/* @__PURE__ */ /* @__PURE__ */(0,ft.jsxs)("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */ /* @__PURE__ */(0,ft.jsx)("span",{"aria-hidden":"true",className:$e("block h-4 w-4 rounded-[4px] border-2 bg-transparent",e.indicatorClassName)}),/* @__PURE__ */ /* @__PURE__ */(0,ft.jsx)("span",{children:e.label})]},e.label))})}),c?/* @__PURE__ */ /* @__PURE__ */(0,ft.jsx)("div",{ref:g,className:"pointer-events-none absolute bottom-6 left-6 z-10 rounded-full bg-black/85 px-3.5 py-2 text-sm font-semibold tracking-[0.5px] text-white shadow-lg backdrop-blur-sm",children:"Zoom: 100%"}):null,
135
+ /* @__PURE__ */(0,ft.jsx)("div",{className:"pointer-events-none absolute bottom-6 right-6 z-10 px-3 py-2",children:/* @__PURE__ */ /* @__PURE__ */(0,ft.jsx)("div",{className:"flex items-center gap-3 text-sm text-default",children:th.map(e=>/* @__PURE__ */ /* @__PURE__ */(0,ft.jsxs)("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */ /* @__PURE__ */(0,ft.jsx)("span",{"aria-hidden":"true",className:$e("block h-4 w-4 rounded-[4px] border-2 bg-transparent",e.indicatorClassName)}),/* @__PURE__ */ /* @__PURE__ */(0,ft.jsx)("span",{children:e.label})]},e.label))})}),c?/* @__PURE__ */ /* @__PURE__ */(0,ft.jsx)("div",{ref:g,className:"pointer-events-none absolute bottom-6 left-6 z-10 rounded-full bg-black/85 px-3.5 py-2 text-sm font-semibold tracking-[0.5px] text-white shadow-lg backdrop-blur-sm",children:"Zoom: 100%"}):null,
136
136
  /* @__PURE__ */
137
- /* @__PURE__ */(0,ft.jsx)("div",{ref:h,role:"region","aria-label":"Organization chart",className:"h-full w-full"})]})}),eh=()=>{const[e,t]=Ve.useState(!1);return[e,Ve.useCallback(()=>{t(!e)},[e])]},th=/* @__PURE__ */function(e){return e.LIGHT="light",e.DARK="dark",e}({}),nh=(0,Ve.createContext)({theme:th.LIGHT,setTheme:()=>{},isDark:!1}),rh=()=>{const{theme:e,setTheme:t,isDark:n}=(0,Ve.use)(nh);return{theme:e,isDark:n,setTheme:t}};export{kt as Accordion,pt as Alert,Nt as AnimatePresence,zt as AnimatePresenceChild,xn as Avatar,ec as AvatarGroup,jt as Badge,It as Breadcrumb,Ft as Button,Gt as ButtonGroup,on as Checkbox,hn as CheckboxGroup,En as Chip,Mn as Divider,So as Drawer,Di as Dropdown,eo as Feedback,uo as Input,mo as Link,Bi as ListBox,Ai as ListItem,Xo as Modal,Qp as OrganizationChart,ns as Popover,go as Portal,bs as ProgressBar,Es as Radio,Ls as RadioGroup,Zs as Rating,pl as Slider,zl as Tab,Cl as TabPanel,Sl as Tabs,jl as TabsList,Kl as Toaster,$e as cn,Re as mergeRefs,rh as useTheme,Zl as useToast,eh as useToggle};
137
+ /* @__PURE__ */(0,ft.jsx)("div",{ref:h,role:"region","aria-label":"Organization chart",className:"h-full w-full"})]})}),rh=()=>{const[e,t]=Ve.useState(!1);return[e,Ve.useCallback(()=>{t(!e)},[e])]},ah=/* @__PURE__ */function(e){return e.LIGHT="light",e.DARK="dark",e}({}),ih=(0,Ve.createContext)({theme:ah.LIGHT,setTheme:()=>{},isDark:!1}),oh=()=>{const{theme:e,setTheme:t,isDark:n}=(0,Ve.use)(ih);return{theme:e,isDark:n,setTheme:t}};export{kt as Accordion,pt as Alert,Nt as AnimatePresence,zt as AnimatePresenceChild,xn as Avatar,ec as AvatarGroup,jt as Badge,It as Breadcrumb,Ft as Button,Gt as ButtonGroup,on as Checkbox,hn as CheckboxGroup,En as Chip,Mn as Divider,So as Drawer,Di as Dropdown,eo as Feedback,uo as Input,mo as Link,Bi as ListBox,Ai as ListItem,Xo as Modal,nh as OrganizationChart,ns as Popover,go as Portal,bs as ProgressBar,Es as Radio,Ls as RadioGroup,Zs as Rating,pl as Slider,zl as Tab,Cl as TabPanel,Sl as Tabs,jl as TabsList,Kl as Toaster,$e as cn,Re as mergeRefs,oh as useTheme,Zl as useToast,rh as useToggle};
138
138
  //# sourceMappingURL=index.es.js.map