agent-dag 1.3.3 → 1.3.4
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.
|
@@ -54,4 +54,4 @@ Error generating stack: `+g.message+`
|
|
|
54
54
|
* This source code is licensed under the MIT license found in the
|
|
55
55
|
* LICENSE file in the root directory of this source tree.
|
|
56
56
|
*/var y0;function u2(){if(y0)return tc;y0=1;var e=Do(),r=a2();function i(p,h){return p===h&&(p!==0||1/p===1/h)||p!==p&&h!==h}var o=typeof Object.is=="function"?Object.is:i,s=r.useSyncExternalStore,u=e.useRef,l=e.useEffect,c=e.useMemo,d=e.useDebugValue;return tc.useSyncExternalStoreWithSelector=function(p,h,m,y,_){var k=u(null);if(k.current===null){var w={hasValue:!1,value:null};k.current=w}else w=k.current;k=c(function(){function S(A){if(!b){if(b=!0,N=A,A=y(A),_!==void 0&&w.hasValue){var P=w.value;if(_(P,A))return C=P}return C=A}if(P=C,o(N,A))return P;var $=y(A);return _!==void 0&&_(P,$)?(N=A,P):(N=A,C=$)}var b=!1,N,C,I=m===void 0?null:m;return[function(){return S(h())},I===null?void 0:function(){return S(I())}]},[h,m,y,_]);var x=s(p,k[0],k[1]);return l(function(){w.hasValue=!0,w.value=x},[x]),d(x),x},tc}var _0;function l2(){return _0||(_0=1,ec.exports=u2()),ec.exports}var c2=l2();const f2=tm(c2),d2={},w0=e=>{let r;const i=new Set,o=(h,m)=>{const y=typeof h=="function"?h(r):h;if(!Object.is(y,r)){const _=r;r=m??(typeof y!="object"||y===null)?y:Object.assign({},r,y),i.forEach(k=>k(r,_))}},s=()=>r,d={setState:o,getState:s,getInitialState:()=>p,subscribe:h=>(i.add(h),()=>i.delete(h)),destroy:()=>{(d2?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),i.clear()}},p=r=e(o,s,d);return d},h2=e=>e?w0(e):w0,{useDebugValue:p2}=ie,{useSyncExternalStoreWithSelector:v2}=f2,m2=e=>e;function FE(e,r=m2,i){const o=v2(e.subscribe,e.getState,e.getServerState||e.getInitialState,r,i);return p2(o),o}const x0=(e,r)=>{const i=h2(e),o=(s,u=r)=>FE(i,s,u);return Object.assign(o,i),o},g2=(e,r)=>e?x0(e,r):x0;function ot(e,r){if(Object.is(e,r))return!0;if(typeof e!="object"||e===null||typeof r!="object"||r===null)return!1;if(e instanceof Map&&r instanceof Map){if(e.size!==r.size)return!1;for(const[o,s]of e)if(!Object.is(s,r.get(o)))return!1;return!0}if(e instanceof Set&&r instanceof Set){if(e.size!==r.size)return!1;for(const o of e)if(!r.has(o))return!1;return!0}const i=Object.keys(e);if(i.length!==Object.keys(r).length)return!1;for(const o of i)if(!Object.prototype.hasOwnProperty.call(r,o)||!Object.is(e[o],r[o]))return!1;return!0}var y2={value:()=>{}};function za(){for(var e=0,r=arguments.length,i={},o;e<r;++e){if(!(o=arguments[e]+"")||o in i||/[\s.]/.test(o))throw new Error("illegal type: "+o);i[o]=[]}return new ka(i)}function ka(e){this._=e}function _2(e,r){return e.trim().split(/^|\s+/).map(function(i){var o="",s=i.indexOf(".");if(s>=0&&(o=i.slice(s+1),i=i.slice(0,s)),i&&!r.hasOwnProperty(i))throw new Error("unknown type: "+i);return{type:i,name:o}})}ka.prototype=za.prototype={constructor:ka,on:function(e,r){var i=this._,o=_2(e+"",i),s,u=-1,l=o.length;if(arguments.length<2){for(;++u<l;)if((s=(e=o[u]).type)&&(s=w2(i[s],e.name)))return s;return}if(r!=null&&typeof r!="function")throw new Error("invalid callback: "+r);for(;++u<l;)if(s=(e=o[u]).type)i[s]=S0(i[s],e.name,r);else if(r==null)for(s in i)i[s]=S0(i[s],e.name,null);return this},copy:function(){var e={},r=this._;for(var i in r)e[i]=r[i].slice();return new ka(e)},call:function(e,r){if((s=arguments.length-2)>0)for(var i=new Array(s),o=0,s,u;o<s;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(u=this._[e],o=0,s=u.length;o<s;++o)u[o].value.apply(r,i)},apply:function(e,r,i){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],s=0,u=o.length;s<u;++s)o[s].value.apply(r,i)}};function w2(e,r){for(var i=0,o=e.length,s;i<o;++i)if((s=e[i]).name===r)return s.value}function S0(e,r,i){for(var o=0,s=e.length;o<s;++o)if(e[o].name===r){e[o]=y2,e=e.slice(0,o).concat(e.slice(o+1));break}return i!=null&&e.push({name:r,value:i}),e}var Pv="http://www.w3.org/1999/xhtml";const E0={svg:"http://www.w3.org/2000/svg",xhtml:Pv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Fa(e){var r=e+="",i=r.indexOf(":");return i>=0&&(r=e.slice(0,i))!=="xmlns"&&(e=e.slice(i+1)),E0.hasOwnProperty(r)?{space:E0[r],local:e}:e}function x2(e){return function(){var r=this.ownerDocument,i=this.namespaceURI;return i===Pv&&r.documentElement.namespaceURI===Pv?r.createElement(e):r.createElementNS(i,e)}}function S2(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function $E(e){var r=Fa(e);return(r.local?S2:x2)(r)}function E2(){}function nm(e){return e==null?E2:function(){return this.querySelector(e)}}function k2(e){typeof e!="function"&&(e=nm(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s<i;++s)for(var u=r[s],l=u.length,c=o[s]=new Array(l),d,p,h=0;h<l;++h)(d=u[h])&&(p=e.call(d,d.__data__,h,u))&&("__data__"in d&&(p.__data__=d.__data__),c[h]=p);return new zt(o,this._parents)}function b2(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function C2(){return[]}function BE(e){return e==null?C2:function(){return this.querySelectorAll(e)}}function N2(e){return function(){return b2(e.apply(this,arguments))}}function R2(e){typeof e=="function"?e=N2(e):e=BE(e);for(var r=this._groups,i=r.length,o=[],s=[],u=0;u<i;++u)for(var l=r[u],c=l.length,d,p=0;p<c;++p)(d=l[p])&&(o.push(e.call(d,d.__data__,p,l)),s.push(d));return new zt(o,s)}function UE(e){return function(){return this.matches(e)}}function HE(e){return function(r){return r.matches(e)}}var T2=Array.prototype.find;function I2(e){return function(){return T2.call(this.children,e)}}function A2(){return this.firstElementChild}function M2(e){return this.select(e==null?A2:I2(typeof e=="function"?e:HE(e)))}var P2=Array.prototype.filter;function q2(){return Array.from(this.children)}function O2(e){return function(){return P2.call(this.children,e)}}function L2(e){return this.selectAll(e==null?q2:O2(typeof e=="function"?e:HE(e)))}function j2(e){typeof e!="function"&&(e=UE(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s<i;++s)for(var u=r[s],l=u.length,c=o[s]=[],d,p=0;p<l;++p)(d=u[p])&&e.call(d,d.__data__,p,u)&&c.push(d);return new zt(o,this._parents)}function VE(e){return new Array(e.length)}function D2(){return new zt(this._enter||this._groups.map(VE),this._parents)}function Ta(e,r){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=r}Ta.prototype={constructor:Ta,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,r){return this._parent.insertBefore(e,r)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function z2(e){return function(){return e}}function F2(e,r,i,o,s,u){for(var l=0,c,d=r.length,p=u.length;l<p;++l)(c=r[l])?(c.__data__=u[l],o[l]=c):i[l]=new Ta(e,u[l]);for(;l<d;++l)(c=r[l])&&(s[l]=c)}function $2(e,r,i,o,s,u,l){var c,d,p=new Map,h=r.length,m=u.length,y=new Array(h),_;for(c=0;c<h;++c)(d=r[c])&&(y[c]=_=l.call(d,d.__data__,c,r)+"",p.has(_)?s[c]=d:p.set(_,d));for(c=0;c<m;++c)_=l.call(e,u[c],c,u)+"",(d=p.get(_))?(o[c]=d,d.__data__=u[c],p.delete(_)):i[c]=new Ta(e,u[c]);for(c=0;c<h;++c)(d=r[c])&&p.get(y[c])===d&&(s[c]=d)}function B2(e){return e.__data__}function U2(e,r){if(!arguments.length)return Array.from(this,B2);var i=r?$2:F2,o=this._parents,s=this._groups;typeof e!="function"&&(e=z2(e));for(var u=s.length,l=new Array(u),c=new Array(u),d=new Array(u),p=0;p<u;++p){var h=o[p],m=s[p],y=m.length,_=H2(e.call(h,h&&h.__data__,p,o)),k=_.length,w=c[p]=new Array(k),x=l[p]=new Array(k),S=d[p]=new Array(y);i(h,m,w,x,S,_,r);for(var b=0,N=0,C,I;b<k;++b)if(C=w[b]){for(b>=N&&(N=b+1);!(I=x[N])&&++N<k;);C._next=I||null}}return l=new zt(l,o),l._enter=c,l._exit=d,l}function H2(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function V2(){return new zt(this._exit||this._groups.map(VE),this._parents)}function G2(e,r,i){var o=this.enter(),s=this,u=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),r!=null&&(s=r(s),s&&(s=s.selection())),i==null?u.remove():i(u),o&&s?o.merge(s).order():s}function W2(e){for(var r=e.selection?e.selection():e,i=this._groups,o=r._groups,s=i.length,u=o.length,l=Math.min(s,u),c=new Array(s),d=0;d<l;++d)for(var p=i[d],h=o[d],m=p.length,y=c[d]=new Array(m),_,k=0;k<m;++k)(_=p[k]||h[k])&&(y[k]=_);for(;d<s;++d)c[d]=i[d];return new zt(c,this._parents)}function K2(){for(var e=this._groups,r=-1,i=e.length;++r<i;)for(var o=e[r],s=o.length-1,u=o[s],l;--s>=0;)(l=o[s])&&(u&&l.compareDocumentPosition(u)^4&&u.parentNode.insertBefore(l,u),u=l);return this}function Y2(e){e||(e=X2);function r(m,y){return m&&y?e(m.__data__,y.__data__):!m-!y}for(var i=this._groups,o=i.length,s=new Array(o),u=0;u<o;++u){for(var l=i[u],c=l.length,d=s[u]=new Array(c),p,h=0;h<c;++h)(p=l[h])&&(d[h]=p);d.sort(r)}return new zt(s,this._parents).order()}function X2(e,r){return e<r?-1:e>r?1:e>=r?0:NaN}function Q2(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Z2(){return Array.from(this)}function J2(){for(var e=this._groups,r=0,i=e.length;r<i;++r)for(var o=e[r],s=0,u=o.length;s<u;++s){var l=o[s];if(l)return l}return null}function eR(){let e=0;for(const r of this)++e;return e}function tR(){return!this.node()}function nR(e){for(var r=this._groups,i=0,o=r.length;i<o;++i)for(var s=r[i],u=0,l=s.length,c;u<l;++u)(c=s[u])&&e.call(c,c.__data__,u,s);return this}function rR(e){return function(){this.removeAttribute(e)}}function iR(e){return function(){this.removeAttributeNS(e.space,e.local)}}function oR(e,r){return function(){this.setAttribute(e,r)}}function sR(e,r){return function(){this.setAttributeNS(e.space,e.local,r)}}function aR(e,r){return function(){var i=r.apply(this,arguments);i==null?this.removeAttribute(e):this.setAttribute(e,i)}}function uR(e,r){return function(){var i=r.apply(this,arguments);i==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,i)}}function lR(e,r){var i=Fa(e);if(arguments.length<2){var o=this.node();return i.local?o.getAttributeNS(i.space,i.local):o.getAttribute(i)}return this.each((r==null?i.local?iR:rR:typeof r=="function"?i.local?uR:aR:i.local?sR:oR)(i,r))}function GE(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function cR(e){return function(){this.style.removeProperty(e)}}function fR(e,r,i){return function(){this.style.setProperty(e,r,i)}}function dR(e,r,i){return function(){var o=r.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,i)}}function hR(e,r,i){return arguments.length>1?this.each((r==null?cR:typeof r=="function"?dR:fR)(e,r,i??"")):Si(this.node(),e)}function Si(e,r){return e.style.getPropertyValue(r)||GE(e).getComputedStyle(e,null).getPropertyValue(r)}function pR(e){return function(){delete this[e]}}function vR(e,r){return function(){this[e]=r}}function mR(e,r){return function(){var i=r.apply(this,arguments);i==null?delete this[e]:this[e]=i}}function gR(e,r){return arguments.length>1?this.each((r==null?pR:typeof r=="function"?mR:vR)(e,r)):this.node()[e]}function WE(e){return e.trim().split(/^|\s+/)}function rm(e){return e.classList||new KE(e)}function KE(e){this._node=e,this._names=WE(e.getAttribute("class")||"")}KE.prototype={add:function(e){var r=this._names.indexOf(e);r<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var r=this._names.indexOf(e);r>=0&&(this._names.splice(r,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function YE(e,r){for(var i=rm(e),o=-1,s=r.length;++o<s;)i.add(r[o])}function XE(e,r){for(var i=rm(e),o=-1,s=r.length;++o<s;)i.remove(r[o])}function yR(e){return function(){YE(this,e)}}function _R(e){return function(){XE(this,e)}}function wR(e,r){return function(){(r.apply(this,arguments)?YE:XE)(this,e)}}function xR(e,r){var i=WE(e+"");if(arguments.length<2){for(var o=rm(this.node()),s=-1,u=i.length;++s<u;)if(!o.contains(i[s]))return!1;return!0}return this.each((typeof r=="function"?wR:r?yR:_R)(i,r))}function SR(){this.textContent=""}function ER(e){return function(){this.textContent=e}}function kR(e){return function(){var r=e.apply(this,arguments);this.textContent=r??""}}function bR(e){return arguments.length?this.each(e==null?SR:(typeof e=="function"?kR:ER)(e)):this.node().textContent}function CR(){this.innerHTML=""}function NR(e){return function(){this.innerHTML=e}}function RR(e){return function(){var r=e.apply(this,arguments);this.innerHTML=r??""}}function TR(e){return arguments.length?this.each(e==null?CR:(typeof e=="function"?RR:NR)(e)):this.node().innerHTML}function IR(){this.nextSibling&&this.parentNode.appendChild(this)}function AR(){return this.each(IR)}function MR(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function PR(){return this.each(MR)}function qR(e){var r=typeof e=="function"?e:$E(e);return this.select(function(){return this.appendChild(r.apply(this,arguments))})}function OR(){return null}function LR(e,r){var i=typeof e=="function"?e:$E(e),o=r==null?OR:typeof r=="function"?r:nm(r);return this.select(function(){return this.insertBefore(i.apply(this,arguments),o.apply(this,arguments)||null)})}function jR(){var e=this.parentNode;e&&e.removeChild(this)}function DR(){return this.each(jR)}function zR(){var e=this.cloneNode(!1),r=this.parentNode;return r?r.insertBefore(e,this.nextSibling):e}function FR(){var e=this.cloneNode(!0),r=this.parentNode;return r?r.insertBefore(e,this.nextSibling):e}function $R(e){return this.select(e?FR:zR)}function BR(e){return arguments.length?this.property("__data__",e):this.node().__data__}function UR(e){return function(r){e.call(this,r,this.__data__)}}function HR(e){return e.trim().split(/^|\s+/).map(function(r){var i="",o=r.indexOf(".");return o>=0&&(i=r.slice(o+1),r=r.slice(0,o)),{type:r,name:i}})}function VR(e){return function(){var r=this.__on;if(r){for(var i=0,o=-1,s=r.length,u;i<s;++i)u=r[i],(!e.type||u.type===e.type)&&u.name===e.name?this.removeEventListener(u.type,u.listener,u.options):r[++o]=u;++o?r.length=o:delete this.__on}}}function GR(e,r,i){return function(){var o=this.__on,s,u=UR(r);if(o){for(var l=0,c=o.length;l<c;++l)if((s=o[l]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=u,s.options=i),s.value=r;return}}this.addEventListener(e.type,u,i),s={type:e.type,name:e.name,value:r,listener:u,options:i},o?o.push(s):this.__on=[s]}}function WR(e,r,i){var o=HR(e+""),s,u=o.length,l;if(arguments.length<2){var c=this.node().__on;if(c){for(var d=0,p=c.length,h;d<p;++d)for(s=0,h=c[d];s<u;++s)if((l=o[s]).type===h.type&&l.name===h.name)return h.value}return}for(c=r?GR:VR,s=0;s<u;++s)this.each(c(o[s],r,i));return this}function QE(e,r,i){var o=GE(e),s=o.CustomEvent;typeof s=="function"?s=new s(r,i):(s=o.document.createEvent("Event"),i?(s.initEvent(r,i.bubbles,i.cancelable),s.detail=i.detail):s.initEvent(r,!1,!1)),e.dispatchEvent(s)}function KR(e,r){return function(){return QE(this,e,r)}}function YR(e,r){return function(){return QE(this,e,r.apply(this,arguments))}}function XR(e,r){return this.each((typeof r=="function"?YR:KR)(e,r))}function*QR(){for(var e=this._groups,r=0,i=e.length;r<i;++r)for(var o=e[r],s=0,u=o.length,l;s<u;++s)(l=o[s])&&(yield l)}var ZE=[null];function zt(e,r){this._groups=e,this._parents=r}function zo(){return new zt([[document.documentElement]],ZE)}function ZR(){return this}zt.prototype=zo.prototype={constructor:zt,select:k2,selectAll:R2,selectChild:M2,selectChildren:L2,filter:j2,data:U2,enter:D2,exit:V2,join:G2,merge:W2,selection:ZR,order:K2,sort:Y2,call:Q2,nodes:Z2,node:J2,size:eR,empty:tR,each:nR,attr:lR,style:hR,property:gR,classed:xR,text:bR,html:TR,raise:AR,lower:PR,append:qR,insert:LR,remove:DR,clone:$R,datum:BR,on:WR,dispatch:XR,[Symbol.iterator]:QR};function Yt(e){return typeof e=="string"?new zt([[document.querySelector(e)]],[document.documentElement]):new zt([[e]],ZE)}function JR(e){let r;for(;r=e.sourceEvent;)e=r;return e}function an(e,r){if(e=JR(e),r===void 0&&(r=e.currentTarget),r){var i=r.ownerSVGElement||r;if(i.createSVGPoint){var o=i.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(r.getScreenCTM().inverse()),[o.x,o.y]}if(r.getBoundingClientRect){var s=r.getBoundingClientRect();return[e.clientX-s.left-r.clientLeft,e.clientY-s.top-r.clientTop]}}return[e.pageX,e.pageY]}const eT={passive:!1},Io={capture:!0,passive:!1};function ic(e){e.stopImmediatePropagation()}function _i(e){e.preventDefault(),e.stopImmediatePropagation()}function JE(e){var r=e.document.documentElement,i=Yt(e).on("dragstart.drag",_i,Io);"onselectstart"in r?i.on("selectstart.drag",_i,Io):(r.__noselect=r.style.MozUserSelect,r.style.MozUserSelect="none")}function ek(e,r){var i=e.document.documentElement,o=Yt(e).on("dragstart.drag",null);r&&(o.on("click.drag",_i,Io),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in i?o.on("selectstart.drag",null):(i.style.MozUserSelect=i.__noselect,delete i.__noselect)}const pa=e=>()=>e;function qv(e,{sourceEvent:r,subject:i,target:o,identifier:s,active:u,x:l,y:c,dx:d,dy:p,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:r,enumerable:!0,configurable:!0},subject:{value:i,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:u,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:h}})}qv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function tT(e){return!e.ctrlKey&&!e.button}function nT(){return this.parentNode}function rT(e,r){return r??{x:e.x,y:e.y}}function iT(){return navigator.maxTouchPoints||"ontouchstart"in this}function oT(){var e=tT,r=nT,i=rT,o=iT,s={},u=za("start","drag","end"),l=0,c,d,p,h,m=0;function y(C){C.on("mousedown.drag",_).filter(o).on("touchstart.drag",x).on("touchmove.drag",S,eT).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function _(C,I){if(!(h||!e.call(this,C,I))){var A=N(this,r.call(this,C,I),C,I,"mouse");A&&(Yt(C.view).on("mousemove.drag",k,Io).on("mouseup.drag",w,Io),JE(C.view),ic(C),p=!1,c=C.clientX,d=C.clientY,A("start",C))}}function k(C){if(_i(C),!p){var I=C.clientX-c,A=C.clientY-d;p=I*I+A*A>m}s.mouse("drag",C)}function w(C){Yt(C.view).on("mousemove.drag mouseup.drag",null),ek(C.view,p),_i(C),s.mouse("end",C)}function x(C,I){if(e.call(this,C,I)){var A=C.changedTouches,P=r.call(this,C,I),$=A.length,L,U;for(L=0;L<$;++L)(U=N(this,P,C,I,A[L].identifier,A[L]))&&(ic(C),U("start",C,A[L]))}}function S(C){var I=C.changedTouches,A=I.length,P,$;for(P=0;P<A;++P)($=s[I[P].identifier])&&(_i(C),$("drag",C,I[P]))}function b(C){var I=C.changedTouches,A=I.length,P,$;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),P=0;P<A;++P)($=s[I[P].identifier])&&(ic(C),$("end",C,I[P]))}function N(C,I,A,P,$,L){var U=u.copy(),V=an(L||A,I),ee,Z,R;if((R=i.call(C,new qv("beforestart",{sourceEvent:A,target:y,identifier:$,active:l,x:V[0],y:V[1],dx:0,dy:0,dispatch:U}),P))!=null)return ee=R.x-V[0]||0,Z=R.y-V[1]||0,function W(F,ne,G){var j=V,K;switch(F){case"start":s[$]=W,K=l++;break;case"end":delete s[$],--l;case"drag":V=an(G||ne,I),K=l;break}U.call(F,C,new qv(F,{sourceEvent:ne,subject:R,target:y,identifier:$,active:K,x:V[0]+ee,y:V[1]+Z,dx:V[0]-j[0],dy:V[1]-j[1],dispatch:U}),P)}}return y.filter=function(C){return arguments.length?(e=typeof C=="function"?C:pa(!!C),y):e},y.container=function(C){return arguments.length?(r=typeof C=="function"?C:pa(C),y):r},y.subject=function(C){return arguments.length?(i=typeof C=="function"?C:pa(C),y):i},y.touchable=function(C){return arguments.length?(o=typeof C=="function"?C:pa(!!C),y):o},y.on=function(){var C=u.on.apply(u,arguments);return C===u?y:C},y.clickDistance=function(C){return arguments.length?(m=(C=+C)*C,y):Math.sqrt(m)},y}function im(e,r,i){e.prototype=r.prototype=i,i.constructor=e}function tk(e,r){var i=Object.create(e.prototype);for(var o in r)i[o]=r[o];return i}function Fo(){}var Ao=.7,Ia=1/Ao,wi="\\s*([+-]?\\d+)\\s*",Mo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_n="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",sT=/^#([0-9a-f]{3,8})$/,aT=new RegExp(`^rgb\\(${wi},${wi},${wi}\\)$`),uT=new RegExp(`^rgb\\(${_n},${_n},${_n}\\)$`),lT=new RegExp(`^rgba\\(${wi},${wi},${wi},${Mo}\\)$`),cT=new RegExp(`^rgba\\(${_n},${_n},${_n},${Mo}\\)$`),fT=new RegExp(`^hsl\\(${Mo},${_n},${_n}\\)$`),dT=new RegExp(`^hsla\\(${Mo},${_n},${_n},${Mo}\\)$`),k0={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};im(Fo,Po,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:b0,formatHex:b0,formatHex8:hT,formatHsl:pT,formatRgb:C0,toString:C0});function b0(){return this.rgb().formatHex()}function hT(){return this.rgb().formatHex8()}function pT(){return nk(this).formatHsl()}function C0(){return this.rgb().formatRgb()}function Po(e){var r,i;return e=(e+"").trim().toLowerCase(),(r=sT.exec(e))?(i=r[1].length,r=parseInt(r[1],16),i===6?N0(r):i===3?new Mt(r>>8&15|r>>4&240,r>>4&15|r&240,(r&15)<<4|r&15,1):i===8?va(r>>24&255,r>>16&255,r>>8&255,(r&255)/255):i===4?va(r>>12&15|r>>8&240,r>>8&15|r>>4&240,r>>4&15|r&240,((r&15)<<4|r&15)/255):null):(r=aT.exec(e))?new Mt(r[1],r[2],r[3],1):(r=uT.exec(e))?new Mt(r[1]*255/100,r[2]*255/100,r[3]*255/100,1):(r=lT.exec(e))?va(r[1],r[2],r[3],r[4]):(r=cT.exec(e))?va(r[1]*255/100,r[2]*255/100,r[3]*255/100,r[4]):(r=fT.exec(e))?I0(r[1],r[2]/100,r[3]/100,1):(r=dT.exec(e))?I0(r[1],r[2]/100,r[3]/100,r[4]):k0.hasOwnProperty(e)?N0(k0[e]):e==="transparent"?new Mt(NaN,NaN,NaN,0):null}function N0(e){return new Mt(e>>16&255,e>>8&255,e&255,1)}function va(e,r,i,o){return o<=0&&(e=r=i=NaN),new Mt(e,r,i,o)}function vT(e){return e instanceof Fo||(e=Po(e)),e?(e=e.rgb(),new Mt(e.r,e.g,e.b,e.opacity)):new Mt}function Ov(e,r,i,o){return arguments.length===1?vT(e):new Mt(e,r,i,o??1)}function Mt(e,r,i,o){this.r=+e,this.g=+r,this.b=+i,this.opacity=+o}im(Mt,Ov,tk(Fo,{brighter(e){return e=e==null?Ia:Math.pow(Ia,e),new Mt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ao:Math.pow(Ao,e),new Mt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Mt(Pr(this.r),Pr(this.g),Pr(this.b),Aa(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:R0,formatHex:R0,formatHex8:mT,formatRgb:T0,toString:T0}));function R0(){return`#${Ar(this.r)}${Ar(this.g)}${Ar(this.b)}`}function mT(){return`#${Ar(this.r)}${Ar(this.g)}${Ar(this.b)}${Ar((isNaN(this.opacity)?1:this.opacity)*255)}`}function T0(){const e=Aa(this.opacity);return`${e===1?"rgb(":"rgba("}${Pr(this.r)}, ${Pr(this.g)}, ${Pr(this.b)}${e===1?")":`, ${e})`}`}function Aa(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Pr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ar(e){return e=Pr(e),(e<16?"0":"")+e.toString(16)}function I0(e,r,i,o){return o<=0?e=r=i=NaN:i<=0||i>=1?e=r=NaN:r<=0&&(e=NaN),new un(e,r,i,o)}function nk(e){if(e instanceof un)return new un(e.h,e.s,e.l,e.opacity);if(e instanceof Fo||(e=Po(e)),!e)return new un;if(e instanceof un)return e;e=e.rgb();var r=e.r/255,i=e.g/255,o=e.b/255,s=Math.min(r,i,o),u=Math.max(r,i,o),l=NaN,c=u-s,d=(u+s)/2;return c?(r===u?l=(i-o)/c+(i<o)*6:i===u?l=(o-r)/c+2:l=(r-i)/c+4,c/=d<.5?u+s:2-u-s,l*=60):c=d>0&&d<1?0:l,new un(l,c,d,e.opacity)}function gT(e,r,i,o){return arguments.length===1?nk(e):new un(e,r,i,o??1)}function un(e,r,i,o){this.h=+e,this.s=+r,this.l=+i,this.opacity=+o}im(un,gT,tk(Fo,{brighter(e){return e=e==null?Ia:Math.pow(Ia,e),new un(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ao:Math.pow(Ao,e),new un(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,r=isNaN(e)||isNaN(this.s)?0:this.s,i=this.l,o=i+(i<.5?i:1-i)*r,s=2*i-o;return new Mt(oc(e>=240?e-240:e+120,s,o),oc(e,s,o),oc(e<120?e+240:e-120,s,o),this.opacity)},clamp(){return new un(A0(this.h),ma(this.s),ma(this.l),Aa(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=Aa(this.opacity);return`${e===1?"hsl(":"hsla("}${A0(this.h)}, ${ma(this.s)*100}%, ${ma(this.l)*100}%${e===1?")":`, ${e})`}`}}));function A0(e){return e=(e||0)%360,e<0?e+360:e}function ma(e){return Math.max(0,Math.min(1,e||0))}function oc(e,r,i){return(e<60?r+(i-r)*e/60:e<180?i:e<240?r+(i-r)*(240-e)/60:r)*255}const rk=e=>()=>e;function yT(e,r){return function(i){return e+i*r}}function _T(e,r,i){return e=Math.pow(e,i),r=Math.pow(r,i)-e,i=1/i,function(o){return Math.pow(e+o*r,i)}}function wT(e){return(e=+e)==1?ik:function(r,i){return i-r?_T(r,i,e):rk(isNaN(r)?i:r)}}function ik(e,r){var i=r-e;return i?yT(e,i):rk(isNaN(e)?r:e)}const M0=(function e(r){var i=wT(r);function o(s,u){var l=i((s=Ov(s)).r,(u=Ov(u)).r),c=i(s.g,u.g),d=i(s.b,u.b),p=ik(s.opacity,u.opacity);return function(h){return s.r=l(h),s.g=c(h),s.b=d(h),s.opacity=p(h),s+""}}return o.gamma=e,o})(1);function ur(e,r){return e=+e,r=+r,function(i){return e*(1-i)+r*i}}var Lv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,sc=new RegExp(Lv.source,"g");function xT(e){return function(){return e}}function ST(e){return function(r){return e(r)+""}}function ET(e,r){var i=Lv.lastIndex=sc.lastIndex=0,o,s,u,l=-1,c=[],d=[];for(e=e+"",r=r+"";(o=Lv.exec(e))&&(s=sc.exec(r));)(u=s.index)>i&&(u=r.slice(i,u),c[l]?c[l]+=u:c[++l]=u),(o=o[0])===(s=s[0])?c[l]?c[l]+=s:c[++l]=s:(c[++l]=null,d.push({i:l,x:ur(o,s)})),i=sc.lastIndex;return i<r.length&&(u=r.slice(i),c[l]?c[l]+=u:c[++l]=u),c.length<2?d[0]?ST(d[0].x):xT(r):(r=d.length,function(p){for(var h=0,m;h<r;++h)c[(m=d[h]).i]=m.x(p);return c.join("")})}var P0=180/Math.PI,jv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ok(e,r,i,o,s,u){var l,c,d;return(l=Math.sqrt(e*e+r*r))&&(e/=l,r/=l),(d=e*i+r*o)&&(i-=e*d,o-=r*d),(c=Math.sqrt(i*i+o*o))&&(i/=c,o/=c,d/=c),e*o<r*i&&(e=-e,r=-r,d=-d,l=-l),{translateX:s,translateY:u,rotate:Math.atan2(r,e)*P0,skewX:Math.atan(d)*P0,scaleX:l,scaleY:c}}var ga;function kT(e){const r=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return r.isIdentity?jv:ok(r.a,r.b,r.c,r.d,r.e,r.f)}function bT(e){return e==null||(ga||(ga=document.createElementNS("http://www.w3.org/2000/svg","g")),ga.setAttribute("transform",e),!(e=ga.transform.baseVal.consolidate()))?jv:(e=e.matrix,ok(e.a,e.b,e.c,e.d,e.e,e.f))}function sk(e,r,i,o){function s(p){return p.length?p.pop()+" ":""}function u(p,h,m,y,_,k){if(p!==m||h!==y){var w=_.push("translate(",null,r,null,i);k.push({i:w-4,x:ur(p,m)},{i:w-2,x:ur(h,y)})}else(m||y)&&_.push("translate("+m+r+y+i)}function l(p,h,m,y){p!==h?(p-h>180?h+=360:h-p>180&&(p+=360),y.push({i:m.push(s(m)+"rotate(",null,o)-2,x:ur(p,h)})):h&&m.push(s(m)+"rotate("+h+o)}function c(p,h,m,y){p!==h?y.push({i:m.push(s(m)+"skewX(",null,o)-2,x:ur(p,h)}):h&&m.push(s(m)+"skewX("+h+o)}function d(p,h,m,y,_,k){if(p!==m||h!==y){var w=_.push(s(_)+"scale(",null,",",null,")");k.push({i:w-4,x:ur(p,m)},{i:w-2,x:ur(h,y)})}else(m!==1||y!==1)&&_.push(s(_)+"scale("+m+","+y+")")}return function(p,h){var m=[],y=[];return p=e(p),h=e(h),u(p.translateX,p.translateY,h.translateX,h.translateY,m,y),l(p.rotate,h.rotate,m,y),c(p.skewX,h.skewX,m,y),d(p.scaleX,p.scaleY,h.scaleX,h.scaleY,m,y),p=h=null,function(_){for(var k=-1,w=y.length,x;++k<w;)m[(x=y[k]).i]=x.x(_);return m.join("")}}}var CT=sk(kT,"px, ","px)","deg)"),NT=sk(bT,", ",")",")"),RT=1e-12;function q0(e){return((e=Math.exp(e))+1/e)/2}function TT(e){return((e=Math.exp(e))-1/e)/2}function IT(e){return((e=Math.exp(2*e))-1)/(e+1)}const AT=(function e(r,i,o){function s(u,l){var c=u[0],d=u[1],p=u[2],h=l[0],m=l[1],y=l[2],_=h-c,k=m-d,w=_*_+k*k,x,S;if(w<RT)S=Math.log(y/p)/r,x=function(P){return[c+P*_,d+P*k,p*Math.exp(r*P*S)]};else{var b=Math.sqrt(w),N=(y*y-p*p+o*w)/(2*p*i*b),C=(y*y-p*p-o*w)/(2*y*i*b),I=Math.log(Math.sqrt(N*N+1)-N),A=Math.log(Math.sqrt(C*C+1)-C);S=(A-I)/r,x=function(P){var $=P*S,L=q0(I),U=p/(i*b)*(L*IT(r*$+I)-TT(I));return[c+U*_,d+U*k,p*L/q0(r*$+I)]}}return x.duration=S*1e3*r/Math.SQRT2,x}return s.rho=function(u){var l=Math.max(.001,+u),c=l*l,d=c*c;return e(l,c,d)},s})(Math.SQRT2,2,4);var Ei=0,So=0,go=0,ak=1e3,Ma,Eo,Pa=0,Lr=0,$a=0,qo=typeof performance=="object"&&performance.now?performance:Date,uk=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function om(){return Lr||(uk(MT),Lr=qo.now()+$a)}function MT(){Lr=0}function qa(){this._call=this._time=this._next=null}qa.prototype=lk.prototype={constructor:qa,restart:function(e,r,i){if(typeof e!="function")throw new TypeError("callback is not a function");i=(i==null?om():+i)+(r==null?0:+r),!this._next&&Eo!==this&&(Eo?Eo._next=this:Ma=this,Eo=this),this._call=e,this._time=i,Dv()},stop:function(){this._call&&(this._call=null,this._time=1/0,Dv())}};function lk(e,r,i){var o=new qa;return o.restart(e,r,i),o}function PT(){om(),++Ei;for(var e=Ma,r;e;)(r=Lr-e._time)>=0&&e._call.call(void 0,r),e=e._next;--Ei}function O0(){Lr=(Pa=qo.now())+$a,Ei=So=0;try{PT()}finally{Ei=0,OT(),Lr=0}}function qT(){var e=qo.now(),r=e-Pa;r>ak&&($a-=r,Pa=e)}function OT(){for(var e,r=Ma,i,o=1/0;r;)r._call?(o>r._time&&(o=r._time),e=r,r=r._next):(i=r._next,r._next=null,r=e?e._next=i:Ma=i);Eo=e,Dv(o)}function Dv(e){if(!Ei){So&&(So=clearTimeout(So));var r=e-Lr;r>24?(e<1/0&&(So=setTimeout(O0,e-qo.now()-$a)),go&&(go=clearInterval(go))):(go||(Pa=qo.now(),go=setInterval(qT,ak)),Ei=1,uk(O0))}}function L0(e,r,i){var o=new qa;return r=r==null?0:+r,o.restart(s=>{o.stop(),e(s+r)},r,i),o}var LT=za("start","end","cancel","interrupt"),jT=[],ck=0,j0=1,zv=2,ba=3,D0=4,Fv=5,Ca=6;function Ba(e,r,i,o,s,u){var l=e.__transition;if(!l)e.__transition={};else if(i in l)return;DT(e,i,{name:r,index:o,group:s,on:LT,tween:jT,time:u.time,delay:u.delay,duration:u.duration,ease:u.ease,timer:null,state:ck})}function sm(e,r){var i=fn(e,r);if(i.state>ck)throw new Error("too late; already scheduled");return i}function wn(e,r){var i=fn(e,r);if(i.state>ba)throw new Error("too late; already running");return i}function fn(e,r){var i=e.__transition;if(!i||!(i=i[r]))throw new Error("transition not found");return i}function DT(e,r,i){var o=e.__transition,s;o[r]=i,i.timer=lk(u,0,i.time);function u(p){i.state=j0,i.timer.restart(l,i.delay,i.time),i.delay<=p&&l(p-i.delay)}function l(p){var h,m,y,_;if(i.state!==j0)return d();for(h in o)if(_=o[h],_.name===i.name){if(_.state===ba)return L0(l);_.state===D0?(_.state=Ca,_.timer.stop(),_.on.call("interrupt",e,e.__data__,_.index,_.group),delete o[h]):+h<r&&(_.state=Ca,_.timer.stop(),_.on.call("cancel",e,e.__data__,_.index,_.group),delete o[h])}if(L0(function(){i.state===ba&&(i.state=D0,i.timer.restart(c,i.delay,i.time),c(p))}),i.state=zv,i.on.call("start",e,e.__data__,i.index,i.group),i.state===zv){for(i.state=ba,s=new Array(y=i.tween.length),h=0,m=-1;h<y;++h)(_=i.tween[h].value.call(e,e.__data__,i.index,i.group))&&(s[++m]=_);s.length=m+1}}function c(p){for(var h=p<i.duration?i.ease.call(null,p/i.duration):(i.timer.restart(d),i.state=Fv,1),m=-1,y=s.length;++m<y;)s[m].call(e,h);i.state===Fv&&(i.on.call("end",e,e.__data__,i.index,i.group),d())}function d(){i.state=Ca,i.timer.stop(),delete o[r];for(var p in o)return;delete e.__transition}}function Na(e,r){var i=e.__transition,o,s,u=!0,l;if(i){r=r==null?null:r+"";for(l in i){if((o=i[l]).name!==r){u=!1;continue}s=o.state>zv&&o.state<Fv,o.state=Ca,o.timer.stop(),o.on.call(s?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete i[l]}u&&delete e.__transition}}function zT(e){return this.each(function(){Na(this,e)})}function FT(e,r){var i,o;return function(){var s=wn(this,e),u=s.tween;if(u!==i){o=i=u;for(var l=0,c=o.length;l<c;++l)if(o[l].name===r){o=o.slice(),o.splice(l,1);break}}s.tween=o}}function $T(e,r,i){var o,s;if(typeof i!="function")throw new Error;return function(){var u=wn(this,e),l=u.tween;if(l!==o){s=(o=l).slice();for(var c={name:r,value:i},d=0,p=s.length;d<p;++d)if(s[d].name===r){s[d]=c;break}d===p&&s.push(c)}u.tween=s}}function BT(e,r){var i=this._id;if(e+="",arguments.length<2){for(var o=fn(this.node(),i).tween,s=0,u=o.length,l;s<u;++s)if((l=o[s]).name===e)return l.value;return null}return this.each((r==null?FT:$T)(i,e,r))}function am(e,r,i){var o=e._id;return e.each(function(){var s=wn(this,o);(s.value||(s.value={}))[r]=i.apply(this,arguments)}),function(s){return fn(s,o).value[r]}}function fk(e,r){var i;return(typeof r=="number"?ur:r instanceof Po?M0:(i=Po(r))?(r=i,M0):ET)(e,r)}function UT(e){return function(){this.removeAttribute(e)}}function HT(e){return function(){this.removeAttributeNS(e.space,e.local)}}function VT(e,r,i){var o,s=i+"",u;return function(){var l=this.getAttribute(e);return l===s?null:l===o?u:u=r(o=l,i)}}function GT(e,r,i){var o,s=i+"",u;return function(){var l=this.getAttributeNS(e.space,e.local);return l===s?null:l===o?u:u=r(o=l,i)}}function WT(e,r,i){var o,s,u;return function(){var l,c=i(this),d;return c==null?void this.removeAttribute(e):(l=this.getAttribute(e),d=c+"",l===d?null:l===o&&d===s?u:(s=d,u=r(o=l,c)))}}function KT(e,r,i){var o,s,u;return function(){var l,c=i(this),d;return c==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),d=c+"",l===d?null:l===o&&d===s?u:(s=d,u=r(o=l,c)))}}function YT(e,r){var i=Fa(e),o=i==="transform"?NT:fk;return this.attrTween(e,typeof r=="function"?(i.local?KT:WT)(i,o,am(this,"attr."+e,r)):r==null?(i.local?HT:UT)(i):(i.local?GT:VT)(i,o,r))}function XT(e,r){return function(i){this.setAttribute(e,r.call(this,i))}}function QT(e,r){return function(i){this.setAttributeNS(e.space,e.local,r.call(this,i))}}function ZT(e,r){var i,o;function s(){var u=r.apply(this,arguments);return u!==o&&(i=(o=u)&&QT(e,u)),i}return s._value=r,s}function JT(e,r){var i,o;function s(){var u=r.apply(this,arguments);return u!==o&&(i=(o=u)&&XT(e,u)),i}return s._value=r,s}function eI(e,r){var i="attr."+e;if(arguments.length<2)return(i=this.tween(i))&&i._value;if(r==null)return this.tween(i,null);if(typeof r!="function")throw new Error;var o=Fa(e);return this.tween(i,(o.local?ZT:JT)(o,r))}function tI(e,r){return function(){sm(this,e).delay=+r.apply(this,arguments)}}function nI(e,r){return r=+r,function(){sm(this,e).delay=r}}function rI(e){var r=this._id;return arguments.length?this.each((typeof e=="function"?tI:nI)(r,e)):fn(this.node(),r).delay}function iI(e,r){return function(){wn(this,e).duration=+r.apply(this,arguments)}}function oI(e,r){return r=+r,function(){wn(this,e).duration=r}}function sI(e){var r=this._id;return arguments.length?this.each((typeof e=="function"?iI:oI)(r,e)):fn(this.node(),r).duration}function aI(e,r){if(typeof r!="function")throw new Error;return function(){wn(this,e).ease=r}}function uI(e){var r=this._id;return arguments.length?this.each(aI(r,e)):fn(this.node(),r).ease}function lI(e,r){return function(){var i=r.apply(this,arguments);if(typeof i!="function")throw new Error;wn(this,e).ease=i}}function cI(e){if(typeof e!="function")throw new Error;return this.each(lI(this._id,e))}function fI(e){typeof e!="function"&&(e=UE(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s<i;++s)for(var u=r[s],l=u.length,c=o[s]=[],d,p=0;p<l;++p)(d=u[p])&&e.call(d,d.__data__,p,u)&&c.push(d);return new Dn(o,this._parents,this._name,this._id)}function dI(e){if(e._id!==this._id)throw new Error;for(var r=this._groups,i=e._groups,o=r.length,s=i.length,u=Math.min(o,s),l=new Array(o),c=0;c<u;++c)for(var d=r[c],p=i[c],h=d.length,m=l[c]=new Array(h),y,_=0;_<h;++_)(y=d[_]||p[_])&&(m[_]=y);for(;c<o;++c)l[c]=r[c];return new Dn(l,this._parents,this._name,this._id)}function hI(e){return(e+"").trim().split(/^|\s+/).every(function(r){var i=r.indexOf(".");return i>=0&&(r=r.slice(0,i)),!r||r==="start"})}function pI(e,r,i){var o,s,u=hI(r)?sm:wn;return function(){var l=u(this,e),c=l.on;c!==o&&(s=(o=c).copy()).on(r,i),l.on=s}}function vI(e,r){var i=this._id;return arguments.length<2?fn(this.node(),i).on.on(e):this.each(pI(i,e,r))}function mI(e){return function(){var r=this.parentNode;for(var i in this.__transition)if(+i!==e)return;r&&r.removeChild(this)}}function gI(){return this.on("end.remove",mI(this._id))}function yI(e){var r=this._name,i=this._id;typeof e!="function"&&(e=nm(e));for(var o=this._groups,s=o.length,u=new Array(s),l=0;l<s;++l)for(var c=o[l],d=c.length,p=u[l]=new Array(d),h,m,y=0;y<d;++y)(h=c[y])&&(m=e.call(h,h.__data__,y,c))&&("__data__"in h&&(m.__data__=h.__data__),p[y]=m,Ba(p[y],r,i,y,p,fn(h,i)));return new Dn(u,this._parents,r,i)}function _I(e){var r=this._name,i=this._id;typeof e!="function"&&(e=BE(e));for(var o=this._groups,s=o.length,u=[],l=[],c=0;c<s;++c)for(var d=o[c],p=d.length,h,m=0;m<p;++m)if(h=d[m]){for(var y=e.call(h,h.__data__,m,d),_,k=fn(h,i),w=0,x=y.length;w<x;++w)(_=y[w])&&Ba(_,r,i,w,y,k);u.push(y),l.push(h)}return new Dn(u,l,r,i)}var wI=zo.prototype.constructor;function xI(){return new wI(this._groups,this._parents)}function SI(e,r){var i,o,s;return function(){var u=Si(this,e),l=(this.style.removeProperty(e),Si(this,e));return u===l?null:u===i&&l===o?s:s=r(i=u,o=l)}}function dk(e){return function(){this.style.removeProperty(e)}}function EI(e,r,i){var o,s=i+"",u;return function(){var l=Si(this,e);return l===s?null:l===o?u:u=r(o=l,i)}}function kI(e,r,i){var o,s,u;return function(){var l=Si(this,e),c=i(this),d=c+"";return c==null&&(d=c=(this.style.removeProperty(e),Si(this,e))),l===d?null:l===o&&d===s?u:(s=d,u=r(o=l,c))}}function bI(e,r){var i,o,s,u="style."+r,l="end."+u,c;return function(){var d=wn(this,e),p=d.on,h=d.value[u]==null?c||(c=dk(r)):void 0;(p!==i||s!==h)&&(o=(i=p).copy()).on(l,s=h),d.on=o}}function CI(e,r,i){var o=(e+="")=="transform"?CT:fk;return r==null?this.styleTween(e,SI(e,o)).on("end.style."+e,dk(e)):typeof r=="function"?this.styleTween(e,kI(e,o,am(this,"style."+e,r))).each(bI(this._id,e)):this.styleTween(e,EI(e,o,r),i).on("end.style."+e,null)}function NI(e,r,i){return function(o){this.style.setProperty(e,r.call(this,o),i)}}function RI(e,r,i){var o,s;function u(){var l=r.apply(this,arguments);return l!==s&&(o=(s=l)&&NI(e,l,i)),o}return u._value=r,u}function TI(e,r,i){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(r==null)return this.tween(o,null);if(typeof r!="function")throw new Error;return this.tween(o,RI(e,r,i??""))}function II(e){return function(){this.textContent=e}}function AI(e){return function(){var r=e(this);this.textContent=r??""}}function MI(e){return this.tween("text",typeof e=="function"?AI(am(this,"text",e)):II(e==null?"":e+""))}function PI(e){return function(r){this.textContent=e.call(this,r)}}function qI(e){var r,i;function o(){var s=e.apply(this,arguments);return s!==i&&(r=(i=s)&&PI(s)),r}return o._value=e,o}function OI(e){var r="text";if(arguments.length<1)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,qI(e))}function LI(){for(var e=this._name,r=this._id,i=hk(),o=this._groups,s=o.length,u=0;u<s;++u)for(var l=o[u],c=l.length,d,p=0;p<c;++p)if(d=l[p]){var h=fn(d,r);Ba(d,e,i,p,l,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new Dn(o,this._parents,e,i)}function jI(){var e,r,i=this,o=i._id,s=i.size();return new Promise(function(u,l){var c={value:l},d={value:function(){--s===0&&u()}};i.each(function(){var p=wn(this,o),h=p.on;h!==e&&(r=(e=h).copy(),r._.cancel.push(c),r._.interrupt.push(c),r._.end.push(d)),p.on=r}),s===0&&u()})}var DI=0;function Dn(e,r,i,o){this._groups=e,this._parents=r,this._name=i,this._id=o}function hk(){return++DI}var On=zo.prototype;Dn.prototype={constructor:Dn,select:yI,selectAll:_I,selectChild:On.selectChild,selectChildren:On.selectChildren,filter:fI,merge:dI,selection:xI,transition:LI,call:On.call,nodes:On.nodes,node:On.node,size:On.size,empty:On.empty,each:On.each,on:vI,attr:YT,attrTween:eI,style:CI,styleTween:TI,text:MI,textTween:OI,remove:gI,tween:BT,delay:rI,duration:sI,ease:uI,easeVarying:cI,end:jI,[Symbol.iterator]:On[Symbol.iterator]};function zI(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var FI={time:null,delay:0,duration:250,ease:zI};function $I(e,r){for(var i;!(i=e.__transition)||!(i=i[r]);)if(!(e=e.parentNode))throw new Error(`transition ${r} not found`);return i}function BI(e){var r,i;e instanceof Dn?(r=e._id,e=e._name):(r=hk(),(i=FI).time=om(),e=e==null?null:e+"");for(var o=this._groups,s=o.length,u=0;u<s;++u)for(var l=o[u],c=l.length,d,p=0;p<c;++p)(d=l[p])&&Ba(d,e,r,p,l,i||$I(d,r));return new Dn(o,this._parents,e,r)}zo.prototype.interrupt=zT;zo.prototype.transition=BI;const ya=e=>()=>e;function UI(e,{sourceEvent:r,target:i,transform:o,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:s}})}function Ln(e,r,i){this.k=e,this.x=r,this.y=i}Ln.prototype={constructor:Ln,scale:function(e){return e===1?this:new Ln(this.k*e,this.x,this.y)},translate:function(e,r){return e===0&r===0?this:new Ln(this.k,this.x+this.k*e,this.y+this.k*r)},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 jn=new Ln(1,0,0);Ln.prototype;function ac(e){e.stopImmediatePropagation()}function yo(e){e.preventDefault(),e.stopImmediatePropagation()}function HI(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function VI(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.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 z0(){return this.__zoom||jn}function GI(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function WI(){return navigator.maxTouchPoints||"ontouchstart"in this}function KI(e,r,i){var o=e.invertX(r[0][0])-i[0][0],s=e.invertX(r[1][0])-i[1][0],u=e.invertY(r[0][1])-i[0][1],l=e.invertY(r[1][1])-i[1][1];return e.translate(s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s),l>u?(u+l)/2:Math.min(0,u)||Math.max(0,l))}function pk(){var e=HI,r=VI,i=KI,o=GI,s=WI,u=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],c=250,d=AT,p=za("start","zoom","end"),h,m,y,_=500,k=150,w=0,x=10;function S(R){R.property("__zoom",z0).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",U).filter(s).on("touchstart.zoom",V).on("touchmove.zoom",ee).on("touchend.zoom touchcancel.zoom",Z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(R,W,F,ne){var G=R.selection?R.selection():R;G.property("__zoom",z0),R!==G?I(R,W,F,ne):G.interrupt().each(function(){A(this,arguments).event(ne).start().zoom(null,typeof W=="function"?W.apply(this,arguments):W).end()})},S.scaleBy=function(R,W,F,ne){S.scaleTo(R,function(){var G=this.__zoom.k,j=typeof W=="function"?W.apply(this,arguments):W;return G*j},F,ne)},S.scaleTo=function(R,W,F,ne){S.transform(R,function(){var G=r.apply(this,arguments),j=this.__zoom,K=F==null?C(G):typeof F=="function"?F.apply(this,arguments):F,T=j.invert(K),z=typeof W=="function"?W.apply(this,arguments):W;return i(N(b(j,z),K,T),G,l)},F,ne)},S.translateBy=function(R,W,F,ne){S.transform(R,function(){return i(this.__zoom.translate(typeof W=="function"?W.apply(this,arguments):W,typeof F=="function"?F.apply(this,arguments):F),r.apply(this,arguments),l)},null,ne)},S.translateTo=function(R,W,F,ne,G){S.transform(R,function(){var j=r.apply(this,arguments),K=this.__zoom,T=ne==null?C(j):typeof ne=="function"?ne.apply(this,arguments):ne;return i(jn.translate(T[0],T[1]).scale(K.k).translate(typeof W=="function"?-W.apply(this,arguments):-W,typeof F=="function"?-F.apply(this,arguments):-F),j,l)},ne,G)};function b(R,W){return W=Math.max(u[0],Math.min(u[1],W)),W===R.k?R:new Ln(W,R.x,R.y)}function N(R,W,F){var ne=W[0]-F[0]*R.k,G=W[1]-F[1]*R.k;return ne===R.x&&G===R.y?R:new Ln(R.k,ne,G)}function C(R){return[(+R[0][0]+ +R[1][0])/2,(+R[0][1]+ +R[1][1])/2]}function I(R,W,F,ne){R.on("start.zoom",function(){A(this,arguments).event(ne).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(ne).end()}).tween("zoom",function(){var G=this,j=arguments,K=A(G,j).event(ne),T=r.apply(G,j),z=F==null?C(T):typeof F=="function"?F.apply(G,j):F,ae=Math.max(T[1][0]-T[0][0],T[1][1]-T[0][1]),q=G.__zoom,H=typeof W=="function"?W.apply(G,j):W,X=d(q.invert(z).concat(ae/q.k),H.invert(z).concat(ae/H.k));return function(oe){if(oe===1)oe=H;else{var ue=X(oe),se=ae/ue[2];oe=new Ln(se,z[0]-ue[0]*se,z[1]-ue[1]*se)}K.zoom(null,oe)}})}function A(R,W,F){return!F&&R.__zooming||new P(R,W)}function P(R,W){this.that=R,this.args=W,this.active=0,this.sourceEvent=null,this.extent=r.apply(R,W),this.taps=0}P.prototype={event:function(R){return R&&(this.sourceEvent=R),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(R,W){return this.mouse&&R!=="mouse"&&(this.mouse[1]=W.invert(this.mouse[0])),this.touch0&&R!=="touch"&&(this.touch0[1]=W.invert(this.touch0[0])),this.touch1&&R!=="touch"&&(this.touch1[1]=W.invert(this.touch1[0])),this.that.__zoom=W,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(R){var W=Yt(this.that).datum();p.call(R,this.that,new UI(R,{sourceEvent:this.sourceEvent,target:S,transform:this.that.__zoom,dispatch:p}),W)}};function $(R,...W){if(!e.apply(this,arguments))return;var F=A(this,W).event(R),ne=this.__zoom,G=Math.max(u[0],Math.min(u[1],ne.k*Math.pow(2,o.apply(this,arguments)))),j=an(R);if(F.wheel)(F.mouse[0][0]!==j[0]||F.mouse[0][1]!==j[1])&&(F.mouse[1]=ne.invert(F.mouse[0]=j)),clearTimeout(F.wheel);else{if(ne.k===G)return;F.mouse=[j,ne.invert(j)],Na(this),F.start()}yo(R),F.wheel=setTimeout(K,k),F.zoom("mouse",i(N(b(ne,G),F.mouse[0],F.mouse[1]),F.extent,l));function K(){F.wheel=null,F.end()}}function L(R,...W){if(y||!e.apply(this,arguments))return;var F=R.currentTarget,ne=A(this,W,!0).event(R),G=Yt(R.view).on("mousemove.zoom",z,!0).on("mouseup.zoom",ae,!0),j=an(R,F),K=R.clientX,T=R.clientY;JE(R.view),ac(R),ne.mouse=[j,this.__zoom.invert(j)],Na(this),ne.start();function z(q){if(yo(q),!ne.moved){var H=q.clientX-K,X=q.clientY-T;ne.moved=H*H+X*X>w}ne.event(q).zoom("mouse",i(N(ne.that.__zoom,ne.mouse[0]=an(q,F),ne.mouse[1]),ne.extent,l))}function ae(q){G.on("mousemove.zoom mouseup.zoom",null),ek(q.view,ne.moved),yo(q),ne.event(q).end()}}function U(R,...W){if(e.apply(this,arguments)){var F=this.__zoom,ne=an(R.changedTouches?R.changedTouches[0]:R,this),G=F.invert(ne),j=F.k*(R.shiftKey?.5:2),K=i(N(b(F,j),ne,G),r.apply(this,W),l);yo(R),c>0?Yt(this).transition().duration(c).call(I,K,ne,R):Yt(this).call(S.transform,K,ne,R)}}function V(R,...W){if(e.apply(this,arguments)){var F=R.touches,ne=F.length,G=A(this,W,R.changedTouches.length===ne).event(R),j,K,T,z;for(ac(R),K=0;K<ne;++K)T=F[K],z=an(T,this),z=[z,this.__zoom.invert(z),T.identifier],G.touch0?!G.touch1&&G.touch0[2]!==z[2]&&(G.touch1=z,G.taps=0):(G.touch0=z,j=!0,G.taps=1+!!h);h&&(h=clearTimeout(h)),j&&(G.taps<2&&(m=z[0],h=setTimeout(function(){h=null},_)),Na(this),G.start())}}function ee(R,...W){if(this.__zooming){var F=A(this,W).event(R),ne=R.changedTouches,G=ne.length,j,K,T,z;for(yo(R),j=0;j<G;++j)K=ne[j],T=an(K,this),F.touch0&&F.touch0[2]===K.identifier?F.touch0[0]=T:F.touch1&&F.touch1[2]===K.identifier&&(F.touch1[0]=T);if(K=F.that.__zoom,F.touch1){var ae=F.touch0[0],q=F.touch0[1],H=F.touch1[0],X=F.touch1[1],oe=(oe=H[0]-ae[0])*oe+(oe=H[1]-ae[1])*oe,ue=(ue=X[0]-q[0])*ue+(ue=X[1]-q[1])*ue;K=b(K,Math.sqrt(oe/ue)),T=[(ae[0]+H[0])/2,(ae[1]+H[1])/2],z=[(q[0]+X[0])/2,(q[1]+X[1])/2]}else if(F.touch0)T=F.touch0[0],z=F.touch0[1];else return;F.zoom("touch",i(N(K,T,z),F.extent,l))}}function Z(R,...W){if(this.__zooming){var F=A(this,W).event(R),ne=R.changedTouches,G=ne.length,j,K;for(ac(R),y&&clearTimeout(y),y=setTimeout(function(){y=null},_),j=0;j<G;++j)K=ne[j],F.touch0&&F.touch0[2]===K.identifier?delete F.touch0:F.touch1&&F.touch1[2]===K.identifier&&delete F.touch1;if(F.touch1&&!F.touch0&&(F.touch0=F.touch1,delete F.touch1),F.touch0)F.touch0[1]=this.__zoom.invert(F.touch0[0]);else if(F.end(),F.taps===2&&(K=an(K,this),Math.hypot(m[0]-K[0],m[1]-K[1])<x)){var T=Yt(this).on("dblclick.zoom");T&&T.apply(this,arguments)}}}return S.wheelDelta=function(R){return arguments.length?(o=typeof R=="function"?R:ya(+R),S):o},S.filter=function(R){return arguments.length?(e=typeof R=="function"?R:ya(!!R),S):e},S.touchable=function(R){return arguments.length?(s=typeof R=="function"?R:ya(!!R),S):s},S.extent=function(R){return arguments.length?(r=typeof R=="function"?R:ya([[+R[0][0],+R[0][1]],[+R[1][0],+R[1][1]]]),S):r},S.scaleExtent=function(R){return arguments.length?(u[0]=+R[0],u[1]=+R[1],S):[u[0],u[1]]},S.translateExtent=function(R){return arguments.length?(l[0][0]=+R[0][0],l[1][0]=+R[1][0],l[0][1]=+R[0][1],l[1][1]=+R[1][1],S):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},S.constrain=function(R){return arguments.length?(i=R,S):i},S.duration=function(R){return arguments.length?(c=+R,S):c},S.interpolate=function(R){return arguments.length?(d=R,S):d},S.on=function(){var R=p.on.apply(p,arguments);return R===p?S:R},S.clickDistance=function(R){return arguments.length?(w=(R=+R)*R,S):Math.sqrt(w)},S.tapDistance=function(R){return arguments.length?(x=+R,S):x},S}zE();const Ua=Y.createContext(null),YI=Ua.Provider,zn={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,r)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?r.targetHandle:r.sourceHandle}", edge id: ${r.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},vk=zn.error001();function Oe(e,r){const i=Y.useContext(Ua);if(i===null)throw new Error(vk);return FE(i,e,r)}const st=()=>{const e=Y.useContext(Ua);if(e===null)throw new Error(vk);return Y.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},XI=e=>e.userSelectionActive?"none":"all";function um({position:e,children:r,className:i,style:o,...s}){const u=Oe(XI),l=`${e}`.split("-");return ie.createElement("div",{className:pt(["react-flow__panel",i,...l]),style:{...o,pointerEvents:u},...s},r)}function QI({proOptions:e,position:r="bottom-right"}){return e!=null&&e.hideAttribution?null:ie.createElement(um,{position:r,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},ie.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const ZI=({x:e,y:r,label:i,labelStyle:o={},labelShowBg:s=!0,labelBgStyle:u={},labelBgPadding:l=[2,4],labelBgBorderRadius:c=2,children:d,className:p,...h})=>{const m=Y.useRef(null),[y,_]=Y.useState({x:0,y:0,width:0,height:0}),k=pt(["react-flow__edge-textwrapper",p]);return Y.useEffect(()=>{if(m.current){const w=m.current.getBBox();_({x:w.x,y:w.y,width:w.width,height:w.height})}},[i]),typeof i>"u"||!i?null:ie.createElement("g",{transform:`translate(${e-y.width/2} ${r-y.height/2})`,className:k,visibility:y.width?"visible":"hidden",...h},s&&ie.createElement("rect",{width:y.width+2*l[0],x:-l[0],y:-l[1],height:y.height+2*l[1],className:"react-flow__edge-textbg",style:u,rx:c,ry:c}),ie.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:m,style:o},i),d)};var JI=Y.memo(ZI);const lm=e=>({width:e.offsetWidth,height:e.offsetHeight}),ki=(e,r=0,i=1)=>Math.min(Math.max(e,r),i),cm=(e={x:0,y:0},r)=>({x:ki(e.x,r[0][0],r[1][0]),y:ki(e.y,r[0][1],r[1][1])}),F0=(e,r,i)=>e<r?ki(Math.abs(e-r),1,50)/50:e>i?-ki(Math.abs(e-i),1,50)/50:0,mk=(e,r)=>{const i=F0(e.x,35,r.width-35)*20,o=F0(e.y,35,r.height-35)*20;return[i,o]},gk=e=>{var r;return((r=e.getRootNode)==null?void 0:r.call(e))||(window==null?void 0:window.document)},yk=(e,r)=>({x:Math.min(e.x,r.x),y:Math.min(e.y,r.y),x2:Math.max(e.x2,r.x2),y2:Math.max(e.y2,r.y2)}),Oo=({x:e,y:r,width:i,height:o})=>({x:e,y:r,x2:e+i,y2:r+o}),_k=({x:e,y:r,x2:i,y2:o})=>({x:e,y:r,width:i-e,height:o-r}),$0=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),eA=(e,r)=>_k(yk(Oo(e),Oo(r))),$v=(e,r)=>{const i=Math.max(0,Math.min(e.x+e.width,r.x+r.width)-Math.max(e.x,r.x)),o=Math.max(0,Math.min(e.y+e.height,r.y+r.height)-Math.max(e.y,r.y));return Math.ceil(i*o)},tA=e=>Xt(e.width)&&Xt(e.height)&&Xt(e.x)&&Xt(e.y),Xt=e=>!isNaN(e)&&isFinite(e),Ye=Symbol.for("internals"),wk=["Enter"," ","Escape"],nA=(e,r)=>{},rA=e=>"nativeEvent"in e;function Bv(e){var s,u;const r=rA(e)?e.nativeEvent:e,i=((u=(s=r.composedPath)==null?void 0:s.call(r))==null?void 0:u[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(i==null?void 0:i.nodeName)||(i==null?void 0:i.hasAttribute("contenteditable"))||!!(i!=null&&i.closest(".nokey"))}const xk=e=>"clientX"in e,fr=(e,r)=>{var u,l;const i=xk(e),o=i?e.clientX:(u=e.touches)==null?void 0:u[0].clientX,s=i?e.clientY:(l=e.touches)==null?void 0:l[0].clientY;return{x:o-((r==null?void 0:r.left)??0),y:s-((r==null?void 0:r.top)??0)}},Oa=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},$o=({id:e,path:r,labelX:i,labelY:o,label:s,labelStyle:u,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:_=20})=>ie.createElement(ie.Fragment,null,ie.createElement("path",{id:e,style:h,d:r,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:y}),_&&ie.createElement("path",{d:r,fill:"none",strokeOpacity:0,strokeWidth:_,className:"react-flow__edge-interaction"}),s&&Xt(i)&&Xt(o)?ie.createElement(JI,{x:i,y:o,label:s,labelStyle:u,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:p}):null);$o.displayName="BaseEdge";function _o(e,r,i){return i===void 0?i:o=>{const s=r().edges.find(u=>u.id===e);s&&i(o,{...s})}}function Sk({sourceX:e,sourceY:r,targetX:i,targetY:o}){const s=Math.abs(i-e)/2,u=i<e?i+s:i-s,l=Math.abs(o-r)/2,c=o<r?o+l:o-l;return[u,c,s,l]}function Ek({sourceX:e,sourceY:r,targetX:i,targetY:o,sourceControlX:s,sourceControlY:u,targetControlX:l,targetControlY:c}){const d=e*.125+s*.375+l*.375+i*.125,p=r*.125+u*.375+c*.375+o*.125,h=Math.abs(d-e),m=Math.abs(p-r);return[d,p,h,m]}var jr;(function(e){e.Strict="strict",e.Loose="loose"})(jr||(jr={}));var Mr;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Mr||(Mr={}));var Lo;(function(e){e.Partial="partial",e.Full="full"})(Lo||(Lo={}));var cr;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(cr||(cr={}));var La;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(La||(La={}));var Se;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Se||(Se={}));function B0({pos:e,x1:r,y1:i,x2:o,y2:s}){return e===Se.Left||e===Se.Right?[.5*(r+o),i]:[r,.5*(i+s)]}function kk({sourceX:e,sourceY:r,sourcePosition:i=Se.Bottom,targetX:o,targetY:s,targetPosition:u=Se.Top}){const[l,c]=B0({pos:i,x1:e,y1:r,x2:o,y2:s}),[d,p]=B0({pos:u,x1:o,y1:s,x2:e,y2:r}),[h,m,y,_]=Ek({sourceX:e,sourceY:r,targetX:o,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:d,targetControlY:p});return[`M${e},${r} C${l},${c} ${d},${p} ${o},${s}`,h,m,y,_]}const fm=Y.memo(({sourceX:e,sourceY:r,targetX:i,targetY:o,sourcePosition:s=Se.Bottom,targetPosition:u=Se.Top,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:_,markerStart:k,interactionWidth:w})=>{const[x,S,b]=kk({sourceX:e,sourceY:r,sourcePosition:s,targetX:i,targetY:o,targetPosition:u});return ie.createElement($o,{path:x,labelX:S,labelY:b,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:_,markerStart:k,interactionWidth:w})});fm.displayName="SimpleBezierEdge";const U0={[Se.Left]:{x:-1,y:0},[Se.Right]:{x:1,y:0},[Se.Top]:{x:0,y:-1},[Se.Bottom]:{x:0,y:1}},iA=({source:e,sourcePosition:r=Se.Bottom,target:i})=>r===Se.Left||r===Se.Right?e.x<i.x?{x:1,y:0}:{x:-1,y:0}:e.y<i.y?{x:0,y:1}:{x:0,y:-1},H0=(e,r)=>Math.sqrt(Math.pow(r.x-e.x,2)+Math.pow(r.y-e.y,2));function oA({source:e,sourcePosition:r=Se.Bottom,target:i,targetPosition:o=Se.Top,center:s,offset:u}){const l=U0[r],c=U0[o],d={x:e.x+l.x*u,y:e.y+l.y*u},p={x:i.x+c.x*u,y:i.y+c.y*u},h=iA({source:d,sourcePosition:r,target:p}),m=h.x!==0?"x":"y",y=h[m];let _=[],k,w;const x={x:0,y:0},S={x:0,y:0},[b,N,C,I]=Sk({sourceX:e.x,sourceY:e.y,targetX:i.x,targetY:i.y});if(l[m]*c[m]===-1){k=s.x??b,w=s.y??N;const P=[{x:k,y:d.y},{x:k,y:p.y}],$=[{x:d.x,y:w},{x:p.x,y:w}];l[m]===y?_=m==="x"?P:$:_=m==="x"?$:P}else{const P=[{x:d.x,y:p.y}],$=[{x:p.x,y:d.y}];if(m==="x"?_=l.x===y?$:P:_=l.y===y?P:$,r===o){const Z=Math.abs(e[m]-i[m]);if(Z<=u){const R=Math.min(u-1,u-Z);l[m]===y?x[m]=(d[m]>e[m]?-1:1)*R:S[m]=(p[m]>i[m]?-1:1)*R}}if(r!==o){const Z=m==="x"?"y":"x",R=l[m]===c[Z],W=d[Z]>p[Z],F=d[Z]<p[Z];(l[m]===1&&(!R&&W||R&&F)||l[m]!==1&&(!R&&F||R&&W))&&(_=m==="x"?P:$)}const L={x:d.x+x.x,y:d.y+x.y},U={x:p.x+S.x,y:p.y+S.y},V=Math.max(Math.abs(L.x-_[0].x),Math.abs(U.x-_[0].x)),ee=Math.max(Math.abs(L.y-_[0].y),Math.abs(U.y-_[0].y));V>=ee?(k=(L.x+U.x)/2,w=_[0].y):(k=_[0].x,w=(L.y+U.y)/2)}return[[e,{x:d.x+x.x,y:d.y+x.y},..._,{x:p.x+S.x,y:p.y+S.y},i],k,w,C,I]}function sA(e,r,i,o){const s=Math.min(H0(e,r)/2,H0(r,i)/2,o),{x:u,y:l}=r;if(e.x===u&&u===i.x||e.y===l&&l===i.y)return`L${u} ${l}`;if(e.y===l){const p=e.x<i.x?-1:1,h=e.y<i.y?1:-1;return`L ${u+s*p},${l}Q ${u},${l} ${u},${l+s*h}`}const c=e.x<i.x?1:-1,d=e.y<i.y?-1:1;return`L ${u},${l+s*d}Q ${u},${l} ${u+s*c},${l}`}function Uv({sourceX:e,sourceY:r,sourcePosition:i=Se.Bottom,targetX:o,targetY:s,targetPosition:u=Se.Top,borderRadius:l=5,centerX:c,centerY:d,offset:p=20}){const[h,m,y,_,k]=oA({source:{x:e,y:r},sourcePosition:i,target:{x:o,y:s},targetPosition:u,center:{x:c,y:d},offset:p});return[h.reduce((x,S,b)=>{let N="";return b>0&&b<h.length-1?N=sA(h[b-1],S,h[b+1],l):N=`${b===0?"M":"L"}${S.x} ${S.y}`,x+=N,x},""),m,y,_,k]}const Ha=Y.memo(({sourceX:e,sourceY:r,targetX:i,targetY:o,label:s,labelStyle:u,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:p,style:h,sourcePosition:m=Se.Bottom,targetPosition:y=Se.Top,markerEnd:_,markerStart:k,pathOptions:w,interactionWidth:x})=>{const[S,b,N]=Uv({sourceX:e,sourceY:r,sourcePosition:m,targetX:i,targetY:o,targetPosition:y,borderRadius:w==null?void 0:w.borderRadius,offset:w==null?void 0:w.offset});return ie.createElement($o,{path:S,labelX:b,labelY:N,label:s,labelStyle:u,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:p,style:h,markerEnd:_,markerStart:k,interactionWidth:x})});Ha.displayName="SmoothStepEdge";const dm=Y.memo(e=>{var r;return ie.createElement(Ha,{...e,pathOptions:Y.useMemo(()=>{var i;return{borderRadius:0,offset:(i=e.pathOptions)==null?void 0:i.offset}},[(r=e.pathOptions)==null?void 0:r.offset])})});dm.displayName="StepEdge";function aA({sourceX:e,sourceY:r,targetX:i,targetY:o}){const[s,u,l,c]=Sk({sourceX:e,sourceY:r,targetX:i,targetY:o});return[`M ${e},${r}L ${i},${o}`,s,u,l,c]}const hm=Y.memo(({sourceX:e,sourceY:r,targetX:i,targetY:o,label:s,labelStyle:u,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:_})=>{const[k,w,x]=aA({sourceX:e,sourceY:r,targetX:i,targetY:o});return ie.createElement($o,{path:k,labelX:w,labelY:x,label:s,labelStyle:u,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:_})});hm.displayName="StraightEdge";function _a(e,r){return e>=0?.5*e:r*25*Math.sqrt(-e)}function V0({pos:e,x1:r,y1:i,x2:o,y2:s,c:u}){switch(e){case Se.Left:return[r-_a(r-o,u),i];case Se.Right:return[r+_a(o-r,u),i];case Se.Top:return[r,i-_a(i-s,u)];case Se.Bottom:return[r,i+_a(s-i,u)]}}function bk({sourceX:e,sourceY:r,sourcePosition:i=Se.Bottom,targetX:o,targetY:s,targetPosition:u=Se.Top,curvature:l=.25}){const[c,d]=V0({pos:i,x1:e,y1:r,x2:o,y2:s,c:l}),[p,h]=V0({pos:u,x1:o,y1:s,x2:e,y2:r,c:l}),[m,y,_,k]=Ek({sourceX:e,sourceY:r,targetX:o,targetY:s,sourceControlX:c,sourceControlY:d,targetControlX:p,targetControlY:h});return[`M${e},${r} C${c},${d} ${p},${h} ${o},${s}`,m,y,_,k]}const ja=Y.memo(({sourceX:e,sourceY:r,targetX:i,targetY:o,sourcePosition:s=Se.Bottom,targetPosition:u=Se.Top,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:_,markerStart:k,pathOptions:w,interactionWidth:x})=>{const[S,b,N]=bk({sourceX:e,sourceY:r,sourcePosition:s,targetX:i,targetY:o,targetPosition:u,curvature:w==null?void 0:w.curvature});return ie.createElement($o,{path:S,labelX:b,labelY:N,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:_,markerStart:k,interactionWidth:x})});ja.displayName="BezierEdge";const pm=Y.createContext(null),uA=pm.Provider;pm.Consumer;const lA=()=>Y.useContext(pm),cA=e=>"id"in e&&"source"in e&&"target"in e,fA=({source:e,sourceHandle:r,target:i,targetHandle:o})=>`reactflow__edge-${e}${r||""}-${i}${o||""}`,Hv=(e,r)=>typeof e>"u"?"":typeof e=="string"?e:`${r?`${r}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`,dA=(e,r)=>r.some(i=>i.source===e.source&&i.target===e.target&&(i.sourceHandle===e.sourceHandle||!i.sourceHandle&&!e.sourceHandle)&&(i.targetHandle===e.targetHandle||!i.targetHandle&&!e.targetHandle)),hA=(e,r)=>{if(!e.source||!e.target)return r;let i;return cA(e)?i={...e}:i={...e,id:fA(e)},dA(i,r)?r:r.concat(i)},Vv=({x:e,y:r},[i,o,s],u,[l,c])=>{const d={x:(e-i)/s,y:(r-o)/s};return u?{x:l*Math.round(d.x/l),y:c*Math.round(d.y/c)}:d},Ck=({x:e,y:r},[i,o,s])=>({x:e*s+i,y:r*s+o}),qr=(e,r=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const i=(e.width??0)*r[0],o=(e.height??0)*r[1],s={x:e.position.x-i,y:e.position.y-o};return{...s,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-i,y:e.positionAbsolute.y-o}:s}},Va=(e,r=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const i=e.reduce((o,s)=>{const{x:u,y:l}=qr(s,r).positionAbsolute;return yk(o,Oo({x:u,y:l,width:s.width||0,height:s.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return _k(i)},Nk=(e,r,[i,o,s]=[0,0,1],u=!1,l=!1,c=[0,0])=>{const d={x:(r.x-i)/s,y:(r.y-o)/s,width:r.width/s,height:r.height/s},p=[];return e.forEach(h=>{const{width:m,height:y,selectable:_=!0,hidden:k=!1}=h;if(l&&!_||k)return!1;const{positionAbsolute:w}=qr(h,c),x={x:w.x,y:w.y,width:m||0,height:y||0},S=$v(d,x),b=typeof m>"u"||typeof y>"u"||m===null||y===null,N=u&&S>0,C=(m||0)*(y||0);(b||N||S>=C||h.dragging)&&p.push(h)}),p},Rk=(e,r)=>{const i=e.map(o=>o.id);return r.filter(o=>i.includes(o.source)||i.includes(o.target))},Tk=(e,r,i,o,s,u=.1)=>{const l=r/(e.width*(1+u)),c=i/(e.height*(1+u)),d=Math.min(l,c),p=ki(d,o,s),h=e.x+e.width/2,m=e.y+e.height/2,y=r/2-h*p,_=i/2-m*p;return{x:y,y:_,zoom:p}},Ir=(e,r=0)=>e.transition().duration(r);function G0(e,r,i,o){return(r[i]||[]).reduce((s,u)=>{var l,c;return`${e.id}-${u.id}-${i}`!==o&&s.push({id:u.id||null,type:i,nodeId:e.id,x:(((l=e.positionAbsolute)==null?void 0:l.x)??0)+u.x+u.width/2,y:(((c=e.positionAbsolute)==null?void 0:c.y)??0)+u.y+u.height/2}),s},[])}function pA(e,r,i,o,s,u){const{x:l,y:c}=fr(e),p=r.elementsFromPoint(l,c).find(k=>k.classList.contains("react-flow__handle"));if(p){const k=p.getAttribute("data-nodeid");if(k){const w=vm(void 0,p),x=p.getAttribute("data-handleid"),S=u({nodeId:k,id:x,type:w});if(S){const b=s.find(N=>N.nodeId===k&&N.type===w&&N.id===x);return{handle:{id:x,type:w,nodeId:k,x:(b==null?void 0:b.x)||i.x,y:(b==null?void 0:b.y)||i.y},validHandleResult:S}}}}let h=[],m=1/0;if(s.forEach(k=>{const w=Math.sqrt((k.x-i.x)**2+(k.y-i.y)**2);if(w<=o){const x=u(k);w<=m&&(w<m?h=[{handle:k,validHandleResult:x}]:w===m&&h.push({handle:k,validHandleResult:x}),m=w)}}),!h.length)return{handle:null,validHandleResult:Ik()};if(h.length===1)return h[0];const y=h.some(({validHandleResult:k})=>k.isValid),_=h.some(({handle:k})=>k.type==="target");return h.find(({handle:k,validHandleResult:w})=>_?k.type==="target":y?w.isValid:!0)||h[0]}const vA={source:null,target:null,sourceHandle:null,targetHandle:null},Ik=()=>({handleDomNode:null,isValid:!1,connection:vA,endHandle:null});function Ak(e,r,i,o,s,u,l){const c=s==="target",d=l.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),p={...Ik(),handleDomNode:d};if(d){const h=vm(void 0,d),m=d.getAttribute("data-nodeid"),y=d.getAttribute("data-handleid"),_=d.classList.contains("connectable"),k=d.classList.contains("connectableend"),w={source:c?m:i,sourceHandle:c?y:o,target:c?i:m,targetHandle:c?o:y};p.connection=w,_&&k&&(r===jr.Strict?c&&h==="source"||!c&&h==="target":m!==i||y!==o)&&(p.endHandle={nodeId:m,handleId:y,type:h},p.isValid=u(w))}return p}function mA({nodes:e,nodeId:r,handleId:i,handleType:o}){return e.reduce((s,u)=>{if(u[Ye]){const{handleBounds:l}=u[Ye];let c=[],d=[];l&&(c=G0(u,l,"source",`${r}-${i}-${o}`),d=G0(u,l,"target",`${r}-${i}-${o}`)),s.push(...c,...d)}return s},[])}function vm(e,r){return e||(r!=null&&r.classList.contains("target")?"target":r!=null&&r.classList.contains("source")?"source":null)}function uc(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function gA(e,r){let i=null;return r?i="valid":e&&!r&&(i="invalid"),i}function Mk({event:e,handleId:r,nodeId:i,onConnect:o,isTarget:s,getState:u,setState:l,isValidConnection:c,edgeUpdaterType:d,onReconnectEnd:p}){const h=gk(e.target),{connectionMode:m,domNode:y,autoPanOnConnect:_,connectionRadius:k,onConnectStart:w,panBy:x,getNodes:S,cancelConnection:b}=u();let N=0,C;const{x:I,y:A}=fr(e),P=h==null?void 0:h.elementFromPoint(I,A),$=vm(d,P),L=y==null?void 0:y.getBoundingClientRect();if(!L||!$)return;let U,V=fr(e,L),ee=!1,Z=null,R=!1,W=null;const F=mA({nodes:S(),nodeId:i,handleId:r,handleType:$}),ne=()=>{if(!_)return;const[K,T]=mk(V,L);x({x:K,y:T}),N=requestAnimationFrame(ne)};l({connectionPosition:V,connectionStatus:null,connectionNodeId:i,connectionHandleId:r,connectionHandleType:$,connectionStartHandle:{nodeId:i,handleId:r,type:$},connectionEndHandle:null}),w==null||w(e,{nodeId:i,handleId:r,handleType:$});function G(K){const{transform:T}=u();V=fr(K,L);const{handle:z,validHandleResult:ae}=pA(K,h,Vv(V,T,!1,[1,1]),k,F,q=>Ak(q,m,i,r,s?"target":"source",c,h));if(C=z,ee||(ne(),ee=!0),W=ae.handleDomNode,Z=ae.connection,R=ae.isValid,l({connectionPosition:C&&R?Ck({x:C.x,y:C.y},T):V,connectionStatus:gA(!!C,R),connectionEndHandle:ae.endHandle}),!C&&!R&&!W)return uc(U);Z.source!==Z.target&&W&&(uc(U),U=W,W.classList.add("connecting","react-flow__handle-connecting"),W.classList.toggle("valid",R),W.classList.toggle("react-flow__handle-valid",R))}function j(K){var T,z;(C||W)&&Z&&R&&(o==null||o(Z)),(z=(T=u()).onConnectEnd)==null||z.call(T,K),d&&(p==null||p(K)),uc(U),b(),cancelAnimationFrame(N),ee=!1,R=!1,Z=null,W=null,h.removeEventListener("mousemove",G),h.removeEventListener("mouseup",j),h.removeEventListener("touchmove",G),h.removeEventListener("touchend",j)}h.addEventListener("mousemove",G),h.addEventListener("mouseup",j),h.addEventListener("touchmove",G),h.addEventListener("touchend",j)}const W0=()=>!0,yA=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),_A=(e,r,i)=>o=>{const{connectionStartHandle:s,connectionEndHandle:u,connectionClickStartHandle:l}=o;return{connecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.handleId)===r&&(s==null?void 0:s.type)===i||(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.handleId)===r&&(u==null?void 0:u.type)===i,clickConnecting:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===r&&(l==null?void 0:l.type)===i}},Pk=Y.forwardRef(({type:e="source",position:r=Se.Top,isValidConnection:i,isConnectable:o=!0,isConnectableStart:s=!0,isConnectableEnd:u=!0,id:l,onConnect:c,children:d,className:p,onMouseDown:h,onTouchStart:m,...y},_)=>{var L,U;const k=l||null,w=e==="target",x=st(),S=lA(),{connectOnClick:b,noPanClassName:N}=Oe(yA,ot),{connecting:C,clickConnecting:I}=Oe(_A(S,k,e),ot);S||(U=(L=x.getState()).onError)==null||U.call(L,"010",zn.error010());const A=V=>{const{defaultEdgeOptions:ee,onConnect:Z,hasDefaultEdges:R}=x.getState(),W={...ee,...V};if(R){const{edges:F,setEdges:ne}=x.getState();ne(hA(W,F))}Z==null||Z(W),c==null||c(W)},P=V=>{if(!S)return;const ee=xk(V);s&&(ee&&V.button===0||!ee)&&Mk({event:V,handleId:k,nodeId:S,onConnect:A,isTarget:w,getState:x.getState,setState:x.setState,isValidConnection:i||x.getState().isValidConnection||W0}),ee?h==null||h(V):m==null||m(V)},$=V=>{const{onClickConnectStart:ee,onClickConnectEnd:Z,connectionClickStartHandle:R,connectionMode:W,isValidConnection:F}=x.getState();if(!S||!R&&!s)return;if(!R){ee==null||ee(V,{nodeId:S,handleId:k,handleType:e}),x.setState({connectionClickStartHandle:{nodeId:S,type:e,handleId:k}});return}const ne=gk(V.target),G=i||F||W0,{connection:j,isValid:K}=Ak({nodeId:S,id:k,type:e},W,R.nodeId,R.handleId||null,R.type,G,ne);K&&A(j),Z==null||Z(V),x.setState({connectionClickStartHandle:null})};return ie.createElement("div",{"data-handleid":k,"data-nodeid":S,"data-handlepos":r,"data-id":`${S}-${k}-${e}`,className:pt(["react-flow__handle",`react-flow__handle-${r}`,"nodrag",N,p,{source:!w,target:w,connectable:o,connectablestart:s,connectableend:u,connecting:I,connectionindicator:o&&(s&&!C||u&&C)}]),onMouseDown:P,onTouchStart:P,onClick:b?$:void 0,ref:_,...y},d)});Pk.displayName="Handle";var bi=Y.memo(Pk);const qk=({data:e,isConnectable:r,targetPosition:i=Se.Top,sourcePosition:o=Se.Bottom})=>ie.createElement(ie.Fragment,null,ie.createElement(bi,{type:"target",position:i,isConnectable:r}),e==null?void 0:e.label,ie.createElement(bi,{type:"source",position:o,isConnectable:r}));qk.displayName="DefaultNode";var Gv=Y.memo(qk);const Ok=({data:e,isConnectable:r,sourcePosition:i=Se.Bottom})=>ie.createElement(ie.Fragment,null,e==null?void 0:e.label,ie.createElement(bi,{type:"source",position:i,isConnectable:r}));Ok.displayName="InputNode";var Lk=Y.memo(Ok);const jk=({data:e,isConnectable:r,targetPosition:i=Se.Top})=>ie.createElement(ie.Fragment,null,ie.createElement(bi,{type:"target",position:i,isConnectable:r}),e==null?void 0:e.label);jk.displayName="OutputNode";var Dk=Y.memo(jk);const mm=()=>null;mm.displayName="GroupNode";const wA=e=>({selectedNodes:e.getNodes().filter(r=>r.selected),selectedEdges:e.edges.filter(r=>r.selected).map(r=>({...r}))}),wa=e=>e.id;function xA(e,r){return ot(e.selectedNodes.map(wa),r.selectedNodes.map(wa))&&ot(e.selectedEdges.map(wa),r.selectedEdges.map(wa))}const zk=Y.memo(({onSelectionChange:e})=>{const r=st(),{selectedNodes:i,selectedEdges:o}=Oe(wA,xA);return Y.useEffect(()=>{const s={nodes:i,edges:o};e==null||e(s),r.getState().onSelectionChange.forEach(u=>u(s))},[i,o,e]),null});zk.displayName="SelectionListener";const SA=e=>!!e.onSelectionChange;function EA({onSelectionChange:e}){const r=Oe(SA);return e||r?ie.createElement(zk,{onSelectionChange:e}):null}const kA=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function pi(e,r){Y.useEffect(()=>{typeof e<"u"&&r(e)},[e])}function Ie(e,r,i){Y.useEffect(()=>{typeof r<"u"&&i({[e]:r})},[r])}const bA=({nodes:e,edges:r,defaultNodes:i,defaultEdges:o,onConnect:s,onConnectStart:u,onConnectEnd:l,onClickConnectStart:c,onClickConnectEnd:d,nodesDraggable:p,nodesConnectable:h,nodesFocusable:m,edgesFocusable:y,edgesUpdatable:_,elevateNodesOnSelect:k,minZoom:w,maxZoom:x,nodeExtent:S,onNodesChange:b,onEdgesChange:N,elementsSelectable:C,connectionMode:I,snapGrid:A,snapToGrid:P,translateExtent:$,connectOnClick:L,defaultEdgeOptions:U,fitView:V,fitViewOptions:ee,onNodesDelete:Z,onEdgesDelete:R,onNodeDrag:W,onNodeDragStart:F,onNodeDragStop:ne,onSelectionDrag:G,onSelectionDragStart:j,onSelectionDragStop:K,noPanClassName:T,nodeOrigin:z,rfId:ae,autoPanOnConnect:q,autoPanOnNodeDrag:H,onError:X,connectionRadius:oe,isValidConnection:ue,nodeDragThreshold:se})=>{const{setNodes:re,setEdges:Ee,setDefaultNodesAndEdges:Re,setMinZoom:xe,setMaxZoom:Ce,setTranslateExtent:ye,setNodeExtent:Le,reset:ve}=Oe(kA,ot),he=st();return Y.useEffect(()=>{const Pe=o==null?void 0:o.map(He=>({...He,...U}));return Re(i,Pe),()=>{ve()}},[]),Ie("defaultEdgeOptions",U,he.setState),Ie("connectionMode",I,he.setState),Ie("onConnect",s,he.setState),Ie("onConnectStart",u,he.setState),Ie("onConnectEnd",l,he.setState),Ie("onClickConnectStart",c,he.setState),Ie("onClickConnectEnd",d,he.setState),Ie("nodesDraggable",p,he.setState),Ie("nodesConnectable",h,he.setState),Ie("nodesFocusable",m,he.setState),Ie("edgesFocusable",y,he.setState),Ie("edgesUpdatable",_,he.setState),Ie("elementsSelectable",C,he.setState),Ie("elevateNodesOnSelect",k,he.setState),Ie("snapToGrid",P,he.setState),Ie("snapGrid",A,he.setState),Ie("onNodesChange",b,he.setState),Ie("onEdgesChange",N,he.setState),Ie("connectOnClick",L,he.setState),Ie("fitViewOnInit",V,he.setState),Ie("fitViewOnInitOptions",ee,he.setState),Ie("onNodesDelete",Z,he.setState),Ie("onEdgesDelete",R,he.setState),Ie("onNodeDrag",W,he.setState),Ie("onNodeDragStart",F,he.setState),Ie("onNodeDragStop",ne,he.setState),Ie("onSelectionDrag",G,he.setState),Ie("onSelectionDragStart",j,he.setState),Ie("onSelectionDragStop",K,he.setState),Ie("noPanClassName",T,he.setState),Ie("nodeOrigin",z,he.setState),Ie("rfId",ae,he.setState),Ie("autoPanOnConnect",q,he.setState),Ie("autoPanOnNodeDrag",H,he.setState),Ie("onError",X,he.setState),Ie("connectionRadius",oe,he.setState),Ie("isValidConnection",ue,he.setState),Ie("nodeDragThreshold",se,he.setState),pi(e,re),pi(r,Ee),pi(w,xe),pi(x,Ce),pi($,ye),pi(S,Le),null},K0={display:"none"},CA={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Fk="react-flow__node-desc",$k="react-flow__edge-desc",NA="react-flow__aria-live",RA=e=>e.ariaLiveMessage;function TA({rfId:e}){const r=Oe(RA);return ie.createElement("div",{id:`${NA}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:CA},r)}function IA({rfId:e,disableKeyboardA11y:r}){return ie.createElement(ie.Fragment,null,ie.createElement("div",{id:`${Fk}-${e}`,style:K0},"Press enter or space to select a node.",!r&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),ie.createElement("div",{id:`${$k}-${e}`,style:K0},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!r&&ie.createElement(TA,{rfId:e}))}var jo=(e=null,r={actInsideInputWithModifier:!0})=>{const[i,o]=Y.useState(!1),s=Y.useRef(!1),u=Y.useRef(new Set([])),[l,c]=Y.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.split("+")),h=p.reduce((m,y)=>m.concat(...y),[]);return[p,h]}return[[],[]]},[e]);return Y.useEffect(()=>{const d=typeof document<"u"?document:null,p=(r==null?void 0:r.target)||d;if(e!==null){const h=_=>{if(s.current=_.ctrlKey||_.metaKey||_.shiftKey,(!s.current||s.current&&!r.actInsideInputWithModifier)&&Bv(_))return!1;const w=X0(_.code,c);u.current.add(_[w]),Y0(l,u.current,!1)&&(_.preventDefault(),o(!0))},m=_=>{if((!s.current||s.current&&!r.actInsideInputWithModifier)&&Bv(_))return!1;const w=X0(_.code,c);Y0(l,u.current,!0)?(o(!1),u.current.clear()):u.current.delete(_[w]),_.key==="Meta"&&u.current.clear(),s.current=!1},y=()=>{u.current.clear(),o(!1)};return p==null||p.addEventListener("keydown",h),p==null||p.addEventListener("keyup",m),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",h),p==null||p.removeEventListener("keyup",m),window.removeEventListener("blur",y)}}},[e,o]),i};function Y0(e,r,i){return e.filter(o=>i||o.length===r.size).some(o=>o.every(s=>r.has(s)))}function X0(e,r){return r.includes(e)?"code":"key"}function Bk(e,r,i,o){var c,d;const s=e.parentNode||e.parentId;if(!s)return i;const u=r.get(s),l=qr(u,o);return Bk(u,r,{x:(i.x??0)+l.x,y:(i.y??0)+l.y,z:(((c=u[Ye])==null?void 0:c.z)??0)>(i.z??0)?((d=u[Ye])==null?void 0:d.z)??0:i.z??0},o)}function Uk(e,r,i){e.forEach(o=>{var u;const s=o.parentNode||o.parentId;if(s&&!e.has(s))throw new Error(`Parent node ${s} not found`);if(s||i!=null&&i[o.id]){const{x:l,y:c,z:d}=Bk(o,e,{...o.position,z:((u=o[Ye])==null?void 0:u.z)??0},r);o.positionAbsolute={x:l,y:c},o[Ye].z=d,i!=null&&i[o.id]&&(o[Ye].isParent=!0)}})}function lc(e,r,i,o){const s=new Map,u={},l=o?1e3:0;return e.forEach(c=>{var _;const d=(Xt(c.zIndex)?c.zIndex:0)+(c.selected?l:0),p=r.get(c.id),h={...c,positionAbsolute:{x:c.position.x,y:c.position.y}},m=c.parentNode||c.parentId;m&&(u[m]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==c.type;Object.defineProperty(h,Ye,{enumerable:!1,value:{handleBounds:y||(_=p==null?void 0:p[Ye])==null?void 0:_.handleBounds,z:d}}),s.set(c.id,h)}),Uk(s,i,u),s}function Hk(e,r={}){const{getNodes:i,width:o,height:s,minZoom:u,maxZoom:l,d3Zoom:c,d3Selection:d,fitViewOnInitDone:p,fitViewOnInit:h,nodeOrigin:m}=e(),y=r.initial&&!p&&h;if(c&&d&&(y||!r.initial)){const k=i().filter(x=>{var b;const S=r.includeHiddenNodes?x.width&&x.height:!x.hidden;return(b=r.nodes)!=null&&b.length?S&&r.nodes.some(N=>N.id===x.id):S}),w=k.every(x=>x.width&&x.height);if(k.length>0&&w){const x=Va(k,m),{x:S,y:b,zoom:N}=Tk(x,o,s,r.minZoom??u,r.maxZoom??l,r.padding??.1),C=jn.translate(S,b).scale(N);return typeof r.duration=="number"&&r.duration>0?c.transform(Ir(d,r.duration),C):c.transform(d,C),!0}}return!1}function AA(e,r){return e.forEach(i=>{const o=r.get(i.id);o&&r.set(o.id,{...o,[Ye]:o[Ye],selected:i.selected})}),new Map(r)}function MA(e,r){return r.map(i=>{const o=e.find(s=>s.id===i.id);return o&&(i.selected=o.selected),i})}function xa({changedNodes:e,changedEdges:r,get:i,set:o}){const{nodeInternals:s,edges:u,onNodesChange:l,onEdgesChange:c,hasDefaultNodes:d,hasDefaultEdges:p}=i();e!=null&&e.length&&(d&&o({nodeInternals:AA(e,s)}),l==null||l(e)),r!=null&&r.length&&(p&&o({edges:MA(r,u)}),c==null||c(r))}const vi=()=>{},PA={zoomIn:vi,zoomOut:vi,zoomTo:vi,getZoom:()=>1,setViewport:vi,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:vi,fitBounds:vi,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},qA=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),OA=()=>{const e=st(),{d3Zoom:r,d3Selection:i}=Oe(qA,ot);return Y.useMemo(()=>i&&r?{zoomIn:s=>r.scaleBy(Ir(i,s==null?void 0:s.duration),1.2),zoomOut:s=>r.scaleBy(Ir(i,s==null?void 0:s.duration),1/1.2),zoomTo:(s,u)=>r.scaleTo(Ir(i,u==null?void 0:u.duration),s),getZoom:()=>e.getState().transform[2],setViewport:(s,u)=>{const[l,c,d]=e.getState().transform,p=jn.translate(s.x??l,s.y??c).scale(s.zoom??d);r.transform(Ir(i,u==null?void 0:u.duration),p)},getViewport:()=>{const[s,u,l]=e.getState().transform;return{x:s,y:u,zoom:l}},fitView:s=>Hk(e.getState,s),setCenter:(s,u,l)=>{const{width:c,height:d,maxZoom:p}=e.getState(),h=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:p,m=c/2-s*h,y=d/2-u*h,_=jn.translate(m,y).scale(h);r.transform(Ir(i,l==null?void 0:l.duration),_)},fitBounds:(s,u)=>{const{width:l,height:c,minZoom:d,maxZoom:p}=e.getState(),{x:h,y:m,zoom:y}=Tk(s,l,c,d,p,(u==null?void 0:u.padding)??.1),_=jn.translate(h,m).scale(y);r.transform(Ir(i,u==null?void 0:u.duration),_)},project:s=>{const{transform:u,snapToGrid:l,snapGrid:c}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Vv(s,u,l,c)},screenToFlowPosition:s=>{const{transform:u,snapToGrid:l,snapGrid:c,domNode:d}=e.getState();if(!d)return s;const{x:p,y:h}=d.getBoundingClientRect(),m={x:s.x-p,y:s.y-h};return Vv(m,u,l,c)},flowToScreenPosition:s=>{const{transform:u,domNode:l}=e.getState();if(!l)return s;const{x:c,y:d}=l.getBoundingClientRect(),p=Ck(s,u);return{x:p.x+c,y:p.y+d}},viewportInitialized:!0}:PA,[r,i])};function Ga(){const e=OA(),r=st(),i=Y.useCallback(()=>r.getState().getNodes().map(w=>({...w})),[]),o=Y.useCallback(w=>r.getState().nodeInternals.get(w),[]),s=Y.useCallback(()=>{const{edges:w=[]}=r.getState();return w.map(x=>({...x}))},[]),u=Y.useCallback(w=>{const{edges:x=[]}=r.getState();return x.find(S=>S.id===w)},[]),l=Y.useCallback(w=>{const{getNodes:x,setNodes:S,hasDefaultNodes:b,onNodesChange:N}=r.getState(),C=x(),I=typeof w=="function"?w(C):w;if(b)S(I);else if(N){const A=I.length===0?C.map(P=>({type:"remove",id:P.id})):I.map(P=>({item:P,type:"reset"}));N(A)}},[]),c=Y.useCallback(w=>{const{edges:x=[],setEdges:S,hasDefaultEdges:b,onEdgesChange:N}=r.getState(),C=typeof w=="function"?w(x):w;if(b)S(C);else if(N){const I=C.length===0?x.map(A=>({type:"remove",id:A.id})):C.map(A=>({item:A,type:"reset"}));N(I)}},[]),d=Y.useCallback(w=>{const x=Array.isArray(w)?w:[w],{getNodes:S,setNodes:b,hasDefaultNodes:N,onNodesChange:C}=r.getState();if(N){const A=[...S(),...x];b(A)}else if(C){const I=x.map(A=>({item:A,type:"add"}));C(I)}},[]),p=Y.useCallback(w=>{const x=Array.isArray(w)?w:[w],{edges:S=[],setEdges:b,hasDefaultEdges:N,onEdgesChange:C}=r.getState();if(N)b([...S,...x]);else if(C){const I=x.map(A=>({item:A,type:"add"}));C(I)}},[]),h=Y.useCallback(()=>{const{getNodes:w,edges:x=[],transform:S}=r.getState(),[b,N,C]=S;return{nodes:w().map(I=>({...I})),edges:x.map(I=>({...I})),viewport:{x:b,y:N,zoom:C}}},[]),m=Y.useCallback(({nodes:w,edges:x})=>{const{nodeInternals:S,getNodes:b,edges:N,hasDefaultNodes:C,hasDefaultEdges:I,onNodesDelete:A,onEdgesDelete:P,onNodesChange:$,onEdgesChange:L}=r.getState(),U=(w||[]).map(W=>W.id),V=(x||[]).map(W=>W.id),ee=b().reduce((W,F)=>{const ne=F.parentNode||F.parentId,G=!U.includes(F.id)&&ne&&W.find(K=>K.id===ne);return(typeof F.deletable=="boolean"?F.deletable:!0)&&(U.includes(F.id)||G)&&W.push(F),W},[]),Z=N.filter(W=>typeof W.deletable=="boolean"?W.deletable:!0),R=Z.filter(W=>V.includes(W.id));if(ee||R){const W=Rk(ee,Z),F=[...R,...W],ne=F.reduce((G,j)=>(G.includes(j.id)||G.push(j.id),G),[]);if((I||C)&&(I&&r.setState({edges:N.filter(G=>!ne.includes(G.id))}),C&&(ee.forEach(G=>{S.delete(G.id)}),r.setState({nodeInternals:new Map(S)}))),ne.length>0&&(P==null||P(F),L&&L(ne.map(G=>({id:G,type:"remove"})))),ee.length>0&&(A==null||A(ee),$)){const G=ee.map(j=>({id:j.id,type:"remove"}));$(G)}}},[]),y=Y.useCallback(w=>{const x=tA(w),S=x?null:r.getState().nodeInternals.get(w.id);return!x&&!S?[null,null,x]:[x?w:$0(S),S,x]},[]),_=Y.useCallback((w,x=!0,S)=>{const[b,N,C]=y(w);return b?(S||r.getState().getNodes()).filter(I=>{if(!C&&(I.id===N.id||!I.positionAbsolute))return!1;const A=$0(I),P=$v(A,b);return x&&P>0||P>=b.width*b.height}):[]},[]),k=Y.useCallback((w,x,S=!0)=>{const[b]=y(w);if(!b)return!1;const N=$v(b,x);return S&&N>0||N>=b.width*b.height},[]);return Y.useMemo(()=>({...e,getNodes:i,getNode:o,getEdges:s,getEdge:u,setNodes:l,setEdges:c,addNodes:d,addEdges:p,toObject:h,deleteElements:m,getIntersectingNodes:_,isNodeIntersecting:k}),[e,i,o,s,u,l,c,d,p,h,m,_,k])}const LA={actInsideInputWithModifier:!1};var jA=({deleteKeyCode:e,multiSelectionKeyCode:r})=>{const i=st(),{deleteElements:o}=Ga(),s=jo(e,LA),u=jo(r);Y.useEffect(()=>{if(s){const{edges:l,getNodes:c}=i.getState(),d=c().filter(h=>h.selected),p=l.filter(h=>h.selected);o({nodes:d,edges:p}),i.setState({nodesSelectionActive:!1})}},[s]),Y.useEffect(()=>{i.setState({multiSelectionActive:u})},[u])};function DA(e){const r=st();Y.useEffect(()=>{let i;const o=()=>{var u,l;if(!e.current)return;const s=lm(e.current);(s.height===0||s.width===0)&&((l=(u=r.getState()).onError)==null||l.call(u,"004",zn.error004())),r.setState({width:s.width||500,height:s.height||500})};return o(),window.addEventListener("resize",o),e.current&&(i=new ResizeObserver(()=>o()),i.observe(e.current)),()=>{window.removeEventListener("resize",o),i&&e.current&&i.unobserve(e.current)}},[])}const gm={position:"absolute",width:"100%",height:"100%",top:0,left:0},zA=(e,r)=>e.x!==r.x||e.y!==r.y||e.zoom!==r.k,Sa=e=>({x:e.x,y:e.y,zoom:e.k}),mi=(e,r)=>e.target.closest(`.${r}`),Q0=(e,r)=>r===2&&Array.isArray(e)&&e.includes(2),Z0=e=>{const r=e.ctrlKey&&Oa()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*r},FA=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),$A=({onMove:e,onMoveStart:r,onMoveEnd:i,onPaneContextMenu:o,zoomOnScroll:s=!0,zoomOnPinch:u=!0,panOnScroll:l=!1,panOnScrollSpeed:c=.5,panOnScrollMode:d=Mr.Free,zoomOnDoubleClick:p=!0,elementsSelectable:h,panOnDrag:m=!0,defaultViewport:y,translateExtent:_,minZoom:k,maxZoom:w,zoomActivationKeyCode:x,preventScrolling:S=!0,children:b,noWheelClassName:N,noPanClassName:C})=>{const I=Y.useRef(),A=st(),P=Y.useRef(!1),$=Y.useRef(!1),L=Y.useRef(null),U=Y.useRef({x:0,y:0,zoom:0}),{d3Zoom:V,d3Selection:ee,d3ZoomHandler:Z,userSelectionActive:R}=Oe(FA,ot),W=jo(x),F=Y.useRef(0),ne=Y.useRef(!1),G=Y.useRef();return DA(L),Y.useEffect(()=>{if(L.current){const j=L.current.getBoundingClientRect(),K=pk().scaleExtent([k,w]).translateExtent(_),T=Yt(L.current).call(K),z=jn.translate(y.x,y.y).scale(ki(y.zoom,k,w)),ae=[[0,0],[j.width,j.height]],q=K.constrain()(z,ae,_);K.transform(T,q),K.wheelDelta(Z0),A.setState({d3Zoom:K,d3Selection:T,d3ZoomHandler:T.on("wheel.zoom"),transform:[q.x,q.y,q.k],domNode:L.current.closest(".react-flow")})}},[]),Y.useEffect(()=>{ee&&V&&(l&&!W&&!R?ee.on("wheel.zoom",j=>{if(mi(j,N))return!1;j.preventDefault(),j.stopImmediatePropagation();const K=ee.property("__zoom").k||1;if(j.ctrlKey&&u){const ue=an(j),se=Z0(j),re=K*Math.pow(2,se);V.scaleTo(ee,re,ue,j);return}const T=j.deltaMode===1?20:1;let z=d===Mr.Vertical?0:j.deltaX*T,ae=d===Mr.Horizontal?0:j.deltaY*T;!Oa()&&j.shiftKey&&d!==Mr.Vertical&&(z=j.deltaY*T,ae=0),V.translateBy(ee,-(z/K)*c,-(ae/K)*c,{internal:!0});const q=Sa(ee.property("__zoom")),{onViewportChangeStart:H,onViewportChange:X,onViewportChangeEnd:oe}=A.getState();clearTimeout(G.current),ne.current||(ne.current=!0,r==null||r(j,q),H==null||H(q)),ne.current&&(e==null||e(j,q),X==null||X(q),G.current=setTimeout(()=>{i==null||i(j,q),oe==null||oe(q),ne.current=!1},150))},{passive:!1}):typeof Z<"u"&&ee.on("wheel.zoom",function(j,K){if(!S&&j.type==="wheel"&&!j.ctrlKey||mi(j,N))return null;j.preventDefault(),Z.call(this,j,K)},{passive:!1}))},[R,l,d,ee,V,Z,W,u,S,N,r,e,i]),Y.useEffect(()=>{V&&V.on("start",j=>{var z,ae;if(!j.sourceEvent||j.sourceEvent.internal)return null;F.current=(z=j.sourceEvent)==null?void 0:z.button;const{onViewportChangeStart:K}=A.getState(),T=Sa(j.transform);P.current=!0,U.current=T,((ae=j.sourceEvent)==null?void 0:ae.type)==="mousedown"&&A.setState({paneDragging:!0}),K==null||K(T),r==null||r(j.sourceEvent,T)})},[V,r]),Y.useEffect(()=>{V&&(R&&!P.current?V.on("zoom",null):R||V.on("zoom",j=>{var T;const{onViewportChange:K}=A.getState();if(A.setState({transform:[j.transform.x,j.transform.y,j.transform.k]}),$.current=!!(o&&Q0(m,F.current??0)),(e||K)&&!((T=j.sourceEvent)!=null&&T.internal)){const z=Sa(j.transform);K==null||K(z),e==null||e(j.sourceEvent,z)}}))},[R,V,e,m,o]),Y.useEffect(()=>{V&&V.on("end",j=>{if(!j.sourceEvent||j.sourceEvent.internal)return null;const{onViewportChangeEnd:K}=A.getState();if(P.current=!1,A.setState({paneDragging:!1}),o&&Q0(m,F.current??0)&&!$.current&&o(j.sourceEvent),$.current=!1,(i||K)&&zA(U.current,j.transform)){const T=Sa(j.transform);U.current=T,clearTimeout(I.current),I.current=setTimeout(()=>{K==null||K(T),i==null||i(j.sourceEvent,T)},l?150:0)}})},[V,l,m,i,o]),Y.useEffect(()=>{V&&V.filter(j=>{const K=W||s,T=u&&j.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&j.button===1&&j.type==="mousedown"&&(mi(j,"react-flow__node")||mi(j,"react-flow__edge")))return!0;if(!m&&!K&&!l&&!p&&!u||R||!p&&j.type==="dblclick"||mi(j,N)&&j.type==="wheel"||mi(j,C)&&(j.type!=="wheel"||l&&j.type==="wheel"&&!W)||!u&&j.ctrlKey&&j.type==="wheel"||!K&&!l&&!T&&j.type==="wheel"||!m&&(j.type==="mousedown"||j.type==="touchstart")||Array.isArray(m)&&!m.includes(j.button)&&j.type==="mousedown")return!1;const z=Array.isArray(m)&&m.includes(j.button)||!j.button||j.button<=1;return(!j.ctrlKey||j.type==="wheel")&&z})},[R,V,s,u,l,p,m,h,W]),ie.createElement("div",{className:"react-flow__renderer",ref:L,style:gm},b)},BA=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function UA(){const{userSelectionActive:e,userSelectionRect:r}=Oe(BA,ot);return e&&r?ie.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:r.width,height:r.height,transform:`translate(${r.x}px, ${r.y}px)`}}):null}function J0(e,r){const i=r.parentNode||r.parentId,o=e.find(s=>s.id===i);if(o){const s=r.position.x+r.width-o.width,u=r.position.y+r.height-o.height;if(s>0||u>0||r.position.x<0||r.position.y<0){if(o.style={...o.style},o.style.width=o.style.width??o.width,o.style.height=o.style.height??o.height,s>0&&(o.style.width+=s),u>0&&(o.style.height+=u),r.position.x<0){const l=Math.abs(r.position.x);o.position.x=o.position.x-l,o.style.width+=l,r.position.x=0}if(r.position.y<0){const l=Math.abs(r.position.y);o.position.y=o.position.y-l,o.style.height+=l,r.position.y=0}o.width=o.style.width,o.height=o.style.height}}}function HA(e,r){if(e.some(o=>o.type==="reset"))return e.filter(o=>o.type==="reset").map(o=>o.item);const i=e.filter(o=>o.type==="add").map(o=>o.item);return r.reduce((o,s)=>{const u=e.filter(c=>c.id===s.id);if(u.length===0)return o.push(s),o;const l={...s};for(const c of u)if(c)switch(c.type){case"select":{l.selected=c.selected;break}case"position":{typeof c.position<"u"&&(l.position=c.position),typeof c.positionAbsolute<"u"&&(l.positionAbsolute=c.positionAbsolute),typeof c.dragging<"u"&&(l.dragging=c.dragging),l.expandParent&&J0(o,l);break}case"dimensions":{typeof c.dimensions<"u"&&(l.width=c.dimensions.width,l.height=c.dimensions.height),typeof c.updateStyle<"u"&&(l.style={...l.style||{},...c.dimensions}),typeof c.resizing=="boolean"&&(l.resizing=c.resizing),l.expandParent&&J0(o,l);break}case"remove":return o}return o.push(l),o},i)}function VA(e,r){return HA(e,r)}const lr=(e,r)=>({id:e,type:"select",selected:r});function yi(e,r){return e.reduce((i,o)=>{const s=r.includes(o.id);return!o.selected&&s?(o.selected=!0,i.push(lr(o.id,!0))):o.selected&&!s&&(o.selected=!1,i.push(lr(o.id,!1))),i},[])}const cc=(e,r)=>i=>{i.target===r.current&&(e==null||e(i))},GA=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),Vk=Y.memo(({isSelecting:e,selectionMode:r=Lo.Full,panOnDrag:i,onSelectionStart:o,onSelectionEnd:s,onPaneClick:u,onPaneContextMenu:l,onPaneScroll:c,onPaneMouseEnter:d,onPaneMouseMove:p,onPaneMouseLeave:h,children:m})=>{const y=Y.useRef(null),_=st(),k=Y.useRef(0),w=Y.useRef(0),x=Y.useRef(),{userSelectionActive:S,elementsSelectable:b,dragging:N}=Oe(GA,ot),C=()=>{_.setState({userSelectionActive:!1,userSelectionRect:null}),k.current=0,w.current=0},I=Z=>{u==null||u(Z),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},A=Z=>{if(Array.isArray(i)&&(i!=null&&i.includes(2))){Z.preventDefault();return}l==null||l(Z)},P=c?Z=>c(Z):void 0,$=Z=>{const{resetSelectedElements:R,domNode:W}=_.getState();if(x.current=W==null?void 0:W.getBoundingClientRect(),!b||!e||Z.button!==0||Z.target!==y.current||!x.current)return;const{x:F,y:ne}=fr(Z,x.current);R(),_.setState({userSelectionRect:{width:0,height:0,startX:F,startY:ne,x:F,y:ne}}),o==null||o(Z)},L=Z=>{const{userSelectionRect:R,nodeInternals:W,edges:F,transform:ne,onNodesChange:G,onEdgesChange:j,nodeOrigin:K,getNodes:T}=_.getState();if(!e||!x.current||!R)return;_.setState({userSelectionActive:!0,nodesSelectionActive:!1});const z=fr(Z,x.current),ae=R.startX??0,q=R.startY??0,H={...R,x:z.x<ae?z.x:ae,y:z.y<q?z.y:q,width:Math.abs(z.x-ae),height:Math.abs(z.y-q)},X=T(),oe=Nk(W,H,ne,r===Lo.Partial,!0,K),ue=Rk(oe,F).map(re=>re.id),se=oe.map(re=>re.id);if(k.current!==se.length){k.current=se.length;const re=yi(X,se);re.length&&(G==null||G(re))}if(w.current!==ue.length){w.current=ue.length;const re=yi(F,ue);re.length&&(j==null||j(re))}_.setState({userSelectionRect:H})},U=Z=>{if(Z.button!==0)return;const{userSelectionRect:R}=_.getState();!S&&R&&Z.target===y.current&&(I==null||I(Z)),_.setState({nodesSelectionActive:k.current>0}),C(),s==null||s(Z)},V=Z=>{S&&(_.setState({nodesSelectionActive:k.current>0}),s==null||s(Z)),C()},ee=b&&(e||S);return ie.createElement("div",{className:pt(["react-flow__pane",{dragging:N,selection:e}]),onClick:ee?void 0:cc(I,y),onContextMenu:cc(A,y),onWheel:cc(P,y),onMouseEnter:ee?void 0:d,onMouseDown:ee?$:void 0,onMouseMove:ee?L:p,onMouseUp:ee?U:void 0,onMouseLeave:ee?V:h,ref:y,style:gm},m,ie.createElement(UA,null))});Vk.displayName="Pane";function Gk(e,r){const i=e.parentNode||e.parentId;if(!i)return!1;const o=r.get(i);return o?o.selected?!0:Gk(o,r):!1}function e1(e,r,i){let o=e;do{if(o!=null&&o.matches(r))return!0;if(o===i.current)return!1;o=o.parentElement}while(o);return!1}function WA(e,r,i,o){return Array.from(e.values()).filter(s=>(s.selected||s.id===o)&&(!s.parentNode||s.parentId||!Gk(s,e))&&(s.draggable||r&&typeof s.draggable>"u")).map(s=>{var u,l;return{id:s.id,position:s.position||{x:0,y:0},positionAbsolute:s.positionAbsolute||{x:0,y:0},distance:{x:i.x-(((u=s.positionAbsolute)==null?void 0:u.x)??0),y:i.y-(((l=s.positionAbsolute)==null?void 0:l.y)??0)},delta:{x:0,y:0},extent:s.extent,parentNode:s.parentNode||s.parentId,parentId:s.parentNode||s.parentId,width:s.width,height:s.height,expandParent:s.expandParent}})}function KA(e,r){return!r||r==="parent"?r:[r[0],[r[1][0]-(e.width||0),r[1][1]-(e.height||0)]]}function Wk(e,r,i,o,s=[0,0],u){const l=KA(e,e.extent||o);let c=l;const d=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(d&&e.width&&e.height){const m=i.get(d),{x:y,y:_}=qr(m,s).positionAbsolute;c=m&&Xt(y)&&Xt(_)&&Xt(m.width)&&Xt(m.height)?[[y+e.width*s[0],_+e.height*s[1]],[y+m.width-e.width+e.width*s[0],_+m.height-e.height+e.height*s[1]]]:c}else u==null||u("005",zn.error005()),c=l;else if(e.extent&&d&&e.extent!=="parent"){const m=i.get(d),{x:y,y:_}=qr(m,s).positionAbsolute;c=[[e.extent[0][0]+y,e.extent[0][1]+_],[e.extent[1][0]+y,e.extent[1][1]+_]]}let p={x:0,y:0};if(d){const m=i.get(d);p=qr(m,s).positionAbsolute}const h=c&&c!=="parent"?cm(r,c):r;return{position:{x:h.x-p.x,y:h.y-p.y},positionAbsolute:h}}function fc({nodeId:e,dragItems:r,nodeInternals:i}){const o=r.map(s=>({...i.get(s.id),position:s.position,positionAbsolute:s.positionAbsolute}));return[e?o.find(s=>s.id===e):o[0],o]}const t1=(e,r,i,o)=>{const s=r.querySelectorAll(e);if(!s||!s.length)return null;const u=Array.from(s),l=r.getBoundingClientRect(),c={x:l.width*o[0],y:l.height*o[1]};return u.map(d=>{const p=d.getBoundingClientRect();return{id:d.getAttribute("data-handleid"),position:d.getAttribute("data-handlepos"),x:(p.left-l.left-c.x)/i,y:(p.top-l.top-c.y)/i,...lm(d)}})};function wo(e,r,i){return i===void 0?i:o=>{const s=r().nodeInternals.get(e);s&&i(o,{...s})}}function Wv({id:e,store:r,unselect:i=!1,nodeRef:o}){const{addSelectedNodes:s,unselectNodesAndEdges:u,multiSelectionActive:l,nodeInternals:c,onError:d}=r.getState(),p=c.get(e);if(!p){d==null||d("012",zn.error012(e));return}r.setState({nodesSelectionActive:!1}),p.selected?(i||p.selected&&l)&&(u({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var h;return(h=o==null?void 0:o.current)==null?void 0:h.blur()})):s([e])}function YA(){const e=st();return Y.useCallback(({sourceEvent:i})=>{const{transform:o,snapGrid:s,snapToGrid:u}=e.getState(),l=i.touches?i.touches[0].clientX:i.clientX,c=i.touches?i.touches[0].clientY:i.clientY,d={x:(l-o[0])/o[2],y:(c-o[1])/o[2]};return{xSnapped:u?s[0]*Math.round(d.x/s[0]):d.x,ySnapped:u?s[1]*Math.round(d.y/s[1]):d.y,...d}},[])}function dc(e){return(r,i,o)=>e==null?void 0:e(r,o)}function Kk({nodeRef:e,disabled:r=!1,noDragClassName:i,handleSelector:o,nodeId:s,isSelectable:u,selectNodesOnDrag:l}){const c=st(),[d,p]=Y.useState(!1),h=Y.useRef([]),m=Y.useRef({x:null,y:null}),y=Y.useRef(0),_=Y.useRef(null),k=Y.useRef({x:0,y:0}),w=Y.useRef(null),x=Y.useRef(!1),S=Y.useRef(!1),b=Y.useRef(!1),N=YA();return Y.useEffect(()=>{if(e!=null&&e.current){const C=Yt(e.current),I=({x:$,y:L})=>{const{nodeInternals:U,onNodeDrag:V,onSelectionDrag:ee,updateNodePositions:Z,nodeExtent:R,snapGrid:W,snapToGrid:F,nodeOrigin:ne,onError:G}=c.getState();m.current={x:$,y:L};let j=!1,K={x:0,y:0,x2:0,y2:0};if(h.current.length>1&&R){const z=Va(h.current,ne);K=Oo(z)}if(h.current=h.current.map(z=>{const ae={x:$-z.distance.x,y:L-z.distance.y};F&&(ae.x=W[0]*Math.round(ae.x/W[0]),ae.y=W[1]*Math.round(ae.y/W[1]));const q=[[R[0][0],R[0][1]],[R[1][0],R[1][1]]];h.current.length>1&&R&&!z.extent&&(q[0][0]=z.positionAbsolute.x-K.x+R[0][0],q[1][0]=z.positionAbsolute.x+(z.width??0)-K.x2+R[1][0],q[0][1]=z.positionAbsolute.y-K.y+R[0][1],q[1][1]=z.positionAbsolute.y+(z.height??0)-K.y2+R[1][1]);const H=Wk(z,ae,U,q,ne,G);return j=j||z.position.x!==H.position.x||z.position.y!==H.position.y,z.position=H.position,z.positionAbsolute=H.positionAbsolute,z}),!j)return;Z(h.current,!0,!0),p(!0);const T=s?V:dc(ee);if(T&&w.current){const[z,ae]=fc({nodeId:s,dragItems:h.current,nodeInternals:U});T(w.current,z,ae)}},A=()=>{if(!_.current)return;const[$,L]=mk(k.current,_.current);if($!==0||L!==0){const{transform:U,panBy:V}=c.getState();m.current.x=(m.current.x??0)-$/U[2],m.current.y=(m.current.y??0)-L/U[2],V({x:$,y:L})&&I(m.current)}y.current=requestAnimationFrame(A)},P=$=>{var ne;const{nodeInternals:L,multiSelectionActive:U,nodesDraggable:V,unselectNodesAndEdges:ee,onNodeDragStart:Z,onSelectionDragStart:R}=c.getState();S.current=!0;const W=s?Z:dc(R);(!l||!u)&&!U&&s&&((ne=L.get(s))!=null&&ne.selected||ee()),s&&u&&l&&Wv({id:s,store:c,nodeRef:e});const F=N($);if(m.current=F,h.current=WA(L,V,F,s),W&&h.current){const[G,j]=fc({nodeId:s,dragItems:h.current,nodeInternals:L});W($.sourceEvent,G,j)}};if(r)C.on(".drag",null);else{const $=oT().on("start",L=>{const{domNode:U,nodeDragThreshold:V}=c.getState();V===0&&P(L),b.current=!1;const ee=N(L);m.current=ee,_.current=(U==null?void 0:U.getBoundingClientRect())||null,k.current=fr(L.sourceEvent,_.current)}).on("drag",L=>{var Z,R;const U=N(L),{autoPanOnNodeDrag:V,nodeDragThreshold:ee}=c.getState();if(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1&&(b.current=!0),!b.current){if(!x.current&&S.current&&V&&(x.current=!0,A()),!S.current){const W=U.xSnapped-(((Z=m==null?void 0:m.current)==null?void 0:Z.x)??0),F=U.ySnapped-(((R=m==null?void 0:m.current)==null?void 0:R.y)??0);Math.sqrt(W*W+F*F)>ee&&P(L)}(m.current.x!==U.xSnapped||m.current.y!==U.ySnapped)&&h.current&&S.current&&(w.current=L.sourceEvent,k.current=fr(L.sourceEvent,_.current),I(U))}}).on("end",L=>{if(!(!S.current||b.current)&&(p(!1),x.current=!1,S.current=!1,cancelAnimationFrame(y.current),h.current)){const{updateNodePositions:U,nodeInternals:V,onNodeDragStop:ee,onSelectionDragStop:Z}=c.getState(),R=s?ee:dc(Z);if(U(h.current,!1,!1),R){const[W,F]=fc({nodeId:s,dragItems:h.current,nodeInternals:V});R(L.sourceEvent,W,F)}}}).filter(L=>{const U=L.target;return!L.button&&(!i||!e1(U,`.${i}`,e))&&(!o||e1(U,o,e))});return C.call($),()=>{C.on(".drag",null)}}}},[e,r,i,o,u,c,s,l,N]),d}function Yk(){const e=st();return Y.useCallback(i=>{const{nodeInternals:o,nodeExtent:s,updateNodePositions:u,getNodes:l,snapToGrid:c,snapGrid:d,onError:p,nodesDraggable:h}=e.getState(),m=l().filter(b=>b.selected&&(b.draggable||h&&typeof b.draggable>"u")),y=c?d[0]:5,_=c?d[1]:5,k=i.isShiftPressed?4:1,w=i.x*y*k,x=i.y*_*k,S=m.map(b=>{if(b.positionAbsolute){const N={x:b.positionAbsolute.x+w,y:b.positionAbsolute.y+x};c&&(N.x=d[0]*Math.round(N.x/d[0]),N.y=d[1]*Math.round(N.y/d[1]));const{positionAbsolute:C,position:I}=Wk(b,N,o,s,void 0,p);b.position=I,b.positionAbsolute=C}return b});u(S,!0,!1)},[])}const xi={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var xo=e=>{const r=({id:i,type:o,data:s,xPos:u,yPos:l,xPosOrigin:c,yPosOrigin:d,selected:p,onClick:h,onMouseEnter:m,onMouseMove:y,onMouseLeave:_,onContextMenu:k,onDoubleClick:w,style:x,className:S,isDraggable:b,isSelectable:N,isConnectable:C,isFocusable:I,selectNodesOnDrag:A,sourcePosition:P,targetPosition:$,hidden:L,resizeObserver:U,dragHandle:V,zIndex:ee,isParent:Z,noDragClassName:R,noPanClassName:W,initialized:F,disableKeyboardA11y:ne,ariaLabel:G,rfId:j,hasHandleBounds:K})=>{const T=st(),z=Y.useRef(null),ae=Y.useRef(null),q=Y.useRef(P),H=Y.useRef($),X=Y.useRef(o),oe=N||b||h||m||y||_,ue=Yk(),se=wo(i,T.getState,m),re=wo(i,T.getState,y),Ee=wo(i,T.getState,_),Re=wo(i,T.getState,k),xe=wo(i,T.getState,w),Ce=ve=>{const{nodeDragThreshold:he}=T.getState();if(N&&(!A||!b||he>0)&&Wv({id:i,store:T,nodeRef:z}),h){const Pe=T.getState().nodeInternals.get(i);Pe&&h(ve,{...Pe})}},ye=ve=>{if(!Bv(ve)&&!ne)if(wk.includes(ve.key)&&N){const he=ve.key==="Escape";Wv({id:i,store:T,unselect:he,nodeRef:z})}else b&&p&&Object.prototype.hasOwnProperty.call(xi,ve.key)&&(T.setState({ariaLiveMessage:`Moved selected node ${ve.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~u}, y: ${~~l}`}),ue({x:xi[ve.key].x,y:xi[ve.key].y,isShiftPressed:ve.shiftKey}))};Y.useEffect(()=>()=>{ae.current&&(U==null||U.unobserve(ae.current),ae.current=null)},[]),Y.useEffect(()=>{if(z.current&&!L){const ve=z.current;(!F||!K||ae.current!==ve)&&(ae.current&&(U==null||U.unobserve(ae.current)),U==null||U.observe(ve),ae.current=ve)}},[L,F,K]),Y.useEffect(()=>{const ve=X.current!==o,he=q.current!==P,Pe=H.current!==$;z.current&&(ve||he||Pe)&&(ve&&(X.current=o),he&&(q.current=P),Pe&&(H.current=$),T.getState().updateNodeDimensions([{id:i,nodeElement:z.current,forceUpdate:!0}]))},[i,o,P,$]);const Le=Kk({nodeRef:z,disabled:L||!b,noDragClassName:R,handleSelector:V,nodeId:i,isSelectable:N,selectNodesOnDrag:A});return L?null:ie.createElement("div",{className:pt(["react-flow__node",`react-flow__node-${o}`,{[W]:b},S,{selected:p,selectable:N,parent:Z,dragging:Le}]),ref:z,style:{zIndex:ee,transform:`translate(${c}px,${d}px)`,pointerEvents:oe?"all":"none",visibility:F?"visible":"hidden",...x},"data-id":i,"data-testid":`rf__node-${i}`,onMouseEnter:se,onMouseMove:re,onMouseLeave:Ee,onContextMenu:Re,onClick:Ce,onDoubleClick:xe,onKeyDown:I?ye:void 0,tabIndex:I?0:void 0,role:I?"button":void 0,"aria-describedby":ne?void 0:`${Fk}-${j}`,"aria-label":G},ie.createElement(uA,{value:i},ie.createElement(e,{id:i,data:s,type:o,xPos:u,yPos:l,selected:p,isConnectable:C,sourcePosition:P,targetPosition:$,dragging:Le,dragHandle:V,zIndex:ee})))};return r.displayName="NodeWrapper",Y.memo(r)};const XA=e=>{const r=e.getNodes().filter(i=>i.selected);return{...Va(r,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function QA({onSelectionContextMenu:e,noPanClassName:r,disableKeyboardA11y:i}){const o=st(),{width:s,height:u,x:l,y:c,transformString:d,userSelectionActive:p}=Oe(XA,ot),h=Yk(),m=Y.useRef(null);if(Y.useEffect(()=>{var k;i||(k=m.current)==null||k.focus({preventScroll:!0})},[i]),Kk({nodeRef:m}),p||!s||!u)return null;const y=e?k=>{const w=o.getState().getNodes().filter(x=>x.selected);e(k,w)}:void 0,_=k=>{Object.prototype.hasOwnProperty.call(xi,k.key)&&h({x:xi[k.key].x,y:xi[k.key].y,isShiftPressed:k.shiftKey})};return ie.createElement("div",{className:pt(["react-flow__nodesselection","react-flow__container",r]),style:{transform:d}},ie.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:i?void 0:-1,onKeyDown:i?void 0:_,style:{width:s,height:u,top:c,left:l}}))}var ZA=Y.memo(QA);const JA=e=>e.nodesSelectionActive,Xk=({children:e,onPaneClick:r,onPaneMouseEnter:i,onPaneMouseMove:o,onPaneMouseLeave:s,onPaneContextMenu:u,onPaneScroll:l,deleteKeyCode:c,onMove:d,onMoveStart:p,onMoveEnd:h,selectionKeyCode:m,selectionOnDrag:y,selectionMode:_,onSelectionStart:k,onSelectionEnd:w,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:b,elementsSelectable:N,zoomOnScroll:C,zoomOnPinch:I,panOnScroll:A,panOnScrollSpeed:P,panOnScrollMode:$,zoomOnDoubleClick:L,panOnDrag:U,defaultViewport:V,translateExtent:ee,minZoom:Z,maxZoom:R,preventScrolling:W,onSelectionContextMenu:F,noWheelClassName:ne,noPanClassName:G,disableKeyboardA11y:j})=>{const K=Oe(JA),T=jo(m),z=jo(S),ae=z||U,q=z||A,H=T||y&&ae!==!0;return jA({deleteKeyCode:c,multiSelectionKeyCode:x}),ie.createElement($A,{onMove:d,onMoveStart:p,onMoveEnd:h,onPaneContextMenu:u,elementsSelectable:N,zoomOnScroll:C,zoomOnPinch:I,panOnScroll:q,panOnScrollSpeed:P,panOnScrollMode:$,zoomOnDoubleClick:L,panOnDrag:!T&&ae,defaultViewport:V,translateExtent:ee,minZoom:Z,maxZoom:R,zoomActivationKeyCode:b,preventScrolling:W,noWheelClassName:ne,noPanClassName:G},ie.createElement(Vk,{onSelectionStart:k,onSelectionEnd:w,onPaneClick:r,onPaneMouseEnter:i,onPaneMouseMove:o,onPaneMouseLeave:s,onPaneContextMenu:u,onPaneScroll:l,panOnDrag:ae,isSelecting:!!H,selectionMode:_},e,K&&ie.createElement(ZA,{onSelectionContextMenu:F,noPanClassName:G,disableKeyboardA11y:j})))};Xk.displayName="FlowRenderer";var eM=Y.memo(Xk);function tM(e){return Oe(Y.useCallback(i=>e?Nk(i.nodeInternals,{x:0,y:0,width:i.width,height:i.height},i.transform,!0):i.getNodes(),[e]))}function nM(e){const r={input:xo(e.input||Lk),default:xo(e.default||Gv),output:xo(e.output||Dk),group:xo(e.group||mm)},i={},o=Object.keys(e).filter(s=>!["input","default","output","group"].includes(s)).reduce((s,u)=>(s[u]=xo(e[u]||Gv),s),i);return{...r,...o}}const rM=({x:e,y:r,width:i,height:o,origin:s})=>!i||!o?{x:e,y:r}:s[0]<0||s[1]<0||s[0]>1||s[1]>1?{x:e,y:r}:{x:e-i*s[0],y:r-o*s[1]},iM=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),Qk=e=>{const{nodesDraggable:r,nodesConnectable:i,nodesFocusable:o,elementsSelectable:s,updateNodeDimensions:u,onError:l}=Oe(iM,ot),c=tM(e.onlyRenderVisibleElements),d=Y.useRef(),p=Y.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(m=>{const y=m.map(_=>({id:_.target.getAttribute("data-id"),nodeElement:_.target,forceUpdate:!0}));u(y)});return d.current=h,h},[]);return Y.useEffect(()=>()=>{var h;(h=d==null?void 0:d.current)==null||h.disconnect()},[]),ie.createElement("div",{className:"react-flow__nodes",style:gm},c.map(h=>{var I,A,P;let m=h.type||"default";e.nodeTypes[m]||(l==null||l("003",zn.error003(m)),m="default");const y=e.nodeTypes[m]||e.nodeTypes.default,_=!!(h.draggable||r&&typeof h.draggable>"u"),k=!!(h.selectable||s&&typeof h.selectable>"u"),w=!!(h.connectable||i&&typeof h.connectable>"u"),x=!!(h.focusable||o&&typeof h.focusable>"u"),S=e.nodeExtent?cm(h.positionAbsolute,e.nodeExtent):h.positionAbsolute,b=(S==null?void 0:S.x)??0,N=(S==null?void 0:S.y)??0,C=rM({x:b,y:N,width:h.width??0,height:h.height??0,origin:e.nodeOrigin});return ie.createElement(y,{key:h.id,id:h.id,className:h.className,style:h.style,type:m,data:h.data,sourcePosition:h.sourcePosition||Se.Bottom,targetPosition:h.targetPosition||Se.Top,hidden:h.hidden,xPos:b,yPos:N,xPosOrigin:C.x,yPosOrigin:C.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!h.selected,isDraggable:_,isSelectable:k,isConnectable:w,isFocusable:x,resizeObserver:p,dragHandle:h.dragHandle,zIndex:((I=h[Ye])==null?void 0:I.z)??0,isParent:!!((A=h[Ye])!=null&&A.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!h.width&&!!h.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!((P=h[Ye])!=null&&P.handleBounds)})}))};Qk.displayName="NodeRenderer";var oM=Y.memo(Qk);const sM=(e,r,i)=>i===Se.Left?e-r:i===Se.Right?e+r:e,aM=(e,r,i)=>i===Se.Top?e-r:i===Se.Bottom?e+r:e,n1="react-flow__edgeupdater",r1=({position:e,centerX:r,centerY:i,radius:o=10,onMouseDown:s,onMouseEnter:u,onMouseOut:l,type:c})=>ie.createElement("circle",{onMouseDown:s,onMouseEnter:u,onMouseOut:l,className:pt([n1,`${n1}-${c}`]),cx:sM(r,o,e),cy:aM(i,o,e),r:o,stroke:"transparent",fill:"transparent"}),uM=()=>!0;var gi=e=>{const r=({id:i,className:o,type:s,data:u,onClick:l,onEdgeDoubleClick:c,selected:d,animated:p,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:_,labelBgPadding:k,labelBgBorderRadius:w,style:x,source:S,target:b,sourceX:N,sourceY:C,targetX:I,targetY:A,sourcePosition:P,targetPosition:$,elementsSelectable:L,hidden:U,sourceHandleId:V,targetHandleId:ee,onContextMenu:Z,onMouseEnter:R,onMouseMove:W,onMouseLeave:F,reconnectRadius:ne,onReconnect:G,onReconnectStart:j,onReconnectEnd:K,markerEnd:T,markerStart:z,rfId:ae,ariaLabel:q,isFocusable:H,isReconnectable:X,pathOptions:oe,interactionWidth:ue,disableKeyboardA11y:se})=>{const re=Y.useRef(null),[Ee,Re]=Y.useState(!1),[xe,Ce]=Y.useState(!1),ye=st(),Le=Y.useMemo(()=>`url('#${Hv(z,ae)}')`,[z,ae]),ve=Y.useMemo(()=>`url('#${Hv(T,ae)}')`,[T,ae]);if(U)return null;const he=$e=>{var bt;const{edges:vt,addSelectedEdges:nt,unselectNodesAndEdges:ut,multiSelectionActive:Sn}=ye.getState(),qt=vt.find(En=>En.id===i);qt&&(L&&(ye.setState({nodesSelectionActive:!1}),qt.selected&&Sn?(ut({nodes:[],edges:[qt]}),(bt=re.current)==null||bt.blur()):nt([i])),l&&l($e,qt))},Pe=_o(i,ye.getState,c),He=_o(i,ye.getState,Z),et=_o(i,ye.getState,R),Xe=_o(i,ye.getState,W),je=_o(i,ye.getState,F),tt=($e,vt)=>{if($e.button!==0)return;const{edges:nt,isValidConnection:ut}=ye.getState(),Sn=vt?b:S,qt=(vt?ee:V)||null,bt=vt?"target":"source",En=ut||uM,hr=vt,kn=nt.find(pn=>pn.id===i);Ce(!0),j==null||j($e,kn,bt);const hn=pn=>{Ce(!1),K==null||K(pn,kn,bt)};Mk({event:$e,handleId:qt,nodeId:Sn,onConnect:pn=>G==null?void 0:G(kn,pn),isTarget:hr,getState:ye.getState,setState:ye.setState,isValidConnection:En,edgeUpdaterType:bt,onReconnectEnd:hn})},St=$e=>tt($e,!0),Ft=$e=>tt($e,!1),Et=()=>Re(!0),at=()=>Re(!1),$t=!L&&!l,kt=$e=>{var vt;if(!se&&wk.includes($e.key)&&L){const{unselectNodesAndEdges:nt,addSelectedEdges:ut,edges:Sn}=ye.getState();$e.key==="Escape"?((vt=re.current)==null||vt.blur(),nt({edges:[Sn.find(bt=>bt.id===i)]})):ut([i])}};return ie.createElement("g",{className:pt(["react-flow__edge",`react-flow__edge-${s}`,o,{selected:d,animated:p,inactive:$t,updating:Ee}]),onClick:he,onDoubleClick:Pe,onContextMenu:He,onMouseEnter:et,onMouseMove:Xe,onMouseLeave:je,onKeyDown:H?kt:void 0,tabIndex:H?0:void 0,role:H?"button":"img","data-testid":`rf__edge-${i}`,"aria-label":q===null?void 0:q||`Edge from ${S} to ${b}`,"aria-describedby":H?`${$k}-${ae}`:void 0,ref:re},!xe&&ie.createElement(e,{id:i,source:S,target:b,selected:d,animated:p,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:_,labelBgPadding:k,labelBgBorderRadius:w,data:u,style:x,sourceX:N,sourceY:C,targetX:I,targetY:A,sourcePosition:P,targetPosition:$,sourceHandleId:V,targetHandleId:ee,markerStart:Le,markerEnd:ve,pathOptions:oe,interactionWidth:ue}),X&&ie.createElement(ie.Fragment,null,(X==="source"||X===!0)&&ie.createElement(r1,{position:P,centerX:N,centerY:C,radius:ne,onMouseDown:St,onMouseEnter:Et,onMouseOut:at,type:"source"}),(X==="target"||X===!0)&&ie.createElement(r1,{position:$,centerX:I,centerY:A,radius:ne,onMouseDown:Ft,onMouseEnter:Et,onMouseOut:at,type:"target"})))};return r.displayName="EdgeWrapper",Y.memo(r)};function lM(e){const r={default:gi(e.default||ja),straight:gi(e.bezier||hm),step:gi(e.step||dm),smoothstep:gi(e.step||Ha),simplebezier:gi(e.simplebezier||fm)},i={},o=Object.keys(e).filter(s=>!["default","bezier"].includes(s)).reduce((s,u)=>(s[u]=gi(e[u]||ja),s),i);return{...r,...o}}function i1(e,r,i=null){const o=((i==null?void 0:i.x)||0)+r.x,s=((i==null?void 0:i.y)||0)+r.y,u=(i==null?void 0:i.width)||r.width,l=(i==null?void 0:i.height)||r.height;switch(e){case Se.Top:return{x:o+u/2,y:s};case Se.Right:return{x:o+u,y:s+l/2};case Se.Bottom:return{x:o+u/2,y:s+l};case Se.Left:return{x:o,y:s+l/2}}}function o1(e,r){return e?e.length===1||!r?e[0]:r&&e.find(i=>i.id===r)||null:null}const cM=(e,r,i,o,s,u)=>{const l=i1(i,e,r),c=i1(u,o,s);return{sourceX:l.x,sourceY:l.y,targetX:c.x,targetY:c.y}};function fM({sourcePos:e,targetPos:r,sourceWidth:i,sourceHeight:o,targetWidth:s,targetHeight:u,width:l,height:c,transform:d}){const p={x:Math.min(e.x,r.x),y:Math.min(e.y,r.y),x2:Math.max(e.x+i,r.x+s),y2:Math.max(e.y+o,r.y+u)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const h=Oo({x:(0-d[0])/d[2],y:(0-d[1])/d[2],width:l/d[2],height:c/d[2]}),m=Math.max(0,Math.min(h.x2,p.x2)-Math.max(h.x,p.x)),y=Math.max(0,Math.min(h.y2,p.y2)-Math.max(h.y,p.y));return Math.ceil(m*y)>0}function s1(e){var o,s,u,l,c;const r=((o=e==null?void 0:e[Ye])==null?void 0:o.handleBounds)||null,i=r&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.x)<"u"&&typeof((u=e==null?void 0:e.positionAbsolute)==null?void 0:u.y)<"u";return[{x:((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.x)||0,y:((c=e==null?void 0:e.positionAbsolute)==null?void 0:c.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},r,!!i]}const dM=[{level:0,isMaxLevel:!0,edges:[]}];function hM(e,r,i=!1){let o=-1;const s=e.reduce((l,c)=>{var h,m;const d=Xt(c.zIndex);let p=d?c.zIndex:0;if(i){const y=r.get(c.target),_=r.get(c.source),k=c.selected||(y==null?void 0:y.selected)||(_==null?void 0:_.selected),w=Math.max(((h=_==null?void 0:_[Ye])==null?void 0:h.z)||0,((m=y==null?void 0:y[Ye])==null?void 0:m.z)||0,1e3);p=(d?c.zIndex:0)+(k?w:0)}return l[p]?l[p].push(c):l[p]=[c],o=p>o?p:o,l},{}),u=Object.entries(s).map(([l,c])=>{const d=+l;return{edges:c,level:d,isMaxLevel:d===o}});return u.length===0?dM:u}function pM(e,r,i){const o=Oe(Y.useCallback(s=>e?s.edges.filter(u=>{const l=r.get(u.source),c=r.get(u.target);return(l==null?void 0:l.width)&&(l==null?void 0:l.height)&&(c==null?void 0:c.width)&&(c==null?void 0:c.height)&&fM({sourcePos:l.positionAbsolute||{x:0,y:0},targetPos:c.positionAbsolute||{x:0,y:0},sourceWidth:l.width,sourceHeight:l.height,targetWidth:c.width,targetHeight:c.height,width:s.width,height:s.height,transform:s.transform})}):s.edges,[e,r]));return hM(o,r,i)}const vM=({color:e="none",strokeWidth:r=1})=>ie.createElement("polyline",{style:{stroke:e,strokeWidth:r},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),mM=({color:e="none",strokeWidth:r=1})=>ie.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:r},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),a1={[La.Arrow]:vM,[La.ArrowClosed]:mM};function gM(e){const r=st();return Y.useMemo(()=>{var s,u;return Object.prototype.hasOwnProperty.call(a1,e)?a1[e]:((u=(s=r.getState()).onError)==null||u.call(s,"009",zn.error009(e)),null)},[e])}const yM=({id:e,type:r,color:i,width:o=12.5,height:s=12.5,markerUnits:u="strokeWidth",strokeWidth:l,orient:c="auto-start-reverse"})=>{const d=gM(r);return d?ie.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:u,orient:c,refX:"0",refY:"0"},ie.createElement(d,{color:i,strokeWidth:l})):null},_M=({defaultColor:e,rfId:r})=>i=>{const o=[];return i.edges.reduce((s,u)=>([u.markerStart,u.markerEnd].forEach(l=>{if(l&&typeof l=="object"){const c=Hv(l,r);o.includes(c)||(s.push({id:c,color:l.color||e,...l}),o.push(c))}}),s),[]).sort((s,u)=>s.id.localeCompare(u.id))},Zk=({defaultColor:e,rfId:r})=>{const i=Oe(Y.useCallback(_M({defaultColor:e,rfId:r}),[e,r]),(o,s)=>!(o.length!==s.length||o.some((u,l)=>u.id!==s[l].id)));return ie.createElement("defs",null,i.map(o=>ie.createElement(yM,{id:o.id,key:o.id,type:o.type,color:o.color,width:o.width,height:o.height,markerUnits:o.markerUnits,strokeWidth:o.strokeWidth,orient:o.orient})))};Zk.displayName="MarkerDefinitions";var wM=Y.memo(Zk);const xM=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),Jk=({defaultMarkerColor:e,onlyRenderVisibleElements:r,elevateEdgesOnSelect:i,rfId:o,edgeTypes:s,noPanClassName:u,onEdgeContextMenu:l,onEdgeMouseEnter:c,onEdgeMouseMove:d,onEdgeMouseLeave:p,onEdgeClick:h,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:_,onReconnectEnd:k,reconnectRadius:w,children:x,disableKeyboardA11y:S})=>{const{edgesFocusable:b,edgesUpdatable:N,elementsSelectable:C,width:I,height:A,connectionMode:P,nodeInternals:$,onError:L}=Oe(xM,ot),U=pM(r,$,i);return I?ie.createElement(ie.Fragment,null,U.map(({level:V,edges:ee,isMaxLevel:Z})=>ie.createElement("svg",{key:V,style:{zIndex:V},width:I,height:A,className:"react-flow__edges react-flow__container"},Z&&ie.createElement(wM,{defaultColor:e,rfId:o}),ie.createElement("g",null,ee.map(R=>{const[W,F,ne]=s1($.get(R.source)),[G,j,K]=s1($.get(R.target));if(!ne||!K)return null;let T=R.type||"default";s[T]||(L==null||L("011",zn.error011(T)),T="default");const z=s[T]||s.default,ae=P===jr.Strict?j.target:(j.target??[]).concat(j.source??[]),q=o1(F.source,R.sourceHandle),H=o1(ae,R.targetHandle),X=(q==null?void 0:q.position)||Se.Bottom,oe=(H==null?void 0:H.position)||Se.Top,ue=!!(R.focusable||b&&typeof R.focusable>"u"),se=R.reconnectable||R.updatable,re=typeof y<"u"&&(se||N&&typeof se>"u");if(!q||!H)return L==null||L("008",zn.error008(q,R)),null;const{sourceX:Ee,sourceY:Re,targetX:xe,targetY:Ce}=cM(W,q,X,G,H,oe);return ie.createElement(z,{key:R.id,id:R.id,className:pt([R.className,u]),type:T,data:R.data,selected:!!R.selected,animated:!!R.animated,hidden:!!R.hidden,label:R.label,labelStyle:R.labelStyle,labelShowBg:R.labelShowBg,labelBgStyle:R.labelBgStyle,labelBgPadding:R.labelBgPadding,labelBgBorderRadius:R.labelBgBorderRadius,style:R.style,source:R.source,target:R.target,sourceHandleId:R.sourceHandle,targetHandleId:R.targetHandle,markerEnd:R.markerEnd,markerStart:R.markerStart,sourceX:Ee,sourceY:Re,targetX:xe,targetY:Ce,sourcePosition:X,targetPosition:oe,elementsSelectable:C,onContextMenu:l,onMouseEnter:c,onMouseMove:d,onMouseLeave:p,onClick:h,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:_,onReconnectEnd:k,reconnectRadius:w,rfId:o,ariaLabel:R.ariaLabel,isFocusable:ue,isReconnectable:re,pathOptions:"pathOptions"in R?R.pathOptions:void 0,interactionWidth:R.interactionWidth,disableKeyboardA11y:S})})))),x):null};Jk.displayName="EdgeRenderer";var SM=Y.memo(Jk);const EM=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function kM({children:e}){const r=Oe(EM);return ie.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:r}},e)}function bM(e){const r=Ga(),i=Y.useRef(!1);Y.useEffect(()=>{!i.current&&r.viewportInitialized&&e&&(setTimeout(()=>e(r),1),i.current=!0)},[e,r.viewportInitialized])}const CM={[Se.Left]:Se.Right,[Se.Right]:Se.Left,[Se.Top]:Se.Bottom,[Se.Bottom]:Se.Top},eb=({nodeId:e,handleType:r,style:i,type:o=cr.Bezier,CustomComponent:s,connectionStatus:u})=>{var A,P,$;const{fromNode:l,handleId:c,toX:d,toY:p,connectionMode:h}=Oe(Y.useCallback(L=>({fromNode:L.nodeInternals.get(e),handleId:L.connectionHandleId,toX:(L.connectionPosition.x-L.transform[0])/L.transform[2],toY:(L.connectionPosition.y-L.transform[1])/L.transform[2],connectionMode:L.connectionMode}),[e]),ot),m=(A=l==null?void 0:l[Ye])==null?void 0:A.handleBounds;let y=m==null?void 0:m[r];if(h===jr.Loose&&(y=y||(m==null?void 0:m[r==="source"?"target":"source"])),!l||!y)return null;const _=c?y.find(L=>L.id===c):y[0],k=_?_.x+_.width/2:(l.width??0)/2,w=_?_.y+_.height/2:l.height??0,x=(((P=l.positionAbsolute)==null?void 0:P.x)??0)+k,S=((($=l.positionAbsolute)==null?void 0:$.y)??0)+w,b=_==null?void 0:_.position,N=b?CM[b]:null;if(!b||!N)return null;if(s)return ie.createElement(s,{connectionLineType:o,connectionLineStyle:i,fromNode:l,fromHandle:_,fromX:x,fromY:S,toX:d,toY:p,fromPosition:b,toPosition:N,connectionStatus:u});let C="";const I={sourceX:x,sourceY:S,sourcePosition:b,targetX:d,targetY:p,targetPosition:N};return o===cr.Bezier?[C]=bk(I):o===cr.Step?[C]=Uv({...I,borderRadius:0}):o===cr.SmoothStep?[C]=Uv(I):o===cr.SimpleBezier?[C]=kk(I):C=`M${x},${S} ${d},${p}`,ie.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:i})};eb.displayName="ConnectionLine";const NM=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function RM({containerStyle:e,style:r,type:i,component:o}){const{nodeId:s,handleType:u,nodesConnectable:l,width:c,height:d,connectionStatus:p}=Oe(NM,ot);return!(s&&u&&c&&l)?null:ie.createElement("svg",{style:e,width:c,height:d,className:"react-flow__edges react-flow__connectionline react-flow__container"},ie.createElement("g",{className:pt(["react-flow__connection",p])},ie.createElement(eb,{nodeId:s,handleType:u,style:r,type:i,CustomComponent:o,connectionStatus:p})))}function u1(e,r){return Y.useRef(null),st(),Y.useMemo(()=>r(e),[e])}const tb=({nodeTypes:e,edgeTypes:r,onMove:i,onMoveStart:o,onMoveEnd:s,onInit:u,onNodeClick:l,onEdgeClick:c,onNodeDoubleClick:d,onEdgeDoubleClick:p,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:_,onSelectionContextMenu:k,onSelectionStart:w,onSelectionEnd:x,connectionLineType:S,connectionLineStyle:b,connectionLineComponent:N,connectionLineContainerStyle:C,selectionKeyCode:I,selectionOnDrag:A,selectionMode:P,multiSelectionKeyCode:$,panActivationKeyCode:L,zoomActivationKeyCode:U,deleteKeyCode:V,onlyRenderVisibleElements:ee,elementsSelectable:Z,selectNodesOnDrag:R,defaultViewport:W,translateExtent:F,minZoom:ne,maxZoom:G,preventScrolling:j,defaultMarkerColor:K,zoomOnScroll:T,zoomOnPinch:z,panOnScroll:ae,panOnScrollSpeed:q,panOnScrollMode:H,zoomOnDoubleClick:X,panOnDrag:oe,onPaneClick:ue,onPaneMouseEnter:se,onPaneMouseMove:re,onPaneMouseLeave:Ee,onPaneScroll:Re,onPaneContextMenu:xe,onEdgeContextMenu:Ce,onEdgeMouseEnter:ye,onEdgeMouseMove:Le,onEdgeMouseLeave:ve,onReconnect:he,onReconnectStart:Pe,onReconnectEnd:He,reconnectRadius:et,noDragClassName:Xe,noWheelClassName:je,noPanClassName:tt,elevateEdgesOnSelect:St,disableKeyboardA11y:Ft,nodeOrigin:Et,nodeExtent:at,rfId:$t})=>{const kt=u1(e,nM),$e=u1(r,lM);return bM(u),ie.createElement(eM,{onPaneClick:ue,onPaneMouseEnter:se,onPaneMouseMove:re,onPaneMouseLeave:Ee,onPaneContextMenu:xe,onPaneScroll:Re,deleteKeyCode:V,selectionKeyCode:I,selectionOnDrag:A,selectionMode:P,onSelectionStart:w,onSelectionEnd:x,multiSelectionKeyCode:$,panActivationKeyCode:L,zoomActivationKeyCode:U,elementsSelectable:Z,onMove:i,onMoveStart:o,onMoveEnd:s,zoomOnScroll:T,zoomOnPinch:z,zoomOnDoubleClick:X,panOnScroll:ae,panOnScrollSpeed:q,panOnScrollMode:H,panOnDrag:oe,defaultViewport:W,translateExtent:F,minZoom:ne,maxZoom:G,onSelectionContextMenu:k,preventScrolling:j,noDragClassName:Xe,noWheelClassName:je,noPanClassName:tt,disableKeyboardA11y:Ft},ie.createElement(kM,null,ie.createElement(SM,{edgeTypes:$e,onEdgeClick:c,onEdgeDoubleClick:p,onlyRenderVisibleElements:ee,onEdgeContextMenu:Ce,onEdgeMouseEnter:ye,onEdgeMouseMove:Le,onEdgeMouseLeave:ve,onReconnect:he,onReconnectStart:Pe,onReconnectEnd:He,reconnectRadius:et,defaultMarkerColor:K,noPanClassName:tt,elevateEdgesOnSelect:!!St,disableKeyboardA11y:Ft,rfId:$t},ie.createElement(RM,{style:b,type:S,component:N,containerStyle:C})),ie.createElement("div",{className:"react-flow__edgelabel-renderer"}),ie.createElement(oM,{nodeTypes:kt,onNodeClick:l,onNodeDoubleClick:d,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:_,selectNodesOnDrag:R,onlyRenderVisibleElements:ee,noPanClassName:tt,noDragClassName:Xe,disableKeyboardA11y:Ft,nodeOrigin:Et,nodeExtent:at,rfId:$t})))};tb.displayName="GraphView";var TM=Y.memo(tb);const Kv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ar={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:Kv,nodeExtent:Kv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:jr.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:nA,isValidConnection:void 0},IM=()=>g2((e,r)=>({...ar,setNodes:i=>{const{nodeInternals:o,nodeOrigin:s,elevateNodesOnSelect:u}=r();e({nodeInternals:lc(i,o,s,u)})},getNodes:()=>Array.from(r().nodeInternals.values()),setEdges:i=>{const{defaultEdgeOptions:o={}}=r();e({edges:i.map(s=>({...o,...s}))})},setDefaultNodesAndEdges:(i,o)=>{const s=typeof i<"u",u=typeof o<"u",l=s?lc(i,new Map,r().nodeOrigin,r().elevateNodesOnSelect):new Map;e({nodeInternals:l,edges:u?o:[],hasDefaultNodes:s,hasDefaultEdges:u})},updateNodeDimensions:i=>{const{onNodesChange:o,nodeInternals:s,fitViewOnInit:u,fitViewOnInitDone:l,fitViewOnInitOptions:c,domNode:d,nodeOrigin:p}=r(),h=d==null?void 0:d.querySelector(".react-flow__viewport");if(!h)return;const m=window.getComputedStyle(h),{m22:y}=new window.DOMMatrixReadOnly(m.transform),_=i.reduce((w,x)=>{const S=s.get(x.id);if(S!=null&&S.hidden)s.set(S.id,{...S,[Ye]:{...S[Ye],handleBounds:void 0}});else if(S){const b=lm(x.nodeElement);!!(b.width&&b.height&&(S.width!==b.width||S.height!==b.height||x.forceUpdate))&&(s.set(S.id,{...S,[Ye]:{...S[Ye],handleBounds:{source:t1(".source",x.nodeElement,y,p),target:t1(".target",x.nodeElement,y,p)}},...b}),w.push({id:S.id,type:"dimensions",dimensions:b}))}return w},[]);Uk(s,p);const k=l||u&&!l&&Hk(r,{initial:!0,...c});e({nodeInternals:new Map(s),fitViewOnInitDone:k}),(_==null?void 0:_.length)>0&&(o==null||o(_))},updateNodePositions:(i,o=!0,s=!1)=>{const{triggerNodeChanges:u}=r(),l=i.map(c=>{const d={id:c.id,type:"position",dragging:s};return o&&(d.positionAbsolute=c.positionAbsolute,d.position=c.position),d});u(l)},triggerNodeChanges:i=>{const{onNodesChange:o,nodeInternals:s,hasDefaultNodes:u,nodeOrigin:l,getNodes:c,elevateNodesOnSelect:d}=r();if(i!=null&&i.length){if(u){const p=VA(i,c()),h=lc(p,s,l,d);e({nodeInternals:h})}o==null||o(i)}},addSelectedNodes:i=>{const{multiSelectionActive:o,edges:s,getNodes:u}=r();let l,c=null;o?l=i.map(d=>lr(d,!0)):(l=yi(u(),i),c=yi(s,[])),xa({changedNodes:l,changedEdges:c,get:r,set:e})},addSelectedEdges:i=>{const{multiSelectionActive:o,edges:s,getNodes:u}=r();let l,c=null;o?l=i.map(d=>lr(d,!0)):(l=yi(s,i),c=yi(u(),[])),xa({changedNodes:c,changedEdges:l,get:r,set:e})},unselectNodesAndEdges:({nodes:i,edges:o}={})=>{const{edges:s,getNodes:u}=r(),l=i||u(),c=o||s,d=l.map(h=>(h.selected=!1,lr(h.id,!1))),p=c.map(h=>lr(h.id,!1));xa({changedNodes:d,changedEdges:p,get:r,set:e})},setMinZoom:i=>{const{d3Zoom:o,maxZoom:s}=r();o==null||o.scaleExtent([i,s]),e({minZoom:i})},setMaxZoom:i=>{const{d3Zoom:o,minZoom:s}=r();o==null||o.scaleExtent([s,i]),e({maxZoom:i})},setTranslateExtent:i=>{var o;(o=r().d3Zoom)==null||o.translateExtent(i),e({translateExtent:i})},resetSelectedElements:()=>{const{edges:i,getNodes:o}=r(),u=o().filter(c=>c.selected).map(c=>lr(c.id,!1)),l=i.filter(c=>c.selected).map(c=>lr(c.id,!1));xa({changedNodes:u,changedEdges:l,get:r,set:e})},setNodeExtent:i=>{const{nodeInternals:o}=r();o.forEach(s=>{s.positionAbsolute=cm(s.position,i)}),e({nodeExtent:i,nodeInternals:new Map(o)})},panBy:i=>{const{transform:o,width:s,height:u,d3Zoom:l,d3Selection:c,translateExtent:d}=r();if(!l||!c||!i.x&&!i.y)return!1;const p=jn.translate(o[0]+i.x,o[1]+i.y).scale(o[2]),h=[[0,0],[s,u]],m=l==null?void 0:l.constrain()(p,h,d);return l.transform(c,m),o[0]!==m.x||o[1]!==m.y||o[2]!==m.k},cancelConnection:()=>e({connectionNodeId:ar.connectionNodeId,connectionHandleId:ar.connectionHandleId,connectionHandleType:ar.connectionHandleType,connectionStatus:ar.connectionStatus,connectionStartHandle:ar.connectionStartHandle,connectionEndHandle:ar.connectionEndHandle}),reset:()=>e({...ar})}),Object.is),ym=({children:e})=>{const r=Y.useRef(null);return r.current||(r.current=IM()),ie.createElement(YI,{value:r.current},e)};ym.displayName="ReactFlowProvider";const nb=({children:e})=>Y.useContext(Ua)?ie.createElement(ie.Fragment,null,e):ie.createElement(ym,null,e);nb.displayName="ReactFlowWrapper";const AM={input:Lk,default:Gv,output:Dk,group:mm},MM={default:ja,straight:hm,step:dm,smoothstep:Ha,simplebezier:fm},PM=[0,0],qM=[15,15],OM={x:0,y:0,zoom:1},LM={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},rb=Y.forwardRef(({nodes:e,edges:r,defaultNodes:i,defaultEdges:o,className:s,nodeTypes:u=AM,edgeTypes:l=MM,onNodeClick:c,onEdgeClick:d,onInit:p,onMove:h,onMoveStart:m,onMoveEnd:y,onConnect:_,onConnectStart:k,onConnectEnd:w,onClickConnectStart:x,onClickConnectEnd:S,onNodeMouseEnter:b,onNodeMouseMove:N,onNodeMouseLeave:C,onNodeContextMenu:I,onNodeDoubleClick:A,onNodeDragStart:P,onNodeDrag:$,onNodeDragStop:L,onNodesDelete:U,onEdgesDelete:V,onSelectionChange:ee,onSelectionDragStart:Z,onSelectionDrag:R,onSelectionDragStop:W,onSelectionContextMenu:F,onSelectionStart:ne,onSelectionEnd:G,connectionMode:j=jr.Strict,connectionLineType:K=cr.Bezier,connectionLineStyle:T,connectionLineComponent:z,connectionLineContainerStyle:ae,deleteKeyCode:q="Backspace",selectionKeyCode:H="Shift",selectionOnDrag:X=!1,selectionMode:oe=Lo.Full,panActivationKeyCode:ue="Space",multiSelectionKeyCode:se=Oa()?"Meta":"Control",zoomActivationKeyCode:re=Oa()?"Meta":"Control",snapToGrid:Ee=!1,snapGrid:Re=qM,onlyRenderVisibleElements:xe=!1,selectNodesOnDrag:Ce=!0,nodesDraggable:ye,nodesConnectable:Le,nodesFocusable:ve,nodeOrigin:he=PM,edgesFocusable:Pe,edgesUpdatable:He,elementsSelectable:et,defaultViewport:Xe=OM,minZoom:je=.5,maxZoom:tt=2,translateExtent:St=Kv,preventScrolling:Ft=!0,nodeExtent:Et,defaultMarkerColor:at="#b1b1b7",zoomOnScroll:$t=!0,zoomOnPinch:kt=!0,panOnScroll:$e=!1,panOnScrollSpeed:vt=.5,panOnScrollMode:nt=Mr.Free,zoomOnDoubleClick:ut=!0,panOnDrag:Sn=!0,onPaneClick:qt,onPaneMouseEnter:bt,onPaneMouseMove:En,onPaneMouseLeave:hr,onPaneScroll:kn,onPaneContextMenu:hn,children:bn,onEdgeContextMenu:pn,onEdgeDoubleClick:Wo,onEdgeMouseEnter:Ko,onEdgeMouseMove:Yo,onEdgeMouseLeave:Xo,onEdgeUpdate:Ai,onEdgeUpdateStart:Qo,onEdgeUpdateEnd:pr,onReconnect:Mi,onReconnectStart:vr,onReconnectEnd:cu,reconnectRadius:mr=10,edgeUpdaterRadius:Br=10,onNodesChange:Ur,onEdgesChange:Pi,noDragClassName:fu="nodrag",noWheelClassName:du="nowheel",noPanClassName:Zo="nopan",fitView:Cn=!1,fitViewOptions:Jo,connectOnClick:es=!0,attributionPosition:hu,proOptions:ts,defaultEdgeOptions:ns,elevateNodesOnSelect:rs=!0,elevateEdgesOnSelect:is=!1,disableKeyboardA11y:os=!1,autoPanOnConnect:pu=!0,autoPanOnNodeDrag:Ve=!0,connectionRadius:vu=20,isValidConnection:qi,onError:ss,style:Hr,id:as,nodeDragThreshold:us,...Vr},Bt)=>{const Oi=as||"1";return ie.createElement("div",{...Vr,style:{...Hr,...LM},ref:Bt,className:pt(["react-flow",s]),"data-testid":"rf__wrapper",id:as},ie.createElement(nb,null,ie.createElement(TM,{onInit:p,onMove:h,onMoveStart:m,onMoveEnd:y,onNodeClick:c,onEdgeClick:d,onNodeMouseEnter:b,onNodeMouseMove:N,onNodeMouseLeave:C,onNodeContextMenu:I,onNodeDoubleClick:A,nodeTypes:u,edgeTypes:l,connectionLineType:K,connectionLineStyle:T,connectionLineComponent:z,connectionLineContainerStyle:ae,selectionKeyCode:H,selectionOnDrag:X,selectionMode:oe,deleteKeyCode:q,multiSelectionKeyCode:se,panActivationKeyCode:ue,zoomActivationKeyCode:re,onlyRenderVisibleElements:xe,selectNodesOnDrag:Ce,defaultViewport:Xe,translateExtent:St,minZoom:je,maxZoom:tt,preventScrolling:Ft,zoomOnScroll:$t,zoomOnPinch:kt,zoomOnDoubleClick:ut,panOnScroll:$e,panOnScrollSpeed:vt,panOnScrollMode:nt,panOnDrag:Sn,onPaneClick:qt,onPaneMouseEnter:bt,onPaneMouseMove:En,onPaneMouseLeave:hr,onPaneScroll:kn,onPaneContextMenu:hn,onSelectionContextMenu:F,onSelectionStart:ne,onSelectionEnd:G,onEdgeContextMenu:pn,onEdgeDoubleClick:Wo,onEdgeMouseEnter:Ko,onEdgeMouseMove:Yo,onEdgeMouseLeave:Xo,onReconnect:Mi??Ai,onReconnectStart:vr??Qo,onReconnectEnd:cu??pr,reconnectRadius:mr??Br,defaultMarkerColor:at,noDragClassName:fu,noWheelClassName:du,noPanClassName:Zo,elevateEdgesOnSelect:is,rfId:Oi,disableKeyboardA11y:os,nodeOrigin:he,nodeExtent:Et}),ie.createElement(bA,{nodes:e,edges:r,defaultNodes:i,defaultEdges:o,onConnect:_,onConnectStart:k,onConnectEnd:w,onClickConnectStart:x,onClickConnectEnd:S,nodesDraggable:ye,nodesConnectable:Le,nodesFocusable:ve,edgesFocusable:Pe,edgesUpdatable:He,elementsSelectable:et,elevateNodesOnSelect:rs,minZoom:je,maxZoom:tt,nodeExtent:Et,onNodesChange:Ur,onEdgesChange:Pi,snapToGrid:Ee,snapGrid:Re,connectionMode:j,translateExtent:St,connectOnClick:es,defaultEdgeOptions:ns,fitView:Cn,fitViewOptions:Jo,onNodesDelete:U,onEdgesDelete:V,onNodeDragStart:P,onNodeDrag:$,onNodeDragStop:L,onSelectionDrag:R,onSelectionDragStart:Z,onSelectionDragStop:W,noPanClassName:Zo,nodeOrigin:he,rfId:Oi,autoPanOnConnect:pu,autoPanOnNodeDrag:Ve,onError:ss,connectionRadius:vu,isValidConnection:qi,nodeDragThreshold:us}),ie.createElement(EA,{onSelectionChange:ee}),bn,ie.createElement(QI,{proOptions:ts,position:hu}),ie.createElement(IA,{rfId:Oi,disableKeyboardA11y:os})))});rb.displayName="ReactFlow";const jM=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function ib(){return Oe(jM,ot)}const ob=({id:e,x:r,y:i,width:o,height:s,style:u,color:l,strokeColor:c,strokeWidth:d,className:p,borderRadius:h,shapeRendering:m,onClick:y,selected:_})=>{const{background:k,backgroundColor:w}=u||{},x=l||k||w;return ie.createElement("rect",{className:pt(["react-flow__minimap-node",{selected:_},p]),x:r,y:i,rx:h,ry:h,width:o,height:s,fill:x,stroke:c,strokeWidth:d,shapeRendering:m,onClick:y?S=>y(S,e):void 0})};ob.displayName="MiniMapNode";var DM=Y.memo(ob);const zM=e=>e.nodeOrigin,FM=e=>e.getNodes().filter(r=>!r.hidden&&r.width&&r.height),hc=e=>e instanceof Function?e:()=>e;function $M({nodeStrokeColor:e="transparent",nodeColor:r="#e2e2e2",nodeClassName:i="",nodeBorderRadius:o=5,nodeStrokeWidth:s=2,nodeComponent:u=DM,onClick:l}){const c=Oe(FM,ot),d=Oe(zM),p=hc(r),h=hc(e),m=hc(i),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return ie.createElement(ie.Fragment,null,c.map(_=>{const{x:k,y:w}=qr(_,d).positionAbsolute;return ie.createElement(u,{key:_.id,x:k,y:w,width:_.width,height:_.height,style:_.style,selected:_.selected,className:m(_),color:p(_),borderRadius:o,strokeColor:h(_),strokeWidth:s,shapeRendering:y,onClick:l,id:_.id})}))}var BM=Y.memo($M);const UM=200,HM=150,VM=e=>{const r=e.getNodes(),i={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:i,boundingRect:r.length>0?eA(Va(r,e.nodeOrigin),i):i,rfId:e.rfId}},GM="react-flow__minimap-desc";function sb({style:e,className:r,nodeStrokeColor:i="transparent",nodeColor:o="#e2e2e2",nodeClassName:s="",nodeBorderRadius:u=5,nodeStrokeWidth:l=2,nodeComponent:c,maskColor:d="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:h=1,position:m="bottom-right",onClick:y,onNodeClick:_,pannable:k=!1,zoomable:w=!1,ariaLabel:x="React Flow mini map",inversePan:S=!1,zoomStep:b=10,offsetScale:N=5}){const C=st(),I=Y.useRef(null),{boundingRect:A,viewBB:P,rfId:$}=Oe(VM,ot),L=(e==null?void 0:e.width)??UM,U=(e==null?void 0:e.height)??HM,V=A.width/L,ee=A.height/U,Z=Math.max(V,ee),R=Z*L,W=Z*U,F=N*Z,ne=A.x-(R-A.width)/2-F,G=A.y-(W-A.height)/2-F,j=R+F*2,K=W+F*2,T=`${GM}-${$}`,z=Y.useRef(0);z.current=Z,Y.useEffect(()=>{if(I.current){const H=Yt(I.current),X=se=>{const{transform:re,d3Selection:Ee,d3Zoom:Re}=C.getState();if(se.sourceEvent.type!=="wheel"||!Ee||!Re)return;const xe=-se.sourceEvent.deltaY*(se.sourceEvent.deltaMode===1?.05:se.sourceEvent.deltaMode?1:.002)*b,Ce=re[2]*Math.pow(2,xe);Re.scaleTo(Ee,Ce)},oe=se=>{const{transform:re,d3Selection:Ee,d3Zoom:Re,translateExtent:xe,width:Ce,height:ye}=C.getState();if(se.sourceEvent.type!=="mousemove"||!Ee||!Re)return;const Le=z.current*Math.max(1,re[2])*(S?-1:1),ve={x:re[0]-se.sourceEvent.movementX*Le,y:re[1]-se.sourceEvent.movementY*Le},he=[[0,0],[Ce,ye]],Pe=jn.translate(ve.x,ve.y).scale(re[2]),He=Re.constrain()(Pe,he,xe);Re.transform(Ee,He)},ue=pk().on("zoom",k?oe:null).on("zoom.wheel",w?X:null);return H.call(ue),()=>{H.on("zoom",null)}}},[k,w,S,b]);const ae=y?H=>{const X=an(H);y(H,{x:X[0],y:X[1]})}:void 0,q=_?(H,X)=>{const oe=C.getState().nodeInternals.get(X);_(H,oe)}:void 0;return ie.createElement(um,{position:m,style:e,className:pt(["react-flow__minimap",r]),"data-testid":"rf__minimap"},ie.createElement("svg",{width:L,height:U,viewBox:`${ne} ${G} ${j} ${K}`,role:"img","aria-labelledby":T,ref:I,onClick:ae},x&&ie.createElement("title",{id:T},x),ie.createElement(BM,{onClick:q,nodeColor:o,nodeStrokeColor:i,nodeBorderRadius:u,nodeClassName:s,nodeStrokeWidth:l,nodeComponent:c}),ie.createElement("path",{className:"react-flow__minimap-mask",d:`M${ne-F},${G-F}h${j+F*2}v${K+F*2}h${-j-F*2}z
|
|
57
|
-
M${P.x},${P.y}h${P.width}v${P.height}h${-P.width}z`,fill:d,fillRule:"evenodd",stroke:p,strokeWidth:h,pointerEvents:"none"})))}sb.displayName="MiniMap";var WM=Y.memo(sb);function KM(){return ie.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},ie.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function YM(){return ie.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},ie.createElement("path",{d:"M0 0h32v4.2H0z"}))}function XM(){return ie.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},ie.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function QM(){return ie.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ie.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function ZM(){return ie.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ie.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const ko=({children:e,className:r,...i})=>ie.createElement("button",{type:"button",className:pt(["react-flow__controls-button",r]),...i},e);ko.displayName="ControlButton";const JM=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),ab=({style:e,showZoom:r=!0,showFitView:i=!0,showInteractive:o=!0,fitViewOptions:s,onZoomIn:u,onZoomOut:l,onFitView:c,onInteractiveChange:d,className:p,children:h,position:m="bottom-left"})=>{const y=st(),[_,k]=Y.useState(!1),{isInteractive:w,minZoomReached:x,maxZoomReached:S}=Oe(JM,ot),{zoomIn:b,zoomOut:N,fitView:C}=Ga();if(Y.useEffect(()=>{k(!0)},[]),!_)return null;const I=()=>{b(),u==null||u()},A=()=>{N(),l==null||l()},P=()=>{C(s),c==null||c()},$=()=>{y.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),d==null||d(!w)};return ie.createElement(um,{className:pt(["react-flow__controls",p]),position:m,style:e,"data-testid":"rf__controls"},r&&ie.createElement(ie.Fragment,null,ie.createElement(ko,{onClick:I,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:S},ie.createElement(KM,null)),ie.createElement(ko,{onClick:A,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:x},ie.createElement(YM,null))),i&&ie.createElement(ko,{className:"react-flow__controls-fitview",onClick:P,title:"fit view","aria-label":"fit view"},ie.createElement(XM,null)),o&&ie.createElement(ko,{className:"react-flow__controls-interactive",onClick:$,title:"toggle interactivity","aria-label":"toggle interactivity"},w?ie.createElement(ZM,null):ie.createElement(QM,null)),h)};ab.displayName="Controls";var eP=Y.memo(ab),ln;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ln||(ln={}));function tP({color:e,dimensions:r,lineWidth:i}){return ie.createElement("path",{stroke:e,strokeWidth:i,d:`M${r[0]/2} 0 V${r[1]} M0 ${r[1]/2} H${r[0]}`})}function nP({color:e,radius:r}){return ie.createElement("circle",{cx:r,cy:r,r,fill:e})}const rP={[ln.Dots]:"#91919a",[ln.Lines]:"#eee",[ln.Cross]:"#e2e2e2"},iP={[ln.Dots]:1,[ln.Lines]:1,[ln.Cross]:6},oP=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function ub({id:e,variant:r=ln.Dots,gap:i=20,size:o,lineWidth:s=1,offset:u=2,color:l,style:c,className:d}){const p=Y.useRef(null),{transform:h,patternId:m}=Oe(oP,ot),y=l||rP[r],_=o||iP[r],k=r===ln.Dots,w=r===ln.Cross,x=Array.isArray(i)?i:[i,i],S=[x[0]*h[2]||1,x[1]*h[2]||1],b=_*h[2],N=w?[b,b]:S,C=k?[b/u,b/u]:[N[0]/u,N[1]/u];return ie.createElement("svg",{className:pt(["react-flow__background",d]),style:{...c,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},ie.createElement("pattern",{id:m+e,x:h[0]%S[0],y:h[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`},k?ie.createElement(nP,{color:y,radius:b/u}):ie.createElement(tP,{dimensions:N,color:y,lineWidth:s})),ie.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}ub.displayName="Background";var sP=Y.memo(ub);function lb(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function cb(e,r=0){if(!e||typeof e!="object"||r>6)return null;const i=e;if(typeof i.input_tokens=="number"||typeof i.output_tokens=="number"||typeof i.cache_read_input_tokens=="number"||typeof i.cache_creation_input_tokens=="number")return{inputTokens:Number(i.input_tokens??0),outputTokens:Number(i.output_tokens??0),cacheReadTokens:Number(i.cache_read_input_tokens??0),cacheCreateTokens:Number(i.cache_creation_input_tokens??0)};for(const o of Object.values(i)){const s=cb(o,r+1);if(s)return s}return null}function aP(e,r){e.inputTokens+=r.inputTokens,e.outputTokens+=r.outputTokens,e.cacheReadTokens+=r.cacheReadTokens,e.cacheCreateTokens+=r.cacheCreateTokens}function fb(e,r=0){if(!e||typeof e!="object"||r>6)return null;const i=e;if(typeof i.model=="string"&&/^claude[-_]/i.test(i.model))return i.model;for(const o of Object.values(i)){const s=fb(o,r+1);if(s)return s}return null}function Yv(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,totalEvents:0}}function Or(e){if(!e)return;const r=e.replace(/\\/g,"/").split("/").filter(Boolean);return r[r.length-1]}function db(e,r){return`${e}::${r}`}function Xv(e){return e.agent_type??e.subagent_type??"subagent"}function Qv(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function To(e,r,i,o){const s=r;let u=e.agents.get(s);return u||(u={id:s,sessionId:r,label:"session",kind:"root",state:"active",startedAt:i,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:o,inFlightTool:null,usage:lb()},e.agents.set(s,u),u)}function l1(e,r,i){const o=r.session_id??"unknown",s=Qv(r);if(s)return Zv(e,o,s,r,i);const u=e.activeSubagentStack.get(o),l=u&&u.length>0?u[u.length-1]:null;if(l){const d=e.agents.get(db(o,l));if(d)return!d.cwd&&r.cwd&&(d.cwd=r.cwd,d.cwdBasename=Or(r.cwd)),d}const c=To(e,o,i,!1);return c.synthetic&&(c.synthetic=!1,c.startedAt=i),!c.cwd&&r.cwd&&(c.cwd=r.cwd,c.cwdBasename=Or(r.cwd)),c.label==="session"&&r.cwd&&(c.label=Or(r.cwd)??"session"),c}function Zv(e,r,i,o,s){const u=db(r,i),l=To(e,r,s,!0);let c=e.agents.get(u);if(c){!c.cwd&&o.cwd&&(c.cwd=o.cwd,c.cwdBasename=Or(o.cwd));const d=Xv(o);return d&&(c.label==="subagent"||!c.label)&&(c.label=d),c}return c={id:u,sessionId:r,label:Xv(o),kind:"subagent",parentId:l.id,state:"active",startedAt:s,tools:[],prompts:[],cwd:o.cwd,cwdBasename:Or(o.cwd),toolCount:0,childCount:0,inFlightTool:null,usage:lb()},e.agents.set(u,c),l.childCount+=1,c}function uP(e,r,i){const o=e.activeSubagentStack.get(r)??[];o.push(i),e.activeSubagentStack.set(r,o)}function lP(e,r,i){const o=e.activeSubagentStack.get(r);if(o){for(let s=o.length-1;s>=0;s--)if(o[s]===i){o.splice(s,1);break}o.length===0&&e.activeSubagentStack.delete(r)}}function pc(e,r=80){if(e==null)return"";if(typeof e=="string")return e.length>r?e.slice(0,r-1)+"…":e;try{const i=JSON.stringify(e);return i.length>r?i.slice(0,r-1)+"…":i}catch{return String(e)}}function bo(e){let r=null;for(let i=e.tools.length-1;i>=0;i--){const o=e.tools[i];if(o.endedAt==null){r=o;break}}e.inFlightTool=r}function cP(e,r,i){let o=!1;for(const s of e.agents.values()){let u=!1;for(const l of s.tools)l.endedAt==null&&r-l.startedAt>i&&(l.endedAt=l.startedAt+i,l.ok=!1,l.errorPreview="stale (no PostToolUse received)",e.toolIndex.delete(l.id),e.toolOwner.delete(l.id),u=!0,o=!0);u&&bo(s)}return o}function c1(e,r){if(r.seq<=e.lastSeq)return e;const i=r.payload??{},o=r.receivedAt,s=i.hook_event_name??"Unknown";if(s==="__clear")return{...Yv(),lastSeq:r.seq};e.totalEvents+=1,e.lastSeq=r.seq;const u=i.session_id??"unknown",l=l1(e,i,o),c=fb(i);switch(c&&(l.model=c),s){case"SessionStart":{const d=To(e,u,o,!1);d.synthetic=!1,d.state="active",d.startedAt=d.startedAt||o,!d.cwd&&i.cwd&&(d.cwd=i.cwd,d.cwdBasename=Or(i.cwd)),d.label==="session"&&i.cwd&&(d.label=Or(i.cwd)??"session");break}case"UserPromptSubmit":{for(const m of e.agents.values())m.sessionId===u&&m.kind==="subagent"&&m.state==="done"&&m.exitAt==null&&(m.exitAt=o);const d=To(e,u,o,!1);d.state="active",d.endedAt=void 0;const p=l1(e,i,o);p.state="active";const h=(typeof i.prompt=="string"?i.prompt:typeof i.message=="string"?i.message:"")??"";h&&(p.prompts.push({at:o,text:h}),p.firstPrompt||(p.firstPrompt=pc(h,120)));break}case"PreToolUse":{const d=i.tool_use_id??`${l.id}:${l.toolCount}`,p={id:d,name:i.tool_name??"?",input:i.tool_input,inputPreview:pc(i.tool_input),agentId:l.id,startedAt:o};l.tools.push(p),l.toolCount+=1,l.state="active",e.toolIndex.set(d,p),e.toolOwner.set(d,l.id),bo(l);break}case"PostToolUse":case"PostToolUseFailure":{const d=i.tool_use_id,p=d?e.toolIndex.get(d):void 0;if(p){p.endedAt=o,p.ok=s==="PostToolUse",p.response=i.tool_response,s==="PostToolUseFailure"&&(p.errorPreview=pc(i.tool_response));const h=cb(i.tool_response);h&&(p.usage=h),e.toolIndex.delete(d);const m=e.toolOwner.get(d);if(e.toolOwner.delete(d),m){const y=e.agents.get(m);y&&(h&&aP(y.usage,h),bo(y))}}break}case"SubagentStart":{const d=Qv(i);if(!d)break;const p=Zv(e,u,d,i,o);p.state="active",p.startedAt=p.startedAt||o;const h=Xv(i);h&&(p.label=h),uP(e,u,d);break}case"SubagentStop":{const d=Qv(i);if(!d)break;const p=Zv(e,u,d,i,o);p.state="done",p.endedAt=o,bo(p),lP(e,u,d);break}case"Stop":case"SessionEnd":{const d=To(e,u,o,!1);d.state="done",d.endedAt=o,bo(d);break}}return e}function _m(e){let r=5381;for(let i=0;i<e.length;i++)r=(r<<5)+r^e.charCodeAt(i);return Math.abs(r)%360}function fP(e,r,i){const o=(r??i)-e;if(o<1e3)return`${Math.max(0,o)}ms`;const s=Math.floor(o/1e3);if(s<60)return`${s}s`;const u=Math.floor(s/60),l=s%60;return`${u}m ${String(l).padStart(2,"0")}s`}function dP({data:e,selected:r}){const i=e.now??Date.now(),o=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",r?"selected":""].filter(Boolean).join(" "),s=e.tools.filter(c=>!c.endedAt).length,l=`hsl(${_m(e.sessionId)} 70% 60%)`;return O.jsxs("div",{className:o,style:{"--accent":l},children:[O.jsx("span",{className:"accent-stripe"}),O.jsx(bi,{type:"target",position:Se.Left,style:{background:"transparent",border:"none"}}),O.jsxs("div",{className:"head",children:[O.jsxs("div",{className:"title",children:[O.jsx(hP,{state:e.state}),O.jsx("span",{className:"label",title:e.cwd,children:e.label}),e.synthetic&&O.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"})]}),O.jsx("div",{className:"time",title:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:fP(e.startedAt,e.endedAt,i)})]}),O.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&O.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model&&O.jsx("span",{className:"model-chip",title:e.model,children:mP(e.model)})]}),e.tools.length>0&&O.jsx(vP,{tools:e.tools,now:i}),O.jsxs("div",{className:"meta",children:[O.jsxs("span",{children:[O.jsx("b",{children:e.toolCount})," tools"]}),s>0&&O.jsxs("span",{className:"inflight-meta",children:[O.jsx("b",{children:s})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&O.jsxs("span",{className:"tokens-meta",title:`in:${e.usage.inputTokens} out:${e.usage.outputTokens} cache-r:${e.usage.cacheReadTokens} cache-c:${e.usage.cacheCreateTokens}`,children:[O.jsx("b",{children:pP(e.usage.inputTokens+e.usage.outputTokens)})," tok"]})]}),O.jsx(bi,{type:"source",position:Se.Right,style:{background:"transparent",border:"none"}})]})}function hP({state:e}){const r=e==="active"?"live":e==="done"?"done":"err";return O.jsx("span",{className:`state-pill state-${e}`,children:r})}function pP(e){return e<1e3?`${e}`:e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(2)}M`}function vP({tools:e,now:r}){const u=new Array(24).fill(0);let l=0;for(const y of e){const _=r-y.startedAt;if(_<0||_>=6e4)continue;const k=23-Math.floor(_/2500);k>=0&&k<24&&(u[k]+=1,l+=1)}const c=Math.max(1,...u),d=132,p=14,h=d/24,m=c/(2500/1e3);return O.jsxs("div",{className:"tool-spark-row",title:`${l} tool calls in last 60s · peak ${m.toFixed(1)}/s`,children:[O.jsx("svg",{className:"tool-spark",width:d,height:p,viewBox:`0 0 ${d} ${p}`,"aria-hidden":!0,children:u.map((y,_)=>{const k=y===0?1.5:Math.max(1.5,y/c*p),w=_===23&&y>0,S=`tool-spark-bar${y>0?" active":""}${w?" latest":""}`;return O.jsx("rect",{x:_*h+.4,y:p-k,width:Math.max(.5,h-1),height:k,rx:.8,className:S},_)})}),O.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function mP(e){const r=e.match(/^claude[-_](opus|sonnet|haiku|fable)[-_](\d+(?:[-_.]\d+)*)/i);if(!r)return e;const i=r[1][0].toUpperCase()+r[1].slice(1).toLowerCase(),o=r[2].replace(/[-_]/g,".");return`${i} ${o}`}function f1(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function gP(e){if(e.endedAt==null)return"in-flight…";const r=e.endedAt-e.startedAt;return r<1e3?`${r}ms`:`${(r/1e3).toFixed(2)}s`}function yP({tool:e,onClose:r}){Y.useEffect(()=>{const o=s=>{s.key==="Escape"&&r()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[r]);const i=e.endedAt==null?"inflight":e.ok===!1?"err":"done";return O.jsx("div",{className:"modal-backdrop",onClick:r,role:"dialog","aria-modal":"true",children:O.jsxs("div",{className:"modal",onClick:o=>o.stopPropagation(),children:[O.jsxs("header",{className:"modal-head",children:[O.jsxs("div",{className:"modal-title",children:[O.jsx("span",{className:`status-dot ${i}`}),O.jsx("span",{className:"modal-tool-name",children:e.name}),O.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),O.jsxs("div",{className:"modal-actions",children:[O.jsx("span",{className:"modal-dur",children:gP(e)}),O.jsx("button",{className:"btn icon-btn",onClick:r,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),O.jsxs("section",{className:"modal-body",children:[O.jsxs("div",{className:"modal-section",children:[O.jsx("h4",{children:"Input"}),O.jsx("pre",{children:f1(e.input??e.inputPreview)})]}),O.jsxs("div",{className:"modal-section",children:[O.jsxs("h4",{children:["Response ",i==="err"&&O.jsx("span",{className:"err-tag",children:"error"})]}),O.jsx("pre",{children:e.endedAt==null?"(waiting…)":f1(e.response??e.errorPreview)})]})]})]})})}const Ea=18,d1=26,_P=12;function wP(e){const r=new Map;for(const s of e.nodeInternals.values()){const u=s.data;if(!(u!=null&&u.sessionId)||u.exitAt!=null||s.width==null||s.height==null)continue;const l=s.position.x,c=s.position.y,d=l+s.width,p=c+s.height,h=r.get(u.sessionId);h?(h.minX=Math.min(h.minX,l),h.minY=Math.min(h.minY,c),h.maxX=Math.max(h.maxX,d),h.maxY=Math.max(h.maxY,p),u.kind==="root"&&(h.label=h1(u)??h.label)):r.set(u.sessionId,{minX:l,minY:c,maxX:d,maxY:p,label:h1(u)??u.sessionId})}const i=new Map;for(const s of r.values())i.set(s.label,(i.get(s.label)??0)+1);const o=[];for(const[s,u]of r){const c=(i.get(u.label)??0)>1?`${u.label} · ${xP(s)}`:u.label;o.push({sessionId:s,label:c,x:u.minX-Ea,y:u.minY-Ea-d1,w:u.maxX-u.minX+Ea*2,h:u.maxY-u.minY+Ea*2+d1})}return o}function xP(e){const r=e.match(/[a-zA-Z0-9]{4}/);return r?r[0]:e.slice(0,4)}function h1(e){if(e.kind==="root")return e.label}function SP(){const{x:e,y:r,zoom:i}=ib(),o=Oe(wP,EP);return o.length<=1?null:O.jsx("div",{className:"session-clusters","aria-hidden":!0,children:o.map(s=>{const u=_m(s.sessionId),l={position:"absolute",left:s.x*i+e,top:s.y*i+r,width:s.w*i,height:s.h*i,borderColor:`hsl(${u} 65% 55% / 0.32)`,background:`hsl(${u} 70% 50% / 0.04)`},c={position:"absolute",left:s.x*i+e+16*i,top:(s.y-_P)*i+r,color:`hsl(${u} 70% 78%)`,borderColor:`hsl(${u} 65% 55% / 0.5)`,transform:`scale(${Math.min(1,i)})`,transformOrigin:"left top"};return O.jsxs(ie.Fragment,{children:[O.jsx("div",{className:"cluster-card",style:l}),O.jsx("div",{className:"cluster-label",style:c,children:s.label})]},s.sessionId)})})}function EP(e,r){if(e.length!==r.length)return!1;for(let i=0;i<e.length;i++){const o=e[i],s=r[i];if(o.sessionId!==s.sessionId||o.label!==s.label||o.x!==s.x||o.y!==s.y||o.w!==s.w||o.h!==s.h)return!1}return!0}const Jv=4e3,hb=600,kP=44,Ra=16,bP=52,p1=96,CP=28,NP={Read:"file",Write:"file",Edit:"file",MultiEdit:"file",Glob:"file",Grep:"file",LS:"file",NotebookEdit:"file",Bash:"shell",PowerShell:"shell",WebFetch:"web",WebSearch:"web",Task:"agent",Agent:"agent",TodoWrite:"task",TaskCreate:"task",TaskUpdate:"task",TaskList:"task",TaskGet:"task",TaskOutput:"task",TaskStop:"task",EnterPlanMode:"plan",ExitPlanMode:"plan",AskUserQuestion:"plan",Skill:"plan",Workflow:"plan",ScheduleWakeup:"other",CronCreate:"other",CronList:"other",CronDelete:"other",Monitor:"other",PushNotification:"other",RemoteTrigger:"other",ToolSearch:"other"};function RP(e){return e.startsWith("mcp__")?"mcp":NP[e]??"other"}const TP={Read:"📖",Write:"💾",Edit:"✏️",MultiEdit:"🔧",Glob:"🗺️",Grep:"🔎",Bash:"⚡",PowerShell:"💻",LS:"📂",Task:"🤖",Agent:"🤖",TodoWrite:"📋",TaskCreate:"📋",TaskUpdate:"📝",TaskList:"🗂️",TaskGet:"🗂️",TaskOutput:"📤",TaskStop:"🛑",WebFetch:"🌐",WebSearch:"🔭",ToolSearch:"🧰",NotebookEdit:"📓",EnterPlanMode:"🧭",ExitPlanMode:"🏁",AskUserQuestion:"❓",ScheduleWakeup:"⏰",CronCreate:"⏰",CronList:"📅",CronDelete:"🗑️",Skill:"🎯",Workflow:"🎬",Monitor:"📡",PushNotification:"🔔",RemoteTrigger:"📡",WebFetch_:"🌐"};function IP(e){return e.startsWith("mcp__")?"🔌":TP[e]??"✨"}const AP={git:"🐙",gh:"🐙",glab:"🐙",npm:"📦",pnpm:"📦",yarn:"📦",bun:"📦",brew:"🍺",node:"🟢",deno:"🟢",python:"🐍",python3:"🐍",py:"🐍",pip:"🐍",pip3:"🐍",uv:"🐍",ruby:"💎",bundle:"💎",gem:"💎",cargo:"🦀",rustc:"🦀",rustup:"🦀",go:"🐹",docker:"🐳","docker-compose":"🐳",podman:"🐳",kubectl:"☸️",helm:"☸️",k9s:"☸️",grep:"🔎",rg:"🔎",ag:"🔎",ack:"🔎",find:"🔍",fd:"🔍",locate:"🔍",which:"🔍",ls:"📂",dir:"📂",tree:"📂",cat:"📄",head:"📄",tail:"📄",less:"📄",more:"📄",bat:"📄",cp:"📋",mv:"✂️",rm:"🗑️",rmdir:"🗑️",mkdir:"📁",touch:"📁",sed:"✏️",awk:"✏️",tr:"✏️",curl:"🌐",wget:"🌐",http:"🌐",httpie:"🌐",ssh:"🔐",scp:"🔐",rsync:"🔐",ping:"📡",make:"🔨",cmake:"🔨",ninja:"🔨",bazel:"🔨",just:"🔨",terraform:"🏗️",ansible:"📕",pulumi:"🏗️",ps:"📊",top:"📊",htop:"📊",btm:"📊",kill:"💀",pkill:"💀",systemctl:"⚙️",service:"⚙️",tar:"🗜️",zip:"🗜️",unzip:"🗜️",gzip:"🗜️","7z":"🗜️",vim:"📝",nvim:"📝",nano:"📝",emacs:"📝",code:"📝",jq:"🪺",yq:"🪺",echo:"💬",printf:"💬",ffmpeg:"🎞️",ffprobe:"🎞️",imagemagick:"🖼️",convert:"🖼️","Get-ChildItem":"📂","Get-Content":"📄","Set-Content":"💾","Out-File":"💾","Add-Content":"💾","Set-Location":"📍","Get-Location":"📍","Get-Process":"📊","Start-Process":"▶️","Stop-Process":"💀","Invoke-WebRequest":"🌐","Invoke-RestMethod":"🌐","New-Item":"📁","Remove-Item":"🗑️","Copy-Item":"📋","Move-Item":"✂️","Test-Path":"🔍","Where-Object":"🔎","ForEach-Object":"🔁","Select-Object":"🎯","Measure-Object":"📊","Get-Service":"⚙️","Restart-Service":"⚙️","ConvertTo-Json":"🪺","ConvertFrom-Json":"🪺"};function pb(e){if(!e)return null;let r=e.trim();if(!r)return null;const i=r.match(/^(?:bash|sh|zsh|fish|powershell|pwsh)(?:\.exe)?\s+(?:-c|-Command|-NoProfile|-NonInteractive|\s)+["']([^"']+)["']/i);if(i)return pb(i[1]);for(;;){const u=r.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!u)break;r=r.slice(u[0].length)}r=r.replace(/^sudo(?:\s+-\S+)*\s+/,""),r=r.replace(/^(?:time|nohup|xargs)\s+/,"");const o=r.match(/^([^\s|;&<>(]+)/);if(!o)return null;let s=o[1];return s=s.replace(/^.*[/\\]/,""),s=s.replace(/\.(exe|cmd|bat|ps1)$/i,""),s||null}function MP(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const r=e;return typeof r.command=="string"?r.command:typeof r.cmd=="string"?r.cmd:typeof r.script=="string"?r.script:null}function PP(e,r){if(e!=="Bash"&&e!=="PowerShell")return null;const i=MP(r);if(!i)return null;const o=pb(i);return o?{emoji:AP[o]??"⚙️",label:o}:null}function qP(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function OP(e,r){if(e.endedAt==null)return 1;const i=r-e.endedAt;return i<Jv?1:Math.max(0,1-(i-Jv)/hb)}function LP(e,r,i,o,s){const u=[];for(const l of e.values()){if(l.exitAt!=null&&s-l.exitAt>600)continue;const c=i.get(l.id)??r.get(l.id);if(!c)continue;const d=l.tools.filter(S=>S.endedAt==null?!0:s-S.endedAt<Jv+hb).slice(-4);if(d.length===0)continue;const p=o.get(l.id),h=(p==null?void 0:p.width)??240,m=(p==null?void 0:p.height)??130,y=c.x,_=c.y,k=y+h,w=_+m/2,x=d.length-1;d.forEach((S,b)=>{const N=(b-x/2)*kP,C=y+h+bP,I=_+m/2+N-Ra,A=OP(S,s),P=S.inputPreview??"",$=qP(S),L=A<.999;u.push({id:S.id,toolId:S.id,agentId:l.id,toolName:S.name,name:S.name,emoji:IP(S.name),status:$,category:RP(S.name),inputPreview:P,fade:A,fading:L,worldX:C,worldY:I,anchorX:k,anchorY:w,spawnDx:k-C,spawnDy:w-(I+Ra)});const U=PP(S.name,S.input);if(U){const V=C+p1+CP,ee=I,Z=C+p1,R=I+Ra;u.push({id:`sub:${S.id}`,toolId:S.id,agentId:l.id,toolName:S.name,name:U.label,emoji:U.emoji,isSub:!0,status:$,category:"shell",inputPreview:P,fade:A,fading:L,worldX:V,worldY:ee,anchorX:Z,anchorY:R,spawnDx:Z-V,spawnDy:0})}})}return u}function jP({agents:e,positions:r,pinned:i,measured:o,now:s,onOpenTool:u}){const{x:l,y:c,zoom:d}=ib(),p=LP(e,r,i,o,s);return O.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[O.jsx("svg",{className:"tool-bursts-svg",children:p.map(h=>{const m=h.anchorX*d+l,y=h.anchorY*d+c,_=(h.worldX+6)*d+l,k=(h.worldY+Ra)*d+c,w=m+(_-m)*.55;return O.jsx("path",{d:`M ${m} ${y} Q ${w} ${y}, ${_} ${k}`,className:`tool-conn status-${h.status}${h.fading?" fading":""}`,opacity:h.fade},`l:${h.id}`)})}),p.map(h=>{const m=h.worldX*d+l,y=h.worldY*d+c,_={left:`${m}px`,top:`${y}px`,transform:`scale(${d})`,transformOrigin:"left top","--spawn-dx":`${h.spawnDx}px`,"--spawn-dy":`${h.spawnDy}px`},k=h.isSub?`${h.toolName} · ${h.name}`:h.toolName,w=h.inputPreview?`${k} · ${h.inputPreview}`:k,x=u!=null;return O.jsx("div",{className:"tool-burst-wrap",style:_,children:O.jsxs("div",{className:`tool-burst cat-${h.category} status-${h.status}${h.fading?" fading":""}${x?" clickable":""}${h.isSub?" sub":""}`,title:w,role:x?"button":void 0,tabIndex:x?0:void 0,onClick:x?()=>u(h.toolId):void 0,onKeyDown:x?S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),u(h.toolId))}:void 0,children:[O.jsx("span",{className:"tb-emoji",children:h.emoji}),O.jsx("span",{className:"tb-name",children:h.name}),h.status==="inflight"&&O.jsx("span",{className:"tb-spin"}),h.status==="done"&&O.jsx("span",{className:"tb-mark done",children:"✓"}),h.status==="err"&&O.jsx("span",{className:"tb-mark err",children:"×"})]})},h.id)})]})}function wm(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var vc,v1;function DP(){if(v1)return vc;v1=1;function e(){this.__data__=[],this.size=0}return vc=e,vc}var mc,m1;function Ci(){if(m1)return mc;m1=1;function e(r,i){return r===i||r!==r&&i!==i}return mc=e,mc}var gc,g1;function Wa(){if(g1)return gc;g1=1;var e=Ci();function r(i,o){for(var s=i.length;s--;)if(e(i[s][0],o))return s;return-1}return gc=r,gc}var yc,y1;function zP(){if(y1)return yc;y1=1;var e=Wa(),r=Array.prototype,i=r.splice;function o(s){var u=this.__data__,l=e(u,s);if(l<0)return!1;var c=u.length-1;return l==c?u.pop():i.call(u,l,1),--this.size,!0}return yc=o,yc}var _c,_1;function FP(){if(_1)return _c;_1=1;var e=Wa();function r(i){var o=this.__data__,s=e(o,i);return s<0?void 0:o[s][1]}return _c=r,_c}var wc,w1;function $P(){if(w1)return wc;w1=1;var e=Wa();function r(i){return e(this.__data__,i)>-1}return wc=r,wc}var xc,x1;function BP(){if(x1)return xc;x1=1;var e=Wa();function r(i,o){var s=this.__data__,u=e(s,i);return u<0?(++this.size,s.push([i,o])):s[u][1]=o,this}return xc=r,xc}var Sc,S1;function Ka(){if(S1)return Sc;S1=1;var e=DP(),r=zP(),i=FP(),o=$P(),s=BP();function u(l){var c=-1,d=l==null?0:l.length;for(this.clear();++c<d;){var p=l[c];this.set(p[0],p[1])}}return u.prototype.clear=e,u.prototype.delete=r,u.prototype.get=i,u.prototype.has=o,u.prototype.set=s,Sc=u,Sc}var Ec,E1;function UP(){if(E1)return Ec;E1=1;var e=Ka();function r(){this.__data__=new e,this.size=0}return Ec=r,Ec}var kc,k1;function HP(){if(k1)return kc;k1=1;function e(r){var i=this.__data__,o=i.delete(r);return this.size=i.size,o}return kc=e,kc}var bc,b1;function VP(){if(b1)return bc;b1=1;function e(r){return this.__data__.get(r)}return bc=e,bc}var Cc,C1;function GP(){if(C1)return Cc;C1=1;function e(r){return this.__data__.has(r)}return Cc=e,Cc}var Nc,N1;function vb(){if(N1)return Nc;N1=1;var e=typeof da=="object"&&da&&da.Object===Object&&da;return Nc=e,Nc}var Rc,R1;function dn(){if(R1)return Rc;R1=1;var e=vb(),r=typeof self=="object"&&self&&self.Object===Object&&self,i=e||r||Function("return this")();return Rc=i,Rc}var Tc,T1;function Ni(){if(T1)return Tc;T1=1;var e=dn(),r=e.Symbol;return Tc=r,Tc}var Ic,I1;function WP(){if(I1)return Ic;I1=1;var e=Ni(),r=Object.prototype,i=r.hasOwnProperty,o=r.toString,s=e?e.toStringTag:void 0;function u(l){var c=i.call(l,s),d=l[s];try{l[s]=void 0;var p=!0}catch{}var h=o.call(l);return p&&(c?l[s]=d:delete l[s]),h}return Ic=u,Ic}var Ac,A1;function KP(){if(A1)return Ac;A1=1;var e=Object.prototype,r=e.toString;function i(o){return r.call(o)}return Ac=i,Ac}var Mc,M1;function Dr(){if(M1)return Mc;M1=1;var e=Ni(),r=WP(),i=KP(),o="[object Null]",s="[object Undefined]",u=e?e.toStringTag:void 0;function l(c){return c==null?c===void 0?s:o:u&&u in Object(c)?r(c):i(c)}return Mc=l,Mc}var Pc,P1;function Qt(){if(P1)return Pc;P1=1;function e(r){var i=typeof r;return r!=null&&(i=="object"||i=="function")}return Pc=e,Pc}var qc,q1;function Bo(){if(q1)return qc;q1=1;var e=Dr(),r=Qt(),i="[object AsyncFunction]",o="[object Function]",s="[object GeneratorFunction]",u="[object Proxy]";function l(c){if(!r(c))return!1;var d=e(c);return d==o||d==s||d==i||d==u}return qc=l,qc}var Oc,O1;function YP(){if(O1)return Oc;O1=1;var e=dn(),r=e["__core-js_shared__"];return Oc=r,Oc}var Lc,L1;function XP(){if(L1)return Lc;L1=1;var e=YP(),r=(function(){var o=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""})();function i(o){return!!r&&r in o}return Lc=i,Lc}var jc,j1;function mb(){if(j1)return jc;j1=1;var e=Function.prototype,r=e.toString;function i(o){if(o!=null){try{return r.call(o)}catch{}try{return o+""}catch{}}return""}return jc=i,jc}var Dc,D1;function QP(){if(D1)return Dc;D1=1;var e=Bo(),r=XP(),i=Qt(),o=mb(),s=/[\\^$.*+?()[\]{}|]/g,u=/^\[object .+?Constructor\]$/,l=Function.prototype,c=Object.prototype,d=l.toString,p=c.hasOwnProperty,h=RegExp("^"+d.call(p).replace(s,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(y){if(!i(y)||r(y))return!1;var _=e(y)?h:u;return _.test(o(y))}return Dc=m,Dc}var zc,z1;function ZP(){if(z1)return zc;z1=1;function e(r,i){return r==null?void 0:r[i]}return zc=e,zc}var Fc,F1;function zr(){if(F1)return Fc;F1=1;var e=QP(),r=ZP();function i(o,s){var u=r(o,s);return e(u)?u:void 0}return Fc=i,Fc}var $c,$1;function xm(){if($1)return $c;$1=1;var e=zr(),r=dn(),i=e(r,"Map");return $c=i,$c}var Bc,B1;function Ya(){if(B1)return Bc;B1=1;var e=zr(),r=e(Object,"create");return Bc=r,Bc}var Uc,U1;function JP(){if(U1)return Uc;U1=1;var e=Ya();function r(){this.__data__=e?e(null):{},this.size=0}return Uc=r,Uc}var Hc,H1;function eq(){if(H1)return Hc;H1=1;function e(r){var i=this.has(r)&&delete this.__data__[r];return this.size-=i?1:0,i}return Hc=e,Hc}var Vc,V1;function tq(){if(V1)return Vc;V1=1;var e=Ya(),r="__lodash_hash_undefined__",i=Object.prototype,o=i.hasOwnProperty;function s(u){var l=this.__data__;if(e){var c=l[u];return c===r?void 0:c}return o.call(l,u)?l[u]:void 0}return Vc=s,Vc}var Gc,G1;function nq(){if(G1)return Gc;G1=1;var e=Ya(),r=Object.prototype,i=r.hasOwnProperty;function o(s){var u=this.__data__;return e?u[s]!==void 0:i.call(u,s)}return Gc=o,Gc}var Wc,W1;function rq(){if(W1)return Wc;W1=1;var e=Ya(),r="__lodash_hash_undefined__";function i(o,s){var u=this.__data__;return this.size+=this.has(o)?0:1,u[o]=e&&s===void 0?r:s,this}return Wc=i,Wc}var Kc,K1;function iq(){if(K1)return Kc;K1=1;var e=JP(),r=eq(),i=tq(),o=nq(),s=rq();function u(l){var c=-1,d=l==null?0:l.length;for(this.clear();++c<d;){var p=l[c];this.set(p[0],p[1])}}return u.prototype.clear=e,u.prototype.delete=r,u.prototype.get=i,u.prototype.has=o,u.prototype.set=s,Kc=u,Kc}var Yc,Y1;function oq(){if(Y1)return Yc;Y1=1;var e=iq(),r=Ka(),i=xm();function o(){this.size=0,this.__data__={hash:new e,map:new(i||r),string:new e}}return Yc=o,Yc}var Xc,X1;function sq(){if(X1)return Xc;X1=1;function e(r){var i=typeof r;return i=="string"||i=="number"||i=="symbol"||i=="boolean"?r!=="__proto__":r===null}return Xc=e,Xc}var Qc,Q1;function Xa(){if(Q1)return Qc;Q1=1;var e=sq();function r(i,o){var s=i.__data__;return e(o)?s[typeof o=="string"?"string":"hash"]:s.map}return Qc=r,Qc}var Zc,Z1;function aq(){if(Z1)return Zc;Z1=1;var e=Xa();function r(i){var o=e(this,i).delete(i);return this.size-=o?1:0,o}return Zc=r,Zc}var Jc,J1;function uq(){if(J1)return Jc;J1=1;var e=Xa();function r(i){return e(this,i).get(i)}return Jc=r,Jc}var ef,e_;function lq(){if(e_)return ef;e_=1;var e=Xa();function r(i){return e(this,i).has(i)}return ef=r,ef}var tf,t_;function cq(){if(t_)return tf;t_=1;var e=Xa();function r(i,o){var s=e(this,i),u=s.size;return s.set(i,o),this.size+=s.size==u?0:1,this}return tf=r,tf}var nf,n_;function Sm(){if(n_)return nf;n_=1;var e=oq(),r=aq(),i=uq(),o=lq(),s=cq();function u(l){var c=-1,d=l==null?0:l.length;for(this.clear();++c<d;){var p=l[c];this.set(p[0],p[1])}}return u.prototype.clear=e,u.prototype.delete=r,u.prototype.get=i,u.prototype.has=o,u.prototype.set=s,nf=u,nf}var rf,r_;function fq(){if(r_)return rf;r_=1;var e=Ka(),r=xm(),i=Sm(),o=200;function s(u,l){var c=this.__data__;if(c instanceof e){var d=c.__data__;if(!r||d.length<o-1)return d.push([u,l]),this.size=++c.size,this;c=this.__data__=new i(d)}return c.set(u,l),this.size=c.size,this}return rf=s,rf}var of,i_;function Qa(){if(i_)return of;i_=1;var e=Ka(),r=UP(),i=HP(),o=VP(),s=GP(),u=fq();function l(c){var d=this.__data__=new e(c);this.size=d.size}return l.prototype.clear=r,l.prototype.delete=i,l.prototype.get=o,l.prototype.has=s,l.prototype.set=u,of=l,of}var sf,o_;function Em(){if(o_)return sf;o_=1;function e(r,i){for(var o=-1,s=r==null?0:r.length;++o<s&&i(r[o],o,r)!==!1;);return r}return sf=e,sf}var af,s_;function gb(){if(s_)return af;s_=1;var e=zr(),r=(function(){try{var i=e(Object,"defineProperty");return i({},"",{}),i}catch{}})();return af=r,af}var uf,a_;function Za(){if(a_)return uf;a_=1;var e=gb();function r(i,o,s){o=="__proto__"&&e?e(i,o,{configurable:!0,enumerable:!0,value:s,writable:!0}):i[o]=s}return uf=r,uf}var lf,u_;function Ja(){if(u_)return lf;u_=1;var e=Za(),r=Ci(),i=Object.prototype,o=i.hasOwnProperty;function s(u,l,c){var d=u[l];(!(o.call(u,l)&&r(d,c))||c===void 0&&!(l in u))&&e(u,l,c)}return lf=s,lf}var cf,l_;function Uo(){if(l_)return cf;l_=1;var e=Ja(),r=Za();function i(o,s,u,l){var c=!u;u||(u={});for(var d=-1,p=s.length;++d<p;){var h=s[d],m=l?l(u[h],o[h],h,u,o):void 0;m===void 0&&(m=o[h]),c?r(u,h,m):e(u,h,m)}return u}return cf=i,cf}var ff,c_;function dq(){if(c_)return ff;c_=1;function e(r,i){for(var o=-1,s=Array(r);++o<r;)s[o]=i(o);return s}return ff=e,ff}var df,f_;function xn(){if(f_)return df;f_=1;function e(r){return r!=null&&typeof r=="object"}return df=e,df}var hf,d_;function hq(){if(d_)return hf;d_=1;var e=Dr(),r=xn(),i="[object Arguments]";function o(s){return r(s)&&e(s)==i}return hf=o,hf}var pf,h_;function Ho(){if(h_)return pf;h_=1;var e=hq(),r=xn(),i=Object.prototype,o=i.hasOwnProperty,s=i.propertyIsEnumerable,u=e((function(){return arguments})())?e:function(l){return r(l)&&o.call(l,"callee")&&!s.call(l,"callee")};return pf=u,pf}var vf,p_;function Je(){if(p_)return vf;p_=1;var e=Array.isArray;return vf=e,vf}var Co={exports:{}},mf,v_;function pq(){if(v_)return mf;v_=1;function e(){return!1}return mf=e,mf}Co.exports;var m_;function Ri(){return m_||(m_=1,(function(e,r){var i=dn(),o=pq(),s=r&&!r.nodeType&&r,u=s&&!0&&e&&!e.nodeType&&e,l=u&&u.exports===s,c=l?i.Buffer:void 0,d=c?c.isBuffer:void 0,p=d||o;e.exports=p})(Co,Co.exports)),Co.exports}var gf,g_;function eu(){if(g_)return gf;g_=1;var e=9007199254740991,r=/^(?:0|[1-9]\d*)$/;function i(o,s){var u=typeof o;return s=s??e,!!s&&(u=="number"||u!="symbol"&&r.test(o))&&o>-1&&o%1==0&&o<s}return gf=i,gf}var yf,y_;function km(){if(y_)return yf;y_=1;var e=9007199254740991;function r(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=e}return yf=r,yf}var _f,__;function vq(){if(__)return _f;__=1;var e=Dr(),r=km(),i=xn(),o="[object Arguments]",s="[object Array]",u="[object Boolean]",l="[object Date]",c="[object Error]",d="[object Function]",p="[object Map]",h="[object Number]",m="[object Object]",y="[object RegExp]",_="[object Set]",k="[object String]",w="[object WeakMap]",x="[object ArrayBuffer]",S="[object DataView]",b="[object Float32Array]",N="[object Float64Array]",C="[object Int8Array]",I="[object Int16Array]",A="[object Int32Array]",P="[object Uint8Array]",$="[object Uint8ClampedArray]",L="[object Uint16Array]",U="[object Uint32Array]",V={};V[b]=V[N]=V[C]=V[I]=V[A]=V[P]=V[$]=V[L]=V[U]=!0,V[o]=V[s]=V[x]=V[u]=V[S]=V[l]=V[c]=V[d]=V[p]=V[h]=V[m]=V[y]=V[_]=V[k]=V[w]=!1;function ee(Z){return i(Z)&&r(Z.length)&&!!V[e(Z)]}return _f=ee,_f}var wf,w_;function tu(){if(w_)return wf;w_=1;function e(r){return function(i){return r(i)}}return wf=e,wf}var No={exports:{}};No.exports;var x_;function bm(){return x_||(x_=1,(function(e,r){var i=vb(),o=r&&!r.nodeType&&r,s=o&&!0&&e&&!e.nodeType&&e,u=s&&s.exports===o,l=u&&i.process,c=(function(){try{var d=s&&s.require&&s.require("util").types;return d||l&&l.binding&&l.binding("util")}catch{}})();e.exports=c})(No,No.exports)),No.exports}var xf,S_;function Vo(){if(S_)return xf;S_=1;var e=vq(),r=tu(),i=bm(),o=i&&i.isTypedArray,s=o?r(o):e;return xf=s,xf}var Sf,E_;function yb(){if(E_)return Sf;E_=1;var e=dq(),r=Ho(),i=Je(),o=Ri(),s=eu(),u=Vo(),l=Object.prototype,c=l.hasOwnProperty;function d(p,h){var m=i(p),y=!m&&r(p),_=!m&&!y&&o(p),k=!m&&!y&&!_&&u(p),w=m||y||_||k,x=w?e(p.length,String):[],S=x.length;for(var b in p)(h||c.call(p,b))&&!(w&&(b=="length"||_&&(b=="offset"||b=="parent")||k&&(b=="buffer"||b=="byteLength"||b=="byteOffset")||s(b,S)))&&x.push(b);return x}return Sf=d,Sf}var Ef,k_;function nu(){if(k_)return Ef;k_=1;var e=Object.prototype;function r(i){var o=i&&i.constructor,s=typeof o=="function"&&o.prototype||e;return i===s}return Ef=r,Ef}var kf,b_;function _b(){if(b_)return kf;b_=1;function e(r,i){return function(o){return r(i(o))}}return kf=e,kf}var bf,C_;function mq(){if(C_)return bf;C_=1;var e=_b(),r=e(Object.keys,Object);return bf=r,bf}var Cf,N_;function Cm(){if(N_)return Cf;N_=1;var e=nu(),r=mq(),i=Object.prototype,o=i.hasOwnProperty;function s(u){if(!e(u))return r(u);var l=[];for(var c in Object(u))o.call(u,c)&&c!="constructor"&&l.push(c);return l}return Cf=s,Cf}var Nf,R_;function Fn(){if(R_)return Nf;R_=1;var e=Bo(),r=km();function i(o){return o!=null&&r(o.length)&&!e(o)}return Nf=i,Nf}var Rf,T_;function dr(){if(T_)return Rf;T_=1;var e=yb(),r=Cm(),i=Fn();function o(s){return i(s)?e(s):r(s)}return Rf=o,Rf}var Tf,I_;function gq(){if(I_)return Tf;I_=1;var e=Uo(),r=dr();function i(o,s){return o&&e(s,r(s),o)}return Tf=i,Tf}var If,A_;function yq(){if(A_)return If;A_=1;function e(r){var i=[];if(r!=null)for(var o in Object(r))i.push(o);return i}return If=e,If}var Af,M_;function _q(){if(M_)return Af;M_=1;var e=Qt(),r=nu(),i=yq(),o=Object.prototype,s=o.hasOwnProperty;function u(l){if(!e(l))return i(l);var c=r(l),d=[];for(var p in l)p=="constructor"&&(c||!s.call(l,p))||d.push(p);return d}return Af=u,Af}var Mf,P_;function Fr(){if(P_)return Mf;P_=1;var e=yb(),r=_q(),i=Fn();function o(s){return i(s)?e(s,!0):r(s)}return Mf=o,Mf}var Pf,q_;function wq(){if(q_)return Pf;q_=1;var e=Uo(),r=Fr();function i(o,s){return o&&e(s,r(s),o)}return Pf=i,Pf}var Ro={exports:{}};Ro.exports;var O_;function wb(){return O_||(O_=1,(function(e,r){var i=dn(),o=r&&!r.nodeType&&r,s=o&&!0&&e&&!e.nodeType&&e,u=s&&s.exports===o,l=u?i.Buffer:void 0,c=l?l.allocUnsafe:void 0;function d(p,h){if(h)return p.slice();var m=p.length,y=c?c(m):new p.constructor(m);return p.copy(y),y}e.exports=d})(Ro,Ro.exports)),Ro.exports}var qf,L_;function xb(){if(L_)return qf;L_=1;function e(r,i){var o=-1,s=r.length;for(i||(i=Array(s));++o<s;)i[o]=r[o];return i}return qf=e,qf}var Of,j_;function Sb(){if(j_)return Of;j_=1;function e(r,i){for(var o=-1,s=r==null?0:r.length,u=0,l=[];++o<s;){var c=r[o];i(c,o,r)&&(l[u++]=c)}return l}return Of=e,Of}var Lf,D_;function Eb(){if(D_)return Lf;D_=1;function e(){return[]}return Lf=e,Lf}var jf,z_;function Nm(){if(z_)return jf;z_=1;var e=Sb(),r=Eb(),i=Object.prototype,o=i.propertyIsEnumerable,s=Object.getOwnPropertySymbols,u=s?function(l){return l==null?[]:(l=Object(l),e(s(l),function(c){return o.call(l,c)}))}:r;return jf=u,jf}var Df,F_;function xq(){if(F_)return Df;F_=1;var e=Uo(),r=Nm();function i(o,s){return e(o,r(o),s)}return Df=i,Df}var zf,$_;function Rm(){if($_)return zf;$_=1;function e(r,i){for(var o=-1,s=i.length,u=r.length;++o<s;)r[u+o]=i[o];return r}return zf=e,zf}var Ff,B_;function ru(){if(B_)return Ff;B_=1;var e=_b(),r=e(Object.getPrototypeOf,Object);return Ff=r,Ff}var $f,U_;function kb(){if(U_)return $f;U_=1;var e=Rm(),r=ru(),i=Nm(),o=Eb(),s=Object.getOwnPropertySymbols,u=s?function(l){for(var c=[];l;)e(c,i(l)),l=r(l);return c}:o;return $f=u,$f}var Bf,H_;function Sq(){if(H_)return Bf;H_=1;var e=Uo(),r=kb();function i(o,s){return e(o,r(o),s)}return Bf=i,Bf}var Uf,V_;function bb(){if(V_)return Uf;V_=1;var e=Rm(),r=Je();function i(o,s,u){var l=s(o);return r(o)?l:e(l,u(o))}return Uf=i,Uf}var Hf,G_;function Cb(){if(G_)return Hf;G_=1;var e=bb(),r=Nm(),i=dr();function o(s){return e(s,i,r)}return Hf=o,Hf}var Vf,W_;function Eq(){if(W_)return Vf;W_=1;var e=bb(),r=kb(),i=Fr();function o(s){return e(s,i,r)}return Vf=o,Vf}var Gf,K_;function kq(){if(K_)return Gf;K_=1;var e=zr(),r=dn(),i=e(r,"DataView");return Gf=i,Gf}var Wf,Y_;function bq(){if(Y_)return Wf;Y_=1;var e=zr(),r=dn(),i=e(r,"Promise");return Wf=i,Wf}var Kf,X_;function Nb(){if(X_)return Kf;X_=1;var e=zr(),r=dn(),i=e(r,"Set");return Kf=i,Kf}var Yf,Q_;function Cq(){if(Q_)return Yf;Q_=1;var e=zr(),r=dn(),i=e(r,"WeakMap");return Yf=i,Yf}var Xf,Z_;function Ti(){if(Z_)return Xf;Z_=1;var e=kq(),r=xm(),i=bq(),o=Nb(),s=Cq(),u=Dr(),l=mb(),c="[object Map]",d="[object Object]",p="[object Promise]",h="[object Set]",m="[object WeakMap]",y="[object DataView]",_=l(e),k=l(r),w=l(i),x=l(o),S=l(s),b=u;return(e&&b(new e(new ArrayBuffer(1)))!=y||r&&b(new r)!=c||i&&b(i.resolve())!=p||o&&b(new o)!=h||s&&b(new s)!=m)&&(b=function(N){var C=u(N),I=C==d?N.constructor:void 0,A=I?l(I):"";if(A)switch(A){case _:return y;case k:return c;case w:return p;case x:return h;case S:return m}return C}),Xf=b,Xf}var Qf,J_;function Nq(){if(J_)return Qf;J_=1;var e=Object.prototype,r=e.hasOwnProperty;function i(o){var s=o.length,u=new o.constructor(s);return s&&typeof o[0]=="string"&&r.call(o,"index")&&(u.index=o.index,u.input=o.input),u}return Qf=i,Qf}var Zf,ew;function Rb(){if(ew)return Zf;ew=1;var e=dn(),r=e.Uint8Array;return Zf=r,Zf}var Jf,tw;function Tm(){if(tw)return Jf;tw=1;var e=Rb();function r(i){var o=new i.constructor(i.byteLength);return new e(o).set(new e(i)),o}return Jf=r,Jf}var ed,nw;function Rq(){if(nw)return ed;nw=1;var e=Tm();function r(i,o){var s=o?e(i.buffer):i.buffer;return new i.constructor(s,i.byteOffset,i.byteLength)}return ed=r,ed}var td,rw;function Tq(){if(rw)return td;rw=1;var e=/\w*$/;function r(i){var o=new i.constructor(i.source,e.exec(i));return o.lastIndex=i.lastIndex,o}return td=r,td}var nd,iw;function Iq(){if(iw)return nd;iw=1;var e=Ni(),r=e?e.prototype:void 0,i=r?r.valueOf:void 0;function o(s){return i?Object(i.call(s)):{}}return nd=o,nd}var rd,ow;function Tb(){if(ow)return rd;ow=1;var e=Tm();function r(i,o){var s=o?e(i.buffer):i.buffer;return new i.constructor(s,i.byteOffset,i.length)}return rd=r,rd}var id,sw;function Aq(){if(sw)return id;sw=1;var e=Tm(),r=Rq(),i=Tq(),o=Iq(),s=Tb(),u="[object Boolean]",l="[object Date]",c="[object Map]",d="[object Number]",p="[object RegExp]",h="[object Set]",m="[object String]",y="[object Symbol]",_="[object ArrayBuffer]",k="[object DataView]",w="[object Float32Array]",x="[object Float64Array]",S="[object Int8Array]",b="[object Int16Array]",N="[object Int32Array]",C="[object Uint8Array]",I="[object Uint8ClampedArray]",A="[object Uint16Array]",P="[object Uint32Array]";function $(L,U,V){var ee=L.constructor;switch(U){case _:return e(L);case u:case l:return new ee(+L);case k:return r(L,V);case w:case x:case S:case b:case N:case C:case I:case A:case P:return s(L,V);case c:return new ee;case d:case m:return new ee(L);case p:return i(L);case h:return new ee;case y:return o(L)}}return id=$,id}var od,aw;function Ib(){if(aw)return od;aw=1;var e=Qt(),r=Object.create,i=(function(){function o(){}return function(s){if(!e(s))return{};if(r)return r(s);o.prototype=s;var u=new o;return o.prototype=void 0,u}})();return od=i,od}var sd,uw;function Ab(){if(uw)return sd;uw=1;var e=Ib(),r=ru(),i=nu();function o(s){return typeof s.constructor=="function"&&!i(s)?e(r(s)):{}}return sd=o,sd}var ad,lw;function Mq(){if(lw)return ad;lw=1;var e=Ti(),r=xn(),i="[object Map]";function o(s){return r(s)&&e(s)==i}return ad=o,ad}var ud,cw;function Pq(){if(cw)return ud;cw=1;var e=Mq(),r=tu(),i=bm(),o=i&&i.isMap,s=o?r(o):e;return ud=s,ud}var ld,fw;function qq(){if(fw)return ld;fw=1;var e=Ti(),r=xn(),i="[object Set]";function o(s){return r(s)&&e(s)==i}return ld=o,ld}var cd,dw;function Oq(){if(dw)return cd;dw=1;var e=qq(),r=tu(),i=bm(),o=i&&i.isSet,s=o?r(o):e;return cd=s,cd}var fd,hw;function Mb(){if(hw)return fd;hw=1;var e=Qa(),r=Em(),i=Ja(),o=gq(),s=wq(),u=wb(),l=xb(),c=xq(),d=Sq(),p=Cb(),h=Eq(),m=Ti(),y=Nq(),_=Aq(),k=Ab(),w=Je(),x=Ri(),S=Pq(),b=Qt(),N=Oq(),C=dr(),I=Fr(),A=1,P=2,$=4,L="[object Arguments]",U="[object Array]",V="[object Boolean]",ee="[object Date]",Z="[object Error]",R="[object Function]",W="[object GeneratorFunction]",F="[object Map]",ne="[object Number]",G="[object Object]",j="[object RegExp]",K="[object Set]",T="[object String]",z="[object Symbol]",ae="[object WeakMap]",q="[object ArrayBuffer]",H="[object DataView]",X="[object Float32Array]",oe="[object Float64Array]",ue="[object Int8Array]",se="[object Int16Array]",re="[object Int32Array]",Ee="[object Uint8Array]",Re="[object Uint8ClampedArray]",xe="[object Uint16Array]",Ce="[object Uint32Array]",ye={};ye[L]=ye[U]=ye[q]=ye[H]=ye[V]=ye[ee]=ye[X]=ye[oe]=ye[ue]=ye[se]=ye[re]=ye[F]=ye[ne]=ye[G]=ye[j]=ye[K]=ye[T]=ye[z]=ye[Ee]=ye[Re]=ye[xe]=ye[Ce]=!0,ye[Z]=ye[R]=ye[ae]=!1;function Le(ve,he,Pe,He,et,Xe){var je,tt=he&A,St=he&P,Ft=he&$;if(Pe&&(je=et?Pe(ve,He,et,Xe):Pe(ve)),je!==void 0)return je;if(!b(ve))return ve;var Et=w(ve);if(Et){if(je=y(ve),!tt)return l(ve,je)}else{var at=m(ve),$t=at==R||at==W;if(x(ve))return u(ve,tt);if(at==G||at==L||$t&&!et){if(je=St||$t?{}:k(ve),!tt)return St?d(ve,s(je,ve)):c(ve,o(je,ve))}else{if(!ye[at])return et?ve:{};je=_(ve,at,tt)}}Xe||(Xe=new e);var kt=Xe.get(ve);if(kt)return kt;Xe.set(ve,je),N(ve)?ve.forEach(function(nt){je.add(Le(nt,he,Pe,nt,ve,Xe))}):S(ve)&&ve.forEach(function(nt,ut){je.set(ut,Le(nt,he,Pe,ut,ve,Xe))});var $e=Ft?St?h:p:St?I:C,vt=Et?void 0:$e(ve);return r(vt||ve,function(nt,ut){vt&&(ut=nt,nt=ve[ut]),i(je,ut,Le(nt,he,Pe,ut,ve,Xe))}),je}return fd=Le,fd}var dd,pw;function Lq(){if(pw)return dd;pw=1;var e=Mb(),r=4;function i(o){return e(o,r)}return dd=i,dd}var hd,vw;function Im(){if(vw)return hd;vw=1;function e(r){return function(){return r}}return hd=e,hd}var pd,mw;function jq(){if(mw)return pd;mw=1;function e(r){return function(i,o,s){for(var u=-1,l=Object(i),c=s(i),d=c.length;d--;){var p=c[r?d:++u];if(o(l[p],p,l)===!1)break}return i}}return pd=e,pd}var vd,gw;function Am(){if(gw)return vd;gw=1;var e=jq(),r=e();return vd=r,vd}var md,yw;function Mm(){if(yw)return md;yw=1;var e=Am(),r=dr();function i(o,s){return o&&e(o,s,r)}return md=i,md}var gd,_w;function Dq(){if(_w)return gd;_w=1;var e=Fn();function r(i,o){return function(s,u){if(s==null)return s;if(!e(s))return i(s,u);for(var l=s.length,c=o?l:-1,d=Object(s);(o?c--:++c<l)&&u(d[c],c,d)!==!1;);return s}}return gd=r,gd}var yd,ww;function iu(){if(ww)return yd;ww=1;var e=Mm(),r=Dq(),i=r(e);return yd=i,yd}var _d,xw;function $r(){if(xw)return _d;xw=1;function e(r){return r}return _d=e,_d}var wd,Sw;function Pb(){if(Sw)return wd;Sw=1;var e=$r();function r(i){return typeof i=="function"?i:e}return wd=r,wd}var xd,Ew;function qb(){if(Ew)return xd;Ew=1;var e=Em(),r=iu(),i=Pb(),o=Je();function s(u,l){var c=o(u)?e:r;return c(u,i(l))}return xd=s,xd}var Sd,kw;function Ob(){return kw||(kw=1,Sd=qb()),Sd}var Ed,bw;function zq(){if(bw)return Ed;bw=1;var e=iu();function r(i,o){var s=[];return e(i,function(u,l,c){o(u,l,c)&&s.push(u)}),s}return Ed=r,Ed}var kd,Cw;function Fq(){if(Cw)return kd;Cw=1;var e="__lodash_hash_undefined__";function r(i){return this.__data__.set(i,e),this}return kd=r,kd}var bd,Nw;function $q(){if(Nw)return bd;Nw=1;function e(r){return this.__data__.has(r)}return bd=e,bd}var Cd,Rw;function Lb(){if(Rw)return Cd;Rw=1;var e=Sm(),r=Fq(),i=$q();function o(s){var u=-1,l=s==null?0:s.length;for(this.__data__=new e;++u<l;)this.add(s[u])}return o.prototype.add=o.prototype.push=r,o.prototype.has=i,Cd=o,Cd}var Nd,Tw;function Bq(){if(Tw)return Nd;Tw=1;function e(r,i){for(var o=-1,s=r==null?0:r.length;++o<s;)if(i(r[o],o,r))return!0;return!1}return Nd=e,Nd}var Rd,Iw;function jb(){if(Iw)return Rd;Iw=1;function e(r,i){return r.has(i)}return Rd=e,Rd}var Td,Aw;function Db(){if(Aw)return Td;Aw=1;var e=Lb(),r=Bq(),i=jb(),o=1,s=2;function u(l,c,d,p,h,m){var y=d&o,_=l.length,k=c.length;if(_!=k&&!(y&&k>_))return!1;var w=m.get(l),x=m.get(c);if(w&&x)return w==c&&x==l;var S=-1,b=!0,N=d&s?new e:void 0;for(m.set(l,c),m.set(c,l);++S<_;){var C=l[S],I=c[S];if(p)var A=y?p(I,C,S,c,l,m):p(C,I,S,l,c,m);if(A!==void 0){if(A)continue;b=!1;break}if(N){if(!r(c,function(P,$){if(!i(N,$)&&(C===P||h(C,P,d,p,m)))return N.push($)})){b=!1;break}}else if(!(C===I||h(C,I,d,p,m))){b=!1;break}}return m.delete(l),m.delete(c),b}return Td=u,Td}var Id,Mw;function Uq(){if(Mw)return Id;Mw=1;function e(r){var i=-1,o=Array(r.size);return r.forEach(function(s,u){o[++i]=[u,s]}),o}return Id=e,Id}var Ad,Pw;function Pm(){if(Pw)return Ad;Pw=1;function e(r){var i=-1,o=Array(r.size);return r.forEach(function(s){o[++i]=s}),o}return Ad=e,Ad}var Md,qw;function Hq(){if(qw)return Md;qw=1;var e=Ni(),r=Rb(),i=Ci(),o=Db(),s=Uq(),u=Pm(),l=1,c=2,d="[object Boolean]",p="[object Date]",h="[object Error]",m="[object Map]",y="[object Number]",_="[object RegExp]",k="[object Set]",w="[object String]",x="[object Symbol]",S="[object ArrayBuffer]",b="[object DataView]",N=e?e.prototype:void 0,C=N?N.valueOf:void 0;function I(A,P,$,L,U,V,ee){switch($){case b:if(A.byteLength!=P.byteLength||A.byteOffset!=P.byteOffset)return!1;A=A.buffer,P=P.buffer;case S:return!(A.byteLength!=P.byteLength||!V(new r(A),new r(P)));case d:case p:case y:return i(+A,+P);case h:return A.name==P.name&&A.message==P.message;case _:case w:return A==P+"";case m:var Z=s;case k:var R=L&l;if(Z||(Z=u),A.size!=P.size&&!R)return!1;var W=ee.get(A);if(W)return W==P;L|=c,ee.set(A,P);var F=o(Z(A),Z(P),L,U,V,ee);return ee.delete(A),F;case x:if(C)return C.call(A)==C.call(P)}return!1}return Md=I,Md}var Pd,Ow;function Vq(){if(Ow)return Pd;Ow=1;var e=Cb(),r=1,i=Object.prototype,o=i.hasOwnProperty;function s(u,l,c,d,p,h){var m=c&r,y=e(u),_=y.length,k=e(l),w=k.length;if(_!=w&&!m)return!1;for(var x=_;x--;){var S=y[x];if(!(m?S in l:o.call(l,S)))return!1}var b=h.get(u),N=h.get(l);if(b&&N)return b==l&&N==u;var C=!0;h.set(u,l),h.set(l,u);for(var I=m;++x<_;){S=y[x];var A=u[S],P=l[S];if(d)var $=m?d(P,A,S,l,u,h):d(A,P,S,u,l,h);if(!($===void 0?A===P||p(A,P,c,d,h):$)){C=!1;break}I||(I=S=="constructor")}if(C&&!I){var L=u.constructor,U=l.constructor;L!=U&&"constructor"in u&&"constructor"in l&&!(typeof L=="function"&&L instanceof L&&typeof U=="function"&&U instanceof U)&&(C=!1)}return h.delete(u),h.delete(l),C}return Pd=s,Pd}var qd,Lw;function Gq(){if(Lw)return qd;Lw=1;var e=Qa(),r=Db(),i=Hq(),o=Vq(),s=Ti(),u=Je(),l=Ri(),c=Vo(),d=1,p="[object Arguments]",h="[object Array]",m="[object Object]",y=Object.prototype,_=y.hasOwnProperty;function k(w,x,S,b,N,C){var I=u(w),A=u(x),P=I?h:s(w),$=A?h:s(x);P=P==p?m:P,$=$==p?m:$;var L=P==m,U=$==m,V=P==$;if(V&&l(w)){if(!l(x))return!1;I=!0,L=!1}if(V&&!L)return C||(C=new e),I||c(w)?r(w,x,S,b,N,C):i(w,x,P,S,b,N,C);if(!(S&d)){var ee=L&&_.call(w,"__wrapped__"),Z=U&&_.call(x,"__wrapped__");if(ee||Z){var R=ee?w.value():w,W=Z?x.value():x;return C||(C=new e),N(R,W,S,b,C)}}return V?(C||(C=new e),o(w,x,S,b,N,C)):!1}return qd=k,qd}var Od,jw;function zb(){if(jw)return Od;jw=1;var e=Gq(),r=xn();function i(o,s,u,l,c){return o===s?!0:o==null||s==null||!r(o)&&!r(s)?o!==o&&s!==s:e(o,s,u,l,i,c)}return Od=i,Od}var Ld,Dw;function Wq(){if(Dw)return Ld;Dw=1;var e=Qa(),r=zb(),i=1,o=2;function s(u,l,c,d){var p=c.length,h=p,m=!d;if(u==null)return!h;for(u=Object(u);p--;){var y=c[p];if(m&&y[2]?y[1]!==u[y[0]]:!(y[0]in u))return!1}for(;++p<h;){y=c[p];var _=y[0],k=u[_],w=y[1];if(m&&y[2]){if(k===void 0&&!(_ in u))return!1}else{var x=new e;if(d)var S=d(k,w,_,u,l,x);if(!(S===void 0?r(w,k,i|o,d,x):S))return!1}}return!0}return Ld=s,Ld}var jd,zw;function Fb(){if(zw)return jd;zw=1;var e=Qt();function r(i){return i===i&&!e(i)}return jd=r,jd}var Dd,Fw;function Kq(){if(Fw)return Dd;Fw=1;var e=Fb(),r=dr();function i(o){for(var s=r(o),u=s.length;u--;){var l=s[u],c=o[l];s[u]=[l,c,e(c)]}return s}return Dd=i,Dd}var zd,$w;function $b(){if($w)return zd;$w=1;function e(r,i){return function(o){return o==null?!1:o[r]===i&&(i!==void 0||r in Object(o))}}return zd=e,zd}var Fd,Bw;function Yq(){if(Bw)return Fd;Bw=1;var e=Wq(),r=Kq(),i=$b();function o(s){var u=r(s);return u.length==1&&u[0][2]?i(u[0][0],u[0][1]):function(l){return l===s||e(l,s,u)}}return Fd=o,Fd}var $d,Uw;function Ii(){if(Uw)return $d;Uw=1;var e=Dr(),r=xn(),i="[object Symbol]";function o(s){return typeof s=="symbol"||r(s)&&e(s)==i}return $d=o,$d}var Bd,Hw;function qm(){if(Hw)return Bd;Hw=1;var e=Je(),r=Ii(),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,o=/^\w*$/;function s(u,l){if(e(u))return!1;var c=typeof u;return c=="number"||c=="symbol"||c=="boolean"||u==null||r(u)?!0:o.test(u)||!i.test(u)||l!=null&&u in Object(l)}return Bd=s,Bd}var Ud,Vw;function Xq(){if(Vw)return Ud;Vw=1;var e=Sm(),r="Expected a function";function i(o,s){if(typeof o!="function"||s!=null&&typeof s!="function")throw new TypeError(r);var u=function(){var l=arguments,c=s?s.apply(this,l):l[0],d=u.cache;if(d.has(c))return d.get(c);var p=o.apply(this,l);return u.cache=d.set(c,p)||d,p};return u.cache=new(i.Cache||e),u}return i.Cache=e,Ud=i,Ud}var Hd,Gw;function Qq(){if(Gw)return Hd;Gw=1;var e=Xq(),r=500;function i(o){var s=e(o,function(l){return u.size===r&&u.clear(),l}),u=s.cache;return s}return Hd=i,Hd}var Vd,Ww;function Zq(){if(Ww)return Vd;Ww=1;var e=Qq(),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,o=e(function(s){var u=[];return s.charCodeAt(0)===46&&u.push(""),s.replace(r,function(l,c,d,p){u.push(d?p.replace(i,"$1"):c||l)}),u});return Vd=o,Vd}var Gd,Kw;function ou(){if(Kw)return Gd;Kw=1;function e(r,i){for(var o=-1,s=r==null?0:r.length,u=Array(s);++o<s;)u[o]=i(r[o],o,r);return u}return Gd=e,Gd}var Wd,Yw;function Jq(){if(Yw)return Wd;Yw=1;var e=Ni(),r=ou(),i=Je(),o=Ii(),s=e?e.prototype:void 0,u=s?s.toString:void 0;function l(c){if(typeof c=="string")return c;if(i(c))return r(c,l)+"";if(o(c))return u?u.call(c):"";var d=c+"";return d=="0"&&1/c==-1/0?"-0":d}return Wd=l,Wd}var Kd,Xw;function Bb(){if(Xw)return Kd;Xw=1;var e=Jq();function r(i){return i==null?"":e(i)}return Kd=r,Kd}var Yd,Qw;function su(){if(Qw)return Yd;Qw=1;var e=Je(),r=qm(),i=Zq(),o=Bb();function s(u,l){return e(u)?u:r(u,l)?[u]:i(o(u))}return Yd=s,Yd}var Xd,Zw;function Go(){if(Zw)return Xd;Zw=1;var e=Ii();function r(i){if(typeof i=="string"||e(i))return i;var o=i+"";return o=="0"&&1/i==-1/0?"-0":o}return Xd=r,Xd}var Qd,Jw;function au(){if(Jw)return Qd;Jw=1;var e=su(),r=Go();function i(o,s){s=e(s,o);for(var u=0,l=s.length;o!=null&&u<l;)o=o[r(s[u++])];return u&&u==l?o:void 0}return Qd=i,Qd}var Zd,ex;function e3(){if(ex)return Zd;ex=1;var e=au();function r(i,o,s){var u=i==null?void 0:e(i,o);return u===void 0?s:u}return Zd=r,Zd}var Jd,tx;function t3(){if(tx)return Jd;tx=1;function e(r,i){return r!=null&&i in Object(r)}return Jd=e,Jd}var eh,nx;function Ub(){if(nx)return eh;nx=1;var e=su(),r=Ho(),i=Je(),o=eu(),s=km(),u=Go();function l(c,d,p){d=e(d,c);for(var h=-1,m=d.length,y=!1;++h<m;){var _=u(d[h]);if(!(y=c!=null&&p(c,_)))break;c=c[_]}return y||++h!=m?y:(m=c==null?0:c.length,!!m&&s(m)&&o(_,m)&&(i(c)||r(c)))}return eh=l,eh}var th,rx;function Hb(){if(rx)return th;rx=1;var e=t3(),r=Ub();function i(o,s){return o!=null&&r(o,s,e)}return th=i,th}var nh,ix;function n3(){if(ix)return nh;ix=1;var e=zb(),r=e3(),i=Hb(),o=qm(),s=Fb(),u=$b(),l=Go(),c=1,d=2;function p(h,m){return o(h)&&s(m)?u(l(h),m):function(y){var _=r(y,h);return _===void 0&&_===m?i(y,h):e(m,_,c|d)}}return nh=p,nh}var rh,ox;function Vb(){if(ox)return rh;ox=1;function e(r){return function(i){return i==null?void 0:i[r]}}return rh=e,rh}var ih,sx;function r3(){if(sx)return ih;sx=1;var e=au();function r(i){return function(o){return e(o,i)}}return ih=r,ih}var oh,ax;function i3(){if(ax)return oh;ax=1;var e=Vb(),r=r3(),i=qm(),o=Go();function s(u){return i(u)?e(o(u)):r(u)}return oh=s,oh}var sh,ux;function $n(){if(ux)return sh;ux=1;var e=Yq(),r=n3(),i=$r(),o=Je(),s=i3();function u(l){return typeof l=="function"?l:l==null?i:typeof l=="object"?o(l)?r(l[0],l[1]):e(l):s(l)}return sh=u,sh}var ah,lx;function Gb(){if(lx)return ah;lx=1;var e=Sb(),r=zq(),i=$n(),o=Je();function s(u,l){var c=o(u)?e:r;return c(u,i(l,3))}return ah=s,ah}var uh,cx;function o3(){if(cx)return uh;cx=1;var e=Object.prototype,r=e.hasOwnProperty;function i(o,s){return o!=null&&r.call(o,s)}return uh=i,uh}var lh,fx;function Wb(){if(fx)return lh;fx=1;var e=o3(),r=Ub();function i(o,s){return o!=null&&r(o,s,e)}return lh=i,lh}var ch,dx;function s3(){if(dx)return ch;dx=1;var e=Cm(),r=Ti(),i=Ho(),o=Je(),s=Fn(),u=Ri(),l=nu(),c=Vo(),d="[object Map]",p="[object Set]",h=Object.prototype,m=h.hasOwnProperty;function y(_){if(_==null)return!0;if(s(_)&&(o(_)||typeof _=="string"||typeof _.splice=="function"||u(_)||c(_)||i(_)))return!_.length;var k=r(_);if(k==d||k==p)return!_.size;if(l(_))return!e(_).length;for(var w in _)if(m.call(_,w))return!1;return!0}return ch=y,ch}var fh,hx;function Kb(){if(hx)return fh;hx=1;function e(r){return r===void 0}return fh=e,fh}var dh,px;function Yb(){if(px)return dh;px=1;var e=iu(),r=Fn();function i(o,s){var u=-1,l=r(o)?Array(o.length):[];return e(o,function(c,d,p){l[++u]=s(c,d,p)}),l}return dh=i,dh}var hh,vx;function Xb(){if(vx)return hh;vx=1;var e=ou(),r=$n(),i=Yb(),o=Je();function s(u,l){var c=o(u)?e:i;return c(u,r(l,3))}return hh=s,hh}var ph,mx;function a3(){if(mx)return ph;mx=1;function e(r,i,o,s){var u=-1,l=r==null?0:r.length;for(s&&l&&(o=r[++u]);++u<l;)o=i(o,r[u],u,r);return o}return ph=e,ph}var vh,gx;function u3(){if(gx)return vh;gx=1;function e(r,i,o,s,u){return u(r,function(l,c,d){o=s?(s=!1,l):i(o,l,c,d)}),o}return vh=e,vh}var mh,yx;function Qb(){if(yx)return mh;yx=1;var e=a3(),r=iu(),i=$n(),o=u3(),s=Je();function u(l,c,d){var p=s(l)?e:o,h=arguments.length<3;return p(l,i(c,4),d,h,r)}return mh=u,mh}var gh,_x;function l3(){if(_x)return gh;_x=1;var e=Dr(),r=Je(),i=xn(),o="[object String]";function s(u){return typeof u=="string"||!r(u)&&i(u)&&e(u)==o}return gh=s,gh}var yh,wx;function c3(){if(wx)return yh;wx=1;var e=Vb(),r=e("length");return yh=r,yh}var _h,xx;function f3(){if(xx)return _h;xx=1;var e="\\ud800-\\udfff",r="\\u0300-\\u036f",i="\\ufe20-\\ufe2f",o="\\u20d0-\\u20ff",s=r+i+o,u="\\ufe0e\\ufe0f",l="\\u200d",c=RegExp("["+l+e+s+u+"]");function d(p){return c.test(p)}return _h=d,_h}var wh,Sx;function d3(){if(Sx)return wh;Sx=1;var e="\\ud800-\\udfff",r="\\u0300-\\u036f",i="\\ufe20-\\ufe2f",o="\\u20d0-\\u20ff",s=r+i+o,u="\\ufe0e\\ufe0f",l="["+e+"]",c="["+s+"]",d="\\ud83c[\\udffb-\\udfff]",p="(?:"+c+"|"+d+")",h="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",_="\\u200d",k=p+"?",w="["+u+"]?",x="(?:"+_+"(?:"+[h,m,y].join("|")+")"+w+k+")*",S=w+k+x,b="(?:"+[h+c+"?",c,m,y,l].join("|")+")",N=RegExp(d+"(?="+d+")|"+b+S,"g");function C(I){for(var A=N.lastIndex=0;N.test(I);)++A;return A}return wh=C,wh}var xh,Ex;function h3(){if(Ex)return xh;Ex=1;var e=c3(),r=f3(),i=d3();function o(s){return r(s)?i(s):e(s)}return xh=o,xh}var Sh,kx;function p3(){if(kx)return Sh;kx=1;var e=Cm(),r=Ti(),i=Fn(),o=l3(),s=h3(),u="[object Map]",l="[object Set]";function c(d){if(d==null)return 0;if(i(d))return o(d)?s(d):d.length;var p=r(d);return p==u||p==l?d.size:e(d).length}return Sh=c,Sh}var Eh,bx;function v3(){if(bx)return Eh;bx=1;var e=Em(),r=Ib(),i=Mm(),o=$n(),s=ru(),u=Je(),l=Ri(),c=Bo(),d=Qt(),p=Vo();function h(m,y,_){var k=u(m),w=k||l(m)||p(m);if(y=o(y,4),_==null){var x=m&&m.constructor;w?_=k?new x:[]:d(m)?_=c(x)?r(s(m)):{}:_={}}return(w?e:i)(m,function(S,b,N){return y(_,S,b,N)}),_}return Eh=h,Eh}var kh,Cx;function m3(){if(Cx)return kh;Cx=1;var e=Ni(),r=Ho(),i=Je(),o=e?e.isConcatSpreadable:void 0;function s(u){return i(u)||r(u)||!!(o&&u&&u[o])}return kh=s,kh}var bh,Nx;function Om(){if(Nx)return bh;Nx=1;var e=Rm(),r=m3();function i(o,s,u,l,c){var d=-1,p=o.length;for(u||(u=r),c||(c=[]);++d<p;){var h=o[d];s>0&&u(h)?s>1?i(h,s-1,u,l,c):e(c,h):l||(c[c.length]=h)}return c}return bh=i,bh}var Ch,Rx;function g3(){if(Rx)return Ch;Rx=1;function e(r,i,o){switch(o.length){case 0:return r.call(i);case 1:return r.call(i,o[0]);case 2:return r.call(i,o[0],o[1]);case 3:return r.call(i,o[0],o[1],o[2])}return r.apply(i,o)}return Ch=e,Ch}var Nh,Tx;function Zb(){if(Tx)return Nh;Tx=1;var e=g3(),r=Math.max;function i(o,s,u){return s=r(s===void 0?o.length-1:s,0),function(){for(var l=arguments,c=-1,d=r(l.length-s,0),p=Array(d);++c<d;)p[c]=l[s+c];c=-1;for(var h=Array(s+1);++c<s;)h[c]=l[c];return h[s]=u(p),e(o,this,h)}}return Nh=i,Nh}var Rh,Ix;function y3(){if(Ix)return Rh;Ix=1;var e=Im(),r=gb(),i=$r(),o=r?function(s,u){return r(s,"toString",{configurable:!0,enumerable:!1,value:e(u),writable:!0})}:i;return Rh=o,Rh}var Th,Ax;function _3(){if(Ax)return Th;Ax=1;var e=800,r=16,i=Date.now;function o(s){var u=0,l=0;return function(){var c=i(),d=r-(c-l);if(l=c,d>0){if(++u>=e)return arguments[0]}else u=0;return s.apply(void 0,arguments)}}return Th=o,Th}var Ih,Mx;function Jb(){if(Mx)return Ih;Mx=1;var e=y3(),r=_3(),i=r(e);return Ih=i,Ih}var Ah,Px;function uu(){if(Px)return Ah;Px=1;var e=$r(),r=Zb(),i=Jb();function o(s,u){return i(r(s,u,e),s+"")}return Ah=o,Ah}var Mh,qx;function eC(){if(qx)return Mh;qx=1;function e(r,i,o,s){for(var u=r.length,l=o+(s?1:-1);s?l--:++l<u;)if(i(r[l],l,r))return l;return-1}return Mh=e,Mh}var Ph,Ox;function w3(){if(Ox)return Ph;Ox=1;function e(r){return r!==r}return Ph=e,Ph}var qh,Lx;function x3(){if(Lx)return qh;Lx=1;function e(r,i,o){for(var s=o-1,u=r.length;++s<u;)if(r[s]===i)return s;return-1}return qh=e,qh}var Oh,jx;function S3(){if(jx)return Oh;jx=1;var e=eC(),r=w3(),i=x3();function o(s,u,l){return u===u?i(s,u,l):e(s,r,l)}return Oh=o,Oh}var Lh,Dx;function E3(){if(Dx)return Lh;Dx=1;var e=S3();function r(i,o){var s=i==null?0:i.length;return!!s&&e(i,o,0)>-1}return Lh=r,Lh}var jh,zx;function k3(){if(zx)return jh;zx=1;function e(r,i,o){for(var s=-1,u=r==null?0:r.length;++s<u;)if(o(i,r[s]))return!0;return!1}return jh=e,jh}var Dh,Fx;function b3(){if(Fx)return Dh;Fx=1;function e(){}return Dh=e,Dh}var zh,$x;function C3(){if($x)return zh;$x=1;var e=Nb(),r=b3(),i=Pm(),o=1/0,s=e&&1/i(new e([,-0]))[1]==o?function(u){return new e(u)}:r;return zh=s,zh}var Fh,Bx;function N3(){if(Bx)return Fh;Bx=1;var e=Lb(),r=E3(),i=k3(),o=jb(),s=C3(),u=Pm(),l=200;function c(d,p,h){var m=-1,y=r,_=d.length,k=!0,w=[],x=w;if(h)k=!1,y=i;else if(_>=l){var S=p?null:s(d);if(S)return u(S);k=!1,y=o,x=new e}else x=p?[]:w;e:for(;++m<_;){var b=d[m],N=p?p(b):b;if(b=h||b!==0?b:0,k&&N===N){for(var C=x.length;C--;)if(x[C]===N)continue e;p&&x.push(N),w.push(b)}else y(x,N,h)||(x!==w&&x.push(N),w.push(b))}return w}return Fh=c,Fh}var $h,Ux;function tC(){if(Ux)return $h;Ux=1;var e=Fn(),r=xn();function i(o){return r(o)&&e(o)}return $h=i,$h}var Bh,Hx;function R3(){if(Hx)return Bh;Hx=1;var e=Om(),r=uu(),i=N3(),o=tC(),s=r(function(u){return i(e(u,1,o,!0))});return Bh=s,Bh}var Uh,Vx;function T3(){if(Vx)return Uh;Vx=1;var e=ou();function r(i,o){return e(o,function(s){return i[s]})}return Uh=r,Uh}var Hh,Gx;function nC(){if(Gx)return Hh;Gx=1;var e=T3(),r=dr();function i(o){return o==null?[]:e(o,r(o))}return Hh=i,Hh}var Vh,Wx;function Zt(){if(Wx)return Vh;Wx=1;var e;if(typeof wm=="function")try{e={clone:Lq(),constant:Im(),each:Ob(),filter:Gb(),has:Wb(),isArray:Je(),isEmpty:s3(),isFunction:Bo(),isUndefined:Kb(),keys:dr(),map:Xb(),reduce:Qb(),size:p3(),transform:v3(),union:R3(),values:nC()}}catch{}return e||(e=window._),Vh=e,Vh}var Gh,Kx;function Lm(){if(Kx)return Gh;Kx=1;var e=Zt();Gh=s;var r="\0",i="\0",o="";function s(h){this._isDirected=e.has(h,"directed")?h.directed:!0,this._isMultigraph=e.has(h,"multigraph")?h.multigraph:!1,this._isCompound=e.has(h,"compound")?h.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[i]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}s.prototype._nodeCount=0,s.prototype._edgeCount=0,s.prototype.isDirected=function(){return this._isDirected},s.prototype.isMultigraph=function(){return this._isMultigraph},s.prototype.isCompound=function(){return this._isCompound},s.prototype.setGraph=function(h){return this._label=h,this},s.prototype.graph=function(){return this._label},s.prototype.setDefaultNodeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultNodeLabelFn=h,this},s.prototype.nodeCount=function(){return this._nodeCount},s.prototype.nodes=function(){return e.keys(this._nodes)},s.prototype.sources=function(){var h=this;return e.filter(this.nodes(),function(m){return e.isEmpty(h._in[m])})},s.prototype.sinks=function(){var h=this;return e.filter(this.nodes(),function(m){return e.isEmpty(h._out[m])})},s.prototype.setNodes=function(h,m){var y=arguments,_=this;return e.each(h,function(k){y.length>1?_.setNode(k,m):_.setNode(k)}),this},s.prototype.setNode=function(h,m){return e.has(this._nodes,h)?(arguments.length>1&&(this._nodes[h]=m),this):(this._nodes[h]=arguments.length>1?m:this._defaultNodeLabelFn(h),this._isCompound&&(this._parent[h]=i,this._children[h]={},this._children[i][h]=!0),this._in[h]={},this._preds[h]={},this._out[h]={},this._sucs[h]={},++this._nodeCount,this)},s.prototype.node=function(h){return this._nodes[h]},s.prototype.hasNode=function(h){return e.has(this._nodes,h)},s.prototype.removeNode=function(h){var m=this;if(e.has(this._nodes,h)){var y=function(_){m.removeEdge(m._edgeObjs[_])};delete this._nodes[h],this._isCompound&&(this._removeFromParentsChildList(h),delete this._parent[h],e.each(this.children(h),function(_){m.setParent(_)}),delete this._children[h]),e.each(e.keys(this._in[h]),y),delete this._in[h],delete this._preds[h],e.each(e.keys(this._out[h]),y),delete this._out[h],delete this._sucs[h],--this._nodeCount}return this},s.prototype.setParent=function(h,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(m))m=i;else{m+="";for(var y=m;!e.isUndefined(y);y=this.parent(y))if(y===h)throw new Error("Setting "+m+" as parent of "+h+" would create a cycle");this.setNode(m)}return this.setNode(h),this._removeFromParentsChildList(h),this._parent[h]=m,this._children[m][h]=!0,this},s.prototype._removeFromParentsChildList=function(h){delete this._children[this._parent[h]][h]},s.prototype.parent=function(h){if(this._isCompound){var m=this._parent[h];if(m!==i)return m}},s.prototype.children=function(h){if(e.isUndefined(h)&&(h=i),this._isCompound){var m=this._children[h];if(m)return e.keys(m)}else{if(h===i)return this.nodes();if(this.hasNode(h))return[]}},s.prototype.predecessors=function(h){var m=this._preds[h];if(m)return e.keys(m)},s.prototype.successors=function(h){var m=this._sucs[h];if(m)return e.keys(m)},s.prototype.neighbors=function(h){var m=this.predecessors(h);if(m)return e.union(m,this.successors(h))},s.prototype.isLeaf=function(h){var m;return this.isDirected()?m=this.successors(h):m=this.neighbors(h),m.length===0},s.prototype.filterNodes=function(h){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var y=this;e.each(this._nodes,function(w,x){h(x)&&m.setNode(x,w)}),e.each(this._edgeObjs,function(w){m.hasNode(w.v)&&m.hasNode(w.w)&&m.setEdge(w,y.edge(w))});var _={};function k(w){var x=y.parent(w);return x===void 0||m.hasNode(x)?(_[w]=x,x):x in _?_[x]:k(x)}return this._isCompound&&e.each(m.nodes(),function(w){m.setParent(w,k(w))}),m},s.prototype.setDefaultEdgeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultEdgeLabelFn=h,this},s.prototype.edgeCount=function(){return this._edgeCount},s.prototype.edges=function(){return e.values(this._edgeObjs)},s.prototype.setPath=function(h,m){var y=this,_=arguments;return e.reduce(h,function(k,w){return _.length>1?y.setEdge(k,w,m):y.setEdge(k,w),w}),this},s.prototype.setEdge=function(){var h,m,y,_,k=!1,w=arguments[0];typeof w=="object"&&w!==null&&"v"in w?(h=w.v,m=w.w,y=w.name,arguments.length===2&&(_=arguments[1],k=!0)):(h=w,m=arguments[1],y=arguments[3],arguments.length>2&&(_=arguments[2],k=!0)),h=""+h,m=""+m,e.isUndefined(y)||(y=""+y);var x=c(this._isDirected,h,m,y);if(e.has(this._edgeLabels,x))return k&&(this._edgeLabels[x]=_),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(h),this.setNode(m),this._edgeLabels[x]=k?_:this._defaultEdgeLabelFn(h,m,y);var S=d(this._isDirected,h,m,y);return h=S.v,m=S.w,Object.freeze(S),this._edgeObjs[x]=S,u(this._preds[m],h),u(this._sucs[h],m),this._in[m][x]=S,this._out[h][x]=S,this._edgeCount++,this},s.prototype.edge=function(h,m,y){var _=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,h,m,y);return this._edgeLabels[_]},s.prototype.hasEdge=function(h,m,y){var _=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,h,m,y);return e.has(this._edgeLabels,_)},s.prototype.removeEdge=function(h,m,y){var _=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,h,m,y),k=this._edgeObjs[_];return k&&(h=k.v,m=k.w,delete this._edgeLabels[_],delete this._edgeObjs[_],l(this._preds[m],h),l(this._sucs[h],m),delete this._in[m][_],delete this._out[h][_],this._edgeCount--),this},s.prototype.inEdges=function(h,m){var y=this._in[h];if(y){var _=e.values(y);return m?e.filter(_,function(k){return k.v===m}):_}},s.prototype.outEdges=function(h,m){var y=this._out[h];if(y){var _=e.values(y);return m?e.filter(_,function(k){return k.w===m}):_}},s.prototype.nodeEdges=function(h,m){var y=this.inEdges(h,m);if(y)return y.concat(this.outEdges(h,m))};function u(h,m){h[m]?h[m]++:h[m]=1}function l(h,m){--h[m]||delete h[m]}function c(h,m,y,_){var k=""+m,w=""+y;if(!h&&k>w){var x=k;k=w,w=x}return k+o+w+o+(e.isUndefined(_)?r:_)}function d(h,m,y,_){var k=""+m,w=""+y;if(!h&&k>w){var x=k;k=w,w=x}var S={v:k,w};return _&&(S.name=_),S}function p(h,m){return c(h,m.v,m.w,m.name)}return Gh}var Wh,Yx;function I3(){return Yx||(Yx=1,Wh="2.1.8"),Wh}var Kh,Xx;function A3(){return Xx||(Xx=1,Kh={Graph:Lm(),version:I3()}),Kh}var Yh,Qx;function M3(){if(Qx)return Yh;Qx=1;var e=Zt(),r=Lm();Yh={write:i,read:u};function i(l){var c={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:o(l),edges:s(l)};return e.isUndefined(l.graph())||(c.value=e.clone(l.graph())),c}function o(l){return e.map(l.nodes(),function(c){var d=l.node(c),p=l.parent(c),h={v:c};return e.isUndefined(d)||(h.value=d),e.isUndefined(p)||(h.parent=p),h})}function s(l){return e.map(l.edges(),function(c){var d=l.edge(c),p={v:c.v,w:c.w};return e.isUndefined(c.name)||(p.name=c.name),e.isUndefined(d)||(p.value=d),p})}function u(l){var c=new r(l.options).setGraph(l.value);return e.each(l.nodes,function(d){c.setNode(d.v,d.value),d.parent&&c.setParent(d.v,d.parent)}),e.each(l.edges,function(d){c.setEdge({v:d.v,w:d.w,name:d.name},d.value)}),c}return Yh}var Xh,Zx;function P3(){if(Zx)return Xh;Zx=1;var e=Zt();Xh=r;function r(i){var o={},s=[],u;function l(c){e.has(o,c)||(o[c]=!0,u.push(c),e.each(i.successors(c),l),e.each(i.predecessors(c),l))}return e.each(i.nodes(),function(c){u=[],l(c),u.length&&s.push(u)}),s}return Xh}var Qh,Jx;function rC(){if(Jx)return Qh;Jx=1;var e=Zt();Qh=r;function r(){this._arr=[],this._keyIndices={}}return r.prototype.size=function(){return this._arr.length},r.prototype.keys=function(){return this._arr.map(function(i){return i.key})},r.prototype.has=function(i){return e.has(this._keyIndices,i)},r.prototype.priority=function(i){var o=this._keyIndices[i];if(o!==void 0)return this._arr[o].priority},r.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},r.prototype.add=function(i,o){var s=this._keyIndices;if(i=String(i),!e.has(s,i)){var u=this._arr,l=u.length;return s[i]=l,u.push({key:i,priority:o}),this._decrease(l),!0}return!1},r.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var i=this._arr.pop();return delete this._keyIndices[i.key],this._heapify(0),i.key},r.prototype.decrease=function(i,o){var s=this._keyIndices[i];if(o>this._arr[s].priority)throw new Error("New priority is greater than current priority. Key: "+i+" Old: "+this._arr[s].priority+" New: "+o);this._arr[s].priority=o,this._decrease(s)},r.prototype._heapify=function(i){var o=this._arr,s=2*i,u=s+1,l=i;s<o.length&&(l=o[s].priority<o[l].priority?s:l,u<o.length&&(l=o[u].priority<o[l].priority?u:l),l!==i&&(this._swap(i,l),this._heapify(l)))},r.prototype._decrease=function(i){for(var o=this._arr,s=o[i].priority,u;i!==0&&(u=i>>1,!(o[u].priority<s));)this._swap(i,u),i=u},r.prototype._swap=function(i,o){var s=this._arr,u=this._keyIndices,l=s[i],c=s[o];s[i]=c,s[o]=l,u[c.key]=i,u[l.key]=o},Qh}var Zh,eS;function iC(){if(eS)return Zh;eS=1;var e=Zt(),r=rC();Zh=o;var i=e.constant(1);function o(u,l,c,d){return s(u,String(l),c||i,d||function(p){return u.outEdges(p)})}function s(u,l,c,d){var p={},h=new r,m,y,_=function(k){var w=k.v!==m?k.v:k.w,x=p[w],S=c(k),b=y.distance+S;if(S<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+k+" Weight: "+S);b<x.distance&&(x.distance=b,x.predecessor=m,h.decrease(w,b))};for(u.nodes().forEach(function(k){var w=k===l?0:Number.POSITIVE_INFINITY;p[k]={distance:w},h.add(k,w)});h.size()>0&&(m=h.removeMin(),y=p[m],y.distance!==Number.POSITIVE_INFINITY);)d(m).forEach(_);return p}return Zh}var Jh,tS;function q3(){if(tS)return Jh;tS=1;var e=iC(),r=Zt();Jh=i;function i(o,s,u){return r.transform(o.nodes(),function(l,c){l[c]=e(o,c,s,u)},{})}return Jh}var ep,nS;function oC(){if(nS)return ep;nS=1;var e=Zt();ep=r;function r(i){var o=0,s=[],u={},l=[];function c(d){var p=u[d]={onStack:!0,lowlink:o,index:o++};if(s.push(d),i.successors(d).forEach(function(y){e.has(u,y)?u[y].onStack&&(p.lowlink=Math.min(p.lowlink,u[y].index)):(c(y),p.lowlink=Math.min(p.lowlink,u[y].lowlink))}),p.lowlink===p.index){var h=[],m;do m=s.pop(),u[m].onStack=!1,h.push(m);while(d!==m);l.push(h)}}return i.nodes().forEach(function(d){e.has(u,d)||c(d)}),l}return ep}var tp,rS;function O3(){if(rS)return tp;rS=1;var e=Zt(),r=oC();tp=i;function i(o){return e.filter(r(o),function(s){return s.length>1||s.length===1&&o.hasEdge(s[0],s[0])})}return tp}var np,iS;function L3(){if(iS)return np;iS=1;var e=Zt();np=i;var r=e.constant(1);function i(s,u,l){return o(s,u||r,l||function(c){return s.outEdges(c)})}function o(s,u,l){var c={},d=s.nodes();return d.forEach(function(p){c[p]={},c[p][p]={distance:0},d.forEach(function(h){p!==h&&(c[p][h]={distance:Number.POSITIVE_INFINITY})}),l(p).forEach(function(h){var m=h.v===p?h.w:h.v,y=u(h);c[p][m]={distance:y,predecessor:p}})}),d.forEach(function(p){var h=c[p];d.forEach(function(m){var y=c[m];d.forEach(function(_){var k=y[p],w=h[_],x=y[_],S=k.distance+w.distance;S<x.distance&&(x.distance=S,x.predecessor=w.predecessor)})})}),c}return np}var rp,oS;function sC(){if(oS)return rp;oS=1;var e=Zt();rp=r,r.CycleException=i;function r(o){var s={},u={},l=[];function c(d){if(e.has(u,d))throw new i;e.has(s,d)||(u[d]=!0,s[d]=!0,e.each(o.predecessors(d),c),delete u[d],l.push(d))}if(e.each(o.sinks(),c),e.size(s)!==o.nodeCount())throw new i;return l}function i(){}return i.prototype=new Error,rp}var ip,sS;function j3(){if(sS)return ip;sS=1;var e=sC();ip=r;function r(i){try{e(i)}catch(o){if(o instanceof e.CycleException)return!1;throw o}return!0}return ip}var op,aS;function aC(){if(aS)return op;aS=1;var e=Zt();op=r;function r(o,s,u){e.isArray(s)||(s=[s]);var l=(o.isDirected()?o.successors:o.neighbors).bind(o),c=[],d={};return e.each(s,function(p){if(!o.hasNode(p))throw new Error("Graph does not have node: "+p);i(o,p,u==="post",d,l,c)}),c}function i(o,s,u,l,c,d){e.has(l,s)||(l[s]=!0,u||d.push(s),e.each(c(s),function(p){i(o,p,u,l,c,d)}),u&&d.push(s))}return op}var sp,uS;function D3(){if(uS)return sp;uS=1;var e=aC();sp=r;function r(i,o){return e(i,o,"post")}return sp}var ap,lS;function z3(){if(lS)return ap;lS=1;var e=aC();ap=r;function r(i,o){return e(i,o,"pre")}return ap}var up,cS;function F3(){if(cS)return up;cS=1;var e=Zt(),r=Lm(),i=rC();up=o;function o(s,u){var l=new r,c={},d=new i,p;function h(y){var _=y.v===p?y.w:y.v,k=d.priority(_);if(k!==void 0){var w=u(y);w<k&&(c[_]=p,d.decrease(_,w))}}if(s.nodeCount()===0)return l;e.each(s.nodes(),function(y){d.add(y,Number.POSITIVE_INFINITY),l.setNode(y)}),d.decrease(s.nodes()[0],0);for(var m=!1;d.size()>0;){if(p=d.removeMin(),e.has(c,p))l.setEdge(p,c[p]);else{if(m)throw new Error("Input graph is not connected: "+s);m=!0}s.nodeEdges(p).forEach(h)}return l}return up}var lp,fS;function $3(){return fS||(fS=1,lp={components:P3(),dijkstra:iC(),dijkstraAll:q3(),findCycles:O3(),floydWarshall:L3(),isAcyclic:j3(),postorder:D3(),preorder:z3(),prim:F3(),tarjan:oC(),topsort:sC()}),lp}var cp,dS;function B3(){if(dS)return cp;dS=1;var e=A3();return cp={Graph:e.Graph,json:M3(),alg:$3(),version:e.version},cp}var fp,hS;function cn(){if(hS)return fp;hS=1;var e;if(typeof wm=="function")try{e=B3()}catch{}return e||(e=window.graphlib),fp=e,fp}var dp,pS;function U3(){if(pS)return dp;pS=1;var e=Mb(),r=1,i=4;function o(s){return e(s,r|i)}return dp=o,dp}var hp,vS;function lu(){if(vS)return hp;vS=1;var e=Ci(),r=Fn(),i=eu(),o=Qt();function s(u,l,c){if(!o(c))return!1;var d=typeof l;return(d=="number"?r(c)&&i(l,c.length):d=="string"&&l in c)?e(c[l],u):!1}return hp=s,hp}var pp,mS;function H3(){if(mS)return pp;mS=1;var e=uu(),r=Ci(),i=lu(),o=Fr(),s=Object.prototype,u=s.hasOwnProperty,l=e(function(c,d){c=Object(c);var p=-1,h=d.length,m=h>2?d[2]:void 0;for(m&&i(d[0],d[1],m)&&(h=1);++p<h;)for(var y=d[p],_=o(y),k=-1,w=_.length;++k<w;){var x=_[k],S=c[x];(S===void 0||r(S,s[x])&&!u.call(c,x))&&(c[x]=y[x])}return c});return pp=l,pp}var vp,gS;function V3(){if(gS)return vp;gS=1;var e=$n(),r=Fn(),i=dr();function o(s){return function(u,l,c){var d=Object(u);if(!r(u)){var p=e(l,3);u=i(u),l=function(m){return p(d[m],m,d)}}var h=s(u,l,c);return h>-1?d[p?u[h]:h]:void 0}}return vp=o,vp}var mp,yS;function G3(){if(yS)return mp;yS=1;var e=/\s/;function r(i){for(var o=i.length;o--&&e.test(i.charAt(o)););return o}return mp=r,mp}var gp,_S;function W3(){if(_S)return gp;_S=1;var e=G3(),r=/^\s+/;function i(o){return o&&o.slice(0,e(o)+1).replace(r,"")}return gp=i,gp}var yp,wS;function K3(){if(wS)return yp;wS=1;var e=W3(),r=Qt(),i=Ii(),o=NaN,s=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,l=/^0o[0-7]+$/i,c=parseInt;function d(p){if(typeof p=="number")return p;if(i(p))return o;if(r(p)){var h=typeof p.valueOf=="function"?p.valueOf():p;p=r(h)?h+"":h}if(typeof p!="string")return p===0?p:+p;p=e(p);var m=u.test(p);return m||l.test(p)?c(p.slice(2),m?2:8):s.test(p)?o:+p}return yp=d,yp}var _p,xS;function uC(){if(xS)return _p;xS=1;var e=K3(),r=1/0,i=17976931348623157e292;function o(s){if(!s)return s===0?s:0;if(s=e(s),s===r||s===-r){var u=s<0?-1:1;return u*i}return s===s?s:0}return _p=o,_p}var wp,SS;function Y3(){if(SS)return wp;SS=1;var e=uC();function r(i){var o=e(i),s=o%1;return o===o?s?o-s:o:0}return wp=r,wp}var xp,ES;function X3(){if(ES)return xp;ES=1;var e=eC(),r=$n(),i=Y3(),o=Math.max;function s(u,l,c){var d=u==null?0:u.length;if(!d)return-1;var p=c==null?0:i(c);return p<0&&(p=o(d+p,0)),e(u,r(l,3),p)}return xp=s,xp}var Sp,kS;function Q3(){if(kS)return Sp;kS=1;var e=V3(),r=X3(),i=e(r);return Sp=i,Sp}var Ep,bS;function lC(){if(bS)return Ep;bS=1;var e=Om();function r(i){var o=i==null?0:i.length;return o?e(i,1):[]}return Ep=r,Ep}var kp,CS;function Z3(){if(CS)return kp;CS=1;var e=Am(),r=Pb(),i=Fr();function o(s,u){return s==null?s:e(s,r(u),i)}return kp=o,kp}var bp,NS;function J3(){if(NS)return bp;NS=1;function e(r){var i=r==null?0:r.length;return i?r[i-1]:void 0}return bp=e,bp}var Cp,RS;function eO(){if(RS)return Cp;RS=1;var e=Za(),r=Mm(),i=$n();function o(s,u){var l={};return u=i(u,3),r(s,function(c,d,p){e(l,d,u(c,d,p))}),l}return Cp=o,Cp}var Np,TS;function jm(){if(TS)return Np;TS=1;var e=Ii();function r(i,o,s){for(var u=-1,l=i.length;++u<l;){var c=i[u],d=o(c);if(d!=null&&(p===void 0?d===d&&!e(d):s(d,p)))var p=d,h=c}return h}return Np=r,Np}var Rp,IS;function tO(){if(IS)return Rp;IS=1;function e(r,i){return r>i}return Rp=e,Rp}var Tp,AS;function nO(){if(AS)return Tp;AS=1;var e=jm(),r=tO(),i=$r();function o(s){return s&&s.length?e(s,i,r):void 0}return Tp=o,Tp}var Ip,MS;function cC(){if(MS)return Ip;MS=1;var e=Za(),r=Ci();function i(o,s,u){(u!==void 0&&!r(o[s],u)||u===void 0&&!(s in o))&&e(o,s,u)}return Ip=i,Ip}var Ap,PS;function rO(){if(PS)return Ap;PS=1;var e=Dr(),r=ru(),i=xn(),o="[object Object]",s=Function.prototype,u=Object.prototype,l=s.toString,c=u.hasOwnProperty,d=l.call(Object);function p(h){if(!i(h)||e(h)!=o)return!1;var m=r(h);if(m===null)return!0;var y=c.call(m,"constructor")&&m.constructor;return typeof y=="function"&&y instanceof y&&l.call(y)==d}return Ap=p,Ap}var Mp,qS;function fC(){if(qS)return Mp;qS=1;function e(r,i){if(!(i==="constructor"&&typeof r[i]=="function")&&i!="__proto__")return r[i]}return Mp=e,Mp}var Pp,OS;function iO(){if(OS)return Pp;OS=1;var e=Uo(),r=Fr();function i(o){return e(o,r(o))}return Pp=i,Pp}var qp,LS;function oO(){if(LS)return qp;LS=1;var e=cC(),r=wb(),i=Tb(),o=xb(),s=Ab(),u=Ho(),l=Je(),c=tC(),d=Ri(),p=Bo(),h=Qt(),m=rO(),y=Vo(),_=fC(),k=iO();function w(x,S,b,N,C,I,A){var P=_(x,b),$=_(S,b),L=A.get($);if(L){e(x,b,L);return}var U=I?I(P,$,b+"",x,S,A):void 0,V=U===void 0;if(V){var ee=l($),Z=!ee&&d($),R=!ee&&!Z&&y($);U=$,ee||Z||R?l(P)?U=P:c(P)?U=o(P):Z?(V=!1,U=r($,!0)):R?(V=!1,U=i($,!0)):U=[]:m($)||u($)?(U=P,u(P)?U=k(P):(!h(P)||p(P))&&(U=s($))):V=!1}V&&(A.set($,U),C(U,$,N,I,A),A.delete($)),e(x,b,U)}return qp=w,qp}var Op,jS;function sO(){if(jS)return Op;jS=1;var e=Qa(),r=cC(),i=Am(),o=oO(),s=Qt(),u=Fr(),l=fC();function c(d,p,h,m,y){d!==p&&i(p,function(_,k){if(y||(y=new e),s(_))o(d,p,k,h,c,m,y);else{var w=m?m(l(d,k),_,k+"",d,p,y):void 0;w===void 0&&(w=_),r(d,k,w)}},u)}return Op=c,Op}var Lp,DS;function aO(){if(DS)return Lp;DS=1;var e=uu(),r=lu();function i(o){return e(function(s,u){var l=-1,c=u.length,d=c>1?u[c-1]:void 0,p=c>2?u[2]:void 0;for(d=o.length>3&&typeof d=="function"?(c--,d):void 0,p&&r(u[0],u[1],p)&&(d=c<3?void 0:d,c=1),s=Object(s);++l<c;){var h=u[l];h&&o(s,h,l,d)}return s})}return Lp=i,Lp}var jp,zS;function uO(){if(zS)return jp;zS=1;var e=sO(),r=aO(),i=r(function(o,s,u){e(o,s,u)});return jp=i,jp}var Dp,FS;function dC(){if(FS)return Dp;FS=1;function e(r,i){return r<i}return Dp=e,Dp}var zp,$S;function lO(){if($S)return zp;$S=1;var e=jm(),r=dC(),i=$r();function o(s){return s&&s.length?e(s,i,r):void 0}return zp=o,zp}var Fp,BS;function cO(){if(BS)return Fp;BS=1;var e=jm(),r=$n(),i=dC();function o(s,u){return s&&s.length?e(s,r(u,2),i):void 0}return Fp=o,Fp}var $p,US;function fO(){if(US)return $p;US=1;var e=dn(),r=function(){return e.Date.now()};return $p=r,$p}var Bp,HS;function dO(){if(HS)return Bp;HS=1;var e=Ja(),r=su(),i=eu(),o=Qt(),s=Go();function u(l,c,d,p){if(!o(l))return l;c=r(c,l);for(var h=-1,m=c.length,y=m-1,_=l;_!=null&&++h<m;){var k=s(c[h]),w=d;if(k==="__proto__"||k==="constructor"||k==="prototype")return l;if(h!=y){var x=_[k];w=p?p(x,k,_):void 0,w===void 0&&(w=o(x)?x:i(c[h+1])?[]:{})}e(_,k,w),_=_[k]}return l}return Bp=u,Bp}var Up,VS;function hO(){if(VS)return Up;VS=1;var e=au(),r=dO(),i=su();function o(s,u,l){for(var c=-1,d=u.length,p={};++c<d;){var h=u[c],m=e(s,h);l(m,h)&&r(p,i(h,s),m)}return p}return Up=o,Up}var Hp,GS;function pO(){if(GS)return Hp;GS=1;var e=hO(),r=Hb();function i(o,s){return e(o,s,function(u,l){return r(o,l)})}return Hp=i,Hp}var Vp,WS;function vO(){if(WS)return Vp;WS=1;var e=lC(),r=Zb(),i=Jb();function o(s){return i(r(s,void 0,e),s+"")}return Vp=o,Vp}var Gp,KS;function mO(){if(KS)return Gp;KS=1;var e=pO(),r=vO(),i=r(function(o,s){return o==null?{}:e(o,s)});return Gp=i,Gp}var Wp,YS;function gO(){if(YS)return Wp;YS=1;var e=Math.ceil,r=Math.max;function i(o,s,u,l){for(var c=-1,d=r(e((s-o)/(u||1)),0),p=Array(d);d--;)p[l?d:++c]=o,o+=u;return p}return Wp=i,Wp}var Kp,XS;function yO(){if(XS)return Kp;XS=1;var e=gO(),r=lu(),i=uC();function o(s){return function(u,l,c){return c&&typeof c!="number"&&r(u,l,c)&&(l=c=void 0),u=i(u),l===void 0?(l=u,u=0):l=i(l),c=c===void 0?u<l?1:-1:i(c),e(u,l,c,s)}}return Kp=o,Kp}var Yp,QS;function _O(){if(QS)return Yp;QS=1;var e=yO(),r=e();return Yp=r,Yp}var Xp,ZS;function wO(){if(ZS)return Xp;ZS=1;function e(r,i){var o=r.length;for(r.sort(i);o--;)r[o]=r[o].value;return r}return Xp=e,Xp}var Qp,JS;function xO(){if(JS)return Qp;JS=1;var e=Ii();function r(i,o){if(i!==o){var s=i!==void 0,u=i===null,l=i===i,c=e(i),d=o!==void 0,p=o===null,h=o===o,m=e(o);if(!p&&!m&&!c&&i>o||c&&d&&h&&!p&&!m||u&&d&&h||!s&&h||!l)return 1;if(!u&&!c&&!m&&i<o||m&&s&&l&&!u&&!c||p&&s&&l||!d&&l||!h)return-1}return 0}return Qp=r,Qp}var Zp,eE;function SO(){if(eE)return Zp;eE=1;var e=xO();function r(i,o,s){for(var u=-1,l=i.criteria,c=o.criteria,d=l.length,p=s.length;++u<d;){var h=e(l[u],c[u]);if(h){if(u>=p)return h;var m=s[u];return h*(m=="desc"?-1:1)}}return i.index-o.index}return Zp=r,Zp}var Jp,tE;function EO(){if(tE)return Jp;tE=1;var e=ou(),r=au(),i=$n(),o=Yb(),s=wO(),u=tu(),l=SO(),c=$r(),d=Je();function p(h,m,y){m.length?m=e(m,function(w){return d(w)?function(x){return r(x,w.length===1?w[0]:w)}:w}):m=[c];var _=-1;m=e(m,u(i));var k=o(h,function(w,x,S){var b=e(m,function(N){return N(w)});return{criteria:b,index:++_,value:w}});return s(k,function(w,x){return l(w,x,y)})}return Jp=p,Jp}var ev,nE;function kO(){if(nE)return ev;nE=1;var e=Om(),r=EO(),i=uu(),o=lu(),s=i(function(u,l){if(u==null)return[];var c=l.length;return c>1&&o(u,l[0],l[1])?l=[]:c>2&&o(l[0],l[1],l[2])&&(l=[l[0]]),r(u,e(l,1),[])});return ev=s,ev}var tv,rE;function bO(){if(rE)return tv;rE=1;var e=Bb(),r=0;function i(o){var s=++r;return e(o)+s}return tv=i,tv}var nv,iE;function CO(){if(iE)return nv;iE=1;function e(r,i,o){for(var s=-1,u=r.length,l=i.length,c={};++s<u;){var d=s<l?i[s]:void 0;o(c,r[s],d)}return c}return nv=e,nv}var rv,oE;function NO(){if(oE)return rv;oE=1;var e=Ja(),r=CO();function i(o,s){return r(o||[],s||[],e)}return rv=i,rv}var iv,sE;function Ue(){if(sE)return iv;sE=1;var e;if(typeof wm=="function")try{e={cloneDeep:U3(),constant:Im(),defaults:H3(),each:Ob(),filter:Gb(),find:Q3(),flatten:lC(),forEach:qb(),forIn:Z3(),has:Wb(),isUndefined:Kb(),last:J3(),map:Xb(),mapValues:eO(),max:nO(),merge:uO(),min:lO(),minBy:cO(),now:fO(),pick:mO(),range:_O(),reduce:Qb(),sortBy:kO(),uniqueId:bO(),values:nC(),zipObject:NO()}}catch{}return e||(e=window._),iv=e,iv}var ov,aE;function RO(){if(aE)return ov;aE=1,ov=e;function e(){var o={};o._next=o._prev=o,this._sentinel=o}e.prototype.dequeue=function(){var o=this._sentinel,s=o._prev;if(s!==o)return r(s),s},e.prototype.enqueue=function(o){var s=this._sentinel;o._prev&&o._next&&r(o),o._next=s._next,s._next._prev=o,s._next=o,o._prev=s},e.prototype.toString=function(){for(var o=[],s=this._sentinel,u=s._prev;u!==s;)o.push(JSON.stringify(u,i)),u=u._prev;return"["+o.join(", ")+"]"};function r(o){o._prev._next=o._next,o._next._prev=o._prev,delete o._next,delete o._prev}function i(o,s){if(o!=="_next"&&o!=="_prev")return s}return ov}var sv,uE;function TO(){if(uE)return sv;uE=1;var e=Ue(),r=cn().Graph,i=RO();sv=s;var o=e.constant(1);function s(p,h){if(p.nodeCount()<=1)return[];var m=c(p,h||o),y=u(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(y,function(_){return p.outEdges(_.v,_.w)}),!0)}function u(p,h,m){for(var y=[],_=h[h.length-1],k=h[0],w;p.nodeCount();){for(;w=k.dequeue();)l(p,h,m,w);for(;w=_.dequeue();)l(p,h,m,w);if(p.nodeCount()){for(var x=h.length-2;x>0;--x)if(w=h[x].dequeue(),w){y=y.concat(l(p,h,m,w,!0));break}}}return y}function l(p,h,m,y,_){var k=_?[]:void 0;return e.forEach(p.inEdges(y.v),function(w){var x=p.edge(w),S=p.node(w.v);_&&k.push({v:w.v,w:w.w}),S.out-=x,d(h,m,S)}),e.forEach(p.outEdges(y.v),function(w){var x=p.edge(w),S=w.w,b=p.node(S);b.in-=x,d(h,m,b)}),p.removeNode(y.v),k}function c(p,h){var m=new r,y=0,_=0;e.forEach(p.nodes(),function(x){m.setNode(x,{v:x,in:0,out:0})}),e.forEach(p.edges(),function(x){var S=m.edge(x.v,x.w)||0,b=h(x),N=S+b;m.setEdge(x.v,x.w,N),_=Math.max(_,m.node(x.v).out+=b),y=Math.max(y,m.node(x.w).in+=b)});var k=e.range(_+y+3).map(function(){return new i}),w=y+1;return e.forEach(m.nodes(),function(x){d(k,w,m.node(x))}),{graph:m,buckets:k,zeroIdx:w}}function d(p,h,m){m.out?m.in?p[m.out-m.in+h].enqueue(m):p[p.length-1].enqueue(m):p[0].enqueue(m)}return sv}var av,lE;function IO(){if(lE)return av;lE=1;var e=Ue(),r=TO();av={run:i,undo:s};function i(u){var l=u.graph().acyclicer==="greedy"?r(u,c(u)):o(u);e.forEach(l,function(d){var p=u.edge(d);u.removeEdge(d),p.forwardName=d.name,p.reversed=!0,u.setEdge(d.w,d.v,p,e.uniqueId("rev"))});function c(d){return function(p){return d.edge(p).weight}}}function o(u){var l=[],c={},d={};function p(h){e.has(d,h)||(d[h]=!0,c[h]=!0,e.forEach(u.outEdges(h),function(m){e.has(c,m.w)?l.push(m):p(m.w)}),delete c[h])}return e.forEach(u.nodes(),p),l}function s(u){e.forEach(u.edges(),function(l){var c=u.edge(l);if(c.reversed){u.removeEdge(l);var d=c.forwardName;delete c.reversed,delete c.forwardName,u.setEdge(l.w,l.v,c,d)}})}return av}var uv,cE;function Pt(){if(cE)return uv;cE=1;var e=Ue(),r=cn().Graph;uv={addDummyNode:i,simplify:o,asNonCompoundGraph:s,successorWeights:u,predecessorWeights:l,intersectRect:c,buildLayerMatrix:d,normalizeRanks:p,removeEmptyRanks:h,addBorderNode:m,maxRank:y,partition:_,time:k,notime:w};function i(x,S,b,N){var C;do C=e.uniqueId(N);while(x.hasNode(C));return b.dummy=S,x.setNode(C,b),C}function o(x){var S=new r().setGraph(x.graph());return e.forEach(x.nodes(),function(b){S.setNode(b,x.node(b))}),e.forEach(x.edges(),function(b){var N=S.edge(b.v,b.w)||{weight:0,minlen:1},C=x.edge(b);S.setEdge(b.v,b.w,{weight:N.weight+C.weight,minlen:Math.max(N.minlen,C.minlen)})}),S}function s(x){var S=new r({multigraph:x.isMultigraph()}).setGraph(x.graph());return e.forEach(x.nodes(),function(b){x.children(b).length||S.setNode(b,x.node(b))}),e.forEach(x.edges(),function(b){S.setEdge(b,x.edge(b))}),S}function u(x){var S=e.map(x.nodes(),function(b){var N={};return e.forEach(x.outEdges(b),function(C){N[C.w]=(N[C.w]||0)+x.edge(C).weight}),N});return e.zipObject(x.nodes(),S)}function l(x){var S=e.map(x.nodes(),function(b){var N={};return e.forEach(x.inEdges(b),function(C){N[C.v]=(N[C.v]||0)+x.edge(C).weight}),N});return e.zipObject(x.nodes(),S)}function c(x,S){var b=x.x,N=x.y,C=S.x-b,I=S.y-N,A=x.width/2,P=x.height/2;if(!C&&!I)throw new Error("Not possible to find intersection inside of the rectangle");var $,L;return Math.abs(I)*A>Math.abs(C)*P?(I<0&&(P=-P),$=P*C/I,L=P):(C<0&&(A=-A),$=A,L=A*I/C),{x:b+$,y:N+L}}function d(x){var S=e.map(e.range(y(x)+1),function(){return[]});return e.forEach(x.nodes(),function(b){var N=x.node(b),C=N.rank;e.isUndefined(C)||(S[C][N.order]=b)}),S}function p(x){var S=e.min(e.map(x.nodes(),function(b){return x.node(b).rank}));e.forEach(x.nodes(),function(b){var N=x.node(b);e.has(N,"rank")&&(N.rank-=S)})}function h(x){var S=e.min(e.map(x.nodes(),function(I){return x.node(I).rank})),b=[];e.forEach(x.nodes(),function(I){var A=x.node(I).rank-S;b[A]||(b[A]=[]),b[A].push(I)});var N=0,C=x.graph().nodeRankFactor;e.forEach(b,function(I,A){e.isUndefined(I)&&A%C!==0?--N:N&&e.forEach(I,function(P){x.node(P).rank+=N})})}function m(x,S,b,N){var C={width:0,height:0};return arguments.length>=4&&(C.rank=b,C.order=N),i(x,"border",C,S)}function y(x){return e.max(e.map(x.nodes(),function(S){var b=x.node(S).rank;if(!e.isUndefined(b))return b}))}function _(x,S){var b={lhs:[],rhs:[]};return e.forEach(x,function(N){S(N)?b.lhs.push(N):b.rhs.push(N)}),b}function k(x,S){var b=e.now();try{return S()}finally{console.log(x+" time: "+(e.now()-b)+"ms")}}function w(x,S){return S()}return uv}var lv,fE;function AO(){if(fE)return lv;fE=1;var e=Ue(),r=Pt();lv={run:i,undo:s};function i(u){u.graph().dummyChains=[],e.forEach(u.edges(),function(l){o(u,l)})}function o(u,l){var c=l.v,d=u.node(c).rank,p=l.w,h=u.node(p).rank,m=l.name,y=u.edge(l),_=y.labelRank;if(h!==d+1){u.removeEdge(l);var k,w,x;for(x=0,++d;d<h;++x,++d)y.points=[],w={width:0,height:0,edgeLabel:y,edgeObj:l,rank:d},k=r.addDummyNode(u,"edge",w,"_d"),d===_&&(w.width=y.width,w.height=y.height,w.dummy="edge-label",w.labelpos=y.labelpos),u.setEdge(c,k,{weight:y.weight},m),x===0&&u.graph().dummyChains.push(k),c=k;u.setEdge(c,p,{weight:y.weight},m)}}function s(u){e.forEach(u.graph().dummyChains,function(l){var c=u.node(l),d=c.edgeLabel,p;for(u.setEdge(c.edgeObj,d);c.dummy;)p=u.successors(l)[0],u.removeNode(l),d.points.push({x:c.x,y:c.y}),c.dummy==="edge-label"&&(d.x=c.x,d.y=c.y,d.width=c.width,d.height=c.height),l=p,c=u.node(l)})}return lv}var cv,dE;function Da(){if(dE)return cv;dE=1;var e=Ue();cv={longestPath:r,slack:i};function r(o){var s={};function u(l){var c=o.node(l);if(e.has(s,l))return c.rank;s[l]=!0;var d=e.min(e.map(o.outEdges(l),function(p){return u(p.w)-o.edge(p).minlen}));return(d===Number.POSITIVE_INFINITY||d===void 0||d===null)&&(d=0),c.rank=d}e.forEach(o.sources(),u)}function i(o,s){return o.node(s.w).rank-o.node(s.v).rank-o.edge(s).minlen}return cv}var fv,hE;function hC(){if(hE)return fv;hE=1;var e=Ue(),r=cn().Graph,i=Da().slack;fv=o;function o(c){var d=new r({directed:!1}),p=c.nodes()[0],h=c.nodeCount();d.setNode(p,{});for(var m,y;s(d,c)<h;)m=u(d,c),y=d.hasNode(m.v)?i(c,m):-i(c,m),l(d,c,y);return d}function s(c,d){function p(h){e.forEach(d.nodeEdges(h),function(m){var y=m.v,_=h===y?m.w:y;!c.hasNode(_)&&!i(d,m)&&(c.setNode(_,{}),c.setEdge(h,_,{}),p(_))})}return e.forEach(c.nodes(),p),c.nodeCount()}function u(c,d){return e.minBy(d.edges(),function(p){if(c.hasNode(p.v)!==c.hasNode(p.w))return i(d,p)})}function l(c,d,p){e.forEach(c.nodes(),function(h){d.node(h).rank+=p})}return fv}var dv,pE;function MO(){if(pE)return dv;pE=1;var e=Ue(),r=hC(),i=Da().slack,o=Da().longestPath,s=cn().alg.preorder,u=cn().alg.postorder,l=Pt().simplify;dv=c,c.initLowLimValues=m,c.initCutValues=d,c.calcCutValue=h,c.leaveEdge=_,c.enterEdge=k,c.exchangeEdges=w;function c(N){N=l(N),o(N);var C=r(N);m(C),d(C,N);for(var I,A;I=_(C);)A=k(C,N,I),w(C,N,I,A)}function d(N,C){var I=u(N,N.nodes());I=I.slice(0,I.length-1),e.forEach(I,function(A){p(N,C,A)})}function p(N,C,I){var A=N.node(I),P=A.parent;N.edge(I,P).cutvalue=h(N,C,I)}function h(N,C,I){var A=N.node(I),P=A.parent,$=!0,L=C.edge(I,P),U=0;return L||($=!1,L=C.edge(P,I)),U=L.weight,e.forEach(C.nodeEdges(I),function(V){var ee=V.v===I,Z=ee?V.w:V.v;if(Z!==P){var R=ee===$,W=C.edge(V).weight;if(U+=R?W:-W,S(N,I,Z)){var F=N.edge(I,Z).cutvalue;U+=R?-F:F}}}),U}function m(N,C){arguments.length<2&&(C=N.nodes()[0]),y(N,{},1,C)}function y(N,C,I,A,P){var $=I,L=N.node(A);return C[A]=!0,e.forEach(N.neighbors(A),function(U){e.has(C,U)||(I=y(N,C,I,U,A))}),L.low=$,L.lim=I++,P?L.parent=P:delete L.parent,I}function _(N){return e.find(N.edges(),function(C){return N.edge(C).cutvalue<0})}function k(N,C,I){var A=I.v,P=I.w;C.hasEdge(A,P)||(A=I.w,P=I.v);var $=N.node(A),L=N.node(P),U=$,V=!1;$.lim>L.lim&&(U=L,V=!0);var ee=e.filter(C.edges(),function(Z){return V===b(N,N.node(Z.v),U)&&V!==b(N,N.node(Z.w),U)});return e.minBy(ee,function(Z){return i(C,Z)})}function w(N,C,I,A){var P=I.v,$=I.w;N.removeEdge(P,$),N.setEdge(A.v,A.w,{}),m(N),d(N,C),x(N,C)}function x(N,C){var I=e.find(N.nodes(),function(P){return!C.node(P).parent}),A=s(N,I);A=A.slice(1),e.forEach(A,function(P){var $=N.node(P).parent,L=C.edge(P,$),U=!1;L||(L=C.edge($,P),U=!0),C.node(P).rank=C.node($).rank+(U?L.minlen:-L.minlen)})}function S(N,C,I){return N.hasEdge(C,I)}function b(N,C,I){return I.low<=C.lim&&C.lim<=I.lim}return dv}var hv,vE;function PO(){if(vE)return hv;vE=1;var e=Da(),r=e.longestPath,i=hC(),o=MO();hv=s;function s(d){switch(d.graph().ranker){case"network-simplex":c(d);break;case"tight-tree":l(d);break;case"longest-path":u(d);break;default:c(d)}}var u=r;function l(d){r(d),i(d)}function c(d){o(d)}return hv}var pv,mE;function qO(){if(mE)return pv;mE=1;var e=Ue();pv=r;function r(s){var u=o(s);e.forEach(s.graph().dummyChains,function(l){for(var c=s.node(l),d=c.edgeObj,p=i(s,u,d.v,d.w),h=p.path,m=p.lca,y=0,_=h[y],k=!0;l!==d.w;){if(c=s.node(l),k){for(;(_=h[y])!==m&&s.node(_).maxRank<c.rank;)y++;_===m&&(k=!1)}if(!k){for(;y<h.length-1&&s.node(_=h[y+1]).minRank<=c.rank;)y++;_=h[y]}s.setParent(l,_),l=s.successors(l)[0]}})}function i(s,u,l,c){var d=[],p=[],h=Math.min(u[l].low,u[c].low),m=Math.max(u[l].lim,u[c].lim),y,_;y=l;do y=s.parent(y),d.push(y);while(y&&(u[y].low>h||m>u[y].lim));for(_=y,y=c;(y=s.parent(y))!==_;)p.push(y);return{path:d.concat(p.reverse()),lca:_}}function o(s){var u={},l=0;function c(d){var p=l;e.forEach(s.children(d),c),u[d]={low:p,lim:l++}}return e.forEach(s.children(),c),u}return pv}var vv,gE;function OO(){if(gE)return vv;gE=1;var e=Ue(),r=Pt();vv={run:i,cleanup:l};function i(c){var d=r.addDummyNode(c,"root",{},"_root"),p=s(c),h=e.max(e.values(p))-1,m=2*h+1;c.graph().nestingRoot=d,e.forEach(c.edges(),function(_){c.edge(_).minlen*=m});var y=u(c)+1;e.forEach(c.children(),function(_){o(c,d,m,y,h,p,_)}),c.graph().nodeRankFactor=m}function o(c,d,p,h,m,y,_){var k=c.children(_);if(!k.length){_!==d&&c.setEdge(d,_,{weight:0,minlen:p});return}var w=r.addBorderNode(c,"_bt"),x=r.addBorderNode(c,"_bb"),S=c.node(_);c.setParent(w,_),S.borderTop=w,c.setParent(x,_),S.borderBottom=x,e.forEach(k,function(b){o(c,d,p,h,m,y,b);var N=c.node(b),C=N.borderTop?N.borderTop:b,I=N.borderBottom?N.borderBottom:b,A=N.borderTop?h:2*h,P=C!==I?1:m-y[_]+1;c.setEdge(w,C,{weight:A,minlen:P,nestingEdge:!0}),c.setEdge(I,x,{weight:A,minlen:P,nestingEdge:!0})}),c.parent(_)||c.setEdge(d,w,{weight:0,minlen:m+y[_]})}function s(c){var d={};function p(h,m){var y=c.children(h);y&&y.length&&e.forEach(y,function(_){p(_,m+1)}),d[h]=m}return e.forEach(c.children(),function(h){p(h,1)}),d}function u(c){return e.reduce(c.edges(),function(d,p){return d+c.edge(p).weight},0)}function l(c){var d=c.graph();c.removeNode(d.nestingRoot),delete d.nestingRoot,e.forEach(c.edges(),function(p){var h=c.edge(p);h.nestingEdge&&c.removeEdge(p)})}return vv}var mv,yE;function LO(){if(yE)return mv;yE=1;var e=Ue(),r=Pt();mv=i;function i(s){function u(l){var c=s.children(l),d=s.node(l);if(c.length&&e.forEach(c,u),e.has(d,"minRank")){d.borderLeft=[],d.borderRight=[];for(var p=d.minRank,h=d.maxRank+1;p<h;++p)o(s,"borderLeft","_bl",l,d,p),o(s,"borderRight","_br",l,d,p)}}e.forEach(s.children(),u)}function o(s,u,l,c,d,p){var h={width:0,height:0,rank:p,borderType:u},m=d[u][p-1],y=r.addDummyNode(s,"border",h,l);d[u][p]=y,s.setParent(y,c),m&&s.setEdge(m,y,{weight:1})}return mv}var gv,_E;function jO(){if(_E)return gv;_E=1;var e=Ue();gv={adjust:r,undo:i};function r(p){var h=p.graph().rankdir.toLowerCase();(h==="lr"||h==="rl")&&o(p)}function i(p){var h=p.graph().rankdir.toLowerCase();(h==="bt"||h==="rl")&&u(p),(h==="lr"||h==="rl")&&(c(p),o(p))}function o(p){e.forEach(p.nodes(),function(h){s(p.node(h))}),e.forEach(p.edges(),function(h){s(p.edge(h))})}function s(p){var h=p.width;p.width=p.height,p.height=h}function u(p){e.forEach(p.nodes(),function(h){l(p.node(h))}),e.forEach(p.edges(),function(h){var m=p.edge(h);e.forEach(m.points,l),e.has(m,"y")&&l(m)})}function l(p){p.y=-p.y}function c(p){e.forEach(p.nodes(),function(h){d(p.node(h))}),e.forEach(p.edges(),function(h){var m=p.edge(h);e.forEach(m.points,d),e.has(m,"x")&&d(m)})}function d(p){var h=p.x;p.x=p.y,p.y=h}return gv}var yv,wE;function DO(){if(wE)return yv;wE=1;var e=Ue();yv=r;function r(i){var o={},s=e.filter(i.nodes(),function(p){return!i.children(p).length}),u=e.max(e.map(s,function(p){return i.node(p).rank})),l=e.map(e.range(u+1),function(){return[]});function c(p){if(!e.has(o,p)){o[p]=!0;var h=i.node(p);l[h.rank].push(p),e.forEach(i.successors(p),c)}}var d=e.sortBy(s,function(p){return i.node(p).rank});return e.forEach(d,c),l}return yv}var _v,xE;function zO(){if(xE)return _v;xE=1;var e=Ue();_v=r;function r(o,s){for(var u=0,l=1;l<s.length;++l)u+=i(o,s[l-1],s[l]);return u}function i(o,s,u){for(var l=e.zipObject(u,e.map(u,function(y,_){return _})),c=e.flatten(e.map(s,function(y){return e.sortBy(e.map(o.outEdges(y),function(_){return{pos:l[_.w],weight:o.edge(_).weight}}),"pos")}),!0),d=1;d<u.length;)d<<=1;var p=2*d-1;d-=1;var h=e.map(new Array(p),function(){return 0}),m=0;return e.forEach(c.forEach(function(y){var _=y.pos+d;h[_]+=y.weight;for(var k=0;_>0;)_%2&&(k+=h[_+1]),_=_-1>>1,h[_]+=y.weight;m+=y.weight*k})),m}return _v}var wv,SE;function FO(){if(SE)return wv;SE=1;var e=Ue();wv=r;function r(i,o){return e.map(o,function(s){var u=i.inEdges(s);if(u.length){var l=e.reduce(u,function(c,d){var p=i.edge(d),h=i.node(d.v);return{sum:c.sum+p.weight*h.order,weight:c.weight+p.weight}},{sum:0,weight:0});return{v:s,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:s}})}return wv}var xv,EE;function $O(){if(EE)return xv;EE=1;var e=Ue();xv=r;function r(s,u){var l={};e.forEach(s,function(d,p){var h=l[d.v]={indegree:0,in:[],out:[],vs:[d.v],i:p};e.isUndefined(d.barycenter)||(h.barycenter=d.barycenter,h.weight=d.weight)}),e.forEach(u.edges(),function(d){var p=l[d.v],h=l[d.w];!e.isUndefined(p)&&!e.isUndefined(h)&&(h.indegree++,p.out.push(l[d.w]))});var c=e.filter(l,function(d){return!d.indegree});return i(c)}function i(s){var u=[];function l(p){return function(h){h.merged||(e.isUndefined(h.barycenter)||e.isUndefined(p.barycenter)||h.barycenter>=p.barycenter)&&o(p,h)}}function c(p){return function(h){h.in.push(p),--h.indegree===0&&s.push(h)}}for(;s.length;){var d=s.pop();u.push(d),e.forEach(d.in.reverse(),l(d)),e.forEach(d.out,c(d))}return e.map(e.filter(u,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function o(s,u){var l=0,c=0;s.weight&&(l+=s.barycenter*s.weight,c+=s.weight),u.weight&&(l+=u.barycenter*u.weight,c+=u.weight),s.vs=u.vs.concat(s.vs),s.barycenter=l/c,s.weight=c,s.i=Math.min(u.i,s.i),u.merged=!0}return xv}var Sv,kE;function BO(){if(kE)return Sv;kE=1;var e=Ue(),r=Pt();Sv=i;function i(u,l){var c=r.partition(u,function(w){return e.has(w,"barycenter")}),d=c.lhs,p=e.sortBy(c.rhs,function(w){return-w.i}),h=[],m=0,y=0,_=0;d.sort(s(!!l)),_=o(h,p,_),e.forEach(d,function(w){_+=w.vs.length,h.push(w.vs),m+=w.barycenter*w.weight,y+=w.weight,_=o(h,p,_)});var k={vs:e.flatten(h,!0)};return y&&(k.barycenter=m/y,k.weight=y),k}function o(u,l,c){for(var d;l.length&&(d=e.last(l)).i<=c;)l.pop(),u.push(d.vs),c++;return c}function s(u){return function(l,c){return l.barycenter<c.barycenter?-1:l.barycenter>c.barycenter?1:u?c.i-l.i:l.i-c.i}}return Sv}var Ev,bE;function UO(){if(bE)return Ev;bE=1;var e=Ue(),r=FO(),i=$O(),o=BO();Ev=s;function s(c,d,p,h){var m=c.children(d),y=c.node(d),_=y?y.borderLeft:void 0,k=y?y.borderRight:void 0,w={};_&&(m=e.filter(m,function(I){return I!==_&&I!==k}));var x=r(c,m);e.forEach(x,function(I){if(c.children(I.v).length){var A=s(c,I.v,p,h);w[I.v]=A,e.has(A,"barycenter")&&l(I,A)}});var S=i(x,p);u(S,w);var b=o(S,h);if(_&&(b.vs=e.flatten([_,b.vs,k],!0),c.predecessors(_).length)){var N=c.node(c.predecessors(_)[0]),C=c.node(c.predecessors(k)[0]);e.has(b,"barycenter")||(b.barycenter=0,b.weight=0),b.barycenter=(b.barycenter*b.weight+N.order+C.order)/(b.weight+2),b.weight+=2}return b}function u(c,d){e.forEach(c,function(p){p.vs=e.flatten(p.vs.map(function(h){return d[h]?d[h].vs:h}),!0)})}function l(c,d){e.isUndefined(c.barycenter)?(c.barycenter=d.barycenter,c.weight=d.weight):(c.barycenter=(c.barycenter*c.weight+d.barycenter*d.weight)/(c.weight+d.weight),c.weight+=d.weight)}return Ev}var kv,CE;function HO(){if(CE)return kv;CE=1;var e=Ue(),r=cn().Graph;kv=i;function i(s,u,l){var c=o(s),d=new r({compound:!0}).setGraph({root:c}).setDefaultNodeLabel(function(p){return s.node(p)});return e.forEach(s.nodes(),function(p){var h=s.node(p),m=s.parent(p);(h.rank===u||h.minRank<=u&&u<=h.maxRank)&&(d.setNode(p),d.setParent(p,m||c),e.forEach(s[l](p),function(y){var _=y.v===p?y.w:y.v,k=d.edge(_,p),w=e.isUndefined(k)?0:k.weight;d.setEdge(_,p,{weight:s.edge(y).weight+w})}),e.has(h,"minRank")&&d.setNode(p,{borderLeft:h.borderLeft[u],borderRight:h.borderRight[u]}))}),d}function o(s){for(var u;s.hasNode(u=e.uniqueId("_root")););return u}return kv}var bv,NE;function VO(){if(NE)return bv;NE=1;var e=Ue();bv=r;function r(i,o,s){var u={},l;e.forEach(s,function(c){for(var d=i.parent(c),p,h;d;){if(p=i.parent(d),p?(h=u[p],u[p]=d):(h=l,l=d),h&&h!==d){o.setEdge(h,d);return}d=p}})}return bv}var Cv,RE;function GO(){if(RE)return Cv;RE=1;var e=Ue(),r=DO(),i=zO(),o=UO(),s=HO(),u=VO(),l=cn().Graph,c=Pt();Cv=d;function d(y){var _=c.maxRank(y),k=p(y,e.range(1,_+1),"inEdges"),w=p(y,e.range(_-1,-1,-1),"outEdges"),x=r(y);m(y,x);for(var S=Number.POSITIVE_INFINITY,b,N=0,C=0;C<4;++N,++C){h(N%2?k:w,N%4>=2),x=c.buildLayerMatrix(y);var I=i(y,x);I<S&&(C=0,b=e.cloneDeep(x),S=I)}m(y,b)}function p(y,_,k){return e.map(_,function(w){return s(y,w,k)})}function h(y,_){var k=new l;e.forEach(y,function(w){var x=w.graph().root,S=o(w,x,k,_);e.forEach(S.vs,function(b,N){w.node(b).order=N}),u(w,k,S.vs)})}function m(y,_){e.forEach(_,function(k){e.forEach(k,function(w,x){y.node(w).order=x})})}return Cv}var Nv,TE;function WO(){if(TE)return Nv;TE=1;var e=Ue(),r=cn().Graph,i=Pt();Nv={positionX:k,findType1Conflicts:o,findType2Conflicts:s,addConflict:l,hasConflict:c,verticalAlignment:d,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:m,balance:_};function o(S,b){var N={};function C(I,A){var P=0,$=0,L=I.length,U=e.last(A);return e.forEach(A,function(V,ee){var Z=u(S,V),R=Z?S.node(Z).order:L;(Z||V===U)&&(e.forEach(A.slice($,ee+1),function(W){e.forEach(S.predecessors(W),function(F){var ne=S.node(F),G=ne.order;(G<P||R<G)&&!(ne.dummy&&S.node(W).dummy)&&l(N,F,W)})}),$=ee+1,P=R)}),A}return e.reduce(b,C),N}function s(S,b){var N={};function C(A,P,$,L,U){var V;e.forEach(e.range(P,$),function(ee){V=A[ee],S.node(V).dummy&&e.forEach(S.predecessors(V),function(Z){var R=S.node(Z);R.dummy&&(R.order<L||R.order>U)&&l(N,Z,V)})})}function I(A,P){var $=-1,L,U=0;return e.forEach(P,function(V,ee){if(S.node(V).dummy==="border"){var Z=S.predecessors(V);Z.length&&(L=S.node(Z[0]).order,C(P,U,ee,$,L),U=ee,$=L)}C(P,U,P.length,L,A.length)}),P}return e.reduce(b,I),N}function u(S,b){if(S.node(b).dummy)return e.find(S.predecessors(b),function(N){return S.node(N).dummy})}function l(S,b,N){if(b>N){var C=b;b=N,N=C}var I=S[b];I||(S[b]=I={}),I[N]=!0}function c(S,b,N){if(b>N){var C=b;b=N,N=C}return e.has(S[b],N)}function d(S,b,N,C){var I={},A={},P={};return e.forEach(b,function($){e.forEach($,function(L,U){I[L]=L,A[L]=L,P[L]=U})}),e.forEach(b,function($){var L=-1;e.forEach($,function(U){var V=C(U);if(V.length){V=e.sortBy(V,function(F){return P[F]});for(var ee=(V.length-1)/2,Z=Math.floor(ee),R=Math.ceil(ee);Z<=R;++Z){var W=V[Z];A[U]===U&&L<P[W]&&!c(N,U,W)&&(A[W]=U,A[U]=I[U]=I[W],L=P[W])}}})}),{root:I,align:A}}function p(S,b,N,C,I){var A={},P=h(S,b,N,I),$=I?"borderLeft":"borderRight";function L(ee,Z){for(var R=P.nodes(),W=R.pop(),F={};W;)F[W]?ee(W):(F[W]=!0,R.push(W),R=R.concat(Z(W))),W=R.pop()}function U(ee){A[ee]=P.inEdges(ee).reduce(function(Z,R){return Math.max(Z,A[R.v]+P.edge(R))},0)}function V(ee){var Z=P.outEdges(ee).reduce(function(W,F){return Math.min(W,A[F.w]-P.edge(F))},Number.POSITIVE_INFINITY),R=S.node(ee);Z!==Number.POSITIVE_INFINITY&&R.borderType!==$&&(A[ee]=Math.max(A[ee],Z))}return L(U,P.predecessors.bind(P)),L(V,P.successors.bind(P)),e.forEach(C,function(ee){A[ee]=A[N[ee]]}),A}function h(S,b,N,C){var I=new r,A=S.graph(),P=w(A.nodesep,A.edgesep,C);return e.forEach(b,function($){var L;e.forEach($,function(U){var V=N[U];if(I.setNode(V),L){var ee=N[L],Z=I.edge(ee,V);I.setEdge(ee,V,Math.max(P(S,U,L),Z||0))}L=U})}),I}function m(S,b){return e.minBy(e.values(b),function(N){var C=Number.NEGATIVE_INFINITY,I=Number.POSITIVE_INFINITY;return e.forIn(N,function(A,P){var $=x(S,P)/2;C=Math.max(A+$,C),I=Math.min(A-$,I)}),C-I})}function y(S,b){var N=e.values(b),C=e.min(N),I=e.max(N);e.forEach(["u","d"],function(A){e.forEach(["l","r"],function(P){var $=A+P,L=S[$],U;if(L!==b){var V=e.values(L);U=P==="l"?C-e.min(V):I-e.max(V),U&&(S[$]=e.mapValues(L,function(ee){return ee+U}))}})})}function _(S,b){return e.mapValues(S.ul,function(N,C){if(b)return S[b.toLowerCase()][C];var I=e.sortBy(e.map(S,C));return(I[1]+I[2])/2})}function k(S){var b=i.buildLayerMatrix(S),N=e.merge(o(S,b),s(S,b)),C={},I;e.forEach(["u","d"],function(P){I=P==="u"?b:e.values(b).reverse(),e.forEach(["l","r"],function($){$==="r"&&(I=e.map(I,function(ee){return e.values(ee).reverse()}));var L=(P==="u"?S.predecessors:S.successors).bind(S),U=d(S,I,N,L),V=p(S,I,U.root,U.align,$==="r");$==="r"&&(V=e.mapValues(V,function(ee){return-ee})),C[P+$]=V})});var A=m(S,C);return y(C,A),_(C,S.graph().align)}function w(S,b,N){return function(C,I,A){var P=C.node(I),$=C.node(A),L=0,U;if(L+=P.width/2,e.has(P,"labelpos"))switch(P.labelpos.toLowerCase()){case"l":U=-P.width/2;break;case"r":U=P.width/2;break}if(U&&(L+=N?U:-U),U=0,L+=(P.dummy?b:S)/2,L+=($.dummy?b:S)/2,L+=$.width/2,e.has($,"labelpos"))switch($.labelpos.toLowerCase()){case"l":U=$.width/2;break;case"r":U=-$.width/2;break}return U&&(L+=N?U:-U),U=0,L}}function x(S,b){return S.node(b).width}return Nv}var Rv,IE;function KO(){if(IE)return Rv;IE=1;var e=Ue(),r=Pt(),i=WO().positionX;Rv=o;function o(u){u=r.asNonCompoundGraph(u),s(u),e.forEach(i(u),function(l,c){u.node(c).x=l})}function s(u){var l=r.buildLayerMatrix(u),c=u.graph().ranksep,d=0;e.forEach(l,function(p){var h=e.max(e.map(p,function(m){return u.node(m).height}));e.forEach(p,function(m){u.node(m).y=d+h/2}),d+=h+c})}return Rv}var Tv,AE;function YO(){if(AE)return Tv;AE=1;var e=Ue(),r=IO(),i=AO(),o=PO(),s=Pt().normalizeRanks,u=qO(),l=Pt().removeEmptyRanks,c=OO(),d=LO(),p=jO(),h=GO(),m=KO(),y=Pt(),_=cn().Graph;Tv=k;function k(q,H){var X=H&&H.debugTiming?y.time:y.notime;X("layout",function(){var oe=X(" buildLayoutGraph",function(){return L(q)});X(" runLayout",function(){w(oe,X)}),X(" updateInputGraph",function(){x(q,oe)})})}function w(q,H){H(" makeSpaceForEdgeLabels",function(){U(q)}),H(" removeSelfEdges",function(){j(q)}),H(" acyclic",function(){r.run(q)}),H(" nestingGraph.run",function(){c.run(q)}),H(" rank",function(){o(y.asNonCompoundGraph(q))}),H(" injectEdgeLabelProxies",function(){V(q)}),H(" removeEmptyRanks",function(){l(q)}),H(" nestingGraph.cleanup",function(){c.cleanup(q)}),H(" normalizeRanks",function(){s(q)}),H(" assignRankMinMax",function(){ee(q)}),H(" removeEdgeLabelProxies",function(){Z(q)}),H(" normalize.run",function(){i.run(q)}),H(" parentDummyChains",function(){u(q)}),H(" addBorderSegments",function(){d(q)}),H(" order",function(){h(q)}),H(" insertSelfEdges",function(){K(q)}),H(" adjustCoordinateSystem",function(){p.adjust(q)}),H(" position",function(){m(q)}),H(" positionSelfEdges",function(){T(q)}),H(" removeBorderNodes",function(){G(q)}),H(" normalize.undo",function(){i.undo(q)}),H(" fixupEdgeLabelCoords",function(){F(q)}),H(" undoCoordinateSystem",function(){p.undo(q)}),H(" translateGraph",function(){R(q)}),H(" assignNodeIntersects",function(){W(q)}),H(" reversePoints",function(){ne(q)}),H(" acyclic.undo",function(){r.undo(q)})}function x(q,H){e.forEach(q.nodes(),function(X){var oe=q.node(X),ue=H.node(X);oe&&(oe.x=ue.x,oe.y=ue.y,H.children(X).length&&(oe.width=ue.width,oe.height=ue.height))}),e.forEach(q.edges(),function(X){var oe=q.edge(X),ue=H.edge(X);oe.points=ue.points,e.has(ue,"x")&&(oe.x=ue.x,oe.y=ue.y)}),q.graph().width=H.graph().width,q.graph().height=H.graph().height}var S=["nodesep","edgesep","ranksep","marginx","marginy"],b={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},N=["acyclicer","ranker","rankdir","align"],C=["width","height"],I={width:0,height:0},A=["minlen","weight","width","height","labeloffset"],P={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},$=["labelpos"];function L(q){var H=new _({multigraph:!0,compound:!0}),X=ae(q.graph());return H.setGraph(e.merge({},b,z(X,S),e.pick(X,N))),e.forEach(q.nodes(),function(oe){var ue=ae(q.node(oe));H.setNode(oe,e.defaults(z(ue,C),I)),H.setParent(oe,q.parent(oe))}),e.forEach(q.edges(),function(oe){var ue=ae(q.edge(oe));H.setEdge(oe,e.merge({},P,z(ue,A),e.pick(ue,$)))}),H}function U(q){var H=q.graph();H.ranksep/=2,e.forEach(q.edges(),function(X){var oe=q.edge(X);oe.minlen*=2,oe.labelpos.toLowerCase()!=="c"&&(H.rankdir==="TB"||H.rankdir==="BT"?oe.width+=oe.labeloffset:oe.height+=oe.labeloffset)})}function V(q){e.forEach(q.edges(),function(H){var X=q.edge(H);if(X.width&&X.height){var oe=q.node(H.v),ue=q.node(H.w),se={rank:(ue.rank-oe.rank)/2+oe.rank,e:H};y.addDummyNode(q,"edge-proxy",se,"_ep")}})}function ee(q){var H=0;e.forEach(q.nodes(),function(X){var oe=q.node(X);oe.borderTop&&(oe.minRank=q.node(oe.borderTop).rank,oe.maxRank=q.node(oe.borderBottom).rank,H=e.max(H,oe.maxRank))}),q.graph().maxRank=H}function Z(q){e.forEach(q.nodes(),function(H){var X=q.node(H);X.dummy==="edge-proxy"&&(q.edge(X.e).labelRank=X.rank,q.removeNode(H))})}function R(q){var H=Number.POSITIVE_INFINITY,X=0,oe=Number.POSITIVE_INFINITY,ue=0,se=q.graph(),re=se.marginx||0,Ee=se.marginy||0;function Re(xe){var Ce=xe.x,ye=xe.y,Le=xe.width,ve=xe.height;H=Math.min(H,Ce-Le/2),X=Math.max(X,Ce+Le/2),oe=Math.min(oe,ye-ve/2),ue=Math.max(ue,ye+ve/2)}e.forEach(q.nodes(),function(xe){Re(q.node(xe))}),e.forEach(q.edges(),function(xe){var Ce=q.edge(xe);e.has(Ce,"x")&&Re(Ce)}),H-=re,oe-=Ee,e.forEach(q.nodes(),function(xe){var Ce=q.node(xe);Ce.x-=H,Ce.y-=oe}),e.forEach(q.edges(),function(xe){var Ce=q.edge(xe);e.forEach(Ce.points,function(ye){ye.x-=H,ye.y-=oe}),e.has(Ce,"x")&&(Ce.x-=H),e.has(Ce,"y")&&(Ce.y-=oe)}),se.width=X-H+re,se.height=ue-oe+Ee}function W(q){e.forEach(q.edges(),function(H){var X=q.edge(H),oe=q.node(H.v),ue=q.node(H.w),se,re;X.points?(se=X.points[0],re=X.points[X.points.length-1]):(X.points=[],se=ue,re=oe),X.points.unshift(y.intersectRect(oe,se)),X.points.push(y.intersectRect(ue,re))})}function F(q){e.forEach(q.edges(),function(H){var X=q.edge(H);if(e.has(X,"x"))switch((X.labelpos==="l"||X.labelpos==="r")&&(X.width-=X.labeloffset),X.labelpos){case"l":X.x-=X.width/2+X.labeloffset;break;case"r":X.x+=X.width/2+X.labeloffset;break}})}function ne(q){e.forEach(q.edges(),function(H){var X=q.edge(H);X.reversed&&X.points.reverse()})}function G(q){e.forEach(q.nodes(),function(H){if(q.children(H).length){var X=q.node(H),oe=q.node(X.borderTop),ue=q.node(X.borderBottom),se=q.node(e.last(X.borderLeft)),re=q.node(e.last(X.borderRight));X.width=Math.abs(re.x-se.x),X.height=Math.abs(ue.y-oe.y),X.x=se.x+X.width/2,X.y=oe.y+X.height/2}}),e.forEach(q.nodes(),function(H){q.node(H).dummy==="border"&&q.removeNode(H)})}function j(q){e.forEach(q.edges(),function(H){if(H.v===H.w){var X=q.node(H.v);X.selfEdges||(X.selfEdges=[]),X.selfEdges.push({e:H,label:q.edge(H)}),q.removeEdge(H)}})}function K(q){var H=y.buildLayerMatrix(q);e.forEach(H,function(X){var oe=0;e.forEach(X,function(ue,se){var re=q.node(ue);re.order=se+oe,e.forEach(re.selfEdges,function(Ee){y.addDummyNode(q,"selfedge",{width:Ee.label.width,height:Ee.label.height,rank:re.rank,order:se+ ++oe,e:Ee.e,label:Ee.label},"_se")}),delete re.selfEdges})})}function T(q){e.forEach(q.nodes(),function(H){var X=q.node(H);if(X.dummy==="selfedge"){var oe=q.node(X.e.v),ue=oe.x+oe.width/2,se=oe.y,re=X.x-ue,Ee=oe.height/2;q.setEdge(X.e,X.label),q.removeNode(H),X.label.points=[{x:ue+2*re/3,y:se-Ee},{x:ue+5*re/6,y:se-Ee},{x:ue+re,y:se},{x:ue+5*re/6,y:se+Ee},{x:ue+2*re/3,y:se+Ee}],X.label.x=X.x,X.label.y=X.y}})}function z(q,H){return e.mapValues(e.pick(q,H),Number)}function ae(q){var H={};return e.forEach(q,function(X,oe){H[oe.toLowerCase()]=X}),H}return Tv}var Iv,ME;function XO(){if(ME)return Iv;ME=1;var e=Ue(),r=Pt(),i=cn().Graph;Iv={debugOrdering:o};function o(s){var u=r.buildLayerMatrix(s),l=new i({compound:!0,multigraph:!0}).setGraph({});return e.forEach(s.nodes(),function(c){l.setNode(c,{label:c}),l.setParent(c,"layer"+s.node(c).rank)}),e.forEach(s.edges(),function(c){l.setEdge(c.v,c.w,{},c.name)}),e.forEach(u,function(c,d){var p="layer"+d;l.setNode(p,{rank:"same"}),e.reduce(c,function(h,m){return l.setEdge(h,m,{style:"invis"}),m})}),l}return Iv}var Av,PE;function QO(){return PE||(PE=1,Av="0.8.5"),Av}var Mv,qE;function ZO(){return qE||(qE=1,Mv={graphlib:cn(),layout:YO(),debug:XO(),util:{time:Pt().time,notime:Pt().notime},version:QO()}),Mv}var JO=ZO();const OE=tm(JO),LE=240,jE=130,eL=110;function tL(e){var i;return((i=e.data)==null?void 0:i.sessionId)??"_default"}function nL(e,r,i,o){const s=new OE.graphlib.Graph;s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:i,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const u=new Set(e);for(const _ of e){const k=o.get(_);s.setNode(_,{width:(k==null?void 0:k.width)??LE,height:(k==null?void 0:k.height)??jE})}for(const _ of r)u.has(_.source)&&u.has(_.target)&&s.setEdge(_.source,_.target);OE.layout(s);const l=new Map;let c=1/0,d=1/0,p=-1/0,h=-1/0;for(const _ of e){const k=s.node(_);if(!k)continue;const w=o.get(_),x=(w==null?void 0:w.width)??LE,S=(w==null?void 0:w.height)??jE,b=k.x-x/2,N=k.y-S/2;l.set(_,{x:b,y:N}),b<c&&(c=b),N<d&&(d=N),b+x>p&&(p=b+x),N+S>h&&(h=N+S)}if(Number.isFinite(c)&&Number.isFinite(d))for(const[_,k]of l)l.set(_,{x:k.x-c,y:k.y-d});const m=Number.isFinite(p)?p-c:0,y=Number.isFinite(h)?h-d:0;return{positions:l,width:m,height:y}}function DE(e,r,i={}){const o=i.direction??"LR",s=i.pinned??new Map,u=i.measured??new Map,l=new Map;for(const h of e){const m=tL(h),y=l.get(m);y?y.push(h.id):l.set(m,[h.id])}const c=Array.from(l.keys()).sort(),d=new Map;let p=0;for(const h of c){const m=l.get(h),{positions:y,height:_}=nL(m,r,o,u);for(const[k,w]of y)d.set(k,{x:w.x,y:w.y+p});p+=_+eL}return e.map(h=>{const m=s.get(h.id);if(m)return{...h,position:m};const y=d.get(h.id);return y?{...h,position:y}:h})}function Tr(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}function rL(e){return e<1e3?`${e}`:e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(2)}M`}const iL={agent:dP},em=600,oL=9e4;function sL(e,r){var o,s,u;if(!r)return!0;const i=r.toLowerCase();if(e.label.toLowerCase().includes(i)||(o=e.cwd)!=null&&o.toLowerCase().includes(i)||(s=e.cwdBasename)!=null&&s.toLowerCase().includes(i)||e.sessionId.toLowerCase().includes(i)||(u=e.firstPrompt)!=null&&u.toLowerCase().includes(i))return!0;for(const l of e.tools)if(l.name.toLowerCase().includes(i))return!0;return!1}function aL(e,r,i,o,s,u,l,c){const d=[],p=[],h=new Set;if(o)for(const _ of e.agents.values())sL(_,o)&&h.add(_.id);const m=new Set;for(const _ of e.agents.values())_.exitAt!=null&&r-_.exitAt>em||m.add(_.id);for(const _ of e.agents.values()){if(!m.has(_.id))continue;const k=o?!h.has(_.id):!1,w=_.exitAt!=null,x=[k?"rf-dim":"",w?"rf-exiting":""].filter(Boolean).join(" ")||void 0;if(d.push({id:_.id,type:"agent",position:{x:0,y:0},data:{..._,now:r,dim:k},className:x}),_.parentId&&m.has(_.parentId)){const S=_m(_.sessionId),b=_.state==="active"?`hsl(${S} 80% 72%)`:`hsl(${S} 50% 55%)`,N=o&&!h.has(_.id)&&!h.has(_.parentId),C=w;p.push({id:`e:${_.parentId}->${_.id}`,source:_.parentId,target:_.id,animated:_.state==="active"&&!N&&!C,type:"smoothstep",style:{stroke:b,strokeWidth:_.state==="active"?2:1.5,opacity:N||C?.2:1,transition:"opacity 500ms ease"},className:C?"rf-edge-exiting":void 0})}}if(l!==c.current){const _=DE(d,p,{direction:"LR",pinned:i,measured:s});for(const k of _)u.set(k.id,k.position);c.current=l}else if(d.filter(k=>!i.has(k.id)&&!u.has(k.id)).length>0){const k=DE(d,p,{direction:"LR",pinned:i,measured:s});for(const w of k)u.has(w.id)||u.set(w.id,w.position)}return{nodes:d.map(_=>{const k=i.get(_.id)??u.get(_.id)??{x:0,y:0};return{..._,position:k}}),edges:p}}function uL(){return O.jsx(ym,{children:O.jsx(lL,{})})}function lL(){const e=Ga(),r=Y.useRef(Yv()),[,i]=Y.useState(0),o=Y.useCallback(()=>i(se=>se+1),[]),[s,u]=Y.useState(null),[l,c]=Y.useState(null),[d,p]=Y.useState(!1),[h,m]=Y.useState(!1),y=Y.useRef([]),[_,k]=Y.useState(Date.now()),w=Y.useRef(new Map),[x,S]=Y.useState(""),[b,N]=Y.useState(()=>typeof window>"u"?"dark":window.localStorage.getItem("agent-dag.theme")??"dark"),[C,I]=Y.useState(!1),A=Y.useRef(null);Y.useEffect(()=>{document.documentElement.dataset.theme=b;try{window.localStorage.setItem("agent-dag.theme",b)}catch{}},[b]),Y.useEffect(()=>{const se=new EventSource("/events");return se.addEventListener("open",()=>{p(!0),I(!0)}),se.addEventListener("error",()=>p(!1)),se.addEventListener("hook",re=>{try{const Ee=JSON.parse(re.data);if(h){y.current.push(Ee);return}r.current=c1(r.current,Ee),o()}catch{}}),()=>se.close()},[h,o]),Y.useEffect(()=>{if(!h&&y.current.length!==0){for(const se of y.current)r.current=c1(r.current,se);y.current.length=0,o()}},[h,o]),Y.useEffect(()=>{const se=setInterval(()=>{const re=Date.now();k(re),cP(r.current,re,oL)&&o()},250);return()=>clearInterval(se)},[o]);const P=Y.useRef(null),$=Y.useRef(0),L=Y.useRef(""),U=Y.useRef(0),V=Y.useCallback(()=>{U.current=Date.now()},[]);Y.useEffect(()=>{const se=setInterval(()=>{if(Date.now()-U.current<800)return;const re=r.current,Ee=Date.now(),Re=[];for(const he of re.agents.values())he.exitAt!=null&&Ee-he.exitAt>em||Re.push({id:he.id});if(Re.length===0)return;const xe=e.getViewport(),Ce=window.innerWidth-360,ye=window.innerHeight-52;let Le=!1,ve=!1;for(const{id:he}of Re){const Pe=ee.current.get(he),He=w.current.get(he)??F.current.get(he);if(!Pe||!He)continue;ve=!0;const et=He.x*xe.zoom+xe.x,Xe=He.y*xe.zoom+xe.y,je=(He.x+Pe.width)*xe.zoom+xe.x,tt=(He.y+Pe.height)*xe.zoom+xe.y;if(je>0&&et<Ce&&tt>0&&Xe<ye){Le=!0;break}}if(ve&&!Le)try{e.fitView({padding:.25,duration:600})}catch{}},1500);return()=>clearInterval(se)},[e]);const ee=Y.useRef(new Map),Z=Y.useRef(0),R=Y.useCallback(se=>{const re=ee.current;let Ee=!1;for(const Re of se.nodeInternals.values()){const xe=Re.width,Ce=Re.height;if(xe==null||Ce==null)continue;const ye=re.get(Re.id);ye?(Math.abs(ye.height-Ce)>4||Math.abs(ye.width-xe)>4)&&(re.set(Re.id,{width:xe,height:Ce}),Ee=!0):(re.set(Re.id,{width:xe,height:Ce}),Ee=!0)}return Ee&&(Z.current+=1),Z.current},[]),W=Oe(R),F=Y.useRef(new Map),ne=Y.useRef(""),G=Y.useMemo(()=>{const se=[];for(const re of r.current.agents.values())re.exitAt!=null&&_-re.exitAt>em||se.push(re.id+(re.parentId?`>${re.parentId}`:""));return se.sort(),`${se.join("|")}#sv${W}`},[r.current,r.current.lastSeq,_,W]);Y.useEffect(()=>{if(L.current===G)return;const se=L.current;if(L.current=G,!se)return;const re=Date.now();if(re-$.current>1200){try{e.fitView({padding:.25,duration:400})}catch{}$.current=re}P.current&&window.clearTimeout(P.current),P.current=window.setTimeout(()=>{try{e.fitView({padding:.25,duration:500})}catch{}$.current=Date.now()},280)},[G,e]);const{nodes:j,edges:K}=Y.useMemo(()=>aL(r.current,_,w.current,x,ee.current,F.current,G,ne),[r.current,r.current.lastSeq,_,x,G]),T=s?r.current.agents.get(s):null,z=l?Array.from(r.current.agents.values()).flatMap(se=>se.tools).find(se=>se.id===l)??null:null,ae=Y.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}r.current=Yv(),w.current.clear(),ee.current.clear(),F.current.clear(),ne.current="",u(null),o()},[o]),q=Y.useCallback(()=>{w.current.clear(),F.current.clear(),ne.current="",o(),window.setTimeout(()=>{try{e.fitView({padding:.25,duration:500})}catch{}$.current=Date.now()},80)},[o,e]),H=Y.useCallback(()=>{try{e.fitView({padding:.25,duration:500})}catch{}$.current=Date.now()},[e]);Y.useEffect(()=>{const se=re=>{var Re,xe;const Ee=((Re=re.target)==null?void 0:Re.tagName)==="INPUT";if(re.key==="Escape"){Ee?re.target.blur():u(null);return}if(!Ee){if(re.key==="/"){re.preventDefault(),(xe=A.current)==null||xe.focus();return}re.key===" "&&(re.preventDefault(),m(Ce=>!Ce)),(re.key==="c"||re.key==="C")&&ae(),(re.key==="r"||re.key==="R")&&q(),(re.key==="f"||re.key==="F")&&H(),(re.key==="t"||re.key==="T")&&N(Ce=>Ce==="dark"?"light":"dark")}};return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[ae,q,H]);const X=r.current.agents.size,oe=new Set(Array.from(r.current.agents.values()).map(se=>se.sessionId)).size,ue=Y.useMemo(()=>{let se=0,re=0,Ee=0,Re=0;for(const xe of r.current.agents.values())se+=xe.usage.inputTokens,re+=xe.usage.outputTokens,Ee+=xe.usage.cacheReadTokens,Re+=xe.usage.cacheCreateTokens;return{inT:se,outT:re,cacheR:Ee,cacheC:Re,sum:se+re}},[r.current,r.current.lastSeq]);return O.jsxs("div",{className:"app",children:[O.jsxs("header",{className:"topbar",children:[O.jsxs("div",{className:"brand",children:[O.jsx("span",{className:"logo"}),"agent-dag ",O.jsxs("span",{className:"v",children:["v","1.3.3"]})]}),O.jsxs("div",{className:"actions",children:[O.jsxs("div",{className:"search",children:[O.jsx("span",{className:"search-icon","aria-hidden":!0,children:"⌕"}),O.jsx("input",{ref:A,type:"text",placeholder:"Search agents, cwd, tools…",value:x,onChange:se=>S(se.target.value),spellCheck:!1,"aria-label":"Filter the graph"}),x?O.jsx("button",{className:"search-clear","aria-label":"Clear search",onClick:()=>S(""),children:"×"}):O.jsx("kbd",{className:"search-kbd","aria-hidden":!0,children:"/"})]}),O.jsxs("span",{className:"status",role:"status",children:[O.jsx("span",{className:`pill ${d?"live":"dead"}`,title:d?"Receiving events":"SSE disconnected",children:d?"live":"offline"}),O.jsxs("span",{className:"stat",title:"Distinct CC sessions",children:[O.jsx("span",{className:"count",children:oe}),O.jsx("span",{className:"lbl",children:"sessions"})]}),O.jsxs("span",{className:"stat",title:"Total agents (root + subagents)",children:[O.jsx("span",{className:"count",children:X}),O.jsx("span",{className:"lbl",children:"agents"})]}),O.jsxs("span",{className:"stat",title:"Total hook events received",children:[O.jsx("span",{className:"count",children:r.current.totalEvents}),O.jsx("span",{className:"lbl",children:"events"})]}),ue.sum>0&&O.jsxs("span",{className:"stat",title:`in:${ue.inT.toLocaleString()} out:${ue.outT.toLocaleString()} cache-r:${ue.cacheR.toLocaleString()} cache-c:${ue.cacheC.toLocaleString()}`,children:[O.jsx("span",{className:"count",children:rL(ue.sum)}),O.jsx("span",{className:"lbl",children:"tokens"})]})]}),O.jsx("button",{className:`btn ${h?"warn":""}`,onClick:()=>m(se=>!se),title:"Pause/resume live updates (Space)",children:h?`Resume${y.current.length?` · ${y.current.length}`:""}`:"Pause"}),O.jsx("button",{className:"btn",onClick:q,title:"Auto-arrange — clear pins (R)",children:"Re-layout"}),O.jsx("button",{className:"btn",onClick:ae,title:"Clear canvas (C)",children:"Clear"}),O.jsx("button",{className:"btn icon-btn",onClick:()=>N(se=>se==="dark"?"light":"dark"),title:`Switch to ${b==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:b==="dark"?"☀":"☾"})]})]}),C&&!d&&O.jsxs("div",{className:"conn-banner",role:"alert",children:[O.jsx("span",{className:"conn-dot"}),"Lost connection to agent-dag server. Reconnecting…"]}),O.jsxs("div",{className:"canvas-wrap",children:[X===0&&O.jsx(cL,{live:d,everConnected:C}),O.jsxs(rb,{nodes:j,edges:K,nodeTypes:iL,fitView:!0,fitViewOptions:{padding:.25,duration:400},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,onNodeClick:(se,re)=>u(re.id),onPaneClick:()=>u(null),onMove:V,onNodeDragStart:(se,re)=>{V(),w.current.set(re.id,{x:re.position.x,y:re.position.y})},onNodeDrag:(se,re)=>{V(),w.current.set(re.id,{x:re.position.x,y:re.position.y}),F.current.set(re.id,{x:re.position.x,y:re.position.y})},onNodeDragStop:(se,re)=>{V(),w.current.set(re.id,{x:re.position.x,y:re.position.y}),F.current.set(re.id,{x:re.position.x,y:re.position.y})},children:[O.jsx(sP,{gap:28,size:1,color:Tr("--grid-line")}),O.jsx(SP,{}),O.jsx(jP,{agents:r.current.agents,positions:F.current,pinned:w.current,measured:ee.current,now:_,onOpenTool:c}),O.jsx(eP,{showInteractive:!1}),O.jsx(WM,{zoomable:!0,pannable:!0,nodeColor:se=>{const re=se.data;return re.state==="err"?Tr("--err"):re.state==="active"?Tr("--inflight"):Tr("--ok")},nodeStrokeWidth:2,maskColor:Tr("--minimap-mask"),style:{background:Tr("--panel"),border:`1px solid ${Tr("--line")}`,borderRadius:8}})]})]}),O.jsx("aside",{className:"detail",children:T?O.jsx(hL,{agent:T,now:_,onOpenTool:c}):O.jsx(dL,{count:X})}),z&&O.jsx(yP,{tool:z,onClose:()=>c(null)})]})}function cL({live:e,everConnected:r}){const i=!e;return O.jsxs("div",{className:"empty-hero",children:[O.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[O.jsx("div",{className:"core"}),O.jsxs("div",{className:"orbit r1",children:[O.jsx("span",{className:"dot"}),O.jsx("span",{className:"dot b"})]}),O.jsxs("div",{className:"orbit r2",children:[O.jsx("span",{className:"dot"}),O.jsx("span",{className:"dot b"})]}),O.jsxs("div",{className:"orbit r3",children:[O.jsx("span",{className:"dot"}),O.jsx("span",{className:"dot b"})]})]}),i?O.jsxs(O.Fragment,{children:[O.jsx("h2",{children:r?"Disconnected from server":"Server unreachable"}),O.jsxs("p",{children:["The browser cannot reach ",O.jsx("code",{children:"/events"}),". Check that",O.jsx("code",{children:"agent-dag"})," is still running in your terminal, then this page will resume automatically."]})]}):fL()]})}function fL(){return O.jsxs(O.Fragment,{children:[O.jsx("h2",{children:"Waiting for Claude Code"}),O.jsxs("p",{children:["Run ",O.jsx("code",{children:"claude"})," in any folder. As soon as a session sends an event, a node appears here and grows as subagents fork and tools are called."]}),O.jsxs("p",{className:"hint-row",children:["Not seeing anything? Make sure ",O.jsx("code",{children:"agent-dag"})," is running and that the hook is installed in ",O.jsx("code",{children:"~/.claude/settings.json"}),"."]})]})}function dL({count:e}){return O.jsxs(O.Fragment,{children:[O.jsx("h3",{children:"Detail"}),e===0?O.jsxs("div",{className:"hint",children:["No data yet. Start a Claude Code session anywhere on this machine — agent-dag is in ",O.jsx("code",{children:"--all"})," mode and listens to every workspace."]}):O.jsx("div",{className:"empty",children:"Click an agent to see its tools."}),O.jsx("h3",{style:{marginTop:4},children:"Shortcuts"}),O.jsxs("div",{className:"shortcuts",children:[O.jsxs("div",{className:"sc",children:[O.jsx("kbd",{children:"drag"}),O.jsx("span",{children:"move a node"})]}),O.jsxs("div",{className:"sc",children:[O.jsx("kbd",{children:"/"}),O.jsx("span",{children:"focus search"})]}),O.jsxs("div",{className:"sc",children:[O.jsx("kbd",{children:"space"}),O.jsx("span",{children:"pause / resume"})]}),O.jsxs("div",{className:"sc",children:[O.jsx("kbd",{children:"R"}),O.jsx("span",{children:"re-arrange"})]}),O.jsxs("div",{className:"sc",children:[O.jsx("kbd",{children:"F"}),O.jsx("span",{children:"fit view"})]}),O.jsxs("div",{className:"sc",children:[O.jsx("kbd",{children:"C"}),O.jsx("span",{children:"clear canvas"})]}),O.jsxs("div",{className:"sc",children:[O.jsx("kbd",{children:"T"}),O.jsx("span",{children:"toggle theme"})]}),O.jsxs("div",{className:"sc",children:[O.jsx("kbd",{children:"Esc"}),O.jsx("span",{children:"deselect"})]})]})]})}function hL({agent:e,now:r,onOpenTool:i}){const o=Math.max(0,Math.floor(((e.endedAt??r)-e.startedAt)/1e3));return O.jsxs(O.Fragment,{children:[O.jsx("h3",{children:e.label}),O.jsxs("div",{children:[O.jsxs("div",{className:"row",children:[O.jsx("span",{className:"k",children:"kind"}),O.jsx("span",{className:"v",children:e.kind})]}),O.jsxs("div",{className:"row",children:[O.jsx("span",{className:"k",children:"state"}),O.jsx("span",{className:"v",children:e.state})]}),O.jsxs("div",{className:"row",children:[O.jsx("span",{className:"k",children:"elapsed"}),O.jsxs("span",{className:"v",children:[o,"s"]})]}),O.jsxs("div",{className:"row",children:[O.jsx("span",{className:"k",children:"tools"}),O.jsx("span",{className:"v",children:e.toolCount})]}),e.cwd&&O.jsxs("div",{className:"row",children:[O.jsx("span",{className:"k",children:"cwd"}),O.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),O.jsxs("div",{className:"row",children:[O.jsx("span",{className:"k",children:"session"}),O.jsxs("span",{className:"v",children:[e.sessionId.slice(0,8),"…"]})]})]}),e.usage.inputTokens+e.usage.outputTokens>0&&O.jsxs(O.Fragment,{children:[O.jsx("h3",{children:"Tokens"}),O.jsxs("div",{className:"tokens-grid",children:[O.jsxs("div",{children:[O.jsx("span",{className:"k",children:"in"}),O.jsx("b",{children:e.usage.inputTokens.toLocaleString()})]}),O.jsxs("div",{children:[O.jsx("span",{className:"k",children:"out"}),O.jsx("b",{children:e.usage.outputTokens.toLocaleString()})]}),O.jsxs("div",{children:[O.jsx("span",{className:"k",children:"cache r"}),O.jsx("b",{children:e.usage.cacheReadTokens.toLocaleString()})]}),O.jsxs("div",{children:[O.jsx("span",{className:"k",children:"cache c"}),O.jsx("b",{children:e.usage.cacheCreateTokens.toLocaleString()})]})]})]}),e.prompts.length>0&&O.jsxs(O.Fragment,{children:[O.jsxs("h3",{children:["Prompts (",e.prompts.length,")"]}),O.jsx("div",{className:"prompts",children:e.prompts.map((s,u)=>O.jsxs("div",{className:"prompt-entry",children:[O.jsx("div",{className:"prompt-time",children:new Date(s.at).toLocaleTimeString()}),O.jsx("div",{className:"prompt-text",children:s.text})]},u))})]}),O.jsxs("h3",{children:["Tool calls (",e.tools.length,")"]}),e.tools.length===0&&O.jsx("div",{className:"empty",children:"No tool calls yet."}),O.jsx("div",{children:e.tools.slice().reverse().map(s=>O.jsx(pL,{t:s,now:r,onClick:()=>i(s.id)},s.id))})]})}function pL({t:e,now:r,onClick:i}){const o=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=(e.endedAt??r)-e.startedAt,u=e.endedAt==null?"…":s<1e3?`${s}ms`:`${(s/1e3).toFixed(1)}s`;return O.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:i,children:[O.jsxs("span",{className:"name",children:[O.jsx("span",{className:`status-dot ${o}`}),e.name]}),O.jsx("span",{style:{color:"var(--muted)"},children:u})]})}const vL=o2.createRoot(document.getElementById("root"));vL.render(O.jsx(uL,{}));
|
|
57
|
+
M${P.x},${P.y}h${P.width}v${P.height}h${-P.width}z`,fill:d,fillRule:"evenodd",stroke:p,strokeWidth:h,pointerEvents:"none"})))}sb.displayName="MiniMap";var WM=Y.memo(sb);function KM(){return ie.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},ie.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function YM(){return ie.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},ie.createElement("path",{d:"M0 0h32v4.2H0z"}))}function XM(){return ie.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},ie.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function QM(){return ie.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ie.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function ZM(){return ie.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ie.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const ko=({children:e,className:r,...i})=>ie.createElement("button",{type:"button",className:pt(["react-flow__controls-button",r]),...i},e);ko.displayName="ControlButton";const JM=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),ab=({style:e,showZoom:r=!0,showFitView:i=!0,showInteractive:o=!0,fitViewOptions:s,onZoomIn:u,onZoomOut:l,onFitView:c,onInteractiveChange:d,className:p,children:h,position:m="bottom-left"})=>{const y=st(),[_,k]=Y.useState(!1),{isInteractive:w,minZoomReached:x,maxZoomReached:S}=Oe(JM,ot),{zoomIn:b,zoomOut:N,fitView:C}=Ga();if(Y.useEffect(()=>{k(!0)},[]),!_)return null;const I=()=>{b(),u==null||u()},A=()=>{N(),l==null||l()},P=()=>{C(s),c==null||c()},$=()=>{y.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),d==null||d(!w)};return ie.createElement(um,{className:pt(["react-flow__controls",p]),position:m,style:e,"data-testid":"rf__controls"},r&&ie.createElement(ie.Fragment,null,ie.createElement(ko,{onClick:I,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:S},ie.createElement(KM,null)),ie.createElement(ko,{onClick:A,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:x},ie.createElement(YM,null))),i&&ie.createElement(ko,{className:"react-flow__controls-fitview",onClick:P,title:"fit view","aria-label":"fit view"},ie.createElement(XM,null)),o&&ie.createElement(ko,{className:"react-flow__controls-interactive",onClick:$,title:"toggle interactivity","aria-label":"toggle interactivity"},w?ie.createElement(ZM,null):ie.createElement(QM,null)),h)};ab.displayName="Controls";var eP=Y.memo(ab),ln;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ln||(ln={}));function tP({color:e,dimensions:r,lineWidth:i}){return ie.createElement("path",{stroke:e,strokeWidth:i,d:`M${r[0]/2} 0 V${r[1]} M0 ${r[1]/2} H${r[0]}`})}function nP({color:e,radius:r}){return ie.createElement("circle",{cx:r,cy:r,r,fill:e})}const rP={[ln.Dots]:"#91919a",[ln.Lines]:"#eee",[ln.Cross]:"#e2e2e2"},iP={[ln.Dots]:1,[ln.Lines]:1,[ln.Cross]:6},oP=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function ub({id:e,variant:r=ln.Dots,gap:i=20,size:o,lineWidth:s=1,offset:u=2,color:l,style:c,className:d}){const p=Y.useRef(null),{transform:h,patternId:m}=Oe(oP,ot),y=l||rP[r],_=o||iP[r],k=r===ln.Dots,w=r===ln.Cross,x=Array.isArray(i)?i:[i,i],S=[x[0]*h[2]||1,x[1]*h[2]||1],b=_*h[2],N=w?[b,b]:S,C=k?[b/u,b/u]:[N[0]/u,N[1]/u];return ie.createElement("svg",{className:pt(["react-flow__background",d]),style:{...c,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},ie.createElement("pattern",{id:m+e,x:h[0]%S[0],y:h[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`},k?ie.createElement(nP,{color:y,radius:b/u}):ie.createElement(tP,{dimensions:N,color:y,lineWidth:s})),ie.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}ub.displayName="Background";var sP=Y.memo(ub);function lb(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function cb(e,r=0){if(!e||typeof e!="object"||r>6)return null;const i=e;if(typeof i.input_tokens=="number"||typeof i.output_tokens=="number"||typeof i.cache_read_input_tokens=="number"||typeof i.cache_creation_input_tokens=="number")return{inputTokens:Number(i.input_tokens??0),outputTokens:Number(i.output_tokens??0),cacheReadTokens:Number(i.cache_read_input_tokens??0),cacheCreateTokens:Number(i.cache_creation_input_tokens??0)};for(const o of Object.values(i)){const s=cb(o,r+1);if(s)return s}return null}function aP(e,r){e.inputTokens+=r.inputTokens,e.outputTokens+=r.outputTokens,e.cacheReadTokens+=r.cacheReadTokens,e.cacheCreateTokens+=r.cacheCreateTokens}function fb(e,r=0){if(!e||typeof e!="object"||r>6)return null;const i=e;if(typeof i.model=="string"&&/^claude[-_]/i.test(i.model))return i.model;for(const o of Object.values(i)){const s=fb(o,r+1);if(s)return s}return null}function Yv(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,totalEvents:0}}function Or(e){if(!e)return;const r=e.replace(/\\/g,"/").split("/").filter(Boolean);return r[r.length-1]}function db(e,r){return`${e}::${r}`}function Xv(e){return e.agent_type??e.subagent_type??"subagent"}function Qv(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function To(e,r,i,o){const s=r;let u=e.agents.get(s);return u||(u={id:s,sessionId:r,label:"session",kind:"root",state:"active",startedAt:i,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:o,inFlightTool:null,usage:lb()},e.agents.set(s,u),u)}function l1(e,r,i){const o=r.session_id??"unknown",s=Qv(r);if(s)return Zv(e,o,s,r,i);const u=e.activeSubagentStack.get(o),l=u&&u.length>0?u[u.length-1]:null;if(l){const d=e.agents.get(db(o,l));if(d)return!d.cwd&&r.cwd&&(d.cwd=r.cwd,d.cwdBasename=Or(r.cwd)),d}const c=To(e,o,i,!1);return c.synthetic&&(c.synthetic=!1,c.startedAt=i),!c.cwd&&r.cwd&&(c.cwd=r.cwd,c.cwdBasename=Or(r.cwd)),c.label==="session"&&r.cwd&&(c.label=Or(r.cwd)??"session"),c}function Zv(e,r,i,o,s){const u=db(r,i),l=To(e,r,s,!0);let c=e.agents.get(u);if(c){!c.cwd&&o.cwd&&(c.cwd=o.cwd,c.cwdBasename=Or(o.cwd));const d=Xv(o);return d&&(c.label==="subagent"||!c.label)&&(c.label=d),c}return c={id:u,sessionId:r,label:Xv(o),kind:"subagent",parentId:l.id,state:"active",startedAt:s,tools:[],prompts:[],cwd:o.cwd,cwdBasename:Or(o.cwd),toolCount:0,childCount:0,inFlightTool:null,usage:lb()},e.agents.set(u,c),l.childCount+=1,c}function uP(e,r,i){const o=e.activeSubagentStack.get(r)??[];o.push(i),e.activeSubagentStack.set(r,o)}function lP(e,r,i){const o=e.activeSubagentStack.get(r);if(o){for(let s=o.length-1;s>=0;s--)if(o[s]===i){o.splice(s,1);break}o.length===0&&e.activeSubagentStack.delete(r)}}function pc(e,r=80){if(e==null)return"";if(typeof e=="string")return e.length>r?e.slice(0,r-1)+"…":e;try{const i=JSON.stringify(e);return i.length>r?i.slice(0,r-1)+"…":i}catch{return String(e)}}function bo(e){let r=null;for(let i=e.tools.length-1;i>=0;i--){const o=e.tools[i];if(o.endedAt==null){r=o;break}}e.inFlightTool=r}function cP(e,r,i){let o=!1;for(const s of e.agents.values()){let u=!1;for(const l of s.tools)l.endedAt==null&&r-l.startedAt>i&&(l.endedAt=l.startedAt+i,l.ok=!1,l.errorPreview="stale (no PostToolUse received)",e.toolIndex.delete(l.id),e.toolOwner.delete(l.id),u=!0,o=!0);u&&bo(s)}return o}function c1(e,r){if(r.seq<=e.lastSeq)return e;const i=r.payload??{},o=r.receivedAt,s=i.hook_event_name??"Unknown";if(s==="__clear")return{...Yv(),lastSeq:r.seq};e.totalEvents+=1,e.lastSeq=r.seq;const u=i.session_id??"unknown",l=l1(e,i,o),c=fb(i);switch(c&&(l.model=c),s){case"SessionStart":{const d=To(e,u,o,!1);d.synthetic=!1,d.state="active",d.startedAt=d.startedAt||o,!d.cwd&&i.cwd&&(d.cwd=i.cwd,d.cwdBasename=Or(i.cwd)),d.label==="session"&&i.cwd&&(d.label=Or(i.cwd)??"session");break}case"UserPromptSubmit":{for(const m of e.agents.values())m.sessionId===u&&m.kind==="subagent"&&m.state==="done"&&m.exitAt==null&&(m.exitAt=o);const d=To(e,u,o,!1);d.state="active",d.endedAt=void 0;const p=l1(e,i,o);p.state="active";const h=(typeof i.prompt=="string"?i.prompt:typeof i.message=="string"?i.message:"")??"";h&&(p.prompts.push({at:o,text:h}),p.firstPrompt||(p.firstPrompt=pc(h,120)));break}case"PreToolUse":{const d=i.tool_use_id??`${l.id}:${l.toolCount}`,p={id:d,name:i.tool_name??"?",input:i.tool_input,inputPreview:pc(i.tool_input),agentId:l.id,startedAt:o};l.tools.push(p),l.toolCount+=1,l.state="active",e.toolIndex.set(d,p),e.toolOwner.set(d,l.id),bo(l);break}case"PostToolUse":case"PostToolUseFailure":{const d=i.tool_use_id,p=d?e.toolIndex.get(d):void 0;if(p){p.endedAt=o,p.ok=s==="PostToolUse",p.response=i.tool_response,s==="PostToolUseFailure"&&(p.errorPreview=pc(i.tool_response));const h=cb(i.tool_response);h&&(p.usage=h),e.toolIndex.delete(d);const m=e.toolOwner.get(d);if(e.toolOwner.delete(d),m){const y=e.agents.get(m);y&&(h&&aP(y.usage,h),bo(y))}}break}case"SubagentStart":{const d=Qv(i);if(!d)break;const p=Zv(e,u,d,i,o);p.state="active",p.startedAt=p.startedAt||o;const h=Xv(i);h&&(p.label=h),uP(e,u,d);break}case"SubagentStop":{const d=Qv(i);if(!d)break;const p=Zv(e,u,d,i,o);p.state="done",p.endedAt=o,bo(p),lP(e,u,d);break}case"Stop":case"SessionEnd":{const d=To(e,u,o,!1);d.state="done",d.endedAt=o,bo(d);break}}return e}function _m(e){let r=5381;for(let i=0;i<e.length;i++)r=(r<<5)+r^e.charCodeAt(i);return Math.abs(r)%360}function fP(e,r,i){const o=(r??i)-e;if(o<1e3)return`${Math.max(0,o)}ms`;const s=Math.floor(o/1e3);if(s<60)return`${s}s`;const u=Math.floor(s/60),l=s%60;return`${u}m ${String(l).padStart(2,"0")}s`}function dP({data:e,selected:r}){const i=e.now??Date.now(),o=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",r?"selected":""].filter(Boolean).join(" "),s=e.tools.filter(c=>!c.endedAt).length,l=`hsl(${_m(e.sessionId)} 70% 60%)`;return O.jsxs("div",{className:o,style:{"--accent":l},children:[O.jsx("span",{className:"accent-stripe"}),O.jsx(bi,{type:"target",position:Se.Left,style:{background:"transparent",border:"none"}}),O.jsxs("div",{className:"head",children:[O.jsxs("div",{className:"title",children:[O.jsx(hP,{state:e.state}),O.jsx("span",{className:"label",title:e.cwd,children:e.label}),e.synthetic&&O.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"})]}),O.jsx("div",{className:"time",title:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:fP(e.startedAt,e.endedAt,i)})]}),O.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&O.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model&&O.jsx("span",{className:"model-chip",title:e.model,children:mP(e.model)})]}),e.tools.length>0&&O.jsx(vP,{tools:e.tools,now:i}),O.jsxs("div",{className:"meta",children:[O.jsxs("span",{children:[O.jsx("b",{children:e.toolCount})," tools"]}),s>0&&O.jsxs("span",{className:"inflight-meta",children:[O.jsx("b",{children:s})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&O.jsxs("span",{className:"tokens-meta",title:`in:${e.usage.inputTokens} out:${e.usage.outputTokens} cache-r:${e.usage.cacheReadTokens} cache-c:${e.usage.cacheCreateTokens}`,children:[O.jsx("b",{children:pP(e.usage.inputTokens+e.usage.outputTokens)})," tok"]})]}),O.jsx(bi,{type:"source",position:Se.Right,style:{background:"transparent",border:"none"}})]})}function hP({state:e}){const r=e==="active"?"live":e==="done"?"done":"err";return O.jsx("span",{className:`state-pill state-${e}`,children:r})}function pP(e){return e<1e3?`${e}`:e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(2)}M`}function vP({tools:e,now:r}){const u=new Array(24).fill(0);let l=0;for(const y of e){const _=r-y.startedAt;if(_<0||_>=6e4)continue;const k=23-Math.floor(_/2500);k>=0&&k<24&&(u[k]+=1,l+=1)}const c=Math.max(1,...u),d=132,p=14,h=d/24,m=c/(2500/1e3);return O.jsxs("div",{className:"tool-spark-row",title:`${l} tool calls in last 60s · peak ${m.toFixed(1)}/s`,children:[O.jsx("svg",{className:"tool-spark",width:d,height:p,viewBox:`0 0 ${d} ${p}`,"aria-hidden":!0,children:u.map((y,_)=>{const k=y===0?1.5:Math.max(1.5,y/c*p),w=_===23&&y>0,S=`tool-spark-bar${y>0?" active":""}${w?" latest":""}`;return O.jsx("rect",{x:_*h+.4,y:p-k,width:Math.max(.5,h-1),height:k,rx:.8,className:S},_)})}),O.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function mP(e){const r=e.match(/^claude[-_](opus|sonnet|haiku|fable)[-_](\d+(?:[-_.]\d+)*)/i);if(!r)return e;const i=r[1][0].toUpperCase()+r[1].slice(1).toLowerCase(),o=r[2].replace(/[-_]/g,".");return`${i} ${o}`}function f1(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function gP(e){if(e.endedAt==null)return"in-flight…";const r=e.endedAt-e.startedAt;return r<1e3?`${r}ms`:`${(r/1e3).toFixed(2)}s`}function yP({tool:e,onClose:r}){Y.useEffect(()=>{const o=s=>{s.key==="Escape"&&r()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[r]);const i=e.endedAt==null?"inflight":e.ok===!1?"err":"done";return O.jsx("div",{className:"modal-backdrop",onClick:r,role:"dialog","aria-modal":"true",children:O.jsxs("div",{className:"modal",onClick:o=>o.stopPropagation(),children:[O.jsxs("header",{className:"modal-head",children:[O.jsxs("div",{className:"modal-title",children:[O.jsx("span",{className:`status-dot ${i}`}),O.jsx("span",{className:"modal-tool-name",children:e.name}),O.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),O.jsxs("div",{className:"modal-actions",children:[O.jsx("span",{className:"modal-dur",children:gP(e)}),O.jsx("button",{className:"btn icon-btn",onClick:r,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),O.jsxs("section",{className:"modal-body",children:[O.jsxs("div",{className:"modal-section",children:[O.jsx("h4",{children:"Input"}),O.jsx("pre",{children:f1(e.input??e.inputPreview)})]}),O.jsxs("div",{className:"modal-section",children:[O.jsxs("h4",{children:["Response ",i==="err"&&O.jsx("span",{className:"err-tag",children:"error"})]}),O.jsx("pre",{children:e.endedAt==null?"(waiting…)":f1(e.response??e.errorPreview)})]})]})]})})}const Ea=18,d1=26,_P=12;function wP(e){const r=new Map;for(const s of e.nodeInternals.values()){const u=s.data;if(!(u!=null&&u.sessionId)||u.exitAt!=null||s.width==null||s.height==null)continue;const l=s.position.x,c=s.position.y,d=l+s.width,p=c+s.height,h=r.get(u.sessionId);h?(h.minX=Math.min(h.minX,l),h.minY=Math.min(h.minY,c),h.maxX=Math.max(h.maxX,d),h.maxY=Math.max(h.maxY,p),u.kind==="root"&&(h.label=h1(u)??h.label)):r.set(u.sessionId,{minX:l,minY:c,maxX:d,maxY:p,label:h1(u)??u.sessionId})}const i=new Map;for(const s of r.values())i.set(s.label,(i.get(s.label)??0)+1);const o=[];for(const[s,u]of r){const c=(i.get(u.label)??0)>1?`${u.label} · ${xP(s)}`:u.label;o.push({sessionId:s,label:c,x:u.minX-Ea,y:u.minY-Ea-d1,w:u.maxX-u.minX+Ea*2,h:u.maxY-u.minY+Ea*2+d1})}return o}function xP(e){const r=e.match(/[a-zA-Z0-9]{4}/);return r?r[0]:e.slice(0,4)}function h1(e){if(e.kind==="root")return e.label}function SP(){const{x:e,y:r,zoom:i}=ib(),o=Oe(wP,EP);return o.length<=1?null:O.jsx("div",{className:"session-clusters","aria-hidden":!0,children:o.map(s=>{const u=_m(s.sessionId),l={position:"absolute",left:s.x*i+e,top:s.y*i+r,width:s.w*i,height:s.h*i,borderColor:`hsl(${u} 65% 55% / 0.32)`,background:`hsl(${u} 70% 50% / 0.04)`},c={position:"absolute",left:s.x*i+e+16*i,top:(s.y-_P)*i+r,color:`hsl(${u} 70% 78%)`,borderColor:`hsl(${u} 65% 55% / 0.5)`,transform:`scale(${Math.min(1,i)})`,transformOrigin:"left top"};return O.jsxs(ie.Fragment,{children:[O.jsx("div",{className:"cluster-card",style:l}),O.jsx("div",{className:"cluster-label",style:c,children:s.label})]},s.sessionId)})})}function EP(e,r){if(e.length!==r.length)return!1;for(let i=0;i<e.length;i++){const o=e[i],s=r[i];if(o.sessionId!==s.sessionId||o.label!==s.label||o.x!==s.x||o.y!==s.y||o.w!==s.w||o.h!==s.h)return!1}return!0}const Jv=4e3,hb=600,kP=44,Ra=16,bP=52,p1=96,CP=28,NP={Read:"file",Write:"file",Edit:"file",MultiEdit:"file",Glob:"file",Grep:"file",LS:"file",NotebookEdit:"file",Bash:"shell",PowerShell:"shell",WebFetch:"web",WebSearch:"web",Task:"agent",Agent:"agent",TodoWrite:"task",TaskCreate:"task",TaskUpdate:"task",TaskList:"task",TaskGet:"task",TaskOutput:"task",TaskStop:"task",EnterPlanMode:"plan",ExitPlanMode:"plan",AskUserQuestion:"plan",Skill:"plan",Workflow:"plan",ScheduleWakeup:"other",CronCreate:"other",CronList:"other",CronDelete:"other",Monitor:"other",PushNotification:"other",RemoteTrigger:"other",ToolSearch:"other"};function RP(e){return e.startsWith("mcp__")?"mcp":NP[e]??"other"}const TP={Read:"📖",Write:"💾",Edit:"✏️",MultiEdit:"🔧",Glob:"🗺️",Grep:"🔎",Bash:"⚡",PowerShell:"💻",LS:"📂",Task:"🤖",Agent:"🤖",TodoWrite:"📋",TaskCreate:"📋",TaskUpdate:"📝",TaskList:"🗂️",TaskGet:"🗂️",TaskOutput:"📤",TaskStop:"🛑",WebFetch:"🌐",WebSearch:"🔭",ToolSearch:"🧰",NotebookEdit:"📓",EnterPlanMode:"🧭",ExitPlanMode:"🏁",AskUserQuestion:"❓",ScheduleWakeup:"⏰",CronCreate:"⏰",CronList:"📅",CronDelete:"🗑️",Skill:"🎯",Workflow:"🎬",Monitor:"📡",PushNotification:"🔔",RemoteTrigger:"📡",WebFetch_:"🌐"};function IP(e){return e.startsWith("mcp__")?"🔌":TP[e]??"✨"}const AP={git:"🐙",gh:"🐙",glab:"🐙",npm:"📦",pnpm:"📦",yarn:"📦",bun:"📦",brew:"🍺",node:"🟢",deno:"🟢",python:"🐍",python3:"🐍",py:"🐍",pip:"🐍",pip3:"🐍",uv:"🐍",ruby:"💎",bundle:"💎",gem:"💎",cargo:"🦀",rustc:"🦀",rustup:"🦀",go:"🐹",docker:"🐳","docker-compose":"🐳",podman:"🐳",kubectl:"☸️",helm:"☸️",k9s:"☸️",grep:"🔎",rg:"🔎",ag:"🔎",ack:"🔎",find:"🔍",fd:"🔍",locate:"🔍",which:"🔍",ls:"📂",dir:"📂",tree:"📂",cat:"📄",head:"📄",tail:"📄",less:"📄",more:"📄",bat:"📄",cp:"📋",mv:"✂️",rm:"🗑️",rmdir:"🗑️",mkdir:"📁",touch:"📁",sed:"✏️",awk:"✏️",tr:"✏️",curl:"🌐",wget:"🌐",http:"🌐",httpie:"🌐",ssh:"🔐",scp:"🔐",rsync:"🔐",ping:"📡",make:"🔨",cmake:"🔨",ninja:"🔨",bazel:"🔨",just:"🔨",terraform:"🏗️",ansible:"📕",pulumi:"🏗️",ps:"📊",top:"📊",htop:"📊",btm:"📊",kill:"💀",pkill:"💀",systemctl:"⚙️",service:"⚙️",tar:"🗜️",zip:"🗜️",unzip:"🗜️",gzip:"🗜️","7z":"🗜️",vim:"📝",nvim:"📝",nano:"📝",emacs:"📝",code:"📝",jq:"🪺",yq:"🪺",echo:"💬",printf:"💬",ffmpeg:"🎞️",ffprobe:"🎞️",imagemagick:"🖼️",convert:"🖼️","Get-ChildItem":"📂","Get-Content":"📄","Set-Content":"💾","Out-File":"💾","Add-Content":"💾","Set-Location":"📍","Get-Location":"📍","Get-Process":"📊","Start-Process":"▶️","Stop-Process":"💀","Invoke-WebRequest":"🌐","Invoke-RestMethod":"🌐","New-Item":"📁","Remove-Item":"🗑️","Copy-Item":"📋","Move-Item":"✂️","Test-Path":"🔍","Where-Object":"🔎","ForEach-Object":"🔁","Select-Object":"🎯","Measure-Object":"📊","Get-Service":"⚙️","Restart-Service":"⚙️","ConvertTo-Json":"🪺","ConvertFrom-Json":"🪺"};function pb(e){if(!e)return null;let r=e.trim();if(!r)return null;const i=r.match(/^(?:bash|sh|zsh|fish|powershell|pwsh)(?:\.exe)?\s+(?:-c|-Command|-NoProfile|-NonInteractive|\s)+["']([^"']+)["']/i);if(i)return pb(i[1]);for(;;){const u=r.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!u)break;r=r.slice(u[0].length)}r=r.replace(/^sudo(?:\s+-\S+)*\s+/,""),r=r.replace(/^(?:time|nohup|xargs)\s+/,"");const o=r.match(/^([^\s|;&<>(]+)/);if(!o)return null;let s=o[1];return s=s.replace(/^.*[/\\]/,""),s=s.replace(/\.(exe|cmd|bat|ps1)$/i,""),s||null}function MP(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const r=e;return typeof r.command=="string"?r.command:typeof r.cmd=="string"?r.cmd:typeof r.script=="string"?r.script:null}function PP(e,r){if(e!=="Bash"&&e!=="PowerShell")return null;const i=MP(r);if(!i)return null;const o=pb(i);return o?{emoji:AP[o]??"⚙️",label:o}:null}function qP(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function OP(e,r){if(e.endedAt==null)return 1;const i=r-e.endedAt;return i<Jv?1:Math.max(0,1-(i-Jv)/hb)}function LP(e,r,i,o,s){const u=[];for(const l of e.values()){if(l.exitAt!=null&&s-l.exitAt>600)continue;const c=i.get(l.id)??r.get(l.id);if(!c)continue;const d=l.tools.filter(S=>S.endedAt==null?!0:s-S.endedAt<Jv+hb).slice(-4);if(d.length===0)continue;const p=o.get(l.id),h=(p==null?void 0:p.width)??240,m=(p==null?void 0:p.height)??130,y=c.x,_=c.y,k=y+h,w=_+m/2,x=d.length-1;d.forEach((S,b)=>{const N=(b-x/2)*kP,C=y+h+bP,I=_+m/2+N-Ra,A=OP(S,s),P=S.inputPreview??"",$=qP(S),L=A<.999;u.push({id:S.id,toolId:S.id,agentId:l.id,toolName:S.name,name:S.name,emoji:IP(S.name),status:$,category:RP(S.name),inputPreview:P,fade:A,fading:L,worldX:C,worldY:I,anchorX:k,anchorY:w,spawnDx:k-C,spawnDy:w-(I+Ra)});const U=PP(S.name,S.input);if(U){const V=C+p1+CP,ee=I,Z=C+p1,R=I+Ra;u.push({id:`sub:${S.id}`,toolId:S.id,agentId:l.id,toolName:S.name,name:U.label,emoji:U.emoji,isSub:!0,status:$,category:"shell",inputPreview:P,fade:A,fading:L,worldX:V,worldY:ee,anchorX:Z,anchorY:R,spawnDx:Z-V,spawnDy:0})}})}return u}function jP({agents:e,positions:r,pinned:i,measured:o,now:s,onOpenTool:u}){const{x:l,y:c,zoom:d}=ib(),p=LP(e,r,i,o,s);return O.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[O.jsx("svg",{className:"tool-bursts-svg",children:p.map(h=>{const m=h.anchorX*d+l,y=h.anchorY*d+c,_=(h.worldX+6)*d+l,k=(h.worldY+Ra)*d+c,w=m+(_-m)*.55;return O.jsx("path",{d:`M ${m} ${y} Q ${w} ${y}, ${_} ${k}`,className:`tool-conn status-${h.status}${h.fading?" fading":""}`,opacity:h.fade},`l:${h.id}`)})}),p.map(h=>{const m=h.worldX*d+l,y=h.worldY*d+c,_={left:`${m}px`,top:`${y}px`,transform:`scale(${d})`,transformOrigin:"left top","--spawn-dx":`${h.spawnDx}px`,"--spawn-dy":`${h.spawnDy}px`},k=h.isSub?`${h.toolName} · ${h.name}`:h.toolName,w=h.inputPreview?`${k} · ${h.inputPreview}`:k,x=u!=null;return O.jsx("div",{className:"tool-burst-wrap",style:_,children:O.jsxs("div",{className:`tool-burst cat-${h.category} status-${h.status}${h.fading?" fading":""}${x?" clickable":""}${h.isSub?" sub":""}`,title:w,role:x?"button":void 0,tabIndex:x?0:void 0,onClick:x?()=>u(h.toolId):void 0,onKeyDown:x?S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),u(h.toolId))}:void 0,children:[O.jsx("span",{className:"tb-emoji",children:h.emoji}),O.jsx("span",{className:"tb-name",children:h.name}),h.status==="inflight"&&O.jsx("span",{className:"tb-spin"}),h.status==="done"&&O.jsx("span",{className:"tb-mark done",children:"✓"}),h.status==="err"&&O.jsx("span",{className:"tb-mark err",children:"×"})]})},h.id)})]})}function wm(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var vc,v1;function DP(){if(v1)return vc;v1=1;function e(){this.__data__=[],this.size=0}return vc=e,vc}var mc,m1;function Ci(){if(m1)return mc;m1=1;function e(r,i){return r===i||r!==r&&i!==i}return mc=e,mc}var gc,g1;function Wa(){if(g1)return gc;g1=1;var e=Ci();function r(i,o){for(var s=i.length;s--;)if(e(i[s][0],o))return s;return-1}return gc=r,gc}var yc,y1;function zP(){if(y1)return yc;y1=1;var e=Wa(),r=Array.prototype,i=r.splice;function o(s){var u=this.__data__,l=e(u,s);if(l<0)return!1;var c=u.length-1;return l==c?u.pop():i.call(u,l,1),--this.size,!0}return yc=o,yc}var _c,_1;function FP(){if(_1)return _c;_1=1;var e=Wa();function r(i){var o=this.__data__,s=e(o,i);return s<0?void 0:o[s][1]}return _c=r,_c}var wc,w1;function $P(){if(w1)return wc;w1=1;var e=Wa();function r(i){return e(this.__data__,i)>-1}return wc=r,wc}var xc,x1;function BP(){if(x1)return xc;x1=1;var e=Wa();function r(i,o){var s=this.__data__,u=e(s,i);return u<0?(++this.size,s.push([i,o])):s[u][1]=o,this}return xc=r,xc}var Sc,S1;function Ka(){if(S1)return Sc;S1=1;var e=DP(),r=zP(),i=FP(),o=$P(),s=BP();function u(l){var c=-1,d=l==null?0:l.length;for(this.clear();++c<d;){var p=l[c];this.set(p[0],p[1])}}return u.prototype.clear=e,u.prototype.delete=r,u.prototype.get=i,u.prototype.has=o,u.prototype.set=s,Sc=u,Sc}var Ec,E1;function UP(){if(E1)return Ec;E1=1;var e=Ka();function r(){this.__data__=new e,this.size=0}return Ec=r,Ec}var kc,k1;function HP(){if(k1)return kc;k1=1;function e(r){var i=this.__data__,o=i.delete(r);return this.size=i.size,o}return kc=e,kc}var bc,b1;function VP(){if(b1)return bc;b1=1;function e(r){return this.__data__.get(r)}return bc=e,bc}var Cc,C1;function GP(){if(C1)return Cc;C1=1;function e(r){return this.__data__.has(r)}return Cc=e,Cc}var Nc,N1;function vb(){if(N1)return Nc;N1=1;var e=typeof da=="object"&&da&&da.Object===Object&&da;return Nc=e,Nc}var Rc,R1;function dn(){if(R1)return Rc;R1=1;var e=vb(),r=typeof self=="object"&&self&&self.Object===Object&&self,i=e||r||Function("return this")();return Rc=i,Rc}var Tc,T1;function Ni(){if(T1)return Tc;T1=1;var e=dn(),r=e.Symbol;return Tc=r,Tc}var Ic,I1;function WP(){if(I1)return Ic;I1=1;var e=Ni(),r=Object.prototype,i=r.hasOwnProperty,o=r.toString,s=e?e.toStringTag:void 0;function u(l){var c=i.call(l,s),d=l[s];try{l[s]=void 0;var p=!0}catch{}var h=o.call(l);return p&&(c?l[s]=d:delete l[s]),h}return Ic=u,Ic}var Ac,A1;function KP(){if(A1)return Ac;A1=1;var e=Object.prototype,r=e.toString;function i(o){return r.call(o)}return Ac=i,Ac}var Mc,M1;function Dr(){if(M1)return Mc;M1=1;var e=Ni(),r=WP(),i=KP(),o="[object Null]",s="[object Undefined]",u=e?e.toStringTag:void 0;function l(c){return c==null?c===void 0?s:o:u&&u in Object(c)?r(c):i(c)}return Mc=l,Mc}var Pc,P1;function Qt(){if(P1)return Pc;P1=1;function e(r){var i=typeof r;return r!=null&&(i=="object"||i=="function")}return Pc=e,Pc}var qc,q1;function Bo(){if(q1)return qc;q1=1;var e=Dr(),r=Qt(),i="[object AsyncFunction]",o="[object Function]",s="[object GeneratorFunction]",u="[object Proxy]";function l(c){if(!r(c))return!1;var d=e(c);return d==o||d==s||d==i||d==u}return qc=l,qc}var Oc,O1;function YP(){if(O1)return Oc;O1=1;var e=dn(),r=e["__core-js_shared__"];return Oc=r,Oc}var Lc,L1;function XP(){if(L1)return Lc;L1=1;var e=YP(),r=(function(){var o=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""})();function i(o){return!!r&&r in o}return Lc=i,Lc}var jc,j1;function mb(){if(j1)return jc;j1=1;var e=Function.prototype,r=e.toString;function i(o){if(o!=null){try{return r.call(o)}catch{}try{return o+""}catch{}}return""}return jc=i,jc}var Dc,D1;function QP(){if(D1)return Dc;D1=1;var e=Bo(),r=XP(),i=Qt(),o=mb(),s=/[\\^$.*+?()[\]{}|]/g,u=/^\[object .+?Constructor\]$/,l=Function.prototype,c=Object.prototype,d=l.toString,p=c.hasOwnProperty,h=RegExp("^"+d.call(p).replace(s,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(y){if(!i(y)||r(y))return!1;var _=e(y)?h:u;return _.test(o(y))}return Dc=m,Dc}var zc,z1;function ZP(){if(z1)return zc;z1=1;function e(r,i){return r==null?void 0:r[i]}return zc=e,zc}var Fc,F1;function zr(){if(F1)return Fc;F1=1;var e=QP(),r=ZP();function i(o,s){var u=r(o,s);return e(u)?u:void 0}return Fc=i,Fc}var $c,$1;function xm(){if($1)return $c;$1=1;var e=zr(),r=dn(),i=e(r,"Map");return $c=i,$c}var Bc,B1;function Ya(){if(B1)return Bc;B1=1;var e=zr(),r=e(Object,"create");return Bc=r,Bc}var Uc,U1;function JP(){if(U1)return Uc;U1=1;var e=Ya();function r(){this.__data__=e?e(null):{},this.size=0}return Uc=r,Uc}var Hc,H1;function eq(){if(H1)return Hc;H1=1;function e(r){var i=this.has(r)&&delete this.__data__[r];return this.size-=i?1:0,i}return Hc=e,Hc}var Vc,V1;function tq(){if(V1)return Vc;V1=1;var e=Ya(),r="__lodash_hash_undefined__",i=Object.prototype,o=i.hasOwnProperty;function s(u){var l=this.__data__;if(e){var c=l[u];return c===r?void 0:c}return o.call(l,u)?l[u]:void 0}return Vc=s,Vc}var Gc,G1;function nq(){if(G1)return Gc;G1=1;var e=Ya(),r=Object.prototype,i=r.hasOwnProperty;function o(s){var u=this.__data__;return e?u[s]!==void 0:i.call(u,s)}return Gc=o,Gc}var Wc,W1;function rq(){if(W1)return Wc;W1=1;var e=Ya(),r="__lodash_hash_undefined__";function i(o,s){var u=this.__data__;return this.size+=this.has(o)?0:1,u[o]=e&&s===void 0?r:s,this}return Wc=i,Wc}var Kc,K1;function iq(){if(K1)return Kc;K1=1;var e=JP(),r=eq(),i=tq(),o=nq(),s=rq();function u(l){var c=-1,d=l==null?0:l.length;for(this.clear();++c<d;){var p=l[c];this.set(p[0],p[1])}}return u.prototype.clear=e,u.prototype.delete=r,u.prototype.get=i,u.prototype.has=o,u.prototype.set=s,Kc=u,Kc}var Yc,Y1;function oq(){if(Y1)return Yc;Y1=1;var e=iq(),r=Ka(),i=xm();function o(){this.size=0,this.__data__={hash:new e,map:new(i||r),string:new e}}return Yc=o,Yc}var Xc,X1;function sq(){if(X1)return Xc;X1=1;function e(r){var i=typeof r;return i=="string"||i=="number"||i=="symbol"||i=="boolean"?r!=="__proto__":r===null}return Xc=e,Xc}var Qc,Q1;function Xa(){if(Q1)return Qc;Q1=1;var e=sq();function r(i,o){var s=i.__data__;return e(o)?s[typeof o=="string"?"string":"hash"]:s.map}return Qc=r,Qc}var Zc,Z1;function aq(){if(Z1)return Zc;Z1=1;var e=Xa();function r(i){var o=e(this,i).delete(i);return this.size-=o?1:0,o}return Zc=r,Zc}var Jc,J1;function uq(){if(J1)return Jc;J1=1;var e=Xa();function r(i){return e(this,i).get(i)}return Jc=r,Jc}var ef,e_;function lq(){if(e_)return ef;e_=1;var e=Xa();function r(i){return e(this,i).has(i)}return ef=r,ef}var tf,t_;function cq(){if(t_)return tf;t_=1;var e=Xa();function r(i,o){var s=e(this,i),u=s.size;return s.set(i,o),this.size+=s.size==u?0:1,this}return tf=r,tf}var nf,n_;function Sm(){if(n_)return nf;n_=1;var e=oq(),r=aq(),i=uq(),o=lq(),s=cq();function u(l){var c=-1,d=l==null?0:l.length;for(this.clear();++c<d;){var p=l[c];this.set(p[0],p[1])}}return u.prototype.clear=e,u.prototype.delete=r,u.prototype.get=i,u.prototype.has=o,u.prototype.set=s,nf=u,nf}var rf,r_;function fq(){if(r_)return rf;r_=1;var e=Ka(),r=xm(),i=Sm(),o=200;function s(u,l){var c=this.__data__;if(c instanceof e){var d=c.__data__;if(!r||d.length<o-1)return d.push([u,l]),this.size=++c.size,this;c=this.__data__=new i(d)}return c.set(u,l),this.size=c.size,this}return rf=s,rf}var of,i_;function Qa(){if(i_)return of;i_=1;var e=Ka(),r=UP(),i=HP(),o=VP(),s=GP(),u=fq();function l(c){var d=this.__data__=new e(c);this.size=d.size}return l.prototype.clear=r,l.prototype.delete=i,l.prototype.get=o,l.prototype.has=s,l.prototype.set=u,of=l,of}var sf,o_;function Em(){if(o_)return sf;o_=1;function e(r,i){for(var o=-1,s=r==null?0:r.length;++o<s&&i(r[o],o,r)!==!1;);return r}return sf=e,sf}var af,s_;function gb(){if(s_)return af;s_=1;var e=zr(),r=(function(){try{var i=e(Object,"defineProperty");return i({},"",{}),i}catch{}})();return af=r,af}var uf,a_;function Za(){if(a_)return uf;a_=1;var e=gb();function r(i,o,s){o=="__proto__"&&e?e(i,o,{configurable:!0,enumerable:!0,value:s,writable:!0}):i[o]=s}return uf=r,uf}var lf,u_;function Ja(){if(u_)return lf;u_=1;var e=Za(),r=Ci(),i=Object.prototype,o=i.hasOwnProperty;function s(u,l,c){var d=u[l];(!(o.call(u,l)&&r(d,c))||c===void 0&&!(l in u))&&e(u,l,c)}return lf=s,lf}var cf,l_;function Uo(){if(l_)return cf;l_=1;var e=Ja(),r=Za();function i(o,s,u,l){var c=!u;u||(u={});for(var d=-1,p=s.length;++d<p;){var h=s[d],m=l?l(u[h],o[h],h,u,o):void 0;m===void 0&&(m=o[h]),c?r(u,h,m):e(u,h,m)}return u}return cf=i,cf}var ff,c_;function dq(){if(c_)return ff;c_=1;function e(r,i){for(var o=-1,s=Array(r);++o<r;)s[o]=i(o);return s}return ff=e,ff}var df,f_;function xn(){if(f_)return df;f_=1;function e(r){return r!=null&&typeof r=="object"}return df=e,df}var hf,d_;function hq(){if(d_)return hf;d_=1;var e=Dr(),r=xn(),i="[object Arguments]";function o(s){return r(s)&&e(s)==i}return hf=o,hf}var pf,h_;function Ho(){if(h_)return pf;h_=1;var e=hq(),r=xn(),i=Object.prototype,o=i.hasOwnProperty,s=i.propertyIsEnumerable,u=e((function(){return arguments})())?e:function(l){return r(l)&&o.call(l,"callee")&&!s.call(l,"callee")};return pf=u,pf}var vf,p_;function Je(){if(p_)return vf;p_=1;var e=Array.isArray;return vf=e,vf}var Co={exports:{}},mf,v_;function pq(){if(v_)return mf;v_=1;function e(){return!1}return mf=e,mf}Co.exports;var m_;function Ri(){return m_||(m_=1,(function(e,r){var i=dn(),o=pq(),s=r&&!r.nodeType&&r,u=s&&!0&&e&&!e.nodeType&&e,l=u&&u.exports===s,c=l?i.Buffer:void 0,d=c?c.isBuffer:void 0,p=d||o;e.exports=p})(Co,Co.exports)),Co.exports}var gf,g_;function eu(){if(g_)return gf;g_=1;var e=9007199254740991,r=/^(?:0|[1-9]\d*)$/;function i(o,s){var u=typeof o;return s=s??e,!!s&&(u=="number"||u!="symbol"&&r.test(o))&&o>-1&&o%1==0&&o<s}return gf=i,gf}var yf,y_;function km(){if(y_)return yf;y_=1;var e=9007199254740991;function r(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=e}return yf=r,yf}var _f,__;function vq(){if(__)return _f;__=1;var e=Dr(),r=km(),i=xn(),o="[object Arguments]",s="[object Array]",u="[object Boolean]",l="[object Date]",c="[object Error]",d="[object Function]",p="[object Map]",h="[object Number]",m="[object Object]",y="[object RegExp]",_="[object Set]",k="[object String]",w="[object WeakMap]",x="[object ArrayBuffer]",S="[object DataView]",b="[object Float32Array]",N="[object Float64Array]",C="[object Int8Array]",I="[object Int16Array]",A="[object Int32Array]",P="[object Uint8Array]",$="[object Uint8ClampedArray]",L="[object Uint16Array]",U="[object Uint32Array]",V={};V[b]=V[N]=V[C]=V[I]=V[A]=V[P]=V[$]=V[L]=V[U]=!0,V[o]=V[s]=V[x]=V[u]=V[S]=V[l]=V[c]=V[d]=V[p]=V[h]=V[m]=V[y]=V[_]=V[k]=V[w]=!1;function ee(Z){return i(Z)&&r(Z.length)&&!!V[e(Z)]}return _f=ee,_f}var wf,w_;function tu(){if(w_)return wf;w_=1;function e(r){return function(i){return r(i)}}return wf=e,wf}var No={exports:{}};No.exports;var x_;function bm(){return x_||(x_=1,(function(e,r){var i=vb(),o=r&&!r.nodeType&&r,s=o&&!0&&e&&!e.nodeType&&e,u=s&&s.exports===o,l=u&&i.process,c=(function(){try{var d=s&&s.require&&s.require("util").types;return d||l&&l.binding&&l.binding("util")}catch{}})();e.exports=c})(No,No.exports)),No.exports}var xf,S_;function Vo(){if(S_)return xf;S_=1;var e=vq(),r=tu(),i=bm(),o=i&&i.isTypedArray,s=o?r(o):e;return xf=s,xf}var Sf,E_;function yb(){if(E_)return Sf;E_=1;var e=dq(),r=Ho(),i=Je(),o=Ri(),s=eu(),u=Vo(),l=Object.prototype,c=l.hasOwnProperty;function d(p,h){var m=i(p),y=!m&&r(p),_=!m&&!y&&o(p),k=!m&&!y&&!_&&u(p),w=m||y||_||k,x=w?e(p.length,String):[],S=x.length;for(var b in p)(h||c.call(p,b))&&!(w&&(b=="length"||_&&(b=="offset"||b=="parent")||k&&(b=="buffer"||b=="byteLength"||b=="byteOffset")||s(b,S)))&&x.push(b);return x}return Sf=d,Sf}var Ef,k_;function nu(){if(k_)return Ef;k_=1;var e=Object.prototype;function r(i){var o=i&&i.constructor,s=typeof o=="function"&&o.prototype||e;return i===s}return Ef=r,Ef}var kf,b_;function _b(){if(b_)return kf;b_=1;function e(r,i){return function(o){return r(i(o))}}return kf=e,kf}var bf,C_;function mq(){if(C_)return bf;C_=1;var e=_b(),r=e(Object.keys,Object);return bf=r,bf}var Cf,N_;function Cm(){if(N_)return Cf;N_=1;var e=nu(),r=mq(),i=Object.prototype,o=i.hasOwnProperty;function s(u){if(!e(u))return r(u);var l=[];for(var c in Object(u))o.call(u,c)&&c!="constructor"&&l.push(c);return l}return Cf=s,Cf}var Nf,R_;function Fn(){if(R_)return Nf;R_=1;var e=Bo(),r=km();function i(o){return o!=null&&r(o.length)&&!e(o)}return Nf=i,Nf}var Rf,T_;function dr(){if(T_)return Rf;T_=1;var e=yb(),r=Cm(),i=Fn();function o(s){return i(s)?e(s):r(s)}return Rf=o,Rf}var Tf,I_;function gq(){if(I_)return Tf;I_=1;var e=Uo(),r=dr();function i(o,s){return o&&e(s,r(s),o)}return Tf=i,Tf}var If,A_;function yq(){if(A_)return If;A_=1;function e(r){var i=[];if(r!=null)for(var o in Object(r))i.push(o);return i}return If=e,If}var Af,M_;function _q(){if(M_)return Af;M_=1;var e=Qt(),r=nu(),i=yq(),o=Object.prototype,s=o.hasOwnProperty;function u(l){if(!e(l))return i(l);var c=r(l),d=[];for(var p in l)p=="constructor"&&(c||!s.call(l,p))||d.push(p);return d}return Af=u,Af}var Mf,P_;function Fr(){if(P_)return Mf;P_=1;var e=yb(),r=_q(),i=Fn();function o(s){return i(s)?e(s,!0):r(s)}return Mf=o,Mf}var Pf,q_;function wq(){if(q_)return Pf;q_=1;var e=Uo(),r=Fr();function i(o,s){return o&&e(s,r(s),o)}return Pf=i,Pf}var Ro={exports:{}};Ro.exports;var O_;function wb(){return O_||(O_=1,(function(e,r){var i=dn(),o=r&&!r.nodeType&&r,s=o&&!0&&e&&!e.nodeType&&e,u=s&&s.exports===o,l=u?i.Buffer:void 0,c=l?l.allocUnsafe:void 0;function d(p,h){if(h)return p.slice();var m=p.length,y=c?c(m):new p.constructor(m);return p.copy(y),y}e.exports=d})(Ro,Ro.exports)),Ro.exports}var qf,L_;function xb(){if(L_)return qf;L_=1;function e(r,i){var o=-1,s=r.length;for(i||(i=Array(s));++o<s;)i[o]=r[o];return i}return qf=e,qf}var Of,j_;function Sb(){if(j_)return Of;j_=1;function e(r,i){for(var o=-1,s=r==null?0:r.length,u=0,l=[];++o<s;){var c=r[o];i(c,o,r)&&(l[u++]=c)}return l}return Of=e,Of}var Lf,D_;function Eb(){if(D_)return Lf;D_=1;function e(){return[]}return Lf=e,Lf}var jf,z_;function Nm(){if(z_)return jf;z_=1;var e=Sb(),r=Eb(),i=Object.prototype,o=i.propertyIsEnumerable,s=Object.getOwnPropertySymbols,u=s?function(l){return l==null?[]:(l=Object(l),e(s(l),function(c){return o.call(l,c)}))}:r;return jf=u,jf}var Df,F_;function xq(){if(F_)return Df;F_=1;var e=Uo(),r=Nm();function i(o,s){return e(o,r(o),s)}return Df=i,Df}var zf,$_;function Rm(){if($_)return zf;$_=1;function e(r,i){for(var o=-1,s=i.length,u=r.length;++o<s;)r[u+o]=i[o];return r}return zf=e,zf}var Ff,B_;function ru(){if(B_)return Ff;B_=1;var e=_b(),r=e(Object.getPrototypeOf,Object);return Ff=r,Ff}var $f,U_;function kb(){if(U_)return $f;U_=1;var e=Rm(),r=ru(),i=Nm(),o=Eb(),s=Object.getOwnPropertySymbols,u=s?function(l){for(var c=[];l;)e(c,i(l)),l=r(l);return c}:o;return $f=u,$f}var Bf,H_;function Sq(){if(H_)return Bf;H_=1;var e=Uo(),r=kb();function i(o,s){return e(o,r(o),s)}return Bf=i,Bf}var Uf,V_;function bb(){if(V_)return Uf;V_=1;var e=Rm(),r=Je();function i(o,s,u){var l=s(o);return r(o)?l:e(l,u(o))}return Uf=i,Uf}var Hf,G_;function Cb(){if(G_)return Hf;G_=1;var e=bb(),r=Nm(),i=dr();function o(s){return e(s,i,r)}return Hf=o,Hf}var Vf,W_;function Eq(){if(W_)return Vf;W_=1;var e=bb(),r=kb(),i=Fr();function o(s){return e(s,i,r)}return Vf=o,Vf}var Gf,K_;function kq(){if(K_)return Gf;K_=1;var e=zr(),r=dn(),i=e(r,"DataView");return Gf=i,Gf}var Wf,Y_;function bq(){if(Y_)return Wf;Y_=1;var e=zr(),r=dn(),i=e(r,"Promise");return Wf=i,Wf}var Kf,X_;function Nb(){if(X_)return Kf;X_=1;var e=zr(),r=dn(),i=e(r,"Set");return Kf=i,Kf}var Yf,Q_;function Cq(){if(Q_)return Yf;Q_=1;var e=zr(),r=dn(),i=e(r,"WeakMap");return Yf=i,Yf}var Xf,Z_;function Ti(){if(Z_)return Xf;Z_=1;var e=kq(),r=xm(),i=bq(),o=Nb(),s=Cq(),u=Dr(),l=mb(),c="[object Map]",d="[object Object]",p="[object Promise]",h="[object Set]",m="[object WeakMap]",y="[object DataView]",_=l(e),k=l(r),w=l(i),x=l(o),S=l(s),b=u;return(e&&b(new e(new ArrayBuffer(1)))!=y||r&&b(new r)!=c||i&&b(i.resolve())!=p||o&&b(new o)!=h||s&&b(new s)!=m)&&(b=function(N){var C=u(N),I=C==d?N.constructor:void 0,A=I?l(I):"";if(A)switch(A){case _:return y;case k:return c;case w:return p;case x:return h;case S:return m}return C}),Xf=b,Xf}var Qf,J_;function Nq(){if(J_)return Qf;J_=1;var e=Object.prototype,r=e.hasOwnProperty;function i(o){var s=o.length,u=new o.constructor(s);return s&&typeof o[0]=="string"&&r.call(o,"index")&&(u.index=o.index,u.input=o.input),u}return Qf=i,Qf}var Zf,ew;function Rb(){if(ew)return Zf;ew=1;var e=dn(),r=e.Uint8Array;return Zf=r,Zf}var Jf,tw;function Tm(){if(tw)return Jf;tw=1;var e=Rb();function r(i){var o=new i.constructor(i.byteLength);return new e(o).set(new e(i)),o}return Jf=r,Jf}var ed,nw;function Rq(){if(nw)return ed;nw=1;var e=Tm();function r(i,o){var s=o?e(i.buffer):i.buffer;return new i.constructor(s,i.byteOffset,i.byteLength)}return ed=r,ed}var td,rw;function Tq(){if(rw)return td;rw=1;var e=/\w*$/;function r(i){var o=new i.constructor(i.source,e.exec(i));return o.lastIndex=i.lastIndex,o}return td=r,td}var nd,iw;function Iq(){if(iw)return nd;iw=1;var e=Ni(),r=e?e.prototype:void 0,i=r?r.valueOf:void 0;function o(s){return i?Object(i.call(s)):{}}return nd=o,nd}var rd,ow;function Tb(){if(ow)return rd;ow=1;var e=Tm();function r(i,o){var s=o?e(i.buffer):i.buffer;return new i.constructor(s,i.byteOffset,i.length)}return rd=r,rd}var id,sw;function Aq(){if(sw)return id;sw=1;var e=Tm(),r=Rq(),i=Tq(),o=Iq(),s=Tb(),u="[object Boolean]",l="[object Date]",c="[object Map]",d="[object Number]",p="[object RegExp]",h="[object Set]",m="[object String]",y="[object Symbol]",_="[object ArrayBuffer]",k="[object DataView]",w="[object Float32Array]",x="[object Float64Array]",S="[object Int8Array]",b="[object Int16Array]",N="[object Int32Array]",C="[object Uint8Array]",I="[object Uint8ClampedArray]",A="[object Uint16Array]",P="[object Uint32Array]";function $(L,U,V){var ee=L.constructor;switch(U){case _:return e(L);case u:case l:return new ee(+L);case k:return r(L,V);case w:case x:case S:case b:case N:case C:case I:case A:case P:return s(L,V);case c:return new ee;case d:case m:return new ee(L);case p:return i(L);case h:return new ee;case y:return o(L)}}return id=$,id}var od,aw;function Ib(){if(aw)return od;aw=1;var e=Qt(),r=Object.create,i=(function(){function o(){}return function(s){if(!e(s))return{};if(r)return r(s);o.prototype=s;var u=new o;return o.prototype=void 0,u}})();return od=i,od}var sd,uw;function Ab(){if(uw)return sd;uw=1;var e=Ib(),r=ru(),i=nu();function o(s){return typeof s.constructor=="function"&&!i(s)?e(r(s)):{}}return sd=o,sd}var ad,lw;function Mq(){if(lw)return ad;lw=1;var e=Ti(),r=xn(),i="[object Map]";function o(s){return r(s)&&e(s)==i}return ad=o,ad}var ud,cw;function Pq(){if(cw)return ud;cw=1;var e=Mq(),r=tu(),i=bm(),o=i&&i.isMap,s=o?r(o):e;return ud=s,ud}var ld,fw;function qq(){if(fw)return ld;fw=1;var e=Ti(),r=xn(),i="[object Set]";function o(s){return r(s)&&e(s)==i}return ld=o,ld}var cd,dw;function Oq(){if(dw)return cd;dw=1;var e=qq(),r=tu(),i=bm(),o=i&&i.isSet,s=o?r(o):e;return cd=s,cd}var fd,hw;function Mb(){if(hw)return fd;hw=1;var e=Qa(),r=Em(),i=Ja(),o=gq(),s=wq(),u=wb(),l=xb(),c=xq(),d=Sq(),p=Cb(),h=Eq(),m=Ti(),y=Nq(),_=Aq(),k=Ab(),w=Je(),x=Ri(),S=Pq(),b=Qt(),N=Oq(),C=dr(),I=Fr(),A=1,P=2,$=4,L="[object Arguments]",U="[object Array]",V="[object Boolean]",ee="[object Date]",Z="[object Error]",R="[object Function]",W="[object GeneratorFunction]",F="[object Map]",ne="[object Number]",G="[object Object]",j="[object RegExp]",K="[object Set]",T="[object String]",z="[object Symbol]",ae="[object WeakMap]",q="[object ArrayBuffer]",H="[object DataView]",X="[object Float32Array]",oe="[object Float64Array]",ue="[object Int8Array]",se="[object Int16Array]",re="[object Int32Array]",Ee="[object Uint8Array]",Re="[object Uint8ClampedArray]",xe="[object Uint16Array]",Ce="[object Uint32Array]",ye={};ye[L]=ye[U]=ye[q]=ye[H]=ye[V]=ye[ee]=ye[X]=ye[oe]=ye[ue]=ye[se]=ye[re]=ye[F]=ye[ne]=ye[G]=ye[j]=ye[K]=ye[T]=ye[z]=ye[Ee]=ye[Re]=ye[xe]=ye[Ce]=!0,ye[Z]=ye[R]=ye[ae]=!1;function Le(ve,he,Pe,He,et,Xe){var je,tt=he&A,St=he&P,Ft=he&$;if(Pe&&(je=et?Pe(ve,He,et,Xe):Pe(ve)),je!==void 0)return je;if(!b(ve))return ve;var Et=w(ve);if(Et){if(je=y(ve),!tt)return l(ve,je)}else{var at=m(ve),$t=at==R||at==W;if(x(ve))return u(ve,tt);if(at==G||at==L||$t&&!et){if(je=St||$t?{}:k(ve),!tt)return St?d(ve,s(je,ve)):c(ve,o(je,ve))}else{if(!ye[at])return et?ve:{};je=_(ve,at,tt)}}Xe||(Xe=new e);var kt=Xe.get(ve);if(kt)return kt;Xe.set(ve,je),N(ve)?ve.forEach(function(nt){je.add(Le(nt,he,Pe,nt,ve,Xe))}):S(ve)&&ve.forEach(function(nt,ut){je.set(ut,Le(nt,he,Pe,ut,ve,Xe))});var $e=Ft?St?h:p:St?I:C,vt=Et?void 0:$e(ve);return r(vt||ve,function(nt,ut){vt&&(ut=nt,nt=ve[ut]),i(je,ut,Le(nt,he,Pe,ut,ve,Xe))}),je}return fd=Le,fd}var dd,pw;function Lq(){if(pw)return dd;pw=1;var e=Mb(),r=4;function i(o){return e(o,r)}return dd=i,dd}var hd,vw;function Im(){if(vw)return hd;vw=1;function e(r){return function(){return r}}return hd=e,hd}var pd,mw;function jq(){if(mw)return pd;mw=1;function e(r){return function(i,o,s){for(var u=-1,l=Object(i),c=s(i),d=c.length;d--;){var p=c[r?d:++u];if(o(l[p],p,l)===!1)break}return i}}return pd=e,pd}var vd,gw;function Am(){if(gw)return vd;gw=1;var e=jq(),r=e();return vd=r,vd}var md,yw;function Mm(){if(yw)return md;yw=1;var e=Am(),r=dr();function i(o,s){return o&&e(o,s,r)}return md=i,md}var gd,_w;function Dq(){if(_w)return gd;_w=1;var e=Fn();function r(i,o){return function(s,u){if(s==null)return s;if(!e(s))return i(s,u);for(var l=s.length,c=o?l:-1,d=Object(s);(o?c--:++c<l)&&u(d[c],c,d)!==!1;);return s}}return gd=r,gd}var yd,ww;function iu(){if(ww)return yd;ww=1;var e=Mm(),r=Dq(),i=r(e);return yd=i,yd}var _d,xw;function $r(){if(xw)return _d;xw=1;function e(r){return r}return _d=e,_d}var wd,Sw;function Pb(){if(Sw)return wd;Sw=1;var e=$r();function r(i){return typeof i=="function"?i:e}return wd=r,wd}var xd,Ew;function qb(){if(Ew)return xd;Ew=1;var e=Em(),r=iu(),i=Pb(),o=Je();function s(u,l){var c=o(u)?e:r;return c(u,i(l))}return xd=s,xd}var Sd,kw;function Ob(){return kw||(kw=1,Sd=qb()),Sd}var Ed,bw;function zq(){if(bw)return Ed;bw=1;var e=iu();function r(i,o){var s=[];return e(i,function(u,l,c){o(u,l,c)&&s.push(u)}),s}return Ed=r,Ed}var kd,Cw;function Fq(){if(Cw)return kd;Cw=1;var e="__lodash_hash_undefined__";function r(i){return this.__data__.set(i,e),this}return kd=r,kd}var bd,Nw;function $q(){if(Nw)return bd;Nw=1;function e(r){return this.__data__.has(r)}return bd=e,bd}var Cd,Rw;function Lb(){if(Rw)return Cd;Rw=1;var e=Sm(),r=Fq(),i=$q();function o(s){var u=-1,l=s==null?0:s.length;for(this.__data__=new e;++u<l;)this.add(s[u])}return o.prototype.add=o.prototype.push=r,o.prototype.has=i,Cd=o,Cd}var Nd,Tw;function Bq(){if(Tw)return Nd;Tw=1;function e(r,i){for(var o=-1,s=r==null?0:r.length;++o<s;)if(i(r[o],o,r))return!0;return!1}return Nd=e,Nd}var Rd,Iw;function jb(){if(Iw)return Rd;Iw=1;function e(r,i){return r.has(i)}return Rd=e,Rd}var Td,Aw;function Db(){if(Aw)return Td;Aw=1;var e=Lb(),r=Bq(),i=jb(),o=1,s=2;function u(l,c,d,p,h,m){var y=d&o,_=l.length,k=c.length;if(_!=k&&!(y&&k>_))return!1;var w=m.get(l),x=m.get(c);if(w&&x)return w==c&&x==l;var S=-1,b=!0,N=d&s?new e:void 0;for(m.set(l,c),m.set(c,l);++S<_;){var C=l[S],I=c[S];if(p)var A=y?p(I,C,S,c,l,m):p(C,I,S,l,c,m);if(A!==void 0){if(A)continue;b=!1;break}if(N){if(!r(c,function(P,$){if(!i(N,$)&&(C===P||h(C,P,d,p,m)))return N.push($)})){b=!1;break}}else if(!(C===I||h(C,I,d,p,m))){b=!1;break}}return m.delete(l),m.delete(c),b}return Td=u,Td}var Id,Mw;function Uq(){if(Mw)return Id;Mw=1;function e(r){var i=-1,o=Array(r.size);return r.forEach(function(s,u){o[++i]=[u,s]}),o}return Id=e,Id}var Ad,Pw;function Pm(){if(Pw)return Ad;Pw=1;function e(r){var i=-1,o=Array(r.size);return r.forEach(function(s){o[++i]=s}),o}return Ad=e,Ad}var Md,qw;function Hq(){if(qw)return Md;qw=1;var e=Ni(),r=Rb(),i=Ci(),o=Db(),s=Uq(),u=Pm(),l=1,c=2,d="[object Boolean]",p="[object Date]",h="[object Error]",m="[object Map]",y="[object Number]",_="[object RegExp]",k="[object Set]",w="[object String]",x="[object Symbol]",S="[object ArrayBuffer]",b="[object DataView]",N=e?e.prototype:void 0,C=N?N.valueOf:void 0;function I(A,P,$,L,U,V,ee){switch($){case b:if(A.byteLength!=P.byteLength||A.byteOffset!=P.byteOffset)return!1;A=A.buffer,P=P.buffer;case S:return!(A.byteLength!=P.byteLength||!V(new r(A),new r(P)));case d:case p:case y:return i(+A,+P);case h:return A.name==P.name&&A.message==P.message;case _:case w:return A==P+"";case m:var Z=s;case k:var R=L&l;if(Z||(Z=u),A.size!=P.size&&!R)return!1;var W=ee.get(A);if(W)return W==P;L|=c,ee.set(A,P);var F=o(Z(A),Z(P),L,U,V,ee);return ee.delete(A),F;case x:if(C)return C.call(A)==C.call(P)}return!1}return Md=I,Md}var Pd,Ow;function Vq(){if(Ow)return Pd;Ow=1;var e=Cb(),r=1,i=Object.prototype,o=i.hasOwnProperty;function s(u,l,c,d,p,h){var m=c&r,y=e(u),_=y.length,k=e(l),w=k.length;if(_!=w&&!m)return!1;for(var x=_;x--;){var S=y[x];if(!(m?S in l:o.call(l,S)))return!1}var b=h.get(u),N=h.get(l);if(b&&N)return b==l&&N==u;var C=!0;h.set(u,l),h.set(l,u);for(var I=m;++x<_;){S=y[x];var A=u[S],P=l[S];if(d)var $=m?d(P,A,S,l,u,h):d(A,P,S,u,l,h);if(!($===void 0?A===P||p(A,P,c,d,h):$)){C=!1;break}I||(I=S=="constructor")}if(C&&!I){var L=u.constructor,U=l.constructor;L!=U&&"constructor"in u&&"constructor"in l&&!(typeof L=="function"&&L instanceof L&&typeof U=="function"&&U instanceof U)&&(C=!1)}return h.delete(u),h.delete(l),C}return Pd=s,Pd}var qd,Lw;function Gq(){if(Lw)return qd;Lw=1;var e=Qa(),r=Db(),i=Hq(),o=Vq(),s=Ti(),u=Je(),l=Ri(),c=Vo(),d=1,p="[object Arguments]",h="[object Array]",m="[object Object]",y=Object.prototype,_=y.hasOwnProperty;function k(w,x,S,b,N,C){var I=u(w),A=u(x),P=I?h:s(w),$=A?h:s(x);P=P==p?m:P,$=$==p?m:$;var L=P==m,U=$==m,V=P==$;if(V&&l(w)){if(!l(x))return!1;I=!0,L=!1}if(V&&!L)return C||(C=new e),I||c(w)?r(w,x,S,b,N,C):i(w,x,P,S,b,N,C);if(!(S&d)){var ee=L&&_.call(w,"__wrapped__"),Z=U&&_.call(x,"__wrapped__");if(ee||Z){var R=ee?w.value():w,W=Z?x.value():x;return C||(C=new e),N(R,W,S,b,C)}}return V?(C||(C=new e),o(w,x,S,b,N,C)):!1}return qd=k,qd}var Od,jw;function zb(){if(jw)return Od;jw=1;var e=Gq(),r=xn();function i(o,s,u,l,c){return o===s?!0:o==null||s==null||!r(o)&&!r(s)?o!==o&&s!==s:e(o,s,u,l,i,c)}return Od=i,Od}var Ld,Dw;function Wq(){if(Dw)return Ld;Dw=1;var e=Qa(),r=zb(),i=1,o=2;function s(u,l,c,d){var p=c.length,h=p,m=!d;if(u==null)return!h;for(u=Object(u);p--;){var y=c[p];if(m&&y[2]?y[1]!==u[y[0]]:!(y[0]in u))return!1}for(;++p<h;){y=c[p];var _=y[0],k=u[_],w=y[1];if(m&&y[2]){if(k===void 0&&!(_ in u))return!1}else{var x=new e;if(d)var S=d(k,w,_,u,l,x);if(!(S===void 0?r(w,k,i|o,d,x):S))return!1}}return!0}return Ld=s,Ld}var jd,zw;function Fb(){if(zw)return jd;zw=1;var e=Qt();function r(i){return i===i&&!e(i)}return jd=r,jd}var Dd,Fw;function Kq(){if(Fw)return Dd;Fw=1;var e=Fb(),r=dr();function i(o){for(var s=r(o),u=s.length;u--;){var l=s[u],c=o[l];s[u]=[l,c,e(c)]}return s}return Dd=i,Dd}var zd,$w;function $b(){if($w)return zd;$w=1;function e(r,i){return function(o){return o==null?!1:o[r]===i&&(i!==void 0||r in Object(o))}}return zd=e,zd}var Fd,Bw;function Yq(){if(Bw)return Fd;Bw=1;var e=Wq(),r=Kq(),i=$b();function o(s){var u=r(s);return u.length==1&&u[0][2]?i(u[0][0],u[0][1]):function(l){return l===s||e(l,s,u)}}return Fd=o,Fd}var $d,Uw;function Ii(){if(Uw)return $d;Uw=1;var e=Dr(),r=xn(),i="[object Symbol]";function o(s){return typeof s=="symbol"||r(s)&&e(s)==i}return $d=o,$d}var Bd,Hw;function qm(){if(Hw)return Bd;Hw=1;var e=Je(),r=Ii(),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,o=/^\w*$/;function s(u,l){if(e(u))return!1;var c=typeof u;return c=="number"||c=="symbol"||c=="boolean"||u==null||r(u)?!0:o.test(u)||!i.test(u)||l!=null&&u in Object(l)}return Bd=s,Bd}var Ud,Vw;function Xq(){if(Vw)return Ud;Vw=1;var e=Sm(),r="Expected a function";function i(o,s){if(typeof o!="function"||s!=null&&typeof s!="function")throw new TypeError(r);var u=function(){var l=arguments,c=s?s.apply(this,l):l[0],d=u.cache;if(d.has(c))return d.get(c);var p=o.apply(this,l);return u.cache=d.set(c,p)||d,p};return u.cache=new(i.Cache||e),u}return i.Cache=e,Ud=i,Ud}var Hd,Gw;function Qq(){if(Gw)return Hd;Gw=1;var e=Xq(),r=500;function i(o){var s=e(o,function(l){return u.size===r&&u.clear(),l}),u=s.cache;return s}return Hd=i,Hd}var Vd,Ww;function Zq(){if(Ww)return Vd;Ww=1;var e=Qq(),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,o=e(function(s){var u=[];return s.charCodeAt(0)===46&&u.push(""),s.replace(r,function(l,c,d,p){u.push(d?p.replace(i,"$1"):c||l)}),u});return Vd=o,Vd}var Gd,Kw;function ou(){if(Kw)return Gd;Kw=1;function e(r,i){for(var o=-1,s=r==null?0:r.length,u=Array(s);++o<s;)u[o]=i(r[o],o,r);return u}return Gd=e,Gd}var Wd,Yw;function Jq(){if(Yw)return Wd;Yw=1;var e=Ni(),r=ou(),i=Je(),o=Ii(),s=e?e.prototype:void 0,u=s?s.toString:void 0;function l(c){if(typeof c=="string")return c;if(i(c))return r(c,l)+"";if(o(c))return u?u.call(c):"";var d=c+"";return d=="0"&&1/c==-1/0?"-0":d}return Wd=l,Wd}var Kd,Xw;function Bb(){if(Xw)return Kd;Xw=1;var e=Jq();function r(i){return i==null?"":e(i)}return Kd=r,Kd}var Yd,Qw;function su(){if(Qw)return Yd;Qw=1;var e=Je(),r=qm(),i=Zq(),o=Bb();function s(u,l){return e(u)?u:r(u,l)?[u]:i(o(u))}return Yd=s,Yd}var Xd,Zw;function Go(){if(Zw)return Xd;Zw=1;var e=Ii();function r(i){if(typeof i=="string"||e(i))return i;var o=i+"";return o=="0"&&1/i==-1/0?"-0":o}return Xd=r,Xd}var Qd,Jw;function au(){if(Jw)return Qd;Jw=1;var e=su(),r=Go();function i(o,s){s=e(s,o);for(var u=0,l=s.length;o!=null&&u<l;)o=o[r(s[u++])];return u&&u==l?o:void 0}return Qd=i,Qd}var Zd,ex;function e3(){if(ex)return Zd;ex=1;var e=au();function r(i,o,s){var u=i==null?void 0:e(i,o);return u===void 0?s:u}return Zd=r,Zd}var Jd,tx;function t3(){if(tx)return Jd;tx=1;function e(r,i){return r!=null&&i in Object(r)}return Jd=e,Jd}var eh,nx;function Ub(){if(nx)return eh;nx=1;var e=su(),r=Ho(),i=Je(),o=eu(),s=km(),u=Go();function l(c,d,p){d=e(d,c);for(var h=-1,m=d.length,y=!1;++h<m;){var _=u(d[h]);if(!(y=c!=null&&p(c,_)))break;c=c[_]}return y||++h!=m?y:(m=c==null?0:c.length,!!m&&s(m)&&o(_,m)&&(i(c)||r(c)))}return eh=l,eh}var th,rx;function Hb(){if(rx)return th;rx=1;var e=t3(),r=Ub();function i(o,s){return o!=null&&r(o,s,e)}return th=i,th}var nh,ix;function n3(){if(ix)return nh;ix=1;var e=zb(),r=e3(),i=Hb(),o=qm(),s=Fb(),u=$b(),l=Go(),c=1,d=2;function p(h,m){return o(h)&&s(m)?u(l(h),m):function(y){var _=r(y,h);return _===void 0&&_===m?i(y,h):e(m,_,c|d)}}return nh=p,nh}var rh,ox;function Vb(){if(ox)return rh;ox=1;function e(r){return function(i){return i==null?void 0:i[r]}}return rh=e,rh}var ih,sx;function r3(){if(sx)return ih;sx=1;var e=au();function r(i){return function(o){return e(o,i)}}return ih=r,ih}var oh,ax;function i3(){if(ax)return oh;ax=1;var e=Vb(),r=r3(),i=qm(),o=Go();function s(u){return i(u)?e(o(u)):r(u)}return oh=s,oh}var sh,ux;function $n(){if(ux)return sh;ux=1;var e=Yq(),r=n3(),i=$r(),o=Je(),s=i3();function u(l){return typeof l=="function"?l:l==null?i:typeof l=="object"?o(l)?r(l[0],l[1]):e(l):s(l)}return sh=u,sh}var ah,lx;function Gb(){if(lx)return ah;lx=1;var e=Sb(),r=zq(),i=$n(),o=Je();function s(u,l){var c=o(u)?e:r;return c(u,i(l,3))}return ah=s,ah}var uh,cx;function o3(){if(cx)return uh;cx=1;var e=Object.prototype,r=e.hasOwnProperty;function i(o,s){return o!=null&&r.call(o,s)}return uh=i,uh}var lh,fx;function Wb(){if(fx)return lh;fx=1;var e=o3(),r=Ub();function i(o,s){return o!=null&&r(o,s,e)}return lh=i,lh}var ch,dx;function s3(){if(dx)return ch;dx=1;var e=Cm(),r=Ti(),i=Ho(),o=Je(),s=Fn(),u=Ri(),l=nu(),c=Vo(),d="[object Map]",p="[object Set]",h=Object.prototype,m=h.hasOwnProperty;function y(_){if(_==null)return!0;if(s(_)&&(o(_)||typeof _=="string"||typeof _.splice=="function"||u(_)||c(_)||i(_)))return!_.length;var k=r(_);if(k==d||k==p)return!_.size;if(l(_))return!e(_).length;for(var w in _)if(m.call(_,w))return!1;return!0}return ch=y,ch}var fh,hx;function Kb(){if(hx)return fh;hx=1;function e(r){return r===void 0}return fh=e,fh}var dh,px;function Yb(){if(px)return dh;px=1;var e=iu(),r=Fn();function i(o,s){var u=-1,l=r(o)?Array(o.length):[];return e(o,function(c,d,p){l[++u]=s(c,d,p)}),l}return dh=i,dh}var hh,vx;function Xb(){if(vx)return hh;vx=1;var e=ou(),r=$n(),i=Yb(),o=Je();function s(u,l){var c=o(u)?e:i;return c(u,r(l,3))}return hh=s,hh}var ph,mx;function a3(){if(mx)return ph;mx=1;function e(r,i,o,s){var u=-1,l=r==null?0:r.length;for(s&&l&&(o=r[++u]);++u<l;)o=i(o,r[u],u,r);return o}return ph=e,ph}var vh,gx;function u3(){if(gx)return vh;gx=1;function e(r,i,o,s,u){return u(r,function(l,c,d){o=s?(s=!1,l):i(o,l,c,d)}),o}return vh=e,vh}var mh,yx;function Qb(){if(yx)return mh;yx=1;var e=a3(),r=iu(),i=$n(),o=u3(),s=Je();function u(l,c,d){var p=s(l)?e:o,h=arguments.length<3;return p(l,i(c,4),d,h,r)}return mh=u,mh}var gh,_x;function l3(){if(_x)return gh;_x=1;var e=Dr(),r=Je(),i=xn(),o="[object String]";function s(u){return typeof u=="string"||!r(u)&&i(u)&&e(u)==o}return gh=s,gh}var yh,wx;function c3(){if(wx)return yh;wx=1;var e=Vb(),r=e("length");return yh=r,yh}var _h,xx;function f3(){if(xx)return _h;xx=1;var e="\\ud800-\\udfff",r="\\u0300-\\u036f",i="\\ufe20-\\ufe2f",o="\\u20d0-\\u20ff",s=r+i+o,u="\\ufe0e\\ufe0f",l="\\u200d",c=RegExp("["+l+e+s+u+"]");function d(p){return c.test(p)}return _h=d,_h}var wh,Sx;function d3(){if(Sx)return wh;Sx=1;var e="\\ud800-\\udfff",r="\\u0300-\\u036f",i="\\ufe20-\\ufe2f",o="\\u20d0-\\u20ff",s=r+i+o,u="\\ufe0e\\ufe0f",l="["+e+"]",c="["+s+"]",d="\\ud83c[\\udffb-\\udfff]",p="(?:"+c+"|"+d+")",h="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",_="\\u200d",k=p+"?",w="["+u+"]?",x="(?:"+_+"(?:"+[h,m,y].join("|")+")"+w+k+")*",S=w+k+x,b="(?:"+[h+c+"?",c,m,y,l].join("|")+")",N=RegExp(d+"(?="+d+")|"+b+S,"g");function C(I){for(var A=N.lastIndex=0;N.test(I);)++A;return A}return wh=C,wh}var xh,Ex;function h3(){if(Ex)return xh;Ex=1;var e=c3(),r=f3(),i=d3();function o(s){return r(s)?i(s):e(s)}return xh=o,xh}var Sh,kx;function p3(){if(kx)return Sh;kx=1;var e=Cm(),r=Ti(),i=Fn(),o=l3(),s=h3(),u="[object Map]",l="[object Set]";function c(d){if(d==null)return 0;if(i(d))return o(d)?s(d):d.length;var p=r(d);return p==u||p==l?d.size:e(d).length}return Sh=c,Sh}var Eh,bx;function v3(){if(bx)return Eh;bx=1;var e=Em(),r=Ib(),i=Mm(),o=$n(),s=ru(),u=Je(),l=Ri(),c=Bo(),d=Qt(),p=Vo();function h(m,y,_){var k=u(m),w=k||l(m)||p(m);if(y=o(y,4),_==null){var x=m&&m.constructor;w?_=k?new x:[]:d(m)?_=c(x)?r(s(m)):{}:_={}}return(w?e:i)(m,function(S,b,N){return y(_,S,b,N)}),_}return Eh=h,Eh}var kh,Cx;function m3(){if(Cx)return kh;Cx=1;var e=Ni(),r=Ho(),i=Je(),o=e?e.isConcatSpreadable:void 0;function s(u){return i(u)||r(u)||!!(o&&u&&u[o])}return kh=s,kh}var bh,Nx;function Om(){if(Nx)return bh;Nx=1;var e=Rm(),r=m3();function i(o,s,u,l,c){var d=-1,p=o.length;for(u||(u=r),c||(c=[]);++d<p;){var h=o[d];s>0&&u(h)?s>1?i(h,s-1,u,l,c):e(c,h):l||(c[c.length]=h)}return c}return bh=i,bh}var Ch,Rx;function g3(){if(Rx)return Ch;Rx=1;function e(r,i,o){switch(o.length){case 0:return r.call(i);case 1:return r.call(i,o[0]);case 2:return r.call(i,o[0],o[1]);case 3:return r.call(i,o[0],o[1],o[2])}return r.apply(i,o)}return Ch=e,Ch}var Nh,Tx;function Zb(){if(Tx)return Nh;Tx=1;var e=g3(),r=Math.max;function i(o,s,u){return s=r(s===void 0?o.length-1:s,0),function(){for(var l=arguments,c=-1,d=r(l.length-s,0),p=Array(d);++c<d;)p[c]=l[s+c];c=-1;for(var h=Array(s+1);++c<s;)h[c]=l[c];return h[s]=u(p),e(o,this,h)}}return Nh=i,Nh}var Rh,Ix;function y3(){if(Ix)return Rh;Ix=1;var e=Im(),r=gb(),i=$r(),o=r?function(s,u){return r(s,"toString",{configurable:!0,enumerable:!1,value:e(u),writable:!0})}:i;return Rh=o,Rh}var Th,Ax;function _3(){if(Ax)return Th;Ax=1;var e=800,r=16,i=Date.now;function o(s){var u=0,l=0;return function(){var c=i(),d=r-(c-l);if(l=c,d>0){if(++u>=e)return arguments[0]}else u=0;return s.apply(void 0,arguments)}}return Th=o,Th}var Ih,Mx;function Jb(){if(Mx)return Ih;Mx=1;var e=y3(),r=_3(),i=r(e);return Ih=i,Ih}var Ah,Px;function uu(){if(Px)return Ah;Px=1;var e=$r(),r=Zb(),i=Jb();function o(s,u){return i(r(s,u,e),s+"")}return Ah=o,Ah}var Mh,qx;function eC(){if(qx)return Mh;qx=1;function e(r,i,o,s){for(var u=r.length,l=o+(s?1:-1);s?l--:++l<u;)if(i(r[l],l,r))return l;return-1}return Mh=e,Mh}var Ph,Ox;function w3(){if(Ox)return Ph;Ox=1;function e(r){return r!==r}return Ph=e,Ph}var qh,Lx;function x3(){if(Lx)return qh;Lx=1;function e(r,i,o){for(var s=o-1,u=r.length;++s<u;)if(r[s]===i)return s;return-1}return qh=e,qh}var Oh,jx;function S3(){if(jx)return Oh;jx=1;var e=eC(),r=w3(),i=x3();function o(s,u,l){return u===u?i(s,u,l):e(s,r,l)}return Oh=o,Oh}var Lh,Dx;function E3(){if(Dx)return Lh;Dx=1;var e=S3();function r(i,o){var s=i==null?0:i.length;return!!s&&e(i,o,0)>-1}return Lh=r,Lh}var jh,zx;function k3(){if(zx)return jh;zx=1;function e(r,i,o){for(var s=-1,u=r==null?0:r.length;++s<u;)if(o(i,r[s]))return!0;return!1}return jh=e,jh}var Dh,Fx;function b3(){if(Fx)return Dh;Fx=1;function e(){}return Dh=e,Dh}var zh,$x;function C3(){if($x)return zh;$x=1;var e=Nb(),r=b3(),i=Pm(),o=1/0,s=e&&1/i(new e([,-0]))[1]==o?function(u){return new e(u)}:r;return zh=s,zh}var Fh,Bx;function N3(){if(Bx)return Fh;Bx=1;var e=Lb(),r=E3(),i=k3(),o=jb(),s=C3(),u=Pm(),l=200;function c(d,p,h){var m=-1,y=r,_=d.length,k=!0,w=[],x=w;if(h)k=!1,y=i;else if(_>=l){var S=p?null:s(d);if(S)return u(S);k=!1,y=o,x=new e}else x=p?[]:w;e:for(;++m<_;){var b=d[m],N=p?p(b):b;if(b=h||b!==0?b:0,k&&N===N){for(var C=x.length;C--;)if(x[C]===N)continue e;p&&x.push(N),w.push(b)}else y(x,N,h)||(x!==w&&x.push(N),w.push(b))}return w}return Fh=c,Fh}var $h,Ux;function tC(){if(Ux)return $h;Ux=1;var e=Fn(),r=xn();function i(o){return r(o)&&e(o)}return $h=i,$h}var Bh,Hx;function R3(){if(Hx)return Bh;Hx=1;var e=Om(),r=uu(),i=N3(),o=tC(),s=r(function(u){return i(e(u,1,o,!0))});return Bh=s,Bh}var Uh,Vx;function T3(){if(Vx)return Uh;Vx=1;var e=ou();function r(i,o){return e(o,function(s){return i[s]})}return Uh=r,Uh}var Hh,Gx;function nC(){if(Gx)return Hh;Gx=1;var e=T3(),r=dr();function i(o){return o==null?[]:e(o,r(o))}return Hh=i,Hh}var Vh,Wx;function Zt(){if(Wx)return Vh;Wx=1;var e;if(typeof wm=="function")try{e={clone:Lq(),constant:Im(),each:Ob(),filter:Gb(),has:Wb(),isArray:Je(),isEmpty:s3(),isFunction:Bo(),isUndefined:Kb(),keys:dr(),map:Xb(),reduce:Qb(),size:p3(),transform:v3(),union:R3(),values:nC()}}catch{}return e||(e=window._),Vh=e,Vh}var Gh,Kx;function Lm(){if(Kx)return Gh;Kx=1;var e=Zt();Gh=s;var r="\0",i="\0",o="";function s(h){this._isDirected=e.has(h,"directed")?h.directed:!0,this._isMultigraph=e.has(h,"multigraph")?h.multigraph:!1,this._isCompound=e.has(h,"compound")?h.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[i]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}s.prototype._nodeCount=0,s.prototype._edgeCount=0,s.prototype.isDirected=function(){return this._isDirected},s.prototype.isMultigraph=function(){return this._isMultigraph},s.prototype.isCompound=function(){return this._isCompound},s.prototype.setGraph=function(h){return this._label=h,this},s.prototype.graph=function(){return this._label},s.prototype.setDefaultNodeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultNodeLabelFn=h,this},s.prototype.nodeCount=function(){return this._nodeCount},s.prototype.nodes=function(){return e.keys(this._nodes)},s.prototype.sources=function(){var h=this;return e.filter(this.nodes(),function(m){return e.isEmpty(h._in[m])})},s.prototype.sinks=function(){var h=this;return e.filter(this.nodes(),function(m){return e.isEmpty(h._out[m])})},s.prototype.setNodes=function(h,m){var y=arguments,_=this;return e.each(h,function(k){y.length>1?_.setNode(k,m):_.setNode(k)}),this},s.prototype.setNode=function(h,m){return e.has(this._nodes,h)?(arguments.length>1&&(this._nodes[h]=m),this):(this._nodes[h]=arguments.length>1?m:this._defaultNodeLabelFn(h),this._isCompound&&(this._parent[h]=i,this._children[h]={},this._children[i][h]=!0),this._in[h]={},this._preds[h]={},this._out[h]={},this._sucs[h]={},++this._nodeCount,this)},s.prototype.node=function(h){return this._nodes[h]},s.prototype.hasNode=function(h){return e.has(this._nodes,h)},s.prototype.removeNode=function(h){var m=this;if(e.has(this._nodes,h)){var y=function(_){m.removeEdge(m._edgeObjs[_])};delete this._nodes[h],this._isCompound&&(this._removeFromParentsChildList(h),delete this._parent[h],e.each(this.children(h),function(_){m.setParent(_)}),delete this._children[h]),e.each(e.keys(this._in[h]),y),delete this._in[h],delete this._preds[h],e.each(e.keys(this._out[h]),y),delete this._out[h],delete this._sucs[h],--this._nodeCount}return this},s.prototype.setParent=function(h,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(m))m=i;else{m+="";for(var y=m;!e.isUndefined(y);y=this.parent(y))if(y===h)throw new Error("Setting "+m+" as parent of "+h+" would create a cycle");this.setNode(m)}return this.setNode(h),this._removeFromParentsChildList(h),this._parent[h]=m,this._children[m][h]=!0,this},s.prototype._removeFromParentsChildList=function(h){delete this._children[this._parent[h]][h]},s.prototype.parent=function(h){if(this._isCompound){var m=this._parent[h];if(m!==i)return m}},s.prototype.children=function(h){if(e.isUndefined(h)&&(h=i),this._isCompound){var m=this._children[h];if(m)return e.keys(m)}else{if(h===i)return this.nodes();if(this.hasNode(h))return[]}},s.prototype.predecessors=function(h){var m=this._preds[h];if(m)return e.keys(m)},s.prototype.successors=function(h){var m=this._sucs[h];if(m)return e.keys(m)},s.prototype.neighbors=function(h){var m=this.predecessors(h);if(m)return e.union(m,this.successors(h))},s.prototype.isLeaf=function(h){var m;return this.isDirected()?m=this.successors(h):m=this.neighbors(h),m.length===0},s.prototype.filterNodes=function(h){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var y=this;e.each(this._nodes,function(w,x){h(x)&&m.setNode(x,w)}),e.each(this._edgeObjs,function(w){m.hasNode(w.v)&&m.hasNode(w.w)&&m.setEdge(w,y.edge(w))});var _={};function k(w){var x=y.parent(w);return x===void 0||m.hasNode(x)?(_[w]=x,x):x in _?_[x]:k(x)}return this._isCompound&&e.each(m.nodes(),function(w){m.setParent(w,k(w))}),m},s.prototype.setDefaultEdgeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultEdgeLabelFn=h,this},s.prototype.edgeCount=function(){return this._edgeCount},s.prototype.edges=function(){return e.values(this._edgeObjs)},s.prototype.setPath=function(h,m){var y=this,_=arguments;return e.reduce(h,function(k,w){return _.length>1?y.setEdge(k,w,m):y.setEdge(k,w),w}),this},s.prototype.setEdge=function(){var h,m,y,_,k=!1,w=arguments[0];typeof w=="object"&&w!==null&&"v"in w?(h=w.v,m=w.w,y=w.name,arguments.length===2&&(_=arguments[1],k=!0)):(h=w,m=arguments[1],y=arguments[3],arguments.length>2&&(_=arguments[2],k=!0)),h=""+h,m=""+m,e.isUndefined(y)||(y=""+y);var x=c(this._isDirected,h,m,y);if(e.has(this._edgeLabels,x))return k&&(this._edgeLabels[x]=_),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(h),this.setNode(m),this._edgeLabels[x]=k?_:this._defaultEdgeLabelFn(h,m,y);var S=d(this._isDirected,h,m,y);return h=S.v,m=S.w,Object.freeze(S),this._edgeObjs[x]=S,u(this._preds[m],h),u(this._sucs[h],m),this._in[m][x]=S,this._out[h][x]=S,this._edgeCount++,this},s.prototype.edge=function(h,m,y){var _=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,h,m,y);return this._edgeLabels[_]},s.prototype.hasEdge=function(h,m,y){var _=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,h,m,y);return e.has(this._edgeLabels,_)},s.prototype.removeEdge=function(h,m,y){var _=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,h,m,y),k=this._edgeObjs[_];return k&&(h=k.v,m=k.w,delete this._edgeLabels[_],delete this._edgeObjs[_],l(this._preds[m],h),l(this._sucs[h],m),delete this._in[m][_],delete this._out[h][_],this._edgeCount--),this},s.prototype.inEdges=function(h,m){var y=this._in[h];if(y){var _=e.values(y);return m?e.filter(_,function(k){return k.v===m}):_}},s.prototype.outEdges=function(h,m){var y=this._out[h];if(y){var _=e.values(y);return m?e.filter(_,function(k){return k.w===m}):_}},s.prototype.nodeEdges=function(h,m){var y=this.inEdges(h,m);if(y)return y.concat(this.outEdges(h,m))};function u(h,m){h[m]?h[m]++:h[m]=1}function l(h,m){--h[m]||delete h[m]}function c(h,m,y,_){var k=""+m,w=""+y;if(!h&&k>w){var x=k;k=w,w=x}return k+o+w+o+(e.isUndefined(_)?r:_)}function d(h,m,y,_){var k=""+m,w=""+y;if(!h&&k>w){var x=k;k=w,w=x}var S={v:k,w};return _&&(S.name=_),S}function p(h,m){return c(h,m.v,m.w,m.name)}return Gh}var Wh,Yx;function I3(){return Yx||(Yx=1,Wh="2.1.8"),Wh}var Kh,Xx;function A3(){return Xx||(Xx=1,Kh={Graph:Lm(),version:I3()}),Kh}var Yh,Qx;function M3(){if(Qx)return Yh;Qx=1;var e=Zt(),r=Lm();Yh={write:i,read:u};function i(l){var c={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:o(l),edges:s(l)};return e.isUndefined(l.graph())||(c.value=e.clone(l.graph())),c}function o(l){return e.map(l.nodes(),function(c){var d=l.node(c),p=l.parent(c),h={v:c};return e.isUndefined(d)||(h.value=d),e.isUndefined(p)||(h.parent=p),h})}function s(l){return e.map(l.edges(),function(c){var d=l.edge(c),p={v:c.v,w:c.w};return e.isUndefined(c.name)||(p.name=c.name),e.isUndefined(d)||(p.value=d),p})}function u(l){var c=new r(l.options).setGraph(l.value);return e.each(l.nodes,function(d){c.setNode(d.v,d.value),d.parent&&c.setParent(d.v,d.parent)}),e.each(l.edges,function(d){c.setEdge({v:d.v,w:d.w,name:d.name},d.value)}),c}return Yh}var Xh,Zx;function P3(){if(Zx)return Xh;Zx=1;var e=Zt();Xh=r;function r(i){var o={},s=[],u;function l(c){e.has(o,c)||(o[c]=!0,u.push(c),e.each(i.successors(c),l),e.each(i.predecessors(c),l))}return e.each(i.nodes(),function(c){u=[],l(c),u.length&&s.push(u)}),s}return Xh}var Qh,Jx;function rC(){if(Jx)return Qh;Jx=1;var e=Zt();Qh=r;function r(){this._arr=[],this._keyIndices={}}return r.prototype.size=function(){return this._arr.length},r.prototype.keys=function(){return this._arr.map(function(i){return i.key})},r.prototype.has=function(i){return e.has(this._keyIndices,i)},r.prototype.priority=function(i){var o=this._keyIndices[i];if(o!==void 0)return this._arr[o].priority},r.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},r.prototype.add=function(i,o){var s=this._keyIndices;if(i=String(i),!e.has(s,i)){var u=this._arr,l=u.length;return s[i]=l,u.push({key:i,priority:o}),this._decrease(l),!0}return!1},r.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var i=this._arr.pop();return delete this._keyIndices[i.key],this._heapify(0),i.key},r.prototype.decrease=function(i,o){var s=this._keyIndices[i];if(o>this._arr[s].priority)throw new Error("New priority is greater than current priority. Key: "+i+" Old: "+this._arr[s].priority+" New: "+o);this._arr[s].priority=o,this._decrease(s)},r.prototype._heapify=function(i){var o=this._arr,s=2*i,u=s+1,l=i;s<o.length&&(l=o[s].priority<o[l].priority?s:l,u<o.length&&(l=o[u].priority<o[l].priority?u:l),l!==i&&(this._swap(i,l),this._heapify(l)))},r.prototype._decrease=function(i){for(var o=this._arr,s=o[i].priority,u;i!==0&&(u=i>>1,!(o[u].priority<s));)this._swap(i,u),i=u},r.prototype._swap=function(i,o){var s=this._arr,u=this._keyIndices,l=s[i],c=s[o];s[i]=c,s[o]=l,u[c.key]=i,u[l.key]=o},Qh}var Zh,eS;function iC(){if(eS)return Zh;eS=1;var e=Zt(),r=rC();Zh=o;var i=e.constant(1);function o(u,l,c,d){return s(u,String(l),c||i,d||function(p){return u.outEdges(p)})}function s(u,l,c,d){var p={},h=new r,m,y,_=function(k){var w=k.v!==m?k.v:k.w,x=p[w],S=c(k),b=y.distance+S;if(S<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+k+" Weight: "+S);b<x.distance&&(x.distance=b,x.predecessor=m,h.decrease(w,b))};for(u.nodes().forEach(function(k){var w=k===l?0:Number.POSITIVE_INFINITY;p[k]={distance:w},h.add(k,w)});h.size()>0&&(m=h.removeMin(),y=p[m],y.distance!==Number.POSITIVE_INFINITY);)d(m).forEach(_);return p}return Zh}var Jh,tS;function q3(){if(tS)return Jh;tS=1;var e=iC(),r=Zt();Jh=i;function i(o,s,u){return r.transform(o.nodes(),function(l,c){l[c]=e(o,c,s,u)},{})}return Jh}var ep,nS;function oC(){if(nS)return ep;nS=1;var e=Zt();ep=r;function r(i){var o=0,s=[],u={},l=[];function c(d){var p=u[d]={onStack:!0,lowlink:o,index:o++};if(s.push(d),i.successors(d).forEach(function(y){e.has(u,y)?u[y].onStack&&(p.lowlink=Math.min(p.lowlink,u[y].index)):(c(y),p.lowlink=Math.min(p.lowlink,u[y].lowlink))}),p.lowlink===p.index){var h=[],m;do m=s.pop(),u[m].onStack=!1,h.push(m);while(d!==m);l.push(h)}}return i.nodes().forEach(function(d){e.has(u,d)||c(d)}),l}return ep}var tp,rS;function O3(){if(rS)return tp;rS=1;var e=Zt(),r=oC();tp=i;function i(o){return e.filter(r(o),function(s){return s.length>1||s.length===1&&o.hasEdge(s[0],s[0])})}return tp}var np,iS;function L3(){if(iS)return np;iS=1;var e=Zt();np=i;var r=e.constant(1);function i(s,u,l){return o(s,u||r,l||function(c){return s.outEdges(c)})}function o(s,u,l){var c={},d=s.nodes();return d.forEach(function(p){c[p]={},c[p][p]={distance:0},d.forEach(function(h){p!==h&&(c[p][h]={distance:Number.POSITIVE_INFINITY})}),l(p).forEach(function(h){var m=h.v===p?h.w:h.v,y=u(h);c[p][m]={distance:y,predecessor:p}})}),d.forEach(function(p){var h=c[p];d.forEach(function(m){var y=c[m];d.forEach(function(_){var k=y[p],w=h[_],x=y[_],S=k.distance+w.distance;S<x.distance&&(x.distance=S,x.predecessor=w.predecessor)})})}),c}return np}var rp,oS;function sC(){if(oS)return rp;oS=1;var e=Zt();rp=r,r.CycleException=i;function r(o){var s={},u={},l=[];function c(d){if(e.has(u,d))throw new i;e.has(s,d)||(u[d]=!0,s[d]=!0,e.each(o.predecessors(d),c),delete u[d],l.push(d))}if(e.each(o.sinks(),c),e.size(s)!==o.nodeCount())throw new i;return l}function i(){}return i.prototype=new Error,rp}var ip,sS;function j3(){if(sS)return ip;sS=1;var e=sC();ip=r;function r(i){try{e(i)}catch(o){if(o instanceof e.CycleException)return!1;throw o}return!0}return ip}var op,aS;function aC(){if(aS)return op;aS=1;var e=Zt();op=r;function r(o,s,u){e.isArray(s)||(s=[s]);var l=(o.isDirected()?o.successors:o.neighbors).bind(o),c=[],d={};return e.each(s,function(p){if(!o.hasNode(p))throw new Error("Graph does not have node: "+p);i(o,p,u==="post",d,l,c)}),c}function i(o,s,u,l,c,d){e.has(l,s)||(l[s]=!0,u||d.push(s),e.each(c(s),function(p){i(o,p,u,l,c,d)}),u&&d.push(s))}return op}var sp,uS;function D3(){if(uS)return sp;uS=1;var e=aC();sp=r;function r(i,o){return e(i,o,"post")}return sp}var ap,lS;function z3(){if(lS)return ap;lS=1;var e=aC();ap=r;function r(i,o){return e(i,o,"pre")}return ap}var up,cS;function F3(){if(cS)return up;cS=1;var e=Zt(),r=Lm(),i=rC();up=o;function o(s,u){var l=new r,c={},d=new i,p;function h(y){var _=y.v===p?y.w:y.v,k=d.priority(_);if(k!==void 0){var w=u(y);w<k&&(c[_]=p,d.decrease(_,w))}}if(s.nodeCount()===0)return l;e.each(s.nodes(),function(y){d.add(y,Number.POSITIVE_INFINITY),l.setNode(y)}),d.decrease(s.nodes()[0],0);for(var m=!1;d.size()>0;){if(p=d.removeMin(),e.has(c,p))l.setEdge(p,c[p]);else{if(m)throw new Error("Input graph is not connected: "+s);m=!0}s.nodeEdges(p).forEach(h)}return l}return up}var lp,fS;function $3(){return fS||(fS=1,lp={components:P3(),dijkstra:iC(),dijkstraAll:q3(),findCycles:O3(),floydWarshall:L3(),isAcyclic:j3(),postorder:D3(),preorder:z3(),prim:F3(),tarjan:oC(),topsort:sC()}),lp}var cp,dS;function B3(){if(dS)return cp;dS=1;var e=A3();return cp={Graph:e.Graph,json:M3(),alg:$3(),version:e.version},cp}var fp,hS;function cn(){if(hS)return fp;hS=1;var e;if(typeof wm=="function")try{e=B3()}catch{}return e||(e=window.graphlib),fp=e,fp}var dp,pS;function U3(){if(pS)return dp;pS=1;var e=Mb(),r=1,i=4;function o(s){return e(s,r|i)}return dp=o,dp}var hp,vS;function lu(){if(vS)return hp;vS=1;var e=Ci(),r=Fn(),i=eu(),o=Qt();function s(u,l,c){if(!o(c))return!1;var d=typeof l;return(d=="number"?r(c)&&i(l,c.length):d=="string"&&l in c)?e(c[l],u):!1}return hp=s,hp}var pp,mS;function H3(){if(mS)return pp;mS=1;var e=uu(),r=Ci(),i=lu(),o=Fr(),s=Object.prototype,u=s.hasOwnProperty,l=e(function(c,d){c=Object(c);var p=-1,h=d.length,m=h>2?d[2]:void 0;for(m&&i(d[0],d[1],m)&&(h=1);++p<h;)for(var y=d[p],_=o(y),k=-1,w=_.length;++k<w;){var x=_[k],S=c[x];(S===void 0||r(S,s[x])&&!u.call(c,x))&&(c[x]=y[x])}return c});return pp=l,pp}var vp,gS;function V3(){if(gS)return vp;gS=1;var e=$n(),r=Fn(),i=dr();function o(s){return function(u,l,c){var d=Object(u);if(!r(u)){var p=e(l,3);u=i(u),l=function(m){return p(d[m],m,d)}}var h=s(u,l,c);return h>-1?d[p?u[h]:h]:void 0}}return vp=o,vp}var mp,yS;function G3(){if(yS)return mp;yS=1;var e=/\s/;function r(i){for(var o=i.length;o--&&e.test(i.charAt(o)););return o}return mp=r,mp}var gp,_S;function W3(){if(_S)return gp;_S=1;var e=G3(),r=/^\s+/;function i(o){return o&&o.slice(0,e(o)+1).replace(r,"")}return gp=i,gp}var yp,wS;function K3(){if(wS)return yp;wS=1;var e=W3(),r=Qt(),i=Ii(),o=NaN,s=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,l=/^0o[0-7]+$/i,c=parseInt;function d(p){if(typeof p=="number")return p;if(i(p))return o;if(r(p)){var h=typeof p.valueOf=="function"?p.valueOf():p;p=r(h)?h+"":h}if(typeof p!="string")return p===0?p:+p;p=e(p);var m=u.test(p);return m||l.test(p)?c(p.slice(2),m?2:8):s.test(p)?o:+p}return yp=d,yp}var _p,xS;function uC(){if(xS)return _p;xS=1;var e=K3(),r=1/0,i=17976931348623157e292;function o(s){if(!s)return s===0?s:0;if(s=e(s),s===r||s===-r){var u=s<0?-1:1;return u*i}return s===s?s:0}return _p=o,_p}var wp,SS;function Y3(){if(SS)return wp;SS=1;var e=uC();function r(i){var o=e(i),s=o%1;return o===o?s?o-s:o:0}return wp=r,wp}var xp,ES;function X3(){if(ES)return xp;ES=1;var e=eC(),r=$n(),i=Y3(),o=Math.max;function s(u,l,c){var d=u==null?0:u.length;if(!d)return-1;var p=c==null?0:i(c);return p<0&&(p=o(d+p,0)),e(u,r(l,3),p)}return xp=s,xp}var Sp,kS;function Q3(){if(kS)return Sp;kS=1;var e=V3(),r=X3(),i=e(r);return Sp=i,Sp}var Ep,bS;function lC(){if(bS)return Ep;bS=1;var e=Om();function r(i){var o=i==null?0:i.length;return o?e(i,1):[]}return Ep=r,Ep}var kp,CS;function Z3(){if(CS)return kp;CS=1;var e=Am(),r=Pb(),i=Fr();function o(s,u){return s==null?s:e(s,r(u),i)}return kp=o,kp}var bp,NS;function J3(){if(NS)return bp;NS=1;function e(r){var i=r==null?0:r.length;return i?r[i-1]:void 0}return bp=e,bp}var Cp,RS;function eO(){if(RS)return Cp;RS=1;var e=Za(),r=Mm(),i=$n();function o(s,u){var l={};return u=i(u,3),r(s,function(c,d,p){e(l,d,u(c,d,p))}),l}return Cp=o,Cp}var Np,TS;function jm(){if(TS)return Np;TS=1;var e=Ii();function r(i,o,s){for(var u=-1,l=i.length;++u<l;){var c=i[u],d=o(c);if(d!=null&&(p===void 0?d===d&&!e(d):s(d,p)))var p=d,h=c}return h}return Np=r,Np}var Rp,IS;function tO(){if(IS)return Rp;IS=1;function e(r,i){return r>i}return Rp=e,Rp}var Tp,AS;function nO(){if(AS)return Tp;AS=1;var e=jm(),r=tO(),i=$r();function o(s){return s&&s.length?e(s,i,r):void 0}return Tp=o,Tp}var Ip,MS;function cC(){if(MS)return Ip;MS=1;var e=Za(),r=Ci();function i(o,s,u){(u!==void 0&&!r(o[s],u)||u===void 0&&!(s in o))&&e(o,s,u)}return Ip=i,Ip}var Ap,PS;function rO(){if(PS)return Ap;PS=1;var e=Dr(),r=ru(),i=xn(),o="[object Object]",s=Function.prototype,u=Object.prototype,l=s.toString,c=u.hasOwnProperty,d=l.call(Object);function p(h){if(!i(h)||e(h)!=o)return!1;var m=r(h);if(m===null)return!0;var y=c.call(m,"constructor")&&m.constructor;return typeof y=="function"&&y instanceof y&&l.call(y)==d}return Ap=p,Ap}var Mp,qS;function fC(){if(qS)return Mp;qS=1;function e(r,i){if(!(i==="constructor"&&typeof r[i]=="function")&&i!="__proto__")return r[i]}return Mp=e,Mp}var Pp,OS;function iO(){if(OS)return Pp;OS=1;var e=Uo(),r=Fr();function i(o){return e(o,r(o))}return Pp=i,Pp}var qp,LS;function oO(){if(LS)return qp;LS=1;var e=cC(),r=wb(),i=Tb(),o=xb(),s=Ab(),u=Ho(),l=Je(),c=tC(),d=Ri(),p=Bo(),h=Qt(),m=rO(),y=Vo(),_=fC(),k=iO();function w(x,S,b,N,C,I,A){var P=_(x,b),$=_(S,b),L=A.get($);if(L){e(x,b,L);return}var U=I?I(P,$,b+"",x,S,A):void 0,V=U===void 0;if(V){var ee=l($),Z=!ee&&d($),R=!ee&&!Z&&y($);U=$,ee||Z||R?l(P)?U=P:c(P)?U=o(P):Z?(V=!1,U=r($,!0)):R?(V=!1,U=i($,!0)):U=[]:m($)||u($)?(U=P,u(P)?U=k(P):(!h(P)||p(P))&&(U=s($))):V=!1}V&&(A.set($,U),C(U,$,N,I,A),A.delete($)),e(x,b,U)}return qp=w,qp}var Op,jS;function sO(){if(jS)return Op;jS=1;var e=Qa(),r=cC(),i=Am(),o=oO(),s=Qt(),u=Fr(),l=fC();function c(d,p,h,m,y){d!==p&&i(p,function(_,k){if(y||(y=new e),s(_))o(d,p,k,h,c,m,y);else{var w=m?m(l(d,k),_,k+"",d,p,y):void 0;w===void 0&&(w=_),r(d,k,w)}},u)}return Op=c,Op}var Lp,DS;function aO(){if(DS)return Lp;DS=1;var e=uu(),r=lu();function i(o){return e(function(s,u){var l=-1,c=u.length,d=c>1?u[c-1]:void 0,p=c>2?u[2]:void 0;for(d=o.length>3&&typeof d=="function"?(c--,d):void 0,p&&r(u[0],u[1],p)&&(d=c<3?void 0:d,c=1),s=Object(s);++l<c;){var h=u[l];h&&o(s,h,l,d)}return s})}return Lp=i,Lp}var jp,zS;function uO(){if(zS)return jp;zS=1;var e=sO(),r=aO(),i=r(function(o,s,u){e(o,s,u)});return jp=i,jp}var Dp,FS;function dC(){if(FS)return Dp;FS=1;function e(r,i){return r<i}return Dp=e,Dp}var zp,$S;function lO(){if($S)return zp;$S=1;var e=jm(),r=dC(),i=$r();function o(s){return s&&s.length?e(s,i,r):void 0}return zp=o,zp}var Fp,BS;function cO(){if(BS)return Fp;BS=1;var e=jm(),r=$n(),i=dC();function o(s,u){return s&&s.length?e(s,r(u,2),i):void 0}return Fp=o,Fp}var $p,US;function fO(){if(US)return $p;US=1;var e=dn(),r=function(){return e.Date.now()};return $p=r,$p}var Bp,HS;function dO(){if(HS)return Bp;HS=1;var e=Ja(),r=su(),i=eu(),o=Qt(),s=Go();function u(l,c,d,p){if(!o(l))return l;c=r(c,l);for(var h=-1,m=c.length,y=m-1,_=l;_!=null&&++h<m;){var k=s(c[h]),w=d;if(k==="__proto__"||k==="constructor"||k==="prototype")return l;if(h!=y){var x=_[k];w=p?p(x,k,_):void 0,w===void 0&&(w=o(x)?x:i(c[h+1])?[]:{})}e(_,k,w),_=_[k]}return l}return Bp=u,Bp}var Up,VS;function hO(){if(VS)return Up;VS=1;var e=au(),r=dO(),i=su();function o(s,u,l){for(var c=-1,d=u.length,p={};++c<d;){var h=u[c],m=e(s,h);l(m,h)&&r(p,i(h,s),m)}return p}return Up=o,Up}var Hp,GS;function pO(){if(GS)return Hp;GS=1;var e=hO(),r=Hb();function i(o,s){return e(o,s,function(u,l){return r(o,l)})}return Hp=i,Hp}var Vp,WS;function vO(){if(WS)return Vp;WS=1;var e=lC(),r=Zb(),i=Jb();function o(s){return i(r(s,void 0,e),s+"")}return Vp=o,Vp}var Gp,KS;function mO(){if(KS)return Gp;KS=1;var e=pO(),r=vO(),i=r(function(o,s){return o==null?{}:e(o,s)});return Gp=i,Gp}var Wp,YS;function gO(){if(YS)return Wp;YS=1;var e=Math.ceil,r=Math.max;function i(o,s,u,l){for(var c=-1,d=r(e((s-o)/(u||1)),0),p=Array(d);d--;)p[l?d:++c]=o,o+=u;return p}return Wp=i,Wp}var Kp,XS;function yO(){if(XS)return Kp;XS=1;var e=gO(),r=lu(),i=uC();function o(s){return function(u,l,c){return c&&typeof c!="number"&&r(u,l,c)&&(l=c=void 0),u=i(u),l===void 0?(l=u,u=0):l=i(l),c=c===void 0?u<l?1:-1:i(c),e(u,l,c,s)}}return Kp=o,Kp}var Yp,QS;function _O(){if(QS)return Yp;QS=1;var e=yO(),r=e();return Yp=r,Yp}var Xp,ZS;function wO(){if(ZS)return Xp;ZS=1;function e(r,i){var o=r.length;for(r.sort(i);o--;)r[o]=r[o].value;return r}return Xp=e,Xp}var Qp,JS;function xO(){if(JS)return Qp;JS=1;var e=Ii();function r(i,o){if(i!==o){var s=i!==void 0,u=i===null,l=i===i,c=e(i),d=o!==void 0,p=o===null,h=o===o,m=e(o);if(!p&&!m&&!c&&i>o||c&&d&&h&&!p&&!m||u&&d&&h||!s&&h||!l)return 1;if(!u&&!c&&!m&&i<o||m&&s&&l&&!u&&!c||p&&s&&l||!d&&l||!h)return-1}return 0}return Qp=r,Qp}var Zp,eE;function SO(){if(eE)return Zp;eE=1;var e=xO();function r(i,o,s){for(var u=-1,l=i.criteria,c=o.criteria,d=l.length,p=s.length;++u<d;){var h=e(l[u],c[u]);if(h){if(u>=p)return h;var m=s[u];return h*(m=="desc"?-1:1)}}return i.index-o.index}return Zp=r,Zp}var Jp,tE;function EO(){if(tE)return Jp;tE=1;var e=ou(),r=au(),i=$n(),o=Yb(),s=wO(),u=tu(),l=SO(),c=$r(),d=Je();function p(h,m,y){m.length?m=e(m,function(w){return d(w)?function(x){return r(x,w.length===1?w[0]:w)}:w}):m=[c];var _=-1;m=e(m,u(i));var k=o(h,function(w,x,S){var b=e(m,function(N){return N(w)});return{criteria:b,index:++_,value:w}});return s(k,function(w,x){return l(w,x,y)})}return Jp=p,Jp}var ev,nE;function kO(){if(nE)return ev;nE=1;var e=Om(),r=EO(),i=uu(),o=lu(),s=i(function(u,l){if(u==null)return[];var c=l.length;return c>1&&o(u,l[0],l[1])?l=[]:c>2&&o(l[0],l[1],l[2])&&(l=[l[0]]),r(u,e(l,1),[])});return ev=s,ev}var tv,rE;function bO(){if(rE)return tv;rE=1;var e=Bb(),r=0;function i(o){var s=++r;return e(o)+s}return tv=i,tv}var nv,iE;function CO(){if(iE)return nv;iE=1;function e(r,i,o){for(var s=-1,u=r.length,l=i.length,c={};++s<u;){var d=s<l?i[s]:void 0;o(c,r[s],d)}return c}return nv=e,nv}var rv,oE;function NO(){if(oE)return rv;oE=1;var e=Ja(),r=CO();function i(o,s){return r(o||[],s||[],e)}return rv=i,rv}var iv,sE;function Ue(){if(sE)return iv;sE=1;var e;if(typeof wm=="function")try{e={cloneDeep:U3(),constant:Im(),defaults:H3(),each:Ob(),filter:Gb(),find:Q3(),flatten:lC(),forEach:qb(),forIn:Z3(),has:Wb(),isUndefined:Kb(),last:J3(),map:Xb(),mapValues:eO(),max:nO(),merge:uO(),min:lO(),minBy:cO(),now:fO(),pick:mO(),range:_O(),reduce:Qb(),sortBy:kO(),uniqueId:bO(),values:nC(),zipObject:NO()}}catch{}return e||(e=window._),iv=e,iv}var ov,aE;function RO(){if(aE)return ov;aE=1,ov=e;function e(){var o={};o._next=o._prev=o,this._sentinel=o}e.prototype.dequeue=function(){var o=this._sentinel,s=o._prev;if(s!==o)return r(s),s},e.prototype.enqueue=function(o){var s=this._sentinel;o._prev&&o._next&&r(o),o._next=s._next,s._next._prev=o,s._next=o,o._prev=s},e.prototype.toString=function(){for(var o=[],s=this._sentinel,u=s._prev;u!==s;)o.push(JSON.stringify(u,i)),u=u._prev;return"["+o.join(", ")+"]"};function r(o){o._prev._next=o._next,o._next._prev=o._prev,delete o._next,delete o._prev}function i(o,s){if(o!=="_next"&&o!=="_prev")return s}return ov}var sv,uE;function TO(){if(uE)return sv;uE=1;var e=Ue(),r=cn().Graph,i=RO();sv=s;var o=e.constant(1);function s(p,h){if(p.nodeCount()<=1)return[];var m=c(p,h||o),y=u(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(y,function(_){return p.outEdges(_.v,_.w)}),!0)}function u(p,h,m){for(var y=[],_=h[h.length-1],k=h[0],w;p.nodeCount();){for(;w=k.dequeue();)l(p,h,m,w);for(;w=_.dequeue();)l(p,h,m,w);if(p.nodeCount()){for(var x=h.length-2;x>0;--x)if(w=h[x].dequeue(),w){y=y.concat(l(p,h,m,w,!0));break}}}return y}function l(p,h,m,y,_){var k=_?[]:void 0;return e.forEach(p.inEdges(y.v),function(w){var x=p.edge(w),S=p.node(w.v);_&&k.push({v:w.v,w:w.w}),S.out-=x,d(h,m,S)}),e.forEach(p.outEdges(y.v),function(w){var x=p.edge(w),S=w.w,b=p.node(S);b.in-=x,d(h,m,b)}),p.removeNode(y.v),k}function c(p,h){var m=new r,y=0,_=0;e.forEach(p.nodes(),function(x){m.setNode(x,{v:x,in:0,out:0})}),e.forEach(p.edges(),function(x){var S=m.edge(x.v,x.w)||0,b=h(x),N=S+b;m.setEdge(x.v,x.w,N),_=Math.max(_,m.node(x.v).out+=b),y=Math.max(y,m.node(x.w).in+=b)});var k=e.range(_+y+3).map(function(){return new i}),w=y+1;return e.forEach(m.nodes(),function(x){d(k,w,m.node(x))}),{graph:m,buckets:k,zeroIdx:w}}function d(p,h,m){m.out?m.in?p[m.out-m.in+h].enqueue(m):p[p.length-1].enqueue(m):p[0].enqueue(m)}return sv}var av,lE;function IO(){if(lE)return av;lE=1;var e=Ue(),r=TO();av={run:i,undo:s};function i(u){var l=u.graph().acyclicer==="greedy"?r(u,c(u)):o(u);e.forEach(l,function(d){var p=u.edge(d);u.removeEdge(d),p.forwardName=d.name,p.reversed=!0,u.setEdge(d.w,d.v,p,e.uniqueId("rev"))});function c(d){return function(p){return d.edge(p).weight}}}function o(u){var l=[],c={},d={};function p(h){e.has(d,h)||(d[h]=!0,c[h]=!0,e.forEach(u.outEdges(h),function(m){e.has(c,m.w)?l.push(m):p(m.w)}),delete c[h])}return e.forEach(u.nodes(),p),l}function s(u){e.forEach(u.edges(),function(l){var c=u.edge(l);if(c.reversed){u.removeEdge(l);var d=c.forwardName;delete c.reversed,delete c.forwardName,u.setEdge(l.w,l.v,c,d)}})}return av}var uv,cE;function Pt(){if(cE)return uv;cE=1;var e=Ue(),r=cn().Graph;uv={addDummyNode:i,simplify:o,asNonCompoundGraph:s,successorWeights:u,predecessorWeights:l,intersectRect:c,buildLayerMatrix:d,normalizeRanks:p,removeEmptyRanks:h,addBorderNode:m,maxRank:y,partition:_,time:k,notime:w};function i(x,S,b,N){var C;do C=e.uniqueId(N);while(x.hasNode(C));return b.dummy=S,x.setNode(C,b),C}function o(x){var S=new r().setGraph(x.graph());return e.forEach(x.nodes(),function(b){S.setNode(b,x.node(b))}),e.forEach(x.edges(),function(b){var N=S.edge(b.v,b.w)||{weight:0,minlen:1},C=x.edge(b);S.setEdge(b.v,b.w,{weight:N.weight+C.weight,minlen:Math.max(N.minlen,C.minlen)})}),S}function s(x){var S=new r({multigraph:x.isMultigraph()}).setGraph(x.graph());return e.forEach(x.nodes(),function(b){x.children(b).length||S.setNode(b,x.node(b))}),e.forEach(x.edges(),function(b){S.setEdge(b,x.edge(b))}),S}function u(x){var S=e.map(x.nodes(),function(b){var N={};return e.forEach(x.outEdges(b),function(C){N[C.w]=(N[C.w]||0)+x.edge(C).weight}),N});return e.zipObject(x.nodes(),S)}function l(x){var S=e.map(x.nodes(),function(b){var N={};return e.forEach(x.inEdges(b),function(C){N[C.v]=(N[C.v]||0)+x.edge(C).weight}),N});return e.zipObject(x.nodes(),S)}function c(x,S){var b=x.x,N=x.y,C=S.x-b,I=S.y-N,A=x.width/2,P=x.height/2;if(!C&&!I)throw new Error("Not possible to find intersection inside of the rectangle");var $,L;return Math.abs(I)*A>Math.abs(C)*P?(I<0&&(P=-P),$=P*C/I,L=P):(C<0&&(A=-A),$=A,L=A*I/C),{x:b+$,y:N+L}}function d(x){var S=e.map(e.range(y(x)+1),function(){return[]});return e.forEach(x.nodes(),function(b){var N=x.node(b),C=N.rank;e.isUndefined(C)||(S[C][N.order]=b)}),S}function p(x){var S=e.min(e.map(x.nodes(),function(b){return x.node(b).rank}));e.forEach(x.nodes(),function(b){var N=x.node(b);e.has(N,"rank")&&(N.rank-=S)})}function h(x){var S=e.min(e.map(x.nodes(),function(I){return x.node(I).rank})),b=[];e.forEach(x.nodes(),function(I){var A=x.node(I).rank-S;b[A]||(b[A]=[]),b[A].push(I)});var N=0,C=x.graph().nodeRankFactor;e.forEach(b,function(I,A){e.isUndefined(I)&&A%C!==0?--N:N&&e.forEach(I,function(P){x.node(P).rank+=N})})}function m(x,S,b,N){var C={width:0,height:0};return arguments.length>=4&&(C.rank=b,C.order=N),i(x,"border",C,S)}function y(x){return e.max(e.map(x.nodes(),function(S){var b=x.node(S).rank;if(!e.isUndefined(b))return b}))}function _(x,S){var b={lhs:[],rhs:[]};return e.forEach(x,function(N){S(N)?b.lhs.push(N):b.rhs.push(N)}),b}function k(x,S){var b=e.now();try{return S()}finally{console.log(x+" time: "+(e.now()-b)+"ms")}}function w(x,S){return S()}return uv}var lv,fE;function AO(){if(fE)return lv;fE=1;var e=Ue(),r=Pt();lv={run:i,undo:s};function i(u){u.graph().dummyChains=[],e.forEach(u.edges(),function(l){o(u,l)})}function o(u,l){var c=l.v,d=u.node(c).rank,p=l.w,h=u.node(p).rank,m=l.name,y=u.edge(l),_=y.labelRank;if(h!==d+1){u.removeEdge(l);var k,w,x;for(x=0,++d;d<h;++x,++d)y.points=[],w={width:0,height:0,edgeLabel:y,edgeObj:l,rank:d},k=r.addDummyNode(u,"edge",w,"_d"),d===_&&(w.width=y.width,w.height=y.height,w.dummy="edge-label",w.labelpos=y.labelpos),u.setEdge(c,k,{weight:y.weight},m),x===0&&u.graph().dummyChains.push(k),c=k;u.setEdge(c,p,{weight:y.weight},m)}}function s(u){e.forEach(u.graph().dummyChains,function(l){var c=u.node(l),d=c.edgeLabel,p;for(u.setEdge(c.edgeObj,d);c.dummy;)p=u.successors(l)[0],u.removeNode(l),d.points.push({x:c.x,y:c.y}),c.dummy==="edge-label"&&(d.x=c.x,d.y=c.y,d.width=c.width,d.height=c.height),l=p,c=u.node(l)})}return lv}var cv,dE;function Da(){if(dE)return cv;dE=1;var e=Ue();cv={longestPath:r,slack:i};function r(o){var s={};function u(l){var c=o.node(l);if(e.has(s,l))return c.rank;s[l]=!0;var d=e.min(e.map(o.outEdges(l),function(p){return u(p.w)-o.edge(p).minlen}));return(d===Number.POSITIVE_INFINITY||d===void 0||d===null)&&(d=0),c.rank=d}e.forEach(o.sources(),u)}function i(o,s){return o.node(s.w).rank-o.node(s.v).rank-o.edge(s).minlen}return cv}var fv,hE;function hC(){if(hE)return fv;hE=1;var e=Ue(),r=cn().Graph,i=Da().slack;fv=o;function o(c){var d=new r({directed:!1}),p=c.nodes()[0],h=c.nodeCount();d.setNode(p,{});for(var m,y;s(d,c)<h;)m=u(d,c),y=d.hasNode(m.v)?i(c,m):-i(c,m),l(d,c,y);return d}function s(c,d){function p(h){e.forEach(d.nodeEdges(h),function(m){var y=m.v,_=h===y?m.w:y;!c.hasNode(_)&&!i(d,m)&&(c.setNode(_,{}),c.setEdge(h,_,{}),p(_))})}return e.forEach(c.nodes(),p),c.nodeCount()}function u(c,d){return e.minBy(d.edges(),function(p){if(c.hasNode(p.v)!==c.hasNode(p.w))return i(d,p)})}function l(c,d,p){e.forEach(c.nodes(),function(h){d.node(h).rank+=p})}return fv}var dv,pE;function MO(){if(pE)return dv;pE=1;var e=Ue(),r=hC(),i=Da().slack,o=Da().longestPath,s=cn().alg.preorder,u=cn().alg.postorder,l=Pt().simplify;dv=c,c.initLowLimValues=m,c.initCutValues=d,c.calcCutValue=h,c.leaveEdge=_,c.enterEdge=k,c.exchangeEdges=w;function c(N){N=l(N),o(N);var C=r(N);m(C),d(C,N);for(var I,A;I=_(C);)A=k(C,N,I),w(C,N,I,A)}function d(N,C){var I=u(N,N.nodes());I=I.slice(0,I.length-1),e.forEach(I,function(A){p(N,C,A)})}function p(N,C,I){var A=N.node(I),P=A.parent;N.edge(I,P).cutvalue=h(N,C,I)}function h(N,C,I){var A=N.node(I),P=A.parent,$=!0,L=C.edge(I,P),U=0;return L||($=!1,L=C.edge(P,I)),U=L.weight,e.forEach(C.nodeEdges(I),function(V){var ee=V.v===I,Z=ee?V.w:V.v;if(Z!==P){var R=ee===$,W=C.edge(V).weight;if(U+=R?W:-W,S(N,I,Z)){var F=N.edge(I,Z).cutvalue;U+=R?-F:F}}}),U}function m(N,C){arguments.length<2&&(C=N.nodes()[0]),y(N,{},1,C)}function y(N,C,I,A,P){var $=I,L=N.node(A);return C[A]=!0,e.forEach(N.neighbors(A),function(U){e.has(C,U)||(I=y(N,C,I,U,A))}),L.low=$,L.lim=I++,P?L.parent=P:delete L.parent,I}function _(N){return e.find(N.edges(),function(C){return N.edge(C).cutvalue<0})}function k(N,C,I){var A=I.v,P=I.w;C.hasEdge(A,P)||(A=I.w,P=I.v);var $=N.node(A),L=N.node(P),U=$,V=!1;$.lim>L.lim&&(U=L,V=!0);var ee=e.filter(C.edges(),function(Z){return V===b(N,N.node(Z.v),U)&&V!==b(N,N.node(Z.w),U)});return e.minBy(ee,function(Z){return i(C,Z)})}function w(N,C,I,A){var P=I.v,$=I.w;N.removeEdge(P,$),N.setEdge(A.v,A.w,{}),m(N),d(N,C),x(N,C)}function x(N,C){var I=e.find(N.nodes(),function(P){return!C.node(P).parent}),A=s(N,I);A=A.slice(1),e.forEach(A,function(P){var $=N.node(P).parent,L=C.edge(P,$),U=!1;L||(L=C.edge($,P),U=!0),C.node(P).rank=C.node($).rank+(U?L.minlen:-L.minlen)})}function S(N,C,I){return N.hasEdge(C,I)}function b(N,C,I){return I.low<=C.lim&&C.lim<=I.lim}return dv}var hv,vE;function PO(){if(vE)return hv;vE=1;var e=Da(),r=e.longestPath,i=hC(),o=MO();hv=s;function s(d){switch(d.graph().ranker){case"network-simplex":c(d);break;case"tight-tree":l(d);break;case"longest-path":u(d);break;default:c(d)}}var u=r;function l(d){r(d),i(d)}function c(d){o(d)}return hv}var pv,mE;function qO(){if(mE)return pv;mE=1;var e=Ue();pv=r;function r(s){var u=o(s);e.forEach(s.graph().dummyChains,function(l){for(var c=s.node(l),d=c.edgeObj,p=i(s,u,d.v,d.w),h=p.path,m=p.lca,y=0,_=h[y],k=!0;l!==d.w;){if(c=s.node(l),k){for(;(_=h[y])!==m&&s.node(_).maxRank<c.rank;)y++;_===m&&(k=!1)}if(!k){for(;y<h.length-1&&s.node(_=h[y+1]).minRank<=c.rank;)y++;_=h[y]}s.setParent(l,_),l=s.successors(l)[0]}})}function i(s,u,l,c){var d=[],p=[],h=Math.min(u[l].low,u[c].low),m=Math.max(u[l].lim,u[c].lim),y,_;y=l;do y=s.parent(y),d.push(y);while(y&&(u[y].low>h||m>u[y].lim));for(_=y,y=c;(y=s.parent(y))!==_;)p.push(y);return{path:d.concat(p.reverse()),lca:_}}function o(s){var u={},l=0;function c(d){var p=l;e.forEach(s.children(d),c),u[d]={low:p,lim:l++}}return e.forEach(s.children(),c),u}return pv}var vv,gE;function OO(){if(gE)return vv;gE=1;var e=Ue(),r=Pt();vv={run:i,cleanup:l};function i(c){var d=r.addDummyNode(c,"root",{},"_root"),p=s(c),h=e.max(e.values(p))-1,m=2*h+1;c.graph().nestingRoot=d,e.forEach(c.edges(),function(_){c.edge(_).minlen*=m});var y=u(c)+1;e.forEach(c.children(),function(_){o(c,d,m,y,h,p,_)}),c.graph().nodeRankFactor=m}function o(c,d,p,h,m,y,_){var k=c.children(_);if(!k.length){_!==d&&c.setEdge(d,_,{weight:0,minlen:p});return}var w=r.addBorderNode(c,"_bt"),x=r.addBorderNode(c,"_bb"),S=c.node(_);c.setParent(w,_),S.borderTop=w,c.setParent(x,_),S.borderBottom=x,e.forEach(k,function(b){o(c,d,p,h,m,y,b);var N=c.node(b),C=N.borderTop?N.borderTop:b,I=N.borderBottom?N.borderBottom:b,A=N.borderTop?h:2*h,P=C!==I?1:m-y[_]+1;c.setEdge(w,C,{weight:A,minlen:P,nestingEdge:!0}),c.setEdge(I,x,{weight:A,minlen:P,nestingEdge:!0})}),c.parent(_)||c.setEdge(d,w,{weight:0,minlen:m+y[_]})}function s(c){var d={};function p(h,m){var y=c.children(h);y&&y.length&&e.forEach(y,function(_){p(_,m+1)}),d[h]=m}return e.forEach(c.children(),function(h){p(h,1)}),d}function u(c){return e.reduce(c.edges(),function(d,p){return d+c.edge(p).weight},0)}function l(c){var d=c.graph();c.removeNode(d.nestingRoot),delete d.nestingRoot,e.forEach(c.edges(),function(p){var h=c.edge(p);h.nestingEdge&&c.removeEdge(p)})}return vv}var mv,yE;function LO(){if(yE)return mv;yE=1;var e=Ue(),r=Pt();mv=i;function i(s){function u(l){var c=s.children(l),d=s.node(l);if(c.length&&e.forEach(c,u),e.has(d,"minRank")){d.borderLeft=[],d.borderRight=[];for(var p=d.minRank,h=d.maxRank+1;p<h;++p)o(s,"borderLeft","_bl",l,d,p),o(s,"borderRight","_br",l,d,p)}}e.forEach(s.children(),u)}function o(s,u,l,c,d,p){var h={width:0,height:0,rank:p,borderType:u},m=d[u][p-1],y=r.addDummyNode(s,"border",h,l);d[u][p]=y,s.setParent(y,c),m&&s.setEdge(m,y,{weight:1})}return mv}var gv,_E;function jO(){if(_E)return gv;_E=1;var e=Ue();gv={adjust:r,undo:i};function r(p){var h=p.graph().rankdir.toLowerCase();(h==="lr"||h==="rl")&&o(p)}function i(p){var h=p.graph().rankdir.toLowerCase();(h==="bt"||h==="rl")&&u(p),(h==="lr"||h==="rl")&&(c(p),o(p))}function o(p){e.forEach(p.nodes(),function(h){s(p.node(h))}),e.forEach(p.edges(),function(h){s(p.edge(h))})}function s(p){var h=p.width;p.width=p.height,p.height=h}function u(p){e.forEach(p.nodes(),function(h){l(p.node(h))}),e.forEach(p.edges(),function(h){var m=p.edge(h);e.forEach(m.points,l),e.has(m,"y")&&l(m)})}function l(p){p.y=-p.y}function c(p){e.forEach(p.nodes(),function(h){d(p.node(h))}),e.forEach(p.edges(),function(h){var m=p.edge(h);e.forEach(m.points,d),e.has(m,"x")&&d(m)})}function d(p){var h=p.x;p.x=p.y,p.y=h}return gv}var yv,wE;function DO(){if(wE)return yv;wE=1;var e=Ue();yv=r;function r(i){var o={},s=e.filter(i.nodes(),function(p){return!i.children(p).length}),u=e.max(e.map(s,function(p){return i.node(p).rank})),l=e.map(e.range(u+1),function(){return[]});function c(p){if(!e.has(o,p)){o[p]=!0;var h=i.node(p);l[h.rank].push(p),e.forEach(i.successors(p),c)}}var d=e.sortBy(s,function(p){return i.node(p).rank});return e.forEach(d,c),l}return yv}var _v,xE;function zO(){if(xE)return _v;xE=1;var e=Ue();_v=r;function r(o,s){for(var u=0,l=1;l<s.length;++l)u+=i(o,s[l-1],s[l]);return u}function i(o,s,u){for(var l=e.zipObject(u,e.map(u,function(y,_){return _})),c=e.flatten(e.map(s,function(y){return e.sortBy(e.map(o.outEdges(y),function(_){return{pos:l[_.w],weight:o.edge(_).weight}}),"pos")}),!0),d=1;d<u.length;)d<<=1;var p=2*d-1;d-=1;var h=e.map(new Array(p),function(){return 0}),m=0;return e.forEach(c.forEach(function(y){var _=y.pos+d;h[_]+=y.weight;for(var k=0;_>0;)_%2&&(k+=h[_+1]),_=_-1>>1,h[_]+=y.weight;m+=y.weight*k})),m}return _v}var wv,SE;function FO(){if(SE)return wv;SE=1;var e=Ue();wv=r;function r(i,o){return e.map(o,function(s){var u=i.inEdges(s);if(u.length){var l=e.reduce(u,function(c,d){var p=i.edge(d),h=i.node(d.v);return{sum:c.sum+p.weight*h.order,weight:c.weight+p.weight}},{sum:0,weight:0});return{v:s,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:s}})}return wv}var xv,EE;function $O(){if(EE)return xv;EE=1;var e=Ue();xv=r;function r(s,u){var l={};e.forEach(s,function(d,p){var h=l[d.v]={indegree:0,in:[],out:[],vs:[d.v],i:p};e.isUndefined(d.barycenter)||(h.barycenter=d.barycenter,h.weight=d.weight)}),e.forEach(u.edges(),function(d){var p=l[d.v],h=l[d.w];!e.isUndefined(p)&&!e.isUndefined(h)&&(h.indegree++,p.out.push(l[d.w]))});var c=e.filter(l,function(d){return!d.indegree});return i(c)}function i(s){var u=[];function l(p){return function(h){h.merged||(e.isUndefined(h.barycenter)||e.isUndefined(p.barycenter)||h.barycenter>=p.barycenter)&&o(p,h)}}function c(p){return function(h){h.in.push(p),--h.indegree===0&&s.push(h)}}for(;s.length;){var d=s.pop();u.push(d),e.forEach(d.in.reverse(),l(d)),e.forEach(d.out,c(d))}return e.map(e.filter(u,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function o(s,u){var l=0,c=0;s.weight&&(l+=s.barycenter*s.weight,c+=s.weight),u.weight&&(l+=u.barycenter*u.weight,c+=u.weight),s.vs=u.vs.concat(s.vs),s.barycenter=l/c,s.weight=c,s.i=Math.min(u.i,s.i),u.merged=!0}return xv}var Sv,kE;function BO(){if(kE)return Sv;kE=1;var e=Ue(),r=Pt();Sv=i;function i(u,l){var c=r.partition(u,function(w){return e.has(w,"barycenter")}),d=c.lhs,p=e.sortBy(c.rhs,function(w){return-w.i}),h=[],m=0,y=0,_=0;d.sort(s(!!l)),_=o(h,p,_),e.forEach(d,function(w){_+=w.vs.length,h.push(w.vs),m+=w.barycenter*w.weight,y+=w.weight,_=o(h,p,_)});var k={vs:e.flatten(h,!0)};return y&&(k.barycenter=m/y,k.weight=y),k}function o(u,l,c){for(var d;l.length&&(d=e.last(l)).i<=c;)l.pop(),u.push(d.vs),c++;return c}function s(u){return function(l,c){return l.barycenter<c.barycenter?-1:l.barycenter>c.barycenter?1:u?c.i-l.i:l.i-c.i}}return Sv}var Ev,bE;function UO(){if(bE)return Ev;bE=1;var e=Ue(),r=FO(),i=$O(),o=BO();Ev=s;function s(c,d,p,h){var m=c.children(d),y=c.node(d),_=y?y.borderLeft:void 0,k=y?y.borderRight:void 0,w={};_&&(m=e.filter(m,function(I){return I!==_&&I!==k}));var x=r(c,m);e.forEach(x,function(I){if(c.children(I.v).length){var A=s(c,I.v,p,h);w[I.v]=A,e.has(A,"barycenter")&&l(I,A)}});var S=i(x,p);u(S,w);var b=o(S,h);if(_&&(b.vs=e.flatten([_,b.vs,k],!0),c.predecessors(_).length)){var N=c.node(c.predecessors(_)[0]),C=c.node(c.predecessors(k)[0]);e.has(b,"barycenter")||(b.barycenter=0,b.weight=0),b.barycenter=(b.barycenter*b.weight+N.order+C.order)/(b.weight+2),b.weight+=2}return b}function u(c,d){e.forEach(c,function(p){p.vs=e.flatten(p.vs.map(function(h){return d[h]?d[h].vs:h}),!0)})}function l(c,d){e.isUndefined(c.barycenter)?(c.barycenter=d.barycenter,c.weight=d.weight):(c.barycenter=(c.barycenter*c.weight+d.barycenter*d.weight)/(c.weight+d.weight),c.weight+=d.weight)}return Ev}var kv,CE;function HO(){if(CE)return kv;CE=1;var e=Ue(),r=cn().Graph;kv=i;function i(s,u,l){var c=o(s),d=new r({compound:!0}).setGraph({root:c}).setDefaultNodeLabel(function(p){return s.node(p)});return e.forEach(s.nodes(),function(p){var h=s.node(p),m=s.parent(p);(h.rank===u||h.minRank<=u&&u<=h.maxRank)&&(d.setNode(p),d.setParent(p,m||c),e.forEach(s[l](p),function(y){var _=y.v===p?y.w:y.v,k=d.edge(_,p),w=e.isUndefined(k)?0:k.weight;d.setEdge(_,p,{weight:s.edge(y).weight+w})}),e.has(h,"minRank")&&d.setNode(p,{borderLeft:h.borderLeft[u],borderRight:h.borderRight[u]}))}),d}function o(s){for(var u;s.hasNode(u=e.uniqueId("_root")););return u}return kv}var bv,NE;function VO(){if(NE)return bv;NE=1;var e=Ue();bv=r;function r(i,o,s){var u={},l;e.forEach(s,function(c){for(var d=i.parent(c),p,h;d;){if(p=i.parent(d),p?(h=u[p],u[p]=d):(h=l,l=d),h&&h!==d){o.setEdge(h,d);return}d=p}})}return bv}var Cv,RE;function GO(){if(RE)return Cv;RE=1;var e=Ue(),r=DO(),i=zO(),o=UO(),s=HO(),u=VO(),l=cn().Graph,c=Pt();Cv=d;function d(y){var _=c.maxRank(y),k=p(y,e.range(1,_+1),"inEdges"),w=p(y,e.range(_-1,-1,-1),"outEdges"),x=r(y);m(y,x);for(var S=Number.POSITIVE_INFINITY,b,N=0,C=0;C<4;++N,++C){h(N%2?k:w,N%4>=2),x=c.buildLayerMatrix(y);var I=i(y,x);I<S&&(C=0,b=e.cloneDeep(x),S=I)}m(y,b)}function p(y,_,k){return e.map(_,function(w){return s(y,w,k)})}function h(y,_){var k=new l;e.forEach(y,function(w){var x=w.graph().root,S=o(w,x,k,_);e.forEach(S.vs,function(b,N){w.node(b).order=N}),u(w,k,S.vs)})}function m(y,_){e.forEach(_,function(k){e.forEach(k,function(w,x){y.node(w).order=x})})}return Cv}var Nv,TE;function WO(){if(TE)return Nv;TE=1;var e=Ue(),r=cn().Graph,i=Pt();Nv={positionX:k,findType1Conflicts:o,findType2Conflicts:s,addConflict:l,hasConflict:c,verticalAlignment:d,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:m,balance:_};function o(S,b){var N={};function C(I,A){var P=0,$=0,L=I.length,U=e.last(A);return e.forEach(A,function(V,ee){var Z=u(S,V),R=Z?S.node(Z).order:L;(Z||V===U)&&(e.forEach(A.slice($,ee+1),function(W){e.forEach(S.predecessors(W),function(F){var ne=S.node(F),G=ne.order;(G<P||R<G)&&!(ne.dummy&&S.node(W).dummy)&&l(N,F,W)})}),$=ee+1,P=R)}),A}return e.reduce(b,C),N}function s(S,b){var N={};function C(A,P,$,L,U){var V;e.forEach(e.range(P,$),function(ee){V=A[ee],S.node(V).dummy&&e.forEach(S.predecessors(V),function(Z){var R=S.node(Z);R.dummy&&(R.order<L||R.order>U)&&l(N,Z,V)})})}function I(A,P){var $=-1,L,U=0;return e.forEach(P,function(V,ee){if(S.node(V).dummy==="border"){var Z=S.predecessors(V);Z.length&&(L=S.node(Z[0]).order,C(P,U,ee,$,L),U=ee,$=L)}C(P,U,P.length,L,A.length)}),P}return e.reduce(b,I),N}function u(S,b){if(S.node(b).dummy)return e.find(S.predecessors(b),function(N){return S.node(N).dummy})}function l(S,b,N){if(b>N){var C=b;b=N,N=C}var I=S[b];I||(S[b]=I={}),I[N]=!0}function c(S,b,N){if(b>N){var C=b;b=N,N=C}return e.has(S[b],N)}function d(S,b,N,C){var I={},A={},P={};return e.forEach(b,function($){e.forEach($,function(L,U){I[L]=L,A[L]=L,P[L]=U})}),e.forEach(b,function($){var L=-1;e.forEach($,function(U){var V=C(U);if(V.length){V=e.sortBy(V,function(F){return P[F]});for(var ee=(V.length-1)/2,Z=Math.floor(ee),R=Math.ceil(ee);Z<=R;++Z){var W=V[Z];A[U]===U&&L<P[W]&&!c(N,U,W)&&(A[W]=U,A[U]=I[U]=I[W],L=P[W])}}})}),{root:I,align:A}}function p(S,b,N,C,I){var A={},P=h(S,b,N,I),$=I?"borderLeft":"borderRight";function L(ee,Z){for(var R=P.nodes(),W=R.pop(),F={};W;)F[W]?ee(W):(F[W]=!0,R.push(W),R=R.concat(Z(W))),W=R.pop()}function U(ee){A[ee]=P.inEdges(ee).reduce(function(Z,R){return Math.max(Z,A[R.v]+P.edge(R))},0)}function V(ee){var Z=P.outEdges(ee).reduce(function(W,F){return Math.min(W,A[F.w]-P.edge(F))},Number.POSITIVE_INFINITY),R=S.node(ee);Z!==Number.POSITIVE_INFINITY&&R.borderType!==$&&(A[ee]=Math.max(A[ee],Z))}return L(U,P.predecessors.bind(P)),L(V,P.successors.bind(P)),e.forEach(C,function(ee){A[ee]=A[N[ee]]}),A}function h(S,b,N,C){var I=new r,A=S.graph(),P=w(A.nodesep,A.edgesep,C);return e.forEach(b,function($){var L;e.forEach($,function(U){var V=N[U];if(I.setNode(V),L){var ee=N[L],Z=I.edge(ee,V);I.setEdge(ee,V,Math.max(P(S,U,L),Z||0))}L=U})}),I}function m(S,b){return e.minBy(e.values(b),function(N){var C=Number.NEGATIVE_INFINITY,I=Number.POSITIVE_INFINITY;return e.forIn(N,function(A,P){var $=x(S,P)/2;C=Math.max(A+$,C),I=Math.min(A-$,I)}),C-I})}function y(S,b){var N=e.values(b),C=e.min(N),I=e.max(N);e.forEach(["u","d"],function(A){e.forEach(["l","r"],function(P){var $=A+P,L=S[$],U;if(L!==b){var V=e.values(L);U=P==="l"?C-e.min(V):I-e.max(V),U&&(S[$]=e.mapValues(L,function(ee){return ee+U}))}})})}function _(S,b){return e.mapValues(S.ul,function(N,C){if(b)return S[b.toLowerCase()][C];var I=e.sortBy(e.map(S,C));return(I[1]+I[2])/2})}function k(S){var b=i.buildLayerMatrix(S),N=e.merge(o(S,b),s(S,b)),C={},I;e.forEach(["u","d"],function(P){I=P==="u"?b:e.values(b).reverse(),e.forEach(["l","r"],function($){$==="r"&&(I=e.map(I,function(ee){return e.values(ee).reverse()}));var L=(P==="u"?S.predecessors:S.successors).bind(S),U=d(S,I,N,L),V=p(S,I,U.root,U.align,$==="r");$==="r"&&(V=e.mapValues(V,function(ee){return-ee})),C[P+$]=V})});var A=m(S,C);return y(C,A),_(C,S.graph().align)}function w(S,b,N){return function(C,I,A){var P=C.node(I),$=C.node(A),L=0,U;if(L+=P.width/2,e.has(P,"labelpos"))switch(P.labelpos.toLowerCase()){case"l":U=-P.width/2;break;case"r":U=P.width/2;break}if(U&&(L+=N?U:-U),U=0,L+=(P.dummy?b:S)/2,L+=($.dummy?b:S)/2,L+=$.width/2,e.has($,"labelpos"))switch($.labelpos.toLowerCase()){case"l":U=$.width/2;break;case"r":U=-$.width/2;break}return U&&(L+=N?U:-U),U=0,L}}function x(S,b){return S.node(b).width}return Nv}var Rv,IE;function KO(){if(IE)return Rv;IE=1;var e=Ue(),r=Pt(),i=WO().positionX;Rv=o;function o(u){u=r.asNonCompoundGraph(u),s(u),e.forEach(i(u),function(l,c){u.node(c).x=l})}function s(u){var l=r.buildLayerMatrix(u),c=u.graph().ranksep,d=0;e.forEach(l,function(p){var h=e.max(e.map(p,function(m){return u.node(m).height}));e.forEach(p,function(m){u.node(m).y=d+h/2}),d+=h+c})}return Rv}var Tv,AE;function YO(){if(AE)return Tv;AE=1;var e=Ue(),r=IO(),i=AO(),o=PO(),s=Pt().normalizeRanks,u=qO(),l=Pt().removeEmptyRanks,c=OO(),d=LO(),p=jO(),h=GO(),m=KO(),y=Pt(),_=cn().Graph;Tv=k;function k(q,H){var X=H&&H.debugTiming?y.time:y.notime;X("layout",function(){var oe=X(" buildLayoutGraph",function(){return L(q)});X(" runLayout",function(){w(oe,X)}),X(" updateInputGraph",function(){x(q,oe)})})}function w(q,H){H(" makeSpaceForEdgeLabels",function(){U(q)}),H(" removeSelfEdges",function(){j(q)}),H(" acyclic",function(){r.run(q)}),H(" nestingGraph.run",function(){c.run(q)}),H(" rank",function(){o(y.asNonCompoundGraph(q))}),H(" injectEdgeLabelProxies",function(){V(q)}),H(" removeEmptyRanks",function(){l(q)}),H(" nestingGraph.cleanup",function(){c.cleanup(q)}),H(" normalizeRanks",function(){s(q)}),H(" assignRankMinMax",function(){ee(q)}),H(" removeEdgeLabelProxies",function(){Z(q)}),H(" normalize.run",function(){i.run(q)}),H(" parentDummyChains",function(){u(q)}),H(" addBorderSegments",function(){d(q)}),H(" order",function(){h(q)}),H(" insertSelfEdges",function(){K(q)}),H(" adjustCoordinateSystem",function(){p.adjust(q)}),H(" position",function(){m(q)}),H(" positionSelfEdges",function(){T(q)}),H(" removeBorderNodes",function(){G(q)}),H(" normalize.undo",function(){i.undo(q)}),H(" fixupEdgeLabelCoords",function(){F(q)}),H(" undoCoordinateSystem",function(){p.undo(q)}),H(" translateGraph",function(){R(q)}),H(" assignNodeIntersects",function(){W(q)}),H(" reversePoints",function(){ne(q)}),H(" acyclic.undo",function(){r.undo(q)})}function x(q,H){e.forEach(q.nodes(),function(X){var oe=q.node(X),ue=H.node(X);oe&&(oe.x=ue.x,oe.y=ue.y,H.children(X).length&&(oe.width=ue.width,oe.height=ue.height))}),e.forEach(q.edges(),function(X){var oe=q.edge(X),ue=H.edge(X);oe.points=ue.points,e.has(ue,"x")&&(oe.x=ue.x,oe.y=ue.y)}),q.graph().width=H.graph().width,q.graph().height=H.graph().height}var S=["nodesep","edgesep","ranksep","marginx","marginy"],b={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},N=["acyclicer","ranker","rankdir","align"],C=["width","height"],I={width:0,height:0},A=["minlen","weight","width","height","labeloffset"],P={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},$=["labelpos"];function L(q){var H=new _({multigraph:!0,compound:!0}),X=ae(q.graph());return H.setGraph(e.merge({},b,z(X,S),e.pick(X,N))),e.forEach(q.nodes(),function(oe){var ue=ae(q.node(oe));H.setNode(oe,e.defaults(z(ue,C),I)),H.setParent(oe,q.parent(oe))}),e.forEach(q.edges(),function(oe){var ue=ae(q.edge(oe));H.setEdge(oe,e.merge({},P,z(ue,A),e.pick(ue,$)))}),H}function U(q){var H=q.graph();H.ranksep/=2,e.forEach(q.edges(),function(X){var oe=q.edge(X);oe.minlen*=2,oe.labelpos.toLowerCase()!=="c"&&(H.rankdir==="TB"||H.rankdir==="BT"?oe.width+=oe.labeloffset:oe.height+=oe.labeloffset)})}function V(q){e.forEach(q.edges(),function(H){var X=q.edge(H);if(X.width&&X.height){var oe=q.node(H.v),ue=q.node(H.w),se={rank:(ue.rank-oe.rank)/2+oe.rank,e:H};y.addDummyNode(q,"edge-proxy",se,"_ep")}})}function ee(q){var H=0;e.forEach(q.nodes(),function(X){var oe=q.node(X);oe.borderTop&&(oe.minRank=q.node(oe.borderTop).rank,oe.maxRank=q.node(oe.borderBottom).rank,H=e.max(H,oe.maxRank))}),q.graph().maxRank=H}function Z(q){e.forEach(q.nodes(),function(H){var X=q.node(H);X.dummy==="edge-proxy"&&(q.edge(X.e).labelRank=X.rank,q.removeNode(H))})}function R(q){var H=Number.POSITIVE_INFINITY,X=0,oe=Number.POSITIVE_INFINITY,ue=0,se=q.graph(),re=se.marginx||0,Ee=se.marginy||0;function Re(xe){var Ce=xe.x,ye=xe.y,Le=xe.width,ve=xe.height;H=Math.min(H,Ce-Le/2),X=Math.max(X,Ce+Le/2),oe=Math.min(oe,ye-ve/2),ue=Math.max(ue,ye+ve/2)}e.forEach(q.nodes(),function(xe){Re(q.node(xe))}),e.forEach(q.edges(),function(xe){var Ce=q.edge(xe);e.has(Ce,"x")&&Re(Ce)}),H-=re,oe-=Ee,e.forEach(q.nodes(),function(xe){var Ce=q.node(xe);Ce.x-=H,Ce.y-=oe}),e.forEach(q.edges(),function(xe){var Ce=q.edge(xe);e.forEach(Ce.points,function(ye){ye.x-=H,ye.y-=oe}),e.has(Ce,"x")&&(Ce.x-=H),e.has(Ce,"y")&&(Ce.y-=oe)}),se.width=X-H+re,se.height=ue-oe+Ee}function W(q){e.forEach(q.edges(),function(H){var X=q.edge(H),oe=q.node(H.v),ue=q.node(H.w),se,re;X.points?(se=X.points[0],re=X.points[X.points.length-1]):(X.points=[],se=ue,re=oe),X.points.unshift(y.intersectRect(oe,se)),X.points.push(y.intersectRect(ue,re))})}function F(q){e.forEach(q.edges(),function(H){var X=q.edge(H);if(e.has(X,"x"))switch((X.labelpos==="l"||X.labelpos==="r")&&(X.width-=X.labeloffset),X.labelpos){case"l":X.x-=X.width/2+X.labeloffset;break;case"r":X.x+=X.width/2+X.labeloffset;break}})}function ne(q){e.forEach(q.edges(),function(H){var X=q.edge(H);X.reversed&&X.points.reverse()})}function G(q){e.forEach(q.nodes(),function(H){if(q.children(H).length){var X=q.node(H),oe=q.node(X.borderTop),ue=q.node(X.borderBottom),se=q.node(e.last(X.borderLeft)),re=q.node(e.last(X.borderRight));X.width=Math.abs(re.x-se.x),X.height=Math.abs(ue.y-oe.y),X.x=se.x+X.width/2,X.y=oe.y+X.height/2}}),e.forEach(q.nodes(),function(H){q.node(H).dummy==="border"&&q.removeNode(H)})}function j(q){e.forEach(q.edges(),function(H){if(H.v===H.w){var X=q.node(H.v);X.selfEdges||(X.selfEdges=[]),X.selfEdges.push({e:H,label:q.edge(H)}),q.removeEdge(H)}})}function K(q){var H=y.buildLayerMatrix(q);e.forEach(H,function(X){var oe=0;e.forEach(X,function(ue,se){var re=q.node(ue);re.order=se+oe,e.forEach(re.selfEdges,function(Ee){y.addDummyNode(q,"selfedge",{width:Ee.label.width,height:Ee.label.height,rank:re.rank,order:se+ ++oe,e:Ee.e,label:Ee.label},"_se")}),delete re.selfEdges})})}function T(q){e.forEach(q.nodes(),function(H){var X=q.node(H);if(X.dummy==="selfedge"){var oe=q.node(X.e.v),ue=oe.x+oe.width/2,se=oe.y,re=X.x-ue,Ee=oe.height/2;q.setEdge(X.e,X.label),q.removeNode(H),X.label.points=[{x:ue+2*re/3,y:se-Ee},{x:ue+5*re/6,y:se-Ee},{x:ue+re,y:se},{x:ue+5*re/6,y:se+Ee},{x:ue+2*re/3,y:se+Ee}],X.label.x=X.x,X.label.y=X.y}})}function z(q,H){return e.mapValues(e.pick(q,H),Number)}function ae(q){var H={};return e.forEach(q,function(X,oe){H[oe.toLowerCase()]=X}),H}return Tv}var Iv,ME;function XO(){if(ME)return Iv;ME=1;var e=Ue(),r=Pt(),i=cn().Graph;Iv={debugOrdering:o};function o(s){var u=r.buildLayerMatrix(s),l=new i({compound:!0,multigraph:!0}).setGraph({});return e.forEach(s.nodes(),function(c){l.setNode(c,{label:c}),l.setParent(c,"layer"+s.node(c).rank)}),e.forEach(s.edges(),function(c){l.setEdge(c.v,c.w,{},c.name)}),e.forEach(u,function(c,d){var p="layer"+d;l.setNode(p,{rank:"same"}),e.reduce(c,function(h,m){return l.setEdge(h,m,{style:"invis"}),m})}),l}return Iv}var Av,PE;function QO(){return PE||(PE=1,Av="0.8.5"),Av}var Mv,qE;function ZO(){return qE||(qE=1,Mv={graphlib:cn(),layout:YO(),debug:XO(),util:{time:Pt().time,notime:Pt().notime},version:QO()}),Mv}var JO=ZO();const OE=tm(JO),LE=240,jE=130,eL=110;function tL(e){var i;return((i=e.data)==null?void 0:i.sessionId)??"_default"}function nL(e,r,i,o){const s=new OE.graphlib.Graph;s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:i,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const u=new Set(e);for(const _ of e){const k=o.get(_);s.setNode(_,{width:(k==null?void 0:k.width)??LE,height:(k==null?void 0:k.height)??jE})}for(const _ of r)u.has(_.source)&&u.has(_.target)&&s.setEdge(_.source,_.target);OE.layout(s);const l=new Map;let c=1/0,d=1/0,p=-1/0,h=-1/0;for(const _ of e){const k=s.node(_);if(!k)continue;const w=o.get(_),x=(w==null?void 0:w.width)??LE,S=(w==null?void 0:w.height)??jE,b=k.x-x/2,N=k.y-S/2;l.set(_,{x:b,y:N}),b<c&&(c=b),N<d&&(d=N),b+x>p&&(p=b+x),N+S>h&&(h=N+S)}if(Number.isFinite(c)&&Number.isFinite(d))for(const[_,k]of l)l.set(_,{x:k.x-c,y:k.y-d});const m=Number.isFinite(p)?p-c:0,y=Number.isFinite(h)?h-d:0;return{positions:l,width:m,height:y}}function DE(e,r,i={}){const o=i.direction??"LR",s=i.pinned??new Map,u=i.measured??new Map,l=new Map;for(const h of e){const m=tL(h),y=l.get(m);y?y.push(h.id):l.set(m,[h.id])}const c=Array.from(l.keys()).sort(),d=new Map;let p=0;for(const h of c){const m=l.get(h),{positions:y,height:_}=nL(m,r,o,u);for(const[k,w]of y)d.set(k,{x:w.x,y:w.y+p});p+=_+eL}return e.map(h=>{const m=s.get(h.id);if(m)return{...h,position:m};const y=d.get(h.id);return y?{...h,position:y}:h})}function Tr(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}function rL(e){return e<1e3?`${e}`:e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(2)}M`}const iL={agent:dP},em=600,oL=9e4;function sL(e,r){var o,s,u;if(!r)return!0;const i=r.toLowerCase();if(e.label.toLowerCase().includes(i)||(o=e.cwd)!=null&&o.toLowerCase().includes(i)||(s=e.cwdBasename)!=null&&s.toLowerCase().includes(i)||e.sessionId.toLowerCase().includes(i)||(u=e.firstPrompt)!=null&&u.toLowerCase().includes(i))return!0;for(const l of e.tools)if(l.name.toLowerCase().includes(i))return!0;return!1}function aL(e,r,i,o,s,u,l,c){const d=[],p=[],h=new Set;if(o)for(const _ of e.agents.values())sL(_,o)&&h.add(_.id);const m=new Set;for(const _ of e.agents.values())_.exitAt!=null&&r-_.exitAt>em||m.add(_.id);for(const _ of e.agents.values()){if(!m.has(_.id))continue;const k=o?!h.has(_.id):!1,w=_.exitAt!=null,x=[k?"rf-dim":"",w?"rf-exiting":""].filter(Boolean).join(" ")||void 0;if(d.push({id:_.id,type:"agent",position:{x:0,y:0},data:{..._,now:r,dim:k},className:x}),_.parentId&&m.has(_.parentId)){const S=_m(_.sessionId),b=_.state==="active"?`hsl(${S} 80% 72%)`:`hsl(${S} 50% 55%)`,N=o&&!h.has(_.id)&&!h.has(_.parentId),C=w;p.push({id:`e:${_.parentId}->${_.id}`,source:_.parentId,target:_.id,animated:_.state==="active"&&!N&&!C,type:"smoothstep",style:{stroke:b,strokeWidth:_.state==="active"?2:1.5,opacity:N||C?.2:1,transition:"opacity 500ms ease"},className:C?"rf-edge-exiting":void 0})}}if(l!==c.current){const _=DE(d,p,{direction:"LR",pinned:i,measured:s});for(const k of _)u.set(k.id,k.position);c.current=l}else if(d.filter(k=>!i.has(k.id)&&!u.has(k.id)).length>0){const k=DE(d,p,{direction:"LR",pinned:i,measured:s});for(const w of k)u.has(w.id)||u.set(w.id,w.position)}return{nodes:d.map(_=>{const k=i.get(_.id)??u.get(_.id)??{x:0,y:0};return{..._,position:k}}),edges:p}}function uL(){return O.jsx(ym,{children:O.jsx(lL,{})})}function lL(){const e=Ga(),r=Y.useRef(Yv()),[,i]=Y.useState(0),o=Y.useCallback(()=>i(se=>se+1),[]),[s,u]=Y.useState(null),[l,c]=Y.useState(null),[d,p]=Y.useState(!1),[h,m]=Y.useState(!1),y=Y.useRef([]),[_,k]=Y.useState(Date.now()),w=Y.useRef(new Map),[x,S]=Y.useState(""),[b,N]=Y.useState(()=>typeof window>"u"?"dark":window.localStorage.getItem("agent-dag.theme")??"dark"),[C,I]=Y.useState(!1),A=Y.useRef(null);Y.useEffect(()=>{document.documentElement.dataset.theme=b;try{window.localStorage.setItem("agent-dag.theme",b)}catch{}},[b]),Y.useEffect(()=>{const se=new EventSource("/events");return se.addEventListener("open",()=>{p(!0),I(!0)}),se.addEventListener("error",()=>p(!1)),se.addEventListener("hook",re=>{try{const Ee=JSON.parse(re.data);if(h){y.current.push(Ee);return}r.current=c1(r.current,Ee),o()}catch{}}),()=>se.close()},[h,o]),Y.useEffect(()=>{if(!h&&y.current.length!==0){for(const se of y.current)r.current=c1(r.current,se);y.current.length=0,o()}},[h,o]),Y.useEffect(()=>{const se=setInterval(()=>{const re=Date.now();k(re),cP(r.current,re,oL)&&o()},250);return()=>clearInterval(se)},[o]);const P=Y.useRef(null),$=Y.useRef(0),L=Y.useRef(""),U=Y.useRef(0),V=Y.useCallback(()=>{U.current=Date.now()},[]);Y.useEffect(()=>{const se=setInterval(()=>{if(Date.now()-U.current<800)return;const re=r.current,Ee=Date.now(),Re=[];for(const he of re.agents.values())he.exitAt!=null&&Ee-he.exitAt>em||Re.push({id:he.id});if(Re.length===0)return;const xe=e.getViewport(),Ce=window.innerWidth-360,ye=window.innerHeight-52;let Le=!1,ve=!1;for(const{id:he}of Re){const Pe=ee.current.get(he),He=w.current.get(he)??F.current.get(he);if(!Pe||!He)continue;ve=!0;const et=He.x*xe.zoom+xe.x,Xe=He.y*xe.zoom+xe.y,je=(He.x+Pe.width)*xe.zoom+xe.x,tt=(He.y+Pe.height)*xe.zoom+xe.y;if(je>0&&et<Ce&&tt>0&&Xe<ye){Le=!0;break}}if(ve&&!Le)try{e.fitView({padding:.25,duration:600})}catch{}},1500);return()=>clearInterval(se)},[e]);const ee=Y.useRef(new Map),Z=Y.useRef(0),R=Y.useCallback(se=>{const re=ee.current;let Ee=!1;for(const Re of se.nodeInternals.values()){const xe=Re.width,Ce=Re.height;if(xe==null||Ce==null)continue;const ye=re.get(Re.id);ye?(Math.abs(ye.height-Ce)>4||Math.abs(ye.width-xe)>4)&&(re.set(Re.id,{width:xe,height:Ce}),Ee=!0):(re.set(Re.id,{width:xe,height:Ce}),Ee=!0)}return Ee&&(Z.current+=1),Z.current},[]),W=Oe(R),F=Y.useRef(new Map),ne=Y.useRef(""),G=Y.useMemo(()=>{const se=[];for(const re of r.current.agents.values())re.exitAt!=null&&_-re.exitAt>em||se.push(re.id+(re.parentId?`>${re.parentId}`:""));return se.sort(),`${se.join("|")}#sv${W}`},[r.current,r.current.lastSeq,_,W]);Y.useEffect(()=>{if(L.current===G)return;const se=L.current;if(L.current=G,!se)return;const re=Date.now();if(re-$.current>1200){try{e.fitView({padding:.25,duration:400})}catch{}$.current=re}P.current&&window.clearTimeout(P.current),P.current=window.setTimeout(()=>{try{e.fitView({padding:.25,duration:500})}catch{}$.current=Date.now()},280)},[G,e]);const{nodes:j,edges:K}=Y.useMemo(()=>aL(r.current,_,w.current,x,ee.current,F.current,G,ne),[r.current,r.current.lastSeq,_,x,G]),T=s?r.current.agents.get(s):null,z=l?Array.from(r.current.agents.values()).flatMap(se=>se.tools).find(se=>se.id===l)??null:null,ae=Y.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}r.current=Yv(),w.current.clear(),ee.current.clear(),F.current.clear(),ne.current="",u(null),o()},[o]),q=Y.useCallback(()=>{w.current.clear(),F.current.clear(),ne.current="",o(),window.setTimeout(()=>{try{e.fitView({padding:.25,duration:500})}catch{}$.current=Date.now()},80)},[o,e]),H=Y.useCallback(()=>{try{e.fitView({padding:.25,duration:500})}catch{}$.current=Date.now()},[e]);Y.useEffect(()=>{const se=re=>{var Re,xe;const Ee=((Re=re.target)==null?void 0:Re.tagName)==="INPUT";if(re.key==="Escape"){Ee?re.target.blur():u(null);return}if(!Ee){if(re.key==="/"){re.preventDefault(),(xe=A.current)==null||xe.focus();return}re.key===" "&&(re.preventDefault(),m(Ce=>!Ce)),(re.key==="c"||re.key==="C")&&ae(),(re.key==="r"||re.key==="R")&&q(),(re.key==="f"||re.key==="F")&&H(),(re.key==="t"||re.key==="T")&&N(Ce=>Ce==="dark"?"light":"dark")}};return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[ae,q,H]);const X=r.current.agents.size,oe=new Set(Array.from(r.current.agents.values()).map(se=>se.sessionId)).size,ue=Y.useMemo(()=>{let se=0,re=0,Ee=0,Re=0;for(const xe of r.current.agents.values())se+=xe.usage.inputTokens,re+=xe.usage.outputTokens,Ee+=xe.usage.cacheReadTokens,Re+=xe.usage.cacheCreateTokens;return{inT:se,outT:re,cacheR:Ee,cacheC:Re,sum:se+re}},[r.current,r.current.lastSeq]);return O.jsxs("div",{className:"app",children:[O.jsxs("header",{className:"topbar",children:[O.jsxs("div",{className:"brand",children:[O.jsx("span",{className:"logo"}),"agent-dag ",O.jsxs("span",{className:"v",children:["v","1.3.4"]})]}),O.jsxs("div",{className:"actions",children:[O.jsxs("div",{className:"search",children:[O.jsx("span",{className:"search-icon","aria-hidden":!0,children:"⌕"}),O.jsx("input",{ref:A,type:"text",placeholder:"Search agents, cwd, tools…",value:x,onChange:se=>S(se.target.value),spellCheck:!1,"aria-label":"Filter the graph"}),x?O.jsx("button",{className:"search-clear","aria-label":"Clear search",onClick:()=>S(""),children:"×"}):O.jsx("kbd",{className:"search-kbd","aria-hidden":!0,children:"/"})]}),O.jsxs("span",{className:"status",role:"status",children:[O.jsx("span",{className:`pill ${d?"live":"dead"}`,title:d?"Receiving events":"SSE disconnected",children:d?"live":"offline"}),O.jsxs("span",{className:"stat",title:"Distinct CC sessions",children:[O.jsx("span",{className:"count",children:oe}),O.jsx("span",{className:"lbl",children:"sessions"})]}),O.jsxs("span",{className:"stat",title:"Total agents (root + subagents)",children:[O.jsx("span",{className:"count",children:X}),O.jsx("span",{className:"lbl",children:"agents"})]}),O.jsxs("span",{className:"stat",title:"Total hook events received",children:[O.jsx("span",{className:"count",children:r.current.totalEvents}),O.jsx("span",{className:"lbl",children:"events"})]}),ue.sum>0&&O.jsxs("span",{className:"stat",title:`in:${ue.inT.toLocaleString()} out:${ue.outT.toLocaleString()} cache-r:${ue.cacheR.toLocaleString()} cache-c:${ue.cacheC.toLocaleString()}`,children:[O.jsx("span",{className:"count",children:rL(ue.sum)}),O.jsx("span",{className:"lbl",children:"tokens"})]})]}),O.jsx("button",{className:`btn ${h?"warn":""}`,onClick:()=>m(se=>!se),title:"Pause/resume live updates (Space)",children:h?`Resume${y.current.length?` · ${y.current.length}`:""}`:"Pause"}),O.jsx("button",{className:"btn",onClick:q,title:"Auto-arrange — clear pins (R)",children:"Re-layout"}),O.jsx("button",{className:"btn",onClick:ae,title:"Clear canvas (C)",children:"Clear"}),O.jsx("button",{className:"btn icon-btn",onClick:()=>N(se=>se==="dark"?"light":"dark"),title:`Switch to ${b==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:b==="dark"?"☀":"☾"})]})]}),C&&!d&&O.jsxs("div",{className:"conn-banner",role:"alert",children:[O.jsx("span",{className:"conn-dot"}),"Lost connection to agent-dag server. Reconnecting…"]}),O.jsxs("div",{className:"canvas-wrap",children:[X===0&&O.jsx(cL,{live:d,everConnected:C}),O.jsxs(rb,{nodes:j,edges:K,nodeTypes:iL,fitView:!0,fitViewOptions:{padding:.25,duration:400},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,onNodeClick:(se,re)=>u(re.id),onPaneClick:()=>u(null),onMove:V,onNodeDragStart:(se,re)=>{V(),w.current.set(re.id,{x:re.position.x,y:re.position.y})},onNodeDrag:(se,re)=>{V(),w.current.set(re.id,{x:re.position.x,y:re.position.y}),F.current.set(re.id,{x:re.position.x,y:re.position.y})},onNodeDragStop:(se,re)=>{V(),w.current.set(re.id,{x:re.position.x,y:re.position.y}),F.current.set(re.id,{x:re.position.x,y:re.position.y})},children:[O.jsx(sP,{gap:28,size:1,color:Tr("--grid-line")}),O.jsx(SP,{}),O.jsx(jP,{agents:r.current.agents,positions:F.current,pinned:w.current,measured:ee.current,now:_,onOpenTool:c}),O.jsx(eP,{showInteractive:!1}),O.jsx(WM,{zoomable:!0,pannable:!0,nodeColor:se=>{const re=se.data;return re.state==="err"?Tr("--err"):re.state==="active"?Tr("--inflight"):Tr("--ok")},nodeStrokeWidth:2,maskColor:Tr("--minimap-mask"),style:{background:Tr("--panel"),border:`1px solid ${Tr("--line")}`,borderRadius:8}})]})]}),O.jsx("aside",{className:"detail",children:T?O.jsx(hL,{agent:T,now:_,onOpenTool:c}):O.jsx(dL,{count:X})}),z&&O.jsx(yP,{tool:z,onClose:()=>c(null)})]})}function cL({live:e,everConnected:r}){const i=!e;return O.jsxs("div",{className:"empty-hero",children:[O.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[O.jsx("div",{className:"core"}),O.jsxs("div",{className:"orbit r1",children:[O.jsx("span",{className:"dot"}),O.jsx("span",{className:"dot b"})]}),O.jsxs("div",{className:"orbit r2",children:[O.jsx("span",{className:"dot"}),O.jsx("span",{className:"dot b"})]}),O.jsxs("div",{className:"orbit r3",children:[O.jsx("span",{className:"dot"}),O.jsx("span",{className:"dot b"})]})]}),i?O.jsxs(O.Fragment,{children:[O.jsx("h2",{children:r?"Disconnected from server":"Server unreachable"}),O.jsxs("p",{children:["The browser cannot reach ",O.jsx("code",{children:"/events"}),". Check that",O.jsx("code",{children:"agent-dag"})," is still running in your terminal, then this page will resume automatically."]})]}):fL()]})}function fL(){return O.jsxs(O.Fragment,{children:[O.jsx("h2",{children:"Waiting for Claude Code"}),O.jsxs("p",{children:["Run ",O.jsx("code",{children:"claude"})," in any folder. As soon as a session sends an event, a node appears here and grows as subagents fork and tools are called."]}),O.jsxs("p",{className:"hint-row",children:["Not seeing anything? Make sure ",O.jsx("code",{children:"agent-dag"})," is running and that the hook is installed in ",O.jsx("code",{children:"~/.claude/settings.json"}),"."]})]})}function dL({count:e}){return O.jsxs(O.Fragment,{children:[O.jsx("h3",{children:"Detail"}),e===0?O.jsxs("div",{className:"hint",children:["No data yet. Start a Claude Code session anywhere on this machine — agent-dag is in ",O.jsx("code",{children:"--all"})," mode and listens to every workspace."]}):O.jsx("div",{className:"empty",children:"Click an agent to see its tools."}),O.jsx("h3",{style:{marginTop:4},children:"Shortcuts"}),O.jsxs("div",{className:"shortcuts",children:[O.jsxs("div",{className:"sc",children:[O.jsx("kbd",{children:"drag"}),O.jsx("span",{children:"move a node"})]}),O.jsxs("div",{className:"sc",children:[O.jsx("kbd",{children:"/"}),O.jsx("span",{children:"focus search"})]}),O.jsxs("div",{className:"sc",children:[O.jsx("kbd",{children:"space"}),O.jsx("span",{children:"pause / resume"})]}),O.jsxs("div",{className:"sc",children:[O.jsx("kbd",{children:"R"}),O.jsx("span",{children:"re-arrange"})]}),O.jsxs("div",{className:"sc",children:[O.jsx("kbd",{children:"F"}),O.jsx("span",{children:"fit view"})]}),O.jsxs("div",{className:"sc",children:[O.jsx("kbd",{children:"C"}),O.jsx("span",{children:"clear canvas"})]}),O.jsxs("div",{className:"sc",children:[O.jsx("kbd",{children:"T"}),O.jsx("span",{children:"toggle theme"})]}),O.jsxs("div",{className:"sc",children:[O.jsx("kbd",{children:"Esc"}),O.jsx("span",{children:"deselect"})]})]})]})}function hL({agent:e,now:r,onOpenTool:i}){const o=Math.max(0,Math.floor(((e.endedAt??r)-e.startedAt)/1e3));return O.jsxs(O.Fragment,{children:[O.jsx("h3",{children:e.label}),O.jsxs("div",{children:[O.jsxs("div",{className:"row",children:[O.jsx("span",{className:"k",children:"kind"}),O.jsx("span",{className:"v",children:e.kind})]}),O.jsxs("div",{className:"row",children:[O.jsx("span",{className:"k",children:"state"}),O.jsx("span",{className:"v",children:e.state})]}),O.jsxs("div",{className:"row",children:[O.jsx("span",{className:"k",children:"elapsed"}),O.jsxs("span",{className:"v",children:[o,"s"]})]}),O.jsxs("div",{className:"row",children:[O.jsx("span",{className:"k",children:"tools"}),O.jsx("span",{className:"v",children:e.toolCount})]}),e.cwd&&O.jsxs("div",{className:"row",children:[O.jsx("span",{className:"k",children:"cwd"}),O.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),O.jsxs("div",{className:"row",children:[O.jsx("span",{className:"k",children:"session"}),O.jsxs("span",{className:"v",children:[e.sessionId.slice(0,8),"…"]})]})]}),e.usage.inputTokens+e.usage.outputTokens>0&&O.jsxs(O.Fragment,{children:[O.jsx("h3",{children:"Tokens"}),O.jsxs("div",{className:"tokens-grid",children:[O.jsxs("div",{children:[O.jsx("span",{className:"k",children:"in"}),O.jsx("b",{children:e.usage.inputTokens.toLocaleString()})]}),O.jsxs("div",{children:[O.jsx("span",{className:"k",children:"out"}),O.jsx("b",{children:e.usage.outputTokens.toLocaleString()})]}),O.jsxs("div",{children:[O.jsx("span",{className:"k",children:"cache r"}),O.jsx("b",{children:e.usage.cacheReadTokens.toLocaleString()})]}),O.jsxs("div",{children:[O.jsx("span",{className:"k",children:"cache c"}),O.jsx("b",{children:e.usage.cacheCreateTokens.toLocaleString()})]})]})]}),e.prompts.length>0&&O.jsxs(O.Fragment,{children:[O.jsxs("h3",{children:["Prompts (",e.prompts.length,")"]}),O.jsx("div",{className:"prompts",children:e.prompts.map((s,u)=>O.jsxs("div",{className:"prompt-entry",children:[O.jsx("div",{className:"prompt-time",children:new Date(s.at).toLocaleTimeString()}),O.jsx("div",{className:"prompt-text",children:s.text})]},u))})]}),O.jsxs("h3",{children:["Tool calls (",e.tools.length,")"]}),e.tools.length===0&&O.jsx("div",{className:"empty",children:"No tool calls yet."}),O.jsx("div",{children:e.tools.slice().reverse().map(s=>O.jsx(pL,{t:s,now:r,onClick:()=>i(s.id)},s.id))})]})}function pL({t:e,now:r,onClick:i}){const o=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=(e.endedAt??r)-e.startedAt,u=e.endedAt==null?"…":s<1e3?`${s}ms`:`${(s/1e3).toFixed(1)}s`;return O.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:i,children:[O.jsxs("span",{className:"name",children:[O.jsx("span",{className:`status-dot ${o}`}),e.name]}),O.jsx("span",{style:{color:"var(--muted)"},children:u})]})}const vL=o2.createRoot(document.getElementById("root"));vL.render(O.jsx(uL,{}));
|