@layers-app/editor 0.3.11 → 0.4.0

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 (242) hide show
  1. package/dist/index.cjs +2 -2
  2. package/dist/index.js +6 -6
  3. package/dist/layers.-WGsbPEO.js +14 -0
  4. package/dist/layers.-wDyU9sN.js +118 -0
  5. package/dist/layers.0FtwCmdk.js +52 -0
  6. package/dist/layers.0RkUYii1.js +282 -0
  7. package/dist/layers.1EHoXd8e.js +8 -0
  8. package/dist/layers.2cerO4OS.js +139 -0
  9. package/dist/layers.3Ekf-o8F.js +39 -0
  10. package/dist/layers.52famHy6.js +1 -0
  11. package/dist/layers.5Sr9IY96.js +9 -0
  12. package/dist/layers.78ekkCq0.js +116 -0
  13. package/dist/layers.7JqFgE4-.js +15 -0
  14. package/dist/layers.9QK1wiQj.js +1 -0
  15. package/dist/layers.9jdDI2yV.js +36 -0
  16. package/dist/layers.9pNaFvaX.js +1 -0
  17. package/dist/layers.AEy2G-Gv.js +40 -0
  18. package/dist/layers.AIQle8wy.js +1 -0
  19. package/dist/layers.A_NuFq0j.js +2235 -0
  20. package/dist/layers.B0lp7rOz.js +9 -0
  21. package/dist/layers.B19hGmey.js +1 -0
  22. package/dist/layers.B1VZZIP7.js +21763 -0
  23. package/dist/layers.B2AGu32C.js +11692 -0
  24. package/dist/layers.B3CuqfYy.js +37 -0
  25. package/dist/layers.B3D4g2HH.js +1 -0
  26. package/dist/layers.B3xfUipV.js +2966 -0
  27. package/dist/layers.B4n4WelM.js +1 -0
  28. package/dist/layers.B4qkzU1u.js +41 -0
  29. package/dist/layers.B5bQ8hRv.js +70 -0
  30. package/dist/layers.B6YfcxJD.js +1 -0
  31. package/dist/layers.B7O9Ykf9.js +6 -0
  32. package/dist/layers.BAtv1CM7.js +1 -0
  33. package/dist/layers.BBXYbcFN.js +10 -0
  34. package/dist/layers.BBZL6QaK.js +8 -0
  35. package/dist/layers.BCbGsxxm.js +7 -0
  36. package/dist/layers.BE_DKuuD.js +790 -0
  37. package/dist/layers.BFlWA9Iz.js +373 -0
  38. package/dist/layers.BFxRJ3Li.js +1 -0
  39. package/dist/layers.BIeVwYKL.js +1 -0
  40. package/dist/layers.BLQfYqXT.js +39 -0
  41. package/dist/layers.BM0ksLnS.js +5 -0
  42. package/dist/layers.BNUbfOwd.js +42 -0
  43. package/dist/layers.BP3xLRrX.js +33 -0
  44. package/dist/layers.BQFScIff.js +9 -0
  45. package/dist/layers.BRu1ZkhL.js +6 -0
  46. package/dist/layers.BS1BSw0O.js +257 -0
  47. package/dist/layers.BSTBZrFn.js +1 -0
  48. package/dist/layers.BU5FG1HP.js +84 -0
  49. package/dist/layers.BUuBI6QS.js +41 -0
  50. package/dist/layers.BVrcjbG3.js +8 -0
  51. package/dist/layers.BW99L8Fl.js +39 -0
  52. package/dist/layers.BWj5iNQV.js +34 -0
  53. package/dist/layers.BYRpGhl3.js +11 -0
  54. package/dist/layers.BZ217a7U.js +40 -0
  55. package/dist/layers.Bb0NXUFw.js +39 -0
  56. package/dist/layers.BbCfEXyj.js +55 -0
  57. package/dist/layers.BblO5S7z.js +5 -0
  58. package/dist/layers.BbpcdAWy.js +1 -0
  59. package/dist/layers.Bfw0Gunv.js +9148 -0
  60. package/dist/layers.BgOa2ZQq.js +7 -0
  61. package/dist/layers.Bh0aB-u7.js +59 -0
  62. package/dist/layers.BiCOjicn.js +32 -0
  63. package/dist/layers.BiJ8hfRt.js +1510 -0
  64. package/dist/layers.BirPY36J.js +268 -0
  65. package/dist/layers.Bit9KYIY.js +32 -0
  66. package/dist/layers.BjFHkSyo.js +37 -0
  67. package/dist/{layers.DPccTctI.js → layers.BkQdsQ8U.js} +17 -17
  68. package/dist/layers.BkrI3eMq.js +1089 -0
  69. package/dist/layers.BlPVzVNM.js +6 -0
  70. package/dist/layers.Bn7Yja2i.js +3 -0
  71. package/dist/layers.Bnu-owJj.js +61 -0
  72. package/dist/{layers.C125HTat.js → layers.BoIttUlh.js} +1 -1
  73. package/dist/layers.Bp_lUbdE.js +41 -0
  74. package/dist/layers.BpilXLfW.js +6 -0
  75. package/dist/layers.Bs7-WFjs.js +1283 -0
  76. package/dist/layers.BzRvQtZ0.js +11 -0
  77. package/dist/layers.C00LPdpd.js +437 -0
  78. package/dist/layers.C0q8oCjN.js +1034 -0
  79. package/dist/layers.C1iEaL9k.js +37 -0
  80. package/dist/layers.C1w3XBPW.js +230 -0
  81. package/dist/layers.C4ROEdAW.js +84 -0
  82. package/dist/layers.C4qaO0MD.js +10 -0
  83. package/dist/layers.C7lIplJU.js +247 -0
  84. package/dist/layers.C8_lu5UH.js +23 -0
  85. package/dist/layers.C996Xek1.js +2479 -0
  86. package/dist/layers.CAcpgnDk.js +9 -0
  87. package/dist/layers.CAwBq0yQ.js +10 -0
  88. package/dist/layers.CEmVEjbM.js +7 -0
  89. package/dist/layers.CFa6SgS0.js +38 -0
  90. package/dist/layers.CHZsXQcr.js +1 -0
  91. package/dist/layers.CHuQjPi1.js +32 -0
  92. package/dist/layers.CJBYVYBK.js +8 -0
  93. package/dist/layers.CLOKCltZ.js +35 -0
  94. package/dist/layers.COAF7f8g.js +1 -0
  95. package/dist/layers.COaiyaHl.js +1580 -0
  96. package/dist/layers.COhnMbFE.js +220 -0
  97. package/dist/layers.CQqtbI-S.js +122 -0
  98. package/dist/layers.CRWsKrSv.js +40 -0
  99. package/dist/layers.CSW2aYxs.js +1 -0
  100. package/dist/layers.CSfCebqe.js +207 -0
  101. package/dist/layers.CTzpQJrz.js +501 -0
  102. package/dist/layers.CX9eMlzX.js +6 -0
  103. package/dist/layers.CXUGZO8g.js +40 -0
  104. package/dist/layers.CYHkquLL.js +1 -0
  105. package/dist/layers.CYJyjqCg.js +7 -0
  106. package/dist/layers.C_0uL0lu.js +42 -0
  107. package/dist/layers.CbseH42B.js +5 -0
  108. package/dist/layers.CdvbuuVd.js +2 -0
  109. package/dist/layers.CeU6SAcT.js +8 -0
  110. package/dist/layers.Cef-VRJs.js +37 -0
  111. package/dist/layers.Cg3zhLTz.js +1 -0
  112. package/dist/layers.CldWERA-.js +1 -0
  113. package/dist/layers.Cle37JNX.js +1 -0
  114. package/dist/layers.CmLupkS6.js +186 -0
  115. package/dist/layers.Cn2QpKZw.js +51 -0
  116. package/dist/layers.CoVavTdv.js +1126 -0
  117. package/dist/layers.CoZpR7_r.js +40 -0
  118. package/dist/layers.CqVTtuYm.js +6 -0
  119. package/dist/layers.CrZ6TV4m.js +1 -0
  120. package/dist/layers.CrpDpBIW.js +904 -0
  121. package/dist/layers.Cs24L6er.js +261 -0
  122. package/dist/layers.CsmOgd93.js +38 -0
  123. package/dist/layers.Ct-zQnmI.js +32 -0
  124. package/dist/layers.CuAZJoX1.js +42 -0
  125. package/dist/{layers.BnjxHNDK.js → layers.CylfN5iO.js} +85 -85
  126. package/dist/layers.CyxAbBDV.js +7 -0
  127. package/dist/layers.Czj3PJzZ.js +10 -0
  128. package/dist/layers.D-1CXIBI.js +19 -0
  129. package/dist/layers.D-EQ5B97.js +7 -0
  130. package/dist/layers.D-uwIUCE.js +139 -0
  131. package/dist/layers.D-xK8h4X.js +8 -0
  132. package/dist/layers.D0rE1hbF.js +10 -0
  133. package/dist/layers.D0zn4_Mx.js +1 -0
  134. package/dist/layers.D2Jbdqtj.js +7 -0
  135. package/dist/layers.D3Qwcfa_.js +1619 -0
  136. package/dist/layers.D3sICpwv.js +8 -0
  137. package/dist/layers.D4DB55K_.js +2 -0
  138. package/dist/layers.D4RhFsg6.js +10 -0
  139. package/dist/layers.D4fGb2cV.js +1272 -0
  140. package/dist/layers.D4v0XyUf.js +1 -0
  141. package/dist/layers.D6SbX5Az.js +423 -0
  142. package/dist/layers.D6dwFhht.js +9 -0
  143. package/dist/layers.D7jGxypv.js +8 -0
  144. package/dist/layers.D87gRG-J.js +1088 -0
  145. package/dist/layers.D8fb1iDb.js +10 -0
  146. package/dist/layers.D9JK3npg.js +41 -0
  147. package/dist/layers.DAvEslJc.js +33 -0
  148. package/dist/layers.DBOFmWi_.js +1359 -0
  149. package/dist/layers.DCAo6G5D.js +40 -0
  150. package/dist/layers.DGWfd9sT.js +5 -0
  151. package/dist/layers.DIc9Pn5-.js +96 -0
  152. package/dist/layers.DJVg69Yo.js +803 -0
  153. package/dist/layers.DLBD3WBx.js +11 -0
  154. package/dist/layers.DLwuMfdd.js +84 -0
  155. package/dist/layers.DMkBISW1.js +1 -0
  156. package/dist/layers.DN9HoVxI.js +18 -0
  157. package/dist/layers.DOrgOHBr.js +1 -0
  158. package/dist/layers.DPhgksD-.js +41 -0
  159. package/dist/layers.DPnpGXQm.js +2 -0
  160. package/dist/layers.DQ8aCG7v.js +769 -0
  161. package/dist/layers.DR14S1m9.js +161 -0
  162. package/dist/layers.DRFq8PR7.js +39 -0
  163. package/dist/layers.DRYGpdtc.js +48146 -0
  164. package/dist/layers.DSd23vw_.js +1 -0
  165. package/dist/layers.DSl3dgu7.js +7 -0
  166. package/dist/layers.DUYA7tE_.js +10 -0
  167. package/dist/layers.DVgohoWC.js +11 -0
  168. package/dist/layers.D_3fuwmS.js +1 -0
  169. package/dist/layers.D_ILz54C.js +41 -0
  170. package/dist/layers.DbaKVP5e.js +1 -0
  171. package/dist/layers.Dd-Mdjt8.js +40 -0
  172. package/dist/layers.Dd9WE-Kq.js +1265 -0
  173. package/dist/layers.DdjaY7yq.js +9 -0
  174. package/dist/layers.DgJemaOm.js +65 -0
  175. package/dist/layers.Dgm8-XFN.js +960 -0
  176. package/dist/layers.DgwJ1eL7.js +13 -0
  177. package/dist/layers.DhZsCIrr.js +425 -0
  178. package/dist/layers.DipbuRcs.js +36 -0
  179. package/dist/layers.DjUOC4st.js +16 -0
  180. package/dist/layers.DjZdvQQY.js +1 -0
  181. package/dist/layers.DkyFv1Ys.js +35 -0
  182. package/dist/layers.Dmf-FkA-.js +4 -0
  183. package/dist/layers.DmgkuDwj.js +9 -0
  184. package/dist/layers.Dmrtdk6A.js +1 -0
  185. package/dist/layers.Dn02LanZ.js +931 -0
  186. package/dist/layers.Do3LJDis.js +202 -0
  187. package/dist/layers.DoI-3ssc.js +802 -0
  188. package/dist/layers.DobBKdZ6.js +32 -0
  189. package/dist/layers.DpzPbocR.js +39 -0
  190. package/dist/layers.Dq0wRjbC.js +35 -0
  191. package/dist/layers.Dqsk7GNe.js +10 -0
  192. package/dist/layers.DrTVlGxj.js +1 -0
  193. package/dist/layers.DukBaqf8.js +1 -0
  194. package/dist/layers.DvxaikrZ.js +10 -0
  195. package/dist/layers.DxA6ocdw.js +70 -0
  196. package/dist/layers.Dy1naDTQ.js +14 -0
  197. package/dist/layers.DygycO7X.js +39 -0
  198. package/dist/{layers.VK3NB7Nd.js → layers.DzUJmmvD.js} +1 -1
  199. package/dist/layers.FoT1zSFE.js +42 -0
  200. package/dist/layers.HsplLW7l.js +4 -0
  201. package/dist/{layers.YZkXZvVS.js → layers.HstOwREP.js} +11432 -10897
  202. package/dist/layers.IKdQaUN6.js +11 -0
  203. package/dist/layers.JWCLFILJ.js +1 -0
  204. package/dist/layers.K3yYYJdK.js +40 -0
  205. package/dist/layers.L1UaldnR.js +36 -0
  206. package/dist/layers.Lz059Um8.js +41 -0
  207. package/dist/layers.M6o7NygO.js +6 -0
  208. package/dist/layers.MLq12lxF.js +32 -0
  209. package/dist/layers.MczyPMMk.js +6 -0
  210. package/dist/layers.OGhIzIND.js +36 -0
  211. package/dist/layers.OH8pkzdf.js +1 -0
  212. package/dist/layers.OUHm0dZY.js +40 -0
  213. package/dist/layers.OeuRpLZr.js +41 -0
  214. package/dist/layers.PsWF_Poj.js +8 -0
  215. package/dist/layers.R7Qt9hQa.js +1 -0
  216. package/dist/layers.SwZPMavM.js +7 -0
  217. package/dist/layers.UHZ7LEG5.js +44 -0
  218. package/dist/layers.VAQxBGRz.js +42 -0
  219. package/dist/layers.WPo01EJ5.js +4 -0
  220. package/dist/layers.XJChT8Le.js +9 -0
  221. package/dist/layers.XMeRR-JR.js +39 -0
  222. package/dist/layers.b0h5ZBmD.js +61 -0
  223. package/dist/layers.bSw_jQ5U.js +40 -0
  224. package/dist/layers.bn1dbtN4.js +160 -0
  225. package/dist/layers.cdGjFrMq.js +9 -0
  226. package/dist/layers.cu7eSI3X.js +4 -0
  227. package/dist/layers.iBT5g_cH.js +320 -0
  228. package/dist/layers.igIdIxGe.js +9 -0
  229. package/dist/layers.j1hLqMc8.js +38 -0
  230. package/dist/layers.jrSryxFl.js +39 -0
  231. package/dist/layers.lCpg7dOn.js +21 -0
  232. package/dist/layers.oQqeIYLp.js +21938 -0
  233. package/dist/layers.raic7pCl.js +793 -0
  234. package/dist/layers.srlypw1l.js +8 -0
  235. package/dist/layers.tqtFgs0l.js +1 -0
  236. package/dist/layers.uwhbxtz3.js +8 -0
  237. package/dist/layers.weZ4wJXB.js +5 -0
  238. package/dist/layers.wf8u33re.js +1 -0
  239. package/package.json +22 -15
  240. package/dist/layers.Cjs5EBWM.js +0 -343
  241. package/dist/layers.DZ8DrrVn.js +0 -53491
  242. package/dist/layers.QVaGPbs3.js +0 -161
@@ -0,0 +1 @@
1
+ "use strict";const ae=require("lodash-es"),w=require("./layers.9QK1wiQj.js");function te(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:()=>e[r]})}}return n.default=e,Object.freeze(n)}const o=te(ae);class oe{constructor(){var n={};n._next=n._prev=n,this._sentinel=n}dequeue(){var n=this._sentinel,r=n._prev;if(r!==n)return P(r),r}enqueue(n){var r=this._sentinel;n._prev&&n._next&&P(n),n._next=r._next,r._next._prev=n,r._next=n,n._prev=r}toString(){for(var n=[],r=this._sentinel,a=r._prev;a!==r;)n.push(JSON.stringify(a,ie)),a=a._prev;return"["+n.join(", ")+"]"}}function P(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function ie(e,n){if(e!=="_next"&&e!=="_prev")return n}var fe=o.constant(1);function ue(e,n){if(e.nodeCount()<=1)return[];var r=ce(e,n||fe),a=de(r.graph,r.buckets,r.zeroIdx);return o.flatten(o.map(a,function(t){return e.outEdges(t.v,t.w)}))}function de(e,n,r){for(var a=[],t=n[n.length-1],f=n[0],i;e.nodeCount();){for(;i=f.dequeue();)y(e,n,r,i);for(;i=t.dequeue();)y(e,n,r,i);if(e.nodeCount()){for(var u=n.length-2;u>0;--u)if(i=n[u].dequeue(),i){a=a.concat(y(e,n,r,i,!0));break}}}return a}function y(e,n,r,a,t){var f=t?[]:void 0;return o.forEach(e.inEdges(a.v),function(i){var u=e.edge(i),d=e.node(i.v);t&&f.push({v:i.v,w:i.w}),d.out-=u,R(n,r,d)}),o.forEach(e.outEdges(a.v),function(i){var u=e.edge(i),d=i.w,c=e.node(d);c.in-=u,R(n,r,c)}),e.removeNode(a.v),f}function ce(e,n){var r=new w.Graph,a=0,t=0;o.forEach(e.nodes(),function(u){r.setNode(u,{v:u,in:0,out:0})}),o.forEach(e.edges(),function(u){var d=r.edge(u.v,u.w)||0,c=n(u),s=d+c;r.setEdge(u.v,u.w,s),t=Math.max(t,r.node(u.v).out+=c),a=Math.max(a,r.node(u.w).in+=c)});var f=o.range(t+a+3).map(function(){return new oe}),i=a+1;return o.forEach(r.nodes(),function(u){R(f,i,r.node(u))}),{graph:r,buckets:f,zeroIdx:i}}function R(e,n,r){r.out?r.in?e[r.out-r.in+n].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}function se(e){var n=e.graph().acyclicer==="greedy"?ue(e,r(e)):he(e);o.forEach(n,function(a){var t=e.edge(a);e.removeEdge(a),t.forwardName=a.name,t.reversed=!0,e.setEdge(a.w,a.v,t,o.uniqueId("rev"))});function r(a){return function(t){return a.edge(t).weight}}}function he(e){var n=[],r={},a={};function t(f){o.has(a,f)||(a[f]=!0,r[f]=!0,o.forEach(e.outEdges(f),function(i){o.has(r,i.w)?n.push(i):t(i.w)}),delete r[f])}return o.forEach(e.nodes(),t),n}function le(e){o.forEach(e.edges(),function(n){var r=e.edge(n);if(r.reversed){e.removeEdge(n);var a=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(n.w,n.v,r,a)}})}function b(e,n,r,a){var t;do t=o.uniqueId(a);while(e.hasNode(t));return r.dummy=n,e.setNode(t,r),t}function ve(e){var n=new w.Graph().setGraph(e.graph());return o.forEach(e.nodes(),function(r){n.setNode(r,e.node(r))}),o.forEach(e.edges(),function(r){var a=n.edge(r.v,r.w)||{weight:0,minlen:1},t=e.edge(r);n.setEdge(r.v,r.w,{weight:a.weight+t.weight,minlen:Math.max(a.minlen,t.minlen)})}),n}function q(e){var n=new w.Graph({multigraph:e.isMultigraph()}).setGraph(e.graph());return o.forEach(e.nodes(),function(r){e.children(r).length||n.setNode(r,e.node(r))}),o.forEach(e.edges(),function(r){n.setEdge(r,e.edge(r))}),n}function O(e,n){var r=e.x,a=e.y,t=n.x-r,f=n.y-a,i=e.width/2,u=e.height/2;if(!t&&!f)throw new Error("Not possible to find intersection inside of the rectangle");var d,c;return Math.abs(f)*i>Math.abs(t)*u?(f<0&&(u=-u),d=u*t/f,c=u):(t<0&&(i=-i),d=i,c=i*f/t),{x:r+d,y:a+c}}function x(e){var n=o.map(o.range(U(e)+1),function(){return[]});return o.forEach(e.nodes(),function(r){var a=e.node(r),t=a.rank;o.isUndefined(t)||(n[t][a.order]=r)}),n}function pe(e){var n=o.min(o.map(e.nodes(),function(r){return e.node(r).rank}));o.forEach(e.nodes(),function(r){var a=e.node(r);o.has(a,"rank")&&(a.rank-=n)})}function me(e){var n=o.min(o.map(e.nodes(),function(f){return e.node(f).rank})),r=[];o.forEach(e.nodes(),function(f){var i=e.node(f).rank-n;r[i]||(r[i]=[]),r[i].push(f)});var a=0,t=e.graph().nodeRankFactor;o.forEach(r,function(f,i){o.isUndefined(f)&&i%t!==0?--a:a&&o.forEach(f,function(u){e.node(u).rank+=a})})}function V(e,n,r,a){var t={width:0,height:0};return arguments.length>=4&&(t.rank=r,t.order=a),b(e,"border",t,n)}function U(e){return o.max(o.map(e.nodes(),function(n){var r=e.node(n).rank;if(!o.isUndefined(r))return r}))}function we(e,n){var r={lhs:[],rhs:[]};return o.forEach(e,function(a){n(a)?r.lhs.push(a):r.rhs.push(a)}),r}function Ee(e,n){return n()}function be(e){function n(r){var a=e.children(r),t=e.node(r);if(a.length&&o.forEach(a,n),o.has(t,"minRank")){t.borderLeft=[],t.borderRight=[];for(var f=t.minRank,i=t.maxRank+1;f<i;++f)B(e,"borderLeft","_bl",r,t,f),B(e,"borderRight","_br",r,t,f)}}o.forEach(e.children(),n)}function B(e,n,r,a,t,f){var i={width:0,height:0,rank:f,borderType:n},u=t[n][f-1],d=b(e,"border",i,r);t[n][f]=d,e.setParent(d,a),u&&e.setEdge(u,d,{weight:1})}function ge(e){var n=e.graph().rankdir.toLowerCase();(n==="lr"||n==="rl")&&W(e)}function ke(e){var n=e.graph().rankdir.toLowerCase();(n==="bt"||n==="rl")&&xe(e),(n==="lr"||n==="rl")&&(ye(e),W(e))}function W(e){o.forEach(e.nodes(),function(n){F(e.node(n))}),o.forEach(e.edges(),function(n){F(e.edge(n))})}function F(e){var n=e.width;e.width=e.height,e.height=n}function xe(e){o.forEach(e.nodes(),function(n){N(e.node(n))}),o.forEach(e.edges(),function(n){var r=e.edge(n);o.forEach(r.points,N),o.has(r,"y")&&N(r)})}function N(e){e.y=-e.y}function ye(e){o.forEach(e.nodes(),function(n){L(e.node(n))}),o.forEach(e.edges(),function(n){var r=e.edge(n);o.forEach(r.points,L),o.has(r,"x")&&L(r)})}function L(e){var n=e.x;e.x=e.y,e.y=n}function Ne(e){e.graph().dummyChains=[],o.forEach(e.edges(),function(n){Le(e,n)})}function Le(e,n){var r=n.v,a=e.node(r).rank,t=n.w,f=e.node(t).rank,i=n.name,u=e.edge(n),d=u.labelRank;if(f!==a+1){e.removeEdge(n);var c,s,h;for(h=0,++a;a<f;++h,++a)u.points=[],s={width:0,height:0,edgeLabel:u,edgeObj:n,rank:a},c=b(e,"edge",s,"_d"),a===d&&(s.width=u.width,s.height=u.height,s.dummy="edge-label",s.labelpos=u.labelpos),e.setEdge(r,c,{weight:u.weight},i),h===0&&e.graph().dummyChains.push(c),r=c;e.setEdge(r,t,{weight:u.weight},i)}}function Ie(e){o.forEach(e.graph().dummyChains,function(n){var r=e.node(n),a=r.edgeLabel,t;for(e.setEdge(r.edgeObj,a);r.dummy;)t=e.successors(n)[0],e.removeNode(n),a.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(a.x=r.x,a.y=r.y,a.width=r.width,a.height=r.height),n=t,r=e.node(n)})}function C(e){var n={};function r(a){var t=e.node(a);if(o.has(n,a))return t.rank;n[a]=!0;var f=o.min(o.map(e.outEdges(a),function(i){return r(i.w)-e.edge(i).minlen}));return(f===Number.POSITIVE_INFINITY||f===void 0||f===null)&&(f=0),t.rank=f}o.forEach(e.sources(),r)}function k(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}function $(e){var n=new w.Graph({directed:!1}),r=e.nodes()[0],a=e.nodeCount();n.setNode(r,{});for(var t,f;_e(n,e)<a;)t=Re(n,e),f=n.hasNode(t.v)?k(e,t):-k(e,t),Ce(n,e,f);return n}function _e(e,n){function r(a){o.forEach(n.nodeEdges(a),function(t){var f=t.v,i=a===f?t.w:f;!e.hasNode(i)&&!k(n,t)&&(e.setNode(i,{}),e.setEdge(a,i,{}),r(i))})}return o.forEach(e.nodes(),r),e.nodeCount()}function Re(e,n){return o.minBy(n.edges(),function(r){if(e.hasNode(r.v)!==e.hasNode(r.w))return k(n,r)})}function Ce(e,n,r){o.forEach(e.nodes(),function(a){n.node(a).rank+=r})}o.constant(1);o.constant(1);function Te(){}Te.prototype=new Error;function z(e,n,r){o.isArray(n)||(n=[n]);var a=(e.isDirected()?e.successors:e.neighbors).bind(e),t=[],f={};return o.each(n,function(i){if(!e.hasNode(i))throw new Error("Graph does not have node: "+i);X(e,i,r==="post",f,a,t)}),t}function X(e,n,r,a,t,f){o.has(a,n)||(a[n]=!0,r||f.push(n),o.each(t(n),function(i){X(e,i,r,a,t,f)}),r&&f.push(n))}function Se(e,n){return z(e,n,"post")}function Me(e,n){return z(e,n,"pre")}E.initLowLimValues=S;E.initCutValues=T;E.calcCutValue=H;E.leaveEdge=K;E.enterEdge=Q;E.exchangeEdges=Z;function E(e){e=ve(e),C(e);var n=$(e);S(n),T(n,e);for(var r,a;r=K(n);)a=Q(n,e,r),Z(n,e,r,a)}function T(e,n){var r=Se(e,e.nodes());r=r.slice(0,r.length-1),o.forEach(r,function(a){Pe(e,n,a)})}function Pe(e,n,r){var a=e.node(r),t=a.parent;e.edge(r,t).cutvalue=H(e,n,r)}function H(e,n,r){var a=e.node(r),t=a.parent,f=!0,i=n.edge(r,t),u=0;return i||(f=!1,i=n.edge(t,r)),u=i.weight,o.forEach(n.nodeEdges(r),function(d){var c=d.v===r,s=c?d.w:d.v;if(s!==t){var h=c===f,l=n.edge(d).weight;if(u+=h?l:-l,Ve(e,r,s)){var v=e.edge(r,s).cutvalue;u+=h?-v:v}}}),u}function S(e,n){arguments.length<2&&(n=e.nodes()[0]),J(e,{},1,n)}function J(e,n,r,a,t){var f=r,i=e.node(a);return n[a]=!0,o.forEach(e.neighbors(a),function(u){o.has(n,u)||(r=J(e,n,r,u,a))}),i.low=f,i.lim=r++,t?i.parent=t:delete i.parent,r}function K(e){return o.find(e.edges(),function(n){return e.edge(n).cutvalue<0})}function Q(e,n,r){var a=r.v,t=r.w;n.hasEdge(a,t)||(a=r.w,t=r.v);var f=e.node(a),i=e.node(t),u=f,d=!1;f.lim>i.lim&&(u=i,d=!0);var c=o.filter(n.edges(),function(s){return d===G(e,e.node(s.v),u)&&d!==G(e,e.node(s.w),u)});return o.minBy(c,function(s){return k(n,s)})}function Z(e,n,r,a){var t=r.v,f=r.w;e.removeEdge(t,f),e.setEdge(a.v,a.w,{}),S(e),T(e,n),Oe(e,n)}function Oe(e,n){var r=o.find(e.nodes(),function(t){return!n.node(t).parent}),a=Me(e,r);a=a.slice(1),o.forEach(a,function(t){var f=e.node(t).parent,i=n.edge(t,f),u=!1;i||(i=n.edge(f,t),u=!0),n.node(t).rank=n.node(f).rank+(u?i.minlen:-i.minlen)})}function Ve(e,n,r){return e.hasEdge(n,r)}function G(e,n,r){return r.low<=n.lim&&n.lim<=r.lim}function Be(e){switch(e.graph().ranker){case"network-simplex":D(e);break;case"tight-tree":Ge(e);break;case"longest-path":Fe(e);break;default:D(e)}}var Fe=C;function Ge(e){C(e),$(e)}function D(e){E(e)}function De(e){var n=b(e,"root",{},"_root"),r=Ae(e),a=o.max(o.values(r))-1,t=2*a+1;e.graph().nestingRoot=n,o.forEach(e.edges(),function(i){e.edge(i).minlen*=t});var f=Ye(e)+1;o.forEach(e.children(),function(i){ee(e,n,t,f,a,r,i)}),e.graph().nodeRankFactor=t}function ee(e,n,r,a,t,f,i){var u=e.children(i);if(!u.length){i!==n&&e.setEdge(n,i,{weight:0,minlen:r});return}var d=V(e,"_bt"),c=V(e,"_bb"),s=e.node(i);e.setParent(d,i),s.borderTop=d,e.setParent(c,i),s.borderBottom=c,o.forEach(u,function(h){ee(e,n,r,a,t,f,h);var l=e.node(h),v=l.borderTop?l.borderTop:h,p=l.borderBottom?l.borderBottom:h,m=l.borderTop?a:2*a,g=v!==p?1:t-f[i]+1;e.setEdge(d,v,{weight:m,minlen:g,nestingEdge:!0}),e.setEdge(p,c,{weight:m,minlen:g,nestingEdge:!0})}),e.parent(i)||e.setEdge(n,d,{weight:0,minlen:t+f[i]})}function Ae(e){var n={};function r(a,t){var f=e.children(a);f&&f.length&&o.forEach(f,function(i){r(i,t+1)}),n[a]=t}return o.forEach(e.children(),function(a){r(a,1)}),n}function Ye(e){return o.reduce(e.edges(),function(n,r){return n+e.edge(r).weight},0)}function je(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,o.forEach(e.edges(),function(r){var a=e.edge(r);a.nestingEdge&&e.removeEdge(r)})}function qe(e,n,r){var a={},t;o.forEach(r,function(f){for(var i=e.parent(f),u,d;i;){if(u=e.parent(i),u?(d=a[u],a[u]=i):(d=t,t=i),d&&d!==i){n.setEdge(d,i);return}i=u}})}function Ue(e,n,r){var a=We(e),t=new w.Graph({compound:!0}).setGraph({root:a}).setDefaultNodeLabel(function(f){return e.node(f)});return o.forEach(e.nodes(),function(f){var i=e.node(f),u=e.parent(f);(i.rank===n||i.minRank<=n&&n<=i.maxRank)&&(t.setNode(f),t.setParent(f,u||a),o.forEach(e[r](f),function(d){var c=d.v===f?d.w:d.v,s=t.edge(c,f),h=o.isUndefined(s)?0:s.weight;t.setEdge(c,f,{weight:e.edge(d).weight+h})}),o.has(i,"minRank")&&t.setNode(f,{borderLeft:i.borderLeft[n],borderRight:i.borderRight[n]}))}),t}function We(e){for(var n;e.hasNode(n=o.uniqueId("_root")););return n}function $e(e,n){for(var r=0,a=1;a<n.length;++a)r+=ze(e,n[a-1],n[a]);return r}function ze(e,n,r){for(var a=o.zipObject(r,o.map(r,function(c,s){return s})),t=o.flatten(o.map(n,function(c){return o.sortBy(o.map(e.outEdges(c),function(s){return{pos:a[s.w],weight:e.edge(s).weight}}),"pos")})),f=1;f<r.length;)f<<=1;var i=2*f-1;f-=1;var u=o.map(new Array(i),function(){return 0}),d=0;return o.forEach(t.forEach(function(c){var s=c.pos+f;u[s]+=c.weight;for(var h=0;s>0;)s%2&&(h+=u[s+1]),s=s-1>>1,u[s]+=c.weight;d+=c.weight*h})),d}function Xe(e){var n={},r=o.filter(e.nodes(),function(u){return!e.children(u).length}),a=o.max(o.map(r,function(u){return e.node(u).rank})),t=o.map(o.range(a+1),function(){return[]});function f(u){if(!o.has(n,u)){n[u]=!0;var d=e.node(u);t[d.rank].push(u),o.forEach(e.successors(u),f)}}var i=o.sortBy(r,function(u){return e.node(u).rank});return o.forEach(i,f),t}function He(e,n){return o.map(n,function(r){var a=e.inEdges(r);if(a.length){var t=o.reduce(a,function(f,i){var u=e.edge(i),d=e.node(i.v);return{sum:f.sum+u.weight*d.order,weight:f.weight+u.weight}},{sum:0,weight:0});return{v:r,barycenter:t.sum/t.weight,weight:t.weight}}else return{v:r}})}function Je(e,n){var r={};o.forEach(e,function(t,f){var i=r[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:f};o.isUndefined(t.barycenter)||(i.barycenter=t.barycenter,i.weight=t.weight)}),o.forEach(n.edges(),function(t){var f=r[t.v],i=r[t.w];!o.isUndefined(f)&&!o.isUndefined(i)&&(i.indegree++,f.out.push(r[t.w]))});var a=o.filter(r,function(t){return!t.indegree});return Ke(a)}function Ke(e){var n=[];function r(f){return function(i){i.merged||(o.isUndefined(i.barycenter)||o.isUndefined(f.barycenter)||i.barycenter>=f.barycenter)&&Qe(f,i)}}function a(f){return function(i){i.in.push(f),--i.indegree===0&&e.push(i)}}for(;e.length;){var t=e.pop();n.push(t),o.forEach(t.in.reverse(),r(t)),o.forEach(t.out,a(t))}return o.map(o.filter(n,function(f){return!f.merged}),function(f){return o.pick(f,["vs","i","barycenter","weight"])})}function Qe(e,n){var r=0,a=0;e.weight&&(r+=e.barycenter*e.weight,a+=e.weight),n.weight&&(r+=n.barycenter*n.weight,a+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=r/a,e.weight=a,e.i=Math.min(n.i,e.i),n.merged=!0}function Ze(e,n){var r=we(e,function(s){return o.has(s,"barycenter")}),a=r.lhs,t=o.sortBy(r.rhs,function(s){return-s.i}),f=[],i=0,u=0,d=0;a.sort(en(!!n)),d=A(f,t,d),o.forEach(a,function(s){d+=s.vs.length,f.push(s.vs),i+=s.barycenter*s.weight,u+=s.weight,d=A(f,t,d)});var c={vs:o.flatten(f)};return u&&(c.barycenter=i/u,c.weight=u),c}function A(e,n,r){for(var a;n.length&&(a=o.last(n)).i<=r;)n.pop(),e.push(a.vs),r++;return r}function en(e){return function(n,r){return n.barycenter<r.barycenter?-1:n.barycenter>r.barycenter?1:e?r.i-n.i:n.i-r.i}}function ne(e,n,r,a){var t=e.children(n),f=e.node(n),i=f?f.borderLeft:void 0,u=f?f.borderRight:void 0,d={};i&&(t=o.filter(t,function(p){return p!==i&&p!==u}));var c=He(e,t);o.forEach(c,function(p){if(e.children(p.v).length){var m=ne(e,p.v,r,a);d[p.v]=m,o.has(m,"barycenter")&&rn(p,m)}});var s=Je(c,r);nn(s,d);var h=Ze(s,a);if(i&&(h.vs=o.flatten([i,h.vs,u]),e.predecessors(i).length)){var l=e.node(e.predecessors(i)[0]),v=e.node(e.predecessors(u)[0]);o.has(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+l.order+v.order)/(h.weight+2),h.weight+=2}return h}function nn(e,n){o.forEach(e,function(r){r.vs=o.flatten(r.vs.map(function(a){return n[a]?n[a].vs:a}))})}function rn(e,n){o.isUndefined(e.barycenter)?(e.barycenter=n.barycenter,e.weight=n.weight):(e.barycenter=(e.barycenter*e.weight+n.barycenter*n.weight)/(e.weight+n.weight),e.weight+=n.weight)}function an(e){var n=U(e),r=Y(e,o.range(1,n+1),"inEdges"),a=Y(e,o.range(n-1,-1,-1),"outEdges"),t=Xe(e);j(e,t);for(var f=Number.POSITIVE_INFINITY,i,u=0,d=0;d<4;++u,++d){tn(u%2?r:a,u%4>=2),t=x(e);var c=$e(e,t);c<f&&(d=0,i=o.cloneDeep(t),f=c)}j(e,i)}function Y(e,n,r){return o.map(n,function(a){return Ue(e,a,r)})}function tn(e,n){var r=new w.Graph;o.forEach(e,function(a){var t=a.graph().root,f=ne(a,t,r,n);o.forEach(f.vs,function(i,u){a.node(i).order=u}),qe(a,r,f.vs)})}function j(e,n){o.forEach(n,function(r){o.forEach(r,function(a,t){e.node(a).order=t})})}function on(e){var n=un(e);o.forEach(e.graph().dummyChains,function(r){for(var a=e.node(r),t=a.edgeObj,f=fn(e,n,t.v,t.w),i=f.path,u=f.lca,d=0,c=i[d],s=!0;r!==t.w;){if(a=e.node(r),s){for(;(c=i[d])!==u&&e.node(c).maxRank<a.rank;)d++;c===u&&(s=!1)}if(!s){for(;d<i.length-1&&e.node(c=i[d+1]).minRank<=a.rank;)d++;c=i[d]}e.setParent(r,c),r=e.successors(r)[0]}})}function fn(e,n,r,a){var t=[],f=[],i=Math.min(n[r].low,n[a].low),u=Math.max(n[r].lim,n[a].lim),d,c;d=r;do d=e.parent(d),t.push(d);while(d&&(n[d].low>i||u>n[d].lim));for(c=d,d=a;(d=e.parent(d))!==c;)f.push(d);return{path:t.concat(f.reverse()),lca:c}}function un(e){var n={},r=0;function a(t){var f=r;o.forEach(e.children(t),a),n[t]={low:f,lim:r++}}return o.forEach(e.children(),a),n}function dn(e,n){var r={};function a(t,f){var i=0,u=0,d=t.length,c=o.last(f);return o.forEach(f,function(s,h){var l=sn(e,s),v=l?e.node(l).order:d;(l||s===c)&&(o.forEach(f.slice(u,h+1),function(p){o.forEach(e.predecessors(p),function(m){var g=e.node(m),M=g.order;(M<i||v<M)&&!(g.dummy&&e.node(p).dummy)&&re(r,m,p)})}),u=h+1,i=v)}),f}return o.reduce(n,a),r}function cn(e,n){var r={};function a(f,i,u,d,c){var s;o.forEach(o.range(i,u),function(h){s=f[h],e.node(s).dummy&&o.forEach(e.predecessors(s),function(l){var v=e.node(l);v.dummy&&(v.order<d||v.order>c)&&re(r,l,s)})})}function t(f,i){var u=-1,d,c=0;return o.forEach(i,function(s,h){if(e.node(s).dummy==="border"){var l=e.predecessors(s);l.length&&(d=e.node(l[0]).order,a(i,c,h,u,d),c=h,u=d)}a(i,c,i.length,d,f.length)}),i}return o.reduce(n,t),r}function sn(e,n){if(e.node(n).dummy)return o.find(e.predecessors(n),function(r){return e.node(r).dummy})}function re(e,n,r){if(n>r){var a=n;n=r,r=a}var t=e[n];t||(e[n]=t={}),t[r]=!0}function hn(e,n,r){if(n>r){var a=n;n=r,r=a}return o.has(e[n],r)}function ln(e,n,r,a){var t={},f={},i={};return o.forEach(n,function(u){o.forEach(u,function(d,c){t[d]=d,f[d]=d,i[d]=c})}),o.forEach(n,function(u){var d=-1;o.forEach(u,function(c){var s=a(c);if(s.length){s=o.sortBy(s,function(m){return i[m]});for(var h=(s.length-1)/2,l=Math.floor(h),v=Math.ceil(h);l<=v;++l){var p=s[l];f[c]===c&&d<i[p]&&!hn(r,c,p)&&(f[p]=c,f[c]=t[c]=t[p],d=i[p])}}})}),{root:t,align:f}}function vn(e,n,r,a,t){var f={},i=pn(e,n,r,t),u=t?"borderLeft":"borderRight";function d(h,l){for(var v=i.nodes(),p=v.pop(),m={};p;)m[p]?h(p):(m[p]=!0,v.push(p),v=v.concat(l(p))),p=v.pop()}function c(h){f[h]=i.inEdges(h).reduce(function(l,v){return Math.max(l,f[v.v]+i.edge(v))},0)}function s(h){var l=i.outEdges(h).reduce(function(p,m){return Math.min(p,f[m.w]-i.edge(m))},Number.POSITIVE_INFINITY),v=e.node(h);l!==Number.POSITIVE_INFINITY&&v.borderType!==u&&(f[h]=Math.max(f[h],l))}return d(c,i.predecessors.bind(i)),d(s,i.successors.bind(i)),o.forEach(a,function(h){f[h]=f[r[h]]}),f}function pn(e,n,r,a){var t=new w.Graph,f=e.graph(),i=gn(f.nodesep,f.edgesep,a);return o.forEach(n,function(u){var d;o.forEach(u,function(c){var s=r[c];if(t.setNode(s),d){var h=r[d],l=t.edge(h,s);t.setEdge(h,s,Math.max(i(e,c,d),l||0))}d=c})}),t}function mn(e,n){return o.minBy(o.values(n),function(r){var a=Number.NEGATIVE_INFINITY,t=Number.POSITIVE_INFINITY;return o.forIn(r,function(f,i){var u=kn(e,i)/2;a=Math.max(f+u,a),t=Math.min(f-u,t)}),a-t})}function wn(e,n){var r=o.values(n),a=o.min(r),t=o.max(r);o.forEach(["u","d"],function(f){o.forEach(["l","r"],function(i){var u=f+i,d=e[u],c;if(d!==n){var s=o.values(d);c=i==="l"?a-o.min(s):t-o.max(s),c&&(e[u]=o.mapValues(d,function(h){return h+c}))}})})}function En(e,n){return o.mapValues(e.ul,function(r,a){if(n)return e[n.toLowerCase()][a];var t=o.sortBy(o.map(e,a));return(t[1]+t[2])/2})}function bn(e){var n=x(e),r=o.merge(dn(e,n),cn(e,n)),a={},t;o.forEach(["u","d"],function(i){t=i==="u"?n:o.values(n).reverse(),o.forEach(["l","r"],function(u){u==="r"&&(t=o.map(t,function(h){return o.values(h).reverse()}));var d=(i==="u"?e.predecessors:e.successors).bind(e),c=ln(e,t,r,d),s=vn(e,t,c.root,c.align,u==="r");u==="r"&&(s=o.mapValues(s,function(h){return-h})),a[i+u]=s})});var f=mn(e,a);return wn(a,f),En(a,e.graph().align)}function gn(e,n,r){return function(a,t,f){var i=a.node(t),u=a.node(f),d=0,c;if(d+=i.width/2,o.has(i,"labelpos"))switch(i.labelpos.toLowerCase()){case"l":c=-i.width/2;break;case"r":c=i.width/2;break}if(c&&(d+=r?c:-c),c=0,d+=(i.dummy?n:e)/2,d+=(u.dummy?n:e)/2,d+=u.width/2,o.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":c=u.width/2;break;case"r":c=-u.width/2;break}return c&&(d+=r?c:-c),c=0,d}}function kn(e,n){return e.node(n).width}function xn(e){e=q(e),yn(e),o.forOwn(bn(e),function(n,r){e.node(r).x=n})}function yn(e){var n=x(e),r=e.graph().ranksep,a=0;o.forEach(n,function(t){var f=o.max(o.map(t,function(i){return e.node(i).height}));o.forEach(t,function(i){e.node(i).y=a+f/2}),a+=f+r})}function Nn(e,n){var r=Ee;r("layout",function(){var a=r(" buildLayoutGraph",function(){return Vn(e)});r(" runLayout",function(){Ln(a,r)}),r(" updateInputGraph",function(){In(e,a)})})}function Ln(e,n){n(" makeSpaceForEdgeLabels",function(){Bn(e)}),n(" removeSelfEdges",function(){Wn(e)}),n(" acyclic",function(){se(e)}),n(" nestingGraph.run",function(){De(e)}),n(" rank",function(){Be(q(e))}),n(" injectEdgeLabelProxies",function(){Fn(e)}),n(" removeEmptyRanks",function(){me(e)}),n(" nestingGraph.cleanup",function(){je(e)}),n(" normalizeRanks",function(){pe(e)}),n(" assignRankMinMax",function(){Gn(e)}),n(" removeEdgeLabelProxies",function(){Dn(e)}),n(" normalize.run",function(){Ne(e)}),n(" parentDummyChains",function(){on(e)}),n(" addBorderSegments",function(){be(e)}),n(" order",function(){an(e)}),n(" insertSelfEdges",function(){$n(e)}),n(" adjustCoordinateSystem",function(){ge(e)}),n(" position",function(){xn(e)}),n(" positionSelfEdges",function(){zn(e)}),n(" removeBorderNodes",function(){Un(e)}),n(" normalize.undo",function(){Ie(e)}),n(" fixupEdgeLabelCoords",function(){jn(e)}),n(" undoCoordinateSystem",function(){ke(e)}),n(" translateGraph",function(){An(e)}),n(" assignNodeIntersects",function(){Yn(e)}),n(" reversePoints",function(){qn(e)}),n(" acyclic.undo",function(){le(e)})}function In(e,n){o.forEach(e.nodes(),function(r){var a=e.node(r),t=n.node(r);a&&(a.x=t.x,a.y=t.y,n.children(r).length&&(a.width=t.width,a.height=t.height))}),o.forEach(e.edges(),function(r){var a=e.edge(r),t=n.edge(r);a.points=t.points,o.has(t,"x")&&(a.x=t.x,a.y=t.y)}),e.graph().width=n.graph().width,e.graph().height=n.graph().height}var _n=["nodesep","edgesep","ranksep","marginx","marginy"],Rn={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Cn=["acyclicer","ranker","rankdir","align"],Tn=["width","height"],Sn={width:0,height:0},Mn=["minlen","weight","width","height","labeloffset"],Pn={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},On=["labelpos"];function Vn(e){var n=new w.Graph({multigraph:!0,compound:!0}),r=_(e.graph());return n.setGraph(o.merge({},Rn,I(r,_n),o.pick(r,Cn))),o.forEach(e.nodes(),function(a){var t=_(e.node(a));n.setNode(a,o.defaults(I(t,Tn),Sn)),n.setParent(a,e.parent(a))}),o.forEach(e.edges(),function(a){var t=_(e.edge(a));n.setEdge(a,o.merge({},Pn,I(t,Mn),o.pick(t,On)))}),n}function Bn(e){var n=e.graph();n.ranksep/=2,o.forEach(e.edges(),function(r){var a=e.edge(r);a.minlen*=2,a.labelpos.toLowerCase()!=="c"&&(n.rankdir==="TB"||n.rankdir==="BT"?a.width+=a.labeloffset:a.height+=a.labeloffset)})}function Fn(e){o.forEach(e.edges(),function(n){var r=e.edge(n);if(r.width&&r.height){var a=e.node(n.v),t=e.node(n.w),f={rank:(t.rank-a.rank)/2+a.rank,e:n};b(e,"edge-proxy",f,"_ep")}})}function Gn(e){var n=0;o.forEach(e.nodes(),function(r){var a=e.node(r);a.borderTop&&(a.minRank=e.node(a.borderTop).rank,a.maxRank=e.node(a.borderBottom).rank,n=o.max(n,a.maxRank))}),e.graph().maxRank=n}function Dn(e){o.forEach(e.nodes(),function(n){var r=e.node(n);r.dummy==="edge-proxy"&&(e.edge(r.e).labelRank=r.rank,e.removeNode(n))})}function An(e){var n=Number.POSITIVE_INFINITY,r=0,a=Number.POSITIVE_INFINITY,t=0,f=e.graph(),i=f.marginx||0,u=f.marginy||0;function d(c){var s=c.x,h=c.y,l=c.width,v=c.height;n=Math.min(n,s-l/2),r=Math.max(r,s+l/2),a=Math.min(a,h-v/2),t=Math.max(t,h+v/2)}o.forEach(e.nodes(),function(c){d(e.node(c))}),o.forEach(e.edges(),function(c){var s=e.edge(c);o.has(s,"x")&&d(s)}),n-=i,a-=u,o.forEach(e.nodes(),function(c){var s=e.node(c);s.x-=n,s.y-=a}),o.forEach(e.edges(),function(c){var s=e.edge(c);o.forEach(s.points,function(h){h.x-=n,h.y-=a}),o.has(s,"x")&&(s.x-=n),o.has(s,"y")&&(s.y-=a)}),f.width=r-n+i,f.height=t-a+u}function Yn(e){o.forEach(e.edges(),function(n){var r=e.edge(n),a=e.node(n.v),t=e.node(n.w),f,i;r.points?(f=r.points[0],i=r.points[r.points.length-1]):(r.points=[],f=t,i=a),r.points.unshift(O(a,f)),r.points.push(O(t,i))})}function jn(e){o.forEach(e.edges(),function(n){var r=e.edge(n);if(o.has(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function qn(e){o.forEach(e.edges(),function(n){var r=e.edge(n);r.reversed&&r.points.reverse()})}function Un(e){o.forEach(e.nodes(),function(n){if(e.children(n).length){var r=e.node(n),a=e.node(r.borderTop),t=e.node(r.borderBottom),f=e.node(o.last(r.borderLeft)),i=e.node(o.last(r.borderRight));r.width=Math.abs(i.x-f.x),r.height=Math.abs(t.y-a.y),r.x=f.x+r.width/2,r.y=a.y+r.height/2}}),o.forEach(e.nodes(),function(n){e.node(n).dummy==="border"&&e.removeNode(n)})}function Wn(e){o.forEach(e.edges(),function(n){if(n.v===n.w){var r=e.node(n.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}})}function $n(e){var n=x(e);o.forEach(n,function(r){var a=0;o.forEach(r,function(t,f){var i=e.node(t);i.order=f+a,o.forEach(i.selfEdges,function(u){b(e,"selfedge",{width:u.label.width,height:u.label.height,rank:i.rank,order:f+ ++a,e:u.e,label:u.label},"_se")}),delete i.selfEdges})})}function zn(e){o.forEach(e.nodes(),function(n){var r=e.node(n);if(r.dummy==="selfedge"){var a=e.node(r.e.v),t=a.x+a.width/2,f=a.y,i=r.x-t,u=a.height/2;e.setEdge(r.e,r.label),e.removeNode(n),r.label.points=[{x:t+2*i/3,y:f-u},{x:t+5*i/6,y:f-u},{x:t+i,y:f},{x:t+5*i/6,y:f+u},{x:t+2*i/3,y:f+u}],r.label.x=r.x,r.label.y=r.y}})}function I(e,n){return o.mapValues(o.pick(e,n),Number)}function _(e){var n={};return o.forEach(e,function(r,a){n[a.toLowerCase()]=r}),n}exports.layout=Nn;