filecat 6.59.2 → 6.60.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.
Files changed (52) hide show
  1. package/build/dist/{1472.ac066786b1f8f318de62.js → 1472.ee0d027b82768e506b70.js} +1 -1
  2. package/build/dist/1695.8a7beb249e1ad17a47f3.js +1 -0
  3. package/build/dist/3105.8506dea62edb242a898c.js +1 -0
  4. package/build/dist/3457.e003dede632769cfe55e.js +1 -0
  5. package/build/dist/3721.c484f07613f940d94b90.js +1 -0
  6. package/build/dist/378.a32383dade4a2e55152a.js +1 -0
  7. package/build/dist/5137.ea60635374bc8146dbe3.js +1 -0
  8. package/build/dist/5622.01faef0a863f5cad9619.js +1 -0
  9. package/build/dist/6284.10deb80685728f50aa45.js +1 -0
  10. package/build/dist/647.42e7ab2f84bd57ba60e4.js +1 -0
  11. package/build/dist/6636.cc3f66845c61dbf76bd1.js +1 -0
  12. package/build/dist/6919.8df9652177bc9e8713d8.js +1 -0
  13. package/build/dist/7277.aa3af95608a9d9d07634.js +1 -0
  14. package/build/dist/7454.e647fbf309ca068e39e8.js +1 -0
  15. package/build/dist/7834.7a593dcb80ca09f58586.js +1 -0
  16. package/build/dist/8840.525f17063dc60979415b.js +1 -0
  17. package/build/dist/8947.5c2814b7a2c2810f0ce2.js +2 -0
  18. package/build/dist/{2637.9c1a442f4131e029385d.js → 9214.7750d99fcaff8de186f9.js} +1 -1
  19. package/build/dist/9421.7eb137bdb14410e9f6f4.js +1 -0
  20. package/build/dist/9482.a952553a24ad781da8c4.js +1 -0
  21. package/build/dist/9546.0621e5736f104bc83c15.js +1 -0
  22. package/build/dist/970.0a2e1e7d00bc1b8a2d6c.js +1 -0
  23. package/build/dist/9899.2a79d3f40f2bf1ae7829.js +1 -0
  24. package/build/dist/dark.css +8 -0
  25. package/build/dist/google-dark.css +8 -0
  26. package/build/dist/index.html +1 -1
  27. package/build/dist/main.90464f4b95f7466ef43e.js +2 -0
  28. package/build/main.js +1 -1
  29. package/package.json +1 -1
  30. package/build/dist/1070.f9959455a7cb92f7cc56.js +0 -1
  31. package/build/dist/1297.f0c54354f6a56960f66e.js +0 -1
  32. package/build/dist/1327.4b8e684f28cdee892e00.js +0 -1
  33. package/build/dist/2824.2990d63b1d3564cf19fb.js +0 -1
  34. package/build/dist/2857.870fe5dcf2cff743819f.js +0 -1
  35. package/build/dist/4253.f6c2ea8c7314d4df9c6d.js +0 -1
  36. package/build/dist/4306.9618c407f36d82608325.js +0 -1
  37. package/build/dist/4806.1e68bc623f8c369611a3.js +0 -1
  38. package/build/dist/4830.0042c6dcd47f7dcec003.js +0 -1
  39. package/build/dist/5315.0a806bc186510d2d0152.js +0 -1
  40. package/build/dist/5332.00d54e3fd946dafee80e.js +0 -1
  41. package/build/dist/6459.06eb5a8b0d8c8f7d3bd0.js +0 -1
  42. package/build/dist/6488.4de7c86754406277783e.js +0 -1
  43. package/build/dist/6506.ae8f7efceae47503af40.js +0 -1
  44. package/build/dist/6535.a5c5040e658bc76d0da8.js +0 -1
  45. package/build/dist/727.45aacafb8172bc2bb662.js +0 -1
  46. package/build/dist/821.1cd8faa58770da7e977c.js +0 -1
  47. package/build/dist/8947.7e10e5115cc7edc7fc85.js +0 -2
  48. package/build/dist/9269.f5e25bc611f9230a1aae.js +0 -1
  49. package/build/dist/9546.4801bc682362b139f12a.js +0 -1
  50. package/build/dist/main.73187d8e6ef7f4c10a5b.js +0 -2
  51. /package/build/dist/{8947.7e10e5115cc7edc7fc85.js.LICENSE.txt → 8947.5c2814b7a2c2810f0ce2.js.LICENSE.txt} +0 -0
  52. /package/build/dist/{main.73187d8e6ef7f4c10a5b.js.LICENSE.txt → main.90464f4b95f7466ef43e.js.LICENSE.txt} +0 -0
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[4806],{338(t,e,s){s.d(e,{CP:()=>d,Ck:()=>y,HT:()=>p,PB:()=>u,aC:()=>h,lC:()=>l,m:()=>c,tk:()=>a});var i=s(86535),n=s(86827),r=s(62559),o=s(51444),a=(0,n.K)((t,e)=>{const s=t.append("rect");if(s.attr("x",e.x),s.attr("y",e.y),s.attr("fill",e.fill),s.attr("stroke",e.stroke),s.attr("width",e.width),s.attr("height",e.height),e.name&&s.attr("name",e.name),e.rx&&s.attr("rx",e.rx),e.ry&&s.attr("ry",e.ry),void 0!==e.attrs)for(const t in e.attrs)s.attr(t,e.attrs[t]);return e.class&&s.attr("class",e.class),s},"drawRect"),l=(0,n.K)((t,e)=>{const s={x:e.startx,y:e.starty,width:e.stopx-e.startx,height:e.stopy-e.starty,fill:e.fill,stroke:e.stroke,class:"rect"};a(t,s).lower()},"drawBackgroundRect"),c=(0,n.K)((t,e)=>{const s=e.text.replace(i.H1," "),n=t.append("text");n.attr("x",e.x),n.attr("y",e.y),n.attr("class","legend"),n.style("text-anchor",e.anchor),e.class&&n.attr("class",e.class);const r=n.append("tspan");return r.attr("x",e.x+2*e.textMargin),r.text(s),n},"drawText"),h=(0,n.K)((t,e,s,i)=>{const n=t.append("image");n.attr("x",e),n.attr("y",s);const o=(0,r.J)(i);n.attr("xlink:href",o)},"drawImage"),d=(0,n.K)((t,e,s,i)=>{const n=t.append("use");n.attr("x",e),n.attr("y",s);const o=(0,r.J)(i);n.attr("xlink:href",`#${o}`)},"drawEmbeddedImage"),u=(0,n.K)(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),p=(0,n.K)(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),y=(0,n.K)(()=>{let t=(0,o.Ltv)(".mermaidTooltip");return t.empty()&&(t=(0,o.Ltv)("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),t},"createTooltip")},74806(t,e,s){s.d(e,{Zk:()=>y,q7:()=>G,tM:()=>ht,u4:()=>ct});var i=s(96755),n=s(1672),r=s(9417),o=s(338),a=s(12505),l=s(86535),c=s(31293),h=s(86827),d=s(51444),u=s(99418),p=function(){var t=(0,h.K)(function(t,e,s,i){for(s=s||{},i=t.length;i--;s[t[i]]=e);return s},"o"),e=[1,2],s=[1,3],i=[1,4],n=[2,4],r=[1,9],o=[1,11],a=[1,16],l=[1,17],c=[1,18],d=[1,19],u=[1,33],p=[1,20],y=[1,21],g=[1,22],f=[1,23],m=[1,24],S=[1,26],k=[1,27],b=[1,28],T=[1,29],_=[1,30],x=[1,31],E=[1,32],D=[1,35],$=[1,36],C=[1,37],v=[1,38],w=[1,34],I=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],A=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],L=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],R={trace:(0,h.K)(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"--\x3e":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"--\x3e",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:(0,h.K)(function(t,e,s,i,n,r,o){var a=r.length-1;switch(n){case 3:return i.setRootDoc(r[a]),r[a];case 4:this.$=[];break;case 5:"nl"!=r[a]&&(r[a-1].push(r[a]),this.$=r[a-1]);break;case 6:case 7:case 12:this.$=r[a];break;case 8:this.$="nl";break;case 13:const t=r[a-1];t.description=i.trimColon(r[a]),this.$=t;break;case 14:this.$={stmt:"relation",state1:r[a-2],state2:r[a]};break;case 15:const e=i.trimColon(r[a]);this.$={stmt:"relation",state1:r[a-3],state2:r[a-1],description:e};break;case 19:this.$={stmt:"state",id:r[a-3],type:"default",description:"",doc:r[a-1]};break;case 20:var l=r[a],c=r[a-2].trim();if(r[a].match(":")){var h=r[a].split(":");l=h[0],c=[c,h[1]]}this.$={stmt:"state",id:l,type:"default",description:c};break;case 21:this.$={stmt:"state",id:r[a-3],type:"default",description:r[a-5],doc:r[a-1]};break;case 22:this.$={stmt:"state",id:r[a],type:"fork"};break;case 23:this.$={stmt:"state",id:r[a],type:"join"};break;case 24:this.$={stmt:"state",id:r[a],type:"choice"};break;case 25:this.$={stmt:"state",id:i.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:r[a-1].trim(),note:{position:r[a-2].trim(),text:r[a].trim()}};break;case 29:this.$=r[a].trim(),i.setAccTitle(this.$);break;case 30:case 31:this.$=r[a].trim(),i.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:r[a-3],url:r[a-2],tooltip:r[a-1]};break;case 33:this.$={stmt:"click",id:r[a-3],url:r[a-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:r[a-1].trim(),classes:r[a].trim()};break;case 36:this.$={stmt:"style",id:r[a-1].trim(),styleClass:r[a].trim()};break;case 37:this.$={stmt:"applyClass",id:r[a-1].trim(),styleClass:r[a].trim()};break;case 38:i.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:i.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:i.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:i.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:r[a].trim(),type:"default",description:""};break;case 46:case 47:this.$={stmt:"state",id:r[a-2].trim(),classes:[r[a].trim()],type:"default",description:""}}},"anonymous"),table:[{3:1,4:e,5:s,6:i},{1:[3]},{3:5,4:e,5:s,6:i},{3:6,4:e,5:s,6:i},t([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],n,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:r,5:o,8:8,9:10,10:12,11:13,12:14,13:15,16:a,17:l,19:c,22:d,24:u,25:p,26:y,27:g,28:f,29:m,32:25,33:S,35:k,37:b,38:T,41:_,45:x,48:E,51:D,52:$,53:C,54:v,57:w},t(I,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:a,17:l,19:c,22:d,24:u,25:p,26:y,27:g,28:f,29:m,32:25,33:S,35:k,37:b,38:T,41:_,45:x,48:E,51:D,52:$,53:C,54:v,57:w},t(I,[2,7]),t(I,[2,8]),t(I,[2,9]),t(I,[2,10]),t(I,[2,11]),t(I,[2,12],{14:[1,40],15:[1,41]}),t(I,[2,16]),{18:[1,42]},t(I,[2,18],{20:[1,43]}),{23:[1,44]},t(I,[2,22]),t(I,[2,23]),t(I,[2,24]),t(I,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},t(I,[2,28]),{34:[1,49]},{36:[1,50]},t(I,[2,31]),{13:51,24:u,57:w},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},t(A,[2,44],{58:[1,56]}),t(A,[2,45],{58:[1,57]}),t(I,[2,38]),t(I,[2,39]),t(I,[2,40]),t(I,[2,41]),t(I,[2,6]),t(I,[2,13]),{13:58,24:u,57:w},t(I,[2,17]),t(L,n,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},t(I,[2,29]),t(I,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},t(I,[2,14],{14:[1,71]}),{4:r,5:o,8:8,9:10,10:12,11:13,12:14,13:15,16:a,17:l,19:c,21:[1,72],22:d,24:u,25:p,26:y,27:g,28:f,29:m,32:25,33:S,35:k,37:b,38:T,41:_,45:x,48:E,51:D,52:$,53:C,54:v,57:w},t(I,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},t(I,[2,34]),t(I,[2,35]),t(I,[2,36]),t(I,[2,37]),t(A,[2,46]),t(A,[2,47]),t(I,[2,15]),t(I,[2,19]),t(L,n,{7:78}),t(I,[2,26]),t(I,[2,27]),{5:[1,79]},{5:[1,80]},{4:r,5:o,8:8,9:10,10:12,11:13,12:14,13:15,16:a,17:l,19:c,21:[1,81],22:d,24:u,25:p,26:y,27:g,28:f,29:m,32:25,33:S,35:k,37:b,38:T,41:_,45:x,48:E,51:D,52:$,53:C,54:v,57:w},t(I,[2,32]),t(I,[2,33]),t(I,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:(0,h.K)(function(t,e){if(!e.recoverable){var s=new Error(t);throw s.hash=e,s}this.trace(t)},"parseError"),parse:(0,h.K)(function(t){var e=this,s=[0],i=[],n=[null],r=[],o=this.table,a="",l=0,c=0,d=0,u=r.slice.call(arguments,1),p=Object.create(this.lexer),y={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(y.yy[g]=this.yy[g]);p.setInput(t,y.yy),y.yy.lexer=p,y.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var f=p.yylloc;r.push(f);var m=p.options&&p.options.ranges;function S(){var t;return"number"!=typeof(t=i.pop()||p.lex()||1)&&(t instanceof Array&&(t=(i=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof y.yy.parseError?this.parseError=y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,(0,h.K)(function(t){s.length=s.length-2*t,n.length=n.length-t,r.length=r.length-t},"popStack"),(0,h.K)(S,"lex");for(var k,b,T,_,x,E,D,$,C,v={};;){if(T=s[s.length-1],this.defaultActions[T]?_=this.defaultActions[T]:(null==k&&(k=S()),_=o[T]&&o[T][k]),void 0===_||!_.length||!_[0]){var w="";for(E in C=[],o[T])this.terminals_[E]&&E>2&&C.push("'"+this.terminals_[E]+"'");w=p.showPosition?"Parse error on line "+(l+1)+":\n"+p.showPosition()+"\nExpecting "+C.join(", ")+", got '"+(this.terminals_[k]||k)+"'":"Parse error on line "+(l+1)+": Unexpected "+(1==k?"end of input":"'"+(this.terminals_[k]||k)+"'"),this.parseError(w,{text:p.match,token:this.terminals_[k]||k,line:p.yylineno,loc:f,expected:C})}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+T+", token: "+k);switch(_[0]){case 1:s.push(k),n.push(p.yytext),r.push(p.yylloc),s.push(_[1]),k=null,b?(k=b,b=null):(c=p.yyleng,a=p.yytext,l=p.yylineno,f=p.yylloc,d>0&&d--);break;case 2:if(D=this.productions_[_[1]][1],v.$=n[n.length-D],v._$={first_line:r[r.length-(D||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(D||1)].first_column,last_column:r[r.length-1].last_column},m&&(v._$.range=[r[r.length-(D||1)].range[0],r[r.length-1].range[1]]),void 0!==(x=this.performAction.apply(v,[a,c,l,y.yy,_[1],n,r].concat(u))))return x;D&&(s=s.slice(0,-1*D*2),n=n.slice(0,-1*D),r=r.slice(0,-1*D)),s.push(this.productions_[_[1]][0]),n.push(v.$),r.push(v._$),$=o[s[s.length-2]][s[s.length-1]],s.push($);break;case 3:return!0}}return!0},"parse")},N=function(){return{EOF:1,parseError:(0,h.K)(function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},"parseError"),setInput:(0,h.K)(function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:(0,h.K)(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:(0,h.K)(function(t){var e=t.length,s=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var i=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),s.length-1&&(this.yylineno-=s.length-1);var n=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:s?(s.length===i.length?this.yylloc.first_column:0)+i[i.length-s.length].length-s[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[n[0],n[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},"unput"),more:(0,h.K)(function(){return this._more=!0,this},"more"),reject:(0,h.K)(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:(0,h.K)(function(t){this.unput(this.match.slice(t))},"less"),pastInput:(0,h.K)(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:(0,h.K)(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:(0,h.K)(function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},"showPosition"),test_match:(0,h.K)(function(t,e){var s,i,n;if(this.options.backtrack_lexer&&(n={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(n.yylloc.range=this.yylloc.range.slice(0))),(i=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],s=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),s)return s;if(this._backtrack){for(var r in n)this[r]=n[r];return!1}return!1},"test_match"),next:(0,h.K)(function(){if(this.done)return this.EOF;var t,e,s,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var n=this._currentRules(),r=0;r<n.length;r++)if((s=this._input.match(this.rules[n[r]]))&&(!e||s[0].length>e[0].length)){if(e=s,i=r,this.options.backtrack_lexer){if(!1!==(t=this.test_match(s,n[r])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,n[i]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:(0,h.K)(function(){var t=this.next();return t||this.lex()},"lex"),begin:(0,h.K)(function(t){this.conditionStack.push(t)},"begin"),popState:(0,h.K)(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:(0,h.K)(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:(0,h.K)(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:(0,h.K)(function(t){this.begin(t)},"pushState"),stateStackSize:(0,h.K)(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:(0,h.K)(function(t,e,s,i){function n(){const s=e.yytext.indexOf("%%");if(0===s)return!1;if(s>0){const i=e.yytext.slice(0,s),n=e.yytext.slice(s);n&&t.lexer.unput(n),e.yytext=i}return!0}(0,h.K)(n,"processId");switch(s){case 0:return 38;case 1:return 40;case 2:return 39;case 3:return 44;case 4:case 43:return 51;case 5:case 44:return 52;case 6:case 45:return 53;case 7:case 46:return 54;case 8:case 78:return 5;case 9:case 10:case 11:case 12:case 57:case 63:break;case 13:case 33:return this.pushState("SCALE"),17;case 14:case 34:return 18;case 15:case 21:case 35:case 50:case 54:this.popState();break;case 16:return this.begin("acc_title"),33;case 17:return this.popState(),"acc_title_value";case 18:return this.begin("acc_descr"),35;case 19:return this.popState(),"acc_descr_value";case 20:this.begin("acc_descr_multiline");break;case 22:return"acc_descr_multiline_value";case 23:return this.pushState("CLASSDEF"),41;case 24:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";case 25:return this.popState(),this.pushState("CLASSDEFID"),42;case 26:return this.popState(),43;case 27:return this.pushState("CLASS"),48;case 28:return this.popState(),this.pushState("CLASS_STYLE"),49;case 29:return this.popState(),50;case 30:return this.pushState("STYLE"),45;case 31:return this.popState(),this.pushState("STYLEDEF_STYLES"),46;case 32:return this.popState(),47;case 36:this.pushState("STATE");break;case 37:case 40:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),25;case 38:case 41:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),26;case 39:case 42:return this.popState(),e.yytext=e.yytext.slice(0,-10).trim(),27;case 47:this.pushState("STATE_STRING");break;case 48:return this.pushState("STATE_ID"),"AS";case 49:case 65:if(!n())return;return this.popState(),"ID";case 51:return"STATE_DESCR";case 52:throw new Error('Error: State name must be a single word. Found: "'+e.yytext.trim()+'"');case 53:return 19;case 55:return this.popState(),this.pushState("struct"),20;case 56:return this.popState(),21;case 58:return this.begin("NOTE"),29;case 59:return this.popState(),this.pushState("NOTE_ID"),59;case 60:return this.popState(),this.pushState("NOTE_ID"),60;case 61:this.popState(),this.pushState("FLOATING_NOTE");break;case 62:return this.popState(),this.pushState("FLOATING_NOTE_ID"),"AS";case 64:return"NOTE_TEXT";case 66:if(!n())return;return this.popState(),this.pushState("NOTE_TEXT"),24;case 67:return this.popState(),e.yytext=e.yytext.substr(2).trim(),31;case 68:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),31;case 69:case 70:return 6;case 71:return 16;case 72:return 57;case 73:if(!n())return;return 24;case 74:return e.yytext=e.yytext.trim(),14;case 75:return 15;case 76:return 28;case 77:return 58;case 79:return"INVALID"}},"anonymous"),rules:[/^(?:click\b)/i,/^(?:href\b)/i,/^(?:"[^"]*")/i,/^(?:default\b)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:classDef\s+)/i,/^(?:DEFAULT\s+)/i,/^(?:\w+\s+)/i,/^(?:[^\n]*)/i,/^(?:class\s+)/i,/^(?:(\w+)+((,\s*\w+)*))/i,/^(?:[^\n]*)/i,/^(?:style\s+)/i,/^(?:[\w,]+\s+)/i,/^(?:[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:state\s+)/i,/^(?:.*<<fork>>)/i,/^(?:.*<<join>>)/i,/^(?:.*<<choice>>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\w+\s+\w+.*?\{)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:[\s\S]*?\n\s*end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:(?:[^:\n;]|:[^:\n;])+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?::::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[10,11,12],inclusive:!1},struct:{rules:[10,11,12,23,27,30,36,43,44,45,46,56,57,58,72,73,74,75,76,77],inclusive:!1},FLOATING_NOTE_ID:{rules:[65],inclusive:!1},FLOATING_NOTE:{rules:[62,63,64],inclusive:!1},NOTE_TEXT:{rules:[67,68],inclusive:!1},NOTE_ID:{rules:[66],inclusive:!1},NOTE:{rules:[59,60,61],inclusive:!1},STYLEDEF_STYLEOPTS:{rules:[],inclusive:!1},STYLEDEF_STYLES:{rules:[32],inclusive:!1},STYLE_IDS:{rules:[],inclusive:!1},STYLE:{rules:[31],inclusive:!1},CLASS_STYLE:{rules:[29],inclusive:!1},CLASS:{rules:[28],inclusive:!1},CLASSDEFID:{rules:[26],inclusive:!1},CLASSDEF:{rules:[24,25],inclusive:!1},acc_descr_multiline:{rules:[21,22],inclusive:!1},acc_descr:{rules:[19],inclusive:!1},acc_title:{rules:[17],inclusive:!1},SCALE:{rules:[14,15,34,35],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[49],inclusive:!1},STATE_STRING:{rules:[50,51],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[10,11,12,37,38,39,40,41,42,47,48,52,53,54,55],inclusive:!1},ID:{rules:[10,11,12],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,12,13,16,18,20,23,27,30,33,36,55,58,69,70,71,72,73,74,75,77,78,79],inclusive:!0}}}}();function K(){this.yy={}}return R.lexer=N,(0,h.K)(K,"Parser"),K.prototype=R,R.Parser=K,new K}();p.parser=p;var y=p,g="state",f="root",m="relation",S="default",k="divider",b="fill:none",T="fill: #333",_="markdown",x="normal",E="rect",D="rectWithTitle",$="divider",C="roundedWithTitle",v="statediagram",w=`${v}-state`,I="transition",A=`${I} note-edge`,L=`${v}-note`,R=`${v}-cluster`,N=`${v}-cluster-alt`,K="parent",O="note",B="----",F=`${B}${O}`,P=`${B}${K}`,Y=(0,h.K)((t,e="TB")=>{if(!t.doc)return e;let s=e;for(const e of t.doc)"dir"===e.stmt&&(s=e.value);return s},"getDir"),G={getClasses:(0,h.K)(function(t,e){return e.db.getClasses()},"getClasses"),draw:(0,h.K)(async function(t,e,s,o){c.R.info("REF0:"),c.R.info("Drawing state diagram (v2)",e);const{securityLevel:h,state:d,layout:u}=(0,l.D7)();o.db.extract(o.db.getRootDocV2());const p=o.db.getData(),y=(0,i.A)(e,h);p.type=o.type,p.layoutAlgorithm=u,p.nodeSpacing=d?.nodeSpacing||50,p.rankSpacing=d?.rankSpacing||50;"neo"===(0,l.D7)().look?p.markers=["barbNeo"]:p.markers=["barb"],p.diagramId=e,await(0,r.XX)(p,y);try{("function"==typeof o.db.getLinks?o.db.getLinks():new Map).forEach((t,e)=>{const s="string"==typeof e?e:"string"==typeof e?.id?e.id:"",i=p.nodes.find(t=>t.id===s);if(!s)return void c.R.warn("⚠️ Invalid or missing stateId from key:",JSON.stringify(e));const n=y.node()?.querySelectorAll("g.node, g.rough-node");let r;if(n?.forEach(t=>{const e=t.textContent?.trim();t.id!==i?.domId&&e!==s||(r=t)}),!r)return void c.R.warn("⚠️ Could not find node matching text:",s);const o=r.parentNode;if(!o)return void c.R.warn("⚠️ Node has no parent, cannot wrap:",s);const a=document.createElementNS("http://www.w3.org/2000/svg","a"),l=t.url.replace(/^"+|"+$/g,"");if(a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l),a.setAttribute("target","_blank"),t.tooltip){const e=t.tooltip.replace(/^"+|"+$/g,"");a.setAttribute("title",e),r.setAttribute("title",e)}o.replaceChild(a,r),a.appendChild(r),c.R.info("🔗 Wrapped node in <a> tag for:",s,t.url)})}catch(t){c.R.error("❌ Error injecting clickable links:",t)}a._K.insertTitle(y,"statediagramTitleText",d?.titleTopMargin??25,o.db.getDiagramTitle()),(0,n.P)(y,8,v,d?.useMaxWidth??!0)},"draw"),getDir:Y},j=new Map,z=0;function M(t="",e=0,s="",i=B){return`state-${t}${null!==s&&s.length>0?`${i}${s}`:""}-${e}`}(0,h.K)(M,"stateDomId");var W=(0,h.K)((t,e,s,i,n,r,o,a)=>{c.R.trace("items",e),e.forEach(e=>{switch(e.stmt){case g:case S:J(t,e,s,i,n,r,o,a);break;case m:{J(t,e.state1,s,i,n,r,o,a),J(t,e.state2,s,i,n,r,o,a);const c="neo"===o,h={id:"edge"+z,start:e.state1.id,end:e.state2.id,arrowhead:"normal",arrowTypeEnd:c?"arrow_barb_neo":"arrow_barb",style:b,labelStyle:"",label:l.Y2.sanitizeText(e.description??"",(0,l.D7)()),arrowheadStyle:T,labelpos:"c",labelType:_,thickness:x,classes:I,look:o};n.push(h),z++}}})},"setupDoc"),U=(0,h.K)((t,e="TB")=>{let s=e;if(t.doc)for(const e of t.doc)"dir"===e.stmt&&(s=e.value);return s},"getDir");function X(t,e,s){if(!e.id||"</join></fork>"===e.id||"</choice>"===e.id)return;e.cssClasses&&(Array.isArray(e.cssCompiledStyles)||(e.cssCompiledStyles=[]),e.cssClasses.split(" ").forEach(t=>{const i=s.get(t);i&&(e.cssCompiledStyles=[...e.cssCompiledStyles??[],...i.styles])}));const i=t.find(t=>t.id===e.id);i?Object.assign(i,e):t.push(e)}function H(t){return t?.classes?.join(" ")??""}function V(t){return t?.styles??[]}(0,h.K)(X,"insertOrUpdateNode"),(0,h.K)(H,"getClassesFromDbInfo"),(0,h.K)(V,"getStylesFromDbInfo");var J=(0,h.K)((t,e,s,i,n,r,o,a)=>{const h=e.id,d=s.get(h),u=H(d),p=V(d),y=(0,l.D7)();if(c.R.info("dataFetcher parsedItem",e,d,p),"root"!==h){let s=E;!0===e.start?s="stateStart":!1===e.start&&(s="stateEnd"),e.type!==S&&(s=e.type),j.get(h)||j.set(h,{id:h,shape:s,description:l.Y2.sanitizeText(h,y),cssClasses:`${u} ${w}`,cssStyles:p});const d=j.get(h);e.description&&(Array.isArray(d.description)?(d.shape=D,d.description.push(e.description)):d.description?.length&&d.description.length>0?(d.shape=D,d.description===h?d.description=[e.description]:d.description=[d.description,e.description]):(d.shape=E,d.description=e.description),d.description=l.Y2.sanitizeTextOrArray(d.description,y)),1===d.description?.length&&d.shape===D&&("group"===d.type?d.shape=C:d.shape=E),!d.type&&e.doc&&(c.R.info("Setting cluster for XCX",h,U(e)),d.type="group",d.isGroup=!0,d.dir=U(e),d.shape=e.type===k?$:C,d.cssClasses=`${d.cssClasses} ${R} ${r?N:""}`);const g={labelStyle:"",shape:d.shape,label:d.description,cssClasses:d.cssClasses,cssCompiledStyles:[],cssStyles:d.cssStyles,id:h,dir:d.dir,domId:M(h,z),type:d.type,isGroup:"group"===d.type,padding:8,rx:10,ry:10,look:o,labelType:"markdown"};if(g.shape===$&&(g.label=""),t&&"root"!==t.id&&(c.R.trace("Setting node ",h," to be child of its parent ",t.id),g.parentId=t.id),g.centerLabel=!0,e.note){const t={labelStyle:"",shape:"note",label:e.note.text,labelType:"markdown",cssClasses:L,cssStyles:[],cssCompiledStyles:[],id:h+F+"-"+z,domId:M(h,z,O),type:d.type,isGroup:"group"===d.type,padding:y.flowchart?.padding,look:o,position:e.note.position},s=h+P,r={labelStyle:"",shape:"noteGroup",label:e.note.text,cssClasses:d.cssClasses,cssStyles:[],id:h+P,domId:M(h,z,K),type:"group",isGroup:!0,padding:16,look:o,position:e.note.position};z++,r.id=s,t.parentId=s,X(i,r,a),X(i,t,a),X(i,g,a);let l=h,c=t.id;"left of"===e.note.position&&(l=t.id,c=h),n.push({id:l+"-"+c,start:l,end:c,arrowhead:"none",arrowTypeEnd:"",style:b,labelStyle:"",classes:A,arrowheadStyle:T,labelpos:"c",labelType:_,thickness:x,look:o})}else X(i,g,a)}e.doc&&(c.R.trace("Adding nodes children "),W(e,e.doc,s,i,n,!r,o,a))},"dataFetcher"),q=(0,h.K)(()=>{j.clear(),z=0},"reset"),Z="[*]",Q="start",tt="[*]",et="end",st="color",it="fill",nt="bgFill",rt=",",ot=(0,h.K)(()=>new Map,"newClassesList"),at=(0,h.K)(()=>({relations:[],states:new Map,documents:{}}),"newDoc"),lt=(0,h.K)(t=>JSON.parse(JSON.stringify(t)),"clone"),ct=class{constructor(t){this.version=t,this.nodes=[],this.edges=[],this.rootDoc=[],this.classes=ot(),this.documents={root:at()},this.currentDocument=this.documents.root,this.startEndCount=0,this.dividerCnt=0,this.links=new Map,this.funs=[],this.getAccTitle=l.iN,this.setAccTitle=l.SV,this.getAccDescription=l.m7,this.setAccDescription=l.EI,this.setDiagramTitle=l.ke,this.getDiagramTitle=l.ab,this.clear(),this.setRootDoc=this.setRootDoc.bind(this),this.getDividerId=this.getDividerId.bind(this),this.setDirection=this.setDirection.bind(this),this.trimColon=this.trimColon.bind(this),this.bindFunctions=this.bindFunctions.bind(this)}static{(0,h.K)(this,"StateDB")}static{this.relationType={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3}}extract(t){this.clear(!0);for(const e of Array.isArray(t)?t:t.doc)switch(e.stmt){case g:this.addState(e.id.trim(),e.type,e.doc,e.description,e.note);break;case m:this.addRelation(e.state1,e.state2,e.description);break;case"classDef":this.addStyleClass(e.id.trim(),e.classes);break;case"style":this.handleStyleDef(e);break;case"applyClass":this.setCssClass(e.id.trim(),e.styleClass);break;case"click":this.addLink(e.id,e.url,e.tooltip)}const e=this.getStates(),s=(0,l.D7)();q(),J(void 0,this.getRootDocV2(),e,this.nodes,this.edges,!0,s.look,this.classes);for(const t of this.nodes)if(Array.isArray(t.label)){if(t.description=t.label.slice(1),t.isGroup&&t.description.length>0)throw new Error(`Group nodes can only have label. Remove the additional description for node [${t.id}]`);t.label=t.label[0]}}handleStyleDef(t){const e=t.id.trim().split(","),s=t.styleClass.split(",");for(const t of e){let e=this.getState(t);if(!e){const s=t.trim();this.addState(s),e=this.getState(s)}e&&(e.styles=s.map(t=>t.replace(/;/g,"")?.trim()))}}setRootDoc(t){c.R.info("Setting root doc",t),this.rootDoc=t,1===this.version?this.extract(t):this.extract(this.getRootDocV2())}docTranslator(t,e,s){if(e.stmt===m)return this.docTranslator(t,e.state1,!0),void this.docTranslator(t,e.state2,!1);if(e.stmt===g&&(e.id===Z?(e.id=t.id+(s?"_start":"_end"),e.start=s):e.id=e.id.trim()),e.stmt!==f&&e.stmt!==g||!e.doc)return;const i=[];let n=[];for(const t of e.doc)if(t.type===k){const e=lt(t);e.doc=lt(n),i.push(e),n=[]}else n.push(t);if(i.length>0&&n.length>0){const t={stmt:g,id:(0,a.$C)(),type:"divider",doc:lt(n)};i.push(lt(t)),e.doc=i}e.doc.forEach(t=>this.docTranslator(e,t,!0))}getRootDocV2(){return this.docTranslator({id:f,stmt:f},{id:f,stmt:f,doc:this.rootDoc},!0),{id:f,doc:this.rootDoc}}addState(t,e=S,s=void 0,i=void 0,n=void 0,r=void 0,o=void 0,a=void 0){const h=t?.trim();if(this.currentDocument.states.has(h)){const t=this.currentDocument.states.get(h);if(!t)throw new Error(`State not found: ${h}`);t.doc||(t.doc=s),t.type||(t.type=e)}else c.R.info("Adding state ",h,i),this.currentDocument.states.set(h,{stmt:g,id:h,descriptions:[],type:e,doc:s,note:n,classes:[],styles:[],textStyles:[]});if(i){c.R.info("Setting state description",h,i);(Array.isArray(i)?i:[i]).forEach(t=>this.addDescription(h,t.trim()))}if(n){const t=this.currentDocument.states.get(h);if(!t)throw new Error(`State not found: ${h}`);t.note=n,t.note.text=l.Y2.sanitizeText(t.note.text,(0,l.D7)())}if(r){c.R.info("Setting state classes",h,r);(Array.isArray(r)?r:[r]).forEach(t=>this.setCssClass(h,t.trim()))}if(o){c.R.info("Setting state styles",h,o);(Array.isArray(o)?o:[o]).forEach(t=>this.setStyle(h,t.trim()))}if(a){c.R.info("Setting state styles",h,o);(Array.isArray(a)?a:[a]).forEach(t=>this.setTextStyle(h,t.trim()))}}clear(t){this.nodes=[],this.edges=[],this.funs=[this.setupToolTips.bind(this)],this.documents={root:at()},this.currentDocument=this.documents.root,this.startEndCount=0,this.classes=ot(),t||(this.links=new Map,(0,l.IU)())}getState(t){return this.currentDocument.states.get(t)}getStates(){return this.currentDocument.states}logDocuments(){c.R.info("Documents = ",this.documents)}getRelations(){return this.currentDocument.relations}addLink(t,e,s){this.links.set(t,{url:e,tooltip:s}),c.R.warn("Adding link",t,e,s)}getLinks(){return this.links}startIdIfNeeded(t=""){return t===Z?(this.startEndCount++,`${Q}${this.startEndCount}`):t}startTypeIfNeeded(t="",e=S){return t===Z?Q:e}endIdIfNeeded(t=""){return t===tt?(this.startEndCount++,`${et}${this.startEndCount}`):t}endTypeIfNeeded(t="",e=S){return t===tt?et:e}addRelationObjs(t,e,s=""){const i=this.startIdIfNeeded(t.id.trim()),n=this.startTypeIfNeeded(t.id.trim(),t.type),r=this.startIdIfNeeded(e.id.trim()),o=this.startTypeIfNeeded(e.id.trim(),e.type);this.addState(i,n,t.doc,t.description,t.note,t.classes,t.styles,t.textStyles),this.addState(r,o,e.doc,e.description,e.note,e.classes,e.styles,e.textStyles),this.currentDocument.relations.push({id1:i,id2:r,relationTitle:l.Y2.sanitizeText(s,(0,l.D7)())})}addRelation(t,e,s){if("object"==typeof t&&"object"==typeof e)this.addRelationObjs(t,e,s);else if("string"==typeof t&&"string"==typeof e){const i=this.startIdIfNeeded(t.trim()),n=this.startTypeIfNeeded(t),r=this.endIdIfNeeded(e.trim()),o=this.endTypeIfNeeded(e);this.addState(i,n),this.addState(r,o),this.currentDocument.relations.push({id1:i,id2:r,relationTitle:s?l.Y2.sanitizeText(s,(0,l.D7)()):void 0})}}addDescription(t,e){const s=this.currentDocument.states.get(t),i=e.startsWith(":")?e.replace(":","").trim():e;s?.descriptions?.push(l.Y2.sanitizeText(i,(0,l.D7)()))}cleanupLabel(t){return t.startsWith(":")?t.slice(2).trim():t.trim()}getDividerId(){return this.dividerCnt++,`divider-id-${this.dividerCnt}`}addStyleClass(t,e=""){this.classes.has(t)||this.classes.set(t,{id:t,styles:[],textStyles:[]});const s=this.classes.get(t);e&&s&&e.split(rt).forEach(t=>{const e=t.replace(/([^;]*);/,"$1").trim();if(RegExp(st).exec(t)){const t=e.replace(it,nt).replace(st,it);s.textStyles.push(t)}s.styles.push(e)})}getClasses(){return this.classes}setupToolTips(t){const e=(0,o.Ck)();(0,d.Ltv)(t).select("svg").selectAll("g.node, g.rough-node").on("mouseover",t=>{const s=(0,d.Ltv)(t.currentTarget),i=s.attr("title");if(null===i)return;const n=t.currentTarget?.getBoundingClientRect();e.transition().duration(200).style("opacity",".9"),e.style("left",window.scrollX+n.left+(n.right-n.left)/2+"px").style("top",window.scrollY+n.bottom+"px"),e.html(u.A.sanitize(i)),s.classed("hover",!0)}).on("mouseout",t=>{e.transition().duration(500).style("opacity",0);(0,d.Ltv)(t.currentTarget).classed("hover",!1)})}setCssClass(t,e){t.split(",").forEach(t=>{let s=this.getState(t);if(!s){const e=t.trim();this.addState(e),s=this.getState(e)}s?.classes?.push(e)})}setStyle(t,e){this.getState(t)?.styles?.push(e)}setTextStyle(t,e){this.getState(t)?.textStyles?.push(e)}bindFunctions(t){this.funs.forEach(e=>{e(t)})}getDirectionStatement(){return this.rootDoc.find(t=>"dir"===t.stmt)}getDirection(){return this.getDirectionStatement()?.value??"TB"}setDirection(t){const e=this.getDirectionStatement();e?e.value=t:this.rootDoc.unshift({stmt:"dir",value:t})}trimColon(t){return t.startsWith(":")?t.slice(1).trim():t.trim()}getData(){const t=(0,l.D7)();return{nodes:this.nodes,edges:this.edges,other:{},config:t,direction:Y(this.getRootDocV2())}}getConfig(){return(0,l.D7)().state}},ht=(0,h.K)(t=>`\ndefs [id$="-barbEnd"] {\n fill: ${t.transitionColor};\n stroke: ${t.transitionColor};\n }\ng.stateGroup text {\n fill: ${t.nodeBorder};\n stroke: none;\n font-size: 10px;\n}\ng.stateGroup text {\n fill: ${t.textColor};\n stroke: none;\n font-size: 10px;\n\n}\ng.stateGroup .state-title {\n font-weight: bolder;\n fill: ${t.stateLabelColor};\n}\n\ng.stateGroup rect {\n fill: ${t.mainBkg};\n stroke: ${t.nodeBorder};\n}\n\ng.stateGroup line {\n stroke: ${t.lineColor};\n stroke-width: ${t.strokeWidth||1};\n}\n\n.transition {\n stroke: ${t.transitionColor};\n stroke-width: ${t.strokeWidth||1};\n fill: none;\n}\n\n.stateGroup .composit {\n fill: ${t.background};\n border-bottom: 1px\n}\n\n.stateGroup .alt-composit {\n fill: #e0e0e0;\n border-bottom: 1px\n}\n\n.state-note {\n stroke: ${t.noteBorderColor};\n fill: ${t.noteBkgColor};\n\n text {\n fill: ${t.noteTextColor};\n stroke: none;\n font-size: 10px;\n }\n}\n\n.stateLabel .box {\n stroke: none;\n stroke-width: 0;\n fill: ${t.mainBkg};\n opacity: 0.5;\n}\n\n.edgeLabel .label rect {\n fill: ${t.labelBackgroundColor};\n opacity: 0.5;\n}\n.edgeLabel {\n background-color: ${t.edgeLabelBackground};\n p {\n background-color: ${t.edgeLabelBackground};\n }\n rect {\n opacity: 0.5;\n background-color: ${t.edgeLabelBackground};\n fill: ${t.edgeLabelBackground};\n }\n text-align: center;\n}\n.edgeLabel .label text {\n fill: ${t.transitionLabelColor||t.tertiaryTextColor};\n}\n.label div .edgeLabel {\n color: ${t.transitionLabelColor||t.tertiaryTextColor};\n}\n\n.stateLabel text {\n fill: ${t.stateLabelColor};\n font-size: 10px;\n font-weight: bold;\n}\n\n.node circle.state-start {\n fill: ${t.specialStateColor};\n stroke: ${t.specialStateColor};\n}\n\n.node .fork-join {\n fill: ${t.specialStateColor};\n stroke: ${t.specialStateColor};\n}\n\n.node circle.state-end {\n fill: ${t.innerEndBackground};\n stroke: ${t.background};\n stroke-width: 1.5\n}\n.end-state-inner {\n fill: ${t.compositeBackground||t.background};\n // stroke: ${t.background};\n stroke-width: 1.5\n}\n\n.node rect {\n fill: ${t.stateBkg||t.mainBkg};\n stroke: ${t.stateBorder||t.nodeBorder};\n stroke-width: ${t.strokeWidth||1}px;\n}\n.node polygon {\n fill: ${t.mainBkg};\n stroke: ${t.stateBorder||t.nodeBorder};;\n stroke-width: ${t.strokeWidth||1}px;\n}\n[id$="-barbEnd"] {\n fill: ${t.lineColor};\n}\n\n.statediagram-cluster rect {\n fill: ${t.compositeTitleBackground};\n stroke: ${t.stateBorder||t.nodeBorder};\n stroke-width: ${t.strokeWidth||1}px;\n}\n\n.cluster-label, .nodeLabel {\n color: ${t.stateLabelColor};\n // line-height: 1;\n}\n\n.statediagram-cluster rect.outer {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-state .divider {\n stroke: ${t.stateBorder||t.nodeBorder};\n}\n\n.statediagram-state .title-state {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-cluster.statediagram-cluster .inner {\n fill: ${t.compositeBackground||t.background};\n}\n.statediagram-cluster.statediagram-cluster-alt .inner {\n fill: ${t.altBackground?t.altBackground:"#efefef"};\n}\n\n.statediagram-cluster .inner {\n rx:0;\n ry:0;\n}\n\n.statediagram-state rect.basic {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-state rect.divider {\n stroke-dasharray: 10,10;\n fill: ${t.altBackground?t.altBackground:"#efefef"};\n}\n\n.note-edge {\n stroke-dasharray: 5;\n}\n\n.statediagram-note rect {\n fill: ${t.noteBkgColor};\n stroke: ${t.noteBorderColor};\n stroke-width: 1px;\n rx: 0;\n ry: 0;\n}\n.statediagram-note rect {\n fill: ${t.noteBkgColor};\n stroke: ${t.noteBorderColor};\n stroke-width: 1px;\n rx: 0;\n ry: 0;\n}\n\n.statediagram-note text {\n fill: ${t.noteTextColor};\n}\n\n.statediagram-note .nodeLabel {\n color: ${t.noteTextColor};\n}\n.statediagram .edgeLabel {\n color: red; // ${t.noteTextColor};\n}\n\n[id$="-dependencyStart"], [id$="-dependencyEnd"] {\n fill: ${t.lineColor};\n stroke: ${t.lineColor};\n stroke-width: ${t.strokeWidth||1};\n}\n\n.statediagramTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${t.textColor};\n}\n\n[data-look="neo"].statediagram-cluster rect {\n fill: ${t.mainBkg};\n stroke: ${t.useGradient?"url("+t.svgId+"-gradient)":t.stateBorder||t.nodeBorder};\n stroke-width: ${t.strokeWidth??1};\n}\n[data-look="neo"].statediagram-cluster rect.outer {\n rx: ${t.radius}px;\n ry: ${t.radius}px;\n filter: ${t.dropShadow?t.dropShadow.replace("url(#drop-shadow)",`url(${t.svgId}-drop-shadow)`):"none"}\n}\n`,"getStyles")},1672(t,e,s){s.d(e,{P:()=>o});var i=s(86535),n=s(31293),r=s(86827),o=(0,r.K)((t,e,s,r)=>{t.attr("class",s);const{width:o,height:c,x:h,y:d}=a(t,e);(0,i.a$)(t,c,o,r);const u=l(h,d,o,c,e);t.attr("viewBox",u),n.R.debug(`viewBox configured: ${u} with padding: ${e}`)},"setupViewPortForSVG"),a=(0,r.K)((t,e)=>{const s=t.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:s.width+2*e,height:s.height+2*e,x:s.x,y:s.y}},"calculateDimensionsWithPadding"),l=(0,r.K)((t,e,s,i,n)=>`${t-n} ${e-n} ${s} ${i}`,"createViewBox")},96755(t,e,s){s.d(e,{A:()=>r});var i=s(86827),n=s(51444),r=(0,i.K)((t,e)=>{let s;"sandbox"===e&&(s=(0,n.Ltv)("#i"+t));return("sandbox"===e?(0,n.Ltv)(s.nodes()[0].contentDocument.body):(0,n.Ltv)("body")).select(`[id="${t}"]`)},"getDiagramElement")}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[4830],{24830(t,e,n){n.r(e),n.d(e,{render:()=>_n});var o=n(35167),r=(n(78771),n(46853)),s=(n(717),n(79515),n(44505),n(69793),n(43287),n(12505),n(86535),n(31293)),i=n(86827),a=1e-5,c=1e-6;function f(t){const e=[];for(let n=0;n<t.length-1;n++)e.push({a:t[n],b:t[n+1]});return e}function d(t,e,n,o){const r=e.x-t.x,s=e.y-t.y,i=o.x-n.x,a=o.y-n.y,f=r*a-s*i;if(0===f)return null;const d=n.x-t.x,l=n.y-t.y,u=(d*a-l*i)/f,h=(d*s-l*r)/f;return u<=c||u>=.999999||h<=c||h>=.999999?null:{point:{x:t.x+u*r,y:t.y+u*s},tA:u,tB:h}}function l(t){return Math.abs(t.b.x-t.a.x)>=Math.abs(t.b.y-t.a.y)}function u(t){const e=[];for(let n=0;n<t.length;n++){const o=t[n],r=f(o.points);for(let s=n+1;s<t.length;s++){const n=t[s],i=f(n.points);for(const[t,s]of r.entries())for(const[r,a]of i.entries()){const i=d(s.a,s.b,a.a,a.b);if(!i)continue;const c=l(s);!!(c!==l(a))&&c?e.push({jumpEdgeId:o.id,otherEdgeId:n.id,segIndex:t,t:i.tA,point:i.point}):e.push({jumpEdgeId:n.id,otherEdgeId:o.id,segIndex:r,t:i.tB,point:i.point})}}}return e}function h(t){const e=Math.round(1e3*t)/1e3;return Number.isInteger(e),`${e}`}function g(t){return`${h(t.x)},${h(t.y)}`}function p(t){const e=t.b.x-t.a.x,n=t.b.y-t.a.y;return Math.abs(e)>=Math.abs(n)?e>=0?1:0:n>=0?1:0}(0,i.K)(f,"buildSegmentList"),(0,i.K)(d,"segmentIntersection"),(0,i.K)(l,"isHorizontalSeg"),(0,i.K)(u,"findEdgeIntersections"),(0,i.K)(h,"fmt"),(0,i.K)(g,"pointToString"),(0,i.K)(p,"getArcSweepFlag");function x(t,e){if(t.length<2)return t.map(t=>({...t}));const n=t.map(t=>({...t})),o=e.arrowTypeStart&&r.hq[e.arrowTypeStart];if(o){const e=t[0],r=t[1],s=Math.atan2(r.y-e.y,r.x-e.x);n[0].x=e.x+o*Math.cos(s),n[0].y=e.y+o*Math.sin(s)}const s=e.arrowTypeEnd&&r.hq[e.arrowTypeEnd];if(s){const e=t.length,o=t[e-2],r=t[e-1],i=Math.atan2(r.y-o.y,r.x-o.x);n[e-1].x=r.x-s*Math.cos(i),n[e-1].y=r.y-s*Math.sin(i)}return n}function m(t,e,n,o,r){const s=t.point.x,i=t.point.y,a={x:s-e*t.r,y:i-n*t.r},c={x:s+e*t.r,y:i+n*t.r},f=[`L${g(a)}`];return"arc"===r?f.push(`A${h(t.r)},${h(t.r)} 0 0 ${o} ${g(c)}`):f.push(`M${g(c)}`),f}function y(t,e,n,o){const r=e.x-t.x,s=e.y-t.y,i=n.x-e.x,c=n.y-e.y,f=Math.hypot(r,s),d=Math.hypot(i,c);if(f<a||d<a)return null;const l=r/f,u=s/f,h=i/d,g=c/d,p=l*h+u*g,x=Math.max(-1,Math.min(1,p)),m=Math.acos(x);if(m<a||Math.abs(Math.PI-m)<a)return null;const y=Math.min(o/Math.sin(m/2),f/2,d/2);return{startX:e.x-l*y,startY:e.y-u*y,endX:e.x+h*y,endY:e.y+g*y,ctrlX:e.x,ctrlY:e.y,cutLen:y}}function b(t,e,n){const o=t.points;if(o.length<2)return"";const r=x(o,t),s="rounded"===t.curve,i=f(r),a=new Map;for(const t of e){const e=i[t.segIndex];if(!e)continue;const o=Math.hypot(e.b.x-e.a.x,e.b.y-e.a.y),r=a.get(t.segIndex)??[];r.push({t:t.t,point:t.point,d:t.t*o,r:n.jumpRadius}),a.set(t.segIndex,r)}const c=[`M${g(r[0])}`];for(let t=0;t<i.length;t++){const e=i[t],o=Math.hypot(e.b.x-e.a.x,e.b.y-e.a.y),f=0===o?0:(e.b.x-e.a.x)/o,d=0===o?0:(e.b.y-e.a.y)/o,l=p(e);let u=0;if(s&&t>0){const e=y(r[t-1],r[t],r[t+1]??r[t],5);e&&(u=e.cutLen)}let x=o,b=null;s&&t<i.length-1&&(b=y(r[t],r[t+1],r[t+2]??r[t+1],5),b&&(x=o-b.cutLen));const M=[...a.get(t)??[]].sort((t,e)=>t.t-e.t);for(const t of M)t.r=Math.min(t.r,t.d-u,x-t.d);for(let t=0;t<M.length-1;t++){const e=M[t+1].d-M[t].d;if(M[t].r+M[t+1].r>e){const n=e/2;M[t].r=Math.min(M[t].r,n),M[t+1].r=Math.min(M[t+1].r,n)}}for(const t of M)t.r<.001||c.push(...m(t,f,d,l,n.jumpStyle));s&&b?(c.push(`L${h(b.startX)},${h(b.startY)}`),c.push(`Q${h(b.ctrlX)},${h(b.ctrlY)} ${h(b.endX)},${h(b.endY)}`)):c.push(`L${g(e.b)}`)}return c.join(" ")}function M(t){return/^[\d\s+,.LMelm-]*$/.test(t)}function K(t){return!t||("linear"===t||"rounded"===t||"step"===t||"stepBefore"===t||"stepAfter"===t)}function I(t){if(!t)return null;try{const e="function"==typeof atob?atob(t):Buffer.from(t,"base64").toString(),n=JSON.parse(e);if(!Array.isArray(n))return null;const o=[];for(const t of n)t&&"number"==typeof t.x&&"number"==typeof t.y&&o.push({x:t.x,y:t.y});return o.length>=2?o:null}catch{return null}}function S(t,e,n){if(!n.enabled)return;const o=t.node();if(!o)return;const r=new Map;for(const t of e)r.set(t.id,t);const s=[],i=new Map;for(const t of e){const e="undefined"!=typeof CSS&&CSS.escape?CSS.escape(t.id):t.id,n=o.querySelector(`path[data-id="${e}"]`);if(!n)continue;i.set(t.id,n);const r=I(n.getAttribute("data-points"))??t.points;s.push({...t,points:r})}const a=u(s);if(0===a.length)return;const c=new Map;for(const t of a){const e=c.get(t.jumpEdgeId)??[];e.push(t),c.set(t.jumpEdgeId,e)}for(const t of s){const e=c.get(t.id);if(!e||0===e.length)continue;const o=r.get(t.id),s=o?.curve;if(void 0!==s&&!K(s))continue;const a=i.get(t.id);if(!a)continue;if(void 0===s){if(!M(a.getAttribute("d")??""))continue}const f=a.getAttribute("style")??"",d=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(f),l=d?Number.parseFloat(d[1]):null,u=d?Number.parseFloat(d[2]):null,h=b(t,e,n);if(a.setAttribute("d",h),null!==l&&null!==u&&"function"==typeof a.getTotalLength){const t=a.getTotalLength(),e=`0 ${l} ${Math.max(0,t-l-u)} ${u}`,n=f.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${e};`).replace(/;\s*;+/g,";");a.setAttribute("style",n)}}}function w(t,{measure:e}){const n=t.config?.swimlane?.lineHops;if(!1===n)return;const o="gap"===n?"gap":"arc",r=t.edges.filter(t=>Array.isArray(t.points)&&t.points.length>=2).map(t=>({id:t.id,points:t.points,curve:t.curve,arrowTypeStart:t.arrowTypeStart,arrowTypeEnd:t.arrowTypeEnd}));S(e.groups.edgePaths,r,{enabled:!0,jumpRadius:6,jumpStyle:o})}(0,i.K)(x,"applyMarkerOffsets"),(0,i.K)(m,"emitJump"),(0,i.K)(y,"computeRoundedCorner"),(0,i.K)(b,"rewriteEdgePath"),(0,i.K)(M,"isStraightPath"),(0,i.K)(K,"curveSupportsLineHops"),(0,i.K)(I,"decodeDataPoints"),(0,i.K)(S,"applyLineJumpsToSvg"),(0,i.K)(w,"applySwimlaneLineJumps");var v="__swimlane_default__";function C(t){return Math.max(t.padding??20,20)}function L(t){const{x:e,y:n,width:o,height:r}=t,s=t.swimlaneContentTop;if("number"!=typeof e||"number"!=typeof n||"number"!=typeof o||"number"!=typeof r||"number"!=typeof s||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(r)||!Number.isFinite(s)||o<=0||r<=0)return void delete t.groupTitleRect;const i=n-r/2,a=Math.min(s,n+r/2),c=i+Math.min(21,Math.max(0,a-i));c<=i?delete t.groupTitleRect:t.groupTitleRect={left:e-o/2,right:e+o/2,top:i,bottom:c}}function k(t){const e=t.direction,n=t.nodes??=[];for(const n of t.nodes??[])n.isGroup&&!n.parentId&&(n.shape="swimlane",e&&(n.direction=e));const o=n.filter(t=>!t.isGroup&&!t.parentId);if(0===o.length)return;let r=n.find(t=>t.id===v);r?r.isGroup&&(r.shape="swimlane",e&&(r.direction=e)):(r={id:v,label:"",isGroup:!0,shape:"swimlane",padding:20,...e?{direction:e}:{}},n.push(r));for(const t of o)t.parentId=v}function O(t){const e=new Map;for(const n of t.nodes??[])e.set(n.id,n);const n=[];for(const e of t.edges??[]){const t="string"==typeof e.start?e.start:void 0,o="string"==typeof e.end?e.end:void 0;t&&o&&(e.labelNodeId||n.push({id:e.id,src:t,dst:o,ref:e}))}const o=t.nodes??[],r=o.filter(t=>t.isGroup),s=o.filter(t=>!t.isGroup);return{nodes:[...[...r].reverse(),...s].map(t=>t.id),edges:n,layout:t,nodeById:e}}function R(t,e,n,o){const{layout:r}=t,s=t.nodeById,i=o?.layerGap??100,a=o?.nodeGap??40;let c=0;for(const t of e.layers){let e=0;for(const o of t){const t=s.get(o);if(!t){e++;continue}t.layer=c,t.order=e;const r=n.x[o]??e*a,f=n.y[o]??c*i;t.x=r,t.y=f,e++}c++}const f=r.nodes??[],d=new Map,l=[];for(const t of f){if(!t?.isGroup)continue;t.parentId||l.push(t);const e=f.filter(e=>e.parentId===t.id);let o=1/0,r=-1/0,s=1/0,i=-1/0;for(const t of e){const e=t.x??n.x[t.id],a=t.y??n.y[t.id],c=t.width??0,f=t.height??0;null!=e&&null!=a&&(o=Math.min(o,e-c/2),r=Math.max(r,e+c/2),s=Math.min(s,a-f/2),i=Math.max(i,a+f/2))}if(o===1/0||s===1/0)t.x=t.x??0,t.y=t.y??0,t.width=t.width??0,t.height=t.height??0;else{const e=t.padding??20,n=t.parentId?e:2*C(t),a=e,c=Math.max(0,r-o)+n,f=Math.max(0,i-s)+a,l=(o+r)/2,u=(s+i)/2;t.x=l,t.y=u,t.width=c,t.height=f,d.set(t.id,{minX:o,maxX:r,minY:s,maxY:i})}}if(l.length>0&&d.size>0){let t=1/0,e=-1/0,n=0;for(const o of l){const r=o.padding??20;r>n&&(n=r);const s=d.get(o.id);s&&(t=Math.min(t,s.minY),e=Math.max(e,s.maxY))}if(t!==1/0&&e!==-1/0){const o=36,r=Math.max(0,e-t)+2*Math.max(n,o),s=(t+e)/2;for(const e of l)e.y=s,e.height=r,e.swimlaneContentTop=t;const i=[...l].sort((t,e)=>(t.x??0)-(e.x??0)),a=[],c=[],f=[];for(const t of i){const e=d.get(t.id);if(!e)continue;const n=Math.max(0,e.maxX-e.minX)+2*C(t),o=(e.minX+e.maxX)/2;a.push(t.id),c.push(o),f.push(n)}const u=a.length;if(u>0){const t=new Map;if(1===u)t.set(a[0],f[0]);else{const e=[];for(let t=0;t<u-1;t++)e.push(c[t+1]-c[t]);const n=new Array(u);n[0]=0;for(let t=0;t<u-1;t++)n[t+1]=2*e[t]-n[t];let o=0,r=Number.POSITIVE_INFINITY;for(let t=0;t<u;t++){const e=f[t];t%2==0?o=Math.max(o,e-n[t]):r=Math.min(r,n[t]-e)}let s=o;s=o<=r?(o+r)/2:o;for(let e=0;e<u;e++){const o=n[e]+(e%2==0?s:-s),r=Math.max(f[e],o);t.set(a[e],r)}}for(const e of l){const n=t.get(e.id);null!=n&&(e.width=n),L(e)}}}}}(0,i.K)(C,"topLaneHorizontalPadding"),(0,i.K)(L,"assignTopLaneTitleRect"),(0,i.K)(k,"prepareLayoutForSwimlanes"),(0,i.K)(O,"toGraphView"),(0,i.K)(R,"writeBackToLayoutData");function T(t){const e=[],n=[],o=new Map;for(const e of t.nodes)o.set(e.id,e);for(const r of t.edges){if(!r.label||0===r.label.length)continue;if(r.isLayoutOnly)continue;if(r.labelNodeId)continue;const t=r.start?o.get(r.start):void 0,i=r.end?o.get(r.end):void 0;if(!t||!i){s.R.warn("[EdgeLabelNodes]",`Edge ${r.id} has missing source or target node`);continue}const a=`edge-label-${r.start}-${r.end}-${r.id}`,c=t.parentId!==i.parentId?i.parentId:t.parentId,f={id:a,label:r.label,edgeStart:r.start??"",edgeEnd:r.end??"",shape:"labelRect",width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:c,isGroup:!1,labelStyle:Array.isArray(r.labelStyle)?r.labelStyle[0]:r.labelStyle??"",...t.dir?{dir:t.dir}:{}};e.push(f),r.labelNodeId=a,r.label=void 0,r.text=void 0;const d={id:`${r.id}-to-label`,start:r.start,end:a,type:"normal",isLayoutOnly:!0},l={id:`${r.id}-from-label`,start:a,end:r.end,type:"normal",isLayoutOnly:!0};n.push(d,l)}const r=[...t.nodes,...e],i=[...t.edges,...n];return{...t,nodes:r,edges:i}}(0,i.K)(T,"createEdgeLabelNodes");var $=.001;function N(t){const e=t.x??0,n=t.y??0,o=t.width??0,r=t.height??0;return o>0&&r>0?{cx:e,cy:n,rect:Q(e,n,o,r)}:void 0}function B(t){if(t.isGroup)return;const e=N(t);if(!e)return;return{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}}function F(t,e,n=$){return Math.abs(t.x-e.x)<n&&Math.abs(t.y-e.y)<n}function E(t,e,n=$){return Math.abs(t.x-e.x)<n}function Y(t,e,n=$){return Math.abs(t.y-e.y)<n}function X(t,e,n=$){return Y(t,e,n)&&Math.abs(t.x-e.x)>n}function z(t,e,n=$){return E(t,e,n)&&Math.abs(t.y-e.y)>n}function A(t,e,n,o){return Math.max(0,Math.min(Math.max(t,e),Math.max(n,o))-Math.max(Math.min(t,e),Math.min(n,o)))}function P(t,e,n=$){return t.horizontal&&e.horizontal&&Y(t.a,e.a,n)?A(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&&E(t.a,e.a,n)?A(t.a.y,t.b.y,e.a.y,e.b.y):0}function D(t,e=$){const n=[];for(let o=0;o<t.length-1;o++){const r=t[o],s=t[o+1],i=X(r,s,e),a=z(r,s,e);(i||a)&&n.push({index:o,a:r,b:s,horizontal:i,vertical:a})}return n}function G(t,e=$){const n=D(t,e);let o=0;for(let t=1;t<n.length;t++)n[t-1].horizontal!==n[t].horizontal&&o++;return o}function H(t,e=$){const n=[];for(const o of t){const t=n.length>0?n[n.length-1]:void 0;t&&F(t,o,e)||n.push({x:o.x,y:o.y})}return n}function j(t,e=$){if(!t||4!==t.length)return;const[n,o,r,s]=t;if(X(n,o,e)&&z(o,r,e)&&X(r,s,e))return{kind:"HVH",p0:n,p1:o,p2:r,p3:s};return z(n,o,e)&&X(o,r,e)&&z(r,s,e)?{kind:"VHV",p0:n,p1:o,p2:r,p3:s}:void 0}function V(t,e,n,o=0){const r=Math.min(t.x,e.x),s=Math.max(t.x,e.x),i=Math.min(t.y,e.y),a=Math.max(t.y,e.y);return s>n.left-o&&r<n.right+o&&a>n.top-o&&i<n.bottom+o}function _(t,e,n=0){return t.x>e.left+n&&t.x<e.right-n&&t.y>e.top+n&&t.y<e.bottom-n}function W(t,e){return t.left<=e.left&&t.right>=e.right&&t.top<=e.top&&t.bottom>=e.bottom}function q(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}function J(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}function Q(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}function U(t){return N(t)?.rect}function Z(t,e){switch(e){case"top":return{x:t.cx,y:t.rect.top};case"bottom":return{x:t.cx,y:t.rect.bottom};case"left":return{x:t.rect.left,y:t.cy};case"right":return{x:t.rect.right,y:t.cy}}}function tt(t,e,n,o,r,s=$){const i="left"===e||"right"===e,a="left"===o||"right"===o;if(i&&a){if("right"===e&&"left"===o&&t.x<n.x||"left"===e&&"right"===o&&t.x>n.x){if(Y(t,n,s))return[t,n];const e=(t.x+n.x)/2;return[t,{x:e,y:t.y},{x:e,y:n.y},n]}if(e===o){if(Y(t,n,s))return;const o="left"===e?Math.min(t.x,n.x)-r:Math.max(t.x,n.x)+r;return[t,{x:o,y:t.y},{x:o,y:n.y},n]}return}if(!i&&!a){if(e===o){if(E(t,n,s))return;const o="top"===e?Math.min(t.y,n.y)-r:Math.max(t.y,n.y)+r;return[t,{x:t.x,y:o},{x:n.x,y:o},n]}if(!("bottom"===e&&"top"===o&&t.y<n.y||"top"===e&&"bottom"===o&&t.y>n.y))return;if(E(t,n,s))return[t,n];const i=(t.y+n.y)/2;return[t,{x:t.x,y:i},{x:n.x,y:i},n]}if(i&&!a){const r="right"===e&&n.x>t.x||"left"===e&&n.x<t.x,s="top"===o&&t.y<n.y||"bottom"===o&&t.y>n.y;return r&&s?[t,{x:n.x,y:t.y},n]:void 0}const c="bottom"===e&&n.y>t.y||"top"===e&&n.y<t.y,f="left"===o&&t.x<n.x||"right"===o&&t.x>n.x;return c&&f?[t,{x:t.x,y:n.y},n]:void 0}function et(t,e,n,o){return"left"===e||"right"===e?[t,{x:o,y:t.y},{x:o,y:n.y},n]:[t,{x:t.x,y:o},{x:n.x,y:o},n]}function nt(t){const e=new Map,n=[];for(const o of t){if(o.isEdgeLabel)continue;const t=B(o);t&&(e.set(t.id,t),n.push({id:t.id,rect:t.rect}))}return{nodeInfoById:e,realNodeRects:n}}function ot(t){const e=[],n=[];for(const o of t){const t=B(o);if(!t)continue;const r={id:t.id,rect:t.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}function rt(t,{includeEdgeLabels:e=!0}={}){const n=[];for(const o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;const t=o.x??0,r=o.y??0,s=o.width??0,i=o.height??0;n.push({nodeId:o.id,...Q(t,r,s,i)})}return n}function st(t,e,n=$){const o=t.start,r=t.end;if(!o||!r)return;const s=e.get(o),i=e.get(r);return s&&i?{srcId:o,dstId:r,srcInfo:s,dstInfo:i,collinearX:Math.abs(s.cx-i.cx)<n,collinearY:Math.abs(s.cy-i.cy)<n}:void 0}function it(t,e,n,o=[],r=0){for(const s of n)if(!o.includes(s.id)&&V(t,e,s.rect,-r))return!0;return!1}function at(t,e,n,o,r=$,s=1e-6){const i=Y(t,e,r),a=E(t,e,r),c=Y(n,o,r),f=E(n,o,r);if(i&&c||a&&f)return!1;if(!i&&!a||!c&&!f)return!1;const d=i?{a:t,b:e}:{a:n,b:o},l=a?{a:t,b:e}:{a:n,b:o},u=d.a.y,h=Math.min(d.a.x,d.b.x),g=Math.max(d.a.x,d.b.x),p=l.a.x,x=Math.min(l.a.y,l.b.y),m=Math.max(l.a.y,l.b.y);if(p<h||p>g||u<x||u>m)return!1;const y=Math.abs(p-d.a.x)<s&&Math.abs(u-d.a.y)<s||Math.abs(p-d.b.x)<s&&Math.abs(u-d.b.y)<s,b=Math.abs(p-l.a.x)<s&&Math.abs(u-l.a.y)<s||Math.abs(p-l.b.x)<s&&Math.abs(u-l.b.y)<s;return!(y&&b)}function ct(t,e,n,o,r=$){const s=Y(t,e,r),i=E(t,e,r),a=Y(n,o,r),c=E(n,o,r);return i&&c&&E(t,n,r)?A(t.y,e.y,n.y,o.y)>r:!!(s&&a&&Y(t,n,r))&&A(t.x,e.x,n.x,o.x)>r}function ft(t,e,n,o,{epsilon:r=$,skipDegenerateOther:s=!1}={}){for(const i of n){if(i===o||i.isLayoutOnly)continue;const n=i.points;if(n&&!(n.length<2))for(let o=0;o<n.length-1;o++){const i=n[o],a=n[o+1];if((!s||!F(i,a,r))&&(at(t,e,i,a,r)||ct(t,e,i,a,r)))return!0}}return!1}function dt(t,e,n,o,r=$){const s=Y(t,e,r),i=E(t,e,r),a=Y(n,o,r),c=E(n,o,r);if(!(s&&c||i&&a))return!1;const f=s?{a:t,b:e}:{a:n,b:o},d=s?{a:n,b:o}:{a:t,b:e},l=f.a.y,u=Math.min(f.a.x,f.b.x),h=Math.max(f.a.x,f.b.x),g=d.a.x,p=Math.min(d.a.y,d.b.y),x=Math.max(d.a.y,d.b.y);return g>u+r&&g<h-r&&l>p+r&&l<x-r}function lt(t,e,n){const o=Math.min(e,n),r=Math.max(e,n);return t>o+$&&t<r-$}function ut(t,e,n){return E(t,e)&&E(e,n)?lt(e.y,t.y,n.y):!(!Y(t,e)||!Y(e,n))&&lt(e.x,t.x,n.x)}function ht(t){let e=!1;const n=[];for(let o=0;o<t.length;o++){const r=n[n.length-1],s=t[o],i=o+1<t.length?t[o+1]:void 0;if(r&&i){if(F(r,i)){o++,e=!0;continue}if(ut(r,s,i)){e=!0;continue}}n.push(s)}return{points:n,changed:e}}function gt(t){const e=[t[0]];for(let n=1;n<t.length;n++){const o=e[e.length-1],r=t[n];if(!E(o,r)&&!Y(o,r)){const t=e.length>=2?e[e.length-2]:void 0,n=!!t&&E(t,o)?{x:o.x,y:r.y}:{x:r.x,y:o.y};e.push(n)}e.push(r)}const n=[];for(const t of e){const e=n[n.length-1];e&&F(e,t)||n.push(t)}return n}function pt(t){if(t.length<3)return t;let e=[...t];for(let t=0;t<32;t++){const t=ht(e);if(e=t.points,!t.changed)break}return e}(0,i.K)(N,"measuredNodeRect"),(0,i.K)(B,"nodeBoundsInfoFor"),(0,i.K)(F,"samePoint"),(0,i.K)(E,"sameX"),(0,i.K)(Y,"sameY"),(0,i.K)(X,"isHorizontalSegment"),(0,i.K)(z,"isVerticalSegment"),(0,i.K)(A,"overlapLength"),(0,i.K)(P,"sameAxisSegmentOverlapLength"),(0,i.K)(D,"orthogonalSegmentsForPoints"),(0,i.K)(G,"countOrthogonalBends"),(0,i.K)(H,"dedupeConsecutivePoints"),(0,i.K)(j,"classifyThreeSegmentRoute"),(0,i.K)(V,"segmentBoundsOverlapRect"),(0,i.K)(_,"pointInsideRect"),(0,i.K)(W,"rectContainsRect"),(0,i.K)(q,"rectsOverlap"),(0,i.K)(J,"inflateRect"),(0,i.K)(Q,"rectFromCenterSize"),(0,i.K)(U,"rectOfNodeBounds"),(0,i.K)(Z,"portForRectSide"),(0,i.K)(tt,"buildOrthogonalPortPath"),(0,i.K)(et,"buildSameSideTrackPath"),(0,i.K)(nt,"collectRealNodeBounds"),(0,i.K)(ot,"collectNodeRectEntries"),(0,i.K)(rt,"collectLayoutNodeRects"),(0,i.K)(st,"getNodePairGeometry"),(0,i.K)(it,"segmentHitsAnyRect"),(0,i.K)(at,"orthogonalSegmentsCross"),(0,i.K)(ct,"sameAxisSegmentsOverlap"),(0,i.K)(ft,"segmentConflictsWithAnyEdge"),(0,i.K)(dt,"orthogonalSegmentsStrictlyCross"),(0,i.K)(lt,"strictlyBetween"),(0,i.K)(ut,"isCollinearIntermediate"),(0,i.K)(ht,"simplifyPolylineOnce"),(0,i.K)(gt,"orthogonalizePolyline"),(0,i.K)(pt,"simplifyPolyline");var xt=.001;function mt(t,e,n){const o=t;if(o.isLayoutOnly||!o.points||o.points.length<n)return;const r=o.start?e.get(o.start):void 0,s=o.end?e.get(o.end):void 0;return{edge:o,points:o.points,srcRect:r?U(r):void 0,dstRect:s?U(s):void 0}}function yt(t,e,n){if(Y(t,e,xt)){return{x:t.x<n.left?n.left:n.right,y:t.y}}if(E(t,e,xt)){const e=t.y<n.top?n.top:n.bottom;return{x:t.x,y:e}}return{x:Math.min(n.right,Math.max(n.left,t.x)),y:Math.min(n.bottom,Math.max(n.top,t.y))}}function bt(t,e,n){const o=n?1:-1;let r=n?0:t.length-1;for(;r>=0&&r<t.length&&_(t[r],e,.5);)r+=o;if(r<0||r>=t.length)return t;const s=r-o;if(s<0||s>=t.length)return t;const i=yt(t[r],t[s],e);return n?[i,...t.slice(r)]:[...t.slice(0,r+1),i]}function Mt(t,e){for(const n of t){const t=mt(n,e,2);if(!t)continue;let o=[...t.points];t.srcRect&&(o=bt(o,t.srcRect,!0)),t.dstRect&&(o=bt(o,t.dstRect,!1)),o=pt(gt(o)),o=Tt(o,t.srcRect,t.dstRect),t.edge.points=pt(gt(o))}}function Kt(t,e,n,o=!1){if(Y(t,e,xt)){if(e.y<n.top-xt||e.y>n.bottom+xt)return e;if(o){if(t.x<n.left-xt)return{x:n.left,y:t.y};if(t.x>n.right+xt)return{x:n.right,y:t.y}}return{x:Math.abs(e.x-n.left)<=Math.abs(e.x-n.right)?n.left:n.right,y:t.y}}if(E(t,e,xt)){if(e.x<n.left-xt||e.x>n.right+xt)return e;if(o){if(t.y<n.top-xt)return{x:t.x,y:n.top};if(t.y>n.bottom+xt)return{x:t.x,y:n.bottom}}const r=Math.abs(e.y-n.top)<=Math.abs(e.y-n.bottom);return{x:t.x,y:r?n.top:n.bottom}}return e}function It(t,e,n){const o=t[e];for(let r=e+n;r>=0&&r<t.length;r+=n){const e=t[r];if(!F(e,o,xt))return e}return t[e+n]}function St(t,e){const n=t+4,o=e-4;return n<=o?{lo:n,hi:o}:{lo:(t+e)/2,hi:(t+e)/2}}function wt(t,e,n){const{lo:o,hi:r}=St(e,n);return Math.min(r,Math.max(o,t))}function vt(t){const e=Math.max(...t.map(t=>t.lo)),n=Math.min(...t.map(t=>t.hi));if(!(e>n))return{lo:e,hi:n}}function Ct(t,e){return"left"===e||"right"===e?St(t.top,t.bottom):St(t.left,t.right)}function Lt(t,e,n){const o=t.y>=n.top-xt&&t.y<=n.bottom+xt,r=t.x>=n.left-xt&&t.x<=n.right+xt;if(Y(t,e,xt)&&o){if(Math.abs(t.x-n.left)<xt)return"left";if(Math.abs(t.x-n.right)<xt)return"right"}if(E(t,e,xt)&&r){if(Math.abs(t.y-n.top)<xt)return"top";if(Math.abs(t.y-n.bottom)<xt)return"bottom"}}function kt(t){return"left"===t||"right"===t}function Ot(t,e,n,o,r){const s=[],i=n?Lt(t,e,n):void 0,a=o?Lt(e,t,o):void 0;return n&&i&&kt(i)===r&&s.push(Ct(n,i)),o&&a&&kt(a)===r&&s.push(Ct(o,a)),s.length>0?vt(s):void 0}function Rt(t,e,n,o,r){const s=Ot(t,e,n,o,r);if(!s)return;const i=r?t.y:t.x,a=Math.min(s.hi,Math.max(s.lo,i));return Math.abs(a-i)<xt?void 0:r?[{x:t.x,y:a},{x:e.x,y:a}]:[{x:a,y:t.y},{x:a,y:e.y}]}function Tt(t,e,n){if(2!==t.length)return t;const[o,r]=t;return Y(o,r,xt)?Rt(o,r,e,n,!0)??t:E(o,r,xt)?Rt(o,r,e,n,!1)??t:t}function $t(t,e,n){return kt(n)?{x:t.x,y:wt(t.y,e.top,e.bottom)}:{x:wt(t.x,e.left,e.right),y:t.y}}function Nt(t,e,n,o,r,s){const i=t.map(t=>({...t}));for(let a=e;a>=0&&a<t.length;a+=n){const e=t[a];if(s&&!Y(e,o,xt))break;if(!s&&!E(e,o,xt))break;s?i[a].y=r.y:i[a].x=r.x}return i}function Bt(t,e,n){if(t.length<2)return t;const o=n?0:t.length-1,r=n?1:-1,s=t[o],i=It(t,o,r);if(!i)return t;const a=Lt(s,i,e);if(!a)return t;const c=kt(a),f=$t(s,e,a);return F(s,f,xt)?t:Nt(t,o,r,s,f,c)}function Ft(t,e,n){const o=Math.min(t.x,e.x)>=n.left-xt&&Math.max(t.x,e.x)<=n.right+xt,r=Math.min(t.y,e.y)>=n.top-xt&&Math.max(t.y,e.y)<=n.bottom+xt;return Math.abs(t.y-n.top)<xt&&Math.abs(e.y-n.top)<xt&&o?"top":Math.abs(t.y-n.bottom)<xt&&Math.abs(e.y-n.bottom)<xt&&o?"bottom":Math.abs(t.x-n.left)<xt&&Math.abs(e.x-n.left)<xt&&r?"left":Math.abs(t.x-n.right)<xt&&Math.abs(e.x-n.right)<xt&&r?"right":void 0}function Et(t,e,n,o){switch(t){case"top":return E(e,n,xt)&&n.y<o.top-xt;case"bottom":return E(e,n,xt)&&n.y>o.bottom+xt;case"left":return Y(e,n,xt)&&n.x<o.left-xt;case"right":return Y(e,n,xt)&&n.x>o.right+xt}}function Yt(t,e,n){if(t.length<3)return t;if(n){const n=Ft(t[0],t[1],e);return n&&Et(n,t[1],t[2],e)?t.slice(1):t}const o=t.length-1,r=Ft(t[o-1],t[o],e);return r&&Et(r,t[o-1],t[o-2],e)?t.slice(0,o):t}function Xt(t,e,n){let o=t;if(e){const t=It(o,0,1);if(t){const n=Kt(t,o[0],e);n!==o[0]&&(o=[n,...o.slice(1)])}o=Yt(o,e,!0)}if(n){const t=o.length-1,e=It(o,t,-1);if(e){const r=Kt(e,o[t],n,!0);r!==o[t]&&(o=[...o.slice(0,t),r])}o=Yt(o,n,!1)}const r=Tt(o,e,n);return r!==o||2===o.length?r:(e&&(o=Bt(o,e,!0)),n&&(o=Bt(o,n,!1)),o)}function zt(t,e){for(const n of t){const t=mt(n,e,2);if(!t)continue;const o=Xt(H(t.points,xt),t.srcRect,t.dstRect);if(o.length<3){t.edge.points=o;continue}const r=[o[0],{...o[0]},...o.slice(1,-1),o[o.length-1],{...o[o.length-1]}];t.edge.points=r}}function At(t){return new Map(t.map(t=>[t.id,t]))}function Pt(t,e){let n=t.parentId,o=null;for(;n;){const t=e.get(n);if(!t?.isGroup)break;o=t.id,n=t.parentId}return o}function Dt(t,e){let n=0,o=t.parentId;for(;o;){const t=e.get(o);if(!t?.isGroup)break;n++,o=t.parentId}return n}function Gt(t){let e=1/0,n=-1/0,o=1/0,r=-1/0;for(const s of t){const t=s.x,i=s.y;if("number"!=typeof t||"number"!=typeof i)continue;const a=s.width??0,c=s.height??0;e=Math.min(e,t-a/2),n=Math.max(n,t+a/2),o=Math.min(o,i-c/2),r=Math.max(r,i+c/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:r}}function Ht(t,e){const n=t.padding??20;t.x=(e.minX+e.maxX)/2,t.y=(e.minY+e.maxY)/2,t.width=Math.max(0,e.maxX-e.minX)+n,t.height=Math.max(0,e.maxY-e.minY)+n}function jt(t){const e=At(t),n=t.filter(t=>t.isGroup&&t.parentId).sort((t,n)=>Dt(n,e)-Dt(t,e));for(const e of n){const n=Gt(t.filter(t=>t.parentId===e.id));n&&Ht(e,n)}}function Vt(t,e){const n=t.nodes??[],o=t.edges??[],r=n.filter(t=>!t.isGroup);let s=1/0,a=-1/0;for(const t of r){const n=t[e];"number"==typeof n&&(s=Math.min(s,n),a=Math.max(a,n))}if(!Number.isFinite(s)||!Number.isFinite(a))return!1;const c=(0,i.K)(t=>s+a-t,"mirror");for(const t of n){const n=t[e];"number"==typeof n&&(t[e]=c(n));const o=t.groupTitleRect;o&&(t.groupTitleRect="x"===e?{...o,left:c(o.right),right:c(o.left)}:{...o,top:c(o.bottom),bottom:c(o.top)})}for(const t of o)for(const n of t.points??[])n[e]=c(n[e]);return!0}function _t(t){return!(t.nodes??[]).some(t=>!t.isGroup)||Vt(t,"y")}function Wt(t,e="LR"){const n=t.nodes??[],o=t.edges??[],r=n.filter(t=>!t.isGroup);let s=1/0,i=1/0;for(const t of r){const e=t.x??0,n=t.y??0;e<s&&(s=e),n<i&&(i=n)}if(!Number.isFinite(s)||!Number.isFinite(i))return!1;const a=36;let c=0,f=0;for(const t of r)c+=t.width??0,f+=t.height??0;const d=c/r.length,l=f/r.length,u=l>0?Math.max(1,d/l):1;for(const t of r){const e=t.x??0,n=((t.y??0)-i)*u+a,o=e-s;t.x=n,t.y=o}for(const t of o)if(t.points)for(const e of t.points){const t=e.x,n=(e.y-i)*u+a,o=t-s;e.x=n,e.y=o}jt(n);const h=n.filter(t=>t.isGroup&&!t.parentId);if(0===h.length)return"RL"===e&&Vt(t,"x"),!0;const g=At(n),p=new Map;for(const t of n){if(t.isGroup)continue;const e=Pt(t,g);if(!e)continue;const n=p.get(e)??[];n.push(t),p.set(e,n)}let x=0;for(const t of h){const e=t.padding??0;e>x&&(x=e)}const m=[];let y=1/0,b=-1/0;for(const t of h){const e=Gt(p.get(t.id)??[]);e&&(y=Math.min(y,e.minX),b=Math.max(b,e.maxX),m.push({lane:t,contentTop:e.minY,contentBottom:e.maxY,centerY:(e.minY+e.maxY)/2}))}if(y===1/0||b===-1/0)return!0;const M=Math.max(0,b-y)+2*Math.max(x,10),K=a+M,I=(y+b)/2-M/2-a,S=I+K/2,w=Math.max(x,a);m.sort((t,e)=>t.centerY-e.centerY);for(let t=0;t<m.length;t++){const e=m[t];let n,o;if(0===t)n=e.contentTop-w;else{n=(m[t-1].contentBottom+e.contentTop)/2}if(t===m.length-1)o=e.contentBottom+w;else{const n=m[t+1];o=(e.contentBottom+n.contentTop)/2}const r=Math.max(0,o-n),s=(n+o)/2;e.lane.x=S,e.lane.y=s,e.lane.width=K,e.lane.height=r,e.lane.swimlaneContentTop=e.contentTop,e.lane.groupTitleRect={left:I,right:I+a,top:n,bottom:o}}return"RL"===e&&Vt(t,"x"),!0}(0,i.K)(mt,"endpointContextFor"),(0,i.K)(yt,"segmentEnterPoint"),(0,i.K)(bt,"clipEndpoint"),(0,i.K)(Mt,"clipEdgeEndpointsToNodeBoundaries"),(0,i.K)(Kt,"snapEndpointToBoundary"),(0,i.K)(It,"firstDistinctAdjacent"),(0,i.K)(St,"cornerClearanceRange"),(0,i.K)(wt,"clampToCornerClearance"),(0,i.K)(vt,"intersectRanges"),(0,i.K)(Ct,"clearanceRangeForSide"),(0,i.K)(Lt,"terminalSideForSegment"),(0,i.K)(kt,"isHorizontalSide"),(0,i.K)(Ot,"straightClearanceRange"),(0,i.K)(Rt,"clearStraightEndpointCornerAxis"),(0,i.K)(Tt,"clearStraightEndpointCornerConnections"),(0,i.K)($t,"cornerClearedEndpoint"),(0,i.K)(Nt,"moveCollinearEndpointRun"),(0,i.K)(Bt,"clearEndpointCornerConnection"),(0,i.K)(Ft,"borderSideForSegment"),(0,i.K)(Et,"leavesOutward"),(0,i.K)(Yt,"collapseOwnBorderStub"),(0,i.K)(Xt,"snapAndCollapseEndpoints"),(0,i.K)(zt,"prepareEdgeEndpointsForRenderer"),(0,i.K)(At,"buildNodeMap"),(0,i.K)(Pt,"resolveTopLevelGroupId"),(0,i.K)(Dt,"groupDepth"),(0,i.K)(Gt,"boundsForChildren"),(0,i.K)(Ht,"applyGroupBounds"),(0,i.K)(jt,"recomputeNestedGroupBounds"),(0,i.K)(Vt,"mirrorAxis"),(0,i.K)(_t,"applyBtDirectionTransform"),(0,i.K)(Wt,"applyLrDirectionTransform");var qt=1e-6,Jt=[0,8,-8,16,-16];function Qt(t,e){const{nodeInfoById:n,realNodeRects:o}=nt(e);for(const e of t){if(e.isLayoutOnly)continue;const r=e.points;if(!r||r.length<4)continue;const s=j(H(r,qt),qt);if(!s)continue;const{p3:i}=s,a="HVH"===s.kind,c=st(e,n,qt);if(!c)continue;const{srcId:f,dstId:d,srcInfo:l,dstInfo:u,collinearX:h,collinearY:g}=c;if(h||g)continue;let p;const x=l.rect;for(const n of Jt){let r,s,c;if(a){const t=u.cy>l.cy?x.bottom:x.top,e=l.cx+n;if(e<=x.left+qt||e>=x.right-qt)continue;r={x:e,y:t},s={x:e,y:i.y},c={x:i.x,y:i.y}}else{const t=u.cx>l.cx?x.right:x.left,e=l.cy+n;if(e<=x.top+qt||e>=x.bottom-qt)continue;r={x:t,y:e},s={x:i.x,y:e},c={x:i.x,y:i.y}}const h=F(r,s,qt),g=F(s,c,qt);if(h&&g)continue;if(!h&&it(r,s,o,[f],1))continue;if(!g&&it(s,c,o,[d],1))continue;const m=!h&&ft(r,s,t,e,{epsilon:qt,skipDegenerateOther:!0}),y=!g&&ft(s,c,t,e,{epsilon:qt,skipDegenerateOther:!0});if(!m&&!y){p=h?[s,c]:g?[r,s]:[r,s,c];break}}p&&(e.points=p)}}function Ut(t,e){const n=.001,{realNodeRects:o,labelNodeRects:r}=ot(e.values());for(const s of t){if(s.isLayoutOnly)continue;const a=s.points;if(!a||a.length<4)continue;const c=H(a,n);if(c.length<4)continue;const f=c.length-1,d=c[f],l=c[f-1],u=c[f-2],h=d.x-l.x,g=d.y-l.y,p=Math.hypot(h,g);if(p>=10||p<n)continue;const x=l.x-u.x,m=l.y-u.y;if(Math.hypot(x,m)<n)continue;const y=X(l,d,n),b=z(l,d,n),M=X(u,l,n),K=z(u,l,n);if(!(y&&K||b&&M))continue;const I=s.end,S=s.start,w=I?e.get(I):void 0;if(!w)continue;const v=w.x??0,C=w.y??0,L=U(w);if(!L)continue;let k,O;if(K){const t=m<0;k={x:v,y:u.y},O={x:v,y:t?L.bottom:L.top}}else{const t=x>0;k={x:u.x,y:C},O={x:t?L.right:L.left,y:C}}if(it(k,O,o,I?[I]:[],-2))continue;if(it(k,O,r,[],-2))continue;if(S){const t=e.get(S),n=t?U(t):void 0;if(n&&_(k,n,2))continue}const R=(0,i.K)((t,e)=>`${t.x.toFixed(3)},${t.y.toFixed(3)}|${e.x.toFixed(3)},${e.y.toFixed(3)}`,"ownSegmentKey"),T=new Set;for(let t=0;t<c.length-1;t++)T.add(R(c[t],c[t+1]));const $=(0,i.K)((e,o)=>{for(const r of t){if(r===s)continue;if(r.isLayoutOnly)continue;const t=r.points;if(t&&!(t.length<2))for(let r=0;r<t.length-1;r++){const s=t[r],i=t[r+1];if(!T.has(R(s,i))&&dt(e,o,s,i,n))return!0}}return!1},"segmentCrossesOtherEdge");if($(k,O))continue;if(f-3>=0){const t=c[f-3];if(it(t,k,o,[S,I].filter(t=>Boolean(t)),-2))continue;if($(t,k))continue}const N=[...c.slice(0,f-2),k,O];s.points=N;const B=s.labelNodeId;if(B){const t=e.get(B);if(t){const e=t.width??0,o=t.height??0;if(e>0&&o>0){let r,s,i=-1;for(let t=0;t<N.length-1;t++){const a=N[t],c=N[t+1],f=Math.hypot(c.x-a.x,c.y-a.y),d=Y(a,c,n),l=E(a,c,n);(d&&f>=e+2||l&&f>=o+2)&&(f>i&&(i=f,r=(a.x+c.x)/2,s=(a.y+c.y)/2))}void 0!==r&&void 0!==s&&(t.x=r,t.y=s)}}}}}(0,i.K)(Qt,"portSwapToLShape"),(0,i.K)(Ut,"collapseShortTerminalStub");var Zt=.001,te=D,ee=(0,i.K)((t,e)=>E(t,e,Zt)||Y(t,e,Zt),"orthogonallyAligned");function ne(t,e){const n=(0,i.K)((t,e)=>{const n=t.x??0,o=t.y??0,r=e.x-n,s=e.y-o;let i=(t.width??0)/2,a=(t.height??0)/2;return Math.abs(s)*i>Math.abs(r)*a?(s<0&&(a=-a),{x:n+(0===s?0:a*r/s),y:o+a}):(r<0&&(i=-i),{x:n+i,y:o+(0===r?0:i*s/r)})},"rectIntersect"),o=(0,i.K)((t,o)=>{const r=H(t.points??[]);if(r.length<2)return;const s=o?t.start:t.end,i=s?e.get(s):void 0,a=i?U(i):void 0;if(!i||!s||!a)return;const c=o?r[0]:r[r.length-1],f=o?r[1]:r[r.length-2],d=n(i,c);let l=c;return ee(f,d)&&(l=f),E(d,l,Zt)?{edge:t,edgeId:String(t.id??""),nodeId:s,atStart:o,orientation:"V",coord:d.x,min:Math.min(d.y,l.y),max:Math.max(d.y,l.y),boundary:d,railEnd:l,rect:a}:Y(d,l,Zt)?{edge:t,edgeId:String(t.id??""),nodeId:s,atStart:o,orientation:"H",coord:d.y,min:Math.min(d.x,l.x),max:Math.max(d.x,l.x),boundary:d,railEnd:l,rect:a}:void 0},"terminalLaneFor"),r=(0,i.K)((t,e)=>Math.max(0,Math.min(t.max,e.max)-Math.max(t.min,e.min)),"projectedOverlapLength"),s=(0,i.K)((t,e)=>{if(t.nodeId!==e.nodeId||t.orientation!==e.orientation)return!1;if("H"===t.orientation){return(Math.abs(t.boundary.x-t.rect.left)<1||Math.abs(t.boundary.x-t.rect.right)<1)&&E(t.boundary,e.boundary,1)}return(Math.abs(t.boundary.y-t.rect.top)<1||Math.abs(t.boundary.y-t.rect.bottom)<1)&&Y(t.boundary,e.boundary,1)},"sameTerminalFace"),a=(0,i.K)((t,e)=>{if(t.nodeId!==e.nodeId||t.orientation!==e.orientation)return!1;return r(t,e)>=8&&Math.abs(t.coord-e.coord)<.5},"exactTerminalLaneConflict"),c=(0,i.K)((t,e)=>{if(t.nodeId!==e.nodeId||t.orientation!==e.orientation||"H"!==t.orientation||t.atStart===e.atStart)return!1;const n=r(t,e);if(n<8)return!1;const o=t.rect.bottom-t.rect.top;return!(n<o||n>2*o)&&(s(t,e)&&Math.abs(t.coord-e.coord)<16)},"nearTerminalLaneConflict"),f=(0,i.K)((t,e)=>{const n=H(t.edge.points??[]);if(n.length<2)return;const o="V"===t.orientation?{x:t.boundary.x+e,y:t.boundary.y}:{x:t.boundary.x,y:t.boundary.y+e},r="V"===t.orientation?{x:t.railEnd.x+e,y:t.railEnd.y}:{x:t.railEnd.x,y:t.railEnd.y+e};if(!(0,i.K)(()=>Math.abs(t.boundary.y-t.rect.top)<1||Math.abs(t.boundary.y-t.rect.bottom)<1?Y(o,t.boundary,Zt)&&o.x>=t.rect.left+1&&o.x<=t.rect.right-1:(Math.abs(t.boundary.x-t.rect.left)<1||Math.abs(t.boundary.x-t.rect.right)<1)&&(E(o,t.boundary,Zt)&&o.y>=t.rect.top+1&&o.y<=t.rect.bottom-1),"boundaryStaysOnSameFace")())return;if(t.atStart){const e=n.length>1&&F(n[1],t.railEnd,Zt),s=n.slice(e?2:1),i=s[0];if(i&&!ee(i,r))return;return[o,r,...s]}const s=n.length>1&&F(n[n.length-2],t.railEnd,Zt),a=n.slice(0,s?-2:-1),c=a[a.length-1];return!c||ee(c,r)?[...a,r,o]:void 0},"shiftedCandidate"),d=(0,i.K)(t=>{const n=t.edge,o=H(n.points??[]);if(2!==o.length)return!1;const r=n.start,s=n.end,i=r?e.get(r):void 0,a=s?e.get(s):void 0;if(!i||!a)return!1;const c=i.x??0,f=i.y??0,d=a.x??0,l=a.y??0,[u,h]=o;return Y(u,h,Zt)&&Math.abs(f-l)<1&&Math.abs(c-d)>1||E(u,h,Zt)&&Math.abs(c-d)<1&&Math.abs(f-l)>1},"laneIsStraightCollinearConnector"),l=[-7,7,-14,14,-21,21];for(let e=0;e<8;e++){const e=t.filter(t=>!t.isLayoutOnly).flatMap(t=>[o(t,!0),o(t,!1)]).filter(t=>Boolean(t));let n=!1;for(let t=0;t<e.length&&!n;t++)for(let r=t+1;r<e.length&&!n;r++){const s=e[t],i=e[r];if(s.edge===i.edge||!a(s,i)&&!c(s,i))continue;const u=!a(s,i),h=[s,i].sort((t,e)=>{const n=d(t),o=d(e);return n!==o?Number(n)-Number(o):Number(!e.atStart)-Number(!t.atStart)});for(const t of h){for(const r of l){const s=f(t,r);if(!s)continue;const i=o({...t.edge,points:s},t.atStart);if(i&&!e.some(e=>e.edge!==t.edge&&(a(i,e)||u&&c(i,e)))){t.edge.points=s,n=!0;break}}if(n)break}}if(!n)return}}function oe(t,e){const{realNodeRects:n,labelNodeRects:o}=ot(e.values()),r=(0,i.K)((e,r)=>{const s=e.start,i=e.end,a=te(r);if(a.length!==r.length-1)return!1;const c=[s,i].filter(t=>Boolean(t));for(const t of a){if(it(t.a,t.b,n,c,-2))return!1;if(it(t.a,t.b,o,[],-2))return!1}for(const n of t){if(n===e||n.isLayoutOnly)continue;const t=n.points;if(t&&!(t.length<2))for(const e of a)for(const n of te(H(t))){if(P(e,n,.5)>=8)return!1;if(dt(e.a,e.b,n.a,n.b,Zt))return!1}}return!0},"candidateIsSafe"),s=(0,i.K)((t,e)=>{if(e+4>=t.length)return;const n=t[e],o=t[e+1],r=t[e+2],s=t[e+3],i=t[e+4],a=X(n,o)&&z(o,r)&&X(r,s)&&z(s,i)&&E(n,s,Zt)&&E(n,i,Zt)&&E(o,r,Zt)&&(o.x-n.x)*(s.x-r.x)<0,c=z(n,o)&&X(o,r)&&z(r,s)&&X(s,i)&&Y(n,s,Zt)&&Y(n,i,Zt)&&Y(o,r,Zt)&&(o.y-n.y)*(s.y-r.y)<0;if(a||c)return H([...t.slice(0,e+1),i,...t.slice(e+5)]);if(e+5>=t.length)return;const f=t[e+5],d=z(n,o)&&X(o,r)&&z(r,s)&&X(s,i)&&z(i,f)&&E(n,i,Zt)&&E(n,f,Zt)&&E(r,s,Zt)&&(r.x-o.x)*(i.x-s.x)<0,l=X(n,o)&&z(o,r)&&X(r,s)&&z(s,i)&&X(i,f)&&Y(n,i,Zt)&&Y(n,f,Zt)&&Y(r,s,Zt)&&(r.y-o.y)*(i.y-s.y)<0;return d||l?H([...t.slice(0,e+1),f,...t.slice(e+6)]):void 0},"withoutDogleg");for(let e=0;e<8;e++){let e=!1;for(const n of t){if(n.isLayoutOnly)continue;const t=H(n.points??[]);for(let o=0;o<=t.length-5;o++){const i=s(t,o);if(i&&r(n,i)){n.points=i,e=!0;break}}if(e)break}if(!e)return}}function re(t,e){const{realNodeRects:n,labelNodeRects:o}=ot(e.values()),r=t.filter(t=>!t.isLayoutOnly),s=(0,i.K)((t,e,n)=>H(t===e?n??[]:t.points??[]),"pointsFor"),a=(0,i.K)((t,e)=>{let n=0;for(let o=0;o<r.length;o++){const i=te(s(r[o],t,e));for(let a=o+1;a<r.length;a++){const o=te(s(r[a],t,e));for(const t of i)for(const e of o)dt(t.a,t.b,e.a,e.b,Zt)&&n++}}return n},"strictCrossingCount"),c=(0,i.K)(t=>{const e=te(t);if(3!==e.length)return;const n=e[1];return e[0].horizontal!==n.horizontal&&e[2].horizontal!==n.horizontal?{index:n.index,horizontal:n.horizontal,vertical:n.vertical,segment:n}:void 0},"middleRail"),f=(0,i.K)((t,e)=>{const o=[t.start,t.end].filter(t=>Boolean(t));return n.filter(t=>{if(o.includes(t.id))return!1;const n=t.rect;if(e.horizontal){return A(e.a.x,e.b.x,n.left,n.right)>=8&&e.a.y>=n.top-2&&e.a.y<=n.bottom+2}return A(e.a.y,e.b.y,n.top,n.bottom)>=8&&e.a.x>=n.left-2&&e.a.x<=n.right+2})},"blockingRectsFor"),d=(0,i.K)((t,e,n)=>{const o=t.map(t=>({...t}));if(e.horizontal)o[e.index].y=n,o[e.index+1].y=n;else{if(!e.vertical)return;o[e.index].x=n,o[e.index+1].x=n}const r=pt(H(o));return te(r).length===r.length-1?r:void 0},"candidateByMovingRail"),l=(0,i.K)((t,e,i)=>{const c=[t.start,t.end].filter(t=>Boolean(t)),f=te(e);if(f.length!==e.length-1)return!1;for(const t of f){if(it(t.a,t.b,n,c,-2))return!1;if(it(t.a,t.b,o,[],-2))return!1}for(const e of r)if(e!==t)for(const t of f)for(const n of te(s(e)))if(P(t,n,.5)>=8)return!1;return a(t,e)<=i},"candidateIsSafe");for(let t=0;t<8;t++){const t=a();let e=!1;for(const n of r){const o=s(n),r=c(o);if(!r)continue;const i=f(n,r.segment);if(0===i.length)continue;const a=r.horizontal?[Math.min(...i.map(t=>t.rect.top))-20,Math.max(...i.map(t=>t.rect.bottom))+20]:[Math.min(...i.map(t=>t.rect.left))-20,Math.max(...i.map(t=>t.rect.right))+20];for(const s of a){const i=d(o,r.segment,s);if(i&&l(n,i,t)){n.points=i,e=!0;break}}if(e)break}if(!e)return}}function se(t,e){const n=(0,i.K)(t=>{const e=t.groupTitleRect;if(e&&"number"==typeof e.left&&"number"==typeof e.right&&"number"==typeof e.top&&"number"==typeof e.bottom&&Number.isFinite(e.left)&&Number.isFinite(e.right)&&Number.isFinite(e.top)&&Number.isFinite(e.bottom)&&!(e.right<=e.left)&&!(e.bottom<=e.top))return{left:e.left,right:e.right,top:e.top,bottom:e.bottom}},"validTitleRect"),o=(0,i.K)(t=>{if(!t.isGroup||t.parentId)return;const e=t.direction,o="string"==typeof e?e.toUpperCase():"";if("LR"===o||"RL"===o||"BT"===o)return;const r=n(t),s=t.y,i=t.height;if(!r||"number"!=typeof s||"number"!=typeof i||!Number.isFinite(s)||!Number.isFinite(i)||i<=0)return;const a=r.right-r.left,c=r.bottom-r.top;return c<=0||a<c?void 0:{node:t,rect:r}},"topLaneTitleFor"),r=(0,i.K)((t,e)=>{if(!t.horizontal)return!1;const n=t.a.y;return!(n<=e.top+Zt||n>=e.bottom-Zt)&&A(t.a.x,t.b.x,e.left,e.right)>=8},"horizontalSegmentIntersectsTitle"),s=[...e.values()].map(o).filter(t=>Boolean(t));if(0===s.length)return;let a=0;for(const e of t){if(e.isLayoutOnly)continue;const t=H(e.points??[]);for(const e of te(t))for(const t of s)r(e,t.rect)&&(a=Math.max(a,t.rect.bottom-e.a.y+4))}if(!(a<=Zt))for(const t of s){const e=t.node.y,n=t.node.height;"number"!=typeof e||"number"!=typeof n||!Number.isFinite(e)||!Number.isFinite(n)||n<=0||(t.node.y=e-a/2,t.node.height=n+a,t.node.groupTitleRect={...t.rect,top:t.rect.top-a,bottom:t.rect.bottom-a})}}function ie(t,e){const n=(0,i.K)(t=>{const e=t.groupTitleRect;if(e&&"number"==typeof e.left&&"number"==typeof e.right&&"number"==typeof e.top&&"number"==typeof e.bottom&&Number.isFinite(e.left)&&Number.isFinite(e.right)&&Number.isFinite(e.top)&&Number.isFinite(e.bottom)&&!(e.right<=e.left)&&!(e.bottom<=e.top))return{left:e.left,right:e.right,top:e.top,bottom:e.bottom}},"validTitleRect"),o=(0,i.K)(t=>{if(!t.isGroup||t.parentId)return;if("LR"!==t.direction)return;const e=n(t),o=t.x,r=t.width;if(!e||"number"!=typeof o||"number"!=typeof r||!Number.isFinite(o)||!Number.isFinite(r)||r<=0)return;const s=e.right-e.left,i=e.bottom-e.top;return s<=0||i<s?void 0:{node:t,rect:e}},"leftLaneTitleFor"),r=(0,i.K)((t,e)=>{if(!t.vertical)return!1;const n=t.a.x;return!(n<=e.left+Zt||n>=e.right-Zt)&&A(t.a.y,t.b.y,e.top,e.bottom)>=8},"verticalSegmentIntersectsTitle"),s=(0,i.K)((t,e)=>{if(!t.horizontal)return!1;const n=t.a.y;return!(n<=e.top+Zt||n>=e.bottom-Zt)&&A(t.a.x,t.b.x,e.left,e.right)>=8},"horizontalSegmentIntersectsTitle"),a=[...e.values()].map(o).filter(t=>Boolean(t));if(0===a.length)return;let c=0;for(const e of t){if(e.isLayoutOnly)continue;const t=H(e.points??[]);for(const e of te(t))for(const t of a)if(r(e,t.rect))c=Math.max(c,t.rect.right-e.a.x+4);else if(s(e,t.rect)){const n=Math.min(e.a.x,e.b.x);c=Math.max(c,t.rect.right-n+4)}}if(!(c<=Zt))for(const t of a){const e=t.node.x,n=t.node.width;"number"!=typeof e||"number"!=typeof n||!Number.isFinite(e)||!Number.isFinite(n)||n<=0||(t.node.x=e-c/2,t.node.width=n+c,t.node.groupTitleRect={...t.rect,left:t.rect.left-c,right:t.rect.right-c})}}function ae(t,e){const{realNodeRects:n}=ot(e.values()),o=t.filter(t=>!t.isLayoutOnly),r=(0,i.K)((t,e=new Map)=>H(e.get(t)??t.points??[]),"replacementPointsFor"),s=(0,i.K)((t=new Map)=>{let e=0;for(let n=0;n<o.length;n++){const s=te(r(o[n],t));for(let i=n+1;i<o.length;i++){const n=te(r(o[i],t));for(const t of s)for(const o of n)dt(t.a,t.b,o.a,o.b,Zt)&&e++}}return e},"crossingCount"),a=(0,i.K)((t=new Map)=>o.reduce((e,n)=>e+G(r(n,t)),0),"totalBends"),c=(0,i.K)(t=>{const e=r(t);if(e.length<4)return;const n=e[e.length-2],o=e[e.length-1];return X(n,o,Zt)||z(n,o,Zt)?{tailStart:n,terminal:o}:void 0},"terminalTailFor"),f=(0,i.K)((t,e)=>{const n=r(t);if(n.length<3)return;const o=n[0],s=n[1];let i;if(X(o,s,Zt))i={x:s.x,y:e.tailStart.y};else{if(!z(o,s,Zt))return;i={x:e.tailStart.x,y:s.y}}const a=pt(H([o,s,i,e.tailStart,e.terminal]));return te(a).length===a.length-1?a:void 0},"candidateWithDestinationTail"),d=(0,i.K)((t,e)=>{const o=[t.start,t.end].filter(t=>Boolean(t));for(const t of te(e))if(it(t.a,t.b,n,o,-2))return!0;return!1},"pathHasNodeHit"),l=(0,i.K)((t,e,n)=>{for(const s of o)if(s!==t)for(const t of te(e))for(const e of te(r(s,n)))if(P(t,e,.5)>=8)return!0;return!1},"pathHasSharedTrack"),u=(0,i.K)((t,e,n)=>!d(t,e)&&!l(t,e,n),"candidateIsSafe"),h=(0,i.K)(()=>{const t=new Map;for(const n of o){const o=n.end;if(!o||!e.has(o))continue;if(r(n).length<4)continue;const s=t.get(o)??[];s.push(n),t.set(o,s)}return t},"edgesByDestination");for(let t=0;t<4;t++){const t=s();if(0===t)return;let e,n=t,o=a();for(const r of h().values())for(let i=0;i<r.length;i++)for(let d=i+1;d<r.length;d++){const l=r[i],h=r[d],g=c(l),p=c(h);if(!g||!p)continue;const x=f(l,p),m=f(h,g);if(!x||!m)continue;const y=new Map([[l,x],[h,m]]);if(!u(l,x,y)||!u(h,m,y))continue;const b=s(y),M=a(y);b>=t||(b>n||b===n&&M>=o||(e=y,n=b,o=M))}if(!e)return;for(const[t,n]of e)t.points=n}}function ce(t,e){const{realNodeRects:n,labelNodeRects:o}=ot(e.values()),r=t.filter(t=>!t.isLayoutOnly),s=(0,i.K)((t,e=new Map)=>H(e.get(t)??t.points??[]),"replacementPointsFor"),a=(0,i.K)((t=new Map)=>{let e=0;for(let n=0;n<r.length;n++){const o=te(s(r[n],t));for(let i=n+1;i<r.length;i++){const n=te(s(r[i],t));for(const t of o)for(const o of n)dt(t.a,t.b,o.a,o.b,Zt)&&e++}}return e},"strictCrossingCount"),c=(0,i.K)((t=new Map)=>r.reduce((e,n)=>e+G(s(n,t)),0),"totalBends"),f=(0,i.K)(t=>{const n=t.start,o=t.end,r=n?e.get(n):void 0,s=o?e.get(o):void 0,i=r?U(r):void 0,a=s?U(s):void 0;return i&&a?{src:i,dst:a}:void 0},"endpointRectsFor"),d=(0,i.K)((t,e,n)=>{if(n.index<=0||n.index+1>=e.length-1)return;const o=f(t);if(o){if(n.vertical){const r=n.a.x,s=Math.min(o.src.left,o.dst.left),i=Math.max(o.src.right,o.dst.right),a=r<s-Zt?"left":r>i+Zt?"right":void 0;if(!a)return;return{edge:t,points:e,segmentIndex:n.index,axis:"vertical",side:a,coord:r,min:Math.min(n.a.y,n.b.y),max:Math.max(n.a.y,n.b.y)}}if(n.horizontal){const r=n.a.y,s=Math.min(o.src.top,o.dst.top),i=Math.max(o.src.bottom,o.dst.bottom),a=r<s-Zt?"top":r>i+Zt?"bottom":void 0;if(!a)return;return{edge:t,points:e,segmentIndex:n.index,axis:"horizontal",side:a,coord:r,min:Math.min(n.a.x,n.b.x),max:Math.max(n.a.x,n.b.x)}}}},"externalRailForSegment"),l=(0,i.K)(()=>{const t=[];for(const e of r){const n=s(e);for(const o of te(n)){const r=d(e,n,o);r&&t.push(r)}}return t},"collectExternalRails"),u=(0,i.K)((t,e)=>t.edge!==e.edge&&t.axis===e.axis&&t.side===e.side&&A(t.min,t.max,e.min,e.max)>=8,"railsInteract"),h=(0,i.K)(t=>{const e=[],n=new Set;for(const o of t){if(n.has(o))continue;const r=[o],s=[];for(n.add(o);r.length>0;){const e=r.pop();s.push(e);for(const o of t)!n.has(o)&&u(e,o)&&(n.add(o),r.push(o))}s.length>1&&e.push(s)}return e},"connectedComponents"),g=(0,i.K)(t=>{const e=[];for(const n of t)e.some(t=>Math.abs(t-n.coord)<Zt)||e.push(n.coord);for(;e.length<t.length;){const n=Math.min(...e),o=Math.max(...e),r=t[0].side;e.push("left"===r||"top"===r?n-12*(t.length-e.length):o+12*(t.length-e.length))}return e},"uniqueCoordsFor"),p=(0,i.K)(t=>{const e=t.map(t=>t.coord),n=g(t),o=[];if(t.length<=6){const r=new Array(n.length).fill(!1),s=[],a=(0,i.K)(()=>{if(s.length!==t.length)for(const[t,e]of n.entries())r[t]||(r[t]=!0,s.push(e),a(),s.pop(),r[t]=!1);else s.some((t,n)=>Math.abs(t-e[n])>=Zt)&&o.push([...s])},"visit");return a(),o}for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++){const r=[...e];[r[t],r[n]]=[r[n],r[t]],o.push(r)}return o},"coordinateAssignmentsFor"),x=(0,i.K)((t,e)=>{const n=new Map;for(const[o,r]of t.entries()){const t=e[o],s=n.get(r.edge)??r.points.map(t=>({x:t.x,y:t.y}));"vertical"===r.axis?(s[r.segmentIndex].x=t,s[r.segmentIndex+1].x=t):(s[r.segmentIndex].y=t,s[r.segmentIndex+1].y=t),n.set(r.edge,s)}const o=new Map;for(const[t,e]of n){const n=pt(H(e));if(te(n).length!==n.length-1)return;o.set(t,n)}return o},"replacementsForAssignment"),m=(0,i.K)(t=>{for(const[e,r]of t){const t=[e.start,e.end].filter(t=>Boolean(t));for(const e of te(r)){if(it(e.a,e.b,n,t,-2))return!1;if(it(e.a,e.b,o,[],-2))return!1}}for(let e=0;e<r.length;e++){const n=r[e],o=t.has(n),i=te(s(n,t));for(let n=e+1;n<r.length;n++){const e=r[n];if(!o&&!t.has(e))continue;const a=te(s(e,t));for(const t of i)for(const e of a)if(P(t,e,.5)>=8)return!1}}return!0},"candidateIsSafe");for(let t=0;t<4;t++){const t=a();if(0===t)return;let e,n=t,o=c(),r=Number.POSITIVE_INFINITY;for(const s of h(l()))for(const i of p(s)){const f=x(s,i);if(!f||!m(f))continue;const d=a(f);if(d>=t)continue;const l=c(f),u=s.reduce((t,e,n)=>t+Math.abs(i[n]-e.coord),0);d>n||d===n&&(l>o||l===o&&u>=r)||(e=f,n=d,o=l,r=u)}if(!e)return;for(const[t,n]of e)t.points=n}}function fe(t,e){const{realNodeRects:n,labelNodeRects:o}=ot(e.values()),r=t.filter(t=>!t.isLayoutOnly),s=(0,i.K)((t,e,n)=>H(t===e?n??[]:t.points??[]),"pointsFor"),a=(0,i.K)(t=>te(t).reduce((t,e)=>{const n=e.a.x-e.b.x,o=e.a.y-e.b.y;return t+Math.hypot(n,o)},0),"pathLength"),c=(0,i.K)((t,e)=>{let n=0;for(let o=0;o<r.length;o++){const i=te(s(r[o],t,e));for(let a=o+1;a<r.length;a++){const o=te(s(r[a],t,e));for(const t of i)for(const e of o)dt(t.a,t.b,e.a,e.b,Zt)&&n++}}return n},"strictCrossingCount"),f=(0,i.K)((t,e)=>{if(t.horizontal){const n=t.a.y;return(Math.abs(n-e.top)<1||Math.abs(n-e.bottom)<1)&&A(t.a.x,t.b.x,e.left,e.right)>=8}if(t.vertical){const n=t.a.x;return(Math.abs(n-e.left)<1||Math.abs(n-e.right)<1)&&A(t.a.y,t.b.y,e.top,e.bottom)>=8}return!1},"segmentRunsAlongRectBorder"),d=(0,i.K)(t=>{const n=[t.start,t.end].filter(t=>Boolean(t)),o=[];for(const t of n){const n=e.get(t),r=n?U(n):void 0;r&&o.push(r)}return o},"endpointRectsFor"),l=(0,i.K)((t,e)=>{if(e+3>=t.length)return[];const n=t[e],o=t[e+1],r=t[e+2],s=t[e+3],i=X(n,o,Zt)&&z(o,r,Zt)&&X(r,s,Zt),a=z(n,o,Zt)&&X(o,r,Zt)&&z(r,s,Zt);if(!i&&!a)return[];if(!(i?Math.sign(o.x-n.x)!==Math.sign(s.x-r.x):Math.sign(o.y-n.y)!==Math.sign(s.y-r.y)))return[];const c=E(n,s,Zt)||Y(n,s,Zt)?[]:[{x:n.x,y:s.y},{x:s.x,y:n.y}],f=0===c.length?[[...t.slice(0,e+1),...t.slice(e+3)]]:c.map(n=>[...t.slice(0,e+1),n,...t.slice(e+3)]),d=new Set;return f.map(t=>pt(H(t))).filter(t=>{if(te(t).length!==t.length-1)return!1;if(!t.some(t=>F(t,s,Zt)))return!1;const e=t.map(t=>`${t.x.toFixed(3)},${t.y.toFixed(3)}`).join("|");return!d.has(e)&&(d.add(e),!0)})},"shortcutCandidatesAt"),u=(0,i.K)((t,e,i)=>{const a=[t.start,t.end].filter(t=>Boolean(t)),l=d(t);for(const t of te(e)){if(it(t.a,t.b,n,a,-2))return!1;if(it(t.a,t.b,o,[],-2))return!1;if(l.some(e=>f(t,e)))return!1}for(const n of r)if(n!==t)for(const t of te(e))for(const e of te(s(n)))if(P(t,e,.5)>=8)return!1;return c(t,e)<=i},"candidateIsSafe");for(let t=0;t<8;t++){const t=c();let e,n,o=t,i=Number.POSITIVE_INFINITY,f=Number.POSITIVE_INFINITY;for(const d of r){const r=s(d),h=G(r,Zt),g=a(r);for(let s=0;s<=r.length-4;s++)for(const p of l(r,s)){const r=G(p,Zt),s=a(p);if(!(r<h||r===h&&s<g-Zt)||!u(d,p,t))continue;const l=c(d,p);l>o||l===o&&(r>i||r===i&&s>=f)||(e=d,n=p,o=l,i=r,f=s)}}if(!e||!n)return;e.points=n}}function de(t,e){const n=20,o=[];for(const t of e.values()){if(t.isGroup||t.isEdgeLabel)continue;const e=t.x??0,n=t.y??0,r=U(t);r&&o.push({id:String(t.id??""),cx:e,cy:n,rect:r})}if(0===o.length)return;const r=new Map(o.map(t=>[t.id,t])),s=o.map(t=>({id:t.id,rect:t.rect})),a=["top","bottom","left","right"],c={top:Math.min(...o.map(t=>t.rect.top))-n,bottom:Math.max(...o.map(t=>t.rect.bottom))+n,left:Math.min(...o.map(t=>t.rect.left))-n,right:Math.max(...o.map(t=>t.rect.right))+n},f=t.filter(t=>!t.isLayoutOnly),d=new Map(f.map((t,e)=>[t,e])),l=(0,i.K)(t=>{const e="left"===t||"top"===t?-1:1,o=[];for(let r=0;r<=2;r++)o.push(c[t]+e*n*r);return o},"outwardTracksForSide"),u=(0,i.K)((t,e=new Map)=>H(e.get(t)??t.points??[]),"replacementPointsFor"),h=(0,i.K)((t,e)=>{let n=0;for(const o of t)for(const t of e)dt(o.a,o.b,t.a,t.b,Zt)&&n++;return n},"crossingCountBetweenSegments"),g=(0,i.K)((t,e)=>h(te(t),te(e)),"crossingCountBetweenPaths"),p=(0,i.K)((t=new Map)=>{let e=0;const n=[],o=new Set,r=[],s=(0,i.K)(t=>{o.has(t)||(o.add(t),r.push(t))},"addEdge");for(let o=0;o<f.length;o++){const r=f[o],i=u(r,t);for(let a=o+1;a<f.length;a++){const o=f[a],c=g(i,u(o,t));c>0&&(e+=c,n.push({first:r,second:o,count:c}),s(r),s(o))}}return r.sort((t,e)=>(d.get(t)??0)-(d.get(e)??0)),{count:e,pairs:n,edgeSet:o,edges:r}},"crossingSnapshot"),x=(0,i.K)((t,e)=>{const n=new Set(e.keys());if(0===n.size)return t.count;let o=0;for(const e of t.pairs)(n.has(e.first)||n.has(e.second))&&(o+=e.count);let r=0;for(let t=0;t<f.length;t++){const o=f[t],s=n.has(o),i=u(o,e);for(let o=t+1;o<f.length;o++){const t=f[o];(s||n.has(t))&&(r+=g(i,u(t,e)))}}return t.count-o+r},"crossingCountWithReplacements"),m=(0,i.K)(t=>{const e=new Map;for(const n of t.pairs){const t=e.get(n.first)??new Set;t.add(n.second),e.set(n.first,t);const o=e.get(n.second)??new Set;o.add(n.first),e.set(n.second,o)}const n=[],o=new Set;for(const r of t.edges){if(o.has(r))continue;const t=[r],s=[];for(o.add(r);t.length>0;){const n=t.pop();s.push(n);for(const r of e.get(n)??[])o.has(r)||(o.add(r),t.push(r))}s.sort((t,e)=>(d.get(t)??0)-(d.get(e)??0)),s.length>1&&n.push(s)}return n},"crossingComponents"),y=(0,i.K)(t=>[t.start,t.end].filter(t=>Boolean(t)),"endpointIdsFor"),b=(0,i.K)(t=>{const e=[];for(const n of m(t)){const t=new Set(n),o=new Set(n.flatMap(t=>y(t))),r=[...n];for(const e of f)t.has(e)||y(e).some(t=>o.has(t))&&r.push(e);r.sort((t,e)=>(d.get(t)??0)-(d.get(e)??0)),e.push(r)}return e},"pairSearchGroups"),M=(0,i.K)((t,e,n)=>x(t,new Map([[e,n]])),"crossingCountWithSingleReplacement"),K=(0,i.K)(t=>{const e=new Map;for(const n of t.pairs)e.set(n.first,(e.get(n.first)??0)+n.count),e.set(n.second,(e.get(n.second)??0)+n.count);return e},"currentCrossingsByEdge"),I=(0,i.K)(t=>t.slice(1).reduce((e,n,o)=>{const r=t[o];return e+Math.abs(n.x-r.x)+Math.abs(n.y-r.y)},0),"pathLength"),S=(0,i.K)((t=new Map)=>f.reduce((e,n)=>e+G(u(n,t)),0),"totalBends"),w=(0,i.K)((t=new Map)=>f.reduce((e,n)=>e+I(u(n,t)),0),"totalLength"),v=(0,i.K)((t,e,n=new Map)=>{const o=te(e);for(const e of f)if(e!==t)for(const t of o)for(const o of te(u(e,n)))if(P(t,o,.5)>=8)return!0;return!1},"pathHasSegmentConflict"),C=(0,i.K)((t,e)=>{const n=[t.start,t.end].filter(t=>Boolean(t));for(const t of te(e))if(it(t.a,t.b,s,n,-2))return!0;return!1},"pathHitsNode"),L=(0,i.K)((t,e)=>{const n=pt(H(e));te(n).length===n.length-1&&t.push(n)},"pushOrthogonalCandidate"),k=(0,i.K)(t=>"left"===t||"right"===t,"sideIsHorizontal"),O=(0,i.K)((t,e,o)=>{switch(e){case"left":return Math.min(t.x,o.x)-n;case"right":return Math.max(t.x,o.x)+n;case"top":return Math.min(t.y,o.y)-n;case"bottom":return Math.max(t.y,o.y)+n}},"localTrackForSameSide"),R=(0,i.K)((t,e,o,r)=>{const s="left"===o||"top"===o?-1:1,i=[O(e,o,r),c[o]];for(const a of i)for(let i=0;i<=2;i++)L(t,et(e,o,r,a+s*n*i))},"addSameSideCandidates"),T=(0,i.K)((t,e,n,o,r)=>{for(const s of l(n))for(const n of l(r))L(t,[e,{x:s,y:e.y},{x:s,y:n},{x:o.x,y:n},o])},"addHorizontalToVerticalCandidates"),$=(0,i.K)((t,e,n,o,r)=>{for(const s of l(n))for(const n of l(r))L(t,[e,{x:e.x,y:s},{x:n,y:s},{x:n,y:o.y},o])},"addVerticalToHorizontalCandidates"),N=(0,i.K)((t,e,n,o,r)=>{const s=[...l("top"),...l("bottom")];for(const i of l(n))for(const n of l(r))for(const r of s)L(t,[e,{x:i,y:e.y},{x:i,y:r},{x:n,y:r},{x:n,y:o.y},o])},"addHorizontalPairCandidates"),B=(0,i.K)((t,e,n,o,r)=>{const s=[...l("left"),...l("right")];for(const i of l(n))for(const n of l(r))for(const r of s)L(t,[e,{x:e.x,y:i},{x:r,y:i},{x:r,y:n},{x:o.x,y:n},o])},"addVerticalPairCandidates"),F=(0,i.K)(t=>{const e=new Set;return t.map(t=>H(t)).filter(t=>{const n=t.map(t=>`${t.x.toFixed(3)},${t.y.toFixed(3)}`).join("|");return!(e.has(n)||t.length<2)&&(e.add(n),!0)})},"dedupeCandidatePaths"),E=(0,i.K)((t,e,o,r)=>{const s=[],i=tt(t,e,o,r,n,Zt);i&&L(s,i),e===r&&R(s,t,e,o);const a=k(e),c=k(r);return a&&!c?T(s,t,e,o,r):!a&&c?$(s,t,e,o,r):a?N(s,t,e,o,r):B(s,t,e,o,r),F(s)},"buildCandidatesForSides"),Y=(0,i.K)((t,e,n,o)=>{const r=[...l("left"),...l("right")],s=[...l("top"),...l("bottom")];for(const i of a){const a=Z(o,i),c="top"===i||"bottom"===i?l(i):s;for(const o of r){L(t,[e,n,{x:o,y:n.y},{x:o,y:a.y},a]);for(const r of c)L(t,[e,n,{x:o,y:n.y},{x:o,y:r},{x:a.x,y:r},a])}}},"addVerticalDepartureOuterTrackCandidates"),A=(0,i.K)((t,e,n,o)=>{const r=[...l("left"),...l("right")],s=[...l("top"),...l("bottom")];for(const i of a){const a=Z(o,i),c="left"===i||"right"===i?l(i):r;for(const o of s){L(t,[e,n,{x:n.x,y:o},{x:a.x,y:o},a]);for(const r of c)L(t,[e,n,{x:n.x,y:o},{x:r,y:o},{x:r,y:a.y},a])}}},"addHorizontalDepartureOuterTrackCandidates"),D=(0,i.K)(t=>{const e=t.start,n=t.end,o=n?r.get(n):void 0;if(!e||!o)return[];const s=H(t.points??[]);if(s.length<4)return[];const i=s[0],a=s[1],c=[];return z(i,a,Zt)?Y(c,i,a,o):X(i,a,Zt)&&A(c,i,a,o),c},"terminalPreservingOuterTrackCandidates"),j=(0,i.K)(t=>{const e=t.start,n=t.end,o=e?r.get(e):void 0,s=n?r.get(n):void 0;if(!o||!s)return[];const i=[];for(const t of a){const e=Z(o,t);for(const n of a)i.push(...E(e,t,Z(s,n),n))}return i.push(...D(t)),i},"candidatePathsFor"),V=(0,i.K)(()=>new Map(f.map(t=>[t,te(u(t))])),"currentSegmentsByEdge"),_=(0,i.K)((t,e,n)=>{const o=new Set;for(const r of f){if(r===t)continue;const s=n.get(r)??te(u(r));e.some(t=>s.some(e=>P(t,e,.5)>=8))&&o.add(r)}return o},"sharedTrackConflictsFor"),W=(0,i.K)((t,e,n,o)=>{const r=new Set;return j(t).map(t=>pt(H(t))).filter(e=>{if(C(t,e))return!1;const n=e.map(t=>`${t.x.toFixed(3)},${t.y.toFixed(3)}`).join("|");return!(r.has(n)||e.length<2)&&(r.add(n),!0)}).map(r=>{const s=te(r);let i=0;for(const e of f)e!==t&&(i+=h(s,n.get(e)??te(u(e))));return{candidate:r,candidateSegments:s,crossings:e.count-(o.get(t)??0)+i,bends:G(r,Zt),totalBends:G(r),length:I(r)}}).filter(({crossings:t})=>t<=e.count).sort((t,e)=>t.crossings-e.crossings||t.bends-e.bends||t.length-e.length).slice(0,48).map(e=>({path:e.candidate,segments:e.candidateSegments,sharedTrackConflicts:_(t,e.candidateSegments,n),totalBends:e.totalBends,length:e.length}))},"pairCandidatesFor"),q=(0,i.K)((t,e,n,o,r,s)=>{let i=0;for(const n of t.pairs)n.first!==e&&n.second!==e&&n.first!==o&&n.second!==o||(i+=n.count);let a=h(n.segments,r.segments);for(const t of f){if(t===e||t===o)continue;const i=s.get(t)??te(u(t));a+=h(n.segments,i)+h(r.segments,i)}return t.count-i+a},"pairCrossingCount"),J=(0,i.K)((t,e)=>{for(const n of t.sharedTrackConflicts)if(n!==e)return!1;return!0},"conflictsOnlyWith"),Q=(0,i.K)((t,e)=>t.segments.some(t=>e.segments.some(e=>P(t,e,.5)>=8)),"candidatesShareTrack"),nt=(0,i.K)((t,e,n,o)=>J(e,n.edge)&&J(o,t.edge)&&!Q(e,o),"pairCandidatesAreCompatible"),ot=(0,i.K)((t,e,n,o,r)=>{const s=q(t.current,e.edge,n,o.edge,r,t.baseSegments);if(!(s>=t.current.count))return{replacements:new Map([[e.edge,n.path],[o.edge,r.path]]),crossings:s,bends:t.currentBends-(t.baseBendsByEdge.get(e.edge)??0)-(t.baseBendsByEdge.get(o.edge)??0)+n.totalBends+r.totalBends,length:t.currentLength-(t.baseLengthByEdge.get(e.edge)??0)-(t.baseLengthByEdge.get(o.edge)??0)+n.length+r.length}},"scorePairReplacement"),rt=(0,i.K)((t,e)=>t.crossings<e.crossings||t.crossings===e.crossings&&(t.bends<e.bends||t.bends===e.bends&&t.length<e.length),"pairScoreIsBetter"),st=(0,i.K)((t,e,n,o)=>{let r=o;for(const o of e.candidates)for(const s of n.candidates){if(!nt(e,o,n,s))continue;const i=ot(t,e,o,n,s);i&&rt(i,r)&&(r=i)}return r},"bestScoreForOptionPair"),at=(0,i.K)(t=>{const e=S(),n=w(),o=V(),r=K(t),s=new Map(f.map(t=>[t,G(u(t))])),i=new Map(f.map(t=>[t,I(u(t))])),a=new Map,c=b(t);for(const e of c)for(const n of e){if(a.has(n))continue;const e=W(n,t,o,r);e.length>0&&a.set(n,{edge:n,candidates:e})}let d={replacements:new Map,crossings:t.count,bends:e,length:n};const l={current:t,currentBends:e,currentLength:n,baseBendsByEdge:s,baseLengthByEdge:i,baseSegments:o};for(const e of c){const n=new Set(e.filter(e=>t.edgeSet.has(e))),o=e.map(t=>a.get(t)).filter(t=>Boolean(t));for(let t=0;t<o.length;t++){const e=o[t];for(let r=t+1;r<o.length;r++){const t=o[r];(n.has(e.edge)||n.has(t.edge))&&(d=st(l,e,t,d))}}}return d.replacements.size>0?d.replacements:void 0},"bestPairedReplacement");for(let t=0;t<4;t++){const t=p(),e=t.count;if(0===e)return;let n,o,r=e,s=Number.POSITIVE_INFINITY;for(const i of t.edges){const a=G(u(i),Zt);for(const c of j(i)){const f=C(i,c),d=!f&&v(i,c),l=M(t,i,c),u=G(c,Zt);if(f||d)continue;(l<e||l===e&&u<a)&&(l>r||l===r&&u>=s||(n=i,o=c,r=l,s=u))}}if(n&&o){n.points=o;continue}const i=at(t);if(!i)return;for(const[t,e]of i)t.points=e}}(0,i.K)(ne,"separateSharedRenderedTerminalLanes"),(0,i.K)(oe,"collapseRedundantRectangularDoglegs"),(0,i.K)(re,"liftObstacleHuggingSameSideRails"),(0,i.K)(se,"liftTopLaneTitleBandsAboveRails"),(0,i.K)(ie,"shiftLeftLaneTitleBandsLeftOfRails"),(0,i.K)(ae,"swapDestinationTerminalTailsToReduceCrossings"),(0,i.K)(ce,"reassignCrossingExternalRailChannels"),(0,i.K)(fe,"shortcutRedundantOrthogonalJogs"),(0,i.K)(de,"resolveRenderedOrthogonalCrossings");var le=.001;function ue(t,e){const{nodeInfoById:n,realNodeRects:o}=nt(e),r=["top","bottom","left","right"],s={top:Math.min(...o.map(t=>t.rect.top))-20,bottom:Math.max(...o.map(t=>t.rect.bottom))+20,left:Math.min(...o.map(t=>t.rect.left))-20,right:Math.max(...o.map(t=>t.rect.right))+20},a=(0,i.K)((t,e,n,o)=>{const r=[],i=tt(t,e,n,o,20,le);return i&&r.push(i),e===o&&r.push(et(t,e,n,s[e])),r},"buildOrthogonalPathCandidates"),c=(0,i.K)((t,e)=>{for(let n=0;n<t.length-1;n++){if(it(t[n],t[n+1],o,e,1))return!0}return!1},"pathHitsNode"),f=(0,i.K)((e,n,o=!1)=>{let r=0;const s=D(e,le),i=n.start,a=n.end;for(const e of t){if(e===n||e.isLayoutOnly)continue;const t=e.start,c=e.end;if(!o&&i&&a&&(t===i||t===a||c===i||c===a))continue;const f=e.points;if(f&&!(f.length<2))for(const t of s)for(const e of D(f,le))(at(t.a,t.b,e.a,e.b,le,le)||P(t,e,le)>=8)&&r++}return r},"pathConflictCount"),d=(0,i.K)((t,e)=>{const n=Math.abs(t.y-e.rect.top),o=Math.abs(t.y-e.rect.bottom),r=Math.abs(t.x-e.rect.left),s=Math.abs(t.x-e.rect.right);let i="top",a=n;return o<a&&(i="bottom",a=o),r<a&&(i="left",a=r),s<a&&(i="right",a=s),i},"nearestSideOfRect"),l=new Map,u=(0,i.K)((t,e,n)=>{const o=l.get(t)??[];o.push({side:e,edgeId:n}),l.set(t,o)},"addFaceClaim");for(const e of t){if(e.isLayoutOnly)continue;const t=e.points??[];if(t.length<1)continue;const o=e.id??"",r=e.start,s=e.end;if(r){const e=n.get(r);e&&u(r,d(t[0],e),o)}if(s){const e=n.get(s);e&&u(s,d(t[t.length-1],e),o)}}const h=(0,i.K)((t,e,n)=>l.get(t)?.some(t=>t.edgeId!==n&&t.side===e)??!1,"faceIsClaimed");for(const e of t){if(e.isLayoutOnly)continue;const t=e.points;if(!t||t.length<2)continue;const o=G(t,le);if(o<4)continue;const s=e.start,i=e.end;if(!s||!i)continue;const g=n.get(s),p=n.get(i);if(!g||!p)continue;const x=e.id??"",m=f(t,e,!0),y=f(t,e);let b,M=m,K=o;for(const t of r){if(h(s,t,x))continue;const n=Z(g,t);for(const o of r){if(h(i,o,x))continue;const r=Z(p,o);for(const d of a(n,t,r,o)){if(c(d,[s,i]))continue;const t=G(d,le);if(m>0){const n=f(d,e,!0);if(n>M||n===M&&t>=K)continue;M=n,K=t,b=d;continue}f(d,e)>y||t<K&&(K=t,b=d)}}}if(b){e.points=b;const t=l.get(s);t&&l.set(s,t.filter(t=>t.edgeId!==x));const n=l.get(i);n&&l.set(i,n.filter(t=>t.edgeId!==x)),u(s,d(b[0],g),x),u(i,d(b[b.length-1],p),x)}}}(0,i.K)(ue,"simplifyDetouredEdges");var he=.001;function ge(t,e){const n=e?0:t.length-1,o=e?1:-1,r=t[n],s=t[n+o];if(!r||!s)return;const i=s.x-r.x,a=s.y-r.y;if(!(Math.abs(i)+Math.abs(a)<he)){if(Math.abs(a)<=he){const t=r.x+10*Math.sign(i);return{left:Math.min(r.x,t),right:Math.max(r.x,t),top:r.y-7,bottom:r.y+7}}if(Math.abs(i)<=he){const t=r.y+10*Math.sign(a);return{left:r.x-7,right:r.x+7,top:Math.min(r.y,t),bottom:Math.max(r.y,t)}}return{left:Math.min(r.x,s.x),right:Math.max(r.x,s.x),top:Math.min(r.y,s.y),bottom:Math.max(r.y,s.y)}}}function pe(t){return{left:Math.min(t.left,t.right),right:Math.max(t.left,t.right),top:Math.min(t.top,t.bottom),bottom:Math.max(t.top,t.bottom)}}function xe(t,e){const n=H(e);return[ge(n,!0),ge(n,!1)].some(e=>e&&q(t,pe(e)))}function me(t,e){const n=[];for(const e of t){if(e.isLayoutOnly)continue;const t=e.points;if(t&&!(t.length<2))for(let o=0;o<t.length-1;o++)n.push({edgeId:e.id,p1:t[o],p2:t[o+1]})}const o=[],r=[];for(const t of e.values()){const e=t.isGroup,n=t.parentId;if(e&&!n){const e=U(t);e&&r.push({id:t.id,rect:e});continue}if(e)continue;if(t.isEdgeLabel)continue;const s=U(t);s&&o.push({nodeId:t.id,rect:s})}const s=(0,i.K)((t,e)=>{const n=J(e,3);for(const{nodeId:e,rect:r}of o)if(e!==t&&q(n,r))return!0;return!1},"labelOverlapsForeignNode"),a=(0,i.K)((t,e)=>{const o=J(e,3);for(const e of n)if(e.edgeId!==t&&V(e.p1,e.p2,o))return!0;return!1},"labelOverlapsForeignEdge"),c=(0,i.K)((t,e,n)=>s(t,n)||a(e,n),"labelOverlapsAnything"),f=[],d=(0,i.K)(t=>{for(const{id:e,rect:n}of r)if(W(n,t))return e},"findContainingLane"),l=(0,i.K)((t,e)=>f.some(n=>n.labelId!==t&&q(e,n.rect)),"overlapsPlacedLabel");for(const n of t){if(n.isLayoutOnly)continue;const t=n.labelNodeId;if(!t)continue;const o=e.get(t);if(!o)continue;const u=n.points;if(!u||u.length<2)continue;const h=o.width??0,g=o.height??0;if(h<=0||g<=0)continue;const p=[];for(let t=0;t<u.length-1;t++){const e=u[t],n=u[t+1],o=Math.abs(e.x-n.x),r=Math.abs(e.y-n.y);o<he&&r<he||(o>=he&&r>=he||p.push({idx:t,length:o+r,orientation:o>=he?"horizontal":"vertical",midX:(e.x+n.x)/2,midY:(e.y+n.y)/2}))}if(0===p.length)continue;const x=p.length>=3?p.filter(t=>t.idx>0&&t.idx<p.length-1):p,m=x.length>0?x:p,y=h>=g?"horizontal":"vertical",b=(0,i.K)(t=>[...t].sort((t,e)=>{const n=t.orientation===y;if(n!==(e.orientation===y))return n?-1:1;const o=t.length>=("horizontal"===t.orientation?h:g)+2;return o!==e.length>=("horizontal"===e.orientation?h:g)+2?o?-1:1:e.length-t.length}),"rankSegments"),M=p[0],K=p[p.length-1],I=[.5,.25,.75,.05,.95,.15,.85,.1,.9],S=(0,i.K)((t,e)=>{const n=u[t.idx],o=u[t.idx+1];return{midX:n.x+(o.x-n.x)*e,midY:n.y+(o.y-n.y)*e}},"anchorAtT"),w=(0,i.K)((t,e,n)=>Math.min(n,Math.max(e,t)),"clamp"),v=(0,i.K)((t,e)=>t.midX>=e.left-he&&t.midX<=e.right+he&&t.midY>=e.top-he&&t.midY<=e.bottom+he,"pointInsideRectInclusive"),C=(0,i.K)(t=>{const e=Q(t.midX,t.midY,h,g),n=d(e);if(n)return{laneId:n,anchor:t,rect:e};const o=r.find(({rect:e})=>v(t,e));if(!o)return;const s=o.rect.left+h/2+1,i=o.rect.right-h/2-1,a=o.rect.top+g/2+1,c=o.rect.bottom-g/2-1;if(s>i||a>c)return;const f={midX:w(t.midX,s,i),midY:w(t.midY,a,c)},l=Q(f.midX,f.midY,h,g);return v(t,l)?{laneId:o.id,anchor:f,rect:l}:void 0},"placementForAnchor"),L=(0,i.K)((t,e,n)=>"horizontal"===t.orientation?Math.abs(e.midX-n.x):Math.abs(e.midY-n.y),"distanceAlongSegment"),k=(0,i.K)((t,e)=>{const n=("horizontal"===t.orientation?h/2:g/2)+12;if(t===M){const o=u[t.idx];if(L(t,e,o)+he<n)return!1}if(t===K){const o=u[t.idx+1];if(L(t,e,o)+he<n)return!1}return!0},"labelClearsTerminalEndpoints"),O=(0,i.K)(e=>{const o=b(e);for(const e of o)for(const o of I){const r=S(e,o);if(!k(e,r))continue;const s=C(r);if(s&&(!xe(s.rect,u)&&!l(t,s.rect)&&!c(t,n.id,s.rect)))return{laneId:s.laneId,anchor:s.anchor}}},"tryPool"),R=(0,i.K)((e,o,r=!1)=>{const i=b(e);for(const e of i){const i={midX:e.midX,midY:e.midY};if(o&&!k(e,i))continue;const c=C(i);if(c&&!xe(c.rect,u)&&!l(t,c.rect)&&!s(t,c.rect)&&(r||!a(n.id,c.rect)))return{laneId:c.laneId,anchor:c.anchor}}},"findLaneContainingFallback"),T=O(m)??(m.length<p.length?O(p):void 0)??R(p,!0)??R(p,!1)??R(p,!1,!0);if(T){o.x=T.anchor.midX,o.y=T.anchor.midY,o.parentId=T.laneId;const e=Q(T.anchor.midX,T.anchor.midY,h,g),n=f.findIndex(e=>e.labelId===t);n>=0?f[n]={labelId:t,rect:e}:f.push({labelId:t,rect:e})}}}(0,i.K)(ge,"markerClearanceRectFor"),(0,i.K)(pe,"normalizeRect"),(0,i.K)(xe,"labelOverlapsOwnMarker"),(0,i.K)(me,"anchorLabelsToPolyline");var ye=1e-6;function be(t,e){return t<e?`${t}::${e}`:`${e}::${t}`}function Me(t,e){const{nodeInfoById:n,realNodeRects:o}=nt(e),r=new Map;for(const t of e){const e=t.id;t.isGroup||t.isEdgeLabel&&r.set(e,{w:t.width??0,h:t.height??0})}const s=(0,i.K)((e,n,o,s)=>{const a=be(n,o);let c=0;const f=(0,i.K)(t=>{if(!t)return;const e=r.get(t);if(!e)return;const n="x"===s?e.w/2:e.h/2;n>c&&(c=n)},"consider");f(e.labelNodeId);for(const n of t){if(n===e)continue;if(n.isLayoutOnly)continue;const t=n.start,o=n.end;t&&o&&(be(t,o)===a&&f(n.labelNodeId))}return c>0?c+3:0},"labelClearanceFor");for(const e of t){if(e.isLayoutOnly)continue;if(!j(e.points,ye))continue;const r=st(e,n,ye);if(!r)continue;const{srcId:i,dstId:a,srcInfo:c,dstInfo:f,collinearX:d,collinearY:l}=r;if(d===l)continue;let u,h;if(d){const t=f.cy>c.cy;u={x:c.cx,y:t?c.rect.bottom:c.rect.top},h={x:f.cx,y:t?f.rect.top:f.rect.bottom}}else{const t=f.cx>c.cx;u={x:t?c.rect.right:c.rect.left,y:c.cy},h={x:t?f.rect.left:f.rect.right,y:f.cy}}if(it(u,h,o,[i,a],1))continue;const g=s(e,i,a,d?"x":"y"),p=g>4?g:4,x=[0,p,-p];for(const n of x){const r={...u},s={...h};if(d){if(r.x+=n,s.x+=n,r.x<=c.rect.left||r.x>=c.rect.right)continue;if(s.x<=f.rect.left||s.x>=f.rect.right)continue}else{if(r.y+=n,s.y+=n,r.y<=c.rect.top||r.y>=c.rect.bottom)continue;if(s.y<=f.rect.top||s.y>=f.rect.bottom)continue}if(!it(r,s,o,[i,a],1)&&!ft(r,s,t,e,{epsilon:ye})){e.points=[r,s];break}}}}function Ke(t,e){const n=.001,{realNodeRects:o,labelNodeRects:r}=ot(e.values()),s=(0,i.K)((t,e)=>D(e,n).map(n=>({...n,edge:t,interior:n.index>=1&&n.index<=e.length-3})),"segmentsFor"),a=(0,i.K)(()=>{const e=[];for(const n of t){if(n.isLayoutOnly)continue;const t=n.points;!t||t.length<2||e.push(...s(n,H(t)))}return e},"allSegments"),c=(0,i.K)((t,e)=>t.horizontal&&e.horizontal?A(t.a.x,t.b.x,e.a.x,e.b.x)>=8&&Math.abs(t.a.y-e.a.y)<7:!(!t.vertical||!e.vertical)&&(A(t.a.y,t.b.y,e.a.y,e.b.y)>=8&&Math.abs(t.a.x-e.a.x)<7),"hasCrowdedParallelTrack"),f=(0,i.K)((e,i)=>{const a=e.start,f=e.end,d=s(e,i);if(d.length!==i.length-1)return!1;const l=[a,f].filter(t=>Boolean(t)),u=e.labelNodeId?[e.labelNodeId]:[];for(const t of d){if(it(t.a,t.b,o,l,-2))return!1;if(it(t.a,t.b,r,u,-2))return!1}for(const o of t){if(o===e||o.isLayoutOnly)continue;const t=o.points;if(t&&!(t.length<2))for(const e of d)for(const r of s(o,H(t))){if(c(e,r))return!1;if(dt(e.a,e.b,r.a,r.b,n))return!1}}return!0},"candidateIsSafe"),d=(0,i.K)((t,e)=>{const n=H(t.edge.points??[]);if(n.length<4||t.index>=n.length-1)return;const o=n.map(t=>({...t}));if(t.horizontal)o[t.index].y+=e,o[t.index+1].y+=e;else{if(!t.vertical)return;o[t.index].x+=e,o[t.index+1].x+=e}return s(t.edge,o).length===o.length-1?o:void 0},"shiftedCandidate"),l=(0,i.K)((t,e)=>({x:t.x??(e.left+e.right)/2,y:t.y??(e.top+e.bottom)/2}),"nodeCenter"),u=(0,i.K)(t=>{const n=t.edge,o=H(n.points??[]);if(4!==o.length||1!==t.index)return;const r=n.start?e.get(n.start):void 0,s=n.end?e.get(n.end):void 0,i=r?U(r):void 0,a=s?U(s):void 0,c=o.slice(t.index+2);return r&&s&&i&&a&&0!==c.length?{sourceCenter:l(r,i),targetCenter:l(s,a),sourceRect:i,tail:c}:void 0},"sourceDetourContextFor"),h=(0,i.K)((t,e,o,r,s,i)=>{const a=r.y>=o.y,c=a?s.bottom:s.top,f=c+(a?20:-20);if(a&&t.b.y<=f+n||!a&&t.b.y>=f-n)return;const d=t.a.x+e;return H([{x:o.x,y:c},{x:o.x,y:f},{x:d,y:f},{x:d,y:t.b.y},...i],n)},"verticalSourceDetour"),g=(0,i.K)((t,e,o,r,s,i)=>{const a=r.x>=o.x,c=a?s.right:s.left,f=c+(a?20:-20);if(a&&t.b.x<=f+n||!a&&t.b.x>=f-n)return;const d=t.a.y+e;return H([{x:c,y:o.y},{x:f,y:o.y},{x:f,y:d},{x:t.b.x,y:d},...i],n)},"horizontalSourceDetour"),p=(0,i.K)((t,e)=>{const n=u(t);if(n)return t.vertical?h(t,e,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail):t.horizontal?g(t,e,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail):void 0},"sourceDetourCandidate"),x=[-7,7,-14,14,-21,21];for(let t=0;t<12;t++){const t=a();let e=!1;for(let n=0;n<t.length&&!e;n++)for(let o=n+1;o<t.length&&!e;o++){const r=t[n],s=t[o];if(r.edge===s.edge||!c(r,s))continue;const i=[r,s].filter(t=>t.interior);for(const t of i){for(const n of x){const o=d(t,n);if(o&&f(t.edge,o)){t.edge.points=o,e=!0;break}const r=p(t,n);if(r&&f(t.edge,r)){t.edge.points=r,e=!0;break}}if(e)break}}if(!e)return}}function Ie(t,e,n,o){const r=e.x-t.x,s=e.y-t.y,i=o.x-n.x,a=o.y-n.y,c=r*a-s*i;if(Math.abs(c)<1e-10)return!1;const f=n.x-t.x,d=n.y-t.y,l=(f*a-d*i)/c,u=(f*s-d*r)/c,h=.01;return l>h&&l<.99&&u>h&&u<.99}function Se(t){const e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;const r=rt(e),i=[];for(const t of n){if(t.isLayoutOnly)continue;const e=t.points;if(!e||e.length<2)continue;const n=t.start,s=t.end,a=t.labelNodeId,c=t.id??`${n}->${s}`;for(const t of r)if(t.nodeId!==n&&t.nodeId!==s&&(!a||t.nodeId!==a))for(let n=0;n<e.length-1;n++)if(V(e[n],e[n+1],t,-1)){o.push({type:"edge-node-overlap",edgeId:c,targetId:t.nodeId,detail:`segment ${n} passes through node "${t.nodeId}"`});break}for(let t=0;t<e.length-1;t++)i.push({edgeId:c,start:n,end:s,p1:e[t],p2:e[t+1]})}const a=new Set;for(let t=0;t<i.length;t++)for(let e=t+1;e<i.length;e++){const n=i[t],r=i[e];if(n.edgeId!==r.edgeId&&(n.start!==r.start&&n.start!==r.end&&n.end!==r.start&&n.end!==r.end&&Ie(n.p1,n.p2,r.p1,r.p2))){const t=n.edgeId<r.edgeId?`${n.edgeId}|${r.edgeId}`:`${r.edgeId}|${n.edgeId}`;a.has(t)||(a.add(t),o.push({type:"edge-edge-crossing",edgeId:n.edgeId,targetId:r.edgeId,detail:`edges "${n.edgeId}" and "${r.edgeId}" cross`}))}}if(o.length>0){const t=o.filter(t=>"edge-node-overlap"===t.type).length,e=o.filter(t=>"edge-edge-crossing"===t.type).length;s.R.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${t} edge-node overlap(s), ${e} edge crossing(s)`);for(const t of o)s.R.warn(`[SWIMLANE_VALIDATE] ${t.type}: ${t.detail}`)}return o}function we(t,e){const n=t.nodes??[],o=t.edges??[],r=n.filter(t=>!t.isGroup);if(("LR"===e||"RL"===e)&&r.length>0&&!Wt(t,e))return;if("BT"===e&&r.length>0&&!_t(t))return;for(const t of o){if(t.isLayoutOnly)continue;const e=t.points;!e||e.length<2||(t.points=pt(gt(e)))}ue(o,n),Me(o,n),Qt(o,n);const s=new Map;for(const t of n)s.set(String(t.id),t);me(o,s),Mt(o,s),Ut(o,s),Ke(o,s),ne(o,s),oe(o,s),re(o,s),ae(o,s);const a=(0,i.K)(()=>{de(o,s),ce(o,s),fe(o,s),me(o,s),zt(o,s),re(o,s),me(o,s),zt(o,s)},"finalizeRenderedEdges");a(),Ke(o,s),a(),se(o,s),ie(o,s),se(o,s),ie(o,s)}function ve(t){const e=new Map(t.nodeById),n=new Set,o=[];for(const r of t.edges){if(!e.has(r.src)||!e.has(r.dst))continue;const t=`${r.id}:${r.src}->${r.dst}`;n.has(t)||(n.add(t),o.push(r))}return{nodes:[...e.keys()],edges:o,layout:t.layout,nodeById:e}}function Ce(t,e){return t.edges.filter(t=>t.dst===e)}function Le(t){const e=new Map;for(const n of t.nodes)e.set(n,[]);for(const n of t.edges)e.get(n.src).push(n.dst);return e}function ke(t){const e=Le(t);for(const t of e.values())t.sort((t,e)=>t.localeCompare(e));return e}function Oe(t){const e=new Map;for(const n of t.nodes)e.set(n,0);for(const n of t.edges)e.set(n.dst,(e.get(n.dst)??0)+1);return e}function Re(t){return[...t.entries()].filter(([,t])=>0===t).map(([t])=>t).sort((t,e)=>t.localeCompare(e))}function Te(t,e=()=>!0){const n=new Map,o=new Map;for(const e of t.nodes)n.set(e,[]),o.set(e,[]);for(const r of t.edges)e(r)&&(o.get(r.src).push(r.dst),n.get(r.dst).push(r.src));return{preds:n,succs:o}}function $e(t,e,n,o){let r=0;for(const e of t.nodes)o?.skipGroups&&t.nodeById.get(e)?.isGroup||(r=Math.max(r,n[e]??0));const s=Array.from({length:r+1},()=>[]);for(const r of e)o?.skipGroups&&t.nodeById.get(r)?.isGroup||s[Math.max(0,n[r]??0)].push(r);return s}function Ne(t){const e=Oe(t),n=Re(e),o=[],r=ke(t);for(;n.length;){const t=n.shift();o.push(t);for(const o of r.get(t)??[])if(e.set(o,(e.get(o)??0)-1),0===(e.get(o)??0)){let t=0;for(;t<n.length&&n[t]<o;)t++;n.splice(t,0,o)}}return o.length===t.nodes.length?o:null}function Be(t){const e=new Map;let n=0;for(const o of t)e.set(o,n),n++;return e}function Fe(t){const e=new Array(t.length),n=(0,i.K)((o,r)=>{if(r-o<=1)return 0;const s=o+r>>1;let i=n(o,s)+n(s,r),a=o,c=s,f=o;for(;a<s||c<r;)c>=r||a<s&&t[a]<=t[c]?e[f++]=t[a++]:(e[f++]=t[c++],i+=s-a);for(let n=o;n<r;n++)t[n]=e[n];return i},"count");return n(0,t.length)}function Ee(t){const e=ve(t),n=new Map;for(const t of e.nodes)n.set(t,[]);for(const t of e.edges)n.get(t.src).push(t);for(const t of n.values())t.sort((t,e)=>t.dst===e.dst?t.id.localeCompare(e.id):t.dst.localeCompare(e.dst));const o=Object.create(null);for(const t of e.nodes)o[t]=0;const r=[],s=(0,i.K)(t=>{o[t]=1;for(const e of n.get(t)??[]){const t=e.dst;0===o[t]?s(t):1===o[t]&&r.push(e)}o[t]=2},"dfs"),a=[...e.nodes].sort((t,e)=>t.localeCompare(e));for(const t of a)0===o[t]&&s(t);const c=new Set(r.map(t=>`${t.id}:${t.src}->${t.dst}`)),f=e.edges.map(t=>c.has(`${t.id}:${t.src}->${t.dst}`)?{id:t.id,src:t.dst,dst:t.src,weight:t.weight,ref:t.ref}:t);return{acyclic:{nodes:[...e.nodes],edges:f,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:r}}function Ye(t){const e=new Map,n=(0,i.K)(o=>{if(e.has(o))return e.get(o);const r=t.nodeById.get(o);if(!r)return e.set(o,null),null;const s=r.parentId;if(!s)return e.set(o,null),null;const i=n(s)??s;return e.set(o,i),i},"resolve");for(const e of t.nodes)n(e);return e}function Xe(t){const e=Ye(t);return t=>e.get(t)??null}function ze(t){const e=[];for(const n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}function Ae(t,e){const n=ze(t);if(!e||0===e.length)return n;const o=new Set(n),r=new Set,s=[];for(const t of e)o.has(t)&&!r.has(t)&&(r.add(t),s.push(t));for(const t of n)r.has(t)||s.push(t);return s}(0,i.K)(be,"pairKey"),(0,i.K)(Me,"straightenCollinearSiblingDetours"),(0,i.K)(Ke,"nudgeSharedInteriorSubpaths"),(0,i.K)(Ie,"segmentsIntersect"),(0,i.K)(Se,"validateSwimlanesLayout"),(0,i.K)(we,"postProcessSwimlaneLayout"),(0,i.K)(ve,"normalizeGraph"),(0,i.K)(Ce,"incoming"),(0,i.K)(Le,"buildSuccessorMap"),(0,i.K)(ke,"buildSortedSuccessorMap"),(0,i.K)(Oe,"buildInDegreeMap"),(0,i.K)(Re,"sortedZeroInDegreeNodes"),(0,i.K)(Te,"buildPredecessorSuccessorMaps"),(0,i.K)($e,"buildLayersFromRanks"),(0,i.K)(Ne,"topoSortIfAcyclic"),(0,i.K)(Be,"buildLayerIndex"),(0,i.K)(Fe,"countInversions"),(0,i.K)(Ee,"removeCycles_DFS"),(0,i.K)(Ye,"buildTopLaneMap"),(0,i.K)(Xe,"createTopLaneResolver"),(0,i.K)(ze,"buildTopLaneOrder"),(0,i.K)(Ae,"resolveTopLaneOrder");var Pe=8,De=4,Ge=!0,He=100,je=40;function Ve(t,e){const n=ve(t),o=e?.laneOf??(()=>null),r=e?.rankHint,{preds:s}=Te(n);for(const t of s.values())t.sort((t,e)=>t.localeCompare(e));const a=Ne(n)??[...n.nodes].sort((t,e)=>t.localeCompare(e)),c=new Map;for(const[t,e]of a.entries())c.set(e,t);const f=new Map,d=new Map;for(const t of n.nodes)d.set(t,[]);for(const t of a){const e=(s.get(t)??[]).filter(t=>f.has(t));if(e.length>0){const n=_e(t,e,{laneOf:o,rankHint:r,topoIndex:c});f.set(t,n),d.get(n).push(t)}else f.has(t)||f.set(t,null)}for(const t of n.nodes)f.has(t)||f.set(t,null);const l=new Set;for(const t of n.nodes)null===(f.get(t)??null)&&l.add(t);const u=[...l].sort((t,e)=>{const n=c.get(t)??0,o=c.get(e)??0;return n===o?t.localeCompare(e):n-o}),h=We(n),g=new Map;for(const[t,e]of h.entries())g.set(t,[...e].sort((t,e)=>t.localeCompare(e)));const p=qe(g),x=Je(g),m=new Map;for(const t of n.nodes)m.set(t,[]);for(const t of x)for(const e of t.nodes){const n=m.get(e);n?n.push(t.id):m.set(e,[t.id])}const y=[],b=[],M=new Set,K=(0,i.K)(t=>{if(!M.has(t)){M.add(t),y.push(t);for(const e of d.get(t)??[])K(e);b.push(t)}},"walk");for(const t of u)K(t);for(const t of a)K(t);return{parent:f,children:d,roots:u,componentOf:p,blocks:x,nodeBlocks:m,adjacency:g,preorder:y,postorder:b,topologicalOrder:a}}function _e(t,e,n){const o=n.laneOf(t);return[...e].sort((t,e)=>{const r=n.laneOf(t),s=n.laneOf(e),i=null!=r&&r===o;if(i!==(null!=s&&s===o))return i?-1:1;const a=n.rankHint?.[t],c=n.rankHint?.[e];if(null!=a&&null!=c&&a!==c)return c-a;const f=n.topoIndex.get(t)??0,d=n.topoIndex.get(e)??0;return f!==d?f-d:t.localeCompare(e)})[0]}function We(t){const e=new Map;for(const n of t.nodes)e.set(n,new Set);for(const n of t.edges)e.get(n.src).add(n.dst),e.get(n.dst).add(n.src);return e}function qe(t){const e=new Map;let n=0;for(const o of t.keys()){if(e.has(o))continue;const r=[o];for(;r.length>0;){const o=r.pop();if(!e.has(o)){e.set(o,n);for(const n of t.get(o)??[])e.has(n)||r.push(n)}}n++}return e}function Je(t){const e=new Map,n=new Map,o=[],r=[];let s=0;const a=(0,i.K)((i,c)=>{e.set(i,++s),n.set(i,s);for(const f of t.get(i)??[])f!==c&&(e.has(f)?(e.get(f)??0)<(e.get(i)??0)&&(o.push([i,f]),n.set(i,Math.min(n.get(i)??s,e.get(f)??s))):(o.push([i,f]),a(f,i),n.set(i,Math.min(n.get(i)??s,n.get(f)??s)),(n.get(f)??0)>=(e.get(i)??0)&&r.push(Qe(i,f,o,r.length))))},"visit");for(const n of t.keys())e.has(n)||a(n,null);return r}function Qe(t,e,n,o){const r=[],s=new Set;for(;n.length>0;){const o=n.pop();if(r.push(o),s.add(o[0]),s.add(o[1]),o[0]===t&&o[1]===e||o[0]===e&&o[1]===t)break}return{id:o,edges:r,nodes:[...s]}}function Ue(t,e,n){const o=[...t.nodes],r=new Map;for(const[t,e]of o.entries())r.set(e,t);const s=o.length,a=new Array(s).fill(-1),c=new Array(s).fill(0),f=[],d=new Set;for(const t of o){const e=n.parent.get(t)??null,o=r.get(t);null!=o&&(null==e&&(a[o]=-1,c[o]=0,d.has(t)||(d.add(t),f.push(t))))}for(;f.length>0;){const t=f.shift(),e=r.get(t);if(null==e)continue;const o=n.children.get(t)??[];for(const t of o){if(d.has(t))continue;const n=r.get(t);null!=n&&(a[n]=e,c[n]=c[e]+1,d.add(t),f.push(t))}}for(const t of o){if(d.has(t))continue;const e=r.get(t);null!=e&&(a[e]=-1,c[e]=0,d.add(t))}const l=Math.max(1,Math.ceil(Math.log2(Math.max(1,s)))+1),u=Array.from({length:l},()=>new Array(s).fill(-1));for(let t=0;t<s;t++)u[0][t]=a[t];for(let t=1;t<l;t++)for(let e=0;e<s;e++){const n=u[t-1][e];u[t][e]=-1===n?-1:u[t-1][n]}const h=(0,i.K)((t,e)=>{if(-1===t||-1===e)return-1;c[t]<c[e]&&([t,e]=[e,t]);const n=c[t]-c[e];for(let e=0;e<l;e++)if(n>>e&1&&-1===(t=u[e][t]))return-1;if(t===e)return t;for(let n=l-1;n>=0;n--){const o=u[n][t],r=u[n][e];-1!==o&&-1!==r&&(o!==r&&(t=o,e=r))}return u[0][t]},"lcaIndex"),g=Array.from({length:s},()=>new Map);for(const n of t.edges){let t=n.src,o=n.dst,s=e[t],i=e[o];if(null==s||null==i)continue;if(s>i&&([t,o]=[o,t],[s,i]=[i,s]),null==s||null==i||s===i)continue;const a=r.get(t),c=r.get(o);if(null==a||null==c)continue;const f=h(a,c);if(-1===f)continue;const d=g[f];for(let t=s;t<i;t++)d.set(t,(d.get(t)??0)+1)}const p=new Map,x=(0,i.K)((t,e)=>{if(0!==e.size)for(const[n,o]of e)t.set(n,(t.get(n)??0)+o)},"mergeInto"),m=new Set,y=(0,i.K)(t=>{const o=r.get(t);m.add(t);const s=null==o?void 0:g[o],i=s?new Map(s):new Map,a=n.children.get(t)??[];for(const n of a){const o=y(n),r=e[t];if(null!=r){let s=p.get(t);s||(s=new Map,p.set(t,s));let i=o.get(r)??0;const a=e[n];null!=a&&a>r&&(i+=1),s.set(n,i)}x(i,o)}return i},"dfs");for(const t of n.roots)m.has(t)||y(t);for(const t of o)m.has(t)||y(t);return p}function Ze(t,e,n){const o=new Map,r=(0,i.K)(t=>{let s=n[t]??0;const i=[...e.get(t)??[]];i.sort(tn(n));for(const t of i){r(t);const e=o.get(t);null!=e&&(s=Math.min(s,e))}o.set(t,s)},"annotate");for(const e of t)r(e);return o}function tn(t){return(e,n)=>{const o=t[e]??0,r=t[n]??0;return o===r?e.localeCompare(n):o-r}}function en(t,e,n,o){let r=0;for(const t of e){const e=n[t]??0;e>r&&(r=e)}const s=Array.from({length:r+1},()=>[]),a=new Set,c=(0,i.K)(t=>{if(a.has(t))return;a.add(t);const e=n[t]??0;s[e]||(s[e]=[]),s[e].push(t);for(const e of o(t))c(e)},"emit");for(const e of t)c(e);for(const t of e)if(!a.has(t)){const e=n[t]??0;s[e]||(s[e]=[]),s[e].push(t),a.add(t)}return s}function nn(t){const e=[];for(const n of t){const t=new Set,o=[];for(const e of n)t.has(e)||(t.add(e),o.push(e));e.push(o)}return e}function on(t,e,n,o){return r=>{const s=t.get(r)??[];if(0===s.length)return[];const i=e[r]??0,a=[],c=[],f=n.get(r);for(const t of s){const e=o.get(t)??i;e>i?a.push({child:t,min:e}):c.push(t)}return a.sort((t,e)=>t.min===e.min?t.child.localeCompare(e.child):t.min-e.min),c.sort((t,e)=>{const n=f?.get(t)??0,r=f?.get(e)??0;if(n!==r)return n-r;const s=o.get(t)??i,a=o.get(e)??i;return s!==a?s-a:t.localeCompare(e)}),[...a.map(t=>t.child),...c]}}function rn(t,e,n){const o=Ve(t,{rankHint:e,laneOf:n}),{children:r,roots:s}=o;for(const e of t.nodes)r.has(e)||r.set(e,[]);const i=Ue(t,e,o),a=[...s].sort(tn(e)),c=on(r,e,i,Ze(a,r,e));let f=en(a,t.nodes,e,c);return f=nn(f),f}function sn(t,e,n){const o=new Set(t),r=new Set(e),s=Be(e),i=[];for(const t of n)o.has(t.src)&&r.has(t.dst)&&i.push(s.get(t.dst));return Fe(i)}function an(t,e,n){const o=[];for(const t of e){const e=n[t.src],r=n[t.dst];if(null==e||null==r||e===r)continue;let s=t.src,i=t.dst,a=e,c=r;e>r&&(s=t.dst,i=t.src,a=r,c=e);for(let e=a;e<c;e++)o.push({id:`${t.id}@${e}`,src:s,dst:i,ref:t.ref})}let r=0;for(let e=0;e+1<t.length;e++)r+=sn(t[e],t[e+1],o);return r}function cn(t,e){const n={...e},{preds:o}=Te(t),r=Xe(t);let s=an(rn(t,n,r),t.edges,n);const i=De;for(let e=0;e<i;e++){let e=!1;const i=[...t.nodes].sort((t,e)=>(n[e]??0)-(n[t]??0));for(const a of i){const i=n[a]??0;if(0===i)continue;let c=0;for(const t of o.get(a)??[])c=Math.max(c,(n[t]??0)+1);if(c>=i)continue;const f=i;n[a]=c;const d=an(rn(t,n,r),t.edges,n);d<s?(s=d,e=!0):n[a]=f}if(!e)break}return n}function fn(t,e){const n=Xe(t),o=[...t.nodes].sort((t,n)=>(e[t]??0)-(e[n]??0)||t.localeCompare(n));for(const r of o){const o=n(r);if(!o)continue;const s=t.edges.filter(t=>t.src===r);if(0===s.length)continue;let i=!1,a=0;for(const t of s){const e=n(t.dst);null==e||e===o?i=!0:a++}if(0===a||i)continue;let c=0,f=!1;for(const e of t.edges){if(e.dst!==r)continue;const t=n(e.src);t&&(t===o?f=!0:c++)}if(c>0||!f)continue;const d=e[r]??0,l=d+a;let u=0;for(const n of t.edges)n.dst===r&&(u=Math.max(u,(e[n.src]??0)+1));const h=Math.max(d,u,l);h!==d&&(e[r]=h)}}function dn(t,e){const n=ve(t),o=Ne(n)??[...n.nodes].sort(),r=e?.compactSingleInput??!1,s=Xe(n);let i=Object.create(null);for(const t of o){const o=Ce(n,t),a=e?.ignoreCrossLaneEdges?o.filter(e=>{const n=s(e.src),o=s(t);return!n||!o||n===o}):o;if(0===a.length)i[t]=0;else if(r&&1===a.length){const e=a[0].src,n=s(e),o=s(t);i[t]=n!==o?i[e]??0:(i[e]??0)+1}else{let e=-1/0;for(const t of a)e=Math.max(e,(i[t.src]??0)+1);i[t]=e===-1/0?0:e}}e?.optimizeRanksByCrossings&&(i=cn(n,i)),e?.ignoreCrossLaneEdges&&fn(n,i);return{layers:rn(n,i,s),rankOf:i,dummy:new Set}}function ln(t,e){const n=ve(t),o={...dn(n,{compactSingleInput:e?.compactSingleInput,ignoreCrossLaneEdges:e?.ignoreCrossLaneEdges,optimizeRanksByCrossings:e?.optimizeRanksByCrossings}).rankOf},r=Xe(n),{preds:s,succs:a}=Te(n,t=>{if(e?.ignoreCrossLaneEdges){const e=r(t.src),n=r(t.dst);if(e&&n&&e!==n)return!1}return!0}),c=Ne(n)??[...n.nodes],f=[...c].reverse(),d=(0,i.K)((t,e)=>{let n=0;for(const e of s.get(t)??[])n=Math.max(n,(o[e]??0)+1);let r=Number.POSITIVE_INFINITY;const i=a.get(t)??[];return i.length>0&&(r=Math.min(...i.map(t=>(o[t]??0)-1))),Number.isFinite(r)||(r=Math.max(n,e)),Math.min(Math.max(e,n),r)},"clampFeasible"),l=Pe,u=(0,i.K)(t=>{let e=!1;for(const n of t){const t=s.get(n)??[],r=a.get(n)??[];if(0===t.length&&0===r.length)continue;const i=t.length>0?t.reduce((t,e)=>t+(o[e]??0)+1,0)/t.length:o[n]??0,c=r.length>0?r.reduce((t,e)=>t+(o[e]??0)-1,0)/r.length:o[n]??0,f=Math.round((i+c)/2),l=d(n,f);l!==o[n]&&(o[n]=l,e=!0)}return e},"relaxOrder");for(let t=0;t<l;t++){const t=u(c),e=u(f);if(!t&&!e)break}for(const t of c){let e=0;for(const n of s.get(t)??[])e=Math.max(e,(o[n]??0)+1);(o[t]??0)<e&&(o[t]=e)}for(const t of f){const e=a.get(t)??[];if(e.length>0){const n=Math.min(...e.map(t=>(o[t]??0)-1));(o[t]??0)>n&&(o[t]=n)}}return{layers:$e(n,c,o),rankOf:o,dummy:new Set}}function un(t){const e=Oe(t),n=ke(t);let o=Re(e);const r=[];for(;o.length>0;){const t=[];for(const s of o){r.push(s);for(const o of n.get(s)??[])e.set(o,(e.get(o)??0)-1),0===(e.get(o)??0)&&t.push(o)}o=t.sort((t,e)=>t.localeCompare(e))}return r.length===t.nodes.length?r:null}function hn(t,e){const n=ve(t),o="LR"===e?.direction?un(n)??[...n.nodes].sort():Ne(n)??[...n.nodes].sort(),r=Xe(n),s=(0,i.K)(t=>r(t)??t,"laneOf"),a=Object.create(null),c=new Map,f=(0,i.K)((t,n)=>e?.ignoreCrossLaneEdges??!0?s(t)===s(n)?1:0:1,"edgeWeight");for(const t of o){const e=n.nodeById.get(t);if(e?.isGroup)continue;const o=Ce(n,t);let r=0;if(o.length>0)for(const e of o){const n=e.src,o=a[n]??0;r=Math.max(r,o+f(n,t))}const i=s(t),d=c.get(i)??0,l=Math.max(r,d);a[t]=l,c.set(i,l+1)}return{layers:$e(n,o,a,{skipGroups:!0}),rankOf:a,dummy:new Set}}function gn(t,e){const n=ve(e),{rankOf:o}=t,r=t.layers.map(t=>[...t]),s=new Set(t.dummy?[...t.dummy]:[]);let a=0;const c=new Map(n.nodeById),f=(0,i.K)(t=>{const e="placeholder-"+a++,n={id:e,isGroup:!1,isDummy:!0,width:0,height:0};for(c.set(e,n),s.add(e);r.length<=t;)r.push([]);return r[t].push(e),o[e]=t,e},"addDummyAt"),d=[...n.edges].sort((t,e)=>t.id===e.id?t.src===e.src?t.dst.localeCompare(e.dst):t.src.localeCompare(e.src):t.id.localeCompare(e.id)),l=[];for(const t of d){const e=o[t.src]??0,n=o[t.dst]??0;if(n-e<=1){l.push(t);continue}let r=t.src;for(let o=e+1,s=0;o<n;o++,s++){const e=f(o);l.push({id:`${t.id}#${s}`,src:r,dst:e,weight:t.weight,ref:t.ref}),r=e}const s=n-e-2;l.push({id:`${t.id}#${Math.max(s+1,0)}`,src:r,dst:t.dst,weight:t.weight,ref:t.ref})}const u={nodes:[...n.nodes,...[...s].filter(t=>!n.nodes.includes(t))],edges:l,layout:n.layout,nodeById:c};return{layering:{layers:r,rankOf:o,dummy:s},graphWithDummies:u}}function pn(t){const e=t.length;if(0===e)return Number.POSITIVE_INFINITY;const n=[...t].sort((t,e)=>t-e);return e%2==1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}function xn(t){if(0===t.length)return Number.POSITIVE_INFINITY;return t.reduce((t,e)=>t+e,0)/t.length}function mn(t,e,n,o){const r=new Map;for(const e of t)r.set(e,[]);for(const t of n)"down"===o?e.has(t.src)&&r.has(t.dst)&&r.get(t.dst).push(e.get(t.src)):e.has(t.dst)&&r.has(t.src)&&r.get(t.src).push(e.get(t.dst));return r}function yn(t,e,n){const o=n.get(t)??0,r=n.get(e)??0;return o!==r?o-r:t.localeCompare(e)}function bn(t,e,n){const o=new Set(t),r=new Set(e),s=Be(t),i=Be(e),a=[];for(const t of n)o.has(t.src)&&r.has(t.dst)&&a.push({u:s.get(t.src),v:i.get(t.dst)});a.sort((t,e)=>t.u===e.u?t.v-e.v:t.u-e.u);return Fe(a.map(t=>t.v))}function Mn(t,e,n){return[...t].sort((t,o)=>{const r=pn(e.get(t)??[]),s=pn(e.get(o)??[]);return r===s?yn(t,o,n):isFinite(r)?isFinite(s)?r-s:-1:1})}function Kn(t,e,n,o,r,s){const i=Be(t),a=Be(e),c=mn(e,i,n,o);if(!r||!s||0===s.length)return Mn(e,c,a);const f=new Map;for(const t of e){const e=r(t),n=f.get(e)??[];n.push(t),f.set(e,n)}const d=[];for(const t of s){const e=f.get(t);if(!e||0===e.length)continue;const n=Mn(e,c,a);d.push(...n)}const l=f.get(null);if(l&&l.length>0){const t=Mn(l,c,a);for(const e of t){const t=xn(c.get(e)??[]);let n=d.length;if(isFinite(t))for(const[e,o]of d.entries()){if(t<xn(c.get(o)??[])){n=e;break}}d.splice(n,0,e)}}return d}function In(t,e,n,o,r){const s=[...e],a=new Set(t),c=new Set(e),f=o?new Set(o):null,d=n.filter(t=>a.has(t.src)&&c.has(t.dst)),l=f?n.filter(t=>c.has(t.src)&&f.has(t.dst)):void 0,u=(0,i.K)(e=>{let n=bn(t,e,d);return l&&o&&(n+=bn(e,o,l)),n},"crossingScore"),h=r?new Map:null;if(r&&h)for(const t of e)h.set(t,r(t));let g=!0,p=u(s);for(;g;){g=!1;for(let t=0;t+1<s.length;t++){if(h){if(h.get(s[t])!==h.get(s[t+1]))continue}const e=p;[s[t],s[t+1]]=[s[t+1],s[t]];const n=u(s);n<e?(p=n,g=!0):[s[t],s[t+1]]=[s[t+1],s[t]]}}return s}function Sn(t,e,n){const o=t.layers.map(t=>[...t]),r=e.edges,s=Xe(e),i=Ae(e,n?.laneOrder);for(let t=0;t<3;t++){for(let t=1;t<o.length;t++)o[t]=Kn(o[t-1],o[t],r,"down",s,i),o[t]=In(o[t-1],o[t],r,o[t+1],s);for(let t=o.length-2;t>=0;t--)o[t]=Kn(o[t+1],o[t],r,"up",s,i),o[t]=In(o[t+1],o[t],r,o[t-1],s)}return{layers:o}}function wn(t,e,n){const o=n?.layerGap??He,r=n?.nodeGap??je,s=n?.laneGap??2*r,a=n?.direction??"TB",c="LR"===a||"RL"===a,f=t.layers,d=Object.create(null),l=Object.create(null),u=(0,i.K)(t=>e.nodeById.get(t),"getNode"),h=(0,i.K)(t=>u(t)?.width??0,"getWidth"),g=(0,i.K)(t=>u(t)?.height??0,"getHeight"),p=Xe(e),x=Ae(e,n?.laneOrder),m=f.map(t=>t.reduce((t,e)=>Math.max(t,g(e)),0)),y=[];if(c)for(let t=0;t+1<f.length;t++){const e=f[t].reduce((t,e)=>Math.max(t,h(e)),0),n=f[t+1].reduce((t,e)=>Math.max(t,h(e)),0),r=m[t]/2+m[t+1]/2,s=(e+n)/2,i=Math.max(0,s-r-o);y.push(i)}const b=new Set;for(const t of f)for(const e of t)b.add(p(e));const M=b.has(null),K=x.filter(t=>b.has(t)),I=[...M?[null]:[],...K],S=Object.create(null);for(const t of K)S[t]=0;M&&(S.null=0);for(const t of f){const e=Object.create(null),n=[];for(const o of t){const t=p(o);null===t?n.push(o):(e[t]||=[]).push(o)}for(const[t,n]of Object.entries(e)){const e=n.reduce((t,e)=>t+h(e),0)+r*Math.max(0,n.length-1);S[t]=Math.max(S[t]??0,e)}if(M&&n.length){const t=n.reduce((t,e)=>t+h(e),0)+r*Math.max(0,n.length-1);S.null=Math.max(S.null??0,t)}}const w=new Map;{const t=I.map(t=>(null===t?S.null:S[t])??0);let e=-(t.reduce((t,e)=>t+e,0)+s*Math.max(0,I.length-1))/2;for(let n=0;n<I.length;n++){const o=I[n],r=t[n]??0,i=e+r/2;w.set(o,i),e+=r,n<I.length-1&&(e+=s)}}let v=0;for(const[t,e]of f.entries()){const n=m[t]??0,s=new Map;for(const t of e){const e=p(t),n=s.get(e)??[];n.push(t),s.set(e,n)}for(const t of I){const e=s.get(t)??[];if(0===e.length)continue;const o=w.get(t);if(1===e.length){const t=e[0];d[t]=o,l[t]=v+n/2}else{const t=e.map(t=>h(t));let s=o-(t.reduce((t,e)=>t+e,0)+r*(e.length-1))/2;for(const[o,i]of e.entries()){const e=t[o];d[i]=s+e/2,l[i]=v+n/2,s+=e+r}}}v+=n+o+(y[t]??0)}const C=new Map;for(const t of e.edges){const e=t.ref.id;C.has(e)||C.set(e,[]),C.get(e).push(t)}for(const[,t]of C){if(0===t.length)continue;const n=t[0].ref,o=n.start,r=n.end;if(null==o||null==r)continue;const s=Math.round(((d[o]??0)+(d[r]??0))/2),i=new Set;for(const e of t)i.add(e.src),i.add(e.dst);for(const t of i){if(t===o||t===r)continue;const n=e.nodeById.get(t);n?.isDummy&&(d[t]=s)}}return{x:d,y:l}}(0,i.K)(Ve,"buildDrivingTree"),(0,i.K)(_e,"chooseParent"),(0,i.K)(We,"buildAdjacency"),(0,i.K)(qe,"assignComponents"),(0,i.K)(Je,"computeBlocks"),(0,i.K)(Qe,"popBlock"),(0,i.K)(Ue,"computeSubtreeCrossCounts"),(0,i.K)(Ze,"annotateMinimumLayers"),(0,i.K)(tn,"compareByRankThenId"),(0,i.K)(en,"emitNodesInTreeOrder"),(0,i.K)(nn,"deduplicateLayers"),(0,i.K)(on,"createChildOrderer"),(0,i.K)(rn,"buildMultitreeLayerOrder"),(0,i.K)(sn,"countCrossingsBetweenAdjacent"),(0,i.K)(an,"totalCrossings"),(0,i.K)(cn,"optimizeRanksByCrossings"),(0,i.K)(fn,"adjustCrossLaneSources"),(0,i.K)(dn,"assignLayers_LongestPath"),(0,i.K)(ln,"assignLayers_Gravity"),(0,i.K)(un,"topoSortByGenerationIfAcyclic"),(0,i.K)(hn,"assignLayers_LaneAwareCompact"),(0,i.K)(gn,"makeProperLayering"),(0,i.K)(pn,"median"),(0,i.K)(xn,"barycenter"),(0,i.K)(mn,"neighborPositionsFor"),(0,i.K)(yn,"currentOrderTieBreak"),(0,i.K)(bn,"countCrossingsBetweenAdjacent"),(0,i.K)(Mn,"sortByHeuristic"),(0,i.K)(Kn,"reorderLayer"),(0,i.K)(In,"transposeImprove"),(0,i.K)(Sn,"orderLayers"),(0,i.K)(wn,"assignCoordinates");function vn(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return e>>>0}function Cn(t){let e=t>>>0;return()=>{e+=1831565813;let t=e;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296}}function Ln(t,e){const n=[...t],o=Cn(e);for(let t=n.length-1;t>0;t--){const e=Math.floor(o()*(t+1));[n[t],n[e]]=[n[e],n[t]]}return n}function kn(t,e){let n=0;for(const[o,r]of t.entries())n+=Math.abs(o-(e.get(r)??o));return n}function On(t,e){const n=new Map;for(const[e,o]of t.entries())n.set(o,e);let o=0;for(const{a:t,b:r,weight:s}of e){const e=n.get(t),i=n.get(r);null!=e&&null!=i&&(o+=s*Math.abs(e-i))}return o}function Rn(t){const e=ze(t);if(e.length<2)return[];const n=new Map(e.map((t,e)=>[t,e])),o=Xe(t),r=new Map;for(const e of t.layout.edges??[]){if(e.isLayoutOnly)continue;const s="string"==typeof e.start?e.start:void 0,i="string"==typeof e.end?e.end:void 0;if(!(s&&i&&t.nodeById.has(s)&&t.nodeById.has(i)))continue;const a=o(s),c=o(i);if(!a||!c||a===c)continue;const f=n.get(a),d=n.get(c);if(null==f||null==d)continue;const[l,u]=f<=d?[a,c]:[c,a],h=`${l}\0${u}`,g=r.get(h);g?g.weight++:r.set(h,{a:l,b:u,weight:1})}return[...r.values()]}function Tn(t,e,n){const o=[...t];let r=On(o,e),s=!0,i=0;const a=Math.max(1,o.length);for(;s&&i<a;){s=!1,i++;for(let t=0;t+1<o.length;t++){[o[t],o[t+1]]=[o[t+1],o[t]];const n=On(o,e);n<r?(r=n,s=!0):[o[t],o[t+1]]=[o[t+1],o[t]]}}return{order:o,cost:r,sourceDistance:kn(o,n)}}function $n(t,e){return t.cost!==e.cost?t.cost<e.cost:t.sourceDistance<e.sourceDistance}function Nn(t,e,n){const o=[...e].sort((t,e)=>t.a===e.a?t.b.localeCompare(e.b):t.a.localeCompare(e.a)).map(({a:t,b:e,weight:n})=>`${t}:${e}:${n}`).join("|");return vn(`${t.join("|")}#${o}#${n}`)}function Bn(t,e={}){const n=ze(t);if(n.length<2)return n;const o=Rn(t);if(0===o.length)return n;const r=new Map(n.map((t,e)=>[t,e]));let s=Tn(n,o,r);const i=Math.max(0,e.restarts??8);for(let t=0;t<i;t++){const e=Tn(Ln(n,Nn(n,o,t)),o,r);$n(e,s)&&(s=e)}return s.order}function Fn(t,e){const n=e?.ignoreCrossLaneEdges??!0,o=e?.optimizeRanksByCrossings??!0,r=ve(t),s=e?.automaticLaneOrdering?Bn(r,{restarts:8}):void 0,i=Ee(r),a=i.acyclic,c=n?hn(a,{compactSingleInput:e?.compactSingleInput??Ge,ignoreCrossLaneEdges:!0,direction:e?.direction}):ln(a,{compactSingleInput:e?.compactSingleInput??Ge,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:o}),{layering:f,graphWithDummies:d}=gn(c,a),l=Sn(f,d,{laneOrder:s}),u=wn(l,d,{layerGap:e?.layerGap,nodeGap:e?.nodeGap,direction:e?.direction,laneOrder:s});return{acyclic:a,reversed:i.reversed,layering:f,ordered:l,coordinates:u}}(0,i.K)(vn,"hashString"),(0,i.K)(Cn,"mulberry32"),(0,i.K)(Ln,"deterministicShuffle"),(0,i.K)(kn,"sourceDistance"),(0,i.K)(On,"laneArrangementCost"),(0,i.K)(Rn,"buildWeightedLaneEdges"),(0,i.K)(Tn,"greedySwitch"),(0,i.K)($n,"isBetterCandidate"),(0,i.K)(Nn,"seedForRestart"),(0,i.K)(Bn,"optimizeTopLaneOrder"),(0,i.K)(Fn,"sugiyamaLayout");var En=1e-6,Yn=15,Xn=15,zn=20;function An(t,e,n){const o=t.x??0,r=t.y??0,s=e.x-o,i=e.y-r,a=Math.abs(s),c=Math.abs(i);if(a<En&&c<En)return n;return c>En&&3*c>=a?i>0?"bottom":"top":a>En?s>0?"right":"left":n}function Pn(t,e){return Math.abs(t.to-e.from)<En||Math.abs(t.to-e.to)<En?t.to:t.from}function Dn(t,e){return"vertical"===t.orient?{x:t.coord,y:e}:{x:e,y:t.coord}}function Gn(t,e){const n=t.nodes??[],o=t.edges??[],r=[];for(const t of o)t.isLayoutOnly||r.push({...t,__originalEdge:t});const s=new Map,a=new Map,c=[],f="LR"===e;for(const t of n)s.set(t.id,t);const d=n.filter(t=>t.isGroup&&!t.parentId);for(const t of d){const e={id:t.id},o=(0,i.K)(t=>{a.set(t.id,e),n.filter(e=>e.parentId===t.id).forEach(o)},"assignLane");o(t)}const l=n.filter(t=>!t.isGroup&&!t.isEdgeLabel).map(t=>{const e=t.width??10,n=t.height??10,o=t.x??0,r=t.y??0;return{nodeId:t.id,minX:o-e/2-8,maxX:o+e/2+8,minY:r-n/2-8,maxY:r+n/2+8,visualXHalfExtent:f?n/2+8:e/2+8}}),u=(0,i.K)((t,e,n,o)=>{let r=c.find(n=>n.orientation===t&&Math.abs(n.coord-e)<1);return r||(r={id:`pipe-${t}-${e.toFixed(0)}`,orientation:t,coord:e,spanMin:n,spanMax:o,tracks:[]},c.push(r)),r.spanMin=Math.min(r.spanMin,n),r.spanMax=Math.max(r.spanMax,o),r},"getOrAddPipe"),h=(0,i.K)((t,e)=>{const n=t.width??10,o=t.height??10,r=t.x??0,s=t.y??0;switch(e){case"top":return{x:r,y:s-o/2};case"bottom":return{x:r,y:s+o/2};case"left":return{x:r-n/2,y:s};case"right":return{x:r+n/2,y:s}}},"portForSide"),g=(0,i.K)((t,e,n)=>h(t,An(t,e,n?"bottom":"top")),"getOrthogonalPort"),p=[],x=[],m=new Set,y=(0,i.K)((t,e,n)=>{if(0===p.length)return 0;const o=Math.abs(e.y-n.y)<En,r=Math.abs(e.x-n.x)<En;if(!o&&!r)return 0;let s=0;if(o){const o=e.y,r=Math.min(e.x,n.x)-En,i=Math.max(e.x,n.x)+En;if(i<=r)return 0;for(const e of p)e.edgeIndex!==t&&"vertical"===e.orientation&&(e.pipe.coord<r||e.pipe.coord>i||e.from-En<=o&&e.to+En>=o&&(s+=1e3))}else if(r){const o=e.x,r=Math.min(e.y,n.y)-En,i=Math.max(e.y,n.y)+En;if(i<=r)return 0;for(const e of p)e.edgeIndex!==t&&"horizontal"===e.orientation&&(e.pipe.coord<r||e.pipe.coord>i||e.from-En<=o&&e.to+En>=o&&(s+=1e3))}return s},"crossingPenalty"),b=r.map((t,e)=>{if(!t.start||!t.end)return{idx:e,crossLane:0,dx:0,dy:0};const n=s.get(t.start),o=s.get(t.end),r=a.get(t.start),i=a.get(t.end);return{idx:e,crossLane:r&&i&&r.id!==i.id?1:0,dx:n&&o?Math.abs((o.x??0)-(n.x??0)):0,dy:n&&o?Math.abs((o.y??0)-(n.y??0)):0}}).sort((t,e)=>{if(t.crossLane!==e.crossLane)return e.crossLane-t.crossLane;const n=t.dx+t.dy,o=e.dx+e.dy;return Math.abs(n-o)>1?n-o:t.idx-e.idx}).map(t=>t.idx),M=(0,i.K)((t,e,n,o)=>{const r=Math.min(t.x,e.x),s=Math.max(t.x,e.x),i=Math.min(t.y,e.y),a=Math.max(t.y,e.y);return!!l.find(c=>(!n||c.nodeId!==n)&&((!o||c.nodeId!==o)&&(Math.abs(t.x-e.x)>En?c.minY<t.y&&c.maxY>t.y&&c.maxX>r&&c.minX<s:c.minX<t.x&&c.maxX>t.x&&c.maxY>i&&c.minY<a)))},"isSegmentBlocked"),K=new Map,I=new Map;for(const t of r)t.start&&t.end&&t.start!==t.end&&(I.set(t.start,(I.get(t.start)??0)+1),I.set(t.end,(I.get(t.end)??0)+1));const S=(0,i.K)((t,e)=>An(t,e,"bottom"),"determineSide"),w=new Map;for(const[t,e]of r.entries()){if(!e.start||!e.end||e.start===e.end)continue;if(e.points&&e.points.length>0)continue;const n=s.get(e.start),o=s.get(e.end);if(!n||!o)continue;const r=(o.x??0)-(n.x??0),i=(o.y??0)-(n.y??0);w.set(t,{edgeIdx:t,srcId:e.start,dstId:e.end,srcSide:S(n,{x:o.x??0,y:o.y??0}),dstSide:S(o,{x:n.x??0,y:n.y??0}),absDx:Math.abs(r),absDy:Math.abs(i),dxSign:Math.sign(r),dySign:Math.sign(i)})}const v=(0,i.K)(t=>"top"===t.srcSide||"bottom"===t.srcSide?0===t.absDx?1/0:t.absDy/t.absDx:0===t.absDy?1/0:t.absDx/t.absDy,"preferenceStrength"),C=(0,i.K)(t=>"top"===t.srcSide||"bottom"===t.srcSide?t.dxSign>=0?"right":"left":t.dySign>=0?"bottom":"top","secondarySide"),L=new Map;for(const t of w.values()){const e=`${t.srcId}:${t.srcSide}`;L.has(e)||L.set(e,[]),L.get(e).push(t)}const k=new Map,O=(0,i.K)((t,e)=>`${t}:${e}`,"loadKey");for(const t of w.values())k.set(O(t.srcId,t.srcSide),(k.get(O(t.srcId,t.srcSide))??0)+1),k.set(O(t.dstId,t.dstSide),(k.get(O(t.dstId,t.dstSide))??0)+1);for(const t of L.values())if(!(t.length<2)){t.sort((t,e)=>{const n=v(t),o=v(e);return Math.abs(n-o)>1e-9?o-n:t.edgeIdx-e.edgeIdx});for(let e=1;e<t.length;e++){const n=t[e],o=C(n),r=k.get(O(n.srcId,n.srcSide))??0,s=k.get(O(n.srcId,o))??0;s>=r||(k.set(O(n.srcId,n.srcSide),r-1),k.set(O(n.srcId,o),s+1),n.srcSide=o)}}const R=(0,i.K)(t=>{const e=t?.shape;return"question"===e||"diamond"===e},"isDiamondNode"),T=new Map;for(const t of w.values())T.has(t.dstId)||T.set(t.dstId,new Set),T.get(t.dstId).add(t.dstSide);for(const t of w.values()){if(!R(s.get(t.srcId)))continue;const e=T.get(t.srcId);if(!e?.has(t.srcSide))continue;const n=C(t);if(e.has(n)||(k.get(O(t.srcId,n))??0)>0)continue;const o=k.get(O(t.srcId,t.srcSide))??0;k.set(O(t.srcId,t.srcSide),Math.max(0,o-1)),k.set(O(t.srcId,n),1),t.srcSide=n}for(const t of w.values()){const{edgeIdx:e,srcId:n,dstId:o,srcSide:r,dstSide:i}=t,a=s.get(n),c=s.get(o),f=`${n}:${r}:src`,d="top"===r||"bottom"===r?c.x??0:c.y??0;K.has(f)||K.set(f,[]),K.get(f).push({edgeIdx:e,oppositeCoord:d});const l=`${o}:${i}:dst`,u="top"===i||"bottom"===i?a.x??0:a.y??0;K.has(l)||K.set(l,[]),K.get(l).push({edgeIdx:e,oppositeCoord:u})}const $=new Map;for(const[t,e]of K){if(e.length<2)continue;e.sort((t,e)=>t.oppositeCoord-e.oppositeCoord);const n=t.split(":"),o=n.slice(0,-2).join(":"),r=n[n.length-2],i=n[n.length-1],a=s.get(o);if(!a)continue;const c="left"===r||"right"===r?a.height??10:a.width??10,f=a.shape,d="question"===f||"diamond"===f?.3*c:c,l=20,u=Math.min(l,Math.max(8,d/(e.length+1))),h=-(u*(e.length-1))/2;for(const[t,n]of e.entries()){const e=h+t*u,o=`${n.edgeIdx}:${i}`;$.set(o,e)}}const N=(0,i.K)(t=>Boolean(r[t]?.labelNodeId),"edgeHasLabelNode"),B=(0,i.K)((t,e)=>!!t&&((K.get(`${t}:${e}:src`)??[]).some(({edgeIdx:t})=>N(t))||(K.get(`${t}:${e}:dst`)??[]).some(({edgeIdx:t})=>N(t))),"faceHasLabelNode"),F=(0,i.K)((t,e,n)=>"top"===e||"bottom"===e?{x:t.x+n,y:t.y}:{x:t.x,y:t.y+n},"applyPortOffset"),E=(0,i.K)((t,e,n)=>{const o=w.get(t),r={x:n.x??0,y:n.y??0},s={x:e.x??0,y:e.y??0},i=o?.srcSide??S(e,r),a=o?.dstSide??S(n,s);let c=o?h(e,o.srcSide):g(e,r,!0),f=o?h(n,o.dstSide):g(n,s,!1);const d=$.get(`${t}:src`),l=$.get(`${t}:dst`);return void 0!==d&&(c=F(c,i,d)),void 0!==l&&(f=F(f,a,l)),{pSrcPort:c,pDstPort:f,srcSide:i,dstSide:a}},"portsForEdge");for(const t of b){const e=r[t];if(x[t]=[],!e.start||!e.end)continue;if(e.points&&e.points.length>0)continue;if(e.start===e.end)continue;const n=s.get(e.start),o=s.get(e.end);if(!n||!o)continue;const{pSrcPort:a,pDstPort:d,srcSide:h,dstSide:g}=E(t,n,o),b={...a},S={...d},w="top"===h||"bottom"===h,v="top"===g||"bottom"===g;if(w){const t=a.y>(n.y??0);b.y=t?a.y+zn:a.y-zn}else{const t=a.x>(n.x??0);b.x=t?a.x+zn:a.x-zn}if(v){const t=d.y>(o.y??0);S.y=t?d.y+zn:d.y-zn}else{const t=d.x>(o.x??0);S.x=t?d.x+zn:d.x-zn}const C=(0,i.K)((t,e)=>{for(const n of l)if(!e.includes(n.nodeId)&&t.x>n.minX&&t.x<n.maxX&&t.y>n.minY&&t.y<n.maxY)return{inside:!0,obstacle:n};return{inside:!1}},"isPointInObstacle"),L=(0,i.K)((t,e,n,o,r)=>{if(r){const r=t.y>(e.y??0);return{x:(n.x??0)>=t.x?o.maxX+Yn:o.minX-Yn,y:r?o.maxY+Xn:o.minY-Xn,leavesPositiveSide:r}}const s=t.x>(e.x??0),i=(n.y??0)>=t.y;return{x:s?o.maxX+Yn:o.minX-Yn,y:i?o.maxY+Xn:o.minY-Xn,leavesPositiveSide:s}},"obstacleDetour");let k=[];const O=[e.start,e.end],R=C(b,O);if(R.inside&&R.obstacle){const t=R.obstacle;if(w){const e=L(a,n,o,t,!0);b.x=e.x,b.y=e.y;const r=e.leavesPositiveSide?Math.min(t.minY-2,a.y+zn):Math.max(t.maxY+2,a.y-zn);k=[{x:a.x,y:r},{x:e.x,y:r},{x:e.x,y:e.y}]}else{const e=L(a,n,o,t,!1),r=e.leavesPositiveSide?Math.min(t.minX-2,a.x+zn):Math.max(t.maxX+2,a.x-zn);b.x=e.x,b.y=e.y,k=[{x:r,y:a.y},{x:r,y:e.y},{x:e.x,y:e.y}]}}let T=[];const N=C(S,O);if(N.inside&&N.obstacle){const t=N.obstacle;if(v){const e=L(d,o,n,t,!0);S.x=e.x,S.y=e.y,T=[{x:e.x,y:e.y},{x:d.x,y:e.y}]}else{const e=L(d,o,n,t,!1);S.x=e.x,S.y=e.y,T=[{x:e.x,y:e.y},{x:e.x,y:d.y}]}}if(0===k.length&&0===T.length){const n=Yn,o=Math.abs(b.x-S.x)<n,r=Math.abs(b.y-S.y)<n,s=void 0!==$.get(`${t}:src`)||void 0!==$.get(`${t}:dst`),i=(K.get(`${e.start??""}:${h}:src`)?.length??0)+(K.get(`${e.start??""}:${h}:dst`)?.length??0),c=(K.get(`${e.end??""}:${g}:src`)?.length??0)+(K.get(`${e.end??""}:${g}:dst`)?.length??0),f=i>1||c>1,l=I.get(e.start??"")??0,u=I.get(e.end??"")??0,x=i>1&&B(e.start,h)||c>1&&B(e.end,g);if((o||r)&&!s&&(!f||f&&!x&&(i<=1||l<=2)&&(c<=1||u<=2))){if(!M(a,d,e.start,e.end)){e.points=[{...a},{...b},{...S},{...d}],m.add(t);const n=r?"horizontal":"vertical",o=r?a.y:a.x,s=r?Math.min(a.x,d.x):Math.min(a.y,d.y),i=r?Math.max(a.x,d.x):Math.max(a.y,d.y),c={id:`fast-path-${n}-${o.toFixed(0)}-${t}`,orientation:n,coord:o,spanMin:s,spanMax:i,tracks:[]};p.push({edgeIndex:t,segmentIndex:0,orientation:n,pipe:c,trackIndex:0,from:s,to:i});continue}}}const F=u("vertical",b.x,b.y,b.y);b.x=F.coord;const Y=u("vertical",S.x,S.y,S.y);S.x=Y.coord;let X=Math.min(b.x,S.x)-50,z=Math.max(b.x,S.x)+50,A=Math.min(b.y,S.y)-50,P=Math.max(b.y,S.y)+50;for(const t of l){const e=Math.min(b.x,S.x),n=Math.max(b.x,S.x),o=Math.min(b.y,S.y),r=Math.max(b.y,S.y);t.minX<n&&t.maxX>e&&t.minY<r&&t.maxY>o&&(X=Math.min(X,t.minX-25),z=Math.max(z,t.maxX+25),A=Math.min(A,t.minY-25),P=Math.max(P,t.maxY+25))}for(const t of l){if(t.maxX<X||t.minX>z||t.maxY<A||t.minY>P)continue;const e=Yn;u("horizontal",t.minY-e,X,z),u("horizontal",t.maxY+e,X,z);const n=Xn;u("vertical",t.minX-n,A,P),u("vertical",t.maxX+n,A,P)}u("horizontal",b.y,X,z),u("horizontal",S.y,X,z);const D=c.filter(t=>"horizontal"===t.orientation&&t.coord>=A&&t.coord<=P),G=c.filter(t=>"vertical"===t.orientation&&t.coord>=X&&t.coord<=z),H=(0,i.K)((t,e)=>`${t.toFixed(1)},${e.toFixed(1)}`,"getKey"),j=H(b.x,b.y),V=H(S.x,S.y),_=new Map,W=new Map,q=new Map,J=new Set,Q=[];_.set(j,0),q.set(j,"n"),Q.push({key:j,f:Math.hypot(S.x-b.x,S.y-b.y),pt:b}),J.add(j);let U=[];const Z=(0,i.K)((t,n)=>M(t,n,e.start,e.end),"checkSegmentBlocked"),tt={x:S.x,y:b.y},et=Z(b,tt),nt=Z(tt,S),ot=et||nt,rt={x:b.x,y:S.y},st=Z(b,rt),it=Z(rt,S);if(ot?st||it||(U=Math.abs(b.x-S.x)<En?[b,S]:[b,rt,S]):U=Math.abs(b.y-S.y)<En||Math.abs(b.x-S.x)<En?[b,S]:[b,tt,S],0===U.length)for(;Q.length>0;){Q.sort((t,e)=>t.f-e.f);const n=Q.shift();if(J.delete(n.key),n.key===V){let t=V,e=S;for(U=[e];W.has(t);){const n=W.get(t);U.unshift(n),e=n,t=H(n.x,n.y)}break}const o=n.pt.x,r=n.pt.y,s=G.sort((t,e)=>t.coord-e.coord),i=s.findIndex(t=>Math.abs(t.coord-o)<1),a=D.sort((t,e)=>t.coord-e.coord),c=a.findIndex(t=>Math.abs(t.coord-r)<1),f=[];i>0&&f.push({x:s[i-1].coord,y:r}),i>=0&&i<s.length-1&&f.push({x:s[i+1].coord,y:r}),c>0&&f.push({x:o,y:a[c-1].coord}),c>=0&&c<a.length-1&&f.push({x:o,y:a[c+1].coord});for(const s of f){const i=Math.min(o,s.x),a=Math.max(o,s.x),c=Math.min(r,s.y),f=Math.max(r,s.y);if(l.some(t=>t.nodeId!==e.start&&t.nodeId!==e.end&&(i!==a?t.minY<r&&t.maxY>r&&t.maxX>i&&t.minX<a:t.minX<o&&t.maxX>o&&t.maxY>c&&t.minY<f)))continue;const d=H(s.x,s.y),u=Math.abs(s.x-o)+Math.abs(s.y-r),h=y(t,n.pt,s);let g=0;const p=S.x-b.x,x=S.y-b.y,m=s.x-o,M=s.y-r;(x>10&&M<-5||x<-10&&M>5)&&(g=100*Math.abs(M)),(p>10&&m<-5||p<-10&&m>5)&&(g+=50*Math.abs(m));let K=0;const I=q.get(n.key)??"n",w=Math.abs(m)>En?"h":"v";"n"!==I&&I!==w&&(K=50);const v=u+h+g+K,C=(_.get(n.key)??1/0)+v,L=Math.abs(S.x-s.x)+Math.abs(S.y-s.y);if(C<(_.get(d)??1/0))if(W.set(d,n.pt),_.set(d,C),q.set(d,w),J.has(d)){const t=Q.findIndex(t=>t.key===d);-1!==t&&(Q[t].f=C+L)}else Q.push({key:d,f:C+L,pt:s}),J.add(d)}}if(0===U.length&&(U=[b,{x:b.x,y:S.y},S]),U.length>4){const t=U[0],e=U[U.length-1];let n=Math.min(t.x,e.x),o=Math.max(t.x,e.x),r=Math.min(t.y,e.y),s=Math.max(t.y,e.y);for(const t of U)n=Math.min(n,t.x),o=Math.max(o,t.x),r=Math.min(r,t.y),s=Math.max(s,t.y);const a=o>Math.max(t.x,e.x),c=n<Math.min(t.x,e.x);if(f){const r=Xn;if(a){const n=Math.max(t.x,e.x),s=Math.min(t.y,e.y),i=Math.max(t.y,e.y),a=l.filter(t=>t.minX<n&&t.maxX>n&&t.minY<i&&t.maxY>s);if(a.length>0){let n=Math.max(t.x,e.x);for(const t of a){const e=(t.minX+t.maxX)/2;if(void 0===t.visualXHalfExtent||isNaN(t.visualXHalfExtent))continue;const o=e+t.visualXHalfExtent+r;n=Math.max(n,o)}isNaN(n)||(o=n)}}if(c){const o=l.filter(n=>n.minX<Math.min(t.x,e.x)+r&&n.minY<Math.max(t.y,e.y)&&n.maxY>Math.min(t.y,e.y));if(o.length>0){let s=Math.min(t.x,e.x);for(const t of o){const e=(t.minX+t.maxX)/2-t.visualXHalfExtent-r;s=Math.min(s,e)}n=s}}}const d=(0,i.K)(n=>{const o=e.y>t.y,r=l.filter(n=>{const o=Math.min(t.x,e.x)<n.maxX&&Math.max(t.x,e.x)>n.minX,r=Math.min(t.y,e.y)<n.maxY&&Math.max(t.y,e.y)>n.minY;return o&&r});let s=r;if(f&&r.length>0){const t=r.filter(t=>t.minX<n&&t.maxX>n);t.length>0&&(s=t)}if(0===s.length)return e.y;if(o){const t=Math.max(...s.map(t=>t.maxY))+15;if(t<e.y-En)return t}else{const t=Math.min(...s.map(t=>t.minY))-15;if(t>e.y+En)return t}return e.y},"findBestReturnY"),u=(0,i.K)(n=>{const o=d(n),r={x:n,y:t.y},s={x:n,y:o},i={x:e.x,y:o},a=Z(t,r),c=Z(r,s),f=Z(s,i),l=o!==e.y&&Z(i,e);return a||c||f||l?null:Math.abs(o-e.y)<En?[t,r,s,e]:[t,r,s,i,e]},"trySimplifyWithDetourX"),h=a&&!c?u(o):c&&!a?u(n):null;h&&(U=h)}const at=[a,...k,...U,...T.reverse(),d];if(at.length>=3){const t=at[at.length-1],e=at[at.length-2],n=at[at.length-3],o=Math.abs(n.y-e.y)<En&&Math.abs(e.y-t.y)<En,r=Math.abs(n.x-e.x)<En&&Math.abs(e.x-t.x)<En;if(o){const o=Math.sign(e.x-n.x),r=Math.sign(t.x-n.x);0!==o&&o===r&&Math.abs(e.x-n.x)>Math.abs(t.x-n.x)&&at.splice(-2,1)}else if(r){const o=Math.sign(e.y-n.y),r=Math.sign(t.y-n.y);0!==o&&o===r&&Math.abs(e.y-n.y)>Math.abs(t.y-n.y)&&at.splice(-2,1)}}const ct=[at[0]];for(let t=1;t<at.length-1;t++){if(1===t){ct.push(at[t]);continue}const e=ct[ct.length-1],n=at[t],o=at[t+1];if(Math.abs(e.y-n.y)<En&&Math.abs(n.y-o.y)<En){if(n.x>e.x!==o.x>n.x){ct.push(n);continue}continue}if(Math.abs(e.x-n.x)<En&&Math.abs(n.x-o.x)<En){if(n.y>e.y!==o.y>n.y){ct.push(n);continue}continue}ct.push(n)}ct.push(at[at.length-1]);for(let e=0;e<ct.length-1;e++){const n=ct[e],o=ct[e+1],r=Math.abs(n.x-o.x)<En?"vertical":"horizontal",s="vertical"===r?n.x:n.y,i="vertical"===r?Math.min(n.y,o.y):Math.min(n.x,o.x),a="vertical"===r?Math.max(n.y,o.y):Math.max(n.x,o.x),c=u(r,s,i,a),f={edgeIndex:t,segmentIndex:e,orientation:r,pipe:c,trackIndex:0,from:i,to:a};p.push(f),x[t].push(p.length-1),c.tracks[0]||(c.tracks[0]={index:0,coord:c.coord,segments:[]}),c.tracks[0].segments.push({edgeIndex:t,segmentIndex:e,from:i,to:a})}}const Y=(0,i.K)((t,e)=>t.from<e.to&&e.from<t.to,"segmentsOverlap"),X=(0,i.K)((t,e,n,o)=>{const r=!o.segments.some(n=>(n.edgeIndex!==e.edgeIndex||n.segmentIndex!==e.segmentIndex)&&Y(n,t)),s=!n.segments.some(n=>(n.edgeIndex!==t.edgeIndex||n.segmentIndex!==t.segmentIndex)&&Y(n,e));return!(!r||!s)&&(t.trackIndex=o.index,e.trackIndex=n.index,n.segments=[...n.segments.filter(e=>e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex),{edgeIndex:e.edgeIndex,segmentIndex:e.segmentIndex,from:e.from,to:e.to}],o.segments=[...o.segments.filter(t=>t.edgeIndex!==e.edgeIndex||t.segmentIndex!==e.segmentIndex),{edgeIndex:t.edgeIndex,segmentIndex:t.segmentIndex,from:t.from,to:t.to}],!0)},"trySwapSegmentsAcrossTracks"),z=(0,i.K)(t=>{const e=t.tracks.length;return t.tracks[e]={index:e,coord:t.coord,segments:[]},e},"createNewTrack"),A=(0,i.K)((t,e)=>{const n=t.pipe.tracks[t.trackIndex];n.segments=n.segments.filter(e=>e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex),t.trackIndex=e;t.pipe.tracks[e].segments.push({edgeIndex:t.edgeIndex,segmentIndex:t.segmentIndex,from:t.from,to:t.to})},"moveSegmentToTrack"),P=(0,i.K)((t,e)=>{const n=x[t.edgeIndex];for(const o of n){const n=p[o];n.pipe===t.pipe&&A(n,e)}},"moveSegmentChainToTrack"),D=(0,i.K)(t=>{const e=x[t.edgeIndex],n=e.indexOf(p.indexOf(t)),o=[];return n>0&&o.push(p[e[n-1]]),n<e.length-1&&o.push(p[e[n+1]]),o},"getAdjacentSegmentsAlongEdge"),G=(0,i.K)((t,e)=>{if(t.orientation===e.orientation)return!1;const n="horizontal"===t.orientation?t:e,o="horizontal"===t.orientation?e:t;return o.pipe.coord>n.from&&o.pipe.coord<n.to&&n.pipe.coord>o.from&&n.pipe.coord<o.to},"haveAnyCrossing"),H=(0,i.K)((t,e)=>{for(const n of t.tracks){if(!n.segments.some(t=>(t.edgeIndex!==e.edgeIndex||t.segmentIndex!==e.segmentIndex)&&Y(t,e)))return n.index}return-1},"findAvailableTrack"),j=(0,i.K)((t,e)=>{if(t.trackIndex===e.trackIndex)return Y(t,e);const n=D(t),o=D(e);return n.some(t=>o.some(e=>G(t,e)))},"segmentsConflict"),V=(0,i.K)((t,e,n)=>{if(X(t,e,t.pipe.tracks[t.trackIndex],e.pipe.tracks[e.trackIndex]))return;const o=H(t.pipe,e);n(e,-1!==o?o:z(t.pipe))},"resolveTrackConflict"),_=(0,i.K)(t=>{let e=0;for(let n=0;n<t.length;n++)for(let o=n+1;o<t.length;o++){const r=t[n],s=t[o];r.pipe===s.pipe&&(j(r,s)&&(e++,V(r,s,P)))}return e},"resolveHandleConflicts"),W=new Map,q=(0,i.K)(t=>{if(W.has(t))return W.get(t);const e=x[t];if(0===e.length){const e={dest:0,deviation:0,base:0,delta:0};return W.set(t,e),e}const n=p[e[0]].pipe.coord;let o=n;for(let t=1;t<e.length;t++){const r=p[e[t]];if("horizontal"===r.orientation){const t=r.from,e=r.to;o=Math.abs(t-n)>Math.abs(e-n)?t:e;break}}const r={dest:o,deviation:Math.abs(o-n),base:n,delta:o-n};return W.set(t,r),r},"getDestInfo"),J=(0,i.K)(()=>{let t=0;const e=new Map;for(const[t,n]of r.entries())0!==x[t].length&&n.start&&(e.has(n.start)||e.set(n.start,[]),e.get(n.start).push(t));const n=(0,i.K)(t=>{const e=r[t];if(!e.start||!e.end)return 0;const n=s.get(e.start),o=s.get(e.end);if(!n||!o)return 0;const i=(o.x??0)-(n.x??0),a=(o.y??0)-(n.y??0);return Math.abs(i)+Math.abs(a)},"getEdgeDistance");for(const o of e.values()){o.sort((t,e)=>{const o=q(t),r=q(e);if(Math.abs(o.deviation-r.deviation)>1)return o.deviation-r.deviation;if(Math.abs(o.dest-r.dest)>1)return o.dest-r.dest;const s=n(t),i=n(e);if(Math.abs(s-i)>1)return i-s;const a=x[t].length,c=x[e].length;if(a!==c)return a-c;if(1===a){const n=x[t][0],o=x[e][0];if(p[n]&&p[o]){const t=p[n],e=p[o],r=Math.abs(t.to-t.from),s=Math.abs(e.to-e.from);if(Math.abs(r-s)>1)return r-s}}return 0});const e=o.map(t=>p[x[t][0]]);t+=_(e)}return t},"fixSourceHandleCrossings"),Q=(0,i.K)(()=>{let t=0;const e=new Map;for(const[t,n]of r.entries()){0!==x[t].length&&(n.end&&(e.has(n.end)||e.set(n.end,[]),e.get(n.end).push(t)))}for(const n of e.values()){n.sort((t,e)=>{const n=(0,i.K)(t=>{const e=x[t];if(e.length<2)return 0;const n=p[e[e.length-2]];return Math.abs(n.to-n.from)},"getDist"),o=n(t),r=n(e);return Math.abs(o-r)>.1?o-r:t-e});const e=n.map(t=>p[x[t][x[t].length-1]]);t+=_(e)}return t},"fixTargetHandleCrossings"),U=(0,i.K)(()=>{let t=0;for(const e of c){const n=[];for(const t of e.tracks)for(const e of t.segments){const t=x[e.edgeIndex].find(t=>p[t].segmentIndex===e.segmentIndex);void 0!==t&&n.push(p[t])}n.sort((t,e)=>t.edgeIndex-e.edgeIndex||t.segmentIndex-e.segmentIndex);for(let e=0;e<n.length;e++)for(let o=e+1;o<n.length;o++){const r=n[e],s=n[o];j(r,s)&&(t++,V(r,s,A))}}return t},"fixPipeCrossings");let Z=0;for(;Z<10;){let t=0;if(t+=J(),t+=Q(),t+=U(),0===t)break;Z++}const tt=new Map;for(const t of c){const e=[];t.tracks.forEach(t=>{t.segments.forEach(n=>{e.push({edgeIndex:n.edgeIndex,segmentIndex:n.segmentIndex,trackIndex:t.index,from:n.from,to:n.to})})}),e.sort((t,e)=>t.from-e.from);const n=[];if(e.length>0){let t=[e[0]],o=e[0].to;for(let r=1;r<e.length;r++){const s=e[r];s.from<o?(t.push(s),o=Math.max(o,s.to)):(n.push(t),t=[s],o=s.to)}n.push(t)}for(const e of n){const n=new Set;e.forEach(t=>n.add(t.trackIndex));const o=new Map;e.forEach(t=>{const e=q(t.edgeIndex);o.set(t.trackIndex,(o.get(t.trackIndex)??0)+e.delta)});const r=[...n].filter(t=>(o.get(t)??0)<-1),s=[...n].filter(t=>(o.get(t)??0)>1),a=[...n].filter(t=>Math.abs(o.get(t)??0)<=1);r.sort((t,e)=>(o.get(e)??0)-(o.get(t)??0)),s.sort((t,e)=>(o.get(t)??0)-(o.get(e)??0));const c=(0,i.K)((n,o)=>{e.filter(t=>t.trackIndex===n).forEach(e=>{const n=m.has(e.edgeIndex)?t.coord:o;tt.set(`${e.edgeIndex}-${e.segmentIndex}`,n)})},"assignCoord");let f=0;for(const e of r)f++,c(e,t.coord-10*f);if(0===a.length&&n.size>0){const t=[...n].sort((t,e)=>Math.abs(o.get(t)??0)-Math.abs(o.get(e)??0))[0],e=r.indexOf(t);-1!==e&&r.splice(e,1);const i=s.indexOf(t);-1!==i&&s.splice(i,1),a.push(t)}let d=0;for(const e of a){if(0===d)c(e,t.coord);else{const n=d%2==1?1:-1,o=Math.ceil(d/2);c(e,t.coord+n*o*10*.5)}d++}let l=0;for(const e of s)l++,c(e,t.coord+10*l)}}for(const[t,e]of r.entries()){const n=x[t]??[];if(0===n.length)continue;const o=[],r=s.get(e.start),i=s.get(e.end),{pSrcPort:a,pDstPort:c}=E(t,r,i),f=n.map(t=>{const e=p[t],n=tt.get(`${e.edgeIndex}-${e.segmentIndex}`)??e.pipe.coord;return{orient:e.orientation,coord:n,from:e.from,to:e.to}});o.push(a);for(let t=0;t<f.length;t++){const e=f[t],n=o[o.length-1],r="vertical"===e.orient?n.y:n.x,s="vertical"===e.orient?n.x:n.y,i=f[t+1],a=t<f.length-1;if(Math.abs(s-e.coord)>En&&o.push(Dn(e,r)),a&&i.orient===e.orient)if(Math.abs(e.coord-i.coord)>En){const t="vertical"===e.orient?(r+i.from)/2:Pn(e,i);o.push(Dn(e,t),Dn(i,t))}else 0!==t&&t!==f.length-2||o.push(Dn(e,Pn(e,i)));else if(a)o.push(Dn(e,i.coord));else{const t=Math.abs(e.from-r)<Math.abs(e.to-r)?e.to:e.from;o.push(Dn(e,t))}}const d=o[o.length-1];(Math.abs(d.x-c.x)>En||Math.abs(d.y-c.y)>En)&&o.push(c);const l=[];o.length>0&&l.push(o[0]);for(let t=1;t<o.length;t++){const e=o[t],n=l[l.length-1];(Math.abs(e.x-n.x)>En||Math.abs(e.y-n.y)>En)&&l.push(e)}e.points=l}for(const t of r){const e=t.__originalEdge;e&&t.points&&(e.points=t.points)}t.edges=(t.edges??[]).filter(t=>!t.isLayoutOnly);const et=(0,i.K)((t,e)=>{const n=e.x??0,o=e.y??0,r=e.width??0,s=e.height??0;if(r<=0||s<=0)return t;const i=n-r/2,a=n+r/2,c=o-s/2,f=o+s/2;if(t.x<i||t.x>a||t.y<c||t.y>f)return t;const d=t.x-i,l=a-t.x,u=t.y-c,h=f-t.y,g=Math.min(d,l,u,h);return g===d?{x:i,y:t.y}:g===l?{x:a,y:t.y}:g===u?{x:t.x,y:c}:{x:t.x,y:f}},"nodeBoundaryClamp");for(const e of t.edges){const t=e.points;if(!t||t.length<2)continue;const n=e.start,o=e.end,r=n?s.get(n):void 0,i=o?s.get(o):void 0;r&&(t[0]=et(t[0],r)),i&&(t[t.length-1]=et(t[t.length-1],i))}return t}function Hn(t){return t.direction??"TB"}function jn(t){const e=O(t),n=t.config.flowchart?.nodeSpacing??40,o=t.config.flowchart?.rankSpacing??100,r=t.config.swimlane?.ignoreCrossLaneEdges??!0,s=t.config.swimlane?.optimizeRanksByCrossings??!0,i=t.config.swimlane?.automaticLaneOrdering??!1,a=Hn(t),{ordered:c,coordinates:f}=Fn(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:r,optimizeRanksByCrossings:s,automaticLaneOrdering:i,direction:a});R(e,c,f,{nodeGap:n,layerGap:o});for(const e of t.edges??[])delete e.points;Gn(t,a);for(const e of t.edges??[])e.curve&&"basis"!==e.curve||(e.curve="rounded");return we(t,a),Se(t),a}function Vn(t){k(t);const e=T(t);t.nodes=e.nodes,t.edges=e.edges}(0,i.K)(An,"chooseOrthogonalSide"),(0,i.K)(Pn,"sharedLineEndpointCoord"),(0,i.K)(Dn,"pointOnLine"),(0,i.K)(Gn,"routeEdgesOrthogonal"),(0,i.K)(Hn,"getSwimlaneDirection"),(0,i.K)(jn,"runSwimlaneLayoutCore"),(0,i.K)(Vn,"prepareSwimlaneLayout");var _n=(0,o.xY)({prepareLayout:Vn,runLayoutCore:jn,afterPaint:w})}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[5315],{64918(t,e,n){n.d(e,{o:()=>i});var i=(0,n(86827).K)(()=>"\n /* Font Awesome icon styling - consolidated */\n .label-icon {\n display: inline-block;\n height: 1em;\n overflow: visible;\n vertical-align: -0.125em;\n }\n \n .node .label-icon path {\n fill: currentColor;\n stroke: revert;\n stroke-width: revert;\n }\n","getIconStyles")},35315(t,e,n){n.d(e,{diagram:()=>C});var i=n(5637),s=n(64918),r=n(841),o=n(78771),a=n(717),c=(n(79515),n(44505),n(69793),n(43287),n(12505),n(86535)),l=n(31293),h=n(86827),u=n(5097),g=n(78041),d=n(75263),p=function(){var t=(0,h.K)(function(t,e,n,i){for(n=n||{},i=t.length;i--;n[t[i]]=e);return n},"o"),e=[1,4],n=[1,13],i=[1,12],s=[1,15],r=[1,16],o=[1,20],a=[1,19],c=[6,7,8],l=[1,26],u=[1,24],g=[1,25],d=[6,7,11],p=[1,31],y=[6,7,11,24],f=[1,6,13,16,17,20,23],m=[1,35],b=[1,36],k=[1,6,7,11,13,16,17,20,23],_=[1,38],E={trace:(0,h.K)(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:(0,h.K)(function(t,e,n,i,s,r,o){var a=r.length-1;switch(s){case 6:case 7:return i;case 8:i.getLogger().trace("Stop NL ");break;case 9:i.getLogger().trace("Stop EOF ");break;case 11:i.getLogger().trace("Stop NL2 ");break;case 12:i.getLogger().trace("Stop EOF2 ");break;case 15:i.getLogger().info("Node: ",r[a-1].id),i.addNode(r[a-2].length,r[a-1].id,r[a-1].descr,r[a-1].type,r[a]);break;case 16:i.getLogger().info("Node: ",r[a].id),i.addNode(r[a-1].length,r[a].id,r[a].descr,r[a].type);break;case 17:i.getLogger().trace("Icon: ",r[a]),i.decorateNode({icon:r[a]});break;case 18:case 23:i.decorateNode({class:r[a]});break;case 19:i.getLogger().trace("SPACELIST");break;case 20:i.getLogger().trace("Node: ",r[a-1].id),i.addNode(0,r[a-1].id,r[a-1].descr,r[a-1].type,r[a]);break;case 21:i.getLogger().trace("Node: ",r[a].id),i.addNode(0,r[a].id,r[a].descr,r[a].type);break;case 22:i.decorateNode({icon:r[a]});break;case 27:i.getLogger().trace("node found ..",r[a-2]),this.$={id:r[a-1],descr:r[a-1],type:i.getType(r[a-2],r[a])};break;case 28:this.$={id:r[a],descr:r[a],type:0};break;case 29:i.getLogger().trace("node found ..",r[a-3]),this.$={id:r[a-3],descr:r[a-1],type:i.getType(r[a-2],r[a])};break;case 30:this.$=r[a-1]+r[a];break;case 31:this.$=r[a]}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:e},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:e},{6:n,7:[1,10],9:9,12:11,13:i,14:14,16:s,17:r,18:17,19:18,20:o,23:a},t(c,[2,3]),{1:[2,2]},t(c,[2,4]),t(c,[2,5]),{1:[2,6],6:n,12:21,13:i,14:14,16:s,17:r,18:17,19:18,20:o,23:a},{6:n,9:22,12:11,13:i,14:14,16:s,17:r,18:17,19:18,20:o,23:a},{6:l,7:u,10:23,11:g},t(d,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:o,23:a}),t(d,[2,19]),t(d,[2,21],{15:30,24:p}),t(d,[2,22]),t(d,[2,23]),t(y,[2,25]),t(y,[2,26]),t(y,[2,28],{20:[1,32]}),{21:[1,33]},{6:l,7:u,10:34,11:g},{1:[2,7],6:n,12:21,13:i,14:14,16:s,17:r,18:17,19:18,20:o,23:a},t(f,[2,14],{7:m,11:b}),t(k,[2,8]),t(k,[2,9]),t(k,[2,10]),t(d,[2,16],{15:37,24:p}),t(d,[2,17]),t(d,[2,18]),t(d,[2,20],{24:_}),t(y,[2,31]),{21:[1,39]},{22:[1,40]},t(f,[2,13],{7:m,11:b}),t(k,[2,11]),t(k,[2,12]),t(d,[2,15],{24:_}),t(y,[2,30]),{22:[1,41]},t(y,[2,27]),t(y,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:(0,h.K)(function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},"parseError"),parse:(0,h.K)(function(t){var e=this,n=[0],i=[],s=[null],r=[],o=this.table,a="",c=0,l=0,u=0,g=r.slice.call(arguments,1),d=Object.create(this.lexer),p={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(p.yy[y]=this.yy[y]);d.setInput(t,p.yy),p.yy.lexer=d,p.yy.parser=this,void 0===d.yylloc&&(d.yylloc={});var f=d.yylloc;r.push(f);var m=d.options&&d.options.ranges;function b(){var t;return"number"!=typeof(t=i.pop()||d.lex()||1)&&(t instanceof Array&&(t=(i=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof p.yy.parseError?this.parseError=p.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,(0,h.K)(function(t){n.length=n.length-2*t,s.length=s.length-t,r.length=r.length-t},"popStack"),(0,h.K)(b,"lex");for(var k,_,E,S,N,x,D,L,I,v={};;){if(E=n[n.length-1],this.defaultActions[E]?S=this.defaultActions[E]:(null==k&&(k=b()),S=o[E]&&o[E][k]),void 0===S||!S.length||!S[0]){var C="";for(x in I=[],o[E])this.terminals_[x]&&x>2&&I.push("'"+this.terminals_[x]+"'");C=d.showPosition?"Parse error on line "+(c+1)+":\n"+d.showPosition()+"\nExpecting "+I.join(", ")+", got '"+(this.terminals_[k]||k)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==k?"end of input":"'"+(this.terminals_[k]||k)+"'"),this.parseError(C,{text:d.match,token:this.terminals_[k]||k,line:d.yylineno,loc:f,expected:I})}if(S[0]instanceof Array&&S.length>1)throw new Error("Parse Error: multiple actions possible at state: "+E+", token: "+k);switch(S[0]){case 1:n.push(k),s.push(d.yytext),r.push(d.yylloc),n.push(S[1]),k=null,_?(k=_,_=null):(l=d.yyleng,a=d.yytext,c=d.yylineno,f=d.yylloc,u>0&&u--);break;case 2:if(D=this.productions_[S[1]][1],v.$=s[s.length-D],v._$={first_line:r[r.length-(D||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(D||1)].first_column,last_column:r[r.length-1].last_column},m&&(v._$.range=[r[r.length-(D||1)].range[0],r[r.length-1].range[1]]),void 0!==(N=this.performAction.apply(v,[a,l,c,p.yy,S[1],s,r].concat(g))))return N;D&&(n=n.slice(0,-1*D*2),s=s.slice(0,-1*D),r=r.slice(0,-1*D)),n.push(this.productions_[S[1]][0]),s.push(v.$),r.push(v._$),L=o[n[n.length-2]][n[n.length-1]],n.push(L);break;case 3:return!0}}return!0},"parse")},S=function(){return{EOF:1,parseError:(0,h.K)(function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},"parseError"),setInput:(0,h.K)(function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:(0,h.K)(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:(0,h.K)(function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var i=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var s=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===i.length?this.yylloc.first_column:0)+i[i.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[s[0],s[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},"unput"),more:(0,h.K)(function(){return this._more=!0,this},"more"),reject:(0,h.K)(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:(0,h.K)(function(t){this.unput(this.match.slice(t))},"less"),pastInput:(0,h.K)(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:(0,h.K)(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:(0,h.K)(function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},"showPosition"),test_match:(0,h.K)(function(t,e){var n,i,s;if(this.options.backtrack_lexer&&(s={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(s.yylloc.range=this.yylloc.range.slice(0))),(i=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var r in s)this[r]=s[r];return!1}return!1},"test_match"),next:(0,h.K)(function(){if(this.done)return this.EOF;var t,e,n,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var s=this._currentRules(),r=0;r<s.length;r++)if((n=this._input.match(this.rules[s[r]]))&&(!e||n[0].length>e[0].length)){if(e=n,i=r,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,s[r])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,s[i]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:(0,h.K)(function(){var t=this.next();return t||this.lex()},"lex"),begin:(0,h.K)(function(t){this.conditionStack.push(t)},"begin"),popState:(0,h.K)(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:(0,h.K)(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:(0,h.K)(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:(0,h.K)(function(t){this.begin(t)},"pushState"),stateStackSize:(0,h.K)(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:(0,h.K)(function(t,e,n,i){switch(n){case 0:return this.pushState("shapeData"),e.yytext="",24;case 1:return this.pushState("shapeDataStr"),24;case 2:return this.popState(),24;case 3:const n=/\n\s*/g;return e.yytext=e.yytext.replace(n,"<br/>"),24;case 4:return 24;case 5:case 10:case 29:case 32:this.popState();break;case 6:return t.getLogger().trace("Found comment",e.yytext),6;case 7:return 8;case 8:this.begin("CLASS");break;case 9:return this.popState(),17;case 11:t.getLogger().trace("Begin icon"),this.begin("ICON");break;case 12:return t.getLogger().trace("SPACELINE"),6;case 13:return 7;case 14:return 16;case 15:t.getLogger().trace("end icon"),this.popState();break;case 16:return t.getLogger().trace("Exploding node"),this.begin("NODE"),20;case 17:return t.getLogger().trace("Cloud"),this.begin("NODE"),20;case 18:return t.getLogger().trace("Explosion Bang"),this.begin("NODE"),20;case 19:return t.getLogger().trace("Cloud Bang"),this.begin("NODE"),20;case 20:case 21:case 22:case 23:return this.begin("NODE"),20;case 24:return 13;case 25:return 23;case 26:return 11;case 27:this.begin("NSTR2");break;case 28:return"NODE_DESCR";case 30:t.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 31:return t.getLogger().trace("description:",e.yytext),"NODE_DESCR";case 33:return this.popState(),t.getLogger().trace("node end ))"),"NODE_DEND";case 34:return this.popState(),t.getLogger().trace("node end )"),"NODE_DEND";case 35:return this.popState(),t.getLogger().trace("node end ...",e.yytext),"NODE_DEND";case 36:case 39:case 40:return this.popState(),t.getLogger().trace("node end (("),"NODE_DEND";case 37:case 38:return this.popState(),t.getLogger().trace("node end (-"),"NODE_DEND";case 41:case 42:return t.getLogger().trace("Long description:",e.yytext),21}},"anonymous"),rules:[/^(?:@\{)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^\"]+)/i,/^(?:[^}^"]+)/i,/^(?:\})/i,/^(?:\s*%%.*)/i,/^(?:kanban\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}@]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{shapeDataEndBracket:{rules:[],inclusive:!1},shapeDataStr:{rules:[2,3],inclusive:!1},shapeData:{rules:[1,4,5],inclusive:!1},CLASS:{rules:[9,10],inclusive:!1},ICON:{rules:[14,15],inclusive:!1},NSTR2:{rules:[28,29],inclusive:!1},NSTR:{rules:[31,32],inclusive:!1},NODE:{rules:[27,30,33,34,35,36,37,38,39,40,41,42],inclusive:!1},INITIAL:{rules:[0,6,7,8,11,12,13,16,17,18,19,20,21,22,23,24,25,26],inclusive:!0}}}}();function N(){this.yy={}}return E.lexer=S,(0,h.K)(N,"Parser"),N.prototype=E,E.Parser=N,new N}();p.parser=p;var y=p,f=[],m=[],b=0,k={},_=(0,h.K)(()=>{f=[],m=[],b=0,k={}},"clear"),E=(0,h.K)(t=>{if(0===f.length)return null;const e=f[0].level;let n=null;for(let t=f.length-1;t>=0;t--)if(f[t].level!==e||n||(n=f[t]),f[t].level<e)throw new Error('Items without section detected, found section ("'+f[t].label+'")');return t===n?.level?null:n},"getSection"),S=(0,h.K)(function(){return m},"getSections"),N=(0,h.K)(function(){const t=[],e=S(),n=(0,c.D7)();for(const i of e){const e={id:i.id,label:(0,c.jZ)(i.label??"",n),labelType:"markdown",isGroup:!0,ticket:i.ticket,shape:"kanbanSection",level:i.level,look:n.look};t.push(e);const s=f.filter(t=>t.parentId===i.id);for(const e of s){const s={id:e.id,parentId:i.id,label:(0,c.jZ)(e.label??"",n),labelType:"markdown",isGroup:!1,ticket:e?.ticket,priority:e?.priority,assigned:e?.assigned,icon:e?.icon,shape:"kanbanItem",level:e.level,rx:5,ry:5,cssStyles:["text-align: left"]};t.push(s)}}return{nodes:t,edges:[],other:{},config:(0,c.D7)()}},"getData"),x=(0,h.K)((t,e,n,i,s)=>{const o=(0,c.D7)();let a=o.mindmap?.padding??c.UI.mindmap.padding;switch(i){case D.ROUNDED_RECT:case D.RECT:case D.HEXAGON:a*=2}const l={id:(0,c.jZ)(e,o)||"kbn"+b++,level:t,label:(0,c.jZ)(n,o),width:o.mindmap?.maxNodeWidth??c.UI.mindmap.maxNodeWidth,padding:a,isGroup:!1};if(void 0!==s){let t;t=s.includes("\n")?s+"\n":"{\n"+s+"\n}";const e=(0,r.H)(t,{schema:r.r});if(e.shape&&(e.shape!==e.shape.toLowerCase()||e.shape.includes("_")))throw new Error(`No such shape: ${e.shape}. Shape names should be lowercase.`);e?.shape&&"kanbanItem"===e.shape&&(l.shape=e?.shape),e?.label&&(l.label=e?.label),e?.icon&&(l.icon=e?.icon.toString()),e?.assigned&&(l.assigned=e?.assigned.toString()),e?.ticket&&(l.ticket=e?.ticket.toString()),e?.priority&&(l.priority=e?.priority)}const h=E(t);h?l.parentId=h.id||"kbn"+b++:m.push(l),f.push(l)},"addNode"),D={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},L={clear:_,addNode:x,getSections:S,getData:N,nodeType:D,getType:(0,h.K)((t,e)=>{switch(l.R.debug("In get type",t,e),t){case"[":return D.RECT;case"(":return")"===e?D.ROUNDED_RECT:D.CLOUD;case"((":return D.CIRCLE;case")":return D.CLOUD;case"))":return D.BANG;case"{{":return D.HEXAGON;default:return D.DEFAULT}},"getType"),setElementForId:(0,h.K)((t,e)=>{k[t]=e},"setElementForId"),decorateNode:(0,h.K)(t=>{if(!t)return;const e=(0,c.D7)(),n=f[f.length-1];t.icon&&(n.icon=(0,c.jZ)(t.icon,e)),t.class&&(n.cssClasses=(0,c.jZ)(t.class,e))},"decorateNode"),type2Str:(0,h.K)(t=>{switch(t){case D.DEFAULT:return"no-border";case D.RECT:return"rect";case D.ROUNDED_RECT:return"rounded-rect";case D.CIRCLE:return"circle";case D.CLOUD:return"cloud";case D.BANG:return"bang";case D.HEXAGON:return"hexgon";default:return"no-border"}},"type2Str"),getLogger:(0,h.K)(()=>l.R,"getLogger"),getElementById:(0,h.K)(t=>k[t],"getElementById")},I={draw:(0,h.K)(async(t,e,n,s)=>{l.R.debug("Rendering kanban diagram\n"+t);const r=s.db.getData(),h=(0,c.D7)();h.htmlLabels=!1;const u=(0,i.D)(e);for(const t of r.nodes)t.domId=`${e}-${t.id}`;const g=u.append("g");g.attr("class","sections");const d=u.append("g");d.attr("class","items");const p=r.nodes.filter(t=>t.isGroup);let y=0;const f=[];let m=25;for(const t of p){const e=h?.kanban?.sectionWidth||200;y+=1,t.x=e*y+10*(y-1)/2,t.width=e,t.y=0,t.height=3*e,t.rx=5,t.ry=5,t.cssClasses=t.cssClasses+" section-"+y;const n=await(0,o.U)(g,t);m=Math.max(m,n?.labelBBox?.height),f.push(n)}let b=0;for(const t of p){const e=f[b];b+=1;const n=h?.kanban?.sectionWidth||200,i=3*-n/2+m;let s=i;const o=r.nodes.filter(e=>e.parentId===t.id);for(const e of o){if(e.isGroup)throw new Error("Groups within groups are not allowed in Kanban diagrams");e.x=t.x,e.width=n-15;const i=(await(0,a.on)(d,e,{config:h})).node().getBBox();e.y=s+i.height/2,await(0,a.U_)(e),s=e.y+i.height/2+5}const c=e.cluster.select("rect"),l=Math.max(s-i+30,50)+(m-25);c.attr("height",l)}(0,c.ot)(void 0,u,h.mindmap?.padding??c.UI.kanban.padding,h.mindmap?.useMaxWidth??c.UI.kanban.useMaxWidth)},"draw")},v=(0,h.K)(t=>{let e="";for(let e=0;e<t.THEME_COLOR_LIMIT;e++)t["lineColor"+e]=t["lineColor"+e]||t["cScaleInv"+e],(0,u.A)(t["lineColor"+e])?t["lineColor"+e]=(0,g.A)(t["lineColor"+e],20):t["lineColor"+e]=(0,d.A)(t["lineColor"+e],20);const n=(0,h.K)((e,n)=>t.darkMode?(0,d.A)(e,n):(0,g.A)(e,n),"adjuster");for(let i=0;i<t.THEME_COLOR_LIMIT;i++){const s=""+(17-3*i);e+=`\n .section-${i-1} rect, .section-${i-1} path, .section-${i-1} circle, .section-${i-1} polygon, .section-${i-1} path {\n fill: ${n(t["cScale"+i],10)};\n stroke: ${n(t["cScale"+i],10)};\n\n }\n .section-${i-1} text {\n fill: ${t["cScaleLabel"+i]};\n }\n .node-icon-${i-1} {\n font-size: 40px;\n color: ${t["cScaleLabel"+i]};\n }\n .section-edge-${i-1}{\n stroke: ${t["cScale"+i]};\n }\n .edge-depth-${i-1}{\n stroke-width: ${s};\n }\n .section-${i-1} line {\n stroke: ${t["cScaleInv"+i]} ;\n stroke-width: 3;\n }\n\n .disabled, .disabled circle, .disabled text {\n fill: lightgray;\n }\n .disabled text {\n fill: #efefef;\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ${t.background};\n stroke: ${t.nodeBorder};\n stroke-width: 1px;\n }\n\n .kanban-ticket-link {\n fill: ${t.background};\n stroke: ${t.nodeBorder};\n text-decoration: underline;\n }\n `}return e},"genSections"),C={db:L,renderer:I,parser:y,styles:(0,h.K)(t=>`\n .edge {\n stroke-width: 3;\n }\n ${v(t)}\n .section-root rect, .section-root path, .section-root circle, .section-root polygon {\n fill: ${t.git0};\n }\n .section-root text {\n fill: ${t.gitBranchLabel0};\n }\n .icon-container {\n height:100%;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .edge {\n fill: none;\n }\n .cluster-label, .label {\n color: ${t.textColor};\n fill: ${t.textColor};\n }\n .kanban-label {\n dy: 1em;\n alignment-baseline: middle;\n text-anchor: middle;\n dominant-baseline: middle;\n text-align: center;\n }\n ${(0,s.o)()}\n`,"getStyles")}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[5332],{75332(e,r,t){t.d(r,{diagram:()=>i});var a=t(74806),s=(t(96755),t(1672),t(9417),t(338),t(78771),t(46853),t(717),t(79515),t(44505),t(69793),t(43287),t(12505),t(86535),t(31293),t(86827)),i={parser:a.Zk,get db(){return new a.u4(2)},renderer:a.q7,styles:a.tM,init:(0,s.K)(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6459],{66459(e,t,n){n.d(t,{diagram:()=>r});var a=n(96506),l=(n(64918),n(96755),n(1672),n(841),n(9417),n(338),n(78771),n(46853),n(717),n(79515),n(44505),n(69793),n(43287),n(12505),n(86535),n(31293),(0,n(86827).K)(e=>`${(0,a.tM)(e)}\n .swimlane.cluster rect {\n stroke: ${e.clusterBorder} !important;\n }\n [data-look="neo"].cluster rect {\n filter: none;\n }\n`,"getStyles")),r=(0,a.ur)({defaultLayout:"swimlane",styles:l})}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6488],{16488(a,e,c){c.d(e,{diagram:()=>s.AC});var s=c(96506);c(64918),c(96755),c(1672),c(841),c(9417),c(338),c(78771),c(46853),c(717),c(79515),c(44505),c(69793),c(43287),c(12505),c(86535),c(31293),c(86827)}}]);