@data_wise/hyper-markdown 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -167443,6 +167443,10 @@ const $tr = {
|
|
|
167443
167443
|
theme: {
|
|
167444
167444
|
type: Object,
|
|
167445
167445
|
default: () => ({})
|
|
167446
|
+
},
|
|
167447
|
+
showFullscreenButton: {
|
|
167448
|
+
type: Boolean,
|
|
167449
|
+
default: !1
|
|
167446
167450
|
}
|
|
167447
167451
|
},
|
|
167448
167452
|
emits: ["update:content", "errors"],
|
|
@@ -167778,7 +167782,7 @@ function Ytr(t, e, r, n, i, a) {
|
|
|
167778
167782
|
"data-theme-mode": a.isDarkMode ? "dark" : "light",
|
|
167779
167783
|
style: Eoe(a.themeVars)
|
|
167780
167784
|
}, [
|
|
167781
|
-
i.isDashboardMode ? (Du(), qh("div", {
|
|
167785
|
+
i.isDashboardMode && r.showFullscreenButton ? (Du(), qh("div", {
|
|
167782
167786
|
key: 0,
|
|
167783
167787
|
class: "fullscreen-toggle",
|
|
167784
167788
|
onClick: e[0] || (e[0] = (...l) => a.toggleFullscreen && a.toggleFullscreen(...l)),
|
|
@@ -167841,7 +167845,7 @@ function Ytr(t, e, r, n, i, a) {
|
|
|
167841
167845
|
}, null, 8, ["visible", "content", "component-type", "onSave", "onClose"])
|
|
167842
167846
|
], 14, Gtr);
|
|
167843
167847
|
}
|
|
167844
|
-
const iRr = /* @__PURE__ */ Vne($tr, [["render", Ytr], ["__scopeId", "data-v-
|
|
167848
|
+
const iRr = /* @__PURE__ */ Vne($tr, [["render", Ytr], ["__scopeId", "data-v-93810f56"]]);
|
|
167845
167849
|
var Wtr = "[object Symbol]";
|
|
167846
167850
|
function Dv(t) {
|
|
167847
167851
|
return typeof t == "symbol" || fu(t) && kp(t) == Wtr;
|
|
@@ -908,10 +908,10 @@ Actual: `+Y.attribValue);else{var K=Y.tag,j=Y.tags[Y.tags.length-1]||Y;K.ns===j.
|
|
|
908
908
|
display: none !important;
|
|
909
909
|
}`,vJt=function(t){yJt(t,"."+oJ+AJt+J6e+`
|
|
910
910
|
.`+lJ+mJt+J6e)},yJt=function(t,e){var r=t.ownerDocument;if(r){var n=r.createElement("style");n.textContent=e,t.appendChild(n)}},eFe=function(){function t(){}return t.getOrigin=function(e){var r=t._link;return r?(r.href=e,r.href=r.href,r.protocol+r.hostname+r.port):"about:blank"},t.isSameOrigin=function(e){return t.getOrigin(e)===t._origin},t.setContext=function(e){t._link=e.document.createElement("a"),t._origin=t.getOrigin(e.location.href)},t._origin="about:blank",t}(),_Jt=function(){function t(e,r){this.context=e,this._options=r,this._cache={}}return t.prototype.addImage=function(e){var r=Promise.resolve();return this.has(e)||(uJ(e)||wJt(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),r},t.prototype.match=function(e){return this._cache[e]},t.prototype.loadImage=function(e){return ll(this,void 0,void 0,function(){var r,n,i,a,s=this;return To(this,function(o){switch(o.label){case 0:return r=eFe.isSameOrigin(e),n=!cJ(e)&&this._options.useCORS===!0&&qs.SUPPORT_CORS_IMAGES&&!r,i=!cJ(e)&&!r&&!uJ(e)&&typeof this._options.proxy=="string"&&qs.SUPPORT_CORS_XHR&&!n,!r&&this._options.allowTaint===!1&&!cJ(e)&&!uJ(e)&&!i&&!n?[2]:(a=e,i?[4,this.proxy(a)]:[3,2]);case 1:a=o.sent(),o.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(l,u){var h=new Image;h.onload=function(){return l(h)},h.onerror=u,(xJt(a)||n)&&(h.crossOrigin="anonymous"),h.src=a,h.complete===!0&&setTimeout(function(){return l(h)},500),s._options.imageTimeout>0&&setTimeout(function(){return u("Timed out ("+s._options.imageTimeout+"ms) loading image")},s._options.imageTimeout)})];case 3:return[2,o.sent()]}})})},t.prototype.has=function(e){return typeof this._cache[e]<"u"},t.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},t.prototype.proxy=function(e){var r=this,n=this._options.proxy;if(!n)throw new Error("No proxy defined");var i=e.substring(0,256);return new Promise(function(a,s){var o=qs.SUPPORT_RESPONSE_TYPE?"blob":"text",l=new XMLHttpRequest;l.onload=function(){if(l.status===200)if(o==="text")a(l.response);else{var d=new FileReader;d.addEventListener("load",function(){return a(d.result)},!1),d.addEventListener("error",function(f){return s(f)},!1),d.readAsDataURL(l.response)}else s("Failed to proxy resource "+i+" with status code "+l.status)},l.onerror=s;var u=n.indexOf("?")>-1?"&":"?";if(l.open("GET",""+n+u+"url="+encodeURIComponent(e)+"&responseType="+o),o!=="text"&&l instanceof XMLHttpRequest&&(l.responseType=o),r._options.imageTimeout){var h=r._options.imageTimeout;l.timeout=h,l.ontimeout=function(){return s("Timed out ("+h+"ms) proxying "+i)}}l.send()})},t}(),bJt=/^data:image\/svg\+xml/i,SJt=/^data:image\/.*;base64,/i,EJt=/^data:image\/.*/i,wJt=function(t){return qs.SUPPORT_SVG_DRAWING||!TJt(t)},cJ=function(t){return EJt.test(t)},xJt=function(t){return SJt.test(t)},uJ=function(t){return t.substr(0,4)==="blob"},TJt=function(t){return t.substr(-3).toLowerCase()==="svg"||bJt.test(t)},Jt=function(){function t(e,r){this.type=0,this.x=e,this.y=r}return t.prototype.add=function(e,r){return new t(this.x+e,this.y+r)},t}(),gb=function(t,e,r){return new Jt(t.x+(e.x-t.x)*r,t.y+(e.y-t.y)*r)},R5=function(){function t(e,r,n,i){this.type=1,this.start=e,this.startControl=r,this.endControl=n,this.end=i}return t.prototype.subdivide=function(e,r){var n=gb(this.start,this.startControl,e),i=gb(this.startControl,this.endControl,e),a=gb(this.endControl,this.end,e),s=gb(n,i,e),o=gb(i,a,e),l=gb(s,o,e);return r?new t(this.start,n,s,l):new t(l,o,a,this.end)},t.prototype.add=function(e,r){return new t(this.start.add(e,r),this.startControl.add(e,r),this.endControl.add(e,r),this.end.add(e,r))},t.prototype.reverse=function(){return new t(this.end,this.endControl,this.startControl,this.start)},t}(),lu=function(t){return t.type===1},OJt=function(){function t(e){var r=e.styles,n=e.bounds,i=o2(r.borderTopLeftRadius,n.width,n.height),a=i[0],s=i[1],o=o2(r.borderTopRightRadius,n.width,n.height),l=o[0],u=o[1],h=o2(r.borderBottomRightRadius,n.width,n.height),d=h[0],f=h[1],p=o2(r.borderBottomLeftRadius,n.width,n.height),g=p[0],A=p[1],m=[];m.push((a+l)/n.width),m.push((g+d)/n.width),m.push((s+A)/n.height),m.push((u+f)/n.height);var v=Math.max.apply(Math,m);v>1&&(a/=v,s/=v,l/=v,u/=v,d/=v,f/=v,g/=v,A/=v);var y=n.width-l,_=n.height-f,b=n.width-d,S=n.height-A,E=r.borderTopWidth,w=r.borderRightWidth,O=r.borderBottomWidth,x=r.borderLeftWidth,R=Ei(r.paddingTop,e.bounds.width),C=Ei(r.paddingRight,e.bounds.width),I=Ei(r.paddingBottom,e.bounds.width),N=Ei(r.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=a>0||s>0?Ui(n.left+x/3,n.top+E/3,a-x/3,s-E/3,Wn.TOP_LEFT):new Jt(n.left+x/3,n.top+E/3),this.topRightBorderDoubleOuterBox=a>0||s>0?Ui(n.left+y,n.top+E/3,l-w/3,u-E/3,Wn.TOP_RIGHT):new Jt(n.left+n.width-w/3,n.top+E/3),this.bottomRightBorderDoubleOuterBox=d>0||f>0?Ui(n.left+b,n.top+_,d-w/3,f-O/3,Wn.BOTTOM_RIGHT):new Jt(n.left+n.width-w/3,n.top+n.height-O/3),this.bottomLeftBorderDoubleOuterBox=g>0||A>0?Ui(n.left+x/3,n.top+S,g-x/3,A-O/3,Wn.BOTTOM_LEFT):new Jt(n.left+x/3,n.top+n.height-O/3),this.topLeftBorderDoubleInnerBox=a>0||s>0?Ui(n.left+x*2/3,n.top+E*2/3,a-x*2/3,s-E*2/3,Wn.TOP_LEFT):new Jt(n.left+x*2/3,n.top+E*2/3),this.topRightBorderDoubleInnerBox=a>0||s>0?Ui(n.left+y,n.top+E*2/3,l-w*2/3,u-E*2/3,Wn.TOP_RIGHT):new Jt(n.left+n.width-w*2/3,n.top+E*2/3),this.bottomRightBorderDoubleInnerBox=d>0||f>0?Ui(n.left+b,n.top+_,d-w*2/3,f-O*2/3,Wn.BOTTOM_RIGHT):new Jt(n.left+n.width-w*2/3,n.top+n.height-O*2/3),this.bottomLeftBorderDoubleInnerBox=g>0||A>0?Ui(n.left+x*2/3,n.top+S,g-x*2/3,A-O*2/3,Wn.BOTTOM_LEFT):new Jt(n.left+x*2/3,n.top+n.height-O*2/3),this.topLeftBorderStroke=a>0||s>0?Ui(n.left+x/2,n.top+E/2,a-x/2,s-E/2,Wn.TOP_LEFT):new Jt(n.left+x/2,n.top+E/2),this.topRightBorderStroke=a>0||s>0?Ui(n.left+y,n.top+E/2,l-w/2,u-E/2,Wn.TOP_RIGHT):new Jt(n.left+n.width-w/2,n.top+E/2),this.bottomRightBorderStroke=d>0||f>0?Ui(n.left+b,n.top+_,d-w/2,f-O/2,Wn.BOTTOM_RIGHT):new Jt(n.left+n.width-w/2,n.top+n.height-O/2),this.bottomLeftBorderStroke=g>0||A>0?Ui(n.left+x/2,n.top+S,g-x/2,A-O/2,Wn.BOTTOM_LEFT):new Jt(n.left+x/2,n.top+n.height-O/2),this.topLeftBorderBox=a>0||s>0?Ui(n.left,n.top,a,s,Wn.TOP_LEFT):new Jt(n.left,n.top),this.topRightBorderBox=l>0||u>0?Ui(n.left+y,n.top,l,u,Wn.TOP_RIGHT):new Jt(n.left+n.width,n.top),this.bottomRightBorderBox=d>0||f>0?Ui(n.left+b,n.top+_,d,f,Wn.BOTTOM_RIGHT):new Jt(n.left+n.width,n.top+n.height),this.bottomLeftBorderBox=g>0||A>0?Ui(n.left,n.top+S,g,A,Wn.BOTTOM_LEFT):new Jt(n.left,n.top+n.height),this.topLeftPaddingBox=a>0||s>0?Ui(n.left+x,n.top+E,Math.max(0,a-x),Math.max(0,s-E),Wn.TOP_LEFT):new Jt(n.left+x,n.top+E),this.topRightPaddingBox=l>0||u>0?Ui(n.left+Math.min(y,n.width-w),n.top+E,y>n.width+w?0:Math.max(0,l-w),Math.max(0,u-E),Wn.TOP_RIGHT):new Jt(n.left+n.width-w,n.top+E),this.bottomRightPaddingBox=d>0||f>0?Ui(n.left+Math.min(b,n.width-x),n.top+Math.min(_,n.height-O),Math.max(0,d-w),Math.max(0,f-O),Wn.BOTTOM_RIGHT):new Jt(n.left+n.width-w,n.top+n.height-O),this.bottomLeftPaddingBox=g>0||A>0?Ui(n.left+x,n.top+Math.min(S,n.height-O),Math.max(0,g-x),Math.max(0,A-O),Wn.BOTTOM_LEFT):new Jt(n.left+x,n.top+n.height-O),this.topLeftContentBox=a>0||s>0?Ui(n.left+x+N,n.top+E+R,Math.max(0,a-(x+N)),Math.max(0,s-(E+R)),Wn.TOP_LEFT):new Jt(n.left+x+N,n.top+E+R),this.topRightContentBox=l>0||u>0?Ui(n.left+Math.min(y,n.width+x+N),n.top+E+R,y>n.width+x+N?0:l-x+N,u-(E+R),Wn.TOP_RIGHT):new Jt(n.left+n.width-(w+C),n.top+E+R),this.bottomRightContentBox=d>0||f>0?Ui(n.left+Math.min(b,n.width-(x+N)),n.top+Math.min(_,n.height+E+R),Math.max(0,d-(w+C)),f-(O+I),Wn.BOTTOM_RIGHT):new Jt(n.left+n.width-(w+C),n.top+n.height-(O+I)),this.bottomLeftContentBox=g>0||A>0?Ui(n.left+x+N,n.top+S,Math.max(0,g-(x+N)),A-(O+I),Wn.BOTTOM_LEFT):new Jt(n.left+x+N,n.top+n.height-(O+I))}return t}(),Wn;(function(t){t[t.TOP_LEFT=0]="TOP_LEFT",t[t.TOP_RIGHT=1]="TOP_RIGHT",t[t.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",t[t.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(Wn||(Wn={}));var Ui=function(t,e,r,n,i){var a=4*((Math.sqrt(2)-1)/3),s=r*a,o=n*a,l=t+r,u=e+n;switch(i){case Wn.TOP_LEFT:return new R5(new Jt(t,u),new Jt(t,u-o),new Jt(l-s,e),new Jt(l,e));case Wn.TOP_RIGHT:return new R5(new Jt(t,e),new Jt(t+s,e),new Jt(l,u-o),new Jt(l,u));case Wn.BOTTOM_RIGHT:return new R5(new Jt(l,e),new Jt(l,e+o),new Jt(t+s,u),new Jt(t,u));case Wn.BOTTOM_LEFT:default:return new R5(new Jt(l,u),new Jt(l-s,u),new Jt(t,e+o),new Jt(t,e))}},k5=function(t){return[t.topLeftBorderBox,t.topRightBorderBox,t.bottomRightBorderBox,t.bottomLeftBorderBox]},CJt=function(t){return[t.topLeftContentBox,t.topRightContentBox,t.bottomRightContentBox,t.bottomLeftContentBox]},I5=function(t){return[t.topLeftPaddingBox,t.topRightPaddingBox,t.bottomRightPaddingBox,t.bottomLeftPaddingBox]},RJt=function(){function t(e,r,n){this.offsetX=e,this.offsetY=r,this.matrix=n,this.type=0,this.target=6}return t}(),N5=function(){function t(e,r){this.path=e,this.target=r,this.type=1}return t}(),kJt=function(){function t(e){this.opacity=e,this.type=2,this.target=6}return t}(),IJt=function(t){return t.type===0},tFe=function(t){return t.type===1},NJt=function(t){return t.type===2},rFe=function(t,e){return t.length===e.length?t.some(function(r,n){return r===e[n]}):!1},DJt=function(t,e,r,n,i){return t.map(function(a,s){switch(s){case 0:return a.add(e,r);case 1:return a.add(e+n,r);case 2:return a.add(e+n,r+i);case 3:return a.add(e,r+i)}return a})},nFe=function(){function t(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return t}(),iFe=function(){function t(e,r){if(this.container=e,this.parent=r,this.effects=[],this.curves=new OJt(this.container),this.container.styles.opacity<1&&this.effects.push(new kJt(this.container.styles.opacity)),this.container.styles.transform!==null){var n=this.container.bounds.left+this.container.styles.transformOrigin[0].number,i=this.container.bounds.top+this.container.styles.transformOrigin[1].number,a=this.container.styles.transform;this.effects.push(new RJt(n,i,a))}if(this.container.styles.overflowX!==0){var s=k5(this.curves),o=I5(this.curves);rFe(s,o)?this.effects.push(new N5(s,6)):(this.effects.push(new N5(s,2)),this.effects.push(new N5(o,4)))}}return t.prototype.getEffects=function(e){for(var r=[2,3].indexOf(this.container.styles.position)===-1,n=this.parent,i=this.effects.slice(0);n;){var a=n.effects.filter(function(l){return!tFe(l)});if(r||n.container.styles.position!==0||!n.parent){if(i.unshift.apply(i,a),r=[2,3].indexOf(n.container.styles.position)===-1,n.container.styles.overflowX!==0){var s=k5(n.curves),o=I5(n.curves);rFe(s,o)||i.unshift(new N5(o,6))}}else i.unshift.apply(i,a);n=n.parent}return i.filter(function(l){return ns(l.target,e)})},t}(),hJ=function(t,e,r,n){t.container.elements.forEach(function(i){var a=ns(i.flags,4),s=ns(i.flags,2),o=new iFe(i,t);ns(i.styles.display,2048)&&n.push(o);var l=ns(i.flags,8)?[]:n;if(a||s){var u=a||i.styles.isPositioned()?r:e,h=new nFe(o);if(i.styles.isPositioned()||i.styles.opacity<1||i.styles.isTransformed()){var d=i.styles.zIndex.order;if(d<0){var f=0;u.negativeZIndex.some(function(g,A){return d>g.element.container.styles.zIndex.order?(f=A,!1):f>0}),u.negativeZIndex.splice(f,0,h)}else if(d>0){var p=0;u.positiveZIndex.some(function(g,A){return d>=g.element.container.styles.zIndex.order?(p=A+1,!1):p>0}),u.positiveZIndex.splice(p,0,h)}else u.zeroOrAutoZIndexOrTransformedOrOpacity.push(h)}else i.styles.isFloating()?u.nonPositionedFloats.push(h):u.nonPositionedInlineLevel.push(h);hJ(o,h,a?h:r,l)}else i.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),hJ(o,e,r,l);ns(i.flags,8)&&aFe(i,l)})},aFe=function(t,e){for(var r=t instanceof eJ?t.start:1,n=t instanceof eJ?t.reversed:!1,i=0;i<e.length;i++){var a=e[i];a.container instanceof k6e&&typeof a.container.value=="number"&&a.container.value!==0&&(r=a.container.value),a.listValue=f2(r,a.container.styles.listStyleType,!0),r+=n?-1:1}},LJt=function(t){var e=new iFe(t,null),r=new nFe(e),n=[];return hJ(e,r,r,n),aFe(e.container,n),r},sFe=function(t,e){switch(e){case 0:return cu(t.topLeftBorderBox,t.topLeftPaddingBox,t.topRightBorderBox,t.topRightPaddingBox);case 1:return cu(t.topRightBorderBox,t.topRightPaddingBox,t.bottomRightBorderBox,t.bottomRightPaddingBox);case 2:return cu(t.bottomRightBorderBox,t.bottomRightPaddingBox,t.bottomLeftBorderBox,t.bottomLeftPaddingBox);case 3:default:return cu(t.bottomLeftBorderBox,t.bottomLeftPaddingBox,t.topLeftBorderBox,t.topLeftPaddingBox)}},MJt=function(t,e){switch(e){case 0:return cu(t.topLeftBorderBox,t.topLeftBorderDoubleOuterBox,t.topRightBorderBox,t.topRightBorderDoubleOuterBox);case 1:return cu(t.topRightBorderBox,t.topRightBorderDoubleOuterBox,t.bottomRightBorderBox,t.bottomRightBorderDoubleOuterBox);case 2:return cu(t.bottomRightBorderBox,t.bottomRightBorderDoubleOuterBox,t.bottomLeftBorderBox,t.bottomLeftBorderDoubleOuterBox);case 3:default:return cu(t.bottomLeftBorderBox,t.bottomLeftBorderDoubleOuterBox,t.topLeftBorderBox,t.topLeftBorderDoubleOuterBox)}},BJt=function(t,e){switch(e){case 0:return cu(t.topLeftBorderDoubleInnerBox,t.topLeftPaddingBox,t.topRightBorderDoubleInnerBox,t.topRightPaddingBox);case 1:return cu(t.topRightBorderDoubleInnerBox,t.topRightPaddingBox,t.bottomRightBorderDoubleInnerBox,t.bottomRightPaddingBox);case 2:return cu(t.bottomRightBorderDoubleInnerBox,t.bottomRightPaddingBox,t.bottomLeftBorderDoubleInnerBox,t.bottomLeftPaddingBox);case 3:default:return cu(t.bottomLeftBorderDoubleInnerBox,t.bottomLeftPaddingBox,t.topLeftBorderDoubleInnerBox,t.topLeftPaddingBox)}},PJt=function(t,e){switch(e){case 0:return D5(t.topLeftBorderStroke,t.topRightBorderStroke);case 1:return D5(t.topRightBorderStroke,t.bottomRightBorderStroke);case 2:return D5(t.bottomRightBorderStroke,t.bottomLeftBorderStroke);case 3:default:return D5(t.bottomLeftBorderStroke,t.topLeftBorderStroke)}},D5=function(t,e){var r=[];return lu(t)?r.push(t.subdivide(.5,!1)):r.push(t),lu(e)?r.push(e.subdivide(.5,!0)):r.push(e),r},cu=function(t,e,r,n){var i=[];return lu(t)?i.push(t.subdivide(.5,!1)):i.push(t),lu(r)?i.push(r.subdivide(.5,!0)):i.push(r),lu(n)?i.push(n.subdivide(.5,!0).reverse()):i.push(n),lu(e)?i.push(e.subdivide(.5,!1).reverse()):i.push(e),i},oFe=function(t){var e=t.bounds,r=t.styles;return e.add(r.borderLeftWidth,r.borderTopWidth,-(r.borderRightWidth+r.borderLeftWidth),-(r.borderTopWidth+r.borderBottomWidth))},L5=function(t){var e=t.styles,r=t.bounds,n=Ei(e.paddingLeft,r.width),i=Ei(e.paddingRight,r.width),a=Ei(e.paddingTop,r.width),s=Ei(e.paddingBottom,r.width);return r.add(n+e.borderLeftWidth,a+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+n+i),-(e.borderTopWidth+e.borderBottomWidth+a+s))},FJt=function(t,e){return t===0?e.bounds:t===2?L5(e):oFe(e)},UJt=function(t,e){return t===0?e.bounds:t===2?L5(e):oFe(e)},dJ=function(t,e,r){var n=FJt(mb(t.styles.backgroundOrigin,e),t),i=UJt(mb(t.styles.backgroundClip,e),t),a=QJt(mb(t.styles.backgroundSize,e),r,n),s=a[0],o=a[1],l=o2(mb(t.styles.backgroundPosition,e),n.width-s,n.height-o),u=$Jt(mb(t.styles.backgroundRepeat,e),l,a,n,i),h=Math.round(n.left+l[0]),d=Math.round(n.top+l[1]);return[u,h,d,s,o]},Ab=function(t){return di(t)&&t.value===hb.AUTO},M5=function(t){return typeof t=="number"},QJt=function(t,e,r){var n=e[0],i=e[1],a=e[2],s=t[0],o=t[1];if(!s)return[0,0];if(Fa(s)&&o&&Fa(o))return[Ei(s,r.width),Ei(o,r.height)];var l=M5(a);if(di(s)&&(s.value===hb.CONTAIN||s.value===hb.COVER)){if(M5(a)){var u=r.width/r.height;return u<a!=(s.value===hb.COVER)?[r.width,r.width/a]:[r.height*a,r.height]}return[r.width,r.height]}var h=M5(n),d=M5(i),f=h||d;if(Ab(s)&&(!o||Ab(o))){if(h&&d)return[n,i];if(!l&&!f)return[r.width,r.height];if(f&&l){var p=h?n:i*a,g=d?i:n/a;return[p,g]}var A=h?n:r.width,m=d?i:r.height;return[A,m]}if(l){var v=0,y=0;return Fa(s)?v=Ei(s,r.width):Fa(o)&&(y=Ei(o,r.height)),Ab(s)?v=y*a:(!o||Ab(o))&&(y=v/a),[v,y]}var _=null,b=null;if(Fa(s)?_=Ei(s,r.width):o&&Fa(o)&&(b=Ei(o,r.height)),_!==null&&(!o||Ab(o))&&(b=h&&d?_/n*i:r.height),b!==null&&Ab(s)&&(_=h&&d?b/i*n:r.width),_!==null&&b!==null)return[_,b];throw new Error("Unable to calculate background-size for element")},mb=function(t,e){var r=t[e];return typeof r>"u"?t[0]:r},$Jt=function(t,e,r,n,i){var a=e[0],s=e[1],o=r[0],l=r[1];switch(t){case 2:return[new Jt(Math.round(n.left),Math.round(n.top+s)),new Jt(Math.round(n.left+n.width),Math.round(n.top+s)),new Jt(Math.round(n.left+n.width),Math.round(l+n.top+s)),new Jt(Math.round(n.left),Math.round(l+n.top+s))];case 3:return[new Jt(Math.round(n.left+a),Math.round(n.top)),new Jt(Math.round(n.left+a+o),Math.round(n.top)),new Jt(Math.round(n.left+a+o),Math.round(n.height+n.top)),new Jt(Math.round(n.left+a),Math.round(n.height+n.top))];case 1:return[new Jt(Math.round(n.left+a),Math.round(n.top+s)),new Jt(Math.round(n.left+a+o),Math.round(n.top+s)),new Jt(Math.round(n.left+a+o),Math.round(n.top+s+l)),new Jt(Math.round(n.left+a),Math.round(n.top+s+l))];default:return[new Jt(Math.round(i.left),Math.round(i.top)),new Jt(Math.round(i.left+i.width),Math.round(i.top)),new Jt(Math.round(i.left+i.width),Math.round(i.height+i.top)),new Jt(Math.round(i.left),Math.round(i.height+i.top))]}},GJt="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",lFe="Hidden Text",zJt=function(){function t(e){this._data={},this._document=e}return t.prototype.parseMetrics=function(e,r){var n=this._document.createElement("div"),i=this._document.createElement("img"),a=this._document.createElement("span"),s=this._document.body;n.style.visibility="hidden",n.style.fontFamily=e,n.style.fontSize=r,n.style.margin="0",n.style.padding="0",n.style.whiteSpace="nowrap",s.appendChild(n),i.src=GJt,i.width=1,i.height=1,i.style.margin="0",i.style.padding="0",i.style.verticalAlign="baseline",a.style.fontFamily=e,a.style.fontSize=r,a.style.margin="0",a.style.padding="0",a.appendChild(this._document.createTextNode(lFe)),n.appendChild(a),n.appendChild(i);var o=i.offsetTop-a.offsetTop+2;n.removeChild(a),n.appendChild(this._document.createTextNode(lFe)),n.style.lineHeight="normal",i.style.verticalAlign="super";var l=i.offsetTop-n.offsetTop+2;return s.removeChild(n),{baseline:o,middle:l}},t.prototype.getMetrics=function(e,r){var n=e+" "+r;return typeof this._data[n]>"u"&&(this._data[n]=this.parseMetrics(e,r)),this._data[n]},t}(),cFe=function(){function t(e,r){this.context=e,this.options=r}return t}(),VJt=1e4,HJt=function(t){th(e,t);function e(r,n){var i=t.call(this,r,n)||this;return i._activeEffects=[],i.canvas=n.canvas?n.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),n.canvas||(i.canvas.width=Math.floor(n.width*n.scale),i.canvas.height=Math.floor(n.height*n.scale),i.canvas.style.width=n.width+"px",i.canvas.style.height=n.height+"px"),i.fontMetrics=new zJt(document),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-n.x,-n.y),i.ctx.textBaseline="bottom",i._activeEffects=[],i.context.logger.debug("Canvas renderer initialized ("+n.width+"x"+n.height+") with scale "+n.scale),i}return e.prototype.applyEffects=function(r){for(var n=this;this._activeEffects.length;)this.popEffect();r.forEach(function(i){return n.applyEffect(i)})},e.prototype.applyEffect=function(r){this.ctx.save(),NJt(r)&&(this.ctx.globalAlpha=r.opacity),IJt(r)&&(this.ctx.translate(r.offsetX,r.offsetY),this.ctx.transform(r.matrix[0],r.matrix[1],r.matrix[2],r.matrix[3],r.matrix[4],r.matrix[5]),this.ctx.translate(-r.offsetX,-r.offsetY)),tFe(r)&&(this.path(r.path),this.ctx.clip()),this._activeEffects.push(r)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(r){return ll(this,void 0,void 0,function(){var n;return To(this,function(i){switch(i.label){case 0:return n=r.element.container.styles,n.isVisible()?[4,this.renderStackContent(r)]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(r){return ll(this,void 0,void 0,function(){return To(this,function(n){switch(n.label){case 0:if(ns(r.container.flags,16))debugger;return r.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(r)]:[3,3];case 1:return n.sent(),[4,this.renderNodeContent(r)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(r,n,i){var a=this;if(n===0)this.ctx.fillText(r.text,r.bounds.left,r.bounds.top+i);else{var s=Jj(r.text);s.reduce(function(o,l){return a.ctx.fillText(l,o,r.bounds.top+i),o+a.ctx.measureText(l).width},r.bounds.left)}},e.prototype.createFontStyle=function(r){var n=r.fontVariant.filter(function(s){return s==="normal"||s==="small-caps"}).join(""),i=KJt(r.fontFamily).join(", "),a=s2(r.fontSize)?""+r.fontSize.number+r.fontSize.unit:r.fontSize.number+"px";return[[r.fontStyle,n,r.fontWeight,a,i].join(" "),i,a]},e.prototype.renderTextNode=function(r,n){return ll(this,void 0,void 0,function(){var i,a,s,o,l,u,h,d,f=this;return To(this,function(p){return i=this.createFontStyle(n),a=i[0],s=i[1],o=i[2],this.ctx.font=a,this.ctx.direction=n.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",l=this.fontMetrics.getMetrics(s,o),u=l.baseline,h=l.middle,d=n.paintOrder,r.textBounds.forEach(function(g){d.forEach(function(A){switch(A){case 0:f.ctx.fillStyle=Ts(n.color),f.renderTextWithLetterSpacing(g,n.letterSpacing,u);var m=n.textShadow;m.length&&g.text.trim().length&&(m.slice(0).reverse().forEach(function(v){f.ctx.shadowColor=Ts(v.color),f.ctx.shadowOffsetX=v.offsetX.number*f.options.scale,f.ctx.shadowOffsetY=v.offsetY.number*f.options.scale,f.ctx.shadowBlur=v.blur.number,f.renderTextWithLetterSpacing(g,n.letterSpacing,u)}),f.ctx.shadowColor="",f.ctx.shadowOffsetX=0,f.ctx.shadowOffsetY=0,f.ctx.shadowBlur=0),n.textDecorationLine.length&&(f.ctx.fillStyle=Ts(n.textDecorationColor||n.color),n.textDecorationLine.forEach(function(v){switch(v){case 1:f.ctx.fillRect(g.bounds.left,Math.round(g.bounds.top+u),g.bounds.width,1);break;case 2:f.ctx.fillRect(g.bounds.left,Math.round(g.bounds.top),g.bounds.width,1);break;case 3:f.ctx.fillRect(g.bounds.left,Math.ceil(g.bounds.top+h),g.bounds.width,1);break}}));break;case 1:n.webkitTextStrokeWidth&&g.text.trim().length&&(f.ctx.strokeStyle=Ts(n.webkitTextStrokeColor),f.ctx.lineWidth=n.webkitTextStrokeWidth,f.ctx.lineJoin=window.chrome?"miter":"round",f.ctx.strokeText(g.text,g.bounds.left,g.bounds.top+u)),f.ctx.strokeStyle="",f.ctx.lineWidth=0,f.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(r,n,i){if(i&&r.intrinsicWidth>0&&r.intrinsicHeight>0){var a=L5(r),s=I5(n);this.path(s),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(i,0,0,r.intrinsicWidth,r.intrinsicHeight,a.left,a.top,a.width,a.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(r){return ll(this,void 0,void 0,function(){var n,i,a,s,o,l,y,y,u,h,d,f,b,p,g,S,A,m,v,y,_,b,S;return To(this,function(E){switch(E.label){case 0:this.applyEffects(r.getEffects(4)),n=r.container,i=r.curves,a=n.styles,s=0,o=n.textNodes,E.label=1;case 1:return s<o.length?(l=o[s],[4,this.renderTextNode(l,a)]):[3,4];case 2:E.sent(),E.label=3;case 3:return s++,[3,1];case 4:if(!(n instanceof O6e))return[3,8];E.label=5;case 5:return E.trys.push([5,7,,8]),[4,this.context.cache.match(n.src)];case 6:return y=E.sent(),this.renderReplacedElement(n,i,y),[3,8];case 7:return E.sent(),this.context.logger.error("Error loading image "+n.src),[3,8];case 8:if(n instanceof C6e&&this.renderReplacedElement(n,i,n.canvas),!(n instanceof R6e))return[3,12];E.label=9;case 9:return E.trys.push([9,11,,12]),[4,this.context.cache.match(n.svg)];case 10:return y=E.sent(),this.renderReplacedElement(n,i,y),[3,12];case 11:return E.sent(),this.context.logger.error("Error loading svg "+n.svg.substring(0,255)),[3,12];case 12:return n instanceof L6e&&n.tree?(u=new e(this.context,{scale:this.options.scale,backgroundColor:n.backgroundColor,x:0,y:0,width:n.width,height:n.height}),[4,u.render(n.tree)]):[3,14];case 13:h=E.sent(),n.width&&n.height&&this.ctx.drawImage(h,0,0,n.width,n.height,n.bounds.left,n.bounds.top,n.bounds.width,n.bounds.height),E.label=14;case 14:if(n instanceof tJ&&(d=Math.min(n.bounds.width,n.bounds.height),n.type===E5?n.checked&&(this.ctx.save(),this.path([new Jt(n.bounds.left+d*.39363,n.bounds.top+d*.79),new Jt(n.bounds.left+d*.16,n.bounds.top+d*.5549),new Jt(n.bounds.left+d*.27347,n.bounds.top+d*.44071),new Jt(n.bounds.left+d*.39694,n.bounds.top+d*.5649),new Jt(n.bounds.left+d*.72983,n.bounds.top+d*.23),new Jt(n.bounds.left+d*.84,n.bounds.top+d*.34085),new Jt(n.bounds.left+d*.39363,n.bounds.top+d*.79)]),this.ctx.fillStyle=Ts(I6e),this.ctx.fill(),this.ctx.restore()):n.type===w5&&n.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(n.bounds.left+d/2,n.bounds.top+d/2,d/4,0,Math.PI*2,!0),this.ctx.fillStyle=Ts(I6e),this.ctx.fill(),this.ctx.restore())),qJt(n)&&n.value.length){switch(f=this.createFontStyle(a),b=f[0],p=f[1],g=this.fontMetrics.getMetrics(b,p).baseline,this.ctx.font=b,this.ctx.fillStyle=Ts(a.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=WJt(n.styles.textAlign),S=L5(n),A=0,n.styles.textAlign){case 1:A+=S.width/2;break;case 2:A+=S.width;break}m=S.add(A,0,0,-S.height/2+1),this.ctx.save(),this.path([new Jt(S.left,S.top),new Jt(S.left+S.width,S.top),new Jt(S.left+S.width,S.top+S.height),new Jt(S.left,S.top+S.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new h2(n.value,m),a.letterSpacing,g),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!ns(n.styles.display,2048))return[3,20];if(n.styles.listStyleImage===null)return[3,19];if(v=n.styles.listStyleImage,v.type!==0)return[3,18];y=void 0,_=v.url,E.label=15;case 15:return E.trys.push([15,17,,18]),[4,this.context.cache.match(_)];case 16:return y=E.sent(),this.ctx.drawImage(y,n.bounds.left-(y.width+10),n.bounds.top),[3,18];case 17:return E.sent(),this.context.logger.error("Error loading list-style-image "+_),[3,18];case 18:return[3,20];case 19:r.listValue&&n.styles.listStyleType!==-1&&(b=this.createFontStyle(a)[0],this.ctx.font=b,this.ctx.fillStyle=Ts(a.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",S=new lp(n.bounds.left,n.bounds.top+Ei(n.styles.paddingTop,n.bounds.width),n.bounds.width,l6e(a.lineHeight,a.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new h2(r.listValue,S),a.letterSpacing,l6e(a.lineHeight,a.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),E.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(r){return ll(this,void 0,void 0,function(){var n,i,v,a,s,v,o,l,v,u,h,v,d,f,v,p,g,v,A,m,v;return To(this,function(y){switch(y.label){case 0:if(ns(r.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(r.element)];case 1:y.sent(),n=0,i=r.negativeZIndex,y.label=2;case 2:return n<i.length?(v=i[n],[4,this.renderStack(v)]):[3,5];case 3:y.sent(),y.label=4;case 4:return n++,[3,2];case 5:return[4,this.renderNodeContent(r.element)];case 6:y.sent(),a=0,s=r.nonInlineLevel,y.label=7;case 7:return a<s.length?(v=s[a],[4,this.renderNode(v)]):[3,10];case 8:y.sent(),y.label=9;case 9:return a++,[3,7];case 10:o=0,l=r.nonPositionedFloats,y.label=11;case 11:return o<l.length?(v=l[o],[4,this.renderStack(v)]):[3,14];case 12:y.sent(),y.label=13;case 13:return o++,[3,11];case 14:u=0,h=r.nonPositionedInlineLevel,y.label=15;case 15:return u<h.length?(v=h[u],[4,this.renderStack(v)]):[3,18];case 16:y.sent(),y.label=17;case 17:return u++,[3,15];case 18:d=0,f=r.inlineLevel,y.label=19;case 19:return d<f.length?(v=f[d],[4,this.renderNode(v)]):[3,22];case 20:y.sent(),y.label=21;case 21:return d++,[3,19];case 22:p=0,g=r.zeroOrAutoZIndexOrTransformedOrOpacity,y.label=23;case 23:return p<g.length?(v=g[p],[4,this.renderStack(v)]):[3,26];case 24:y.sent(),y.label=25;case 25:return p++,[3,23];case 26:A=0,m=r.positiveZIndex,y.label=27;case 27:return A<m.length?(v=m[A],[4,this.renderStack(v)]):[3,30];case 28:y.sent(),y.label=29;case 29:return A++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(r){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(r.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(r){this.ctx.beginPath(),this.formatPath(r),this.ctx.closePath()},e.prototype.formatPath=function(r){var n=this;r.forEach(function(i,a){var s=lu(i)?i.start:i;a===0?n.ctx.moveTo(s.x,s.y):n.ctx.lineTo(s.x,s.y),lu(i)&&n.ctx.bezierCurveTo(i.startControl.x,i.startControl.y,i.endControl.x,i.endControl.y,i.end.x,i.end.y)})},e.prototype.renderRepeat=function(r,n,i,a){this.path(r),this.ctx.fillStyle=n,this.ctx.translate(i,a),this.ctx.fill(),this.ctx.translate(-i,-a)},e.prototype.resizeImage=function(r,n,i){var a;if(r.width===n&&r.height===i)return r;var s=(a=this.canvas.ownerDocument)!==null&&a!==void 0?a:document,o=s.createElement("canvas");o.width=Math.max(1,n),o.height=Math.max(1,i);var l=o.getContext("2d");return l.drawImage(r,0,0,r.width,r.height,0,0,n,i),o},e.prototype.renderBackgroundImage=function(r){return ll(this,void 0,void 0,function(){var n,i,a,s,o,l;return To(this,function(u){switch(u.label){case 0:n=r.styles.backgroundImage.length-1,i=function(h){var d,f,p,R,M,B,N,T,O,g,R,M,B,N,T,A,m,v,y,_,b,S,E,w,O,x,R,C,I,N,T,D,M,B,F,$,z,G,V,ee,se,ie;return To(this,function(le){switch(le.label){case 0:if(h.type!==0)return[3,5];d=void 0,f=h.url,le.label=1;case 1:return le.trys.push([1,3,,4]),[4,a.context.cache.match(f)];case 2:return d=le.sent(),[3,4];case 3:return le.sent(),a.context.logger.error("Error loading background-image "+f),[3,4];case 4:return d&&(p=dJ(r,n,[d.width,d.height,d.width/d.height]),R=p[0],M=p[1],B=p[2],N=p[3],T=p[4],O=a.ctx.createPattern(a.resizeImage(d,N,T),"repeat"),a.renderRepeat(R,O,M,B)),[3,6];case 5:IKt(h)?(g=dJ(r,n,[null,null,null]),R=g[0],M=g[1],B=g[2],N=g[3],T=g[4],A=TKt(h.angle,N,T),m=A[0],v=A[1],y=A[2],_=A[3],b=A[4],S=document.createElement("canvas"),S.width=N,S.height=T,E=S.getContext("2d"),w=E.createLinearGradient(v,_,y,b),ZPe(h.stops,m).forEach(function(Y){return w.addColorStop(Y.stop,Ts(Y.color))}),E.fillStyle=w,E.fillRect(0,0,N,T),N>0&&T>0&&(O=a.ctx.createPattern(S,"repeat"),a.renderRepeat(R,O,M,B))):NKt(h)&&(x=dJ(r,n,[null,null,null]),R=x[0],C=x[1],I=x[2],N=x[3],T=x[4],D=h.position.length===0?[Fj]:h.position,M=Ei(D[0],N),B=Ei(D[D.length-1],T),F=OKt(h,M,B,N,T),$=F[0],z=F[1],$>0&&z>0&&(G=a.ctx.createRadialGradient(C+M,I+B,0,C+M,I+B,$),ZPe(h.stops,$*2).forEach(function(Y){return G.addColorStop(Y.stop,Ts(Y.color))}),a.path(R),a.ctx.fillStyle=G,$!==z?(V=r.bounds.left+.5*r.bounds.width,ee=r.bounds.top+.5*r.bounds.height,se=z/$,ie=1/se,a.ctx.save(),a.ctx.translate(V,ee),a.ctx.transform(1,0,0,se,0,0),a.ctx.translate(-V,-ee),a.ctx.fillRect(C,ie*(I-ee)+ee,N,T*ie),a.ctx.restore()):a.ctx.fill())),le.label=6;case 6:return n--,[2]}})},a=this,s=0,o=r.styles.backgroundImage.slice(0).reverse(),u.label=1;case 1:return s<o.length?(l=o[s],[5,i(l)]):[3,4];case 2:u.sent(),u.label=3;case 3:return s++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(r,n,i){return ll(this,void 0,void 0,function(){return To(this,function(a){return this.path(sFe(i,n)),this.ctx.fillStyle=Ts(r),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(r,n,i,a){return ll(this,void 0,void 0,function(){var s,o;return To(this,function(l){switch(l.label){case 0:return n<3?[4,this.renderSolidBorder(r,i,a)]:[3,2];case 1:return l.sent(),[2];case 2:return s=MJt(a,i),this.path(s),this.ctx.fillStyle=Ts(r),this.ctx.fill(),o=BJt(a,i),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(r){return ll(this,void 0,void 0,function(){var n,i,a,s,o,l,u,h,d=this;return To(this,function(f){switch(f.label){case 0:return this.applyEffects(r.getEffects(2)),n=r.container.styles,i=!u0(n.backgroundColor)||n.backgroundImage.length,a=[{style:n.borderTopStyle,color:n.borderTopColor,width:n.borderTopWidth},{style:n.borderRightStyle,color:n.borderRightColor,width:n.borderRightWidth},{style:n.borderBottomStyle,color:n.borderBottomColor,width:n.borderBottomWidth},{style:n.borderLeftStyle,color:n.borderLeftColor,width:n.borderLeftWidth}],s=YJt(mb(n.backgroundClip,0),r.curves),i||n.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),u0(n.backgroundColor)||(this.ctx.fillStyle=Ts(n.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(r.container)]):[3,2];case 1:f.sent(),this.ctx.restore(),n.boxShadow.slice(0).reverse().forEach(function(p){d.ctx.save();var g=k5(r.curves),A=p.inset?0:VJt,m=DJt(g,-A+(p.inset?1:-1)*p.spread.number,(p.inset?1:-1)*p.spread.number,p.spread.number*(p.inset?-2:2),p.spread.number*(p.inset?-2:2));p.inset?(d.path(g),d.ctx.clip(),d.mask(m)):(d.mask(g),d.ctx.clip(),d.path(m)),d.ctx.shadowOffsetX=p.offsetX.number+A,d.ctx.shadowOffsetY=p.offsetY.number,d.ctx.shadowColor=Ts(p.color),d.ctx.shadowBlur=p.blur.number,d.ctx.fillStyle=p.inset?Ts(p.color):"rgba(0,0,0,1)",d.ctx.fill(),d.ctx.restore()}),f.label=2;case 2:o=0,l=0,u=a,f.label=3;case 3:return l<u.length?(h=u[l],h.style!==0&&!u0(h.color)&&h.width>0?h.style!==2?[3,5]:[4,this.renderDashedDottedBorder(h.color,h.width,o,r.curves,2)]:[3,11]):[3,13];case 4:return f.sent(),[3,11];case 5:return h.style!==3?[3,7]:[4,this.renderDashedDottedBorder(h.color,h.width,o,r.curves,3)];case 6:return f.sent(),[3,11];case 7:return h.style!==4?[3,9]:[4,this.renderDoubleBorder(h.color,h.width,o,r.curves)];case 8:return f.sent(),[3,11];case 9:return[4,this.renderSolidBorder(h.color,o,r.curves)];case 10:f.sent(),f.label=11;case 11:o++,f.label=12;case 12:return l++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(r,n,i,a,s){return ll(this,void 0,void 0,function(){var o,l,u,h,d,f,p,g,A,m,v,y,_,b,S,E,S,E;return To(this,function(w){return this.ctx.save(),o=PJt(a,i),l=sFe(a,i),s===2&&(this.path(l),this.ctx.clip()),lu(l[0])?(u=l[0].start.x,h=l[0].start.y):(u=l[0].x,h=l[0].y),lu(l[1])?(d=l[1].end.x,f=l[1].end.y):(d=l[1].x,f=l[1].y),i===0||i===2?p=Math.abs(u-d):p=Math.abs(h-f),this.ctx.beginPath(),s===3?this.formatPath(o):this.formatPath(l.slice(0,2)),g=n<3?n*3:n*2,A=n<3?n*2:n,s===3&&(g=n,A=n),m=!0,p<=g*2?m=!1:p<=g*2+A?(v=p/(2*g+A),g*=v,A*=v):(y=Math.floor((p+A)/(g+A)),_=(p-y*g)/(y-1),b=(p-(y+1)*g)/y,A=b<=0||Math.abs(A-_)<Math.abs(A-b)?_:b),m&&(s===3?this.ctx.setLineDash([0,g+A]):this.ctx.setLineDash([g,A])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=n):this.ctx.lineWidth=n*2+1.1,this.ctx.strokeStyle=Ts(r),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(lu(l[0])&&(S=l[3],E=l[0],this.ctx.beginPath(),this.formatPath([new Jt(S.end.x,S.end.y),new Jt(E.start.x,E.start.y)]),this.ctx.stroke()),lu(l[1])&&(S=l[1],E=l[2],this.ctx.beginPath(),this.formatPath([new Jt(S.end.x,S.end.y),new Jt(E.start.x,E.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(r){return ll(this,void 0,void 0,function(){var n;return To(this,function(i){switch(i.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Ts(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),n=LJt(r),[4,this.renderStack(n)];case 1:return i.sent(),this.applyEffects([]),[2,this.canvas]}})})},e}(cFe),qJt=function(t){return t instanceof D6e||t instanceof N6e?!0:t instanceof tJ&&t.type!==w5&&t.type!==E5},YJt=function(t,e){switch(t){case 0:return k5(e);case 2:return CJt(e);case 1:default:return I5(e)}},WJt=function(t){switch(t){case 1:return"center";case 2:return"right";case 0:default:return"left"}},XJt=["-apple-system","system-ui"],KJt=function(t){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?t.filter(function(e){return XJt.indexOf(e)===-1}):t},ZJt=function(t){th(e,t);function e(r,n){var i=t.call(this,r,n)||this;return i.canvas=n.canvas?n.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),i.options=n,i.canvas.width=Math.floor(n.width*n.scale),i.canvas.height=Math.floor(n.height*n.scale),i.canvas.style.width=n.width+"px",i.canvas.style.height=n.height+"px",i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-n.x,-n.y),i.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+n.width+"x"+n.height+" at "+n.x+","+n.y+") with scale "+n.scale),i}return e.prototype.render=function(r){return ll(this,void 0,void 0,function(){var n,i;return To(this,function(a){switch(a.label){case 0:return n=jj(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,r),[4,jJt(n)];case 1:return i=a.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Ts(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(i,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e}(cFe),jJt=function(t){return new Promise(function(e,r){var n=new Image;n.onload=function(){e(n)},n.onerror=r,n.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(t))})},JJt=function(){function t(e){var r=e.id,n=e.enabled;this.id=r,this.enabled=n,this.start=Date.now()}return t.prototype.debug=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,zL([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},t.prototype.getTime=function(){return Date.now()-this.start},t.prototype.info=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,zL([this.id,this.getTime()+"ms"],e))},t.prototype.warn=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,zL([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},t.prototype.error=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,zL([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},t.instances={},t}(),eer=function(){function t(e,r){var n;this.windowBounds=r,this.instanceName="#"+t.instanceCount++,this.logger=new JJt({id:this.instanceName,enabled:e.logging}),this.cache=(n=e.cache)!==null&&n!==void 0?n:new _Jt(this,e)}return t.instanceCount=1,t}(),fJ=function(t,e){return e===void 0&&(e={}),ter(t,e)};typeof window<"u"&&eFe.setContext(window);var ter=function(t,e){return ll(void 0,void 0,void 0,function(){var r,n,i,a,s,o,l,u,h,d,f,p,g,A,m,v,y,_,b,S,w,E,w,O,x,R,C,I,N,T,D,M,B,F,$,z,G,V,ee,se;return To(this,function(ie){switch(ie.label){case 0:if(!t||typeof t!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(r=t.ownerDocument,!r)throw new Error("Element is not attached to a Document");if(n=r.defaultView,!n)throw new Error("Document is not attached to a Window");return i={allowTaint:(O=e.allowTaint)!==null&&O!==void 0?O:!1,imageTimeout:(x=e.imageTimeout)!==null&&x!==void 0?x:15e3,proxy:e.proxy,useCORS:(R=e.useCORS)!==null&&R!==void 0?R:!1},a=mj({logging:(C=e.logging)!==null&&C!==void 0?C:!0,cache:e.cache},i),s={windowWidth:(I=e.windowWidth)!==null&&I!==void 0?I:n.innerWidth,windowHeight:(N=e.windowHeight)!==null&&N!==void 0?N:n.innerHeight,scrollX:(T=e.scrollX)!==null&&T!==void 0?T:n.pageXOffset,scrollY:(D=e.scrollY)!==null&&D!==void 0?D:n.pageYOffset},o=new lp(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),l=new eer(a,o),u=(M=e.foreignObjectRendering)!==null&&M!==void 0?M:!1,h={allowTaint:(B=e.allowTaint)!==null&&B!==void 0?B:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:u,copyStyles:u},l.logger.debug("Starting document clone with size "+o.width+"x"+o.height+" scrolled to "+-o.left+","+-o.top),d=new j6e(l,t,h),f=d.clonedReferenceElement,f?[4,d.toIFrame(r,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return p=ie.sent(),g=nJ(f)||nJt(f)?DWt(f.ownerDocument):VL(l,f),A=g.width,m=g.height,v=g.left,y=g.top,_=rer(l,f,e.backgroundColor),b={canvas:e.canvas,backgroundColor:_,scale:($=(F=e.scale)!==null&&F!==void 0?F:n.devicePixelRatio)!==null&&$!==void 0?$:1,x:((z=e.x)!==null&&z!==void 0?z:0)+v,y:((G=e.y)!==null&&G!==void 0?G:0)+y,width:(V=e.width)!==null&&V!==void 0?V:Math.ceil(A),height:(ee=e.height)!==null&&ee!==void 0?ee:Math.ceil(m)},u?(l.logger.debug("Document cloned, using foreign object rendering"),w=new ZJt(l,b),[4,w.render(f)]):[3,3];case 2:return S=ie.sent(),[3,5];case 3:return l.logger.debug("Document cloned, element located at "+v+","+y+" with size "+A+"x"+m+" using computed rendering"),l.logger.debug("Starting DOM parsing"),E=B6e(l,f),_===E.styles.backgroundColor&&(E.styles.backgroundColor=up.TRANSPARENT),l.logger.debug("Starting renderer for element at "+b.x+","+b.y+" with size "+b.width+"x"+b.height),w=new HJt(l,b),[4,w.render(E)];case 4:S=ie.sent(),ie.label=5;case 5:return(!((se=e.removeContainer)!==null&&se!==void 0)||se)&&(j6e.destroy(p)||l.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),l.logger.debug("Finished rendering"),[2,S]}})})},rer=function(t,e,r){var n=e.ownerDocument,i=n.documentElement?l2(t,getComputedStyle(n.documentElement).backgroundColor):up.TRANSPARENT,a=n.body?l2(t,getComputedStyle(n.body).backgroundColor):up.TRANSPARENT,s=typeof r=="string"?l2(t,r):r===null?up.TRANSPARENT:4294967295;return e===n.documentElement?u0(i)?u0(a)?s:a:i:s};class ner{constructor(){this.imageCache=new Map,this.defaultChartHeight=189,this.defaultChartWidth=567}canvasToBlob(e){return new Promise((r,n)=>{e.toBlob(i=>{i?(i.type!=="image/png"&&console.warn("Blob type 不是 image/png:",i.type),r(i)):n(new Error("Canvas to Blob 转换失败"))},"image/png",1)})}async captureEChartsAsImage(e){try{const r=await fJ(e,{backgroundColor:"#ffffff",scale:2,logging:!1,useCORS:!0}),n=r.width,i=r.height,a=await this.canvasToBlob(r),s=await this.blobToArrayBuffer(a);return{data:new Uint8Array(s),width:n,height:i}}catch(r){return console.error("捕获 ECharts 图表失败:",r),null}}async captureMermaidAsImage(e){try{const r=e.querySelector("svg");if(!r)return console.warn("未找到 Mermaid SVG 元素"),null;const n=r.getBoundingClientRect(),i=n.width,a=n.height,s=e.querySelector(".mermaid-controls");let o=null;s&&(o=s.style.display,s.style.display="none");try{const l=await fJ(e,{backgroundColor:"#ffffff",scale:2,logging:!1,useCORS:!0,allowTaint:!0,foreignObjectRendering:!1}),u=await this.canvasToBlob(l),h=await this.blobToArrayBuffer(u);return{data:new Uint8Array(h),width:l.width,height:l.height,displayWidth:i,displayHeight:a}}finally{s&&o!==null&&(s.style.display=o)}}catch(r){return console.error("捕获 Mermaid 图表失败:",r),null}}async captureMathAsImage(e){try{const r=e.getBoundingClientRect(),n=r.width,i=r.height,a=await fJ(e,{backgroundColor:"#ffffff",scale:3,logging:!1,useCORS:!0,allowTaint:!0}),s=await this.canvasToBlob(a),o=await this.blobToArrayBuffer(s);return{data:new Uint8Array(o),width:a.width,height:a.height,displayWidth:n,displayHeight:i}}catch(r){return console.error("捕获数学公式失败:",r),null}}async base64ToBlob(e){try{return await(await fetch(e)).blob()}catch(r){throw console.error("base64 转 Blob 失败:",r),r}}async blobToArrayBuffer(e){return new Promise((r,n)=>{const i=new FileReader;i.onload=()=>r(i.result),i.onerror=n,i.readAsArrayBuffer(e)})}base64ToUint8Array(e){try{const r=e.split(",")[1];if(!r)throw new Error("无效的 base64 数据");const n=atob(r),i=new Uint8Array(n.length);for(let a=0;a<n.length;a++)i[a]=n.charCodeAt(a);return i}catch(r){throw console.error("base64 转换失败:",r),r}}validateImageData(e){return e.length<8?!1:e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71}parseMarkdown(e,r){return e.parse(r,{})}getDefaultTextStyle(){return{font:"宋体",size:20}}getDefaultSpacing(){return{before:120,after:0,line:288,lineRule:"auto"}}async convertTokensToDocx(e,r){const n=[];let i=0,a={},s=null,o=0,l=0,u=!1,h=[],d=0,f=[];for(let p=0;p<e.length;p++){const g=e[p];if(!(g.type==="fence"&&g.info.startsWith("dataset"))){if(g.type==="container_info_open"){s="info";continue}if(g.type==="container_warning_open"){s="warning";continue}if(g.type==="container_danger_open"){s="danger";continue}if(g.type==="container_success_open"){s="success";continue}if(g.type==="container_cell_open"){const A=g.info.match(/cell\s+(\d+)/);d=A?parseInt(A[1]):12,u=!0,h=[];continue}if(g.type==="container_cell_close"){if(f.push({width:d,contents:h}),f.reduce((m,v)=>m+v.width,0)>=12){const m=this.createGridTable(f);m&&n.push(m),f=[]}u=!1,h=[],d=0;continue}if(g.type==="container_info_close"||g.type==="container_warning_close"||g.type==="container_danger_close"||g.type==="container_success_close"){s=null,u||n.push(new wa({text:"",spacing:{before:100,after:100}}));continue}if(g.type==="fence"&&g.info==="echarts"){const A=r.querySelectorAll('.echarts-container[data-processed="true"]');if(A[o]){try{const m=await this.captureEChartsAsImage(A[o]);if(m&&m.data)if(this.validateImageData(m.data)){let v,y;u?(v=Math.round(d/12*567*.9),y=300):(v=567,y=378);const _=m.width/m.height;let b=v,S=Math.round(b/_);S>y&&(S=y,b=Math.round(S*_));const E=new wa({children:[new DBe({data:m.data,transformation:{width:b,height:S},type:"png",ext:"png",extension:"png"})],spacing:{before:200,after:200}});u?h.push(E):n.push(E)}else{console.warn("ECharts 图片数据无效");const v=new wa({text:"[ECharts 图表]",spacing:{before:200,after:200}});u?h.push(v):n.push(v)}}catch(m){console.error("ECharts 图表转换失败:",m);const v=new wa({text:"[ECharts 图表]",spacing:{before:200,after:200}});u?h.push(v):n.push(v)}o++}continue}if(g.type==="fence"&&g.info==="mermaid"){const A=r.querySelectorAll('.mermaid[data-processed="true"]');if(A[l]){try{await new Promise(v=>setTimeout(v,100));const m=await this.captureMermaidAsImage(A[l]);if(m&&m.data)if(this.validateImageData(m.data)){let v,y;if(u){const b=Math.round(d/12*567*.9),S=300,E=m.displayWidth/m.displayHeight;y=b,v=Math.round(y/E),v>S&&(v=S,y=Math.round(v*E))}else{v=this.defaultChartHeight;const b=m.displayWidth/m.displayHeight;y=Math.round(v*b)}const _=new wa({children:[new DBe({data:m.data,transformation:{width:y,height:v},type:"png",ext:"png",extension:"png"})],spacing:{before:200,after:200}});u?h.push(_):n.push(_)}else{console.warn("Mermaid 图片数据无效");const v=new wa({text:"[Mermaid 流程图]",spacing:{before:200,after:200}});u?h.push(v):n.push(v)}else{const v=new wa({text:"[Mermaid 流程图]",spacing:{before:200,after:200}});u?h.push(v):n.push(v)}}catch(m){console.error("Mermaid 图表转换失败:",m);const v=new wa({text:"[Mermaid 流程图]",spacing:{before:200,after:200}});u?h.push(v):n.push(v)}l++}continue}if(g.type==="heading_open"){parseInt(g.tag.substring(1));const A=e[p+1];if(A&&A.type==="inline"){const m=this.getDefaultTextStyle(),v=this.getDefaultSpacing(),y=new wa({children:[new xo({text:A.content,font:m.font,size:m.size,bold:!0})],spacing:v});u?h.push(y):n.push(y)}p+=2;continue}if(g.type==="paragraph_open"){const A=e[p+1];if(A&&A.type==="inline"){const m=this.parseInlineContent(A);if(m.length>0){const v=this.getDefaultSpacing(),y={children:m,spacing:v};if(s){const b=this.getContainerStyle(s);y.shading={fill:b.background},y.border={left:{color:b.borderColor,space:1,style:ol.SINGLE,size:24}}}const _=new wa(y);u?h.push(_):n.push(_)}}p+=2;continue}if(g.type==="bullet_list_open"||g.type==="ordered_list_open"){const A=g.type==="ordered_list_open";i++,A&&(a[i]=1);continue}if(g.type==="bullet_list_close"||g.type==="ordered_list_close"){g.type==="ordered_list_close"&&delete a[i],i--;continue}if(g.type==="list_item_open"){const A=e[p+1];if(A&&A.type==="paragraph_open"){const m=e[p+2];if(m&&m.type==="inline"){const v=this.parseInlineContent(m),y=a[i]!==void 0,_=this.getDefaultTextStyle(),b=this.getDefaultSpacing(),S=y?`${a[i]}. `:"• ",E=new wa({children:[new xo({text:S,bold:!0,font:_.font,size:_.size}),...v],spacing:b,indent:{left:720*i}});u?h.push(E):n.push(E),y&&a[i]++}p+=3}continue}if(g.type==="math_block"||g.type==="math_block_end"){const A=this.getDefaultTextStyle(),m=this.getDefaultSpacing(),v=new wa({children:[new xo({text:g.content,font:"Cambria Math",size:A.size,italics:!0})],spacing:m,alignment:Ju.CENTER});u?h.push(v):n.push(v);continue}if(g.type==="fence"&&g.info!=="echarts"&&g.info!=="mermaid"&&!g.info.startsWith("dataset")){const A=g.content.split(`
|
|
911
|
-
`).filter(y=>y.trim()),m=this.getDefaultTextStyle(),v=this.getDefaultSpacing();A.forEach(y=>{const _=new wa({children:[new xo({text:y,font:"Consolas",size:m.size})],spacing:v,shading:{fill:"F5F5F5"}});u?h.push(_):n.push(_)});continue}if(g.type==="table_open"){const A=this.parseTable(e,p);if(A){const m=this.createTable(A);u?h.push(m):n.push(m),p=A.endIndex}continue}if(g.type==="hr"){const A=new wa({text:"",border:{bottom:{color:"CCCCCC",space:1,style:ol.SINGLE,size:6}},spacing:{before:200,after:200}});u?h.push(A):n.push(A);continue}}}if(f.length>0){const p=this.createGridTable(f);p&&n.push(p)}return n}parseInlineContent(e){const r=this.getDefaultTextStyle(),n=[];if(!e.children||e.children.length===0)return[new xo({text:e.content||"",font:r.font,size:r.size})];e.children.forEach(s=>{s.type==="text"?n.push(new xo({text:s.content,font:r.font,size:r.size})):s.type==="strong_open"||s.type==="strong_close"||s.type==="em_open"||s.type==="em_close"||(s.type==="code_inline"?n.push(new xo({text:s.content,font:"Consolas",size:r.size,shading:{fill:"F5F5F5"}})):s.type==="math_inline"||s.type==="katex_inline"?n.push(new xo({text:s.content,font:"Cambria Math",size:r.size,italics:!0})):s.type==="link_open"||s.type)});const i=[];let a=0;for(;a<e.children.length;){const s=e.children[a];if(s.type==="strong_open"&&a+2<e.children.length){const o=e.children[a+1];i.push(new xo({text:o.content,bold:!0,font:r.font,size:r.size})),a+=3}else if(s.type==="em_open"&&a+2<e.children.length){const o=e.children[a+1];i.push(new xo({text:o.content,italics:!0,font:r.font,size:r.size})),a+=3}else s.type==="text"?(i.push(new xo({text:s.content,font:r.font,size:r.size})),a++):s.type==="code_inline"?(i.push(new xo({text:s.content,font:"Consolas",size:r.size,shading:{fill:"F5F5F5"}})),a++):((s.type==="math_inline"||s.type==="katex_inline")&&i.push(new xo({text:s.content,font:"Cambria Math",size:r.size,italics:!0})),a++)}return i.length>0?i:n}parseTable(e,r){const n=[];let i=r+1,a=!0;for(;i<e.length&&e[i].type!=="table_close";){if(e[i].type==="thead_open"||e[i].type==="tbody_open"){i++;continue}if(e[i].type==="thead_close"){a=!1,i++;continue}if(e[i].type==="tbody_close"){i++;continue}if(e[i].type==="tr_open"){const s=[];for(i++;i<e.length&&e[i].type!=="tr_close";)e[i].type==="th_open"||e[i].type==="td_open"?(i++,e[i]&&e[i].type==="inline"&&s.push({text:e[i].content,isHeader:a}),i+=2):i++;s.length>0&&n.push(s),i++}else i++}return n.length>0?{rows:n,endIndex:i}:null}createGridTable(e){if(!e||e.length===0)return null;const r=e.map(n=>new FL({children:n.contents.length>0?n.contents:[new wa({text:""})],width:{size:n.width/12*100,type:nb.PERCENTAGE},borders:{top:{style:ol.NONE,size:0,color:"FFFFFF"},bottom:{style:ol.NONE,size:0,color:"FFFFFF"},left:{style:ol.NONE,size:0,color:"FFFFFF"},right:{style:ol.NONE,size:0,color:"FFFFFF"}},margins:{top:100,bottom:100,left:100,right:100}}));return new YBe({rows:[new WBe({children:r})],width:{size:100,type:nb.PERCENTAGE},borders:{top:{style:ol.NONE,size:0,color:"FFFFFF"},bottom:{style:ol.NONE,size:0,color:"FFFFFF"},left:{style:ol.NONE,size:0,color:"FFFFFF"},right:{style:ol.NONE,size:0,color:"FFFFFF"},insideHorizontal:{style:ol.NONE,size:0,color:"FFFFFF"},insideVertical:{style:ol.NONE,size:0,color:"FFFFFF"}}})}createTable(e){const r=this.getDefaultTextStyle(),n=e.rows.map(i=>new WBe({children:i.map(a=>new FL({children:[new wa({children:[new xo({text:a.text,bold:a.isHeader,font:r.font,size:r.size})],spacing:{before:0,after:0,line:288,lineRule:"auto"}})],shading:a.isHeader?{fill:"F0F0F0"}:void 0}))}));return new YBe({rows:n,width:{size:100,type:nb.PERCENTAGE}})}getContainerStyle(e){const r={info:{background:"E3F2FD",borderColor:"2196F3"},warning:{background:"FFF3E0",borderColor:"FF9800"},danger:{background:"FFEBEE",borderColor:"F44336"},success:{background:"E8F5E9",borderColor:"4CAF50"}};return r[e]||r.info}getHeadingLevel(e){return{1:xv.HEADING_1,2:xv.HEADING_2,3:xv.HEADING_3,4:xv.HEADING_4,5:xv.HEADING_5,6:xv.HEADING_6}[e]||xv.HEADING_1}async exportToWord(e,r,n,i="document.docx"){try{const a=this.parseMarkdown(e,r),s=await this.convertTokensToDocx(a,n),o=new AWt({sections:[{properties:{},children:s}]}),l=await IWt.toBlob(o);return NWt.saveAs(l,i),{success:!0,message:"导出成功"}}catch(a){return console.error("导出 Word 文档失败:",a),{success:!1,message:a.message}}}}const ier={name:"MarkdownEditor",components:{EditModal:IGt,DatasetPanel:PGt},props:{content:{type:String,default:""},editable:{type:Boolean,default:!1},defaultShowEditor:{type:Boolean,default:!0},datasource:{type:Object,required:!1,validator:t=>["getDataSource","getDataSourceList","clearDataSourceCache","testDataSourceConnection"].every(r=>typeof t[r]=="function")},dark:{type:[Boolean,String],default:"auto",validator:t=>t==="auto"||typeof t=="boolean"},theme:{type:Object,default:()=>({})}},emits:["update:content","errors"],data(){return{showEditor:this.defaultShowEditor,md:null,chartRenderer:null,datasetRenderer:null,mermaidRenderer:null,renderTimeout:null,editModalVisible:!1,currentEditContent:"",currentComponentType:"",currentComponentId:"",currentTokenStart:0,currentTokenEnd:0,isResizing:!1,editorWidth:500,minEditorWidth:300,maxEditorWidth:800,renderErrors:[],_isMounted:!1,_isRendering:!1,isDashboardMode:!1,isFullscreen:!1}},watch:{content:{handler(t){console.log("watch content triggered:",{length:t==null?void 0:t.length,hasComment:/<!--\s*dashboard\s*-->/.test(t)}),this.detectDashboardMode(t),this._isMounted&&!this._isRendering&&(this.renderTimeout&&clearTimeout(this.renderTimeout),this.renderTimeout=setTimeout(()=>{this.$nextTick(()=>{this.renderWithQueue()})},150))},immediate:!0},showEditor:{handler(){this.$nextTick(()=>{var t;return(t=this.chartRenderer)==null?void 0:t.processEChartsElements()})}},localContent:{handler(t,e){t!==e&&this._isMounted&&this.$emit("update:content",t),this._isMounted&&!this._isRendering&&(this.renderTimeout&&clearTimeout(this.renderTimeout),this.renderTimeout=setTimeout(()=>{this.$nextTick(()=>{this.renderWithQueue()})},150))}},isDarkMode:{handler(){if(this._isMounted){this.updateMermaidTheme();const t=this.isDarkMode?"dark":"light";this.chartRenderer.setTheme(t),this.$nextTick(()=>{this.clearProcessedMarks(),this.renderWithQueue()})}}}},created(){this.md=rIe(this.editable),this.chartRenderer=new qEt,this.datasetRenderer=new Hnt,this.mermaidRenderer=new zBt,this.wordExporter=new ner,this.datasetRenderer.setDataSourceFunctions(this.datasource),this.chartRenderer.setDataset(this.datasetRenderer.getDataset()),this.updateMermaidTheme(),this.detectDashboardMode(this.content)},computed:{contentModel:{get(){return this.content},set(t){this.$emit("update:content",t)}},renderedContent(){return this.md?this.md.render(this.content):""},isDarkMode(){return this.dark==="auto"?typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)").matches:!1:this.dark===!0},themeVars(){const t=this.isDarkMode?"dark":"light",e=FGt[t],r=this.theme[t]||{};return{...e,...r}}},mounted(){var e;this._isMounted=!0,this.content&&this.localContent!==this.content&&(this.localContent=this.content,console.log("MarkdownEditor mounted: 强制设置 localContent,长度:",((e=this.localContent)==null?void 0:e.length)||0)),this.dark==="auto"&&typeof window<"u"&&window.matchMedia&&(this._themeMediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this._handleThemeChange=()=>{this.$forceUpdate()},this._themeMediaQuery.addEventListener("change",this._handleThemeChange));const t=this.$el.querySelector(".preview-container");t&&(this._handleEditClick=r=>{const n=r.target.closest('[data-editable="true"]');if(!n)return;r.stopPropagation(),r.preventDefault();const i=n.getBoundingClientRect(),a={left:i.right-20,top:i.top,right:i.right,bottom:i.top+20};if(!(r.clientX>=a.left&&r.clientX<=a.right&&r.clientY>=a.top&&r.clientY<=a.bottom))return;const o=n.getAttribute("data-component-id"),l=n.getAttribute("data-component-type"),u=n.getAttribute("data-position");if(o&&l&&u){const[h,d]=u.split(",").map(Number),f=this.content.substring(h,d);this.currentComponentId=o,this.currentComponentType=l,this.currentEditContent=f,this.currentTokenStart=h,this.currentTokenEnd=d,this.editModalVisible=!0}},t.addEventListener("click",this._handleEditClick)),this.$nextTick(()=>{const r=this.isDarkMode?"dark":"light",n=this.isDarkMode?"dark":"default";this.chartRenderer.setTheme(r),this.mermaidRenderer.initialize(n),this.renderWithQueue(),this.chartRenderer.observeDOM(".preview-container"),this.datasetRenderer.observeDOM(".preview-container"),this.mermaidRenderer.observeDOM(".preview-container")})},beforeUnmount(){var e,r,n,i;this._isMounted=!1,this.renderTimeout&&(clearTimeout(this.renderTimeout),this.renderTimeout=null),this._themeMediaQuery&&this._handleThemeChange&&(this._themeMediaQuery.removeEventListener("change",this._handleThemeChange),this._themeMediaQuery=null,this._handleThemeChange=null);const t=(e=this.$el)==null?void 0:e.querySelector(".preview-container");t&&this._handleEditClick&&(t.removeEventListener("click",this._handleEditClick),this._handleEditClick=null),(r=this.chartRenderer)==null||r.cleanup(),(n=this.datasetRenderer)==null||n.cleanup(),(i=this.mermaidRenderer)==null||i.cleanup()},methods:{detectDashboardMode(t){const e=/<!--\s*dashboard\s*-->/.test(t);console.log("detectDashboardMode:",{content:t==null?void 0:t.substring(0,50),isDashboard:e,currentMode:this.isDashboardMode}),e!==this.isDashboardMode&&(this.isDashboardMode=e,console.log("Dashboard mode changed to:",e))},clearProcessedMarks(){const t=this.$el.querySelector(".preview-container");if(!t)return;t.querySelectorAll('.mermaid[data-processed="true"]').forEach(i=>{i.removeAttribute("data-processed"),i.dataset.originalCode&&(i.textContent=i.dataset.originalCode)}),t.querySelectorAll('.echarts-container[data-processed="true"]').forEach(i=>{i.removeAttribute("data-processed")}),t.querySelectorAll('.dataset-container[data-processed="true"]').forEach(i=>{i.removeAttribute("data-processed")})},updateMermaidTheme(){const t=this.isDarkMode?"dark":"default";this.mermaidRenderer&&this.mermaidRenderer.setTheme(t)},handleResizerMouseDown(t){this.$emit("update:content",this.content)},async renderWithQueue(){if(!this._isRendering){this._isRendering=!0;try{this.chartRenderer.clearErrors(),this.datasetRenderer.clearErrors(),this.mermaidRenderer.clearErrors(),tD.clearErrors(),await this.datasetRenderer.renderDatasets(),await this.$nextTick(),this.chartRenderer.processEChartsElements(),this.mermaidRenderer.renderMermaidCharts(),setTimeout(()=>{this.collectRenderErrors()},300)}catch(t){console.warn("渲染过程中发生错误:",t),setTimeout(()=>{this.collectRenderErrors()},300)}finally{this._isRendering=!1}}},getErrors(){return[...this.renderErrors]},collectRenderErrors(){const t=[],e=this.content.split(`
|
|
911
|
+
`).filter(y=>y.trim()),m=this.getDefaultTextStyle(),v=this.getDefaultSpacing();A.forEach(y=>{const _=new wa({children:[new xo({text:y,font:"Consolas",size:m.size})],spacing:v,shading:{fill:"F5F5F5"}});u?h.push(_):n.push(_)});continue}if(g.type==="table_open"){const A=this.parseTable(e,p);if(A){const m=this.createTable(A);u?h.push(m):n.push(m),p=A.endIndex}continue}if(g.type==="hr"){const A=new wa({text:"",border:{bottom:{color:"CCCCCC",space:1,style:ol.SINGLE,size:6}},spacing:{before:200,after:200}});u?h.push(A):n.push(A);continue}}}if(f.length>0){const p=this.createGridTable(f);p&&n.push(p)}return n}parseInlineContent(e){const r=this.getDefaultTextStyle(),n=[];if(!e.children||e.children.length===0)return[new xo({text:e.content||"",font:r.font,size:r.size})];e.children.forEach(s=>{s.type==="text"?n.push(new xo({text:s.content,font:r.font,size:r.size})):s.type==="strong_open"||s.type==="strong_close"||s.type==="em_open"||s.type==="em_close"||(s.type==="code_inline"?n.push(new xo({text:s.content,font:"Consolas",size:r.size,shading:{fill:"F5F5F5"}})):s.type==="math_inline"||s.type==="katex_inline"?n.push(new xo({text:s.content,font:"Cambria Math",size:r.size,italics:!0})):s.type==="link_open"||s.type)});const i=[];let a=0;for(;a<e.children.length;){const s=e.children[a];if(s.type==="strong_open"&&a+2<e.children.length){const o=e.children[a+1];i.push(new xo({text:o.content,bold:!0,font:r.font,size:r.size})),a+=3}else if(s.type==="em_open"&&a+2<e.children.length){const o=e.children[a+1];i.push(new xo({text:o.content,italics:!0,font:r.font,size:r.size})),a+=3}else s.type==="text"?(i.push(new xo({text:s.content,font:r.font,size:r.size})),a++):s.type==="code_inline"?(i.push(new xo({text:s.content,font:"Consolas",size:r.size,shading:{fill:"F5F5F5"}})),a++):((s.type==="math_inline"||s.type==="katex_inline")&&i.push(new xo({text:s.content,font:"Cambria Math",size:r.size,italics:!0})),a++)}return i.length>0?i:n}parseTable(e,r){const n=[];let i=r+1,a=!0;for(;i<e.length&&e[i].type!=="table_close";){if(e[i].type==="thead_open"||e[i].type==="tbody_open"){i++;continue}if(e[i].type==="thead_close"){a=!1,i++;continue}if(e[i].type==="tbody_close"){i++;continue}if(e[i].type==="tr_open"){const s=[];for(i++;i<e.length&&e[i].type!=="tr_close";)e[i].type==="th_open"||e[i].type==="td_open"?(i++,e[i]&&e[i].type==="inline"&&s.push({text:e[i].content,isHeader:a}),i+=2):i++;s.length>0&&n.push(s),i++}else i++}return n.length>0?{rows:n,endIndex:i}:null}createGridTable(e){if(!e||e.length===0)return null;const r=e.map(n=>new FL({children:n.contents.length>0?n.contents:[new wa({text:""})],width:{size:n.width/12*100,type:nb.PERCENTAGE},borders:{top:{style:ol.NONE,size:0,color:"FFFFFF"},bottom:{style:ol.NONE,size:0,color:"FFFFFF"},left:{style:ol.NONE,size:0,color:"FFFFFF"},right:{style:ol.NONE,size:0,color:"FFFFFF"}},margins:{top:100,bottom:100,left:100,right:100}}));return new YBe({rows:[new WBe({children:r})],width:{size:100,type:nb.PERCENTAGE},borders:{top:{style:ol.NONE,size:0,color:"FFFFFF"},bottom:{style:ol.NONE,size:0,color:"FFFFFF"},left:{style:ol.NONE,size:0,color:"FFFFFF"},right:{style:ol.NONE,size:0,color:"FFFFFF"},insideHorizontal:{style:ol.NONE,size:0,color:"FFFFFF"},insideVertical:{style:ol.NONE,size:0,color:"FFFFFF"}}})}createTable(e){const r=this.getDefaultTextStyle(),n=e.rows.map(i=>new WBe({children:i.map(a=>new FL({children:[new wa({children:[new xo({text:a.text,bold:a.isHeader,font:r.font,size:r.size})],spacing:{before:0,after:0,line:288,lineRule:"auto"}})],shading:a.isHeader?{fill:"F0F0F0"}:void 0}))}));return new YBe({rows:n,width:{size:100,type:nb.PERCENTAGE}})}getContainerStyle(e){const r={info:{background:"E3F2FD",borderColor:"2196F3"},warning:{background:"FFF3E0",borderColor:"FF9800"},danger:{background:"FFEBEE",borderColor:"F44336"},success:{background:"E8F5E9",borderColor:"4CAF50"}};return r[e]||r.info}getHeadingLevel(e){return{1:xv.HEADING_1,2:xv.HEADING_2,3:xv.HEADING_3,4:xv.HEADING_4,5:xv.HEADING_5,6:xv.HEADING_6}[e]||xv.HEADING_1}async exportToWord(e,r,n,i="document.docx"){try{const a=this.parseMarkdown(e,r),s=await this.convertTokensToDocx(a,n),o=new AWt({sections:[{properties:{},children:s}]}),l=await IWt.toBlob(o);return NWt.saveAs(l,i),{success:!0,message:"导出成功"}}catch(a){return console.error("导出 Word 文档失败:",a),{success:!1,message:a.message}}}}const ier={name:"MarkdownEditor",components:{EditModal:IGt,DatasetPanel:PGt},props:{content:{type:String,default:""},editable:{type:Boolean,default:!1},defaultShowEditor:{type:Boolean,default:!0},datasource:{type:Object,required:!1,validator:t=>["getDataSource","getDataSourceList","clearDataSourceCache","testDataSourceConnection"].every(r=>typeof t[r]=="function")},dark:{type:[Boolean,String],default:"auto",validator:t=>t==="auto"||typeof t=="boolean"},theme:{type:Object,default:()=>({})},showFullscreenButton:{type:Boolean,default:!1}},emits:["update:content","errors"],data(){return{showEditor:this.defaultShowEditor,md:null,chartRenderer:null,datasetRenderer:null,mermaidRenderer:null,renderTimeout:null,editModalVisible:!1,currentEditContent:"",currentComponentType:"",currentComponentId:"",currentTokenStart:0,currentTokenEnd:0,isResizing:!1,editorWidth:500,minEditorWidth:300,maxEditorWidth:800,renderErrors:[],_isMounted:!1,_isRendering:!1,isDashboardMode:!1,isFullscreen:!1}},watch:{content:{handler(t){console.log("watch content triggered:",{length:t==null?void 0:t.length,hasComment:/<!--\s*dashboard\s*-->/.test(t)}),this.detectDashboardMode(t),this._isMounted&&!this._isRendering&&(this.renderTimeout&&clearTimeout(this.renderTimeout),this.renderTimeout=setTimeout(()=>{this.$nextTick(()=>{this.renderWithQueue()})},150))},immediate:!0},showEditor:{handler(){this.$nextTick(()=>{var t;return(t=this.chartRenderer)==null?void 0:t.processEChartsElements()})}},localContent:{handler(t,e){t!==e&&this._isMounted&&this.$emit("update:content",t),this._isMounted&&!this._isRendering&&(this.renderTimeout&&clearTimeout(this.renderTimeout),this.renderTimeout=setTimeout(()=>{this.$nextTick(()=>{this.renderWithQueue()})},150))}},isDarkMode:{handler(){if(this._isMounted){this.updateMermaidTheme();const t=this.isDarkMode?"dark":"light";this.chartRenderer.setTheme(t),this.$nextTick(()=>{this.clearProcessedMarks(),this.renderWithQueue()})}}}},created(){this.md=rIe(this.editable),this.chartRenderer=new qEt,this.datasetRenderer=new Hnt,this.mermaidRenderer=new zBt,this.wordExporter=new ner,this.datasetRenderer.setDataSourceFunctions(this.datasource),this.chartRenderer.setDataset(this.datasetRenderer.getDataset()),this.updateMermaidTheme(),this.detectDashboardMode(this.content)},computed:{contentModel:{get(){return this.content},set(t){this.$emit("update:content",t)}},renderedContent(){return this.md?this.md.render(this.content):""},isDarkMode(){return this.dark==="auto"?typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)").matches:!1:this.dark===!0},themeVars(){const t=this.isDarkMode?"dark":"light",e=FGt[t],r=this.theme[t]||{};return{...e,...r}}},mounted(){var e;this._isMounted=!0,this.content&&this.localContent!==this.content&&(this.localContent=this.content,console.log("MarkdownEditor mounted: 强制设置 localContent,长度:",((e=this.localContent)==null?void 0:e.length)||0)),this.dark==="auto"&&typeof window<"u"&&window.matchMedia&&(this._themeMediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this._handleThemeChange=()=>{this.$forceUpdate()},this._themeMediaQuery.addEventListener("change",this._handleThemeChange));const t=this.$el.querySelector(".preview-container");t&&(this._handleEditClick=r=>{const n=r.target.closest('[data-editable="true"]');if(!n)return;r.stopPropagation(),r.preventDefault();const i=n.getBoundingClientRect(),a={left:i.right-20,top:i.top,right:i.right,bottom:i.top+20};if(!(r.clientX>=a.left&&r.clientX<=a.right&&r.clientY>=a.top&&r.clientY<=a.bottom))return;const o=n.getAttribute("data-component-id"),l=n.getAttribute("data-component-type"),u=n.getAttribute("data-position");if(o&&l&&u){const[h,d]=u.split(",").map(Number),f=this.content.substring(h,d);this.currentComponentId=o,this.currentComponentType=l,this.currentEditContent=f,this.currentTokenStart=h,this.currentTokenEnd=d,this.editModalVisible=!0}},t.addEventListener("click",this._handleEditClick)),this.$nextTick(()=>{const r=this.isDarkMode?"dark":"light",n=this.isDarkMode?"dark":"default";this.chartRenderer.setTheme(r),this.mermaidRenderer.initialize(n),this.renderWithQueue(),this.chartRenderer.observeDOM(".preview-container"),this.datasetRenderer.observeDOM(".preview-container"),this.mermaidRenderer.observeDOM(".preview-container")})},beforeUnmount(){var e,r,n,i;this._isMounted=!1,this.renderTimeout&&(clearTimeout(this.renderTimeout),this.renderTimeout=null),this._themeMediaQuery&&this._handleThemeChange&&(this._themeMediaQuery.removeEventListener("change",this._handleThemeChange),this._themeMediaQuery=null,this._handleThemeChange=null);const t=(e=this.$el)==null?void 0:e.querySelector(".preview-container");t&&this._handleEditClick&&(t.removeEventListener("click",this._handleEditClick),this._handleEditClick=null),(r=this.chartRenderer)==null||r.cleanup(),(n=this.datasetRenderer)==null||n.cleanup(),(i=this.mermaidRenderer)==null||i.cleanup()},methods:{detectDashboardMode(t){const e=/<!--\s*dashboard\s*-->/.test(t);console.log("detectDashboardMode:",{content:t==null?void 0:t.substring(0,50),isDashboard:e,currentMode:this.isDashboardMode}),e!==this.isDashboardMode&&(this.isDashboardMode=e,console.log("Dashboard mode changed to:",e))},clearProcessedMarks(){const t=this.$el.querySelector(".preview-container");if(!t)return;t.querySelectorAll('.mermaid[data-processed="true"]').forEach(i=>{i.removeAttribute("data-processed"),i.dataset.originalCode&&(i.textContent=i.dataset.originalCode)}),t.querySelectorAll('.echarts-container[data-processed="true"]').forEach(i=>{i.removeAttribute("data-processed")}),t.querySelectorAll('.dataset-container[data-processed="true"]').forEach(i=>{i.removeAttribute("data-processed")})},updateMermaidTheme(){const t=this.isDarkMode?"dark":"default";this.mermaidRenderer&&this.mermaidRenderer.setTheme(t)},handleResizerMouseDown(t){this.$emit("update:content",this.content)},async renderWithQueue(){if(!this._isRendering){this._isRendering=!0;try{this.chartRenderer.clearErrors(),this.datasetRenderer.clearErrors(),this.mermaidRenderer.clearErrors(),tD.clearErrors(),await this.datasetRenderer.renderDatasets(),await this.$nextTick(),this.chartRenderer.processEChartsElements(),this.mermaidRenderer.renderMermaidCharts(),setTimeout(()=>{this.collectRenderErrors()},300)}catch(t){console.warn("渲染过程中发生错误:",t),setTimeout(()=>{this.collectRenderErrors()},300)}finally{this._isRendering=!1}}},getErrors(){return[...this.renderErrors]},collectRenderErrors(){const t=[],e=this.content.split(`
|
|
912
912
|
`);[...this.chartRenderer.getErrors(),...this.datasetRenderer.getErrors(),...this.mermaidRenderer.getErrors(),...tD.getErrors()].forEach(n=>{const i=this.findErrorLocation(n.message,e,n.type,n.code);i&&t.push(i)}),this.renderErrors=t,this.$emit("errors",t)},findErrorLocation(t,e,r=null,n=null){let i=-1,a=r||"Unknown",s=t;r||(t.includes("ECharts")?a="ECharts":t.includes("数据集")||t.includes("dataset")?a="Dataset":t.includes("Mermaid")&&(a="Mermaid"));let o=-1;for(let l=0;l<e.length;l++){const u=e[l];a==="ECharts"&&u.includes("```echarts")||(a==="Dataset"&&u.includes("```dataset")?n&&n.includes(u.trim())&&(o=l+1):a==="Mermaid"&&u.includes("```mermaid")||a==="Container"&&u.includes("::: cell"))}if(o>0&&(i=o),i>0){const l=Math.max(0,i-1);let u=l+1;if(a==="Container"){for(let f=l+1;f<e.length;f++)if(e[f].trim()===":::"){u=f+1;break}}else for(let f=l+1;f<e.length;f++)if(e[f].trim()==="```"){u=f+1;break}u=Math.min(e.length,u);const h=e.slice(l,u).join(`
|
|
913
913
|
`);let d=s.replace(/^(ECharts|数据集|Mermaid|Container)(渲染|配置处理)?错误:\s*/i,"").replace(/\s*at\s+.*$/gm,"").split(`
|
|
914
|
-
`)[0].trim();return{line:i,type:a,message:d,code:h,severity:"error"}}return null},handleEditSave(t){if(this.currentComponentId&&this.currentComponentType){const e=this.currentTokenStart,r=this.currentTokenEnd;let n=this.content;if(e!==void 0&&r!==void 0){const i=this.content.substring(0,e),a=this.content.substring(r);n=i+t+a;const s=r-e,l=t.length-s;l!==0&&this.$nextTick(()=>{this._updateSubsequentPositions(r,l)})}else{console.error("未找到精确位置信息,无法进行内容替换");return}this.$emit("update:content",n),this.editModalVisible=!1}},_updateSubsequentPositions(t,e){document.querySelectorAll('[data-editable="true"][data-position]').forEach(n=>{const i=n.getAttribute("data-position");if(!i)return;const[a,s]=i.split(",").map(Number);if(a>=t){const o=a+e,l=s+e;n.setAttribute("data-position",`${o},${l}`)}})},handleEditClose(){this.editModalVisible=!1,this.currentComponentId="",this.currentComponentType="",this.currentEditContent="",this.currentTokenStart=0,this.currentTokenEnd=0},handleEditFromPanel(t,e,r){const[n,i]=r.split(",").map(Number),a=this.content.substring(n,i);this.currentComponentId=t,this.currentComponentType=e,this.currentEditContent=a,this.currentTokenStart=n,this.currentTokenEnd=i,this.editModalVisible=!0},toggleEditor(){this.showEditor=!this.showEditor},toggleFullscreen(){this.isFullscreen=!this.isFullscreen},startResize(t){this.isResizing=!0,document.addEventListener("mousemove",this.handleResize),document.addEventListener("mouseup",this.stopResize),t.preventDefault()},handleResize(t){if(!this.isResizing)return;const n=this.$el.getBoundingClientRect().right-t.clientX;n>=this.minEditorWidth&&n<=this.maxEditorWidth&&(this.editorWidth=n)},stopResize(){this.isResizing=!1,document.removeEventListener("mousemove",this.handleResize),document.removeEventListener("mouseup",this.stopResize),this.$nextTick(()=>{var t;(t=this.chartRenderer)==null||t.processEChartsElements()})},async exportToWord(t="document.docx"){try{const e=this.$el.querySelector(".preview-container");return e?(await this.$nextTick(),await this.wordExporter.exportToWord(this.md,this.content,e,t)):{success:!1,message:"预览容器未找到"}}catch(e){return console.error("导出失败:",e),{success:!1,message:e.message}}}}},aer=["data-theme-mode"],ser=["title"],oer={key:0,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},ler={key:1,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},cer=["innerHTML"];function uer(t,e,r,n,i,a){const s=Dt.resolveComponent("DatasetPanel"),o=Dt.resolveComponent("EditModal");return Dt.openBlock(),Dt.createElementBlock("div",{class:Dt.normalizeClass(["markdown-editor",{"dashboard-mode":i.isDashboardMode,fullscreen:i.isFullscreen}]),"data-theme-mode":a.isDarkMode?"dark":"light",style:Dt.normalizeStyle(a.themeVars)},[i.isDashboardMode?(Dt.openBlock(),Dt.createElementBlock("div",{key:0,class:"fullscreen-toggle",onClick:e[0]||(e[0]=(...l)=>a.toggleFullscreen&&a.toggleFullscreen(...l)),title:i.isFullscreen?"退出全屏":"全屏"},[i.isFullscreen?(Dt.openBlock(),Dt.createElementBlock("svg",ler,[...e[6]||(e[6]=[Dt.createElementVNode("path",{d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"},null,-1)])])):(Dt.openBlock(),Dt.createElementBlock("svg",oer,[...e[5]||(e[5]=[Dt.createElementVNode("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"},null,-1)])]))],8,ser)):Dt.createCommentVNode("",!0),i.isDashboardMode?(Dt.openBlock(),Dt.createBlock(s,{key:1,ref:"datasetPanel"},null,512)):Dt.createCommentVNode("",!0),Dt.createElementVNode("div",{class:Dt.normalizeClass(["preview-container",{"full-width":!i.showEditor}])},[Dt.createElementVNode("div",{class:"markdown-body",innerHTML:a.renderedContent},null,8,cer)],2),r.editable?(Dt.openBlock(),Dt.createElementBlock("div",{key:2,class:Dt.normalizeClass(["resizer",{"resizer-collapsed":!i.showEditor}])},[i.showEditor?(Dt.openBlock(),Dt.createElementBlock("div",{key:0,class:"resizer-draggable",onMousedown:e[1]||(e[1]=(...l)=>a.startResize&&a.startResize(...l))},null,32)):Dt.createCommentVNode("",!0),Dt.createElementVNode("div",{class:"resizer-toggle",onClick:e[2]||(e[2]=(...l)=>a.toggleEditor&&a.toggleEditor(...l))},[Dt.createElementVNode("span",null,Dt.toDisplayString(i.showEditor?"›":"‹"),1)])],2)):Dt.createCommentVNode("",!0),r.editable&&i.showEditor?(Dt.openBlock(),Dt.createElementBlock("div",{key:3,class:"editor-container",style:Dt.normalizeStyle({width:i.editorWidth+"px"})},[Dt.withDirectives(Dt.createElementVNode("textarea",{"onUpdate:modelValue":e[3]||(e[3]=l=>a.contentModel=l),class:"editor",placeholder:"请输入 Markdown 内容..."},null,512),[[Dt.vModelText,a.contentModel]])],4)):Dt.createCommentVNode("",!0),Dt.createVNode(o,{visible:i.editModalVisible,"onUpdate:visible":e[4]||(e[4]=l=>i.editModalVisible=l),content:i.currentEditContent,"component-type":i.currentComponentType,onSave:a.handleEditSave,onClose:a.handleEditClose},null,8,["visible","content","component-type","onSave","onClose"])],14,aer)}const uFe=aK(ier,[["render",uer],["__scopeId","data-v-d6bb0035"]]);var her="[object Symbol]";function Dv(t){return typeof t=="symbol"||Kc(t)&&If(t)==her}function Lv(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var hFe=Wc?Wc.prototype:void 0,dFe=hFe?hFe.toString:void 0;function fFe(t){if(typeof t=="string")return t;if(dn(t))return Lv(t,fFe)+"";if(Dv(t))return dFe?dFe.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var der=/\s/;function fer(t){for(var e=t.length;e--&&der.test(t.charAt(e)););return e}var per=/^\s+/;function ger(t){return t&&t.slice(0,fer(t)+1).replace(per,"")}var pFe=NaN,Aer=/^[-+]0x[0-9a-f]+$/i,mer=/^0b[01]+$/i,ver=/^0o[0-7]+$/i,yer=parseInt;function _er(t){if(typeof t=="number")return t;if(Dv(t))return pFe;if(kl(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=kl(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=ger(t);var r=mer.test(t);return r||ver.test(t)?yer(t.slice(2),r?2:8):Aer.test(t)?pFe:+t}var gFe=1/0,ber=17976931348623157e292;function B5(t){if(!t)return t===0?t:0;if(t=_er(t),t===gFe||t===-gFe){var e=t<0?-1:1;return e*ber}return t===t?t:0}function P5(t){var e=B5(t),r=e%1;return e===e?r?e-r:e:0}function is(){}function AFe(t,e){for(var r=-1,n=t==null?0:t.length;++r<n&&e(t[r],r,t)!==!1;);return t}function mFe(t,e,r,n){for(var i=t.length,a=r+-1;++a<i;)if(e(t[a],a,t))return a;return-1}function Ser(t){return t!==t}function Eer(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}function pJ(t,e,r){return e===e?Eer(t,e,r):mFe(t,Ser,r)}function vFe(t,e){var r=t==null?0:t.length;return!!r&&pJ(t,e,0)>-1}function as(t){return ed(t)?e2e(t):nke(t)}var wer=Object.prototype,xer=wer.hasOwnProperty,hc=a2e(function(t,e){if(wT(e)||ed(e)){v_(e,as(e),t);return}for(var r in e)xer.call(e,r)&&OT(t,r,e[r])}),Ter=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Oer=/^\w*$/;function gJ(t,e){if(dn(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Dv(t)?!0:Oer.test(t)||!Ter.test(t)||e!=null&&t in Object(e)}var Cer=500;function Rer(t){var e=g_(t,function(n){return r.size===Cer&&r.clear(),n}),r=e.cache;return e}var ker=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ier=/\\(\\)?/g,Ner=Rer(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(ker,function(r,n,i,a){e.push(i?a.replace(Ier,"$1"):n||r)}),e});function yFe(t){return t==null?"":fFe(t)}function F5(t,e){return dn(t)?t:gJ(t,e)?[t]:Ner(yFe(t))}function g2(t){if(typeof t=="string"||Dv(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function U5(t,e){e=F5(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[g2(e[r++])];return r&&r==n?t:void 0}function Der(t,e,r){var n=t==null?void 0:U5(t,e);return n===void 0?r:n}function AJ(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}var _Fe=Wc?Wc.isConcatSpreadable:void 0;function Ler(t){return dn(t)||A_(t)||!!(_Fe&&t&&t[_Fe])}function A2(t,e,r,n,i){var a=-1,s=t.length;for(r||(r=Ler),i||(i=[]);++a<s;){var o=t[a];r(o)?AJ(i,o):n||(i[i.length]=o)}return i}function Os(t){var e=t==null?0:t.length;return e?A2(t):[]}function Mer(t){return i2e(n2e(t,void 0,Os),t+"")}function bFe(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),r=r>i?i:r,r<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var a=Array(i);++n<i;)a[n]=t[n+e];return a}function Ber(t,e,r,n){var i=-1,a=t==null?0:t.length;for(n&&a&&(r=t[++i]);++i<a;)r=e(r,t[i],i,t);return r}function Per(t,e){return t&&v_(e,as(e),t)}function Fer(t,e){return t&&v_(e,Km(e),t)}function mJ(t,e){for(var r=-1,n=t==null?0:t.length,i=0,a=[];++r<n;){var s=t[r];e(s,r,t)&&(a[i++]=s)}return a}function SFe(){return[]}var Uer=Object.prototype,Qer=Uer.propertyIsEnumerable,EFe=Object.getOwnPropertySymbols,vJ=EFe?function(t){return t==null?[]:(t=Object(t),mJ(EFe(t),function(e){return Qer.call(t,e)}))}:SFe;function $er(t,e){return v_(t,vJ(t),e)}var Ger=Object.getOwnPropertySymbols,wFe=Ger?function(t){for(var e=[];t;)AJ(e,vJ(t)),t=Nq(t);return e}:SFe;function zer(t,e){return v_(t,wFe(t),e)}function xFe(t,e,r){var n=e(t);return dn(t)?n:AJ(n,r(t))}function yJ(t){return xFe(t,as,vJ)}function TFe(t){return xFe(t,Km,wFe)}var Ver=Object.prototype,Her=Ver.hasOwnProperty;function qer(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Her.call(t,"index")&&(r.index=t.index,r.input=t.input),r}function Yer(t,e){var r=e?Iq(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Wer=/\w*$/;function Xer(t){var e=new t.constructor(t.source,Wer.exec(t));return e.lastIndex=t.lastIndex,e}var OFe=Wc?Wc.prototype:void 0,CFe=OFe?OFe.valueOf:void 0;function Ker(t){return CFe?Object(CFe.call(t)):{}}var Zer="[object Boolean]",jer="[object Date]",Jer="[object Map]",etr="[object Number]",ttr="[object RegExp]",rtr="[object Set]",ntr="[object String]",itr="[object Symbol]",atr="[object ArrayBuffer]",str="[object DataView]",otr="[object Float32Array]",ltr="[object Float64Array]",ctr="[object Int8Array]",utr="[object Int16Array]",htr="[object Int32Array]",dtr="[object Uint8Array]",ftr="[object Uint8ClampedArray]",ptr="[object Uint16Array]",gtr="[object Uint32Array]";function Atr(t,e,r){var n=t.constructor;switch(e){case atr:return Iq(t);case Zer:case jer:return new n(+t);case str:return Yer(t,r);case otr:case ltr:case ctr:case utr:case htr:case dtr:case ftr:case ptr:case gtr:return $Oe(t,r);case Jer:return new n;case etr:case ntr:return new n(t);case ttr:return Xer(t);case rtr:return new n;case itr:return Ker(t)}}var mtr="[object Map]";function vtr(t){return Kc(t)&&jc(t)==mtr}var RFe=Mg&&Mg.isMap,ytr=RFe?xT(RFe):vtr,_tr="[object Set]";function btr(t){return Kc(t)&&jc(t)==_tr}var kFe=Mg&&Mg.isSet,Str=kFe?xT(kFe):btr,Etr=1,wtr=2,xtr=4,IFe="[object Arguments]",Ttr="[object Array]",Otr="[object Boolean]",Ctr="[object Date]",Rtr="[object Error]",NFe="[object Function]",ktr="[object GeneratorFunction]",Itr="[object Map]",Ntr="[object Number]",DFe="[object Object]",Dtr="[object RegExp]",Ltr="[object Set]",Mtr="[object String]",Btr="[object Symbol]",Ptr="[object WeakMap]",Ftr="[object ArrayBuffer]",Utr="[object DataView]",Qtr="[object Float32Array]",$tr="[object Float64Array]",Gtr="[object Int8Array]",ztr="[object Int16Array]",Vtr="[object Int32Array]",Htr="[object Uint8Array]",qtr="[object Uint8ClampedArray]",Ytr="[object Uint16Array]",Wtr="[object Uint32Array]",wi={};wi[IFe]=wi[Ttr]=wi[Ftr]=wi[Utr]=wi[Otr]=wi[Ctr]=wi[Qtr]=wi[$tr]=wi[Gtr]=wi[ztr]=wi[Vtr]=wi[Itr]=wi[Ntr]=wi[DFe]=wi[Dtr]=wi[Ltr]=wi[Mtr]=wi[Btr]=wi[Htr]=wi[qtr]=wi[Ytr]=wi[Wtr]=!0,wi[Rtr]=wi[NFe]=wi[Ptr]=!1;function m2(t,e,r,n,i,a){var s,o=e&Etr,l=e&wtr,u=e&xtr;if(s!==void 0)return s;if(!kl(t))return t;var h=dn(t);if(h){if(s=qer(t),!o)return GOe(t,s)}else{var d=jc(t),f=d==NFe||d==ktr;if(m_(t))return QOe(t,o);if(d==DFe||d==IFe||f&&!i){if(s=l||f?{}:HOe(t),!o)return l?zer(t,Fer(s,t)):$er(t,Per(s,t))}else{if(!wi[d])return i?t:{};s=Atr(t,d,o)}}a||(a=new Hu);var p=a.get(t);if(p)return p;a.set(t,s),Str(t)?t.forEach(function(m){s.add(m2(m,e,r,m,t,a))}):ytr(t)&&t.forEach(function(m,v){s.set(v,m2(m,e,r,v,t,a))});var g=u?l?TFe:yJ:l?Km:as,A=h?void 0:g(t);return AFe(A||t,function(m,v){A&&(v=m,m=t[v]),OT(s,v,m2(m,e,r,v,t,a))}),s}var Xtr=4;function ss(t){return m2(t,Xtr)}var Ktr=1,Ztr=4;function jtr(t){return m2(t,Ktr|Ztr)}function v2(t){for(var e=-1,r=t==null?0:t.length,n=0,i=[];++e<r;){var a=t[e];a&&(i[n++]=a)}return i}var Jtr="__lodash_hash_undefined__";function err(t){return this.__data__.set(t,Jtr),this}function trr(t){return this.__data__.has(t)}function vb(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Df;++e<r;)this.add(t[e])}vb.prototype.add=vb.prototype.push=err,vb.prototype.has=trr;function LFe(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function _J(t,e){return t.has(e)}var rrr=1,nrr=2;function MFe(t,e,r,n,i,a){var s=r&rrr,o=t.length,l=e.length;if(o!=l&&!(s&&l>o))return!1;var u=a.get(t),h=a.get(e);if(u&&h)return u==e&&h==t;var d=-1,f=!0,p=r&nrr?new vb:void 0;for(a.set(t,e),a.set(e,t);++d<o;){var g=t[d],A=e[d];if(n)var m=s?n(A,g,d,e,t,a):n(g,A,d,t,e,a);if(m!==void 0){if(m)continue;f=!1;break}if(p){if(!LFe(e,function(v,y){if(!_J(p,y)&&(g===v||i(g,v,r,n,a)))return p.push(y)})){f=!1;break}}else if(!(g===A||i(g,A,r,n,a))){f=!1;break}}return a.delete(t),a.delete(e),f}function irr(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}function bJ(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var arr=1,srr=2,orr="[object Boolean]",lrr="[object Date]",crr="[object Error]",urr="[object Map]",hrr="[object Number]",drr="[object RegExp]",frr="[object Set]",prr="[object String]",grr="[object Symbol]",Arr="[object ArrayBuffer]",mrr="[object DataView]",BFe=Wc?Wc.prototype:void 0,SJ=BFe?BFe.valueOf:void 0;function vrr(t,e,r,n,i,a,s){switch(r){case mrr:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Arr:return!(t.byteLength!=e.byteLength||!a(new y4(t),new y4(e)));case orr:case lrr:case hrr:return p_(+t,+e);case crr:return t.name==e.name&&t.message==e.message;case drr:case prr:return t==e+"";case urr:var o=irr;case frr:var l=n&arr;if(o||(o=bJ),t.size!=e.size&&!l)return!1;var u=s.get(t);if(u)return u==e;n|=srr,s.set(t,e);var h=MFe(o(t),o(e),n,i,a,s);return s.delete(t),h;case grr:if(SJ)return SJ.call(t)==SJ.call(e)}return!1}var yrr=1,_rr=Object.prototype,brr=_rr.hasOwnProperty;function Srr(t,e,r,n,i,a){var s=r&yrr,o=yJ(t),l=o.length,u=yJ(e),h=u.length;if(l!=h&&!s)return!1;for(var d=l;d--;){var f=o[d];if(!(s?f in e:brr.call(e,f)))return!1}var p=a.get(t),g=a.get(e);if(p&&g)return p==e&&g==t;var A=!0;a.set(t,e),a.set(e,t);for(var m=s;++d<l;){f=o[d];var v=t[f],y=e[f];if(n)var _=s?n(y,v,f,e,t,a):n(v,y,f,t,e,a);if(!(_===void 0?v===y||i(v,y,r,n,a):_)){A=!1;break}m||(m=f=="constructor")}if(A&&!m){var b=t.constructor,S=e.constructor;b!=S&&"constructor"in t&&"constructor"in e&&!(typeof b=="function"&&b instanceof b&&typeof S=="function"&&S instanceof S)&&(A=!1)}return a.delete(t),a.delete(e),A}var Err=1,PFe="[object Arguments]",FFe="[object Array]",Q5="[object Object]",wrr=Object.prototype,UFe=wrr.hasOwnProperty;function xrr(t,e,r,n,i,a){var s=dn(t),o=dn(e),l=s?FFe:jc(t),u=o?FFe:jc(e);l=l==PFe?Q5:l,u=u==PFe?Q5:u;var h=l==Q5,d=u==Q5,f=l==u;if(f&&m_(t)){if(!m_(e))return!1;s=!0,h=!1}if(f&&!h)return a||(a=new Hu),s||b4(t)?MFe(t,e,r,n,i,a):vrr(t,e,l,r,n,i,a);if(!(r&Err)){var p=h&&UFe.call(t,"__wrapped__"),g=d&&UFe.call(e,"__wrapped__");if(p||g){var A=p?t.value():t,m=g?e.value():e;return a||(a=new Hu),i(A,m,r,n,a)}}return f?(a||(a=new Hu),Srr(t,e,r,n,i,a)):!1}function EJ(t,e,r,n,i){return t===e?!0:t==null||e==null||!Kc(t)&&!Kc(e)?t!==t&&e!==e:xrr(t,e,r,n,EJ,i)}var Trr=1,Orr=2;function Crr(t,e,r,n){var i=r.length,a=i;if(t==null)return!a;for(t=Object(t);i--;){var s=r[i];if(s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++i<a;){s=r[i];var o=s[0],l=t[o],u=s[1];if(s[2]){if(l===void 0&&!(o in t))return!1}else{var h=new Hu,d;if(!(d===void 0?EJ(u,l,Trr|Orr,n,h):d))return!1}}return!0}function QFe(t){return t===t&&!kl(t)}function Rrr(t){for(var e=as(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,QFe(i)]}return e}function $Fe(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function krr(t){var e=Rrr(t);return e.length==1&&e[0][2]?$Fe(e[0][0],e[0][1]):function(r){return r===t||Crr(r,t,e)}}function Irr(t,e){return t!=null&&e in Object(t)}function GFe(t,e,r){e=F5(e,t);for(var n=-1,i=e.length,a=!1;++n<i;){var s=g2(e[n]);if(!(a=t!=null&&r(t,s)))break;t=t[s]}return a||++n!=i?a:(i=t==null?0:t.length,!!i&&Dq(i)&&S4(s,i)&&(dn(t)||A_(t)))}function zFe(t,e){return t!=null&&GFe(t,e,Irr)}var Nrr=1,Drr=2;function Lrr(t,e){return gJ(t)&&QFe(e)?$Fe(g2(t),e):function(r){var n=Der(r,t);return n===void 0&&n===e?zFe(r,t):EJ(e,n,Nrr|Drr)}}function Mrr(t){return function(e){return e==null?void 0:e[t]}}function Brr(t){return function(e){return U5(e,t)}}function Prr(t){return gJ(t)?Mrr(g2(t)):Brr(t)}function Dl(t){return typeof t=="function"?t:t==null?Lf:typeof t=="object"?dn(t)?Lrr(t[0],t[1]):krr(t):Prr(t)}function Frr(t,e,r,n){for(var i=-1,a=t==null?0:t.length;++i<a;){var s=t[i];e(n,s,r(s),t)}return n}function wJ(t,e){return t&&kq(t,e,as)}function Urr(t,e){return function(r,n){if(r==null)return r;if(!ed(r))return t(r,n);for(var i=r.length,a=-1,s=Object(r);++a<i&&n(s[a],a,s)!==!1;);return r}}var Mv=Urr(wJ);function Qrr(t,e,r,n){return Mv(t,function(i,a,s){e(n,i,r(i),s)}),n}function $rr(t,e){return function(r,n){var i=dn(r)?Frr:Qrr,a=e?e():{};return i(r,t,Dl(n),a)}}var VFe=Object.prototype,Grr=VFe.hasOwnProperty,$5=CT(function(t,e){t=Object(t);var r=-1,n=e.length,i=n>2?e[2]:void 0;for(i&&RT(e[0],e[1],i)&&(n=1);++r<n;)for(var a=e[r],s=Km(a),o=-1,l=s.length;++o<l;){var u=s[o],h=t[u];(h===void 0||p_(h,VFe[u])&&!Grr.call(t,u))&&(t[u]=a[u])}return t}),zrr=200;function Vrr(t,e,r,n){var i=-1,a=vFe,s=!0,o=t.length,l=[],u=e.length;if(!o)return l;e.length>=zrr&&(a=_J,s=!1,e=new vb(e));e:for(;++i<o;){var h=t[i],d=h;if(h=h!==0?h:0,s&&d===d){for(var f=u;f--;)if(e[f]===d)continue e;l.push(h)}else a(e,d,n)||l.push(h)}return l}var G5=CT(function(t,e){return _4(t)?Vrr(t,A2(e,1,_4,!0)):[]});function wd(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}function Ys(t,e,r){var n=t==null?0:t.length;return n?(e=e===void 0?1:P5(e),bFe(t,e<0?0:e,n)):[]}function y2(t,e,r){var n=t==null?0:t.length;return n?(e=e===void 0?1:P5(e),e=n-e,bFe(t,0,e<0?0:e)):[]}function xJ(t){return typeof t=="function"?t:Lf}function rt(t,e){var r=dn(t)?AFe:Mv;return r(t,xJ(e))}function Hrr(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(!e(t[r],r,t))return!1;return!0}function qrr(t,e){var r=!0;return Mv(t,function(n,i,a){return r=!!e(n,i,a),r}),r}function nh(t,e,r){var n=dn(t)?Hrr:qrr;return n(t,Dl(e))}function HFe(t,e){var r=[];return Mv(t,function(n,i,a){e(n,i,a)&&r.push(n)}),r}function ia(t,e){var r=dn(t)?mJ:HFe;return r(t,Dl(e))}function Yrr(t){return function(e,r,n){var i=Object(e);if(!ed(e)){var a=Dl(r);e=as(e),r=function(o){return a(i[o],o,i)}}var s=t(e,r,n);return s>-1?i[a?e[s]:s]:void 0}}var Wrr=Math.max;function Xrr(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:P5(r);return i<0&&(i=Wrr(n+i,0)),mFe(t,Dl(e),i)}var dp=Yrr(Xrr);function ih(t){return t&&t.length?t[0]:void 0}function qFe(t,e){var r=-1,n=ed(t)?Array(t.length):[];return Mv(t,function(i,a,s){n[++r]=e(i,a,s)}),n}function Qt(t,e){var r=dn(t)?Lv:qFe;return r(t,Dl(e))}function dc(t,e){return A2(Qt(t,e))}function Krr(t,e){return t==null?t:kq(t,xJ(e),Km)}function Zrr(t,e){return t&&wJ(t,xJ(e))}var jrr=Object.prototype,Jrr=jrr.hasOwnProperty,enr=$rr(function(t,e,r){Jrr.call(t,r)?t[r].push(e):ET(t,r,[e])});function tnr(t,e){return t>e}var rnr=Object.prototype,nnr=rnr.hasOwnProperty;function inr(t,e){return t!=null&&nnr.call(t,e)}function Nr(t,e){return t!=null&&GFe(t,e,inr)}var anr="[object String]";function Ll(t){return typeof t=="string"||!dn(t)&&Kc(t)&&If(t)==anr}function snr(t,e){return Lv(e,function(r){return t[r]})}function fi(t){return t==null?[]:snr(t,as(t))}var onr=Math.max;function cl(t,e,r,n){t=ed(t)?t:fi(t),r=r?P5(r):0;var i=t.length;return r<0&&(r=onr(i+r,0)),Ll(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&pJ(t,e,r)>-1}function YFe(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=0;return pJ(t,e,i)}var lnr="[object RegExp]";function cnr(t){return Kc(t)&&If(t)==lnr}var WFe=Mg&&Mg.isRegExp,fp=WFe?xT(WFe):cnr;function Xn(t){return t===void 0}function XFe(t,e){return t<e}function z5(t,e){var r={};return e=Dl(e),wJ(t,function(n,i,a){ET(r,i,e(n,i,a))}),r}function TJ(t,e,r){for(var n=-1,i=t.length;++n<i;){var a=t[n],s=e(a);if(s!=null&&(o===void 0?s===s&&!Dv(s):r(s,o)))var o=s,l=a}return l}function Bv(t){return t&&t.length?TJ(t,Lf,tnr):void 0}function yb(t){return t&&t.length?TJ(t,Lf,XFe):void 0}function OJ(t,e){return t&&t.length?TJ(t,Dl(e),XFe):void 0}var unr="Expected a function";function hnr(t){if(typeof t!="function")throw new TypeError(unr);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function dnr(t,e,r,n){if(!kl(t))return t;e=F5(e,t);for(var i=-1,a=e.length,s=a-1,o=t;o!=null&&++i<a;){var l=g2(e[i]),u=r;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(i!=s){var h=o[l];u=void 0,u===void 0&&(u=kl(h)?h:S4(e[i+1])?[]:{})}OT(o,l,u),o=o[l]}return t}function KFe(t,e,r){for(var n=-1,i=e.length,a={};++n<i;){var s=e[n],o=U5(t,s);r(o,s)&&dnr(a,F5(s,t),o)}return a}function ah(t,e){if(t==null)return{};var r=Lv(TFe(t),function(n){return[n]});return e=Dl(e),KFe(t,r,function(n,i){return e(n,i[0])})}function fnr(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}function pnr(t,e){if(t!==e){var r=t!==void 0,n=t===null,i=t===t,a=Dv(t),s=e!==void 0,o=e===null,l=e===e,u=Dv(e);if(!o&&!u&&!a&&t>e||a&&s&&l&&!o&&!u||n&&s&&l||!r&&l||!i)return 1;if(!n&&!a&&!u&&t<e||u&&r&&i&&!n&&!a||o&&r&&i||!s&&i||!l)return-1}return 0}function gnr(t,e,r){for(var n=-1,i=t.criteria,a=e.criteria,s=i.length,o=r.length;++n<s;){var l=pnr(i[n],a[n]);if(l){if(n>=o)return l;var u=r[n];return l*(u=="desc"?-1:1)}}return t.index-e.index}function Anr(t,e,r){e.length?e=Lv(e,function(a){return dn(a)?function(s){return U5(s,a.length===1?a[0]:a)}:a}):e=[Lf];var n=-1;e=Lv(e,xT(Dl));var i=qFe(t,function(a,s,o){var l=Lv(e,function(u){return u(a)});return{criteria:l,index:++n,value:a}});return fnr(i,function(a,s){return gnr(a,s,r)})}function mnr(t,e){return KFe(t,e,function(r,n){return zFe(t,n)})}var V5=Mer(function(t,e){return t==null?{}:mnr(t,e)}),vnr=Math.ceil,ynr=Math.max;function _nr(t,e,r,n){for(var i=-1,a=ynr(vnr((e-t)/(r||1)),0),s=Array(a);a--;)s[++i]=t,t+=r;return s}function bnr(t){return function(e,r,n){return n&&typeof n!="number"&&RT(e,r,n)&&(r=n=void 0),e=B5(e),r===void 0?(r=e,e=0):r=B5(r),n=n===void 0?e<r?1:-1:B5(n),_nr(e,r,n)}}var _b=bnr();function Snr(t,e,r,n,i){return i(t,function(a,s,o){r=n?(n=!1,a):e(r,a,s,o)}),r}function Ua(t,e,r){var n=dn(t)?Ber:Snr,i=arguments.length<3;return n(t,Dl(e),r,i,Mv)}function H5(t,e){var r=dn(t)?mJ:HFe;return r(t,hnr(Dl(e)))}function Enr(t,e){var r;return Mv(t,function(n,i,a){return r=e(n,i,a),!r}),!!r}function ZFe(t,e,r){var n=dn(t)?LFe:Enr;return n(t,Dl(e))}var _2=CT(function(t,e){if(t==null)return[];var r=e.length;return r>1&&RT(t,e[0],e[1])?e=[]:r>2&&RT(e[0],e[1],e[2])&&(e=[e[0]]),Anr(t,A2(e),[])}),wnr=1/0,xnr=R_&&1/bJ(new R_([,-0]))[1]==wnr?function(t){return new R_(t)}:is,Tnr=200;function CJ(t,e,r){var n=-1,i=vFe,a=t.length,s=!0,o=[],l=o;if(a>=Tnr){var u=e?null:xnr(t);if(u)return bJ(u);s=!1,i=_J,l=new vb}else l=e?[]:o;e:for(;++n<a;){var h=t[n],d=e?e(h):h;if(h=h!==0?h:0,s&&d===d){for(var f=l.length;f--;)if(l[f]===d)continue e;e&&l.push(d),o.push(h)}else i(l,d,r)||(l!==o&&l.push(d),o.push(h))}return o}var Onr=CT(function(t){return CJ(A2(t,1,_4,!0))});function RJ(t){return t&&t.length?CJ(t):[]}function Cnr(t,e){return t&&t.length?CJ(t,Dl(e)):[]}var Rnr=0;function kJ(t){var e=++Rnr;return yFe(t)+e}function knr(t,e,r){for(var n=-1,i=t.length,a=e.length,s={};++n<i;){var o=n<a?e[n]:void 0;r(s,t[n],o)}return s}function Inr(t,e){return knr(t||[],e||[],OT)}var Nnr="\0",Pv="\0",jFe="";class Ml{constructor(e={}){this._isDirected=Object.prototype.hasOwnProperty.call(e,"directed")?e.directed:!0,this._isMultigraph=Object.prototype.hasOwnProperty.call(e,"multigraph")?e.multigraph:!1,this._isCompound=Object.prototype.hasOwnProperty.call(e,"compound")?e.compound:!1,this._label=void 0,this._defaultNodeLabelFn=y_(void 0),this._defaultEdgeLabelFn=y_(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[Pv]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return Xc(e)||(e=y_(e)),this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return as(this._nodes)}sources(){var e=this;return ia(this.nodes(),function(r){return Gn(e._in[r])})}sinks(){var e=this;return ia(this.nodes(),function(r){return Gn(e._out[r])})}setNodes(e,r){var n=arguments,i=this;return rt(e,function(a){n.length>1?i.setNode(a,r):i.setNode(a)}),this}setNode(e,r){return Object.prototype.hasOwnProperty.call(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=r),this):(this._nodes[e]=arguments.length>1?r:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=Pv,this._children[e]={},this._children[Pv][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.prototype.hasOwnProperty.call(this._nodes,e)}removeNode(e){if(Object.prototype.hasOwnProperty.call(this._nodes,e)){var r=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],rt(this.children(e),n=>{this.setParent(n)}),delete this._children[e]),rt(as(this._in[e]),r),delete this._in[e],delete this._preds[e],rt(as(this._out[e]),r),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(Xn(r))r=Pv;else{r+="";for(var n=r;!Xn(n);n=this.parent(n))if(n===e)throw new Error("Setting "+r+" as parent of "+e+" would create a cycle");this.setNode(r)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=r,this._children[r][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var r=this._parent[e];if(r!==Pv)return r}}children(e){if(Xn(e)&&(e=Pv),this._isCompound){var r=this._children[e];if(r)return as(r)}else{if(e===Pv)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var r=this._preds[e];if(r)return as(r)}successors(e){var r=this._sucs[e];if(r)return as(r)}neighbors(e){var r=this.predecessors(e);if(r)return Onr(r,this.successors(e))}isLeaf(e){var r;return this.isDirected()?r=this.successors(e):r=this.neighbors(e),r.length===0}filterNodes(e){var r=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});r.setGraph(this.graph());var n=this;rt(this._nodes,function(s,o){e(o)&&r.setNode(o,s)}),rt(this._edgeObjs,function(s){r.hasNode(s.v)&&r.hasNode(s.w)&&r.setEdge(s,n.edge(s))});var i={};function a(s){var o=n.parent(s);return o===void 0||r.hasNode(o)?(i[s]=o,o):o in i?i[o]:a(o)}return this._isCompound&&rt(r.nodes(),function(s){r.setParent(s,a(s))}),r}setDefaultEdgeLabel(e){return Xc(e)||(e=y_(e)),this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return fi(this._edgeObjs)}setPath(e,r){var n=this,i=arguments;return Ua(e,function(a,s){return i.length>1?n.setEdge(a,s,r):n.setEdge(a,s),s}),this}setEdge(){var e,r,n,i,a=!1,s=arguments[0];typeof s=="object"&&s!==null&&"v"in s?(e=s.v,r=s.w,n=s.name,arguments.length===2&&(i=arguments[1],a=!0)):(e=s,r=arguments[1],n=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),e=""+e,r=""+r,Xn(n)||(n=""+n);var o=b2(this._isDirected,e,r,n);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,o))return a&&(this._edgeLabels[o]=i),this;if(!Xn(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(r),this._edgeLabels[o]=a?i:this._defaultEdgeLabelFn(e,r,n);var l=Dnr(this._isDirected,e,r,n);return e=l.v,r=l.w,Object.freeze(l),this._edgeObjs[o]=l,JFe(this._preds[r],e),JFe(this._sucs[e],r),this._in[r][o]=l,this._out[e][o]=l,this._edgeCount++,this}edge(e,r,n){var i=arguments.length===1?IJ(this._isDirected,arguments[0]):b2(this._isDirected,e,r,n);return this._edgeLabels[i]}hasEdge(e,r,n){var i=arguments.length===1?IJ(this._isDirected,arguments[0]):b2(this._isDirected,e,r,n);return Object.prototype.hasOwnProperty.call(this._edgeLabels,i)}removeEdge(e,r,n){var i=arguments.length===1?IJ(this._isDirected,arguments[0]):b2(this._isDirected,e,r,n),a=this._edgeObjs[i];return a&&(e=a.v,r=a.w,delete this._edgeLabels[i],delete this._edgeObjs[i],e8e(this._preds[r],e),e8e(this._sucs[e],r),delete this._in[r][i],delete this._out[e][i],this._edgeCount--),this}inEdges(e,r){var n=this._in[e];if(n){var i=fi(n);return r?ia(i,function(a){return a.v===r}):i}}outEdges(e,r){var n=this._out[e];if(n){var i=fi(n);return r?ia(i,function(a){return a.w===r}):i}}nodeEdges(e,r){var n=this.inEdges(e,r);if(n)return n.concat(this.outEdges(e,r))}}Ml.prototype._nodeCount=0,Ml.prototype._edgeCount=0;function JFe(t,e){t[e]?t[e]++:t[e]=1}function e8e(t,e){--t[e]||delete t[e]}function b2(t,e,r,n){var i=""+e,a=""+r;if(!t&&i>a){var s=i;i=a,a=s}return i+jFe+a+jFe+(Xn(n)?Nnr:n)}function Dnr(t,e,r,n){var i=""+e,a=""+r;if(!t&&i>a){var s=i;i=a,a=s}var o={v:i,w:a};return n&&(o.name=n),o}function IJ(t,e){return b2(t,e.v,e.w,e.name)}class Lnr{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,r=e._prev;if(r!==e)return t8e(r),r}enqueue(e){var r=this._sentinel;e._prev&&e._next&&t8e(e),e._next=r._next,r._next._prev=e,r._next=e,e._prev=r}toString(){for(var e=[],r=this._sentinel,n=r._prev;n!==r;)e.push(JSON.stringify(n,Mnr)),n=n._prev;return"["+e.join(", ")+"]"}}function t8e(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function Mnr(t,e){if(t!=="_next"&&t!=="_prev")return e}var Bnr=y_(1);function Pnr(t,e){if(t.nodeCount()<=1)return[];var r=Unr(t,e||Bnr),n=Fnr(r.graph,r.buckets,r.zeroIdx);return Os(Qt(n,function(i){return t.outEdges(i.v,i.w)}))}function Fnr(t,e,r){for(var n=[],i=e[e.length-1],a=e[0],s;t.nodeCount();){for(;s=a.dequeue();)NJ(t,e,r,s);for(;s=i.dequeue();)NJ(t,e,r,s);if(t.nodeCount()){for(var o=e.length-2;o>0;--o)if(s=e[o].dequeue(),s){n=n.concat(NJ(t,e,r,s,!0));break}}}return n}function NJ(t,e,r,n,i){var a=i?[]:void 0;return rt(t.inEdges(n.v),function(s){var o=t.edge(s),l=t.node(s.v);i&&a.push({v:s.v,w:s.w}),l.out-=o,DJ(e,r,l)}),rt(t.outEdges(n.v),function(s){var o=t.edge(s),l=s.w,u=t.node(l);u.in-=o,DJ(e,r,u)}),t.removeNode(n.v),a}function Unr(t,e){var r=new Ml,n=0,i=0;rt(t.nodes(),function(o){r.setNode(o,{v:o,in:0,out:0})}),rt(t.edges(),function(o){var l=r.edge(o.v,o.w)||0,u=e(o),h=l+u;r.setEdge(o.v,o.w,h),i=Math.max(i,r.node(o.v).out+=u),n=Math.max(n,r.node(o.w).in+=u)});var a=_b(i+n+3).map(function(){return new Lnr}),s=n+1;return rt(r.nodes(),function(o){DJ(a,s,r.node(o))}),{graph:r,buckets:a,zeroIdx:s}}function DJ(t,e,r){r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)}function Qnr(t){var e=t.graph().acyclicer==="greedy"?Pnr(t,r(t)):$nr(t);rt(e,function(n){var i=t.edge(n);t.removeEdge(n),i.forwardName=n.name,i.reversed=!0,t.setEdge(n.w,n.v,i,kJ("rev"))});function r(n){return function(i){return n.edge(i).weight}}}function $nr(t){var e=[],r={},n={};function i(a){Object.prototype.hasOwnProperty.call(n,a)||(n[a]=!0,r[a]=!0,rt(t.outEdges(a),function(s){Object.prototype.hasOwnProperty.call(r,s.w)?e.push(s):i(s.w)}),delete r[a])}return rt(t.nodes(),i),e}function Gnr(t){rt(t.edges(),function(e){var r=t.edge(e);if(r.reversed){t.removeEdge(e);var n=r.forwardName;delete r.reversed,delete r.forwardName,t.setEdge(e.w,e.v,r,n)}})}function bb(t,e,r,n){var i;do i=kJ(n);while(t.hasNode(i));return r.dummy=e,t.setNode(i,r),i}function znr(t){var e=new Ml().setGraph(t.graph());return rt(t.nodes(),function(r){e.setNode(r,t.node(r))}),rt(t.edges(),function(r){var n=e.edge(r.v,r.w)||{weight:0,minlen:1},i=t.edge(r);e.setEdge(r.v,r.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),e}function r8e(t){var e=new Ml({multigraph:t.isMultigraph()}).setGraph(t.graph());return rt(t.nodes(),function(r){t.children(r).length||e.setNode(r,t.node(r))}),rt(t.edges(),function(r){e.setEdge(r,t.edge(r))}),e}function n8e(t,e){var r=t.x,n=t.y,i=e.x-r,a=e.y-n,s=t.width/2,o=t.height/2;if(!i&&!a)throw new Error("Not possible to find intersection inside of the rectangle");var l,u;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=o*i/a,u=o):(i<0&&(s=-s),l=s,u=s*a/i),{x:r+l,y:n+u}}function q5(t){var e=Qt(_b(a8e(t)+1),function(){return[]});return rt(t.nodes(),function(r){var n=t.node(r),i=n.rank;Xn(i)||(e[i][n.order]=r)}),e}function Vnr(t){var e=yb(Qt(t.nodes(),function(r){return t.node(r).rank}));rt(t.nodes(),function(r){var n=t.node(r);Nr(n,"rank")&&(n.rank-=e)})}function Hnr(t){var e=yb(Qt(t.nodes(),function(a){return t.node(a).rank})),r=[];rt(t.nodes(),function(a){var s=t.node(a).rank-e;r[s]||(r[s]=[]),r[s].push(a)});var n=0,i=t.graph().nodeRankFactor;rt(r,function(a,s){Xn(a)&&s%i!==0?--n:n&&rt(a,function(o){t.node(o).rank+=n})})}function i8e(t,e,r,n){var i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=n),bb(t,"border",i,e)}function a8e(t){return Bv(Qt(t.nodes(),function(e){var r=t.node(e).rank;if(!Xn(r))return r}))}function qnr(t,e){var r={lhs:[],rhs:[]};return rt(t,function(n){e(n)?r.lhs.push(n):r.rhs.push(n)}),r}function Ynr(t,e){return e()}function Wnr(t){function e(r){var n=t.children(r),i=t.node(r);if(n.length&&rt(n,e),Object.prototype.hasOwnProperty.call(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,s=i.maxRank+1;a<s;++a)s8e(t,"borderLeft","_bl",r,i,a),s8e(t,"borderRight","_br",r,i,a)}}rt(t.children(),e)}function s8e(t,e,r,n,i,a){var s={width:0,height:0,rank:a,borderType:e},o=i[e][a-1],l=bb(t,"border",s,r);i[e][a]=l,t.setParent(l,n),o&&t.setEdge(o,l,{weight:1})}function Xnr(t){var e=t.graph().rankdir.toLowerCase();(e==="lr"||e==="rl")&&o8e(t)}function Knr(t){var e=t.graph().rankdir.toLowerCase();(e==="bt"||e==="rl")&&Znr(t),(e==="lr"||e==="rl")&&(jnr(t),o8e(t))}function o8e(t){rt(t.nodes(),function(e){l8e(t.node(e))}),rt(t.edges(),function(e){l8e(t.edge(e))})}function l8e(t){var e=t.width;t.width=t.height,t.height=e}function Znr(t){rt(t.nodes(),function(e){LJ(t.node(e))}),rt(t.edges(),function(e){var r=t.edge(e);rt(r.points,LJ),Object.prototype.hasOwnProperty.call(r,"y")&&LJ(r)})}function LJ(t){t.y=-t.y}function jnr(t){rt(t.nodes(),function(e){MJ(t.node(e))}),rt(t.edges(),function(e){var r=t.edge(e);rt(r.points,MJ),Object.prototype.hasOwnProperty.call(r,"x")&&MJ(r)})}function MJ(t){var e=t.x;t.x=t.y,t.y=e}function Jnr(t){t.graph().dummyChains=[],rt(t.edges(),function(e){eir(t,e)})}function eir(t,e){var r=e.v,n=t.node(r).rank,i=e.w,a=t.node(i).rank,s=e.name,o=t.edge(e),l=o.labelRank;if(a!==n+1){t.removeEdge(e);var u=void 0,h,d;for(d=0,++n;n<a;++d,++n)o.points=[],u={width:0,height:0,edgeLabel:o,edgeObj:e,rank:n},h=bb(t,"edge",u,"_d"),n===l&&(u.width=o.width,u.height=o.height,u.dummy="edge-label",u.labelpos=o.labelpos),t.setEdge(r,h,{weight:o.weight},s),d===0&&t.graph().dummyChains.push(h),r=h;t.setEdge(r,i,{weight:o.weight},s)}}function tir(t){rt(t.graph().dummyChains,function(e){var r=t.node(e),n=r.edgeLabel,i;for(t.setEdge(r.edgeObj,n);r.dummy;)i=t.successors(e)[0],t.removeNode(e),n.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(n.x=r.x,n.y=r.y,n.width=r.width,n.height=r.height),e=i,r=t.node(e)})}function BJ(t){var e={};function r(n){var i=t.node(n);if(Object.prototype.hasOwnProperty.call(e,n))return i.rank;e[n]=!0;var a=yb(Qt(t.outEdges(n),function(s){return r(s.w)-t.edge(s).minlen}));return(a===Number.POSITIVE_INFINITY||a===void 0||a===null)&&(a=0),i.rank=a}rt(t.sources(),r)}function S2(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}function c8e(t){var e=new Ml({directed:!1}),r=t.nodes()[0],n=t.nodeCount();e.setNode(r,{});for(var i,a;rir(e,t)<n;)i=nir(e,t),a=e.hasNode(i.v)?S2(t,i):-S2(t,i),iir(e,t,a);return e}function rir(t,e){function r(n){rt(e.nodeEdges(n),function(i){var a=i.v,s=n===a?i.w:a;!t.hasNode(s)&&!S2(e,i)&&(t.setNode(s,{}),t.setEdge(n,s,{}),r(s))})}return rt(t.nodes(),r),t.nodeCount()}function nir(t,e){return OJ(e.edges(),function(r){if(t.hasNode(r.v)!==t.hasNode(r.w))return S2(e,r)})}function iir(t,e,r){rt(t.nodes(),function(n){e.node(n).rank+=r})}function air(){}air.prototype=new Error;function u8e(t,e,r){dn(e)||(e=[e]);var n=(t.isDirected()?t.successors:t.neighbors).bind(t),i=[],a={};return rt(e,function(s){if(!t.hasNode(s))throw new Error("Graph does not have node: "+s);h8e(t,s,r==="post",a,n,i)}),i}function h8e(t,e,r,n,i,a){Object.prototype.hasOwnProperty.call(n,e)||(n[e]=!0,r||a.push(e),rt(i(e),function(s){h8e(t,s,r,n,i,a)}),r&&a.push(e))}function sir(t,e){return u8e(t,e,"post")}function oir(t,e){return u8e(t,e,"pre")}Fv.initLowLimValues=FJ,Fv.initCutValues=PJ,Fv.calcCutValue=d8e,Fv.leaveEdge=p8e,Fv.enterEdge=g8e,Fv.exchangeEdges=A8e;function Fv(t){t=znr(t),BJ(t);var e=c8e(t);FJ(e),PJ(e,t);for(var r,n;r=p8e(e);)n=g8e(e,t,r),A8e(e,t,r,n)}function PJ(t,e){var r=sir(t,t.nodes());r=r.slice(0,r.length-1),rt(r,function(n){lir(t,e,n)})}function lir(t,e,r){var n=t.node(r),i=n.parent;t.edge(r,i).cutvalue=d8e(t,e,r)}function d8e(t,e,r){var n=t.node(r),i=n.parent,a=!0,s=e.edge(r,i),o=0;return s||(a=!1,s=e.edge(i,r)),o=s.weight,rt(e.nodeEdges(r),function(l){var u=l.v===r,h=u?l.w:l.v;if(h!==i){var d=u===a,f=e.edge(l).weight;if(o+=d?f:-f,uir(t,r,h)){var p=t.edge(r,h).cutvalue;o+=d?-p:p}}}),o}function FJ(t,e){arguments.length<2&&(e=t.nodes()[0]),f8e(t,{},1,e)}function f8e(t,e,r,n,i){var a=r,s=t.node(n);return e[n]=!0,rt(t.neighbors(n),function(o){Object.prototype.hasOwnProperty.call(e,o)||(r=f8e(t,e,r,o,n))}),s.low=a,s.lim=r++,i?s.parent=i:delete s.parent,r}function p8e(t){return dp(t.edges(),function(e){return t.edge(e).cutvalue<0})}function g8e(t,e,r){var n=r.v,i=r.w;e.hasEdge(n,i)||(n=r.w,i=r.v);var a=t.node(n),s=t.node(i),o=a,l=!1;a.lim>s.lim&&(o=s,l=!0);var u=ia(e.edges(),function(h){return l===m8e(t,t.node(h.v),o)&&l!==m8e(t,t.node(h.w),o)});return OJ(u,function(h){return S2(e,h)})}function A8e(t,e,r,n){var i=r.v,a=r.w;t.removeEdge(i,a),t.setEdge(n.v,n.w,{}),FJ(t),PJ(t,e),cir(t,e)}function cir(t,e){var r=dp(t.nodes(),function(i){return!e.node(i).parent}),n=oir(t,r);n=n.slice(1),rt(n,function(i){var a=t.node(i).parent,s=e.edge(i,a),o=!1;s||(s=e.edge(a,i),o=!0),e.node(i).rank=e.node(a).rank+(o?s.minlen:-s.minlen)})}function uir(t,e,r){return t.hasEdge(e,r)}function m8e(t,e,r){return r.low<=e.lim&&e.lim<=r.lim}function hir(t){switch(t.graph().ranker){case"network-simplex":v8e(t);break;case"tight-tree":fir(t);break;case"longest-path":dir(t);break;default:v8e(t)}}var dir=BJ;function fir(t){BJ(t),c8e(t)}function v8e(t){Fv(t)}function pir(t){var e=bb(t,"root",{},"_root"),r=gir(t),n=Bv(fi(r))-1,i=2*n+1;t.graph().nestingRoot=e,rt(t.edges(),function(s){t.edge(s).minlen*=i});var a=Air(t)+1;rt(t.children(),function(s){y8e(t,e,i,a,n,r,s)}),t.graph().nodeRankFactor=i}function y8e(t,e,r,n,i,a,s){var o=t.children(s);if(!o.length){s!==e&&t.setEdge(e,s,{weight:0,minlen:r});return}var l=i8e(t,"_bt"),u=i8e(t,"_bb"),h=t.node(s);t.setParent(l,s),h.borderTop=l,t.setParent(u,s),h.borderBottom=u,rt(o,function(d){y8e(t,e,r,n,i,a,d);var f=t.node(d),p=f.borderTop?f.borderTop:d,g=f.borderBottom?f.borderBottom:d,A=f.borderTop?n:2*n,m=p!==g?1:i-a[s]+1;t.setEdge(l,p,{weight:A,minlen:m,nestingEdge:!0}),t.setEdge(g,u,{weight:A,minlen:m,nestingEdge:!0})}),t.parent(s)||t.setEdge(e,l,{weight:0,minlen:i+a[s]})}function gir(t){var e={};function r(n,i){var a=t.children(n);a&&a.length&&rt(a,function(s){r(s,i+1)}),e[n]=i}return rt(t.children(),function(n){r(n,1)}),e}function Air(t){return Ua(t.edges(),function(e,r){return e+t.edge(r).weight},0)}function mir(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,rt(t.edges(),function(r){var n=t.edge(r);n.nestingEdge&&t.removeEdge(r)})}function vir(t,e,r){var n={},i;rt(r,function(a){for(var s=t.parent(a),o,l;s;){if(o=t.parent(s),o?(l=n[o],n[o]=s):(l=i,i=s),l&&l!==s){e.setEdge(l,s);return}s=o}})}function yir(t,e,r){var n=_ir(t),i=new Ml({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(a){return t.node(a)});return rt(t.nodes(),function(a){var s=t.node(a),o=t.parent(a);(s.rank===e||s.minRank<=e&&e<=s.maxRank)&&(i.setNode(a),i.setParent(a,o||n),rt(t[r](a),function(l){var u=l.v===a?l.w:l.v,h=i.edge(u,a),d=Xn(h)?0:h.weight;i.setEdge(u,a,{weight:t.edge(l).weight+d})}),Object.prototype.hasOwnProperty.call(s,"minRank")&&i.setNode(a,{borderLeft:s.borderLeft[e],borderRight:s.borderRight[e]}))}),i}function _ir(t){for(var e;t.hasNode(e=kJ("_root")););return e}function bir(t,e){for(var r=0,n=1;n<e.length;++n)r+=Sir(t,e[n-1],e[n]);return r}function Sir(t,e,r){for(var n=Inr(r,Qt(r,function(u,h){return h})),i=Os(Qt(e,function(u){return _2(Qt(t.outEdges(u),function(h){return{pos:n[h.w],weight:t.edge(h).weight}}),"pos")})),a=1;a<r.length;)a<<=1;var s=2*a-1;a-=1;var o=Qt(new Array(s),function(){return 0}),l=0;return rt(i.forEach(function(u){var h=u.pos+a;o[h]+=u.weight;for(var d=0;h>0;)h%2&&(d+=o[h+1]),h=h-1>>1,o[h]+=u.weight;l+=u.weight*d})),l}function Eir(t){var e={},r=ia(t.nodes(),function(o){return!t.children(o).length}),n=Bv(Qt(r,function(o){return t.node(o).rank})),i=Qt(_b(n+1),function(){return[]});function a(o){if(!Nr(e,o)){e[o]=!0;var l=t.node(o);i[l.rank].push(o),rt(t.successors(o),a)}}var s=_2(r,function(o){return t.node(o).rank});return rt(s,a),i}function wir(t,e){return Qt(e,function(r){var n=t.inEdges(r);if(n.length){var i=Ua(n,function(a,s){var o=t.edge(s),l=t.node(s.v);return{sum:a.sum+o.weight*l.order,weight:a.weight+o.weight}},{sum:0,weight:0});return{v:r,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:r}})}function xir(t,e){var r={};rt(t,function(i,a){var s=r[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};Xn(i.barycenter)||(s.barycenter=i.barycenter,s.weight=i.weight)}),rt(e.edges(),function(i){var a=r[i.v],s=r[i.w];!Xn(a)&&!Xn(s)&&(s.indegree++,a.out.push(r[i.w]))});var n=ia(r,function(i){return!i.indegree});return Tir(n)}function Tir(t){var e=[];function r(a){return function(s){s.merged||(Xn(s.barycenter)||Xn(a.barycenter)||s.barycenter>=a.barycenter)&&Oir(a,s)}}function n(a){return function(s){s.in.push(a),--s.indegree===0&&t.push(s)}}for(;t.length;){var i=t.pop();e.push(i),rt(i.in.reverse(),r(i)),rt(i.out,n(i))}return Qt(ia(e,function(a){return!a.merged}),function(a){return V5(a,["vs","i","barycenter","weight"])})}function Oir(t,e){var r=0,n=0;t.weight&&(r+=t.barycenter*t.weight,n+=t.weight),e.weight&&(r+=e.barycenter*e.weight,n+=e.weight),t.vs=e.vs.concat(t.vs),t.barycenter=r/n,t.weight=n,t.i=Math.min(e.i,t.i),e.merged=!0}function Cir(t,e){var r=qnr(t,function(h){return Object.prototype.hasOwnProperty.call(h,"barycenter")}),n=r.lhs,i=_2(r.rhs,function(h){return-h.i}),a=[],s=0,o=0,l=0;n.sort(Rir(!!e)),l=_8e(a,i,l),rt(n,function(h){l+=h.vs.length,a.push(h.vs),s+=h.barycenter*h.weight,o+=h.weight,l=_8e(a,i,l)});var u={vs:Os(a)};return o&&(u.barycenter=s/o,u.weight=o),u}function _8e(t,e,r){for(var n;e.length&&(n=wd(e)).i<=r;)e.pop(),t.push(n.vs),r++;return r}function Rir(t){return function(e,r){return e.barycenter<r.barycenter?-1:e.barycenter>r.barycenter?1:t?r.i-e.i:e.i-r.i}}function b8e(t,e,r,n){var i=t.children(e),a=t.node(e),s=a?a.borderLeft:void 0,o=a?a.borderRight:void 0,l={};s&&(i=ia(i,function(g){return g!==s&&g!==o}));var u=wir(t,i);rt(u,function(g){if(t.children(g.v).length){var A=b8e(t,g.v,r,n);l[g.v]=A,Object.prototype.hasOwnProperty.call(A,"barycenter")&&Iir(g,A)}});var h=xir(u,r);kir(h,l);var d=Cir(h,n);if(s&&(d.vs=Os([s,d.vs,o]),t.predecessors(s).length)){var f=t.node(t.predecessors(s)[0]),p=t.node(t.predecessors(o)[0]);Object.prototype.hasOwnProperty.call(d,"barycenter")||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+f.order+p.order)/(d.weight+2),d.weight+=2}return d}function kir(t,e){rt(t,function(r){r.vs=Os(r.vs.map(function(n){return e[n]?e[n].vs:n}))})}function Iir(t,e){Xn(t.barycenter)?(t.barycenter=e.barycenter,t.weight=e.weight):(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight)}function Nir(t){var e=a8e(t),r=S8e(t,_b(1,e+1),"inEdges"),n=S8e(t,_b(e-1,-1,-1),"outEdges"),i=Eir(t);E8e(t,i);for(var a=Number.POSITIVE_INFINITY,s,o=0,l=0;l<4;++o,++l){Dir(o%2?r:n,o%4>=2),i=q5(t);var u=bir(t,i);u<a&&(l=0,s=jtr(i),a=u)}E8e(t,s)}function S8e(t,e,r){return Qt(e,function(n){return yir(t,n,r)})}function Dir(t,e){var r=new Ml;rt(t,function(n){var i=n.graph().root,a=b8e(n,i,r,e);rt(a.vs,function(s,o){n.node(s).order=o}),vir(n,r,a.vs)})}function E8e(t,e){rt(e,function(r){rt(r,function(n,i){t.node(n).order=i})})}function Lir(t){var e=Bir(t);rt(t.graph().dummyChains,function(r){for(var n=t.node(r),i=n.edgeObj,a=Mir(t,e,i.v,i.w),s=a.path,o=a.lca,l=0,u=s[l],h=!0;r!==i.w;){if(n=t.node(r),h){for(;(u=s[l])!==o&&t.node(u).maxRank<n.rank;)l++;u===o&&(h=!1)}if(!h){for(;l<s.length-1&&t.node(u=s[l+1]).minRank<=n.rank;)l++;u=s[l]}t.setParent(r,u),r=t.successors(r)[0]}})}function Mir(t,e,r,n){var i=[],a=[],s=Math.min(e[r].low,e[n].low),o=Math.max(e[r].lim,e[n].lim),l,u;l=r;do l=t.parent(l),i.push(l);while(l&&(e[l].low>s||o>e[l].lim));for(u=l,l=n;(l=t.parent(l))!==u;)a.push(l);return{path:i.concat(a.reverse()),lca:u}}function Bir(t){var e={},r=0;function n(i){var a=r;rt(t.children(i),n),e[i]={low:a,lim:r++}}return rt(t.children(),n),e}function Pir(t,e){var r={};function n(i,a){var s=0,o=0,l=i.length,u=wd(a);return rt(a,function(h,d){var f=Uir(t,h),p=f?t.node(f).order:l;(f||h===u)&&(rt(a.slice(o,d+1),function(g){rt(t.predecessors(g),function(A){var m=t.node(A),v=m.order;(v<s||p<v)&&!(m.dummy&&t.node(g).dummy)&&w8e(r,A,g)})}),o=d+1,s=p)}),a}return Ua(e,n),r}function Fir(t,e){var r={};function n(a,s,o,l,u){var h;rt(_b(s,o),function(d){h=a[d],t.node(h).dummy&&rt(t.predecessors(h),function(f){var p=t.node(f);p.dummy&&(p.order<l||p.order>u)&&w8e(r,f,h)})})}function i(a,s){var o=-1,l,u=0;return rt(s,function(h,d){if(t.node(h).dummy==="border"){var f=t.predecessors(h);f.length&&(l=t.node(f[0]).order,n(s,u,d,o,l),u=d,o=l)}n(s,u,s.length,l,a.length)}),s}return Ua(e,i),r}function Uir(t,e){if(t.node(e).dummy)return dp(t.predecessors(e),function(r){return t.node(r).dummy})}function w8e(t,e,r){if(e>r){var n=e;e=r,r=n}Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=t[e];Object.defineProperty(i,r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function Qir(t,e,r){if(e>r){var n=e;e=r,r=n}return!!t[e]&&Object.prototype.hasOwnProperty.call(t[e],r)}function $ir(t,e,r,n){var i={},a={},s={};return rt(e,function(o){rt(o,function(l,u){i[l]=l,a[l]=l,s[l]=u})}),rt(e,function(o){var l=-1;rt(o,function(u){var h=n(u);if(h.length){h=_2(h,function(A){return s[A]});for(var d=(h.length-1)/2,f=Math.floor(d),p=Math.ceil(d);f<=p;++f){var g=h[f];a[u]===u&&l<s[g]&&!Qir(r,u,g)&&(a[g]=u,a[u]=i[u]=i[g],l=s[g])}}})}),{root:i,align:a}}function Gir(t,e,r,n,i){var a={},s=zir(t,e,r,i),o=i?"borderLeft":"borderRight";function l(d,f){for(var p=s.nodes(),g=p.pop(),A={};g;)A[g]?d(g):(A[g]=!0,p.push(g),p=p.concat(f(g))),g=p.pop()}function u(d){a[d]=s.inEdges(d).reduce(function(f,p){return Math.max(f,a[p.v]+s.edge(p))},0)}function h(d){var f=s.outEdges(d).reduce(function(g,A){return Math.min(g,a[A.w]-s.edge(A))},Number.POSITIVE_INFINITY),p=t.node(d);f!==Number.POSITIVE_INFINITY&&p.borderType!==o&&(a[d]=Math.max(a[d],f))}return l(u,s.predecessors.bind(s)),l(h,s.successors.bind(s)),rt(n,function(d){a[d]=a[r[d]]}),a}function zir(t,e,r,n){var i=new Ml,a=t.graph(),s=Wir(a.nodesep,a.edgesep,n);return rt(e,function(o){var l;rt(o,function(u){var h=r[u];if(i.setNode(h),l){var d=r[l],f=i.edge(d,h);i.setEdge(d,h,Math.max(s(t,u,l),f||0))}l=u})}),i}function Vir(t,e){return OJ(fi(e),function(r){var n=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return Krr(r,function(a,s){var o=Xir(t,s)/2;n=Math.max(a+o,n),i=Math.min(a-o,i)}),n-i})}function Hir(t,e){var r=fi(e),n=yb(r),i=Bv(r);rt(["u","d"],function(a){rt(["l","r"],function(s){var o=a+s,l=t[o],u;if(l!==e){var h=fi(l);u=s==="l"?n-yb(h):i-Bv(h),u&&(t[o]=z5(l,function(d){return d+u}))}})})}function qir(t,e){return z5(t.ul,function(r,n){if(e)return t[e.toLowerCase()][n];var i=_2(Qt(t,n));return(i[1]+i[2])/2})}function Yir(t){var e=q5(t),r=E4(Pir(t,e),Fir(t,e)),n={},i;rt(["u","d"],function(s){i=s==="u"?e:fi(e).reverse(),rt(["l","r"],function(o){o==="r"&&(i=Qt(i,function(d){return fi(d).reverse()}));var l=(s==="u"?t.predecessors:t.successors).bind(t),u=$ir(t,i,r,l),h=Gir(t,i,u.root,u.align,o==="r");o==="r"&&(h=z5(h,function(d){return-d})),n[s+o]=h})});var a=Vir(t,n);return Hir(n,a),qir(n,t.graph().align)}function Wir(t,e,r){return function(n,i,a){var s=n.node(i),o=n.node(a),l=0,u;if(l+=s.width/2,Object.prototype.hasOwnProperty.call(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":u=-s.width/2;break;case"r":u=s.width/2;break}if(u&&(l+=r?u:-u),u=0,l+=(s.dummy?e:t)/2,l+=(o.dummy?e:t)/2,l+=o.width/2,Object.prototype.hasOwnProperty.call(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":u=o.width/2;break;case"r":u=-o.width/2;break}return u&&(l+=r?u:-u),u=0,l}}function Xir(t,e){return t.node(e).width}function Kir(t){t=r8e(t),Zir(t),Zrr(Yir(t),function(e,r){t.node(r).x=e})}function Zir(t){var e=q5(t),r=t.graph().ranksep,n=0;rt(e,function(i){var a=Bv(Qt(i,function(s){return t.node(s).height}));rt(i,function(s){t.node(s).y=n+a/2}),n+=a+r})}function x8e(t,e){var r=Ynr;r("layout",()=>{var n=r(" buildLayoutGraph",()=>lar(t));r(" runLayout",()=>jir(n,r)),r(" updateInputGraph",()=>Jir(t,n))})}function jir(t,e){e(" makeSpaceForEdgeLabels",()=>car(t)),e(" removeSelfEdges",()=>yar(t)),e(" acyclic",()=>Qnr(t)),e(" nestingGraph.run",()=>pir(t)),e(" rank",()=>hir(r8e(t))),e(" injectEdgeLabelProxies",()=>uar(t)),e(" removeEmptyRanks",()=>Hnr(t)),e(" nestingGraph.cleanup",()=>mir(t)),e(" normalizeRanks",()=>Vnr(t)),e(" assignRankMinMax",()=>har(t)),e(" removeEdgeLabelProxies",()=>dar(t)),e(" normalize.run",()=>Jnr(t)),e(" parentDummyChains",()=>Lir(t)),e(" addBorderSegments",()=>Wnr(t)),e(" order",()=>Nir(t)),e(" insertSelfEdges",()=>_ar(t)),e(" adjustCoordinateSystem",()=>Xnr(t)),e(" position",()=>Kir(t)),e(" positionSelfEdges",()=>bar(t)),e(" removeBorderNodes",()=>mar(t)),e(" normalize.undo",()=>tir(t)),e(" fixupEdgeLabelCoords",()=>gar(t)),e(" undoCoordinateSystem",()=>Knr(t)),e(" translateGraph",()=>far(t)),e(" assignNodeIntersects",()=>par(t)),e(" reversePoints",()=>Aar(t)),e(" acyclic.undo",()=>Gnr(t))}function Jir(t,e){rt(t.nodes(),function(r){var n=t.node(r),i=e.node(r);n&&(n.x=i.x,n.y=i.y,e.children(r).length&&(n.width=i.width,n.height=i.height))}),rt(t.edges(),function(r){var n=t.edge(r),i=e.edge(r);n.points=i.points,Object.prototype.hasOwnProperty.call(i,"x")&&(n.x=i.x,n.y=i.y)}),t.graph().width=e.graph().width,t.graph().height=e.graph().height}var ear=["nodesep","edgesep","ranksep","marginx","marginy"],tar={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},rar=["acyclicer","ranker","rankdir","align"],nar=["width","height"],iar={width:0,height:0},aar=["minlen","weight","width","height","labeloffset"],sar={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},oar=["labelpos"];function lar(t){var e=new Ml({multigraph:!0,compound:!0}),r=QJ(t.graph());return e.setGraph(E4({},tar,UJ(r,ear),V5(r,rar))),rt(t.nodes(),function(n){var i=QJ(t.node(n));e.setNode(n,$5(UJ(i,nar),iar)),e.setParent(n,t.parent(n))}),rt(t.edges(),function(n){var i=QJ(t.edge(n));e.setEdge(n,E4({},sar,UJ(i,aar),V5(i,oar)))}),e}function car(t){var e=t.graph();e.ranksep/=2,rt(t.edges(),function(r){var n=t.edge(r);n.minlen*=2,n.labelpos.toLowerCase()!=="c"&&(e.rankdir==="TB"||e.rankdir==="BT"?n.width+=n.labeloffset:n.height+=n.labeloffset)})}function uar(t){rt(t.edges(),function(e){var r=t.edge(e);if(r.width&&r.height){var n=t.node(e.v),i=t.node(e.w),a={rank:(i.rank-n.rank)/2+n.rank,e};bb(t,"edge-proxy",a,"_ep")}})}function har(t){var e=0;rt(t.nodes(),function(r){var n=t.node(r);n.borderTop&&(n.minRank=t.node(n.borderTop).rank,n.maxRank=t.node(n.borderBottom).rank,e=Bv(e,n.maxRank))}),t.graph().maxRank=e}function dar(t){rt(t.nodes(),function(e){var r=t.node(e);r.dummy==="edge-proxy"&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))})}function far(t){var e=Number.POSITIVE_INFINITY,r=0,n=Number.POSITIVE_INFINITY,i=0,a=t.graph(),s=a.marginx||0,o=a.marginy||0;function l(u){var h=u.x,d=u.y,f=u.width,p=u.height;e=Math.min(e,h-f/2),r=Math.max(r,h+f/2),n=Math.min(n,d-p/2),i=Math.max(i,d+p/2)}rt(t.nodes(),function(u){l(t.node(u))}),rt(t.edges(),function(u){var h=t.edge(u);Object.prototype.hasOwnProperty.call(h,"x")&&l(h)}),e-=s,n-=o,rt(t.nodes(),function(u){var h=t.node(u);h.x-=e,h.y-=n}),rt(t.edges(),function(u){var h=t.edge(u);rt(h.points,function(d){d.x-=e,d.y-=n}),Object.prototype.hasOwnProperty.call(h,"x")&&(h.x-=e),Object.prototype.hasOwnProperty.call(h,"y")&&(h.y-=n)}),a.width=r-e+s,a.height=i-n+o}function par(t){rt(t.edges(),function(e){var r=t.edge(e),n=t.node(e.v),i=t.node(e.w),a,s;r.points?(a=r.points[0],s=r.points[r.points.length-1]):(r.points=[],a=i,s=n),r.points.unshift(n8e(n,a)),r.points.push(n8e(i,s))})}function gar(t){rt(t.edges(),function(e){var r=t.edge(e);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function Aar(t){rt(t.edges(),function(e){var r=t.edge(e);r.reversed&&r.points.reverse()})}function mar(t){rt(t.nodes(),function(e){if(t.children(e).length){var r=t.node(e),n=t.node(r.borderTop),i=t.node(r.borderBottom),a=t.node(wd(r.borderLeft)),s=t.node(wd(r.borderRight));r.width=Math.abs(s.x-a.x),r.height=Math.abs(i.y-n.y),r.x=a.x+r.width/2,r.y=n.y+r.height/2}}),rt(t.nodes(),function(e){t.node(e).dummy==="border"&&t.removeNode(e)})}function yar(t){rt(t.edges(),function(e){if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}})}function _ar(t){var e=q5(t);rt(e,function(r){var n=0;rt(r,function(i,a){var s=t.node(i);s.order=a+n,rt(s.selfEdges,function(o){bb(t,"selfedge",{width:o.label.width,height:o.label.height,rank:s.rank,order:a+ ++n,e:o.e,label:o.label},"_se")}),delete s.selfEdges})})}function bar(t){rt(t.nodes(),function(e){var r=t.node(e);if(r.dummy==="selfedge"){var n=t.node(r.e.v),i=n.x+n.width/2,a=n.y,s=r.x-i,o=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:i+2*s/3,y:a-o},{x:i+5*s/6,y:a-o},{x:i+s,y:a},{x:i+5*s/6,y:a+o},{x:i+2*s/3,y:a+o}],r.label.x=r.x,r.label.y=r.y}})}function UJ(t,e){return z5(V5(t,e),Number)}function QJ(t){var e={};return rt(t,function(r,n){e[n.toLowerCase()]=r}),e}function xd(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:Sar(t),edges:Ear(t)};return Xn(t.graph())||(e.value=ss(t.graph())),e}function Sar(t){return Qt(t.nodes(),function(e){var r=t.node(e),n=t.parent(e),i={v:e};return Xn(r)||(i.value=r),Xn(n)||(i.parent=n),i})}function Ear(t){return Qt(t.edges(),function(e){var r=t.edge(e),n={v:e.v,w:e.w};return Xn(e.name)||(n.name=e.name),Xn(r)||(n.value=r),n})}var ln=new Map,Uv=new Map,T8e=new Map,war=k(()=>{Uv.clear(),T8e.clear(),ln.clear()},"clear"),Y5=k((t,e)=>{const r=Uv.get(e)||[];return _e.trace("In isDescendant",e," ",t," = ",r.includes(t)),r.includes(t)},"isDescendant"),xar=k((t,e)=>{const r=Uv.get(e)||[];return _e.info("Descendants of ",e," is ",r),_e.info("Edge is ",t),t.v===e||t.w===e?!1:r?r.includes(t.v)||Y5(t.v,e)||Y5(t.w,e)||r.includes(t.w):(_e.debug("Tilt, ",e,",not in descendants"),!1)},"edgeInCluster"),O8e=k((t,e,r,n)=>{_e.warn("Copying children of ",t,"root",n,"data",e.node(t),n);const i=e.children(t)||[];t!==n&&i.push(t),_e.warn("Copying (nodes) clusterId",t,"nodes",i),i.forEach(a=>{if(e.children(a).length>0)O8e(a,e,r,n);else{const s=e.node(a);_e.info("cp ",a," to ",n," with parent ",t),r.setNode(a,s),n!==e.parent(a)&&(_e.warn("Setting parent",a,e.parent(a)),r.setParent(a,e.parent(a))),t!==n&&a!==t?(_e.debug("Setting parent",a,t),r.setParent(a,t)):(_e.info("In copy ",t,"root",n,"data",e.node(t),n),_e.debug("Not Setting parent for node=",a,"cluster!==rootId",t!==n,"node!==clusterId",a!==t));const o=e.edges(a);_e.debug("Copying Edges",o),o.forEach(l=>{_e.info("Edge",l);const u=e.edge(l.v,l.w,l.name);_e.info("Edge data",u,n);try{xar(l,n)?(_e.info("Copying as ",l.v,l.w,u,l.name),r.setEdge(l.v,l.w,u,l.name),_e.info("newGraph edges ",r.edges(),r.edge(r.edges()[0]))):_e.info("Skipping copy of edge ",l.v,"-->",l.w," rootId: ",n," clusterId:",t)}catch(h){_e.error(h)}})}_e.debug("Removing node",a),e.removeNode(a)})},"copy"),C8e=k((t,e)=>{const r=e.children(t);let n=[...r];for(const i of r)T8e.set(i,t),n=[...n,...C8e(i,e)];return n},"extractDescendants"),Tar=k((t,e,r)=>{const n=t.edges().filter(l=>l.v===e||l.w===e),i=t.edges().filter(l=>l.v===r||l.w===r),a=n.map(l=>({v:l.v===e?r:l.v,w:l.w===e?e:l.w})),s=i.map(l=>({v:l.v,w:l.w}));return a.filter(l=>s.some(u=>l.v===u.v&&l.w===u.w))},"findCommonEdges"),E2=k((t,e,r)=>{const n=e.children(t);if(_e.trace("Searching children of id ",t,n),n.length<1)return t;let i;for(const a of n){const s=E2(a,e,r),o=Tar(e,r,s);if(s)if(o.length>0)i=s;else return s}return i},"findNonClusterChild"),R8e=k(t=>!ln.has(t)||!ln.get(t).externalConnections?t:ln.has(t)?ln.get(t).id:t,"getAnchorId"),Oar=k((t,e)=>{if(!t||e>10){_e.debug("Opting out, no graph ");return}else _e.debug("Opting in, graph ");t.nodes().forEach(function(r){t.children(r).length>0&&(_e.warn("Cluster identified",r," Replacement id in edges: ",E2(r,t,r)),Uv.set(r,C8e(r,t)),ln.set(r,{id:E2(r,t,r),clusterData:t.node(r)}))}),t.nodes().forEach(function(r){const n=t.children(r),i=t.edges();n.length>0?(_e.debug("Cluster identified",r,Uv),i.forEach(a=>{const s=Y5(a.v,r),o=Y5(a.w,r);s^o&&(_e.warn("Edge: ",a," leaves cluster ",r),_e.warn("Descendants of XXX ",r,": ",Uv.get(r)),ln.get(r).externalConnections=!0)})):_e.debug("Not a cluster ",r,Uv)});for(let r of ln.keys()){const n=ln.get(r).id,i=t.parent(n);i!==r&&ln.has(i)&&!ln.get(i).externalConnections&&(ln.get(r).id=i)}t.edges().forEach(function(r){const n=t.edge(r);_e.warn("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(r)),_e.warn("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(t.edge(r)));let i=r.v,a=r.w;if(_e.warn("Fix XXX",ln,"ids:",r.v,r.w,"Translating: ",ln.get(r.v)," --- ",ln.get(r.w)),ln.get(r.v)||ln.get(r.w)){if(_e.warn("Fixing and trying - removing XXX",r.v,r.w,r.name),i=R8e(r.v),a=R8e(r.w),t.removeEdge(r.v,r.w,r.name),i!==r.v){const s=t.parent(i);ln.get(s).externalConnections=!0,n.fromCluster=r.v}if(a!==r.w){const s=t.parent(a);ln.get(s).externalConnections=!0,n.toCluster=r.w}_e.warn("Fix Replacing with XXX",i,a,r.name),t.setEdge(i,a,n,r.name)}}),_e.warn("Adjusted Graph",xd(t)),k8e(t,0),_e.trace(ln)},"adjustClustersAndEdges"),k8e=k((t,e)=>{var i,a;if(_e.warn("extractor - ",e,xd(t),t.children("D")),e>10){_e.error("Bailing out");return}let r=t.nodes(),n=!1;for(const s of r){const o=t.children(s);n=n||o.length>0}if(!n){_e.debug("Done, no node has children",t.nodes());return}_e.debug("Nodes = ",r,e);for(const s of r)if(_e.debug("Extracting node",s,ln,ln.has(s)&&!ln.get(s).externalConnections,!t.parent(s),t.node(s),t.children("D")," Depth ",e),!ln.has(s))_e.debug("Not a cluster",s,e);else if(!ln.get(s).externalConnections&&t.children(s)&&t.children(s).length>0){_e.warn("Cluster without external connections, without a parent and with children",s,e);let l=t.graph().rankdir==="TB"?"LR":"TB";(a=(i=ln.get(s))==null?void 0:i.clusterData)!=null&&a.dir&&(l=ln.get(s).clusterData.dir,_e.warn("Fixing dir",ln.get(s).clusterData.dir,l));const u=new Ml({multigraph:!0,compound:!0}).setGraph({rankdir:l,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});_e.warn("Old graph before copy",xd(t)),O8e(s,t,u,s),t.setNode(s,{clusterNode:!0,id:s,clusterData:ln.get(s).clusterData,label:ln.get(s).label,graph:u}),_e.warn("New graph after copy node: (",s,")",xd(u)),_e.debug("Old graph after copy",xd(t))}else _e.warn("Cluster ** ",s," **not meeting the criteria !externalConnections:",!ln.get(s).externalConnections," no parent: ",!t.parent(s)," children ",t.children(s)&&t.children(s).length>0,t.children("D"),e),_e.debug(ln);r=t.nodes(),_e.warn("New list of nodes",r);for(const s of r){const o=t.node(s);_e.warn(" Now next level",s,o),o!=null&&o.clusterNode&&k8e(o.graph,e+1)}},"extractor"),I8e=k((t,e)=>{if(e.length===0)return[];let r=Object.assign([],e);return e.forEach(n=>{const i=t.children(n),a=I8e(t,i);r=[...r,...a]}),r},"sorter"),Car=k(t=>I8e(t,t.children()),"sortNodesByHierarchy"),N8e=k(async(t,e,r,n,i,a)=>{_e.warn("Graph in recursive render:XAX",xd(e),i);const s=e.graph().rankdir;_e.trace("Dir in recursive render - dir:",s);const o=t.insert("g").attr("class","root");e.nodes()?_e.info("Recursive render XXX",e.nodes()):_e.info("No nodes found for",e),e.edges().length>0&&_e.info("Recursive edges",e.edge(e.edges()[0]));const l=o.insert("g").attr("class","clusters"),u=o.insert("g").attr("class","edgePaths"),h=o.insert("g").attr("class","edgeLabels"),d=o.insert("g").attr("class","nodes");await Promise.all(e.nodes().map(async function(A){const m=e.node(A);if(i!==void 0){const v=JSON.parse(JSON.stringify(i.clusterData));_e.trace(`Setting data for parent cluster XXX
|
|
914
|
+
`)[0].trim();return{line:i,type:a,message:d,code:h,severity:"error"}}return null},handleEditSave(t){if(this.currentComponentId&&this.currentComponentType){const e=this.currentTokenStart,r=this.currentTokenEnd;let n=this.content;if(e!==void 0&&r!==void 0){const i=this.content.substring(0,e),a=this.content.substring(r);n=i+t+a;const s=r-e,l=t.length-s;l!==0&&this.$nextTick(()=>{this._updateSubsequentPositions(r,l)})}else{console.error("未找到精确位置信息,无法进行内容替换");return}this.$emit("update:content",n),this.editModalVisible=!1}},_updateSubsequentPositions(t,e){document.querySelectorAll('[data-editable="true"][data-position]').forEach(n=>{const i=n.getAttribute("data-position");if(!i)return;const[a,s]=i.split(",").map(Number);if(a>=t){const o=a+e,l=s+e;n.setAttribute("data-position",`${o},${l}`)}})},handleEditClose(){this.editModalVisible=!1,this.currentComponentId="",this.currentComponentType="",this.currentEditContent="",this.currentTokenStart=0,this.currentTokenEnd=0},handleEditFromPanel(t,e,r){const[n,i]=r.split(",").map(Number),a=this.content.substring(n,i);this.currentComponentId=t,this.currentComponentType=e,this.currentEditContent=a,this.currentTokenStart=n,this.currentTokenEnd=i,this.editModalVisible=!0},toggleEditor(){this.showEditor=!this.showEditor},toggleFullscreen(){this.isFullscreen=!this.isFullscreen},startResize(t){this.isResizing=!0,document.addEventListener("mousemove",this.handleResize),document.addEventListener("mouseup",this.stopResize),t.preventDefault()},handleResize(t){if(!this.isResizing)return;const n=this.$el.getBoundingClientRect().right-t.clientX;n>=this.minEditorWidth&&n<=this.maxEditorWidth&&(this.editorWidth=n)},stopResize(){this.isResizing=!1,document.removeEventListener("mousemove",this.handleResize),document.removeEventListener("mouseup",this.stopResize),this.$nextTick(()=>{var t;(t=this.chartRenderer)==null||t.processEChartsElements()})},async exportToWord(t="document.docx"){try{const e=this.$el.querySelector(".preview-container");return e?(await this.$nextTick(),await this.wordExporter.exportToWord(this.md,this.content,e,t)):{success:!1,message:"预览容器未找到"}}catch(e){return console.error("导出失败:",e),{success:!1,message:e.message}}}}},aer=["data-theme-mode"],ser=["title"],oer={key:0,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},ler={key:1,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},cer=["innerHTML"];function uer(t,e,r,n,i,a){const s=Dt.resolveComponent("DatasetPanel"),o=Dt.resolveComponent("EditModal");return Dt.openBlock(),Dt.createElementBlock("div",{class:Dt.normalizeClass(["markdown-editor",{"dashboard-mode":i.isDashboardMode,fullscreen:i.isFullscreen}]),"data-theme-mode":a.isDarkMode?"dark":"light",style:Dt.normalizeStyle(a.themeVars)},[i.isDashboardMode&&r.showFullscreenButton?(Dt.openBlock(),Dt.createElementBlock("div",{key:0,class:"fullscreen-toggle",onClick:e[0]||(e[0]=(...l)=>a.toggleFullscreen&&a.toggleFullscreen(...l)),title:i.isFullscreen?"退出全屏":"全屏"},[i.isFullscreen?(Dt.openBlock(),Dt.createElementBlock("svg",ler,[...e[6]||(e[6]=[Dt.createElementVNode("path",{d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"},null,-1)])])):(Dt.openBlock(),Dt.createElementBlock("svg",oer,[...e[5]||(e[5]=[Dt.createElementVNode("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"},null,-1)])]))],8,ser)):Dt.createCommentVNode("",!0),i.isDashboardMode?(Dt.openBlock(),Dt.createBlock(s,{key:1,ref:"datasetPanel"},null,512)):Dt.createCommentVNode("",!0),Dt.createElementVNode("div",{class:Dt.normalizeClass(["preview-container",{"full-width":!i.showEditor}])},[Dt.createElementVNode("div",{class:"markdown-body",innerHTML:a.renderedContent},null,8,cer)],2),r.editable?(Dt.openBlock(),Dt.createElementBlock("div",{key:2,class:Dt.normalizeClass(["resizer",{"resizer-collapsed":!i.showEditor}])},[i.showEditor?(Dt.openBlock(),Dt.createElementBlock("div",{key:0,class:"resizer-draggable",onMousedown:e[1]||(e[1]=(...l)=>a.startResize&&a.startResize(...l))},null,32)):Dt.createCommentVNode("",!0),Dt.createElementVNode("div",{class:"resizer-toggle",onClick:e[2]||(e[2]=(...l)=>a.toggleEditor&&a.toggleEditor(...l))},[Dt.createElementVNode("span",null,Dt.toDisplayString(i.showEditor?"›":"‹"),1)])],2)):Dt.createCommentVNode("",!0),r.editable&&i.showEditor?(Dt.openBlock(),Dt.createElementBlock("div",{key:3,class:"editor-container",style:Dt.normalizeStyle({width:i.editorWidth+"px"})},[Dt.withDirectives(Dt.createElementVNode("textarea",{"onUpdate:modelValue":e[3]||(e[3]=l=>a.contentModel=l),class:"editor",placeholder:"请输入 Markdown 内容..."},null,512),[[Dt.vModelText,a.contentModel]])],4)):Dt.createCommentVNode("",!0),Dt.createVNode(o,{visible:i.editModalVisible,"onUpdate:visible":e[4]||(e[4]=l=>i.editModalVisible=l),content:i.currentEditContent,"component-type":i.currentComponentType,onSave:a.handleEditSave,onClose:a.handleEditClose},null,8,["visible","content","component-type","onSave","onClose"])],14,aer)}const uFe=aK(ier,[["render",uer],["__scopeId","data-v-93810f56"]]);var her="[object Symbol]";function Dv(t){return typeof t=="symbol"||Kc(t)&&If(t)==her}function Lv(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var hFe=Wc?Wc.prototype:void 0,dFe=hFe?hFe.toString:void 0;function fFe(t){if(typeof t=="string")return t;if(dn(t))return Lv(t,fFe)+"";if(Dv(t))return dFe?dFe.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var der=/\s/;function fer(t){for(var e=t.length;e--&&der.test(t.charAt(e)););return e}var per=/^\s+/;function ger(t){return t&&t.slice(0,fer(t)+1).replace(per,"")}var pFe=NaN,Aer=/^[-+]0x[0-9a-f]+$/i,mer=/^0b[01]+$/i,ver=/^0o[0-7]+$/i,yer=parseInt;function _er(t){if(typeof t=="number")return t;if(Dv(t))return pFe;if(kl(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=kl(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=ger(t);var r=mer.test(t);return r||ver.test(t)?yer(t.slice(2),r?2:8):Aer.test(t)?pFe:+t}var gFe=1/0,ber=17976931348623157e292;function B5(t){if(!t)return t===0?t:0;if(t=_er(t),t===gFe||t===-gFe){var e=t<0?-1:1;return e*ber}return t===t?t:0}function P5(t){var e=B5(t),r=e%1;return e===e?r?e-r:e:0}function is(){}function AFe(t,e){for(var r=-1,n=t==null?0:t.length;++r<n&&e(t[r],r,t)!==!1;);return t}function mFe(t,e,r,n){for(var i=t.length,a=r+-1;++a<i;)if(e(t[a],a,t))return a;return-1}function Ser(t){return t!==t}function Eer(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}function pJ(t,e,r){return e===e?Eer(t,e,r):mFe(t,Ser,r)}function vFe(t,e){var r=t==null?0:t.length;return!!r&&pJ(t,e,0)>-1}function as(t){return ed(t)?e2e(t):nke(t)}var wer=Object.prototype,xer=wer.hasOwnProperty,hc=a2e(function(t,e){if(wT(e)||ed(e)){v_(e,as(e),t);return}for(var r in e)xer.call(e,r)&&OT(t,r,e[r])}),Ter=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Oer=/^\w*$/;function gJ(t,e){if(dn(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Dv(t)?!0:Oer.test(t)||!Ter.test(t)||e!=null&&t in Object(e)}var Cer=500;function Rer(t){var e=g_(t,function(n){return r.size===Cer&&r.clear(),n}),r=e.cache;return e}var ker=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ier=/\\(\\)?/g,Ner=Rer(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(ker,function(r,n,i,a){e.push(i?a.replace(Ier,"$1"):n||r)}),e});function yFe(t){return t==null?"":fFe(t)}function F5(t,e){return dn(t)?t:gJ(t,e)?[t]:Ner(yFe(t))}function g2(t){if(typeof t=="string"||Dv(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function U5(t,e){e=F5(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[g2(e[r++])];return r&&r==n?t:void 0}function Der(t,e,r){var n=t==null?void 0:U5(t,e);return n===void 0?r:n}function AJ(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}var _Fe=Wc?Wc.isConcatSpreadable:void 0;function Ler(t){return dn(t)||A_(t)||!!(_Fe&&t&&t[_Fe])}function A2(t,e,r,n,i){var a=-1,s=t.length;for(r||(r=Ler),i||(i=[]);++a<s;){var o=t[a];r(o)?AJ(i,o):n||(i[i.length]=o)}return i}function Os(t){var e=t==null?0:t.length;return e?A2(t):[]}function Mer(t){return i2e(n2e(t,void 0,Os),t+"")}function bFe(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),r=r>i?i:r,r<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var a=Array(i);++n<i;)a[n]=t[n+e];return a}function Ber(t,e,r,n){var i=-1,a=t==null?0:t.length;for(n&&a&&(r=t[++i]);++i<a;)r=e(r,t[i],i,t);return r}function Per(t,e){return t&&v_(e,as(e),t)}function Fer(t,e){return t&&v_(e,Km(e),t)}function mJ(t,e){for(var r=-1,n=t==null?0:t.length,i=0,a=[];++r<n;){var s=t[r];e(s,r,t)&&(a[i++]=s)}return a}function SFe(){return[]}var Uer=Object.prototype,Qer=Uer.propertyIsEnumerable,EFe=Object.getOwnPropertySymbols,vJ=EFe?function(t){return t==null?[]:(t=Object(t),mJ(EFe(t),function(e){return Qer.call(t,e)}))}:SFe;function $er(t,e){return v_(t,vJ(t),e)}var Ger=Object.getOwnPropertySymbols,wFe=Ger?function(t){for(var e=[];t;)AJ(e,vJ(t)),t=Nq(t);return e}:SFe;function zer(t,e){return v_(t,wFe(t),e)}function xFe(t,e,r){var n=e(t);return dn(t)?n:AJ(n,r(t))}function yJ(t){return xFe(t,as,vJ)}function TFe(t){return xFe(t,Km,wFe)}var Ver=Object.prototype,Her=Ver.hasOwnProperty;function qer(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Her.call(t,"index")&&(r.index=t.index,r.input=t.input),r}function Yer(t,e){var r=e?Iq(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Wer=/\w*$/;function Xer(t){var e=new t.constructor(t.source,Wer.exec(t));return e.lastIndex=t.lastIndex,e}var OFe=Wc?Wc.prototype:void 0,CFe=OFe?OFe.valueOf:void 0;function Ker(t){return CFe?Object(CFe.call(t)):{}}var Zer="[object Boolean]",jer="[object Date]",Jer="[object Map]",etr="[object Number]",ttr="[object RegExp]",rtr="[object Set]",ntr="[object String]",itr="[object Symbol]",atr="[object ArrayBuffer]",str="[object DataView]",otr="[object Float32Array]",ltr="[object Float64Array]",ctr="[object Int8Array]",utr="[object Int16Array]",htr="[object Int32Array]",dtr="[object Uint8Array]",ftr="[object Uint8ClampedArray]",ptr="[object Uint16Array]",gtr="[object Uint32Array]";function Atr(t,e,r){var n=t.constructor;switch(e){case atr:return Iq(t);case Zer:case jer:return new n(+t);case str:return Yer(t,r);case otr:case ltr:case ctr:case utr:case htr:case dtr:case ftr:case ptr:case gtr:return $Oe(t,r);case Jer:return new n;case etr:case ntr:return new n(t);case ttr:return Xer(t);case rtr:return new n;case itr:return Ker(t)}}var mtr="[object Map]";function vtr(t){return Kc(t)&&jc(t)==mtr}var RFe=Mg&&Mg.isMap,ytr=RFe?xT(RFe):vtr,_tr="[object Set]";function btr(t){return Kc(t)&&jc(t)==_tr}var kFe=Mg&&Mg.isSet,Str=kFe?xT(kFe):btr,Etr=1,wtr=2,xtr=4,IFe="[object Arguments]",Ttr="[object Array]",Otr="[object Boolean]",Ctr="[object Date]",Rtr="[object Error]",NFe="[object Function]",ktr="[object GeneratorFunction]",Itr="[object Map]",Ntr="[object Number]",DFe="[object Object]",Dtr="[object RegExp]",Ltr="[object Set]",Mtr="[object String]",Btr="[object Symbol]",Ptr="[object WeakMap]",Ftr="[object ArrayBuffer]",Utr="[object DataView]",Qtr="[object Float32Array]",$tr="[object Float64Array]",Gtr="[object Int8Array]",ztr="[object Int16Array]",Vtr="[object Int32Array]",Htr="[object Uint8Array]",qtr="[object Uint8ClampedArray]",Ytr="[object Uint16Array]",Wtr="[object Uint32Array]",wi={};wi[IFe]=wi[Ttr]=wi[Ftr]=wi[Utr]=wi[Otr]=wi[Ctr]=wi[Qtr]=wi[$tr]=wi[Gtr]=wi[ztr]=wi[Vtr]=wi[Itr]=wi[Ntr]=wi[DFe]=wi[Dtr]=wi[Ltr]=wi[Mtr]=wi[Btr]=wi[Htr]=wi[qtr]=wi[Ytr]=wi[Wtr]=!0,wi[Rtr]=wi[NFe]=wi[Ptr]=!1;function m2(t,e,r,n,i,a){var s,o=e&Etr,l=e&wtr,u=e&xtr;if(s!==void 0)return s;if(!kl(t))return t;var h=dn(t);if(h){if(s=qer(t),!o)return GOe(t,s)}else{var d=jc(t),f=d==NFe||d==ktr;if(m_(t))return QOe(t,o);if(d==DFe||d==IFe||f&&!i){if(s=l||f?{}:HOe(t),!o)return l?zer(t,Fer(s,t)):$er(t,Per(s,t))}else{if(!wi[d])return i?t:{};s=Atr(t,d,o)}}a||(a=new Hu);var p=a.get(t);if(p)return p;a.set(t,s),Str(t)?t.forEach(function(m){s.add(m2(m,e,r,m,t,a))}):ytr(t)&&t.forEach(function(m,v){s.set(v,m2(m,e,r,v,t,a))});var g=u?l?TFe:yJ:l?Km:as,A=h?void 0:g(t);return AFe(A||t,function(m,v){A&&(v=m,m=t[v]),OT(s,v,m2(m,e,r,v,t,a))}),s}var Xtr=4;function ss(t){return m2(t,Xtr)}var Ktr=1,Ztr=4;function jtr(t){return m2(t,Ktr|Ztr)}function v2(t){for(var e=-1,r=t==null?0:t.length,n=0,i=[];++e<r;){var a=t[e];a&&(i[n++]=a)}return i}var Jtr="__lodash_hash_undefined__";function err(t){return this.__data__.set(t,Jtr),this}function trr(t){return this.__data__.has(t)}function vb(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Df;++e<r;)this.add(t[e])}vb.prototype.add=vb.prototype.push=err,vb.prototype.has=trr;function LFe(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function _J(t,e){return t.has(e)}var rrr=1,nrr=2;function MFe(t,e,r,n,i,a){var s=r&rrr,o=t.length,l=e.length;if(o!=l&&!(s&&l>o))return!1;var u=a.get(t),h=a.get(e);if(u&&h)return u==e&&h==t;var d=-1,f=!0,p=r&nrr?new vb:void 0;for(a.set(t,e),a.set(e,t);++d<o;){var g=t[d],A=e[d];if(n)var m=s?n(A,g,d,e,t,a):n(g,A,d,t,e,a);if(m!==void 0){if(m)continue;f=!1;break}if(p){if(!LFe(e,function(v,y){if(!_J(p,y)&&(g===v||i(g,v,r,n,a)))return p.push(y)})){f=!1;break}}else if(!(g===A||i(g,A,r,n,a))){f=!1;break}}return a.delete(t),a.delete(e),f}function irr(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}function bJ(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var arr=1,srr=2,orr="[object Boolean]",lrr="[object Date]",crr="[object Error]",urr="[object Map]",hrr="[object Number]",drr="[object RegExp]",frr="[object Set]",prr="[object String]",grr="[object Symbol]",Arr="[object ArrayBuffer]",mrr="[object DataView]",BFe=Wc?Wc.prototype:void 0,SJ=BFe?BFe.valueOf:void 0;function vrr(t,e,r,n,i,a,s){switch(r){case mrr:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Arr:return!(t.byteLength!=e.byteLength||!a(new y4(t),new y4(e)));case orr:case lrr:case hrr:return p_(+t,+e);case crr:return t.name==e.name&&t.message==e.message;case drr:case prr:return t==e+"";case urr:var o=irr;case frr:var l=n&arr;if(o||(o=bJ),t.size!=e.size&&!l)return!1;var u=s.get(t);if(u)return u==e;n|=srr,s.set(t,e);var h=MFe(o(t),o(e),n,i,a,s);return s.delete(t),h;case grr:if(SJ)return SJ.call(t)==SJ.call(e)}return!1}var yrr=1,_rr=Object.prototype,brr=_rr.hasOwnProperty;function Srr(t,e,r,n,i,a){var s=r&yrr,o=yJ(t),l=o.length,u=yJ(e),h=u.length;if(l!=h&&!s)return!1;for(var d=l;d--;){var f=o[d];if(!(s?f in e:brr.call(e,f)))return!1}var p=a.get(t),g=a.get(e);if(p&&g)return p==e&&g==t;var A=!0;a.set(t,e),a.set(e,t);for(var m=s;++d<l;){f=o[d];var v=t[f],y=e[f];if(n)var _=s?n(y,v,f,e,t,a):n(v,y,f,t,e,a);if(!(_===void 0?v===y||i(v,y,r,n,a):_)){A=!1;break}m||(m=f=="constructor")}if(A&&!m){var b=t.constructor,S=e.constructor;b!=S&&"constructor"in t&&"constructor"in e&&!(typeof b=="function"&&b instanceof b&&typeof S=="function"&&S instanceof S)&&(A=!1)}return a.delete(t),a.delete(e),A}var Err=1,PFe="[object Arguments]",FFe="[object Array]",Q5="[object Object]",wrr=Object.prototype,UFe=wrr.hasOwnProperty;function xrr(t,e,r,n,i,a){var s=dn(t),o=dn(e),l=s?FFe:jc(t),u=o?FFe:jc(e);l=l==PFe?Q5:l,u=u==PFe?Q5:u;var h=l==Q5,d=u==Q5,f=l==u;if(f&&m_(t)){if(!m_(e))return!1;s=!0,h=!1}if(f&&!h)return a||(a=new Hu),s||b4(t)?MFe(t,e,r,n,i,a):vrr(t,e,l,r,n,i,a);if(!(r&Err)){var p=h&&UFe.call(t,"__wrapped__"),g=d&&UFe.call(e,"__wrapped__");if(p||g){var A=p?t.value():t,m=g?e.value():e;return a||(a=new Hu),i(A,m,r,n,a)}}return f?(a||(a=new Hu),Srr(t,e,r,n,i,a)):!1}function EJ(t,e,r,n,i){return t===e?!0:t==null||e==null||!Kc(t)&&!Kc(e)?t!==t&&e!==e:xrr(t,e,r,n,EJ,i)}var Trr=1,Orr=2;function Crr(t,e,r,n){var i=r.length,a=i;if(t==null)return!a;for(t=Object(t);i--;){var s=r[i];if(s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++i<a;){s=r[i];var o=s[0],l=t[o],u=s[1];if(s[2]){if(l===void 0&&!(o in t))return!1}else{var h=new Hu,d;if(!(d===void 0?EJ(u,l,Trr|Orr,n,h):d))return!1}}return!0}function QFe(t){return t===t&&!kl(t)}function Rrr(t){for(var e=as(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,QFe(i)]}return e}function $Fe(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function krr(t){var e=Rrr(t);return e.length==1&&e[0][2]?$Fe(e[0][0],e[0][1]):function(r){return r===t||Crr(r,t,e)}}function Irr(t,e){return t!=null&&e in Object(t)}function GFe(t,e,r){e=F5(e,t);for(var n=-1,i=e.length,a=!1;++n<i;){var s=g2(e[n]);if(!(a=t!=null&&r(t,s)))break;t=t[s]}return a||++n!=i?a:(i=t==null?0:t.length,!!i&&Dq(i)&&S4(s,i)&&(dn(t)||A_(t)))}function zFe(t,e){return t!=null&&GFe(t,e,Irr)}var Nrr=1,Drr=2;function Lrr(t,e){return gJ(t)&&QFe(e)?$Fe(g2(t),e):function(r){var n=Der(r,t);return n===void 0&&n===e?zFe(r,t):EJ(e,n,Nrr|Drr)}}function Mrr(t){return function(e){return e==null?void 0:e[t]}}function Brr(t){return function(e){return U5(e,t)}}function Prr(t){return gJ(t)?Mrr(g2(t)):Brr(t)}function Dl(t){return typeof t=="function"?t:t==null?Lf:typeof t=="object"?dn(t)?Lrr(t[0],t[1]):krr(t):Prr(t)}function Frr(t,e,r,n){for(var i=-1,a=t==null?0:t.length;++i<a;){var s=t[i];e(n,s,r(s),t)}return n}function wJ(t,e){return t&&kq(t,e,as)}function Urr(t,e){return function(r,n){if(r==null)return r;if(!ed(r))return t(r,n);for(var i=r.length,a=-1,s=Object(r);++a<i&&n(s[a],a,s)!==!1;);return r}}var Mv=Urr(wJ);function Qrr(t,e,r,n){return Mv(t,function(i,a,s){e(n,i,r(i),s)}),n}function $rr(t,e){return function(r,n){var i=dn(r)?Frr:Qrr,a=e?e():{};return i(r,t,Dl(n),a)}}var VFe=Object.prototype,Grr=VFe.hasOwnProperty,$5=CT(function(t,e){t=Object(t);var r=-1,n=e.length,i=n>2?e[2]:void 0;for(i&&RT(e[0],e[1],i)&&(n=1);++r<n;)for(var a=e[r],s=Km(a),o=-1,l=s.length;++o<l;){var u=s[o],h=t[u];(h===void 0||p_(h,VFe[u])&&!Grr.call(t,u))&&(t[u]=a[u])}return t}),zrr=200;function Vrr(t,e,r,n){var i=-1,a=vFe,s=!0,o=t.length,l=[],u=e.length;if(!o)return l;e.length>=zrr&&(a=_J,s=!1,e=new vb(e));e:for(;++i<o;){var h=t[i],d=h;if(h=h!==0?h:0,s&&d===d){for(var f=u;f--;)if(e[f]===d)continue e;l.push(h)}else a(e,d,n)||l.push(h)}return l}var G5=CT(function(t,e){return _4(t)?Vrr(t,A2(e,1,_4,!0)):[]});function wd(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}function Ys(t,e,r){var n=t==null?0:t.length;return n?(e=e===void 0?1:P5(e),bFe(t,e<0?0:e,n)):[]}function y2(t,e,r){var n=t==null?0:t.length;return n?(e=e===void 0?1:P5(e),e=n-e,bFe(t,0,e<0?0:e)):[]}function xJ(t){return typeof t=="function"?t:Lf}function rt(t,e){var r=dn(t)?AFe:Mv;return r(t,xJ(e))}function Hrr(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(!e(t[r],r,t))return!1;return!0}function qrr(t,e){var r=!0;return Mv(t,function(n,i,a){return r=!!e(n,i,a),r}),r}function nh(t,e,r){var n=dn(t)?Hrr:qrr;return n(t,Dl(e))}function HFe(t,e){var r=[];return Mv(t,function(n,i,a){e(n,i,a)&&r.push(n)}),r}function ia(t,e){var r=dn(t)?mJ:HFe;return r(t,Dl(e))}function Yrr(t){return function(e,r,n){var i=Object(e);if(!ed(e)){var a=Dl(r);e=as(e),r=function(o){return a(i[o],o,i)}}var s=t(e,r,n);return s>-1?i[a?e[s]:s]:void 0}}var Wrr=Math.max;function Xrr(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:P5(r);return i<0&&(i=Wrr(n+i,0)),mFe(t,Dl(e),i)}var dp=Yrr(Xrr);function ih(t){return t&&t.length?t[0]:void 0}function qFe(t,e){var r=-1,n=ed(t)?Array(t.length):[];return Mv(t,function(i,a,s){n[++r]=e(i,a,s)}),n}function Qt(t,e){var r=dn(t)?Lv:qFe;return r(t,Dl(e))}function dc(t,e){return A2(Qt(t,e))}function Krr(t,e){return t==null?t:kq(t,xJ(e),Km)}function Zrr(t,e){return t&&wJ(t,xJ(e))}var jrr=Object.prototype,Jrr=jrr.hasOwnProperty,enr=$rr(function(t,e,r){Jrr.call(t,r)?t[r].push(e):ET(t,r,[e])});function tnr(t,e){return t>e}var rnr=Object.prototype,nnr=rnr.hasOwnProperty;function inr(t,e){return t!=null&&nnr.call(t,e)}function Nr(t,e){return t!=null&&GFe(t,e,inr)}var anr="[object String]";function Ll(t){return typeof t=="string"||!dn(t)&&Kc(t)&&If(t)==anr}function snr(t,e){return Lv(e,function(r){return t[r]})}function fi(t){return t==null?[]:snr(t,as(t))}var onr=Math.max;function cl(t,e,r,n){t=ed(t)?t:fi(t),r=r?P5(r):0;var i=t.length;return r<0&&(r=onr(i+r,0)),Ll(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&pJ(t,e,r)>-1}function YFe(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=0;return pJ(t,e,i)}var lnr="[object RegExp]";function cnr(t){return Kc(t)&&If(t)==lnr}var WFe=Mg&&Mg.isRegExp,fp=WFe?xT(WFe):cnr;function Xn(t){return t===void 0}function XFe(t,e){return t<e}function z5(t,e){var r={};return e=Dl(e),wJ(t,function(n,i,a){ET(r,i,e(n,i,a))}),r}function TJ(t,e,r){for(var n=-1,i=t.length;++n<i;){var a=t[n],s=e(a);if(s!=null&&(o===void 0?s===s&&!Dv(s):r(s,o)))var o=s,l=a}return l}function Bv(t){return t&&t.length?TJ(t,Lf,tnr):void 0}function yb(t){return t&&t.length?TJ(t,Lf,XFe):void 0}function OJ(t,e){return t&&t.length?TJ(t,Dl(e),XFe):void 0}var unr="Expected a function";function hnr(t){if(typeof t!="function")throw new TypeError(unr);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function dnr(t,e,r,n){if(!kl(t))return t;e=F5(e,t);for(var i=-1,a=e.length,s=a-1,o=t;o!=null&&++i<a;){var l=g2(e[i]),u=r;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(i!=s){var h=o[l];u=void 0,u===void 0&&(u=kl(h)?h:S4(e[i+1])?[]:{})}OT(o,l,u),o=o[l]}return t}function KFe(t,e,r){for(var n=-1,i=e.length,a={};++n<i;){var s=e[n],o=U5(t,s);r(o,s)&&dnr(a,F5(s,t),o)}return a}function ah(t,e){if(t==null)return{};var r=Lv(TFe(t),function(n){return[n]});return e=Dl(e),KFe(t,r,function(n,i){return e(n,i[0])})}function fnr(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}function pnr(t,e){if(t!==e){var r=t!==void 0,n=t===null,i=t===t,a=Dv(t),s=e!==void 0,o=e===null,l=e===e,u=Dv(e);if(!o&&!u&&!a&&t>e||a&&s&&l&&!o&&!u||n&&s&&l||!r&&l||!i)return 1;if(!n&&!a&&!u&&t<e||u&&r&&i&&!n&&!a||o&&r&&i||!s&&i||!l)return-1}return 0}function gnr(t,e,r){for(var n=-1,i=t.criteria,a=e.criteria,s=i.length,o=r.length;++n<s;){var l=pnr(i[n],a[n]);if(l){if(n>=o)return l;var u=r[n];return l*(u=="desc"?-1:1)}}return t.index-e.index}function Anr(t,e,r){e.length?e=Lv(e,function(a){return dn(a)?function(s){return U5(s,a.length===1?a[0]:a)}:a}):e=[Lf];var n=-1;e=Lv(e,xT(Dl));var i=qFe(t,function(a,s,o){var l=Lv(e,function(u){return u(a)});return{criteria:l,index:++n,value:a}});return fnr(i,function(a,s){return gnr(a,s,r)})}function mnr(t,e){return KFe(t,e,function(r,n){return zFe(t,n)})}var V5=Mer(function(t,e){return t==null?{}:mnr(t,e)}),vnr=Math.ceil,ynr=Math.max;function _nr(t,e,r,n){for(var i=-1,a=ynr(vnr((e-t)/(r||1)),0),s=Array(a);a--;)s[++i]=t,t+=r;return s}function bnr(t){return function(e,r,n){return n&&typeof n!="number"&&RT(e,r,n)&&(r=n=void 0),e=B5(e),r===void 0?(r=e,e=0):r=B5(r),n=n===void 0?e<r?1:-1:B5(n),_nr(e,r,n)}}var _b=bnr();function Snr(t,e,r,n,i){return i(t,function(a,s,o){r=n?(n=!1,a):e(r,a,s,o)}),r}function Ua(t,e,r){var n=dn(t)?Ber:Snr,i=arguments.length<3;return n(t,Dl(e),r,i,Mv)}function H5(t,e){var r=dn(t)?mJ:HFe;return r(t,hnr(Dl(e)))}function Enr(t,e){var r;return Mv(t,function(n,i,a){return r=e(n,i,a),!r}),!!r}function ZFe(t,e,r){var n=dn(t)?LFe:Enr;return n(t,Dl(e))}var _2=CT(function(t,e){if(t==null)return[];var r=e.length;return r>1&&RT(t,e[0],e[1])?e=[]:r>2&&RT(e[0],e[1],e[2])&&(e=[e[0]]),Anr(t,A2(e),[])}),wnr=1/0,xnr=R_&&1/bJ(new R_([,-0]))[1]==wnr?function(t){return new R_(t)}:is,Tnr=200;function CJ(t,e,r){var n=-1,i=vFe,a=t.length,s=!0,o=[],l=o;if(a>=Tnr){var u=e?null:xnr(t);if(u)return bJ(u);s=!1,i=_J,l=new vb}else l=e?[]:o;e:for(;++n<a;){var h=t[n],d=e?e(h):h;if(h=h!==0?h:0,s&&d===d){for(var f=l.length;f--;)if(l[f]===d)continue e;e&&l.push(d),o.push(h)}else i(l,d,r)||(l!==o&&l.push(d),o.push(h))}return o}var Onr=CT(function(t){return CJ(A2(t,1,_4,!0))});function RJ(t){return t&&t.length?CJ(t):[]}function Cnr(t,e){return t&&t.length?CJ(t,Dl(e)):[]}var Rnr=0;function kJ(t){var e=++Rnr;return yFe(t)+e}function knr(t,e,r){for(var n=-1,i=t.length,a=e.length,s={};++n<i;){var o=n<a?e[n]:void 0;r(s,t[n],o)}return s}function Inr(t,e){return knr(t||[],e||[],OT)}var Nnr="\0",Pv="\0",jFe="";class Ml{constructor(e={}){this._isDirected=Object.prototype.hasOwnProperty.call(e,"directed")?e.directed:!0,this._isMultigraph=Object.prototype.hasOwnProperty.call(e,"multigraph")?e.multigraph:!1,this._isCompound=Object.prototype.hasOwnProperty.call(e,"compound")?e.compound:!1,this._label=void 0,this._defaultNodeLabelFn=y_(void 0),this._defaultEdgeLabelFn=y_(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[Pv]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return Xc(e)||(e=y_(e)),this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return as(this._nodes)}sources(){var e=this;return ia(this.nodes(),function(r){return Gn(e._in[r])})}sinks(){var e=this;return ia(this.nodes(),function(r){return Gn(e._out[r])})}setNodes(e,r){var n=arguments,i=this;return rt(e,function(a){n.length>1?i.setNode(a,r):i.setNode(a)}),this}setNode(e,r){return Object.prototype.hasOwnProperty.call(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=r),this):(this._nodes[e]=arguments.length>1?r:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=Pv,this._children[e]={},this._children[Pv][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.prototype.hasOwnProperty.call(this._nodes,e)}removeNode(e){if(Object.prototype.hasOwnProperty.call(this._nodes,e)){var r=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],rt(this.children(e),n=>{this.setParent(n)}),delete this._children[e]),rt(as(this._in[e]),r),delete this._in[e],delete this._preds[e],rt(as(this._out[e]),r),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(Xn(r))r=Pv;else{r+="";for(var n=r;!Xn(n);n=this.parent(n))if(n===e)throw new Error("Setting "+r+" as parent of "+e+" would create a cycle");this.setNode(r)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=r,this._children[r][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var r=this._parent[e];if(r!==Pv)return r}}children(e){if(Xn(e)&&(e=Pv),this._isCompound){var r=this._children[e];if(r)return as(r)}else{if(e===Pv)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var r=this._preds[e];if(r)return as(r)}successors(e){var r=this._sucs[e];if(r)return as(r)}neighbors(e){var r=this.predecessors(e);if(r)return Onr(r,this.successors(e))}isLeaf(e){var r;return this.isDirected()?r=this.successors(e):r=this.neighbors(e),r.length===0}filterNodes(e){var r=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});r.setGraph(this.graph());var n=this;rt(this._nodes,function(s,o){e(o)&&r.setNode(o,s)}),rt(this._edgeObjs,function(s){r.hasNode(s.v)&&r.hasNode(s.w)&&r.setEdge(s,n.edge(s))});var i={};function a(s){var o=n.parent(s);return o===void 0||r.hasNode(o)?(i[s]=o,o):o in i?i[o]:a(o)}return this._isCompound&&rt(r.nodes(),function(s){r.setParent(s,a(s))}),r}setDefaultEdgeLabel(e){return Xc(e)||(e=y_(e)),this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return fi(this._edgeObjs)}setPath(e,r){var n=this,i=arguments;return Ua(e,function(a,s){return i.length>1?n.setEdge(a,s,r):n.setEdge(a,s),s}),this}setEdge(){var e,r,n,i,a=!1,s=arguments[0];typeof s=="object"&&s!==null&&"v"in s?(e=s.v,r=s.w,n=s.name,arguments.length===2&&(i=arguments[1],a=!0)):(e=s,r=arguments[1],n=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),e=""+e,r=""+r,Xn(n)||(n=""+n);var o=b2(this._isDirected,e,r,n);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,o))return a&&(this._edgeLabels[o]=i),this;if(!Xn(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(r),this._edgeLabels[o]=a?i:this._defaultEdgeLabelFn(e,r,n);var l=Dnr(this._isDirected,e,r,n);return e=l.v,r=l.w,Object.freeze(l),this._edgeObjs[o]=l,JFe(this._preds[r],e),JFe(this._sucs[e],r),this._in[r][o]=l,this._out[e][o]=l,this._edgeCount++,this}edge(e,r,n){var i=arguments.length===1?IJ(this._isDirected,arguments[0]):b2(this._isDirected,e,r,n);return this._edgeLabels[i]}hasEdge(e,r,n){var i=arguments.length===1?IJ(this._isDirected,arguments[0]):b2(this._isDirected,e,r,n);return Object.prototype.hasOwnProperty.call(this._edgeLabels,i)}removeEdge(e,r,n){var i=arguments.length===1?IJ(this._isDirected,arguments[0]):b2(this._isDirected,e,r,n),a=this._edgeObjs[i];return a&&(e=a.v,r=a.w,delete this._edgeLabels[i],delete this._edgeObjs[i],e8e(this._preds[r],e),e8e(this._sucs[e],r),delete this._in[r][i],delete this._out[e][i],this._edgeCount--),this}inEdges(e,r){var n=this._in[e];if(n){var i=fi(n);return r?ia(i,function(a){return a.v===r}):i}}outEdges(e,r){var n=this._out[e];if(n){var i=fi(n);return r?ia(i,function(a){return a.w===r}):i}}nodeEdges(e,r){var n=this.inEdges(e,r);if(n)return n.concat(this.outEdges(e,r))}}Ml.prototype._nodeCount=0,Ml.prototype._edgeCount=0;function JFe(t,e){t[e]?t[e]++:t[e]=1}function e8e(t,e){--t[e]||delete t[e]}function b2(t,e,r,n){var i=""+e,a=""+r;if(!t&&i>a){var s=i;i=a,a=s}return i+jFe+a+jFe+(Xn(n)?Nnr:n)}function Dnr(t,e,r,n){var i=""+e,a=""+r;if(!t&&i>a){var s=i;i=a,a=s}var o={v:i,w:a};return n&&(o.name=n),o}function IJ(t,e){return b2(t,e.v,e.w,e.name)}class Lnr{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,r=e._prev;if(r!==e)return t8e(r),r}enqueue(e){var r=this._sentinel;e._prev&&e._next&&t8e(e),e._next=r._next,r._next._prev=e,r._next=e,e._prev=r}toString(){for(var e=[],r=this._sentinel,n=r._prev;n!==r;)e.push(JSON.stringify(n,Mnr)),n=n._prev;return"["+e.join(", ")+"]"}}function t8e(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function Mnr(t,e){if(t!=="_next"&&t!=="_prev")return e}var Bnr=y_(1);function Pnr(t,e){if(t.nodeCount()<=1)return[];var r=Unr(t,e||Bnr),n=Fnr(r.graph,r.buckets,r.zeroIdx);return Os(Qt(n,function(i){return t.outEdges(i.v,i.w)}))}function Fnr(t,e,r){for(var n=[],i=e[e.length-1],a=e[0],s;t.nodeCount();){for(;s=a.dequeue();)NJ(t,e,r,s);for(;s=i.dequeue();)NJ(t,e,r,s);if(t.nodeCount()){for(var o=e.length-2;o>0;--o)if(s=e[o].dequeue(),s){n=n.concat(NJ(t,e,r,s,!0));break}}}return n}function NJ(t,e,r,n,i){var a=i?[]:void 0;return rt(t.inEdges(n.v),function(s){var o=t.edge(s),l=t.node(s.v);i&&a.push({v:s.v,w:s.w}),l.out-=o,DJ(e,r,l)}),rt(t.outEdges(n.v),function(s){var o=t.edge(s),l=s.w,u=t.node(l);u.in-=o,DJ(e,r,u)}),t.removeNode(n.v),a}function Unr(t,e){var r=new Ml,n=0,i=0;rt(t.nodes(),function(o){r.setNode(o,{v:o,in:0,out:0})}),rt(t.edges(),function(o){var l=r.edge(o.v,o.w)||0,u=e(o),h=l+u;r.setEdge(o.v,o.w,h),i=Math.max(i,r.node(o.v).out+=u),n=Math.max(n,r.node(o.w).in+=u)});var a=_b(i+n+3).map(function(){return new Lnr}),s=n+1;return rt(r.nodes(),function(o){DJ(a,s,r.node(o))}),{graph:r,buckets:a,zeroIdx:s}}function DJ(t,e,r){r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)}function Qnr(t){var e=t.graph().acyclicer==="greedy"?Pnr(t,r(t)):$nr(t);rt(e,function(n){var i=t.edge(n);t.removeEdge(n),i.forwardName=n.name,i.reversed=!0,t.setEdge(n.w,n.v,i,kJ("rev"))});function r(n){return function(i){return n.edge(i).weight}}}function $nr(t){var e=[],r={},n={};function i(a){Object.prototype.hasOwnProperty.call(n,a)||(n[a]=!0,r[a]=!0,rt(t.outEdges(a),function(s){Object.prototype.hasOwnProperty.call(r,s.w)?e.push(s):i(s.w)}),delete r[a])}return rt(t.nodes(),i),e}function Gnr(t){rt(t.edges(),function(e){var r=t.edge(e);if(r.reversed){t.removeEdge(e);var n=r.forwardName;delete r.reversed,delete r.forwardName,t.setEdge(e.w,e.v,r,n)}})}function bb(t,e,r,n){var i;do i=kJ(n);while(t.hasNode(i));return r.dummy=e,t.setNode(i,r),i}function znr(t){var e=new Ml().setGraph(t.graph());return rt(t.nodes(),function(r){e.setNode(r,t.node(r))}),rt(t.edges(),function(r){var n=e.edge(r.v,r.w)||{weight:0,minlen:1},i=t.edge(r);e.setEdge(r.v,r.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),e}function r8e(t){var e=new Ml({multigraph:t.isMultigraph()}).setGraph(t.graph());return rt(t.nodes(),function(r){t.children(r).length||e.setNode(r,t.node(r))}),rt(t.edges(),function(r){e.setEdge(r,t.edge(r))}),e}function n8e(t,e){var r=t.x,n=t.y,i=e.x-r,a=e.y-n,s=t.width/2,o=t.height/2;if(!i&&!a)throw new Error("Not possible to find intersection inside of the rectangle");var l,u;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=o*i/a,u=o):(i<0&&(s=-s),l=s,u=s*a/i),{x:r+l,y:n+u}}function q5(t){var e=Qt(_b(a8e(t)+1),function(){return[]});return rt(t.nodes(),function(r){var n=t.node(r),i=n.rank;Xn(i)||(e[i][n.order]=r)}),e}function Vnr(t){var e=yb(Qt(t.nodes(),function(r){return t.node(r).rank}));rt(t.nodes(),function(r){var n=t.node(r);Nr(n,"rank")&&(n.rank-=e)})}function Hnr(t){var e=yb(Qt(t.nodes(),function(a){return t.node(a).rank})),r=[];rt(t.nodes(),function(a){var s=t.node(a).rank-e;r[s]||(r[s]=[]),r[s].push(a)});var n=0,i=t.graph().nodeRankFactor;rt(r,function(a,s){Xn(a)&&s%i!==0?--n:n&&rt(a,function(o){t.node(o).rank+=n})})}function i8e(t,e,r,n){var i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=n),bb(t,"border",i,e)}function a8e(t){return Bv(Qt(t.nodes(),function(e){var r=t.node(e).rank;if(!Xn(r))return r}))}function qnr(t,e){var r={lhs:[],rhs:[]};return rt(t,function(n){e(n)?r.lhs.push(n):r.rhs.push(n)}),r}function Ynr(t,e){return e()}function Wnr(t){function e(r){var n=t.children(r),i=t.node(r);if(n.length&&rt(n,e),Object.prototype.hasOwnProperty.call(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,s=i.maxRank+1;a<s;++a)s8e(t,"borderLeft","_bl",r,i,a),s8e(t,"borderRight","_br",r,i,a)}}rt(t.children(),e)}function s8e(t,e,r,n,i,a){var s={width:0,height:0,rank:a,borderType:e},o=i[e][a-1],l=bb(t,"border",s,r);i[e][a]=l,t.setParent(l,n),o&&t.setEdge(o,l,{weight:1})}function Xnr(t){var e=t.graph().rankdir.toLowerCase();(e==="lr"||e==="rl")&&o8e(t)}function Knr(t){var e=t.graph().rankdir.toLowerCase();(e==="bt"||e==="rl")&&Znr(t),(e==="lr"||e==="rl")&&(jnr(t),o8e(t))}function o8e(t){rt(t.nodes(),function(e){l8e(t.node(e))}),rt(t.edges(),function(e){l8e(t.edge(e))})}function l8e(t){var e=t.width;t.width=t.height,t.height=e}function Znr(t){rt(t.nodes(),function(e){LJ(t.node(e))}),rt(t.edges(),function(e){var r=t.edge(e);rt(r.points,LJ),Object.prototype.hasOwnProperty.call(r,"y")&&LJ(r)})}function LJ(t){t.y=-t.y}function jnr(t){rt(t.nodes(),function(e){MJ(t.node(e))}),rt(t.edges(),function(e){var r=t.edge(e);rt(r.points,MJ),Object.prototype.hasOwnProperty.call(r,"x")&&MJ(r)})}function MJ(t){var e=t.x;t.x=t.y,t.y=e}function Jnr(t){t.graph().dummyChains=[],rt(t.edges(),function(e){eir(t,e)})}function eir(t,e){var r=e.v,n=t.node(r).rank,i=e.w,a=t.node(i).rank,s=e.name,o=t.edge(e),l=o.labelRank;if(a!==n+1){t.removeEdge(e);var u=void 0,h,d;for(d=0,++n;n<a;++d,++n)o.points=[],u={width:0,height:0,edgeLabel:o,edgeObj:e,rank:n},h=bb(t,"edge",u,"_d"),n===l&&(u.width=o.width,u.height=o.height,u.dummy="edge-label",u.labelpos=o.labelpos),t.setEdge(r,h,{weight:o.weight},s),d===0&&t.graph().dummyChains.push(h),r=h;t.setEdge(r,i,{weight:o.weight},s)}}function tir(t){rt(t.graph().dummyChains,function(e){var r=t.node(e),n=r.edgeLabel,i;for(t.setEdge(r.edgeObj,n);r.dummy;)i=t.successors(e)[0],t.removeNode(e),n.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(n.x=r.x,n.y=r.y,n.width=r.width,n.height=r.height),e=i,r=t.node(e)})}function BJ(t){var e={};function r(n){var i=t.node(n);if(Object.prototype.hasOwnProperty.call(e,n))return i.rank;e[n]=!0;var a=yb(Qt(t.outEdges(n),function(s){return r(s.w)-t.edge(s).minlen}));return(a===Number.POSITIVE_INFINITY||a===void 0||a===null)&&(a=0),i.rank=a}rt(t.sources(),r)}function S2(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}function c8e(t){var e=new Ml({directed:!1}),r=t.nodes()[0],n=t.nodeCount();e.setNode(r,{});for(var i,a;rir(e,t)<n;)i=nir(e,t),a=e.hasNode(i.v)?S2(t,i):-S2(t,i),iir(e,t,a);return e}function rir(t,e){function r(n){rt(e.nodeEdges(n),function(i){var a=i.v,s=n===a?i.w:a;!t.hasNode(s)&&!S2(e,i)&&(t.setNode(s,{}),t.setEdge(n,s,{}),r(s))})}return rt(t.nodes(),r),t.nodeCount()}function nir(t,e){return OJ(e.edges(),function(r){if(t.hasNode(r.v)!==t.hasNode(r.w))return S2(e,r)})}function iir(t,e,r){rt(t.nodes(),function(n){e.node(n).rank+=r})}function air(){}air.prototype=new Error;function u8e(t,e,r){dn(e)||(e=[e]);var n=(t.isDirected()?t.successors:t.neighbors).bind(t),i=[],a={};return rt(e,function(s){if(!t.hasNode(s))throw new Error("Graph does not have node: "+s);h8e(t,s,r==="post",a,n,i)}),i}function h8e(t,e,r,n,i,a){Object.prototype.hasOwnProperty.call(n,e)||(n[e]=!0,r||a.push(e),rt(i(e),function(s){h8e(t,s,r,n,i,a)}),r&&a.push(e))}function sir(t,e){return u8e(t,e,"post")}function oir(t,e){return u8e(t,e,"pre")}Fv.initLowLimValues=FJ,Fv.initCutValues=PJ,Fv.calcCutValue=d8e,Fv.leaveEdge=p8e,Fv.enterEdge=g8e,Fv.exchangeEdges=A8e;function Fv(t){t=znr(t),BJ(t);var e=c8e(t);FJ(e),PJ(e,t);for(var r,n;r=p8e(e);)n=g8e(e,t,r),A8e(e,t,r,n)}function PJ(t,e){var r=sir(t,t.nodes());r=r.slice(0,r.length-1),rt(r,function(n){lir(t,e,n)})}function lir(t,e,r){var n=t.node(r),i=n.parent;t.edge(r,i).cutvalue=d8e(t,e,r)}function d8e(t,e,r){var n=t.node(r),i=n.parent,a=!0,s=e.edge(r,i),o=0;return s||(a=!1,s=e.edge(i,r)),o=s.weight,rt(e.nodeEdges(r),function(l){var u=l.v===r,h=u?l.w:l.v;if(h!==i){var d=u===a,f=e.edge(l).weight;if(o+=d?f:-f,uir(t,r,h)){var p=t.edge(r,h).cutvalue;o+=d?-p:p}}}),o}function FJ(t,e){arguments.length<2&&(e=t.nodes()[0]),f8e(t,{},1,e)}function f8e(t,e,r,n,i){var a=r,s=t.node(n);return e[n]=!0,rt(t.neighbors(n),function(o){Object.prototype.hasOwnProperty.call(e,o)||(r=f8e(t,e,r,o,n))}),s.low=a,s.lim=r++,i?s.parent=i:delete s.parent,r}function p8e(t){return dp(t.edges(),function(e){return t.edge(e).cutvalue<0})}function g8e(t,e,r){var n=r.v,i=r.w;e.hasEdge(n,i)||(n=r.w,i=r.v);var a=t.node(n),s=t.node(i),o=a,l=!1;a.lim>s.lim&&(o=s,l=!0);var u=ia(e.edges(),function(h){return l===m8e(t,t.node(h.v),o)&&l!==m8e(t,t.node(h.w),o)});return OJ(u,function(h){return S2(e,h)})}function A8e(t,e,r,n){var i=r.v,a=r.w;t.removeEdge(i,a),t.setEdge(n.v,n.w,{}),FJ(t),PJ(t,e),cir(t,e)}function cir(t,e){var r=dp(t.nodes(),function(i){return!e.node(i).parent}),n=oir(t,r);n=n.slice(1),rt(n,function(i){var a=t.node(i).parent,s=e.edge(i,a),o=!1;s||(s=e.edge(a,i),o=!0),e.node(i).rank=e.node(a).rank+(o?s.minlen:-s.minlen)})}function uir(t,e,r){return t.hasEdge(e,r)}function m8e(t,e,r){return r.low<=e.lim&&e.lim<=r.lim}function hir(t){switch(t.graph().ranker){case"network-simplex":v8e(t);break;case"tight-tree":fir(t);break;case"longest-path":dir(t);break;default:v8e(t)}}var dir=BJ;function fir(t){BJ(t),c8e(t)}function v8e(t){Fv(t)}function pir(t){var e=bb(t,"root",{},"_root"),r=gir(t),n=Bv(fi(r))-1,i=2*n+1;t.graph().nestingRoot=e,rt(t.edges(),function(s){t.edge(s).minlen*=i});var a=Air(t)+1;rt(t.children(),function(s){y8e(t,e,i,a,n,r,s)}),t.graph().nodeRankFactor=i}function y8e(t,e,r,n,i,a,s){var o=t.children(s);if(!o.length){s!==e&&t.setEdge(e,s,{weight:0,minlen:r});return}var l=i8e(t,"_bt"),u=i8e(t,"_bb"),h=t.node(s);t.setParent(l,s),h.borderTop=l,t.setParent(u,s),h.borderBottom=u,rt(o,function(d){y8e(t,e,r,n,i,a,d);var f=t.node(d),p=f.borderTop?f.borderTop:d,g=f.borderBottom?f.borderBottom:d,A=f.borderTop?n:2*n,m=p!==g?1:i-a[s]+1;t.setEdge(l,p,{weight:A,minlen:m,nestingEdge:!0}),t.setEdge(g,u,{weight:A,minlen:m,nestingEdge:!0})}),t.parent(s)||t.setEdge(e,l,{weight:0,minlen:i+a[s]})}function gir(t){var e={};function r(n,i){var a=t.children(n);a&&a.length&&rt(a,function(s){r(s,i+1)}),e[n]=i}return rt(t.children(),function(n){r(n,1)}),e}function Air(t){return Ua(t.edges(),function(e,r){return e+t.edge(r).weight},0)}function mir(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,rt(t.edges(),function(r){var n=t.edge(r);n.nestingEdge&&t.removeEdge(r)})}function vir(t,e,r){var n={},i;rt(r,function(a){for(var s=t.parent(a),o,l;s;){if(o=t.parent(s),o?(l=n[o],n[o]=s):(l=i,i=s),l&&l!==s){e.setEdge(l,s);return}s=o}})}function yir(t,e,r){var n=_ir(t),i=new Ml({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(a){return t.node(a)});return rt(t.nodes(),function(a){var s=t.node(a),o=t.parent(a);(s.rank===e||s.minRank<=e&&e<=s.maxRank)&&(i.setNode(a),i.setParent(a,o||n),rt(t[r](a),function(l){var u=l.v===a?l.w:l.v,h=i.edge(u,a),d=Xn(h)?0:h.weight;i.setEdge(u,a,{weight:t.edge(l).weight+d})}),Object.prototype.hasOwnProperty.call(s,"minRank")&&i.setNode(a,{borderLeft:s.borderLeft[e],borderRight:s.borderRight[e]}))}),i}function _ir(t){for(var e;t.hasNode(e=kJ("_root")););return e}function bir(t,e){for(var r=0,n=1;n<e.length;++n)r+=Sir(t,e[n-1],e[n]);return r}function Sir(t,e,r){for(var n=Inr(r,Qt(r,function(u,h){return h})),i=Os(Qt(e,function(u){return _2(Qt(t.outEdges(u),function(h){return{pos:n[h.w],weight:t.edge(h).weight}}),"pos")})),a=1;a<r.length;)a<<=1;var s=2*a-1;a-=1;var o=Qt(new Array(s),function(){return 0}),l=0;return rt(i.forEach(function(u){var h=u.pos+a;o[h]+=u.weight;for(var d=0;h>0;)h%2&&(d+=o[h+1]),h=h-1>>1,o[h]+=u.weight;l+=u.weight*d})),l}function Eir(t){var e={},r=ia(t.nodes(),function(o){return!t.children(o).length}),n=Bv(Qt(r,function(o){return t.node(o).rank})),i=Qt(_b(n+1),function(){return[]});function a(o){if(!Nr(e,o)){e[o]=!0;var l=t.node(o);i[l.rank].push(o),rt(t.successors(o),a)}}var s=_2(r,function(o){return t.node(o).rank});return rt(s,a),i}function wir(t,e){return Qt(e,function(r){var n=t.inEdges(r);if(n.length){var i=Ua(n,function(a,s){var o=t.edge(s),l=t.node(s.v);return{sum:a.sum+o.weight*l.order,weight:a.weight+o.weight}},{sum:0,weight:0});return{v:r,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:r}})}function xir(t,e){var r={};rt(t,function(i,a){var s=r[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};Xn(i.barycenter)||(s.barycenter=i.barycenter,s.weight=i.weight)}),rt(e.edges(),function(i){var a=r[i.v],s=r[i.w];!Xn(a)&&!Xn(s)&&(s.indegree++,a.out.push(r[i.w]))});var n=ia(r,function(i){return!i.indegree});return Tir(n)}function Tir(t){var e=[];function r(a){return function(s){s.merged||(Xn(s.barycenter)||Xn(a.barycenter)||s.barycenter>=a.barycenter)&&Oir(a,s)}}function n(a){return function(s){s.in.push(a),--s.indegree===0&&t.push(s)}}for(;t.length;){var i=t.pop();e.push(i),rt(i.in.reverse(),r(i)),rt(i.out,n(i))}return Qt(ia(e,function(a){return!a.merged}),function(a){return V5(a,["vs","i","barycenter","weight"])})}function Oir(t,e){var r=0,n=0;t.weight&&(r+=t.barycenter*t.weight,n+=t.weight),e.weight&&(r+=e.barycenter*e.weight,n+=e.weight),t.vs=e.vs.concat(t.vs),t.barycenter=r/n,t.weight=n,t.i=Math.min(e.i,t.i),e.merged=!0}function Cir(t,e){var r=qnr(t,function(h){return Object.prototype.hasOwnProperty.call(h,"barycenter")}),n=r.lhs,i=_2(r.rhs,function(h){return-h.i}),a=[],s=0,o=0,l=0;n.sort(Rir(!!e)),l=_8e(a,i,l),rt(n,function(h){l+=h.vs.length,a.push(h.vs),s+=h.barycenter*h.weight,o+=h.weight,l=_8e(a,i,l)});var u={vs:Os(a)};return o&&(u.barycenter=s/o,u.weight=o),u}function _8e(t,e,r){for(var n;e.length&&(n=wd(e)).i<=r;)e.pop(),t.push(n.vs),r++;return r}function Rir(t){return function(e,r){return e.barycenter<r.barycenter?-1:e.barycenter>r.barycenter?1:t?r.i-e.i:e.i-r.i}}function b8e(t,e,r,n){var i=t.children(e),a=t.node(e),s=a?a.borderLeft:void 0,o=a?a.borderRight:void 0,l={};s&&(i=ia(i,function(g){return g!==s&&g!==o}));var u=wir(t,i);rt(u,function(g){if(t.children(g.v).length){var A=b8e(t,g.v,r,n);l[g.v]=A,Object.prototype.hasOwnProperty.call(A,"barycenter")&&Iir(g,A)}});var h=xir(u,r);kir(h,l);var d=Cir(h,n);if(s&&(d.vs=Os([s,d.vs,o]),t.predecessors(s).length)){var f=t.node(t.predecessors(s)[0]),p=t.node(t.predecessors(o)[0]);Object.prototype.hasOwnProperty.call(d,"barycenter")||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+f.order+p.order)/(d.weight+2),d.weight+=2}return d}function kir(t,e){rt(t,function(r){r.vs=Os(r.vs.map(function(n){return e[n]?e[n].vs:n}))})}function Iir(t,e){Xn(t.barycenter)?(t.barycenter=e.barycenter,t.weight=e.weight):(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight)}function Nir(t){var e=a8e(t),r=S8e(t,_b(1,e+1),"inEdges"),n=S8e(t,_b(e-1,-1,-1),"outEdges"),i=Eir(t);E8e(t,i);for(var a=Number.POSITIVE_INFINITY,s,o=0,l=0;l<4;++o,++l){Dir(o%2?r:n,o%4>=2),i=q5(t);var u=bir(t,i);u<a&&(l=0,s=jtr(i),a=u)}E8e(t,s)}function S8e(t,e,r){return Qt(e,function(n){return yir(t,n,r)})}function Dir(t,e){var r=new Ml;rt(t,function(n){var i=n.graph().root,a=b8e(n,i,r,e);rt(a.vs,function(s,o){n.node(s).order=o}),vir(n,r,a.vs)})}function E8e(t,e){rt(e,function(r){rt(r,function(n,i){t.node(n).order=i})})}function Lir(t){var e=Bir(t);rt(t.graph().dummyChains,function(r){for(var n=t.node(r),i=n.edgeObj,a=Mir(t,e,i.v,i.w),s=a.path,o=a.lca,l=0,u=s[l],h=!0;r!==i.w;){if(n=t.node(r),h){for(;(u=s[l])!==o&&t.node(u).maxRank<n.rank;)l++;u===o&&(h=!1)}if(!h){for(;l<s.length-1&&t.node(u=s[l+1]).minRank<=n.rank;)l++;u=s[l]}t.setParent(r,u),r=t.successors(r)[0]}})}function Mir(t,e,r,n){var i=[],a=[],s=Math.min(e[r].low,e[n].low),o=Math.max(e[r].lim,e[n].lim),l,u;l=r;do l=t.parent(l),i.push(l);while(l&&(e[l].low>s||o>e[l].lim));for(u=l,l=n;(l=t.parent(l))!==u;)a.push(l);return{path:i.concat(a.reverse()),lca:u}}function Bir(t){var e={},r=0;function n(i){var a=r;rt(t.children(i),n),e[i]={low:a,lim:r++}}return rt(t.children(),n),e}function Pir(t,e){var r={};function n(i,a){var s=0,o=0,l=i.length,u=wd(a);return rt(a,function(h,d){var f=Uir(t,h),p=f?t.node(f).order:l;(f||h===u)&&(rt(a.slice(o,d+1),function(g){rt(t.predecessors(g),function(A){var m=t.node(A),v=m.order;(v<s||p<v)&&!(m.dummy&&t.node(g).dummy)&&w8e(r,A,g)})}),o=d+1,s=p)}),a}return Ua(e,n),r}function Fir(t,e){var r={};function n(a,s,o,l,u){var h;rt(_b(s,o),function(d){h=a[d],t.node(h).dummy&&rt(t.predecessors(h),function(f){var p=t.node(f);p.dummy&&(p.order<l||p.order>u)&&w8e(r,f,h)})})}function i(a,s){var o=-1,l,u=0;return rt(s,function(h,d){if(t.node(h).dummy==="border"){var f=t.predecessors(h);f.length&&(l=t.node(f[0]).order,n(s,u,d,o,l),u=d,o=l)}n(s,u,s.length,l,a.length)}),s}return Ua(e,i),r}function Uir(t,e){if(t.node(e).dummy)return dp(t.predecessors(e),function(r){return t.node(r).dummy})}function w8e(t,e,r){if(e>r){var n=e;e=r,r=n}Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=t[e];Object.defineProperty(i,r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function Qir(t,e,r){if(e>r){var n=e;e=r,r=n}return!!t[e]&&Object.prototype.hasOwnProperty.call(t[e],r)}function $ir(t,e,r,n){var i={},a={},s={};return rt(e,function(o){rt(o,function(l,u){i[l]=l,a[l]=l,s[l]=u})}),rt(e,function(o){var l=-1;rt(o,function(u){var h=n(u);if(h.length){h=_2(h,function(A){return s[A]});for(var d=(h.length-1)/2,f=Math.floor(d),p=Math.ceil(d);f<=p;++f){var g=h[f];a[u]===u&&l<s[g]&&!Qir(r,u,g)&&(a[g]=u,a[u]=i[u]=i[g],l=s[g])}}})}),{root:i,align:a}}function Gir(t,e,r,n,i){var a={},s=zir(t,e,r,i),o=i?"borderLeft":"borderRight";function l(d,f){for(var p=s.nodes(),g=p.pop(),A={};g;)A[g]?d(g):(A[g]=!0,p.push(g),p=p.concat(f(g))),g=p.pop()}function u(d){a[d]=s.inEdges(d).reduce(function(f,p){return Math.max(f,a[p.v]+s.edge(p))},0)}function h(d){var f=s.outEdges(d).reduce(function(g,A){return Math.min(g,a[A.w]-s.edge(A))},Number.POSITIVE_INFINITY),p=t.node(d);f!==Number.POSITIVE_INFINITY&&p.borderType!==o&&(a[d]=Math.max(a[d],f))}return l(u,s.predecessors.bind(s)),l(h,s.successors.bind(s)),rt(n,function(d){a[d]=a[r[d]]}),a}function zir(t,e,r,n){var i=new Ml,a=t.graph(),s=Wir(a.nodesep,a.edgesep,n);return rt(e,function(o){var l;rt(o,function(u){var h=r[u];if(i.setNode(h),l){var d=r[l],f=i.edge(d,h);i.setEdge(d,h,Math.max(s(t,u,l),f||0))}l=u})}),i}function Vir(t,e){return OJ(fi(e),function(r){var n=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return Krr(r,function(a,s){var o=Xir(t,s)/2;n=Math.max(a+o,n),i=Math.min(a-o,i)}),n-i})}function Hir(t,e){var r=fi(e),n=yb(r),i=Bv(r);rt(["u","d"],function(a){rt(["l","r"],function(s){var o=a+s,l=t[o],u;if(l!==e){var h=fi(l);u=s==="l"?n-yb(h):i-Bv(h),u&&(t[o]=z5(l,function(d){return d+u}))}})})}function qir(t,e){return z5(t.ul,function(r,n){if(e)return t[e.toLowerCase()][n];var i=_2(Qt(t,n));return(i[1]+i[2])/2})}function Yir(t){var e=q5(t),r=E4(Pir(t,e),Fir(t,e)),n={},i;rt(["u","d"],function(s){i=s==="u"?e:fi(e).reverse(),rt(["l","r"],function(o){o==="r"&&(i=Qt(i,function(d){return fi(d).reverse()}));var l=(s==="u"?t.predecessors:t.successors).bind(t),u=$ir(t,i,r,l),h=Gir(t,i,u.root,u.align,o==="r");o==="r"&&(h=z5(h,function(d){return-d})),n[s+o]=h})});var a=Vir(t,n);return Hir(n,a),qir(n,t.graph().align)}function Wir(t,e,r){return function(n,i,a){var s=n.node(i),o=n.node(a),l=0,u;if(l+=s.width/2,Object.prototype.hasOwnProperty.call(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":u=-s.width/2;break;case"r":u=s.width/2;break}if(u&&(l+=r?u:-u),u=0,l+=(s.dummy?e:t)/2,l+=(o.dummy?e:t)/2,l+=o.width/2,Object.prototype.hasOwnProperty.call(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":u=o.width/2;break;case"r":u=-o.width/2;break}return u&&(l+=r?u:-u),u=0,l}}function Xir(t,e){return t.node(e).width}function Kir(t){t=r8e(t),Zir(t),Zrr(Yir(t),function(e,r){t.node(r).x=e})}function Zir(t){var e=q5(t),r=t.graph().ranksep,n=0;rt(e,function(i){var a=Bv(Qt(i,function(s){return t.node(s).height}));rt(i,function(s){t.node(s).y=n+a/2}),n+=a+r})}function x8e(t,e){var r=Ynr;r("layout",()=>{var n=r(" buildLayoutGraph",()=>lar(t));r(" runLayout",()=>jir(n,r)),r(" updateInputGraph",()=>Jir(t,n))})}function jir(t,e){e(" makeSpaceForEdgeLabels",()=>car(t)),e(" removeSelfEdges",()=>yar(t)),e(" acyclic",()=>Qnr(t)),e(" nestingGraph.run",()=>pir(t)),e(" rank",()=>hir(r8e(t))),e(" injectEdgeLabelProxies",()=>uar(t)),e(" removeEmptyRanks",()=>Hnr(t)),e(" nestingGraph.cleanup",()=>mir(t)),e(" normalizeRanks",()=>Vnr(t)),e(" assignRankMinMax",()=>har(t)),e(" removeEdgeLabelProxies",()=>dar(t)),e(" normalize.run",()=>Jnr(t)),e(" parentDummyChains",()=>Lir(t)),e(" addBorderSegments",()=>Wnr(t)),e(" order",()=>Nir(t)),e(" insertSelfEdges",()=>_ar(t)),e(" adjustCoordinateSystem",()=>Xnr(t)),e(" position",()=>Kir(t)),e(" positionSelfEdges",()=>bar(t)),e(" removeBorderNodes",()=>mar(t)),e(" normalize.undo",()=>tir(t)),e(" fixupEdgeLabelCoords",()=>gar(t)),e(" undoCoordinateSystem",()=>Knr(t)),e(" translateGraph",()=>far(t)),e(" assignNodeIntersects",()=>par(t)),e(" reversePoints",()=>Aar(t)),e(" acyclic.undo",()=>Gnr(t))}function Jir(t,e){rt(t.nodes(),function(r){var n=t.node(r),i=e.node(r);n&&(n.x=i.x,n.y=i.y,e.children(r).length&&(n.width=i.width,n.height=i.height))}),rt(t.edges(),function(r){var n=t.edge(r),i=e.edge(r);n.points=i.points,Object.prototype.hasOwnProperty.call(i,"x")&&(n.x=i.x,n.y=i.y)}),t.graph().width=e.graph().width,t.graph().height=e.graph().height}var ear=["nodesep","edgesep","ranksep","marginx","marginy"],tar={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},rar=["acyclicer","ranker","rankdir","align"],nar=["width","height"],iar={width:0,height:0},aar=["minlen","weight","width","height","labeloffset"],sar={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},oar=["labelpos"];function lar(t){var e=new Ml({multigraph:!0,compound:!0}),r=QJ(t.graph());return e.setGraph(E4({},tar,UJ(r,ear),V5(r,rar))),rt(t.nodes(),function(n){var i=QJ(t.node(n));e.setNode(n,$5(UJ(i,nar),iar)),e.setParent(n,t.parent(n))}),rt(t.edges(),function(n){var i=QJ(t.edge(n));e.setEdge(n,E4({},sar,UJ(i,aar),V5(i,oar)))}),e}function car(t){var e=t.graph();e.ranksep/=2,rt(t.edges(),function(r){var n=t.edge(r);n.minlen*=2,n.labelpos.toLowerCase()!=="c"&&(e.rankdir==="TB"||e.rankdir==="BT"?n.width+=n.labeloffset:n.height+=n.labeloffset)})}function uar(t){rt(t.edges(),function(e){var r=t.edge(e);if(r.width&&r.height){var n=t.node(e.v),i=t.node(e.w),a={rank:(i.rank-n.rank)/2+n.rank,e};bb(t,"edge-proxy",a,"_ep")}})}function har(t){var e=0;rt(t.nodes(),function(r){var n=t.node(r);n.borderTop&&(n.minRank=t.node(n.borderTop).rank,n.maxRank=t.node(n.borderBottom).rank,e=Bv(e,n.maxRank))}),t.graph().maxRank=e}function dar(t){rt(t.nodes(),function(e){var r=t.node(e);r.dummy==="edge-proxy"&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))})}function far(t){var e=Number.POSITIVE_INFINITY,r=0,n=Number.POSITIVE_INFINITY,i=0,a=t.graph(),s=a.marginx||0,o=a.marginy||0;function l(u){var h=u.x,d=u.y,f=u.width,p=u.height;e=Math.min(e,h-f/2),r=Math.max(r,h+f/2),n=Math.min(n,d-p/2),i=Math.max(i,d+p/2)}rt(t.nodes(),function(u){l(t.node(u))}),rt(t.edges(),function(u){var h=t.edge(u);Object.prototype.hasOwnProperty.call(h,"x")&&l(h)}),e-=s,n-=o,rt(t.nodes(),function(u){var h=t.node(u);h.x-=e,h.y-=n}),rt(t.edges(),function(u){var h=t.edge(u);rt(h.points,function(d){d.x-=e,d.y-=n}),Object.prototype.hasOwnProperty.call(h,"x")&&(h.x-=e),Object.prototype.hasOwnProperty.call(h,"y")&&(h.y-=n)}),a.width=r-e+s,a.height=i-n+o}function par(t){rt(t.edges(),function(e){var r=t.edge(e),n=t.node(e.v),i=t.node(e.w),a,s;r.points?(a=r.points[0],s=r.points[r.points.length-1]):(r.points=[],a=i,s=n),r.points.unshift(n8e(n,a)),r.points.push(n8e(i,s))})}function gar(t){rt(t.edges(),function(e){var r=t.edge(e);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function Aar(t){rt(t.edges(),function(e){var r=t.edge(e);r.reversed&&r.points.reverse()})}function mar(t){rt(t.nodes(),function(e){if(t.children(e).length){var r=t.node(e),n=t.node(r.borderTop),i=t.node(r.borderBottom),a=t.node(wd(r.borderLeft)),s=t.node(wd(r.borderRight));r.width=Math.abs(s.x-a.x),r.height=Math.abs(i.y-n.y),r.x=a.x+r.width/2,r.y=n.y+r.height/2}}),rt(t.nodes(),function(e){t.node(e).dummy==="border"&&t.removeNode(e)})}function yar(t){rt(t.edges(),function(e){if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}})}function _ar(t){var e=q5(t);rt(e,function(r){var n=0;rt(r,function(i,a){var s=t.node(i);s.order=a+n,rt(s.selfEdges,function(o){bb(t,"selfedge",{width:o.label.width,height:o.label.height,rank:s.rank,order:a+ ++n,e:o.e,label:o.label},"_se")}),delete s.selfEdges})})}function bar(t){rt(t.nodes(),function(e){var r=t.node(e);if(r.dummy==="selfedge"){var n=t.node(r.e.v),i=n.x+n.width/2,a=n.y,s=r.x-i,o=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:i+2*s/3,y:a-o},{x:i+5*s/6,y:a-o},{x:i+s,y:a},{x:i+5*s/6,y:a+o},{x:i+2*s/3,y:a+o}],r.label.x=r.x,r.label.y=r.y}})}function UJ(t,e){return z5(V5(t,e),Number)}function QJ(t){var e={};return rt(t,function(r,n){e[n.toLowerCase()]=r}),e}function xd(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:Sar(t),edges:Ear(t)};return Xn(t.graph())||(e.value=ss(t.graph())),e}function Sar(t){return Qt(t.nodes(),function(e){var r=t.node(e),n=t.parent(e),i={v:e};return Xn(r)||(i.value=r),Xn(n)||(i.parent=n),i})}function Ear(t){return Qt(t.edges(),function(e){var r=t.edge(e),n={v:e.v,w:e.w};return Xn(e.name)||(n.name=e.name),Xn(r)||(n.value=r),n})}var ln=new Map,Uv=new Map,T8e=new Map,war=k(()=>{Uv.clear(),T8e.clear(),ln.clear()},"clear"),Y5=k((t,e)=>{const r=Uv.get(e)||[];return _e.trace("In isDescendant",e," ",t," = ",r.includes(t)),r.includes(t)},"isDescendant"),xar=k((t,e)=>{const r=Uv.get(e)||[];return _e.info("Descendants of ",e," is ",r),_e.info("Edge is ",t),t.v===e||t.w===e?!1:r?r.includes(t.v)||Y5(t.v,e)||Y5(t.w,e)||r.includes(t.w):(_e.debug("Tilt, ",e,",not in descendants"),!1)},"edgeInCluster"),O8e=k((t,e,r,n)=>{_e.warn("Copying children of ",t,"root",n,"data",e.node(t),n);const i=e.children(t)||[];t!==n&&i.push(t),_e.warn("Copying (nodes) clusterId",t,"nodes",i),i.forEach(a=>{if(e.children(a).length>0)O8e(a,e,r,n);else{const s=e.node(a);_e.info("cp ",a," to ",n," with parent ",t),r.setNode(a,s),n!==e.parent(a)&&(_e.warn("Setting parent",a,e.parent(a)),r.setParent(a,e.parent(a))),t!==n&&a!==t?(_e.debug("Setting parent",a,t),r.setParent(a,t)):(_e.info("In copy ",t,"root",n,"data",e.node(t),n),_e.debug("Not Setting parent for node=",a,"cluster!==rootId",t!==n,"node!==clusterId",a!==t));const o=e.edges(a);_e.debug("Copying Edges",o),o.forEach(l=>{_e.info("Edge",l);const u=e.edge(l.v,l.w,l.name);_e.info("Edge data",u,n);try{xar(l,n)?(_e.info("Copying as ",l.v,l.w,u,l.name),r.setEdge(l.v,l.w,u,l.name),_e.info("newGraph edges ",r.edges(),r.edge(r.edges()[0]))):_e.info("Skipping copy of edge ",l.v,"-->",l.w," rootId: ",n," clusterId:",t)}catch(h){_e.error(h)}})}_e.debug("Removing node",a),e.removeNode(a)})},"copy"),C8e=k((t,e)=>{const r=e.children(t);let n=[...r];for(const i of r)T8e.set(i,t),n=[...n,...C8e(i,e)];return n},"extractDescendants"),Tar=k((t,e,r)=>{const n=t.edges().filter(l=>l.v===e||l.w===e),i=t.edges().filter(l=>l.v===r||l.w===r),a=n.map(l=>({v:l.v===e?r:l.v,w:l.w===e?e:l.w})),s=i.map(l=>({v:l.v,w:l.w}));return a.filter(l=>s.some(u=>l.v===u.v&&l.w===u.w))},"findCommonEdges"),E2=k((t,e,r)=>{const n=e.children(t);if(_e.trace("Searching children of id ",t,n),n.length<1)return t;let i;for(const a of n){const s=E2(a,e,r),o=Tar(e,r,s);if(s)if(o.length>0)i=s;else return s}return i},"findNonClusterChild"),R8e=k(t=>!ln.has(t)||!ln.get(t).externalConnections?t:ln.has(t)?ln.get(t).id:t,"getAnchorId"),Oar=k((t,e)=>{if(!t||e>10){_e.debug("Opting out, no graph ");return}else _e.debug("Opting in, graph ");t.nodes().forEach(function(r){t.children(r).length>0&&(_e.warn("Cluster identified",r," Replacement id in edges: ",E2(r,t,r)),Uv.set(r,C8e(r,t)),ln.set(r,{id:E2(r,t,r),clusterData:t.node(r)}))}),t.nodes().forEach(function(r){const n=t.children(r),i=t.edges();n.length>0?(_e.debug("Cluster identified",r,Uv),i.forEach(a=>{const s=Y5(a.v,r),o=Y5(a.w,r);s^o&&(_e.warn("Edge: ",a," leaves cluster ",r),_e.warn("Descendants of XXX ",r,": ",Uv.get(r)),ln.get(r).externalConnections=!0)})):_e.debug("Not a cluster ",r,Uv)});for(let r of ln.keys()){const n=ln.get(r).id,i=t.parent(n);i!==r&&ln.has(i)&&!ln.get(i).externalConnections&&(ln.get(r).id=i)}t.edges().forEach(function(r){const n=t.edge(r);_e.warn("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(r)),_e.warn("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(t.edge(r)));let i=r.v,a=r.w;if(_e.warn("Fix XXX",ln,"ids:",r.v,r.w,"Translating: ",ln.get(r.v)," --- ",ln.get(r.w)),ln.get(r.v)||ln.get(r.w)){if(_e.warn("Fixing and trying - removing XXX",r.v,r.w,r.name),i=R8e(r.v),a=R8e(r.w),t.removeEdge(r.v,r.w,r.name),i!==r.v){const s=t.parent(i);ln.get(s).externalConnections=!0,n.fromCluster=r.v}if(a!==r.w){const s=t.parent(a);ln.get(s).externalConnections=!0,n.toCluster=r.w}_e.warn("Fix Replacing with XXX",i,a,r.name),t.setEdge(i,a,n,r.name)}}),_e.warn("Adjusted Graph",xd(t)),k8e(t,0),_e.trace(ln)},"adjustClustersAndEdges"),k8e=k((t,e)=>{var i,a;if(_e.warn("extractor - ",e,xd(t),t.children("D")),e>10){_e.error("Bailing out");return}let r=t.nodes(),n=!1;for(const s of r){const o=t.children(s);n=n||o.length>0}if(!n){_e.debug("Done, no node has children",t.nodes());return}_e.debug("Nodes = ",r,e);for(const s of r)if(_e.debug("Extracting node",s,ln,ln.has(s)&&!ln.get(s).externalConnections,!t.parent(s),t.node(s),t.children("D")," Depth ",e),!ln.has(s))_e.debug("Not a cluster",s,e);else if(!ln.get(s).externalConnections&&t.children(s)&&t.children(s).length>0){_e.warn("Cluster without external connections, without a parent and with children",s,e);let l=t.graph().rankdir==="TB"?"LR":"TB";(a=(i=ln.get(s))==null?void 0:i.clusterData)!=null&&a.dir&&(l=ln.get(s).clusterData.dir,_e.warn("Fixing dir",ln.get(s).clusterData.dir,l));const u=new Ml({multigraph:!0,compound:!0}).setGraph({rankdir:l,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});_e.warn("Old graph before copy",xd(t)),O8e(s,t,u,s),t.setNode(s,{clusterNode:!0,id:s,clusterData:ln.get(s).clusterData,label:ln.get(s).label,graph:u}),_e.warn("New graph after copy node: (",s,")",xd(u)),_e.debug("Old graph after copy",xd(t))}else _e.warn("Cluster ** ",s," **not meeting the criteria !externalConnections:",!ln.get(s).externalConnections," no parent: ",!t.parent(s)," children ",t.children(s)&&t.children(s).length>0,t.children("D"),e),_e.debug(ln);r=t.nodes(),_e.warn("New list of nodes",r);for(const s of r){const o=t.node(s);_e.warn(" Now next level",s,o),o!=null&&o.clusterNode&&k8e(o.graph,e+1)}},"extractor"),I8e=k((t,e)=>{if(e.length===0)return[];let r=Object.assign([],e);return e.forEach(n=>{const i=t.children(n),a=I8e(t,i);r=[...r,...a]}),r},"sorter"),Car=k(t=>I8e(t,t.children()),"sortNodesByHierarchy"),N8e=k(async(t,e,r,n,i,a)=>{_e.warn("Graph in recursive render:XAX",xd(e),i);const s=e.graph().rankdir;_e.trace("Dir in recursive render - dir:",s);const o=t.insert("g").attr("class","root");e.nodes()?_e.info("Recursive render XXX",e.nodes()):_e.info("No nodes found for",e),e.edges().length>0&&_e.info("Recursive edges",e.edge(e.edges()[0]));const l=o.insert("g").attr("class","clusters"),u=o.insert("g").attr("class","edgePaths"),h=o.insert("g").attr("class","edgeLabels"),d=o.insert("g").attr("class","nodes");await Promise.all(e.nodes().map(async function(A){const m=e.node(A);if(i!==void 0){const v=JSON.parse(JSON.stringify(i.clusterData));_e.trace(`Setting data for parent cluster XXX
|
|
915
915
|
Node.id = `,A,`
|
|
916
916
|
data=`,v.height,`
|
|
917
917
|
Parent cluster`,i.height),e.setNode(i.id,v),e.parent(A)||(_e.trace("Setting parent",A,i.id),e.setParent(A,i.id,v))}if(_e.info("(Insert) Node XXX"+A+": "+JSON.stringify(e.node(A))),m!=null&&m.clusterNode){_e.info("Cluster identified XBX",A,m.width,e.node(A));const{ranksep:v,nodesep:y}=e.graph();m.graph.setGraph({...m.graph.graph(),ranksep:v+25,nodesep:y});const _=await N8e(d,m.graph,r,n,e.node(A),a),b=_.elem;mr(m,b),m.diff=_.diff||0,_e.info("New compound node after recursive render XAX",A,"width",m.width,"height",m.height),iLt(b,m)}else e.children(A).length>0?(_e.trace("Cluster - the non recursive path XBX",A,m.id,m,m.width,"Graph:",e),_e.trace(E2(m.id,e)),ln.set(m.id,{id:E2(m.id,e),node:m})):(_e.trace("Node - the non recursive path XAX",A,d,e.node(A),s),await W4(d,e.node(A),{config:a,dir:s}))})),await k(async()=>{const A=e.edges().map(async function(m){const v=e.edge(m.v,m.w,m.name);_e.info("Edge "+m.v+" -> "+m.w+": "+JSON.stringify(m)),_e.info("Edge "+m.v+" -> "+m.w+": ",m," ",JSON.stringify(e.edge(m))),_e.info("Fix",ln,"ids:",m.v,m.w,"Translating: ",ln.get(m.v),ln.get(m.w)),await URe(h,v)});await Promise.all(A)},"processEdges")(),_e.info("Graph before layout:",JSON.stringify(xd(e))),_e.info("############################################# XXX"),_e.info("### Layout ### XXX"),_e.info("############################################# XXX"),x8e(e),_e.info("Graph after layout:",JSON.stringify(xd(e)));let p=0,{subGraphTitleTotalMargin:g}=yT(a);return await Promise.all(Car(e).map(async function(A){var v;const m=e.node(A);if(_e.info("Position XBX => "+A+": ("+m.x,","+m.y,") width: ",m.width," height: ",m.height),m!=null&&m.clusterNode)m.y+=g,_e.info("A tainted cluster node XBX1",A,m.id,m.width,m.height,m.x,m.y,e.parent(A)),ln.get(m.id).node=m,yY(m);else if(e.children(A).length>0){_e.info("A pure cluster node XBX1",A,m.id,m.x,m.y,m.width,m.height,e.parent(A)),m.height+=g,e.node(m.parentId);const y=(m==null?void 0:m.padding)/2||0,_=((v=m==null?void 0:m.labelBBox)==null?void 0:v.height)||0,b=_-y||0;_e.debug("OffsetY",b,"labelHeight",_,"halfPadding",y),await pY(l,m),ln.get(m.id).node=m}else{const y=e.node(m.parentId);m.y+=g/2,_e.info("A regular node XBX1 - using the padding",m.id,"parent",m.parentId,m.width,m.height,m.x,m.y,"offsetY",m.offsetY,"parent",y,y==null?void 0:y.offsetY,m),yY(m)}})),e.edges().forEach(function(A){const m=e.edge(A);_e.info("Edge "+A.v+" -> "+A.w+": "+JSON.stringify(m),m),m.points.forEach(b=>b.y+=g/2);const v=e.node(A.v);var y=e.node(A.w);const _=VRe(u,m,ln,r,v,y,n);QRe(m,_)}),e.nodes().forEach(function(A){const m=e.node(A);_e.info(A,m.type,m.diff),m.isGroup&&(p=m.diff)}),_e.warn("Returning from recursive render XAX",o,p),{elem:o,diff:p}},"recursiveRender"),Rar=k(async(t,e)=>{var a,s,o,l,u,h;const r=new Ml({multigraph:!0,compound:!0}).setGraph({rankdir:t.direction,nodesep:((a=t.config)==null?void 0:a.nodeSpacing)||((o=(s=t.config)==null?void 0:s.flowchart)==null?void 0:o.nodeSpacing)||t.nodeSpacing,ranksep:((l=t.config)==null?void 0:l.rankSpacing)||((h=(u=t.config)==null?void 0:u.flowchart)==null?void 0:h.rankSpacing)||t.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),n=e.select("g");YRe(n,t.markers,t.type,t.diagramId),aLt(),lLt(),Q3t(),war(),t.nodes.forEach(d=>{r.setNode(d.id,{...d}),d.parentId&&r.setParent(d.id,d.parentId)}),_e.debug("Edges:",t.edges),t.edges.forEach(d=>{if(d.start===d.end){const f=d.start,p=f+"---"+f+"---1",g=f+"---"+f+"---2",A=r.node(f);r.setNode(p,{domId:p,id:p,parentId:A.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),r.setParent(p,A.parentId),r.setNode(g,{domId:g,id:g,parentId:A.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),r.setParent(g,A.parentId);const m=structuredClone(d),v=structuredClone(d),y=structuredClone(d);m.label="",m.arrowTypeEnd="none",m.id=f+"-cyclic-special-1",v.arrowTypeStart="none",v.arrowTypeEnd="none",v.id=f+"-cyclic-special-mid",y.label="",A.isGroup&&(m.fromCluster=f,y.toCluster=f),y.id=f+"-cyclic-special-2",y.arrowTypeStart="none",r.setEdge(f,p,m,f+"-cyclic-special-0"),r.setEdge(p,g,v,f+"-cyclic-special-1"),r.setEdge(g,f,y,f+"-cyc<lic-special-2")}else r.setEdge(d.start,d.end,{...d},d.id)}),_e.warn("Graph at first:",JSON.stringify(xd(r))),Oar(r),_e.warn("Graph after XAX:",JSON.stringify(xd(r)));const i=He();await N8e(n,r,t.type,t.diagramId,void 0,i)},"render");const kar=Object.freeze(Object.defineProperty({__proto__:null,render:Rar},Symbol.toStringTag,{value:"Module"}));function $J(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Iar(t){if(Array.isArray(t))return t}function Nar(t){if(Array.isArray(t))return $J(t)}function p0(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Dar(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,L8e(n.key),n)}}function g0(t,e,r){return e&&Dar(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Bl(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=GJ(t))||e){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
package/package.json
CHANGED