@mgamil/mapx 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/LICENSE +194 -0
  2. package/README.md +488 -0
  3. package/VERSION +1 -0
  4. package/dist/agents/generator.d.ts +74 -0
  5. package/dist/agents/generator.js +375 -0
  6. package/dist/agents/templates.d.ts +29 -0
  7. package/dist/agents/templates.js +459 -0
  8. package/dist/cli.d.ts +16 -0
  9. package/dist/cli.js +1835 -0
  10. package/dist/core/cluster-engine.d.ts +32 -0
  11. package/dist/core/cluster-engine.js +314 -0
  12. package/dist/core/config.d.ts +29 -0
  13. package/dist/core/config.js +178 -0
  14. package/dist/core/context-builder.d.ts +61 -0
  15. package/dist/core/context-builder.js +252 -0
  16. package/dist/core/flow-tracer.d.ts +63 -0
  17. package/dist/core/flow-tracer.js +366 -0
  18. package/dist/core/git-tracker.d.ts +20 -0
  19. package/dist/core/git-tracker.js +159 -0
  20. package/dist/core/graph.d.ts +42 -0
  21. package/dist/core/graph.js +186 -0
  22. package/dist/core/metrics.d.ts +24 -0
  23. package/dist/core/metrics.js +87 -0
  24. package/dist/core/scanner.d.ts +53 -0
  25. package/dist/core/scanner.js +949 -0
  26. package/dist/core/store-bun.d.ts +13 -0
  27. package/dist/core/store-bun.js +34 -0
  28. package/dist/core/store-interface.d.ts +15 -0
  29. package/dist/core/store-interface.js +7 -0
  30. package/dist/core/store-node.d.ts +13 -0
  31. package/dist/core/store-node.js +35 -0
  32. package/dist/core/store.d.ts +132 -0
  33. package/dist/core/store.js +614 -0
  34. package/dist/core/workspace-manager.d.ts +9 -0
  35. package/dist/core/workspace-manager.js +64 -0
  36. package/dist/exporters/dot-exporter.d.ts +16 -0
  37. package/dist/exporters/dot-exporter.js +179 -0
  38. package/dist/exporters/graph-exporter.d.ts +14 -0
  39. package/dist/exporters/graph-exporter.js +85 -0
  40. package/dist/exporters/index.d.ts +9 -0
  41. package/dist/exporters/index.js +12 -0
  42. package/dist/exporters/llm-exporter.d.ts +18 -0
  43. package/dist/exporters/llm-exporter.js +224 -0
  44. package/dist/exporters/svg-exporter.d.ts +19 -0
  45. package/dist/exporters/svg-exporter.js +319 -0
  46. package/dist/exporters/toon-exporter.d.ts +16 -0
  47. package/dist/exporters/toon-exporter.js +246 -0
  48. package/dist/frameworks/detectors/aspnet.d.ts +11 -0
  49. package/dist/frameworks/detectors/aspnet.js +52 -0
  50. package/dist/frameworks/detectors/django.d.ts +14 -0
  51. package/dist/frameworks/detectors/django.js +135 -0
  52. package/dist/frameworks/detectors/drupal.d.ts +13 -0
  53. package/dist/frameworks/detectors/drupal.js +94 -0
  54. package/dist/frameworks/detectors/express.d.ts +12 -0
  55. package/dist/frameworks/detectors/express.js +234 -0
  56. package/dist/frameworks/detectors/fastapi.d.ts +12 -0
  57. package/dist/frameworks/detectors/fastapi.js +203 -0
  58. package/dist/frameworks/detectors/flask.d.ts +12 -0
  59. package/dist/frameworks/detectors/flask.js +244 -0
  60. package/dist/frameworks/detectors/go.d.ts +11 -0
  61. package/dist/frameworks/detectors/go.js +75 -0
  62. package/dist/frameworks/detectors/laravel.d.ts +11 -0
  63. package/dist/frameworks/detectors/laravel.js +462 -0
  64. package/dist/frameworks/detectors/nestjs.d.ts +12 -0
  65. package/dist/frameworks/detectors/nestjs.js +155 -0
  66. package/dist/frameworks/detectors/nextjs.d.ts +11 -0
  67. package/dist/frameworks/detectors/nextjs.js +118 -0
  68. package/dist/frameworks/detectors/rails.d.ts +12 -0
  69. package/dist/frameworks/detectors/rails.js +76 -0
  70. package/dist/frameworks/detectors/react-router.d.ts +11 -0
  71. package/dist/frameworks/detectors/react-router.js +115 -0
  72. package/dist/frameworks/detectors/rust.d.ts +11 -0
  73. package/dist/frameworks/detectors/rust.js +59 -0
  74. package/dist/frameworks/detectors/spring.d.ts +11 -0
  75. package/dist/frameworks/detectors/spring.js +56 -0
  76. package/dist/frameworks/detectors/sveltekit.d.ts +11 -0
  77. package/dist/frameworks/detectors/sveltekit.js +154 -0
  78. package/dist/frameworks/detectors/symfony.d.ts +13 -0
  79. package/dist/frameworks/detectors/symfony.js +175 -0
  80. package/dist/frameworks/detectors/tanstack-router.d.ts +12 -0
  81. package/dist/frameworks/detectors/tanstack-router.js +80 -0
  82. package/dist/frameworks/detectors/vapor.d.ts +11 -0
  83. package/dist/frameworks/detectors/vapor.js +52 -0
  84. package/dist/frameworks/detectors/vue-router.d.ts +12 -0
  85. package/dist/frameworks/detectors/vue-router.js +237 -0
  86. package/dist/frameworks/detectors/wordpress.d.ts +13 -0
  87. package/dist/frameworks/detectors/wordpress.js +141 -0
  88. package/dist/frameworks/detectors/yii.d.ts +11 -0
  89. package/dist/frameworks/detectors/yii.js +131 -0
  90. package/dist/frameworks/framework-registry.d.ts +13 -0
  91. package/dist/frameworks/framework-registry.js +77 -0
  92. package/dist/frameworks/route-registry.d.ts +26 -0
  93. package/dist/frameworks/route-registry.js +102 -0
  94. package/dist/index.d.ts +19 -0
  95. package/dist/index.js +30 -0
  96. package/dist/languages/index.d.ts +2 -0
  97. package/dist/languages/index.js +7 -0
  98. package/dist/languages/installer.d.ts +13 -0
  99. package/dist/languages/installer.js +103 -0
  100. package/dist/languages/registry.d.ts +19 -0
  101. package/dist/languages/registry.js +427 -0
  102. package/dist/main.d.ts +2 -0
  103. package/dist/main.js +20 -0
  104. package/dist/mcp.d.ts +11 -0
  105. package/dist/mcp.js +1699 -0
  106. package/dist/parsers/common-methods.d.ts +3 -0
  107. package/dist/parsers/common-methods.js +33 -0
  108. package/dist/parsers/fallback-parser.d.ts +10 -0
  109. package/dist/parsers/fallback-parser.js +18 -0
  110. package/dist/parsers/generic-wasm-parser.d.ts +23 -0
  111. package/dist/parsers/generic-wasm-parser.js +168 -0
  112. package/dist/parsers/ignored-symbols.d.ts +26 -0
  113. package/dist/parsers/ignored-symbols.js +77 -0
  114. package/dist/parsers/index.d.ts +9 -0
  115. package/dist/parsers/index.js +13 -0
  116. package/dist/parsers/languages/javascript.d.ts +11 -0
  117. package/dist/parsers/languages/javascript.js +28 -0
  118. package/dist/parsers/languages/php.d.ts +15 -0
  119. package/dist/parsers/languages/php.js +648 -0
  120. package/dist/parsers/languages/typescript.d.ts +10 -0
  121. package/dist/parsers/languages/typescript.js +9 -0
  122. package/dist/parsers/languages/vue.d.ts +13 -0
  123. package/dist/parsers/languages/vue.js +63 -0
  124. package/dist/parsers/parse-worker.d.ts +2 -0
  125. package/dist/parsers/parse-worker.js +185 -0
  126. package/dist/parsers/parser-interface.d.ts +9 -0
  127. package/dist/parsers/parser-interface.js +0 -0
  128. package/dist/parsers/parser-registry.d.ts +8 -0
  129. package/dist/parsers/parser-registry.js +52 -0
  130. package/dist/parsers/wasm-parser.d.ts +16 -0
  131. package/dist/parsers/wasm-parser.js +110 -0
  132. package/dist/types.d.ts +172 -0
  133. package/dist/types.js +0 -0
  134. package/dist/ui/index.html +270 -0
  135. package/dist/ui/main.js +581 -0
  136. package/dist/ui/main.js.map +7 -0
  137. package/dist/ui/styles.css +573 -0
  138. package/dist/ui-events.d.ts +36 -0
  139. package/dist/ui-events.js +61 -0
  140. package/dist/ui-server.d.ts +12 -0
  141. package/dist/ui-server.js +504 -0
  142. package/package.json +179 -0
  143. package/queries/bash/references.scm +22 -0
  144. package/queries/bash/symbols.scm +15 -0
  145. package/queries/c/references.scm +14 -0
  146. package/queries/c/symbols.scm +30 -0
  147. package/queries/c-sharp/references.scm +26 -0
  148. package/queries/c-sharp/symbols.scm +57 -0
  149. package/queries/cpp/references.scm +21 -0
  150. package/queries/cpp/symbols.scm +44 -0
  151. package/queries/dart/references.scm +33 -0
  152. package/queries/dart/symbols.scm +38 -0
  153. package/queries/elixir/references.scm +45 -0
  154. package/queries/elixir/symbols.scm +41 -0
  155. package/queries/go/references.scm +22 -0
  156. package/queries/go/symbols.scm +53 -0
  157. package/queries/java/references.scm +32 -0
  158. package/queries/java/symbols.scm +41 -0
  159. package/queries/javascript/references.scm +14 -0
  160. package/queries/javascript/symbols.scm +23 -0
  161. package/queries/kotlin/references.scm +31 -0
  162. package/queries/kotlin/symbols.scm +24 -0
  163. package/queries/lua/references.scm +19 -0
  164. package/queries/lua/symbols.scm +29 -0
  165. package/queries/pascal/references.scm +29 -0
  166. package/queries/pascal/symbols.scm +45 -0
  167. package/queries/php/references.scm +109 -0
  168. package/queries/php/symbols.scm +33 -0
  169. package/queries/python/references.scm +50 -0
  170. package/queries/python/symbols.scm +21 -0
  171. package/queries/ruby/references.scm +48 -0
  172. package/queries/ruby/symbols.scm +24 -0
  173. package/queries/rust/references.scm +31 -0
  174. package/queries/rust/symbols.scm +35 -0
  175. package/queries/scala/references.scm +30 -0
  176. package/queries/scala/symbols.scm +35 -0
  177. package/queries/svelte/references.scm +20 -0
  178. package/queries/svelte/symbols.scm +30 -0
  179. package/queries/swift/references.scm +22 -0
  180. package/queries/swift/symbols.scm +37 -0
  181. package/queries/typescript/references.scm +25 -0
  182. package/queries/typescript/symbols.scm +35 -0
  183. package/queries/vue/references.scm +20 -0
  184. package/queries/vue/symbols.scm +28 -0
  185. package/queries/zig/references.scm +20 -0
  186. package/queries/zig/symbols.scm +22 -0
  187. package/wasm/tree-sitter-c.wasm +0 -0
  188. package/wasm/tree-sitter-c_sharp.wasm +0 -0
  189. package/wasm/tree-sitter-cpp.wasm +0 -0
  190. package/wasm/tree-sitter-dart.wasm +0 -0
  191. package/wasm/tree-sitter-go.wasm +0 -0
  192. package/wasm/tree-sitter-java.wasm +0 -0
  193. package/wasm/tree-sitter-javascript.wasm +0 -0
  194. package/wasm/tree-sitter-kotlin.wasm +0 -0
  195. package/wasm/tree-sitter-php.wasm +0 -0
  196. package/wasm/tree-sitter-python.wasm +0 -0
  197. package/wasm/tree-sitter-ruby.wasm +0 -0
  198. package/wasm/tree-sitter-rust.wasm +0 -0
  199. package/wasm/tree-sitter-scala.wasm +0 -0
  200. package/wasm/tree-sitter-swift.wasm +0 -0
  201. package/wasm/tree-sitter-tsx.wasm +0 -0
  202. package/wasm/tree-sitter-typescript.wasm +0 -0
  203. package/wasm/tree-sitter-vue.wasm +0 -0
@@ -0,0 +1,581 @@
1
+ "use strict";(()=>{function Lo(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,a=Array(e);r<e;r++)a[r]=t[r];return a}function bv(t){if(Array.isArray(t))return t}function wv(t){if(Array.isArray(t))return Lo(t)}function gr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function xv(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,ff(a.key),a)}}function pr(t,e,r){return e&&xv(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Tt(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=jo(t))||e){r&&(t=r);var a=0,n=function(){};return{s:n,n:function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(u){throw u},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,o=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,i=u},f:function(){try{o||r.return==null||r.return()}finally{if(s)throw i}}}}function uf(t,e,r){return(e=ff(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ev(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Cv(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var a,n,i,o,s=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(a=i.call(r)).done)&&(s.push(a.value),s.length!==e);u=!0);}catch(f){l=!0,n=f}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(l)throw n}}return s}}function Tv(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Sv(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
4
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Je(t,e){return bv(t)||Cv(t,e)||jo(t,e)||Tv()}function bn(t){return wv(t)||Ev(t)||jo(t)||Sv()}function kv(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var a=r.call(t,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function ff(t){var e=kv(t,"string");return typeof e=="symbol"?e:e+""}function rt(t){"@babel/helpers - typeof";return rt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rt(t)}function jo(t,e){if(t){if(typeof t=="string")return Lo(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Lo(t,e):void 0}}var et=typeof window>"u"?null:window,Is=et?et.navigator:null;et&&et.document;var Bv=rt(""),cf=rt({}),Dv=rt(function(){}),Pv=typeof HTMLElement>"u"?"undefined":rt(HTMLElement),Ia=function(e){return e&&e.instanceString&&We(e.instanceString)?e.instanceString():null},he=function(e){return e!=null&&rt(e)==Bv},We=function(e){return e!=null&&rt(e)===Dv},qe=function(e){return!St(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},Me=function(e){return e!=null&&rt(e)===cf&&!qe(e)&&e.constructor===Object},Av=function(e){return e!=null&&rt(e)===cf},ae=function(e){return e!=null&&rt(e)===rt(1)&&!isNaN(e)},Rv=function(e){return ae(e)&&Math.floor(e)===e},wn=function(e){if(Pv!=="undefined")return e!=null&&e instanceof HTMLElement},St=function(e){return Oa(e)||vf(e)},Oa=function(e){return Ia(e)==="collection"&&e._private.single},vf=function(e){return Ia(e)==="collection"&&!e._private.single},es=function(e){return Ia(e)==="core"},df=function(e){return Ia(e)==="stylesheet"},Mv=function(e){return Ia(e)==="event"},lr=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},Lv=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},Iv=function(e){return Me(e)&&ae(e.x1)&&ae(e.x2)&&ae(e.y1)&&ae(e.y2)},Ov=function(e){return Av(e)&&We(e.then)},Nv=function(){return Is&&Is.userAgent.match(/msie|trident|edge/i)},Jr=function(e,r){r||(r=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);return i.join("$")});var a=function(){var i=this,o=arguments,s,u=r.apply(i,o),l=a.cache;return(s=l[u])||(s=l[u]=e.apply(i,o)),s};return a.cache={},a},ts=Jr(function(t){return t.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),Ln=Jr(function(t){return t.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),hf=Jr(function(t,e){return t+e[0].toUpperCase()+e.substring(1)},function(t,e){return t+"$"+e}),Os=function(e){return lr(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},ar=function(e,r){return e.slice(-1*r.length)===r},tt="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",zv="rgb[a]?\\(("+tt+"[%]?)\\s*,\\s*("+tt+"[%]?)\\s*,\\s*("+tt+"[%]?)(?:\\s*,\\s*("+tt+"))?\\)",Fv="rgb[a]?\\((?:"+tt+"[%]?)\\s*,\\s*(?:"+tt+"[%]?)\\s*,\\s*(?:"+tt+"[%]?)(?:\\s*,\\s*(?:"+tt+"))?\\)",Vv="hsl[a]?\\(("+tt+")\\s*,\\s*("+tt+"[%])\\s*,\\s*("+tt+"[%])(?:\\s*,\\s*("+tt+"))?\\)",qv="hsl[a]?\\((?:"+tt+")\\s*,\\s*(?:"+tt+"[%])\\s*,\\s*(?:"+tt+"[%])(?:\\s*,\\s*(?:"+tt+"))?\\)",$v="\\#[0-9a-fA-F]{3}",_v="\\#[0-9a-fA-F]{6}",gf=function(e,r){return e<r?-1:e>r?1:0},Hv=function(e,r){return-1*gf(e,r)},ye=Object.assign!=null?Object.assign.bind(Object):function(t){for(var e=arguments,r=1;r<e.length;r++){var a=e[r];if(a!=null)for(var n=Object.keys(a),i=0;i<n.length;i++){var o=n[i];t[o]=a[o]}}return t},Gv=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var r=e.length===4,a,n,i,o=16;return r?(a=parseInt(e[1]+e[1],o),n=parseInt(e[2]+e[2],o),i=parseInt(e[3]+e[3],o)):(a=parseInt(e[1]+e[2],o),n=parseInt(e[3]+e[4],o),i=parseInt(e[5]+e[6],o)),[a,n,i]}},Uv=function(e){var r,a,n,i,o,s,u,l;function f(h,y,g){return g<0&&(g+=1),g>1&&(g-=1),g<1/6?h+(y-h)*6*g:g<1/2?y:g<2/3?h+(y-h)*(2/3-g)*6:h}var c=new RegExp("^"+Vv+"$").exec(e);if(c){if(a=parseInt(c[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,n=parseFloat(c[2]),n<0||n>100||(n=n/100,i=parseFloat(c[3]),i<0||i>100)||(i=i/100,o=c[4],o!==void 0&&(o=parseFloat(o),o<0||o>1)))return;if(n===0)s=u=l=Math.round(i*255);else{var v=i<.5?i*(1+n):i+n-i*n,d=2*i-v;s=Math.round(255*f(d,v,a+1/3)),u=Math.round(255*f(d,v,a)),l=Math.round(255*f(d,v,a-1/3))}r=[s,u,l,o]}return r},Wv=function(e){var r,a=new RegExp("^"+zv+"$").exec(e);if(a){r=[];for(var n=[],i=1;i<=3;i++){var o=a[i];if(o[o.length-1]==="%"&&(n[i]=!0),o=parseFloat(o),n[i]&&(o=o/100*255),o<0||o>255)return;r.push(Math.floor(o))}var s=n[1]||n[2]||n[3],u=n[1]&&n[2]&&n[3];if(s&&!u)return;var l=a[4];if(l!==void 0){if(l=parseFloat(l),l<0||l>1)return;r.push(l)}}return r},Kv=function(e){return Xv[e.toLowerCase()]},pf=function(e){return(qe(e)?e:null)||Kv(e)||Gv(e)||Wv(e)||Uv(e)},Xv={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},yf=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var o=a[i];if(Me(o))throw Error("Tried to set map with object key");i<a.length-1?(r[o]==null&&(r[o]={}),r=r[o]):r[o]=e.value}},mf=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var o=a[i];if(Me(o))throw Error("Tried to get map with object key");if(r=r[o],r==null)return r}return r},Xa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Na(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ri,Ns;function za(){if(Ns)return ri;Ns=1;function t(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}return ri=t,ri}var ai,zs;function Yv(){if(zs)return ai;zs=1;var t=typeof Xa=="object"&&Xa&&Xa.Object===Object&&Xa;return ai=t,ai}var ni,Fs;function In(){if(Fs)return ni;Fs=1;var t=Yv(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return ni=r,ni}var ii,Vs;function Zv(){if(Vs)return ii;Vs=1;var t=In(),e=function(){return t.Date.now()};return ii=e,ii}var oi,qs;function Qv(){if(qs)return oi;qs=1;var t=/\s/;function e(r){for(var a=r.length;a--&&t.test(r.charAt(a)););return a}return oi=e,oi}var si,$s;function Jv(){if($s)return si;$s=1;var t=Qv(),e=/^\s+/;function r(a){return a&&a.slice(0,t(a)+1).replace(e,"")}return si=r,si}var li,_s;function rs(){if(_s)return li;_s=1;var t=In(),e=t.Symbol;return li=e,li}var ui,Hs;function jv(){if(Hs)return ui;Hs=1;var t=rs(),e=Object.prototype,r=e.hasOwnProperty,a=e.toString,n=t?t.toStringTag:void 0;function i(o){var s=r.call(o,n),u=o[n];try{o[n]=void 0;var l=!0}catch{}var f=a.call(o);return l&&(s?o[n]=u:delete o[n]),f}return ui=i,ui}var fi,Gs;function ed(){if(Gs)return fi;Gs=1;var t=Object.prototype,e=t.toString;function r(a){return e.call(a)}return fi=r,fi}var ci,Us;function bf(){if(Us)return ci;Us=1;var t=rs(),e=jv(),r=ed(),a="[object Null]",n="[object Undefined]",i=t?t.toStringTag:void 0;function o(s){return s==null?s===void 0?n:a:i&&i in Object(s)?e(s):r(s)}return ci=o,ci}var vi,Ws;function td(){if(Ws)return vi;Ws=1;function t(e){return e!=null&&typeof e=="object"}return vi=t,vi}var di,Ks;function Fa(){if(Ks)return di;Ks=1;var t=bf(),e=td(),r="[object Symbol]";function a(n){return typeof n=="symbol"||e(n)&&t(n)==r}return di=a,di}var hi,Xs;function rd(){if(Xs)return hi;Xs=1;var t=Jv(),e=za(),r=Fa(),a=NaN,n=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function u(l){if(typeof l=="number")return l;if(r(l))return a;if(e(l)){var f=typeof l.valueOf=="function"?l.valueOf():l;l=e(f)?f+"":f}if(typeof l!="string")return l===0?l:+l;l=t(l);var c=i.test(l);return c||o.test(l)?s(l.slice(2),c?2:8):n.test(l)?a:+l}return hi=u,hi}var gi,Ys;function ad(){if(Ys)return gi;Ys=1;var t=za(),e=Zv(),r=rd(),a="Expected a function",n=Math.max,i=Math.min;function o(s,u,l){var f,c,v,d,h,y,g=0,p=!1,m=!1,b=!0;if(typeof s!="function")throw new TypeError(a);u=r(u)||0,t(l)&&(p=!!l.leading,m="maxWait"in l,v=m?n(r(l.maxWait)||0,u):v,b="trailing"in l?!!l.trailing:b);function w(A){var R=f,L=c;return f=c=void 0,g=A,d=s.apply(L,R),d}function E(A){return g=A,h=setTimeout(T,u),p?w(A):d}function C(A){var R=A-y,L=A-g,I=u-R;return m?i(I,v-L):I}function x(A){var R=A-y,L=A-g;return y===void 0||R>=u||R<0||m&&L>=v}function T(){var A=e();if(x(A))return k(A);h=setTimeout(T,C(A))}function k(A){return h=void 0,b&&f?w(A):(f=c=void 0,d)}function B(){h!==void 0&&clearTimeout(h),g=0,f=y=c=h=void 0}function D(){return h===void 0?d:k(e())}function P(){var A=e(),R=x(A);if(f=arguments,c=this,y=A,R){if(h===void 0)return E(y);if(m)return clearTimeout(h),h=setTimeout(T,u),w(y)}return h===void 0&&(h=setTimeout(T,u)),d}return P.cancel=B,P.flush=D,P}return gi=o,gi}var nd=ad(),Va=Na(nd),pi=et?et.performance:null,wf=pi&&pi.now?function(){return pi.now()}:function(){return Date.now()},id=(function(){if(et){if(et.requestAnimationFrame)return function(t){et.requestAnimationFrame(t)};if(et.mozRequestAnimationFrame)return function(t){et.mozRequestAnimationFrame(t)};if(et.webkitRequestAnimationFrame)return function(t){et.webkitRequestAnimationFrame(t)};if(et.msRequestAnimationFrame)return function(t){et.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(wf())},1e3/60)}})(),xn=function(e){return id(e)},Yt=wf,Br=9261,xf=65599,Gr=5381,Ef=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Br,a=r,n;n=e.next(),!n.done;)a=a*xf+n.value|0;return a},Ta=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Br;return r*xf+e|0},Sa=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Gr;return(r<<5)+r+e|0},od=function(e,r){return e*2097152+r},er=function(e){return e[0]*2097152+e[1]},Ya=function(e,r){return[Ta(e[0],r[0]),Sa(e[1],r[1])]},Zs=function(e,r){var a={value:0,done:!1},n=0,i=e.length,o={next:function(){return n<i?a.value=e[n++]:a.done=!0,a}};return Ef(o,r)},Ar=function(e,r){var a={value:0,done:!1},n=0,i=e.length,o={next:function(){return n<i?a.value=e.charCodeAt(n++):a.done=!0,a}};return Ef(o,r)},Cf=function(){return sd(arguments)},sd=function(e){for(var r,a=0;a<e.length;a++){var n=e[a];a===0?r=Ar(n):r=Ar(n,r)}return r};function ld(t,e,r,a,n){var i=n*Math.PI/180,o=Math.cos(i)*(t-r)-Math.sin(i)*(e-a)+r,s=Math.sin(i)*(t-r)+Math.cos(i)*(e-a)+a;return{x:o,y:s}}var ud=function(e,r,a,n,i,o){return{x:(e-a)*i+a,y:(r-n)*o+n}};function fd(t,e,r){if(r===0)return t;var a=(e.x1+e.x2)/2,n=(e.y1+e.y2)/2,i=e.w/e.h,o=1/i,s=ld(t.x,t.y,a,n,r),u=ud(s.x,s.y,a,n,i,o);return{x:u.x,y:u.y}}var Qs=!0,cd=console.warn!=null,vd=console.trace!=null,as=Number.MAX_SAFE_INTEGER||9007199254740991,Tf=function(){return!0},En=function(){return!1},Js=function(){return 0},ns=function(){},Ge=function(e){throw new Error(e)},Sf=function(e){if(e!==void 0)Qs=!!e;else return Qs},ze=function(e){Sf()&&(cd?console.warn(e):(console.log(e),vd&&console.trace()))},dd=function(e){return ye({},e)},$t=function(e){return e==null?e:qe(e)?e.slice():Me(e)?dd(e):e},hd=function(e){return e.slice()},kf=function(e,r){for(r=e="";e++<36;r+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return r},gd={},Bf=function(){return gd},ct=function(e){var r=Object.keys(e);return function(a){for(var n={},i=0;i<r.length;i++){var o=r[i],s=a?.[o];n[o]=s===void 0?e[o]:s}return n}},ur=function(e,r,a){for(var n=e.length-1;n>=0;n--)e[n]===r&&e.splice(n,1)},is=function(e){e.splice(0,e.length)},pd=function(e,r){for(var a=0;a<r.length;a++){var n=r[a];e.push(n)}},Et=function(e,r,a){return a&&(r=hf(a,r)),e[r]},Kt=function(e,r,a,n){a&&(r=hf(a,r)),e[r]=n},yd=(function(){function t(){gr(this,t),this._obj={}}return pr(t,[{key:"set",value:function(r,a){return this._obj[r]=a,this}},{key:"delete",value:function(r){return this._obj[r]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(r){return this._obj[r]!==void 0}},{key:"get",value:function(r){return this._obj[r]}}])})(),Xt=typeof Map<"u"?Map:yd,md="undefined",bd=(function(){function t(e){if(gr(this,t),this._obj=Object.create(null),this.size=0,e!=null){var r;e.instanceString!=null&&e.instanceString()===this.instanceString()?r=e.toArray():r=e;for(var a=0;a<r.length;a++)this.add(r[a])}}return pr(t,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(r){var a=this._obj;a[r]!==1&&(a[r]=1,this.size++)}},{key:"delete",value:function(r){var a=this._obj;a[r]===1&&(a[r]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(r){return this._obj[r]===1}},{key:"toArray",value:function(){var r=this;return Object.keys(this._obj).filter(function(a){return r.has(a)})}},{key:"forEach",value:function(r,a){return this.toArray().forEach(r,a)}}])})(),ta=(typeof Set>"u"?"undefined":rt(Set))!==md?Set:bd,On=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!es(e)){Ge("An element must have a core reference and parameters set");return}var n=r.group;if(n==null&&(r.data&&r.data.source!=null&&r.data.target!=null?n="edges":n="nodes"),n!=="nodes"&&n!=="edges"){Ge("An element must be of type `nodes` or `edges`; you specified `"+n+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:r.data||{},position:r.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!r.selected,selectable:r.selectable===void 0?!0:!!r.selectable,locked:!!r.locked,grabbed:!1,grabbable:r.grabbable===void 0?!0:!!r.grabbable,pannable:r.pannable===void 0?n==="edges":!!r.pannable,active:!1,classes:new ta,animation:{current:[],queue:[]},rscratch:{},scratch:r.scratch||{},edges:[],children:[],parent:r.parent&&r.parent.isNode()?r.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),r.renderedPosition){var o=r.renderedPosition,s=e.pan(),u=e.zoom();i.position={x:(o.x-s.x)/u,y:(o.y-s.y)/u}}var l=[];qe(r.classes)?l=r.classes:he(r.classes)&&(l=r.classes.split(/\s+/));for(var f=0,c=l.length;f<c;f++){var v=l[f];!v||v===""||i.classes.add(v)}this.createEmitter(),(a===void 0||a)&&this.restore();var d=r.style||r.css;d&&(ze("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(d))},js=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(a,n,i){var o;Me(a)&&!St(a)&&(o=a,a=o.roots||o.root,n=o.visit,i=o.directed),i=arguments.length===2&&!We(n)?n:i,n=We(n)?n:function(){};for(var s=this._private.cy,u=a=he(a)?this.filter(a):a,l=[],f=[],c={},v={},d={},h=0,y,g=this.byGroup(),p=g.nodes,m=g.edges,b=0;b<u.length;b++){var w=u[b],E=w.id();w.isNode()&&(l.unshift(w),e.bfs&&(d[E]=!0,f.push(w)),v[E]=0)}for(var C=function(){var A=e.bfs?l.shift():l.pop(),R=A.id();if(e.dfs){if(d[R])return 0;d[R]=!0,f.push(A)}var L=v[R],I=c[R],M=I!=null?I.source():null,O=I!=null?I.target():null,q=I==null?void 0:A.same(M)?O[0]:M[0],$;if($=n(A,I,q,h++,L),$===!0)return y=A,1;if($===!1)return 1;for(var N=A.connectedEdges().filter(function(j){return(!i||j.source().same(A))&&m.has(j)}),F=0;F<N.length;F++){var W=N[F],J=W.connectedNodes().filter(function(j){return!j.same(A)&&p.has(j)}),Z=J.id();J.length!==0&&!d[Z]&&(J=J[0],l.push(J),e.bfs&&(d[Z]=!0,f.push(J)),c[Z]=W,v[Z]=v[R]+1)}},x;l.length!==0&&(x=C(),!(x!==0&&x===1)););for(var T=s.collection(),k=0;k<f.length;k++){var B=f[k],D=c[B.id()];D!=null&&T.push(D),T.push(B)}return{path:s.collection(T),found:s.collection(y)}}},ka={breadthFirstSearch:js({bfs:!0}),depthFirstSearch:js({dfs:!0})};ka.bfs=ka.breadthFirstSearch;ka.dfs=ka.depthFirstSearch;var ln={exports:{}},wd=ln.exports,el;function xd(){return el||(el=1,(function(t,e){(function(){var r,a,n,i,o,s,u,l,f,c,v,d,h,y,g;n=Math.floor,c=Math.min,a=function(p,m){return p<m?-1:p>m?1:0},f=function(p,m,b,w,E){var C;if(b==null&&(b=0),E==null&&(E=a),b<0)throw new Error("lo must be non-negative");for(w==null&&(w=p.length);b<w;)C=n((b+w)/2),E(m,p[C])<0?w=C:b=C+1;return[].splice.apply(p,[b,b-b].concat(m)),m},s=function(p,m,b){return b==null&&(b=a),p.push(m),y(p,0,p.length-1,b)},o=function(p,m){var b,w;return m==null&&(m=a),b=p.pop(),p.length?(w=p[0],p[0]=b,g(p,0,m)):w=b,w},l=function(p,m,b){var w;return b==null&&(b=a),w=p[0],p[0]=m,g(p,0,b),w},u=function(p,m,b){var w;return b==null&&(b=a),p.length&&b(p[0],m)<0&&(w=[p[0],m],m=w[0],p[0]=w[1],g(p,0,b)),m},i=function(p,m){var b,w,E,C,x,T;for(m==null&&(m=a),C=(function(){T=[];for(var k=0,B=n(p.length/2);0<=B?k<B:k>B;0<=B?k++:k--)T.push(k);return T}).apply(this).reverse(),x=[],w=0,E=C.length;w<E;w++)b=C[w],x.push(g(p,b,m));return x},h=function(p,m,b){var w;if(b==null&&(b=a),w=p.indexOf(m),w!==-1)return y(p,0,w,b),g(p,w,b)},v=function(p,m,b){var w,E,C,x,T;if(b==null&&(b=a),E=p.slice(0,m),!E.length)return E;for(i(E,b),T=p.slice(m),C=0,x=T.length;C<x;C++)w=T[C],u(E,w,b);return E.sort(b).reverse()},d=function(p,m,b){var w,E,C,x,T,k,B,D,P;if(b==null&&(b=a),m*10<=p.length){if(C=p.slice(0,m).sort(b),!C.length)return C;for(E=C[C.length-1],B=p.slice(m),x=0,k=B.length;x<k;x++)w=B[x],b(w,E)<0&&(f(C,w,0,null,b),C.pop(),E=C[C.length-1]);return C}for(i(p,b),P=[],T=0,D=c(m,p.length);0<=D?T<D:T>D;0<=D?++T:--T)P.push(o(p,b));return P},y=function(p,m,b,w){var E,C,x;for(w==null&&(w=a),E=p[b];b>m;){if(x=b-1>>1,C=p[x],w(E,C)<0){p[b]=C,b=x;continue}break}return p[b]=E},g=function(p,m,b){var w,E,C,x,T;for(b==null&&(b=a),E=p.length,T=m,C=p[m],w=2*m+1;w<E;)x=w+1,x<E&&!(b(p[w],p[x])<0)&&(w=x),p[m]=p[w],m=w,w=2*m+1;return p[m]=C,y(p,T,m,b)},r=(function(){p.push=s,p.pop=o,p.replace=l,p.pushpop=u,p.heapify=i,p.updateItem=h,p.nlargest=v,p.nsmallest=d;function p(m){this.cmp=m??a,this.nodes=[]}return p.prototype.push=function(m){return s(this.nodes,m,this.cmp)},p.prototype.pop=function(){return o(this.nodes,this.cmp)},p.prototype.peek=function(){return this.nodes[0]},p.prototype.contains=function(m){return this.nodes.indexOf(m)!==-1},p.prototype.replace=function(m){return l(this.nodes,m,this.cmp)},p.prototype.pushpop=function(m){return u(this.nodes,m,this.cmp)},p.prototype.heapify=function(){return i(this.nodes,this.cmp)},p.prototype.updateItem=function(m){return h(this.nodes,m,this.cmp)},p.prototype.clear=function(){return this.nodes=[]},p.prototype.empty=function(){return this.nodes.length===0},p.prototype.size=function(){return this.nodes.length},p.prototype.clone=function(){var m;return m=new p,m.nodes=this.nodes.slice(0),m},p.prototype.toArray=function(){return this.nodes.slice(0)},p.prototype.insert=p.prototype.push,p.prototype.top=p.prototype.peek,p.prototype.front=p.prototype.peek,p.prototype.has=p.prototype.contains,p.prototype.copy=p.prototype.clone,p})(),(function(p,m){return t.exports=m()})(this,function(){return r})}).call(wd)})(ln)),ln.exports}var yi,tl;function Ed(){return tl||(tl=1,yi=xd()),yi}var Cd=Ed(),qa=Na(Cd),Td=ct({root:null,weight:function(e){return 1},directed:!1}),Sd={dijkstra:function(e){if(!Me(e)){var r=arguments;e={root:r[0],weight:r[1],directed:r[2]}}var a=Td(e),n=a.root,i=a.weight,o=a.directed,s=this,u=i,l=he(n)?this.filter(n)[0]:n[0],f={},c={},v={},d=this.byGroup(),h=d.nodes,y=d.edges;y.unmergeBy(function(L){return L.isLoop()});for(var g=function(I){return f[I.id()]},p=function(I,M){f[I.id()]=M,m.updateItem(I)},m=new qa(function(L,I){return g(L)-g(I)}),b=0;b<h.length;b++){var w=h[b];f[w.id()]=w.same(l)?0:1/0,m.push(w)}for(var E=function(I,M){for(var O=(o?I.edgesTo(M):I.edgesWith(M)).intersect(y),q=1/0,$,N=0;N<O.length;N++){var F=O[N],W=u(F);(W<q||!$)&&(q=W,$=F)}return{edge:$,dist:q}};m.size()>0;){var C=m.pop(),x=g(C),T=C.id();if(v[T]=x,x!==1/0)for(var k=C.neighborhood().intersect(h),B=0;B<k.length;B++){var D=k[B],P=D.id(),A=E(C,D),R=x+A.dist;R<g(D)&&(p(D,R),c[P]={node:C,edge:A.edge})}}return{distanceTo:function(I){var M=he(I)?h.filter(I)[0]:I[0];return v[M.id()]},pathTo:function(I){var M=he(I)?h.filter(I)[0]:I[0],O=[],q=M,$=q.id();if(M.length>0)for(O.unshift(M);c[$];){var N=c[$];O.unshift(N.edge),O.unshift(N.node),q=N.node,$=q.id()}return s.spawn(O)}}}},kd={kruskal:function(e){e=e||function(b){return 1};for(var r=this.byGroup(),a=r.nodes,n=r.edges,i=a.length,o=new Array(i),s=a,u=function(w){for(var E=0;E<o.length;E++){var C=o[E];if(C.has(w))return E}},l=0;l<i;l++)o[l]=this.spawn(a[l]);for(var f=n.sort(function(b,w){return e(b)-e(w)}),c=0;c<f.length;c++){var v=f[c],d=v.source()[0],h=v.target()[0],y=u(d),g=u(h),p=o[y],m=o[g];y!==g&&(s.merge(v),p.merge(m),o.splice(g,1))}return s}},Bd=ct({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),Dd={aStar:function(e){var r=this.cy(),a=Bd(e),n=a.root,i=a.goal,o=a.heuristic,s=a.directed,u=a.weight;n=r.collection(n)[0],i=r.collection(i)[0];var l=n.id(),f=i.id(),c={},v={},d={},h=new qa(function($,N){return v[$.id()]-v[N.id()]}),y=new ta,g={},p={},m=function(N,F){h.push(N),y.add(F)},b,w,E=function(){b=h.pop(),w=b.id(),y.delete(w)},C=function(N){return y.has(N)};m(n,l),c[l]=0,v[l]=o(n);for(var x=0;h.size()>0;){if(E(),x++,w===f){for(var T=[],k=i,B=f,D=p[B];T.unshift(k),D!=null&&T.unshift(D),k=g[B],k!=null;)B=k.id(),D=p[B];return{found:!0,distance:c[w],path:this.spawn(T),steps:x}}d[w]=!0;for(var P=b._private.edges,A=0;A<P.length;A++){var R=P[A];if(this.hasElementWithId(R.id())&&!(s&&R.data("source")!==w)){var L=R.source(),I=R.target(),M=L.id()!==w?L:I,O=M.id();if(this.hasElementWithId(O)&&!d[O]){var q=c[w]+u(R);if(!C(O)){c[O]=q,v[O]=q+o(M),m(M,O),g[O]=b,p[O]=R;continue}q<c[O]&&(c[O]=q,v[O]=q+o(M),g[O]=b,p[O]=R)}}}}return{found:!1,distance:void 0,path:void 0,steps:x}}},Pd=ct({weight:function(e){return 1},directed:!1}),Ad={floydWarshall:function(e){for(var r=this.cy(),a=Pd(e),n=a.weight,i=a.directed,o=n,s=this.byGroup(),u=s.nodes,l=s.edges,f=u.length,c=f*f,v=function(W){return u.indexOf(W)},d=function(W){return u[W]},h=new Array(c),y=0;y<c;y++){var g=y%f,p=(y-g)/f;p===g?h[y]=0:h[y]=1/0}for(var m=new Array(c),b=new Array(c),w=0;w<l.length;w++){var E=l[w],C=E.source()[0],x=E.target()[0];if(C!==x){var T=v(C),k=v(x),B=T*f+k,D=o(E);if(h[B]>D&&(h[B]=D,m[B]=k,b[B]=E),!i){var P=k*f+T;!i&&h[P]>D&&(h[P]=D,m[P]=T,b[P]=E)}}}for(var A=0;A<f;A++)for(var R=0;R<f;R++)for(var L=R*f+A,I=0;I<f;I++){var M=R*f+I,O=A*f+I;h[L]+h[O]<h[M]&&(h[M]=h[L]+h[O],m[M]=m[L])}var q=function(W){return(he(W)?r.filter(W):W)[0]},$=function(W){return v(q(W))},N={distance:function(W,J){var Z=$(W),j=$(J);return h[Z*f+j]},path:function(W,J){var Z=$(W),j=$(J),te=d(Z);if(Z===j)return te.collection();if(m[Z*f+j]==null)return r.collection();var ne=r.collection(),Q=Z,V;for(ne.merge(te);Z!==j;)Q=Z,Z=m[Z*f+j],V=b[Q*f+Z],ne.merge(V),ne.merge(d(Z));return ne}};return N}},Rd=ct({weight:function(e){return 1},directed:!1,root:null}),Md={bellmanFord:function(e){var r=this,a=Rd(e),n=a.weight,i=a.directed,o=a.root,s=n,u=this,l=this.cy(),f=this.byGroup(),c=f.edges,v=f.nodes,d=v.length,h=new Xt,y=!1,g=[];o=l.collection(o)[0],c.unmergeBy(function(we){return we.isLoop()});for(var p=c.length,m=function(me){var ge=h.get(me.id());return ge||(ge={},h.set(me.id(),ge)),ge},b=function(me){return(he(me)?l.$(me):me)[0]},w=function(me){return m(b(me)).dist},E=function(me){for(var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o,oe=b(me),de=[],ce=oe;;){if(ce==null)return r.spawn();var xe=m(ce),be=xe.edge,Se=xe.pred;if(de.unshift(ce[0]),ce.same(ge)&&de.length>0)break;be!=null&&de.unshift(be),ce=Se}return u.spawn(de)},C=0;C<d;C++){var x=v[C],T=m(x);x.same(o)?T.dist=0:T.dist=1/0,T.pred=null,T.edge=null}for(var k=!1,B=function(me,ge,oe,de,ce,xe){var be=de.dist+xe;be<ce.dist&&!oe.same(de.edge)&&(ce.dist=be,ce.pred=me,ce.edge=oe,k=!0)},D=1;D<d;D++){k=!1;for(var P=0;P<p;P++){var A=c[P],R=A.source(),L=A.target(),I=s(A),M=m(R),O=m(L);B(R,L,A,M,O,I),i||B(L,R,A,O,M,I)}if(!k)break}if(k)for(var q=[],$=0;$<p;$++){var N=c[$],F=N.source(),W=N.target(),J=s(N),Z=m(F).dist,j=m(W).dist;if(Z+J<j||!i&&j+J<Z)if(y||(ze("Graph contains a negative weight cycle for Bellman-Ford"),y=!0),e.findNegativeWeightCycles!==!1){var te=[];Z+J<j&&te.push(F),!i&&j+J<Z&&te.push(W);for(var ne=te.length,Q=0;Q<ne;Q++){var V=te[Q],H=[V];H.push(m(V).edge);for(var G=m(V).pred;H.indexOf(G)===-1;)H.push(G),H.push(m(G).edge),G=m(G).pred;H=H.slice(H.indexOf(G));for(var Y=H[0].id(),re=0,ve=2;ve<H.length;ve+=2)H[ve].id()<Y&&(Y=H[ve].id(),re=ve);H=H.slice(re).concat(H.slice(0,re)),H.push(H[0]);var De=H.map(function(we){return we.id()}).join(",");q.indexOf(De)===-1&&(g.push(u.spawn(H)),q.push(De))}}else break}return{distanceTo:w,pathTo:E,hasNegativeWeightCycle:y,negativeWeightCycles:g}}},Ld=Math.sqrt(2),Id=function(e,r,a){a.length===0&&Ge("Karger-Stein must be run on a connected (sub)graph");for(var n=a[e],i=n[1],o=n[2],s=r[i],u=r[o],l=a,f=l.length-1;f>=0;f--){var c=l[f],v=c[1],d=c[2];(r[v]===s&&r[d]===u||r[v]===u&&r[d]===s)&&l.splice(f,1)}for(var h=0;h<l.length;h++){var y=l[h];y[1]===u?(l[h]=y.slice(),l[h][1]=s):y[2]===u&&(l[h]=y.slice(),l[h][2]=s)}for(var g=0;g<r.length;g++)r[g]===u&&(r[g]=s);return l},mi=function(e,r,a,n){for(;a>n;){var i=Math.floor(Math.random()*r.length);r=Id(i,e,r),a--}return r},Od={kargerStein:function(){var e=this,r=this.byGroup(),a=r.nodes,n=r.edges;n.unmergeBy(function(O){return O.isLoop()});var i=a.length,o=n.length,s=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),u=Math.floor(i/Ld);if(i<2){Ge("At least 2 nodes are required for Karger-Stein algorithm");return}for(var l=[],f=0;f<o;f++){var c=n[f];l.push([f,a.indexOf(c.source()),a.indexOf(c.target())])}for(var v=1/0,d=[],h=new Array(i),y=new Array(i),g=new Array(i),p=function(q,$){for(var N=0;N<i;N++)$[N]=q[N]},m=0;m<=s;m++){for(var b=0;b<i;b++)y[b]=b;var w=mi(y,l.slice(),i,u),E=w.slice();p(y,g);var C=mi(y,w,u,2),x=mi(g,E,u,2);C.length<=x.length&&C.length<v?(v=C.length,d=C,p(y,h)):x.length<=C.length&&x.length<v&&(v=x.length,d=x,p(g,h))}for(var T=this.spawn(d.map(function(O){return n[O[0]]})),k=this.spawn(),B=this.spawn(),D=h[0],P=0;P<h.length;P++){var A=h[P],R=a[P];A===D?k.merge(R):B.merge(R)}var L=function(q){var $=e.spawn();return q.forEach(function(N){$.merge(N),N.connectedEdges().forEach(function(F){e.contains(F)&&!T.contains(F)&&$.merge(F)})}),$},I=[L(k),L(B)],M={cut:T,components:I,partition1:k,partition2:B};return M}},bi,Nd=function(e){return{x:e.x,y:e.y}},Nn=function(e,r,a){return{x:e.x*r+a.x,y:e.y*r+a.y}},Df=function(e,r,a){return{x:(e.x-a.x)/r,y:(e.y-a.y)/r}},Ur=function(e){return{x:e[0],y:e[1]}},zd=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=1/0,i=r;i<a;i++){var o=e[i];isFinite(o)&&(n=Math.min(o,n))}return n},Fd=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=-1/0,i=r;i<a;i++){var o=e[i];isFinite(o)&&(n=Math.max(o,n))}return n},Vd=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=0,i=0,o=r;o<a;o++){var s=e[o];isFinite(s)&&(n+=s,i++)}return n/i},qd=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;n?e=e.slice(r,a):(a<e.length&&e.splice(a,e.length-a),r>0&&e.splice(0,r));for(var s=0,u=e.length-1;u>=0;u--){var l=e[u];o?isFinite(l)||(e[u]=-1/0,s++):e.splice(u,1)}i&&e.sort(function(v,d){return v-d});var f=e.length,c=Math.floor(f/2);return f%2!==0?e[c+1+s]:(e[c-1+s]+e[c+s])/2},$d=function(e){return Math.PI*e/180},Za=function(e,r){return Math.atan2(r,e)-Math.PI/2},os=Math.log2||function(t){return Math.log(t)/Math.log(2)},ss=function(e){return e>0?1:e<0?-1:0},Rr=function(e,r){return Math.sqrt(Sr(e,r))},Sr=function(e,r){var a=r.x-e.x,n=r.y-e.y;return a*a+n*n},_d=function(e){for(var r=e.length,a=0,n=0;n<r;n++)a+=e[n];for(var i=0;i<r;i++)e[i]=e[i]/a;return e},it=function(e,r,a,n){return(1-n)*(1-n)*e+2*(1-n)*n*r+n*n*a},Xr=function(e,r,a,n){return{x:it(e.x,r.x,a.x,n),y:it(e.y,r.y,a.y,n)}},Hd=function(e,r,a,n){var i={x:r.x-e.x,y:r.y-e.y},o=Rr(e,r),s={x:i.x/o,y:i.y/o};return a=a??0,n=n??a*o,{x:e.x+s.x*n,y:e.y+s.y*n}},Ba=function(e,r,a){return Math.max(e,Math.min(a,r))},mt=function(e){if(e==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(e.x1!=null&&e.y1!=null){if(e.x2!=null&&e.y2!=null&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},Gd=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Ud=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Wd=function(e,r){e.x1=Math.min(e.x1,r.x1),e.x2=Math.max(e.x2,r.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,r.y1),e.y2=Math.max(e.y2,r.y2),e.h=e.y2-e.y1},Pf=function(e,r,a){e.x1=Math.min(e.x1,r),e.x2=Math.max(e.x2,r),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,a),e.y2=Math.max(e.y2,a),e.h=e.y2-e.y1},un=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=r,e.x2+=r,e.y1-=r,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},fn=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,n,i,o;if(r.length===1)a=n=i=o=r[0];else if(r.length===2)a=i=r[0],o=n=r[1];else if(r.length===4){var s=Je(r,4);a=s[0],n=s[1],i=s[2],o=s[3]}return e.x1-=o,e.x2+=n,e.y1-=a,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},rl=function(e,r){e.x1=r.x1,e.y1=r.y1,e.x2=r.x2,e.y2=r.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},ls=function(e,r){return!(e.x1>r.x2||r.x1>e.x2||e.x2<r.x1||r.x2<e.x1||e.y2<r.y1||r.y2<e.y1||e.y1>r.y2||r.y1>e.y2)},nr=function(e,r,a){return e.x1<=r&&r<=e.x2&&e.y1<=a&&a<=e.y2},al=function(e,r){return nr(e,r.x,r.y)},Af=function(e,r){return nr(e,r.x1,r.y1)&&nr(e,r.x2,r.y2)},Kd=(bi=Math.hypot)!==null&&bi!==void 0?bi:function(t,e){return Math.sqrt(t*t+e*e)};function Xd(t,e){if(t.length<3)throw new Error("Need at least 3 vertices");var r=function(T,k){return{x:T.x+k.x,y:T.y+k.y}},a=function(T,k){return{x:T.x-k.x,y:T.y-k.y}},n=function(T,k){return{x:T.x*k,y:T.y*k}},i=function(T,k){return T.x*k.y-T.y*k.x},o=function(T){var k=Kd(T.x,T.y);return k===0?{x:0,y:0}:{x:T.x/k,y:T.y/k}},s=function(T){for(var k=0,B=0;B<T.length;B++){var D=T[B],P=T[(B+1)%T.length];k+=D.x*P.y-P.x*D.y}return k/2},u=function(T,k,B,D){var P=a(k,T),A=a(D,B),R=i(P,A);if(Math.abs(R)<1e-9)return r(T,n(P,.5));var L=i(a(B,T),A)/R;return r(T,n(P,L))},l=t.map(function(x){return{x:x.x,y:x.y}});s(l)<0&&l.reverse();for(var f=l.length,c=[],v=0;v<f;v++){var d=l[v],h=l[(v+1)%f],y=a(h,d),g=o({x:y.y,y:-y.x});c.push(g)}for(var p=c.map(function(x,T){var k=r(l[T],n(x,e)),B=r(l[(T+1)%f],n(x,e));return{p1:k,p2:B}}),m=[],b=0;b<f;b++){var w=p[(b-1+f)%f],E=p[b],C=u(w.p1,w.p2,E.p1,E.p2);m.push(C)}return m}function Yd(t,e,r,a,n,i){var o=nh(t,e,r,a,n),s=Xd(o,i),u=mt();return s.forEach(function(l){return Pf(u,l.x,l.y)}),u}var Rf=function(e,r,a,n,i,o,s){var u=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",l=u==="auto"?fr(i,o):u,f=i/2,c=o/2;l=Math.min(l,f,c);var v=l!==f,d=l!==c,h;if(v){var y=a-f+l-s,g=n-c-s,p=a+f-l+s,m=g;if(h=ir(e,r,a,n,y,g,p,m,!1),h.length>0)return h}if(d){var b=a+f+s,w=n-c+l-s,E=b,C=n+c-l+s;if(h=ir(e,r,a,n,b,w,E,C,!1),h.length>0)return h}if(v){var x=a-f+l-s,T=n+c+s,k=a+f-l+s,B=T;if(h=ir(e,r,a,n,x,T,k,B,!1),h.length>0)return h}if(d){var D=a-f-s,P=n-c+l-s,A=D,R=n+c-l+s;if(h=ir(e,r,a,n,D,P,A,R,!1),h.length>0)return h}var L;{var I=a-f+l,M=n-c+l;if(L=ma(e,r,a,n,I,M,l+s),L.length>0&&L[0]<=I&&L[1]<=M)return[L[0],L[1]]}{var O=a+f-l,q=n-c+l;if(L=ma(e,r,a,n,O,q,l+s),L.length>0&&L[0]>=O&&L[1]<=q)return[L[0],L[1]]}{var $=a+f-l,N=n+c-l;if(L=ma(e,r,a,n,$,N,l+s),L.length>0&&L[0]>=$&&L[1]>=N)return[L[0],L[1]]}{var F=a-f+l,W=n+c-l;if(L=ma(e,r,a,n,F,W,l+s),L.length>0&&L[0]<=F&&L[1]>=W)return[L[0],L[1]]}return[]},Zd=function(e,r,a,n,i,o,s){var u=s,l=Math.min(a,i),f=Math.max(a,i),c=Math.min(n,o),v=Math.max(n,o);return l-u<=e&&e<=f+u&&c-u<=r&&r<=v+u},Qd=function(e,r,a,n,i,o,s,u,l){var f={x1:Math.min(a,s,i)-l,x2:Math.max(a,s,i)+l,y1:Math.min(n,u,o)-l,y2:Math.max(n,u,o)+l};return!(e<f.x1||e>f.x2||r<f.y1||r>f.y2)},Jd=function(e,r,a,n){a-=n;var i=r*r-4*e*a;if(i<0)return[];var o=Math.sqrt(i),s=2*e,u=(-r+o)/s,l=(-r-o)/s;return[u,l]},jd=function(e,r,a,n,i){var o=1e-5;e===0&&(e=o),r/=e,a/=e,n/=e;var s,u,l,f,c,v,d,h;if(u=(3*a-r*r)/9,l=-(27*n)+r*(9*a-2*(r*r)),l/=54,s=u*u*u+l*l,i[1]=0,d=r/3,s>0){c=l+Math.sqrt(s),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),v=l-Math.sqrt(s),v=v<0?-Math.pow(-v,1/3):Math.pow(v,1/3),i[0]=-d+c+v,d+=(c+v)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-v+c)/2,i[3]=d,i[5]=-d;return}if(i[5]=i[3]=0,s===0){h=l<0?-Math.pow(-l,1/3):Math.pow(l,1/3),i[0]=-d+2*h,i[4]=i[2]=-(h+d);return}u=-u,f=u*u*u,f=Math.acos(l/Math.sqrt(f)),h=2*Math.sqrt(u),i[0]=-d+h*Math.cos(f/3),i[2]=-d+h*Math.cos((f+2*Math.PI)/3),i[4]=-d+h*Math.cos((f+4*Math.PI)/3)},eh=function(e,r,a,n,i,o,s,u){var l=1*a*a-4*a*i+2*a*s+4*i*i-4*i*s+s*s+n*n-4*n*o+2*n*u+4*o*o-4*o*u+u*u,f=9*a*i-3*a*a-3*a*s-6*i*i+3*i*s+9*n*o-3*n*n-3*n*u-6*o*o+3*o*u,c=3*a*a-6*a*i+a*s-a*e+2*i*i+2*i*e-s*e+3*n*n-6*n*o+n*u-n*r+2*o*o+2*o*r-u*r,v=1*a*i-a*a+a*e-i*e+n*o-n*n+n*r-o*r,d=[];jd(l,f,c,v,d);for(var h=1e-7,y=[],g=0;g<6;g+=2)Math.abs(d[g+1])<h&&d[g]>=0&&d[g]<=1&&y.push(d[g]);y.push(1),y.push(0);for(var p=-1,m,b,w,E=0;E<y.length;E++)m=Math.pow(1-y[E],2)*a+2*(1-y[E])*y[E]*i+y[E]*y[E]*s,b=Math.pow(1-y[E],2)*n+2*(1-y[E])*y[E]*o+y[E]*y[E]*u,w=Math.pow(m-e,2)+Math.pow(b-r,2),p>=0?w<p&&(p=w):p=w;return p},th=function(e,r,a,n,i,o){var s=[e-a,r-n],u=[i-a,o-n],l=u[0]*u[0]+u[1]*u[1],f=s[0]*s[0]+s[1]*s[1],c=s[0]*u[0]+s[1]*u[1],v=c*c/l;return c<0?f:v>l?(e-i)*(e-i)+(r-o)*(r-o):f-v},Ct=function(e,r,a){for(var n,i,o,s,u,l=0,f=0;f<a.length/2;f++)if(n=a[f*2],i=a[f*2+1],f+1<a.length/2?(o=a[(f+1)*2],s=a[(f+1)*2+1]):(o=a[(f+1-a.length/2)*2],s=a[(f+1-a.length/2)*2+1]),!(n==e&&o==e))if(n>=e&&e>=o||n<=e&&e<=o)u=(e-n)/(o-n)*(s-i)+i,u>r&&l++;else continue;return l%2!==0},Zt=function(e,r,a,n,i,o,s,u,l){var f=new Array(a.length),c;u[0]!=null?(c=Math.atan(u[1]/u[0]),u[0]<0?c=c+Math.PI/2:c=-c-Math.PI/2):c=u;for(var v=Math.cos(-c),d=Math.sin(-c),h=0;h<f.length/2;h++)f[h*2]=o/2*(a[h*2]*v-a[h*2+1]*d),f[h*2+1]=s/2*(a[h*2+1]*v+a[h*2]*d),f[h*2]+=n,f[h*2+1]+=i;var y;if(l>0){var g=Tn(f,-l);y=Cn(g)}else y=f;return Ct(e,r,y)},rh=function(e,r,a,n,i,o,s,u){for(var l=new Array(a.length*2),f=0;f<u.length;f++){var c=u[f];l[f*4+0]=c.startX,l[f*4+1]=c.startY,l[f*4+2]=c.stopX,l[f*4+3]=c.stopY;var v=Math.pow(c.cx-e,2)+Math.pow(c.cy-r,2);if(v<=Math.pow(c.radius,2))return!0}return Ct(e,r,l)},Cn=function(e){for(var r=new Array(e.length/2),a,n,i,o,s,u,l,f,c=0;c<e.length/4;c++){a=e[c*4],n=e[c*4+1],i=e[c*4+2],o=e[c*4+3],c<e.length/4-1?(s=e[(c+1)*4],u=e[(c+1)*4+1],l=e[(c+1)*4+2],f=e[(c+1)*4+3]):(s=e[0],u=e[1],l=e[2],f=e[3]);var v=ir(a,n,i,o,s,u,l,f,!0);r[c*2]=v[0],r[c*2+1]=v[1]}return r},Tn=function(e,r){for(var a=new Array(e.length*2),n,i,o,s,u=0;u<e.length/2;u++){n=e[u*2],i=e[u*2+1],u<e.length/2-1?(o=e[(u+1)*2],s=e[(u+1)*2+1]):(o=e[0],s=e[1]);var l=s-i,f=-(o-n),c=Math.sqrt(l*l+f*f),v=l/c,d=f/c;a[u*4]=n+v*r,a[u*4+1]=i+d*r,a[u*4+2]=o+v*r,a[u*4+3]=s+d*r}return a},ah=function(e,r,a,n,i,o){var s=a-e,u=n-r;s/=i,u/=o;var l=Math.sqrt(s*s+u*u),f=l-1;if(f<0)return[];var c=f/l;return[(a-e)*c+e,(n-r)*c+r]},Pr=function(e,r,a,n,i,o,s){return e-=i,r-=o,e/=a/2+s,r/=n/2+s,e*e+r*r<=1},ma=function(e,r,a,n,i,o,s){var u=[a-e,n-r],l=[e-i,r-o],f=u[0]*u[0]+u[1]*u[1],c=2*(l[0]*u[0]+l[1]*u[1]),v=l[0]*l[0]+l[1]*l[1]-s*s,d=c*c-4*f*v;if(d<0)return[];var h=(-c+Math.sqrt(d))/(2*f),y=(-c-Math.sqrt(d))/(2*f),g=Math.min(h,y),p=Math.max(h,y),m=[];if(g>=0&&g<=1&&m.push(g),p>=0&&p<=1&&m.push(p),m.length===0)return[];var b=m[0]*u[0]+e,w=m[0]*u[1]+r;if(m.length>1){if(m[0]==m[1])return[b,w];var E=m[1]*u[0]+e,C=m[1]*u[1]+r;return[b,w,E,C]}else return[b,w]},wi=function(e,r,a){return r<=e&&e<=a||a<=e&&e<=r?e:e<=r&&r<=a||a<=r&&r<=e?r:a},ir=function(e,r,a,n,i,o,s,u,l){var f=e-i,c=a-e,v=s-i,d=r-o,h=n-r,y=u-o,g=v*d-y*f,p=c*d-h*f,m=y*c-v*h;if(m!==0){var b=g/m,w=p/m,E=.001,C=0-E,x=1+E;return C<=b&&b<=x&&C<=w&&w<=x?[e+b*c,r+b*h]:l?[e+b*c,r+b*h]:[]}else return g===0||p===0?wi(e,a,s)===s?[s,u]:wi(e,a,i)===i?[i,o]:wi(i,s,a)===a?[a,n]:[]:[]},nh=function(e,r,a,n,i){var o=[],s=n/2,u=i/2,l=r,f=a;o.push({x:l+s*e[0],y:f+u*e[1]});for(var c=1;c<e.length/2;c++)o.push({x:l+s*e[c*2],y:f+u*e[c*2+1]});return o},Da=function(e,r,a,n,i,o,s,u){var l=[],f,c=new Array(a.length),v=!0;o==null&&(v=!1);var d;if(v){for(var h=0;h<c.length/2;h++)c[h*2]=a[h*2]*o+n,c[h*2+1]=a[h*2+1]*s+i;if(u>0){var y=Tn(c,-u);d=Cn(y)}else d=c}else d=a;for(var g,p,m,b,w=0;w<d.length/2;w++)g=d[w*2],p=d[w*2+1],w<d.length/2-1?(m=d[(w+1)*2],b=d[(w+1)*2+1]):(m=d[0],b=d[1]),f=ir(e,r,n,i,g,p,m,b),f.length!==0&&l.push(f[0],f[1]);return l},ih=function(e,r,a,n,i,o,s,u,l){var f=[],c,v=new Array(a.length*2);l.forEach(function(m,b){b===0?(v[v.length-2]=m.startX,v[v.length-1]=m.startY):(v[b*4-2]=m.startX,v[b*4-1]=m.startY),v[b*4]=m.stopX,v[b*4+1]=m.stopY,c=ma(e,r,n,i,m.cx,m.cy,m.radius),c.length!==0&&f.push(c[0],c[1])});for(var d=0;d<v.length/4;d++)c=ir(e,r,n,i,v[d*4],v[d*4+1],v[d*4+2],v[d*4+3],!1),c.length!==0&&f.push(c[0],c[1]);if(f.length>2){for(var h=[f[0],f[1]],y=Math.pow(h[0]-e,2)+Math.pow(h[1]-r,2),g=1;g<f.length/2;g++){var p=Math.pow(f[g*2]-e,2)+Math.pow(f[g*2+1]-r,2);p<=y&&(h[0]=f[g*2],h[1]=f[g*2+1],y=p)}return h}return f},Qa=function(e,r,a){var n=[e[0]-r[0],e[1]-r[1]],i=Math.sqrt(n[0]*n[0]+n[1]*n[1]),o=(i-a)/i;return o<0&&(o=1e-5),[r[0]+o*n[0],r[1]+o*n[1]]},yt=function(e,r){var a=Io(e,r);return a=Mf(a),a},Mf=function(e){for(var r,a,n=e.length/2,i=1/0,o=1/0,s=-1/0,u=-1/0,l=0;l<n;l++)r=e[2*l],a=e[2*l+1],i=Math.min(i,r),s=Math.max(s,r),o=Math.min(o,a),u=Math.max(u,a);for(var f=2/(s-i),c=2/(u-o),v=0;v<n;v++)r=e[2*v]=e[2*v]*f,a=e[2*v+1]=e[2*v+1]*c,i=Math.min(i,r),s=Math.max(s,r),o=Math.min(o,a),u=Math.max(u,a);if(o<-1)for(var d=0;d<n;d++)a=e[2*d+1]=e[2*d+1]+(-1-o);return e},Io=function(e,r){var a=1/e*2*Math.PI,n=e%2===0?Math.PI/2+a/2:Math.PI/2;n+=r;for(var i=new Array(e*2),o,s=0;s<e;s++)o=s*a+n,i[2*s]=Math.cos(o),i[2*s+1]=Math.sin(-o);return i},fr=function(e,r){return Math.min(e/4,r/4,8)},Lf=function(e,r){return Math.min(e/10,r/10,8)},us=function(){return 8},oh=function(e,r,a){return[e-2*r+a,2*(r-e),e]},Oo=function(e,r){return{heightOffset:Math.min(15,.05*r),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function xi(t,e){function r(c){for(var v=[],d=0;d<c.length;d++){var h=c[d],y=c[(d+1)%c.length],g={x:y.x-h.x,y:y.y-h.y},p={x:-g.y,y:g.x},m=Math.sqrt(p.x*p.x+p.y*p.y);v.push({x:p.x/m,y:p.y/m})}return v}function a(c,v){var d=1/0,h=-1/0,y=Tt(c),g;try{for(y.s();!(g=y.n()).done;){var p=g.value,m=p.x*v.x+p.y*v.y;d=Math.min(d,m),h=Math.max(h,m)}}catch(b){y.e(b)}finally{y.f()}return{min:d,max:h}}function n(c,v){return!(c.max<v.min||v.max<c.min)}var i=[].concat(bn(r(t)),bn(r(e))),o=Tt(i),s;try{for(o.s();!(s=o.n()).done;){var u=s.value,l=a(t,u),f=a(e,u);if(!n(l,f))return!1}}catch(c){o.e(c)}finally{o.f()}return!0}var sh=ct({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),lh={pageRank:function(e){for(var r=sh(e),a=r.dampingFactor,n=r.precision,i=r.iterations,o=r.weight,s=this._private.cy,u=this.byGroup(),l=u.nodes,f=u.edges,c=l.length,v=c*c,d=f.length,h=new Array(v),y=new Array(c),g=(1-a)/c,p=0;p<c;p++){for(var m=0;m<c;m++){var b=p*c+m;h[b]=0}y[p]=0}for(var w=0;w<d;w++){var E=f[w],C=E.data("source"),x=E.data("target");if(C!==x){var T=l.indexOfId(C),k=l.indexOfId(x),B=o(E),D=k*c+T;h[D]+=B,y[T]+=B}}for(var P=1/c+g,A=0;A<c;A++)if(y[A]===0)for(var R=0;R<c;R++){var L=R*c+A;h[L]=P}else for(var I=0;I<c;I++){var M=I*c+A;h[M]=h[M]/y[A]+g}for(var O=new Array(c),q=new Array(c),$,N=0;N<c;N++)O[N]=1;for(var F=0;F<i;F++){for(var W=0;W<c;W++)q[W]=0;for(var J=0;J<c;J++)for(var Z=0;Z<c;Z++){var j=J*c+Z;q[J]+=h[j]*O[Z]}_d(q),$=O,O=q,q=$;for(var te=0,ne=0;ne<c;ne++){var Q=$[ne]-O[ne];te+=Q*Q}if(te<n)break}var V={rank:function(G){return G=s.collection(G)[0],O[l.indexOf(G)]}};return V}},nl=ct({root:null,weight:function(e){return 1},directed:!1,alpha:0}),Yr={degreeCentralityNormalized:function(e){e=nl(e);var r=this.cy(),a=this.nodes(),n=a.length;if(e.directed){for(var f={},c={},v=0,d=0,h=0;h<n;h++){var y=a[h],g=y.id();e.root=y;var p=this.degreeCentrality(e);v<p.indegree&&(v=p.indegree),d<p.outdegree&&(d=p.outdegree),f[g]=p.indegree,c[g]=p.outdegree}return{indegree:function(b){return v==0?0:(he(b)&&(b=r.filter(b)),f[b.id()]/v)},outdegree:function(b){return d===0?0:(he(b)&&(b=r.filter(b)),c[b.id()]/d)}}}else{for(var i={},o=0,s=0;s<n;s++){var u=a[s];e.root=u;var l=this.degreeCentrality(e);o<l.degree&&(o=l.degree),i[u.id()]=l.degree}return{degree:function(b){return o===0?0:(he(b)&&(b=r.filter(b)),i[b.id()]/o)}}}},degreeCentrality:function(e){e=nl(e);var r=this.cy(),a=this,n=e,i=n.root,o=n.weight,s=n.directed,u=n.alpha;if(i=r.collection(i)[0],s){for(var d=i.connectedEdges(),h=d.filter(function(C){return C.target().same(i)&&a.has(C)}),y=d.filter(function(C){return C.source().same(i)&&a.has(C)}),g=h.length,p=y.length,m=0,b=0,w=0;w<h.length;w++)m+=o(h[w]);for(var E=0;E<y.length;E++)b+=o(y[E]);return{indegree:Math.pow(g,1-u)*Math.pow(m,u),outdegree:Math.pow(p,1-u)*Math.pow(b,u)}}else{for(var l=i.connectedEdges().intersection(a),f=l.length,c=0,v=0;v<l.length;v++)c+=o(l[v]);return{degree:Math.pow(f,1-u)*Math.pow(c,u)}}}};Yr.dc=Yr.degreeCentrality;Yr.dcn=Yr.degreeCentralityNormalised=Yr.degreeCentralityNormalized;var il=ct({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Zr={closenessCentralityNormalized:function(e){for(var r=il(e),a=r.harmonic,n=r.weight,i=r.directed,o=this.cy(),s={},u=0,l=this.nodes(),f=this.floydWarshall({weight:n,directed:i}),c=0;c<l.length;c++){for(var v=0,d=l[c],h=0;h<l.length;h++)if(c!==h){var y=f.distance(d,l[h]);a?v+=1/y:v+=y}a||(v=1/v),u<v&&(u=v),s[d.id()]=v}return{closeness:function(p){return u==0?0:(he(p)?p=o.filter(p)[0].id():p=p.id(),s[p]/u)}}},closenessCentrality:function(e){var r=il(e),a=r.root,n=r.weight,i=r.directed,o=r.harmonic;a=this.filter(a)[0];for(var s=this.dijkstra({root:a,weight:n,directed:i}),u=0,l=this.nodes(),f=0;f<l.length;f++){var c=l[f];if(!c.same(a)){var v=s.distanceTo(c);o?u+=1/v:u+=v}}return o?u:1/u}};Zr.cc=Zr.closenessCentrality;Zr.ccn=Zr.closenessCentralityNormalised=Zr.closenessCentralityNormalized;var uh=ct({weight:null,directed:!1}),No={betweennessCentrality:function(e){for(var r=uh(e),a=r.directed,n=r.weight,i=n!=null,o=this.cy(),s=this.nodes(),u={},l={},f=0,c={set:function(b,w){l[b]=w,w>f&&(f=w)},get:function(b){return l[b]}},v=0;v<s.length;v++){var d=s[v],h=d.id();a?u[h]=d.outgoers().nodes():u[h]=d.openNeighborhood().nodes(),c.set(h,0)}for(var y=function(){for(var b=s[g].id(),w=[],E={},C={},x={},T=new qa(function(J,Z){return x[J]-x[Z]}),k=0;k<s.length;k++){var B=s[k].id();E[B]=[],C[B]=0,x[B]=1/0}for(C[b]=1,x[b]=0,T.push(b);!T.empty();){var D=T.pop();if(w.push(D),i)for(var P=0;P<u[D].length;P++){var A=u[D][P],R=o.getElementById(D),L=void 0;R.edgesTo(A).length>0?L=R.edgesTo(A)[0]:L=A.edgesTo(R)[0];var I=n(L);A=A.id(),x[A]>x[D]+I&&(x[A]=x[D]+I,T.nodes.indexOf(A)<0?T.push(A):T.updateItem(A),C[A]=0,E[A]=[]),x[A]==x[D]+I&&(C[A]=C[A]+C[D],E[A].push(D))}else for(var M=0;M<u[D].length;M++){var O=u[D][M].id();x[O]==1/0&&(T.push(O),x[O]=x[D]+1),x[O]==x[D]+1&&(C[O]=C[O]+C[D],E[O].push(D))}}for(var q={},$=0;$<s.length;$++)q[s[$].id()]=0;for(;w.length>0;){for(var N=w.pop(),F=0;F<E[N].length;F++){var W=E[N][F];q[W]=q[W]+C[W]/C[N]*(1+q[N])}N!=s[g].id()&&c.set(N,c.get(N)+q[N])}},g=0;g<s.length;g++)y();var p={betweenness:function(b){var w=o.collection(b).id();return c.get(w)},betweennessNormalized:function(b){if(f==0)return 0;var w=o.collection(b).id();return c.get(w)/f}};return p.betweennessNormalised=p.betweennessNormalized,p}};No.bc=No.betweennessCentrality;var fh=ct({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(t){return 1}]}),ch=function(e){return fh(e)},vh=function(e,r){for(var a=0,n=0;n<r.length;n++)a+=r[n](e);return a},dh=function(e,r,a){for(var n=0;n<r;n++)e[n*r+n]=a},If=function(e,r){for(var a,n=0;n<r;n++){a=0;for(var i=0;i<r;i++)a+=e[i*r+n];for(var o=0;o<r;o++)e[o*r+n]=e[o*r+n]/a}},hh=function(e,r,a){for(var n=new Array(a*a),i=0;i<a;i++){for(var o=0;o<a;o++)n[i*a+o]=0;for(var s=0;s<a;s++)for(var u=0;u<a;u++)n[i*a+u]+=e[i*a+s]*r[s*a+u]}return n},gh=function(e,r,a){for(var n=e.slice(0),i=1;i<a;i++)e=hh(e,n,r);return e},ph=function(e,r,a){for(var n=new Array(r*r),i=0;i<r*r;i++)n[i]=Math.pow(e[i],a);return If(n,r),n},yh=function(e,r,a,n){for(var i=0;i<a;i++){var o=Math.round(e[i]*Math.pow(10,n))/Math.pow(10,n),s=Math.round(r[i]*Math.pow(10,n))/Math.pow(10,n);if(o!==s)return!1}return!0},mh=function(e,r,a,n){for(var i=[],o=0;o<r;o++){for(var s=[],u=0;u<r;u++)Math.round(e[o*r+u]*1e3)/1e3>0&&s.push(a[u]);s.length!==0&&i.push(n.collection(s))}return i},bh=function(e,r){for(var a=0;a<e.length;a++)if(!r[a]||e[a].id()!==r[a].id())return!1;return!0},wh=function(e){for(var r=0;r<e.length;r++)for(var a=0;a<e.length;a++)r!=a&&bh(e[r],e[a])&&e.splice(a,1);return e},ol=function(e){for(var r=this.nodes(),a=this.edges(),n=this.cy(),i=ch(e),o={},s=0;s<r.length;s++)o[r[s].id()]=s;for(var u=r.length,l=u*u,f=new Array(l),c,v=0;v<l;v++)f[v]=0;for(var d=0;d<a.length;d++){var h=a[d],y=o[h.source().id()],g=o[h.target().id()],p=vh(h,i.attributes);f[y*u+g]+=p,f[g*u+y]+=p}dh(f,u,i.multFactor),If(f,u);for(var m=!0,b=0;m&&b<i.maxIterations;)m=!1,c=gh(f,u,i.expandFactor),f=ph(c,u,i.inflateFactor),yh(f,c,l,4)||(m=!0),b++;var w=mh(f,u,r,n);return w=wh(w),w},xh={markovClustering:ol,mcl:ol},Eh=function(e){return e},Of=function(e,r){return Math.abs(r-e)},sl=function(e,r,a){return e+Of(r,a)},ll=function(e,r,a){return e+Math.pow(a-r,2)},Ch=function(e){return Math.sqrt(e)},Th=function(e,r,a){return Math.max(e,Of(r,a))},ca=function(e,r,a,n,i){for(var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:Eh,s=n,u,l,f=0;f<e;f++)u=r(f),l=a(f),s=i(s,u,l);return o(s)},jr={euclidean:function(e,r,a){return e>=2?ca(e,r,a,0,ll,Ch):ca(e,r,a,0,sl)},squaredEuclidean:function(e,r,a){return ca(e,r,a,0,ll)},manhattan:function(e,r,a){return ca(e,r,a,0,sl)},max:function(e,r,a){return ca(e,r,a,-1/0,Th)}};jr["squared-euclidean"]=jr.squaredEuclidean;jr.squaredeuclidean=jr.squaredEuclidean;function zn(t,e,r,a,n,i){var o;return We(t)?o=t:o=jr[t]||jr.euclidean,e===0&&We(t)?o(n,i):o(e,r,a,n,i)}var Sh=ct({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),fs=function(e){return Sh(e)},Sn=function(e,r,a,n,i){var o=i!=="kMedoids",s=o?function(c){return a[c]}:function(c){return n[c](a)},u=function(v){return n[v](r)},l=a,f=r;return zn(e,n.length,s,u,l,f)},Ei=function(e,r,a){for(var n=a.length,i=new Array(n),o=new Array(n),s=new Array(r),u=null,l=0;l<n;l++)i[l]=e.min(a[l]).value,o[l]=e.max(a[l]).value;for(var f=0;f<r;f++){u=[];for(var c=0;c<n;c++)u[c]=Math.random()*(o[c]-i[c])+i[c];s[f]=u}return s},Nf=function(e,r,a,n,i){for(var o=1/0,s=0,u=0;u<r.length;u++){var l=Sn(a,e,r[u],n,i);l<o&&(o=l,s=u)}return s},zf=function(e,r,a){for(var n=[],i=null,o=0;o<r.length;o++)i=r[o],a[i.id()]===e&&n.push(i);return n},kh=function(e,r,a){return Math.abs(r-e)<=a},Bh=function(e,r,a){for(var n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++){var o=Math.abs(e[n][i]-r[n][i]);if(o>a)return!1}return!0},Dh=function(e,r,a){for(var n=0;n<a;n++)if(e===r[n])return!0;return!1},ul=function(e,r){var a=new Array(r);if(e.length<50)for(var n=0;n<r;n++){for(var i=e[Math.floor(Math.random()*e.length)];Dh(i,a,n);)i=e[Math.floor(Math.random()*e.length)];a[n]=i}else for(var o=0;o<r;o++)a[o]=e[Math.floor(Math.random()*e.length)];return a},fl=function(e,r,a){for(var n=0,i=0;i<r.length;i++)n+=Sn("manhattan",r[i],e,a,"kMedoids");return n},Ph=function(e){var r=this.cy(),a=this.nodes(),n=null,i=fs(e),o=new Array(i.k),s={},u;i.testMode?typeof i.testCentroids=="number"?(i.testCentroids,u=Ei(a,i.k,i.attributes)):rt(i.testCentroids)==="object"?u=i.testCentroids:u=Ei(a,i.k,i.attributes):u=Ei(a,i.k,i.attributes);for(var l=!0,f=0;l&&f<i.maxIterations;){for(var c=0;c<a.length;c++)n=a[c],s[n.id()]=Nf(n,u,i.distance,i.attributes,"kMeans");l=!1;for(var v=0;v<i.k;v++){var d=zf(v,a,s);if(d.length!==0){for(var h=i.attributes.length,y=u[v],g=new Array(h),p=new Array(h),m=0;m<h;m++){p[m]=0;for(var b=0;b<d.length;b++)n=d[b],p[m]+=i.attributes[m](n);g[m]=p[m]/d.length,kh(g[m],y[m],i.sensitivityThreshold)||(l=!0)}u[v]=g,o[v]=r.collection(d)}}f++}return o},Ah=function(e){var r=this.cy(),a=this.nodes(),n=null,i=fs(e),o=new Array(i.k),s,u={},l,f=new Array(i.k);i.testMode?typeof i.testCentroids=="number"||(rt(i.testCentroids)==="object"?s=i.testCentroids:s=ul(a,i.k)):s=ul(a,i.k);for(var c=!0,v=0;c&&v<i.maxIterations;){for(var d=0;d<a.length;d++)n=a[d],u[n.id()]=Nf(n,s,i.distance,i.attributes,"kMedoids");c=!1;for(var h=0;h<s.length;h++){var y=zf(h,a,u);if(y.length!==0){f[h]=fl(s[h],y,i.attributes);for(var g=0;g<y.length;g++)l=fl(y[g],y,i.attributes),l<f[h]&&(f[h]=l,s[h]=y[g],c=!0);o[h]=r.collection(y)}}v++}return o},Rh=function(e,r,a,n,i){for(var o,s,u=0;u<r.length;u++)for(var l=0;l<e.length;l++)n[u][l]=Math.pow(a[u][l],i.m);for(var f=0;f<e.length;f++)for(var c=0;c<i.attributes.length;c++){o=0,s=0;for(var v=0;v<r.length;v++)o+=n[v][f]*i.attributes[c](r[v]),s+=n[v][f];e[f][c]=o/s}},Mh=function(e,r,a,n,i){for(var o=0;o<e.length;o++)r[o]=e[o].slice();for(var s,u,l,f=2/(i.m-1),c=0;c<a.length;c++)for(var v=0;v<n.length;v++){s=0;for(var d=0;d<a.length;d++)u=Sn(i.distance,n[v],a[c],i.attributes,"cmeans"),l=Sn(i.distance,n[v],a[d],i.attributes,"cmeans"),s+=Math.pow(u/l,f);e[v][c]=1/s}},Lh=function(e,r,a,n){for(var i=new Array(a.k),o=0;o<i.length;o++)i[o]=[];for(var s,u,l=0;l<r.length;l++){s=-1/0,u=-1;for(var f=0;f<r[0].length;f++)r[l][f]>s&&(s=r[l][f],u=f);i[u].push(e[l])}for(var c=0;c<i.length;c++)i[c]=n.collection(i[c]);return i},cl=function(e){var r=this.cy(),a=this.nodes(),n=fs(e),i,o,s,u,l;u=new Array(a.length);for(var f=0;f<a.length;f++)u[f]=new Array(n.k);s=new Array(a.length);for(var c=0;c<a.length;c++)s[c]=new Array(n.k);for(var v=0;v<a.length;v++){for(var d=0,h=0;h<n.k;h++)s[v][h]=Math.random(),d+=s[v][h];for(var y=0;y<n.k;y++)s[v][y]=s[v][y]/d}o=new Array(n.k);for(var g=0;g<n.k;g++)o[g]=new Array(n.attributes.length);l=new Array(a.length);for(var p=0;p<a.length;p++)l[p]=new Array(n.k);for(var m=!0,b=0;m&&b<n.maxIterations;)m=!1,Rh(o,a,s,l,n),Mh(s,u,o,a,n),Bh(s,u,n.sensitivityThreshold)||(m=!0),b++;return i=Lh(a,s,n,r),{clusters:i,degreeOfMembership:s}},Ih={kMeans:Ph,kMedoids:Ah,fuzzyCMeans:cl,fcm:cl},Oh=ct({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),Nh={single:"min",complete:"max"},zh=function(e){var r=Oh(e),a=Nh[r.linkage];return a!=null&&(r.linkage=a),r},vl=function(e,r,a,n,i){for(var o=0,s=1/0,u,l=i.attributes,f=function(k,B){return zn(i.distance,l.length,function(D){return l[D](k)},function(D){return l[D](B)},k,B)},c=0;c<e.length;c++){var v=e[c].key,d=a[v][n[v]];d<s&&(o=v,s=d)}if(i.mode==="threshold"&&s>=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var h=r[o],y=r[n[o]],g;i.mode==="dendrogram"?g={left:h,right:y,key:h.key}:g={value:h.value.concat(y.value),key:h.key},e[h.index]=g,e.splice(y.index,1),r[h.key]=g;for(var p=0;p<e.length;p++){var m=e[p];h.key===m.key?u=1/0:i.linkage==="min"?(u=a[h.key][m.key],a[h.key][m.key]>a[y.key][m.key]&&(u=a[y.key][m.key])):i.linkage==="max"?(u=a[h.key][m.key],a[h.key][m.key]<a[y.key][m.key]&&(u=a[y.key][m.key])):i.linkage==="mean"?u=(a[h.key][m.key]*h.size+a[y.key][m.key]*y.size)/(h.size+y.size):i.mode==="dendrogram"?u=f(m.value,h.value):u=f(m.value[0],h.value[0]),a[h.key][m.key]=a[m.key][h.key]=u}for(var b=0;b<e.length;b++){var w=e[b].key;if(n[w]===h.key||n[w]===y.key){for(var E=w,C=0;C<e.length;C++){var x=e[C].key;a[w][x]<a[w][E]&&(E=x)}n[w]=E}e[b].index=b}return h.key=y.key=h.index=y.index=null,!0},Wr=function(e,r,a){e&&(e.value?r.push(e.value):(e.left&&Wr(e.left,r),e.right&&Wr(e.right,r)))},zo=function(e,r){if(!e)return"";if(e.left&&e.right){var a=zo(e.left,r),n=zo(e.right,r),i=r.add({group:"nodes",data:{id:a+","+n}});return r.add({group:"edges",data:{source:a,target:i.id()}}),r.add({group:"edges",data:{source:n,target:i.id()}}),i.id()}else if(e.value)return e.value.id()},Fo=function(e,r,a){if(!e)return[];var n=[],i=[],o=[];return r===0?(e.left&&Wr(e.left,n),e.right&&Wr(e.right,i),o=n.concat(i),[a.collection(o)]):r===1?e.value?[a.collection(e.value)]:(e.left&&Wr(e.left,n),e.right&&Wr(e.right,i),[a.collection(n),a.collection(i)]):e.value?[a.collection(e.value)]:(e.left&&(n=Fo(e.left,r-1,a)),e.right&&(i=Fo(e.right,r-1,a)),n.concat(i))},dl=function(e){for(var r=this.cy(),a=this.nodes(),n=zh(e),i=n.attributes,o=function(b,w){return zn(n.distance,i.length,function(E){return i[E](b)},function(E){return i[E](w)},b,w)},s=[],u=[],l=[],f=[],c=0;c<a.length;c++){var v={value:n.mode==="dendrogram"?a[c]:[a[c]],key:c,index:c};s[c]=v,f[c]=v,u[c]=[],l[c]=0}for(var d=0;d<s.length;d++)for(var h=0;h<=d;h++){var y=void 0;n.mode==="dendrogram"?y=d===h?1/0:o(s[d].value,s[h].value):y=d===h?1/0:o(s[d].value[0],s[h].value[0]),u[d][h]=y,u[h][d]=y,y<u[d][l[d]]&&(l[d]=h)}for(var g=vl(s,f,u,l,n);g;)g=vl(s,f,u,l,n);var p;return n.mode==="dendrogram"?(p=Fo(s[0],n.dendrogramDepth,r),n.addDendrogram&&zo(s[0],r)):(p=new Array(s.length),s.forEach(function(m,b){m.key=m.index=null,p[b]=r.collection(m.value)})),p},Fh={hierarchicalClustering:dl,hca:dl},Vh=ct({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),qh=function(e){var r=e.damping,a=e.preference;.5<=r&&r<1||Ge("Damping must range on [0.5, 1). Got: ".concat(r));var n=["median","mean","min","max"];return n.some(function(i){return i===a})||ae(a)||Ge("Preference must be one of [".concat(n.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(a)),Vh(e)},$h=function(e,r,a,n){var i=function(s,u){return n[u](s)};return-zn(e,n.length,function(o){return i(r,o)},function(o){return i(a,o)},r,a)},_h=function(e,r){var a=null;return r==="median"?a=qd(e):r==="mean"?a=Vd(e):r==="min"?a=zd(e):r==="max"?a=Fd(e):a=r,a},Hh=function(e,r,a){for(var n=[],i=0;i<e;i++)r[i*e+i]+a[i*e+i]>0&&n.push(i);return n},hl=function(e,r,a){for(var n=[],i=0;i<e;i++){for(var o=-1,s=-1/0,u=0;u<a.length;u++){var l=a[u];r[i*e+l]>s&&(o=l,s=r[i*e+l])}o>0&&n.push(o)}for(var f=0;f<a.length;f++)n[a[f]]=a[f];return n},Gh=function(e,r,a){for(var n=hl(e,r,a),i=0;i<a.length;i++){for(var o=[],s=0;s<n.length;s++)n[s]===a[i]&&o.push(s);for(var u=-1,l=-1/0,f=0;f<o.length;f++){for(var c=0,v=0;v<o.length;v++)c+=r[o[v]*e+o[f]];c>l&&(u=f,l=c)}a[i]=o[u]}return n=hl(e,r,a),n},gl=function(e){for(var r=this.cy(),a=this.nodes(),n=qh(e),i={},o=0;o<a.length;o++)i[a[o].id()]=o;var s,u,l,f,c,v;s=a.length,u=s*s,l=new Array(u);for(var d=0;d<u;d++)l[d]=-1/0;for(var h=0;h<s;h++)for(var y=0;y<s;y++)h!==y&&(l[h*s+y]=$h(n.distance,a[h],a[y],n.attributes));f=_h(l,n.preference);for(var g=0;g<s;g++)l[g*s+g]=f;c=new Array(u);for(var p=0;p<u;p++)c[p]=0;v=new Array(u);for(var m=0;m<u;m++)v[m]=0;for(var b=new Array(s),w=new Array(s),E=new Array(s),C=0;C<s;C++)b[C]=0,w[C]=0,E[C]=0;for(var x=new Array(s*n.minIterations),T=0;T<x.length;T++)x[T]=0;var k;for(k=0;k<n.maxIterations;k++){for(var B=0;B<s;B++){for(var D=-1/0,P=-1/0,A=-1,R=0,L=0;L<s;L++)b[L]=c[B*s+L],R=v[B*s+L]+l[B*s+L],R>=D?(P=D,D=R,A=L):R>P&&(P=R);for(var I=0;I<s;I++)c[B*s+I]=(1-n.damping)*(l[B*s+I]-D)+n.damping*b[I];c[B*s+A]=(1-n.damping)*(l[B*s+A]-P)+n.damping*b[A]}for(var M=0;M<s;M++){for(var O=0,q=0;q<s;q++)b[q]=v[q*s+M],w[q]=Math.max(0,c[q*s+M]),O+=w[q];O-=w[M],w[M]=c[M*s+M],O+=w[M];for(var $=0;$<s;$++)v[$*s+M]=(1-n.damping)*Math.min(0,O-w[$])+n.damping*b[$];v[M*s+M]=(1-n.damping)*(O-w[M])+n.damping*b[M]}for(var N=0,F=0;F<s;F++){var W=v[F*s+F]+c[F*s+F]>0?1:0;x[k%n.minIterations*s+F]=W,N+=W}if(N>0&&(k>=n.minIterations-1||k==n.maxIterations-1)){for(var J=0,Z=0;Z<s;Z++){E[Z]=0;for(var j=0;j<n.minIterations;j++)E[Z]+=x[j*s+Z];(E[Z]===0||E[Z]===n.minIterations)&&J++}if(J===s)break}}for(var te=Hh(s,c,v),ne=Gh(s,l,te),Q={},V=0;V<te.length;V++)Q[te[V]]=[];for(var H=0;H<a.length;H++){var G=i[a[H].id()],Y=ne[G];Y!=null&&Q[Y].push(a[H])}for(var re=new Array(te.length),ve=0;ve<te.length;ve++)re[ve]=r.collection(Q[te[ve]]);return re},Uh={affinityPropagation:gl,ap:gl},Wh=ct({root:void 0,directed:!1}),Kh={hierholzer:function(e){if(!Me(e)){var r=arguments;e={root:r[0],directed:r[1]}}var a=Wh(e),n=a.root,i=a.directed,o=this,s=!1,u,l,f;n&&(f=he(n)?this.filter(n)[0].id():n[0].id());var c={},v={};i?o.forEach(function(m){var b=m.id();if(m.isNode()){var w=m.indegree(!0),E=m.outdegree(!0),C=w-E,x=E-w;C==1?u?s=!0:u=b:x==1?l?s=!0:l=b:(x>1||C>1)&&(s=!0),c[b]=[],m.outgoers().forEach(function(T){T.isEdge()&&c[b].push(T.id())})}else v[b]=[void 0,m.target().id()]}):o.forEach(function(m){var b=m.id();if(m.isNode()){var w=m.degree(!0);w%2&&(u?l?s=!0:l=b:u=b),c[b]=[],m.connectedEdges().forEach(function(E){return c[b].push(E.id())})}else v[b]=[m.source().id(),m.target().id()]});var d={found:!1,trail:void 0};if(s)return d;if(l&&u)if(i){if(f&&l!=f)return d;f=l}else{if(f&&l!=f&&u!=f)return d;f||(f=l)}else f||(f=o[0].id());var h=function(b){for(var w=b,E=[b],C,x,T;c[w].length;)C=c[w].shift(),x=v[C][0],T=v[C][1],w!=T?(c[T]=c[T].filter(function(k){return k!=C}),w=T):!i&&w!=x&&(c[x]=c[x].filter(function(k){return k!=C}),w=x),E.unshift(C),E.unshift(w);return E},y=[],g=[];for(g=h(f);g.length!=1;)c[g[0]].length==0?(y.unshift(o.getElementById(g.shift())),y.unshift(o.getElementById(g.shift()))):g=h(g.shift()).concat(g);y.unshift(o.getElementById(g.shift()));for(var p in c)if(c[p].length)return d;return d.found=!0,d.trail=this.spawn(y,!0),d}},Ja=function(){var e=this,r={},a=0,n=0,i=[],o=[],s={},u=function(v,d){for(var h=o.length-1,y=[],g=e.spawn();o[h].x!=v||o[h].y!=d;)y.push(o.pop().edge),h--;y.push(o.pop().edge),y.forEach(function(p){var m=p.connectedNodes().intersection(e);g.merge(p),m.forEach(function(b){var w=b.id(),E=b.connectedEdges().intersection(e);g.merge(b),r[w].cutVertex?g.merge(E.filter(function(C){return C.isLoop()})):g.merge(E)})}),i.push(g)},l=function(v,d,h){v===h&&(n+=1),r[d]={id:a,low:a++,cutVertex:!1};var y=e.getElementById(d).connectedEdges().intersection(e);if(y.size()===0)i.push(e.spawn(e.getElementById(d)));else{var g,p,m,b;y.forEach(function(w){g=w.source().id(),p=w.target().id(),m=g===d?p:g,m!==h&&(b=w.id(),s[b]||(s[b]=!0,o.push({x:d,y:m,edge:w})),m in r?r[d].low=Math.min(r[d].low,r[m].id):(l(v,m,d),r[d].low=Math.min(r[d].low,r[m].low),r[d].id<=r[m].low&&(r[d].cutVertex=!0,u(d,m))))})}};e.forEach(function(c){if(c.isNode()){var v=c.id();v in r||(n=0,l(v,v),r[v].cutVertex=n>1)}});var f=Object.keys(r).filter(function(c){return r[c].cutVertex}).map(function(c){return e.getElementById(c)});return{cut:e.spawn(f),components:i}},Xh={hopcroftTarjanBiconnected:Ja,htbc:Ja,htb:Ja,hopcroftTarjanBiconnectedComponents:Ja},ja=function(){var e=this,r={},a=0,n=[],i=[],o=e.spawn(e),s=function(l){i.push(l),r[l]={index:a,low:a++,explored:!1};var f=e.getElementById(l).connectedEdges().intersection(e);if(f.forEach(function(y){var g=y.target().id();g!==l&&(g in r||s(g),r[g].explored||(r[l].low=Math.min(r[l].low,r[g].low)))}),r[l].index===r[l].low){for(var c=e.spawn();;){var v=i.pop();if(c.merge(e.getElementById(v)),r[v].low=r[l].index,r[v].explored=!0,v===l)break}var d=c.edgesWith(c),h=c.merge(d);n.push(h),o=o.difference(h)}};return e.forEach(function(u){if(u.isNode()){var l=u.id();l in r||s(l)}}),{cut:o,components:n}},Yh={tarjanStronglyConnected:ja,tsc:ja,tscc:ja,tarjanStronglyConnectedComponents:ja},Ff={};[ka,Sd,kd,Dd,Ad,Md,Od,lh,Yr,Zr,No,xh,Ih,Fh,Uh,Kh,Xh,Yh].forEach(function(t){ye(Ff,t)});var Vf=0,qf=1,$f=2,Nt=function(e){if(!(this instanceof Nt))return new Nt(e);this.id="Thenable/1.0.7",this.state=Vf,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e=="function"&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};Nt.prototype={fulfill:function(e){return pl(this,qf,"fulfillValue",e)},reject:function(e){return pl(this,$f,"rejectReason",e)},then:function(e,r){var a=this,n=new Nt;return a.onFulfilled.push(ml(e,n,"fulfill")),a.onRejected.push(ml(r,n,"reject")),_f(a),n.proxy}};var pl=function(e,r,a,n){return e.state===Vf&&(e.state=r,e[a]=n,_f(e)),e},_f=function(e){e.state===qf?yl(e,"onFulfilled",e.fulfillValue):e.state===$f&&yl(e,"onRejected",e.rejectReason)},yl=function(e,r,a){if(e[r].length!==0){var n=e[r];e[r]=[];var i=function(){for(var s=0;s<n.length;s++)n[s](a)};typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}},ml=function(e,r,a){return function(n){if(typeof e!="function")r[a].call(r,n);else{var i;try{i=e(n)}catch(o){r.reject(o);return}Hf(r,i)}}},Hf=function(e,r){if(e===r||e.proxy===r){e.reject(new TypeError("cannot resolve promise with itself"));return}var a;if(rt(r)==="object"&&r!==null||typeof r=="function")try{a=r.then}catch(i){e.reject(i);return}if(typeof a=="function"){var n=!1;try{a.call(r,function(i){n||(n=!0,i===r?e.reject(new TypeError("circular thenable chain")):Hf(e,i))},function(i){n||(n=!0,e.reject(i))})}catch(i){n||e.reject(i)}return}e.fulfill(r)};Nt.all=function(t){return new Nt(function(e,r){for(var a=new Array(t.length),n=0,i=function(u,l){a[u]=l,n++,n===t.length&&e(a)},o=0;o<t.length;o++)(function(s){var u=t[s],l=u!=null&&u.then!=null;if(l)u.then(function(c){i(s,c)},function(c){r(c)});else{var f=u;i(s,f)}})(o)})};Nt.resolve=function(t){return new Nt(function(e,r){e(t)})};Nt.reject=function(t){return new Nt(function(e,r){r(t)})};var ra=typeof Promise<"u"?Promise:Nt,Vo=function(e,r,a){var n=es(e),i=!n,o=this._private=ye({duration:1e3},r,a);if(o.target=e,o.style=o.style||o.css,o.started=!1,o.playing=!1,o.hooked=!1,o.applying=!1,o.progress=0,o.completes=[],o.frames=[],o.complete&&We(o.complete)&&o.completes.push(o.complete),i){var s=e.position();o.startPosition=o.startPosition||{x:s.x,y:s.y},o.startStyle=o.startStyle||e.cy().style().getAnimationStartStyle(e,o.style)}if(n){var u=e.pan();o.startPan={x:u.x,y:u.y},o.startZoom=e.zoom()}this.length=1,this[0]=this},Mr=Vo.prototype;ye(Mr,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var r,a=e.target._private.animation;e.queue?r=a.queue:r=a.current,r.push(this),St(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return e.progress===1&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var r=this._private;return e===void 0?r.progress*r.duration:this.progress(e/r.duration)},progress:function(e){var r=this._private,a=r.playing;return e===void 0?r.progress:(a&&this.pause(),r.progress=e,r.started=!1,a&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,r=e.playing;r&&this.pause(),e.progress=1-e.progress,e.started=!1;var a=function(l,f){var c=e[l];c!=null&&(e[l]=e[f],e[f]=c)};if(a("zoom","startZoom"),a("pan","startPan"),a("position","startPosition"),e.style)for(var n=0;n<e.style.length;n++){var i=e.style[n],o=i.name,s=e.startStyle[o];e.startStyle[o]=i,e.style[n]=s}return r&&this.play(),this},promise:function(e){var r=this._private,a;switch(e){case"frame":a=r.frames;break;default:case"complete":case"completed":a=r.completes}return new ra(function(n,i){a.push(function(){n()})})}});Mr.complete=Mr.completed;Mr.run=Mr.play;Mr.running=Mr.playing;var Zh={animated:function(){return function(){var r=this,a=r.length!==void 0,n=a?r:[r],i=this._private.cy||this;if(!i.styleEnabled())return!1;var o=n[0];if(o)return o._private.animation.current.length>0}},clearQueue:function(){return function(){var r=this,a=r.length!==void 0,n=a?r:[r],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var o=0;o<n.length;o++){var s=n[o];s._private.animation.queue=[]}return this}},delay:function(){return function(r,a){var n=this._private.cy||this;return n.styleEnabled()?this.animate({delay:r,duration:r,complete:a}):this}},delayAnimation:function(){return function(r,a){var n=this._private.cy||this;return n.styleEnabled()?this.animation({delay:r,duration:r,complete:a}):this}},animation:function(){return function(r,a){var n=this,i=n.length!==void 0,o=i?n:[n],s=this._private.cy||this,u=!i,l=!u;if(!s.styleEnabled())return this;var f=s.style();r=ye({},r,a);var c=Object.keys(r).length===0;if(c)return new Vo(o[0],r);switch(r.duration===void 0&&(r.duration=400),r.duration){case"slow":r.duration=600;break;case"fast":r.duration=200;break}if(l&&(r.style=f.getPropsList(r.style||r.css),r.css=void 0),l&&r.renderedPosition!=null){var v=r.renderedPosition,d=s.pan(),h=s.zoom();r.position=Df(v,h,d)}if(u&&r.panBy!=null){var y=r.panBy,g=s.pan();r.pan={x:g.x+y.x,y:g.y+y.y}}var p=r.center||r.centre;if(u&&p!=null){var m=s.getCenterPan(p.eles,r.zoom);m!=null&&(r.pan=m)}if(u&&r.fit!=null){var b=r.fit,w=s.getFitViewport(b.eles||b.boundingBox,b.padding);w!=null&&(r.pan=w.pan,r.zoom=w.zoom)}if(u&&Me(r.zoom)){var E=s.getZoomedViewport(r.zoom);E!=null?(E.zoomed&&(r.zoom=E.zoom),E.panned&&(r.pan=E.pan)):r.zoom=null}return new Vo(o[0],r)}},animate:function(){return function(r,a){var n=this,i=n.length!==void 0,o=i?n:[n],s=this._private.cy||this;if(!s.styleEnabled())return this;a&&(r=ye({},r,a));for(var u=0;u<o.length;u++){var l=o[u],f=l.animated()&&(r.queue===void 0||r.queue),c=l.animation(r,f?{queue:!0}:void 0);c.play()}return this}},stop:function(){return function(r,a){var n=this,i=n.length!==void 0,o=i?n:[n],s=this._private.cy||this;if(!s.styleEnabled())return this;for(var u=0;u<o.length;u++){for(var l=o[u],f=l._private,c=f.animation.current,v=0;v<c.length;v++){var d=c[v],h=d._private;a&&(h.duration=0)}r&&(f.animation.queue=[]),a||(f.animation.current=[])}return s.notify("draw"),this}}},Ci,bl;function Fn(){if(bl)return Ci;bl=1;var t=Array.isArray;return Ci=t,Ci}var Ti,wl;function Qh(){if(wl)return Ti;wl=1;var t=Fn(),e=Fa(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function n(i,o){if(t(i))return!1;var s=typeof i;return s=="number"||s=="symbol"||s=="boolean"||i==null||e(i)?!0:a.test(i)||!r.test(i)||o!=null&&i in Object(o)}return Ti=n,Ti}var Si,xl;function Jh(){if(xl)return Si;xl=1;var t=bf(),e=za(),r="[object AsyncFunction]",a="[object Function]",n="[object GeneratorFunction]",i="[object Proxy]";function o(s){if(!e(s))return!1;var u=t(s);return u==a||u==n||u==r||u==i}return Si=o,Si}var ki,El;function jh(){if(El)return ki;El=1;var t=In(),e=t["__core-js_shared__"];return ki=e,ki}var Bi,Cl;function eg(){if(Cl)return Bi;Cl=1;var t=jh(),e=(function(){var a=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""})();function r(a){return!!e&&e in a}return Bi=r,Bi}var Di,Tl;function tg(){if(Tl)return Di;Tl=1;var t=Function.prototype,e=t.toString;function r(a){if(a!=null){try{return e.call(a)}catch{}try{return a+""}catch{}}return""}return Di=r,Di}var Pi,Sl;function rg(){if(Sl)return Pi;Sl=1;var t=Jh(),e=eg(),r=za(),a=tg(),n=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,u=o.toString,l=s.hasOwnProperty,f=RegExp("^"+u.call(l).replace(n,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function c(v){if(!r(v)||e(v))return!1;var d=t(v)?f:i;return d.test(a(v))}return Pi=c,Pi}var Ai,kl;function ag(){if(kl)return Ai;kl=1;function t(e,r){return e?.[r]}return Ai=t,Ai}var Ri,Bl;function cs(){if(Bl)return Ri;Bl=1;var t=rg(),e=ag();function r(a,n){var i=e(a,n);return t(i)?i:void 0}return Ri=r,Ri}var Mi,Dl;function Vn(){if(Dl)return Mi;Dl=1;var t=cs(),e=t(Object,"create");return Mi=e,Mi}var Li,Pl;function ng(){if(Pl)return Li;Pl=1;var t=Vn();function e(){this.__data__=t?t(null):{},this.size=0}return Li=e,Li}var Ii,Al;function ig(){if(Al)return Ii;Al=1;function t(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}return Ii=t,Ii}var Oi,Rl;function og(){if(Rl)return Oi;Rl=1;var t=Vn(),e="__lodash_hash_undefined__",r=Object.prototype,a=r.hasOwnProperty;function n(i){var o=this.__data__;if(t){var s=o[i];return s===e?void 0:s}return a.call(o,i)?o[i]:void 0}return Oi=n,Oi}var Ni,Ml;function sg(){if(Ml)return Ni;Ml=1;var t=Vn(),e=Object.prototype,r=e.hasOwnProperty;function a(n){var i=this.__data__;return t?i[n]!==void 0:r.call(i,n)}return Ni=a,Ni}var zi,Ll;function lg(){if(Ll)return zi;Ll=1;var t=Vn(),e="__lodash_hash_undefined__";function r(a,n){var i=this.__data__;return this.size+=this.has(a)?0:1,i[a]=t&&n===void 0?e:n,this}return zi=r,zi}var Fi,Il;function ug(){if(Il)return Fi;Il=1;var t=ng(),e=ig(),r=og(),a=sg(),n=lg();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=a,i.prototype.set=n,Fi=i,Fi}var Vi,Ol;function fg(){if(Ol)return Vi;Ol=1;function t(){this.__data__=[],this.size=0}return Vi=t,Vi}var qi,Nl;function Gf(){if(Nl)return qi;Nl=1;function t(e,r){return e===r||e!==e&&r!==r}return qi=t,qi}var $i,zl;function qn(){if(zl)return $i;zl=1;var t=Gf();function e(r,a){for(var n=r.length;n--;)if(t(r[n][0],a))return n;return-1}return $i=e,$i}var _i,Fl;function cg(){if(Fl)return _i;Fl=1;var t=qn(),e=Array.prototype,r=e.splice;function a(n){var i=this.__data__,o=t(i,n);if(o<0)return!1;var s=i.length-1;return o==s?i.pop():r.call(i,o,1),--this.size,!0}return _i=a,_i}var Hi,Vl;function vg(){if(Vl)return Hi;Vl=1;var t=qn();function e(r){var a=this.__data__,n=t(a,r);return n<0?void 0:a[n][1]}return Hi=e,Hi}var Gi,ql;function dg(){if(ql)return Gi;ql=1;var t=qn();function e(r){return t(this.__data__,r)>-1}return Gi=e,Gi}var Ui,$l;function hg(){if($l)return Ui;$l=1;var t=qn();function e(r,a){var n=this.__data__,i=t(n,r);return i<0?(++this.size,n.push([r,a])):n[i][1]=a,this}return Ui=e,Ui}var Wi,_l;function gg(){if(_l)return Wi;_l=1;var t=fg(),e=cg(),r=vg(),a=dg(),n=hg();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=a,i.prototype.set=n,Wi=i,Wi}var Ki,Hl;function pg(){if(Hl)return Ki;Hl=1;var t=cs(),e=In(),r=t(e,"Map");return Ki=r,Ki}var Xi,Gl;function yg(){if(Gl)return Xi;Gl=1;var t=ug(),e=gg(),r=pg();function a(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}return Xi=a,Xi}var Yi,Ul;function mg(){if(Ul)return Yi;Ul=1;function t(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}return Yi=t,Yi}var Zi,Wl;function $n(){if(Wl)return Zi;Wl=1;var t=mg();function e(r,a){var n=r.__data__;return t(a)?n[typeof a=="string"?"string":"hash"]:n.map}return Zi=e,Zi}var Qi,Kl;function bg(){if(Kl)return Qi;Kl=1;var t=$n();function e(r){var a=t(this,r).delete(r);return this.size-=a?1:0,a}return Qi=e,Qi}var Ji,Xl;function wg(){if(Xl)return Ji;Xl=1;var t=$n();function e(r){return t(this,r).get(r)}return Ji=e,Ji}var ji,Yl;function xg(){if(Yl)return ji;Yl=1;var t=$n();function e(r){return t(this,r).has(r)}return ji=e,ji}var eo,Zl;function Eg(){if(Zl)return eo;Zl=1;var t=$n();function e(r,a){var n=t(this,r),i=n.size;return n.set(r,a),this.size+=n.size==i?0:1,this}return eo=e,eo}var to,Ql;function Cg(){if(Ql)return to;Ql=1;var t=yg(),e=bg(),r=wg(),a=xg(),n=Eg();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=a,i.prototype.set=n,to=i,to}var ro,Jl;function Tg(){if(Jl)return ro;Jl=1;var t=Cg(),e="Expected a function";function r(a,n){if(typeof a!="function"||n!=null&&typeof n!="function")throw new TypeError(e);var i=function(){var o=arguments,s=n?n.apply(this,o):o[0],u=i.cache;if(u.has(s))return u.get(s);var l=a.apply(this,o);return i.cache=u.set(s,l)||u,l};return i.cache=new(r.Cache||t),i}return r.Cache=t,ro=r,ro}var ao,jl;function Sg(){if(jl)return ao;jl=1;var t=Tg(),e=500;function r(a){var n=t(a,function(o){return i.size===e&&i.clear(),o}),i=n.cache;return n}return ao=r,ao}var no,eu;function Uf(){if(eu)return no;eu=1;var t=Sg(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,a=t(function(n){var i=[];return n.charCodeAt(0)===46&&i.push(""),n.replace(e,function(o,s,u,l){i.push(u?l.replace(r,"$1"):s||o)}),i});return no=a,no}var io,tu;function Wf(){if(tu)return io;tu=1;function t(e,r){for(var a=-1,n=e==null?0:e.length,i=Array(n);++a<n;)i[a]=r(e[a],a,e);return i}return io=t,io}var oo,ru;function kg(){if(ru)return oo;ru=1;var t=rs(),e=Wf(),r=Fn(),a=Fa(),n=t?t.prototype:void 0,i=n?n.toString:void 0;function o(s){if(typeof s=="string")return s;if(r(s))return e(s,o)+"";if(a(s))return i?i.call(s):"";var u=s+"";return u=="0"&&1/s==-1/0?"-0":u}return oo=o,oo}var so,au;function Kf(){if(au)return so;au=1;var t=kg();function e(r){return r==null?"":t(r)}return so=e,so}var lo,nu;function Xf(){if(nu)return lo;nu=1;var t=Fn(),e=Qh(),r=Uf(),a=Kf();function n(i,o){return t(i)?i:e(i,o)?[i]:r(a(i))}return lo=n,lo}var uo,iu;function vs(){if(iu)return uo;iu=1;var t=Fa();function e(r){if(typeof r=="string"||t(r))return r;var a=r+"";return a=="0"&&1/r==-1/0?"-0":a}return uo=e,uo}var fo,ou;function Bg(){if(ou)return fo;ou=1;var t=Xf(),e=vs();function r(a,n){n=t(n,a);for(var i=0,o=n.length;a!=null&&i<o;)a=a[e(n[i++])];return i&&i==o?a:void 0}return fo=r,fo}var co,su;function Dg(){if(su)return co;su=1;var t=Bg();function e(r,a,n){var i=r==null?void 0:t(r,a);return i===void 0?n:i}return co=e,co}var Pg=Dg(),Ag=Na(Pg),vo,lu;function Rg(){if(lu)return vo;lu=1;var t=cs(),e=(function(){try{var r=t(Object,"defineProperty");return r({},"",{}),r}catch{}})();return vo=e,vo}var ho,uu;function Mg(){if(uu)return ho;uu=1;var t=Rg();function e(r,a,n){a=="__proto__"&&t?t(r,a,{configurable:!0,enumerable:!0,value:n,writable:!0}):r[a]=n}return ho=e,ho}var go,fu;function Lg(){if(fu)return go;fu=1;var t=Mg(),e=Gf(),r=Object.prototype,a=r.hasOwnProperty;function n(i,o,s){var u=i[o];(!(a.call(i,o)&&e(u,s))||s===void 0&&!(o in i))&&t(i,o,s)}return go=n,go}var po,cu;function Ig(){if(cu)return po;cu=1;var t=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function r(a,n){var i=typeof a;return n=n??t,!!n&&(i=="number"||i!="symbol"&&e.test(a))&&a>-1&&a%1==0&&a<n}return po=r,po}var yo,vu;function Og(){if(vu)return yo;vu=1;var t=Lg(),e=Xf(),r=Ig(),a=za(),n=vs();function i(o,s,u,l){if(!a(o))return o;s=e(s,o);for(var f=-1,c=s.length,v=c-1,d=o;d!=null&&++f<c;){var h=n(s[f]),y=u;if(h==="__proto__"||h==="constructor"||h==="prototype")return o;if(f!=v){var g=d[h];y=l?l(g,h,d):void 0,y===void 0&&(y=a(g)?g:r(s[f+1])?[]:{})}t(d,h,y),d=d[h]}return o}return yo=i,yo}var mo,du;function Ng(){if(du)return mo;du=1;var t=Og();function e(r,a,n){return r==null?r:t(r,a,n)}return mo=e,mo}var zg=Ng(),Fg=Na(zg),bo,hu;function Vg(){if(hu)return bo;hu=1;function t(e,r){var a=-1,n=e.length;for(r||(r=Array(n));++a<n;)r[a]=e[a];return r}return bo=t,bo}var wo,gu;function qg(){if(gu)return wo;gu=1;var t=Wf(),e=Vg(),r=Fn(),a=Fa(),n=Uf(),i=vs(),o=Kf();function s(u){return r(u)?t(u,i):a(u)?[u]:e(n(o(u)))}return wo=s,wo}var $g=qg(),_g=Na($g),Hg={data:function(e){var r={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(n){},beforeSet:function(n,i){},onSet:function(n){},canSet:function(n){return!0}};return e=ye({},r,e),function(n,i){var o=e,s=this,u=s.length!==void 0,l=u?s:[s],f=u?s[0]:s;if(he(n)){var c=n.indexOf(".")!==-1,v=c&&_g(n);if(o.allowGetting&&i===void 0){var d;return f&&(o.beforeGet(f),v&&f._private[o.field][n]===void 0?d=Ag(f._private[o.field],v):d=f._private[o.field][n]),d}else if(o.allowSetting&&i!==void 0){var h=!o.immutableKeys[n];if(h){var y=uf({},n,i);o.beforeSet(s,y);for(var g=0,p=l.length;g<p;g++){var m=l[g];o.canSet(m)&&(v&&f._private[o.field][n]===void 0?Fg(m._private[o.field],v,i):m._private[o.field][n]=i)}o.updateStyle&&s.updateStyle(),o.onSet(s),o.settingTriggersEvent&&s[o.triggerFnName](o.settingEvent)}}}else if(o.allowSetting&&Me(n)){var b=n,w,E,C=Object.keys(b);o.beforeSet(s,b);for(var x=0;x<C.length;x++){w=C[x],E=b[w];var T=!o.immutableKeys[w];if(T)for(var k=0;k<l.length;k++){var B=l[k];o.canSet(B)&&(B._private[o.field][w]=E)}}o.updateStyle&&s.updateStyle(),o.onSet(s),o.settingTriggersEvent&&s[o.triggerFnName](o.settingEvent)}else if(o.allowBinding&&We(n)){var D=n;s.on(o.bindingEvent,D)}else if(o.allowGetting&&n===void 0){var P;return f&&(o.beforeGet(f),P=f._private[o.field]),P}return s}},removeData:function(e){var r={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=ye({},r,e),function(n){var i=e,o=this,s=o.length!==void 0,u=s?o:[o];if(he(n)){for(var l=n.split(/\s+/),f=l.length,c=0;c<f;c++){var v=l[c];if(!lr(v)){var d=!i.immutableKeys[v];if(d)for(var h=0,y=u.length;h<y;h++)u[h]._private[i.field][v]=void 0}}i.triggerEvent&&o[i.triggerFnName](i.event)}else if(n===void 0){for(var g=0,p=u.length;g<p;g++)for(var m=u[g]._private[i.field],b=Object.keys(m),w=0;w<b.length;w++){var E=b[w],C=!i.immutableKeys[E];C&&(m[E]=void 0)}i.triggerEvent&&o[i.triggerFnName](i.event)}return o}}},Gg={eventAliasesOn:function(e){var r=e;r.addListener=r.listen=r.bind=r.on,r.unlisten=r.unbind=r.off=r.removeListener,r.trigger=r.emit,r.pon=r.promiseOn=function(a,n){var i=this,o=Array.prototype.slice.call(arguments,0);return new ra(function(s,u){var l=function(d){i.off.apply(i,c),s(d)},f=o.concat([l]),c=f.concat([]);i.on.apply(i,f)})}}},Ne={};[Zh,Hg,Gg].forEach(function(t){ye(Ne,t)});var Ug={animate:Ne.animate(),animation:Ne.animation(),animated:Ne.animated(),clearQueue:Ne.clearQueue(),delay:Ne.delay(),delayAnimation:Ne.delayAnimation(),stop:Ne.stop()},cn={classes:function(e){var r=this;if(e===void 0){var a=[];return r[0]._private.classes.forEach(function(h){return a.push(h)}),a}else qe(e)||(e=(e||"").match(/\S+/g)||[]);for(var n=[],i=new ta(e),o=0;o<r.length;o++){for(var s=r[o],u=s._private,l=u.classes,f=!1,c=0;c<e.length;c++){var v=e[c],d=l.has(v);if(!d){f=!0;break}}f||(f=l.size!==e.length),f&&(u.classes=i,n.push(s))}return n.length>0&&this.spawn(n).updateStyle().emit("class"),r},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var r=this[0];return r!=null&&r._private.classes.has(e)},toggleClass:function(e,r){qe(e)||(e=e.match(/\S+/g)||[]);for(var a=this,n=r===void 0,i=[],o=0,s=a.length;o<s;o++)for(var u=a[o],l=u._private.classes,f=!1,c=0;c<e.length;c++){var v=e[c],d=l.has(v),h=!1;r||n&&!d?(l.add(v),h=!0):(!r||n&&d)&&(l.delete(v),h=!0),!f&&h&&(i.push(u),f=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),a},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,r){var a=this;if(r==null)r=250;else if(r===0)return a;return a.addClass(e),setTimeout(function(){a.removeClass(e)},r),a}};cn.className=cn.classNames=cn.classes;var Re={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:tt,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Re.variable="(?:[\\w-.]|(?:\\\\"+Re.metaChar+"))+";Re.className="(?:[\\w-]|(?:\\\\"+Re.metaChar+"))+";Re.value=Re.string+"|"+Re.number;Re.id=Re.variable;(function(){var t,e,r;for(t=Re.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],Re.comparatorOp+="|@"+e;for(t=Re.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],!(e.indexOf("!")>=0)&&e!=="="&&(Re.comparatorOp+="|\\!"+e)})();var Fe=function(){return{checks:[]}},le={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},qo=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(t,e){return Hv(t.selector,e.selector)}),Wg=(function(){for(var t={},e,r=0;r<qo.length;r++)e=qo[r],t[e.selector]=e.matches;return t})(),Kg=function(e,r){return Wg[e](r)},Xg="("+qo.map(function(t){return t.selector}).join("|")+")",zr=function(e){return e.replace(new RegExp("\\\\("+Re.metaChar+")","g"),function(r,a){return a})},tr=function(e,r,a){e[e.length-1]=a},$o=[{name:"group",query:!0,regex:"("+Re.group+")",populate:function(e,r,a){var n=Je(a,1),i=n[0];r.checks.push({type:le.GROUP,value:i==="*"?i:i+"s"})}},{name:"state",query:!0,regex:Xg,populate:function(e,r,a){var n=Je(a,1),i=n[0];r.checks.push({type:le.STATE,value:i})}},{name:"id",query:!0,regex:"\\#("+Re.id+")",populate:function(e,r,a){var n=Je(a,1),i=n[0];r.checks.push({type:le.ID,value:zr(i)})}},{name:"className",query:!0,regex:"\\.("+Re.className+")",populate:function(e,r,a){var n=Je(a,1),i=n[0];r.checks.push({type:le.CLASS,value:zr(i)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Re.variable+")\\s*\\]",populate:function(e,r,a){var n=Je(a,1),i=n[0];r.checks.push({type:le.DATA_EXIST,field:zr(i)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Re.variable+")\\s*("+Re.comparatorOp+")\\s*("+Re.value+")\\s*\\]",populate:function(e,r,a){var n=Je(a,3),i=n[0],o=n[1],s=n[2],u=new RegExp("^"+Re.string+"$").exec(s)!=null;u?s=s.substring(1,s.length-1):s=parseFloat(s),r.checks.push({type:le.DATA_COMPARE,field:zr(i),operator:o,value:s})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Re.boolOp+")\\s*("+Re.variable+")\\s*\\]",populate:function(e,r,a){var n=Je(a,2),i=n[0],o=n[1];r.checks.push({type:le.DATA_BOOL,field:zr(o),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Re.meta+")\\s*("+Re.comparatorOp+")\\s*("+Re.number+")\\s*\\]\\]",populate:function(e,r,a){var n=Je(a,3),i=n[0],o=n[1],s=n[2];r.checks.push({type:le.META_COMPARE,field:zr(i),operator:o,value:parseFloat(s)})}},{name:"nextQuery",separator:!0,regex:Re.separator,populate:function(e,r){var a=e.currentSubject,n=e.edgeCount,i=e.compoundCount,o=e[e.length-1];a!=null&&(o.subject=a,e.currentSubject=null),o.edgeCount=n,o.compoundCount=i,e.edgeCount=0,e.compoundCount=0;var s=e[e.length++]=Fe();return s}},{name:"directedEdge",separator:!0,regex:Re.directedEdge,populate:function(e,r){if(e.currentSubject==null){var a=Fe(),n=r,i=Fe();return a.checks.push({type:le.DIRECTED_EDGE,source:n,target:i}),tr(e,r,a),e.edgeCount++,i}else{var o=Fe(),s=r,u=Fe();return o.checks.push({type:le.NODE_SOURCE,source:s,target:u}),tr(e,r,o),e.edgeCount++,u}}},{name:"undirectedEdge",separator:!0,regex:Re.undirectedEdge,populate:function(e,r){if(e.currentSubject==null){var a=Fe(),n=r,i=Fe();return a.checks.push({type:le.UNDIRECTED_EDGE,nodes:[n,i]}),tr(e,r,a),e.edgeCount++,i}else{var o=Fe(),s=r,u=Fe();return o.checks.push({type:le.NODE_NEIGHBOR,node:s,neighbor:u}),tr(e,r,o),u}}},{name:"child",separator:!0,regex:Re.child,populate:function(e,r){if(e.currentSubject==null){var a=Fe(),n=Fe(),i=e[e.length-1];return a.checks.push({type:le.CHILD,parent:i,child:n}),tr(e,r,a),e.compoundCount++,n}else if(e.currentSubject===r){var o=Fe(),s=e[e.length-1],u=Fe(),l=Fe(),f=Fe(),c=Fe();return o.checks.push({type:le.COMPOUND_SPLIT,left:s,right:u,subject:l}),l.checks=r.checks,r.checks=[{type:le.TRUE}],c.checks.push({type:le.TRUE}),u.checks.push({type:le.PARENT,parent:c,child:f}),tr(e,s,o),e.currentSubject=l,e.compoundCount++,f}else{var v=Fe(),d=Fe(),h=[{type:le.PARENT,parent:v,child:d}];return v.checks=r.checks,r.checks=h,e.compoundCount++,d}}},{name:"descendant",separator:!0,regex:Re.descendant,populate:function(e,r){if(e.currentSubject==null){var a=Fe(),n=Fe(),i=e[e.length-1];return a.checks.push({type:le.DESCENDANT,ancestor:i,descendant:n}),tr(e,r,a),e.compoundCount++,n}else if(e.currentSubject===r){var o=Fe(),s=e[e.length-1],u=Fe(),l=Fe(),f=Fe(),c=Fe();return o.checks.push({type:le.COMPOUND_SPLIT,left:s,right:u,subject:l}),l.checks=r.checks,r.checks=[{type:le.TRUE}],c.checks.push({type:le.TRUE}),u.checks.push({type:le.ANCESTOR,ancestor:c,descendant:f}),tr(e,s,o),e.currentSubject=l,e.compoundCount++,f}else{var v=Fe(),d=Fe(),h=[{type:le.ANCESTOR,ancestor:v,descendant:d}];return v.checks=r.checks,r.checks=h,e.compoundCount++,d}}},{name:"subject",modifier:!0,regex:Re.subject,populate:function(e,r){if(e.currentSubject!=null&&e.currentSubject!==r)return ze("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=r;var a=e[e.length-1],n=a.checks[0],i=n==null?null:n.type;i===le.DIRECTED_EDGE?n.type=le.NODE_TARGET:i===le.UNDIRECTED_EDGE&&(n.type=le.NODE_NEIGHBOR,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];$o.forEach(function(t){return t.regexObj=new RegExp("^"+t.regex)});var Yg=function(e){for(var r,a,n,i=0;i<$o.length;i++){var o=$o[i],s=o.name,u=e.match(o.regexObj);if(u!=null){a=u,r=o,n=s;var l=u[0];e=e.substring(l.length);break}}return{expr:r,match:a,name:n,remaining:e}},Zg=function(e){var r=e.match(/^\s+/);if(r){var a=r[0];e=e.substring(a.length)}return e},Qg=function(e){var r=this,a=r.inputText=e,n=r[0]=Fe();for(r.length=1,a=Zg(a);;){var i=Yg(a);if(i.expr==null)return ze("The selector `"+e+"`is invalid"),!1;var o=i.match.slice(1),s=i.expr.populate(r,n,o);if(s===!1)return!1;if(s!=null&&(n=s),a=i.remaining,a.match(/^\s*$/))break}var u=r[r.length-1];r.currentSubject!=null&&(u.subject=r.currentSubject),u.edgeCount=r.edgeCount,u.compoundCount=r.compoundCount;for(var l=0;l<r.length;l++){var f=r[l];if(f.compoundCount>0&&f.edgeCount>0)return ze("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(f.edgeCount>1)return ze("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;f.edgeCount===1&&ze("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},Jg=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(f){return f??""},r=function(f){return he(f)?'"'+f+'"':e(f)},a=function(f){return" "+f+" "},n=function(f,c){var v=f.type,d=f.value;switch(v){case le.GROUP:{var h=e(d);return h.substring(0,h.length-1)}case le.DATA_COMPARE:{var y=f.field,g=f.operator;return"["+y+a(e(g))+r(d)+"]"}case le.DATA_BOOL:{var p=f.operator,m=f.field;return"["+e(p)+m+"]"}case le.DATA_EXIST:{var b=f.field;return"["+b+"]"}case le.META_COMPARE:{var w=f.operator,E=f.field;return"[["+E+a(e(w))+r(d)+"]]"}case le.STATE:return d;case le.ID:return"#"+d;case le.CLASS:return"."+d;case le.PARENT:case le.CHILD:return i(f.parent,c)+a(">")+i(f.child,c);case le.ANCESTOR:case le.DESCENDANT:return i(f.ancestor,c)+" "+i(f.descendant,c);case le.COMPOUND_SPLIT:{var C=i(f.left,c),x=i(f.subject,c),T=i(f.right,c);return C+(C.length>0?" ":"")+x+T}case le.TRUE:return""}},i=function(f,c){return f.checks.reduce(function(v,d,h){return v+(c===f&&h===0?"$":"")+n(d,c)},"")},o="",s=0;s<this.length;s++){var u=this[s];o+=i(u,u.subject),this.length>1&&s<this.length-1&&(o+=", ")}return this.toStringCache=o,o},jg={parse:Qg,toString:Jg},Yf=function(e,r,a){var n,i=he(e),o=ae(e),s=he(a),u,l,f=!1,c=!1,v=!1;switch(r.indexOf("!")>=0&&(r=r.replace("!",""),c=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),f=!0),(i||s||f)&&(u=!i&&!o?"":""+e,l=""+a),f&&(e=u=u.toLowerCase(),a=l=l.toLowerCase()),r){case"*=":n=u.indexOf(l)>=0;break;case"$=":n=u.indexOf(l,u.length-l.length)>=0;break;case"^=":n=u.indexOf(l)===0;break;case"=":n=e===a;break;case">":v=!0,n=e>a;break;case">=":v=!0,n=e>=a;break;case"<":v=!0,n=e<a;break;case"<=":v=!0,n=e<=a;break;default:n=!1;break}return c&&(e!=null||!v)&&(n=!n),n},ep=function(e,r){switch(r){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},tp=function(e){return e!==void 0},ds=function(e,r){return e.data(r)},rp=function(e,r){return e[r]()},Ye=[],He=function(e,r){return e.checks.every(function(a){return Ye[a.type](a,r)})};Ye[le.GROUP]=function(t,e){var r=t.value;return r==="*"||r===e.group()};Ye[le.STATE]=function(t,e){var r=t.value;return Kg(r,e)};Ye[le.ID]=function(t,e){var r=t.value;return e.id()===r};Ye[le.CLASS]=function(t,e){var r=t.value;return e.hasClass(r)};Ye[le.META_COMPARE]=function(t,e){var r=t.field,a=t.operator,n=t.value;return Yf(rp(e,r),a,n)};Ye[le.DATA_COMPARE]=function(t,e){var r=t.field,a=t.operator,n=t.value;return Yf(ds(e,r),a,n)};Ye[le.DATA_BOOL]=function(t,e){var r=t.field,a=t.operator;return ep(ds(e,r),a)};Ye[le.DATA_EXIST]=function(t,e){var r=t.field;return t.operator,tp(ds(e,r))};Ye[le.UNDIRECTED_EDGE]=function(t,e){var r=t.nodes[0],a=t.nodes[1],n=e.source(),i=e.target();return He(r,n)&&He(a,i)||He(a,n)&&He(r,i)};Ye[le.NODE_NEIGHBOR]=function(t,e){return He(t.node,e)&&e.neighborhood().some(function(r){return r.isNode()&&He(t.neighbor,r)})};Ye[le.DIRECTED_EDGE]=function(t,e){return He(t.source,e.source())&&He(t.target,e.target())};Ye[le.NODE_SOURCE]=function(t,e){return He(t.source,e)&&e.outgoers().some(function(r){return r.isNode()&&He(t.target,r)})};Ye[le.NODE_TARGET]=function(t,e){return He(t.target,e)&&e.incomers().some(function(r){return r.isNode()&&He(t.source,r)})};Ye[le.CHILD]=function(t,e){return He(t.child,e)&&He(t.parent,e.parent())};Ye[le.PARENT]=function(t,e){return He(t.parent,e)&&e.children().some(function(r){return He(t.child,r)})};Ye[le.DESCENDANT]=function(t,e){return He(t.descendant,e)&&e.ancestors().some(function(r){return He(t.ancestor,r)})};Ye[le.ANCESTOR]=function(t,e){return He(t.ancestor,e)&&e.descendants().some(function(r){return He(t.descendant,r)})};Ye[le.COMPOUND_SPLIT]=function(t,e){return He(t.subject,e)&&He(t.left,e)&&He(t.right,e)};Ye[le.TRUE]=function(){return!0};Ye[le.COLLECTION]=function(t,e){var r=t.value;return r.has(e)};Ye[le.FILTER]=function(t,e){var r=t.value;return r(e)};var ap=function(e){var r=this;if(r.length===1&&r[0].checks.length===1&&r[0].checks[0].type===le.ID)return e.getElementById(r[0].checks[0].value).collection();var a=function(i){for(var o=0;o<r.length;o++){var s=r[o];if(He(s,i))return!0}return!1};return r.text()==null&&(a=function(){return!0}),e.filter(a)},np=function(e){for(var r=this,a=0;a<r.length;a++){var n=r[a];if(He(n,e))return!0}return!1},ip={matches:np,filter:ap},cr=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||he(e)&&e.match(/^\s*$/)||(St(e)?this.addQuery({checks:[{type:le.COLLECTION,value:e.collection()}]}):We(e)?this.addQuery({checks:[{type:le.FILTER,value:e}]}):he(e)?this.parse(e)||(this.invalid=!0):Ge("A selector must be created from a string; found "))},vr=cr.prototype;[jg,ip].forEach(function(t){return ye(vr,t)});vr.text=function(){return this.inputText};vr.size=function(){return this.length};vr.eq=function(t){return this[t]};vr.sameText=function(t){return!this.invalid&&!t.invalid&&this.text()===t.text()};vr.addQuery=function(t){this[this.length++]=t};vr.selector=vr.toString;var or={allAre:function(e){var r=new cr(e);return this.every(function(a){return r.matches(a)})},is:function(e){var r=new cr(e);return this.some(function(a){return r.matches(a)})},some:function(e,r){for(var a=0;a<this.length;a++){var n=r?e.apply(r,[this[a],a,this]):e(this[a],a,this);if(n)return!0}return!1},every:function(e,r){for(var a=0;a<this.length;a++){var n=r?e.apply(r,[this[a],a,this]):e(this[a],a,this);if(!n)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var r=this.length,a=e.length;return r!==a?!1:r===1?this[0]===e[0]:this.every(function(n){return e.hasElementWithId(n.id())})},anySame:function(e){return e=this.cy().collection(e),this.some(function(r){return e.hasElementWithId(r.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var r=this.neighborhood();return e.every(function(a){return r.hasElementWithId(a.id())})},contains:function(e){e=this.cy().collection(e);var r=this;return e.every(function(a){return r.hasElementWithId(a.id())})}};or.allAreNeighbours=or.allAreNeighbors;or.has=or.contains;or.equal=or.equals=or.same;var Pt=function(e,r){return function(n,i,o,s){var u=n,l=this,f;if(u==null?f="":St(u)&&u.length===1&&(f=u.id()),l.length===1&&f){var c=l[0]._private,v=c.traversalCache=c.traversalCache||{},d=v[r]=v[r]||[],h=Ar(f),y=d[h];return y||(d[h]=e.call(l,n,i,o,s))}else return e.call(l,n,i,o,s)}},ea={parent:function(e){var r=[];if(this.length===1){var a=this[0]._private.parent;if(a)return a}for(var n=0;n<this.length;n++){var i=this[n],o=i._private.parent;o&&r.push(o)}return this.spawn(r,!0).filter(e)},parents:function(e){for(var r=[],a=this.parent();a.nonempty();){for(var n=0;n<a.length;n++){var i=a[n];r.push(i)}a=a.parent()}return this.spawn(r,!0).filter(e)},commonAncestors:function(e){for(var r,a=0;a<this.length;a++){var n=this[a],i=n.parents();r=r||i,r=r.intersect(i)}return r.filter(e)},orphans:function(e){return this.stdFilter(function(r){return r.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(r){return r.isChild()}).filter(e)},children:Pt(function(t){for(var e=[],r=0;r<this.length;r++)for(var a=this[r],n=a._private.children,i=0;i<n.length;i++)e.push(n[i]);return this.spawn(e,!0).filter(t)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},isChildless:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},isChild:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},descendants:function(e){var r=[];function a(n){for(var i=0;i<n.length;i++){var o=n[i];r.push(o),o.children().nonempty()&&a(o.children())}}return a(this.children()),this.spawn(r,!0).filter(e)}};function hs(t,e,r,a){for(var n=[],i=new ta,o=t.cy(),s=o.hasCompoundNodes(),u=0;u<t.length;u++){var l=t[u];r?n.push(l):s&&a(n,i,l)}for(;n.length>0;){var f=n.shift();e(f),i.add(f.id()),s&&a(n,i,f)}return t}function Zf(t,e,r){if(r.isParent())for(var a=r._private.children,n=0;n<a.length;n++){var i=a[n];e.has(i.id())||t.push(i)}}ea.forEachDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return hs(this,t,e,Zf)};function Qf(t,e,r){if(r.isChild()){var a=r._private.parent;e.has(a.id())||t.push(a)}}ea.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return hs(this,t,e,Qf)};function op(t,e,r){Qf(t,e,r),Zf(t,e,r)}ea.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return hs(this,t,e,op)};ea.ancestors=ea.parents;var Pa,Jf;Pa=Jf={data:Ne.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Ne.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Ne.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ne.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Ne.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Ne.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};Pa.attr=Pa.data;Pa.removeAttr=Pa.removeData;var sp=Jf,_n={};function xo(t){return function(e){var r=this;if(e===void 0&&(e=!0),r.length!==0)if(r.isNode()&&!r.removed()){for(var a=0,n=r[0],i=n._private.edges,o=0;o<i.length;o++){var s=i[o];!e&&s.isLoop()||(a+=t(n,s))}return a}else return}}ye(_n,{degree:xo(function(t,e){return e.source().same(e.target())?2:1}),indegree:xo(function(t,e){return e.target().same(t)?1:0}),outdegree:xo(function(t,e){return e.source().same(t)?1:0})});function Fr(t,e){return function(r){for(var a,n=this.nodes(),i=0;i<n.length;i++){var o=n[i],s=o[t](r);s!==void 0&&(a===void 0||e(s,a))&&(a=s)}return a}}ye(_n,{minDegree:Fr("degree",function(t,e){return t<e}),maxDegree:Fr("degree",function(t,e){return t>e}),minIndegree:Fr("indegree",function(t,e){return t<e}),maxIndegree:Fr("indegree",function(t,e){return t>e}),minOutdegree:Fr("outdegree",function(t,e){return t<e}),maxOutdegree:Fr("outdegree",function(t,e){return t>e})});ye(_n,{totalDegree:function(e){for(var r=0,a=this.nodes(),n=0;n<a.length;n++)r+=a[n].degree(e);return r}});var Ot,jf,ec=function(e,r,a){for(var n=0;n<e.length;n++){var i=e[n];if(!i.locked()){var o=i._private.position,s={x:r.x!=null?r.x-o.x:0,y:r.y!=null?r.y-o.y:0};i.isParent()&&!(s.x===0&&s.y===0)&&i.children().shift(s,a),i.dirtyBoundingBoxCache()}}},pu={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,r){ec(e,r,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};Ot=jf={position:Ne.data(pu),silentPosition:Ne.data(ye({},pu,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,r){ec(e,r,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,r){if(Me(e))r?this.silentPosition(e):this.position(e);else if(We(e)){var a=e,n=this.cy();n.startBatch();for(var i=0;i<this.length;i++){var o=this[i],s=void 0;(s=a(o,i))&&(r?o.silentPosition(s):o.position(s))}n.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,r,a){var n;if(Me(e)?(n={x:ae(e.x)?e.x:0,y:ae(e.y)?e.y:0},a=r):he(e)&&ae(r)&&(n={x:0,y:0},n[e]=r),n!=null){var i=this.cy();i.startBatch();for(var o=0;o<this.length;o++){var s=this[o];if(!(i.hasCompoundNodes()&&s.isChild()&&s.ancestors().anySame(this))){var u=s.position(),l={x:u.x+n.x,y:u.y+n.y};a?s.silentPosition(l):s.position(l)}}i.endBatch()}return this},silentShift:function(e,r){return Me(e)?this.shift(e,!0):he(e)&&ae(r)&&this.shift(e,r,!0),this},renderedPosition:function(e,r){var a=this[0],n=this.cy(),i=n.zoom(),o=n.pan(),s=Me(e)?e:void 0,u=s!==void 0||r!==void 0&&he(e);if(a&&a.isNode())if(u)for(var l=0;l<this.length;l++){var f=this[l];r!==void 0?f.position(e,(r-o[e])/i):s!==void 0&&f.position(Df(s,i,o))}else{var c=a.position();return s=Nn(c,i,o),e===void 0?s:s[e]}else if(!u)return;return this},relativePosition:function(e,r){var a=this[0],n=this.cy(),i=Me(e)?e:void 0,o=i!==void 0||r!==void 0&&he(e),s=n.hasCompoundNodes();if(a&&a.isNode())if(o)for(var u=0;u<this.length;u++){var l=this[u],f=s?l.parent():null,c=f&&f.length>0,v=c;c&&(f=f[0]);var d=v?f.position():{x:0,y:0};r!==void 0?l.position(e,r+d[e]):i!==void 0&&l.position({x:i.x+d.x,y:i.y+d.y})}else{var h=a.position(),y=s?a.parent():null,g=y&&y.length>0,p=g;g&&(y=y[0]);var m=p?y.position():{x:0,y:0};return i={x:h.x-m.x,y:h.y-m.y},e===void 0?i:i[e]}else if(!o)return;return this}};Ot.modelPosition=Ot.point=Ot.position;Ot.modelPositions=Ot.points=Ot.positions;Ot.renderedPoint=Ot.renderedPosition;Ot.relativePoint=Ot.relativePosition;var lp=jf,Qr,yr;Qr=yr={};yr.renderedBoundingBox=function(t){var e=this.boundingBox(t),r=this.cy(),a=r.zoom(),n=r.pan(),i=e.x1*a+n.x,o=e.x2*a+n.x,s=e.y1*a+n.y,u=e.y2*a+n.y;return{x1:i,x2:o,y1:s,y2:u,w:o-i,h:u-s}};yr.dirtyCompoundBoundsCache=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(r){if(r.isParent()){var a=r._private;a.compoundBoundsClean=!1,a.bbCache=null,t||r.emitAndNotify("bounds")}}),this)};yr.updateCompoundBounds=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!t&&e.batching())return this;function r(o){if(!o.isParent())return;var s=o._private,u=o.children(),l=o.pstyle("compound-sizing-wrt-labels").value==="include",f={width:{val:o.pstyle("min-width").pfValue,left:o.pstyle("min-width-bias-left"),right:o.pstyle("min-width-bias-right")},height:{val:o.pstyle("min-height").pfValue,top:o.pstyle("min-height-bias-top"),bottom:o.pstyle("min-height-bias-bottom")}},c=u.boundingBox({includeLabels:l,includeOverlays:!1,useCache:!1}),v=s.position;(c.w===0||c.h===0)&&(c={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},c.x1=v.x-c.w/2,c.x2=v.x+c.w/2,c.y1=v.y-c.h/2,c.y2=v.y+c.h/2);function d(k,B,D){var P=0,A=0,R=B+D;return k>0&&R>0&&(P=B/R*k,A=D/R*k),{biasDiff:P,biasComplementDiff:A}}function h(k,B,D,P){if(D.units==="%")switch(P){case"width":return k>0?D.pfValue*k:0;case"height":return B>0?D.pfValue*B:0;case"average":return k>0&&B>0?D.pfValue*(k+B)/2:0;case"min":return k>0&&B>0?k>B?D.pfValue*B:D.pfValue*k:0;case"max":return k>0&&B>0?k>B?D.pfValue*k:D.pfValue*B:0;default:return 0}else return D.units==="px"?D.pfValue:0}var y=f.width.left.value;f.width.left.units==="px"&&f.width.val>0&&(y=y*100/f.width.val);var g=f.width.right.value;f.width.right.units==="px"&&f.width.val>0&&(g=g*100/f.width.val);var p=f.height.top.value;f.height.top.units==="px"&&f.height.val>0&&(p=p*100/f.height.val);var m=f.height.bottom.value;f.height.bottom.units==="px"&&f.height.val>0&&(m=m*100/f.height.val);var b=d(f.width.val-c.w,y,g),w=b.biasDiff,E=b.biasComplementDiff,C=d(f.height.val-c.h,p,m),x=C.biasDiff,T=C.biasComplementDiff;s.autoPadding=h(c.w,c.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),s.autoWidth=Math.max(c.w,f.width.val),v.x=(-w+c.x1+c.x2+E)/2,s.autoHeight=Math.max(c.h,f.height.val),v.y=(-x+c.y1+c.y2+T)/2}for(var a=0;a<this.length;a++){var n=this[a],i=n._private;(!i.compoundBoundsClean||t)&&(r(n),e.batching()||(i.compoundBoundsClean=!0))}return this};var Dt=function(e){return e===1/0||e===-1/0?0:e},It=function(e,r,a,n,i){n-r===0||i-a===0||r==null||a==null||n==null||i==null||(e.x1=r<e.x1?r:e.x1,e.x2=n>e.x2?n:e.x2,e.y1=a<e.y1?a:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},rr=function(e,r){return r==null?e:It(e,r.x1,r.y1,r.x2,r.y2)},va=function(e,r,a){return Et(e,r,a)},en=function(e,r,a){if(!r.cy().headless()){var n=r._private,i=n.rstyle,o=i.arrowWidth/2,s=r.pstyle(a+"-arrow-shape").value,u,l;if(s!=="none"){a==="source"?(u=i.srcX,l=i.srcY):a==="target"?(u=i.tgtX,l=i.tgtY):(u=i.midX,l=i.midY);var f=n.arrowBounds=n.arrowBounds||{},c=f[a]=f[a]||{};c.x1=u-o,c.y1=l-o,c.x2=u+o,c.y2=l+o,c.w=c.x2-c.x1,c.h=c.y2-c.y1,un(c,1),It(e,c.x1,c.y1,c.x2,c.y2)}}},Eo=function(e,r,a){if(!r.cy().headless()){var n;a?n=a+"-":n="";var i=r._private,o=i.rstyle,s=r.pstyle(n+"label").strValue;if(s){var u=r.pstyle("text-halign"),l=r.pstyle("text-valign"),f=va(o,"labelWidth",a),c=va(o,"labelHeight",a),v=va(o,"labelX",a),d=va(o,"labelY",a),h=r.pstyle(n+"text-margin-x").pfValue,y=r.pstyle(n+"text-margin-y").pfValue,g=r.isEdge(),p=r.pstyle(n+"text-rotation"),m=r.pstyle("text-outline-width").pfValue,b=r.pstyle("text-border-width").pfValue,w=b/2,E=r.pstyle("text-background-padding").pfValue,C=2,x=c,T=f,k=T/2,B=x/2,D,P,A,R;if(g)D=v-k,P=v+k,A=d-B,R=d+B;else{switch(u.value){case"left":D=v-T,P=v;break;case"center":D=v-k,P=v+k;break;case"right":D=v,P=v+T;break}switch(l.value){case"top":A=d-x,R=d;break;case"center":A=d-B,R=d+B;break;case"bottom":A=d,R=d+x;break}}var L=h-Math.max(m,w)-E-C,I=h+Math.max(m,w)+E+C,M=y-Math.max(m,w)-E-C,O=y+Math.max(m,w)+E+C;D+=L,P+=I,A+=M,R+=O;var q=a||"main",$=i.labelBounds,N=$[q]=$[q]||{};N.x1=D,N.y1=A,N.x2=P,N.y2=R,N.w=P-D,N.h=R-A,N.leftPad=L,N.rightPad=I,N.topPad=M,N.botPad=O;var F=g&&p.strValue==="autorotate",W=p.pfValue!=null&&p.pfValue!==0;if(F||W){var J=F?va(i.rstyle,"labelAngle",a):p.pfValue,Z=Math.cos(J),j=Math.sin(J),te=(D+P)/2,ne=(A+R)/2;if(!g){switch(u.value){case"left":te=P;break;case"right":te=D;break}switch(l.value){case"top":ne=R;break;case"bottom":ne=A;break}}var Q=function(we,me){return we=we-te,me=me-ne,{x:we*Z-me*j+te,y:we*j+me*Z+ne}},V=Q(D,A),H=Q(D,R),G=Q(P,A),Y=Q(P,R);D=Math.min(V.x,H.x,G.x,Y.x),P=Math.max(V.x,H.x,G.x,Y.x),A=Math.min(V.y,H.y,G.y,Y.y),R=Math.max(V.y,H.y,G.y,Y.y)}var re=q+"Rot",ve=$[re]=$[re]||{};ve.x1=D,ve.y1=A,ve.x2=P,ve.y2=R,ve.w=P-D,ve.h=R-A,It(e,D,A,P,R),It(i.labelBounds.all,D,A,P,R)}return e}},yu=function(e,r){if(!r.cy().headless()){var a=r.pstyle("outline-opacity").value,n=r.pstyle("outline-width").value,i=r.pstyle("outline-offset").value,o=n+i;tc(e,r,a,o,"outside",o/2)}},tc=function(e,r,a,n,i,o){if(!(a===0||n<=0||i==="inside")){var s=r.cy(),u=s.renderer(),l=u.nodeShapes[u.getNodeShape(r)];if(l){var f=r.position(),c=f.x,v=f.y,d=r.width(),h=r.height();if(l.hasMiterBounds){i==="center"&&(n/=2);var y=l.miterBounds(c,v,d,h,n);rr(e,y)}else o!=null&&o>0&&fn(e,[o,o,o,o])}}},up=function(e,r){if(!r.cy().headless()){var a=r.pstyle("border-opacity").value,n=r.pstyle("border-width").pfValue,i=r.pstyle("border-position").value;tc(e,r,a,n,i)}},fp=function(e,r){var a=e._private.cy,n=a.styleEnabled(),i=a.headless(),o=mt(),s=e._private,u=e.isNode(),l=e.isEdge(),f,c,v,d,h,y,g=s.rstyle,p=u&&n?e.pstyle("bounds-expansion").pfValue:[0],m=function(De){return De.pstyle("display").value!=="none"},b=!n||m(e)&&(!l||m(e.source())&&m(e.target()));if(b){var w=0,E=0;n&&r.includeOverlays&&(w=e.pstyle("overlay-opacity").value,w!==0&&(E=e.pstyle("overlay-padding").value));var C=0,x=0;n&&r.includeUnderlays&&(C=e.pstyle("underlay-opacity").value,C!==0&&(x=e.pstyle("underlay-padding").value));var T=Math.max(E,x),k=0,B=0;if(n&&(k=e.pstyle("width").pfValue,B=k/2),u&&r.includeNodes){var D=e.position();h=D.x,y=D.y;var P=e.outerWidth(),A=P/2,R=e.outerHeight(),L=R/2;f=h-A,c=h+A,v=y-L,d=y+L,It(o,f,v,c,d),n&&yu(o,e),n&&r.includeOutlines&&!i&&yu(o,e),n&&up(o,e)}else if(l&&r.includeEdges)if(n&&!i){var I=e.pstyle("curve-style").strValue;if(f=Math.min(g.srcX,g.midX,g.tgtX),c=Math.max(g.srcX,g.midX,g.tgtX),v=Math.min(g.srcY,g.midY,g.tgtY),d=Math.max(g.srcY,g.midY,g.tgtY),f-=B,c+=B,v-=B,d+=B,It(o,f,v,c,d),I==="haystack"){var M=g.haystackPts;if(M&&M.length===2){if(f=M[0].x,v=M[0].y,c=M[1].x,d=M[1].y,f>c){var O=f;f=c,c=O}if(v>d){var q=v;v=d,d=q}It(o,f-B,v-B,c+B,d+B)}}else if(I==="bezier"||I==="unbundled-bezier"||ar(I,"segments")||ar(I,"taxi")){var $;switch(I){case"bezier":case"unbundled-bezier":$=g.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":$=g.linePts;break}if($!=null)for(var N=0;N<$.length;N++){var F=$[N];f=F.x-B,c=F.x+B,v=F.y-B,d=F.y+B,It(o,f,v,c,d)}}}else{var W=e.source(),J=W.position(),Z=e.target(),j=Z.position();if(f=J.x,c=j.x,v=J.y,d=j.y,f>c){var te=f;f=c,c=te}if(v>d){var ne=v;v=d,d=ne}f-=B,c+=B,v-=B,d+=B,It(o,f,v,c,d)}if(n&&r.includeEdges&&l&&(en(o,e,"mid-source"),en(o,e,"mid-target"),en(o,e,"source"),en(o,e,"target")),n){var Q=e.pstyle("ghost").value==="yes";if(Q){var V=e.pstyle("ghost-offset-x").pfValue,H=e.pstyle("ghost-offset-y").pfValue;It(o,o.x1+V,o.y1+H,o.x2+V,o.y2+H)}}var G=s.bodyBounds=s.bodyBounds||{};rl(G,o),fn(G,p),un(G,1),n&&(f=o.x1,c=o.x2,v=o.y1,d=o.y2,It(o,f-T,v-T,c+T,d+T));var Y=s.overlayBounds=s.overlayBounds||{};rl(Y,o),fn(Y,p),un(Y,1);var re=s.labelBounds=s.labelBounds||{};re.all!=null?Ud(re.all):re.all=mt(),n&&r.includeLabels&&(r.includeMainLabels&&Eo(o,e,null),l&&(r.includeSourceLabels&&Eo(o,e,"source"),r.includeTargetLabels&&Eo(o,e,"target")))}return o.x1=Dt(o.x1),o.y1=Dt(o.y1),o.x2=Dt(o.x2),o.y2=Dt(o.y2),o.w=Dt(o.x2-o.x1),o.h=Dt(o.y2-o.y1),o.w>0&&o.h>0&&b&&(fn(o,p),un(o,1)),o},rc=function(e){var r=0,a=function(o){return(o?1:0)<<r++},n=0;return n+=a(e.incudeNodes),n+=a(e.includeEdges),n+=a(e.includeLabels),n+=a(e.includeMainLabels),n+=a(e.includeSourceLabels),n+=a(e.includeTargetLabels),n+=a(e.includeOverlays),n+=a(e.includeOutlines),n},ac=function(e){var r=function(s){return Math.round(s)};if(e.isEdge()){var a=e.source().position(),n=e.target().position();return Zs([r(a.x),r(a.y),r(n.x),r(n.y)])}else{var i=e.position();return Zs([r(i.x),r(i.y)])}},mu=function(e,r){var a=e._private,n,i=e.isEdge(),o=r==null?bu:rc(r),s=o===bu;if(a.bbCache==null?(n=fp(e,Aa),a.bbCache=n,a.bbCachePosKey=ac(e)):n=a.bbCache,!s){var u=e.isNode();n=mt(),(r.includeNodes&&u||r.includeEdges&&!u)&&(r.includeOverlays?rr(n,a.overlayBounds):rr(n,a.bodyBounds)),r.includeLabels&&(r.includeMainLabels&&(!i||r.includeSourceLabels&&r.includeTargetLabels)?rr(n,a.labelBounds.all):(r.includeMainLabels&&rr(n,a.labelBounds.mainRot),r.includeSourceLabels&&rr(n,a.labelBounds.sourceRot),r.includeTargetLabels&&rr(n,a.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},Aa={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},bu=rc(Aa),wu=ct(Aa);yr.boundingBox=function(t){var e,r=t===void 0||t.useCache===void 0||t.useCache===!0,a=Jr(function(f){var c=f._private;return c.bbCache==null||c.styleDirty||c.bbCachePosKey!==ac(f)},function(f){return f.id()});if(r&&this.length===1&&!a(this[0]))t===void 0?t=Aa:t=wu(t),e=mu(this[0],t);else{e=mt(),t=t||Aa;var n=wu(t),i=this,o=i.cy(),s=o.styleEnabled();this.edges().forEach(a),this.nodes().forEach(a),s&&this.recalculateRenderedStyle(r),this.updateCompoundBounds(!r);for(var u=0;u<i.length;u++){var l=i[u];a(l)&&l.dirtyBoundingBoxCache(),rr(e,mu(l,n))}}return e.x1=Dt(e.x1),e.y1=Dt(e.y1),e.x2=Dt(e.x2),e.y2=Dt(e.y2),e.w=Dt(e.x2-e.x1),e.h=Dt(e.y2-e.y1),e};yr.dirtyBoundingBoxCache=function(){for(var t=0;t<this.length;t++){var e=this[t]._private;e.bbCache=null,e.bbCachePosKey=null,e.bodyBounds=null,e.overlayBounds=null,e.labelBounds.all=null,e.labelBounds.source=null,e.labelBounds.target=null,e.labelBounds.main=null,e.labelBounds.sourceRot=null,e.labelBounds.targetRot=null,e.labelBounds.mainRot=null,e.arrowBounds.source=null,e.arrowBounds.target=null,e.arrowBounds["mid-source"]=null,e.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this};yr.boundingBoxAt=function(t){var e=this.nodes(),r=this.cy(),a=r.hasCompoundNodes(),n=r.collection();if(a&&(n=e.filter(function(l){return l.isParent()}),e=e.not(n)),Me(t)){var i=t;t=function(){return i}}var o=function(f,c){return f._private.bbAtOldPos=t(f,c)},s=function(f){return f._private.bbAtOldPos};r.startBatch(),e.forEach(o).silentPositions(t),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0));var u=Gd(this.boundingBox({useCache:!1}));return e.silentPositions(s),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0)),r.endBatch(),u};Qr.boundingbox=Qr.bb=Qr.boundingBox;Qr.renderedBoundingbox=Qr.renderedBoundingBox;var cp=yr,ba,$a;ba=$a={};var nc=function(e){e.uppercaseName=Os(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=Os(e.outerName),ba[e.name]=function(){var a=this[0],n=a._private,i=n.cy,o=i._private.styleEnabled;if(a)if(o){if(a.isParent())return a.updateCompoundBounds(),n[e.autoName]||0;var s=a.pstyle(e.name);return s.strValue==="label"?(a.recalculateRenderedStyle(),n.rstyle[e.labelName]||0):s.pfValue}else return 1},ba["outer"+e.uppercaseName]=function(){var a=this[0],n=a._private,i=n.cy,o=i._private.styleEnabled;if(a)if(o){var s=a[e.name](),u=a.pstyle("border-position").value,l;u==="center"?l=a.pstyle("border-width").pfValue:u==="outside"?l=2*a.pstyle("border-width").pfValue:l=0;var f=2*a.padding();return s+l+f}else return 1},ba["rendered"+e.uppercaseName]=function(){var a=this[0];if(a){var n=a[e.name]();return n*this.cy().zoom()}},ba["rendered"+e.uppercaseOuterName]=function(){var a=this[0];if(a){var n=a[e.outerName]();return n*this.cy().zoom()}}};nc({name:"width"});nc({name:"height"});$a.padding=function(){var t=this[0],e=t._private;return t.isParent()?(t.updateCompoundBounds(),e.autoPadding!==void 0?e.autoPadding:t.pstyle("padding").pfValue):t.pstyle("padding").pfValue};$a.paddedHeight=function(){var t=this[0];return t.height()+2*t.padding()};$a.paddedWidth=function(){var t=this[0];return t.width()+2*t.padding()};var vp=$a,dp=function(e,r){if(e.isEdge()&&e.takesUpSpace())return r(e)},hp=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var a=e.cy();return Nn(r(e),a.zoom(),a.pan())}},gp=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var a=e.cy(),n=a.pan(),i=a.zoom();return r(e).map(function(o){return Nn(o,i,n)})}},pp=function(e){return e.renderer().getControlPoints(e)},yp=function(e){return e.renderer().getSegmentPoints(e)},mp=function(e){return e.renderer().getSourceEndpoint(e)},bp=function(e){return e.renderer().getTargetEndpoint(e)},wp=function(e){return e.renderer().getEdgeMidpoint(e)},xu={controlPoints:{get:pp,mult:!0},segmentPoints:{get:yp,mult:!0},sourceEndpoint:{get:mp},targetEndpoint:{get:bp},midpoint:{get:wp}},xp=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},Ep=Object.keys(xu).reduce(function(t,e){var r=xu[e],a=xp(e);return t[e]=function(){return dp(this,r.get)},r.mult?t[a]=function(){return gp(this,r.get)}:t[a]=function(){return hp(this,r.get)},t},{}),Cp=ye({},lp,cp,vp,Ep);var ic=function(e,r){this.recycle(e,r)};function da(){return!1}function tn(){return!0}ic.prototype={instanceString:function(){return"event"},recycle:function(e,r){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=da,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?tn:da):e!=null&&e.type?r=e:this.type=e,r!=null&&(this.originalEvent=r.originalEvent,this.type=r.type!=null?r.type:this.type,this.cy=r.cy,this.target=r.target,this.position=r.position,this.renderedPosition=r.renderedPosition,this.namespace=r.namespace,this.layout=r.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var a=this.position,n=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:a.x*n+i.x,y:a.y*n+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=tn;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=tn;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=tn,this.stopPropagation()},isDefaultPrevented:da,isPropagationStopped:da,isImmediatePropagationStopped:da};var oc=/^([^.]+)(\.(?:[^.]+))?$/,Tp=".*",sc={qualifierCompare:function(e,r){return e===r},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},Eu=Object.keys(sc),Sp={};function Hn(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Sp,e=arguments.length>1?arguments[1]:void 0,r=0;r<Eu.length;r++){var a=Eu[r];this[a]=t[a]||sc[a]}this.context=e||this.context,this.listeners=[],this.emitting=0}var dr=Hn.prototype,lc=function(e,r,a,n,i,o,s){We(n)&&(i=n,n=null),s&&(o==null?o=s:o=ye({},o,s));for(var u=qe(a)?a:a.split(/\s+/),l=0;l<u.length;l++){var f=u[l];if(!lr(f)){var c=f.match(oc);if(c){var v=c[1],d=c[2]?c[2]:null,h=r(e,f,v,d,n,i,o);if(h===!1)break}}}},Cu=function(e,r){return e.addEventFields(e.context,r),new ic(r.type,r)},kp=function(e,r,a){if(Mv(a)){r(e,a);return}else if(Me(a)){r(e,Cu(e,a));return}for(var n=qe(a)?a:a.split(/\s+/),i=0;i<n.length;i++){var o=n[i];if(!lr(o)){var s=o.match(oc);if(s){var u=s[1],l=s[2]?s[2]:null,f=Cu(e,{type:u,namespace:l,target:e.context});r(e,f)}}}};dr.on=dr.addListener=function(t,e,r,a,n){return lc(this,function(i,o,s,u,l,f,c){We(f)&&i.listeners.push({event:o,callback:f,type:s,namespace:u,qualifier:l,conf:c})},t,e,r,a,n),this};dr.one=function(t,e,r,a){return this.on(t,e,r,a,{one:!0})};dr.removeListener=dr.off=function(t,e,r,a){var n=this;this.emitting!==0&&(this.listeners=hd(this.listeners));for(var i=this.listeners,o=function(l){var f=i[l];lc(n,function(c,v,d,h,y,g){if((f.type===d||t==="*")&&(!h&&f.namespace!==".*"||f.namespace===h)&&(!y||c.qualifierCompare(f.qualifier,y))&&(!g||f.callback===g))return i.splice(l,1),!1},t,e,r,a)},s=i.length-1;s>=0;s--)o(s);return this};dr.removeAllListeners=function(){return this.removeListener("*")};dr.emit=dr.trigger=function(t,e,r){var a=this.listeners,n=a.length;return this.emitting++,qe(e)||(e=[e]),kp(this,function(i,o){r!=null&&(a=[{event:o.event,type:o.type,namespace:o.namespace,callback:r}],n=a.length);for(var s=function(){var f=a[u];if(f.type===o.type&&(!f.namespace||f.namespace===o.namespace||f.namespace===Tp)&&i.eventMatches(i.context,f,o)){var c=[o];e!=null&&pd(c,e),i.beforeEmit(i.context,f,o),f.conf&&f.conf.one&&(i.listeners=i.listeners.filter(function(h){return h!==f}));var v=i.callbackContext(i.context,f,o),d=f.callback.apply(v,c);i.afterEmit(i.context,f,o),d===!1&&(o.stopPropagation(),o.preventDefault())}},u=0;u<n;u++)s();i.bubble(i.context)&&!o.isPropagationStopped()&&i.parent(i.context).emit(o,e)},t),this.emitting--,this};var Bp={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,a){var n=r.qualifier;return n!=null?e!==a.target&&Oa(a.target)&&n.matches(a.target):!0},addEventFields:function(e,r){r.cy=e.cy(),r.target=e},callbackContext:function(e,r,a){return r.qualifier!=null?a.target:e},beforeEmit:function(e,r){r.conf&&r.conf.once&&r.conf.onceCollection.removeListener(r.event,r.qualifier,r.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},rn=function(e){return he(e)?new cr(e):e},uc={createEmitter:function(){for(var e=0;e<this.length;e++){var r=this[e],a=r._private;a.emitter||(a.emitter=new Hn(Bp,r))}return this},emitter:function(){return this._private.emitter},on:function(e,r,a){for(var n=rn(r),i=0;i<this.length;i++){var o=this[i];o.emitter().on(e,n,a)}return this},removeListener:function(e,r,a){for(var n=rn(r),i=0;i<this.length;i++){var o=this[i];o.emitter().removeListener(e,n,a)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){var r=this[e];r.emitter().removeAllListeners()}return this},one:function(e,r,a){for(var n=rn(r),i=0;i<this.length;i++){var o=this[i];o.emitter().one(e,n,a)}return this},once:function(e,r,a){for(var n=rn(r),i=0;i<this.length;i++){var o=this[i];o.emitter().on(e,n,a,{once:!0,onceCollection:this})}},emit:function(e,r){for(var a=0;a<this.length;a++){var n=this[a];n.emitter().emit(e,r)}return this},emitAndNotify:function(e,r){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,r),this}};Ne.eventAliasesOn(uc);var fc={nodes:function(e){return this.filter(function(r){return r.isNode()}).filter(e)},edges:function(e){return this.filter(function(r){return r.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),r=this.spawn(),a=0;a<this.length;a++){var n=this[a];n.isNode()?e.push(n):r.push(n)}return{nodes:e,edges:r}},filter:function(e,r){if(e===void 0)return this;if(he(e)||St(e))return new cr(e).filter(this);if(We(e)){for(var a=this.spawn(),n=this,i=0;i<n.length;i++){var o=n[i],s=r?e.apply(r,[o,i,n]):e(o,i,n);s&&a.push(o)}return a}return this.spawn()},not:function(e){if(e){he(e)&&(e=this.filter(e));for(var r=this.spawn(),a=0;a<this.length;a++){var n=this[a],i=e.has(n);i||r.push(n)}return r}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(he(e)){var r=e;return this.filter(r)}for(var a=this.spawn(),n=this,i=e,o=this.length<e.length,s=o?n:i,u=o?i:n,l=0;l<s.length;l++){var f=s[l];u.has(f)&&a.push(f)}return a},xor:function(e){var r=this._private.cy;he(e)&&(e=r.$(e));var a=this.spawn(),n=this,i=e,o=function(u,l){for(var f=0;f<u.length;f++){var c=u[f],v=c._private.data.id,d=l.hasElementWithId(v);d||a.push(c)}};return o(n,i),o(i,n),a},diff:function(e){var r=this._private.cy;he(e)&&(e=r.$(e));var a=this.spawn(),n=this.spawn(),i=this.spawn(),o=this,s=e,u=function(f,c,v){for(var d=0;d<f.length;d++){var h=f[d],y=h._private.data.id,g=c.hasElementWithId(y);g?i.merge(h):v.push(h)}};return u(o,s,a),u(s,o,n),{left:a,right:n,both:i}},add:function(e){var r=this._private.cy;if(!e)return this;if(he(e)){var a=e;e=r.mutableElements().filter(a)}for(var n=this.spawnSelf(),i=0;i<e.length;i++){var o=e[i],s=!this.has(o);s&&n.push(o)}return n},merge:function(e){var r=this._private,a=r.cy;if(!e)return this;if(e&&he(e)){var n=e;e=a.mutableElements().filter(n)}for(var i=r.map,o=0;o<e.length;o++){var s=e[o],u=s._private.data.id,l=!i.has(u);if(l){var f=this.length++;this[f]=s,i.set(u,{ele:s,index:f})}}return this},unmergeAt:function(e){var r=this[e],a=r.id(),n=this._private,i=n.map;this[e]=void 0,i.delete(a);var o=e===this.length-1;if(this.length>1&&!o){var s=this.length-1,u=this[s],l=u._private.data.id;this[s]=void 0,this[e]=u,i.set(l,{ele:u,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var r=this._private,a=e._private.data.id,n=r.map,i=n.get(a);if(!i)return this;var o=i.index;return this.unmergeAt(o),this},unmerge:function(e){var r=this._private.cy;if(!e)return this;if(e&&he(e)){var a=e;e=r.mutableElements().filter(a)}for(var n=0;n<e.length;n++)this.unmergeOne(e[n]);return this},unmergeBy:function(e){for(var r=this.length-1;r>=0;r--){var a=this[r];e(a)&&this.unmergeAt(r)}return this},map:function(e,r){for(var a=[],n=this,i=0;i<n.length;i++){var o=n[i],s=r?e.apply(r,[o,i,n]):e(o,i,n);a.push(s)}return a},reduce:function(e,r){for(var a=r,n=this,i=0;i<n.length;i++)a=e(a,n[i],i,n);return a},max:function(e,r){for(var a=-1/0,n,i=this,o=0;o<i.length;o++){var s=i[o],u=r?e.apply(r,[s,o,i]):e(s,o,i);u>a&&(a=u,n=s)}return{value:a,ele:n}},min:function(e,r){for(var a=1/0,n,i=this,o=0;o<i.length;o++){var s=i[o],u=r?e.apply(r,[s,o,i]):e(s,o,i);u<a&&(a=u,n=s)}return{value:a,ele:n}}},Ie=fc;Ie.u=Ie["|"]=Ie["+"]=Ie.union=Ie.or=Ie.add;Ie["\\"]=Ie["!"]=Ie["-"]=Ie.difference=Ie.relativeComplement=Ie.subtract=Ie.not;Ie.n=Ie["&"]=Ie["."]=Ie.and=Ie.intersection=Ie.intersect;Ie["^"]=Ie["(+)"]=Ie["(-)"]=Ie.symmetricDifference=Ie.symdiff=Ie.xor;Ie.fnFilter=Ie.filterFn=Ie.stdFilter=Ie.filter;Ie.complement=Ie.abscomp=Ie.absoluteComplement;var Dp={isNode:function(){return this.group()==="nodes"},isEdge:function(){return this.group()==="edges"},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},cc=function(e,r){var a=e.cy(),n=a.hasCompoundNodes();function i(f){var c=f.pstyle("z-compound-depth");return c.value==="auto"?n?f.zDepth():0:c.value==="bottom"?-1:c.value==="top"?as:0}var o=i(e)-i(r);if(o!==0)return o;function s(f){var c=f.pstyle("z-index-compare");return c.value==="auto"&&f.isNode()?1:0}var u=s(e)-s(r);if(u!==0)return u;var l=e.pstyle("z-index").value-r.pstyle("z-index").value;return l!==0?l:e.poolIndex()-r.poolIndex()},kn={forEach:function(e,r){if(We(e))for(var a=this.length,n=0;n<a;n++){var i=this[n],o=r?e.apply(r,[i,n,this]):e(i,n,this);if(o===!1)break}return this},toArray:function(){for(var e=[],r=0;r<this.length;r++)e.push(this[r]);return e},slice:function(e,r){var a=[],n=this.length;r==null&&(r=n),e==null&&(e=0),e<0&&(e=n+e),r<0&&(r=n+r);for(var i=e;i>=0&&i<r&&i<n;i++)a.push(this[i]);return this.spawn(a)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!We(e))return this;var r=this.toArray().sort(e);return this.spawn(r)},sortByZIndex:function(){return this.sort(cc)},zDepth:function(){var e=this[0];if(e){var r=e._private,a=r.group;if(a==="nodes"){var n=r.data.parent?e.parents().size():0;return e.isParent()?n:as-1}else{var i=r.source,o=r.target,s=i.zDepth(),u=o.zDepth();return Math.max(s,u,0)}}}};kn.each=kn.forEach;var Pp=function(){var e="undefined",r=(typeof Symbol>"u"?"undefined":rt(Symbol))!=e&&rt(Symbol.iterator)!=e;r&&(kn[Symbol.iterator]=function(){var a=this,n={value:void 0,done:!1},i=0,o=this.length;return uf({next:function(){return i<o?n.value=a[i++]:(n.value=void 0,n.done=!0),n}},Symbol.iterator,function(){return this})})};Pp();var Ap=ct({nodeDimensionsIncludeLabels:!1}),vn={layoutDimensions:function(e){e=Ap(e);var r;if(!this.takesUpSpace())r={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var a=this.boundingBox();r={w:a.w,h:a.h}}else r={w:this.outerWidth(),h:this.outerHeight()};return(r.w===0||r.h===0)&&(r.w=r.h=1),r},layoutPositions:function(e,r,a){var n=this.nodes().filter(function(E){return!E.isParent()}),i=this.cy(),o=r.eles,s=function(C){return C.id()},u=Jr(a,s);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=function(C,x,T){var k={x:x.x1+x.w/2,y:x.y1+x.h/2},B={x:(T.x-k.x)*C,y:(T.y-k.y)*C};return{x:k.x+B.x,y:k.y+B.y}},f=r.spacingFactor&&r.spacingFactor!==1,c=function(){if(!f)return null;for(var C=mt(),x=0;x<n.length;x++){var T=n[x],k=u(T,x);Pf(C,k.x,k.y)}return C},v=c(),d=Jr(function(E,C){var x=u(E,C);if(f){var T=Math.abs(r.spacingFactor);x=l(T,v,x)}return r.transform!=null&&(x=r.transform(E,x)),x},s);if(r.animate){for(var h=0;h<n.length;h++){var y=n[h],g=d(y,h),p=r.animateFilter==null||r.animateFilter(y,h);if(p){var m=y.animation({position:g,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(m)}else y.position(g)}if(r.fit){var b=i.animation({fit:{boundingBox:o.boundingBoxAt(d),padding:r.padding},duration:r.animationDuration,easing:r.animationEasing});e.animations.push(b)}else if(r.zoom!==void 0&&r.pan!==void 0){var w=i.animation({zoom:r.zoom,pan:r.pan,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(w)}e.animations.forEach(function(E){return E.play()}),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),ra.all(e.animations.map(function(E){return E.promise()})).then(function(){e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e})})}else n.positions(d),r.fit&&i.fit(r.eles,r.padding),r.zoom!=null&&i.zoom(r.zoom),r.pan&&i.pan(r.pan),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var r=this.cy();return r.makeLayout(ye({},e,{eles:this}))}};vn.createLayout=vn.makeLayout=vn.layout;function vc(t,e,r){var a=r._private,n=a.styleCache=a.styleCache||[],i;return(i=n[t])!=null||(i=n[t]=e(r)),i}function Gn(t,e){return t=Ar(t),function(a){return vc(t,e,a)}}function Un(t,e){t=Ar(t);var r=function(n){return e.call(n)};return function(){var n=this[0];if(n)return vc(t,r,n)}}var ut={recalculateRenderedStyle:function(e){var r=this.cy(),a=r.renderer(),n=r.styleEnabled();return a&&n&&a.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),r=function(i){return i._private.styleCache=null};if(e.hasCompoundNodes()){var a;a=this.spawnSelf().merge(this.descendants()).merge(this.parents()),a.merge(a.connectedEdges()),a.forEach(r)}else this.forEach(function(n){r(n),n.connectedEdges().forEach(r)});return this},updateStyle:function(e){var r=this._private.cy;if(!r.styleEnabled())return this;if(r.batching()){var a=r._private.batchStyleEles;return a.merge(this),this}var n=r.hasCompoundNodes(),i=this;e=!!(e||e===void 0),n&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var o=i;return e?o.emitAndNotify("style"):o.emit("style"),i.forEach(function(s){return s._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var r=0;r<this.length;r++){var a=this[r];a._private.styleDirty&&(a._private.styleDirty=!1,e.style().apply(a))}},parsedStyle:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,a=this[0],n=a.cy();if(n.styleEnabled()&&a){a._private.styleDirty&&(a._private.styleDirty=!1,n.style().apply(a));var i=a._private.style[e];return i??(r?n.style().getDefaultProperty(e):null)}},numericStyle:function(e){var r=this[0];if(r.cy().styleEnabled()&&r){var a=r.pstyle(e);return a.pfValue!==void 0?a.pfValue:a.value}},numericStyleUnits:function(e){var r=this[0];if(r.cy().styleEnabled()&&r)return r.pstyle(e).units},renderedStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=this[0];if(a)return r.style().getRenderedStyle(a,e)},style:function(e,r){var a=this.cy();if(!a.styleEnabled())return this;var n=!1,i=a.style();if(Me(e)){var o=e;i.applyBypass(this,o,n),this.emitAndNotify("style")}else if(he(e))if(r===void 0){var s=this[0];return s?i.getStylePropertyValue(s,e):void 0}else i.applyBypass(this,e,r,n),this.emitAndNotify("style");else if(e===void 0){var u=this[0];return u?i.getRawStyle(u):void 0}return this},removeStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=!1,n=r.style(),i=this;if(e===void 0)for(var o=0;o<i.length;o++){var s=i[o];n.removeAllBypasses(s,a)}else{e=e.split(/\s+/);for(var u=0;u<i.length;u++){var l=i[u];n.removeBypasses(l,e,a)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var r=e.hasCompoundNodes(),a=this[0];if(a){var n=a._private,i=a.pstyle("opacity").value;if(!r)return i;var o=n.data.parent?a.parents():null;if(o)for(var s=0;s<o.length;s++){var u=o[s],l=u.pstyle("opacity").value;i=l*i}return i}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0],a=r.cy().hasCompoundNodes();if(r)return a?r.effectiveOpacity()===0:r.pstyle("opacity").value===0},backgrounding:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0];return!!r._private.backgrounding}};function Co(t,e){var r=t._private,a=r.data.parent?t.parents():null;if(a)for(var n=0;n<a.length;n++){var i=a[n];if(!e(i))return!1}return!0}function gs(t){var e=t.ok,r=t.edgeOkViaNode||t.ok,a=t.parentOk||t.ok;return function(){var n=this.cy();if(!n.styleEnabled())return!0;var i=this[0],o=n.hasCompoundNodes();if(i){var s=i._private;if(!e(i))return!1;if(i.isNode())return!o||Co(i,a);var u=s.source,l=s.target;return r(u)&&(!o||Co(u,r))&&(u===l||r(l)&&(!o||Co(l,r)))}}}var aa=Gn("eleTakesUpSpace",function(t){return t.pstyle("display").value==="element"&&t.width()!==0&&(t.isNode()?t.height()!==0:!0)});ut.takesUpSpace=Un("takesUpSpace",gs({ok:aa}));var Rp=Gn("eleInteractive",function(t){return t.pstyle("events").value==="yes"&&t.pstyle("visibility").value==="visible"&&aa(t)}),Mp=Gn("parentInteractive",function(t){return t.pstyle("visibility").value==="visible"&&aa(t)});ut.interactive=Un("interactive",gs({ok:Rp,parentOk:Mp,edgeOkViaNode:aa}));ut.noninteractive=function(){var t=this[0];if(t)return!t.interactive()};var Lp=Gn("eleVisible",function(t){return t.pstyle("visibility").value==="visible"&&t.pstyle("opacity").pfValue!==0&&aa(t)}),Ip=aa;ut.visible=Un("visible",gs({ok:Lp,edgeOkViaNode:Ip}));ut.hidden=function(){var t=this[0];if(t)return!t.visible()};ut.isBundledBezier=Un("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});ut.bypass=ut.css=ut.style;ut.renderedCss=ut.renderedStyle;ut.removeBypass=ut.removeCss=ut.removeStyle;ut.pstyle=ut.parsedStyle;var sr={};function Tu(t){return function(){var e=arguments,r=[];if(e.length===2){var a=e[0],n=e[1];this.on(t.event,a,n)}else if(e.length===1&&We(e[0])){var i=e[0];this.on(t.event,i)}else if(e.length===0||e.length===1&&qe(e[0])){for(var o=e.length===1?e[0]:null,s=0;s<this.length;s++){var u=this[s],l=!t.ableField||u._private[t.ableField],f=u._private[t.field]!=t.value;if(t.overrideAble){var c=t.overrideAble(u);if(c!==void 0&&(l=c,!c))return this}l&&(u._private[t.field]=t.value,f&&r.push(u))}var v=this.spawn(r);v.updateStyle(),v.emit(t.event),o&&v.emit(o)}return this}}function na(t){sr[t.field]=function(){var e=this[0];if(e){if(t.overrideField){var r=t.overrideField(e);if(r!==void 0)return r}return e._private[t.field]}},sr[t.on]=Tu({event:t.on,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!0}),sr[t.off]=Tu({event:t.off,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!1})}na({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});na({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});na({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});na({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});sr.deselect=sr.unselect;sr.grabbed=function(){var t=this[0];if(t)return t._private.grabbed};na({field:"active",on:"activate",off:"unactivate"});na({field:"pannable",on:"panify",off:"unpanify"});sr.inactive=function(){var t=this[0];if(t)return!t._private.active};var ht={},Su=function(e){return function(a){for(var n=this,i=[],o=0;o<n.length;o++){var s=n[o];if(s.isNode()){for(var u=!1,l=s.connectedEdges(),f=0;f<l.length;f++){var c=l[f],v=c.source(),d=c.target();if(e.noIncomingEdges&&d===s&&v!==s||e.noOutgoingEdges&&v===s&&d!==s){u=!0;break}}u||i.push(s)}}return this.spawn(i,!0).filter(a)}},ku=function(e){return function(r){for(var a=this,n=[],i=0;i<a.length;i++){var o=a[i];if(o.isNode())for(var s=o.connectedEdges(),u=0;u<s.length;u++){var l=s[u],f=l.source(),c=l.target();e.outgoing&&f===o?(n.push(l),n.push(c)):e.incoming&&c===o&&(n.push(l),n.push(f))}}return this.spawn(n,!0).filter(r)}},Bu=function(e){return function(r){for(var a=this,n=[],i={};;){var o=e.outgoing?a.outgoers():a.incomers();if(o.length===0)break;for(var s=!1,u=0;u<o.length;u++){var l=o[u],f=l.id();i[f]||(i[f]=!0,n.push(l),s=!0)}if(!s)break;a=o}return this.spawn(n,!0).filter(r)}};ht.clearTraversalCache=function(){for(var t=0;t<this.length;t++)this[t]._private.traversalCache=null};ye(ht,{roots:Su({noIncomingEdges:!0}),leaves:Su({noOutgoingEdges:!0}),outgoers:Pt(ku({outgoing:!0}),"outgoers"),successors:Bu({outgoing:!0}),incomers:Pt(ku({incoming:!0}),"incomers"),predecessors:Bu({})});ye(ht,{neighborhood:Pt(function(t){for(var e=[],r=this.nodes(),a=0;a<r.length;a++)for(var n=r[a],i=n.connectedEdges(),o=0;o<i.length;o++){var s=i[o],u=s.source(),l=s.target(),f=n===u?l:u;f.length>0&&e.push(f[0]),e.push(s[0])}return this.spawn(e,!0).filter(t)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}});ht.neighbourhood=ht.neighborhood;ht.closedNeighbourhood=ht.closedNeighborhood;ht.openNeighbourhood=ht.openNeighborhood;ye(ht,{source:Pt(function(e){var r=this[0],a;return r&&(a=r._private.source||r.cy().collection()),a&&e?a.filter(e):a},"source"),target:Pt(function(e){var r=this[0],a;return r&&(a=r._private.target||r.cy().collection()),a&&e?a.filter(e):a},"target"),sources:Du({attr:"source"}),targets:Du({attr:"target"})});function Du(t){return function(r){for(var a=[],n=0;n<this.length;n++){var i=this[n],o=i._private[t.attr];o&&a.push(o)}return this.spawn(a,!0).filter(r)}}ye(ht,{edgesWith:Pt(Pu(),"edgesWith"),edgesTo:Pt(Pu({thisIsSrc:!0}),"edgesTo")});function Pu(t){return function(r){var a=[],n=this._private.cy,i=t||{};he(r)&&(r=n.$(r));for(var o=0;o<r.length;o++)for(var s=r[o]._private.edges,u=0;u<s.length;u++){var l=s[u],f=l._private.data,c=this.hasElementWithId(f.source)&&r.hasElementWithId(f.target),v=r.hasElementWithId(f.source)&&this.hasElementWithId(f.target),d=c||v;d&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!c||i.thisIsTgt&&!v)||a.push(l))}return this.spawn(a,!0)}}ye(ht,{connectedEdges:Pt(function(t){for(var e=[],r=this,a=0;a<r.length;a++){var n=r[a];if(n.isNode())for(var i=n._private.edges,o=0;o<i.length;o++){var s=i[o];e.push(s)}}return this.spawn(e,!0).filter(t)},"connectedEdges"),connectedNodes:Pt(function(t){for(var e=[],r=this,a=0;a<r.length;a++){var n=r[a];n.isEdge()&&(e.push(n.source()[0]),e.push(n.target()[0]))}return this.spawn(e,!0).filter(t)},"connectedNodes"),parallelEdges:Pt(Au(),"parallelEdges"),codirectedEdges:Pt(Au({codirected:!0}),"codirectedEdges")});function Au(t){var e={codirected:!1};return t=ye({},e,t),function(a){for(var n=[],i=this.edges(),o=t,s=0;s<i.length;s++)for(var u=i[s],l=u._private,f=l.source,c=f._private.data.id,v=l.data.target,d=f._private.edges,h=0;h<d.length;h++){var y=d[h],g=y._private.data,p=g.target,m=g.source,b=p===v&&m===c,w=c===p&&v===m;(o.codirected&&b||!o.codirected&&(b||w))&&n.push(y)}return this.spawn(n,!0).filter(a)}}ye(ht,{components:function(e){var r=this,a=r.cy(),n=a.collection(),i=e==null?r.nodes():e.nodes(),o=[];e!=null&&i.empty()&&(i=e.sources());var s=function(f,c){n.merge(f),i.unmerge(f),c.merge(f)};if(i.empty())return r.spawn();var u=function(){var f=a.collection();o.push(f);var c=i[0];s(c,f),r.bfs({directed:!1,roots:c,visit:function(d){return s(d,f)}}),f.forEach(function(v){v.connectedEdges().forEach(function(d){r.has(d)&&f.has(d.source())&&f.has(d.target())&&f.merge(d)})})};do u();while(i.length>0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});ht.componentsOf=ht.components;var ft=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){Ge("A collection must have a reference to the core");return}var i=new Xt,o=!1;if(!r)r=[];else if(r.length>0&&Me(r[0])&&!Oa(r[0])){o=!0;for(var s=[],u=new ta,l=0,f=r.length;l<f;l++){var c=r[l];c.data==null&&(c.data={});var v=c.data;if(v.id==null)v.id=kf();else if(e.hasElementWithId(v.id)||u.has(v.id))continue;var d=new On(e,c,!1);s.push(d),u.add(v.id)}r=s}this.length=0;for(var h=0,y=r.length;h<y;h++){var g=r[h][0];if(g!=null){var p=g._private.data.id;(!a||!i.has(p))&&(a&&i.set(p,{index:this.length,ele:g}),this[this.length]=g,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(m){this.lazyMap=m},rebuildMap:function(){for(var b=this.lazyMap=new Xt,w=this.eles,E=0;E<w.length;E++){var C=w[E];b.set(C.id(),{index:E,ele:C})}}},a&&(this._private.map=i),o&&!n&&this.restore()},_e=On.prototype=ft.prototype=Object.create(Array.prototype);_e.instanceString=function(){return"collection"};_e.spawn=function(t,e){return new ft(this.cy(),t,e)};_e.spawnSelf=function(){return this.spawn(this)};_e.cy=function(){return this._private.cy};_e.renderer=function(){return this._private.cy.renderer()};_e.element=function(){return this[0]};_e.collection=function(){return vf(this)?this:new ft(this._private.cy,[this])};_e.unique=function(){return new ft(this._private.cy,this,!0)};_e.hasElementWithId=function(t){return t=""+t,this._private.map.has(t)};_e.getElementById=function(t){t=""+t;var e=this._private.cy,r=this._private.map.get(t);return r?r.ele:new ft(e)};_e.$id=_e.getElementById;_e.poolIndex=function(){var t=this._private.cy,e=t._private.elements,r=this[0]._private.data.id;return e._private.map.get(r).index};_e.indexOf=function(t){var e=t[0]._private.data.id;return this._private.map.get(e).index};_e.indexOfId=function(t){return t=""+t,this._private.map.get(t).index};_e.json=function(t){var e=this.element(),r=this.cy();if(e==null&&t)return this;if(e!=null){var a=e._private;if(Me(t)){if(r.startBatch(),t.data){e.data(t.data);var n=a.data;if(e.isEdge()){var i=!1,o={},s=t.data.source,u=t.data.target;s!=null&&s!=n.source&&(o.source=""+s,i=!0),u!=null&&u!=n.target&&(o.target=""+u,i=!0),i&&(e=e.move(o))}else{var l="parent"in t.data,f=t.data.parent;l&&(f!=null||n.parent!=null)&&f!=n.parent&&(f===void 0&&(f=null),f!=null&&(f=""+f),e=e.move({parent:f}))}}t.position&&e.position(t.position);var c=function(y,g,p){var m=t[y];m!=null&&m!==a[y]&&(m?e[g]():e[p]())};return c("removed","remove","restore"),c("selected","select","unselect"),c("selectable","selectify","unselectify"),c("locked","lock","unlock"),c("grabbable","grabify","ungrabify"),c("pannable","panify","unpanify"),t.classes!=null&&e.classes(t.classes),r.endBatch(),this}else if(t===void 0){var v={data:$t(a.data),position:$t(a.position),group:a.group,removed:a.removed,selected:a.selected,selectable:a.selectable,locked:a.locked,grabbable:a.grabbable,pannable:a.pannable,classes:null};v.classes="";var d=0;return a.classes.forEach(function(h){return v.classes+=d++===0?h:" "+h}),v}}};_e.jsons=function(){for(var t=[],e=0;e<this.length;e++){var r=this[e],a=r.json();t.push(a)}return t};_e.clone=function(){for(var t=this.cy(),e=[],r=0;r<this.length;r++){var a=this[r],n=a.json(),i=new On(t,n,!1);e.push(i)}return new ft(t,e)};_e.copy=_e.clone;_e.restore=function(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=r.cy(),n=a._private,i=[],o=[],s,u=0,l=r.length;u<l;u++){var f=r[u];e&&!f.removed()||(f.isNode()?i.push(f):o.push(f))}s=i.concat(o);var c,v=function(){s.splice(c,1),c--};for(c=0;c<s.length;c++){var d=s[c],h=d._private,y=h.data;if(d.clearTraversalCache(),!(!e&&!h.removed)){if(y.id===void 0)y.id=kf();else if(ae(y.id))y.id=""+y.id;else if(lr(y.id)||!he(y.id)){Ge("Can not create element with invalid string ID `"+y.id+"`"),v();continue}else if(a.hasElementWithId(y.id)){Ge("Can not create second element with ID `"+y.id+"`"),v();continue}}var g=y.id;if(d.isNode()){var p=h.position;p.x==null&&(p.x=0),p.y==null&&(p.y=0)}if(d.isEdge()){for(var m=d,b=["source","target"],w=b.length,E=!1,C=0;C<w;C++){var x=b[C],T=y[x];ae(T)&&(T=y[x]=""+y[x]),T==null||T===""?(Ge("Can not create edge `"+g+"` with unspecified "+x),E=!0):a.hasElementWithId(T)||(Ge("Can not create edge `"+g+"` with nonexistent "+x+" `"+T+"`"),E=!0)}if(E){v();continue}var k=a.getElementById(y.source),B=a.getElementById(y.target);k.same(B)?k._private.edges.push(m):(k._private.edges.push(m),B._private.edges.push(m)),m._private.source=k,m._private.target=B}h.map=new Xt,h.map.set(g,{ele:d,index:0}),h.removed=!1,e&&a.addToPool(d)}for(var D=0;D<i.length;D++){var P=i[D],A=P._private.data;ae(A.parent)&&(A.parent=""+A.parent);var R=A.parent,L=R!=null;if(L||P._private.parent){var I=P._private.parent?a.collection().merge(P._private.parent):a.getElementById(R);if(I.empty())A.parent=void 0;else if(I[0].removed())ze("Node added with missing parent, reference to parent removed"),A.parent=void 0,P._private.parent=null;else{for(var M=!1,O=I;!O.empty();){if(P.same(O)){M=!0,A.parent=void 0;break}O=O.parent()}M||(I[0]._private.children.push(P),P._private.parent=I[0],n.hasCompoundNodes=!0)}}}if(s.length>0){for(var q=s.length===r.length?r:new ft(a,s),$=0;$<q.length;$++){var N=q[$];N.isNode()||(N.parallelEdges().clearTraversalCache(),N.source().clearTraversalCache(),N.target().clearTraversalCache())}var F;n.hasCompoundNodes?F=a.collection().merge(q).merge(q.connectedNodes()).merge(q.parent()):F=q,F.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(t),t?q.emitAndNotify("add"):e&&q.emit("add")}return r};_e.removed=function(){var t=this[0];return t&&t._private.removed};_e.inside=function(){var t=this[0];return t&&!t._private.removed};_e.remove=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=[],n={},i=r._private.cy;function o(R){for(var L=R._private.edges,I=0;I<L.length;I++)u(L[I])}function s(R){for(var L=R._private.children,I=0;I<L.length;I++)u(L[I])}function u(R){var L=n[R.id()];e&&R.removed()||L||(n[R.id()]=!0,R.isNode()?(a.push(R),o(R),s(R)):a.unshift(R))}for(var l=0,f=r.length;l<f;l++){var c=r[l];u(c)}function v(R,L){var I=R._private.edges;ur(I,L),R.clearTraversalCache()}function d(R){R.clearTraversalCache()}var h=[];h.ids={};function y(R,L){L=L[0],R=R[0];var I=R._private.children,M=R.id();ur(I,L),L._private.parent=null,h.ids[M]||(h.ids[M]=!0,h.push(R))}r.dirtyCompoundBoundsCache(),e&&i.removeFromPool(a);for(var g=0;g<a.length;g++){var p=a[g];if(p.isEdge()){var m=p.source()[0],b=p.target()[0];v(m,p),v(b,p);for(var w=p.parallelEdges(),E=0;E<w.length;E++){var C=w[E];d(C),C.isBundledBezier()&&C.dirtyBoundingBoxCache()}}else{var x=p.parent();x.length!==0&&y(x,p)}e&&(p._private.removed=!0)}var T=i._private.elements;i._private.hasCompoundNodes=!1;for(var k=0;k<T.length;k++){var B=T[k];if(B.isParent()){i._private.hasCompoundNodes=!0;break}}var D=new ft(this.cy(),a);D.size()>0&&(t?D.emitAndNotify("remove"):e&&D.emit("remove"));for(var P=0;P<h.length;P++){var A=h[P];(!e||!A.removed())&&A.updateStyle()}return D};_e.move=function(t){var e=this._private.cy,r=this,a=!1,n=!1,i=function(h){return h==null?h:""+h};if(t.source!==void 0||t.target!==void 0){var o=i(t.source),s=i(t.target),u=o!=null&&e.hasElementWithId(o),l=s!=null&&e.hasElementWithId(s);(u||l)&&(e.batch(function(){r.remove(a,n),r.emitAndNotify("moveout");for(var d=0;d<r.length;d++){var h=r[d],y=h._private.data;h.isEdge()&&(u&&(y.source=o),l&&(y.target=s))}r.restore(a,n)}),r.emitAndNotify("move"))}else if(t.parent!==void 0){var f=i(t.parent),c=f===null||e.hasElementWithId(f);if(c){var v=f===null?void 0:f;e.batch(function(){var d=r.remove(a,n);d.emitAndNotify("moveout");for(var h=0;h<r.length;h++){var y=r[h],g=y._private.data;y.isNode()&&(g.parent=v)}d.restore(a,n)}),r.emitAndNotify("move")}}return this};[Ff,Ug,cn,or,ea,sp,_n,Cp,uc,fc,Dp,kn,vn,ut,sr,ht].forEach(function(t){ye(_e,t)});var Op={add:function(e){var r,a=this;if(St(e)){var n=e;if(n._private.cy===a)r=n.restore();else{for(var i=[],o=0;o<n.length;o++){var s=n[o];i.push(s.json())}r=new ft(a,i)}}else if(qe(e)){var u=e;r=new ft(a,u)}else if(Me(e)&&(qe(e.nodes)||qe(e.edges))){for(var l=e,f=[],c=["nodes","edges"],v=0,d=c.length;v<d;v++){var h=c[v],y=l[h];if(qe(y))for(var g=0,p=y.length;g<p;g++){var m=ye({group:h},y[g]);f.push(m)}}r=new ft(a,f)}else{var b=e;r=new On(a,b).collection()}return r},remove:function(e){if(!St(e)){if(he(e)){var r=e;e=this.$(r)}}return e.remove()}};function Np(t,e,r,a){var n=4,i=.001,o=1e-7,s=10,u=11,l=1/(u-1),f=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var c=0;c<4;++c)if(typeof arguments[c]!="number"||isNaN(arguments[c])||!isFinite(arguments[c]))return!1;t=Math.min(t,1),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var v=f?new Float32Array(u):new Array(u);function d(B,D){return 1-3*D+3*B}function h(B,D){return 3*D-6*B}function y(B){return 3*B}function g(B,D,P){return((d(D,P)*B+h(D,P))*B+y(D))*B}function p(B,D,P){return 3*d(D,P)*B*B+2*h(D,P)*B+y(D)}function m(B,D){for(var P=0;P<n;++P){var A=p(D,t,r);if(A===0)return D;var R=g(D,t,r)-B;D-=R/A}return D}function b(){for(var B=0;B<u;++B)v[B]=g(B*l,t,r)}function w(B,D,P){var A,R,L=0;do R=D+(P-D)/2,A=g(R,t,r)-B,A>0?P=R:D=R;while(Math.abs(A)>o&&++L<s);return R}function E(B){for(var D=0,P=1,A=u-1;P!==A&&v[P]<=B;++P)D+=l;--P;var R=(B-v[P])/(v[P+1]-v[P]),L=D+R*l,I=p(L,t,r);return I>=i?m(B,L):I===0?L:w(B,D,D+l)}var C=!1;function x(){C=!0,(t!==e||r!==a)&&b()}var T=function(D){return C||x(),t===e&&r===a?D:D===0?0:D===1?1:g(E(D),e,a)};T.getControlPoints=function(){return[{x:t,y:e},{x:r,y:a}]};var k="generateBezier("+[t,e,r,a]+")";return T.toString=function(){return k},T}var zp=(function(){function t(a){return-a.tension*a.x-a.friction*a.v}function e(a,n,i){var o={x:a.x+i.dx*n,v:a.v+i.dv*n,tension:a.tension,friction:a.friction};return{dx:o.v,dv:t(o)}}function r(a,n){var i={dx:a.v,dv:t(a)},o=e(a,n*.5,i),s=e(a,n*.5,o),u=e(a,n,s),l=1/6*(i.dx+2*(o.dx+s.dx)+u.dx),f=1/6*(i.dv+2*(o.dv+s.dv)+u.dv);return a.x=a.x+l*n,a.v=a.v+f*n,a}return function a(n,i,o){var s={x:-1,v:0,tension:null,friction:null},u=[0],l=0,f=1/1e4,c=16/1e3,v,d,h;for(n=parseFloat(n)||500,i=parseFloat(i)||20,o=o||null,s.tension=n,s.friction=i,v=o!==null,v?(l=a(n,i),d=l/o*c):d=c;h=r(h||s,d),u.push(1+h.x),l+=16,Math.abs(h.x)>f&&Math.abs(h.v)>f;);return v?function(y){return u[y*(u.length-1)|0]}:l}})(),$e=function(e,r,a,n){var i=Np(e,r,a,n);return function(o,s,u){return o+(s-o)*i(u)}},dn={linear:function(e,r,a){return e+(r-e)*a},ease:$e(.25,.1,.25,1),"ease-in":$e(.42,0,1,1),"ease-out":$e(0,0,.58,1),"ease-in-out":$e(.42,0,.58,1),"ease-in-sine":$e(.47,0,.745,.715),"ease-out-sine":$e(.39,.575,.565,1),"ease-in-out-sine":$e(.445,.05,.55,.95),"ease-in-quad":$e(.55,.085,.68,.53),"ease-out-quad":$e(.25,.46,.45,.94),"ease-in-out-quad":$e(.455,.03,.515,.955),"ease-in-cubic":$e(.55,.055,.675,.19),"ease-out-cubic":$e(.215,.61,.355,1),"ease-in-out-cubic":$e(.645,.045,.355,1),"ease-in-quart":$e(.895,.03,.685,.22),"ease-out-quart":$e(.165,.84,.44,1),"ease-in-out-quart":$e(.77,0,.175,1),"ease-in-quint":$e(.755,.05,.855,.06),"ease-out-quint":$e(.23,1,.32,1),"ease-in-out-quint":$e(.86,0,.07,1),"ease-in-expo":$e(.95,.05,.795,.035),"ease-out-expo":$e(.19,1,.22,1),"ease-in-out-expo":$e(1,0,0,1),"ease-in-circ":$e(.6,.04,.98,.335),"ease-out-circ":$e(.075,.82,.165,1),"ease-in-out-circ":$e(.785,.135,.15,.86),spring:function(e,r,a){if(a===0)return dn.linear;var n=zp(e,r,a);return function(i,o,s){return i+(o-i)*n(s)}},"cubic-bezier":$e};function Ru(t,e,r,a,n){if(a===1||e===r)return r;var i=n(e,r,a);return t==null||((t.roundValue||t.color)&&(i=Math.round(i)),t.min!==void 0&&(i=Math.max(i,t.min)),t.max!==void 0&&(i=Math.min(i,t.max))),i}function Mu(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function Vr(t,e,r,a,n){var i=n!=null?n.type:null;r<0?r=0:r>1&&(r=1);var o=Mu(t,n),s=Mu(e,n);if(ae(o)&&ae(s))return Ru(i,o,s,r,a);if(qe(o)&&qe(s)){for(var u=[],l=0;l<s.length;l++){var f=o[l],c=s[l];if(f!=null&&c!=null){var v=Ru(i,f,c,r,a);u.push(v)}else u.push(c)}return u}}function Fp(t,e,r,a){var n=!a,i=t._private,o=e._private,s=o.easing,u=o.startTime,l=a?t:t.cy(),f=l.style();if(!o.easingImpl)if(s==null)o.easingImpl=dn.linear;else{var c;if(he(s)){var v=f.parse("transition-timing-function",s);c=v.value}else c=s;var d,h;he(c)?(d=c,h=[]):(d=c[1],h=c.slice(2).map(function(q){return+q})),h.length>0?(d==="spring"&&h.push(o.duration),o.easingImpl=dn[d].apply(null,h)):o.easingImpl=dn[d]}var y=o.easingImpl,g;if(o.duration===0?g=1:g=(r-u)/o.duration,o.applying&&(g=o.progress),g<0?g=0:g>1&&(g=1),o.delay==null){var p=o.startPosition,m=o.position;if(m&&n&&!t.locked()){var b={};ha(p.x,m.x)&&(b.x=Vr(p.x,m.x,g,y)),ha(p.y,m.y)&&(b.y=Vr(p.y,m.y,g,y)),t.position(b)}var w=o.startPan,E=o.pan,C=i.pan,x=E!=null&&a;x&&(ha(w.x,E.x)&&(C.x=Vr(w.x,E.x,g,y)),ha(w.y,E.y)&&(C.y=Vr(w.y,E.y,g,y)),t.emit("pan"));var T=o.startZoom,k=o.zoom,B=k!=null&&a;B&&(ha(T,k)&&(i.zoom=Ba(i.minZoom,Vr(T,k,g,y),i.maxZoom)),t.emit("zoom")),(x||B)&&t.emit("viewport");var D=o.style;if(D&&D.length>0&&n){for(var P=0;P<D.length;P++){var A=D[P],R=A.name,L=A,I=o.startStyle[R],M=f.properties[I.name],O=Vr(I,L,g,y,M);f.overrideBypass(t,R,O)}t.emit("style")}}return o.progress=g,g}function ha(t,e){return t==null||e==null?!1:ae(t)&&ae(e)?!0:!!(t&&e)}function Vp(t,e,r,a){var n=e._private;n.started=!0,n.startTime=r-n.progress*n.duration}function Lu(t,e){var r=e._private.aniEles,a=[];function n(f,c){var v=f._private,d=v.animation.current,h=v.animation.queue,y=!1;if(d.length===0){var g=h.shift();g&&d.push(g)}for(var p=function(C){for(var x=C.length-1;x>=0;x--){var T=C[x];T()}C.splice(0,C.length)},m=d.length-1;m>=0;m--){var b=d[m],w=b._private;if(w.stopped){d.splice(m,1),w.hooked=!1,w.playing=!1,w.started=!1,p(w.frames);continue}!w.playing&&!w.applying||(w.playing&&w.applying&&(w.applying=!1),w.started||Vp(f,b,t),Fp(f,b,t,c),w.applying&&(w.applying=!1),p(w.frames),w.step!=null&&w.step(t),b.completed()&&(d.splice(m,1),w.hooked=!1,w.playing=!1,w.started=!1,p(w.completes)),y=!0)}return!c&&d.length===0&&h.length===0&&a.push(f),y}for(var i=!1,o=0;o<r.length;o++){var s=r[o],u=n(s);i=i||u}var l=n(e,!0);(i||l)&&(r.length>0?e.notify("draw",r):e.notify("draw")),r.unmerge(a),e.emit("step")}var qp={animate:Ne.animate(),animation:Ne.animation(),animated:Ne.animated(),clearQueue:Ne.clearQueue(),delay:Ne.delay(),delayAnimation:Ne.delayAnimation(),stop:Ne.stop(),addToAnimationPool:function(e){var r=this;r.styleEnabled()&&r._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function r(){e._private.animationsRunning&&xn(function(i){Lu(i,e),r()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(i,o){Lu(o,e)},a.beforeRenderPriorities.animations):r()}},$p={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,a){var n=r.qualifier;return n!=null?e!==a.target&&Oa(a.target)&&n.matches(a.target):!0},addEventFields:function(e,r){r.cy=e,r.target=e},callbackContext:function(e,r,a){return r.qualifier!=null?a.target:e}},an=function(e){return he(e)?new cr(e):e},dc={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Hn($p,this)),this},emitter:function(){return this._private.emitter},on:function(e,r,a){return this.emitter().on(e,an(r),a),this},removeListener:function(e,r,a){return this.emitter().removeListener(e,an(r),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,r,a){return this.emitter().one(e,an(r),a),this},once:function(e,r,a){return this.emitter().one(e,an(r),a),this},emit:function(e,r){return this.emitter().emit(e,r),this},emitAndNotify:function(e,r){return this.emit(e),this.notify(e,r),this}};Ne.eventAliasesOn(dc);var _o={png:function(e){var r=this._private.renderer;return e=e||{},r.png(e)},jpg:function(e){var r=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",r.jpg(e)}};_o.jpeg=_o.jpg;var hn={layout:function(e){var r=this;if(e==null){Ge("Layout options must be specified to make a layout");return}if(e.name==null){Ge("A `name` must be specified to make a layout");return}var a=e.name,n=r.extension("layout",a);if(n==null){Ge("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;he(e.eles)?i=r.$(e.eles):i=e.eles!=null?e.eles:r.$();var o=new n(ye({},e,{cy:r,eles:i}));return o}};hn.createLayout=hn.makeLayout=hn.layout;var _p={notify:function(e,r){var a=this._private;if(this.batching()){a.batchNotifications=a.batchNotifications||{};var n=a.batchNotifications[e]=a.batchNotifications[e]||this.collection();r!=null&&n.merge(r);return}if(a.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,r)}},notifications:function(e){var r=this._private;return e===void 0?r.notificationsEnabled:(r.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var r=this.renderer();Object.keys(e.batchNotifications).forEach(function(a){var n=e.batchNotifications[a];n.empty()?r.notify(a):r.notify(a,n)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var r=this;return this.batch(function(){for(var a=Object.keys(e),n=0;n<a.length;n++){var i=a[n],o=e[i],s=r.getElementById(i);s.data(o)}})}},Hp=ct({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1,webgl:!1,webglDebug:!1,webglDebugShowAtlases:!1,webglTexSize:2048,webglTexRows:36,webglTexRowsNodes:18,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),Ho={renderTo:function(e,r,a,n){var i=this._private.renderer;return i.renderTo(e,r,a,n),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var r=this,a=r.extension("renderer",e.name);if(a==null){Ge("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}e.wheelSensitivity!==void 0&&ze("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var n=Hp(e);n.cy=r,r._private.renderer=new a(n),this.notify("init")},destroyRenderer:function(){var e=this;e.notify("destroy");var r=e.container();if(r)for(r._cyreg=null;r.childNodes.length>0;)r.removeChild(r.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(a){var n=a._private;n.rscratch={},n.rstyle={},n.animation.current=[],n.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Ho.invalidateDimensions=Ho.resize;var gn={collection:function(e,r){return he(e)?this.$(e):St(e)?e.collection():qe(e)?(r||(r={}),new ft(this,e,r.unique,r.removed)):new ft(this)},nodes:function(e){var r=this.$(function(a){return a.isNode()});return e?r.filter(e):r},edges:function(e){var r=this.$(function(a){return a.isEdge()});return e?r.filter(e):r},$:function(e){var r=this._private.elements;return e?r.filter(e):r.spawnSelf()},mutableElements:function(){return this._private.elements}};gn.elements=gn.filter=gn.$;var st={},xa="t",Gp="f";st.apply=function(t){for(var e=this,r=e._private,a=r.cy,n=a.collection(),i=0;i<t.length;i++){var o=t[i],s=e.getContextMeta(o);if(!s.empty){var u=e.getContextStyle(s),l=e.applyContextStyle(s,u,o);o._private.appliedInitStyle?e.updateTransitions(o,l.diffProps):o._private.appliedInitStyle=!0;var f=e.updateStyleHints(o);f&&n.push(o)}}return n};st.getPropertiesDiff=function(t,e){var r=this,a=r._private.propDiffs=r._private.propDiffs||{},n=t+"-"+e,i=a[n];if(i)return i;for(var o=[],s={},u=0;u<r.length;u++){var l=r[u],f=t[u]===xa,c=e[u]===xa,v=f!==c,d=l.mappedProperties.length>0;if(v||c&&d){var h=void 0;v&&d||v?h=l.properties:d&&(h=l.mappedProperties);for(var y=0;y<h.length;y++){for(var g=h[y],p=g.name,m=!1,b=u+1;b<r.length;b++){var w=r[b],E=e[b]===xa;if(E&&(m=w.properties[g.name]!=null,m))break}!s[p]&&!m&&(s[p]=!0,o.push(p))}}}return a[n]=o,o};st.getContextMeta=function(t){for(var e=this,r="",a,n=t._private.styleCxtKey||"",i=0;i<e.length;i++){var o=e[i],s=o.selector&&o.selector.matches(t);s?r+=xa:r+=Gp}return a=e.getPropertiesDiff(n,r),t._private.styleCxtKey=r,{key:r,diffPropNames:a,empty:a.length===0}};st.getContextStyle=function(t){var e=t.key,r=this,a=this._private.contextStyles=this._private.contextStyles||{};if(a[e])return a[e];for(var n={_private:{key:e}},i=0;i<r.length;i++){var o=r[i],s=e[i]===xa;if(s)for(var u=0;u<o.properties.length;u++){var l=o.properties[u];n[l.name]=l}}return a[e]=n,n};st.applyContextStyle=function(t,e,r){for(var a=this,n=t.diffPropNames,i={},o=a.types,s=0;s<n.length;s++){var u=n[s],l=e[u],f=r.pstyle(u);if(!l)if(f)f.bypass?l={name:u,deleteBypassed:!0}:l={name:u,delete:!0};else continue;if(f!==l){if(l.mapped===o.fn&&f!=null&&f.mapping!=null&&f.mapping.value===l.value){var c=f.mapping,v=c.fnValue=l.value(r);if(v===c.prevFnValue)continue}var d=i[u]={prev:f};a.applyParsedProperty(r,l),d.next=r.pstyle(u),d.next&&d.next.bypass&&(d.next=d.next.bypassed)}}return{diffProps:i}};st.updateStyleHints=function(t){var e=t._private,r=this,a=r.propertyGroupNames,n=r.propertyGroupKeys,i=function(G,Y,re){return r.getPropertiesHash(G,Y,re)},o=e.styleKey;if(t.removed())return!1;var s=e.group==="nodes",u=t._private.style;a=Object.keys(u);for(var l=0;l<n.length;l++){var f=n[l];e.styleKeys[f]=[Br,Gr]}for(var c=function(G,Y){return e.styleKeys[Y][0]=Ta(G,e.styleKeys[Y][0])},v=function(G,Y){return e.styleKeys[Y][1]=Sa(G,e.styleKeys[Y][1])},d=function(G,Y){c(G,Y),v(G,Y)},h=function(G,Y){for(var re=0;re<G.length;re++){var ve=G.charCodeAt(re);c(ve,Y),v(ve,Y)}},y=2e9,g=function(G){return-128<G&&G<128&&Math.floor(G)!==G?y-(G*1024|0):G},p=0;p<a.length;p++){var m=a[p],b=u[m];if(b!=null){var w=this.properties[m],E=w.type,C=w.groupKey,x=void 0;w.hashOverride!=null?x=w.hashOverride(t,b):b.pfValue!=null&&(x=b.pfValue);var T=w.enums==null?b.value:null,k=x!=null,B=T!=null,D=k||B,P=b.units;if(E.number&&D&&!E.multiple){var A=k?x:T;d(g(A),C),!k&&P!=null&&h(P,C)}else h(b.strValue,C)}}for(var R=[Br,Gr],L=0;L<n.length;L++){var I=n[L],M=e.styleKeys[I];R[0]=Ta(M[0],R[0]),R[1]=Sa(M[1],R[1])}e.styleKey=od(R[0],R[1]);var O=e.styleKeys;e.labelDimsKey=er(O.labelDimensions);var q=i(t,["label"],O.labelDimensions);if(e.labelKey=er(q),e.labelStyleKey=er(Ya(O.commonLabel,q)),!s){var $=i(t,["source-label"],O.labelDimensions);e.sourceLabelKey=er($),e.sourceLabelStyleKey=er(Ya(O.commonLabel,$));var N=i(t,["target-label"],O.labelDimensions);e.targetLabelKey=er(N),e.targetLabelStyleKey=er(Ya(O.commonLabel,N))}if(s){var F=e.styleKeys,W=F.nodeBody,J=F.nodeBorder,Z=F.nodeOutline,j=F.backgroundImage,te=F.compound,ne=F.pie,Q=F.stripe,V=[W,J,Z,j,te,ne,Q].filter(function(H){return H!=null}).reduce(Ya,[Br,Gr]);e.nodeKey=er(V),e.hasPie=ne!=null&&ne[0]!==Br&&ne[1]!==Gr,e.hasStripe=Q!=null&&Q[0]!==Br&&Q[1]!==Gr}return o!==e.styleKey};st.clearStyleHints=function(t){var e=t._private;e.styleCxtKey="",e.styleKeys={},e.styleKey=null,e.labelKey=null,e.labelStyleKey=null,e.sourceLabelKey=null,e.sourceLabelStyleKey=null,e.targetLabelKey=null,e.targetLabelStyleKey=null,e.nodeKey=null,e.hasPie=null,e.hasStripe=null};st.applyParsedProperty=function(t,e){var r=this,a=e,n=t._private.style,i,o=r.types,s=r.properties[a.name].type,u=a.bypass,l=n[a.name],f=l&&l.bypass,c=t._private,v="mapping",d=function(W){return W==null?null:W.pfValue!=null?W.pfValue:W.value},h=function(){var W=d(l),J=d(a);r.checkTriggers(t,a.name,W,J)};if(e.name==="curve-style"&&t.isEdge()&&(e.value!=="bezier"&&t.isLoop()||e.value==="haystack"&&(t.source().isParent()||t.target().isParent()))&&(a=e=this.parse(e.name,"bezier",u)),a.delete)return n[a.name]=void 0,h(),!0;if(a.deleteBypassed)return l?l.bypass?(l.bypassed=void 0,h(),!0):!1:(h(),!0);if(a.deleteBypass)return l?l.bypass?(n[a.name]=l.bypassed,h(),!0):!1:(h(),!0);var y=function(){ze("Do not assign mappings to elements without corresponding data (i.e. ele `"+t.id()+"` has no mapping for property `"+a.name+"` with data field `"+a.field+"`); try a `["+a.field+"]` selector to limit scope to elements with `"+a.field+"` defined")};switch(a.mapped){case o.mapData:{for(var g=a.field.split("."),p=c.data,m=0;m<g.length&&p;m++){var b=g[m];p=p[b]}if(p==null)return y(),!1;var w;if(ae(p)){var E=a.fieldMax-a.fieldMin;E===0?w=0:w=(p-a.fieldMin)/E}else return ze("Do not use continuous mappers without specifying numeric data (i.e. `"+a.field+": "+p+"` for `"+t.id()+"` is non-numeric)"),!1;if(w<0?w=0:w>1&&(w=1),s.color){var C=a.valueMin[0],x=a.valueMax[0],T=a.valueMin[1],k=a.valueMax[1],B=a.valueMin[2],D=a.valueMax[2],P=a.valueMin[3]==null?1:a.valueMin[3],A=a.valueMax[3]==null?1:a.valueMax[3],R=[Math.round(C+(x-C)*w),Math.round(T+(k-T)*w),Math.round(B+(D-B)*w),Math.round(P+(A-P)*w)];i={bypass:a.bypass,name:a.name,value:R,strValue:"rgb("+R[0]+", "+R[1]+", "+R[2]+")"}}else if(s.number){var L=a.valueMin+(a.valueMax-a.valueMin)*w;i=this.parse(a.name,L,a.bypass,v)}else return!1;if(!i)return y(),!1;i.mapping=a,a=i;break}case o.data:{for(var I=a.field.split("."),M=c.data,O=0;O<I.length&&M;O++){var q=I[O];M=M[q]}if(M!=null&&(i=this.parse(a.name,M,a.bypass,v)),!i)return y(),!1;i.mapping=a,a=i;break}case o.fn:{var $=a.value,N=a.fnValue!=null?a.fnValue:$(t);if(a.prevFnValue=N,N==null)return ze("Custom function mappers may not return null (i.e. `"+a.name+"` for ele `"+t.id()+"` is null)"),!1;if(i=this.parse(a.name,N,a.bypass,v),!i)return ze("Custom function mappers may not return invalid values for the property type (i.e. `"+a.name+"` for ele `"+t.id()+"` is invalid)"),!1;i.mapping=$t(a),a=i;break}case void 0:break;default:return!1}return u?(f?a.bypassed=l.bypassed:a.bypassed=l,n[a.name]=a):f?l.bypassed=a:n[a.name]=a,h(),!0};st.cleanElements=function(t,e){for(var r=0;r<t.length;r++){var a=t[r];if(this.clearStyleHints(a),a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),!e)a._private.style={};else for(var n=a._private.style,i=Object.keys(n),o=0;o<i.length;o++){var s=i[o],u=n[s];u!=null&&(u.bypass?u.bypassed=null:n[s]=null)}}};st.update=function(){var t=this._private.cy,e=t.mutableElements();e.updateStyle()};st.updateTransitions=function(t,e){var r=this,a=t._private,n=t.pstyle("transition-property").value,i=t.pstyle("transition-duration").pfValue,o=t.pstyle("transition-delay").pfValue;if(n.length>0&&i>0){for(var s={},u=!1,l=0;l<n.length;l++){var f=n[l],c=t.pstyle(f),v=e[f];if(v){var d=v.prev,h=d,y=v.next!=null?v.next:c,g=!1,p=void 0,m=1e-6;h&&(ae(h.pfValue)&&ae(y.pfValue)?(g=y.pfValue-h.pfValue,p=h.pfValue+m*g):ae(h.value)&&ae(y.value)?(g=y.value-h.value,p=h.value+m*g):qe(h.value)&&qe(y.value)&&(g=h.value[0]!==y.value[0]||h.value[1]!==y.value[1]||h.value[2]!==y.value[2],p=h.strValue),g&&(s[f]=y.strValue,this.applyBypass(t,f,p),u=!0))}}if(!u)return;a.transitioning=!0,new ra(function(b){o>0?t.delayAnimation(o).play().promise().then(b):b()}).then(function(){return t.animation({style:s,duration:i,easing:t.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(t,n),t.emitAndNotify("style"),a.transitioning=!1})}else a.transitioning&&(this.removeBypasses(t,n),t.emitAndNotify("style"),a.transitioning=!1)};st.checkTrigger=function(t,e,r,a,n,i){var o=this.properties[e],s=n(o);t.removed()||s!=null&&s(r,a,t)&&i(o)};st.checkZOrderTrigger=function(t,e,r,a){var n=this;this.checkTrigger(t,e,r,a,function(i){return i.triggersZOrder},function(){n._private.cy.notify("zorder",t)})};st.checkBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBounds},function(n){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache()})};st.checkConnectedEdgesBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBoundsOfConnectedEdges},function(n){t.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};st.checkParallelEdgesBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBoundsOfParallelEdges},function(n){t.parallelEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};st.checkTriggers=function(t,e,r,a){t.dirtyStyleCache(),this.checkZOrderTrigger(t,e,r,a),this.checkBoundsTrigger(t,e,r,a),this.checkConnectedEdgesBoundsTrigger(t,e,r,a),this.checkParallelEdgesBoundsTrigger(t,e,r,a)};var _a={};_a.applyBypass=function(t,e,r,a){var n=this,i=[],o=!0;if(e==="*"||e==="**"){if(r!==void 0)for(var s=0;s<n.properties.length;s++){var u=n.properties[s],l=u.name,f=this.parse(l,r,!0);f&&i.push(f)}}else if(he(e)){var c=this.parse(e,r,!0);c&&i.push(c)}else if(Me(e)){var v=e;a=r;for(var d=Object.keys(v),h=0;h<d.length;h++){var y=d[h],g=v[y];if(g===void 0&&(g=v[Ln(y)]),g!==void 0){var p=this.parse(y,g,!0);p&&i.push(p)}}}else return!1;if(i.length===0)return!1;for(var m=!1,b=0;b<t.length;b++){for(var w=t[b],E={},C=void 0,x=0;x<i.length;x++){var T=i[x];if(a){var k=w.pstyle(T.name);C=E[T.name]={prev:k}}m=this.applyParsedProperty(w,$t(T))||m,a&&(C.next=w.pstyle(T.name))}m&&this.updateStyleHints(w),a&&this.updateTransitions(w,E,o)}return m};_a.overrideBypass=function(t,e,r){e=ts(e);for(var a=0;a<t.length;a++){var n=t[a],i=n._private.style[e],o=this.properties[e].type,s=o.color,u=o.mutiple,l=i?i.pfValue!=null?i.pfValue:i.value:null;!i||!i.bypass?this.applyBypass(n,e,r):(i.value=r,i.pfValue!=null&&(i.pfValue=r),s?i.strValue="rgb("+r.join(",")+")":u?i.strValue=r.join(" "):i.strValue=""+r,this.updateStyleHints(n)),this.checkTriggers(n,e,l,r)}};_a.removeAllBypasses=function(t,e){return this.removeBypasses(t,this.propertyNames,e)};_a.removeBypasses=function(t,e,r){for(var a=!0,n=0;n<t.length;n++){for(var i=t[n],o={},s=0;s<e.length;s++){var u=e[s],l=this.properties[u],f=i.pstyle(l.name);if(!(!f||!f.bypass)){var c="",v=this.parse(u,c,!0),d=o[l.name]={prev:f};this.applyParsedProperty(i,v),d.next=i.pstyle(l.name)}}this.updateStyleHints(i),r&&this.updateTransitions(i,o,a)}};var ps={};ps.getEmSizeInPixels=function(){var t=this.containerCss("font-size");return t!=null?parseFloat(t):1};ps.containerCss=function(t){var e=this._private.cy,r=e.container(),a=e.window();if(a&&r&&a.getComputedStyle)return a.getComputedStyle(r).getPropertyValue(t)};var _t={};_t.getRenderedStyle=function(t,e){return e?this.getStylePropertyValue(t,e,!0):this.getRawStyle(t,!0)};_t.getRawStyle=function(t,e){var r=this;if(t=t[0],t){for(var a={},n=0;n<r.properties.length;n++){var i=r.properties[n],o=r.getStylePropertyValue(t,i.name,e);o!=null&&(a[i.name]=o,a[Ln(i.name)]=o)}return a}};_t.getIndexedStyle=function(t,e,r,a){var n=t.pstyle(e)[r][a];return n??t.cy().style().getDefaultProperty(e)[r][0]};_t.getStylePropertyValue=function(t,e,r){var a=this;if(t=t[0],t){var n=a.properties[e];n.alias&&(n=n.pointsTo);var i=n.type,o=t.pstyle(n.name);if(o){var s=o.value,u=o.units,l=o.strValue;if(r&&i.number&&s!=null&&ae(s)){var f=t.cy().zoom(),c=function(g){return g*f},v=function(g,p){return c(g)+p},d=qe(s),h=d?u.every(function(y){return y!=null}):u!=null;return h?d?s.map(function(y,g){return v(y,u[g])}).join(" "):v(s,u):d?s.map(function(y){return he(y)?y:""+c(y)}).join(" "):""+c(s)}else if(l!=null)return l}return null}};_t.getAnimationStartStyle=function(t,e){for(var r={},a=0;a<e.length;a++){var n=e[a],i=n.name,o=t.pstyle(i);o!==void 0&&(Me(o)?o=this.parse(i,o.strValue):o=this.parse(i,o)),o&&(r[i]=o)}return r};_t.getPropsList=function(t){var e=this,r=[],a=t,n=e.properties;if(a)for(var i=Object.keys(a),o=0;o<i.length;o++){var s=i[o],u=a[s],l=n[s]||n[ts(s)],f=this.parse(l.name,u);f&&r.push(f)}return r};_t.getNonDefaultPropertiesHash=function(t,e,r){var a=r.slice(),n,i,o,s,u,l;for(u=0;u<e.length;u++)if(n=e[u],i=t.pstyle(n,!1),i!=null)if(i.pfValue!=null)a[0]=Ta(s,a[0]),a[1]=Sa(s,a[1]);else for(o=i.strValue,l=0;l<o.length;l++)s=o.charCodeAt(l),a[0]=Ta(s,a[0]),a[1]=Sa(s,a[1]);return a};_t.getPropertiesHash=_t.getNonDefaultPropertiesHash;var Wn={};Wn.appendFromJson=function(t){for(var e=this,r=0;r<t.length;r++){var a=t[r],n=a.selector,i=a.style||a.css,o=Object.keys(i);e.selector(n);for(var s=0;s<o.length;s++){var u=o[s],l=i[u];e.css(u,l)}}return e};Wn.fromJson=function(t){var e=this;return e.resetToDefault(),e.appendFromJson(t),e};Wn.json=function(){for(var t=[],e=this.defaultLength;e<this.length;e++){for(var r=this[e],a=r.selector,n=r.properties,i={},o=0;o<n.length;o++){var s=n[o];i[s.name]=s.strValue}t.push({selector:a?a.toString():"core",style:i})}return t};var ys={};ys.appendFromString=function(t){var e=this,r=this,a=""+t,n,i,o;a=a.replace(/[/][*](\s|.)+?[*][/]/g,"");function s(){a.length>n.length?a=a.substr(n.length):a=""}function u(){i.length>o.length?i=i.substr(o.length):i=""}for(;;){var l=a.match(/^\s*$/);if(l)break;var f=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!f){ze("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}n=f[0];var c=f[1];if(c!=="core"){var v=new cr(c);if(v.invalid){ze("Skipping parsing of block: Invalid selector found in string stylesheet: "+c),s();continue}}var d=f[2],h=!1;i=d;for(var y=[];;){var g=i.match(/^\s*$/);if(g)break;var p=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!p){ze("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+d),h=!0;break}o=p[0];var m=p[1],b=p[2],w=e.properties[m];if(!w){ze("Skipping property: Invalid property name in: "+o),u();continue}var E=r.parse(m,b);if(!E){ze("Skipping property: Invalid property definition in: "+o),u();continue}y.push({name:m,val:b}),u()}if(h){s();break}r.selector(c);for(var C=0;C<y.length;C++){var x=y[C];r.css(x.name,x.val)}s()}return r};ys.fromString=function(t){var e=this;return e.resetToDefault(),e.appendFromString(t),e};var Qe={};(function(){var t=tt,e=Fv,r=qv,a=$v,n=_v,i=function(H){return"^"+H+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},o=function(H){var G=t+"|\\w+|"+e+"|"+r+"|"+a+"|"+n;return"^"+H+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+t+")\\s*\\,\\s*("+t+")\\s*,\\s*("+G+")\\s*\\,\\s*("+G+")\\)$"},s=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];Qe.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},axisDirectionExplicit:{enums:["leftward","rightward","upward","downward"]},axisDirectionPrimary:{enums:["horizontal","vertical"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},boxSelection:{enums:["contain","overlap","none"]},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle","circle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:i("data")},layoutData:{mapping:!0,regex:i("layoutData")},scratch:{mapping:!0,regex:i("scratch")},mapData:{mapping:!0,regex:o("mapData")},mapLayoutData:{mapping:!0,regex:o("mapLayoutData")},mapScratch:{mapping:!0,regex:o("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:s,singleRegexMatchValue:!0},urls:{regexes:s,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(H,G){switch(H.length){case 2:return G[0]!=="deg"&&G[0]!=="rad"&&G[1]!=="deg"&&G[1]!=="rad";case 1:return he(H[0])||G[0]==="deg"||G[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(H){var G=H.length;return G===1||G===2||G===4}}};var u={zeroNonZero:function(H,G){return(H==null||G==null)&&H!==G||H==0&&G!=0?!0:H!=0&&G==0},any:function(H,G){return H!=G},emptyNonEmpty:function(H,G){var Y=lr(H),re=lr(G);return Y&&!re||!Y&&re}},l=Qe.types,f=[{name:"label",type:l.text,triggersBounds:u.any,triggersZOrder:u.emptyNonEmpty},{name:"text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any}],c=[{name:"source-label",type:l.text,triggersBounds:u.any},{name:"source-text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"source-text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"source-text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"source-text-offset",type:l.size,triggersBounds:u.any}],v=[{name:"target-label",type:l.text,triggersBounds:u.any},{name:"target-text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"target-text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"target-text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"target-text-offset",type:l.size,triggersBounds:u.any}],d=[{name:"font-family",type:l.fontFamily,triggersBounds:u.any},{name:"font-style",type:l.fontStyle,triggersBounds:u.any},{name:"font-weight",type:l.fontWeight,triggersBounds:u.any},{name:"font-size",type:l.size,triggersBounds:u.any},{name:"text-transform",type:l.textTransform,triggersBounds:u.any},{name:"text-wrap",type:l.textWrap,triggersBounds:u.any},{name:"text-overflow-wrap",type:l.textOverflowWrap,triggersBounds:u.any},{name:"text-max-width",type:l.size,triggersBounds:u.any},{name:"text-outline-width",type:l.size,triggersBounds:u.any},{name:"line-height",type:l.positiveNumber,triggersBounds:u.any}],h=[{name:"text-valign",type:l.valign,triggersBounds:u.any},{name:"text-halign",type:l.halign,triggersBounds:u.any},{name:"color",type:l.color},{name:"text-outline-color",type:l.color},{name:"text-outline-opacity",type:l.zeroOneNumber},{name:"text-background-color",type:l.color},{name:"text-background-opacity",type:l.zeroOneNumber},{name:"text-background-padding",type:l.size,triggersBounds:u.any},{name:"text-border-opacity",type:l.zeroOneNumber},{name:"text-border-color",type:l.color},{name:"text-border-width",type:l.size,triggersBounds:u.any},{name:"text-border-style",type:l.borderStyle,triggersBounds:u.any},{name:"text-background-shape",type:l.textBackgroundShape,triggersBounds:u.any},{name:"text-justification",type:l.justification},{name:"box-select-labels",type:l.bool,triggersBounds:u.any}],y=[{name:"events",type:l.bool,triggersZOrder:u.any},{name:"text-events",type:l.bool,triggersZOrder:u.any},{name:"box-selection",type:l.boxSelection,triggersZOrder:u.any}],g=[{name:"display",type:l.display,triggersZOrder:u.any,triggersBounds:u.any,triggersBoundsOfConnectedEdges:u.any,triggersBoundsOfParallelEdges:function(H,G,Y){return H===G?!1:Y.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:l.visibility,triggersZOrder:u.any},{name:"opacity",type:l.zeroOneNumber,triggersZOrder:u.zeroNonZero},{name:"text-opacity",type:l.zeroOneNumber},{name:"min-zoomed-font-size",type:l.size},{name:"z-compound-depth",type:l.zCompoundDepth,triggersZOrder:u.any},{name:"z-index-compare",type:l.zIndexCompare,triggersZOrder:u.any},{name:"z-index",type:l.number,triggersZOrder:u.any}],p=[{name:"overlay-padding",type:l.size,triggersBounds:u.any},{name:"overlay-color",type:l.color},{name:"overlay-opacity",type:l.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"overlay-shape",type:l.overlayShape,triggersBounds:u.any},{name:"overlay-corner-radius",type:l.cornerRadius}],m=[{name:"underlay-padding",type:l.size,triggersBounds:u.any},{name:"underlay-color",type:l.color},{name:"underlay-opacity",type:l.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"underlay-shape",type:l.overlayShape,triggersBounds:u.any},{name:"underlay-corner-radius",type:l.cornerRadius}],b=[{name:"transition-property",type:l.propList},{name:"transition-duration",type:l.time},{name:"transition-delay",type:l.time},{name:"transition-timing-function",type:l.easing}],w=function(H,G){return G.value==="label"?-H.poolIndex():G.pfValue},E=[{name:"height",type:l.nodeSize,triggersBounds:u.any,hashOverride:w},{name:"width",type:l.nodeSize,triggersBounds:u.any,hashOverride:w},{name:"shape",type:l.nodeShape,triggersBounds:u.any},{name:"shape-polygon-points",type:l.polygonPointList,triggersBounds:u.any},{name:"corner-radius",type:l.cornerRadius},{name:"background-color",type:l.color},{name:"background-fill",type:l.fill},{name:"background-opacity",type:l.zeroOneNumber},{name:"background-blacken",type:l.nOneOneNumber},{name:"background-gradient-stop-colors",type:l.colors},{name:"background-gradient-stop-positions",type:l.percentages},{name:"background-gradient-direction",type:l.gradientDirection},{name:"padding",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"padding-relative-to",type:l.paddingRelativeTo,triggersBounds:u.any},{name:"bounds-expansion",type:l.boundsExpansion,triggersBounds:u.any}],C=[{name:"border-color",type:l.color},{name:"border-opacity",type:l.zeroOneNumber},{name:"border-width",type:l.size,triggersBounds:u.any},{name:"border-style",type:l.borderStyle},{name:"border-cap",type:l.lineCap},{name:"border-join",type:l.lineJoin},{name:"border-dash-pattern",type:l.numbers},{name:"border-dash-offset",type:l.number},{name:"border-position",type:l.linePosition}],x=[{name:"outline-color",type:l.color},{name:"outline-opacity",type:l.zeroOneNumber},{name:"outline-width",type:l.size,triggersBounds:u.any},{name:"outline-style",type:l.borderStyle},{name:"outline-offset",type:l.size,triggersBounds:u.any}],T=[{name:"background-image",type:l.urls},{name:"background-image-crossorigin",type:l.bgCrossOrigin},{name:"background-image-opacity",type:l.zeroOneNumbers},{name:"background-image-containment",type:l.bgContainment},{name:"background-image-smoothing",type:l.bools},{name:"background-position-x",type:l.bgPos},{name:"background-position-y",type:l.bgPos},{name:"background-width-relative-to",type:l.bgRelativeTo},{name:"background-height-relative-to",type:l.bgRelativeTo},{name:"background-repeat",type:l.bgRepeat},{name:"background-fit",type:l.bgFit},{name:"background-clip",type:l.bgClip},{name:"background-width",type:l.bgWH},{name:"background-height",type:l.bgWH},{name:"background-offset-x",type:l.bgPos},{name:"background-offset-y",type:l.bgPos}],k=[{name:"position",type:l.position,triggersBounds:u.any},{name:"compound-sizing-wrt-labels",type:l.compoundIncludeLabels,triggersBounds:u.any},{name:"min-width",type:l.size,triggersBounds:u.any},{name:"min-width-bias-left",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-width-bias-right",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-height",type:l.size,triggersBounds:u.any},{name:"min-height-bias-top",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-height-bias-bottom",type:l.sizeMaybePercent,triggersBounds:u.any}],B=[{name:"line-style",type:l.lineStyle},{name:"line-color",type:l.color},{name:"line-fill",type:l.fill},{name:"line-cap",type:l.lineCap},{name:"line-opacity",type:l.zeroOneNumber},{name:"line-dash-pattern",type:l.numbers},{name:"line-dash-offset",type:l.number},{name:"line-outline-width",type:l.size},{name:"line-outline-color",type:l.color},{name:"line-gradient-stop-colors",type:l.colors},{name:"line-gradient-stop-positions",type:l.percentages},{name:"curve-style",type:l.curveStyle,triggersBounds:u.any,triggersBoundsOfParallelEdges:function(H,G){return H===G?!1:H==="bezier"||G==="bezier"}},{name:"haystack-radius",type:l.zeroOneNumber,triggersBounds:u.any},{name:"source-endpoint",type:l.edgeEndpoint,triggersBounds:u.any},{name:"target-endpoint",type:l.edgeEndpoint,triggersBounds:u.any},{name:"control-point-step-size",type:l.size,triggersBounds:u.any},{name:"control-point-distances",type:l.bidirectionalSizes,triggersBounds:u.any},{name:"control-point-weights",type:l.numbers,triggersBounds:u.any},{name:"segment-distances",type:l.bidirectionalSizes,triggersBounds:u.any},{name:"segment-weights",type:l.numbers,triggersBounds:u.any},{name:"segment-radii",type:l.numbers,triggersBounds:u.any},{name:"radius-type",type:l.radiusType,triggersBounds:u.any},{name:"taxi-turn",type:l.bidirectionalSizeMaybePercent,triggersBounds:u.any},{name:"taxi-turn-min-distance",type:l.size,triggersBounds:u.any},{name:"taxi-direction",type:l.axisDirection,triggersBounds:u.any},{name:"taxi-radius",type:l.number,triggersBounds:u.any},{name:"edge-distances",type:l.edgeDistances,triggersBounds:u.any},{name:"arrow-scale",type:l.positiveNumber,triggersBounds:u.any},{name:"loop-direction",type:l.angle,triggersBounds:u.any},{name:"loop-sweep",type:l.angle,triggersBounds:u.any},{name:"source-distance-from-node",type:l.size,triggersBounds:u.any},{name:"target-distance-from-node",type:l.size,triggersBounds:u.any}],D=[{name:"ghost",type:l.bool,triggersBounds:u.any},{name:"ghost-offset-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"ghost-offset-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"ghost-opacity",type:l.zeroOneNumber}],P=[{name:"selection-box-color",type:l.color},{name:"selection-box-opacity",type:l.zeroOneNumber},{name:"selection-box-border-color",type:l.color},{name:"selection-box-border-width",type:l.size},{name:"active-bg-color",type:l.color},{name:"active-bg-opacity",type:l.zeroOneNumber},{name:"active-bg-size",type:l.size},{name:"outside-texture-bg-color",type:l.color},{name:"outside-texture-bg-opacity",type:l.zeroOneNumber}],A=[];Qe.pieBackgroundN=16,A.push({name:"pie-size",type:l.sizeMaybePercent}),A.push({name:"pie-hole",type:l.sizeMaybePercent}),A.push({name:"pie-start-angle",type:l.angle});for(var R=1;R<=Qe.pieBackgroundN;R++)A.push({name:"pie-"+R+"-background-color",type:l.color}),A.push({name:"pie-"+R+"-background-size",type:l.percent}),A.push({name:"pie-"+R+"-background-opacity",type:l.zeroOneNumber});var L=[];Qe.stripeBackgroundN=16,L.push({name:"stripe-size",type:l.sizeMaybePercent}),L.push({name:"stripe-direction",type:l.axisDirectionPrimary});for(var I=1;I<=Qe.stripeBackgroundN;I++)L.push({name:"stripe-"+I+"-background-color",type:l.color}),L.push({name:"stripe-"+I+"-background-size",type:l.percent}),L.push({name:"stripe-"+I+"-background-opacity",type:l.zeroOneNumber});var M=[],O=Qe.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:l.arrowShape,triggersBounds:u.any},{name:"arrow-color",type:l.color},{name:"arrow-fill",type:l.arrowFill},{name:"arrow-width",type:l.arrowWidth}].forEach(function(V){O.forEach(function(H){var G=H+"-"+V.name,Y=V.type,re=V.triggersBounds;M.push({name:G,type:Y,triggersBounds:re})})},{});var q=Qe.properties=[].concat(y,b,g,p,m,D,h,d,f,c,v,E,C,x,T,A,L,k,B,M,P),$=Qe.propertyGroups={behavior:y,transition:b,visibility:g,overlay:p,underlay:m,ghost:D,commonLabel:h,labelDimensions:d,mainLabel:f,sourceLabel:c,targetLabel:v,nodeBody:E,nodeBorder:C,nodeOutline:x,backgroundImage:T,pie:A,stripe:L,compound:k,edgeLine:B,edgeArrow:M,core:P},N=Qe.propertyGroupNames={},F=Qe.propertyGroupKeys=Object.keys($);F.forEach(function(V){N[V]=$[V].map(function(H){return H.name}),$[V].forEach(function(H){return H.groupKey=V})});var W=Qe.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"segment-distance",pointsTo:"segment-distances"},{name:"segment-weight",pointsTo:"segment-weights"},{name:"segment-radius",pointsTo:"segment-radii"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];Qe.propertyNames=q.map(function(V){return V.name});for(var J=0;J<q.length;J++){var Z=q[J];q[Z.name]=Z}for(var j=0;j<W.length;j++){var te=W[j],ne=q[te.pointsTo],Q={name:te.name,alias:!0,pointsTo:ne};q.push(Q),q[te.name]=Q}})();Qe.getDefaultProperty=function(t){return this.getDefaultProperties()[t]};Qe.getDefaultProperties=function(){var t=this._private;if(t.defaultProperties!=null)return t.defaultProperties;for(var e=ye({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","box-selection":"contain","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","box-select-labels":"no","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%","pie-hole":0,"pie-start-angle":"0deg"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(u,l){for(var f=1;f<=Qe.pieBackgroundN;f++){var c=l.name.replace("{{i}}",f),v=l.value;u[c]=v}return u},{}),{"stripe-size":"100%","stripe-direction":"horizontal"},[{name:"stripe-{{i}}-background-color",value:"black"},{name:"stripe-{{i}}-background-size",value:"0%"},{name:"stripe-{{i}}-background-opacity",value:1}].reduce(function(u,l){for(var f=1;f<=Qe.stripeBackgroundN;f++){var c=l.name.replace("{{i}}",f),v=l.value;u[c]=v}return u},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-outline-width":0,"line-outline-color":"#000","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":"arc-radius","taxi-turn":"50%","taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(u,l){return Qe.arrowPrefixes.forEach(function(f){var c=f+"-"+l.name,v=l.value;u[c]=v}),u},{})),r={},a=0;a<this.properties.length;a++){var n=this.properties[a];if(!n.pointsTo){var i=n.name,o=e[i],s=this.parse(i,o);r[i]=s}}return t.defaultProperties=r,t.defaultProperties};Qe.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var Kn={};Kn.parse=function(t,e,r,a){var n=this;if(We(e))return n.parseImplWarn(t,e,r,a);var i=a==="mapping"||a===!0||a===!1||a==null?"dontcare":a,o=r?"t":"f",s=""+e,u=Cf(t,s,o,i),l=n.propCache=n.propCache||[],f;return(f=l[u])||(f=l[u]=n.parseImplWarn(t,e,r,a)),(r||a==="mapping")&&(f=$t(f),f&&(f.value=$t(f.value))),f};Kn.parseImplWarn=function(t,e,r,a){var n=this.parseImpl(t,e,r,a);return!n&&e!=null&&ze("The style property `".concat(t,": ").concat(e,"` is invalid")),n&&(n.name==="width"||n.name==="height")&&e==="label"&&ze("The style value of `label` is deprecated for `"+n.name+"`"),n};Kn.parseImpl=function(t,e,r,a){var n=this;t=ts(t);var i=n.properties[t],o=e,s=n.types;if(!i||e===void 0)return null;i.alias&&(i=i.pointsTo,t=i.name);var u=he(e);u&&(e=e.trim());var l=i.type;if(!l)return null;if(r&&(e===""||e===null))return{name:t,value:e,bypass:!0,deleteBypass:!0};if(We(e))return{name:t,value:e,strValue:"fn",mapped:s.fn,bypass:r};var f,c;if(!(!u||a||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(f=new RegExp(s.data.regex).exec(e))){if(r)return!1;var v=s.data;return{name:t,value:f,strValue:""+e,mapped:v,field:f[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(c=new RegExp(s.mapData.regex).exec(e))){if(r||l.multiple)return!1;var d=s.mapData;if(!(l.color||l.number))return!1;var h=this.parse(t,c[4]);if(!h||h.mapped)return!1;var y=this.parse(t,c[5]);if(!y||y.mapped)return!1;if(h.pfValue===y.pfValue||h.strValue===y.strValue)return ze("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+h.strValue+"`"),this.parse(t,h.strValue);if(l.color){var g=h.value,p=y.value,m=g[0]===p[0]&&g[1]===p[1]&&g[2]===p[2]&&(g[3]===p[3]||(g[3]==null||g[3]===1)&&(p[3]==null||p[3]===1));if(m)return!1}return{name:t,value:c,strValue:""+e,mapped:d,field:c[1],fieldMin:parseFloat(c[2]),fieldMax:parseFloat(c[3]),valueMin:h.value,valueMax:y.value,bypass:r}}}if(l.multiple&&a!=="multiple"){var b;if(u?b=e.split(/\s+/):qe(e)?b=e:b=[e],l.evenMultiple&&b.length%2!==0)return null;for(var w=[],E=[],C=[],x="",T=!1,k=0;k<b.length;k++){var B=n.parse(t,b[k],r,"multiple");T=T||he(B.value),w.push(B.value),C.push(B.pfValue!=null?B.pfValue:B.value),E.push(B.units),x+=(k>0?" ":"")+B.strValue}return l.validate&&!l.validate(w,E)?null:l.singleEnum&&T?w.length===1&&he(w[0])?{name:t,value:w[0],strValue:w[0],bypass:r}:null:{name:t,value:w,pfValue:C,strValue:x,bypass:r,units:E}}var D=function(){for(var Q=0;Q<l.enums.length;Q++){var V=l.enums[Q];if(V===e)return{name:t,value:e,strValue:""+e,bypass:r}}return null};if(l.number){var P,A="px";if(l.units&&(P=l.units),l.implicitUnits&&(A=l.implicitUnits),!l.unitless)if(u){var R="px|em"+(l.allowPercent?"|\\%":"");P&&(R=P);var L=e.match("^("+tt+")("+R+")?$");L&&(e=L[1],P=L[2]||A)}else(!P||l.implicitUnits)&&(P=A);if(e=parseFloat(e),isNaN(e)&&l.enums===void 0)return null;if(isNaN(e)&&l.enums!==void 0)return e=o,D();if(l.integer&&!Rv(e)||l.min!==void 0&&(e<l.min||l.strictMin&&e===l.min)||l.max!==void 0&&(e>l.max||l.strictMax&&e===l.max))return null;var I={name:t,value:e,strValue:""+e+(P||""),units:P,bypass:r};return l.unitless||P!=="px"&&P!=="em"?I.pfValue=e:I.pfValue=P==="px"||!P?e:this.getEmSizeInPixels()*e,(P==="ms"||P==="s")&&(I.pfValue=P==="ms"?e:1e3*e),(P==="deg"||P==="rad")&&(I.pfValue=P==="rad"?e:$d(e)),P==="%"&&(I.pfValue=e/100),I}else if(l.propList){var M=[],O=""+e;if(O!=="none"){for(var q=O.split(/\s*,\s*|\s+/),$=0;$<q.length;$++){var N=q[$].trim();n.properties[N]?M.push(N):ze("`"+N+"` is not a valid property name")}if(M.length===0)return null}return{name:t,value:M,strValue:M.length===0?"none":M.join(" "),bypass:r}}else if(l.color){var F=pf(e);return F?{name:t,value:F,pfValue:F,strValue:"rgb("+F[0]+","+F[1]+","+F[2]+")",bypass:r}:null}else if(l.regex||l.regexes){if(l.enums){var W=D();if(W)return W}for(var J=l.regexes?l.regexes:[l.regex],Z=0;Z<J.length;Z++){var j=new RegExp(J[Z]),te=j.exec(e);if(te)return{name:t,value:l.singleRegexMatchValue?te[1]:te,strValue:""+e,bypass:r}}return null}else return l.string?{name:t,value:""+e,strValue:""+e,bypass:r}:l.enums?D():null};var ot=function(e){if(!(this instanceof ot))return new ot(e);if(!es(e)){Ge("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},gt=ot.prototype;gt.instanceString=function(){return"style"};gt.clear=function(){for(var t=this._private,e=t.cy,r=e.elements(),a=0;a<this.length;a++)this[a]=void 0;return this.length=0,t.contextStyles={},t.propDiffs={},this.cleanElements(r,!0),r.forEach(function(n){var i=n[0]._private;i.styleDirty=!0,i.appliedInitStyle=!1}),this};gt.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};gt.core=function(t){return this._private.coreStyle[t]||this.getDefaultProperty(t)};gt.selector=function(t){var e=t==="core"?null:new cr(t),r=this.length++;return this[r]={selector:e,properties:[],mappedProperties:[],index:r},this};gt.css=function(){var t=this,e=arguments;if(e.length===1)for(var r=e[0],a=0;a<t.properties.length;a++){var n=t.properties[a],i=r[n.name];i===void 0&&(i=r[Ln(n.name)]),i!==void 0&&this.cssRule(n.name,i)}else e.length===2&&this.cssRule(e[0],e[1]);return this};gt.style=gt.css;gt.cssRule=function(t,e){var r=this.parse(t,e);if(r){var a=this.length-1;this[a].properties.push(r),this[a].properties[r.name]=r,r.name.match(/pie-(\d+)-background-size/)&&r.value&&(this._private.hasPie=!0),r.name.match(/stripe-(\d+)-background-size/)&&r.value&&(this._private.hasStripe=!0),r.mapped&&this[a].mappedProperties.push(r);var n=!this[a].selector;n&&(this._private.coreStyle[r.name]=r)}return this};gt.append=function(t){return df(t)?t.appendToStyle(this):qe(t)?this.appendFromJson(t):he(t)&&this.appendFromString(t),this};ot.fromJson=function(t,e){var r=new ot(t);return r.fromJson(e),r};ot.fromString=function(t,e){return new ot(t).fromString(e)};[st,_a,ps,_t,Wn,ys,Qe,Kn].forEach(function(t){ye(gt,t)});ot.types=gt.types;ot.properties=gt.properties;ot.propertyGroups=gt.propertyGroups;ot.propertyGroupNames=gt.propertyGroupNames;ot.propertyGroupKeys=gt.propertyGroupKeys;var Up={style:function(e){if(e){var r=this.setStyle(e);r.update()}return this._private.style},setStyle:function(e){var r=this._private;return df(e)?r.style=e.generateStyle(this):qe(e)?r.style=ot.fromJson(this,e):he(e)?r.style=ot.fromString(this,e):r.style=ot(this),r.style},updateStyle:function(){this.mutableElements().updateStyle()}},Wp="single",Lr={autolock:function(e){if(e!==void 0)this._private.autolock=!!e;else return this._private.autolock;return this},autoungrabify:function(e){if(e!==void 0)this._private.autoungrabify=!!e;else return this._private.autoungrabify;return this},autounselectify:function(e){if(e!==void 0)this._private.autounselectify=!!e;else return this._private.autounselectify;return this},selectionType:function(e){var r=this._private;if(r.selectionType==null&&(r.selectionType=Wp),e!==void 0)(e==="additive"||e==="single")&&(r.selectionType=e);else return r.selectionType;return this},panningEnabled:function(e){if(e!==void 0)this._private.panningEnabled=!!e;else return this._private.panningEnabled;return this},userPanningEnabled:function(e){if(e!==void 0)this._private.userPanningEnabled=!!e;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(e){if(e!==void 0)this._private.zoomingEnabled=!!e;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(e){if(e!==void 0)this._private.userZoomingEnabled=!!e;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(e){if(e!==void 0)this._private.boxSelectionEnabled=!!e;else return this._private.boxSelectionEnabled;return this},pan:function(){var e=arguments,r=this._private.pan,a,n,i,o,s;switch(e.length){case 0:return r;case 1:if(he(e[0]))return a=e[0],r[a];if(Me(e[0])){if(!this._private.panningEnabled)return this;i=e[0],o=i.x,s=i.y,ae(o)&&(r.x=o),ae(s)&&(r.y=s),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;a=e[0],n=e[1],(a==="x"||a==="y")&&ae(n)&&(r[a]=n),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,r){var a=arguments,n=this._private.pan,i,o,s,u,l;if(!this._private.panningEnabled)return this;switch(a.length){case 1:Me(e)&&(s=a[0],u=s.x,l=s.y,ae(u)&&(n.x+=u),ae(l)&&(n.y+=l),this.emit("pan viewport"));break;case 2:i=e,o=r,(i==="x"||i==="y")&&ae(o)&&(n[i]+=o),this.emit("pan viewport");break}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,r){var a=this.getFitViewport(e,r);if(a){var n=this._private;n.zoom=a.zoom,n.pan=a.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,r){if(ae(e)&&r===void 0&&(r=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var a;if(he(e)){var n=e;e=this.$(n)}else if(Iv(e)){var i=e;a={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},a.w=a.x2-a.x1,a.h=a.y2-a.y1}else St(e)||(e=this.mutableElements());if(!(St(e)&&e.empty())){a=a||e.boundingBox();var o=this.width(),s=this.height(),u;if(r=ae(r)?r:0,!isNaN(o)&&!isNaN(s)&&o>0&&s>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){u=Math.min((o-2*r)/a.w,(s-2*r)/a.h),u=u>this._private.maxZoom?this._private.maxZoom:u,u=u<this._private.minZoom?this._private.minZoom:u;var l={x:(o-u*(a.x1+a.x2))/2,y:(s-u*(a.y1+a.y2))/2};return{zoom:u,pan:l}}}}},zoomRange:function(e,r){var a=this._private;if(r==null){var n=e;e=n.min,r=n.max}return ae(e)&&ae(r)&&e<=r?(a.minZoom=e,a.maxZoom=r):ae(e)&&r===void 0&&e<=a.maxZoom?a.minZoom=e:ae(r)&&e===void 0&&r>=a.minZoom&&(a.maxZoom=r),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var r=this._private,a=r.pan,n=r.zoom,i,o,s=!1;if(r.zoomingEnabled||(s=!0),ae(e)?o=e:Me(e)&&(o=e.level,e.position!=null?i=Nn(e.position,n,a):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!r.panningEnabled&&(s=!0)),o=o>r.maxZoom?r.maxZoom:o,o=o<r.minZoom?r.minZoom:o,s||!ae(o)||o===n||i!=null&&(!ae(i.x)||!ae(i.y)))return null;if(i!=null){var u=a,l=n,f=o,c={x:-f/l*(i.x-u.x)+i.x,y:-f/l*(i.y-u.y)+i.y};return{zoomed:!0,panned:!0,zoom:f,pan:c}}else return{zoomed:!0,panned:!1,zoom:o,pan:a}},zoom:function(e){if(e===void 0)return this._private.zoom;var r=this.getZoomedViewport(e),a=this._private;return r==null||!r.zoomed?this:(a.zoom=r.zoom,r.panned&&(a.pan.x=r.pan.x,a.pan.y=r.pan.y),this.emit("zoom"+(r.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var r=this._private,a=!0,n=!0,i=[],o=!1,s=!1;if(!e)return this;if(ae(e.zoom)||(a=!1),Me(e.pan)||(n=!1),!a&&!n)return this;if(a){var u=e.zoom;u<r.minZoom||u>r.maxZoom||!r.zoomingEnabled?o=!0:(r.zoom=u,i.push("zoom"))}if(n&&(!o||!e.cancelOnFailedZoom)&&r.panningEnabled){var l=e.pan;ae(l.x)&&(r.pan.x=l.x,s=!1),ae(l.y)&&(r.pan.y=l.y,s=!1),s||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var r=this.getCenterPan(e);return r&&(this._private.pan=r,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,r){if(this._private.panningEnabled){if(he(e)){var a=e;e=this.mutableElements().filter(a)}else St(e)||(e=this.mutableElements());if(e.length!==0){var n=e.boundingBox(),i=this.width(),o=this.height();r=r===void 0?this._private.zoom:r;var s={x:(i-r*(n.x1+n.x2))/2,y:(o-r*(n.y1+n.y2))/2};return s}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,r=e.container,a=this;return e.sizeCache=e.sizeCache||(r?(function(){var n=a.window().getComputedStyle(r),i=function(s){return parseFloat(n.getPropertyValue(s))};return{width:r.clientWidth-i("padding-left")-i("padding-right"),height:r.clientHeight-i("padding-top")-i("padding-bottom")}})():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,r=this._private.zoom,a=this.renderedExtent(),n={x1:(a.x1-e.x)/r,x2:(a.x2-e.x)/r,y1:(a.y1-e.y)/r,y2:(a.y2-e.y)/r};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},renderedExtent:function(){var e=this.width(),r=this.height();return{x1:0,y1:0,x2:e,y2:r,w:e,h:r}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};Lr.centre=Lr.center;Lr.autolockNodes=Lr.autolock;Lr.autoungrabifyNodes=Lr.autoungrabify;var Ra={data:Ne.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Ne.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Ne.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ne.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Ra.attr=Ra.data;Ra.removeAttr=Ra.removeData;var Ma=function(e){var r=this;e=ye({},e);var a=e.container;a&&!wn(a)&&wn(a[0])&&(a=a[0]);var n=a?a._cyreg:null;n=n||{},n&&n.cy&&(n.cy.destroy(),n={});var i=n.readies=n.readies||[];a&&(a._cyreg=n),n.cy=r;var o=et!==void 0&&a!==void 0&&!e.headless,s=e;s.layout=ye({name:o?"grid":"null"},s.layout),s.renderer=ye({name:o?"canvas":"null"},s.renderer);var u=function(h,y,g){return y!==void 0?y:g!==void 0?g:h},l=this._private={container:a,ready:!1,options:s,elements:new ft(this),listeners:[],aniEles:new ft(this),data:s.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:u(!0,s.zoomingEnabled),userZoomingEnabled:u(!0,s.userZoomingEnabled),panningEnabled:u(!0,s.panningEnabled),userPanningEnabled:u(!0,s.userPanningEnabled),boxSelectionEnabled:u(!0,s.boxSelectionEnabled),autolock:u(!1,s.autolock,s.autolockNodes),autoungrabify:u(!1,s.autoungrabify,s.autoungrabifyNodes),autounselectify:u(!1,s.autounselectify),styleEnabled:s.styleEnabled===void 0?o:s.styleEnabled,zoom:ae(s.zoom)?s.zoom:1,pan:{x:Me(s.pan)&&ae(s.pan.x)?s.pan.x:0,y:Me(s.pan)&&ae(s.pan.y)?s.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:u(250,s.multiClickDebounceTime)};this.createEmitter(),this.selectionType(s.selectionType),this.zoomRange({min:s.minZoom,max:s.maxZoom});var f=function(h,y){var g=h.some(Ov);if(g)return ra.all(h).then(y);y(h)};l.styleEnabled&&r.setStyle([]);var c=ye({},s,s.renderer);r.initRenderer(c);var v=function(h,y,g){r.notifications(!1);var p=r.mutableElements();p.length>0&&p.remove(),h!=null&&(Me(h)||qe(h))&&r.add(h),r.one("layoutready",function(b){r.notifications(!0),r.emit(b),r.one("load",y),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",g),r.emit("done")});var m=ye({},r._private.options.layout);m.eles=r.elements(),r.layout(m).run()};f([s.style,s.elements],function(d){var h=d[0],y=d[1];l.styleEnabled&&r.style().append(h),v(y,function(){r.startAnimationLoop(),l.ready=!0,We(s.ready)&&r.on("ready",s.ready);for(var g=0;g<i.length;g++){var p=i[g];r.on("ready",p)}n&&(n.readies=[]),r.emit("ready")},s.done)})},Bn=Ma.prototype;ye(Bn,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){var e=this._private.container;if(e==null)return et;var r=this._private.container.ownerDocument;return r===void 0||r==null?et:r.defaultView||et},mount:function(e){if(e!=null){var r=this,a=r._private,n=a.options;return!wn(e)&&wn(e[0])&&(e=e[0]),r.stopAnimationLoop(),r.destroyRenderer(),a.container=e,a.styleEnabled=!0,r.invalidateSize(),r.initRenderer(ye({},n,n.renderer,{name:n.renderer.name==="null"?"canvas":n.renderer.name})),r.startAnimationLoop(),r.style(n.style),r.emit("mount"),r}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return $t(this._private.options)},json:function(e){var r=this,a=r._private,n=r.mutableElements(),i=function(w){return r.getElementById(w.id())};if(Me(e)){if(r.startBatch(),e.elements){var o={},s=function(w,E){for(var C=[],x=[],T=0;T<w.length;T++){var k=w[T];if(!k.data.id){ze("cy.json() cannot handle elements without an ID attribute");continue}var B=""+k.data.id,D=r.getElementById(B);o[B]=!0,D.length!==0?x.push({ele:D,json:k}):(E&&(k.group=E),C.push(k))}r.add(C);for(var P=0;P<x.length;P++){var A=x[P],R=A.ele,L=A.json;R.json(L)}};if(qe(e.elements))s(e.elements);else for(var u=["nodes","edges"],l=0;l<u.length;l++){var f=u[l],c=e.elements[f];qe(c)&&s(c,f)}var v=r.collection();n.filter(function(b){return!o[b.id()]}).forEach(function(b){b.isParent()?v.merge(b):b.remove()}),v.forEach(function(b){return b.children().move({parent:null})}),v.forEach(function(b){return i(b).remove()})}e.style&&r.style(e.style),e.zoom!=null&&e.zoom!==a.zoom&&r.zoom(e.zoom),e.pan&&(e.pan.x!==a.pan.x||e.pan.y!==a.pan.y)&&r.pan(e.pan),e.data&&r.data(e.data);for(var d=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],h=0;h<d.length;h++){var y=d[h];e[y]!=null&&r[y](e[y])}return r.endBatch(),this}else{var g=!!e,p={};g?p.elements=this.elements().map(function(b){return b.json()}):(p.elements={},n.forEach(function(b){var w=b.group();p.elements[w]||(p.elements[w]=[]),p.elements[w].push(b.json())})),this._private.styleEnabled&&(p.style=r.style().json()),p.data=$t(r.data());var m=a.options;return p.zoomingEnabled=a.zoomingEnabled,p.userZoomingEnabled=a.userZoomingEnabled,p.zoom=a.zoom,p.minZoom=a.minZoom,p.maxZoom=a.maxZoom,p.panningEnabled=a.panningEnabled,p.userPanningEnabled=a.userPanningEnabled,p.pan=$t(a.pan),p.boxSelectionEnabled=a.boxSelectionEnabled,p.renderer=$t(m.renderer),p.hideEdgesOnViewport=m.hideEdgesOnViewport,p.textureOnViewport=m.textureOnViewport,p.wheelSensitivity=m.wheelSensitivity,p.motionBlur=m.motionBlur,p.multiClickDebounceTime=m.multiClickDebounceTime,p}}});Bn.$id=Bn.getElementById;[Op,qp,dc,_o,hn,_p,Ho,gn,Up,Lr,Ra].forEach(function(t){ye(Bn,t)});var Kp={fit:!0,directed:!1,direction:"downward",padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}},Xp={maximal:!1,acyclic:!1},qr=function(e){return e.scratch("breadthfirst")},Iu=function(e,r){return e.scratch("breadthfirst",r)};function hc(t){this.options=ye({},Kp,Xp,t)}hc.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,a=r.nodes().filter(function(ge){return ge.isChildless()}),n=r,i=t.directed,o=t.acyclic||t.maximal||t.maximalAdjustments>0,s=!!t.boundingBox,u=mt(s?t.boundingBox:structuredClone(e.extent())),l;if(St(t.roots))l=t.roots;else if(qe(t.roots)){for(var f=[],c=0;c<t.roots.length;c++){var v=t.roots[c],d=e.getElementById(v);f.push(d)}l=e.collection(f)}else if(he(t.roots))l=e.$(t.roots);else if(i)l=a.roots();else{var h=r.components();l=e.collection();for(var y=function(){var oe=h[g],de=oe.maxDegree(!1),ce=oe.filter(function(xe){return xe.degree(!1)===de});l=l.add(ce)},g=0;g<h.length;g++)y()}var p=[],m={},b=function(oe,de){p[de]==null&&(p[de]=[]);var ce=p[de].length;p[de].push(oe),Iu(oe,{index:ce,depth:de})},w=function(oe,de){var ce=qr(oe),xe=ce.depth,be=ce.index;p[xe][be]=null,oe.isChildless()&&b(oe,de)};n.bfs({roots:l,directed:t.directed,visit:function(oe,de,ce,xe,be){var Se=oe[0],Be=Se.id();Se.isChildless()&&b(Se,be),m[Be]=!0}});for(var E=[],C=0;C<a.length;C++){var x=a[C];m[x.id()]||E.push(x)}var T=function(oe){for(var de=p[oe],ce=0;ce<de.length;ce++){var xe=de[ce];if(xe==null){de.splice(ce,1),ce--;continue}Iu(xe,{depth:oe,index:ce})}},k=function(oe,de){for(var ce=qr(oe),xe=oe.incomers().filter(function(X){return X.isNode()&&r.has(X)}),be=-1,Se=oe.id(),Be=0;Be<xe.length;Be++){var Oe=xe[Be],Le=qr(Oe);be=Math.max(be,Le.depth)}if(ce.depth<=be){if(!t.acyclic&&de[Se])return null;var Ae=be+1;return w(oe,Ae),de[Se]=Ae,!0}return!1};if(i&&o){var B=[],D={},P=function(oe){return B.push(oe)},A=function(){return B.shift()};for(a.forEach(function(ge){return B.push(ge)});B.length>0;){var R=A(),L=k(R,D);if(L)R.outgoers().filter(function(ge){return ge.isNode()&&r.has(ge)}).forEach(P);else if(L===null){ze("Detected double maximal shift for node `"+R.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var I=0;if(t.avoidOverlap)for(var M=0;M<a.length;M++){var O=a[M],q=O.layoutDimensions(t),$=q.w,N=q.h;I=Math.max(I,$,N)}var F={},W=function(oe){if(F[oe.id()])return F[oe.id()];for(var de=qr(oe).depth,ce=oe.neighborhood(),xe=0,be=0,Se=0;Se<ce.length;Se++){var Be=ce[Se];if(!(Be.isEdge()||Be.isParent()||!a.has(Be))){var Oe=qr(Be);if(Oe!=null){var Le=Oe.index,Ae=Oe.depth;if(!(Le==null||Ae==null)){var X=p[Ae].length;Ae<de&&(xe+=Le/X,be++)}}}}return be=Math.max(1,be),xe=xe/be,be===0&&(xe=0),F[oe.id()]=xe,xe},J=function(oe,de){var ce=W(oe),xe=W(de),be=ce-xe;return be===0?gf(oe.id(),de.id()):be};t.depthSort!==void 0&&(J=t.depthSort);for(var Z=p.length,j=0;j<Z;j++)p[j].sort(J),T(j);for(var te=[],ne=0;ne<E.length;ne++)te.push(E[ne]);var Q=function(){for(var oe=0;oe<Z;oe++)T(oe)};te.length&&(p.unshift(te),Z=p.length,Q());for(var V=0,H=0;H<Z;H++)V=Math.max(p[H].length,V);var G={x:u.x1+u.w/2,y:u.y1+u.h/2},Y=a.reduce(function(ge,oe){return(function(de){return{w:ge.w===-1?de.w:(ge.w+de.w)/2,h:ge.h===-1?de.h:(ge.h+de.h)/2}})(oe.boundingBox({includeLabels:t.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),re=Math.max(Z===1?0:s?(u.h-t.padding*2-Y.h)/(Z-1):(u.h-t.padding*2-Y.h)/(Z+1),I),ve=p.reduce(function(ge,oe){return Math.max(ge,oe.length)},0),De=function(oe){var de=qr(oe),ce=de.depth,xe=de.index;if(t.circle){var be=Math.min(u.w/2/Z,u.h/2/Z);be=Math.max(be,I);var Se=be*ce+be-(Z>0&&p[0].length<=3?be/2:0),Be=2*Math.PI/p[ce].length*xe;return ce===0&&p[0].length===1&&(Se=1),{x:G.x+Se*Math.cos(Be),y:G.y+Se*Math.sin(Be)}}else{var Oe=p[ce].length,Le=Math.max(Oe===1?0:s?(u.w-t.padding*2-Y.w)/((t.grid?ve:Oe)-1):(u.w-t.padding*2-Y.w)/((t.grid?ve:Oe)+1),I),Ae={x:G.x+(xe+1-(Oe+1)/2)*Le,y:G.y+(ce+1-(Z+1)/2)*re};return Ae}},we={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(we).indexOf(t.direction)===-1&&Ge("Invalid direction '".concat(t.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(we).join(", ")));var me=function(oe){return fd(De(oe),u,we[t.direction])};return r.nodes().layoutPositions(this,t,me),this};var Yp={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function gc(t){this.options=ye({},Yp,t)}gc.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,i=a.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var o=mt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},u=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,l=u/Math.max(1,i.length-1),f,c=0,v=0;v<i.length;v++){var d=i[v],h=d.layoutDimensions(e),y=h.w,g=h.h;c=Math.max(c,y,g)}if(ae(e.radius)?f=e.radius:i.length<=1?f=0:f=Math.min(o.h,o.w)/2-c,i.length>1&&e.avoidOverlap){c*=1.75;var p=Math.cos(l)-Math.cos(0),m=Math.sin(l)-Math.sin(0),b=Math.sqrt(c*c/(p*p+m*m));f=Math.max(b,f)}var w=function(C,x){var T=e.startAngle+x*l*(n?1:-1),k=f*Math.cos(T),B=f*Math.sin(T),D={x:s.x+k,y:s.y+B};return D};return a.nodes().layoutPositions(this,e,w),this};var Zp={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function pc(t){this.options=ye({},Zp,t)}pc.prototype.run=function(){for(var t=this.options,e=t,r=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=t.cy,n=e.eles,i=n.nodes().not(":parent"),o=mt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},u=[],l=0,f=0;f<i.length;f++){var c=i[f],v=void 0;v=e.concentric(c),u.push({value:v,node:c}),c._private.scratch.concentric=v}i.updateStyle();for(var d=0;d<i.length;d++){var h=i[d],y=h.layoutDimensions(e);l=Math.max(l,y.w,y.h)}u.sort(function(re,ve){return ve.value-re.value});for(var g=e.levelWidth(i),p=[[]],m=p[0],b=0;b<u.length;b++){var w=u[b];if(m.length>0){var E=Math.abs(m[0].value-w.value);E>=g&&(m=[],p.push(m))}m.push(w)}var C=l+e.minNodeSpacing;if(!e.avoidOverlap){var x=p.length>0&&p[0].length>1,T=Math.min(o.w,o.h)/2-C,k=T/(p.length+x?1:0);C=Math.min(C,k)}for(var B=0,D=0;D<p.length;D++){var P=p[D],A=e.sweep===void 0?2*Math.PI-2*Math.PI/P.length:e.sweep,R=P.dTheta=A/Math.max(1,P.length-1);if(P.length>1&&e.avoidOverlap){var L=Math.cos(R)-Math.cos(0),I=Math.sin(R)-Math.sin(0),M=Math.sqrt(C*C/(L*L+I*I));B=Math.max(M,B)}P.r=B,B+=C}if(e.equidistant){for(var O=0,q=0,$=0;$<p.length;$++){var N=p[$],F=N.r-q;O=Math.max(O,F)}q=0;for(var W=0;W<p.length;W++){var J=p[W];W===0&&(q=J.r),J.r=q,q+=O}}for(var Z={},j=0;j<p.length;j++)for(var te=p[j],ne=te.dTheta,Q=te.r,V=0;V<te.length;V++){var H=te[V],G=e.startAngle+(r?1:-1)*ne*V,Y={x:s.x+Q*Math.cos(G),y:s.y+Q*Math.sin(G)};Z[H.node.id()]=Y}return n.nodes().layoutPositions(this,e,function(re){var ve=re.id();return Z[ve]}),this};var To,Qp={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,r){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function Xn(t){this.options=ye({},Qp,t),this.options.layout=this;var e=this.options.eles.nodes(),r=this.options.eles.edges(),a=r.filter(function(n){var i=n.source().data("id"),o=n.target().data("id"),s=e.some(function(l){return l.data("id")===i}),u=e.some(function(l){return l.data("id")===o});return!s||!u});this.options.eles=this.options.eles.not(a)}Xn.prototype.run=function(){var t=this.options,e=t.cy,r=this;r.stopped=!1,(t.animate===!0||t.animate===!1)&&r.emit({type:"layoutstart",layout:r}),t.debug===!0?To=!0:To=!1;var a=Jp(e,r,t);To&&ey(a),t.randomize&&ty(a);var n=Yt(),i=function(){ry(a,e,t),t.fit===!0&&e.fit(t.padding)},o=function(v){return!(r.stopped||v>=t.numIter||(ay(a,t),a.temperature=a.temperature*t.coolingFactor,a.temperature<t.minTemp))},s=function(){if(t.animate===!0||t.animate===!1)i(),r.one("layoutstop",t.stop),r.emit({type:"layoutstop",layout:r});else{var v=t.eles.nodes(),d=mc(a,t,v);v.layoutPositions(r,t,d)}},u=0,l=!0;if(t.animate===!0){var f=function(){for(var v=0;l&&v<t.refresh;)l=o(u),u++,v++;if(!l)Nu(a,t),s();else{var d=Yt();d-n>=t.animationThreshold&&i(),xn(f)}};f()}else{for(;l;)l=o(u),u++;Nu(a,t),s()}return this};Xn.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};Xn.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Jp=function(e,r,a){for(var n=a.eles.edges(),i=a.eles.nodes(),o=mt(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),s={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:a.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},u=a.eles.components(),l={},f=0;f<u.length;f++)for(var c=u[f],v=0;v<c.length;v++){var d=c[v];l[d.id()]=f}for(var f=0;f<s.nodeSize;f++){var h=i[f],y=h.layoutDimensions(a),g={};g.isLocked=h.locked(),g.id=h.data("id"),g.parentId=h.data("parent"),g.cmptId=l[h.id()],g.children=[],g.positionX=h.position("x"),g.positionY=h.position("y"),g.offsetX=0,g.offsetY=0,g.height=y.w,g.width=y.h,g.maxX=g.positionX+g.width/2,g.minX=g.positionX-g.width/2,g.maxY=g.positionY+g.height/2,g.minY=g.positionY-g.height/2,g.padLeft=parseFloat(h.style("padding")),g.padRight=parseFloat(h.style("padding")),g.padTop=parseFloat(h.style("padding")),g.padBottom=parseFloat(h.style("padding")),g.nodeRepulsion=We(a.nodeRepulsion)?a.nodeRepulsion(h):a.nodeRepulsion,s.layoutNodes.push(g),s.idToIndex[g.id]=f}for(var p=[],m=0,b=-1,w=[],f=0;f<s.nodeSize;f++){var h=s.layoutNodes[f],E=h.parentId;E!=null?s.layoutNodes[s.idToIndex[E]].children.push(h.id):(p[++b]=h.id,w.push(h.id))}for(s.graphSet.push(w);m<=b;){var C=p[m++],x=s.idToIndex[C],d=s.layoutNodes[x],T=d.children;if(T.length>0){s.graphSet.push(T);for(var f=0;f<T.length;f++)p[++b]=T[f]}}for(var f=0;f<s.graphSet.length;f++)for(var k=s.graphSet[f],v=0;v<k.length;v++){var B=s.idToIndex[k[v]];s.indexToGraph[B]=f}for(var f=0;f<s.edgeSize;f++){var D=n[f],P={};P.id=D.data("id"),P.sourceId=D.data("source"),P.targetId=D.data("target");var A=We(a.idealEdgeLength)?a.idealEdgeLength(D):a.idealEdgeLength,R=We(a.edgeElasticity)?a.edgeElasticity(D):a.edgeElasticity,L=s.idToIndex[P.sourceId],I=s.idToIndex[P.targetId],M=s.indexToGraph[L],O=s.indexToGraph[I];if(M!=O){for(var q=jp(P.sourceId,P.targetId,s),$=s.graphSet[q],N=0,g=s.layoutNodes[L];$.indexOf(g.id)===-1;)g=s.layoutNodes[s.idToIndex[g.parentId]],N++;for(g=s.layoutNodes[I];$.indexOf(g.id)===-1;)g=s.layoutNodes[s.idToIndex[g.parentId]],N++;A*=N*a.nestingFactor}P.idealLength=A,P.elasticity=R,s.layoutEdges.push(P)}return s},jp=function(e,r,a){var n=yc(e,r,0,a);return 2>n.count?0:n.graph},yc=function(e,r,a,n){var i=n.graphSet[a];if(-1<i.indexOf(e)&&-1<i.indexOf(r))return{count:2,graph:a};for(var o=0,s=0;s<i.length;s++){var u=i[s],l=n.idToIndex[u],f=n.layoutNodes[l].children;if(f.length!==0){var c=n.indexToGraph[n.idToIndex[f[0]]],v=yc(e,r,c,n);if(v.count!==0)if(v.count===1){if(o++,o===2)break}else return v}}return{count:o,graph:a}},ey,ty=function(e,r){for(var a=e.clientWidth,n=e.clientHeight,i=0;i<e.nodeSize;i++){var o=e.layoutNodes[i];o.children.length===0&&!o.isLocked&&(o.positionX=Math.random()*a,o.positionY=Math.random()*n)}},mc=function(e,r,a){var n=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return r.boundingBox&&(a.forEach(function(o){var s=e.layoutNodes[e.idToIndex[o.data("id")]];i.x1=Math.min(i.x1,s.positionX),i.x2=Math.max(i.x2,s.positionX),i.y1=Math.min(i.y1,s.positionY),i.y2=Math.max(i.y2,s.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(o,s){var u=e.layoutNodes[e.idToIndex[o.data("id")]];if(r.boundingBox){var l=i.w===0?.5:(u.positionX-i.x1)/i.w,f=i.h===0?.5:(u.positionY-i.y1)/i.h;return{x:n.x1+l*n.w,y:n.y1+f*n.h}}else return{x:u.positionX,y:u.positionY}}},ry=function(e,r,a){var n=a.layout,i=a.eles.nodes(),o=mc(e,a,i);i.positions(o),e.ready!==!0&&(e.ready=!0,n.one("layoutready",a.ready),n.emit({type:"layoutready",layout:this}))},ay=function(e,r,a){ny(e,r),sy(e),ly(e,r),uy(e),fy(e)},ny=function(e,r){for(var a=0;a<e.graphSet.length;a++)for(var n=e.graphSet[a],i=n.length,o=0;o<i;o++)for(var s=e.layoutNodes[e.idToIndex[n[o]]],u=o+1;u<i;u++){var l=e.layoutNodes[e.idToIndex[n[u]]];iy(s,l,e,r)}},Ou=function(e){return-1+2*e*Math.random()},iy=function(e,r,a,n){var i=e.cmptId,o=r.cmptId;if(!(i!==o&&!a.isCompound)){var s=r.positionX-e.positionX,u=r.positionY-e.positionY,l=1;s===0&&u===0&&(s=Ou(l),u=Ou(l));var f=oy(e,r,s,u);if(f>0)var c=n.nodeOverlap*f,v=Math.sqrt(s*s+u*u),d=c*s/v,h=c*u/v;else var y=Dn(e,s,u),g=Dn(r,-1*s,-1*u),p=g.x-y.x,m=g.y-y.y,b=p*p+m*m,v=Math.sqrt(b),c=(e.nodeRepulsion+r.nodeRepulsion)/b,d=c*p/v,h=c*m/v;e.isLocked||(e.offsetX-=d,e.offsetY-=h),r.isLocked||(r.offsetX+=d,r.offsetY+=h)}},oy=function(e,r,a,n){if(a>0)var i=e.maxX-r.minX;else var i=r.maxX-e.minX;if(n>0)var o=e.maxY-r.minY;else var o=r.maxY-e.minY;return i>=0&&o>=0?Math.sqrt(i*i+o*o):0},Dn=function(e,r,a){var n=e.positionX,i=e.positionY,o=e.height||1,s=e.width||1,u=a/r,l=o/s,f={};return r===0&&0<a||r===0&&0>a?(f.x=n,f.y=i+o/2,f):0<r&&-1*l<=u&&u<=l?(f.x=n+s/2,f.y=i+s*a/2/r,f):0>r&&-1*l<=u&&u<=l?(f.x=n-s/2,f.y=i-s*a/2/r,f):0<a&&(u<=-1*l||u>=l)?(f.x=n+o*r/2/a,f.y=i+o/2,f):(0>a&&(u<=-1*l||u>=l)&&(f.x=n-o*r/2/a,f.y=i-o/2),f)},sy=function(e,r){for(var a=0;a<e.edgeSize;a++){var n=e.layoutEdges[a],i=e.idToIndex[n.sourceId],o=e.layoutNodes[i],s=e.idToIndex[n.targetId],u=e.layoutNodes[s],l=u.positionX-o.positionX,f=u.positionY-o.positionY;if(!(l===0&&f===0)){var c=Dn(o,l,f),v=Dn(u,-1*l,-1*f),d=v.x-c.x,h=v.y-c.y,y=Math.sqrt(d*d+h*h),g=Math.pow(n.idealLength-y,2)/n.elasticity;if(y!==0)var p=g*d/y,m=g*h/y;else var p=0,m=0;o.isLocked||(o.offsetX+=p,o.offsetY+=m),u.isLocked||(u.offsetX-=p,u.offsetY-=m)}}},ly=function(e,r){if(r.gravity!==0)for(var a=1,n=0;n<e.graphSet.length;n++){var i=e.graphSet[n],o=i.length;if(n===0)var s=e.clientHeight/2,u=e.clientWidth/2;else var l=e.layoutNodes[e.idToIndex[i[0]]],f=e.layoutNodes[e.idToIndex[l.parentId]],s=f.positionX,u=f.positionY;for(var c=0;c<o;c++){var v=e.layoutNodes[e.idToIndex[i[c]]];if(!v.isLocked){var d=s-v.positionX,h=u-v.positionY,y=Math.sqrt(d*d+h*h);if(y>a){var g=r.gravity*d/y,p=r.gravity*h/y;v.offsetX+=g,v.offsetY+=p}}}}},uy=function(e,r){var a=[],n=0,i=-1;for(a.push.apply(a,e.graphSet[0]),i+=e.graphSet[0].length;n<=i;){var o=a[n++],s=e.idToIndex[o],u=e.layoutNodes[s],l=u.children;if(0<l.length&&!u.isLocked){for(var f=u.offsetX,c=u.offsetY,v=0;v<l.length;v++){var d=e.layoutNodes[e.idToIndex[l[v]]];d.offsetX+=f,d.offsetY+=c,a[++i]=l[v]}u.offsetX=0,u.offsetY=0}}},fy=function(e,r){for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];0<n.children.length&&(n.maxX=void 0,n.minX=void 0,n.maxY=void 0,n.minY=void 0)}for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];if(!(0<n.children.length||n.isLocked)){var i=cy(n.offsetX,n.offsetY,e.temperature);n.positionX+=i.x,n.positionY+=i.y,n.offsetX=0,n.offsetY=0,n.minX=n.positionX-n.width,n.maxX=n.positionX+n.width,n.minY=n.positionY-n.height,n.maxY=n.positionY+n.height,bc(n,e)}}for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];0<n.children.length&&!n.isLocked&&(n.positionX=(n.maxX+n.minX)/2,n.positionY=(n.maxY+n.minY)/2,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY)}},cy=function(e,r,a){var n=Math.sqrt(e*e+r*r);if(n>a)var i={x:a*e/n,y:a*r/n};else var i={x:e,y:r};return i},bc=function(e,r){var a=e.parentId;if(a!=null){var n=r.layoutNodes[r.idToIndex[a]],i=!1;if((n.maxX==null||e.maxX+n.padRight>n.maxX)&&(n.maxX=e.maxX+n.padRight,i=!0),(n.minX==null||e.minX-n.padLeft<n.minX)&&(n.minX=e.minX-n.padLeft,i=!0),(n.maxY==null||e.maxY+n.padBottom>n.maxY)&&(n.maxY=e.maxY+n.padBottom,i=!0),(n.minY==null||e.minY-n.padTop<n.minY)&&(n.minY=e.minY-n.padTop,i=!0),i)return bc(n,r)}},Nu=function(e,r){for(var a=e.layoutNodes,n=[],i=0;i<a.length;i++){var o=a[i],s=o.cmptId,u=n[s]=n[s]||[];u.push(o)}for(var l=0,i=0;i<n.length;i++){var f=n[i];if(f){f.x1=1/0,f.x2=-1/0,f.y1=1/0,f.y2=-1/0;for(var c=0;c<f.length;c++){var v=f[c];f.x1=Math.min(f.x1,v.positionX-v.width/2),f.x2=Math.max(f.x2,v.positionX+v.width/2),f.y1=Math.min(f.y1,v.positionY-v.height/2),f.y2=Math.max(f.y2,v.positionY+v.height/2)}f.w=f.x2-f.x1,f.h=f.y2-f.y1,l+=f.w*f.h}}n.sort(function(m,b){return b.w*b.h-m.w*m.h});for(var d=0,h=0,y=0,g=0,p=Math.sqrt(l)*e.clientWidth/e.clientHeight,i=0;i<n.length;i++){var f=n[i];if(f){for(var c=0;c<f.length;c++){var v=f[c];v.isLocked||(v.positionX+=d-f.x1,v.positionY+=h-f.y1)}d+=f.w+r.componentSpacing,y+=f.w+r.componentSpacing,g=Math.max(g,f.h),y>p&&(h+=g+r.componentSpacing,d=0,y=0,g=0)}}},vy={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function wc(t){this.options=ye({},vy,t)}wc.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=a.nodes().not(":parent");e.sort&&(n=n.sort(e.sort));var i=mt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(i.h===0||i.w===0)a.nodes().layoutPositions(this,e,function(W){return{x:i.x1,y:i.y1}});else{var o=n.size(),s=Math.sqrt(o*i.h/i.w),u=Math.round(s),l=Math.round(i.w/i.h*s),f=function(J){if(J==null)return Math.min(u,l);var Z=Math.min(u,l);Z==u?u=J:l=J},c=function(J){if(J==null)return Math.max(u,l);var Z=Math.max(u,l);Z==u?u=J:l=J},v=e.rows,d=e.cols!=null?e.cols:e.columns;if(v!=null&&d!=null)u=v,l=d;else if(v!=null&&d==null)u=v,l=Math.ceil(o/u);else if(v==null&&d!=null)l=d,u=Math.ceil(o/l);else if(l*u>o){var h=f(),y=c();(h-1)*y>=o?f(h-1):(y-1)*h>=o&&c(y-1)}else for(;l*u<o;){var g=f(),p=c();(p+1)*g>=o?c(p+1):f(g+1)}var m=i.w/l,b=i.h/u;if(e.condense&&(m=0,b=0),e.avoidOverlap)for(var w=0;w<n.length;w++){var E=n[w],C=E._private.position;(C.x==null||C.y==null)&&(C.x=0,C.y=0);var x=E.layoutDimensions(e),T=e.avoidOverlapPadding,k=x.w+T,B=x.h+T;m=Math.max(m,k),b=Math.max(b,B)}for(var D={},P=function(J,Z){return!!D["c-"+J+"-"+Z]},A=function(J,Z){D["c-"+J+"-"+Z]=!0},R=0,L=0,I=function(){L++,L>=l&&(L=0,R++)},M={},O=0;O<n.length;O++){var q=n[O],$=e.position(q);if($&&($.row!==void 0||$.col!==void 0)){var N={row:$.row,col:$.col};if(N.col===void 0)for(N.col=0;P(N.row,N.col);)N.col++;else if(N.row===void 0)for(N.row=0;P(N.row,N.col);)N.row++;M[q.id()]=N,A(N.row,N.col)}}var F=function(J,Z){var j,te;if(J.locked()||J.isParent())return!1;var ne=M[J.id()];if(ne)j=ne.col*m+m/2+i.x1,te=ne.row*b+b/2+i.y1;else{for(;P(R,L);)I();j=L*m+m/2+i.x1,te=R*b+b/2+i.y1,A(R,L),I()}return{x:j,y:te}};n.layoutPositions(this,e,F)}return this};var dy={ready:function(){},stop:function(){}};function ms(t){this.options=ye({},dy,t)}ms.prototype.run=function(){var t=this.options,e=t.eles,r=this;return t.cy,r.emit("layoutstart"),e.nodes().positions(function(){return{x:0,y:0}}),r.one("layoutready",t.ready),r.emit("layoutready"),r.one("layoutstop",t.stop),r.emit("layoutstop"),this};ms.prototype.stop=function(){return this};var hy={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function xc(t){this.options=ye({},hy,t)}xc.prototype.run=function(){var t=this.options,e=t.eles,r=e.nodes(),a=We(t.positions);function n(i){if(t.positions==null)return Nd(i.position());if(a)return t.positions(i);var o=t.positions[i._private.data.id];return o??null}return r.layoutPositions(this,t,function(i,o){var s=n(i);return i.locked()||s==null?!1:s}),this};var gy={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function Ec(t){this.options=ye({},gy,t)}Ec.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,a=mt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),n=function(o,s){return{x:a.x1+Math.round(Math.random()*a.w),y:a.y1+Math.round(Math.random()*a.h)}};return r.nodes().layoutPositions(this,t,n),this};var py=[{name:"breadthfirst",impl:hc},{name:"circle",impl:gc},{name:"concentric",impl:pc},{name:"cose",impl:Xn},{name:"grid",impl:wc},{name:"null",impl:ms},{name:"preset",impl:xc},{name:"random",impl:Ec}];function Cc(t){this.options=t,this.notifications=0}var zu=function(){},Fu=function(){throw new Error("A headless instance can not render images")};Cc.prototype={recalculateRenderedStyle:zu,notify:function(){this.notifications++},init:zu,isHeadless:function(){return!0},png:Fu,jpg:Fu};var bs={};bs.arrowShapeWidth=.3;bs.registerArrowShapes=function(){var t=this.arrowShapes={},e=this,r=function(l,f,c,v,d,h,y){var g=d.x-c/2-y,p=d.x+c/2+y,m=d.y-c/2-y,b=d.y+c/2+y,w=g<=l&&l<=p&&m<=f&&f<=b;return w},a=function(l,f,c,v,d){var h=l*Math.cos(v)-f*Math.sin(v),y=l*Math.sin(v)+f*Math.cos(v),g=h*c,p=y*c,m=g+d.x,b=p+d.y;return{x:m,y:b}},n=function(l,f,c,v){for(var d=[],h=0;h<l.length;h+=2){var y=l[h],g=l[h+1];d.push(a(y,g,f,c,v))}return d},i=function(l){for(var f=[],c=0;c<l.length;c++){var v=l[c];f.push(v.x,v.y)}return f},o=function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").pfValue*2},s=function(l,f){he(f)&&(f=t[f]),t[l]=ye({name:l,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(v,d,h,y,g,p){var m=i(n(this.points,h+2*p,y,g)),b=Ct(v,d,m);return b},roughCollide:r,draw:function(v,d,h,y){var g=n(this.points,d,h,y);e.arrowShapeImpl("polygon")(v,g)},spacing:function(v){return 0},gap:o},f)};s("none",{collide:En,roughCollide:En,draw:ns,spacing:Js,gap:Js}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:t.triangle.points,controlPoint:[0,-.15],roughCollide:r,draw:function(l,f,c,v,d){var h=n(this.points,f,c,v),y=this.controlPoint,g=a(y[0],y[1],f,c,v);e.arrowShapeImpl(this.name)(l,h,g)},gap:function(l){return o(l)*.8}}),s("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(l,f,c,v,d,h,y){var g=i(n(this.points,c+2*y,v,d)),p=i(n(this.pointsTee,c+2*y,v,d)),m=Ct(l,f,g)||Ct(l,f,p);return m},draw:function(l,f,c,v,d){var h=n(this.points,f,c,v),y=n(this.pointsTee,f,c,v);e.arrowShapeImpl(this.name)(l,h,y)}}),s("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(l,f,c,v,d,h,y){var g=d,p=Math.pow(g.x-l,2)+Math.pow(g.y-f,2)<=Math.pow((c+2*y)*this.radius,2),m=i(n(this.points,c+2*y,v,d));return Ct(l,f,m)||p},draw:function(l,f,c,v,d){var h=n(this.pointsTr,f,c,v);e.arrowShapeImpl(this.name)(l,h,v.x,v.y,this.radius*f)},spacing:function(l){return e.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),s("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(l,f){var c=this.baseCrossLinePts.slice(),v=f/l,d=3,h=5;return c[d]=c[d]-v,c[h]=c[h]-v,c},collide:function(l,f,c,v,d,h,y){var g=i(n(this.points,c+2*y,v,d)),p=i(n(this.crossLinePts(c,h),c+2*y,v,d)),m=Ct(l,f,g)||Ct(l,f,p);return m},draw:function(l,f,c,v,d){var h=n(this.points,f,c,v),y=n(this.crossLinePts(f,d),f,c,v);e.arrowShapeImpl(this.name)(l,h,y)}}),s("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(l){return o(l)*.525}}),s("circle",{radius:.15,collide:function(l,f,c,v,d,h,y){var g=d,p=Math.pow(g.x-l,2)+Math.pow(g.y-f,2)<=Math.pow((c+2*y)*this.radius,2);return p},draw:function(l,f,c,v,d){e.arrowShapeImpl(this.name)(l,v.x,v.y,this.radius*f)},spacing:function(l){return e.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),s("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(l){return 1},gap:function(l){return 1}}),s("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}}),s("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(l){return .95*l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}})};var Or={};Or.projectIntoViewport=function(t,e){var r=this.cy,a=this.findContainerClientCoords(),n=a[0],i=a[1],o=a[4],s=r.pan(),u=r.zoom(),l=((t-n)/o-s.x)/u,f=((e-i)/o-s.y)/u;return[l,f]};Or.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var t=this.container,e=t.getBoundingClientRect(),r=this.cy.window().getComputedStyle(t),a=function(p){return parseFloat(r.getPropertyValue(p))},n={left:a("padding-left"),right:a("padding-right"),top:a("padding-top"),bottom:a("padding-bottom")},i={left:a("border-left-width"),right:a("border-right-width"),top:a("border-top-width"),bottom:a("border-bottom-width")},o=t.clientWidth,s=t.clientHeight,u=n.left+n.right,l=n.top+n.bottom,f=i.left+i.right,c=e.width/(o+f),v=o-u,d=s-l,h=e.left+n.left+i.left,y=e.top+n.top+i.top;return this.containerBB=[h,y,v,d,c]};Or.invalidateContainerClientCoordsCache=function(){this.containerBB=null};Or.findNearestElement=function(t,e,r,a){return this.findNearestElements(t,e,r,a)[0]};Or.findNearestElements=function(t,e,r,a){var n=this,i=this,o=i.getCachedZSortedEles(),s=[],u=i.cy.zoom(),l=i.cy.hasCompoundNodes(),f=(a?24:8)/u,c=(a?8:2)/u,v=(a?8:2)/u,d=1/0,h,y;r&&(o=o.interactive);function g(x,T){if(x.isNode()){if(y)return;y=x,s.push(x)}if(x.isEdge()&&(T==null||T<d))if(h){if(h.pstyle("z-compound-depth").value===x.pstyle("z-compound-depth").value&&h.pstyle("z-compound-depth").value===x.pstyle("z-compound-depth").value){for(var k=0;k<s.length;k++)if(s[k].isEdge()){s[k]=x,h=x,d=T??d;break}}}else s.push(x),h=x,d=T??d}function p(x){var T=x.outerWidth()+2*c,k=x.outerHeight()+2*c,B=T/2,D=k/2,P=x.position(),A=x.pstyle("corner-radius").value==="auto"?"auto":x.pstyle("corner-radius").pfValue,R=x._private.rscratch;if(P.x-B<=t&&t<=P.x+B&&P.y-D<=e&&e<=P.y+D){var L=i.nodeShapes[n.getNodeShape(x)];if(L.checkPoint(t,e,0,T,k,P.x,P.y,A,R))return g(x,0),!0}}function m(x){var T=x._private,k=T.rscratch,B=x.pstyle("width").pfValue,D=x.pstyle("arrow-scale").value,P=B/2+f,A=P*P,R=P*2,O=T.source,q=T.target,L;if(k.edgeType==="segments"||k.edgeType==="straight"||k.edgeType==="haystack"){for(var I=k.allpts,M=0;M+3<I.length;M+=2)if(Zd(t,e,I[M],I[M+1],I[M+2],I[M+3],R)&&A>(L=th(t,e,I[M],I[M+1],I[M+2],I[M+3])))return g(x,L),!0}else if(k.edgeType==="bezier"||k.edgeType==="multibezier"||k.edgeType==="self"||k.edgeType==="compound"){for(var I=k.allpts,M=0;M+5<k.allpts.length;M+=4)if(Qd(t,e,I[M],I[M+1],I[M+2],I[M+3],I[M+4],I[M+5],R)&&A>(L=eh(t,e,I[M],I[M+1],I[M+2],I[M+3],I[M+4],I[M+5])))return g(x,L),!0}for(var O=O||T.source,q=q||T.target,$=n.getArrowWidth(B,D),N=[{name:"source",x:k.arrowStartX,y:k.arrowStartY,angle:k.srcArrowAngle},{name:"target",x:k.arrowEndX,y:k.arrowEndY,angle:k.tgtArrowAngle},{name:"mid-source",x:k.midX,y:k.midY,angle:k.midsrcArrowAngle},{name:"mid-target",x:k.midX,y:k.midY,angle:k.midtgtArrowAngle}],M=0;M<N.length;M++){var F=N[M],W=i.arrowShapes[x.pstyle(F.name+"-arrow-shape").value],J=x.pstyle("width").pfValue;if(W.roughCollide(t,e,$,F.angle,{x:F.x,y:F.y},J,f)&&W.collide(t,e,$,F.angle,{x:F.x,y:F.y},J,f))return g(x),!0}l&&s.length>0&&(p(O),p(q))}function b(x,T,k){return Et(x,T,k)}function w(x,T){var k=x._private,B=v,D;T?D=T+"-":D="",x.boundingBox();var P=k.labelBounds[T||"main"],A=x.pstyle(D+"label").value,R=x.pstyle("text-events").strValue==="yes";if(!(!R||!A)){var L=b(k.rscratch,"labelX",T),I=b(k.rscratch,"labelY",T),M=b(k.rscratch,"labelAngle",T),O=x.pstyle(D+"text-margin-x").pfValue,q=x.pstyle(D+"text-margin-y").pfValue,$=P.x1-B-O,N=P.x2+B-O,F=P.y1-B-q,W=P.y2+B-q;if(M){var J=Math.cos(M),Z=Math.sin(M),j=function(Y,re){return Y=Y-L,re=re-I,{x:Y*J-re*Z+L,y:Y*Z+re*J+I}},te=j($,F),ne=j($,W),Q=j(N,F),V=j(N,W),H=[te.x+O,te.y+q,Q.x+O,Q.y+q,V.x+O,V.y+q,ne.x+O,ne.y+q];if(Ct(t,e,H))return g(x),!0}else if(nr(P,t,e))return g(x),!0}}for(var E=o.length-1;E>=0;E--){var C=o[E];C.isNode()?p(C)||w(C):m(C)||w(C)||w(C,"source")||w(C,"target")}return s};Or.getAllInBox=function(t,e,r,a){var n=this.getCachedZSortedEles().interactive,i=this.cy.zoom(),o=2/i,s=[],u=Math.min(t,r),l=Math.max(t,r),f=Math.min(e,a),c=Math.max(e,a);t=u,r=l,e=f,a=c;var v=mt({x1:t,y1:e,x2:r,y2:a}),d=[{x:v.x1,y:v.y1},{x:v.x2,y:v.y1},{x:v.x2,y:v.y2},{x:v.x1,y:v.y2}],h=[[d[0],d[1]],[d[1],d[2]],[d[2],d[3]],[d[3],d[0]]];function y(Y,re,ve){return Et(Y,re,ve)}function g(Y,re){var ve=Y._private,De=o,we="";Y.boundingBox();var me=ve.labelBounds.main;if(!me)return null;var ge=y(ve.rscratch,"labelX",re),oe=y(ve.rscratch,"labelY",re),de=y(ve.rscratch,"labelAngle",re),ce=Y.pstyle(we+"text-margin-x").pfValue,xe=Y.pstyle(we+"text-margin-y").pfValue,be=me.x1-De-ce,Se=me.x2+De-ce,Be=me.y1-De-xe,Oe=me.y2+De-xe;if(de){var Le=Math.cos(de),Ae=Math.sin(de),X=function(z,_){return z=z-ge,_=_-oe,{x:z*Le-_*Ae+ge,y:z*Ae+_*Le+oe}};return[X(be,Be),X(Se,Be),X(Se,Oe),X(be,Oe)]}else return[{x:be,y:Be},{x:Se,y:Be},{x:Se,y:Oe},{x:be,y:Oe}]}function p(Y,re,ve,De){function we(me,ge,oe){return(oe.y-me.y)*(ge.x-me.x)>(ge.y-me.y)*(oe.x-me.x)}return we(Y,ve,De)!==we(re,ve,De)&&we(Y,re,ve)!==we(Y,re,De)}for(var m=0;m<n.length;m++){var b=n[m];if(b.isNode()){var w=b,E=w.pstyle("text-events").strValue==="yes",C=w.pstyle("box-selection").strValue,x=w.pstyle("box-select-labels").strValue==="yes";if(C==="none")continue;var T=(C==="overlap"||x)&&E,k=w.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:T});if(C==="contain"){var B=!1;if(x&&E){var D=g(w);D&&xi(D,d)&&(s.push(w),B=!0)}!B&&Af(v,k)&&s.push(w)}else if(C==="overlap"&&ls(v,k)){var P=w.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1}),A=[{x:P.x1,y:P.y1},{x:P.x2,y:P.y1},{x:P.x2,y:P.y2},{x:P.x1,y:P.y2}];if(xi(A,d))s.push(w);else{var R=g(w);R&&xi(R,d)&&s.push(w)}}}else{var L=b,I=L._private,M=I.rscratch,O=L.pstyle("box-selection").strValue;if(O==="none")continue;if(O==="contain"){if(M.startX!=null&&M.startY!=null&&!nr(v,M.startX,M.startY)||M.endX!=null&&M.endY!=null&&!nr(v,M.endX,M.endY))continue;if(M.edgeType==="bezier"||M.edgeType==="multibezier"||M.edgeType==="self"||M.edgeType==="compound"||M.edgeType==="segments"||M.edgeType==="haystack"){for(var q=I.rstyle.bezierPts||I.rstyle.linePts||I.rstyle.haystackPts,$=!0,N=0;N<q.length;N++)if(!al(v,q[N])){$=!1;break}$&&s.push(L)}else M.edgeType==="straight"&&s.push(L)}else if(O==="overlap"){var F=!1;if(M.startX!=null&&M.startY!=null&&M.endX!=null&&M.endY!=null&&(nr(v,M.startX,M.startY)||nr(v,M.endX,M.endY)))s.push(L),F=!0;else if(!F&&M.edgeType==="haystack"){for(var W=I.rstyle.haystackPts,J=0;J<W.length;J++)if(al(v,W[J])){s.push(L),F=!0;break}}if(!F){var Z=I.rstyle.bezierPts||I.rstyle.linePts||I.rstyle.haystackPts;if((!Z||Z.length<2)&&M.edgeType==="straight"&&M.startX!=null&&M.startY!=null&&M.endX!=null&&M.endY!=null&&(Z=[{x:M.startX,y:M.startY},{x:M.endX,y:M.endY}]),!Z||Z.length<2)continue;for(var j=0;j<Z.length-1;j++){for(var te=Z[j],ne=Z[j+1],Q=0;Q<h.length;Q++){var V=Je(h[Q],2),H=V[0],G=V[1];if(p(te,ne,H,G)){s.push(L),F=!0;break}}if(F)break}}}}}return s};var Pn={};Pn.calculateArrowAngles=function(t){var e=t._private.rscratch,r=e.edgeType==="haystack",a=e.edgeType==="bezier",n=e.edgeType==="multibezier",i=e.edgeType==="segments",o=e.edgeType==="compound",s=e.edgeType==="self",u,l,f,c,v,d,p,m;if(r?(f=e.haystackPts[0],c=e.haystackPts[1],v=e.haystackPts[2],d=e.haystackPts[3]):(f=e.arrowStartX,c=e.arrowStartY,v=e.arrowEndX,d=e.arrowEndY),p=e.midX,m=e.midY,i)u=f-e.segpts[0],l=c-e.segpts[1];else if(n||o||s||a){var h=e.allpts,y=it(h[0],h[2],h[4],.1),g=it(h[1],h[3],h[5],.1);u=f-y,l=c-g}else u=f-p,l=c-m;e.srcArrowAngle=Za(u,l);var p=e.midX,m=e.midY;if(r&&(p=(f+v)/2,m=(c+d)/2),u=v-f,l=d-c,i){var h=e.allpts;if(h.length/2%2===0){var b=h.length/2,w=b-2;u=h[b]-h[w],l=h[b+1]-h[w+1]}else if(e.isRound)u=e.midVector[1],l=-e.midVector[0];else{var b=h.length/2-1,w=b-2;u=h[b]-h[w],l=h[b+1]-h[w+1]}}else if(n||o||s){var h=e.allpts,E=e.ctrlpts,C,x,T,k;if(E.length/2%2===0){var B=h.length/2-1,D=B+2,P=D+2;C=it(h[B],h[D],h[P],0),x=it(h[B+1],h[D+1],h[P+1],0),T=it(h[B],h[D],h[P],1e-4),k=it(h[B+1],h[D+1],h[P+1],1e-4)}else{var D=h.length/2-1,B=D-2,P=D+2;C=it(h[B],h[D],h[P],.4999),x=it(h[B+1],h[D+1],h[P+1],.4999),T=it(h[B],h[D],h[P],.5),k=it(h[B+1],h[D+1],h[P+1],.5)}u=T-C,l=k-x}if(e.midtgtArrowAngle=Za(u,l),e.midDispX=u,e.midDispY=l,u*=-1,l*=-1,i){var h=e.allpts;if(h.length/2%2!==0){if(!e.isRound){var b=h.length/2-1,A=b+2;u=-(h[A]-h[b]),l=-(h[A+1]-h[b+1])}}}if(e.midsrcArrowAngle=Za(u,l),i)u=v-e.segpts[e.segpts.length-2],l=d-e.segpts[e.segpts.length-1];else if(n||o||s||a){var h=e.allpts,R=h.length,y=it(h[R-6],h[R-4],h[R-2],.9),g=it(h[R-5],h[R-3],h[R-1],.9);u=v-y,l=d-g}else u=v-p,l=d-m;e.tgtArrowAngle=Za(u,l)};Pn.getArrowWidth=Pn.getArrowHeight=function(t,e){var r=this.arrowWidthCache=this.arrowWidthCache||{},a=r[t+", "+e];return a||(a=Math.max(Math.pow(t*13.37,.9),29)*e,r[t+", "+e]=a,a)};var Go,Uo,qt={},Bt={},Vu,qu,Dr,pn,Wt,Er,kr,Ft,$r,nn,Tc,Sc,Wo,Ko,$u,_u=function(e,r,a){a.x=r.x-e.x,a.y=r.y-e.y,a.len=Math.sqrt(a.x*a.x+a.y*a.y),a.nx=a.x/a.len,a.ny=a.y/a.len,a.ang=Math.atan2(a.ny,a.nx)},yy=function(e,r){r.x=e.x*-1,r.y=e.y*-1,r.nx=e.nx*-1,r.ny=e.ny*-1,r.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},my=function(e,r,a,n,i){if(e!==$u?_u(r,e,qt):yy(Bt,qt),_u(r,a,Bt),Vu=qt.nx*Bt.ny-qt.ny*Bt.nx,qu=qt.nx*Bt.nx-qt.ny*-Bt.ny,Wt=Math.asin(Math.max(-1,Math.min(1,Vu))),Math.abs(Wt)<1e-6){Go=r.x,Uo=r.y,kr=$r=0;return}Dr=1,pn=!1,qu<0?Wt<0?Wt=Math.PI+Wt:(Wt=Math.PI-Wt,Dr=-1,pn=!0):Wt>0&&(Dr=-1,pn=!0),r.radius!==void 0?$r=r.radius:$r=n,Er=Wt/2,nn=Math.min(qt.len/2,Bt.len/2),i?(Ft=Math.abs(Math.cos(Er)*$r/Math.sin(Er)),Ft>nn?(Ft=nn,kr=Math.abs(Ft*Math.sin(Er)/Math.cos(Er))):kr=$r):(Ft=Math.min(nn,$r),kr=Math.abs(Ft*Math.sin(Er)/Math.cos(Er))),Wo=r.x+Bt.nx*Ft,Ko=r.y+Bt.ny*Ft,Go=Wo-Bt.ny*kr*Dr,Uo=Ko+Bt.nx*kr*Dr,Tc=r.x+qt.nx*Ft,Sc=r.y+qt.ny*Ft,$u=r};function kc(t,e){e.radius===0?t.lineTo(e.cx,e.cy):t.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function ws(t,e,r,a){var n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return a===0||e.radius===0?{cx:e.x,cy:e.y,radius:0,startX:e.x,startY:e.y,stopX:e.x,stopY:e.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(my(t,e,r,a,n),{cx:Go,cy:Uo,radius:kr,startX:Tc,startY:Sc,stopX:Wo,stopY:Ko,startAngle:qt.ang+Math.PI/2*Dr,endAngle:Bt.ang-Math.PI/2*Dr,counterClockwise:pn})}var La=.01,by=Math.sqrt(2*La),pt={};pt.findMidptPtsEtc=function(t,e){var r=e.posPts,a=e.intersectionPts,n=e.vectorNormInverse,i,o=t.pstyle("source-endpoint"),s=t.pstyle("target-endpoint"),u=o.units!=null&&s.units!=null,l=function(E,C,x,T){var k=T-C,B=x-E,D=Math.sqrt(B*B+k*k);return{x:-k/D,y:B/D}},f=t.pstyle("edge-distances").value;switch(f){case"node-position":i=r;break;case"intersection":i=a;break;case"endpoints":{if(u){var c=this.manualEndptToPx(t.source()[0],o),v=Je(c,2),d=v[0],h=v[1],y=this.manualEndptToPx(t.target()[0],s),g=Je(y,2),p=g[0],m=g[1],b={x1:d,y1:h,x2:p,y2:m};n=l(d,h,p,m),i=b}else ze("Edge ".concat(t.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),i=a;break}}return{midptPts:i,vectorNormInverse:n}};pt.findHaystackPoints=function(t){for(var e=0;e<t.length;e++){var r=t[e],a=r._private,n=a.rscratch;if(!n.haystack){var i=Math.random()*2*Math.PI;n.source={x:Math.cos(i),y:Math.sin(i)},i=Math.random()*2*Math.PI,n.target={x:Math.cos(i),y:Math.sin(i)}}var o=a.source,s=a.target,u=o.position(),l=s.position(),f=o.width(),c=s.width(),v=o.height(),d=s.height(),h=r.pstyle("haystack-radius").value,y=h/2;n.haystackPts=n.allpts=[n.source.x*f*y+u.x,n.source.y*v*y+u.y,n.target.x*c*y+l.x,n.target.y*d*y+l.y],n.midX=(n.allpts[0]+n.allpts[2])/2,n.midY=(n.allpts[1]+n.allpts[3])/2,n.edgeType="haystack",n.haystack=!0,this.storeEdgeProjections(r),this.calculateArrowAngles(r),this.recalculateEdgeLabelProjections(r),this.calculateLabelAngles(r)}};pt.findSegmentsPoints=function(t,e){var r=t._private.rscratch,a=t.pstyle("segment-weights"),n=t.pstyle("segment-distances"),i=t.pstyle("segment-radii"),o=t.pstyle("radius-type"),s=Math.min(a.pfValue.length,n.pfValue.length),u=i.pfValue[i.pfValue.length-1],l=o.pfValue[o.pfValue.length-1];r.edgeType="segments",r.segpts=[],r.radii=[],r.isArcRadius=[];for(var f=0;f<s;f++){var c=a.pfValue[f],v=n.pfValue[f],d=1-c,h=c,y=this.findMidptPtsEtc(t,e),g=y.midptPts,p=y.vectorNormInverse,m={x:g.x1*d+g.x2*h,y:g.y1*d+g.y2*h};r.segpts.push(m.x+p.x*v,m.y+p.y*v),r.radii.push(i.pfValue[f]!==void 0?i.pfValue[f]:u),r.isArcRadius.push((o.pfValue[f]!==void 0?o.pfValue[f]:l)==="arc-radius")}};pt.findLoopPoints=function(t,e,r,a){var n=t._private.rscratch,i=e.dirCounts,o=e.srcPos,s=t.pstyle("control-point-distances"),u=s?s.pfValue[0]:void 0,l=t.pstyle("loop-direction").pfValue,f=t.pstyle("loop-sweep").pfValue,c=t.pstyle("control-point-step-size").pfValue;n.edgeType="self";var v=r,d=c;a&&(v=0,d=u);var h=l-Math.PI/2,y=h-f/2,g=h+f/2,p=l+"_"+f;v=i[p]===void 0?i[p]=0:++i[p],n.ctrlpts=[o.x+Math.cos(y)*1.4*d*(v/3+1),o.y+Math.sin(y)*1.4*d*(v/3+1),o.x+Math.cos(g)*1.4*d*(v/3+1),o.y+Math.sin(g)*1.4*d*(v/3+1)]};pt.findCompoundLoopPoints=function(t,e,r,a){var n=t._private.rscratch;n.edgeType="compound";var i=e.srcPos,o=e.tgtPos,s=e.srcW,u=e.srcH,l=e.tgtW,f=e.tgtH,c=t.pstyle("control-point-step-size").pfValue,v=t.pstyle("control-point-distances"),d=v?v.pfValue[0]:void 0,h=r,y=c;a&&(h=0,y=d);var g=50,p={x:i.x-s/2,y:i.y-u/2},m={x:o.x-l/2,y:o.y-f/2},b={x:Math.min(p.x,m.x),y:Math.min(p.y,m.y)},w=.5,E=Math.max(w,Math.log(s*La)),C=Math.max(w,Math.log(l*La));n.ctrlpts=[b.x,b.y-(1+Math.pow(g,1.12)/100)*y*(h/3+1)*E,b.x-(1+Math.pow(g,1.12)/100)*y*(h/3+1)*C,b.y]};pt.findStraightEdgePoints=function(t){t._private.rscratch.edgeType="straight"};pt.findBezierPoints=function(t,e,r,a,n){var i=t._private.rscratch,o=t.pstyle("control-point-step-size").pfValue,s=t.pstyle("control-point-distances"),u=t.pstyle("control-point-weights"),l=s&&u?Math.min(s.value.length,u.value.length):1,f=s?s.pfValue[0]:void 0,c=u.value[0],v=a;i.edgeType=v?"multibezier":"bezier",i.ctrlpts=[];for(var d=0;d<l;d++){var h=(.5-e.eles.length/2+r)*o*(n?-1:1),y=void 0,g=ss(h);v&&(f=s?s.pfValue[d]:o,c=u.value[d]),a?y=f:y=f!==void 0?g*f:void 0;var p=y!==void 0?y:h,m=1-c,b=c,w=this.findMidptPtsEtc(t,e),E=w.midptPts,C=w.vectorNormInverse,x={x:E.x1*m+E.x2*b,y:E.y1*m+E.y2*b};i.ctrlpts.push(x.x+C.x*p,x.y+C.y*p)}};pt.findTaxiPoints=function(t,e){var r=t._private.rscratch;r.edgeType="segments";var a="vertical",n="horizontal",i="leftward",o="rightward",s="downward",u="upward",l="auto",f=e.posPts,c=e.srcW,v=e.srcH,d=e.tgtW,h=e.tgtH,y=t.pstyle("edge-distances").value,g=y!=="node-position",p=t.pstyle("taxi-direction").value,m=p,b=t.pstyle("taxi-turn"),w=b.units==="%",E=b.pfValue,C=E<0,x=t.pstyle("taxi-turn-min-distance").pfValue,T=g?(c+d)/2:0,k=g?(v+h)/2:0,B=f.x2-f.x1,D=f.y2-f.y1,P=function(_,U){return _>0?Math.max(_-U,0):Math.min(_+U,0)},A=P(B,T),R=P(D,k),L=!1;m===l?p=Math.abs(A)>Math.abs(R)?n:a:m===u||m===s?(p=a,L=!0):(m===i||m===o)&&(p=n,L=!0);var I=p===a,M=I?R:A,O=I?D:B,q=ss(O),$=!1;!(L&&(w||C))&&(m===s&&O<0||m===u&&O>0||m===i&&O>0||m===o&&O<0)&&(q*=-1,M=q*Math.abs(M),$=!0);var N;if(w){var F=E<0?1+E:E;N=F*M}else{var W=E<0?M:0;N=W+E*q}var J=function(_){return Math.abs(_)<x||Math.abs(_)>=Math.abs(M)},Z=J(N),j=J(Math.abs(M)-Math.abs(N)),te=Z||j;if(te&&!$)if(I){var ne=Math.abs(O)<=v/2,Q=Math.abs(B)<=d/2;if(ne){var V=(f.x1+f.x2)/2,H=f.y1,G=f.y2;r.segpts=[V,H,V,G]}else if(Q){var Y=(f.y1+f.y2)/2,re=f.x1,ve=f.x2;r.segpts=[re,Y,ve,Y]}else r.segpts=[f.x1,f.y2]}else{var De=Math.abs(O)<=c/2,we=Math.abs(D)<=h/2;if(De){var me=(f.y1+f.y2)/2,ge=f.x1,oe=f.x2;r.segpts=[ge,me,oe,me]}else if(we){var de=(f.x1+f.x2)/2,ce=f.y1,xe=f.y2;r.segpts=[de,ce,de,xe]}else r.segpts=[f.x2,f.y1]}else if(I){var be=f.y1+N+(g?v/2*q:0),Se=f.x1,Be=f.x2;r.segpts=[Se,be,Be,be]}else{var Oe=f.x1+N+(g?c/2*q:0),Le=f.y1,Ae=f.y2;r.segpts=[Oe,Le,Oe,Ae]}if(r.isRound){var X=t.pstyle("taxi-radius").value,S=t.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(X),r.isArcRadius=new Array(r.segpts.length/2).fill(S)}};pt.tryToCorrectInvalidPoints=function(t,e){var r=t._private.rscratch;if(r.edgeType==="bezier"){var a=e.srcPos,n=e.tgtPos,i=e.srcW,o=e.srcH,s=e.tgtW,u=e.tgtH,l=e.srcShape,f=e.tgtShape,c=e.srcCornerRadius,v=e.tgtCornerRadius,d=e.srcRs,h=e.tgtRs,y=!ae(r.startX)||!ae(r.startY),g=!ae(r.arrowStartX)||!ae(r.arrowStartY),p=!ae(r.endX)||!ae(r.endY),m=!ae(r.arrowEndX)||!ae(r.arrowEndY),b=3,w=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,E=b*w,C=Rr({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),x=C<E,T=Rr({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.endX,y:r.endY}),k=T<E,B=!1;if(y||g||x){B=!0;var D={x:r.ctrlpts[0]-a.x,y:r.ctrlpts[1]-a.y},P=Math.sqrt(D.x*D.x+D.y*D.y),A={x:D.x/P,y:D.y/P},R=Math.max(i,o),L={x:r.ctrlpts[0]+A.x*2*R,y:r.ctrlpts[1]+A.y*2*R},I=l.intersectLine(a.x,a.y,i,o,L.x,L.y,0,c,d);x?(r.ctrlpts[0]=r.ctrlpts[0]+A.x*(E-C),r.ctrlpts[1]=r.ctrlpts[1]+A.y*(E-C)):(r.ctrlpts[0]=I[0]+A.x*E,r.ctrlpts[1]=I[1]+A.y*E)}if(p||m||k){B=!0;var M={x:r.ctrlpts[0]-n.x,y:r.ctrlpts[1]-n.y},O=Math.sqrt(M.x*M.x+M.y*M.y),q={x:M.x/O,y:M.y/O},$=Math.max(i,o),N={x:r.ctrlpts[0]+q.x*2*$,y:r.ctrlpts[1]+q.y*2*$},F=f.intersectLine(n.x,n.y,s,u,N.x,N.y,0,v,h);k?(r.ctrlpts[0]=r.ctrlpts[0]+q.x*(E-T),r.ctrlpts[1]=r.ctrlpts[1]+q.y*(E-T)):(r.ctrlpts[0]=F[0]+q.x*E,r.ctrlpts[1]=F[1]+q.y*E)}B&&this.findEndpoints(t)}};pt.storeAllpts=function(t){var e=t._private.rscratch;if(e.edgeType==="multibezier"||e.edgeType==="bezier"||e.edgeType==="self"||e.edgeType==="compound"){e.allpts=[],e.allpts.push(e.startX,e.startY);for(var r=0;r+1<e.ctrlpts.length;r+=2)e.allpts.push(e.ctrlpts[r],e.ctrlpts[r+1]),r+3<e.ctrlpts.length&&e.allpts.push((e.ctrlpts[r]+e.ctrlpts[r+2])/2,(e.ctrlpts[r+1]+e.ctrlpts[r+3])/2);e.allpts.push(e.endX,e.endY);var a,n;e.ctrlpts.length/2%2===0?(a=e.allpts.length/2-1,e.midX=e.allpts[a],e.midY=e.allpts[a+1]):(a=e.allpts.length/2-3,n=.5,e.midX=it(e.allpts[a],e.allpts[a+2],e.allpts[a+4],n),e.midY=it(e.allpts[a+1],e.allpts[a+3],e.allpts[a+5],n))}else if(e.edgeType==="straight")e.allpts=[e.startX,e.startY,e.endX,e.endY],e.midX=(e.startX+e.endX+e.arrowStartX+e.arrowEndX)/4,e.midY=(e.startY+e.endY+e.arrowStartY+e.arrowEndY)/4;else if(e.edgeType==="segments"){if(e.allpts=[],e.allpts.push(e.startX,e.startY),e.allpts.push.apply(e.allpts,e.segpts),e.allpts.push(e.endX,e.endY),e.isRound){e.roundCorners=[];for(var i=2;i+3<e.allpts.length;i+=2){var o=e.radii[i/2-1],s=e.isArcRadius[i/2-1];e.roundCorners.push(ws({x:e.allpts[i-2],y:e.allpts[i-1]},{x:e.allpts[i],y:e.allpts[i+1],radius:o},{x:e.allpts[i+2],y:e.allpts[i+3]},o,s))}}if(e.segpts.length%4===0){var u=e.segpts.length/2,l=u-2;e.midX=(e.segpts[l]+e.segpts[u])/2,e.midY=(e.segpts[l+1]+e.segpts[u+1])/2}else{var f=e.segpts.length/2-1;if(!e.isRound)e.midX=e.segpts[f],e.midY=e.segpts[f+1];else{var c={x:e.segpts[f],y:e.segpts[f+1]},v=e.roundCorners[f/2];if(v.radius===0){var d={x:e.segpts[f+2],y:e.segpts[f+3]};e.midX=c.x,e.midY=c.y,e.midVector=[c.y-d.y,d.x-c.x]}else{var h=[c.x-v.cx,c.y-v.cy],y=v.radius/Math.sqrt(Math.pow(h[0],2)+Math.pow(h[1],2));h=h.map(function(g){return g*y}),e.midX=v.cx+h[0],e.midY=v.cy+h[1],e.midVector=h}}}}};pt.checkForInvalidEdgeWarning=function(t){var e=t[0]._private.rscratch;e.nodesOverlap||ae(e.startX)&&ae(e.startY)&&ae(e.endX)&&ae(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,ze("Edge `"+t.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))};pt.findEdgeControlPoints=function(t){var e=this;if(!(!t||t.length===0)){for(var r=this,a=r.cy,n=a.hasCompoundNodes(),i=new Xt,o=function(k,B){return[].concat(bn(k),[B?1:0]).join("-")},s=[],u=[],l=0;l<t.length;l++){var f=t[l],c=f._private,v=f.pstyle("curve-style").value;if(!(f.removed()||!f.takesUpSpace())){if(v==="haystack"){u.push(f);continue}var d=v==="unbundled-bezier"||ar(v,"segments")||v==="straight"||v==="straight-triangle"||ar(v,"taxi"),h=v==="unbundled-bezier"||v==="bezier",y=c.source,g=c.target,p=y.poolIndex(),m=g.poolIndex(),b=[p,m].sort(),w=o(b,d),E=i.get(w);E==null&&(E={eles:[]},s.push({pairId:b,edgeIsUnbundled:d}),i.set(w,E)),E.eles.push(f),d&&(E.hasUnbundled=!0),h&&(E.hasBezier=!0)}}for(var C=function(){var k=s[x],B=k.pairId,D=k.edgeIsUnbundled,P=o(B,D),A=i.get(P),R;if(!A.hasUnbundled){var L=A.eles[0].parallelEdges().filter(function(S){return S.isBundledBezier()});is(A.eles),L.forEach(function(S){return A.eles.push(S)}),A.eles.sort(function(S,z){return S.poolIndex()-z.poolIndex()})}var I=A.eles[0],M=I.source(),O=I.target();if(M.poolIndex()>O.poolIndex()){var q=M;M=O,O=q}var $=A.srcPos=M.position(),N=A.tgtPos=O.position(),F=A.srcW=M.outerWidth(),W=A.srcH=M.outerHeight(),J=A.tgtW=O.outerWidth(),Z=A.tgtH=O.outerHeight(),j=A.srcShape=r.nodeShapes[e.getNodeShape(M)],te=A.tgtShape=r.nodeShapes[e.getNodeShape(O)],ne=A.srcCornerRadius=M.pstyle("corner-radius").value==="auto"?"auto":M.pstyle("corner-radius").pfValue,Q=A.tgtCornerRadius=O.pstyle("corner-radius").value==="auto"?"auto":O.pstyle("corner-radius").pfValue,V=A.tgtRs=O._private.rscratch,H=A.srcRs=M._private.rscratch;A.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var G=0;G<A.eles.length;G++){var Y=A.eles[G],re=Y[0]._private.rscratch,ve=Y.pstyle("curve-style").value,De=ve==="unbundled-bezier"||ar(ve,"segments")||ar(ve,"taxi"),we=!M.same(Y.source());if(!A.calculatedIntersection&&M!==O&&(A.hasBezier||A.hasUnbundled)){A.calculatedIntersection=!0;var me=j.intersectLine($.x,$.y,F,W,N.x,N.y,0,ne,H),ge=A.srcIntn=me,oe=te.intersectLine(N.x,N.y,J,Z,$.x,$.y,0,Q,V),de=A.tgtIntn=oe,ce=A.intersectionPts={x1:me[0],x2:oe[0],y1:me[1],y2:oe[1]},xe=A.posPts={x1:$.x,x2:N.x,y1:$.y,y2:N.y},be=oe[1]-me[1],Se=oe[0]-me[0],Be=Math.sqrt(Se*Se+be*be);ae(Be)&&Be>=by||(Be=Math.sqrt(Math.max(Se*Se,La)+Math.max(be*be,La)));var Oe=A.vector={x:Se,y:be},Le=A.vectorNorm={x:Oe.x/Be,y:Oe.y/Be},Ae={x:-Le.y,y:Le.x};A.nodesOverlap=!ae(Be)||te.checkPoint(me[0],me[1],0,J,Z,N.x,N.y,Q,V)||j.checkPoint(oe[0],oe[1],0,F,W,$.x,$.y,ne,H),A.vectorNormInverse=Ae,R={nodesOverlap:A.nodesOverlap,dirCounts:A.dirCounts,calculatedIntersection:!0,hasBezier:A.hasBezier,hasUnbundled:A.hasUnbundled,eles:A.eles,srcPos:N,srcRs:V,tgtPos:$,tgtRs:H,srcW:J,srcH:Z,tgtW:F,tgtH:W,srcIntn:de,tgtIntn:ge,srcShape:te,tgtShape:j,posPts:{x1:xe.x2,y1:xe.y2,x2:xe.x1,y2:xe.y1},intersectionPts:{x1:ce.x2,y1:ce.y2,x2:ce.x1,y2:ce.y1},vector:{x:-Oe.x,y:-Oe.y},vectorNorm:{x:-Le.x,y:-Le.y},vectorNormInverse:{x:-Ae.x,y:-Ae.y}}}var X=we?R:A;re.nodesOverlap=X.nodesOverlap,re.srcIntn=X.srcIntn,re.tgtIntn=X.tgtIntn,re.isRound=ve.startsWith("round"),n&&(M.isParent()||M.isChild()||O.isParent()||O.isChild())&&(M.parents().anySame(O)||O.parents().anySame(M)||M.same(O)&&M.isParent())?e.findCompoundLoopPoints(Y,X,G,De):M===O?e.findLoopPoints(Y,X,G,De):ve.endsWith("segments")?e.findSegmentsPoints(Y,X):ve.endsWith("taxi")?e.findTaxiPoints(Y,X):ve==="straight"||!De&&A.eles.length%2===1&&G===Math.floor(A.eles.length/2)?e.findStraightEdgePoints(Y):e.findBezierPoints(Y,X,G,De,we),e.findEndpoints(Y),e.tryToCorrectInvalidPoints(Y,X),e.checkForInvalidEdgeWarning(Y),e.storeAllpts(Y),e.storeEdgeProjections(Y),e.calculateArrowAngles(Y),e.recalculateEdgeLabelProjections(Y),e.calculateLabelAngles(Y)}},x=0;x<s.length;x++)C();this.findHaystackPoints(u)}};function Bc(t){var e=[];if(t!=null){for(var r=0;r<t.length;r+=2){var a=t[r],n=t[r+1];e.push({x:a,y:n})}return e}}pt.getSegmentPoints=function(t){var e=t[0]._private.rscratch;this.recalculateRenderedStyle(t);var r=e.edgeType;if(r==="segments")return Bc(e.segpts)};pt.getControlPoints=function(t){var e=t[0]._private.rscratch;this.recalculateRenderedStyle(t);var r=e.edgeType;if(r==="bezier"||r==="multibezier"||r==="self"||r==="compound")return Bc(e.ctrlpts)};pt.getEdgeMidpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),{x:e.midX,y:e.midY}};var Ha={};Ha.manualEndptToPx=function(t,e){var r=this,a=t.position(),n=t.outerWidth(),i=t.outerHeight(),o=t._private.rscratch;if(e.value.length===2){var s=[e.pfValue[0],e.pfValue[1]];return e.units[0]==="%"&&(s[0]=s[0]*n),e.units[1]==="%"&&(s[1]=s[1]*i),s[0]+=a.x,s[1]+=a.y,s}else{var u=e.pfValue[0];u=-Math.PI/2+u;var l=2*Math.max(n,i),f=[a.x+Math.cos(u)*l,a.y+Math.sin(u)*l];return r.nodeShapes[this.getNodeShape(t)].intersectLine(a.x,a.y,n,i,f[0],f[1],0,t.pstyle("corner-radius").value==="auto"?"auto":t.pstyle("corner-radius").pfValue,o)}};Ha.findEndpoints=function(t){var e,r,a,n,i=this,o,s=t.source()[0],u=t.target()[0],l=s.position(),f=u.position(),c=t.pstyle("target-arrow-shape").value,v=t.pstyle("source-arrow-shape").value,d=t.pstyle("target-distance-from-node").pfValue,h=t.pstyle("source-distance-from-node").pfValue,y=s._private.rscratch,g=u._private.rscratch,p=t.pstyle("curve-style").value,m=t._private.rscratch,b=m.edgeType,w=ar(p,"taxi"),E=b==="self"||b==="compound",C=b==="bezier"||b==="multibezier"||E,x=b!=="bezier",T=b==="straight"||b==="segments",k=b==="segments",B=C||x||T,D=E||w,P=t.pstyle("source-endpoint"),A=D?"outside-to-node":P.value,R=s.pstyle("corner-radius").value==="auto"?"auto":s.pstyle("corner-radius").pfValue,L=t.pstyle("target-endpoint"),I=D?"outside-to-node":L.value,M=u.pstyle("corner-radius").value==="auto"?"auto":u.pstyle("corner-radius").pfValue;m.srcManEndpt=P,m.tgtManEndpt=L;var O,q,$,N,F=(e=(L==null||(r=L.pfValue)===null||r===void 0?void 0:r.length)===2?L.pfValue:null)!==null&&e!==void 0?e:[0,0],W=(a=(P==null||(n=P.pfValue)===null||n===void 0?void 0:n.length)===2?P.pfValue:null)!==null&&a!==void 0?a:[0,0];if(C){var J=[m.ctrlpts[0],m.ctrlpts[1]],Z=x?[m.ctrlpts[m.ctrlpts.length-2],m.ctrlpts[m.ctrlpts.length-1]]:J;O=Z,q=J}else if(T){var j=k?m.segpts.slice(0,2):[f.x+F[0],f.y+F[1]],te=k?m.segpts.slice(m.segpts.length-2):[l.x+W[0],l.y+W[1]];O=te,q=j}if(I==="inside-to-node")o=[f.x,f.y];else if(L.units)o=this.manualEndptToPx(u,L);else if(I==="outside-to-line")o=m.tgtIntn;else if(I==="outside-to-node"||I==="outside-to-node-or-label"?$=O:(I==="outside-to-line"||I==="outside-to-line-or-label")&&($=[l.x,l.y]),o=i.nodeShapes[this.getNodeShape(u)].intersectLine(f.x,f.y,u.outerWidth(),u.outerHeight(),$[0],$[1],0,M,g),I==="outside-to-node-or-label"||I==="outside-to-line-or-label"){var ne=u._private.rscratch,Q=ne.labelWidth,V=ne.labelHeight,H=ne.labelX,G=ne.labelY,Y=Q/2,re=V/2,ve=u.pstyle("text-valign").value;ve==="top"?G-=re:ve==="bottom"&&(G+=re);var De=u.pstyle("text-halign").value;De==="left"?H-=Y:De==="right"&&(H+=Y);var we=Da($[0],$[1],[H-Y,G-re,H+Y,G-re,H+Y,G+re,H-Y,G+re],f.x,f.y);if(we.length>0){var me=l,ge=Sr(me,Ur(o)),oe=Sr(me,Ur(we)),de=ge;if(oe<ge&&(o=we,de=oe),we.length>2){var ce=Sr(me,{x:we[2],y:we[3]});ce<de&&(o=[we[2],we[3]])}}}var xe=Qa(o,O,i.arrowShapes[c].spacing(t)+d),be=Qa(o,O,i.arrowShapes[c].gap(t)+d);if(m.endX=be[0],m.endY=be[1],m.arrowEndX=xe[0],m.arrowEndY=xe[1],A==="inside-to-node")o=[l.x,l.y];else if(P.units)o=this.manualEndptToPx(s,P);else if(A==="outside-to-line")o=m.srcIntn;else if(A==="outside-to-node"||A==="outside-to-node-or-label"?N=q:(A==="outside-to-line"||A==="outside-to-line-or-label")&&(N=[f.x,f.y]),o=i.nodeShapes[this.getNodeShape(s)].intersectLine(l.x,l.y,s.outerWidth(),s.outerHeight(),N[0],N[1],0,R,y),A==="outside-to-node-or-label"||A==="outside-to-line-or-label"){var Se=s._private.rscratch,Be=Se.labelWidth,Oe=Se.labelHeight,Le=Se.labelX,Ae=Se.labelY,X=Be/2,S=Oe/2,z=s.pstyle("text-valign").value;z==="top"?Ae-=S:z==="bottom"&&(Ae+=S);var _=s.pstyle("text-halign").value;_==="left"?Le-=X:_==="right"&&(Le+=X);var U=Da(N[0],N[1],[Le-X,Ae-S,Le+X,Ae-S,Le+X,Ae+S,Le-X,Ae+S],l.x,l.y);if(U.length>0){var K=f,ue=Sr(K,Ur(o)),ee=Sr(K,Ur(U)),ie=ue;if(ee<ue&&(o=[U[0],U[1]],ie=ee),U.length>2){var se=Sr(K,{x:U[2],y:U[3]});se<ie&&(o=[U[2],U[3]])}}}var pe=Qa(o,q,i.arrowShapes[v].spacing(t)+h),Ee=Qa(o,q,i.arrowShapes[v].gap(t)+h);m.startX=Ee[0],m.startY=Ee[1],m.arrowStartX=pe[0],m.arrowStartY=pe[1],B&&(!ae(m.startX)||!ae(m.startY)||!ae(m.endX)||!ae(m.endY)?m.badLine=!0:m.badLine=!1)};Ha.getSourceEndpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),e.edgeType==="haystack"?{x:e.haystackPts[0],y:e.haystackPts[1]}:{x:e.arrowStartX,y:e.arrowStartY}};Ha.getTargetEndpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),e.edgeType==="haystack"?{x:e.haystackPts[2],y:e.haystackPts[3]}:{x:e.arrowEndX,y:e.arrowEndY}};var xs={};function wy(t,e,r){for(var a=function(l,f,c,v){return it(l,f,c,v)},n=e._private,i=n.rstyle.bezierPts,o=0;o<t.bezierProjPcts.length;o++){var s=t.bezierProjPcts[o];i.push({x:a(r[0],r[2],r[4],s),y:a(r[1],r[3],r[5],s)})}}xs.storeEdgeProjections=function(t){var e=t._private,r=e.rscratch,a=r.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,a==="multibezier"||a==="bezier"||a==="self"||a==="compound"){e.rstyle.bezierPts=[];for(var n=0;n+5<r.allpts.length;n+=4)wy(this,t,r.allpts.slice(n,n+6))}else if(a==="segments")for(var i=e.rstyle.linePts=[],n=0;n+1<r.allpts.length;n+=2)i.push({x:r.allpts[n],y:r.allpts[n+1]});else if(a==="haystack"){var o=r.haystackPts;e.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth};xs.recalculateEdgeProjections=function(t){this.findEdgeControlPoints(t)};var Ht={};Ht.recalculateNodeLabelProjection=function(t){var e=t.pstyle("label").strValue;if(!lr(e)){var r,a,n=t._private,i=t.width(),o=t.height(),s=t.padding(),u=t.position(),l=t.pstyle("text-halign").strValue,f=t.pstyle("text-valign").strValue,c=n.rscratch,v=n.rstyle;switch(l){case"left":r=u.x-i/2-s;break;case"right":r=u.x+i/2+s;break;default:r=u.x}switch(f){case"top":a=u.y-o/2-s;break;case"bottom":a=u.y+o/2+s;break;default:a=u.y}c.labelX=r,c.labelY=a,v.labelX=r,v.labelY=a,this.calculateLabelAngles(t),this.applyLabelDimensions(t)}};var Dc=function(e,r){var a=Math.atan(r/e);return e===0&&a<0&&(a=a*-1),a},Pc=function(e,r){var a=r.x-e.x,n=r.y-e.y;return Dc(a,n)},xy=function(e,r,a,n){var i=Ba(0,n-.001,1),o=Ba(0,n+.001,1),s=Xr(e,r,a,i),u=Xr(e,r,a,o);return Pc(s,u)};Ht.recalculateEdgeLabelProjections=function(t){var e,r=t._private,a=r.rscratch,n=this,i={mid:t.pstyle("label").strValue,source:t.pstyle("source-label").strValue,target:t.pstyle("target-label").strValue};if(i.mid||i.source||i.target){e={x:a.midX,y:a.midY};var o=function(c,v,d){Kt(r.rscratch,c,v,d),Kt(r.rstyle,c,v,d)};o("labelX",null,e.x),o("labelY",null,e.y);var s=Dc(a.midDispX,a.midDispY);o("labelAutoAngle",null,s);var u=function(){if(u.cache)return u.cache;for(var c=[],v=0;v+5<a.allpts.length;v+=4){var d={x:a.allpts[v],y:a.allpts[v+1]},h={x:a.allpts[v+2],y:a.allpts[v+3]},y={x:a.allpts[v+4],y:a.allpts[v+5]};c.push({p0:d,p1:h,p2:y,startDist:0,length:0,segments:[]})}var g=r.rstyle.bezierPts,p=n.bezierProjPcts.length;function m(x,T,k,B,D){var P=Rr(T,k),A=x.segments[x.segments.length-1],R={p0:T,p1:k,t0:B,t1:D,startDist:A?A.startDist+A.length:0,length:P};x.segments.push(R),x.length+=P}for(var b=0;b<c.length;b++){var w=c[b],E=c[b-1];E&&(w.startDist=E.startDist+E.length),m(w,w.p0,g[b*p],0,n.bezierProjPcts[0]);for(var C=0;C<p-1;C++)m(w,g[b*p+C],g[b*p+C+1],n.bezierProjPcts[C],n.bezierProjPcts[C+1]);m(w,g[b*p+p-1],w.p2,n.bezierProjPcts[p-1],1)}return u.cache=c},l=function(c){var v,d=c==="source";if(i[c]){var h=t.pstyle(c+"-text-offset").pfValue;switch(a.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var y=u(),g,p=0,m=0,b=0;b<y.length;b++){for(var w=y[d?b:y.length-1-b],E=0;E<w.segments.length;E++){var C=w.segments[d?E:w.segments.length-1-E],x=b===y.length-1&&E===w.segments.length-1;if(p=m,m+=C.length,m>=h||x){g={cp:w,segment:C};break}}if(g)break}var T=g.cp,k=g.segment,B=(h-p)/k.length,D=k.t1-k.t0,P=d?k.t0+D*B:k.t1-D*B;P=Ba(0,P,1),e=Xr(T.p0,T.p1,T.p2,P),v=xy(T.p0,T.p1,T.p2,P);break}case"straight":case"segments":case"haystack":{for(var A=0,R,L,I,M,O=a.allpts.length,q=0;q+3<O&&(d?(I={x:a.allpts[q],y:a.allpts[q+1]},M={x:a.allpts[q+2],y:a.allpts[q+3]}):(I={x:a.allpts[O-2-q],y:a.allpts[O-1-q]},M={x:a.allpts[O-4-q],y:a.allpts[O-3-q]}),R=Rr(I,M),L=A,A+=R,!(A>=h));q+=2);var $=h-L,N=$/R;N=Ba(0,N,1),e=Hd(I,M,N),v=Pc(I,M);break}}o("labelX",c,e.x),o("labelY",c,e.y),o("labelAutoAngle",c,v)}};l("source"),l("target"),this.applyLabelDimensions(t)}};Ht.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))};Ht.applyPrefixedLabelDimensions=function(t,e){var r=t._private,a=this.getLabelText(t,e),n=Ar(a,t._private.labelDimsKey);if(Et(r.rscratch,"prefixedLabelDimsKey",e)!==n){Kt(r.rscratch,"prefixedLabelDimsKey",e,n);var i=this.calculateLabelDimensions(t,a),o=t.pstyle("line-height").pfValue,s=t.pstyle("text-wrap").strValue,u=Et(r.rscratch,"labelWrapCachedLines",e)||[],l=s!=="wrap"?1:Math.max(u.length,1),f=i.height/l,c=f*o,v=i.width,d=i.height+(l-1)*(o-1)*f;Kt(r.rstyle,"labelWidth",e,v),Kt(r.rscratch,"labelWidth",e,v),Kt(r.rstyle,"labelHeight",e,d),Kt(r.rscratch,"labelHeight",e,d),Kt(r.rscratch,"labelLineHeight",e,c)}};Ht.getLabelText=function(t,e){var r=t._private,a=e?e+"-":"",n=t.pstyle(a+"label").strValue,i=t.pstyle("text-transform").value,o=function(W,J){return J?(Kt(r.rscratch,W,e,J),J):Et(r.rscratch,W,e)};if(!n)return"";i=="none"||(i=="uppercase"?n=n.toUpperCase():i=="lowercase"&&(n=n.toLowerCase()));var s=t.pstyle("text-wrap").value;if(s==="wrap"){var u=o("labelKey");if(u!=null&&o("labelWrapKey")===u)return o("labelWrapCachedText");for(var l="\u200B",f=n.split(`
5
+ `),c=t.pstyle("text-max-width").pfValue,v=t.pstyle("text-overflow-wrap").value,d=v==="anywhere",h=[],y=/[\s\u200b]+|$/g,g=0;g<f.length;g++){var p=f[g],m=this.calculateLabelDimensions(t,p),b=m.width;if(d){var w=p.split("").join(l);p=w}if(b>c){var E=p.matchAll(y),C="",x=0,T=Tt(E),k;try{for(T.s();!(k=T.n()).done;){var B=k.value,D=B[0],P=p.substring(x,B.index);x=B.index+D.length;var A=C.length===0?P:C+P+D,R=this.calculateLabelDimensions(t,A),L=R.width;L<=c?C+=P+D:(C&&h.push(C),C=P+D)}}catch(F){T.e(F)}finally{T.f()}C.match(/^[\s\u200b]+$/)||h.push(C)}else h.push(p)}o("labelWrapCachedLines",h),n=o("labelWrapCachedText",h.join(`
6
+ `)),o("labelWrapKey",u)}else if(s==="ellipsis"){var I=t.pstyle("text-max-width").pfValue,M="",O="\u2026",q=!1;if(this.calculateLabelDimensions(t,n).width<I)return n;for(var $=0;$<n.length;$++){var N=this.calculateLabelDimensions(t,M+n[$]+O).width;if(N>I)break;M+=n[$],$===n.length-1&&(q=!0)}return q||(M+=O),M}return n};Ht.getLabelJustification=function(t){var e=t.pstyle("text-justification").strValue,r=t.pstyle("text-halign").strValue;if(e==="auto")if(t.isNode())switch(r){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e};Ht.calculateLabelDimensions=function(t,e){var r=this,a=r.cy.window(),n=a.document,i=0,o=t.pstyle("font-style").strValue,s=t.pstyle("font-size").pfValue,u=t.pstyle("font-family").strValue,l=t.pstyle("font-weight").strValue,f=this.labelCalcCanvas,c=this.labelCalcCanvasContext;if(!f){f=this.labelCalcCanvas=n.createElement("canvas"),c=this.labelCalcCanvasContext=f.getContext("2d");var v=f.style;v.position="absolute",v.left="-9999px",v.top="-9999px",v.zIndex="-1",v.visibility="hidden",v.pointerEvents="none"}c.font="".concat(o," ").concat(l," ").concat(s,"px ").concat(u);for(var d=0,h=0,y=e.split(`
7
+ `),g=0;g<y.length;g++){var p=y[g],m=c.measureText(p),b=Math.ceil(m.width),w=s;d=Math.max(b,d),h+=w}return d+=i,h+=i,{width:d,height:h}};Ht.calculateLabelAngle=function(t,e){var r=t._private,a=r.rscratch,n=t.isEdge(),i=e?e+"-":"",o=t.pstyle(i+"text-rotation"),s=o.strValue;return s==="none"?0:n&&s==="autorotate"?a.labelAutoAngle:s==="autorotate"?0:o.pfValue};Ht.calculateLabelAngles=function(t){var e=this,r=t.isEdge(),a=t._private,n=a.rscratch;n.labelAngle=e.calculateLabelAngle(t),r&&(n.sourceLabelAngle=e.calculateLabelAngle(t,"source"),n.targetLabelAngle=e.calculateLabelAngle(t,"target"))};var Ac={},Hu=28,Gu=!1;Ac.getNodeShape=function(t){var e=this,r=t.pstyle("shape").value;if(r==="cutrectangle"&&(t.width()<Hu||t.height()<Hu))return Gu||(ze("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),Gu=!0),"rectangle";if(t.isParent())return r==="rectangle"||r==="roundrectangle"||r==="round-rectangle"||r==="cutrectangle"||r==="cut-rectangle"||r==="barrel"?r:"rectangle";if(r==="polygon"){var a=t.pstyle("shape-polygon-points").value;return e.nodeShapes.makePolygon(a).name}return r};var Yn={};Yn.registerCalculationListeners=function(){var t=this.cy,e=t.collection(),r=this,a=function(o){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(o),s)for(var u=0;u<o.length;u++){var l=o[u],f=l._private,c=f.rstyle;c.clean=!1,c.cleanConnected=!1}};r.binder(t).on("bounds.* dirty.*",function(o){var s=o.target;a(s)}).on("style.* background.*",function(o){var s=o.target;a(s,!1)});var n=function(o){if(o){var s=r.onUpdateEleCalcsFns;e.cleanStyle();for(var u=0;u<e.length;u++){var l=e[u],f=l._private.rstyle;l.isNode()&&!f.cleanConnected&&(a(l.connectedEdges()),f.cleanConnected=!0)}if(s)for(var c=0;c<s.length;c++){var v=s[c];v(o,e)}r.recalculateRenderedStyle(e),e=t.collection()}};r.flushRenderedStyleQueue=function(){n(!0)},r.beforeRender(n,r.beforeRenderPriorities.eleCalcs)};Yn.onUpdateEleCalcs=function(t){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(t)};Yn.recalculateRenderedStyle=function(t,e){var r=function(w){return w._private.rstyle.cleanConnected};if(t.length!==0){var a=[],n=[];if(!this.destroyed){e===void 0&&(e=!0);for(var i=0;i<t.length;i++){var o=t[i],s=o._private,u=s.rstyle;o.isEdge()&&(!r(o.source())||!r(o.target()))&&(u.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(b){return!b._private.rstyle.clean&&b.isBundledBezier()})&&(u.clean=!1),!(e&&u.clean||o.removed())&&o.pstyle("display").value!=="none"&&(s.group==="nodes"?n.push(o):a.push(o),u.clean=!0)}for(var l=0;l<n.length;l++){var f=n[l],c=f._private,v=c.rstyle,d=f.position();this.recalculateNodeLabelProjection(f),v.nodeX=d.x,v.nodeY=d.y,v.nodeW=f.pstyle("width").pfValue,v.nodeH=f.pstyle("height").pfValue}this.recalculateEdgeProjections(a);for(var h=0;h<a.length;h++){var y=a[h],g=y._private,p=g.rstyle,m=g.rscratch;p.srcX=m.arrowStartX,p.srcY=m.arrowStartY,p.tgtX=m.arrowEndX,p.tgtY=m.arrowEndY,p.midX=m.midX,p.midY=m.midY,p.labelAngle=m.labelAngle,p.sourceLabelAngle=m.sourceLabelAngle,p.targetLabelAngle=m.targetLabelAngle}}}};var Zn={};Zn.updateCachedGrabbedEles=function(){var t=this.cachedZSortedEles;if(t){t.drag=[],t.nondrag=[];for(var e=[],r=0;r<t.length;r++){var a=t[r],n=a._private.rscratch;a.grabbed()&&!a.isParent()?e.push(a):n.inDragLayer?t.drag.push(a):t.nondrag.push(a)}for(var r=0;r<e.length;r++){var a=e[r];t.drag.push(a)}}};Zn.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};Zn.getCachedZSortedEles=function(t){if(t||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(cc),e.interactive=e.filter(function(r){return r.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var Rc={};[Or,Pn,pt,Ha,xs,Ht,Ac,Yn,Zn].forEach(function(t){ye(Rc,t)});var Mc={};Mc.getCachedImage=function(t,e,r){var a=this,n=a.imageCache=a.imageCache||{},i=n[t];if(i)return i.image.complete||i.image.addEventListener("load",r),i.image;i=n[t]=n[t]||{};var o=i.image=new Image;o.addEventListener("load",r),o.addEventListener("error",function(){o.error=!0});var s="data:",u=t.substring(0,s.length).toLowerCase()===s;return u||(e=e==="null"?null:e,o.crossOrigin=e),o.src=t,o};var Lc=function(e,r){var a=e[0];!a||a._private.grabbed===r||(a._private.grabbed=r,e.updateStyle(!1))},Ey=function(e){Lc(e,!0)},Cy=function(e){Lc(e,!1)},ia={};ia.registerBinding=function(t,e,r,a){var n=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(t)){for(var i=[],o=0;o<t.length;o++){var s=t[o];if(s!==void 0){var u=this.binder(s);i.push(u.on.apply(u,n))}}return i}var u=this.binder(t);return u.on.apply(u,n)};ia.binder=function(t){var e=this,r=e.cy.window(),a=t===r||t===r.document||t===r.document.body||Lv(t);if(e.supportsPassiveEvents==null){var n=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return n=!0,!0}});r.addEventListener("test",null,i)}catch{}e.supportsPassiveEvents=n}var o=function(u,l,f){var c=Array.prototype.slice.call(arguments);return a&&e.supportsPassiveEvents&&(c[2]={capture:f??!1,passive:!1,once:!1}),e.bindings.push({target:t,args:c}),(t.addEventListener||t.on).apply(t,c),this};return{on:o,addEventListener:o,addListener:o,bind:o}};ia.nodeIsDraggable=function(t){return t&&t.isNode()&&!t.locked()&&t.grabbable()};ia.nodeIsGrabbable=function(t){return this.nodeIsDraggable(t)&&t.interactive()};ia.load=function(){var t=this,e=t.cy.window(),r=function(S){return S.selected()},a=function(S){var z=S.getRootNode();if(z&&z.nodeType===11&&z.host!==void 0)return z},n=function(S,z,_,U){S==null&&(S=t.cy);for(var K=0;K<z.length;K++){var ue=z[K];S.emit({originalEvent:_,type:ue,position:U})}},i=function(S){return S.shiftKey||S.metaKey||S.ctrlKey},o=function(S,z){var _=!0;if(t.cy.hasCompoundNodes()&&S&&S.pannable())for(var U=0;z&&U<z.length;U++){var S=z[U];if(S.isNode()&&S.isParent()&&!S.pannable()){_=!1;break}}else _=!0;return _},s=function(S){S[0]._private.rscratch.inDragLayer=!0},u=function(S){S[0]._private.rscratch.inDragLayer=!1},l=function(S){S[0]._private.rscratch.isGrabTarget=!0},f=function(S){S[0]._private.rscratch.isGrabTarget=!1},c=function(S,z){var _=z.addToList,U=_.has(S);!U&&S.grabbable()&&!S.locked()&&(_.merge(S),Ey(S))},v=function(S,z){if(S.cy().hasCompoundNodes()&&!(z.inDragLayer==null&&z.addToList==null)){var _=S.descendants();z.inDragLayer&&(_.forEach(s),_.connectedEdges().forEach(s)),z.addToList&&c(_,z)}},d=function(S,z){z=z||{};var _=S.cy().hasCompoundNodes();z.inDragLayer&&(S.forEach(s),S.neighborhood().stdFilter(function(U){return!_||U.isEdge()}).forEach(s)),z.addToList&&S.forEach(function(U){c(U,z)}),v(S,z),g(S,{inDragLayer:z.inDragLayer}),t.updateCachedGrabbedEles()},h=d,y=function(S){S&&(t.getCachedZSortedEles().forEach(function(z){Cy(z),u(z),f(z)}),t.updateCachedGrabbedEles())},g=function(S,z){if(!(z.inDragLayer==null&&z.addToList==null)&&S.cy().hasCompoundNodes()){var _=S.ancestors().orphans();if(!_.same(S)){var U=_.descendants().spawnSelf().merge(_).unmerge(S).unmerge(S.descendants()),K=U.connectedEdges();z.inDragLayer&&(K.forEach(s),U.forEach(s)),z.addToList&&U.forEach(function(ue){c(ue,z)})}}},p=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},m=typeof MutationObserver<"u",b=typeof ResizeObserver<"u";m?(t.removeObserver=new MutationObserver(function(X){for(var S=0;S<X.length;S++){var z=X[S],_=z.removedNodes;if(_)for(var U=0;U<_.length;U++){var K=_[U];if(K===t.container){t.destroy();break}}}}),t.container.parentNode&&t.removeObserver.observe(t.container.parentNode,{childList:!0})):t.registerBinding(t.container,"DOMNodeRemoved",function(X){t.destroy()});var w=Va(function(){t.cy.resize()},100);m&&(t.styleObserver=new MutationObserver(w),t.styleObserver.observe(t.container,{attributes:!0})),t.registerBinding(e,"resize",w),b&&(t.resizeObserver=new ResizeObserver(w),t.resizeObserver.observe(t.container));var E=function(S,z){for(;S!=null;)z(S),S=S.parentNode},C=function(){t.invalidateContainerClientCoordsCache()};E(t.container,function(X){t.registerBinding(X,"transitionend",C),t.registerBinding(X,"animationend",C),t.registerBinding(X,"scroll",C)}),t.registerBinding(t.container,"contextmenu",function(X){X.preventDefault()});var x=function(){return t.selection[4]!==0},T=function(S){for(var z=t.findContainerClientCoords(),_=z[0],U=z[1],K=z[2],ue=z[3],ee=S.touches?S.touches:[S],ie=!1,se=0;se<ee.length;se++){var pe=ee[se];if(_<=pe.clientX&&pe.clientX<=_+K&&U<=pe.clientY&&pe.clientY<=U+ue){ie=!0;break}}if(!ie)return!1;for(var Ee=t.container,Ce=S.target,fe=Ce.parentNode,ke=!1;fe;){if(fe===Ee){ke=!0;break}fe=fe.parentNode}return!!ke};t.registerBinding(t.container,"mousedown",function(S){if(T(S)&&!(t.hoverData.which===1&&S.which!==1)){S.preventDefault(),p(),t.hoverData.capture=!0,t.hoverData.which=S.which;var z=t.cy,_=[S.clientX,S.clientY],U=t.projectIntoViewport(_[0],_[1]),K=t.selection,ue=t.findNearestElements(U[0],U[1],!0,!1),ee=ue[0],ie=t.dragData.possibleDragElements;t.hoverData.mdownPos=U,t.hoverData.mdownGPos=_;var se=function(Pe){return{originalEvent:S,type:Pe,position:{x:U[0],y:U[1]}}},pe=function(){t.hoverData.tapholdCancelled=!1,clearTimeout(t.hoverData.tapholdTimeout),t.hoverData.tapholdTimeout=setTimeout(function(){if(!t.hoverData.tapholdCancelled){var Pe=t.hoverData.down;Pe?Pe.emit(se("taphold")):z.emit(se("taphold"))}},t.tapholdDuration)};if(S.which==3){t.hoverData.cxtStarted=!0;var Ee={originalEvent:S,type:"cxttapstart",position:{x:U[0],y:U[1]}};ee?(ee.activate(),ee.emit(Ee),t.hoverData.down=ee):z.emit(Ee),t.hoverData.downTime=new Date().getTime(),t.hoverData.cxtDragged=!1}else if(S.which==1){ee&&ee.activate();{if(ee!=null&&t.nodeIsGrabbable(ee)){var Ce=function(Pe){Pe.emit(se("grab"))};if(l(ee),!ee.selected())ie=t.dragData.possibleDragElements=z.collection(),h(ee,{addToList:ie}),ee.emit(se("grabon")).emit(se("grab"));else{ie=t.dragData.possibleDragElements=z.collection();var fe=z.$(function(ke){return ke.isNode()&&ke.selected()&&t.nodeIsGrabbable(ke)});d(fe,{addToList:ie}),ee.emit(se("grabon")),fe.forEach(Ce)}t.redrawHint("eles",!0),t.redrawHint("drag",!0)}t.hoverData.down=ee,t.hoverData.downs=ue,t.hoverData.downTime=new Date().getTime()}n(ee,["mousedown","tapstart","vmousedown"],S,{x:U[0],y:U[1]}),ee==null?(K[4]=1,t.data.bgActivePosistion={x:U[0],y:U[1]},t.redrawHint("select",!0),t.redraw()):ee.pannable()&&(K[4]=1),pe()}K[0]=K[2]=U[0],K[1]=K[3]=U[1]}},!1);var k=a(t.container);t.registerBinding([e,k],"mousemove",function(S){var z=t.hoverData.capture;if(!(!z&&!T(S))){var _=!1,U=t.cy,K=U.zoom(),ue=[S.clientX,S.clientY],ee=t.projectIntoViewport(ue[0],ue[1]),ie=t.hoverData.mdownPos,se=t.hoverData.mdownGPos,pe=t.selection,Ee=null;!t.hoverData.draggingEles&&!t.hoverData.dragging&&!t.hoverData.selecting&&(Ee=t.findNearestElement(ee[0],ee[1],!0,!1));var Ce=t.hoverData.last,fe=t.hoverData.down,ke=[ee[0]-pe[2],ee[1]-pe[3]],Pe=t.dragData.possibleDragElements,nt;if(se){var Ke=ue[0]-se[0],At=Ke*Ke,Xe=ue[1]-se[1],Ze=Xe*Xe,je=At+Ze;t.hoverData.isOverThresholdDrag=nt=je>=t.desktopTapThreshold2}var lt=i(S);nt&&(t.hoverData.tapholdCancelled=!0);var zt=function(){var kt=t.hoverData.dragDelta=t.hoverData.dragDelta||[];kt.length===0?(kt.push(ke[0]),kt.push(ke[1])):(kt[0]+=ke[0],kt[1]+=ke[1])};_=!0,n(Ee,["mousemove","vmousemove","tapdrag"],S,{x:ee[0],y:ee[1]});var Ue=function(kt){return{originalEvent:S,type:kt,position:{x:ee[0],y:ee[1]}}},Ut=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||U.emit(Ue("boxstart")),pe[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(nt){var Rt=Ue("cxtdrag");fe?fe.emit(Rt):U.emit(Rt),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||Ee!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit(Ue("cxtdragout")),t.hoverData.cxtOver=Ee,Ee&&Ee.emit(Ue("cxtdragover")))}}else if(t.hoverData.dragging){if(_=!0,U.panningEnabled()&&U.userPanningEnabled()){var jt;if(t.hoverData.justStartedPan){var Wa=t.hoverData.mdownPos;jt={x:(ee[0]-Wa[0])*K,y:(ee[1]-Wa[1])*K},t.hoverData.justStartedPan=!1}else jt={x:ke[0]*K,y:ke[1]*K};U.panBy(jt),U.emit(Ue("dragpan")),t.hoverData.dragged=!0}ee=t.projectIntoViewport(S.clientX,S.clientY)}else if(pe[4]==1&&(fe==null||fe.pannable())){if(nt){if(!t.hoverData.dragging&&U.boxSelectionEnabled()&&(lt||!U.panningEnabled()||!U.userPanningEnabled()))Ut();else if(!t.hoverData.selecting&&U.panningEnabled()&&U.userPanningEnabled()){var xr=o(fe,t.hoverData.downs);xr&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,pe[4]=0,t.data.bgActivePosistion=Ur(ie),t.redrawHint("select",!0),t.redraw())}fe&&fe.pannable()&&fe.active()&&fe.unactivate()}}else{if(fe&&fe.pannable()&&fe.active()&&fe.unactivate(),(!fe||!fe.grabbed())&&Ee!=Ce&&(Ce&&n(Ce,["mouseout","tapdragout"],S,{x:ee[0],y:ee[1]}),Ee&&n(Ee,["mouseover","tapdragover"],S,{x:ee[0],y:ee[1]}),t.hoverData.last=Ee),fe)if(nt){if(U.boxSelectionEnabled()&&lt)fe&&fe.grabbed()&&(y(Pe),fe.emit(Ue("freeon")),Pe.emit(Ue("free")),t.dragData.didDrag&&(fe.emit(Ue("dragfreeon")),Pe.emit(Ue("dragfree")))),Ut();else if(fe&&fe.grabbed()&&t.nodeIsDraggable(fe)){var wt=!t.dragData.didDrag;wt&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||d(Pe,{inDragLayer:!0});var dt={x:0,y:0};if(ae(ke[0])&&ae(ke[1])&&(dt.x+=ke[0],dt.y+=ke[1],wt)){var xt=t.hoverData.dragDelta;xt&&ae(xt[0])&&ae(xt[1])&&(dt.x+=xt[0],dt.y+=xt[1])}t.hoverData.draggingEles=!0,Pe.silentShift(dt).emit(Ue("position")).emit(Ue("drag")),t.redrawHint("drag",!0),t.redraw()}}else zt();_=!0}if(pe[2]=ee[0],pe[3]=ee[1],_)return S.stopPropagation&&S.stopPropagation(),S.preventDefault&&S.preventDefault(),!1}},!1);var B,D,P;t.registerBinding(e,"mouseup",function(S){if(!(t.hoverData.which===1&&S.which!==1&&t.hoverData.capture)){var z=t.hoverData.capture;if(z){t.hoverData.capture=!1;var _=t.cy,U=t.projectIntoViewport(S.clientX,S.clientY),K=t.selection,ue=t.findNearestElement(U[0],U[1],!0,!1),ee=t.dragData.possibleDragElements,ie=t.hoverData.down,se=i(S);t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,ie&&ie.unactivate();var pe=function(Ke){return{originalEvent:S,type:Ke,position:{x:U[0],y:U[1]}}};if(t.hoverData.which===3){var Ee=pe("cxttapend");if(ie?ie.emit(Ee):_.emit(Ee),!t.hoverData.cxtDragged){var Ce=pe("cxttap");ie?ie.emit(Ce):_.emit(Ce)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(n(ue,["mouseup","tapend","vmouseup"],S,{x:U[0],y:U[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(n(ie,["click","tap","vclick"],S,{x:U[0],y:U[1]}),D=!1,S.timeStamp-P<=_.multiClickDebounceTime()?(B&&clearTimeout(B),D=!0,P=null,n(ie,["dblclick","dbltap","vdblclick"],S,{x:U[0],y:U[1]})):(B=setTimeout(function(){D||n(ie,["oneclick","onetap","voneclick"],S,{x:U[0],y:U[1]})},_.multiClickDebounceTime()),P=S.timeStamp)),ie==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!i(S)&&(_.$(r).unselect(["tapunselect"]),ee.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=ee=_.collection()),ue==ie&&!t.dragData.didDrag&&!t.hoverData.selecting&&ue!=null&&ue._private.selectable&&(t.hoverData.dragging||(_.selectionType()==="additive"||se?ue.selected()?ue.unselect(["tapunselect"]):ue.select(["tapselect"]):se||(_.$(r).unmerge(ue).unselect(["tapunselect"]),ue.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var fe=_.collection(t.getAllInBox(K[0],K[1],K[2],K[3]));t.redrawHint("select",!0),fe.length>0&&t.redrawHint("eles",!0),_.emit(pe("boxend"));var ke=function(Ke){return Ke.selectable()&&!Ke.selected()};_.selectionType()==="additive"||se||_.$(r).unmerge(fe).unselect(),fe.emit(pe("box")).stdFilter(ke).select().emit(pe("boxselect")),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!K[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var Pe=ie&&ie.grabbed();y(ee),Pe&&(ie.emit(pe("freeon")),ee.emit(pe("free")),t.dragData.didDrag&&(ie.emit(pe("dragfreeon")),ee.emit(pe("dragfree"))))}}K[4]=0,t.hoverData.down=null,t.hoverData.cxtStarted=!1,t.hoverData.draggingEles=!1,t.hoverData.selecting=!1,t.hoverData.isOverThresholdDrag=!1,t.dragData.didDrag=!1,t.hoverData.dragged=!1,t.hoverData.dragDelta=[],t.hoverData.mdownPos=null,t.hoverData.mdownGPos=null,t.hoverData.which=null}}},!1);var A=[],R=4,L,I=1e5,M=function(S,z){for(var _=0;_<S.length;_++)if(S[_]%z!==0)return!1;return!0},O=function(S){for(var z=Math.abs(S[0]),_=1;_<S.length;_++)if(Math.abs(S[_])!==z)return!1;return!0},q=function(S){var z=!1,_=S.deltaY;if(_==null&&(S.wheelDeltaY!=null?_=S.wheelDeltaY/4:S.wheelDelta!=null&&(_=S.wheelDelta/4)),_!==0){if(L==null)if(A.length>=R){var U=A;if(L=M(U,5),!L){var K=Math.abs(U[0]);L=O(U)&&K>5}if(L)for(var ue=0;ue<U.length;ue++)I=Math.min(Math.abs(U[ue]),I)}else A.push(_),z=!0;else L&&(I=Math.min(Math.abs(_),I));if(!t.scrollingPage){var ee=t.cy,ie=ee.zoom(),se=ee.pan(),pe=t.projectIntoViewport(S.clientX,S.clientY),Ee=[pe[0]*ie+se.x,pe[1]*ie+se.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||x()){S.preventDefault();return}if(ee.panningEnabled()&&ee.userPanningEnabled()&&ee.zoomingEnabled()&&ee.userZoomingEnabled()){S.preventDefault(),t.data.wheelZooming=!0,clearTimeout(t.data.wheelTimeout),t.data.wheelTimeout=setTimeout(function(){t.data.wheelZooming=!1,t.redrawHint("eles",!0),t.redraw()},150);var Ce;z&&Math.abs(_)>5&&(_=ss(_)*5),Ce=_/-250,L&&(Ce/=I,Ce*=3),Ce=Ce*t.wheelSensitivity;var fe=S.deltaMode===1;fe&&(Ce*=33);var ke=ee.zoom()*Math.pow(10,Ce);S.type==="gesturechange"&&(ke=t.gestureStartZoom*S.scale),ee.zoom({level:ke,renderedPosition:{x:Ee[0],y:Ee[1]}}),ee.emit({type:S.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:S,position:{x:pe[0],y:pe[1]}})}}}};t.registerBinding(t.container,"wheel",q,!0),t.registerBinding(e,"scroll",function(S){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(S){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||S.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(X){t.hasTouchStarted||q(X)},!0),t.registerBinding(t.container,"mouseout",function(S){var z=t.projectIntoViewport(S.clientX,S.clientY);t.cy.emit({originalEvent:S,type:"mouseout",position:{x:z[0],y:z[1]}})},!1),t.registerBinding(t.container,"mouseover",function(S){var z=t.projectIntoViewport(S.clientX,S.clientY);t.cy.emit({originalEvent:S,type:"mouseover",position:{x:z[0],y:z[1]}})},!1);var $,N,F,W,J,Z,j,te,ne,Q,V,H,G,Y=function(S,z,_,U){return Math.sqrt((_-S)*(_-S)+(U-z)*(U-z))},re=function(S,z,_,U){return(_-S)*(_-S)+(U-z)*(U-z)},ve;t.registerBinding(t.container,"touchstart",ve=function(S){if(t.hasTouchStarted=!0,!!T(S)){p(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var z=t.cy,_=t.touchData.now,U=t.touchData.earlier;if(S.touches[0]){var K=t.projectIntoViewport(S.touches[0].clientX,S.touches[0].clientY);_[0]=K[0],_[1]=K[1]}if(S.touches[1]){var K=t.projectIntoViewport(S.touches[1].clientX,S.touches[1].clientY);_[2]=K[0],_[3]=K[1]}if(S.touches[2]){var K=t.projectIntoViewport(S.touches[2].clientX,S.touches[2].clientY);_[4]=K[0],_[5]=K[1]}var ue=function(lt){return{originalEvent:S,type:lt,position:{x:_[0],y:_[1]}}};if(S.touches[1]){t.touchData.singleTouchMoved=!0,y(t.dragData.touchDragEles);var ee=t.findContainerClientCoords();ne=ee[0],Q=ee[1],V=ee[2],H=ee[3],$=S.touches[0].clientX-ne,N=S.touches[0].clientY-Q,F=S.touches[1].clientX-ne,W=S.touches[1].clientY-Q,G=0<=$&&$<=V&&0<=F&&F<=V&&0<=N&&N<=H&&0<=W&&W<=H;var ie=z.pan(),se=z.zoom();J=Y($,N,F,W),Z=re($,N,F,W),j=[($+F)/2,(N+W)/2],te=[(j[0]-ie.x)/se,(j[1]-ie.y)/se];var pe=200,Ee=pe*pe;if(Z<Ee&&!S.touches[2]){var Ce=t.findNearestElement(_[0],_[1],!0,!0),fe=t.findNearestElement(_[2],_[3],!0,!0);Ce&&Ce.isNode()?(Ce.activate().emit(ue("cxttapstart")),t.touchData.start=Ce):fe&&fe.isNode()?(fe.activate().emit(ue("cxttapstart")),t.touchData.start=fe):z.emit(ue("cxttapstart")),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!0,t.touchData.cxtDragged=!1,t.data.bgActivePosistion=void 0,t.redraw();return}}if(S.touches[2])z.boxSelectionEnabled()&&S.preventDefault();else if(!S.touches[1]){if(S.touches[0]){var ke=t.findNearestElements(_[0],_[1],!0,!0),Pe=ke[0];if(Pe!=null&&(Pe.activate(),t.touchData.start=Pe,t.touchData.starts=ke,t.nodeIsGrabbable(Pe))){var nt=t.dragData.touchDragEles=z.collection(),Ke=null;t.redrawHint("eles",!0),t.redrawHint("drag",!0),Pe.selected()?(Ke=z.$(function(je){return je.selected()&&t.nodeIsGrabbable(je)}),d(Ke,{addToList:nt})):h(Pe,{addToList:nt}),l(Pe),Pe.emit(ue("grabon")),Ke?Ke.forEach(function(je){je.emit(ue("grab"))}):Pe.emit(ue("grab"))}n(Pe,["touchstart","tapstart","vmousedown"],S,{x:_[0],y:_[1]}),Pe==null&&(t.data.bgActivePosistion={x:K[0],y:K[1]},t.redrawHint("select",!0),t.redraw()),t.touchData.singleTouchMoved=!1,t.touchData.singleTouchStartTime=+new Date,clearTimeout(t.touchData.tapholdTimeout),t.touchData.tapholdTimeout=setTimeout(function(){t.touchData.singleTouchMoved===!1&&!t.pinching&&!t.touchData.selecting&&n(t.touchData.start,["taphold"],S,{x:_[0],y:_[1]})},t.tapholdDuration)}}if(S.touches.length>=1){for(var At=t.touchData.startPosition=[null,null,null,null,null,null],Xe=0;Xe<_.length;Xe++)At[Xe]=U[Xe]=_[Xe];var Ze=S.touches[0];t.touchData.startGPosition=[Ze.clientX,Ze.clientY]}}},!1);var De;t.registerBinding(e,"touchmove",De=function(S){var z=t.touchData.capture;if(!(!z&&!T(S))){var _=t.selection,U=t.cy,K=t.touchData.now,ue=t.touchData.earlier,ee=U.zoom();if(S.touches[0]){var ie=t.projectIntoViewport(S.touches[0].clientX,S.touches[0].clientY);K[0]=ie[0],K[1]=ie[1]}if(S.touches[1]){var ie=t.projectIntoViewport(S.touches[1].clientX,S.touches[1].clientY);K[2]=ie[0],K[3]=ie[1]}if(S.touches[2]){var ie=t.projectIntoViewport(S.touches[2].clientX,S.touches[2].clientY);K[4]=ie[0],K[5]=ie[1]}var se=function(mv){return{originalEvent:S,type:mv,position:{x:K[0],y:K[1]}}},pe=t.touchData.startGPosition,Ee;if(z&&S.touches[0]&&pe){for(var Ce=[],fe=0;fe<K.length;fe++)Ce[fe]=K[fe]-ue[fe];var ke=S.touches[0].clientX-pe[0],Pe=ke*ke,nt=S.touches[0].clientY-pe[1],Ke=nt*nt,At=Pe+Ke;Ee=At>=t.touchTapThreshold2}if(z&&t.touchData.cxt){S.preventDefault();var Xe=S.touches[0].clientX-ne,Ze=S.touches[0].clientY-Q,je=S.touches[1].clientX-ne,lt=S.touches[1].clientY-Q,zt=re(Xe,Ze,je,lt),Ue=zt/Z,Ut=150,Rt=Ut*Ut,jt=1.5,Wa=jt*jt;if(Ue>=Wa||zt>=Rt){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var xr=se("cxttapend");t.touchData.start?(t.touchData.start.unactivate().emit(xr),t.touchData.start=null):U.emit(xr)}}if(z&&t.touchData.cxt){var xr=se("cxtdrag");t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(xr):U.emit(xr),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var wt=t.findNearestElement(K[0],K[1],!0,!0);(!t.touchData.cxtOver||wt!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit(se("cxtdragout")),t.touchData.cxtOver=wt,wt&&wt.emit(se("cxtdragover")))}else if(z&&S.touches[2]&&U.boxSelectionEnabled())S.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||U.emit(se("boxstart")),t.touchData.selecting=!0,t.touchData.didSelect=!0,_[4]=1,!_||_.length===0||_[0]===void 0?(_[0]=(K[0]+K[2]+K[4])/3,_[1]=(K[1]+K[3]+K[5])/3,_[2]=(K[0]+K[2]+K[4])/3+1,_[3]=(K[1]+K[3]+K[5])/3+1):(_[2]=(K[0]+K[2]+K[4])/3,_[3]=(K[1]+K[3]+K[5])/3),t.redrawHint("select",!0),t.redraw();else if(z&&S.touches[1]&&!t.touchData.didSelect&&U.zoomingEnabled()&&U.panningEnabled()&&U.userZoomingEnabled()&&U.userPanningEnabled()){S.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var dt=t.dragData.touchDragEles;if(dt){t.redrawHint("drag",!0);for(var xt=0;xt<dt.length;xt++){var la=dt[xt]._private;la.grabbed=!1,la.rscratch.inDragLayer=!1}}var kt=t.touchData.start,Xe=S.touches[0].clientX-ne,Ze=S.touches[0].clientY-Q,je=S.touches[1].clientX-ne,lt=S.touches[1].clientY-Q,As=Y(Xe,Ze,je,lt),uv=As/J;if(G){var fv=Xe-$,cv=Ze-N,vv=je-F,dv=lt-W,hv=(fv+vv)/2,gv=(cv+dv)/2,ua=U.zoom(),ei=ua*uv,Ka=U.pan(),Rs=te[0]*ua+Ka.x,Ms=te[1]*ua+Ka.y,pv={x:-ei/ua*(Rs-Ka.x-hv)+Rs,y:-ei/ua*(Ms-Ka.y-gv)+Ms};if(kt&&kt.active()){var dt=t.dragData.touchDragEles;y(dt),t.redrawHint("drag",!0),t.redrawHint("eles",!0),kt.unactivate().emit(se("freeon")),dt.emit(se("free")),t.dragData.didDrag&&(kt.emit(se("dragfreeon")),dt.emit(se("dragfree")))}U.viewport({zoom:ei,pan:pv,cancelOnFailedZoom:!0}),U.emit(se("pinchzoom")),J=As,$=Xe,N=Ze,F=je,W=lt,t.pinching=!0}if(S.touches[0]){var ie=t.projectIntoViewport(S.touches[0].clientX,S.touches[0].clientY);K[0]=ie[0],K[1]=ie[1]}if(S.touches[1]){var ie=t.projectIntoViewport(S.touches[1].clientX,S.touches[1].clientY);K[2]=ie[0],K[3]=ie[1]}if(S.touches[2]){var ie=t.projectIntoViewport(S.touches[2].clientX,S.touches[2].clientY);K[4]=ie[0],K[5]=ie[1]}}else if(S.touches[0]&&!t.touchData.didSelect){var Mt=t.touchData.start,ti=t.touchData.last,wt;if(!t.hoverData.draggingEles&&!t.swipePanning&&(wt=t.findNearestElement(K[0],K[1],!0,!0)),z&&Mt!=null&&S.preventDefault(),z&&Mt!=null&&t.nodeIsDraggable(Mt))if(Ee){var dt=t.dragData.touchDragEles,Ls=!t.dragData.didDrag;Ls&&d(dt,{inDragLayer:!0}),t.dragData.didDrag=!0;var fa={x:0,y:0};if(ae(Ce[0])&&ae(Ce[1])&&(fa.x+=Ce[0],fa.y+=Ce[1],Ls)){t.redrawHint("eles",!0);var Lt=t.touchData.dragDelta;Lt&&ae(Lt[0])&&ae(Lt[1])&&(fa.x+=Lt[0],fa.y+=Lt[1])}t.hoverData.draggingEles=!0,dt.silentShift(fa).emit(se("position")).emit(se("drag")),t.redrawHint("drag",!0),t.touchData.startPosition[0]==ue[0]&&t.touchData.startPosition[1]==ue[1]&&t.redrawHint("eles",!0),t.redraw()}else{var Lt=t.touchData.dragDelta=t.touchData.dragDelta||[];Lt.length===0?(Lt.push(Ce[0]),Lt.push(Ce[1])):(Lt[0]+=Ce[0],Lt[1]+=Ce[1])}if(n(Mt||wt,["touchmove","tapdrag","vmousemove"],S,{x:K[0],y:K[1]}),(!Mt||!Mt.grabbed())&&wt!=ti&&(ti&&ti.emit(se("tapdragout")),wt&&wt.emit(se("tapdragover"))),t.touchData.last=wt,z)for(var xt=0;xt<K.length;xt++)K[xt]&&t.touchData.startPosition[xt]&&Ee&&(t.touchData.singleTouchMoved=!0);if(z&&(Mt==null||Mt.pannable())&&U.panningEnabled()&&U.userPanningEnabled()){var yv=o(Mt,t.touchData.starts);yv&&(S.preventDefault(),t.data.bgActivePosistion||(t.data.bgActivePosistion=Ur(t.touchData.startPosition)),t.swipePanning?(U.panBy({x:Ce[0]*ee,y:Ce[1]*ee}),U.emit(se("dragpan"))):Ee&&(t.swipePanning=!0,U.panBy({x:ke*ee,y:nt*ee}),U.emit(se("dragpan")),Mt&&(Mt.unactivate(),t.redrawHint("select",!0),t.touchData.start=null)));var ie=t.projectIntoViewport(S.touches[0].clientX,S.touches[0].clientY);K[0]=ie[0],K[1]=ie[1]}}for(var fe=0;fe<K.length;fe++)ue[fe]=K[fe];z&&S.touches.length>0&&!t.hoverData.draggingEles&&!t.swipePanning&&t.data.bgActivePosistion!=null&&(t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.redraw())}},!1);var we;t.registerBinding(e,"touchcancel",we=function(S){var z=t.touchData.start;t.touchData.capture=!1,z&&z.unactivate()});var me,ge,oe,de;if(t.registerBinding(e,"touchend",me=function(S){var z=t.touchData.start,_=t.touchData.capture;if(_)S.touches.length===0&&(t.touchData.capture=!1),S.preventDefault();else return;var U=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var K=t.cy,ue=K.zoom(),ee=t.touchData.now,ie=t.touchData.earlier;if(S.touches[0]){var se=t.projectIntoViewport(S.touches[0].clientX,S.touches[0].clientY);ee[0]=se[0],ee[1]=se[1]}if(S.touches[1]){var se=t.projectIntoViewport(S.touches[1].clientX,S.touches[1].clientY);ee[2]=se[0],ee[3]=se[1]}if(S.touches[2]){var se=t.projectIntoViewport(S.touches[2].clientX,S.touches[2].clientY);ee[4]=se[0],ee[5]=se[1]}var pe=function(Rt){return{originalEvent:S,type:Rt,position:{x:ee[0],y:ee[1]}}};z&&z.unactivate();var Ee;if(t.touchData.cxt){if(Ee=pe("cxttapend"),z?z.emit(Ee):K.emit(Ee),!t.touchData.cxtDragged){var Ce=pe("cxttap");z?z.emit(Ce):K.emit(Ce)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!S.touches[2]&&K.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var fe=K.collection(t.getAllInBox(U[0],U[1],U[2],U[3]));U[0]=void 0,U[1]=void 0,U[2]=void 0,U[3]=void 0,U[4]=0,t.redrawHint("select",!0),K.emit(pe("boxend"));var ke=function(Rt){return Rt.selectable()&&!Rt.selected()};fe.emit(pe("box")).stdFilter(ke).select().emit(pe("boxselect")),fe.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(z?.unactivate(),S.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!S.touches[1]){if(!S.touches[0]){if(!S.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Pe=t.dragData.touchDragEles;if(z!=null){var nt=z._private.grabbed;y(Pe),t.redrawHint("drag",!0),t.redrawHint("eles",!0),nt&&(z.emit(pe("freeon")),Pe.emit(pe("free")),t.dragData.didDrag&&(z.emit(pe("dragfreeon")),Pe.emit(pe("dragfree")))),n(z,["touchend","tapend","vmouseup","tapdragout"],S,{x:ee[0],y:ee[1]}),z.unactivate(),t.touchData.start=null}else{var Ke=t.findNearestElement(ee[0],ee[1],!0,!0);n(Ke,["touchend","tapend","vmouseup","tapdragout"],S,{x:ee[0],y:ee[1]})}var At=t.touchData.startPosition[0]-ee[0],Xe=At*At,Ze=t.touchData.startPosition[1]-ee[1],je=Ze*Ze,lt=Xe+je,zt=lt*ue*ue;t.touchData.singleTouchMoved||(z||K.$(":selected").unselect(["tapunselect"]),n(z,["tap","vclick"],S,{x:ee[0],y:ee[1]}),ge=!1,S.timeStamp-de<=K.multiClickDebounceTime()?(oe&&clearTimeout(oe),ge=!0,de=null,n(z,["dbltap","vdblclick"],S,{x:ee[0],y:ee[1]})):(oe=setTimeout(function(){ge||n(z,["onetap","voneclick"],S,{x:ee[0],y:ee[1]})},K.multiClickDebounceTime()),de=S.timeStamp)),z!=null&&!t.dragData.didDrag&&z._private.selectable&&zt<t.touchTapThreshold2&&!t.pinching&&(K.selectionType()==="single"?(K.$(r).unmerge(z).unselect(["tapunselect"]),z.select(["tapselect"])):z.selected()?z.unselect(["tapunselect"]):z.select(["tapselect"]),t.redrawHint("eles",!0)),t.touchData.singleTouchMoved=!0}}}for(var Ue=0;Ue<ee.length;Ue++)ie[Ue]=ee[Ue];t.dragData.didDrag=!1,S.touches.length===0&&(t.touchData.dragDelta=[],t.touchData.startPosition=[null,null,null,null,null,null],t.touchData.startGPosition=null,t.touchData.didSelect=!1),S.touches.length<2&&(S.touches.length===1&&(t.touchData.startGPosition=[S.touches[0].clientX,S.touches[0].clientY]),t.pinching=!1,t.redrawHint("eles",!0),t.redraw())},!1),typeof TouchEvent>"u"){var ce=[],xe=function(S){return{clientX:S.clientX,clientY:S.clientY,force:1,identifier:S.pointerId,pageX:S.pageX,pageY:S.pageY,radiusX:S.width/2,radiusY:S.height/2,screenX:S.screenX,screenY:S.screenY,target:S.target}},be=function(S){return{event:S,touch:xe(S)}},Se=function(S){ce.push(be(S))},Be=function(S){for(var z=0;z<ce.length;z++){var _=ce[z];if(_.event.pointerId===S.pointerId){ce.splice(z,1);return}}},Oe=function(S){var z=ce.filter(function(_){return _.event.pointerId===S.pointerId})[0];z.event=S,z.touch=xe(S)},Le=function(S){S.touches=ce.map(function(z){return z.touch})},Ae=function(S){return S.pointerType==="mouse"||S.pointerType===4};t.registerBinding(t.container,"pointerdown",function(X){Ae(X)||(X.preventDefault(),Se(X),Le(X),ve(X))}),t.registerBinding(t.container,"pointerup",function(X){Ae(X)||(Be(X),Le(X),me(X))}),t.registerBinding(t.container,"pointercancel",function(X){Ae(X)||(Be(X),Le(X),we(X))}),t.registerBinding(t.container,"pointermove",function(X){Ae(X)||(X.preventDefault(),Oe(X),Le(X),De(X))})}};var Qt={};Qt.generatePolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,draw:function(a,n,i,o,s,u){this.renderer.nodeShapeImpl("polygon",a,n,i,o,s,this.points)},intersectLine:function(a,n,i,o,s,u,l,f){return Da(s,u,this.points,a,n,i/2,o/2,l)},checkPoint:function(a,n,i,o,s,u,l,f){return Zt(a,n,this.points,u,l,o,s,[0,-1],i)},hasMiterBounds:t!=="rectangle",miterBounds:function(a,n,i,o,s,u){return Yd(this.points,a,n,i,o,s)}}};Qt.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},intersectLine:function(e,r,a,n,i,o,s,u){return ah(i,o,e,r,a/2+s,n/2+s)},checkPoint:function(e,r,a,n,i,o,s,u){return Pr(e,r,n,i,o,s,a)}}};Qt.generateRoundPolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,getOrCreateCorners:function(a,n,i,o,s,u,l){if(u[l]!==void 0&&u[l+"-cx"]===a&&u[l+"-cy"]===n)return u[l];u[l]=new Array(e.length/2),u[l+"-cx"]=a,u[l+"-cy"]=n;var f=i/2,c=o/2;s=s==="auto"?Lf(i,o):s;for(var v=new Array(e.length/2),d=0;d<e.length/2;d++)v[d]={x:a+f*e[d*2],y:n+c*e[d*2+1]};var h,y,g,p,m=v.length;for(y=v[m-1],h=0;h<m;h++)g=v[h%m],p=v[(h+1)%m],u[l][h]=ws(y,g,p,s),y=g,g=p;return u[l]},draw:function(a,n,i,o,s,u,l){this.renderer.nodeShapeImpl("round-polygon",a,n,i,o,s,this.points,this.getOrCreateCorners(n,i,o,s,u,l,"drawCorners"))},intersectLine:function(a,n,i,o,s,u,l,f,c){return ih(s,u,this.points,a,n,i,o,l,this.getOrCreateCorners(a,n,i,o,f,c,"corners"))},checkPoint:function(a,n,i,o,s,u,l,f,c){return rh(a,n,this.points,u,l,o,s,this.getOrCreateCorners(u,l,o,s,f,c,"corners"))}}};Qt.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:yt(4,0),draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i,this.points,o)},intersectLine:function(e,r,a,n,i,o,s,u){return Rf(i,o,e,r,a,n,s,u)},checkPoint:function(e,r,a,n,i,o,s,u){var l=n/2,f=i/2;u=u==="auto"?fr(n,i):u,u=Math.min(l,f,u);var c=u*2;return!!(Zt(e,r,this.points,o,s,n,i-c,[0,-1],a)||Zt(e,r,this.points,o,s,n-c,i,[0,-1],a)||Pr(e,r,c,c,o-l+u,s-f+u,a)||Pr(e,r,c,c,o+l-u,s-f+u,a)||Pr(e,r,c,c,o+l-u,s+f-u,a)||Pr(e,r,c,c,o-l+u,s+f-u,a))}}};Qt.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:us(),points:yt(4,0),draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i,null,o)},generateCutTrianglePts:function(e,r,a,n,i){var o=i==="auto"?this.cornerLength:i,s=r/2,u=e/2,l=a-u,f=a+u,c=n-s,v=n+s;return{topLeft:[l,c+o,l+o,c,l+o,c+o],topRight:[f-o,c,f,c+o,f-o,c+o],bottomRight:[f,v-o,f-o,v,f-o,v-o],bottomLeft:[l+o,v,l,v-o,l+o,v-o]}},intersectLine:function(e,r,a,n,i,o,s,u){var l=this.generateCutTrianglePts(a+2*s,n+2*s,e,r,u),f=[].concat.apply([],[l.topLeft.splice(0,4),l.topRight.splice(0,4),l.bottomRight.splice(0,4),l.bottomLeft.splice(0,4)]);return Da(i,o,f,e,r)},checkPoint:function(e,r,a,n,i,o,s,u){var l=u==="auto"?this.cornerLength:u;if(Zt(e,r,this.points,o,s,n,i-2*l,[0,-1],a)||Zt(e,r,this.points,o,s,n-2*l,i,[0,-1],a))return!0;var f=this.generateCutTrianglePts(n,i,o,s);return Ct(e,r,f.topLeft)||Ct(e,r,f.topRight)||Ct(e,r,f.bottomRight)||Ct(e,r,f.bottomLeft)}}};Qt.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:yt(4,0),draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},intersectLine:function(e,r,a,n,i,o,s,u){var l=.15,f=.5,c=.85,v=this.generateBarrelBezierPts(a+2*s,n+2*s,e,r),d=function(g){var p=Xr({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},l),m=Xr({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},f),b=Xr({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},c);return[g[0],g[1],p.x,p.y,m.x,m.y,b.x,b.y,g[4],g[5]]},h=[].concat(d(v.topLeft),d(v.topRight),d(v.bottomRight),d(v.bottomLeft));return Da(i,o,h,e,r)},generateBarrelBezierPts:function(e,r,a,n){var i=r/2,o=e/2,s=a-o,u=a+o,l=n-i,f=n+i,c=Oo(e,r),v=c.heightOffset,d=c.widthOffset,h=c.ctrlPtOffsetPct*e,y={topLeft:[s,l+v,s+h,l,s+d,l],topRight:[u-d,l,u-h,l,u,l+v],bottomRight:[u,f-v,u-h,f,u-d,f],bottomLeft:[s+d,f,s+h,f,s,f-v]};return y.topLeft.isTop=!0,y.topRight.isTop=!0,y.bottomLeft.isBottom=!0,y.bottomRight.isBottom=!0,y},checkPoint:function(e,r,a,n,i,o,s,u){var l=Oo(n,i),f=l.heightOffset,c=l.widthOffset;if(Zt(e,r,this.points,o,s,n,i-2*f,[0,-1],a)||Zt(e,r,this.points,o,s,n-2*c,i,[0,-1],a))return!0;for(var v=this.generateBarrelBezierPts(n,i,o,s),d=function(T,k,B){var D=B[4],P=B[2],A=B[0],R=B[5],L=B[1],I=Math.min(D,A),M=Math.max(D,A),O=Math.min(R,L),q=Math.max(R,L);if(I<=T&&T<=M&&O<=k&&k<=q){var $=oh(D,P,A),N=Jd($[0],$[1],$[2],T),F=N.filter(function(W){return 0<=W&&W<=1});if(F.length>0)return F[0]}return null},h=Object.keys(v),y=0;y<h.length;y++){var g=h[y],p=v[g],m=d(e,r,p);if(m!=null){var b=p[5],w=p[3],E=p[1],C=it(b,w,E,m);if(p.isTop&&C<=r||p.isBottom&&r<=C)return!0}}return!1}}};Qt.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:yt(4,0),draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i,this.points,o)},intersectLine:function(e,r,a,n,i,o,s,u){var l=e-(a/2+s),f=r-(n/2+s),c=f,v=e+(a/2+s),d=ir(i,o,e,r,l,f,v,c,!1);return d.length>0?d:Rf(i,o,e,r,a,n,s,u)},checkPoint:function(e,r,a,n,i,o,s,u){u=u==="auto"?fr(n,i):u;var l=2*u;if(Zt(e,r,this.points,o,s,n,i-l,[0,-1],a)||Zt(e,r,this.points,o,s,n-l,i,[0,-1],a))return!0;var f=n/2+2*a,c=i/2+2*a,v=[o-f,s-c,o-f,s,o+f,s,o+f,s-c];return!!(Ct(e,r,v)||Pr(e,r,l,l,o+n/2-u,s+i/2-u,a)||Pr(e,r,l,l,o-n/2+u,s+i/2-u,a))}}};Qt.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",yt(3,0)),this.generateRoundPolygon("round-triangle",yt(3,0)),this.generatePolygon("rectangle",yt(4,0)),t.square=t.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r)}this.generatePolygon("pentagon",yt(5,0)),this.generateRoundPolygon("round-pentagon",yt(5,0)),this.generatePolygon("hexagon",yt(6,0)),this.generateRoundPolygon("round-hexagon",yt(6,0)),this.generatePolygon("heptagon",yt(7,0)),this.generateRoundPolygon("round-heptagon",yt(7,0)),this.generatePolygon("octagon",yt(8,0)),this.generateRoundPolygon("round-octagon",yt(8,0));var a=new Array(20);{var n=Io(5,0),i=Io(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<i.length/2;s++)i[s*2]*=o,i[s*2+1]*=o;for(var s=0;s<20/4;s++)a[s*4]=n[s*2],a[s*4+1]=n[s*2+1],a[s*4+2]=i[s*2],a[s*4+3]=i[s*2+1]}a=Mf(a),this.generatePolygon("star",a),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var u=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",u),this.generateRoundPolygon("round-tag",u)}t.makePolygon=function(l){var f=l.join("$"),c="polygon-"+f,v;return(v=this[c])?v:e.generatePolygon(c,l)}};var Ga={};Ga.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};Ga.redraw=function(t){t=t||Bf();var e=this;e.averageRedrawTime===void 0&&(e.averageRedrawTime=0),e.lastRedrawTime===void 0&&(e.lastRedrawTime=0),e.lastDrawTime===void 0&&(e.lastDrawTime=0),e.requestedFrame=!0,e.renderOptions=t};Ga.beforeRender=function(t,e){if(!this.destroyed){e==null&&Ge("Priority is not optional for beforeRender");var r=this.beforeRenderCallbacks;r.push({fn:t,priority:e}),r.sort(function(a,n){return n.priority-a.priority})}};var Uu=function(e,r,a){for(var n=e.beforeRenderCallbacks,i=0;i<n.length;i++)n[i].fn(r,a)};Ga.startRenderLoop=function(){var t=this,e=t.cy;if(!t.renderLoopStarted){t.renderLoopStarted=!0;var r=function(n){if(!t.destroyed){if(!e.batching())if(t.requestedFrame&&!t.skipFrame){Uu(t,!0,n);var i=Yt();t.render(t.renderOptions);var o=t.lastDrawTime=Yt();t.averageRedrawTime===void 0&&(t.averageRedrawTime=o-i),t.redrawCount===void 0&&(t.redrawCount=0),t.redrawCount++,t.redrawTotalTime===void 0&&(t.redrawTotalTime=0);var s=o-i;t.redrawTotalTime+=s,t.lastRedrawTime=s,t.averageRedrawTime=t.averageRedrawTime/2+s/2,t.requestedFrame=!1}else Uu(t,!1,n);t.skipFrame=!1,xn(r)}};xn(r)}};var Ty=function(e){this.init(e)},Ic=Ty,oa=Ic.prototype;oa.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];oa.init=function(t){var e=this;e.options=t,e.cy=t.cy;var r=e.container=t.cy.container(),a=e.cy.window();if(a){var n=a.document,i=n.head,o="__________cytoscape_stylesheet",s="__________cytoscape_container",u=n.getElementById(o)!=null;if(r.className.indexOf(s)<0&&(r.className=(r.className||"")+" "+s),!u){var l=n.createElement("style");l.id=o,l.textContent="."+s+" { position: relative; }",i.insertBefore(l,i.children[0])}var f=a.getComputedStyle(r),c=f.getPropertyValue("position");c==="static"&&ze("A Cytoscape container has style position:static and so can not use UI extensions properly")}e.selection=[void 0,void 0,void 0,void 0,0],e.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],e.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},e.dragData={possibleDragElements:[]},e.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},e.redraws=0,e.showFps=t.showFps,e.debug=t.debug,e.webgl=t.webgl,e.hideEdgesOnViewport=t.hideEdgesOnViewport,e.textureOnViewport=t.textureOnViewport,e.wheelSensitivity=t.wheelSensitivity,e.motionBlurEnabled=t.motionBlur,e.forcedPixelRatio=ae(t.pixelRatio)?t.pixelRatio:null,e.motionBlur=t.motionBlur,e.motionBlurOpacity=t.motionBlurOpacity,e.motionBlurTransparency=1-e.motionBlurOpacity,e.motionBlurPxRatio=1,e.mbPxRBlurry=1,e.minMbLowQualFrames=4,e.fullQualityMb=!1,e.clearedForMotionBlur=[],e.desktopTapThreshold=t.desktopTapThreshold,e.desktopTapThreshold2=t.desktopTapThreshold*t.desktopTapThreshold,e.touchTapThreshold=t.touchTapThreshold,e.touchTapThreshold2=t.touchTapThreshold*t.touchTapThreshold,e.tapholdDuration=500,e.bindings=[],e.beforeRenderCallbacks=[],e.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},e.registerNodeShapes(),e.registerArrowShapes(),e.registerCalculationListeners()};oa.notify=function(t,e){var r=this,a=r.cy;if(!this.destroyed){if(t==="init"){r.load();return}if(t==="destroy"){r.destroy();return}(t==="add"||t==="remove"||t==="move"&&a.hasCompoundNodes()||t==="load"||t==="zorder"||t==="mount")&&r.invalidateCachedZSortedEles(),t==="viewport"&&r.redrawHint("select",!0),t==="gc"&&r.redrawHint("gc",!0),(t==="load"||t==="resize"||t==="mount")&&(r.invalidateContainerClientCoordsCache(),r.matchCanvasSize(r.container)),r.redrawHint("eles",!0),r.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}};oa.destroy=function(){var t=this;t.destroyed=!0,t.cy.stopAnimationLoop();for(var e=0;e<t.bindings.length;e++){var r=t.bindings[e],a=r,n=a.target;(n.off||n.removeEventListener).apply(n,a.args)}if(t.bindings=[],t.beforeRenderCallbacks=[],t.onUpdateEleCalcsFns=[],t.removeObserver&&t.removeObserver.disconnect(),t.styleObserver&&t.styleObserver.disconnect(),t.resizeObserver&&t.resizeObserver.disconnect(),t.labelCalcDiv)try{document.body.removeChild(t.labelCalcDiv)}catch{}};oa.isHeadless=function(){return!1};[bs,Rc,Mc,ia,Qt,Ga].forEach(function(t){ye(oa,t)});var So=1e3/60,Oc={setupDequeueing:function(e){return function(){var a=this,n=this.renderer;if(!a.dequeueingSetup){a.dequeueingSetup=!0;var i=Va(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),o=function(l,f){var c=Yt(),v=n.averageRedrawTime,d=n.lastRedrawTime,h=[],y=n.cy.extent(),g=n.getPixelRatio();for(l||n.flushRenderedStyleQueue();;){var p=Yt(),m=p-c,b=p-f;if(d<So){var w=So-(l?v:0);if(b>=e.deqFastCost*w)break}else if(l){if(m>=e.deqCost*d||m>=e.deqAvgCost*v)break}else if(b>=e.deqNoDrawCost*So)break;var E=e.deq(a,g,y);if(E.length>0)for(var C=0;C<E.length;C++)h.push(E[C]);else break}h.length>0&&(e.onDeqd(a,h),!l&&e.shouldRedraw(a,h,g,y)&&i())},s=e.priority||ns;n.beforeRender(o,s(a))}}}},Sy=(function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:En;gr(this,t),this.idsByKey=new Xt,this.keyForId=new Xt,this.cachesByLvl=new Xt,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return pr(t,[{key:"getIdsFor",value:function(r){r==null&&Ge("Can not get id list for null key");var a=this.idsByKey,n=this.idsByKey.get(r);return n||(n=new ta,a.set(r,n)),n}},{key:"addIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).add(a)}},{key:"deleteIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).delete(a)}},{key:"getNumberOfIdsForKey",value:function(r){return r==null?0:this.getIdsFor(r).size}},{key:"updateKeyMappingFor",value:function(r){var a=r.id(),n=this.keyForId.get(a),i=this.getKey(r);this.deleteIdForKey(n,a),this.addIdForKey(i,a),this.keyForId.set(a,i)}},{key:"deleteKeyMappingFor",value:function(r){var a=r.id(),n=this.keyForId.get(a);this.deleteIdForKey(n,a),this.keyForId.delete(a)}},{key:"keyHasChangedFor",value:function(r){var a=r.id(),n=this.keyForId.get(a),i=this.getKey(r);return n!==i}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var a=this.cachesByLvl,n=this.lvls,i=a.get(r);return i||(i=new Xt,a.set(r,i),n.push(r)),i}},{key:"getCache",value:function(r,a){return this.getCachesAt(a).get(r)}},{key:"get",value:function(r,a){var n=this.getKey(r),i=this.getCache(n,a);return i!=null&&this.updateKeyMappingFor(r),i}},{key:"getForCachedKey",value:function(r,a){var n=this.keyForId.get(r.id()),i=this.getCache(n,a);return i}},{key:"hasCache",value:function(r,a){return this.getCachesAt(a).has(r)}},{key:"has",value:function(r,a){var n=this.getKey(r);return this.hasCache(n,a)}},{key:"setCache",value:function(r,a,n){n.key=r,this.getCachesAt(a).set(r,n)}},{key:"set",value:function(r,a,n){var i=this.getKey(r);this.setCache(i,a,n),this.updateKeyMappingFor(r)}},{key:"deleteCache",value:function(r,a){this.getCachesAt(a).delete(r)}},{key:"delete",value:function(r,a){var n=this.getKey(r);this.deleteCache(n,a)}},{key:"invalidateKey",value:function(r){var a=this;this.lvls.forEach(function(n){return a.deleteCache(r,n)})}},{key:"invalidate",value:function(r){var a=r.id(),n=this.keyForId.get(a);this.deleteKeyMappingFor(r);var i=this.doesEleInvalidateKey(r);return i&&this.invalidateKey(n),i||this.getNumberOfIdsForKey(n)===0}}])})(),Wu=25,on=50,yn=-4,Xo=3,Nc=7.99,ky=8,By=1024,Dy=1024,Py=1024,Ay=.2,Ry=.8,My=10,Ly=.15,Iy=.1,Oy=.9,Ny=.9,zy=100,Fy=1,Kr={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Vy=ct({getKey:null,doesEleInvalidateKey:En,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Tf,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),wa=function(e,r){var a=this;a.renderer=e,a.onDequeues=[];var n=Vy(r);ye(a,n),a.lookup=new Sy(n.getKey,n.doesEleInvalidateKey),a.setupDequeueing()},at=wa.prototype;at.reasons=Kr;at.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]};at.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=r[t]=r[t]||[];return a};at.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new qa(function(r,a){return a.reqs-r.reqs});return e};at.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e};at.getElement=function(t,e,r,a,n){var i=this,o=this.renderer,s=o.cy.zoom(),u=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!t.visible()||t.removed()||!i.allowEdgeTxrCaching&&t.isEdge()||!i.allowParentTxrCaching&&t.isParent())return null;if(a==null&&(a=Math.ceil(os(s*r))),a<yn)a=yn;else if(s>=Nc||a>Xo)return null;var l=Math.pow(2,a),f=e.h*l,c=e.w*l,v=o.eleTextBiggerThanMin(t,l);if(!this.isVisible(t,v))return null;var d=u.get(t,a);if(d&&d.invalidated&&(d.invalidated=!1,d.texture.invalidatedWidth-=d.width),d)return d;var h;if(f<=Wu?h=Wu:f<=on?h=on:h=Math.ceil(f/on)*on,f>Py||c>Dy)return null;var y=i.getTextureQueue(h),g=y[y.length-2],p=function(){return i.recycleTexture(h,c)||i.addTexture(h,c)};g||(g=y[y.length-1]),g||(g=p()),g.width-g.usedWidth<c&&(g=p());for(var m=function(I){return I&&I.scaledLabelShown===v},b=n&&n===Kr.dequeue,w=n&&n===Kr.highQuality,E=n&&n===Kr.downscale,C,x=a+1;x<=Xo;x++){var T=u.get(t,x);if(T){C=T;break}}var k=C&&C.level===a+1?C:null,B=function(){g.context.drawImage(k.texture.canvas,k.x,0,k.width,k.height,g.usedWidth,0,c,f)};if(g.context.setTransform(1,0,0,1,0,0),g.context.clearRect(g.usedWidth,0,c,h),m(k))B();else if(m(C))if(w){for(var D=C.level;D>a;D--)k=i.getElement(t,e,r,D,Kr.downscale);B()}else return i.queueElement(t,C.level-1),C;else{var P;if(!b&&!w&&!E)for(var A=a-1;A>=yn;A--){var R=u.get(t,A);if(R){P=R;break}}if(m(P))return i.queueElement(t,a),P;g.context.translate(g.usedWidth,0),g.context.scale(l,l),this.drawElement(g.context,t,e,v,!1),g.context.scale(1/l,1/l),g.context.translate(-g.usedWidth,0)}return d={x:g.usedWidth,texture:g,level:a,scale:l,width:c,height:f,scaledLabelShown:v},g.usedWidth+=Math.ceil(c+ky),g.eleCaches.push(d),u.set(t,a,d),i.checkTextureFullness(g),d};at.invalidateElements=function(t){for(var e=0;e<t.length;e++)this.invalidateElement(t[e])};at.invalidateElement=function(t){var e=this,r=e.lookup,a=[],n=r.isInvalid(t);if(n){for(var i=yn;i<=Xo;i++){var o=r.getForCachedKey(t,i);o&&a.push(o)}var s=r.invalidate(t);if(s)for(var u=0;u<a.length;u++){var l=a[u],f=l.texture;f.invalidatedWidth+=l.width,l.invalidated=!0,e.checkTextureUtility(f)}e.removeFromQueue(t)}};at.checkTextureUtility=function(t){t.invalidatedWidth>=Ay*t.width&&this.retireTexture(t)};at.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>Ry&&t.fullnessChecks>=My?ur(r,t):t.fullnessChecks++};at.retireTexture=function(t){var e=this,r=t.height,a=e.getTextureQueue(r),n=this.lookup;ur(a,t),t.retired=!0;for(var i=t.eleCaches,o=0;o<i.length;o++){var s=i[o];n.deleteCache(s.key,s.level)}is(i);var u=e.getRetiredTextureQueue(r);u.push(t)};at.addTexture=function(t,e){var r=this,a=r.getTextureQueue(t),n={};return a.push(n),n.eleCaches=[],n.height=t,n.width=Math.max(By,e),n.usedWidth=0,n.invalidatedWidth=0,n.fullnessChecks=0,n.canvas=r.renderer.makeOffscreenCanvas(n.width,n.height),n.context=n.canvas.getContext("2d"),n};at.recycleTexture=function(t,e){for(var r=this,a=r.getTextureQueue(t),n=r.getRetiredTextureQueue(t),i=0;i<n.length;i++){var o=n[i];if(o.width>=e)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,is(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),ur(n,o),a.push(o),o}};at.queueElement=function(t,e){var r=this,a=r.getElementQueue(),n=r.getElementKeyToQueue(),i=this.getKey(t),o=n[i];if(o)o.level=Math.max(o.level,e),o.eles.merge(t),o.reqs++,a.updateItem(o);else{var s={eles:t.spawn().merge(t),level:e,reqs:1,key:i};a.push(s),n[i]=s}};at.dequeue=function(t){for(var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),n=[],i=e.lookup,o=0;o<Fy&&r.size()>0;o++){var s=r.pop(),u=s.key,l=s.eles[0],f=i.hasCache(l,s.level);if(a[u]=null,f)continue;n.push(s);var c=e.getBoundingBox(l);e.getElement(l,c,t,s.level,Kr.dequeue)}return n};at.removeFromQueue=function(t){var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),n=this.getKey(t),i=a[n];i!=null&&(i.eles.length===1?(i.reqs=as,r.updateItem(i),r.pop(),a[n]=null):i.eles.unmerge(t))};at.onDequeue=function(t){this.onDequeues.push(t)};at.offDequeue=function(t){ur(this.onDequeues,t)};at.setupDequeueing=Oc.setupDequeueing({deqRedrawThreshold:zy,deqCost:Ly,deqAvgCost:Iy,deqNoDrawCost:Oy,deqFastCost:Ny,deq:function(e,r,a){return e.dequeue(r,a)},onDeqd:function(e,r){for(var a=0;a<e.onDequeues.length;a++){var n=e.onDequeues[a];n(r)}},shouldRedraw:function(e,r,a,n){for(var i=0;i<r.length;i++)for(var o=r[i].eles,s=0;s<o.length;s++){var u=o[s].boundingBox();if(ls(u,n))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var qy=1,Ea=-4,An=2,$y=3.99,_y=50,Hy=50,Gy=.15,Uy=.1,Wy=.9,Ky=.9,Xy=1,Ku=250,Yy=4e3*4e3,Xu=32767,Zy=!0,zc=function(e){var r=this,a=r.renderer=e,n=a.cy;r.layersByLevel={},r.firstGet=!0,r.lastInvalidationTime=Yt()-2*Ku,r.skipping=!1,r.eleTxrDeqs=n.collection(),r.scheduleElementRefinement=Va(function(){r.refineElementTextures(r.eleTxrDeqs),r.eleTxrDeqs.unmerge(r.eleTxrDeqs)},Hy),a.beforeRender(function(o,s){s-r.lastInvalidationTime<=Ku?r.skipping=!0:r.skipping=!1},a.beforeRenderPriorities.lyrTxrSkip);var i=function(s,u){return u.reqs-s.reqs};r.layersQueue=new qa(i),r.setupDequeueing()},vt=zc.prototype,Yu=0,Qy=Math.pow(2,53)-1;vt.makeLayer=function(t,e){var r=Math.pow(2,e),a=Math.ceil(t.w*r),n=Math.ceil(t.h*r),i=this.renderer.makeOffscreenCanvas(a,n),o={id:Yu=++Yu%Qy,bb:t,level:e,width:a,height:n,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},s=o.context,u=-o.bb.x1,l=-o.bb.y1;return s.scale(r,r),s.translate(u,l),o};vt.getLayers=function(t,e,r){var a=this,n=a.renderer,i=n.cy,o=i.zoom(),s=a.firstGet;if(a.firstGet=!1,r==null){if(r=Math.ceil(os(o*e)),r<Ea)r=Ea;else if(o>=$y||r>An)return null}a.validateLayersElesOrdering(r,t);var u=a.layersByLevel,l=Math.pow(2,r),f=u[r]=u[r]||[],c,v=a.levelIsComplete(r,t),d,h=function(){var B=function(L){if(a.validateLayersElesOrdering(L,t),a.levelIsComplete(L,t))return d=u[L],!0},D=function(L){if(!d)for(var I=r+L;Ea<=I&&I<=An&&!B(I);I+=L);};D(1),D(-1);for(var P=f.length-1;P>=0;P--){var A=f[P];A.invalid&&ur(f,A)}};if(!v)h();else return f;var y=function(){if(!c){c=mt();for(var B=0;B<t.length;B++)Wd(c,t[B].boundingBox())}return c},g=function(B){B=B||{};var D=B.after;y();var P=Math.ceil(c.w*l),A=Math.ceil(c.h*l);if(P>Xu||A>Xu)return null;var R=P*A;if(R>Yy)return null;var L=a.makeLayer(c,r);if(D!=null){var I=f.indexOf(D)+1;f.splice(I,0,L)}else(B.insert===void 0||B.insert)&&f.unshift(L);return L};if(a.skipping&&!s)return null;for(var p=null,m=t.length/qy,b=!s,w=0;w<t.length;w++){var E=t[w],C=E._private.rscratch,x=C.imgLayerCaches=C.imgLayerCaches||{},T=x[r];if(T){p=T;continue}if((!p||p.eles.length>=m||!Af(p.bb,E.boundingBox()))&&(p=g({insert:!0,after:p}),!p))return null;d||b?a.queueLayer(p,E):a.drawEleInLayer(p,E,r,e),p.eles.push(E),x[r]=p}return d||(b?null:f)};vt.getEleLevelForLayerLevel=function(t,e){return t};vt.drawEleInLayer=function(t,e,r,a){var n=this,i=this.renderer,o=t.context,s=e.boundingBox();s.w===0||s.h===0||!e.visible()||(r=n.getEleLevelForLayerLevel(r,a),i.setImgSmoothing(o,!1),i.drawCachedElement(o,e,null,null,r,Zy),i.setImgSmoothing(o,!0))};vt.levelIsComplete=function(t,e){var r=this,a=r.layersByLevel[t];if(!a||a.length===0)return!1;for(var n=0,i=0;i<a.length;i++){var o=a[i];if(o.reqs>0||o.invalid)return!1;n+=o.eles.length}return n===e.length};vt.validateLayersElesOrdering=function(t,e){var r=this.layersByLevel[t];if(r)for(var a=0;a<r.length;a++){for(var n=r[a],i=-1,o=0;o<e.length;o++)if(n.eles[0]===e[o]){i=o;break}if(i<0){this.invalidateLayer(n);continue}for(var s=i,o=0;o<n.eles.length;o++)if(n.eles[o]!==e[s+o]){this.invalidateLayer(n);break}}};vt.updateElementsInLayers=function(t,e){for(var r=this,a=Oa(t[0]),n=0;n<t.length;n++)for(var i=a?null:t[n],o=a?t[n]:t[n].ele,s=o._private.rscratch,u=s.imgLayerCaches=s.imgLayerCaches||{},l=Ea;l<=An;l++){var f=u[l];f&&(i&&r.getEleLevelForLayerLevel(f.level)!==i.level||e(f,o,i))}};vt.haveLayers=function(){for(var t=this,e=!1,r=Ea;r<=An;r++){var a=t.layersByLevel[r];if(a&&a.length>0){e=!0;break}}return e};vt.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=Yt(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(a,n,i){e.invalidateLayer(a)}))};vt.invalidateLayer=function(t){if(this.lastInvalidationTime=Yt(),!t.invalid){var e=t.level,r=t.eles,a=this.layersByLevel[e];ur(a,t),t.elesQueue=[],t.invalid=!0,t.replacement&&(t.replacement.invalid=!0);for(var n=0;n<r.length;n++){var i=r[n]._private.rscratch.imgLayerCaches;i&&(i[e]=null)}}};vt.refineElementTextures=function(t){var e=this;e.updateElementsInLayers(t,function(a,n,i){var o=a.replacement;if(o||(o=a.replacement=e.makeLayer(a.bb,a.level),o.replaces=a,o.eles=a.eles),!o.reqs)for(var s=0;s<o.eles.length;s++)e.queueLayer(o,o.eles[s])})};vt.enqueueElementRefinement=function(t){this.eleTxrDeqs.merge(t),this.scheduleElementRefinement()};vt.queueLayer=function(t,e){var r=this,a=r.layersQueue,n=t.elesQueue,i=n.hasId=n.hasId||{};if(!t.replacement){if(e){if(i[e.id()])return;n.push(e),i[e.id()]=!0}t.reqs?(t.reqs++,a.updateItem(t)):(t.reqs=1,a.push(t))}};vt.dequeue=function(t){for(var e=this,r=e.layersQueue,a=[],n=0;n<Xy&&r.size()!==0;){var i=r.peek();if(i.replacement){r.pop();continue}if(i.replaces&&i!==i.replaces.replacement){r.pop();continue}if(i.invalid){r.pop();continue}var o=i.elesQueue.shift();o&&(e.drawEleInLayer(i,o,i.level,t),n++),a.length===0&&a.push(!0),i.elesQueue.length===0&&(r.pop(),i.reqs=0,i.replaces&&e.applyLayerReplacement(i),e.requestRedraw())}return a};vt.applyLayerReplacement=function(t){var e=this,r=e.layersByLevel[t.level],a=t.replaces,n=r.indexOf(a);if(!(n<0||a.invalid)){r[n]=t;for(var i=0;i<t.eles.length;i++){var o=t.eles[i]._private,s=o.imgLayerCaches=o.imgLayerCaches||{};s&&(s[t.level]=t)}e.requestRedraw()}};vt.requestRedraw=Va(function(){var t=this.renderer;t.redrawHint("eles",!0),t.redrawHint("drag",!0),t.redraw()},100);vt.setupDequeueing=Oc.setupDequeueing({deqRedrawThreshold:_y,deqCost:Gy,deqAvgCost:Uy,deqNoDrawCost:Wy,deqFastCost:Ky,deq:function(e,r){return e.dequeue(r)},onDeqd:ns,shouldRedraw:Tf,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var Fc={},Zu;function Jy(t,e){for(var r=0;r<e.length;r++){var a=e[r];t.lineTo(a.x,a.y)}}function jy(t,e,r){for(var a,n=0;n<e.length;n++){var i=e[n];n===0&&(a=i),t.lineTo(i.x,i.y)}t.quadraticCurveTo(r.x,r.y,a.x,a.y)}function Qu(t,e,r){t.beginPath&&t.beginPath();for(var a=e,n=0;n<a.length;n++){var i=a[n];t.lineTo(i.x,i.y)}var o=r,s=r[0];t.moveTo(s.x,s.y);for(var n=1;n<o.length;n++){var i=o[n];t.lineTo(i.x,i.y)}t.closePath&&t.closePath()}function em(t,e,r,a,n){t.beginPath&&t.beginPath(),t.arc(r,a,n,0,Math.PI*2,!1);var i=e,o=i[0];t.moveTo(o.x,o.y);for(var s=0;s<i.length;s++){var u=i[s];t.lineTo(u.x,u.y)}t.closePath&&t.closePath()}function tm(t,e,r,a){t.arc(e,r,a,0,Math.PI*2,!1)}Fc.arrowShapeImpl=function(t){return(Zu||(Zu={polygon:Jy,"triangle-backcurve":jy,"triangle-tee":Qu,"circle-triangle":em,"triangle-cross":Qu,circle:tm}))[t]};var Gt={};Gt.drawElement=function(t,e,r,a,n,i){var o=this;e.isNode()?o.drawNode(t,e,r,a,n,i):o.drawEdge(t,e,r,a,n,i)};Gt.drawElementOverlay=function(t,e){var r=this;e.isNode()?r.drawNodeOverlay(t,e):r.drawEdgeOverlay(t,e)};Gt.drawElementUnderlay=function(t,e){var r=this;e.isNode()?r.drawNodeUnderlay(t,e):r.drawEdgeUnderlay(t,e)};Gt.drawCachedElementPortion=function(t,e,r,a,n,i,o,s){var u=this,l=r.getBoundingBox(e);if(!(l.w===0||l.h===0)){var f=r.getElement(e,l,a,n,i);if(f!=null){var c=s(u,e);if(c===0)return;var v=o(u,e),d=l.x1,h=l.y1,y=l.w,g=l.h,p,m,b,w,E;if(v!==0){var C=r.getRotationPoint(e);b=C.x,w=C.y,t.translate(b,w),t.rotate(v),E=u.getImgSmoothing(t),E||u.setImgSmoothing(t,!0);var x=r.getRotationOffset(e);p=x.x,m=x.y}else p=d,m=h;var T;c!==1&&(T=t.globalAlpha,t.globalAlpha=T*c),t.drawImage(f.texture.canvas,f.x,0,f.width,f.height,p,m,y,g),c!==1&&(t.globalAlpha=T),v!==0&&(t.rotate(-v),t.translate(-b,-w),E||u.setImgSmoothing(t,!1))}else r.drawElement(t,e)}};var rm=function(){return 0},am=function(e,r){return e.getTextAngle(r,null)},nm=function(e,r){return e.getTextAngle(r,"source")},im=function(e,r){return e.getTextAngle(r,"target")},om=function(e,r){return r.effectiveOpacity()},ko=function(e,r){return r.pstyle("text-opacity").pfValue*r.effectiveOpacity()};Gt.drawCachedElement=function(t,e,r,a,n,i){var o=this,s=o.data,u=s.eleTxrCache,l=s.lblTxrCache,f=s.slbTxrCache,c=s.tlbTxrCache,v=e.boundingBox(),d=i===!0?u.reasons.highQuality:null;if(!(v.w===0||v.h===0||!e.visible())&&(!a||ls(v,a))){var h=e.isEdge(),y=e.element()._private.rscratch.badLine;o.drawElementUnderlay(t,e),o.drawCachedElementPortion(t,e,u,r,n,d,rm,om),(!h||!y)&&o.drawCachedElementPortion(t,e,l,r,n,d,am,ko),h&&!y&&(o.drawCachedElementPortion(t,e,f,r,n,d,nm,ko),o.drawCachedElementPortion(t,e,c,r,n,d,im,ko)),o.drawElementOverlay(t,e)}};Gt.drawElements=function(t,e){for(var r=this,a=0;a<e.length;a++){var n=e[a];r.drawElement(t,n)}};Gt.drawCachedElements=function(t,e,r,a){for(var n=this,i=0;i<e.length;i++){var o=e[i];n.drawCachedElement(t,o,r,a)}};Gt.drawCachedNodes=function(t,e,r,a){for(var n=this,i=0;i<e.length;i++){var o=e[i];o.isNode()&&n.drawCachedElement(t,o,r,a)}};Gt.drawLayeredElements=function(t,e,r,a){var n=this,i=n.data.lyrTxrCache.getLayers(e,r);if(i)for(var o=0;o<i.length;o++){var s=i[o],u=s.bb;u.w===0||u.h===0||t.drawImage(s.canvas,u.x1,u.y1,u.w,u.h)}else n.drawCachedElements(t,e,r,a)};var Jt={};Jt.drawEdge=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s=e._private.rscratch;if(!(i&&!e.visible())&&!(s.badLine||s.allpts==null||isNaN(s.allpts[0]))){var u;r&&(u=r,t.translate(-u.x1,-u.y1));var l=i?e.pstyle("opacity").value:1,f=i?e.pstyle("line-opacity").value:1,c=e.pstyle("curve-style").value,v=e.pstyle("line-style").value,d=e.pstyle("width").pfValue,h=e.pstyle("line-cap").value,y=e.pstyle("line-outline-width").value,g=e.pstyle("line-outline-color").value,p=l*f,m=l*f,b=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p;c==="straight-triangle"?(o.eleStrokeStyle(t,e,L),o.drawEdgeTrianglePath(e,t,s.allpts)):(t.lineWidth=d,t.lineCap=h,o.eleStrokeStyle(t,e,L),o.drawEdgePath(e,t,s.allpts,v),t.lineCap="butt")},w=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p;if(t.lineWidth=d+y,t.lineCap=h,y>0)o.colorStrokeStyle(t,g[0],g[1],g[2],L);else{t.lineCap="butt";return}c==="straight-triangle"?o.drawEdgeTrianglePath(e,t,s.allpts):(o.drawEdgePath(e,t,s.allpts,v),t.lineCap="butt")},E=function(){n&&o.drawEdgeOverlay(t,e)},C=function(){n&&o.drawEdgeUnderlay(t,e)},x=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;o.drawArrowheads(t,e,L)},T=function(){o.drawElementText(t,e,null,a)};t.lineJoin="round";var k=e.pstyle("ghost").value==="yes";if(k){var B=e.pstyle("ghost-offset-x").pfValue,D=e.pstyle("ghost-offset-y").pfValue,P=e.pstyle("ghost-opacity").value,A=p*P;t.translate(B,D),b(A),x(A),t.translate(-B,-D)}else w();C(),b(),x(),E(),T(),r&&t.translate(u.x1,u.y1)}};var Vc=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a){if(a.visible()){var n=a.pstyle("".concat(e,"-opacity")).value;if(n!==0){var i=this,o=i.usePaths(),s=a._private.rscratch,u=a.pstyle("".concat(e,"-padding")).pfValue,l=2*u,f=a.pstyle("".concat(e,"-color")).value;r.lineWidth=l,s.edgeType==="self"&&!o?r.lineCap="butt":r.lineCap="round",i.colorStrokeStyle(r,f[0],f[1],f[2],n),i.drawEdgePath(a,r,s.allpts,"solid")}}}};Jt.drawEdgeOverlay=Vc("overlay");Jt.drawEdgeUnderlay=Vc("underlay");Jt.drawEdgePath=function(t,e,r,a){var n=t._private.rscratch,i=e,o,s=!1,u=this.usePaths(),l=t.pstyle("line-dash-pattern").pfValue,f=t.pstyle("line-dash-offset").pfValue;if(u){var c=r.join("$"),v=n.pathCacheKey&&n.pathCacheKey===c;v?(o=e=n.pathCache,s=!0):(o=e=new Path2D,n.pathCacheKey=c,n.pathCache=o)}if(i.setLineDash)switch(a){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(l),i.lineDashOffset=f;break;case"solid":i.setLineDash([]);break}if(!s&&!n.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(r[0],r[1]),n.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var d=2;d+3<r.length;d+=4)e.quadraticCurveTo(r[d],r[d+1],r[d+2],r[d+3]);break;case"straight":case"haystack":for(var h=2;h+1<r.length;h+=2)e.lineTo(r[h],r[h+1]);break;case"segments":if(n.isRound){var y=Tt(n.roundCorners),g;try{for(y.s();!(g=y.n()).done;){var p=g.value;kc(e,p)}}catch(b){y.e(b)}finally{y.f()}e.lineTo(r[r.length-2],r[r.length-1])}else for(var m=2;m+1<r.length;m+=2)e.lineTo(r[m],r[m+1]);break}e=i,u?e.stroke(o):e.stroke(),e.setLineDash&&e.setLineDash([])};Jt.drawEdgeTrianglePath=function(t,e,r){e.fillStyle=e.strokeStyle;for(var a=t.pstyle("width").pfValue,n=0;n+1<r.length;n+=2){var i=[r[n+2]-r[n],r[n+3]-r[n+1]],o=Math.sqrt(i[0]*i[0]+i[1]*i[1]),s=[i[1]/o,-i[0]/o],u=[s[0]*a/2,s[1]*a/2];e.beginPath(),e.moveTo(r[n]-u[0],r[n+1]-u[1]),e.lineTo(r[n]+u[0],r[n+1]+u[1]),e.lineTo(r[n+2],r[n+3]),e.closePath(),e.fill()}};Jt.drawArrowheads=function(t,e,r){var a=e._private.rscratch,n=a.edgeType==="haystack";n||this.drawArrowhead(t,e,"source",a.arrowStartX,a.arrowStartY,a.srcArrowAngle,r),this.drawArrowhead(t,e,"mid-target",a.midX,a.midY,a.midtgtArrowAngle,r),this.drawArrowhead(t,e,"mid-source",a.midX,a.midY,a.midsrcArrowAngle,r),n||this.drawArrowhead(t,e,"target",a.arrowEndX,a.arrowEndY,a.tgtArrowAngle,r)};Jt.drawArrowhead=function(t,e,r,a,n,i,o){if(!(isNaN(a)||a==null||isNaN(n)||n==null||isNaN(i)||i==null)){var s=this,u=e.pstyle(r+"-arrow-shape").value;if(u!=="none"){var l=e.pstyle(r+"-arrow-fill").value==="hollow"?"both":"filled",f=e.pstyle(r+"-arrow-fill").value,c=e.pstyle("width").pfValue,v=e.pstyle(r+"-arrow-width"),d=v.value==="match-line"?c:v.pfValue;v.units==="%"&&(d*=c);var h=e.pstyle("opacity").value;o===void 0&&(o=h);var y=t.globalCompositeOperation;(o!==1||f==="hollow")&&(t.globalCompositeOperation="destination-out",s.colorFillStyle(t,255,255,255,1),s.colorStrokeStyle(t,255,255,255,1),s.drawArrowShape(e,t,l,c,u,d,a,n,i),t.globalCompositeOperation=y);var g=e.pstyle(r+"-arrow-color").value;s.colorFillStyle(t,g[0],g[1],g[2],o),s.colorStrokeStyle(t,g[0],g[1],g[2],o),s.drawArrowShape(e,t,f,c,u,d,a,n,i)}}};Jt.drawArrowShape=function(t,e,r,a,n,i,o,s,u){var l=this,f=this.usePaths()&&n!=="triangle-cross",c=!1,v,d=e,h={x:o,y:s},y=t.pstyle("arrow-scale").value,g=this.getArrowWidth(a,y),p=l.arrowShapes[n];if(f){var m=l.arrowPathCache=l.arrowPathCache||[],b=Ar(n),w=m[b];w!=null?(v=e=w,c=!0):(v=e=new Path2D,m[b]=v)}c||(e.beginPath&&e.beginPath(),f?p.draw(e,1,0,{x:0,y:0},1):p.draw(e,g,u,h,a),e.closePath&&e.closePath()),e=d,f&&(e.translate(o,s),e.rotate(u),e.scale(g,g)),(r==="filled"||r==="both")&&(f?e.fill(v):e.fill()),(r==="hollow"||r==="both")&&(e.lineWidth=i/(f?g:1),e.lineJoin="miter",f?e.stroke(v):e.stroke()),f&&(e.scale(1/g,1/g),e.rotate(-u),e.translate(-o,-s))};var Es={};Es.safeDrawImage=function(t,e,r,a,n,i,o,s,u,l){if(!(n<=0||i<=0||u<=0||l<=0))try{t.drawImage(e,r,a,n,i,o,s,u,l)}catch(f){ze(f)}};Es.drawInscribedImage=function(t,e,r,a,n){var i=this,o=r.position(),s=o.x,u=o.y,l=r.cy().style(),f=l.getIndexedStyle.bind(l),c=f(r,"background-fit","value",a),v=f(r,"background-repeat","value",a),d=r.width(),h=r.height(),y=r.padding()*2,g=d+(f(r,"background-width-relative-to","value",a)==="inner"?0:y),p=h+(f(r,"background-height-relative-to","value",a)==="inner"?0:y),m=r._private.rscratch,b=f(r,"background-clip","value",a),w=b==="node",E=f(r,"background-image-opacity","value",a)*n,C=f(r,"background-image-smoothing","value",a),x=r.pstyle("corner-radius").value;x!=="auto"&&(x=r.pstyle("corner-radius").pfValue);var T=e.width||e.cachedW,k=e.height||e.cachedH;(T==null||k==null)&&(document.body.appendChild(e),T=e.cachedW=e.width||e.offsetWidth,k=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var B=T,D=k;if(f(r,"background-width","value",a)!=="auto"&&(f(r,"background-width","units",a)==="%"?B=f(r,"background-width","pfValue",a)*g:B=f(r,"background-width","pfValue",a)),f(r,"background-height","value",a)!=="auto"&&(f(r,"background-height","units",a)==="%"?D=f(r,"background-height","pfValue",a)*p:D=f(r,"background-height","pfValue",a)),!(B===0||D===0)){if(c==="contain"){var P=Math.min(g/B,p/D);B*=P,D*=P}else if(c==="cover"){var P=Math.max(g/B,p/D);B*=P,D*=P}var A=s-g/2,R=f(r,"background-position-x","units",a),L=f(r,"background-position-x","pfValue",a);R==="%"?A+=(g-B)*L:A+=L;var I=f(r,"background-offset-x","units",a),M=f(r,"background-offset-x","pfValue",a);I==="%"?A+=(g-B)*M:A+=M;var O=u-p/2,q=f(r,"background-position-y","units",a),$=f(r,"background-position-y","pfValue",a);q==="%"?O+=(p-D)*$:O+=$;var N=f(r,"background-offset-y","units",a),F=f(r,"background-offset-y","pfValue",a);N==="%"?O+=(p-D)*F:O+=F,m.pathCache&&(A-=s,O-=u,s=0,u=0);var W=t.globalAlpha;t.globalAlpha=E;var J=i.getImgSmoothing(t),Z=!1;if(C==="no"&&J?(i.setImgSmoothing(t,!1),Z=!0):C==="yes"&&!J&&(i.setImgSmoothing(t,!0),Z=!0),v==="no-repeat")w&&(t.save(),m.pathCache?t.clip(m.pathCache):(i.nodeShapes[i.getNodeShape(r)].draw(t,s,u,g,p,x,m),t.clip())),i.safeDrawImage(t,e,0,0,T,k,A,O,B,D),w&&t.restore();else{var j=t.createPattern(e,v);t.fillStyle=j,i.nodeShapes[i.getNodeShape(r)].draw(t,s,u,g,p,x,m),t.translate(A,O),t.fill(),t.translate(-A,-O)}t.globalAlpha=W,Z&&i.setImgSmoothing(t,J)}};var Nr={};Nr.eleTextBiggerThanMin=function(t,e){if(!e){var r=t.cy().zoom(),a=this.getPixelRatio(),n=Math.ceil(os(r*a));e=Math.pow(2,n)}var i=t.pstyle("font-size").pfValue*e,o=t.pstyle("min-zoomed-font-size").pfValue;return!(i<o)};Nr.drawElementText=function(t,e,r,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(a==null){if(i&&!o.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var s=e.pstyle("label");if(!s||!s.value)return;var u=o.getLabelJustification(e);t.textAlign=u,t.textBaseline="bottom"}else{var l=e.element()._private.rscratch.badLine,f=e.pstyle("label"),c=e.pstyle("source-label"),v=e.pstyle("target-label");if(l||(!f||!f.value)&&(!c||!c.value)&&(!v||!v.value))return;t.textAlign="center",t.textBaseline="bottom"}var d=!r,h;r&&(h=r,t.translate(-h.x1,-h.y1)),n==null?(o.drawText(t,e,null,d,i),e.isEdge()&&(o.drawText(t,e,"source",d,i),o.drawText(t,e,"target",d,i))):o.drawText(t,e,n,d,i),r&&t.translate(h.x1,h.y1)};Nr.getFontCache=function(t){var e;this.fontCaches=this.fontCaches||[];for(var r=0;r<this.fontCaches.length;r++)if(e=this.fontCaches[r],e.context===t)return e;return e={context:t},this.fontCaches.push(e),e};Nr.setupTextStyle=function(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=e.pstyle("font-style").strValue,n=e.pstyle("font-size").pfValue+"px",i=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,s=r?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,u=e.pstyle("text-outline-opacity").value*s,l=e.pstyle("color").value,f=e.pstyle("text-outline-color").value;t.font=a+" "+o+" "+n+" "+i,t.lineJoin="round",this.colorFillStyle(t,l[0],l[1],l[2],s),this.colorStrokeStyle(t,f[0],f[1],f[2],u)};function sm(t,e,r,a,n){var i=Math.min(a,n),o=i/2,s=e+a/2,u=r+n/2;t.beginPath(),t.arc(s,u,o,0,Math.PI*2),t.closePath()}function Ju(t,e,r,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=Math.min(i,a/2,n/2);t.beginPath(),t.moveTo(e+o,r),t.lineTo(e+a-o,r),t.quadraticCurveTo(e+a,r,e+a,r+o),t.lineTo(e+a,r+n-o),t.quadraticCurveTo(e+a,r+n,e+a-o,r+n),t.lineTo(e+o,r+n),t.quadraticCurveTo(e,r+n,e,r+n-o),t.lineTo(e,r+o),t.quadraticCurveTo(e,r,e+o,r),t.closePath()}Nr.getTextAngle=function(t,e){var r,a=t._private,n=a.rscratch,i=e?e+"-":"",o=t.pstyle(i+"text-rotation");if(o.strValue==="autorotate"){var s=Et(n,"labelAngle",e);r=t.isEdge()?s:0}else o.strValue==="none"?r=0:r=o.pfValue;return r};Nr.drawText=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private,o=i.rscratch,s=n?e.effectiveOpacity():1;if(!(n&&(s===0||e.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var u=Et(o,"labelX",r),l=Et(o,"labelY",r),f,c,v=this.getLabelText(e,r);if(v!=null&&v!==""&&!isNaN(u)&&!isNaN(l)){this.setupTextStyle(t,e,n);var d=r?r+"-":"",h=Et(o,"labelWidth",r),y=Et(o,"labelHeight",r),g=e.pstyle(d+"text-margin-x").pfValue,p=e.pstyle(d+"text-margin-y").pfValue,m=e.isEdge(),b=e.pstyle("text-halign").value,w=e.pstyle("text-valign").value;m&&(b="center",w="center"),u+=g,l+=p;var E;switch(a?E=this.getTextAngle(e,r):E=0,E!==0&&(f=u,c=l,t.translate(f,c),t.rotate(E),u=0,l=0),w){case"top":break;case"center":l+=y/2;break;case"bottom":l+=y;break}var C=e.pstyle("text-background-opacity").value,x=e.pstyle("text-border-opacity").value,T=e.pstyle("text-border-width").pfValue,k=e.pstyle("text-background-padding").pfValue,B=e.pstyle("text-background-shape").strValue,D=B==="round-rectangle"||B==="roundrectangle",P=B==="circle",A=2;if(C>0||T>0&&x>0){var R=t.fillStyle,L=t.strokeStyle,I=t.lineWidth,M=e.pstyle("text-background-color").value,O=e.pstyle("text-border-color").value,q=e.pstyle("text-border-style").value,$=C>0,N=T>0&&x>0,F=u-k;switch(b){case"left":F-=h;break;case"center":F-=h/2;break}var W=l-y-k,J=h+2*k,Z=y+2*k;if($&&(t.fillStyle="rgba(".concat(M[0],",").concat(M[1],",").concat(M[2],",").concat(C*s,")")),N&&(t.strokeStyle="rgba(".concat(O[0],",").concat(O[1],",").concat(O[2],",").concat(x*s,")"),t.lineWidth=T,t.setLineDash))switch(q){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=T/4,t.setLineDash([]);break;default:t.setLineDash([]);break}if(D?(t.beginPath(),Ju(t,F,W,J,Z,A)):P?(t.beginPath(),sm(t,F,W,J,Z)):(t.beginPath(),t.rect(F,W,J,Z)),$&&t.fill(),N&&t.stroke(),N&&q==="double"){var j=T/2;t.beginPath(),D?Ju(t,F+j,W+j,J-2*j,Z-2*j,A):t.rect(F+j,W+j,J-2*j,Z-2*j),t.stroke()}t.fillStyle=R,t.strokeStyle=L,t.lineWidth=I,t.setLineDash&&t.setLineDash([])}var te=2*e.pstyle("text-outline-width").pfValue;if(te>0&&(t.lineWidth=te),e.pstyle("text-wrap").value==="wrap"){var ne=Et(o,"labelWrapCachedLines",r),Q=Et(o,"labelLineHeight",r),V=h/2,H=this.getLabelJustification(e);switch(H==="auto"||(b==="left"?H==="left"?u+=-h:H==="center"&&(u+=-V):b==="center"?H==="left"?u+=-V:H==="right"&&(u+=V):b==="right"&&(H==="center"?u+=V:H==="right"&&(u+=h))),w){case"top":l-=(ne.length-1)*Q;break;case"center":case"bottom":l-=(ne.length-1)*Q;break}for(var G=0;G<ne.length;G++)te>0&&t.strokeText(ne[G],u,l),t.fillText(ne[G],u,l),l+=Q}else te>0&&t.strokeText(v,u,l),t.fillText(v,u,l);E!==0&&(t.rotate(-E),t.translate(-f,-c))}}};var mr={};mr.drawNode=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s,u,l=e._private,f=l.rscratch,c=e.position();if(!(!ae(c.x)||!ae(c.y))&&!(i&&!e.visible())){var v=i?e.effectiveOpacity():1,d=o.usePaths(),h,y=!1,g=e.padding();s=e.width()+2*g,u=e.height()+2*g;var p;r&&(p=r,t.translate(-p.x1,-p.y1));for(var m=e.pstyle("background-image"),b=m.value,w=new Array(b.length),E=new Array(b.length),C=0,x=0;x<b.length;x++){var T=b[x],k=w[x]=T!=null&&T!=="none";if(k){var B=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",x);C++,E[x]=o.getCachedImage(T,B,function(){l.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var D=e.pstyle("background-blacken").value,P=e.pstyle("border-width").pfValue,A=e.pstyle("background-opacity").value*v,R=e.pstyle("border-color").value,L=e.pstyle("border-style").value,I=e.pstyle("border-join").value,M=e.pstyle("border-cap").value,O=e.pstyle("border-position").value,q=e.pstyle("border-dash-pattern").pfValue,$=e.pstyle("border-dash-offset").pfValue,N=e.pstyle("border-opacity").value*v,F=e.pstyle("outline-width").pfValue,W=e.pstyle("outline-color").value,J=e.pstyle("outline-style").value,Z=e.pstyle("outline-opacity").value*v,j=e.pstyle("outline-offset").value,te=e.pstyle("corner-radius").value;te!=="auto"&&(te=e.pstyle("corner-radius").pfValue);var ne=function(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:A;o.eleFillStyle(t,e,S)},Q=function(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:N;o.colorStrokeStyle(t,R[0],R[1],R[2],S)},V=function(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Z;o.colorStrokeStyle(t,W[0],W[1],W[2],S)},H=function(S,z,_,U){var K=o.nodePathCache=o.nodePathCache||[],ue=Cf(_==="polygon"?_+","+U.join(","):_,""+z,""+S,""+te),ee=K[ue],ie,se=!1;return ee!=null?(ie=ee,se=!0,f.pathCache=ie):(ie=new Path2D,K[ue]=f.pathCache=ie),{path:ie,cacheHit:se}},G=e.pstyle("shape").strValue,Y=e.pstyle("shape-polygon-points").pfValue;if(d){t.translate(c.x,c.y);var re=H(s,u,G,Y);h=re.path,y=re.cacheHit}var ve=function(){if(!y){var S=c;d&&(S={x:0,y:0}),o.nodeShapes[o.getNodeShape(e)].draw(h||t,S.x,S.y,s,u,te,f)}d?t.fill(h):t.fill()},De=function(){for(var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:v,z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,_=l.backgrounding,U=0,K=0;K<E.length;K++){var ue=e.cy().style().getIndexedStyle(e,"background-image-containment","value",K);if(z&&ue==="over"||!z&&ue==="inside"){U++;continue}w[K]&&E[K].complete&&!E[K].error&&(U++,o.drawInscribedImage(t,E[K],e,K,S))}l.backgrounding=U!==C,_!==l.backgrounding&&e.updateStyle(!1)},we=function(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:v;o.hasPie(e)&&(o.drawPie(t,e,z),S&&(d||o.nodeShapes[o.getNodeShape(e)].draw(t,c.x,c.y,s,u,te,f)))},me=function(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:v;o.hasStripe(e)&&(t.save(),d?t.clip(f.pathCache):(o.nodeShapes[o.getNodeShape(e)].draw(t,c.x,c.y,s,u,te,f),t.clip()),o.drawStripe(t,e,z),t.restore(),S&&(d||o.nodeShapes[o.getNodeShape(e)].draw(t,c.x,c.y,s,u,te,f)))},ge=function(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:v,z=(D>0?D:-D)*S,_=D>0?0:255;D!==0&&(o.colorFillStyle(t,_,_,_,z),d?t.fill(h):t.fill())},oe=function(){if(P>0){if(t.lineWidth=P,t.lineCap=M,t.lineJoin=I,t.setLineDash)switch(L){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash(q),t.lineDashOffset=$;break;case"solid":case"double":t.setLineDash([]);break}if(O!=="center"){if(t.save(),t.lineWidth*=2,O==="inside")d?t.clip(h):t.clip();else{var S=new Path2D;S.rect(-s/2-P,-u/2-P,s+2*P,u+2*P),S.addPath(h),t.clip(S,"evenodd")}d?t.stroke(h):t.stroke(),t.restore()}else d?t.stroke(h):t.stroke();if(L==="double"){t.lineWidth=P/3;var z=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",d?t.stroke(h):t.stroke(),t.globalCompositeOperation=z}t.setLineDash&&t.setLineDash([])}},de=function(){if(F>0){if(t.lineWidth=F,t.lineCap="butt",t.setLineDash)switch(J){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var S=c;d&&(S={x:0,y:0});var z=o.getNodeShape(e),_=P;O==="inside"&&(_=0),O==="outside"&&(_*=2);var U=(s+_+(F+j))/s,K=(u+_+(F+j))/u,ue=s*U,ee=u*K,ie=o.nodeShapes[z].points,se;if(d){var pe=H(ue,ee,z,ie);se=pe.path}if(z==="ellipse")o.drawEllipsePath(se||t,S.x,S.y,ue,ee);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(z)){var Ee=0,Ce=0,fe=0;z==="round-diamond"?Ee=(_+j+F)*1.4:z==="round-heptagon"?(Ee=(_+j+F)*1.075,fe=-(_/2+j+F)/35):z==="round-hexagon"?Ee=(_+j+F)*1.12:z==="round-pentagon"?(Ee=(_+j+F)*1.13,fe=-(_/2+j+F)/15):z==="round-tag"?(Ee=(_+j+F)*1.12,Ce=(_/2+F+j)*.07):z==="round-triangle"&&(Ee=(_+j+F)*(Math.PI/2),fe=-(_+j/2+F)/Math.PI),Ee!==0&&(U=(s+Ee)/s,ue=s*U,["round-hexagon","round-tag"].includes(z)||(K=(u+Ee)/u,ee=u*K)),te=te==="auto"?Lf(ue,ee):te;for(var ke=ue/2,Pe=ee/2,nt=te+(_+F+j)/2,Ke=new Array(ie.length/2),At=new Array(ie.length/2),Xe=0;Xe<ie.length/2;Xe++)Ke[Xe]={x:S.x+Ce+ke*ie[Xe*2],y:S.y+fe+Pe*ie[Xe*2+1]};var Ze,je,lt,zt,Ue=Ke.length;for(je=Ke[Ue-1],Ze=0;Ze<Ue;Ze++)lt=Ke[Ze%Ue],zt=Ke[(Ze+1)%Ue],At[Ze]=ws(je,lt,zt,nt),je=lt,lt=zt;o.drawRoundPolygonPath(se||t,S.x+Ce,S.y+fe,s*U,u*K,ie,At)}else if(["roundrectangle","round-rectangle"].includes(z))te=te==="auto"?fr(ue,ee):te,o.drawRoundRectanglePath(se||t,S.x,S.y,ue,ee,te+(_+F+j)/2);else if(["cutrectangle","cut-rectangle"].includes(z))te=te==="auto"?us():te,o.drawCutRectanglePath(se||t,S.x,S.y,ue,ee,null,te+(_+F+j)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(z))te=te==="auto"?fr(ue,ee):te,o.drawBottomRoundRectanglePath(se||t,S.x,S.y,ue,ee,te+(_+F+j)/2);else if(z==="barrel")o.drawBarrelPath(se||t,S.x,S.y,ue,ee);else if(z.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(z)){var Ut=(_+F+j)/s;ie=Cn(Tn(ie,Ut)),o.drawPolygonPath(se||t,S.x,S.y,s,u,ie)}else{var Rt=(_+F+j)/s;ie=Cn(Tn(ie,-Rt)),o.drawPolygonPath(se||t,S.x,S.y,s,u,ie)}if(d?t.stroke(se):t.stroke(),J==="double"){t.lineWidth=_/3;var jt=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",d?t.stroke(se):t.stroke(),t.globalCompositeOperation=jt}t.setLineDash&&t.setLineDash([])}},ce=function(){n&&o.drawNodeOverlay(t,e,c,s,u)},xe=function(){n&&o.drawNodeUnderlay(t,e,c,s,u)},be=function(){o.drawElementText(t,e,null,a)},Se=e.pstyle("ghost").value==="yes";if(Se){var Be=e.pstyle("ghost-offset-x").pfValue,Oe=e.pstyle("ghost-offset-y").pfValue,Le=e.pstyle("ghost-opacity").value,Ae=Le*v;t.translate(Be,Oe),V(),de(),ne(Le*A),ve(),De(Ae,!0),Q(Le*N),oe(),we(D!==0||P!==0),me(D!==0||P!==0),De(Ae,!1),ge(Ae),t.translate(-Be,-Oe)}d&&t.translate(-c.x,-c.y),xe(),d&&t.translate(c.x,c.y),V(),de(),ne(),ve(),De(v,!0),Q(),oe(),we(D!==0||P!==0),me(D!==0||P!==0),De(v,!1),ge(),d&&t.translate(-c.x,-c.y),be(),ce(),r&&t.translate(p.x1,p.y1)}};var qc=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a,n,i,o){var s=this;if(a.visible()){var u=a.pstyle("".concat(e,"-padding")).pfValue,l=a.pstyle("".concat(e,"-opacity")).value,f=a.pstyle("".concat(e,"-color")).value,c=a.pstyle("".concat(e,"-shape")).value,v=a.pstyle("".concat(e,"-corner-radius")).value;if(l>0){if(n=n||a.position(),i==null||o==null){var d=a.padding();i=a.width()+2*d,o=a.height()+2*d}s.colorFillStyle(r,f[0],f[1],f[2],l),s.nodeShapes[c].draw(r,n.x,n.y,i+u*2,o+u*2,v),r.fill()}}}};mr.drawNodeOverlay=qc("overlay");mr.drawNodeUnderlay=qc("underlay");mr.hasPie=function(t){return t=t[0],t._private.hasPie};mr.hasStripe=function(t){return t=t[0],t._private.hasStripe};mr.drawPie=function(t,e,r,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=e.pstyle("pie-size"),o=e.pstyle("pie-hole"),s=e.pstyle("pie-start-angle").pfValue,u=a.x,l=a.y,f=e.width(),c=e.height(),v=Math.min(f,c)/2,d,h=0,y=this.usePaths();if(y&&(u=0,l=0),i.units==="%"?v=v*i.pfValue:i.pfValue!==void 0&&(v=i.pfValue/2),o.units==="%"?d=v*o.pfValue:o.pfValue!==void 0&&(d=o.pfValue/2),!(d>=v))for(var g=1;g<=n.pieBackgroundN;g++){var p=e.pstyle("pie-"+g+"-background-size").value,m=e.pstyle("pie-"+g+"-background-color").value,b=e.pstyle("pie-"+g+"-background-opacity").value*r,w=p/100;w+h>1&&(w=1-h);var E=1.5*Math.PI+2*Math.PI*h;E+=s;var C=2*Math.PI*w,x=E+C;p===0||h>=1||h+w>1||(d===0?(t.beginPath(),t.moveTo(u,l),t.arc(u,l,v,E,x),t.closePath()):(t.beginPath(),t.arc(u,l,v,E,x),t.arc(u,l,d,x,E,!0),t.closePath()),this.colorFillStyle(t,m[0],m[1],m[2],b),t.fill(),h+=w)}};mr.drawStripe=function(t,e,r,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=a.x,o=a.y,s=e.width(),u=e.height(),l=0,f=this.usePaths();t.save();var c=e.pstyle("stripe-direction").value,v=e.pstyle("stripe-size");switch(c){case"vertical":break;case"righward":t.rotate(-Math.PI/2);break}var d=s,h=u;v.units==="%"?(d=d*v.pfValue,h=h*v.pfValue):v.pfValue!==void 0&&(d=v.pfValue,h=v.pfValue),f&&(i=0,o=0),o-=d/2,i-=h/2;for(var y=1;y<=n.stripeBackgroundN;y++){var g=e.pstyle("stripe-"+y+"-background-size").value,p=e.pstyle("stripe-"+y+"-background-color").value,m=e.pstyle("stripe-"+y+"-background-opacity").value*r,b=g/100;b+l>1&&(b=1-l),!(g===0||l>=1||l+b>1)&&(t.beginPath(),t.rect(i,o+h*l,d,h*b),t.closePath(),this.colorFillStyle(t,p[0],p[1],p[2],m),t.fill(),l+=b)}t.restore()};var bt={},lm=100;bt.getPixelRatio=function(){var t=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),r=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/r};bt.paintCache=function(t){for(var e=this.paintCaches=this.paintCaches||[],r=!0,a,n=0;n<e.length;n++)if(a=e[n],a.context===t){r=!1;break}return r&&(a={context:t},e.push(a)),a};bt.createGradientStyleFor=function(t,e,r,a,n){var i,o=this.usePaths(),s=r.pstyle(e+"-gradient-stop-colors").value,u=r.pstyle(e+"-gradient-stop-positions").pfValue;if(a==="radial-gradient")if(r.isEdge()){var l=r.sourceEndpoint(),f=r.targetEndpoint(),c=r.midpoint(),v=Rr(l,c),d=Rr(f,c);i=t.createRadialGradient(c.x,c.y,0,c.x,c.y,Math.max(v,d))}else{var h=o?{x:0,y:0}:r.position(),y=r.paddedWidth(),g=r.paddedHeight();i=t.createRadialGradient(h.x,h.y,0,h.x,h.y,Math.max(y,g))}else if(r.isEdge()){var p=r.sourceEndpoint(),m=r.targetEndpoint();i=t.createLinearGradient(p.x,p.y,m.x,m.y)}else{var b=o?{x:0,y:0}:r.position(),w=r.paddedWidth(),E=r.paddedHeight(),C=w/2,x=E/2,T=r.pstyle("background-gradient-direction").value;switch(T){case"to-bottom":i=t.createLinearGradient(b.x,b.y-x,b.x,b.y+x);break;case"to-top":i=t.createLinearGradient(b.x,b.y+x,b.x,b.y-x);break;case"to-left":i=t.createLinearGradient(b.x+C,b.y,b.x-C,b.y);break;case"to-right":i=t.createLinearGradient(b.x-C,b.y,b.x+C,b.y);break;case"to-bottom-right":case"to-right-bottom":i=t.createLinearGradient(b.x-C,b.y-x,b.x+C,b.y+x);break;case"to-top-right":case"to-right-top":i=t.createLinearGradient(b.x-C,b.y+x,b.x+C,b.y-x);break;case"to-bottom-left":case"to-left-bottom":i=t.createLinearGradient(b.x+C,b.y-x,b.x-C,b.y+x);break;case"to-top-left":case"to-left-top":i=t.createLinearGradient(b.x+C,b.y+x,b.x-C,b.y-x);break}}if(!i)return null;for(var k=u.length===s.length,B=s.length,D=0;D<B;D++)i.addColorStop(k?u[D]:D/(B-1),"rgba("+s[D][0]+","+s[D][1]+","+s[D][2]+","+n+")");return i};bt.gradientFillStyle=function(t,e,r,a){var n=this.createGradientStyleFor(t,"background",e,r,a);if(!n)return null;t.fillStyle=n};bt.colorFillStyle=function(t,e,r,a,n){t.fillStyle="rgba("+e+","+r+","+a+","+n+")"};bt.eleFillStyle=function(t,e,r){var a=e.pstyle("background-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientFillStyle(t,e,a,r);else{var n=e.pstyle("background-color").value;this.colorFillStyle(t,n[0],n[1],n[2],r)}};bt.gradientStrokeStyle=function(t,e,r,a){var n=this.createGradientStyleFor(t,"line",e,r,a);if(!n)return null;t.strokeStyle=n};bt.colorStrokeStyle=function(t,e,r,a,n){t.strokeStyle="rgba("+e+","+r+","+a+","+n+")"};bt.eleStrokeStyle=function(t,e,r){var a=e.pstyle("line-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientStrokeStyle(t,e,a,r);else{var n=e.pstyle("line-color").value;this.colorStrokeStyle(t,n[0],n[1],n[2],r)}};bt.matchCanvasSize=function(t){var e=this,r=e.data,a=e.findContainerClientCoords(),n=a[2],i=a[3],o=e.getPixelRatio(),s=e.motionBlurPxRatio;(t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(o=s);var u=n*o,l=i*o,f;if(!(u===e.canvasWidth&&l===e.canvasHeight)){e.fontCaches=null;var c=r.canvasContainer;c.style.width=n+"px",c.style.height=i+"px";for(var v=0;v<e.CANVAS_LAYERS;v++)f=r.canvases[v],f.width=u,f.height=l,f.style.width=n+"px",f.style.height=i+"px";for(var v=0;v<e.BUFFER_COUNT;v++)f=r.bufferCanvases[v],f.width=u,f.height=l,f.style.width=n+"px",f.style.height=i+"px";e.textureMult=1,o<=1&&(f=r.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,f.width=u*e.textureMult,f.height=l*e.textureMult),e.canvasWidth=u,e.canvasHeight=l,e.pixelRatio=o}};bt.renderTo=function(t,e,r,a){this.render({forcedContext:t,forcedZoom:e,forcedPan:r,drawAllLayers:!0,forcedPxRatio:a})};bt.clearCanvas=function(){var t=this,e=t.data;function r(a){a.clearRect(0,0,t.canvasWidth,t.canvasHeight)}r(e.contexts[t.NODE]),r(e.contexts[t.DRAG])};bt.render=function(t){var e=this;t=t||Bf();var r=e.cy,a=t.forcedContext,n=t.drawAllLayers,i=t.drawOnlyNodeLayer,o=t.forcedZoom,s=t.forcedPan,u=t.forcedPxRatio===void 0?this.getPixelRatio():t.forcedPxRatio,l=e.data,f=l.canvasNeedsRedraw,c=e.textureOnViewport&&!a&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),v=t.motionBlur!==void 0?t.motionBlur:e.motionBlur,d=e.motionBlurPxRatio,h=r.hasCompoundNodes(),y=e.hoverData.draggingEles,g=!!(e.hoverData.selecting||e.touchData.selecting);v=v&&!a&&e.motionBlurEnabled&&!g;var p=v;a||(e.prevPxRatio!==u&&(e.invalidateContainerClientCoordsCache(),e.matchCanvasSize(e.container),e.redrawHint("eles",!0),e.redrawHint("drag",!0)),e.prevPxRatio=u),!a&&e.motionBlurTimeout&&clearTimeout(e.motionBlurTimeout),v&&(e.mbFrames==null&&(e.mbFrames=0),e.mbFrames++,e.mbFrames<3&&(p=!1),e.mbFrames>e.minMbLowQualFrames&&(e.motionBlurPxRatio=e.mbPxRBlurry)),e.clearingMotionBlur&&(e.motionBlurPxRatio=1),e.textureDrawLastFrame&&!c&&(f[e.NODE]=!0,f[e.SELECT_BOX]=!0);var m=r.style(),b=r.zoom(),w=o!==void 0?o:b,E=r.pan(),C={x:E.x,y:E.y},x={zoom:b,pan:{x:E.x,y:E.y}},T=e.prevViewport,k=T===void 0||x.zoom!==T.zoom||x.pan.x!==T.pan.x||x.pan.y!==T.pan.y;!k&&!(y&&!h)&&(e.motionBlurPxRatio=1),s&&(C=s),w*=u,C.x*=u,C.y*=u;var B=e.getCachedZSortedEles();function D(Q,V,H,G,Y){var re=Q.globalCompositeOperation;Q.globalCompositeOperation="destination-out",e.colorFillStyle(Q,255,255,255,e.motionBlurTransparency),Q.fillRect(V,H,G,Y),Q.globalCompositeOperation=re}function P(Q,V){var H,G,Y,re;!e.clearingMotionBlur&&(Q===l.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||Q===l.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(H={x:E.x*d,y:E.y*d},G=b*d,Y=e.canvasWidth*d,re=e.canvasHeight*d):(H=C,G=w,Y=e.canvasWidth,re=e.canvasHeight),Q.setTransform(1,0,0,1,0,0),V==="motionBlur"?D(Q,0,0,Y,re):!a&&(V===void 0||V)&&Q.clearRect(0,0,Y,re),n||(Q.translate(H.x,H.y),Q.scale(G,G)),s&&Q.translate(s.x,s.y),o&&Q.scale(o,o)}if(c||(e.textureDrawLastFrame=!1),c){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=r.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var A=e.data.bufferContexts[e.TEXTURE_BUFFER];A.setTransform(1,0,0,1,0,0),A.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:A,drawOnlyNodeLayer:!0,forcedPxRatio:u*e.textureMult});var x=e.textureCache.viewport={zoom:r.zoom(),pan:r.pan(),width:e.canvasWidth,height:e.canvasHeight};x.mpan={x:(0-x.pan.x)/x.zoom,y:(0-x.pan.y)/x.zoom}}f[e.DRAG]=!1,f[e.NODE]=!1;var R=l.contexts[e.NODE],L=e.textureCache.texture,x=e.textureCache.viewport;R.setTransform(1,0,0,1,0,0),v?D(R,0,0,x.width,x.height):R.clearRect(0,0,x.width,x.height);var I=m.core("outside-texture-bg-color").value,M=m.core("outside-texture-bg-opacity").value;e.colorFillStyle(R,I[0],I[1],I[2],M),R.fillRect(0,0,x.width,x.height);var b=r.zoom();P(R,!1),R.clearRect(x.mpan.x,x.mpan.y,x.width/x.zoom/u,x.height/x.zoom/u),R.drawImage(L,x.mpan.x,x.mpan.y,x.width/x.zoom/u,x.height/x.zoom/u)}else e.textureOnViewport&&!a&&(e.textureCache=null);var O=r.extent(),q=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),$=e.hideEdgesOnViewport&&q,N=[];if(N[e.NODE]=!f[e.NODE]&&v&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,N[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),N[e.DRAG]=!f[e.DRAG]&&v&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,N[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),f[e.NODE]||n||i||N[e.NODE]){var F=v&&!N[e.NODE]&&d!==1,R=a||(F?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:l.contexts[e.NODE]),W=v&&!F?"motionBlur":void 0;P(R,W),$?e.drawCachedNodes(R,B.nondrag,u,O):e.drawLayeredElements(R,B.nondrag,u,O),e.debug&&e.drawDebugPoints(R,B.nondrag),!n&&!v&&(f[e.NODE]=!1)}if(!i&&(f[e.DRAG]||n||N[e.DRAG])){var F=v&&!N[e.DRAG]&&d!==1,R=a||(F?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:l.contexts[e.DRAG]);P(R,v&&!F?"motionBlur":void 0),$?e.drawCachedNodes(R,B.drag,u,O):e.drawCachedElements(R,B.drag,u,O),e.debug&&e.drawDebugPoints(R,B.drag),!n&&!v&&(f[e.DRAG]=!1)}if(this.drawSelectionRectangle(t,P),v&&d!==1){var J=l.contexts[e.NODE],Z=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],j=l.contexts[e.DRAG],te=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],ne=function(V,H,G){V.setTransform(1,0,0,1,0,0),G||!p?V.clearRect(0,0,e.canvasWidth,e.canvasHeight):D(V,0,0,e.canvasWidth,e.canvasHeight);var Y=d;V.drawImage(H,0,0,e.canvasWidth*Y,e.canvasHeight*Y,0,0,e.canvasWidth,e.canvasHeight)};(f[e.NODE]||N[e.NODE])&&(ne(J,Z,N[e.NODE]),f[e.NODE]=!1),(f[e.DRAG]||N[e.DRAG])&&(ne(j,te,N[e.DRAG]),f[e.DRAG]=!1)}e.prevViewport=x,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),v&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!c,e.mbFrames=0,f[e.NODE]=!0,f[e.DRAG]=!0,e.redraw()},lm)),a||r.emit("render")};var ga;bt.drawSelectionRectangle=function(t,e){var r=this,a=r.cy,n=r.data,i=a.style(),o=t.drawOnlyNodeLayer,s=t.drawAllLayers,u=n.canvasNeedsRedraw,l=t.forcedContext;if(r.showFps||!o&&u[r.SELECT_BOX]&&!s){var f=l||n.contexts[r.SELECT_BOX];if(e(f),r.selection[4]==1&&(r.hoverData.selecting||r.touchData.selecting)){var c=r.cy.zoom(),v=i.core("selection-box-border-width").value/c;f.lineWidth=v,f.fillStyle="rgba("+i.core("selection-box-color").value[0]+","+i.core("selection-box-color").value[1]+","+i.core("selection-box-color").value[2]+","+i.core("selection-box-opacity").value+")",f.fillRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]),v>0&&(f.strokeStyle="rgba("+i.core("selection-box-border-color").value[0]+","+i.core("selection-box-border-color").value[1]+","+i.core("selection-box-border-color").value[2]+","+i.core("selection-box-opacity").value+")",f.strokeRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]))}if(n.bgActivePosistion&&!r.hoverData.selecting){var c=r.cy.zoom(),d=n.bgActivePosistion;f.fillStyle="rgba("+i.core("active-bg-color").value[0]+","+i.core("active-bg-color").value[1]+","+i.core("active-bg-color").value[2]+","+i.core("active-bg-opacity").value+")",f.beginPath(),f.arc(d.x,d.y,i.core("active-bg-size").pfValue/c,0,2*Math.PI),f.fill()}var h=r.lastRedrawTime;if(r.showFps&&h){h=Math.round(h);var y=Math.round(1e3/h),g="1 frame = "+h+" ms = "+y+" fps";if(f.setTransform(1,0,0,1,0,0),f.fillStyle="rgba(255, 0, 0, 0.75)",f.strokeStyle="rgba(255, 0, 0, 0.75)",f.font="30px Arial",!ga){var p=f.measureText(g);ga=p.actualBoundingBoxAscent}f.fillText(g,0,ga);var m=60;f.strokeRect(0,ga+10,250,20),f.fillRect(0,ga+10,250*Math.min(y/m,1),20)}s||(u[r.SELECT_BOX]=!1)}};function ju(t,e,r){var a=t.createShader(e);if(t.shaderSource(a,r),t.compileShader(a),!t.getShaderParameter(a,t.COMPILE_STATUS))throw new Error(t.getShaderInfoLog(a));return a}function um(t,e,r){var a=ju(t,t.VERTEX_SHADER,e),n=ju(t,t.FRAGMENT_SHADER,r),i=t.createProgram();if(t.attachShader(i,a),t.attachShader(i,n),t.linkProgram(i),!t.getProgramParameter(i,t.LINK_STATUS))throw new Error("Could not initialize shaders");return i}function fm(t,e,r){r===void 0&&(r=e);var a=t.makeOffscreenCanvas(e,r),n=a.context=a.getContext("2d");return a.clear=function(){return n.clearRect(0,0,a.width,a.height)},a.clear(),a}function Cs(t){var e=t.pixelRatio,r=t.cy.zoom(),a=t.cy.pan();return{zoom:r*e,pan:{x:a.x*e,y:a.y*e}}}function cm(t){var e=t.pixelRatio,r=t.cy.zoom();return r*e}function vm(t,e,r,a,n){var i=a*r+e.x,o=n*r+e.y;return o=Math.round(t.canvasHeight-o),[i,o]}function dm(t,e){return e.picking?!0:t.pstyle("background-fill").value!=="solid"||t.pstyle("background-image").strValue!=="none"?!1:t.pstyle("border-width").value===0||t.pstyle("border-opacity").value===0?!0:t.pstyle("border-style").value==="solid"}function hm(t,e){if(t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function Cr(t,e,r){var a=t[0]/255,n=t[1]/255,i=t[2]/255,o=e,s=r||new Array(4);return s[0]=a*o,s[1]=n*o,s[2]=i*o,s[3]=o,s}function _r(t,e){var r=e||new Array(4);return r[0]=(t>>0&255)/255,r[1]=(t>>8&255)/255,r[2]=(t>>16&255)/255,r[3]=(t>>24&255)/255,r}function gm(t){return t[0]+(t[1]<<8)+(t[2]<<16)+(t[3]<<24)}function pm(t,e){var r=t.createTexture();return r.buffer=function(a){t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_NEAREST),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,a),t.generateMipmap(t.TEXTURE_2D),t.bindTexture(t.TEXTURE_2D,null)},r.deleteTexture=function(){t.deleteTexture(r)},r}function $c(t,e){switch(e){case"float":return[1,t.FLOAT,4];case"vec2":return[2,t.FLOAT,4];case"vec3":return[3,t.FLOAT,4];case"vec4":return[4,t.FLOAT,4];case"int":return[1,t.INT,4];case"ivec2":return[2,t.INT,4]}}function _c(t,e,r){switch(e){case t.FLOAT:return new Float32Array(r);case t.INT:return new Int32Array(r)}}function ym(t,e,r,a,n,i){switch(e){case t.FLOAT:return new Float32Array(r.buffer,i*a,n);case t.INT:return new Int32Array(r.buffer,i*a,n)}}function mm(t,e,r,a){var n=$c(t,e),i=Je(n,2),o=i[0],s=i[1],u=_c(t,s,a),l=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,l),t.bufferData(t.ARRAY_BUFFER,u,t.STATIC_DRAW),s===t.FLOAT?t.vertexAttribPointer(r,o,s,!1,0,0):s===t.INT&&t.vertexAttribIPointer(r,o,s,0,0),t.enableVertexAttribArray(r),t.bindBuffer(t.ARRAY_BUFFER,null),l}function Vt(t,e,r,a){var n=$c(t,r),i=Je(n,3),o=i[0],s=i[1],u=i[2],l=_c(t,s,e*o),f=o*u,c=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,c),t.bufferData(t.ARRAY_BUFFER,e*f,t.DYNAMIC_DRAW),t.enableVertexAttribArray(a),s===t.FLOAT?t.vertexAttribPointer(a,o,s,!1,f,0):s===t.INT&&t.vertexAttribIPointer(a,o,s,f,0),t.vertexAttribDivisor(a,1),t.bindBuffer(t.ARRAY_BUFFER,null);for(var v=new Array(e),d=0;d<e;d++)v[d]=ym(t,s,l,f,o,d);return c.dataArray=l,c.stride=f,c.size=o,c.getView=function(h){return v[h]},c.setPoint=function(h,y,g){var p=v[h];p[0]=y,p[1]=g},c.bufferSubData=function(h){t.bindBuffer(t.ARRAY_BUFFER,c),h?t.bufferSubData(t.ARRAY_BUFFER,0,l,0,h*o):t.bufferSubData(t.ARRAY_BUFFER,0,l)},c}function bm(t,e,r){for(var a=9,n=new Float32Array(e*a),i=new Array(e),o=0;o<e;o++){var s=o*a*4;i[o]=new Float32Array(n.buffer,s,a)}var u=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,u),t.bufferData(t.ARRAY_BUFFER,n.byteLength,t.DYNAMIC_DRAW);for(var l=0;l<3;l++){var f=r+l;t.enableVertexAttribArray(f),t.vertexAttribPointer(f,3,t.FLOAT,!1,36,l*12),t.vertexAttribDivisor(f,1)}return t.bindBuffer(t.ARRAY_BUFFER,null),u.getMatrixView=function(c){return i[c]},u.setData=function(c,v){i[v].set(c,0)},u.bufferSubData=function(){t.bindBuffer(t.ARRAY_BUFFER,u),t.bufferSubData(t.ARRAY_BUFFER,0,n)},u}function wm(t){var e=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,e);var r=t.createTexture();return t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0),t.bindFramebuffer(t.FRAMEBUFFER,null),e.setFramebufferAttachmentSizes=function(a,n){t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,a,n,0,t.RGBA,t.UNSIGNED_BYTE,null)},e}var ef=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});function Bo(){var t=new ef(9);return ef!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function tf(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function xm(t,e,r){var a=e[0],n=e[1],i=e[2],o=e[3],s=e[4],u=e[5],l=e[6],f=e[7],c=e[8],v=r[0],d=r[1],h=r[2],y=r[3],g=r[4],p=r[5],m=r[6],b=r[7],w=r[8];return t[0]=v*a+d*o+h*l,t[1]=v*n+d*s+h*f,t[2]=v*i+d*u+h*c,t[3]=y*a+g*o+p*l,t[4]=y*n+g*s+p*f,t[5]=y*i+g*u+p*c,t[6]=m*a+b*o+w*l,t[7]=m*n+b*s+w*f,t[8]=m*i+b*u+w*c,t}function mn(t,e,r){var a=e[0],n=e[1],i=e[2],o=e[3],s=e[4],u=e[5],l=e[6],f=e[7],c=e[8],v=r[0],d=r[1];return t[0]=a,t[1]=n,t[2]=i,t[3]=o,t[4]=s,t[5]=u,t[6]=v*a+d*o+l,t[7]=v*n+d*s+f,t[8]=v*i+d*u+c,t}function rf(t,e,r){var a=e[0],n=e[1],i=e[2],o=e[3],s=e[4],u=e[5],l=e[6],f=e[7],c=e[8],v=Math.sin(r),d=Math.cos(r);return t[0]=d*a+v*o,t[1]=d*n+v*s,t[2]=d*i+v*u,t[3]=d*o-v*a,t[4]=d*s-v*n,t[5]=d*u-v*i,t[6]=l,t[7]=f,t[8]=c,t}function Yo(t,e,r){var a=r[0],n=r[1];return t[0]=a*e[0],t[1]=a*e[1],t[2]=a*e[2],t[3]=n*e[3],t[4]=n*e[4],t[5]=n*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function Em(t,e,r){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/r,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}var Cm=(function(){function t(e,r,a,n){gr(this,t),this.debugID=Math.floor(Math.random()*1e4),this.r=e,this.texSize=r,this.texRows=a,this.texHeight=Math.floor(r/a),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=n(e,r,r),this.scratch=n(e,r,this.texHeight,"scratch")}return pr(t,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(r){var a=r.w,n=r.h,i=this.texHeight,o=this.texSize,s=i/n,u=a*s,l=n*s;return u>o&&(s=o/a,u=a*s,l=n*s),{scale:s,texW:u,texH:l}}},{key:"draw",value:function(r,a,n){var i=this;if(this.locked)throw new Error("can't draw, atlas is locked");var o=this.texSize,s=this.texRows,u=this.texHeight,l=this.getScale(a),f=l.scale,c=l.texW,v=l.texH,d=function(b,w){if(n&&w){var E=w.context,C=b.x,x=b.row,T=C,k=u*x;E.save(),E.translate(T,k),E.scale(f,f),n(E,a),E.restore()}},h=[null,null],y=function(){d(i.freePointer,i.canvas),h[0]={x:i.freePointer.x,y:i.freePointer.row*u,w:c,h:v},h[1]={x:i.freePointer.x+c,y:i.freePointer.row*u,w:0,h:v},i.freePointer.x+=c,i.freePointer.x==o&&(i.freePointer.x=0,i.freePointer.row++)},g=function(){var b=i.scratch,w=i.canvas;b.clear(),d({x:0,row:0},b);var E=o-i.freePointer.x,C=c-E,x=u;{var T=i.freePointer.x,k=i.freePointer.row*u,B=E;w.context.drawImage(b,0,0,B,x,T,k,B,x),h[0]={x:T,y:k,w:B,h:v}}{var D=E,P=(i.freePointer.row+1)*u,A=C;w&&w.context.drawImage(b,D,0,A,x,0,P,A,x),h[1]={x:0,y:P,w:A,h:v}}i.freePointer.x=C,i.freePointer.row++},p=function(){i.freePointer.x=0,i.freePointer.row++};if(this.freePointer.x+c<=o)y();else{if(this.freePointer.row>=s-1)return!1;this.freePointer.x===o?(p(),y()):this.enableWrapping?g():(p(),y())}return this.keyToLocation.set(r,h),this.needsBuffer=!0,h}},{key:"getOffsets",value:function(r){return this.keyToLocation.get(r)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(r){if(this.locked)return!1;var a=this.texSize,n=this.texRows,i=this.getScale(r),o=i.texW;return this.freePointer.x+o>a?this.freePointer.row<n-1:!0}},{key:"bufferIfNeeded",value:function(r){this.texture||(this.texture=pm(r,this.debugID)),this.needsBuffer&&(this.texture.buffer(this.canvas),this.needsBuffer=!1,this.locked&&(this.canvas=null,this.scratch=null))}},{key:"dispose",value:function(){this.texture&&(this.texture.deleteTexture(),this.texture=null),this.canvas=null,this.scratch=null,this.locked=!0}}])})(),Tm=(function(){function t(e,r,a,n){gr(this,t),this.r=e,this.texSize=r,this.texRows=a,this.createTextureCanvas=n,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return pr(t,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var r=this.r,a=this.texSize,n=this.texRows,i=this.createTextureCanvas;return new Cm(r,a,n,i)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var r=this.r,a=this.texSize,n=this.texRows,i=this.createTextureCanvas,o=Math.floor(a/n);this.scratch=i(r,a,o,"scratch")}return this.scratch}},{key:"draw",value:function(r,a,n){var i=this.styleKeyToAtlas.get(r);return i||(i=this.atlases[this.atlases.length-1],(!i||!i.canFit(a))&&(i&&i.lock(),i=this._createAtlas(),this.atlases.push(i)),i.draw(r,a,n),this.styleKeyToAtlas.set(r,i)),i}},{key:"getAtlas",value:function(r){return this.styleKeyToAtlas.get(r)}},{key:"hasAtlas",value:function(r){return this.styleKeyToAtlas.has(r)}},{key:"markKeyForGC",value:function(r){this.markedKeys.add(r)}},{key:"gc",value:function(){var r=this,a=this.markedKeys;if(a.size===0){console.log("nothing to garbage collect");return}var n=[],i=new Map,o=null,s=Tt(this.atlases),u;try{var l=function(){var c=u.value,v=c.getKeys(),d=Sm(a,v);if(d.size===0)return n.push(c),v.forEach(function(E){return i.set(E,c)}),1;o||(o=r._createAtlas(),n.push(o));var h=Tt(v),y;try{for(h.s();!(y=h.n()).done;){var g=y.value;if(!d.has(g)){var p=c.getOffsets(g),m=Je(p,2),b=m[0],w=m[1];o.canFit({w:b.w+w.w,h:b.h})||(o.lock(),o=r._createAtlas(),n.push(o)),c.canvas&&(r._copyTextureToNewAtlas(g,c,o),i.set(g,o))}}}catch(E){h.e(E)}finally{h.f()}c.dispose()};for(s.s();!(u=s.n()).done;)l()}catch(f){s.e(f)}finally{s.f()}this.atlases=n,this.styleKeyToAtlas=i,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(r,a,n){var i=a.getOffsets(r),o=Je(i,2),s=o[0],u=o[1];if(u.w===0)n.draw(r,s,function(v){v.drawImage(a.canvas,s.x,s.y,s.w,s.h,0,0,s.w,s.h)});else{var l=this._getScratchCanvas();l.clear(),l.context.drawImage(a.canvas,s.x,s.y,s.w,s.h,0,0,s.w,s.h),l.context.drawImage(a.canvas,u.x,u.y,u.w,u.h,s.w,0,u.w,u.h);var f=s.w+u.w,c=s.h;n.draw(r,{w:f,h:c},function(v){v.drawImage(l,0,0,f,c,0,0,f,c)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])})();function Sm(t,e){return t.intersection?t.intersection(e):new Set(bn(t).filter(function(r){return e.has(r)}))}var km=(function(){function t(e,r){gr(this,t),this.r=e,this.globalOptions=r,this.atlasSize=r.webglTexSize,this.maxAtlasesPerBatch=r.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map}return pr(t,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(r,a){var n=this.globalOptions,i=n.webglTexSize,o=n.createTextureCanvas,s=a.texRows,u=this._cacheScratchCanvas(o),l=new Tm(this.r,i,s,u);this.collections.set(r,l)}},{key:"addRenderType",value:function(r,a){var n=a.collection;if(!this.collections.has(n))throw new Error("invalid atlas collection name '".concat(n,"'"));var i=this.collections.get(n),o=ye({type:r,atlasCollection:i},a);this.renderTypes.set(r,o)}},{key:"getRenderTypeOpts",value:function(r){return this.renderTypes.get(r)}},{key:"getAtlasCollection",value:function(r){return this.collections.get(r)}},{key:"_cacheScratchCanvas",value:function(r){var a=-1,n=-1,i=null;return function(o,s,u,l){return l?((!i||s!=a||u!=n)&&(a=s,n=u,i=r(o,s,u)),i):r(o,s,u)}}},{key:"_key",value:function(r,a){return"".concat(r,"-").concat(a)}},{key:"invalidate",value:function(r){var a=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.forceRedraw,o=i===void 0?!1:i,s=n.filterEle,u=s===void 0?function(){return!0}:s,l=n.filterType,f=l===void 0?function(){return!0}:l,c=!1,v=!1,d=Tt(r),h;try{for(d.s();!(h=d.n()).done;){var y=h.value;if(u(y)){var g=Tt(this.renderTypes.values()),p;try{var m=function(){var w=p.value,E=w.type;if(f(E)){var C=a.collections.get(w.collection),x=w.getKey(y),T=Array.isArray(x)?x:[x];if(o)T.forEach(function(P){return C.markKeyForGC(P)}),v=!0;else{var k=w.getID?w.getID(y):y.id(),B=a._key(E,k),D=a.typeAndIdToKey.get(B);D!==void 0&&!hm(T,D)&&(c=!0,a.typeAndIdToKey.delete(B),D.forEach(function(P){return C.markKeyForGC(P)}))}}};for(g.s();!(p=g.n()).done;)m()}catch(b){g.e(b)}finally{g.f()}}}}catch(b){d.e(b)}finally{d.f()}return v&&(this.gc(),c=!1),c}},{key:"gc",value:function(){var r=Tt(this.collections.values()),a;try{for(r.s();!(a=r.n()).done;){var n=a.value;n.gc()}}catch(i){r.e(i)}finally{r.f()}}},{key:"getOrCreateAtlas",value:function(r,a,n,i){var o=this.renderTypes.get(a),s=this.collections.get(o.collection),u=!1,l=s.draw(i,n,function(v){o.drawClipped?(v.save(),v.beginPath(),v.rect(0,0,n.w,n.h),v.clip(),o.drawElement(v,r,n,!0,!0),v.restore()):o.drawElement(v,r,n,!0,!0),u=!0});if(u){var f=o.getID?o.getID(r):r.id(),c=this._key(a,f);this.typeAndIdToKey.has(c)?this.typeAndIdToKey.get(c).push(i):this.typeAndIdToKey.set(c,[i])}return l}},{key:"getAtlasInfo",value:function(r,a){var n=this,i=this.renderTypes.get(a),o=i.getKey(r),s=Array.isArray(o)?o:[o];return s.map(function(u){var l=i.getBoundingBox(r,u),f=n.getOrCreateAtlas(r,a,l,u),c=f.getOffsets(u),v=Je(c,2),d=v[0],h=v[1];return{atlas:f,tex:d,tex1:d,tex2:h,bb:l}})}},{key:"getDebugInfo",value:function(){var r=[],a=Tt(this.collections),n;try{for(a.s();!(n=a.n()).done;){var i=Je(n.value,2),o=i[0],s=i[1],u=s.getCounts(),l=u.keyCount,f=u.atlasCount;r.push({type:o,keyCount:l,atlasCount:f})}}catch(c){a.e(c)}finally{a.f()}return r}}])})(),Bm=(function(){function t(e){gr(this,t),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]}return pr(t,[{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(r,a){return a})}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(r){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(r):!0}},{key:"getAtlasIndexForBatch",value:function(r){var a=this.batchAtlases.indexOf(r);if(a<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(r),a=this.batchAtlases.length-1}return a}}])})(),Dm=`
8
+ float circleSD(vec2 p, float r) {
9
+ return distance(vec2(0), p) - r; // signed distance
10
+ }
11
+ `,Pm=`
12
+ float rectangleSD(vec2 p, vec2 b) {
13
+ vec2 d = abs(p)-b;
14
+ return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
15
+ }
16
+ `,Am=`
17
+ float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
18
+ cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
19
+ cr.x = (p.y > 0.0) ? cr.x : cr.y;
20
+ vec2 q = abs(p) - b + cr.x;
21
+ return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
22
+ }
23
+ `,Rm=`
24
+ float ellipseSD(vec2 p, vec2 ab) {
25
+ p = abs( p ); // symmetry
26
+
27
+ // find root with Newton solver
28
+ vec2 q = ab*(p-ab);
29
+ float w = (q.x<q.y)? 1.570796327 : 0.0;
30
+ for( int i=0; i<5; i++ ) {
31
+ vec2 cs = vec2(cos(w),sin(w));
32
+ vec2 u = ab*vec2( cs.x,cs.y);
33
+ vec2 v = ab*vec2(-cs.y,cs.x);
34
+ w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
35
+ }
36
+
37
+ // compute final point and distance
38
+ float d = length(p-ab*vec2(cos(w),sin(w)));
39
+
40
+ // return signed distance
41
+ return (dot(p/ab,p/ab)>1.0) ? d : -d;
42
+ }
43
+ `,Ca={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},Rn={IGNORE:1,USE_BB:2},Do=0,af=1,nf=2,Po=3,Hr=4,sn=5,pa=6,ya=7,Mm=(function(){function t(e,r,a){gr(this,t),this.r=e,this.gl=r,this.maxInstances=a.webglBatchSize,this.atlasSize=a.webglTexSize,this.bgColor=a.bgColor,this.debug=a.webglDebug,this.batchDebugInfo=[],a.enableWrapping=!0,a.createTextureCanvas=fm,this.atlasManager=new km(e,a),this.batchManager=new Bm(a),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(Ca.SCREEN),this.pickingProgram=this._createShaderProgram(Ca.PICKING),this.vao=this._createVAO()}return pr(t,[{key:"addAtlasCollection",value:function(r,a){this.atlasManager.addAtlasCollection(r,a)}},{key:"addTextureAtlasRenderType",value:function(r,a){this.atlasManager.addRenderType(r,a)}},{key:"addSimpleShapeRenderType",value:function(r,a){this.simpleShapeOptions.set(r,a)}},{key:"invalidate",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=a.type,i=this.atlasManager;return n?i.invalidate(r,{filterType:function(s){return s===n},forceRedraw:!0}):i.invalidate(r)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(r){var a=this.gl,n=`#version 300 es
44
+ precision highp float;
45
+
46
+ uniform mat3 uPanZoomMatrix;
47
+ uniform int uAtlasSize;
48
+
49
+ // instanced
50
+ in vec2 aPosition; // a vertex from the unit square
51
+
52
+ in mat3 aTransform; // used to transform verticies, eg into a bounding box
53
+ in int aVertType; // the type of thing we are rendering
54
+
55
+ // the z-index that is output when using picking mode
56
+ in vec4 aIndex;
57
+
58
+ // For textures
59
+ in int aAtlasId; // which shader unit/atlas to use
60
+ in vec4 aTex; // x/y/w/h of texture in atlas
61
+
62
+ // for edges
63
+ in vec4 aPointAPointB;
64
+ in vec4 aPointCPointD;
65
+ in vec2 aLineWidth; // also used for node border width
66
+
67
+ // simple shapes
68
+ in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
69
+ in vec4 aColor; // also used for edges
70
+ in vec4 aBorderColor; // aLineWidth is used for border width
71
+
72
+ // output values passed to the fragment shader
73
+ out vec2 vTexCoord;
74
+ out vec4 vColor;
75
+ out vec2 vPosition;
76
+ // flat values are not interpolated
77
+ flat out int vAtlasId;
78
+ flat out int vVertType;
79
+ flat out vec2 vTopRight;
80
+ flat out vec2 vBotLeft;
81
+ flat out vec4 vCornerRadius;
82
+ flat out vec4 vBorderColor;
83
+ flat out vec2 vBorderWidth;
84
+ flat out vec4 vIndex;
85
+
86
+ void main(void) {
87
+ int vid = gl_VertexID;
88
+ vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
89
+
90
+ if(aVertType == `.concat(Do,`) {
91
+ float texX = aTex.x; // texture coordinates
92
+ float texY = aTex.y;
93
+ float texW = aTex.z;
94
+ float texH = aTex.w;
95
+
96
+ if(vid == 1 || vid == 2 || vid == 4) {
97
+ texX += texW;
98
+ }
99
+ if(vid == 2 || vid == 4 || vid == 5) {
100
+ texY += texH;
101
+ }
102
+
103
+ float d = float(uAtlasSize);
104
+ vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
105
+
106
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
107
+ }
108
+ else if(aVertType == `).concat(Hr," || aVertType == ").concat(ya,`
109
+ || aVertType == `).concat(sn," || aVertType == ").concat(pa,`) { // simple shapes
110
+
111
+ // the bounding box is needed by the fragment shader
112
+ vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
113
+ vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
114
+ vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
115
+
116
+ // calculations are done in the fragment shader, just pass these along
117
+ vColor = aColor;
118
+ vCornerRadius = aCornerRadius;
119
+ vBorderColor = aBorderColor;
120
+ vBorderWidth = aLineWidth;
121
+
122
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
123
+ }
124
+ else if(aVertType == `).concat(af,`) {
125
+ vec2 source = aPointAPointB.xy;
126
+ vec2 target = aPointAPointB.zw;
127
+
128
+ // adjust the geometry so that the line is centered on the edge
129
+ position.y = position.y - 0.5;
130
+
131
+ // stretch the unit square into a long skinny rectangle
132
+ vec2 xBasis = target - source;
133
+ vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
134
+ vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
135
+
136
+ gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
137
+ vColor = aColor;
138
+ }
139
+ else if(aVertType == `).concat(nf,`) {
140
+ vec2 pointA = aPointAPointB.xy;
141
+ vec2 pointB = aPointAPointB.zw;
142
+ vec2 pointC = aPointCPointD.xy;
143
+ vec2 pointD = aPointCPointD.zw;
144
+
145
+ // adjust the geometry so that the line is centered on the edge
146
+ position.y = position.y - 0.5;
147
+
148
+ vec2 p0, p1, p2, pos;
149
+ if(position.x == 0.0) { // The left side of the unit square
150
+ p0 = pointA;
151
+ p1 = pointB;
152
+ p2 = pointC;
153
+ pos = position;
154
+ } else { // The right side of the unit square, use same approach but flip the geometry upside down
155
+ p0 = pointD;
156
+ p1 = pointC;
157
+ p2 = pointB;
158
+ pos = vec2(0.0, -position.y);
159
+ }
160
+
161
+ vec2 p01 = p1 - p0;
162
+ vec2 p12 = p2 - p1;
163
+ vec2 p21 = p1 - p2;
164
+
165
+ // Find the normal vector.
166
+ vec2 tangent = normalize(normalize(p12) + normalize(p01));
167
+ vec2 normal = vec2(-tangent.y, tangent.x);
168
+
169
+ // Find the vector perpendicular to p0 -> p1.
170
+ vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
171
+
172
+ // Determine the bend direction.
173
+ float sigma = sign(dot(p01 + p21, normal));
174
+ float width = aLineWidth[0];
175
+
176
+ if(sign(pos.y) == -sigma) {
177
+ // This is an intersecting vertex. Adjust the position so that there's no overlap.
178
+ vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
179
+ gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
180
+ } else {
181
+ // This is a non-intersecting vertex. Treat it like a mitre join.
182
+ vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
183
+ gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
184
+ }
185
+
186
+ vColor = aColor;
187
+ }
188
+ else if(aVertType == `).concat(Po,` && vid < 3) {
189
+ // massage the first triangle into an edge arrow
190
+ if(vid == 0)
191
+ position = vec2(-0.15, -0.3);
192
+ if(vid == 1)
193
+ position = vec2( 0.0, 0.0);
194
+ if(vid == 2)
195
+ position = vec2( 0.15, -0.3);
196
+
197
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
198
+ vColor = aColor;
199
+ }
200
+ else {
201
+ gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
202
+ }
203
+
204
+ vAtlasId = aAtlasId;
205
+ vVertType = aVertType;
206
+ vIndex = aIndex;
207
+ }
208
+ `),i=this.batchManager.getIndexArray(),o=`#version 300 es
209
+ precision highp float;
210
+
211
+ // declare texture unit for each texture atlas in the batch
212
+ `.concat(i.map(function(l){return"uniform sampler2D uTexture".concat(l,";")}).join(`
213
+ `),`
214
+
215
+ uniform vec4 uBGColor;
216
+ uniform float uZoom;
217
+
218
+ in vec2 vTexCoord;
219
+ in vec4 vColor;
220
+ in vec2 vPosition; // model coordinates
221
+
222
+ flat in int vAtlasId;
223
+ flat in vec4 vIndex;
224
+ flat in int vVertType;
225
+ flat in vec2 vTopRight;
226
+ flat in vec2 vBotLeft;
227
+ flat in vec4 vCornerRadius;
228
+ flat in vec4 vBorderColor;
229
+ flat in vec2 vBorderWidth;
230
+
231
+ out vec4 outColor;
232
+
233
+ `).concat(Dm,`
234
+ `).concat(Pm,`
235
+ `).concat(Am,`
236
+ `).concat(Rm,`
237
+
238
+ vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
239
+ return vec4(
240
+ top.rgb + (bot.rgb * (1.0 - top.a)),
241
+ top.a + (bot.a * (1.0 - top.a))
242
+ );
243
+ }
244
+
245
+ vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
246
+ // scale to the zoom level so that borders don't look blurry when zoomed in
247
+ // note 1.5 is an aribitrary value chosen because it looks good
248
+ return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
249
+ }
250
+
251
+ void main(void) {
252
+ if(vVertType == `).concat(Do,`) {
253
+ // look up the texel from the texture unit
254
+ `).concat(i.map(function(l){return"if(vAtlasId == ".concat(l,") outColor = texture(uTexture").concat(l,", vTexCoord);")}).join(`
255
+ else `),`
256
+ }
257
+ else if(vVertType == `).concat(Po,`) {
258
+ // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
259
+ outColor = blend(vColor, uBGColor);
260
+ outColor.a = 1.0; // make opaque, masks out line under arrow
261
+ }
262
+ else if(vVertType == `).concat(Hr,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
263
+ outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
264
+ }
265
+ else if(vVertType == `).concat(Hr," || vVertType == ").concat(ya,`
266
+ || vVertType == `).concat(sn," || vVertType == ").concat(pa,`) { // use SDF
267
+
268
+ float outerBorder = vBorderWidth[0];
269
+ float innerBorder = vBorderWidth[1];
270
+ float borderPadding = outerBorder * 2.0;
271
+ float w = vTopRight.x - vBotLeft.x - borderPadding;
272
+ float h = vTopRight.y - vBotLeft.y - borderPadding;
273
+ vec2 b = vec2(w/2.0, h/2.0); // half width, half height
274
+ vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
275
+
276
+ float d; // signed distance
277
+ if(vVertType == `).concat(Hr,`) {
278
+ d = rectangleSD(p, b);
279
+ } else if(vVertType == `).concat(ya,` && w == h) {
280
+ d = circleSD(p, b.x); // faster than ellipse
281
+ } else if(vVertType == `).concat(ya,`) {
282
+ d = ellipseSD(p, b);
283
+ } else {
284
+ d = roundRectangleSD(p, b, vCornerRadius.wzyx);
285
+ }
286
+
287
+ // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
288
+ // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
289
+ if(d > 0.0) {
290
+ if(d > outerBorder) {
291
+ discard;
292
+ } else {
293
+ outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
294
+ }
295
+ } else {
296
+ if(d > innerBorder) {
297
+ vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
298
+ vec4 innerBorderColor = blend(vBorderColor, vColor);
299
+ outColor = distInterp(innerBorderColor, outerColor, d);
300
+ }
301
+ else {
302
+ vec4 outerColor;
303
+ if(innerBorder == 0.0 && outerBorder == 0.0) {
304
+ outerColor = vec4(0);
305
+ } else if(innerBorder == 0.0) {
306
+ outerColor = vBorderColor;
307
+ } else {
308
+ outerColor = blend(vBorderColor, vColor);
309
+ }
310
+ outColor = distInterp(vColor, outerColor, d - innerBorder);
311
+ }
312
+ }
313
+ }
314
+ else {
315
+ outColor = vColor;
316
+ }
317
+
318
+ `).concat(r.picking?`if(outColor.a == 0.0) discard;
319
+ else outColor = vIndex;`:"",`
320
+ }
321
+ `),s=um(a,n,o);s.aPosition=a.getAttribLocation(s,"aPosition"),s.aIndex=a.getAttribLocation(s,"aIndex"),s.aVertType=a.getAttribLocation(s,"aVertType"),s.aTransform=a.getAttribLocation(s,"aTransform"),s.aAtlasId=a.getAttribLocation(s,"aAtlasId"),s.aTex=a.getAttribLocation(s,"aTex"),s.aPointAPointB=a.getAttribLocation(s,"aPointAPointB"),s.aPointCPointD=a.getAttribLocation(s,"aPointCPointD"),s.aLineWidth=a.getAttribLocation(s,"aLineWidth"),s.aColor=a.getAttribLocation(s,"aColor"),s.aCornerRadius=a.getAttribLocation(s,"aCornerRadius"),s.aBorderColor=a.getAttribLocation(s,"aBorderColor"),s.uPanZoomMatrix=a.getUniformLocation(s,"uPanZoomMatrix"),s.uAtlasSize=a.getUniformLocation(s,"uAtlasSize"),s.uBGColor=a.getUniformLocation(s,"uBGColor"),s.uZoom=a.getUniformLocation(s,"uZoom"),s.uTextures=[];for(var u=0;u<this.batchManager.getMaxAtlasesPerBatch();u++)s.uTextures.push(a.getUniformLocation(s,"uTexture".concat(u)));return s}},{key:"_createVAO",value:function(){var r=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=r.length/2;var a=this.maxInstances,n=this.gl,i=this.program,o=n.createVertexArray();return n.bindVertexArray(o),mm(n,"vec2",i.aPosition,r),this.transformBuffer=bm(n,a,i.aTransform),this.indexBuffer=Vt(n,a,"vec4",i.aIndex),this.vertTypeBuffer=Vt(n,a,"int",i.aVertType),this.atlasIdBuffer=Vt(n,a,"int",i.aAtlasId),this.texBuffer=Vt(n,a,"vec4",i.aTex),this.pointAPointBBuffer=Vt(n,a,"vec4",i.aPointAPointB),this.pointCPointDBuffer=Vt(n,a,"vec4",i.aPointCPointD),this.lineWidthBuffer=Vt(n,a,"vec2",i.aLineWidth),this.colorBuffer=Vt(n,a,"vec4",i.aColor),this.cornerRadiusBuffer=Vt(n,a,"vec4",i.aCornerRadius),this.borderColorBuffer=Vt(n,a,"vec4",i.aBorderColor),n.bindVertexArray(null),o}},{key:"buffers",get:function(){var r=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(a){return ar(a,"Buffer")}).map(function(a){return r[a]})),this._buffers}},{key:"startFrame",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ca.SCREEN;this.panZoomMatrix=r,this.renderTarget=a,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(r,a){return r.visible()?a&&a.isVisible?a.isVisible(r):!0:!1}},{key:"drawTexture",value:function(r,a,n){var i=this.atlasManager,o=this.batchManager,s=i.getRenderTypeOpts(n);if(this._isVisible(r,s)&&!(r.isEdge()&&!this._isValidEdge(r))){if(this.renderTarget.picking&&s.getTexPickingMode){var u=s.getTexPickingMode(r);if(u===Rn.IGNORE)return;if(u==Rn.USE_BB){this.drawPickingRectangle(r,a,n);return}}var l=i.getAtlasInfo(r,n),f=Tt(l),c;try{for(f.s();!(c=f.n()).done;){var v=c.value,d=v.atlas,h=v.tex1,y=v.tex2;o.canAddToCurrentBatch(d)||this.endBatch();for(var g=o.getAtlasIndexForBatch(d),p=0,m=[[h,!0],[y,!1]];p<m.length;p++){var b=Je(m[p],2),w=b[0],E=b[1];if(w.w!=0){var C=this.instanceCount;this.vertTypeBuffer.getView(C)[0]=Do;var x=this.indexBuffer.getView(C);_r(a,x);var T=this.atlasIdBuffer.getView(C);T[0]=g;var k=this.texBuffer.getView(C);k[0]=w.x,k[1]=w.y,k[2]=w.w,k[3]=w.h;var B=this.transformBuffer.getMatrixView(C);this.setTransformMatrix(r,B,s,v,E),this.instanceCount++,E||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(D){f.e(D)}finally{f.f()}}}},{key:"setTransformMatrix",value:function(r,a,n,i){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=0;if(n.shapeProps&&n.shapeProps.padding&&(s=r.pstyle(n.shapeProps.padding).pfValue),i){var u=i.bb,l=i.tex1,f=i.tex2,c=l.w/(l.w+f.w);o||(c=1-c);var v=this._getAdjustedBB(u,s,o,c);this._applyTransformMatrix(a,v,n,r)}else{var d=n.getBoundingBox(r),h=this._getAdjustedBB(d,s,!0,1);this._applyTransformMatrix(a,h,n,r)}}},{key:"_applyTransformMatrix",value:function(r,a,n,i){var o,s;tf(r);var u=n.getRotation?n.getRotation(i):0;if(u!==0){var l=n.getRotationPoint(i),f=l.x,c=l.y;mn(r,r,[f,c]),rf(r,r,u);var v=n.getRotationOffset(i);o=v.x+(a.xOffset||0),s=v.y+(a.yOffset||0)}else o=a.x1,s=a.y1;mn(r,r,[o,s]),Yo(r,r,[a.w,a.h])}},{key:"_getAdjustedBB",value:function(r,a,n,i){var o=r.x1,s=r.y1,u=r.w,l=r.h,f=r.yOffset;a&&(o-=a,s-=a,u+=2*a,l+=2*a);var c=0,v=u*i;return n&&i<1?u=v:!n&&i<1&&(c=u-v,o+=c,u=v),{x1:o,y1:s,w:u,h:l,xOffset:c,yOffset:f}}},{key:"drawPickingRectangle",value:function(r,a,n){var i=this.atlasManager.getRenderTypeOpts(n),o=this.instanceCount;this.vertTypeBuffer.getView(o)[0]=Hr;var s=this.indexBuffer.getView(o);_r(a,s);var u=this.colorBuffer.getView(o);Cr([0,0,0],1,u);var l=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(r,l,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(r,a,n){var i=this.simpleShapeOptions.get(n);if(this._isVisible(r,i)){var o=i.shapeProps,s=this._getVertTypeForShape(r,o.shape);if(s===void 0||i.isSimple&&!i.isSimple(r,this.renderTarget)){this.drawTexture(r,a,n);return}var u=this.instanceCount;if(this.vertTypeBuffer.getView(u)[0]=s,s===sn||s===pa){var l=i.getBoundingBox(r),f=this._getCornerRadius(r,o.radius,l),c=this.cornerRadiusBuffer.getView(u);c[0]=f,c[1]=f,c[2]=f,c[3]=f,s===pa&&(c[0]=0,c[2]=0)}var v=this.indexBuffer.getView(u);_r(a,v);var d=this.renderTarget.picking?1:n==="node-body"?r.effectiveOpacity():1,h=this.renderTarget.picking?1:r.pstyle(o.opacity).value*d,y=r.pstyle(o.color).value,g=this.colorBuffer.getView(u);Cr(y,h,g);var p=this.lineWidthBuffer.getView(u);if(p[0]=0,p[1]=0,o.border){var m=r.pstyle("border-width").value;if(m>0){var b=r.pstyle("border-color").value,w=d*r.pstyle("border-opacity").value,E=this.borderColorBuffer.getView(u);Cr(b,w,E);var C=r.pstyle("border-position").value;if(C==="inside")p[0]=0,p[1]=-m;else if(C==="outside")p[0]=m,p[1]=0;else{var x=m/2;p[0]=x,p[1]=-x}}}var T=this.transformBuffer.getMatrixView(u);this.setTransformMatrix(r,T,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(r,a){var n=r.pstyle(a).value;switch(n){case"rectangle":return Hr;case"ellipse":return ya;case"roundrectangle":case"round-rectangle":return sn;case"bottom-round-rectangle":return pa;default:return}}},{key:"_getCornerRadius",value:function(r,a,n){var i=n.w,o=n.h;if(r.pstyle(a).value==="auto")return fr(i,o);var s=r.pstyle(a).pfValue,u=i/2,l=o/2;return Math.min(s,l,u)}},{key:"drawEdgeArrow",value:function(r,a,n){if(r.visible()){var i=r._private.rscratch,o,s,u;if(n==="source"?(o=i.arrowStartX,s=i.arrowStartY,u=i.srcArrowAngle):(o=i.arrowEndX,s=i.arrowEndY,u=i.tgtArrowAngle),!(isNaN(o)||o==null||isNaN(s)||s==null||isNaN(u)||u==null)){var l=r.pstyle(n+"-arrow-shape").value;if(l!=="none"){var f=r.pstyle(n+"-arrow-color").value,c=r.pstyle("opacity").value,v=r.pstyle("line-opacity").value,d=c*v,h=r.pstyle("width").pfValue,y=r.pstyle("arrow-scale").value,g=this.r.getArrowWidth(h,y),p=this.instanceCount,m=this.transformBuffer.getMatrixView(p);tf(m),mn(m,m,[o,s]),Yo(m,m,[g,g]),rf(m,m,u),this.vertTypeBuffer.getView(p)[0]=Po;var b=this.indexBuffer.getView(p);_r(a,b);var w=this.colorBuffer.getView(p);Cr(f,d,w),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(r,a){if(r.visible()){var n=this._getEdgePoints(r);if(n){var i=r.pstyle("opacity").value,o=r.pstyle("line-opacity").value,s=r.pstyle("width").pfValue,u=r.pstyle("line-color").value,l=i*o;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),n.length==4){var f=this.instanceCount;this.vertTypeBuffer.getView(f)[0]=af;var c=this.indexBuffer.getView(f);_r(a,c);var v=this.colorBuffer.getView(f);Cr(u,l,v);var d=this.lineWidthBuffer.getView(f);d[0]=s;var h=this.pointAPointBBuffer.getView(f);h[0]=n[0],h[1]=n[1],h[2]=n[2],h[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var y=0;y<n.length-2;y+=2){var g=this.instanceCount;this.vertTypeBuffer.getView(g)[0]=nf;var p=this.indexBuffer.getView(g);_r(a,p);var m=this.colorBuffer.getView(g);Cr(u,l,m);var b=this.lineWidthBuffer.getView(g);b[0]=s;var w=n[y-2],E=n[y-1],C=n[y],x=n[y+1],T=n[y+2],k=n[y+3],B=n[y+4],D=n[y+5];y==0&&(w=2*C-T+.001,E=2*x-k+.001),y==n.length-4&&(B=2*T-C+.001,D=2*k-x+.001);var P=this.pointAPointBBuffer.getView(g);P[0]=w,P[1]=E,P[2]=C,P[3]=x;var A=this.pointCPointDBuffer.getView(g);A[0]=T,A[1]=k,A[2]=B,A[3]=D,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(r){var a=r._private.rscratch;return!(a.badLine||a.allpts==null||isNaN(a.allpts[0]))}},{key:"_getEdgePoints",value:function(r){var a=r._private.rscratch;if(this._isValidEdge(r)){var n=a.allpts;if(n.length==4)return n;var i=this._getNumSegments(r);return this._getCurveSegmentPoints(n,i)}}},{key:"_getNumSegments",value:function(r){var a=15;return Math.min(Math.max(a,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(r,a){if(r.length==4)return r;for(var n=Array((a+1)*2),i=0;i<=a;i++)if(i==0)n[0]=r[0],n[1]=r[1];else if(i==a)n[i*2]=r[r.length-2],n[i*2+1]=r[r.length-1];else{var o=i/a;this._setCurvePoint(r,o,n,i*2)}return n}},{key:"_setCurvePoint",value:function(r,a,n,i){if(r.length<=2)n[i]=r[0],n[i+1]=r[1];else{for(var o=Array(r.length-2),s=0;s<o.length;s+=2){var u=(1-a)*r[s]+a*r[s+2],l=(1-a)*r[s+1]+a*r[s+3];o[s]=u,o[s+1]=l}return this._setCurvePoint(o,a,n,i)}}},{key:"endBatch",value:function(){var r=this.gl,a=this.vao,n=this.vertexCount,i=this.instanceCount;if(i!==0){var o=this.renderTarget.picking?this.pickingProgram:this.program;r.useProgram(o),r.bindVertexArray(a);var s=Tt(this.buffers),u;try{for(s.s();!(u=s.n()).done;){var l=u.value;l.bufferSubData(i)}}catch(h){s.e(h)}finally{s.f()}for(var f=this.batchManager.getAtlases(),c=0;c<f.length;c++)f[c].bufferIfNeeded(r);for(var v=0;v<f.length;v++)r.activeTexture(r.TEXTURE0+v),r.bindTexture(r.TEXTURE_2D,f[v].texture),r.uniform1i(o.uTextures[v],v);r.uniform1f(o.uZoom,cm(this.r)),r.uniformMatrix3fv(o.uPanZoomMatrix,!1,this.panZoomMatrix),r.uniform1i(o.uAtlasSize,this.batchManager.getAtlasSize());var d=Cr(this.bgColor,1);r.uniform4fv(o.uBGColor,d),r.drawArraysInstanced(r.TRIANGLES,0,n,i),r.bindVertexArray(null),r.bindTexture(r.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:i,atlasCount:f.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var r=this.atlasManager.getDebugInfo(),a=r.reduce(function(o,s){return o+s.atlasCount},0),n=this.batchDebugInfo,i=n.reduce(function(o,s){return o+s.count},0);return{atlasInfo:r,totalAtlases:a,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:n.length,batchInfo:n,totalInstances:i}}}])})(),Hc={};Hc.initWebgl=function(t,e){var r=this,a=r.data.contexts[r.WEBGL];t.bgColor=Lm(r),t.webglTexSize=Math.min(t.webglTexSize,a.getParameter(a.MAX_TEXTURE_SIZE)),t.webglTexRows=Math.min(t.webglTexRows,54),t.webglTexRowsNodes=Math.min(t.webglTexRowsNodes,54),t.webglBatchSize=Math.min(t.webglBatchSize,16384),t.webglTexPerBatch=Math.min(t.webglTexPerBatch,a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS)),r.webglDebug=t.webglDebug,r.webglDebugShowAtlases=t.webglDebugShowAtlases,r.pickingFrameBuffer=wm(a),r.pickingFrameBuffer.needsDraw=!0,r.drawing=new Mm(r,a,t);var n=function(c){return function(v){return r.getTextAngle(v,c)}},i=function(c){return function(v){var d=v.pstyle(c);return d&&d.value}},o=function(c){return function(v){return v.pstyle("".concat(c,"-opacity")).value>0}},s=function(c){var v=c.pstyle("text-events").strValue==="yes";return v?Rn.USE_BB:Rn.IGNORE},u=function(c){var v=c.position(),d=v.x,h=v.y,y=c.outerWidth(),g=c.outerHeight();return{w:y,h:g,x1:d-y/2,y1:h-g/2}};r.drawing.addAtlasCollection("node",{texRows:t.webglTexRowsNodes}),r.drawing.addAtlasCollection("label",{texRows:t.webglTexRows}),r.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement}),r.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:u,isSimple:dm,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),r.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:u,isVisible:o("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),r.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:u,isVisible:o("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),r.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:s,getKey:Ao(e.getLabelKey,null),getBoundingBox:Ro(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:n(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:i("label")}),r.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:s,getKey:Ao(e.getSourceLabelKey,"source"),getBoundingBox:Ro(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:n("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:i("source-label")}),r.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:s,getKey:Ao(e.getTargetLabelKey,"target"),getBoundingBox:Ro(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:n("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:i("target-label")});var l=Va(function(){console.log("garbage collect flag set"),r.data.gc=!0},1e4);r.onUpdateEleCalcs(function(f,c){var v=!1;c&&c.length>0&&(v|=r.drawing.invalidate(c)),v&&l()}),Im(r)};function Lm(t){var e=t.cy.container(),r=e&&e.style&&e.style.backgroundColor||"white";return pf(r)}function Gc(t,e){var r=t._private.rscratch;return Et(r,"labelWrapCachedLines",e)||[]}var Ao=function(e,r){return function(a){var n=e(a),i=Gc(a,r);return i.length>1?i.map(function(o,s){return"".concat(n,"_").concat(s)}):n}},Ro=function(e,r){return function(a,n){var i=e(a);if(typeof n=="string"){var o=n.indexOf("_");if(o>0){var s=Number(n.substring(o+1)),u=Gc(a,r),l=i.h/u.length,f=l*s,c=i.y1+f;return{x1:i.x1,w:i.w,y1:c,h:l,yOffset:f}}}return i}};function Im(t){{var e=t.render;t.render=function(i){i=i||{};var o=t.cy;t.webgl&&(o.zoom()>Nc?(Om(t),e.call(t,i)):(Nm(t),Wc(t,i,Ca.SCREEN)))}}{var r=t.matchCanvasSize;t.matchCanvasSize=function(i){r.call(t,i),t.pickingFrameBuffer.setFramebufferAttachmentSizes(t.canvasWidth,t.canvasHeight),t.pickingFrameBuffer.needsDraw=!0}}t.findNearestElements=function(i,o,s,u){return _m(t,i,o)};{var a=t.invalidateCachedZSortedEles;t.invalidateCachedZSortedEles=function(){a.call(t),t.pickingFrameBuffer.needsDraw=!0}}{var n=t.notify;t.notify=function(i,o){n.call(t,i,o),i==="viewport"||i==="bounds"?t.pickingFrameBuffer.needsDraw=!0:i==="background"&&t.drawing.invalidate(o,{type:"node-body"})}}}function Om(t){var e=t.data.contexts[t.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function Nm(t){var e=function(a){a.save(),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,t.canvasWidth,t.canvasHeight),a.restore()};e(t.data.contexts[t.NODE]),e(t.data.contexts[t.DRAG])}function zm(t){var e=t.canvasWidth,r=t.canvasHeight,a=Cs(t),n=a.pan,i=a.zoom,o=Bo();mn(o,o,[n.x,n.y]),Yo(o,o,[i,i]);var s=Bo();Em(s,e,r);var u=Bo();return xm(u,s,o),u}function Uc(t,e){var r=t.canvasWidth,a=t.canvasHeight,n=Cs(t),i=n.pan,o=n.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,r,a),e.translate(i.x,i.y),e.scale(o,o)}function Fm(t,e){t.drawSelectionRectangle(e,function(r){return Uc(t,r)})}function Vm(t){var e=t.data.contexts[t.NODE];e.save(),Uc(t,e),e.strokeStyle="rgba(0, 0, 0, 0.3)",e.beginPath(),e.moveTo(-1e3,0),e.lineTo(1e3,0),e.stroke(),e.beginPath(),e.moveTo(0,-1e3),e.lineTo(0,1e3),e.stroke(),e.restore()}function qm(t){var e=function(n,i,o){for(var s=n.atlasManager.getAtlasCollection(i),u=t.data.contexts[t.NODE],l=s.atlases,f=0;f<l.length;f++){var c=l[f],v=c.canvas;if(v){var d=v.width,h=v.height,y=d*f,g=v.height*o,p=.4;u.save(),u.scale(p,p),u.drawImage(v,y,g),u.strokeStyle="black",u.rect(y,g,d,h),u.stroke(),u.restore()}}},r=0;e(t.drawing,"node",r++),e(t.drawing,"label",r++)}function $m(t,e,r,a,n){var i,o,s,u,l=Cs(t),f=l.pan,c=l.zoom;{var v=vm(t,f,c,e,r),d=Je(v,2),h=d[0],y=d[1],g=6;i=h-g/2,o=y-g/2,s=g,u=g}if(s===0||u===0)return[];var p=t.data.contexts[t.WEBGL];p.bindFramebuffer(p.FRAMEBUFFER,t.pickingFrameBuffer),t.pickingFrameBuffer.needsDraw&&(p.viewport(0,0,p.canvas.width,p.canvas.height),Wc(t,null,Ca.PICKING),t.pickingFrameBuffer.needsDraw=!1);var m=s*u,b=new Uint8Array(m*4);p.readPixels(i,o,s,u,p.RGBA,p.UNSIGNED_BYTE,b),p.bindFramebuffer(p.FRAMEBUFFER,null);for(var w=new Set,E=0;E<m;E++){var C=b.slice(E*4,E*4+4),x=gm(C)-1;x>=0&&w.add(x)}return w}function _m(t,e,r){var a=$m(t,e,r),n=t.getCachedZSortedEles(),i,o,s=Tt(a),u;try{for(s.s();!(u=s.n()).done;){var l=u.value,f=n[l];if(!i&&f.isNode()&&(i=f),!o&&f.isEdge()&&(o=f),i&&o)break}}catch(c){s.e(c)}finally{s.f()}return[i,o].filter(Boolean)}function Mo(t,e,r){var a=t.drawing;e+=1,r.isNode()?(a.drawNode(r,e,"node-underlay"),a.drawNode(r,e,"node-body"),a.drawTexture(r,e,"label"),a.drawNode(r,e,"node-overlay")):(a.drawEdgeLine(r,e),a.drawEdgeArrow(r,e,"source"),a.drawEdgeArrow(r,e,"target"),a.drawTexture(r,e,"label"),a.drawTexture(r,e,"edge-source-label"),a.drawTexture(r,e,"edge-target-label"))}function Wc(t,e,r){var a;t.webglDebug&&(a=performance.now());var n=t.drawing,i=0;if(r.screen&&t.data.canvasNeedsRedraw[t.SELECT_BOX]&&Fm(t,e),t.data.canvasNeedsRedraw[t.NODE]||r.picking){var o=t.data.contexts[t.WEBGL];r.screen?(o.clearColor(0,0,0,0),o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.disable(o.BLEND),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),o.viewport(0,0,o.canvas.width,o.canvas.height);var s=zm(t),u=t.getCachedZSortedEles();if(i=u.length,n.startFrame(s,r),r.screen){for(var l=0;l<u.nondrag.length;l++)Mo(t,l,u.nondrag[l]);for(var f=0;f<u.drag.length;f++)Mo(t,f,u.drag[f])}else if(r.picking)for(var c=0;c<u.length;c++)Mo(t,c,u[c]);n.endFrame(),r.screen&&t.webglDebugShowAtlases&&(Vm(t),qm(t)),t.data.canvasNeedsRedraw[t.NODE]=!1,t.data.canvasNeedsRedraw[t.DRAG]=!1}if(t.webglDebug){var v=performance.now(),d=!1,h=Math.ceil(v-a),y=n.getDebugInfo(),g=["".concat(i," elements"),"".concat(y.totalInstances," instances"),"".concat(y.batchCount," batches"),"".concat(y.totalAtlases," atlases"),"".concat(y.wrappedCount," wrapped textures"),"".concat(y.simpleCount," simple shapes")].join(", ");if(d)console.log("WebGL (".concat(r.name,") - time ").concat(h,"ms, ").concat(g));else{console.log("WebGL (".concat(r.name,") - frame time ").concat(h,"ms")),console.log("Totals:"),console.log(" ".concat(g)),console.log("Texture Atlases Used:");var p=y.atlasInfo,m=Tt(p),b;try{for(m.s();!(b=m.n()).done;){var w=b.value;console.log(" ".concat(w.type,": ").concat(w.keyCount," keys, ").concat(w.atlasCount," atlases"))}}catch(E){m.e(E)}finally{m.f()}console.log("")}}t.data.gc&&(console.log("Garbage Collect!"),t.data.gc=!1,n.gc())}var br={};br.drawPolygonPath=function(t,e,r,a,n,i){var o=a/2,s=n/2;t.beginPath&&t.beginPath(),t.moveTo(e+o*i[0],r+s*i[1]);for(var u=1;u<i.length/2;u++)t.lineTo(e+o*i[u*2],r+s*i[u*2+1]);t.closePath()};br.drawRoundPolygonPath=function(t,e,r,a,n,i,o){o.forEach(function(s){return kc(t,s)}),t.closePath()};br.drawRoundRectanglePath=function(t,e,r,a,n,i){var o=a/2,s=n/2,u=i==="auto"?fr(a,n):Math.min(i,s,o);t.beginPath&&t.beginPath(),t.moveTo(e,r-s),t.arcTo(e+o,r-s,e+o,r,u),t.arcTo(e+o,r+s,e,r+s,u),t.arcTo(e-o,r+s,e-o,r,u),t.arcTo(e-o,r-s,e,r-s,u),t.lineTo(e,r-s),t.closePath()};br.drawBottomRoundRectanglePath=function(t,e,r,a,n,i){var o=a/2,s=n/2,u=i==="auto"?fr(a,n):i;t.beginPath&&t.beginPath(),t.moveTo(e,r-s),t.lineTo(e+o,r-s),t.lineTo(e+o,r),t.arcTo(e+o,r+s,e,r+s,u),t.arcTo(e-o,r+s,e-o,r,u),t.lineTo(e-o,r-s),t.lineTo(e,r-s),t.closePath()};br.drawCutRectanglePath=function(t,e,r,a,n,i,o){var s=a/2,u=n/2,l=o==="auto"?us():o;t.beginPath&&t.beginPath(),t.moveTo(e-s+l,r-u),t.lineTo(e+s-l,r-u),t.lineTo(e+s,r-u+l),t.lineTo(e+s,r+u-l),t.lineTo(e+s-l,r+u),t.lineTo(e-s+l,r+u),t.lineTo(e-s,r+u-l),t.lineTo(e-s,r-u+l),t.closePath()};br.drawBarrelPath=function(t,e,r,a,n){var i=a/2,o=n/2,s=e-i,u=e+i,l=r-o,f=r+o,c=Oo(a,n),v=c.widthOffset,d=c.heightOffset,h=c.ctrlPtOffsetPct*v;t.beginPath&&t.beginPath(),t.moveTo(s,l+d),t.lineTo(s,f-d),t.quadraticCurveTo(s+h,f,s+v,f),t.lineTo(u-v,f),t.quadraticCurveTo(u-h,f,u,f-d),t.lineTo(u,l+d),t.quadraticCurveTo(u-h,l,u-v,l),t.lineTo(s+v,l),t.quadraticCurveTo(s+h,l,s,l+d),t.closePath()};var of=Math.sin(0),sf=Math.cos(0),Zo={},Qo={},Kc=Math.PI/40;for(Tr=0*Math.PI;Tr<2*Math.PI;Tr+=Kc)Zo[Tr]=Math.sin(Tr),Qo[Tr]=Math.cos(Tr);var Tr;br.drawEllipsePath=function(t,e,r,a,n){if(t.beginPath&&t.beginPath(),t.ellipse)t.ellipse(e,r,a/2,n/2,0,0,2*Math.PI);else for(var i,o,s=a/2,u=n/2,l=0*Math.PI;l<2*Math.PI;l+=Kc)i=e-s*Zo[l]*of+s*Qo[l]*sf,o=r+u*Qo[l]*of+u*Zo[l]*sf,l===0?t.moveTo(i,o):t.lineTo(i,o);t.closePath()};var Ua={};Ua.createBuffer=function(t,e){var r=document.createElement("canvas");return r.width=t,r.height=e,[r,r.getContext("2d")]};Ua.bufferCanvasImage=function(t){var e=this.cy,r=e.mutableElements(),a=r.boundingBox(),n=this.findContainerClientCoords(),i=t.full?Math.ceil(a.w):n[2],o=t.full?Math.ceil(a.h):n[3],s=ae(t.maxWidth)||ae(t.maxHeight),u=this.getPixelRatio(),l=1;if(t.scale!==void 0)i*=t.scale,o*=t.scale,l=t.scale;else if(s){var f=1/0,c=1/0;ae(t.maxWidth)&&(f=l*t.maxWidth/i),ae(t.maxHeight)&&(c=l*t.maxHeight/o),l=Math.min(f,c),i*=l,o*=l}s||(i*=u,o*=u,l*=u);var v=document.createElement("canvas");v.width=i,v.height=o,v.style.width=i+"px",v.style.height=o+"px";var d=v.getContext("2d");if(i>0&&o>0){d.clearRect(0,0,i,o),d.globalCompositeOperation="source-over";var h=this.getCachedZSortedEles();if(t.full)d.translate(-a.x1*l,-a.y1*l),d.scale(l,l),this.drawElements(d,h),d.scale(1/l,1/l),d.translate(a.x1*l,a.y1*l);else{var y=e.pan(),g={x:y.x*l,y:y.y*l};l*=e.zoom(),d.translate(g.x,g.y),d.scale(l,l),this.drawElements(d,h),d.scale(1/l,1/l),d.translate(-g.x,-g.y)}t.bg&&(d.globalCompositeOperation="destination-over",d.fillStyle=t.bg,d.rect(0,0,i,o),d.fill())}return v};function Hm(t,e){for(var r=atob(t),a=new ArrayBuffer(r.length),n=new Uint8Array(a),i=0;i<r.length;i++)n[i]=r.charCodeAt(i);return new Blob([a],{type:e})}function lf(t){var e=t.indexOf(",");return t.substr(e+1)}function Xc(t,e,r){var a=function(){return e.toDataURL(r,t.quality)};switch(t.output){case"blob-promise":return new ra(function(n,i){try{e.toBlob(function(o){o!=null?n(o):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},r,t.quality)}catch(o){i(o)}});case"blob":return Hm(lf(a()),r);case"base64":return lf(a());default:return a()}}Ua.png=function(t){return Xc(t,this.bufferCanvasImage(t),"image/png")};Ua.jpg=function(t){return Xc(t,this.bufferCanvasImage(t),"image/jpeg")};var Yc={};Yc.nodeShapeImpl=function(t,e,r,a,n,i,o,s){switch(t){case"ellipse":return this.drawEllipsePath(e,r,a,n,i);case"polygon":return this.drawPolygonPath(e,r,a,n,i,o);case"round-polygon":return this.drawRoundPolygonPath(e,r,a,n,i,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,r,a,n,i,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,r,a,n,i,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,r,a,n,i,s);case"barrel":return this.drawBarrelPath(e,r,a,n,i)}};var Gm=Zc,Te=Zc.prototype;Te.CANVAS_LAYERS=3;Te.SELECT_BOX=0;Te.DRAG=1;Te.NODE=2;Te.WEBGL=3;Te.CANVAS_TYPES=["2d","2d","2d","webgl2"];Te.BUFFER_COUNT=3;Te.TEXTURE_BUFFER=0;Te.MOTIONBLUR_BUFFER_NODE=1;Te.MOTIONBLUR_BUFFER_DRAG=2;function Zc(t){var e=this,r=e.cy.window(),a=r.document;t.webgl&&(Te.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.data={canvases:new Array(Te.CANVAS_LAYERS),contexts:new Array(Te.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Te.CANVAS_LAYERS),bufferCanvases:new Array(Te.BUFFER_COUNT),bufferContexts:new Array(Te.CANVAS_LAYERS)};var n="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";e.data.canvasContainer=a.createElement("div");var o=e.data.canvasContainer.style;e.data.canvasContainer.style[n]=i,o.position="relative",o.zIndex="0",o.overflow="hidden";var s=t.cy.container();s.appendChild(e.data.canvasContainer),s.style[n]=i;var u={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};Nv()&&(u["-ms-touch-action"]="none",u["touch-action"]="none");for(var l=0;l<Te.CANVAS_LAYERS;l++){var f=e.data.canvases[l]=a.createElement("canvas"),c=Te.CANVAS_TYPES[l];e.data.contexts[l]=f.getContext(c),e.data.contexts[l]||Ge("Could not create canvas of type "+c),Object.keys(u).forEach(function(Q){f.style[Q]=u[Q]}),f.style.position="absolute",f.setAttribute("data-id","layer"+l),f.style.zIndex=String(Te.CANVAS_LAYERS-l),e.data.canvasContainer.appendChild(f),e.data.canvasNeedsRedraw[l]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[Te.NODE].setAttribute("data-id","layer"+Te.NODE+"-node"),e.data.canvases[Te.SELECT_BOX].setAttribute("data-id","layer"+Te.SELECT_BOX+"-selectbox"),e.data.canvases[Te.DRAG].setAttribute("data-id","layer"+Te.DRAG+"-drag"),e.data.canvases[Te.WEBGL]&&e.data.canvases[Te.WEBGL].setAttribute("data-id","layer"+Te.WEBGL+"-webgl");for(var l=0;l<Te.BUFFER_COUNT;l++)e.data.bufferCanvases[l]=a.createElement("canvas"),e.data.bufferContexts[l]=e.data.bufferCanvases[l].getContext("2d"),e.data.bufferCanvases[l].style.position="absolute",e.data.bufferCanvases[l].setAttribute("data-id","buffer"+l),e.data.bufferCanvases[l].style.zIndex=String(-l-1),e.data.bufferCanvases[l].style.visibility="hidden";e.pathsEnabled=!0;var v=mt(),d=function(V){return{x:(V.x1+V.x2)/2,y:(V.y1+V.y2)/2}},h=function(V){return{x:-V.w/2,y:-V.h/2}},y=function(V){var H=V[0]._private,G=H.oldBackgroundTimestamp===H.backgroundTimestamp;return!G},g=function(V){return V[0]._private.nodeKey},p=function(V){return V[0]._private.labelStyleKey},m=function(V){return V[0]._private.sourceLabelStyleKey},b=function(V){return V[0]._private.targetLabelStyleKey},w=function(V,H,G,Y,re){return e.drawElement(V,H,G,!1,!1,re)},E=function(V,H,G,Y,re){return e.drawElementText(V,H,G,Y,"main",re)},C=function(V,H,G,Y,re){return e.drawElementText(V,H,G,Y,"source",re)},x=function(V,H,G,Y,re){return e.drawElementText(V,H,G,Y,"target",re)},T=function(V){return V.boundingBox(),V[0]._private.bodyBounds},k=function(V){return V.boundingBox(),V[0]._private.labelBounds.main||v},B=function(V){return V.boundingBox(),V[0]._private.labelBounds.source||v},D=function(V){return V.boundingBox(),V[0]._private.labelBounds.target||v},P=function(V,H){return H},A=function(V){return d(T(V))},R=function(V,H,G){var Y=V?V+"-":"";return{x:H.x+G.pstyle(Y+"text-margin-x").pfValue,y:H.y+G.pstyle(Y+"text-margin-y").pfValue}},L=function(V,H,G){var Y=V[0]._private.rscratch;return{x:Y[H],y:Y[G]}},I=function(V){return R("",L(V,"labelX","labelY"),V)},M=function(V){return R("source",L(V,"sourceLabelX","sourceLabelY"),V)},O=function(V){return R("target",L(V,"targetLabelX","targetLabelY"),V)},q=function(V){return h(T(V))},$=function(V){return h(B(V))},N=function(V){return h(D(V))},F=function(V){var H=k(V),G=h(k(V));if(V.isNode()){switch(V.pstyle("text-halign").value){case"left":G.x=-H.w-(H.leftPad||0);break;case"right":G.x=-(H.rightPad||0);break}switch(V.pstyle("text-valign").value){case"top":G.y=-H.h-(H.topPad||0);break;case"bottom":G.y=-(H.botPad||0);break}}return G},W=e.data.eleTxrCache=new wa(e,{getKey:g,doesEleInvalidateKey:y,drawElement:w,getBoundingBox:T,getRotationPoint:A,getRotationOffset:q,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),J=e.data.lblTxrCache=new wa(e,{getKey:p,drawElement:E,getBoundingBox:k,getRotationPoint:I,getRotationOffset:F,isVisible:P}),Z=e.data.slbTxrCache=new wa(e,{getKey:m,drawElement:C,getBoundingBox:B,getRotationPoint:M,getRotationOffset:$,isVisible:P}),j=e.data.tlbTxrCache=new wa(e,{getKey:b,drawElement:x,getBoundingBox:D,getRotationPoint:O,getRotationOffset:N,isVisible:P}),te=e.data.lyrTxrCache=new zc(e);e.onUpdateEleCalcs(function(V,H){W.invalidateElements(H),J.invalidateElements(H),Z.invalidateElements(H),j.invalidateElements(H),te.invalidateElements(H);for(var G=0;G<H.length;G++){var Y=H[G]._private;Y.oldBackgroundTimestamp=Y.backgroundTimestamp}});var ne=function(V){for(var H=0;H<V.length;H++)te.enqueueElementRefinement(V[H].ele)};W.onDequeue(ne),J.onDequeue(ne),Z.onDequeue(ne),j.onDequeue(ne),t.webgl&&e.initWebgl(t,{getStyleKey:g,getLabelKey:p,getSourceLabelKey:m,getTargetLabelKey:b,drawElement:w,drawLabel:E,drawSourceLabel:C,drawTargetLabel:x,getElementBox:T,getLabelBox:k,getSourceLabelBox:B,getTargetLabelBox:D,getElementRotationPoint:A,getElementRotationOffset:q,getLabelRotationPoint:I,getSourceLabelRotationPoint:M,getTargetLabelRotationPoint:O,getLabelRotationOffset:F,getSourceLabelRotationOffset:$,getTargetLabelRotationOffset:N})}Te.redrawHint=function(t,e){var r=this;switch(t){case"eles":r.data.canvasNeedsRedraw[Te.NODE]=e;break;case"drag":r.data.canvasNeedsRedraw[Te.DRAG]=e;break;case"select":r.data.canvasNeedsRedraw[Te.SELECT_BOX]=e;break;case"gc":r.data.gc=!0;break}};var Um=typeof Path2D<"u";Te.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t};Te.usePaths=function(){return Um&&this.pathsEnabled};Te.setImgSmoothing=function(t,e){t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled=e:(t.webkitImageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.msImageSmoothingEnabled=e)};Te.getImgSmoothing=function(t){return t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled:t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled};Te.makeOffscreenCanvas=function(t,e){var r;if((typeof OffscreenCanvas>"u"?"undefined":rt(OffscreenCanvas))!=="undefined")r=new OffscreenCanvas(t,e);else{var a=this.cy.window(),n=a.document;r=n.createElement("canvas"),r.width=t,r.height=e}return r};[Fc,Gt,Jt,Es,Nr,mr,bt,Hc,br,Ua,Yc].forEach(function(t){ye(Te,t)});var Wm=[{name:"null",impl:Cc},{name:"base",impl:Ic},{name:"canvas",impl:Gm}],Km=[{type:"layout",extensions:py},{type:"renderer",extensions:Wm}],Qc={},Jc={};function jc(t,e,r){var a=r,n=function(T){ze("Can not register `"+e+"` for `"+t+"` since `"+T+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(Ma.prototype[e])return n(e);Ma.prototype[e]=r}else if(t==="collection"){if(ft.prototype[e])return n(e);ft.prototype[e]=r}else if(t==="layout"){for(var i=function(T){this.options=T,r.call(this,T),Me(this._private)||(this._private={}),this._private.cy=T.cy,this._private.listeners=[],this.createEmitter()},o=i.prototype=Object.create(r.prototype),s=[],u=0;u<s.length;u++){var l=s[u];o[l]=o[l]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var f=r.prototype.stop;o.stop=function(){var x=this.options;if(x&&x.animate){var T=this.animations;if(T)for(var k=0;k<T.length;k++)T[k].stop()}return f?f.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var c=function(T){return T._private.cy},v={addEventFields:function(T,k){k.layout=T,k.cy=c(T),k.target=T},bubble:function(){return!0},parent:function(T){return c(T)}};ye(o,{createEmitter:function(){return this._private.emitter=new Hn(v,this),this},emitter:function(){return this._private.emitter},on:function(T,k){return this.emitter().on(T,k),this},one:function(T,k){return this.emitter().one(T,k),this},once:function(T,k){return this.emitter().one(T,k),this},removeListener:function(T,k){return this.emitter().removeListener(T,k),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(T,k){return this.emitter().emit(T,k),this}}),Ne.eventAliasesOn(o),a=i}else if(t==="renderer"&&e!=="null"&&e!=="base"){var d=ev("renderer","base"),h=d.prototype,y=r,g=r.prototype,p=function(){d.apply(this,arguments),y.apply(this,arguments)},m=p.prototype;for(var b in h){var w=h[b],E=g[b]!=null;if(E)return n(b);m[b]=w}for(var C in g)m[C]=g[C];h.clientFunctions.forEach(function(x){m[x]=m[x]||function(){Ge("Renderer does not implement `renderer."+x+"()` on its prototype")}}),a=p}else if(t==="__proto__"||t==="constructor"||t==="prototype")return Ge(t+" is an illegal type to be registered, possibly lead to prototype pollutions");return yf({map:Qc,keys:[t,e],value:a})}function ev(t,e){return mf({map:Qc,keys:[t,e]})}function Xm(t,e,r,a,n){return yf({map:Jc,keys:[t,e,r,a],value:n})}function Ym(t,e,r,a){return mf({map:Jc,keys:[t,e,r,a]})}var Jo=function(){if(arguments.length===2)return ev.apply(null,arguments);if(arguments.length===3)return jc.apply(null,arguments);if(arguments.length===4)return Ym.apply(null,arguments);if(arguments.length===5)return Xm.apply(null,arguments);Ge("Invalid extension access syntax")};Ma.prototype.extension=Jo;Km.forEach(function(t){t.extensions.forEach(function(e){jc(t.type,e.name,e.impl)})});var Mn=function(){if(!(this instanceof Mn))return new Mn;this.length=0},Ir=Mn.prototype;Ir.instanceString=function(){return"stylesheet"};Ir.selector=function(t){var e=this.length++;return this[e]={selector:t,properties:[]},this};Ir.css=function(t,e){var r=this.length-1;if(he(t))this[r].properties.push({name:t,value:e});else if(Me(t))for(var a=t,n=Object.keys(a),i=0;i<n.length;i++){var o=n[i],s=a[o];if(s!=null){var u=ot.properties[o]||ot.properties[Ln(o)];if(u!=null){var l=u.name,f=s;this[r].properties.push({name:l,value:f})}}}return this};Ir.style=Ir.css;Ir.generateStyle=function(t){var e=new ot(t);return this.appendToStyle(e)};Ir.appendToStyle=function(t){for(var e=0;e<this.length;e++){var r=this[e],a=r.selector,n=r.properties;t.selector(a);for(var i=0;i<n.length;i++){var o=n[i];t.css(o.name,o.value)}}return t};var Zm="3.33.4",hr=function(e){if(e===void 0&&(e={}),Me(e))return new Ma(e);if(he(e))return Jo.apply(Jo,arguments)};hr.use=function(t){var e=Array.prototype.slice.call(arguments,1);return e.unshift(hr),t.apply(null,e),this};hr.warnings=function(t){return Sf(t)};hr.version=Zm;hr.stylesheet=hr.Stylesheet=Mn;var tv="graph",Ve=null,rv=document.querySelectorAll(".nav-item");rv.forEach(t=>{t.addEventListener("click",()=>{rv.forEach(a=>a.classList.remove("active")),t.classList.add("active");let e=t.getAttribute("data-tab")||"graph";document.querySelectorAll(".tab-pane").forEach(a=>a.classList.remove("active"));let r=document.getElementById(`tab-${e}`);r&&r.classList.add("active"),tv=e,tv==="graph"&&setTimeout(()=>{Ve&&Ve.resize()},50)})});var av=document.querySelectorAll(".tab-sub-btn");av.forEach(t=>{t.addEventListener("click",()=>{av.forEach(a=>a.classList.remove("active")),t.classList.add("active");let e=t.getAttribute("data-subtab")||"subtab-routes-list";document.querySelectorAll(".subtab-pane").forEach(a=>a.classList.remove("active"));let r=document.getElementById(e);r&&r.classList.add("active")})});var sa=new Set;function Bs(t){return`${t.tool}:${t.timestamp}:${t.durationMs||0}`}function Ds(t){let e=document.createElement("div");e.className="log-entry";let r=new Date(t.timestamp||Date.now()).toLocaleTimeString(),a=t.durationMs!=null?` <span class="log-duration">${t.durationMs}ms</span>`:"",n=t.success===!1?"\u274C":"\u2705";return e.innerHTML=`
322
+ <span class="log-time">[${r}]</span>
323
+ <span class="log-status">${n}</span>
324
+ <span class="log-name">${t.tool}</span>
325
+ <span class="log-input">(${JSON.stringify(t.input)})</span>${a}
326
+ ${t.error?`<div class="log-result" style="color: #ef4444;">Error: ${t.error}</div>`:""}
327
+ `,e}async function Qm(){let t=document.getElementById("tool-log-container");if(t)try{let e=await fetch("/api/tool-calls");if(!e.ok)return;let r=await e.json();if(r.length>0){let a=t.querySelector(".log-placeholder");a&&a.remove();for(let n of r){let i=Bs(n);sa.has(i)||(sa.add(i),t.appendChild(Ds(n)))}}}catch(e){console.error("Failed to load tool call history:",e)}}function Jm(){let t=new EventSource("/events"),e=document.getElementById("tool-log-container");t.addEventListener("tool-call",r=>{try{let a=JSON.parse(r.data),n=Bs(a);if(sa.has(n))return;if(sa.add(n),e){let i=e.querySelector(".log-placeholder");i&&i.remove(),e.prepend(Ds(a))}}catch(a){console.error("Failed to parse SSE event:",a)}}),t.addEventListener("scan-progress",r=>{try{let a=JSON.parse(r.data),n=document.getElementById("repo-name");n&&(n.textContent=`Scanning: ${a.current}/${a.total} (${Math.round(a.current/a.total*100)}%)`)}catch(a){console.error(a)}}),t.addEventListener("scan-complete",r=>{try{let a=document.getElementById("repo-name");a&&(a.textContent="Scan Complete"),iv(),Ps()}catch(a){console.error(a)}})}var Qn=0,Jn=0,jn=0;async function iv(){try{let t=await fetch("/api/status");if(!t.ok)return;let e=await t.json();Qn=e.fileCount||0,Jn=e.symbolCount||0,jn=e.edgeCount||0,document.getElementById("repo-name").textContent=e.repoName||"MapX Project",document.getElementById("stat-files").textContent=String(Qn),document.getElementById("stat-symbols").textContent=String(Jn),document.getElementById("stat-edges").textContent=String(jn);let r=document.getElementById("filter-lang");r&&e.languages&&(r.innerHTML='<option value="">All Languages</option>',Object.keys(e.languages).forEach(a=>{let n=document.createElement("option");n.value=a,n.textContent=a.toUpperCase(),r.appendChild(n)}))}catch(t){console.error("Failed to fetch status:",t)}}var Ts=[],wr=!1;function nv(t,e){let r=[];if(!e)r=t.map(n=>{if(n.data&&n.data.parent){let i=JSON.parse(JSON.stringify(n));return delete i.data.parent,i}return n});else{let n={},i=v=>{let d=v.split("/");return d.length>1?`dir:${d.slice(0,-1).join("/")}`:"dir:root"};for(let v of t)if(v.data&&v.data.type==="file"){let d=i(v.data.id);n[d]||(n[d]=[]);let h=JSON.parse(JSON.stringify(v));h.data.parent=d,n[d].push(h)}let o=Object.keys(n).sort(),s=o.length,u=3,l=550,f=450;for(let v=0;v<s;v++){let d=o[v],h=v%u,y=Math.floor(v/u),g=h*l+l/2,p=y*f+f/2;r.push({data:{id:d,label:d==="dir:root"?"root":d.replace("dir:",""),type:"parent"}});let m=n[d],b=m.length;if(b>0){if(b===1)m[0].position={x:g,y:p};else if(b<=8)for(let E=0;E<b;E++){let C=E*2*Math.PI/b;m[E].position={x:g+110*Math.cos(C),y:p+110*Math.sin(C)}}else if(b<=16){let E=b-6,C=90,x=180;for(let T=0;T<6;T++){let k=T*2*Math.PI/6;m[T].position={x:g+C*Math.cos(k),y:p+C*Math.sin(k)}}for(let T=0;T<E;T++){let k=T*2*Math.PI/E;m[6+T].position={x:g+x*Math.cos(k),y:p+x*Math.sin(k)}}}else{let C=b-15,x=80,T=160,k=240;for(let B=0;B<5;B++){let D=B*2*Math.PI/5;m[B].position={x:g+x*Math.cos(D),y:p+x*Math.sin(D)}}for(let B=0;B<10;B++){let D=B*2*Math.PI/10;m[5+B].position={x:g+T*Math.cos(D),y:p+T*Math.sin(D)}}for(let B=0;B<C;B++){let D=B*2*Math.PI/C;m[15+B].position={x:g+k*Math.cos(D),y:p+k*Math.sin(D)}}}r.push(...m)}}let c=new Map;for(let v of t)if(v.data&&v.data.source&&v.data.target){let d=v.data.source,h=v.data.target,y=i(d),g=i(h);if(y!==g){let p=`${y}->${g}`;c.has(p)||c.set(p,{source:y,target:g,count:0}),c.get(p).count++}else r.push(JSON.parse(JSON.stringify(v)))}for(let[v,d]of c.entries())r.push({data:{id:`edge-cluster-${d.source}-${d.target}`,source:d.source,target:d.target,type:"cluster-dependency",label:`${d.count}`,count:d.count}})}let a=new Set;for(let n of r)n.data&&!n.data.source&&!n.data.target&&a.add(n.data.id);return r.filter(n=>n.data&&(n.data.source||n.data.target)?a.has(n.data.source)&&a.has(n.data.target):!0)}function Ss(t,e=!0){return t?{name:"preset",animate:e,animationDuration:800,fit:!0,padding:50}:{name:"cose",animate:e,nodeDimensionsIncludeLabels:!0,nodeRepulsion:r=>75e3+(r.degree?r.degree():0)*15e3,idealEdgeLength:r=>{let a=r.source(),n=r.target(),i=a.degree?a.degree():0,o=n.degree?n.degree():0;return 120+Math.max(i,o)*8},gravity:.1,nodeOverlap:40,nestingFactor:1.2,componentSpacing:40,refresh:20,fit:!0,padding:30,boundingBox:void 0}}async function Ps(){try{let t=await fetch("/api/graph");if(!t.ok)return;Ts=await t.json();let e=document.getElementById("cy");if(!e)return;let r=nv(Ts,wr);if(r.length===0){e.innerHTML='<div style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; font-size: 15px; color: var(--text-muted); text-align: center; gap: 8px; padding: 20px;"><div style="font-size: 24px;">\u{1F578}\uFE0F</div><div>No codebase graph elements found.</div><div style="font-size: 12px; opacity: 0.8;">Run a scan using the mapx CLI/MCP to index files and generate the graph.</div></div>';return}e.innerHTML="",Ve=hr({container:e,elements:r,wheelSensitivity:3.2,style:[{selector:"node",style:{label:"data(label)",color:"#abb2bf","font-family":"Outfit, sans-serif","font-size":"11px","font-weight":"600","background-color":"#5c6370",shape:"ellipse",width:a=>{if(a.isParent&&a.isParent())return"auto";let n=a.degree?a.degree():0;return 32+Math.min(n*2,48)+"px"},height:a=>{if(a.isParent&&a.isParent())return"auto";let n=a.degree?a.degree():0;return 32+Math.min(n*2,48)+"px"},"text-valign":"top","text-margin-y":-6,"z-index":10,"overlay-color":"#61afef","overlay-opacity":.08,"text-outline-color":"#1e222b","text-outline-width":"1px","transition-property":"opacity, width, height, border-color, border-width, background-color","transition-duration":.2}},{selector:'node[type="file"]',style:{shape:"ellipse","border-width":"1px","border-color":"#282c34"}},{selector:'node[type="symbol"]',style:{shape:"ellipse","border-width":"1px","border-color":"#282c34"}},{selector:":parent",style:{"background-color":"rgba(40, 44, 52, 0.15)","border-width":"1px","border-color":"#3e4452","border-style":"dashed",label:"data(label)",color:"#abb2bf","font-family":"Outfit, sans-serif","font-size":"12px","font-weight":"bold","text-valign":"top","text-halign":"center","text-outline-width":"1px","text-outline-color":"#14161a",padding:"20px"}},{selector:'node[language="php"]',style:{"background-color":"#c678dd"}},{selector:'node[language="javascript"]',style:{"background-color":"#e5c07b"}},{selector:'node[language="typescript"]',style:{"background-color":"#61afef"}},{selector:'node[language="tsx"]',style:{"background-color":"#61afef"}},{selector:'node[language="python"]',style:{"background-color":"#56b6c2"}},{selector:'node[language="rust"]',style:{"background-color":"#d19a66"}},{selector:'node[language="go"]',style:{"background-color":"#56b6c2"}},{selector:'node[language="java"]',style:{"background-color":"#c678dd"}},{selector:'node[language="c_sharp"]',style:{"background-color":"#e06c75"}},{selector:'node[language="cpp"]',style:{"background-color":"#e06c75"}},{selector:'node[language="c"]',style:{"background-color":"#5c6370"}},{selector:'node[language="ruby"]',style:{"background-color":"#e06c75"}},{selector:'node[language="swift"]',style:{"background-color":"#d19a66"}},{selector:'node[language="kotlin"]',style:{"background-color":"#c678dd"}},{selector:'node[language="vue"]',style:{"background-color":"#98c379"}},{selector:'node[language="scala"]',style:{"background-color":"#e06c75"}},{selector:'node[language="dart"]',style:{"background-color":"#56b6c2"}},{selector:"edge",style:{width:1,"line-color":"rgba(92, 99, 112, 0.18)","target-arrow-color":"rgba(92, 99, 112, 0.18)","target-arrow-shape":"triangle","curve-style":"bezier","overlay-color":"#61afef","overlay-opacity":.05,"z-index":1,"transition-property":"opacity, width, line-color, target-arrow-color","transition-duration":.2}},{selector:'edge[type="route"]',style:{"line-color":"rgba(152, 195, 121, 0.7)","target-arrow-color":"rgba(152, 195, 121, 0.7)"}},{selector:'edge[type="cluster-dependency"]',style:{width:"2px","line-color":"#61afef","target-arrow-color":"#61afef","target-arrow-shape":"triangle","curve-style":"bezier",label:"data(label)",color:"#61afef","font-family":"Outfit, sans-serif","font-size":"10px","font-weight":"bold","text-background-color":"#1e222b","text-background-opacity":.95,"text-background-padding":"3px","text-background-shape":"roundrectangle"}},{selector:"node:selected",style:{"border-width":"1.5px","border-color":"#61afef"}},{selector:".dimmed",style:{opacity:.15,"text-opacity":.15}},{selector:".highlighted-center",style:{"border-width":"2px","border-color":"#61afef","overlay-opacity":.15,"z-index":9999,opacity:1,"text-opacity":1}},{selector:".highlighted-outgoing",style:{"line-color":"#98c379","target-arrow-color":"#98c379",width:2,"z-index":9998,opacity:1}},{selector:".highlighted-outgoing-node",style:{"font-size":"11.5px","border-width":"1.8px","border-color":"#98c379","z-index":9997,opacity:1,"text-opacity":1}},{selector:".highlighted-incoming",style:{"line-color":"#c678dd","target-arrow-color":"#c678dd",width:2,"z-index":9998,opacity:1}},{selector:".highlighted-incoming-node",style:{"font-size":"11.5px","border-width":"1.8px","border-color":"#c678dd","z-index":9997,opacity:1,"text-opacity":1}},{selector:":parent.highlighted-parent-active",style:{"border-color":"#61afef","border-width":"1.5px","border-style":"solid","background-color":"rgba(74, 82, 99, 0.55)",color:"#61afef","text-outline-color":"#14161a"}},{selector:":parent.highlighted-parent-outgoing",style:{"border-color":"#98c379","border-width":"1.5px","border-style":"solid","background-color":"rgba(74, 82, 99, 0.55)",color:"#98c379","text-outline-color":"#14161a"}},{selector:":parent.highlighted-parent-incoming",style:{"border-color":"#c678dd","border-width":"1.5px","border-style":"solid","background-color":"rgba(74, 82, 99, 0.55)",color:"#c678dd","text-outline-color":"#14161a"}}],layout:Ss(wr,!1)}),document.getElementById("btn-layout-fcose")?.addEventListener("click",()=>{Ve.layout(Ss(wr,!0)).run()}),document.getElementById("btn-layout-circle")?.addEventListener("click",()=>{Ve.layout({name:"circle",animate:!0}).run()}),document.getElementById("btn-layout-grid")?.addEventListener("click",()=>{Ve.layout({name:"grid",animate:!0}).run()}),document.getElementById("btn-toggle-clusters")?.addEventListener("click",a=>{wr=!wr;let n=a.currentTarget;wr?(n.innerHTML=`
328
+ <svg class="nav-svg-icon" style="width: 16px; height: 16px; stroke: currentColor;" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
329
+ <rect x="3" y="3" width="7" height="9"></rect>
330
+ <rect x="14" y="3" width="7" height="5"></rect>
331
+ <rect x="14" y="12" width="7" height="9"></rect>
332
+ <rect x="3" y="16" width="7" height="5"></rect>
333
+ </svg>
334
+ <span>Hide Clusters</span>
335
+ `,n.classList.add("btn-primary"),n.classList.remove("btn-secondary")):(n.innerHTML=`
336
+ <svg class="nav-svg-icon" style="width: 16px; height: 16px; stroke: currentColor;" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
337
+ <rect x="3" y="3" width="7" height="9"></rect>
338
+ <rect x="14" y="3" width="7" height="5"></rect>
339
+ <rect x="14" y="12" width="7" height="9"></rect>
340
+ <rect x="3" y="16" width="7" height="5"></rect>
341
+ </svg>
342
+ <span>Show Clusters</span>
343
+ `,n.classList.remove("btn-primary"),n.classList.add("btn-secondary")),Ve.batch(()=>{Ve.elements().remove(),Ve.add(nv(Ts,wr))}),Ve.layout(Ss(wr,!0)).run()}),document.getElementById("filter-lang")?.addEventListener("change",a=>{let n=a.target.value;n?(Ve.elements().hide(),Ve.elements(`node[language="${n}"]`).show(),Ve.elements(`node[language="${n}"]`).connectedEdges().show(),Ve.elements(":parent").show()):Ve.elements().show()}),Ve.on("tap","node",a=>{let n=a.target,i=n.data(),o=document.getElementById("details-content");o&&(i.type==="parent"?o.innerHTML=`
344
+ <div style="font-family: 'JetBrains Mono', Monaco, Consolas, monospace; font-size: 12px; line-height: 1.5; color: #cbd5e1; display: flex; flex-direction: column; gap: 10px; width: 100%;">
345
+ <div style="display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 8px; align-items: start;">
346
+ <span style="color: #94a3b8; font-weight: bold; text-transform: uppercase; flex-shrink: 0;">Type</span>
347
+ <span style="color: #98c379; font-weight: bold; text-align: right; word-break: break-all;">DIRECTORY CLUSTER</span>
348
+ </div>
349
+ <div style="display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 8px; align-items: start;">
350
+ <span style="color: #94a3b8; font-weight: bold; text-transform: uppercase; flex-shrink: 0;">Path</span>
351
+ <span style="word-break: break-all; text-align: right;">${i.id.replace("dir:","")}</span>
352
+ </div>
353
+ </div>
354
+ `:o.innerHTML=`
355
+ <div style="font-family: 'JetBrains Mono', Monaco, Consolas, monospace; font-size: 12px; line-height: 1.5; color: #cbd5e1; display: flex; flex-direction: column; gap: 10px; width: 100%;">
356
+ <div style="display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 8px; align-items: start;">
357
+ <span style="color: #94a3b8; font-weight: bold; text-transform: uppercase; flex-shrink: 0;">Path</span>
358
+ <span style="word-break: break-all; text-align: right;">${i.id}</span>
359
+ </div>
360
+ <div style="display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 8px; align-items: start;">
361
+ <span style="color: #94a3b8; font-weight: bold; text-transform: uppercase; flex-shrink: 0;">Language</span>
362
+ <span style="text-align: right; word-break: break-all;">${i.language?i.language.toUpperCase():"UNKNOWN"}</span>
363
+ </div>
364
+ <div style="display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 8px; align-items: start;">
365
+ <span style="color: #94a3b8; font-weight: bold; text-transform: uppercase; flex-shrink: 0;">Lines</span>
366
+ <span style="text-align: right; word-break: break-all;">${i.lines||"N/A"}</span>
367
+ </div>
368
+ <div style="display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 8px; align-items: start;">
369
+ <span style="color: #94a3b8; font-weight: bold; text-transform: uppercase; flex-shrink: 0;">Size</span>
370
+ <span style="text-align: right; word-break: break-all;">${i.size?`${(i.size/1024).toFixed(2)} KB`:"N/A"}</span>
371
+ </div>
372
+ </div>
373
+ `),Ve.batch(()=>{Ve.elements().removeClass("dimmed highlighted-center highlighted-outgoing highlighted-outgoing-node highlighted-incoming highlighted-incoming-node highlighted-parent-active highlighted-parent-outgoing highlighted-parent-incoming"),i.type==="parent"?(Ve.elements().not(":parent").addClass("dimmed"),n.addClass("highlighted-parent-active"),n.children().removeClass("dimmed")):(Ve.elements().not(":parent").addClass("dimmed"),n.removeClass("dimmed").addClass("highlighted-center"),n.parent()&&n.parent().length>0&&n.parent().addClass("highlighted-parent-active"),n.outgoers().forEach(l=>{l.removeClass("dimmed"),l.isEdge()?l.addClass("highlighted-outgoing"):(l.addClass("highlighted-outgoing-node"),l.parent()&&l.parent().length>0&&l.parent().addClass("highlighted-parent-outgoing"))}),n.incomers().forEach(l=>{l.removeClass("dimmed"),l.isEdge()?l.addClass("highlighted-incoming"):(l.addClass("highlighted-incoming-node"),l.parent()&&l.parent().length>0&&l.parent().addClass("highlighted-parent-incoming"))}))})}),Ve.on("tap","edge",a=>{let n=a.target,i=n.data(),o=document.getElementById("details-content");o&&(i.type==="cluster-dependency"?o.innerHTML=`
374
+ <div style="font-family: 'JetBrains Mono', Monaco, Consolas, monospace; font-size: 12px; line-height: 1.5; color: #cbd5e1; display: flex; flex-direction: column; gap: 10px; width: 100%;">
375
+ <div style="display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 8px; align-items: start;">
376
+ <span style="color: #94a3b8; font-weight: bold; text-transform: uppercase; flex-shrink: 0;">Edge ID</span>
377
+ <span style="word-break: break-all; text-align: right;">${i.id}</span>
378
+ </div>
379
+ <div style="display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 8px; align-items: start;">
380
+ <span style="color: #94a3b8; font-weight: bold; text-transform: uppercase; flex-shrink: 0;">Source</span>
381
+ <span style="word-break: break-all; text-align: right;">${i.source.replace("dir:","")}</span>
382
+ </div>
383
+ <div style="display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 8px; align-items: start;">
384
+ <span style="color: #94a3b8; font-weight: bold; text-transform: uppercase; flex-shrink: 0;">Target</span>
385
+ <span style="word-break: break-all; text-align: right;">${i.target.replace("dir:","")}</span>
386
+ </div>
387
+ <div style="display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 8px; align-items: start;">
388
+ <span style="color: #94a3b8; font-weight: bold; text-transform: uppercase; flex-shrink: 0;">Edge Type</span>
389
+ <span style="text-align: right;"><span class="badge" style="background:#2563eb; padding:3px 6px; border-radius:4px; font-size:10px; color:#fff; font-family:inherit;">CLUSTER DEPENDENCY</span></span>
390
+ </div>
391
+ <div style="display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 8px; align-items: start;">
392
+ <span style="color: #94a3b8; font-weight: bold; text-transform: uppercase; flex-shrink: 0;">Count</span>
393
+ <span style="color: #61afef; font-weight: bold; text-align: right;">${i.count} file-level edge(s)</span>
394
+ </div>
395
+ </div>
396
+ `:o.innerHTML=`
397
+ <div style="font-family: 'JetBrains Mono', Monaco, Consolas, monospace; font-size: 12px; line-height: 1.5; color: #cbd5e1; display: flex; flex-direction: column; gap: 10px; width: 100%;">
398
+ <div style="display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 8px; align-items: start;">
399
+ <span style="color: #94a3b8; font-weight: bold; text-transform: uppercase; flex-shrink: 0;">Edge ID</span>
400
+ <span style="word-break: break-all; text-align: right;">${i.id}</span>
401
+ </div>
402
+ <div style="display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 8px; align-items: start;">
403
+ <span style="color: #94a3b8; font-weight: bold; text-transform: uppercase; flex-shrink: 0;">Source</span>
404
+ <span style="word-break: break-all; text-align: right;">${i.source}</span>
405
+ </div>
406
+ <div style="display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 8px; align-items: start;">
407
+ <span style="color: #94a3b8; font-weight: bold; text-transform: uppercase; flex-shrink: 0;">Target</span>
408
+ <span style="word-break: break-all; text-align: right;">${i.target}</span>
409
+ </div>
410
+ <div style="display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 8px; align-items: start;">
411
+ <span style="color: #94a3b8; font-weight: bold; text-transform: uppercase; flex-shrink: 0;">Edge Type</span>
412
+ <span style="text-align: right;"><span class="badge" style="background:#8b5cf6; padding:3px 6px; border-radius:4px; font-size:10px; color:#fff; font-family:inherit;">${i.type}</span></span>
413
+ </div>
414
+ <div style="display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 8px; align-items: start;">
415
+ <span style="color: #94a3b8; font-weight: bold; text-transform: uppercase; flex-shrink: 0;">Verify</span>
416
+ <span style="text-align: right; word-break: break-all;">${i.verifiability}</span>
417
+ </div>
418
+ </div>
419
+ `),Ve.batch(()=>{Ve.elements().removeClass("dimmed highlighted-center highlighted-outgoing highlighted-outgoing-node highlighted-incoming highlighted-incoming-node highlighted-parent-active highlighted-parent-outgoing highlighted-parent-incoming"),Ve.elements().not(":parent").addClass("dimmed"),n.removeClass("dimmed");let s=n.source(),u=n.target();s.removeClass("dimmed").addClass("highlighted-incoming-node"),u.removeClass("dimmed").addClass("highlighted-outgoing-node"),s.parent()&&s.parent().length>0&&s.parent().addClass("highlighted-parent-incoming"),u.parent()&&u.parent().length>0&&u.parent().addClass("highlighted-parent-outgoing")})}),Ve.on("tap",a=>{if(a.target===Ve){Ve.batch(()=>{Ve.elements().removeClass("dimmed highlighted-center highlighted-outgoing highlighted-outgoing-node highlighted-incoming highlighted-incoming-node highlighted-parent-active highlighted-parent-outgoing highlighted-parent-incoming")});let n=document.getElementById("details-content");n&&(n.innerHTML="Click a file node or dependency edge to view details.")}})}catch(t){console.error("Failed to load graph:",t)}}async function ks(t=""){try{let e=await fetch(`/api/symbols?q=${encodeURIComponent(t)}`);if(!e.ok)return;let r=await e.json(),a=document.querySelector("#table-symbols tbody");if(!a)return;if(a.innerHTML="",r.length===0){let n=document.createElement("tr");n.innerHTML=`
420
+ <td colspan="3" style="text-align: center; color: var(--text-muted); padding: 30px; font-style: italic;">
421
+ No symbols found matching "${t||""}"
422
+ </td>
423
+ `,a.appendChild(n);return}r.forEach(n=>{let i=document.createElement("tr");i.innerHTML=`
424
+ <td style="color:#60a5fa; font-weight:500;">${n.name}</td>
425
+ <td>${n.kind}</td>
426
+ <td style="color:#94a3b8; font-size:12px;">${n.file_path}</td>
427
+ `,i.addEventListener("click",()=>ov(n.name)),a.appendChild(i)})}catch(e){console.error(e)}}function jm(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function ov(t){try{let e=await fetch(`/api/symbol/${encodeURIComponent(t)}`);if(!e.ok)return;let r=await e.json(),a=document.getElementById("symbol-detail-view");if(!a)return;a.innerHTML=`
428
+ <div style="font-family: 'JetBrains Mono', Monaco, Consolas, monospace; font-size: 12px; line-height: 1.6; color: #cbd5e1; display: flex; flex-direction: column; gap: 16px; width: 100%; height: 100%; min-height: 0;">
429
+ <div style="border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 12px; flex-shrink: 0;">
430
+ <h3 style="margin: 0 0 6px 0; color: #e5c07b; font-size: 14px;">${r.symbol.name}</h3>
431
+ <span style="background: rgba(229, 192, 123, 0.1); color: #e5c07b; padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: bold; text-transform: uppercase;">${r.symbol.kind}</span>
432
+ </div>
433
+
434
+ <div style="display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 8px; align-items: start; flex-shrink: 0;">
435
+ <span style="color: #94a3b8; font-weight: bold; text-transform: uppercase; flex-shrink: 0;">File</span>
436
+ <span style="word-break: break-all; text-align: right;">${r.symbol.file_path}</span>
437
+ </div>
438
+
439
+ <div style="display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 8px; align-items: start; flex-shrink: 0;">
440
+ <span style="color: #94a3b8; font-weight: bold; text-transform: uppercase; flex-shrink: 0;">Lines</span>
441
+ <span style="text-align: right;">${r.symbol.start_line}-${r.symbol.end_line}</span>
442
+ </div>
443
+
444
+ <div style="display: flex; flex-direction: column; gap: 6px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 8px; flex-shrink: 0;">
445
+ <span style="color: #94a3b8; font-weight: bold; text-transform: uppercase;">Callers (${r.callers.length})</span>
446
+ <ul style="padding-left: 16px; margin: 4px 0 0 0; list-style-type: square; color: #abb2bf;">
447
+ ${r.callers.map(n=>{let i=n.source_symbol;return i&&i!=="<top-level>"?`<li style="margin-bottom: 4px;"><a href="#" class="symbol-link" data-symbol="${i}" style="color: #61afef; text-decoration: none; font-weight: 500;">${i}</a> <span style="color: #5c6370; font-size: 11px;">in ${n.source_file}</span></li>`:`<li style="margin-bottom: 4px; color: #5c6370;"><span style="color: #5c6370;">&lt;top-level&gt;</span> in ${n.source_file}</li>`}).join("")||'<li style="color: #5c6370; list-style-type: none; margin-left: -16px;">None</li>'}
448
+ </ul>
449
+ </div>
450
+
451
+ <div style="display: flex; flex-direction: column; gap: 6px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 8px; flex-shrink: 0;">
452
+ <span style="color: #94a3b8; font-weight: bold; text-transform: uppercase;">Callees (${r.callees.length})</span>
453
+ <ul style="padding-left: 16px; margin: 4px 0 0 0; list-style-type: square; color: #abb2bf;">
454
+ ${r.callees.map(n=>{let i=n.target_symbol;return i?`<li style="margin-bottom: 4px;"><a href="#" class="symbol-link" data-symbol="${i}" style="color: #61afef; text-decoration: none; font-weight: 500;">${i}</a> <span style="color: #5c6370; font-size: 11px;">in ${n.target_file}</span></li>`:`<li style="margin-bottom: 4px; color: #5c6370;">in ${n.target_file}</li>`}).join("")||'<li style="color: #5c6370; list-style-type: none; margin-left: -16px;">None</li>'}
455
+ </ul>
456
+ </div>
457
+
458
+ ${r.sourceCode?`
459
+ <div style="display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 0;">
460
+ <span style="color: #94a3b8; font-weight: bold; text-transform: uppercase; flex-shrink: 0;">Source Code</span>
461
+ <pre class="neat-scrollbar" style="background: #1e1e24; color: #abb2bf; padding: 12px; border-radius: 6px; overflow: auto; font-family: inherit; font-size: 11px; margin: 4px 0 0 0; border: 1px solid rgba(255, 255, 255, 0.05); line-height: 1.5; flex: 1; min-height: 0;">${jm(r.sourceCode)}</pre>
462
+ </div>
463
+ `:""}
464
+ </div>
465
+ `}catch(e){console.error(e)}}async function sv(){try{let t=await fetch("/api/routes");if(!t.ok)return;let e=await t.json(),r=document.querySelector("#table-routes tbody");if(r)if(r.innerHTML="",!e.routes||e.routes.length===0){let n=document.createElement("tr");n.innerHTML=`
466
+ <td colspan="4" style="text-align: center; color: var(--text-muted); padding: 30px; font-style: italic;">
467
+ No framework routes detected in this project.
468
+ </td>
469
+ `,r.appendChild(n)}else e.routes.forEach(n=>{let i=document.createElement("tr");i.innerHTML=`
470
+ <td><strong>${n.framework}</strong></td>
471
+ <td><span style="background:#10b981; padding:2px 6px; border-radius:4px; font-size:11px; color:#fff;">${n.method}</span></td>
472
+ <td><code>${n.path}</code></td>
473
+ <td style="color:#60a5fa;">${n.handlerSymbol||n.handlerFile}</td>
474
+ `,r.appendChild(i)});let a=document.querySelector("#table-hooks tbody");if(a)if(a.innerHTML="",!e.hooks||e.hooks.length===0){let n=document.createElement("tr");n.innerHTML=`
475
+ <td colspan="4" style="text-align: center; color: var(--text-muted); padding: 30px; font-style: italic;">
476
+ No framework hooks/events detected in this project.
477
+ </td>
478
+ `,a.appendChild(n)}else e.hooks.forEach(n=>{let i=document.createElement("tr");i.innerHTML=`
479
+ <td><strong>${n.framework}</strong></td>
480
+ <td><span style="background:#8b5cf6; padding:2px 6px; border-radius:4px; font-size:11px; color:#fff;">${n.hookType}</span></td>
481
+ <td><code>${n.hookName}</code></td>
482
+ <td style="color:#60a5fa;">${n.handlerSymbol||n.handlerFile}</td>
483
+ `,a.appendChild(i)})}catch(t){console.error(t)}}async function lv(){try{let t=await fetch("/api/metrics");if(!t.ok)return;let e=await t.json(),r=document.getElementById("metrics-summary");r&&(r.innerHTML=`
484
+ <div style="display:flex; flex-direction:column; gap:10px;">
485
+ <div><strong>Total Codebase Volume:</strong> ${e.totalFiles||0} files, ${e.totalSymbols||0} symbols</div>
486
+ <div><strong>Acyclic Graph Metrics:</strong> Density: ${e.density||0} | Transitivity: ${e.transitivity||0}</div>
487
+ </div>
488
+ `);let a=document.getElementById("metrics-languages");if(a&&e.languages){let l=Object.entries(e.languages).sort((f,c)=>c[1]-f[1]);l.length>0?a.innerHTML=`
489
+ <ul style="padding-left: 20px; display: flex; flex-direction: column; gap: 6px;">
490
+ ${l.map(([f,c])=>`
491
+ <li><strong style="text-transform: capitalize;">${f}:</strong> ${c} files</li>
492
+ `).join("")}
493
+ </ul>
494
+ `:a.innerHTML='<div style="color: var(--text-muted);">No language files found.</div>'}let n=document.getElementById("metrics-kinds");n&&e.symbolKinds&&(e.symbolKinds.length>0?n.innerHTML=`
495
+ <ul style="padding-left: 20px; display: flex; flex-direction: column; gap: 6px;">
496
+ ${e.symbolKinds.map(l=>`
497
+ <li><strong style="text-transform: capitalize;">${l.kind}:</strong> ${l.cnt}</li>
498
+ `).join("")}
499
+ </ul>
500
+ `:n.innerHTML='<div style="color: var(--text-muted);">No symbols found.</div>');let i=document.getElementById("metrics-edges");if(i){let l=e.edgeTypes&&e.edgeTypes.length>0?e.edgeTypes.map(f=>`<li><strong>${f.edge_type}:</strong> ${f.cnt}</li>`).join(""):'<li style="color: var(--text-muted); list-style-type: none;">None</li>';i.innerHTML=`
501
+ <div style="display:flex; flex-direction:column; gap:10px;">
502
+ <div><strong>Total Edges:</strong> ${e.totalEdges||0}</div>
503
+ <div><strong>Relation Density:</strong> ${e.density||"0%"}</div>
504
+ <div><strong>Avg Edges/File:</strong> ${e.avgEdgesPerFile||0}</div>
505
+ <div><strong>Verified Edges:</strong> ${e.verifiedEdges||0} | <strong>Inferred Edges:</strong> ${e.inferredEdges||0}</div>
506
+ <div style="margin-top: 5px;">
507
+ <strong>Edge Types Breakdown:</strong>
508
+ <ul style="padding-left: 20px; margin-top: 5px; display: flex; flex-direction: column; gap: 4px;">
509
+ ${l}
510
+ </ul>
511
+ </div>
512
+ </div>
513
+ `}let o=document.getElementById("metrics-git-storage");if(o){let l=e.dbSize!=null?(e.dbSize/1024).toFixed(1):"0",f=e.git||{},c="";if(!f.isGit)c="<div><strong>Git Repository:</strong> No git repository detected</div>";else if(f.changesCount===0)c="<div><strong>Git Status:</strong> \u2713 Index up-to-date (no changes since last scan)</div>";else{let v=f.changes.map(d=>`
514
+ <li><span style="font-family: monospace;">[${d.status}]</span> ${d.path}</li>
515
+ `).join("");c=`
516
+ <div>
517
+ <strong>Git Status:</strong> \u26A0 Stale (${f.changesCount} changed files since last scan)
518
+ <ul style="padding-left: 20px; margin-top: 5px; max-height: 100px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px;">
519
+ ${v}
520
+ </ul>
521
+ </div>
522
+ `}o.innerHTML=`
523
+ <div style="display:flex; flex-direction:column; gap:10px;">
524
+ <div><strong>Database Size:</strong> ${l} KB</div>
525
+ ${c}
526
+ </div>
527
+ `}let s=document.getElementById("top-files-list");s&&(e.topFiles&&e.topFiles.length>0?s.innerHTML=e.topFiles.map(l=>`
528
+ <li>${l.path} (PageRank: ${(l.pagerank||0).toFixed(4)})</li>
529
+ `).join(""):s.innerHTML='<li style="color: var(--text-muted); list-style-type: none;">No files available in metrics</li>');let u=document.getElementById("top-symbols-list");u&&(e.topSymbols&&e.topSymbols.length>0?u.innerHTML=e.topSymbols.map(l=>`
530
+ <li>${l.name} (PageRank: ${(l.pagerank||0).toFixed(4)})</li>
531
+ `).join(""):u.innerHTML='<li style="color: var(--text-muted); list-style-type: none;">No symbols available in metrics</li>')}catch(t){console.error(t)}}function e0(){let t=document.getElementById("btn-build-context"),e=document.getElementById("context-task"),r=document.getElementById("context-results");t?.addEventListener("click",async()=>{let a=e?.value||"";if(a){r&&(r.innerHTML='<div class="details-placeholder">Building optimal context map...</div>');try{let n=await fetch("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({task:a})});if(!n.ok){let o=await n.json();r&&(r.innerHTML=`<div class="details-placeholder" style="color:#ef4444;">Error: ${o.error}</div>`);return}let i=await n.json();r&&(r.innerHTML=`
532
+ <div style="display:flex; flex-direction:column; gap:16px;">
533
+ <h3>Context Analysis results</h3>
534
+ <div><strong>Token Budget Used:</strong> ${i.estimatedTokens||0} tokens</div>
535
+ <div>
536
+ <strong>Key Context Files:</strong>
537
+ <ul style="padding-left:20px; margin-top:5px; display: flex; flex-direction: column; gap: 4px;">
538
+ ${i.files&&i.files.length>0?i.files.map(o=>`
539
+ <li>
540
+ <code>${o.path||o}</code>
541
+ <span style="font-size: 0.85em; color: var(--text-muted); margin-left: 8px;">
542
+ (${o.language||"unknown"} \u2022 ${o.lineCount||0} lines)
543
+ </span>
544
+ </li>
545
+ `).join(""):'<li style="color: var(--text-muted); list-style-type: none; margin-left: -20px;">None found</li>'}
546
+ </ul>
547
+ </div>
548
+ <div>
549
+ <strong>Relevant Entry Symbols:</strong>
550
+ <ul style="padding-left:20px; margin-top:5px; display: flex; flex-direction: column; gap: 4px;">
551
+ ${i.symbols&&i.symbols.length>0?i.symbols.map(o=>`
552
+ <li>
553
+ <code>${o.name||o}</code>
554
+ <span style="font-size: 0.85em; color: var(--text-muted); margin-left: 8px;">
555
+ (${o.kind||"unknown"} \u2022 <code>${o.filePath||""}</code>)
556
+ </span>
557
+ </li>
558
+ `).join(""):'<li style="color: var(--text-muted); list-style-type: none; margin-left: -20px;">None found</li>'}
559
+ </ul>
560
+ </div>
561
+ </div>
562
+ `)}catch(n){r&&(r.innerHTML=`<div class="details-placeholder" style="color:#ef4444;">Error: ${n.message}</div>`)}}})}function t0(){setInterval(async()=>{let t=document.getElementById("tool-log-container");if(t)try{let e=await fetch("/api/tool-calls");if(e.ok){let r=await e.json();if(r.length>0){let a=t.querySelector(".log-placeholder"),n=[...r].reverse();for(let i of n){let o=Bs(i);sa.has(o)||(sa.add(o),a&&a.remove(),t.prepend(Ds(i)))}}}}catch(e){console.error("Failed to poll tool calls:",e)}try{let e=await fetch("/api/status");if(e.ok){let r=await e.json(),a=r.fileCount||0,n=r.symbolCount||0,i=r.edgeCount||0;if(a!==Qn||n!==Jn||i!==jn){Qn=a,Jn=n,jn=i,document.getElementById("repo-name").textContent=r.repoName||"MapX Project",document.getElementById("stat-files").textContent=String(a),document.getElementById("stat-symbols").textContent=String(n),document.getElementById("stat-edges").textContent=String(i);let o=document.getElementById("filter-lang");if(o&&r.languages){let s=o.value;o.innerHTML='<option value="">All Languages</option>',Object.keys(r.languages).forEach(u=>{let l=document.createElement("option");l.value=u,l.textContent=u.toUpperCase(),o.appendChild(l)}),o.value=s}Ps(),ks(),sv(),lv()}}}catch(e){console.error("Failed to poll status:",e)}},2e3)}document.addEventListener("DOMContentLoaded",()=>{iv(),Ps(),ks(),sv(),lv(),Qm(),Jm(),e0(),t0(),document.getElementById("symbol-search")?.addEventListener("input",r=>{let a=r.target.value;ks(a)}),document.getElementById("symbol-detail-view")?.addEventListener("click",r=>{let a=r.target;if(a&&a.classList.contains("symbol-link")){r.preventDefault();let n=a.getAttribute("data-symbol");n&&ov(n)}})});})();
563
+ /*! Bundled license information:
564
+
565
+ cytoscape/dist/cytoscape.esm.mjs:
566
+ (*!
567
+ Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
568
+ Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
569
+ Licensed under The MIT License (http://opensource.org/licenses/MIT)
570
+ *)
571
+ (*!
572
+ Event object based on jQuery events, MIT license
573
+
574
+ https://jquery.org/license/
575
+ https://tldrlegal.com/license/mit-license
576
+ https://github.com/jquery/jquery/blob/master/src/event.js
577
+ *)
578
+ (*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License *)
579
+ (*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License *)
580
+ */
581
+ //# sourceMappingURL=main.js.map