import{l as m,a as Te,c as Ae,b as Hi,d as gi,s as ke,e as Ee,g as Ne,f as Oe}from"./transform-12111574.js";import{s as Me}from"./setupGraphViewbox-e1099da8-c59d788d.js";import{c as Ie}from"./commonDb-7528607a-bad803a2.js";var mi={};Object.defineProperty(mi,"__esModule",{value:!0});var qi=mi.sanitizeUrl=void 0,$e=/^([^\w]*)(javascript|data|vbscript)/im,Pe=/&#(\w+)(^\w|;)?/g,je=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,Le=/^([^:]+):/gm,Fe=[".","/"];function De(i){return Fe.indexOf(i[0])>-1}function Re(i){return i.replace(Pe,function(e,n){return String.fromCharCode(n)})}function ze(i){var e=Re(i||"").replace(je,"").trim();if(!e)return"about:blank";if(De(e))return e;var n=e.match(Le);if(!n)return e;var t=n[0];return $e.test(t)?"about:blank":e}qi=mi.sanitizeUrl=ze;var Ko=Math.abs,Vo=Math.atan2,Xo=Math.cos,Jo=Math.max,Zo=Math.min,Qo=Math.sin,is=Math.sqrt,Ni=1e-12,yi=Math.PI,Oi=yi/2,es=2*yi;function ns(i){return i>1?0:i<-1?yi:Math.acos(i)}function ts(i){return i>=1?Oi:i<=-1?-Oi:Math.asin(i)}function Gi(i){this._context=i}Gi.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(i,e){switch(i=+i,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(i,e):this._context.moveTo(i,e);break;case 1:this._point=2;default:this._context.lineTo(i,e);break}}};function Be(i){return new Gi(i)}function E(){}function K(i,e,n){i._context.bezierCurveTo((2*i._x0+i._x1)/3,(2*i._y0+i._y1)/3,(i._x0+2*i._x1)/3,(i._y0+2*i._y1)/3,(i._x0+4*i._x1+e)/6,(i._y0+4*i._y1+n)/6)}function ri(i){this._context=i}ri.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:K(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(i,e){switch(i=+i,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(i,e):this._context.moveTo(i,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:K(this,i,e);break}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=e}};function Ye(i){return new ri(i)}function Ki(i){this._context=i}Ki.prototype={areaStart:E,areaEnd:E,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(i,e){switch(i=+i,e=+e,this._point){case 0:this._point=1,this._x2=i,this._y2=e;break;case 1:this._point=2,this._x3=i,this._y3=e;break;case 2:this._point=3,this._x4=i,this._y4=e,this._context.moveTo((this._x0+4*this._x1+i)/6,(this._y0+4*this._y1+e)/6);break;default:K(this,i,e);break}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=e}};function We(i){return new Ki(i)}function Vi(i){this._context=i}Vi.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(i,e){switch(i=+i,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+i)/6,t=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,t):this._context.moveTo(n,t);break;case 3:this._point=4;default:K(this,i,e);break}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=e}};function Ue(i){return new Vi(i)}class Xi{constructor(e,n){this._context=e,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}}function He(i){return new Xi(i,!0)}function qe(i){return new Xi(i,!1)}function Ji(i,e){this._basis=new ri(i),this._beta=e}Ji.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var i=this._x,e=this._y,n=i.length-1;if(n>0)for(var t=i[0],r=e[0],s=i[n]-t,o=e[n]-r,l=-1,a;++l<=n;)a=l/n,this._basis.point(this._beta*i[l]+(1-this._beta)*(t+a*s),this._beta*e[l]+(1-this._beta)*(r+a*o));this._x=this._y=null,this._basis.lineEnd()},point:function(i,e){this._x.push(+i),this._y.push(+e)}};const Ge=function i(e){function n(t){return e===1?new ri(t):new Ji(t,e)}return n.beta=function(t){return i(+t)},n}(.85);function V(i,e,n){i._context.bezierCurveTo(i._x1+i._k*(i._x2-i._x0),i._y1+i._k*(i._y2-i._y0),i._x2+i._k*(i._x1-e),i._y2+i._k*(i._y1-n),i._x2,i._y2)}function xi(i,e){this._context=i,this._k=(1-e)/6}xi.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:V(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(i,e){switch(i=+i,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(i,e):this._context.moveTo(i,e);break;case 1:this._point=2,this._x1=i,this._y1=e;break;case 2:this._point=3;default:V(this,i,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=i,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Ke=function i(e){function n(t){return new xi(t,e)}return n.tension=function(t){return i(+t)},n}(0);function vi(i,e){this._context=i,this._k=(1-e)/6}vi.prototype={areaStart:E,areaEnd:E,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(i,e){switch(i=+i,e=+e,this._point){case 0:this._point=1,this._x3=i,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=i,this._y4=e);break;case 2:this._point=3,this._x5=i,this._y5=e;break;default:V(this,i,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=i,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Ve=function i(e){function n(t){return new vi(t,e)}return n.tension=function(t){return i(+t)},n}(0);function bi(i,e){this._context=i,this._k=(1-e)/6}bi.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(i,e){switch(i=+i,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:V(this,i,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=i,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Xe=function i(e){function n(t){return new bi(t,e)}return n.tension=function(t){return i(+t)},n}(0);function wi(i,e,n){var t=i._x1,r=i._y1,s=i._x2,o=i._y2;if(i._l01_a>Ni){var l=2*i._l01_2a+3*i._l01_a*i._l12_a+i._l12_2a,a=3*i._l01_a*(i._l01_a+i._l12_a);t=(t*l-i._x0*i._l12_2a+i._x2*i._l01_2a)/a,r=(r*l-i._y0*i._l12_2a+i._y2*i._l01_2a)/a}if(i._l23_a>Ni){var h=2*i._l23_2a+3*i._l23_a*i._l12_a+i._l12_2a,f=3*i._l23_a*(i._l23_a+i._l12_a);s=(s*h+i._x1*i._l23_2a-e*i._l12_2a)/f,o=(o*h+i._y1*i._l23_2a-n*i._l12_2a)/f}i._context.bezierCurveTo(t,r,s,o,i._x2,i._y2)}function Zi(i,e){this._context=i,this._alpha=e}Zi.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(i,e){if(i=+i,e=+e,this._point){var n=this._x2-i,t=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+t*t,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(i,e):this._context.moveTo(i,e);break;case 1:this._point=2;break;case 2:this._point=3;default:wi(this,i,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=i,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Je=function i(e){function n(t){return e?new Zi(t,e):new xi(t,0)}return n.alpha=function(t){return i(+t)},n}(.5);function Qi(i,e){this._context=i,this._alpha=e}Qi.prototype={areaStart:E,areaEnd:E,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(i,e){if(i=+i,e=+e,this._point){var n=this._x2-i,t=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+t*t,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=i,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=i,this._y4=e);break;case 2:this._point=3,this._x5=i,this._y5=e;break;default:wi(this,i,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=i,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Ze=function i(e){function n(t){return e?new Qi(t,e):new vi(t,0)}return n.alpha=function(t){return i(+t)},n}(.5);function ie(i,e){this._context=i,this._alpha=e}ie.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(i,e){if(i=+i,e=+e,this._point){var n=this._x2-i,t=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+t*t,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:wi(this,i,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=i,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Qe=function i(e){function n(t){return e?new ie(t,e):new bi(t,0)}return n.alpha=function(t){return i(+t)},n}(.5);function ee(i){this._context=i}ee.prototype={areaStart:E,areaEnd:E,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(i,e){i=+i,e=+e,this._point?this._context.lineTo(i,e):(this._point=1,this._context.moveTo(i,e))}};function en(i){return new ee(i)}function Mi(i){return i<0?-1:1}function Ii(i,e,n){var t=i._x1-i._x0,r=e-i._x1,s=(i._y1-i._y0)/(t||r<0&&-0),o=(n-i._y1)/(r||t<0&&-0),l=(s*r+o*t)/(t+r);return(Mi(s)+Mi(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(l))||0}function $i(i,e){var n=i._x1-i._x0;return n?(3*(i._y1-i._y0)/n-e)/2:e}function ci(i,e,n){var t=i._x0,r=i._y0,s=i._x1,o=i._y1,l=(s-t)/3;i._context.bezierCurveTo(t+l,r+l*e,s-l,o-l*n,s,o)}function X(i){this._context=i}X.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:ci(this,this._t0,$i(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(i,e){var n=NaN;if(i=+i,e=+e,!(i===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(i,e):this._context.moveTo(i,e);break;case 1:this._point=2;break;case 2:this._point=3,ci(this,$i(this,n=Ii(this,i,e)),n);break;default:ci(this,this._t0,n=Ii(this,i,e));break}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=e,this._t0=n}}};function ne(i){this._context=new te(i)}(ne.prototype=Object.create(X.prototype)).point=function(i,e){X.prototype.point.call(this,e,i)};function te(i){this._context=i}te.prototype={moveTo:function(i,e){this._context.moveTo(e,i)},closePath:function(){this._context.closePath()},lineTo:function(i,e){this._context.lineTo(e,i)},bezierCurveTo:function(i,e,n,t,r,s){this._context.bezierCurveTo(e,i,t,n,s,r)}};function nn(i){return new X(i)}function tn(i){return new ne(i)}function re(i){this._context=i}re.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var i=this._x,e=this._y,n=i.length;if(n)if(this._line?this._context.lineTo(i[0],e[0]):this._context.moveTo(i[0],e[0]),n===2)this._context.lineTo(i[1],e[1]);else for(var t=Pi(i),r=Pi(e),s=0,o=1;o=0;--e)r[e]=(o[e]-r[e+1])/s[e];for(s[n-1]=(i[n]+r[n-1])/2,e=0;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(i,e){switch(i=+i,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(i,e):this._context.moveTo(i,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(i,e);else{var n=this._x*(1-this._t)+i*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=i,this._y=e}};function on(i){return new oi(i,.5)}function sn(i){return new oi(i,0)}function ln(i){return new oi(i,1)}var an=typeof global=="object"&&global&&global.Object===Object&&global;const cn=an;var hn=typeof self=="object"&&self&&self.Object===Object&&self,un=cn||hn||Function("return this")();const Ci=un;var fn=Ci.Symbol;const J=fn;var oe=Object.prototype,_n=oe.hasOwnProperty,pn=oe.toString,z=J?J.toStringTag:void 0;function dn(i){var e=_n.call(i,z),n=i[z];try{i[z]=void 0;var t=!0}catch{}var r=pn.call(i);return t&&(e?i[z]=n:delete i[z]),r}var gn=Object.prototype,mn=gn.toString;function yn(i){return mn.call(i)}var xn="[object Null]",vn="[object Undefined]",ji=J?J.toStringTag:void 0;function bn(i){return i==null?i===void 0?vn:xn:ji&&ji in Object(i)?dn(i):yn(i)}function se(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var wn="[object AsyncFunction]",Cn="[object Function]",Sn="[object GeneratorFunction]",Tn="[object Proxy]";function An(i){if(!se(i))return!1;var e=bn(i);return e==Cn||e==Sn||e==wn||e==Tn}var kn=Ci["__core-js_shared__"];const hi=kn;var Li=function(){var i=/[^.]+$/.exec(hi&&hi.keys&&hi.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}();function En(i){return!!Li&&Li in i}var Nn=Function.prototype,On=Nn.toString;function Mn(i){if(i!=null){try{return On.call(i)}catch{}try{return i+""}catch{}}return""}var In=/[\\^$.*+?()[\]{}|]/g,$n=/^\[object .+?Constructor\]$/,Pn=Function.prototype,jn=Object.prototype,Ln=Pn.toString,Fn=jn.hasOwnProperty,Dn=RegExp("^"+Ln.call(Fn).replace(In,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Rn(i){if(!se(i)||En(i))return!1;var e=An(i)?Dn:$n;return e.test(Mn(i))}function zn(i,e){return i==null?void 0:i[e]}function le(i,e){var n=zn(i,e);return Rn(n)?n:void 0}var Bn=le(Object,"create");const B=Bn;function Yn(){this.__data__=B?B(null):{},this.size=0}function Wn(i){var e=this.has(i)&&delete this.__data__[i];return this.size-=e?1:0,e}var Un="__lodash_hash_undefined__",Hn=Object.prototype,qn=Hn.hasOwnProperty;function Gn(i){var e=this.__data__;if(B){var n=e[i];return n===Un?void 0:n}return qn.call(e,i)?e[i]:void 0}var Kn=Object.prototype,Vn=Kn.hasOwnProperty;function Xn(i){var e=this.__data__;return B?e[i]!==void 0:Vn.call(e,i)}var Jn="__lodash_hash_undefined__";function Zn(i,e){var n=this.__data__;return this.size+=this.has(i)?0:1,n[i]=B&&e===void 0?Jn:e,this}function I(i){var e=-1,n=i==null?0:i.length;for(this.clear();++e-1}function st(i,e){var n=this.__data__,t=si(n,i);return t<0?(++this.size,n.push([i,e])):n[t][1]=e,this}function R(i){var e=-1,n=i==null?0:i.length;for(this.clear();++e"u"||i===null}function gt(i){return typeof i=="object"&&i!==null}function mt(i){return Array.isArray(i)?i:ae(i)?[]:[i]}function yt(i,e){var n,t,r,s;if(e)for(s=Object.keys(e),n=0,t=s.length;nl&&(s=" ... ",e=t-l+s.length),n-t>l&&(o=" ...",n=t+l-o.length),{str:s+i.slice(e,n).replace(/\t/g,"→")+o,pos:t-e+s.length}}function fi(i,e){return w.repeat(" ",e-i.length)+i}function kt(i,e){if(e=Object.create(e||null),!i.buffer)return null;e.maxLength||(e.maxLength=79),typeof e.indent!="number"&&(e.indent=1),typeof e.linesBefore!="number"&&(e.linesBefore=3),typeof e.linesAfter!="number"&&(e.linesAfter=2);for(var n=/\r?\n|\r|\0/g,t=[0],r=[],s,o=-1;s=n.exec(i.buffer);)r.push(s.index),t.push(s.index+s[0].length),i.position<=s.index&&o<0&&(o=t.length-2);o<0&&(o=t.length-1);var l="",a,h,f=Math.min(i.line+e.linesAfter,r.length).toString().length,c=e.maxLength-(e.indent+f+3);for(a=1;a<=e.linesBefore&&!(o-a<0);a++)h=ui(i.buffer,t[o-a],r[o-a],i.position-(t[o]-t[o-a]),c),l=w.repeat(" ",e.indent)+fi((i.line-a+1).toString(),f)+" | "+h.str+` `+l;for(h=ui(i.buffer,t[o],r[o],i.position,c),l+=w.repeat(" ",e.indent)+fi((i.line+1).toString(),f)+" | "+h.str+` `,l+=w.repeat("-",e.indent+f+3+h.pos)+`^ `,a=1;a<=e.linesAfter&&!(o+a>=r.length);a++)h=ui(i.buffer,t[o+a],r[o+a],i.position-(t[o]-t[o+a]),c),l+=w.repeat(" ",e.indent)+fi((i.line+a+1).toString(),f)+" | "+h.str+` `;return l.replace(/\n$/,"")}var Et=kt,Nt=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Ot=["scalar","sequence","mapping"];function Mt(i){var e={};return i!==null&&Object.keys(i).forEach(function(n){i[n].forEach(function(t){e[String(t)]=n})}),e}function It(i,e){if(e=e||{},Object.keys(e).forEach(function(n){if(Nt.indexOf(n)===-1)throw new A('Unknown option "'+n+'" is met in definition of "'+i+'" YAML type.')}),this.options=e,this.tag=i,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(n){return n},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.representName=e.representName||null,this.defaultStyle=e.defaultStyle||null,this.multi=e.multi||!1,this.styleAliases=Mt(e.styleAliases||null),Ot.indexOf(this.kind)===-1)throw new A('Unknown kind "'+this.kind+'" is specified for "'+i+'" YAML type.')}var b=It;function Fi(i,e){var n=[];return i[e].forEach(function(t){var r=n.length;n.forEach(function(s,o){s.tag===t.tag&&s.kind===t.kind&&s.multi===t.multi&&(r=o)}),n[r]=t}),n}function $t(){var i={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},e,n;function t(r){r.multi?(i.multi[r.kind].push(r),i.multi.fallback.push(r)):i[r.kind][r.tag]=i.fallback[r.tag]=r}for(e=0,n=arguments.length;e=0?"0b"+i.toString(2):"-0b"+i.toString(2).slice(1)},octal:function(i){return i>=0?"0o"+i.toString(8):"-0o"+i.toString(8).slice(1)},decimal:function(i){return i.toString(10)},hexadecimal:function(i){return i>=0?"0x"+i.toString(16).toUpperCase():"-0x"+i.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Qt=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function ir(i){return!(i===null||!Qt.test(i)||i[i.length-1]==="_")}function er(i){var e,n;return e=i.replace(/_/g,"").toLowerCase(),n=e[0]==="-"?-1:1,"+-".indexOf(e[0])>=0&&(e=e.slice(1)),e===".inf"?n===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:e===".nan"?NaN:n*parseFloat(e,10)}var nr=/^[-+]?[0-9]+e/;function tr(i,e){var n;if(isNaN(i))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===i)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===i)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(w.isNegativeZero(i))return"-0.0";return n=i.toString(10),nr.test(n)?n.replace("e",".e"):n}function rr(i){return Object.prototype.toString.call(i)==="[object Number]"&&(i%1!==0||w.isNegativeZero(i))}var or=new b("tag:yaml.org,2002:float",{kind:"scalar",resolve:ir,construct:er,predicate:rr,represent:tr,defaultStyle:"lowercase"}),sr=he.extend({implicit:[Bt,Ht,Zt,or]}),lr=sr,ue=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),fe=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function ar(i){return i===null?!1:ue.exec(i)!==null||fe.exec(i)!==null}function cr(i){var e,n,t,r,s,o,l,a=0,h=null,f,c,p;if(e=ue.exec(i),e===null&&(e=fe.exec(i)),e===null)throw new Error("Date resolve error");if(n=+e[1],t=+e[2]-1,r=+e[3],!e[4])return new Date(Date.UTC(n,t,r));if(s=+e[4],o=+e[5],l=+e[6],e[7]){for(a=e[7].slice(0,3);a.length<3;)a+="0";a=+a}return e[9]&&(f=+e[10],c=+(e[11]||0),h=(f*60+c)*6e4,e[9]==="-"&&(h=-h)),p=new Date(Date.UTC(n,t,r,s,o,l,a)),h&&p.setTime(p.getTime()-h),p}function hr(i){return i.toISOString()}var ur=new b("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:ar,construct:cr,instanceOf:Date,represent:hr});function fr(i){return i==="<<"||i===null}var _r=new b("tag:yaml.org,2002:merge",{kind:"scalar",resolve:fr}),Si=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/= \r`;function pr(i){if(i===null)return!1;var e,n,t=0,r=i.length,s=Si;for(n=0;n64)){if(e<0)return!1;t+=6}return t%8===0}function dr(i){var e,n,t=i.replace(/[\r\n=]/g,""),r=t.length,s=Si,o=0,l=[];for(e=0;e>16&255),l.push(o>>8&255),l.push(o&255)),o=o<<6|s.indexOf(t.charAt(e));return n=r%4*6,n===0?(l.push(o>>16&255),l.push(o>>8&255),l.push(o&255)):n===18?(l.push(o>>10&255),l.push(o>>2&255)):n===12&&l.push(o>>4&255),new Uint8Array(l)}function gr(i){var e="",n=0,t,r,s=i.length,o=Si;for(t=0;t>18&63],e+=o[n>>12&63],e+=o[n>>6&63],e+=o[n&63]),n=(n<<8)+i[t];return r=s%3,r===0?(e+=o[n>>18&63],e+=o[n>>12&63],e+=o[n>>6&63],e+=o[n&63]):r===2?(e+=o[n>>10&63],e+=o[n>>4&63],e+=o[n<<2&63],e+=o[64]):r===1&&(e+=o[n>>2&63],e+=o[n<<4&63],e+=o[64],e+=o[64]),e}function mr(i){return Object.prototype.toString.call(i)==="[object Uint8Array]"}var yr=new b("tag:yaml.org,2002:binary",{kind:"scalar",resolve:pr,construct:dr,predicate:mr,represent:gr}),xr=Object.prototype.hasOwnProperty,vr=Object.prototype.toString;function br(i){if(i===null)return!0;var e=[],n,t,r,s,o,l=i;for(n=0,t=l.length;n>10)+55296,(i-65536&1023)+56320)}var me=new Array(256),ye=new Array(256);for(var P=0;P<256;P++)me[P]=zi(P)?1:0,ye[P]=zi(P);function Br(i,e){this.input=i,this.filename=e.filename||null,this.schema=e.schema||Ir,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=i.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function xe(i,e){var n={name:i.filename,buffer:i.input.slice(0,-1),position:i.position,line:i.line,column:i.position-i.lineStart};return n.snippet=Et(n),new A(e,n)}function _(i,e){throw xe(i,e)}function ii(i,e){i.onWarning&&i.onWarning.call(null,xe(i,e))}var Bi={YAML:function(e,n,t){var r,s,o;e.version!==null&&_(e,"duplication of %YAML directive"),t.length!==1&&_(e,"YAML directive accepts exactly one argument"),r=/^([0-9]+)\.([0-9]+)$/.exec(t[0]),r===null&&_(e,"ill-formed argument of the YAML directive"),s=parseInt(r[1],10),o=parseInt(r[2],10),s!==1&&_(e,"unacceptable YAML version of the document"),e.version=t[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&ii(e,"unsupported YAML version of the document")},TAG:function(e,n,t){var r,s;t.length!==2&&_(e,"TAG directive accepts exactly two arguments"),r=t[0],s=t[1],de.test(r)||_(e,"ill-formed tag handle (first argument) of the TAG directive"),N.call(e.tagMap,r)&&_(e,'there is a previously declared suffix for "'+r+'" tag handle'),ge.test(s)||_(e,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{_(e,"tag prefix is malformed: "+s)}e.tagMap[r]=s}};function k(i,e,n,t){var r,s,o,l;if(e1&&(i.result+=w.repeat(` `,e-1))}function Yr(i,e,n){var t,r,s,o,l,a,h,f,c=i.kind,p=i.result,u;if(u=i.input.charCodeAt(i.position),S(u)||j(u)||u===35||u===38||u===42||u===33||u===124||u===62||u===39||u===34||u===37||u===64||u===96||(u===63||u===45)&&(r=i.input.charCodeAt(i.position+1),S(r)||n&&j(r)))return!1;for(i.kind="scalar",i.result="",s=o=i.position,l=!1;u!==0;){if(u===58){if(r=i.input.charCodeAt(i.position+1),S(r)||n&&j(r))break}else if(u===35){if(t=i.input.charCodeAt(i.position-1),S(t))break}else{if(i.position===i.lineStart&&ai(i)||n&&j(u))break;if(T(u))if(a=i.line,h=i.lineStart,f=i.lineIndent,v(i,!1,-1),i.lineIndent>=e){l=!0,u=i.input.charCodeAt(i.position);continue}else{i.position=o,i.line=a,i.lineStart=h,i.lineIndent=f;break}}l&&(k(i,s,o,!1),Ai(i,i.line-a),s=o=i.position,l=!1),M(u)||(o=i.position+1),u=i.input.charCodeAt(++i.position)}return k(i,s,o,!1),i.result?!0:(i.kind=c,i.result=p,!1)}function Wr(i,e){var n,t,r;if(n=i.input.charCodeAt(i.position),n!==39)return!1;for(i.kind="scalar",i.result="",i.position++,t=r=i.position;(n=i.input.charCodeAt(i.position))!==0;)if(n===39)if(k(i,t,i.position,!0),n=i.input.charCodeAt(++i.position),n===39)t=i.position,i.position++,r=i.position;else return!0;else T(n)?(k(i,t,r,!0),Ai(i,v(i,!1,e)),t=r=i.position):i.position===i.lineStart&&ai(i)?_(i,"unexpected end of the document within a single quoted scalar"):(i.position++,r=i.position);_(i,"unexpected end of the stream within a single quoted scalar")}function Ur(i,e){var n,t,r,s,o,l;if(l=i.input.charCodeAt(i.position),l!==34)return!1;for(i.kind="scalar",i.result="",i.position++,n=t=i.position;(l=i.input.charCodeAt(i.position))!==0;){if(l===34)return k(i,n,i.position,!0),i.position++,!0;if(l===92){if(k(i,n,i.position,!0),l=i.input.charCodeAt(++i.position),T(l))v(i,!1,e);else if(l<256&&me[l])i.result+=ye[l],i.position++;else if((o=Dr(l))>0){for(r=o,s=0;r>0;r--)l=i.input.charCodeAt(++i.position),(o=Fr(l))>=0?s=(s<<4)+o:_(i,"expected hexadecimal character");i.result+=zr(s),i.position++}else _(i,"unknown escape sequence");n=t=i.position}else T(l)?(k(i,n,t,!0),Ai(i,v(i,!1,e)),n=t=i.position):i.position===i.lineStart&&ai(i)?_(i,"unexpected end of the document within a double quoted scalar"):(i.position++,t=i.position)}_(i,"unexpected end of the stream within a double quoted scalar")}function Hr(i,e){var n=!0,t,r,s,o=i.tag,l,a=i.anchor,h,f,c,p,u,g=Object.create(null),x,y,C,d;if(d=i.input.charCodeAt(i.position),d===91)f=93,u=!1,l=[];else if(d===123)f=125,u=!0,l={};else return!1;for(i.anchor!==null&&(i.anchorMap[i.anchor]=l),d=i.input.charCodeAt(++i.position);d!==0;){if(v(i,!0,e),d=i.input.charCodeAt(i.position),d===f)return i.position++,i.tag=o,i.anchor=a,i.kind=u?"mapping":"sequence",i.result=l,!0;n?d===44&&_(i,"expected the node content, but found ','"):_(i,"missed comma between flow collection entries"),y=x=C=null,c=p=!1,d===63&&(h=i.input.charCodeAt(i.position+1),S(h)&&(c=p=!0,i.position++,v(i,!0,e))),t=i.line,r=i.lineStart,s=i.position,F(i,e,Z,!1,!0),y=i.tag,x=i.result,v(i,!0,e),d=i.input.charCodeAt(i.position),(p||i.line===t)&&d===58&&(c=!0,d=i.input.charCodeAt(++i.position),v(i,!0,e),F(i,e,Z,!1,!0),C=i.result),u?L(i,l,g,y,x,C,t,r,s):c?l.push(L(i,null,g,y,x,C,t,r,s)):l.push(x),v(i,!0,e),d=i.input.charCodeAt(i.position),d===44?(n=!0,d=i.input.charCodeAt(++i.position)):n=!1}_(i,"unexpected end of the stream within a flow collection")}function qr(i,e){var n,t,r=_i,s=!1,o=!1,l=e,a=0,h=!1,f,c;if(c=i.input.charCodeAt(i.position),c===124)t=!1;else if(c===62)t=!0;else return!1;for(i.kind="scalar",i.result="";c!==0;)if(c=i.input.charCodeAt(++i.position),c===43||c===45)_i===r?r=c===43?Di:$r:_(i,"repeat of a chomping mode identifier");else if((f=Rr(c))>=0)f===0?_(i,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?_(i,"repeat of an indentation width identifier"):(l=e+f-1,o=!0);else break;if(M(c)){do c=i.input.charCodeAt(++i.position);while(M(c));if(c===35)do c=i.input.charCodeAt(++i.position);while(!T(c)&&c!==0)}for(;c!==0;){for(Ti(i),i.lineIndent=0,c=i.input.charCodeAt(i.position);(!o||i.lineIndentl&&(l=i.lineIndent),T(c)){a++;continue}if(i.lineIndente)&&a!==0)_(i,"bad indentation of a sequence entry");else if(i.lineIndente)&&(y&&(o=i.line,l=i.lineStart,a=i.position),F(i,e,Q,!0,r)&&(y?g=i.result:x=i.result),y||(L(i,c,p,u,g,x,o,l,a),u=g=x=null),v(i,!0,-1),d=i.input.charCodeAt(i.position)),(i.line===s||i.lineIndent>e)&&d!==0)_(i,"bad indentation of a mapping entry");else if(i.lineIndente?a=1:i.lineIndent===e?a=0:i.lineIndente?a=1:i.lineIndent===e?a=0:i.lineIndent tag; it should be "scalar", not "'+i.kind+'"'),c=0,p=i.implicitTypes.length;c"),i.result!==null&&g.kind!==i.kind&&_(i,"unacceptable node kind for !<"+i.tag+'> tag; it should be "'+g.kind+'", not "'+i.kind+'"'),g.resolve(i.result,i.tag)?(i.result=g.construct(i.result,i.tag),i.anchor!==null&&(i.anchorMap[i.anchor]=i.result)):_(i,"cannot resolve a node with !<"+i.tag+"> explicit tag")}return i.listener!==null&&i.listener("close",i),i.tag!==null||i.anchor!==null||f}function Jr(i){var e=i.position,n,t,r,s=!1,o;for(i.version=null,i.checkLineBreaks=i.legacy,i.tagMap=Object.create(null),i.anchorMap=Object.create(null);(o=i.input.charCodeAt(i.position))!==0&&(v(i,!0,-1),o=i.input.charCodeAt(i.position),!(i.lineIndent>0||o!==37));){for(s=!0,o=i.input.charCodeAt(++i.position),n=i.position;o!==0&&!S(o);)o=i.input.charCodeAt(++i.position);for(t=i.input.slice(n,i.position),r=[],t.length<1&&_(i,"directive name must not be less than one character in length");o!==0;){for(;M(o);)o=i.input.charCodeAt(++i.position);if(o===35){do o=i.input.charCodeAt(++i.position);while(o!==0&&!T(o));break}if(T(o))break;for(n=i.position;o!==0&&!S(o);)o=i.input.charCodeAt(++i.position);r.push(i.input.slice(n,i.position))}o!==0&&Ti(i),N.call(Bi,t)?Bi[t](i,t,r):ii(i,'unknown document directive "'+t+'"')}if(v(i,!0,-1),i.lineIndent===0&&i.input.charCodeAt(i.position)===45&&i.input.charCodeAt(i.position+1)===45&&i.input.charCodeAt(i.position+2)===45?(i.position+=3,v(i,!0,-1)):s&&_(i,"directives end mark is expected"),F(i,i.lineIndent-1,Q,!1,!0),v(i,!0,-1),i.checkLineBreaks&&jr.test(i.input.slice(e,i.position))&&ii(i,"non-ASCII line breaks are interpreted as content"),i.documents.push(i.result),i.position===i.lineStart&&ai(i)){i.input.charCodeAt(i.position)===46&&(i.position+=3,v(i,!0,-1));return}if(i.position"u"&&(n=e,e=null);var t=ve(i,n);if(typeof e!="function")return t;for(var r=0,s=t.length;r{let t="";return i in q&&q[i]?t=q[i](n):m.warn(`No theme found for ${i}`),` & { font-family: ${n.fontFamily}; font-size: ${n.fontSize}; fill: ${n.textColor} } /* Classes common for multiple diagrams */ & .error-icon { fill: ${n.errorBkgColor}; } & .error-text { fill: ${n.errorTextColor}; stroke: ${n.errorTextColor}; } & .edge-thickness-normal { stroke-width: 2px; } & .edge-thickness-thick { stroke-width: 3.5px } & .edge-pattern-solid { stroke-dasharray: 0; } & .edge-pattern-dashed{ stroke-dasharray: 3; } .edge-pattern-dotted { stroke-dasharray: 2; } & .marker { fill: ${n.lineColor}; stroke: ${n.lineColor}; } & .marker.cross { stroke: ${n.lineColor}; } & svg { font-family: ${n.fontFamily}; font-size: ${n.fontSize}; } ${t} ${e} `},so=(i,e)=>{q[i]=e},os=oo;let O={};const lo=function(i,e,n,t){m.debug("parseDirective is being called",e,n,t);try{if(e!==void 0)switch(e=e.trim(),n){case"open_directive":O={};break;case"type_directive":if(!O)throw new Error("currentDirective is undefined");O.type=e.toLowerCase();break;case"arg_directive":if(!O)throw new Error("currentDirective is undefined");O.args=JSON.parse(e);break;case"close_directive":ao(i,O,t),O=void 0;break}}catch(r){m.error(`Error while rendering sequenceDiagram directive: ${e} jison context: ${n}`),m.error(r.message)}},ao=function(i,e,n){switch(m.info(`Directive type=${e.type} with args:`,e.args),e.type){case"init":case"initialize":{["config"].forEach(t=>{e.args[t]!==void 0&&(n==="flowchart-v2"&&(n="flowchart"),e.args[n]=e.args[t],delete e.args[t])}),m.info("sanitize in handleDirective",e.args),W(e.args),m.info("sanitize in handleDirective (done)",e.args),Te(e.args);break}case"wrap":case"nowrap":i&&i.setWrap&&i.setWrap(e.type==="wrap");break;case"themeCss":m.warn("themeCss encountered");break;default:m.warn(`Unhandled directive: source: '%%{${e.type}: ${JSON.stringify(e.args?e.args:{})}}%%`,e);break}},co=m,ho=Ee,we=Ne,uo=i=>Oe(i,we()),fo=Me,_o=()=>Ie,po=(i,e,n,t)=>lo(i,e,n,t),ei={},go=(i,e,n)=>{if(ei[i])throw new Error(`Diagram ${i} already registered.`);ei[i]=e,n&&Ce(i,n),so(i,e.styles),e.injectUtils&&e.injectUtils(co,ho,we,uo,fo,_o(),po)},mo=i=>{if(i in ei)return ei[i];throw new Error(`Diagram ${i} not found.`)};class yo extends Error{constructor(e){super(e),this.name="UnknownDiagramError"}}const xo=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,vo=/\s*%%.*\n/gm,D={},bo=function(i,e){i=i.replace(be,"").replace(xo,"").replace(vo,` `);for(const[n,{detector:t}]of Object.entries(D))if(t(i,e))return n;throw new yo(`No diagram type detected for text: ${i}`)},ss=(...i)=>{for(const{id:e,detector:n,loader:t}of i)Ce(e,n,t)},ls=async()=>{m.debug("Loading registered diagrams");const e=(await Promise.allSettled(Object.entries(D).map(async([n,{detector:t,loader:r}])=>{if(r)try{mo(n)}catch{try{const{diagram:o,id:l}=await r();go(l,o,t)}catch(o){throw m.error(`Failed to load external diagram with key ${n}. Removing from detectors.`),delete D[n],o}}}))).filter(n=>n.status==="rejected");if(e.length>0){m.error(`Failed to load ${e.length} external diagrams`);for(const n of e)m.error(n);throw new Error(`Failed to load ${e.length} external diagrams`)}},Ce=(i,e,n)=>{D[i]?m.error(`Detector with key ${i} already exists`):D[i]={detector:e,loader:n},m.debug(`Detector with key ${i} added${n?" with loader":""}`)},as=i=>D[i].loader,wo={curveBasis:Ye,curveBasisClosed:We,curveBasisOpen:Ue,curveBumpX:He,curveBumpY:qe,curveBundle:Ge,curveCardinalClosed:Ve,curveCardinalOpen:Xe,curveCardinal:Ke,curveCatmullRomClosed:Ze,curveCatmullRomOpen:Qe,curveCatmullRom:Je,curveLinear:Be,curveLinearClosed:en,curveMonotoneX:nn,curveMonotoneY:tn,curveNatural:rn,curveStep:on,curveStepAfter:ln,curveStepBefore:sn},pi=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,Co=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,So=function(i,e){const n=Se(i,/(?:init\b)|(?:initialize\b)/);let t={};if(Array.isArray(n)){const r=n.map(s=>s.args);W(r),t=Hi(t,[...r])}else t=n.args;if(t){let r=bo(i,e);["config"].forEach(s=>{t[s]!==void 0&&(r==="flowchart-v2"&&(r="flowchart"),t[r]=t[s],delete t[s])})}return t},Se=function(i,e=null){try{const n=new RegExp(`[%]{2}(?![{]${Co.source})(?=[}][%]{2}).* `,"ig");i=i.trim().replace(n,"").replace(/'/gm,'"'),m.debug(`Detecting diagram directive${e!==null?" type:"+e:""} based on the text:${i}`);let t;const r=[];for(;(t=pi.exec(i))!==null;)if(t.index===pi.lastIndex&&pi.lastIndex++,t&&!e||e&&t[1]&&t[1].match(e)||e&&t[2]&&t[2].match(e)){const s=t[1]?t[1]:t[2],o=t[3]?t[3].trim():t[4]?JSON.parse(t[4].trim()):null;r.push({type:s,args:o})}return r.length===0&&r.push({type:i,args:null}),r.length===1?r[0]:r}catch(n){return m.error(`ERROR: ${n.message} - Unable to parse directive ${e!==null?" type:"+e:""} based on the text:${i}`),{type:null,args:null}}},To=function(i,e){for(const[n,t]of e.entries())if(t.match(i))return n;return-1};function Ao(i,e){if(!i)return e;const n=`curve${i.charAt(0).toUpperCase()+i.slice(1)}`;return wo[n]||e}function ko(i,e){const n=i.trim();if(n)return e.securityLevel!=="loose"?qi(n):n}const Eo=(i,...e)=>{const n=i.split("."),t=n.length-1,r=n[t];let s=window;for(let o=0;o{n+=ni(s,e),e=s});let t=n/2,r;return e=void 0,i.forEach(s=>{if(e&&!r){const o=ni(s,e);if(o=1&&(r={x:s.x,y:s.y}),l>0&&l<1&&(r={x:(1-l)*e.x+l*s.x,y:(1-l)*e.y+l*s.y})}}e=s}),r}function Oo(i){return i.length===1?i[0]:No(i)}const Mo=(i,e,n)=>{let t;m.info(`our points ${JSON.stringify(e)}`),e[0]!==n&&(e=e.reverse());let s=25,o;t=void 0,e.forEach(f=>{if(t&&!o){const c=ni(f,t);if(c=1&&(o={x:f.x,y:f.y}),p>0&&p<1&&(o={x:(1-p)*t.x+p*f.x,y:(1-p)*t.y+p*f.y})}}t=f});const l=i?10:5,a=Math.atan2(e[0].y-o.y,e[0].x-o.x),h={x:0,y:0};return h.x=Math.sin(a)*l+(e[0].x+o.x)/2,h.y=-Math.cos(a)*l+(e[0].y+o.y)/2,h};function Io(i,e,n){let t=JSON.parse(JSON.stringify(n)),r;m.info("our points",t),e!=="start_left"&&e!=="start_right"&&(t=t.reverse()),t.forEach(c=>{r=c});let o=25+i,l;r=void 0,t.forEach(c=>{if(r&&!l){const p=ni(c,r);if(p=1&&(l={x:c.x,y:c.y}),u>0&&u<1&&(l={x:(1-u)*r.x+u*c.x,y:(1-u)*r.y+u*c.y})}}r=c});const a=10+i*.5,h=Math.atan2(t[0].y-l.y,t[0].x-l.x),f={x:0,y:0};return f.x=Math.sin(h)*a+(t[0].x+l.x)/2,f.y=-Math.cos(h)*a+(t[0].y+l.y)/2,e==="start_left"&&(f.x=Math.sin(h+Math.PI)*a+(t[0].x+l.x)/2,f.y=-Math.cos(h+Math.PI)*a+(t[0].y+l.y)/2),e==="end_right"&&(f.x=Math.sin(h-Math.PI)*a+(t[0].x+l.x)/2-5,f.y=-Math.cos(h-Math.PI)*a+(t[0].y+l.y)/2-5),e==="end_left"&&(f.x=Math.sin(h)*a+(t[0].x+l.x)/2-5,f.y=-Math.cos(h)*a+(t[0].y+l.y)/2-5),f}function $o(i){let e="",n="";for(const t of i)t!==void 0&&(t.startsWith("color:")||t.startsWith("text-align:")?n=n+t+";":e=e+t+";");return{style:e,labelStyle:n}}let Ui=0;const Po=()=>(Ui++,"id-"+Math.random().toString(36).substr(2,12)+"-"+Ui);function jo(i){let e="";const n="0123456789abcdef",t=n.length;for(let r=0;rjo(i.length),Fo=function(){return{x:0,y:0,fill:void 0,anchor:"start",style:"#666",width:100,height:100,textMargin:0,rx:0,ry:0,valign:void 0}},Do=function(i,e){const n=e.text.replace(gi.lineBreakRegex," "),[,t]=Ei(e.fontSize),r=i.append("text");r.attr("x",e.x),r.attr("y",e.y),r.style("text-anchor",e.anchor),r.style("font-family",e.fontFamily),r.style("font-size",t),r.style("font-weight",e.fontWeight),r.attr("fill",e.fill),e.class!==void 0&&r.attr("class",e.class);const s=r.append("tspan");return s.attr("x",e.x+e.textMargin*2),s.attr("fill",e.fill),s.text(n),r},Ro=U((i,e,n)=>{if(!i||(n=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"
"},n),gi.lineBreakRegex.test(i)))return i;const t=i.split(" "),r=[];let s="";return t.forEach((o,l)=>{const a=ti(`${o} `,n),h=ti(s,n);if(a>e){const{hyphenatedStrings:p,remainingWord:u}=zo(o,e,"-",n);r.push(s,...p),s=u}else h+a>=e?(r.push(s),s=o):s=[s,o].filter(Boolean).join(" ");l+1===t.length&&r.push(s)}),r.filter(o=>o!=="").join(n.joinWith)},(i,e,n)=>`${i}${e}${n.fontSize}${n.fontWeight}${n.fontFamily}${n.joinWith}`),zo=U((i,e,n="-",t)=>{t=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:0},t);const r=[...i],s=[];let o="";return r.forEach((l,a)=>{const h=`${o}${l}`;if(ti(h,t)>=e){const c=a+1,p=r.length===c,u=`${h}${n}`;s.push(p?h:u),o=""}else o=h}),{hyphenatedStrings:s,remainingWord:o}},(i,e,n="-",t)=>`${i}${e}${n}${t.fontSize}${t.fontWeight}${t.fontFamily}`);function Bo(i,e){return e=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:15},e),ki(i,e).height}function ti(i,e){return e=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial"},e),ki(i,e).width}const ki=U((i,e)=>{e=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial"},e);const{fontSize:n,fontFamily:t,fontWeight:r}=e;if(!i)return{width:0,height:0};const[,s]=Ei(n),o=["sans-serif",t],l=i.split(gi.lineBreakRegex),a=[],h=ke("body");if(!h.remove)return{width:0,height:0,lineHeight:0};const f=h.append("svg");for(const p of o){let u=0;const g={width:0,height:0,lineHeight:0};for(const x of l){const y=Fo();y.text=x;const C=Do(f,y).style("font-size",s).style("font-weight",r).style("font-family",p),d=(C._groups||C)[0][0].getBBox();g.width=Math.round(Math.max(g.width,d.width)),u=Math.round(d.height),g.height+=u,g.lineHeight=Math.round(Math.max(g.lineHeight,u))}a.push(g)}f.remove();const c=isNaN(a[1].height)||isNaN(a[1].width)||isNaN(a[1].lineHeight)||a[0].height>a[1].height&&a[0].width>a[1].width&&a[0].lineHeight>a[1].lineHeight?0:1;return a[c]},(i,e)=>`${i}${e.fontSize}${e.fontWeight}${e.fontFamily}`),Yo=class{constructor(e,n){this.deterministic=e,this.seed=n,this.count=n?n.length:0}next(){return this.deterministic?this.count++:Date.now()}};let H;const Wo=function(i){return H=H||document.createElement("div"),i=escape(i).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),H.innerHTML=i,unescape(H.textContent)},W=i=>{if(m.debug("directiveSanitizer called with",i),typeof i=="object"&&(i.length?i.forEach(e=>W(e)):Object.keys(i).forEach(e=>{m.debug("Checking key",e),e.startsWith("__")&&(m.debug("sanitize deleting __ option",e),delete i[e]),e.includes("proto")&&(m.debug("sanitize deleting proto option",e),delete i[e]),e.includes("constr")&&(m.debug("sanitize deleting constr option",e),delete i[e]),e.includes("themeCSS")&&(m.debug("sanitizing themeCss option"),i[e]=G(i[e])),e.includes("fontFamily")&&(m.debug("sanitizing fontFamily option"),i[e]=G(i[e])),e.includes("altFontFamily")&&(m.debug("sanitizing altFontFamily option"),i[e]=G(i[e])),Ae.includes(e)?typeof i[e]=="object"&&(m.debug("sanitize deleting object",e),W(i[e])):(m.debug("sanitize deleting option",e),delete i[e])})),i.themeVariables){const e=Object.keys(i.themeVariables);for(const n of e){const t=i.themeVariables[n];t&&t.match&&!t.match(/^[\d "#%(),.;A-Za-z]+$/)&&(i.themeVariables[n]="")}}m.debug("After sanitization",i)},G=i=>{let e=0,n=0;for(const t of i){if(e{if(!t)return;const r=i.node().getBBox();i.append("text").text(t).attr("x",r.x+r.width/2).attr("y",-n).attr("class",e)},Ei=i=>{if(typeof i=="number")return[i,i+"px"];const e=parseInt(i,10);return Number.isNaN(e)?[void 0,void 0]:i===String(e)?[e,i+"px"]:[e,i]},fs={assignWithDepth:Hi,wrapLabel:Ro,calculateTextHeight:Bo,calculateTextWidth:ti,calculateTextDimensions:ki,detectInit:So,detectDirective:Se,isSubstringInArray:To,interpolateToCurve:Ao,calcLabelPosition:Oo,calcCardinalityPosition:Mo,calcTerminalLabelPosition:Io,formatUrl:ko,getStylesFromArray:$o,generateId:Po,random:Lo,runFunc:Eo,entityDecode:Wo,initIdGenerator:Yo,directiveSanitizer:W,sanitizeCss:G,insertTitle:Uo,parseFontSize:Ei};export{se as A,it as B,U as C,$ as D,Ye as E,we as F,fo as G,Lo as H,es as I,yi as J,Xo as K,R as L,at as M,Qo as N,Oi as O,Ni as P,is as Q,Zo as R,J as S,Ko as T,yo as U,Vo as V,ts as W,ns as X,Jo as Y,Ei as Z,Po as _,Ci as a,bn as b,An as c,W as d,go as e,cn as f,le as g,bo as h,hs as i,mo as j,rs as k,ls as l,as as m,os as n,us as o,lo as p,ti as q,ss as r,qi as s,Mn as t,fs as u,Bo as v,Ro as w,Be as x,$o as y,Ao as z};