@aloudata/ink-flow 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/package.json +2 -3
  2. package/dist/base.css +0 -6
  3. package/dist/components/A11yDescriptions/index.d.ts +0 -8
  4. package/dist/components/A11yDescriptions/index.d.ts.map +0 -1
  5. package/dist/components/BatchProvider/index.d.ts +0 -17
  6. package/dist/components/BatchProvider/index.d.ts.map +0 -1
  7. package/dist/components/BatchProvider/types.d.ts +0 -7
  8. package/dist/components/BatchProvider/types.d.ts.map +0 -1
  9. package/dist/components/BatchProvider/useQueue.d.ts +0 -11
  10. package/dist/components/BatchProvider/useQueue.d.ts.map +0 -1
  11. package/dist/components/EdgeWrapper/EdgeUpdateAnchors.d.ts +0 -17
  12. package/dist/components/EdgeWrapper/EdgeUpdateAnchors.d.ts.map +0 -1
  13. package/dist/components/EdgeWrapper/index.d.ts +0 -3
  14. package/dist/components/EdgeWrapper/index.d.ts.map +0 -1
  15. package/dist/components/EdgeWrapper/utils.d.ts +0 -11
  16. package/dist/components/EdgeWrapper/utils.d.ts.map +0 -1
  17. package/dist/components/Edges/BaseEdge.d.ts +0 -3
  18. package/dist/components/Edges/BaseEdge.d.ts.map +0 -1
  19. package/dist/components/Edges/BezierEdge.d.ts +0 -5
  20. package/dist/components/Edges/BezierEdge.d.ts.map +0 -1
  21. package/dist/components/Edges/EdgeAnchor.d.ts +0 -14
  22. package/dist/components/Edges/EdgeAnchor.d.ts.map +0 -1
  23. package/dist/components/Edges/EdgeText.d.ts +0 -8
  24. package/dist/components/Edges/EdgeText.d.ts.map +0 -1
  25. package/dist/components/Edges/SimpleBezierEdge.d.ts +0 -21
  26. package/dist/components/Edges/SimpleBezierEdge.d.ts.map +0 -1
  27. package/dist/components/Edges/SmoothStepEdge.d.ts +0 -5
  28. package/dist/components/Edges/SmoothStepEdge.d.ts.map +0 -1
  29. package/dist/components/Edges/StepEdge.d.ts +0 -5
  30. package/dist/components/Edges/StepEdge.d.ts.map +0 -1
  31. package/dist/components/Edges/StraightEdge.d.ts +0 -5
  32. package/dist/components/Edges/StraightEdge.d.ts.map +0 -1
  33. package/dist/components/Edges/index.d.ts +0 -6
  34. package/dist/components/Edges/index.d.ts.map +0 -1
  35. package/dist/components/Handle/index.d.ts +0 -9
  36. package/dist/components/Handle/index.d.ts.map +0 -1
  37. package/dist/components/InkFlowProvider/index.d.ts +0 -14
  38. package/dist/components/InkFlowProvider/index.d.ts.map +0 -1
  39. package/dist/components/NodeWrapper/index.d.ts +0 -3
  40. package/dist/components/NodeWrapper/index.d.ts.map +0 -1
  41. package/dist/components/NodeWrapper/useNodeObserver.d.ts +0 -14
  42. package/dist/components/NodeWrapper/useNodeObserver.d.ts.map +0 -1
  43. package/dist/components/NodeWrapper/utils.d.ts +0 -9
  44. package/dist/components/NodeWrapper/utils.d.ts.map +0 -1
  45. package/dist/components/Nodes/DefaultNode.d.ts +0 -3
  46. package/dist/components/Nodes/DefaultNode.d.ts.map +0 -1
  47. package/dist/components/Nodes/GroupNode.d.ts +0 -2
  48. package/dist/components/Nodes/GroupNode.d.ts.map +0 -1
  49. package/dist/components/Nodes/InputNode.d.ts +0 -4
  50. package/dist/components/Nodes/InputNode.d.ts.map +0 -1
  51. package/dist/components/Nodes/OutputNode.d.ts +0 -3
  52. package/dist/components/Nodes/OutputNode.d.ts.map +0 -1
  53. package/dist/components/Nodes/utils.d.ts +0 -13
  54. package/dist/components/Nodes/utils.d.ts.map +0 -1
  55. package/dist/components/Panel/index.d.ts +0 -11
  56. package/dist/components/Panel/index.d.ts.map +0 -1
  57. package/dist/components/StoreUpdater/index.d.ts +0 -9
  58. package/dist/components/StoreUpdater/index.d.ts.map +0 -1
  59. package/dist/components/UserSelection/index.d.ts +0 -2
  60. package/dist/components/UserSelection/index.d.ts.map +0 -1
  61. package/dist/constants/errorMessages.d.ts +0 -22
  62. package/dist/constants/errorMessages.d.ts.map +0 -1
  63. package/dist/constants/index.d.ts +0 -2
  64. package/dist/constants/index.d.ts.map +0 -1
  65. package/dist/container/EdgeRenderer/MarkerDefinitions.d.ts +0 -10
  66. package/dist/container/EdgeRenderer/MarkerDefinitions.d.ts.map +0 -1
  67. package/dist/container/EdgeRenderer/MarkerSymbols.d.ts +0 -9
  68. package/dist/container/EdgeRenderer/MarkerSymbols.d.ts.map +0 -1
  69. package/dist/container/EdgeRenderer/index.d.ts +0 -13
  70. package/dist/container/EdgeRenderer/index.d.ts.map +0 -1
  71. package/dist/container/FlowRenderer/index.d.ts +0 -14
  72. package/dist/container/FlowRenderer/index.d.ts.map +0 -1
  73. package/dist/container/GraphView/index.d.ts +0 -11
  74. package/dist/container/GraphView/index.d.ts.map +0 -1
  75. package/dist/container/InkFlow/Wrapper.d.ts +0 -13
  76. package/dist/container/InkFlow/Wrapper.d.ts.map +0 -1
  77. package/dist/container/InkFlow/index.d.ts +0 -4
  78. package/dist/container/InkFlow/index.d.ts.map +0 -1
  79. package/dist/container/InkFlow/init-values.d.ts +0 -4
  80. package/dist/container/InkFlow/init-values.d.ts.map +0 -1
  81. package/dist/container/NodeRenderer/index.d.ts +0 -10
  82. package/dist/container/NodeRenderer/index.d.ts.map +0 -1
  83. package/dist/container/NodeRenderer/useResizeObserver.d.ts +0 -2
  84. package/dist/container/NodeRenderer/useResizeObserver.d.ts.map +0 -1
  85. package/dist/container/Pane/index.d.ts +0 -12
  86. package/dist/container/Pane/index.d.ts.map +0 -1
  87. package/dist/container/Viewport/index.d.ts +0 -7
  88. package/dist/container/Viewport/index.d.ts.map +0 -1
  89. package/dist/container/ZoomPane/index.d.ts +0 -7
  90. package/dist/container/ZoomPane/index.d.ts.map +0 -1
  91. package/dist/contexts/NodeIdContext.d.ts +0 -6
  92. package/dist/contexts/NodeIdContext.d.ts.map +0 -1
  93. package/dist/contexts/StoreContext.d.ts +0 -4
  94. package/dist/contexts/StoreContext.d.ts.map +0 -1
  95. package/dist/hooks/index.d.ts +0 -5
  96. package/dist/hooks/index.d.ts.map +0 -1
  97. package/dist/hooks/useDrag.d.ts +0 -12
  98. package/dist/hooks/useDrag.d.ts.map +0 -1
  99. package/dist/hooks/useEdgesState.d.ts +0 -4
  100. package/dist/hooks/useEdgesState.d.ts.map +0 -1
  101. package/dist/hooks/useGlobalKeyHandler.d.ts +0 -11
  102. package/dist/hooks/useGlobalKeyHandler.d.ts.map +0 -1
  103. package/dist/hooks/useInkFlow.d.ts +0 -10
  104. package/dist/hooks/useInkFlow.d.ts.map +0 -1
  105. package/dist/hooks/useIsomorphicLayoutEffect.d.ts +0 -3
  106. package/dist/hooks/useIsomorphicLayoutEffect.d.ts.map +0 -1
  107. package/dist/hooks/useKeyPress.d.ts +0 -15
  108. package/dist/hooks/useKeyPress.d.ts.map +0 -1
  109. package/dist/hooks/useMoveSelectedNodes.d.ts +0 -12
  110. package/dist/hooks/useMoveSelectedNodes.d.ts.map +0 -1
  111. package/dist/hooks/useNodesState.d.ts +0 -4
  112. package/dist/hooks/useNodesState.d.ts.map +0 -1
  113. package/dist/hooks/useResizeHandler.d.ts +0 -8
  114. package/dist/hooks/useResizeHandler.d.ts.map +0 -1
  115. package/dist/hooks/useStore.d.ts +0 -21
  116. package/dist/hooks/useStore.d.ts.map +0 -1
  117. package/dist/hooks/useViewportHelper.d.ts +0 -10
  118. package/dist/hooks/useViewportHelper.d.ts.map +0 -1
  119. package/dist/hooks/useVisibleEdgeIds.d.ts +0 -9
  120. package/dist/hooks/useVisibleEdgeIds.d.ts.map +0 -1
  121. package/dist/hooks/useVisibleNodeIds.d.ts +0 -9
  122. package/dist/hooks/useVisibleNodeIds.d.ts.map +0 -1
  123. package/dist/index.cjs.js +0 -17
  124. package/dist/index.cjs.js.map +0 -1
  125. package/dist/index.d.ts +0 -9
  126. package/dist/index.d.ts.map +0 -1
  127. package/dist/index.esm.js +0 -17
  128. package/dist/index.esm.js.map +0 -1
  129. package/dist/plugins/Controls/ControlButton.d.ts +0 -3
  130. package/dist/plugins/Controls/ControlButton.d.ts.map +0 -1
  131. package/dist/plugins/Controls/Controls.d.ts +0 -8
  132. package/dist/plugins/Controls/Controls.d.ts.map +0 -1
  133. package/dist/plugins/Controls/Icons/FitView.d.ts +0 -2
  134. package/dist/plugins/Controls/Icons/FitView.d.ts.map +0 -1
  135. package/dist/plugins/Controls/Icons/Lock.d.ts +0 -2
  136. package/dist/plugins/Controls/Icons/Lock.d.ts.map +0 -1
  137. package/dist/plugins/Controls/Icons/Minus.d.ts +0 -2
  138. package/dist/plugins/Controls/Icons/Minus.d.ts.map +0 -1
  139. package/dist/plugins/Controls/Icons/Plus.d.ts +0 -2
  140. package/dist/plugins/Controls/Icons/Plus.d.ts.map +0 -1
  141. package/dist/plugins/Controls/Icons/Unlock.d.ts +0 -2
  142. package/dist/plugins/Controls/Icons/Unlock.d.ts.map +0 -1
  143. package/dist/plugins/Controls/index.d.ts +0 -4
  144. package/dist/plugins/Controls/index.d.ts.map +0 -1
  145. package/dist/plugins/Controls/types.d.ts +0 -35
  146. package/dist/plugins/Controls/types.d.ts.map +0 -1
  147. package/dist/plugins/index.d.ts +0 -2
  148. package/dist/plugins/index.d.ts.map +0 -1
  149. package/dist/store/index.d.ts +0 -12
  150. package/dist/store/index.d.ts.map +0 -1
  151. package/dist/store/initialState.d.ts +0 -12
  152. package/dist/store/initialState.d.ts.map +0 -1
  153. package/dist/styles/utils.d.ts +0 -3
  154. package/dist/styles/utils.d.ts.map +0 -1
  155. package/dist/types/edges.d.ts +0 -114
  156. package/dist/types/edges.d.ts.map +0 -1
  157. package/dist/types/general.d.ts +0 -123
  158. package/dist/types/general.d.ts.map +0 -1
  159. package/dist/types/index.d.ts +0 -7
  160. package/dist/types/index.d.ts.map +0 -1
  161. package/dist/types/instance.d.ts +0 -149
  162. package/dist/types/instance.d.ts.map +0 -1
  163. package/dist/types/nodes.d.ts +0 -40
  164. package/dist/types/nodes.d.ts.map +0 -1
  165. package/dist/types/props.d.ts +0 -151
  166. package/dist/types/props.d.ts.map +0 -1
  167. package/dist/types/store.d.ts +0 -105
  168. package/dist/types/store.d.ts.map +0 -1
  169. package/dist/types/system/changes.d.ts +0 -51
  170. package/dist/types/system/changes.d.ts.map +0 -1
  171. package/dist/types/system/edges.d.ts +0 -83
  172. package/dist/types/system/edges.d.ts.map +0 -1
  173. package/dist/types/system/general.d.ts +0 -119
  174. package/dist/types/system/general.d.ts.map +0 -1
  175. package/dist/types/system/handles.d.ts +0 -51
  176. package/dist/types/system/handles.d.ts.map +0 -1
  177. package/dist/types/system/index.d.ts +0 -8
  178. package/dist/types/system/index.d.ts.map +0 -1
  179. package/dist/types/system/nodes.d.ts +0 -126
  180. package/dist/types/system/nodes.d.ts.map +0 -1
  181. package/dist/types/system/panzoom.d.ts +0 -49
  182. package/dist/types/system/panzoom.d.ts.map +0 -1
  183. package/dist/types/system/utils.d.ts +0 -25
  184. package/dist/types/system/utils.d.ts.map +0 -1
  185. package/dist/types/utils/types.d.ts +0 -8
  186. package/dist/types/utils/types.d.ts.map +0 -1
  187. package/dist/utils/bezier-edge.d.ts +0 -59
  188. package/dist/utils/bezier-edge.d.ts.map +0 -1
  189. package/dist/utils/changes.d.ts +0 -16
  190. package/dist/utils/changes.d.ts.map +0 -1
  191. package/dist/utils/dom.d.ts +0 -20
  192. package/dist/utils/dom.d.ts.map +0 -1
  193. package/dist/utils/edges/bezier-edge.d.ts +0 -59
  194. package/dist/utils/edges/bezier-edge.d.ts.map +0 -1
  195. package/dist/utils/edges/general.d.ts +0 -46
  196. package/dist/utils/edges/general.d.ts.map +0 -1
  197. package/dist/utils/edges/index.d.ts +0 -6
  198. package/dist/utils/edges/index.d.ts.map +0 -1
  199. package/dist/utils/edges/positions.d.ts +0 -12
  200. package/dist/utils/edges/positions.d.ts.map +0 -1
  201. package/dist/utils/edges/smoothstep-edge.d.ts +0 -43
  202. package/dist/utils/edges/smoothstep-edge.d.ts.map +0 -1
  203. package/dist/utils/edges/straight-edge.d.ts +0 -28
  204. package/dist/utils/edges/straight-edge.d.ts.map +0 -1
  205. package/dist/utils/edges.d.ts +0 -26
  206. package/dist/utils/edges.d.ts.map +0 -1
  207. package/dist/utils/general.d.ts +0 -61
  208. package/dist/utils/general.d.ts.map +0 -1
  209. package/dist/utils/graph.d.ts +0 -113
  210. package/dist/utils/graph.d.ts.map +0 -1
  211. package/dist/utils/marker.d.ts +0 -9
  212. package/dist/utils/marker.d.ts.map +0 -1
  213. package/dist/utils/positions.d.ts +0 -12
  214. package/dist/utils/positions.d.ts.map +0 -1
  215. package/dist/utils/smoothstep-edge.d.ts +0 -43
  216. package/dist/utils/smoothstep-edge.d.ts.map +0 -1
  217. package/dist/utils/store.d.ts +0 -30
  218. package/dist/utils/store.d.ts.map +0 -1
  219. package/dist/utils/straight-edge.d.ts +0 -34
  220. package/dist/utils/straight-edge.d.ts.map +0 -1
  221. package/dist/utils/xydrag/XYDrag.d.ts +0 -52
  222. package/dist/utils/xydrag/XYDrag.d.ts.map +0 -1
  223. package/dist/utils/xydrag/index.d.ts +0 -2
  224. package/dist/utils/xydrag/index.d.ts.map +0 -1
  225. package/dist/utils/xydrag/utils.d.ts +0 -10
  226. package/dist/utils/xydrag/utils.d.ts.map +0 -1
  227. package/dist/utils/xyhandle/XYHandle.d.ts +0 -49
  228. package/dist/utils/xyhandle/XYHandle.d.ts.map +0 -1
  229. package/dist/utils/xyhandle/index.d.ts +0 -2
  230. package/dist/utils/xyhandle/index.d.ts.map +0 -1
  231. package/dist/utils/xyhandle/utils.d.ts +0 -14
  232. package/dist/utils/xyhandle/utils.d.ts.map +0 -1
  233. package/dist/utils/xypanzoom/XYPanZoom.d.ts +0 -12
  234. package/dist/utils/xypanzoom/XYPanZoom.d.ts.map +0 -1
  235. package/dist/utils/xypanzoom/eventhandler.d.ts +0 -46
  236. package/dist/utils/xypanzoom/eventhandler.d.ts.map +0 -1
  237. package/dist/utils/xypanzoom/filter.d.ts +0 -14
  238. package/dist/utils/xypanzoom/filter.d.ts.map +0 -1
  239. package/dist/utils/xypanzoom/index.d.ts +0 -2
  240. package/dist/utils/xypanzoom/index.d.ts.map +0 -1
  241. package/dist/utils/xypanzoom/utils.d.ts +0 -10
  242. package/dist/utils/xypanzoom/utils.d.ts.map +0 -1
package/dist/index.esm.js DELETED
@@ -1,17 +0,0 @@
1
- import e,{createContext as n,useContext as t,useMemo as r,forwardRef as o,useState as i,useRef as a,useEffect as u,memo as c,useCallback as l,useLayoutEffect as s}from"react";var d=function(){return d=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},d.apply(this,arguments)};function f(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}function h(e,n,t,r){return new(t||(t=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function u(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,u)}c((r=r.apply(e,n||[])).next())}))}function v(e,n){var t,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(c){return function(u){if(t)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(t=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=n.call(e,a)}catch(e){u=[6,e],r=0}finally{t=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}function p(e){var n="function"==typeof Symbol&&Symbol.iterator,t=n&&e[n],r=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),a=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function y(e,n,t){if(t||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}function m(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"function"==typeof SuppressedError&&SuppressedError;var w,b={exports:{}},x={};b.exports=function(){if(w)return x;w=1;var n=e,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function u(e,n,r){var u,c={},l=null,s=null;for(u in void 0!==r&&(l=""+r),void 0!==n.key&&(l=""+n.key),void 0!==n.ref&&(s=n.ref),n)o.call(n,u)&&!a.hasOwnProperty(u)&&(c[u]=n[u]);if(e&&e.defaultProps)for(u in n=e.defaultProps)void 0===c[u]&&(c[u]=n[u]);return{$$typeof:t,type:e,key:l,ref:s,props:c,_owner:i.current}}return x.Fragment=r,x.jsx=u,x.jsxs=u,x}();var _,E=b.exports,S={exports:{}};
2
- /*!
3
- Copyright (c) 2018 Jed Watson.
4
- Licensed under the MIT License (MIT), see
5
- http://jedwatson.github.io/classnames
6
- */
7
- _=S,function(){var e={}.hasOwnProperty;function n(){for(var t=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var i=typeof o;if("string"===i||"number"===i)t.push(o);else if(Array.isArray(o)){if(o.length){var a=n.apply(null,o);a&&t.push(a)}}else if("object"===i)if(o.toString===Object.prototype.toString)for(var u in o)e.call(o,u)&&o[u]&&t.push(u);else t.push(o.toString())}}return t.join(" ")}_.exports?(n.default=n,_.exports=n):window.classNames=n}();var k,N,C,O=m(S.exports),M={exports:{}},j={},I={exports:{}},P={};function A(){return N||(N=1,I.exports=function(){if(k)return P;k=1;var n=e,t="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},r=n.useState,o=n.useEffect,i=n.useLayoutEffect,a=n.useDebugValue;function u(e){var n=e.getSnapshot;e=e.value;try{var r=n();return!t(e,r)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,n){return n()}:function(e,n){var t=n(),c=r({inst:{value:t,getSnapshot:n}}),l=c[0].inst,s=c[1];return i((function(){l.value=t,l.getSnapshot=n,u(l)&&s({inst:l})}),[e,t,n]),o((function(){return u(l)&&s({inst:l}),e((function(){u(l)&&s({inst:l})}))}),[e]),a(t),t};return P.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:c,P}()),I.exports}
8
- /**
9
- * @license React
10
- * use-sync-external-store-shim/with-selector.production.min.js
11
- *
12
- * Copyright (c) Facebook, Inc. and its affiliates.
13
- *
14
- * This source code is licensed under the MIT license found in the
15
- * LICENSE file in the root directory of this source tree.
16
- */M.exports=function(){if(C)return j;C=1;var n=e,t=A(),r="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},o=t.useSyncExternalStore,i=n.useRef,a=n.useEffect,u=n.useMemo,c=n.useDebugValue;return j.useSyncExternalStoreWithSelector=function(e,n,t,l,s){var d=i(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=u((function(){function e(e){if(!a){if(a=!0,o=e,e=l(e),void 0!==s&&f.hasValue){var n=f.value;if(s(n,e))return i=n}return i=e}if(n=i,r(o,e))return n;var t=l(e);return void 0!==s&&s(n,t)?n:(o=e,i=t)}var o,i,a=!1,u=void 0===t?null:t;return[function(){return e(n())},null===u?void 0:function(){return e(u())}]}),[n,t,l,s]);var h=o(e,d[0],d[1]);return a((function(){f.hasValue=!0,f.value=h}),[h]),c(h),h},j}();var z=m(M.exports);const T=e=>{let n;const t=new Set,r=(e,r)=>{const o="function"==typeof e?e(n):e;if(!Object.is(o,n)){const e=n;n=(null!=r?r:"object"!=typeof o||null===o)?o:Object.assign({},n,o),t.forEach((t=>t(n,e)))}},o=()=>n,i={setState:r,getState:o,getInitialState:()=>a,subscribe:e=>(t.add(e),()=>t.delete(e)),destroy:()=>{"production"!==(import.meta.env?import.meta.env.MODE:void 0)&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),t.clear()}},a=n=e(r,o,i);return i},{useDebugValue:B}=e,{useSyncExternalStoreWithSelector:D}=z,L=e=>e;function V(e,n=L,t){const r=D(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,t);return B(r),r}const R=(e,n)=>{const t=(e=>e?T(e):T)(e),r=(e,r=n)=>V(t,e,r);return Object.assign(r,t),r};var H=n(null),Z=H.Provider,Y={error001:function(){return"[Ink Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://InkFlow.dev/error#001"},error002:function(){return"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them."},error003:function(e){return'Node type "'.concat(e,'" not found. Using fallback type "default".')},error004:function(){return"The Ink Flow parent container needs a width and a height to render the graph."},error005:function(){return"Only child nodes can use a parent extent."},error006:function(){return"Can't create edge. An edge needs a source and a target."},error007:function(e){return"The old edge with id=".concat(e," does not exist.")},error009:function(e){return'Marker type "'.concat(e,"\" doesn't exist.")},error008:function(e,n){var t=n.id,r=n.sourceHandle,o=n.targetHandle;return"Couldn't create edge for ".concat(e,' handle id: "').concat(r?o:r,'", edge id: ').concat(t,".")},error010:function(){return"Handle: No node id found. Make sure to only use a Handle inside a custom Node."},error011:function(e){return'Edge type "'.concat(e,'" not found. Using fallback type "default".')},error012:function(e){return'Node with id "'.concat(e,'" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.')}},X=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],F=["Enter"," ","Escape"],U=Y.error001();function G(e,n){var r=t(H);if(null===r)throw new Error(U);return V(r,e,n)}function $(){var e=t(H);if(null===e)throw new Error(U);return r((function(){return{getState:e.getState,setState:e.setState,subscribe:e.subscribe}}),[e])}function W(e,n){var t,r,o;void 0===n&&(n={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{}});var i=(null==n?void 0:n.elevateNodesOnSelect)?1e3:0;try{for(var a=p(e),u=a.next();!u.done;u=a.next()){var c=g(u.value,2)[1],l=c.parentId;if(l){if(!e.has(l))throw new Error("Parent node ".concat(l," not found"));var s=e.get(l),f=q(c,e,d(d({},c.position),{z:(oe(c.zIndex)?c.zIndex:0)+(c.selected?i:0)}),null!==(o=null==s?void 0:s.origin)&&void 0!==o?o:n.nodeOrigin),h=f.x,v=f.y,y=f.z,m=c.internals.positionAbsolute,w=h!==m.x||v!==m.y;(w||y!==c.internals.z)&&(c.internals=d(d({},c.internals),{positionAbsolute:w?{x:h,y:v}:m,z:y}))}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}function q(e,n,t,r){var o,i,a,u,c,l;if(void 0===r&&(r=[0,0]),!e.parentId)return t;var s=n.get(e.parentId),d=K(s,r).position;return q(s,n,{x:(null!==(o=t.x)&&void 0!==o?o:0)+d.x,y:(null!==(i=t.y)&&void 0!==i?i:0)+d.y,z:(null!==(a=s.internals.z)&&void 0!==a?a:0)>(null!==(u=t.z)&&void 0!==u?u:0)?null!==(c=s.internals.z)&&void 0!==c?c:0:null!==(l=t.z)&&void 0!==l?l:0},s.origin||r)}var K=function(e,n){void 0===n&&(n=[0,0]);var t=re(e),r=t.width,o=t.height,i="internals"in e?e.internals.positionAbsolute:e.position,a=e.origin||n,u=r*a[0],c=o*a[1];return{position:{x:e.position.x-u,y:e.position.y-c},positionAbsolute:{x:i.x-u,y:i.y-c}}};function Q(e,n,t){var r,o;e.clear(),n.clear();try{for(var i=p(t),a=i.next();!a.done;a=i.next()){var u=a.value,c=u.source,l=u.target,s=u.sourceHandle,d=void 0===s?null:s,f=u.targetHandle,h=void 0===f?null:f,v="".concat(c,"-source-").concat(d),g="".concat(l,"-target-").concat(h),y=e.get(v)||new Map,m=e.get(g)||new Map,w={edgeId:u.id,source:c,target:l,sourceHandle:d,targetHandle:h};n.set(u.id,u),e.set(v,y.set("".concat(l,"-").concat(h),w)),e.set(g,m.set("".concat(c,"-").concat(d),w))}}catch(e){r={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}}function J(e,n,t,r){void 0===r&&(r={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{},checkEquality:!0});var o=new Map(n);n.clear(),t.clear();var i=(null==r?void 0:r.elevateNodesOnSelect)?1e3:0;e.forEach((function(e){var a,u,c=o.get(e.id);if(r.checkEquality&&e===(null==c?void 0:c.internals.userNode)||(c=d(d(d({},r.defaults),e),{measured:{width:null===(a=e.measured)||void 0===a?void 0:a.width,height:null===(u=e.measured)||void 0===u?void 0:u.height},internals:{positionAbsolute:e.position,handleBounds:null==c?void 0:c.internals.handleBounds,z:(oe(e.zIndex)?e.zIndex:0)+(e.selected?i:0),userNode:e}})),n.set(e.id,c),e.parentId){var l=t.get(e.parentId);l?l.push(c):t.set(e.parentId,[c])}})),t.size>0&&W(n,r)}function ee(e,n,t,r){var o,i,a,u,c,l=[],s=new Map;try{for(var d=p(e),f=d.next();!f.done;f=d.next()){var h=f.value,v=n.get(h.parentId);if(v){var g=null!==(u=null===(a=s.get(h.parentId))||void 0===a?void 0:a.expandedRect)&&void 0!==u?u:ue(v,null!==(c=v.origin)&&void 0!==c?c:r),y=fe(g,h.rect);s.set(h.parentId,{expandedRect:y,parent:v})}}}catch(e){o={error:e}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(o)throw o.error}}return s.size>0&&s.forEach((function(n,r){var o=n.expandedRect,i=n.parent,a=K(i,i.origin).position,u=re(i),c=o.x<a.x?Math.round(Math.abs(a.x-o.x)):0,s=o.y<a.y?Math.round(Math.abs(a.y-o.y)):0;if(c>0||s>0){l.push({id:r,type:"position",position:{x:a.x-c,y:a.y-s}});var d=t.get(r);null==d||d.forEach((function(n){e.some((function(e){return e.id===n.id}))||l.push({id:n.id,type:"position",position:{x:n.position.x+c,y:n.position.y+s}})}))}(u.width<o.width||u.height<o.height)&&l.push({id:r,type:"dimensions",setAttributes:!0,dimensions:{width:Math.max(u.width,Math.round(o.width)),height:Math.max(u.height,Math.round(o.height))}})})),l}var ne=function(e,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),Math.min(Math.max(e,n),t)},te=function(e,n){return void 0===e&&(e={x:0,y:0}),{x:ne(e.x,n[0][0],n[1][0]),y:ne(e.y,n[0][1],n[1][1])}};function re(e){var n,t,r,o,i,a,u,c;return{width:null!==(o=null!==(r=null!==(t=null===(n=e.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:e.width)&&void 0!==r?r:e.initialWidth)&&void 0!==o?o:0,height:null!==(c=null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:e.initialHeight)&&void 0!==c?c:0}}var oe=function(e){return!isNaN(e)&&isFinite(e)},ie=function(e,n){return void 0===n&&(n=[1,1]),{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}},ae=function(e,n,t,r){var o=e.x,i=e.y,a=g(n,3),u=a[0],c=a[1],l=a[2];void 0===t&&(t=!1),void 0===r&&(r=[1,1]);var s={x:(o-u)/l,y:(i-c)/l};return t?ie(s,r):s},ue=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=K(e,n).positionAbsolute;return{x:c.x,y:c.y,width:null!==(o=null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:e.width)&&void 0!==o?o:0,height:null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:0}},ce=function(e,n){return{x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}},le=function(e){var n=e.x,t=e.y;return{x:n,y:t,x2:n+e.width,y2:t+e.height}},se=function(e){var n=e.x,t=e.y;return{x:n,y:t,width:e.x2-n,height:e.y2-t}},de=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=K(e,n).positionAbsolute,l=c.x,s=c.y;return{x:l,y:s,x2:l+(null!==(o=null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:e.width)&&void 0!==o?o:0),y2:s+(null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:0)}},fe=function(e,n){return se(ce(le(e),le(n)))};function he(e){return o(e)}var ve=function(e,n){var t=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),r=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(t*r)},pe=function(e,n,t,r,o,i){var a=n/(e.width*(1+i)),u=t/(e.height*(1+i)),c=Math.min(a,u),l=ne(c,r,o);return{x:n/2-(e.x+e.width/2)*l,y:t/2-(e.y+e.height/2)*l,zoom:l}};function ge(e){return void 0!==e&&"parent"!==e}var ye=function(e,n,t){return e<n?ne(Math.abs(e-n),1,50)/50:e>t?-ne(Math.abs(e-t),1,50)/50:0},me=function(e,n){return[20*ye(e.x,35,n.width-35),20*ye(e.y,35,n.height-35)]},we=function(e){var n=e.x,t=e.y,r=e.width,o=e.height,i=e.origin,a=void 0===i?[0,0]:i;return!r||!o||a[0]<0||a[1]<0||a[0]>1||a[1]>1?{x:n,y:t}:{x:n-r*a[0],y:t-o*a[1]}},be=function(e,n){var t=e.x,r=e.y,o=g(n,3),i=o[0],a=o[1],u=o[2];return{x:t*u+i,y:r*u+a}},xe=function(){var e;return"undefined"!=typeof navigator&&(null===(e=null===navigator||void 0===navigator?void 0:navigator.userAgent)||void 0===e?void 0:e.indexOf("Mac"))>=0},_e=function(e){return Ee(e)},Ee=function(e){return"id"in e&&"position"in e&&!("source"in e)&&!("target"in e)};var Se=function(e){return oe(e.width)&&oe(e.height)&&oe(e.x)&&oe(e.y)};function ke(e,n){var t=n.snapGrid,r=void 0===t?[0,0]:t,o=n.snapToGrid,i=void 0!==o&&o,a=n.transform,u=Ie(e),c=u.x,l=u.y,s=ae({x:c,y:l},a),f=i?ie(s,r):s,h=f.x,v=f.y;return d({xSnapped:h,ySnapped:v},s)}var Ne=function(e){return{width:e.offsetWidth,height:e.offsetHeight}},Ce=function(e){var n;return(null===(n=e.getRootNode)||void 0===n?void 0:n.call(e))||(null===window||void 0===window?void 0:window.document)},Oe=["INPUT","SELECT","TEXTAREA"];function Me(e){var n,t,r=(null===(t=null===(n=e.composedPath)||void 0===n?void 0:n.call(e))||void 0===t?void 0:t[0])||e.target;return Oe.includes(null==r?void 0:r.nodeName)||(null==r?void 0:r.hasAttribute("contenteditable"))||!!(null==r?void 0:r.closest(".nokey"))}var je=function(e){return"clientX"in e},Ie=function(e,n){var t,r,o,i,a=je(e),u=a?e.clientX:null===(t=e.touches)||void 0===t?void 0:t[0].clientX,c=a?e.clientY:null===(r=e.touches)||void 0===r?void 0:r[0].clientY;return{x:u-(null!==(o=null==n?void 0:n.left)&&void 0!==o?o:0),y:c-(null!==(i=null==n?void 0:n.top)&&void 0!==i?i:0)}},Pe=function(e,n,t,r){void 0===r&&(r=[0,0]);var o=n.querySelectorAll(e);if(!o||!o.length)return null;var i=Array.from(o),a=n.getBoundingClientRect(),u=a.width*r[0],c=a.height*r[1];return i.map((function(e){var n=e.getBoundingClientRect();return d({id:e.getAttribute("data-handleid"),position:e.getAttribute("data-handlepos"),x:(n.left-a.left-u)/t,y:(n.top-a.top-c)/t},Ne(e))}))},Ae="undefined"!=typeof document?document:null;function ze(e,n){void 0===e&&(e=null),void 0===n&&(n={target:Ae,actInsideInputWithModifier:!0});var t=g(i(!1),2),o=t[0],c=t[1],l=a(!1),s=a(new Set([])),d=g(r((function(){if(null!==e){var n=(Array.isArray(e)?e:[e]).filter((function(e){return"string"==typeof e})).map((function(e){return e.split("+")})),t=n.reduce((function(e,n){return e.concat.apply(e,y([],g(n),!1))}),[]);return[n,t]}return[[],[]]}),[e]),2),f=d[0],h=d[1];return u((function(){var t=(null==n?void 0:n.target)||Ae;if(null!==e){var r=function(e){if(l.current=e.ctrlKey||e.metaKey||e.shiftKey,(!l.current||l.current&&!n.actInsideInputWithModifier)&&Me(e))return!1;var t=Be(e.code,h);s.current.add(e[t]),Te(f,s.current,!1)&&(e.preventDefault(),c(!0))},o=function(e){if((!l.current||l.current&&!n.actInsideInputWithModifier)&&Me(e))return!1;var t=Be(e.code,h);Te(f,s.current,!0)?(c(!1),s.current.clear()):s.current.delete(e[t]),"Meta"===e.key&&s.current.clear(),l.current=!1},i=function(){s.current.clear(),c(!1)};return null==t||t.addEventListener("keydown",r),null==t||t.addEventListener("keyup",o),window.addEventListener("blur",i),window.addEventListener("contextmenu",i),function(){null==t||t.removeEventListener("keydown",r),null==t||t.removeEventListener("keyup",o),window.removeEventListener("blur",i),window.removeEventListener("contextmenu",i)}}}),[e,c]),o}function Te(e,n,t){return e.filter((function(e){return t||e.length===n.size})).some((function(e){return e.every((function(e){return n.has(e)}))}))}function Be(e,n){return n.includes(e)?"code":"key"}function De(e,n){if(Object.is(e,n))return!0;if("object"!=typeof e||null===e||"object"!=typeof n||null===n)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[t,r]of e)if(!Object.is(r,n.get(t)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const t of e)if(!n.has(t))return!1;return!0}const t=Object.keys(e);if(t.length!==Object.keys(n).length)return!1;for(const r of t)if(!Object.prototype.hasOwnProperty.call(n,r)||!Object.is(e[r],n[r]))return!1;return!0}var Le,Ve,Re,He,Ze,Ye,Xe={position:"absolute",width:"100%",height:"100%",top:0,left:0};!function(e){e.Strict="strict",e.Loose="loose"}(Le||(Le={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(Ve||(Ve={})),function(e){e.Partial="partial",e.Full="full"}(Re||(Re={})),function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(He||(He={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}(Ze||(Ze={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(Ye||(Ye={}));var Fe={value:()=>{}};function Ue(){for(var e,n=0,t=arguments.length,r={};n<t;++n){if(!(e=arguments[n]+"")||e in r||/[\s.]/.test(e))throw new Error("illegal type: "+e);r[e]=[]}return new Ge(r)}function Ge(e){this._=e}function $e(e,n){for(var t,r=0,o=e.length;r<o;++r)if((t=e[r]).name===n)return t.value}function We(e,n,t){for(var r=0,o=e.length;r<o;++r)if(e[r].name===n){e[r]=Fe,e=e.slice(0,r).concat(e.slice(r+1));break}return null!=t&&e.push({name:n,value:t}),e}Ge.prototype=Ue.prototype={constructor:Ge,on:function(e,n){var t,r,o=this._,i=(r=o,(e+"").trim().split(/^|\s+/).map((function(e){var n="",t=e.indexOf(".");if(t>=0&&(n=e.slice(t+1),e=e.slice(0,t)),e&&!r.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}}))),a=-1,u=i.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a<u;)if(t=(e=i[a]).type)o[t]=We(o[t],e.name,n);else if(null==n)for(t in o)o[t]=We(o[t],e.name,null);return this}for(;++a<u;)if((t=(e=i[a]).type)&&(t=$e(o[t],e.name)))return t},copy:function(){var e={},n=this._;for(var t in n)e[t]=n[t].slice();return new Ge(e)},call:function(e,n){if((t=arguments.length-2)>0)for(var t,r,o=new Array(t),i=0;i<t;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,t=(r=this._[e]).length;i<t;++i)r[i].value.apply(n,o)},apply:function(e,n,t){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(n,t)}};var qe="http://www.w3.org/1999/xhtml",Ke={svg:"http://www.w3.org/2000/svg",xhtml:qe,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Qe(e){var n=e+="",t=n.indexOf(":");return t>=0&&"xmlns"!==(n=e.slice(0,t))&&(e=e.slice(t+1)),Ke.hasOwnProperty(n)?{space:Ke[n],local:e}:e}function Je(e){return function(){var n=this.ownerDocument,t=this.namespaceURI;return t===qe&&n.documentElement.namespaceURI===qe?n.createElement(e):n.createElementNS(t,e)}}function en(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function nn(e){var n=Qe(e);return(n.local?en:Je)(n)}function tn(){}function rn(e){return null==e?tn:function(){return this.querySelector(e)}}function on(){return[]}function an(e){return null==e?on:function(){return this.querySelectorAll(e)}}function un(e){return function(){return function(e){return null==e?[]:Array.isArray(e)?e:Array.from(e)}(e.apply(this,arguments))}}function cn(e){return function(){return this.matches(e)}}function ln(e){return function(n){return n.matches(e)}}var sn=Array.prototype.find;function dn(){return this.firstElementChild}var fn=Array.prototype.filter;function hn(){return Array.from(this.children)}function vn(e){return new Array(e.length)}function pn(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}function gn(e,n,t,r,o,i){for(var a,u=0,c=n.length,l=i.length;u<l;++u)(a=n[u])?(a.__data__=i[u],r[u]=a):t[u]=new pn(e,i[u]);for(;u<c;++u)(a=n[u])&&(o[u]=a)}function yn(e,n,t,r,o,i,a){var u,c,l,s=new Map,d=n.length,f=i.length,h=new Array(d);for(u=0;u<d;++u)(c=n[u])&&(h[u]=l=a.call(c,c.__data__,u,n)+"",s.has(l)?o[u]=c:s.set(l,c));for(u=0;u<f;++u)l=a.call(e,i[u],u,i)+"",(c=s.get(l))?(r[u]=c,c.__data__=i[u],s.delete(l)):t[u]=new pn(e,i[u]);for(u=0;u<d;++u)(c=n[u])&&s.get(h[u])===c&&(o[u]=c)}function mn(e){return e.__data__}function wn(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function bn(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function xn(e){return function(){this.removeAttribute(e)}}function _n(e){return function(){this.removeAttributeNS(e.space,e.local)}}function En(e,n){return function(){this.setAttribute(e,n)}}function Sn(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function kn(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttribute(e):this.setAttribute(e,t)}}function Nn(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,t)}}function Cn(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function On(e){return function(){this.style.removeProperty(e)}}function Mn(e,n,t){return function(){this.style.setProperty(e,n,t)}}function jn(e,n,t){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,t)}}function In(e,n){return e.style.getPropertyValue(n)||Cn(e).getComputedStyle(e,null).getPropertyValue(n)}function Pn(e){return function(){delete this[e]}}function An(e,n){return function(){this[e]=n}}function zn(e,n){return function(){var t=n.apply(this,arguments);null==t?delete this[e]:this[e]=t}}function Tn(e){return e.trim().split(/^|\s+/)}function Bn(e){return e.classList||new Dn(e)}function Dn(e){this._node=e,this._names=Tn(e.getAttribute("class")||"")}function Ln(e,n){for(var t=Bn(e),r=-1,o=n.length;++r<o;)t.add(n[r])}function Vn(e,n){for(var t=Bn(e),r=-1,o=n.length;++r<o;)t.remove(n[r])}function Rn(e){return function(){Ln(this,e)}}function Hn(e){return function(){Vn(this,e)}}function Zn(e,n){return function(){(n.apply(this,arguments)?Ln:Vn)(this,e)}}function Yn(){this.textContent=""}function Xn(e){return function(){this.textContent=e}}function Fn(e){return function(){var n=e.apply(this,arguments);this.textContent=null==n?"":n}}function Un(){this.innerHTML=""}function Gn(e){return function(){this.innerHTML=e}}function $n(e){return function(){var n=e.apply(this,arguments);this.innerHTML=null==n?"":n}}function Wn(){this.nextSibling&&this.parentNode.appendChild(this)}function qn(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Kn(){return null}function Qn(){var e=this.parentNode;e&&e.removeChild(this)}function Jn(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function et(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function nt(e){return function(){var n=this.__on;if(n){for(var t,r=0,o=-1,i=n.length;r<i;++r)t=n[r],e.type&&t.type!==e.type||t.name!==e.name?n[++o]=t:this.removeEventListener(t.type,t.listener,t.options);++o?n.length=o:delete this.__on}}}function tt(e,n,t){return function(){var r,o=this.__on,i=function(e){return function(n){e.call(this,n,this.__data__)}}(n);if(o)for(var a=0,u=o.length;a<u;++a)if((r=o[a]).type===e.type&&r.name===e.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=t),void(r.value=n);this.addEventListener(e.type,i,t),r={type:e.type,name:e.name,value:n,listener:i,options:t},o?o.push(r):this.__on=[r]}}function rt(e,n,t){var r=Cn(e),o=r.CustomEvent;"function"==typeof o?o=new o(n,t):(o=r.document.createEvent("Event"),t?(o.initEvent(n,t.bubbles,t.cancelable),o.detail=t.detail):o.initEvent(n,!1,!1)),e.dispatchEvent(o)}function ot(e,n){return function(){return rt(this,e,n)}}function it(e,n){return function(){return rt(this,e,n.apply(this,arguments))}}pn.prototype={constructor:pn,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},Dn.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var at=[null];function ut(e,n){this._groups=e,this._parents=n}function ct(){return new ut([[document.documentElement]],at)}function lt(e){return"string"==typeof e?new ut([[document.querySelector(e)]],[document.documentElement]):new ut([[e]],at)}function st(e,n){if(e=function(e){let n;for(;n=e.sourceEvent;)e=n;return e}(e),void 0===n&&(n=e.currentTarget),n){var t=n.ownerSVGElement||n;if(t.createSVGPoint){var r=t.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(n.getScreenCTM().inverse())).x,r.y]}if(n.getBoundingClientRect){var o=n.getBoundingClientRect();return[e.clientX-o.left-n.clientLeft,e.clientY-o.top-n.clientTop]}}return[e.pageX,e.pageY]}ut.prototype=ct.prototype={constructor:ut,select:function(e){"function"!=typeof e&&(e=rn(e));for(var n=this._groups,t=n.length,r=new Array(t),o=0;o<t;++o)for(var i,a,u=n[o],c=u.length,l=r[o]=new Array(c),s=0;s<c;++s)(i=u[s])&&(a=e.call(i,i.__data__,s,u))&&("__data__"in i&&(a.__data__=i.__data__),l[s]=a);return new ut(r,this._parents)},selectAll:function(e){e="function"==typeof e?un(e):an(e);for(var n=this._groups,t=n.length,r=[],o=[],i=0;i<t;++i)for(var a,u=n[i],c=u.length,l=0;l<c;++l)(a=u[l])&&(r.push(e.call(a,a.__data__,l,u)),o.push(a));return new ut(r,o)},selectChild:function(e){return this.select(null==e?dn:function(e){return function(){return sn.call(this.children,e)}}("function"==typeof e?e:ln(e)))},selectChildren:function(e){return this.selectAll(null==e?hn:function(e){return function(){return fn.call(this.children,e)}}("function"==typeof e?e:ln(e)))},filter:function(e){"function"!=typeof e&&(e=cn(e));for(var n=this._groups,t=n.length,r=new Array(t),o=0;o<t;++o)for(var i,a=n[o],u=a.length,c=r[o]=[],l=0;l<u;++l)(i=a[l])&&e.call(i,i.__data__,l,a)&&c.push(i);return new ut(r,this._parents)},data:function(e,n){if(!arguments.length)return Array.from(this,mn);var t=n?yn:gn,r=this._parents,o=this._groups;"function"!=typeof e&&(e=function(e){return function(){return e}}(e));for(var i=o.length,a=new Array(i),u=new Array(i),c=new Array(i),l=0;l<i;++l){var s=r[l],d=o[l],f=d.length,h=wn(e.call(s,s&&s.__data__,l,r)),v=h.length,p=u[l]=new Array(v),g=a[l]=new Array(v);t(s,d,p,g,c[l]=new Array(f),h,n);for(var y,m,w=0,b=0;w<v;++w)if(y=p[w]){for(w>=b&&(b=w+1);!(m=g[b])&&++b<v;);y._next=m||null}}return(a=new ut(a,r))._enter=u,a._exit=c,a},enter:function(){return new ut(this._enter||this._groups.map(vn),this._parents)},exit:function(){return new ut(this._exit||this._groups.map(vn),this._parents)},join:function(e,n,t){var r=this.enter(),o=this,i=this.exit();return"function"==typeof e?(r=e(r))&&(r=r.selection()):r=r.append(e+""),null!=n&&(o=n(o))&&(o=o.selection()),null==t?i.remove():t(i),r&&o?r.merge(o).order():o},merge:function(e){for(var n=e.selection?e.selection():e,t=this._groups,r=n._groups,o=t.length,i=r.length,a=Math.min(o,i),u=new Array(o),c=0;c<a;++c)for(var l,s=t[c],d=r[c],f=s.length,h=u[c]=new Array(f),v=0;v<f;++v)(l=s[v]||d[v])&&(h[v]=l);for(;c<o;++c)u[c]=t[c];return new ut(u,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,n=-1,t=e.length;++n<t;)for(var r,o=e[n],i=o.length-1,a=o[i];--i>=0;)(r=o[i])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(e){function n(n,t){return n&&t?e(n.__data__,t.__data__):!n-!t}e||(e=bn);for(var t=this._groups,r=t.length,o=new Array(r),i=0;i<r;++i){for(var a,u=t[i],c=u.length,l=o[i]=new Array(c),s=0;s<c;++s)(a=u[s])&&(l[s]=a);l.sort(n)}return new ut(o,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,n=0,t=e.length;n<t;++n)for(var r=e[n],o=0,i=r.length;o<i;++o){var a=r[o];if(a)return a}return null},size:function(){let e=0;for(const n of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var n=this._groups,t=0,r=n.length;t<r;++t)for(var o,i=n[t],a=0,u=i.length;a<u;++a)(o=i[a])&&e.call(o,o.__data__,a,i);return this},attr:function(e,n){var t=Qe(e);if(arguments.length<2){var r=this.node();return t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}return this.each((null==n?t.local?_n:xn:"function"==typeof n?t.local?Nn:kn:t.local?Sn:En)(t,n))},style:function(e,n,t){return arguments.length>1?this.each((null==n?On:"function"==typeof n?jn:Mn)(e,n,null==t?"":t)):In(this.node(),e)},property:function(e,n){return arguments.length>1?this.each((null==n?Pn:"function"==typeof n?zn:An)(e,n)):this.node()[e]},classed:function(e,n){var t=Tn(e+"");if(arguments.length<2){for(var r=Bn(this.node()),o=-1,i=t.length;++o<i;)if(!r.contains(t[o]))return!1;return!0}return this.each(("function"==typeof n?Zn:n?Rn:Hn)(t,n))},text:function(e){return arguments.length?this.each(null==e?Yn:("function"==typeof e?Fn:Xn)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?Un:("function"==typeof e?$n:Gn)(e)):this.node().innerHTML},raise:function(){return this.each(Wn)},lower:function(){return this.each(qn)},append:function(e){var n="function"==typeof e?e:nn(e);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(e,n){var t="function"==typeof e?e:nn(e),r=null==n?Kn:"function"==typeof n?n:rn(n);return this.select((function(){return this.insertBefore(t.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(Qn)},clone:function(e){return this.select(e?et:Jn)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,n,t){var r,o,i=function(e){return e.trim().split(/^|\s+/).map((function(e){var n="",t=e.indexOf(".");return t>=0&&(n=e.slice(t+1),e=e.slice(0,t)),{type:e,name:n}}))}(e+""),a=i.length;if(!(arguments.length<2)){for(u=n?tt:nt,r=0;r<a;++r)this.each(u(i[r],n,t));return this}var u=this.node().__on;if(u)for(var c,l=0,s=u.length;l<s;++l)for(r=0,c=u[l];r<a;++r)if((o=i[r]).type===c.type&&o.name===c.name)return c.value},dispatch:function(e,n){return this.each(("function"==typeof n?it:ot)(e,n))},[Symbol.iterator]:function*(){for(var e=this._groups,n=0,t=e.length;n<t;++n)for(var r,o=e[n],i=0,a=o.length;i<a;++i)(r=o[i])&&(yield r)}};const dt={passive:!1},ft={capture:!0,passive:!1};function ht(e){e.stopImmediatePropagation()}function vt(e){e.preventDefault(),e.stopImmediatePropagation()}function pt(e){var n=e.document.documentElement,t=lt(e).on("dragstart.drag",vt,ft);"onselectstart"in n?t.on("selectstart.drag",vt,ft):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function gt(e,n){var t=e.document.documentElement,r=lt(e).on("dragstart.drag",null);n&&(r.on("click.drag",vt,ft),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in t?r.on("selectstart.drag",null):(t.style.MozUserSelect=t.__noselect,delete t.__noselect)}var yt=e=>()=>e;function mt(e,{sourceEvent:n,subject:t,target:r,identifier:o,active:i,x:a,y:u,dx:c,dy:l,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:s}})}function wt(e){return!e.ctrlKey&&!e.button}function bt(){return this.parentNode}function xt(e,n){return null==n?{x:e.x,y:e.y}:n}function _t(){return navigator.maxTouchPoints||"ontouchstart"in this}function Et(e,n,t){e.prototype=n.prototype=t,t.constructor=e}function St(e,n){var t=Object.create(e.prototype);for(var r in n)t[r]=n[r];return t}function kt(){}mt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var Nt=.7,Ct=1/Nt,Ot="\\s*([+-]?\\d+)\\s*",Mt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",jt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",It=/^#([0-9a-f]{3,8})$/,Pt=new RegExp(`^rgb\\(${Ot},${Ot},${Ot}\\)$`),At=new RegExp(`^rgb\\(${jt},${jt},${jt}\\)$`),zt=new RegExp(`^rgba\\(${Ot},${Ot},${Ot},${Mt}\\)$`),Tt=new RegExp(`^rgba\\(${jt},${jt},${jt},${Mt}\\)$`),Bt=new RegExp(`^hsl\\(${Mt},${jt},${jt}\\)$`),Dt=new RegExp(`^hsla\\(${Mt},${jt},${jt},${Mt}\\)$`),Lt={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Vt(){return this.rgb().formatHex()}function Rt(){return this.rgb().formatRgb()}function Ht(e){var n,t;return e=(e+"").trim().toLowerCase(),(n=It.exec(e))?(t=n[1].length,n=parseInt(n[1],16),6===t?Zt(n):3===t?new Ft(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===t?Yt(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===t?Yt(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=Pt.exec(e))?new Ft(n[1],n[2],n[3],1):(n=At.exec(e))?new Ft(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=zt.exec(e))?Yt(n[1],n[2],n[3],n[4]):(n=Tt.exec(e))?Yt(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=Bt.exec(e))?Kt(n[1],n[2]/100,n[3]/100,1):(n=Dt.exec(e))?Kt(n[1],n[2]/100,n[3]/100,n[4]):Lt.hasOwnProperty(e)?Zt(Lt[e]):"transparent"===e?new Ft(NaN,NaN,NaN,0):null}function Zt(e){return new Ft(e>>16&255,e>>8&255,255&e,1)}function Yt(e,n,t,r){return r<=0&&(e=n=t=NaN),new Ft(e,n,t,r)}function Xt(e,n,t,r){return 1===arguments.length?function(e){return e instanceof kt||(e=Ht(e)),e?new Ft((e=e.rgb()).r,e.g,e.b,e.opacity):new Ft}(e):new Ft(e,n,t,null==r?1:r)}function Ft(e,n,t,r){this.r=+e,this.g=+n,this.b=+t,this.opacity=+r}function Ut(){return`#${qt(this.r)}${qt(this.g)}${qt(this.b)}`}function Gt(){const e=$t(this.opacity);return`${1===e?"rgb(":"rgba("}${Wt(this.r)}, ${Wt(this.g)}, ${Wt(this.b)}${1===e?")":`, ${e})`}`}function $t(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Wt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function qt(e){return((e=Wt(e))<16?"0":"")+e.toString(16)}function Kt(e,n,t,r){return r<=0?e=n=t=NaN:t<=0||t>=1?e=n=NaN:n<=0&&(e=NaN),new Jt(e,n,t,r)}function Qt(e){if(e instanceof Jt)return new Jt(e.h,e.s,e.l,e.opacity);if(e instanceof kt||(e=Ht(e)),!e)return new Jt;if(e instanceof Jt)return e;var n=(e=e.rgb()).r/255,t=e.g/255,r=e.b/255,o=Math.min(n,t,r),i=Math.max(n,t,r),a=NaN,u=i-o,c=(i+o)/2;return u?(a=n===i?(t-r)/u+6*(t<r):t===i?(r-n)/u+2:(n-t)/u+4,u/=c<.5?i+o:2-i-o,a*=60):u=c>0&&c<1?0:a,new Jt(a,u,c,e.opacity)}function Jt(e,n,t,r){this.h=+e,this.s=+n,this.l=+t,this.opacity=+r}function er(e){return(e=(e||0)%360)<0?e+360:e}function nr(e){return Math.max(0,Math.min(1,e||0))}function tr(e,n,t){return 255*(e<60?n+(t-n)*e/60:e<180?t:e<240?n+(t-n)*(240-e)/60:n)}Et(kt,Ht,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Vt,formatHex:Vt,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Qt(this).formatHsl()},formatRgb:Rt,toString:Rt}),Et(Ft,Xt,St(kt,{brighter(e){return e=null==e?Ct:Math.pow(Ct,e),new Ft(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?Nt:Math.pow(Nt,e),new Ft(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ft(Wt(this.r),Wt(this.g),Wt(this.b),$t(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ut,formatHex:Ut,formatHex8:function(){return`#${qt(this.r)}${qt(this.g)}${qt(this.b)}${qt(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Gt,toString:Gt})),Et(Jt,(function(e,n,t,r){return 1===arguments.length?Qt(e):new Jt(e,n,t,null==r?1:r)}),St(kt,{brighter(e){return e=null==e?Ct:Math.pow(Ct,e),new Jt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Nt:Math.pow(Nt,e),new Jt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),n=isNaN(e)||isNaN(this.s)?0:this.s,t=this.l,r=t+(t<.5?t:1-t)*n,o=2*t-r;return new Ft(tr(e>=240?e-240:e+120,o,r),tr(e,o,r),tr(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new Jt(er(this.h),nr(this.s),nr(this.l),$t(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=$t(this.opacity);return`${1===e?"hsl(":"hsla("}${er(this.h)}, ${100*nr(this.s)}%, ${100*nr(this.l)}%${1===e?")":`, ${e})`}`}}));var rr=e=>()=>e;function or(e){return 1==(e=+e)?ir:function(n,t){return t-n?function(e,n,t){return e=Math.pow(e,t),n=Math.pow(n,t)-e,t=1/t,function(r){return Math.pow(e+r*n,t)}}(n,t,e):rr(isNaN(n)?t:n)}}function ir(e,n){var t=n-e;return t?function(e,n){return function(t){return e+t*n}}(e,t):rr(isNaN(e)?n:e)}var ar=function e(n){var t=or(n);function r(e,n){var r=t((e=Xt(e)).r,(n=Xt(n)).r),o=t(e.g,n.g),i=t(e.b,n.b),a=ir(e.opacity,n.opacity);return function(n){return e.r=r(n),e.g=o(n),e.b=i(n),e.opacity=a(n),e+""}}return r.gamma=e,r}(1);function ur(e,n){return e=+e,n=+n,function(t){return e*(1-t)+n*t}}var cr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,lr=new RegExp(cr.source,"g");function sr(e,n){var t,r,o,i=cr.lastIndex=lr.lastIndex=0,a=-1,u=[],c=[];for(e+="",n+="";(t=cr.exec(e))&&(r=lr.exec(n));)(o=r.index)>i&&(o=n.slice(i,o),u[a]?u[a]+=o:u[++a]=o),(t=t[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,c.push({i:a,x:ur(t,r)})),i=lr.lastIndex;return i<n.length&&(o=n.slice(i),u[a]?u[a]+=o:u[++a]=o),u.length<2?c[0]?function(e){return function(n){return e(n)+""}}(c[0].x):function(e){return function(){return e}}(n):(n=c.length,function(e){for(var t,r=0;r<n;++r)u[(t=c[r]).i]=t.x(e);return u.join("")})}var dr,fr=180/Math.PI,hr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function vr(e,n,t,r,o,i){var a,u,c;return(a=Math.sqrt(e*e+n*n))&&(e/=a,n/=a),(c=e*t+n*r)&&(t-=e*c,r-=n*c),(u=Math.sqrt(t*t+r*r))&&(t/=u,r/=u,c/=u),e*r<n*t&&(e=-e,n=-n,c=-c,a=-a),{translateX:o,translateY:i,rotate:Math.atan2(n,e)*fr,skewX:Math.atan(c)*fr,scaleX:a,scaleY:u}}function pr(e,n,t,r){function o(e){return e.length?e.pop()+" ":""}return function(i,a){var u=[],c=[];return i=e(i),a=e(a),function(e,r,o,i,a,u){if(e!==o||r!==i){var c=a.push("translate(",null,n,null,t);u.push({i:c-4,x:ur(e,o)},{i:c-2,x:ur(r,i)})}else(o||i)&&a.push("translate("+o+n+i+t)}(i.translateX,i.translateY,a.translateX,a.translateY,u,c),function(e,n,t,i){e!==n?(e-n>180?n+=360:n-e>180&&(e+=360),i.push({i:t.push(o(t)+"rotate(",null,r)-2,x:ur(e,n)})):n&&t.push(o(t)+"rotate("+n+r)}(i.rotate,a.rotate,u,c),function(e,n,t,i){e!==n?i.push({i:t.push(o(t)+"skewX(",null,r)-2,x:ur(e,n)}):n&&t.push(o(t)+"skewX("+n+r)}(i.skewX,a.skewX,u,c),function(e,n,t,r,i,a){if(e!==t||n!==r){var u=i.push(o(i)+"scale(",null,",",null,")");a.push({i:u-4,x:ur(e,t)},{i:u-2,x:ur(n,r)})}else 1===t&&1===r||i.push(o(i)+"scale("+t+","+r+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,u,c),i=a=null,function(e){for(var n,t=-1,r=c.length;++t<r;)u[(n=c[t]).i]=n.x(e);return u.join("")}}}var gr=pr((function(e){const n=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?hr:vr(n.a,n.b,n.c,n.d,n.e,n.f)}),"px, ","px)","deg)"),yr=pr((function(e){return null==e?hr:(dr||(dr=document.createElementNS("http://www.w3.org/2000/svg","g")),dr.setAttribute("transform",e),(e=dr.transform.baseVal.consolidate())?vr((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):hr)}),", ",")",")");function mr(e){return((e=Math.exp(e))+1/e)/2}var wr,br,xr=function e(n,t,r){function o(e,o){var i,a,u=e[0],c=e[1],l=e[2],s=o[0],d=o[1],f=o[2],h=s-u,v=d-c,p=h*h+v*v;if(p<1e-12)a=Math.log(f/l)/n,i=function(e){return[u+e*h,c+e*v,l*Math.exp(n*e*a)]};else{var g=Math.sqrt(p),y=(f*f-l*l+r*p)/(2*l*t*g),m=(f*f-l*l-r*p)/(2*f*t*g),w=Math.log(Math.sqrt(y*y+1)-y),b=Math.log(Math.sqrt(m*m+1)-m);a=(b-w)/n,i=function(e){var r=e*a,o=mr(w),i=l/(t*g)*(o*function(e){return((e=Math.exp(2*e))-1)/(e+1)}(n*r+w)-function(e){return((e=Math.exp(e))-1/e)/2}(w));return[u+i*h,c+i*v,l*o/mr(n*r+w)]}}return i.duration=1e3*a*n/Math.SQRT2,i}return o.rho=function(n){var t=Math.max(.001,+n),r=t*t;return e(t,r,r*r)},o}(Math.SQRT2,2,4),_r=0,Er=0,Sr=0,kr=1e3,Nr=0,Cr=0,Or=0,Mr="object"==typeof performance&&performance.now?performance:Date,jr="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ir(){return Cr||(jr(Pr),Cr=Mr.now()+Or)}function Pr(){Cr=0}function Ar(){this._call=this._time=this._next=null}function zr(e,n,t){var r=new Ar;return r.restart(e,n,t),r}function Tr(){Cr=(Nr=Mr.now())+Or,_r=Er=0;try{!function(){Ir(),++_r;for(var e,n=wr;n;)(e=Cr-n._time)>=0&&n._call.call(void 0,e),n=n._next;--_r}()}finally{_r=0,function(){var e,n,t=wr,r=1/0;for(;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:wr=n);br=e,Dr(r)}(),Cr=0}}function Br(){var e=Mr.now(),n=e-Nr;n>kr&&(Or-=n,Nr=e)}function Dr(e){_r||(Er&&(Er=clearTimeout(Er)),e-Cr>24?(e<1/0&&(Er=setTimeout(Tr,e-Mr.now()-Or)),Sr&&(Sr=clearInterval(Sr))):(Sr||(Nr=Mr.now(),Sr=setInterval(Br,kr)),_r=1,jr(Tr)))}function Lr(e,n,t){var r=new Ar;return n=null==n?0:+n,r.restart((t=>{r.stop(),e(t+n)}),n,t),r}Ar.prototype=zr.prototype={constructor:Ar,restart:function(e,n,t){if("function"!=typeof e)throw new TypeError("callback is not a function");t=(null==t?Ir():+t)+(null==n?0:+n),this._next||br===this||(br?br._next=this:wr=this,br=this),this._call=e,this._time=t,Dr()},stop:function(){this._call&&(this._call=null,this._time=1/0,Dr())}};var Vr=Ue("start","end","cancel","interrupt"),Rr=[],Hr=0,Zr=1,Yr=2,Xr=3,Fr=4,Ur=5,Gr=6;function $r(e,n,t,r,o,i){var a=e.__transition;if(a){if(t in a)return}else e.__transition={};!function(e,n,t){var r,o=e.__transition;function i(e){t.state=Zr,t.timer.restart(a,t.delay,t.time),t.delay<=e&&a(e-t.delay)}function a(i){var l,s,d,f;if(t.state!==Zr)return c();for(l in o)if((f=o[l]).name===t.name){if(f.state===Xr)return Lr(a);f.state===Fr?(f.state=Gr,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete o[l]):+l<n&&(f.state=Gr,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete o[l])}if(Lr((function(){t.state===Xr&&(t.state=Fr,t.timer.restart(u,t.delay,t.time),u(i))})),t.state=Yr,t.on.call("start",e,e.__data__,t.index,t.group),t.state===Yr){for(t.state=Xr,r=new Array(d=t.tween.length),l=0,s=-1;l<d;++l)(f=t.tween[l].value.call(e,e.__data__,t.index,t.group))&&(r[++s]=f);r.length=s+1}}function u(n){for(var o=n<t.duration?t.ease.call(null,n/t.duration):(t.timer.restart(c),t.state=Ur,1),i=-1,a=r.length;++i<a;)r[i].call(e,o);t.state===Ur&&(t.on.call("end",e,e.__data__,t.index,t.group),c())}function c(){for(var r in t.state=Gr,t.timer.stop(),delete o[n],o)return;delete e.__transition}o[n]=t,t.timer=zr(i,0,t.time)}(e,t,{name:n,index:r,group:o,on:Vr,tween:Rr,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Hr})}function Wr(e,n){var t=Kr(e,n);if(t.state>Hr)throw new Error("too late; already scheduled");return t}function qr(e,n){var t=Kr(e,n);if(t.state>Xr)throw new Error("too late; already running");return t}function Kr(e,n){var t=e.__transition;if(!t||!(t=t[n]))throw new Error("transition not found");return t}function Qr(e,n){var t,r,o,i=e.__transition,a=!0;if(i){for(o in n=null==n?null:n+"",i)(t=i[o]).name===n?(r=t.state>Yr&&t.state<Ur,t.state=Gr,t.timer.stop(),t.on.call(r?"interrupt":"cancel",e,e.__data__,t.index,t.group),delete i[o]):a=!1;a&&delete e.__transition}}function Jr(e,n){var t,r;return function(){var o=qr(this,e),i=o.tween;if(i!==t)for(var a=0,u=(r=t=i).length;a<u;++a)if(r[a].name===n){(r=r.slice()).splice(a,1);break}o.tween=r}}function eo(e,n,t){var r,o;if("function"!=typeof t)throw new Error;return function(){var i=qr(this,e),a=i.tween;if(a!==r){o=(r=a).slice();for(var u={name:n,value:t},c=0,l=o.length;c<l;++c)if(o[c].name===n){o[c]=u;break}c===l&&o.push(u)}i.tween=o}}function no(e,n,t){var r=e._id;return e.each((function(){var e=qr(this,r);(e.value||(e.value={}))[n]=t.apply(this,arguments)})),function(e){return Kr(e,r).value[n]}}function to(e,n){var t;return("number"==typeof n?ur:n instanceof Ht?ar:(t=Ht(n))?(n=t,ar):sr)(e,n)}function ro(e){return function(){this.removeAttribute(e)}}function oo(e){return function(){this.removeAttributeNS(e.space,e.local)}}function io(e,n,t){var r,o,i=t+"";return function(){var a=this.getAttribute(e);return a===i?null:a===r?o:o=n(r=a,t)}}function ao(e,n,t){var r,o,i=t+"";return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===r?o:o=n(r=a,t)}}function uo(e,n,t){var r,o,i;return function(){var a,u,c=t(this);if(null!=c)return(a=this.getAttribute(e))===(u=c+"")?null:a===r&&u===o?i:(o=u,i=n(r=a,c));this.removeAttribute(e)}}function co(e,n,t){var r,o,i;return function(){var a,u,c=t(this);if(null!=c)return(a=this.getAttributeNS(e.space,e.local))===(u=c+"")?null:a===r&&u===o?i:(o=u,i=n(r=a,c));this.removeAttributeNS(e.space,e.local)}}function lo(e,n){var t,r;function o(){var o=n.apply(this,arguments);return o!==r&&(t=(r=o)&&function(e,n){return function(t){this.setAttributeNS(e.space,e.local,n.call(this,t))}}(e,o)),t}return o._value=n,o}function so(e,n){var t,r;function o(){var o=n.apply(this,arguments);return o!==r&&(t=(r=o)&&function(e,n){return function(t){this.setAttribute(e,n.call(this,t))}}(e,o)),t}return o._value=n,o}function fo(e,n){return function(){Wr(this,e).delay=+n.apply(this,arguments)}}function ho(e,n){return n=+n,function(){Wr(this,e).delay=n}}function vo(e,n){return function(){qr(this,e).duration=+n.apply(this,arguments)}}function po(e,n){return n=+n,function(){qr(this,e).duration=n}}var go=ct.prototype.constructor;function yo(e){return function(){this.style.removeProperty(e)}}var mo=0;function wo(e,n,t,r){this._groups=e,this._parents=n,this._name=t,this._id=r}function bo(){return++mo}var xo=ct.prototype;wo.prototype={constructor:wo,select:function(e){var n=this._name,t=this._id;"function"!=typeof e&&(e=rn(e));for(var r=this._groups,o=r.length,i=new Array(o),a=0;a<o;++a)for(var u,c,l=r[a],s=l.length,d=i[a]=new Array(s),f=0;f<s;++f)(u=l[f])&&(c=e.call(u,u.__data__,f,l))&&("__data__"in u&&(c.__data__=u.__data__),d[f]=c,$r(d[f],n,t,f,d,Kr(u,t)));return new wo(i,this._parents,n,t)},selectAll:function(e){var n=this._name,t=this._id;"function"!=typeof e&&(e=an(e));for(var r=this._groups,o=r.length,i=[],a=[],u=0;u<o;++u)for(var c,l=r[u],s=l.length,d=0;d<s;++d)if(c=l[d]){for(var f,h=e.call(c,c.__data__,d,l),v=Kr(c,t),p=0,g=h.length;p<g;++p)(f=h[p])&&$r(f,n,t,p,h,v);i.push(h),a.push(c)}return new wo(i,a,n,t)},selectChild:xo.selectChild,selectChildren:xo.selectChildren,filter:function(e){"function"!=typeof e&&(e=cn(e));for(var n=this._groups,t=n.length,r=new Array(t),o=0;o<t;++o)for(var i,a=n[o],u=a.length,c=r[o]=[],l=0;l<u;++l)(i=a[l])&&e.call(i,i.__data__,l,a)&&c.push(i);return new wo(r,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,t=e._groups,r=n.length,o=t.length,i=Math.min(r,o),a=new Array(r),u=0;u<i;++u)for(var c,l=n[u],s=t[u],d=l.length,f=a[u]=new Array(d),h=0;h<d;++h)(c=l[h]||s[h])&&(f[h]=c);for(;u<r;++u)a[u]=n[u];return new wo(a,this._parents,this._name,this._id)},selection:function(){return new go(this._groups,this._parents)},transition:function(){for(var e=this._name,n=this._id,t=bo(),r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],c=u.length,l=0;l<c;++l)if(a=u[l]){var s=Kr(a,n);$r(a,e,t,l,u,{time:s.time+s.delay+s.duration,delay:0,duration:s.duration,ease:s.ease})}return new wo(r,this._parents,e,t)},call:xo.call,nodes:xo.nodes,node:xo.node,size:xo.size,empty:xo.empty,each:xo.each,on:function(e,n){var t=this._id;return arguments.length<2?Kr(this.node(),t).on.on(e):this.each(function(e,n,t){var r,o,i=function(e){return(e+"").trim().split(/^|\s+/).every((function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||"start"===e}))}(n)?Wr:qr;return function(){var a=i(this,e),u=a.on;u!==r&&(o=(r=u).copy()).on(n,t),a.on=o}}(t,e,n))},attr:function(e,n){var t=Qe(e),r="transform"===t?yr:to;return this.attrTween(e,"function"==typeof n?(t.local?co:uo)(t,r,no(this,"attr."+e,n)):null==n?(t.local?oo:ro)(t):(t.local?ao:io)(t,r,n))},attrTween:function(e,n){var t="attr."+e;if(arguments.length<2)return(t=this.tween(t))&&t._value;if(null==n)return this.tween(t,null);if("function"!=typeof n)throw new Error;var r=Qe(e);return this.tween(t,(r.local?lo:so)(r,n))},style:function(e,n,t){var r="transform"==(e+="")?gr:to;return null==n?this.styleTween(e,function(e,n){var t,r,o;return function(){var i=In(this,e),a=(this.style.removeProperty(e),In(this,e));return i===a?null:i===t&&a===r?o:o=n(t=i,r=a)}}(e,r)).on("end.style."+e,yo(e)):"function"==typeof n?this.styleTween(e,function(e,n,t){var r,o,i;return function(){var a=In(this,e),u=t(this),c=u+"";return null==u&&(this.style.removeProperty(e),c=u=In(this,e)),a===c?null:a===r&&c===o?i:(o=c,i=n(r=a,u))}}(e,r,no(this,"style."+e,n))).each(function(e,n){var t,r,o,i,a="style."+n,u="end."+a;return function(){var c=qr(this,e),l=c.on,s=null==c.value[a]?i||(i=yo(n)):void 0;l===t&&o===s||(r=(t=l).copy()).on(u,o=s),c.on=r}}(this._id,e)):this.styleTween(e,function(e,n,t){var r,o,i=t+"";return function(){var a=In(this,e);return a===i?null:a===r?o:o=n(r=a,t)}}(e,r,n),t).on("end.style."+e,null)},styleTween:function(e,n,t){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(e,n,t){var r,o;function i(){var i=n.apply(this,arguments);return i!==o&&(r=(o=i)&&function(e,n,t){return function(r){this.style.setProperty(e,n.call(this,r),t)}}(e,i,t)),r}return i._value=n,i}(e,n,null==t?"":t))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var n=e(this);this.textContent=null==n?"":n}}(no(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;return this.tween(n,function(e){var n,t;function r(){var r=e.apply(this,arguments);return r!==t&&(n=(t=r)&&function(e){return function(n){this.textContent=e.call(this,n)}}(r)),n}return r._value=e,r}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var n=this.parentNode;for(var t in this.__transition)if(+t!==e)return;n&&n.removeChild(this)}}(this._id))},tween:function(e,n){var t=this._id;if(e+="",arguments.length<2){for(var r,o=Kr(this.node(),t).tween,i=0,a=o.length;i<a;++i)if((r=o[i]).name===e)return r.value;return null}return this.each((null==n?Jr:eo)(t,e,n))},delay:function(e){var n=this._id;return arguments.length?this.each(("function"==typeof e?fo:ho)(n,e)):Kr(this.node(),n).delay},duration:function(e){var n=this._id;return arguments.length?this.each(("function"==typeof e?vo:po)(n,e)):Kr(this.node(),n).duration},ease:function(e){var n=this._id;return arguments.length?this.each(function(e,n){if("function"!=typeof n)throw new Error;return function(){qr(this,e).ease=n}}(n,e)):Kr(this.node(),n).ease},easeVarying:function(e){if("function"!=typeof e)throw new Error;return this.each(function(e,n){return function(){var t=n.apply(this,arguments);if("function"!=typeof t)throw new Error;qr(this,e).ease=t}}(this._id,e))},end:function(){var e,n,t=this,r=t._id,o=t.size();return new Promise((function(i,a){var u={value:a},c={value:function(){0==--o&&i()}};t.each((function(){var t=qr(this,r),o=t.on;o!==e&&((n=(e=o).copy())._.cancel.push(u),n._.interrupt.push(u),n._.end.push(c)),t.on=n})),0===o&&i()}))},[Symbol.iterator]:xo[Symbol.iterator]};var _o={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Eo(e,n){for(var t;!(t=e.__transition)||!(t=t[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return t}ct.prototype.interrupt=function(e){return this.each((function(){Qr(this,e)}))},ct.prototype.transition=function(e){var n,t;e instanceof wo?(n=e._id,e=e._name):(n=bo(),(t=_o).time=Ir(),e=null==e?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],c=u.length,l=0;l<c;++l)(a=u[l])&&$r(a,e,n,l,u,t||Eo(a,n));return new wo(r,this._parents,e,n)};var So=e=>()=>e;function ko(e,{sourceEvent:n,target:t,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:t,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function No(e,n,t){this.k=e,this.x=n,this.y=t}No.prototype={constructor:No,scale:function(e){return 1===e?this:new No(this.k*e,this.x,this.y)},translate:function(e,n){return 0===e&0===n?this:new No(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Co=new No(1,0,0);function Oo(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Co;return e.__zoom}function Mo(e){e.stopImmediatePropagation()}function jo(e){e.preventDefault(),e.stopImmediatePropagation()}function Io(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function Po(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function Ao(){return this.__zoom||Co}function zo(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function To(){return navigator.maxTouchPoints||"ontouchstart"in this}function Bo(e,n,t){var r=e.invertX(n[0][0])-t[0][0],o=e.invertX(n[1][0])-t[1][0],i=e.invertY(n[0][1])-t[0][1],a=e.invertY(n[1][1])-t[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}Oo.prototype=No.prototype;var Do=function(e,n){return e.x!==n.x||e.y!==n.y||e.zoom!==n.k},Lo=function(e){return{x:e.x,y:e.y,zoom:e.k}},Vo=function(e){var n=e.x,t=e.y,r=e.zoom;return Co.translate(n,t).scale(r)},Ro=function(e,n){return e.target.closest(".".concat(n))},Ho=function(e,n){return 2===n&&Array.isArray(e)&&e.includes(2)},Zo=function(e,n){return void 0===n&&(n=0),"number"==typeof n&&n>0?e.transition().duration(n):e},Yo=function(e){var n=e.ctrlKey&&xe()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*n};function Xo(e){var n=e.domNode,t=e.minZoom,r=e.maxZoom,o=e.translateExtent,i=e.viewport,a=e.onPanZoom,u=e.onPanZoomStart,c=e.onPanZoomEnd,l=e.onTransformChange,s=e.onDraggingChange,d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=n.getBoundingClientRect(),h=function(){var e,n,t,r=Io,o=Po,i=Bo,a=zo,u=To,c=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,d=xr,f=Ue("start","zoom","end"),h=500,v=150,p=0,g=10;function y(e){e.property("__zoom",Ao).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",N).filter(u).on("touchstart.zoom",C).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(e,n){return(n=Math.max(c[0],Math.min(c[1],n)))===e.k?e:new No(n,e.x,e.y)}function w(e,n,t){var r=n[0]-t[0]*e.k,o=n[1]-t[1]*e.k;return r===e.x&&o===e.y?e:new No(e.k,r,o)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,t,r){e.on("start.zoom",(function(){_(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){_(this,arguments).event(r).end()})).tween("zoom",(function(){var e=this,i=arguments,a=_(e,i).event(r),u=o.apply(e,i),c=null==t?b(u):"function"==typeof t?t.apply(e,i):t,l=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),s=e.__zoom,f="function"==typeof n?n.apply(e,i):n,h=d(s.invert(c).concat(l/s.k),f.invert(c).concat(l/f.k));return function(e){if(1===e)e=f;else{var n=h(e),t=l/n[2];e=new No(t,c[0]-n[0]*t,c[1]-n[1]*t)}a.zoom(null,e)}}))}function _(e,n,t){return!t&&e.__zooming||new E(e,n)}function E(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=o.apply(e,n),this.taps=0}function S(e,...n){if(r.apply(this,arguments)){var t=_(this,n).event(e),o=this.__zoom,u=Math.max(c[0],Math.min(c[1],o.k*Math.pow(2,a.apply(this,arguments)))),s=st(e);if(t.wheel)t.mouse[0][0]===s[0]&&t.mouse[0][1]===s[1]||(t.mouse[1]=o.invert(t.mouse[0]=s)),clearTimeout(t.wheel);else{if(o.k===u)return;t.mouse=[s,o.invert(s)],Qr(this),t.start()}jo(e),t.wheel=setTimeout((function(){t.wheel=null,t.end()}),v),t.zoom("mouse",i(w(m(o,u),t.mouse[0],t.mouse[1]),t.extent,l))}}function k(e,...n){if(!t&&r.apply(this,arguments)){var o=e.currentTarget,a=_(this,n,!0).event(e),u=lt(e.view).on("mousemove.zoom",(function(e){if(jo(e),!a.moved){var n=e.clientX-s,t=e.clientY-d;a.moved=n*n+t*t>p}a.event(e).zoom("mouse",i(w(a.that.__zoom,a.mouse[0]=st(e,o),a.mouse[1]),a.extent,l))}),!0).on("mouseup.zoom",(function(e){u.on("mousemove.zoom mouseup.zoom",null),gt(e.view,a.moved),jo(e),a.event(e).end()}),!0),c=st(e,o),s=e.clientX,d=e.clientY;pt(e.view),Mo(e),a.mouse=[c,this.__zoom.invert(c)],Qr(this),a.start()}}function N(e,...n){if(r.apply(this,arguments)){var t=this.__zoom,a=st(e.changedTouches?e.changedTouches[0]:e,this),u=t.invert(a),c=t.k*(e.shiftKey?.5:2),d=i(w(m(t,c),a,u),o.apply(this,n),l);jo(e),s>0?lt(this).transition().duration(s).call(x,d,a,e):lt(this).call(y.transform,d,a,e)}}function C(t,...o){if(r.apply(this,arguments)){var i,a,u,c,l=t.touches,s=l.length,d=_(this,o,t.changedTouches.length===s).event(t);for(Mo(t),a=0;a<s;++a)c=[c=st(u=l[a],this),this.__zoom.invert(c),u.identifier],d.touch0?d.touch1||d.touch0[2]===c[2]||(d.touch1=c,d.taps=0):(d.touch0=c,i=!0,d.taps=1+!!e);e&&(e=clearTimeout(e)),i&&(d.taps<2&&(n=c[0],e=setTimeout((function(){e=null}),h)),Qr(this),d.start())}}function O(e,...n){if(this.__zooming){var t,r,o,a,u=_(this,n).event(e),c=e.changedTouches,s=c.length;for(jo(e),t=0;t<s;++t)o=st(r=c[t],this),u.touch0&&u.touch0[2]===r.identifier?u.touch0[0]=o:u.touch1&&u.touch1[2]===r.identifier&&(u.touch1[0]=o);if(r=u.that.__zoom,u.touch1){var d=u.touch0[0],f=u.touch0[1],h=u.touch1[0],v=u.touch1[1],p=(p=h[0]-d[0])*p+(p=h[1]-d[1])*p,g=(g=v[0]-f[0])*g+(g=v[1]-f[1])*g;r=m(r,Math.sqrt(p/g)),o=[(d[0]+h[0])/2,(d[1]+h[1])/2],a=[(f[0]+v[0])/2,(f[1]+v[1])/2]}else{if(!u.touch0)return;o=u.touch0[0],a=u.touch0[1]}u.zoom("touch",i(w(r,o,a),u.extent,l))}}function M(e,...r){if(this.__zooming){var o,i,a=_(this,r).event(e),u=e.changedTouches,c=u.length;for(Mo(e),t&&clearTimeout(t),t=setTimeout((function(){t=null}),h),o=0;o<c;++o)i=u[o],a.touch0&&a.touch0[2]===i.identifier?delete a.touch0:a.touch1&&a.touch1[2]===i.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(i=st(i,this),Math.hypot(n[0]-i[0],n[1]-i[1])<g)){var l=lt(this).on("dblclick.zoom");l&&l.apply(this,arguments)}}}return y.transform=function(e,n,t,r){var o=e.selection?e.selection():e;o.property("__zoom",Ao),e!==o?x(e,n,t,r):o.interrupt().each((function(){_(this,arguments).event(r).start().zoom(null,"function"==typeof n?n.apply(this,arguments):n).end()}))},y.scaleBy=function(e,n,t,r){y.scaleTo(e,(function(){return this.__zoom.k*("function"==typeof n?n.apply(this,arguments):n)}),t,r)},y.scaleTo=function(e,n,t,r){y.transform(e,(function(){var e=o.apply(this,arguments),r=this.__zoom,a=null==t?b(e):"function"==typeof t?t.apply(this,arguments):t,u=r.invert(a),c="function"==typeof n?n.apply(this,arguments):n;return i(w(m(r,c),a,u),e,l)}),t,r)},y.translateBy=function(e,n,t,r){y.transform(e,(function(){return i(this.__zoom.translate("function"==typeof n?n.apply(this,arguments):n,"function"==typeof t?t.apply(this,arguments):t),o.apply(this,arguments),l)}),null,r)},y.translateTo=function(e,n,t,r,a){y.transform(e,(function(){var e=o.apply(this,arguments),a=this.__zoom,u=null==r?b(e):"function"==typeof r?r.apply(this,arguments):r;return i(Co.translate(u[0],u[1]).scale(a.k).translate("function"==typeof n?-n.apply(this,arguments):-n,"function"==typeof t?-t.apply(this,arguments):-t),e,l)}),r,a)},E.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,n){return this.mouse&&"mouse"!==e&&(this.mouse[1]=n.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=n.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=n.invert(this.touch1[0])),this.that.__zoom=n,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var n=lt(this.that).datum();f.call(e,this.that,new ko(e,{sourceEvent:this.sourceEvent,target:y,type:e,transform:this.that.__zoom,dispatch:f}),n)}},y.wheelDelta=function(e){return arguments.length?(a="function"==typeof e?e:So(+e),y):a},y.filter=function(e){return arguments.length?(r="function"==typeof e?e:So(!!e),y):r},y.touchable=function(e){return arguments.length?(u="function"==typeof e?e:So(!!e),y):u},y.extent=function(e){return arguments.length?(o="function"==typeof e?e:So([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),y):o},y.scaleExtent=function(e){return arguments.length?(c[0]=+e[0],c[1]=+e[1],y):[c[0],c[1]]},y.translateExtent=function(e){return arguments.length?(l[0][0]=+e[0][0],l[1][0]=+e[1][0],l[0][1]=+e[0][1],l[1][1]=+e[1][1],y):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},y.constrain=function(e){return arguments.length?(i=e,y):i},y.duration=function(e){return arguments.length?(s=+e,y):s},y.interpolate=function(e){return arguments.length?(d=e,y):d},y.on=function(){var e=f.on.apply(f,arguments);return e===f?y:e},y.clickDistance=function(e){return arguments.length?(p=(e=+e)*e,y):Math.sqrt(p)},y.tapDistance=function(e){return arguments.length?(g=+e,y):g},y}().scaleExtent([t,r]).translateExtent(o),v=lt(n).call(h);w({x:i.x,y:i.y,zoom:ne(i.zoom,t,r)},[[0,0],[f.width,f.height]],o);var p=v.on("wheel.zoom"),g=v.on("dblclick.zoom");function y(e,n){v&&(null==h||h.transform(Zo(v,null==n?void 0:n.duration),e))}function m(){h.on("zoom",null)}function w(e,n,t){var r=Vo(e),o=null==h?void 0:h.constrain()(r,n,t);return o&&y(o),o}return h.wheelDelta(Yo),{update:function(e){var n=e.noWheelClassName,t=e.noPanClassName,r=e.onPaneContextMenu,o=e.userSelectionActive,i=e.panOnScroll,f=e.panOnDrag,y=e.panOnScrollMode,w=e.panOnScrollSpeed,b=e.preventScrolling,x=e.zoomOnPinch,_=e.zoomOnScroll,E=e.zoomOnDoubleClick,S=e.zoomActivationKeyPressed,k=e.lib;o&&!d.isZoomingOrPanning&&m();var N=i&&!S&&!o?function(e){var n=e.zoomPanValues,t=e.noWheelClassName,r=e.d3Selection,o=e.d3Zoom,i=e.panOnScrollMode,a=e.panOnScrollSpeed,u=e.zoomOnPinch,c=e.onPanZoomStart,l=e.onPanZoom,s=e.onPanZoomEnd;return function(e){if(Ro(e,t))return!1;e.preventDefault(),e.stopImmediatePropagation();var d=r.property("__zoom").k||1;if(e.ctrlKey&&u){var f=st(e),h=Yo(e),v=d*Math.pow(2,h);o.scaleTo(r,v,f,e)}else{var p=1===e.deltaMode?20:1,g=i===Ve.Vertical?0:e.deltaX*p,y=i===Ve.Horizontal?0:e.deltaY*p;!xe()&&e.shiftKey&&i!==Ve.Vertical&&(g=e.deltaY*p,y=0),o.translateBy(r,-g/d*a,-y/d*a,{internal:!0});var m=Lo(r.property("__zoom"));clearTimeout(n.panScrollTimeout),n.isPanScrolling||(n.isPanScrolling=!0,null==c||c(e,m)),n.isPanScrolling&&(null==l||l(e,m),n.panScrollTimeout=setTimeout((function(){null==s||s(e,m),n.isPanScrolling=!1}),150))}}}({zoomPanValues:d,noWheelClassName:n,d3Selection:v,d3Zoom:h,panOnScrollMode:y,panOnScrollSpeed:w,zoomOnPinch:x,onPanZoomStart:u,onPanZoom:a,onPanZoomEnd:c}):function(e){var n=e.noWheelClassName,t=e.preventScrolling,r=e.d3ZoomHandler;return function(e,o){if(!t&&"wheel"===e.type&&!e.ctrlKey||Ro(e,n))return null;e.preventDefault(),r.call(this,e,o)}}({noWheelClassName:n,preventScrolling:b,d3ZoomHandler:p});if(v.on("wheel.zoom",N,{passive:!1}),!o){var C=function(e){var n=e.zoomPanValues,t=e.onDraggingChange,r=e.onPanZoomStart;return function(e){var o,i,a;if(!(null===(o=e.sourceEvent)||void 0===o?void 0:o.internal)){var u=Lo(e.transform);n.mouseButton=(null===(i=e.sourceEvent)||void 0===i?void 0:i.button)||0,n.isZoomingOrPanning=!0,n.prevViewport=u,"mousedown"===(null===(a=e.sourceEvent)||void 0===a?void 0:a.type)&&t(!0),r&&(null==r||r(e.sourceEvent,u))}}}({zoomPanValues:d,onDraggingChange:s,onPanZoomStart:u});h.on("start",C);var O=function(e){var n=e.zoomPanValues,t=e.panOnDrag,r=e.onPaneContextMenu,o=e.onTransformChange,i=e.onPanZoom;return function(e){var a,u,c;n.usedRightMouseButton=!(!r||!Ho(t,null!==(a=n.mouseButton)&&void 0!==a?a:0)),(null===(u=e.sourceEvent)||void 0===u?void 0:u.sync)||o([e.transform.x,e.transform.y,e.transform.k]),i&&!(null===(c=e.sourceEvent)||void 0===c?void 0:c.internal)&&(null==i||i(e.sourceEvent,Lo(e.transform)))}}({zoomPanValues:d,panOnDrag:f,onPaneContextMenu:!!r,onPanZoom:a,onTransformChange:l});h.on("zoom",O);var M=function(e){var n=e.zoomPanValues,t=e.panOnDrag,r=e.panOnScroll,o=e.onDraggingChange,i=e.onPanZoomEnd,a=e.onPaneContextMenu;return function(e){var u,c;if(!(null===(u=e.sourceEvent)||void 0===u?void 0:u.internal)&&(n.isZoomingOrPanning=!1,a&&Ho(t,null!==(c=n.mouseButton)&&void 0!==c?c:0)&&!n.usedRightMouseButton&&e.sourceEvent&&a(e.sourceEvent),n.usedRightMouseButton=!1,o(!1),i&&Do(n.prevViewport,e.transform))){var l=Lo(e.transform);n.prevViewport=l,clearTimeout(n.timerId),n.timerId=setTimeout((function(){null==i||i(e.sourceEvent,l)}),r?150:0)}}}({zoomPanValues:d,panOnDrag:f,panOnScroll:i,onPaneContextMenu:r,onPanZoomEnd:c,onDraggingChange:s});h.on("end",M)}var j=function(e){var n=e.zoomActivationKeyPressed,t=e.zoomOnScroll,r=e.zoomOnPinch,o=e.panOnDrag,i=e.panOnScroll,a=e.zoomOnDoubleClick,u=e.userSelectionActive,c=e.noWheelClassName,l=e.noPanClassName,s=e.lib;return function(e){var d=n||t,f=r&&e.ctrlKey;if(1===e.button&&"mousedown"===e.type&&(Ro(e,"".concat(s,"-flow__node"))||Ro(e,"".concat(s,"-flow__edge"))))return!0;if(!(o||d||i||a||r))return!1;if(u)return!1;if(Ro(e,c)&&"wheel"===e.type)return!1;if(Ro(e,l)&&("wheel"!==e.type||i&&"wheel"===e.type&&!n))return!1;if(!r&&e.ctrlKey&&"wheel"===e.type)return!1;if(!d&&!i&&!f&&"wheel"===e.type)return!1;if(!o&&("mousedown"===e.type||"touchstart"===e.type))return!1;if(Array.isArray(o)&&!o.includes(e.button)&&"mousedown"===e.type)return!1;var h=Array.isArray(o)&&o.includes(e.button)||!e.button||e.button<=1;return(!e.ctrlKey||"wheel"===e.type)&&h}}({zoomActivationKeyPressed:S,panOnDrag:f,zoomOnScroll:_,panOnScroll:i,zoomOnDoubleClick:E,zoomOnPinch:x,userSelectionActive:o,noPanClassName:t,noWheelClassName:n,lib:k});h.filter(j),E?v.on("dblclick.zoom",g):v.on("dblclick.zoom",null)},destroy:m,setViewport:function(e,n){var t=Vo(e);return y(t,n),t},setViewportConstrained:w,getViewport:function(){var e=v?Oo(v.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}},scaleTo:function(e,n){v&&(null==h||h.scaleTo(Zo(v,null==n?void 0:n.duration),e))},scaleBy:function(e,n){v&&(null==h||h.scaleBy(Zo(v,null==n?void 0:n.duration),e))},setScaleExtent:function(e){null==h||h.scaleExtent(e)},setTranslateExtent:function(e){null==h||h.translateExtent(e)},syncViewport:function(e){if(v){var n=Vo(e),t=v.property("__zoom");t.k===e.zoom&&t.x===e.x&&t.y===e.y||null==h||h.transform(v,n,null,{sync:!0})}}}}var Fo=function(e){return{userSelectionActive:e.userSelectionActive,lib:e.lib}};function Uo(e){var n=e.onPaneContextMenu,t=e.zoomOnScroll,r=void 0===t||t,o=e.zoomOnPinch,i=void 0===o||o,c=e.panOnScroll,l=void 0!==c&&c,s=e.panOnScrollSpeed,d=void 0===s?.5:s,f=e.panOnScrollMode,h=void 0===f?Ve.Free:f,v=e.zoomOnDoubleClick,p=void 0===v||v,g=e.panOnDrag,y=void 0===g||g,m=e.defaultViewport,w=e.translateExtent,b=e.minZoom,x=e.maxZoom,_=e.zoomActivationKeyCode,S=e.preventScrolling,k=void 0===S||S,N=e.children,C=e.noWheelClassName,O=e.noPanClassName,M=e.onViewportChange,j=e.isControlledViewport,I=$(),P=a(null),A=G(Fo,De),z=A.userSelectionActive,T=A.lib,B=ze(_),D=a();return function(e){var n=$();u((function(){var t=function(){var t,r;if(!e.current)return!1;var o=Ne(e.current);0!==o.height&&0!==o.width||null===(r=(t=n.getState()).onError)||void 0===r||r.call(t,"004",Y.error004()),n.setState({width:o.width||500,height:o.height||500})};if(e.current){t(),window.addEventListener("resize",t);var r=new ResizeObserver((function(){return t()}));return r.observe(e.current),function(){window.removeEventListener("resize",t),r&&e.current&&r.unobserve(e.current)}}}),[])}(P),u((function(){if(P.current){D.current=Xo({domNode:P.current,minZoom:b,maxZoom:x,translateExtent:w,viewport:m,onTransformChange:function(e){null==M||M({x:e[0],y:e[1],zoom:e[2]}),j||I.setState({transform:e})},onDraggingChange:function(e){return I.setState({paneDragging:e})},onPanZoomStart:function(e,n){var t=I.getState(),r=t.onViewportChangeStart,o=t.onMoveStart;null==o||o(e,n),null==r||r(n)},onPanZoom:function(e,n){var t=I.getState(),r=t.onViewportChange,o=t.onMove;null==o||o(e,n),null==r||r(n)},onPanZoomEnd:function(e,n){var t=I.getState(),r=t.onViewportChangeEnd,o=t.onMoveEnd;null==o||o(e,n),null==r||r(n)}});var e=D.current.getViewport(),n=e.x,t=e.y,r=e.zoom;return I.setState({panZoom:D.current,transform:[n,t,r],domNode:P.current.closest(".ink-flow")}),function(){var e;null===(e=D.current)||void 0===e||e.destroy()}}}),[]),u((function(){var e;null===(e=D.current)||void 0===e||e.update({onPaneContextMenu:n,zoomOnScroll:r,zoomOnPinch:i,panOnScroll:l,panOnScrollSpeed:d,panOnScrollMode:h,zoomOnDoubleClick:p,panOnDrag:y,zoomActivationKeyPressed:B,preventScrolling:k,noPanClassName:O,userSelectionActive:z,noWheelClassName:C,lib:T})}),[n,r,i,l,d,h,p,y,B,k,O,z,C,T]),E.jsx("div",{className:"ink-flow__renderer",ref:P,style:Xe,children:N})}var Go={actInsideInputWithModifier:!1};function $o(e,n){var t;switch(e.type){case"select":n.selected=e.selected;break;case"position":void 0!==e.position&&(n.position=e.position),void 0!==e.dragging&&(n.dragging=e.dragging);break;case"dimensions":void 0!==e.dimensions&&(null!==(t=n.measured)&&void 0!==t||(n.measured={}),n.measured.width=e.dimensions.width,n.measured.height=e.dimensions.height,e.setAttributes&&(n.width=e.dimensions.width,n.height=e.dimensions.height)),"boolean"==typeof e.resizing&&(n.resizing=e.resizing)}}function Wo(e,n){var t,r,o,i,a,u,c=[],l=new Map;try{for(var s=p(e),f=s.next();!f.done;f=s.next()){if("add"!==(_=f.value).type)if("remove"===_.type||"replace"===_.type)l.set(_.id,[_]);else{var h=l.get(_.id);h?h.push(_):l.set(_.id,[_])}else c.push(_.item)}}catch(e){t={error:e}}finally{try{f&&!f.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}try{for(var v=p(n),g=v.next();!g.done;g=v.next()){var y=g.value,m=l.get(y.id);if(m){if("remove"!==m[0].type)if("replace"!==m[0].type){var w=d({},y);try{for(var b=(a=void 0,p(m)),x=b.next();!x.done;x=b.next()){var _;$o(_=x.value,w)}}catch(e){a={error:e}}finally{try{x&&!x.done&&(u=b.return)&&u.call(b)}finally{if(a)throw a.error}}c.push(w)}else c.push(d({},m[0].item))}else c.push(y)}}catch(e){o={error:e}}finally{try{g&&!g.done&&(i=v.return)&&i.call(v)}finally{if(o)throw o.error}}return c}function qo(e,n){return Wo(e,n)}function Ko(e,n){return Wo(e,n)}function Qo(e,n){return{id:e,type:"select",selected:n}}function Jo(e,n,t){var r,o;void 0===n&&(n=new Set),void 0===t&&(t=!1);var i=[];try{for(var a=p(e),u=a.next();!u.done;u=a.next()){var c=g(u.value,2),l=c[0],s=c[1],d=n.has(l);void 0===s.selected&&!d||s.selected===d||(t&&(s.selected=d),i.push(Qo(s.id,d)))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return i}function ei(e){var n,t,r,o,i,a,u=e.items,c=void 0===u?[]:u,l=e.lookup,s=[],d=new Map(c.map((function(e){return[e.id,e]})));try{for(var f=p(c),h=f.next();!h.done;h=f.next()){var v=h.value,y=l.get(v.id),m=null!==(a=null===(i=null==y?void 0:y.internals)||void 0===i?void 0:i.userNode)&&void 0!==a?a:y;void 0!==m&&m!==v&&s.push({id:v.id,item:v,type:"replace"}),void 0===m&&s.push({item:v,type:"add"})}}catch(e){n={error:e}}finally{try{h&&!h.done&&(t=f.return)&&t.call(f)}finally{if(n)throw n.error}}try{for(var w=p(l),b=w.next();!b.done;b=w.next()){var x=g(b.value,1)[0];void 0===d.get(x)&&s.push({id:x,type:"remove"})}}catch(e){r={error:e}}finally{try{b&&!b.done&&(o=w.return)&&o.call(w)}finally{if(r)throw r.error}}return s}function ni(e){return{id:e.id,type:"remove"}}var ti=function(e,n){void 0===n&&(n=[0,0]);var t=re(e),r=t.width,o=t.height,i="internals"in e?e.internals.positionAbsolute:e.position,a=e.origin||n,u=r*a[0],c=o*a[1];return{position:{x:e.position.x-u,y:e.position.y-c},positionAbsolute:{x:i.x-u,y:i.y-c}}},ri=function(e,n){if(void 0===n&&(n={nodeOrigin:[0,0]}),0===e.size)return{x:0,y:0,width:0,height:0};var t={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach((function(e){if(null==n.filter||n.filter(e)){var r=de(e,n.nodeOrigin);t=ce(t,r)}})),se(t)},oi=function(e,n,t,r,o,i){var a,u,c,l,s,f,h,v,y=g(void 0===t?[0,0,1]:t,3),m=y[0],w=y[1],b=y[2];void 0===r&&(r=!1),void 0===o&&(o=!1),void 0===i&&(i=[0,0]);var x=d(d({},ae(n,[m,w,b])),{width:n.width/b,height:n.height/b}),_=[];try{for(var E=p(e),S=E.next();!S.done;S=E.next()){var k=g(S.value,2)[1],N=k.measured,C=k.selectable,O=void 0===C||C,M=k.hidden,j=void 0!==M&&M,I=null!==(s=null!==(l=null!==(c=N.width)&&void 0!==c?c:k.width)&&void 0!==l?l:k.initialWidth)&&void 0!==s?s:null,P=null!==(v=null!==(h=null!==(f=N.height)&&void 0!==f?f:k.height)&&void 0!==h?h:k.initialHeight)&&void 0!==v?v:null;if(!(o&&!O||j)){var A=ve(x,ue(k,i));(null===I||null===P||r&&A>0||A>=(null!=I?I:0)*(null!=P?P:0)||k.dragging)&&_.push(k)}}}catch(e){a={error:e}}finally{try{S&&!S.done&&(u=E.return)&&u.call(E)}finally{if(a)throw a.error}}return _},ii=function(e,n){var t=new Set;return e.forEach((function(e){t.add(e.id)})),n.filter((function(e){return t.has(e.source)||t.has(e.target)}))};function ai(e,n){var t,r,o,i=e.nodeLookup,a=e.width,u=e.height,c=e.panZoom,l=e.minZoom,s=e.maxZoom,d=e.nodeOrigin,f=void 0===d?[0,0]:d,h=[],v=(null==n?void 0:n.nodes)?new Set(n.nodes.map((function(e){return e.id}))):null;if(i.forEach((function(e){!(e.measured.width&&e.measured.height&&((null==n?void 0:n.includeHiddenNodes)||!e.hidden))||v&&!v.has(e.id)||h.push(e)})),h.length>0){var p=function(e,n){if(void 0===n&&(n={nodeOrigin:[0,0]}),0===e.length)return{x:0,y:0,width:0,height:0};var t=e.reduce((function(e,t){var r=de(t,n.nodeOrigin);return ce(e,r)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return se(t)}(h,{nodeOrigin:f}),g=pe(p,a,u,null!==(t=null==n?void 0:n.minZoom)&&void 0!==t?t:l,null!==(r=null==n?void 0:n.maxZoom)&&void 0!==r?r:s,null!==(o=null==n?void 0:n.padding)&&void 0!==o?o:.1);return c.setViewport(g,{duration:null==n?void 0:n.duration}),!0}return!1}function ui(e){var n=e.nodeId,t=e.nextPosition,r=e.nodeLookup,o=e.nodeOrigin,i=void 0===o?[0,0]:o,a=e.nodeExtent,u=e.onError,c=r.get(n),l=c.parentId?r.get(c.parentId):void 0,s=l?ti(l,l.origin||i).positionAbsolute:{x:0,y:0},d=s.x,f=s.y,h=function(e,n){var t,r,o,i;return n&&"parent"!==n?[n[0],[n[1][0]-(null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:0),n[1][1]-(null!==(i=null===(o=e.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:0)]]:n}(c,c.extent||a);if("parent"!==c.extent||c.expandParent)l&&ge(c.extent)&&(h=[[c.extent[0][0]+d,c.extent[0][1]+f],[c.extent[1][0]+d,c.extent[1][1]+f]]);else if(l){var v=c.measured.width,p=c.measured.height,g=l.measured.width,y=l.measured.height;if(v&&p&&g&&y){var m=c.origin||i,w=d+v*m[0],b=f+p*m[1];h=[[w,b],[w+g-v,b+y-p]]}}else null==u||u("005",Y.error005());var x=ge(h)?te(t,h):t;return{position:{x:x.x-d,y:x.y-f},positionAbsolute:x}}function ci(e){return h(this,arguments,void 0,(function(e){var n,t,r,o,i,a,u,c,l,s,d,f,h,g,y,m,w,b,x,_=e.nodesToRemove,E=void 0===_?[]:_,S=e.edgesToRemove,k=void 0===S?[]:S,N=e.nodes,C=e.edges,O=e.onBeforeDelete;return v(this,(function(e){switch(e.label){case 0:n=new Set(E.map((function(e){return e.id}))),t=[],r=function(e){if(!1===e.deletable)return"continue";var r=n.has(e.id),o=!r&&e.parentId&&t.find((function(n){return n.id===e.parentId}));(r||o)&&t.push(e)};try{for(o=p(N),i=o.next();!i.done;i=o.next())a=i.value,r(a)}catch(e){m={error:e}}finally{try{i&&!i.done&&(w=o.return)&&w.call(o)}finally{if(m)throw m.error}}u=new Set(k.map((function(e){return e.id}))),c=C.filter((function(e){return!1!==e.deletable})),l=ii(t,c),s=l,d=function(e){u.has(e.id)&&!s.find((function(n){return n.id===e.id}))&&s.push(e)};try{for(f=p(c),h=f.next();!h.done;h=f.next())g=h.value,d(g)}catch(e){b={error:e}}finally{try{h&&!h.done&&(x=f.return)&&x.call(f)}finally{if(b)throw b.error}}return O?[4,O({nodes:t,edges:s})]:[2,{edges:s,nodes:t}];case 1:return"boolean"==typeof(y=e.sent())?[2,y?{edges:s,nodes:t}:{edges:[],nodes:[]}]:[2,y]}}))}))}var li=function(e){return{userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect}};function si(){var e=G(li,De),n=e.userSelectionActive,t=e.userSelectionRect;return n&&t?E.jsx("div",{className:"ink-flow__selection ink-flow__container",style:{width:t.width,height:t.height,transform:"translate(".concat(t.x,"px, ").concat(t.y,"px)")}}):null}var di=function(e,n){return function(t){t.target===n.current&&(null==e||e(t))}},fi=function(e){return{userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}};function hi(e){var n=e.isSelecting;e.selectionMode;var t=e.panOnDrag,r=e.onSelectionStart,o=e.onSelectionEnd,i=e.onPaneClick,u=e.onPaneContextMenu,c=e.onPaneScroll,l=e.onPaneMouseEnter,s=e.onPaneMouseMove,d=e.onPaneMouseLeave,f=e.children,h=a(null),v=$(),y=a(0),m=a(0),w=a(),b=a(new Map),x=G(fi,De),_=x.userSelectionActive,S=x.elementsSelectable,k=x.dragging,N=function(){v.setState({userSelectionActive:!1,userSelectionRect:null}),y.current=0,m.current=0},C=function(e){null==i||i(e),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},M=c?function(e){return c(e)}:void 0,j=S&&(n||_);return E.jsxs("div",{className:O(["ink-flow__pane",{draggable:t,dragging:k,selection:n}]),onClick:j?void 0:di(C,h),onContextMenu:di((function(e){Array.isArray(t)&&(null==t?void 0:t.includes(2))?e.preventDefault():null==u||u(e)}),h),onWheel:di(M,h),onMouseEnter:j?void 0:l,onMouseDown:j?function(e){var t,o,i,a,u=v.getState(),c=u.resetSelectedElements,l=u.domNode,s=u.edgeLookup;if(w.current=null==l?void 0:l.getBoundingClientRect(),S&&n&&0===e.button&&e.target===h.current&&w.current){b.current=new Map;try{for(var d=p(s),f=d.next();!f.done;f=d.next()){var y=g(f.value,2),m=y[0],x=y[1];b.current.set(x.source,(null===(i=b.current.get(x.source))||void 0===i?void 0:i.add(m))||new Set([m])),b.current.set(x.target,(null===(a=b.current.get(x.target))||void 0===a?void 0:a.add(m))||new Set([m]))}}catch(e){t={error:e}}finally{try{f&&!f.done&&(o=d.return)&&o.call(d)}finally{if(t)throw t.error}}var _=Ie(e.nativeEvent,w.current),E=_.x,k=_.y;c(),v.setState({userSelectionRect:{width:0,height:0,startX:E,startY:k,x:E,y:k}}),null==r||r(e)}}:void 0,onMouseMove:j?function(e){var t,r,o,i,a=v.getState(),u=a.userSelectionRect,c=a.edgeLookup,l=a.transform,s=a.nodeOrigin,d=a.nodeLookup,f=a.triggerNodeChanges,h=a.triggerEdgeChanges;if(n&&w.current&&u){var g=Ie(e.nativeEvent,w.current),x=g.x,_=g.y,E=u.startX,S=u.startY,k={startX:E,startY:S,x:x<E?x:E,y:_<S?_:S,width:Math.abs(x-E),height:Math.abs(_-S)},N=oi(d,k,l,!1,!0,s),C=new Set,O=new Set;try{for(var M=p(N),j=M.next();!j.done;j=M.next()){var I=j.value;O.add(I.id);var P=b.current.get(I.id);if(P)try{for(var A=(o=void 0,p(P)),z=A.next();!z.done;z=A.next()){var T=z.value;C.add(T)}}catch(e){o={error:e}}finally{try{z&&!z.done&&(i=A.return)&&i.call(A)}finally{if(o)throw o.error}}}}catch(e){t={error:e}}finally{try{j&&!j.done&&(r=M.return)&&r.call(M)}finally{if(t)throw t.error}}if(y.current!==O.size)y.current=O.size,f(Jo(d,O,!0));if(m.current!==C.size)m.current=C.size,h(Jo(c,C));v.setState({userSelectionRect:k,userSelectionActive:!0,nodesSelectionActive:!1})}}:s,onMouseUp:j?function(e){if(0===e.button){var n=v.getState().userSelectionRect;!_&&n&&e.target===h.current&&(null==C||C(e)),v.setState({nodesSelectionActive:y.current>0}),N(),null==o||o(e)}}:void 0,onMouseLeave:j?function(e){_&&(v.setState({nodesSelectionActive:y.current>0}),null==o||o(e)),N()}:d,ref:h,style:Xe,children:[f,E.jsx(si,{})]})}var vi=function(e){return{nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive}};function pi(e){var n=e.children,t=e.onPaneClick,r=e.onPaneMouseEnter,o=e.onPaneMouseMove,i=e.onPaneMouseLeave,a=e.onPaneContextMenu,c=e.onPaneScroll,l=e.deleteKeyCode,s=e.selectionKeyCode,d=e.selectionOnDrag,f=e.selectionMode,h=e.onSelectionStart,v=e.onSelectionEnd,p=e.multiSelectionKeyCode,g=e.panActivationKeyCode,y=e.zoomActivationKeyCode,m=e.elementsSelectable,w=e.zoomOnScroll,b=e.zoomOnPinch,x=e.panOnScroll,_=e.panOnScrollSpeed,S=e.panOnScrollMode,k=e.zoomOnDoubleClick,N=e.panOnDrag,C=e.defaultViewport,O=e.translateExtent,M=e.minZoom,j=e.maxZoom,I=e.preventScrolling;e.onSelectionContextMenu;var P=e.noWheelClassName,A=e.noPanClassName;e.disableKeyboardA11y;var z=e.onViewportChange,T=e.isControlledViewport,B=G(vi);B.nodesSelectionActive;var D=B.userSelectionActive,L=ze(s),V=ze(g),R=V||N,H=V||x,Z=L||D||d&&!0!==R;return function(e){var n=e.deleteKeyCode,t=e.multiSelectionKeyCode,r=$(),o=ze(n,Go),i=ze(t);u((function(){if(o){var e=r.getState();e.edges,e.nodes,r.setState({nodesSelectionActive:!1})}}),[o]),u((function(){r.setState({multiSelectionActive:i})}),[i])}({deleteKeyCode:l,multiSelectionKeyCode:p}),E.jsx(Uo,{onPaneContextMenu:a,elementsSelectable:m,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:H,panOnScrollSpeed:_,panOnScrollMode:S,zoomOnDoubleClick:k,panOnDrag:!L&&R,defaultViewport:C,translateExtent:O,minZoom:M,maxZoom:j,zoomActivationKeyCode:y,preventScrolling:I,noWheelClassName:P,noPanClassName:A,onViewportChange:z,isControlledViewport:T,children:E.jsx(hi,{onSelectionStart:h,onSelectionEnd:v,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:o,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:c,panOnDrag:R,isSelecting:!!Z,selectionMode:f,children:n})})}pi.displayName="FlowRenderer";var gi=c(pi);function yi(e){var n=g(i(e),2),t=n[0],r=n[1],o=l((function(e){return r((function(n){return qo(e,n)}))}),[]);return[t,r,o]}function mi(e){var n=g(i(e),2),t=n[0],r=n[1],o=l((function(e){return r((function(n){return Ko(e,n)}))}),[]);return[t,r,o]}var wi="undefined"!=typeof window?s:u;function bi(e){var n=g(i(!1),2),t=n[0],r=n[1],o=g(i((function(){return function(e){var n=[];return{get:function(){return n},reset:function(){n=[]},push:function(t){n.push(t),e()}}}((function(){return r(!0)}))})),1),a=o[0];return wi((function(){if(t){var n=a.get();n.length&&(e(n),a.reset()),r(!1)}else a.reset()}),[t]),a}var xi=n(null);function _i(e){var n=e.children,t=$(),o=l((function(e){var n,r,o=t.getState(),i=o.nodes,a=void 0===i?[]:i,u=o.setNodes,c=o.hasDefaultNodes,l=o.onNodesChange,s=o.nodeLookup,d=a;try{for(var f=p(e),h=f.next();!h.done;h=f.next()){var v=h.value;d="function"==typeof v?v(d):v}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}c?u(d):l&&l(ei({items:d,lookup:s}))}),[]),i=bi(o),a=l((function(e){var n,r,o=t.getState(),i=o.edges,a=void 0===i?[]:i,u=o.setEdges,c=o.hasDefaultEdges,l=o.onEdgesChange,s=o.edgeLookup,d=a;try{for(var f=p(e),h=f.next();!h.done;h=f.next()){var v=h.value;d="function"==typeof v?v(d):v}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}c?u(d):l&&l(ei({items:d,lookup:s}))}),[]),u=bi(a),c=r((function(){return{nodeQueue:i,edgeQueue:u}}),[]);return E.jsx(xi.Provider,{value:c,children:n})}var Ei=function(){var e=$();return r((function(){return{zoomIn:function(n){var t;return null===(t=e.getState().panZoom)||void 0===t?void 0:t.scaleBy(1.2,{duration:null==n?void 0:n.duration})},zoomOut:function(n){var t;return null===(t=e.getState().panZoom)||void 0===t?void 0:t.scaleBy(1/1.2,{duration:null==n?void 0:n.duration})},zoomTo:function(n,t){var r;return null===(r=e.getState().panZoom)||void 0===r?void 0:r.scaleTo(n,{duration:null==t?void 0:t.duration})},getZoom:function(){return e.getState().transform[2]},setViewport:function(n,t){var r,o,i,a=e.getState(),u=g(a.transform,3),c=u[0],l=u[1],s=u[2],d=a.panZoom;null==d||d.setViewport({x:null!==(r=n.x)&&void 0!==r?r:c,y:null!==(o=n.y)&&void 0!==o?o:l,zoom:null!==(i=n.zoom)&&void 0!==i?i:s},{duration:null==t?void 0:t.duration})},getViewport:function(){var n=g(e.getState().transform,3);return{x:n[0],y:n[1],zoom:n[2]}},fitView:function(n){var t=e.getState(),r=t.nodeLookup,o=t.width,i=t.height,a=t.nodeOrigin,u=t.minZoom,c=t.maxZoom,l=t.panZoom;return!!l&&ai({nodeLookup:r,width:o,height:i,nodeOrigin:a,minZoom:u,maxZoom:c,panZoom:l},n)},setCenter:function(n,t,r){var o=e.getState(),i=o.width,a=o.height,u=o.maxZoom,c=o.panZoom,l=void 0!==(null==r?void 0:r.zoom)?r.zoom:u,s=i/2-n*l,d=a/2-t*l;null==c||c.setViewport({x:s,y:d,zoom:l},{duration:null==r?void 0:r.duration})},fitBounds:function(n,t){var r,o=e.getState(),i=o.width,a=o.height,u=o.minZoom,c=o.maxZoom,l=o.panZoom,s=pe(n,i,a,u,c,null!==(r=null==t?void 0:t.padding)&&void 0!==r?r:.1);null==l||l.setViewport(s,{duration:null==t?void 0:t.duration})},screenToFlowPosition:function(n,t){void 0===t&&(t={snapToGrid:!0});var r=e.getState(),o=r.transform,i=r.snapGrid,a=r.domNode;if(!a)return n;var u=a.getBoundingClientRect(),c=u.x,l=u.y,s={x:n.x-c,y:n.y-l};return ae(s,o,t.snapToGrid,i)},flowToScreenPosition:function(n){var t=e.getState(),r=t.transform,o=t.domNode;if(!o)return n;var i=o.getBoundingClientRect(),a=i.x,u=i.y,c=be(n,r);return{x:c.x+a,y:c.y+u}}}}),[])},Si=function(e){return!!e.panZoom};function ki(){var e=this,n=Ei(),o=$(),i=function(){var e=t(xi);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}(),a=G(Si),u=r((function(){var n=function(e){return o.getState().nodeLookup.get(e)},t=function(e){i.nodeQueue.push(e)},r=function(e){var n,t,r,i,a=o.getState(),u=a.nodeLookup,c=a.nodeOrigin,l=_e(e)?e:u.get(e.id),s=l.parentId?function(e,n,t,r){var o,i;void 0===r&&(r=[0,0]);for(var a=n,u=d({},e);a;){var c=t.get(n);if(a=null==c?void 0:c.parentId,c){var l=c.origin||r,s=(null!==(o=c.measured.width)&&void 0!==o?o:0)*l[0],f=(null!==(i=c.measured.height)&&void 0!==i?i:0)*l[1];u.x+=c.position.x-s,u.y+=c.position.y-f}}return u}(l.position,l.parentId,u,c):l.position,f={id:l.id,position:s,width:null!==(t=null===(n=l.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:l.width,height:null!==(i=null===(r=l.measured)||void 0===r?void 0:r.height)&&void 0!==i?i:l.height,data:l.data};return ue(f)},a=function(e,n,r){void 0===r&&(r={replace:!1}),t((function(t){return t.map((function(t){if(t.id===e){var o="function"==typeof n?n(t):n;return r.replace&&_e(o)?o:d(d({},t),o)}return t}))}))};return{getNodes:function(){return o.getState().nodes.map((function(e){return d({},e)}))},getNode:function(e){var t;return null===(t=n(e))||void 0===t?void 0:t.internals.userNode},getInternalNode:n,getEdges:function(){var e=o.getState().edges;return(void 0===e?[]:e).map((function(e){return d({},e)}))},getEdge:function(e){return o.getState().edgeLookup.get(e)},setNodes:t,setEdges:function(e){i.edgeQueue.push(e)},addNodes:function(e){var n=Array.isArray(e)?e:[e];i.nodeQueue.push((function(e){return y(y([],g(e),!1),g(n),!1)}))},addEdges:function(e){var n=Array.isArray(e)?e:[e];i.edgeQueue.push((function(e){return y(y([],g(e),!1),g(n),!1)}))},toObject:function(){var e=o.getState(),n=e.nodes,t=void 0===n?[]:n,r=e.edges,i=void 0===r?[]:r,a=g(e.transform,3),u=a[0],c=a[1],l=a[2];return{nodes:t.map((function(e){return d({},e)})),edges:i.map((function(e){return d({},e)})),viewport:{x:u,y:c,zoom:l}}},deleteElements:function(n){return h(e,[n],void 0,(function(e){var n,t,r,i,a,u,c,l,s,d,f,h,p,g,y,m,w=e.nodes,b=void 0===w?[]:w,x=e.edges,_=void 0===x?[]:x;return v(this,(function(e){switch(e.label){case 0:return n=o.getState(),t=n.nodes,r=n.edges,i=n.onNodesDelete,a=n.onEdgesDelete,u=n.triggerNodeChanges,c=n.triggerEdgeChanges,l=n.onDelete,s=n.onBeforeDelete,[4,ci({nodesToRemove:b,edgesToRemove:_,nodes:t,edges:r,onBeforeDelete:s})];case 1:return d=e.sent(),f=d.nodes,h=d.edges,p=h.length>0,g=f.length>0,p&&(y=h.map(ni),null==a||a(h),c(y)),g&&(m=f.map(ni),null==i||i(f),u(m)),(g||p)&&(null==l||l({nodes:f,edges:h})),[2,{deletedNodes:f,deletedEdges:h}]}}))}))},getIntersectingNodes:function(e,n,t){void 0===n&&(n=!0);var i=Se(e),a=i?e:r(e),u=void 0!==t;return a?(t||o.getState().nodes).filter((function(t){var r=o.getState().nodeLookup.get(t.id);if(r&&!i&&(t.id===e.id||!r.internals.positionAbsolute))return!1;var c=ue(u?t:r),l=ve(c,a);return n&&l>0||l>=a.width*a.height})):[]},isNodeIntersecting:function(e,n,t){void 0===t&&(t=!0);var o=Se(e)?e:r(e);if(!o)return!1;var i=ve(o,n);return t&&i>0||i>=o.width*o.height},updateNode:a,updateNodeData:function(e,n,t){void 0===t&&(t={replace:!1}),a(e,(function(e){var r="function"==typeof n?n(e):n;return t.replace?d(d({},e),{data:r}):d(d({},e),{data:d(d({},e.data),r)})}),t)}}}),[]);return r((function(){return d(d(d({},u),n),{viewportInitialized:a})}),[a])}var Ni=function(e){return e.updateNodeInternals};var Ci=function(e){return function(n){return e?oi(n.nodeLookup,{x:0,y:0,width:n.width,height:n.height},n.transform,!0).map((function(e){return e.id})):Array.from(n.nodeLookup.keys())}};var Oi=n(null),Mi=Oi.Provider;Oi.Consumer;var ji="ink-flow__node-desc",Ii="ink-flow__edge-desc";function Pi(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=e.sourceControlX,a=e.sourceControlY,u=.125*n+.375*i+.375*e.targetControlX+.125*r,c=.125*t+.375*a+.375*e.targetControlY+.125*o;return[u,c,Math.abs(u-n),Math.abs(c-t)]}function Ai(e,n){return e>=0?.5*e:25*n*Math.sqrt(-e)}function zi(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2,a=e.c;switch(n){case Ye.Left:return[t-Ai(t-o,a),r];case Ye.Right:return[t+Ai(o-t,a),r];case Ye.Top:return[t,r-Ai(r-i,a)];case Ye.Bottom:return[t,r+Ai(i-r,a)]}}function Ti(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=Math.abs(r-n)/2,a=r<n?r+i:r-i,u=Math.abs(o-t)/2;return[a,o<t?o+u:o-u,i,u]}var Bi,Di=function(e){var n=e.source,t=e.sourceHandle,r=e.target,o=e.targetHandle;return"xy-edge__".concat(n).concat(t||"","-").concat(r).concat(o||"")};var Li=((Bi={})[Ye.Left]={x:-1,y:0},Bi[Ye.Right]={x:1,y:0},Bi[Ye.Top]={x:0,y:-1},Bi[Ye.Bottom]={x:0,y:1},Bi),Vi=function(e){var n=e.source,t=e.sourcePosition,r=void 0===t?Ye.Bottom:t,o=e.target;return r===Ye.Left||r===Ye.Right?n.x<o.x?{x:1,y:0}:{x:-1,y:0}:n.y<o.y?{x:0,y:1}:{x:0,y:-1}},Ri=function(e,n){return Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))};function Hi(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?Ye.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?Ye.Top:u,l=e.borderRadius,s=void 0===l?5:l,d=e.centerX,f=e.centerY,h=e.offset,v=g(function(e){var n,t,r,o,i=e.source,a=e.sourcePosition,u=void 0===a?Ye.Bottom:a,c=e.target,l=e.targetPosition,s=void 0===l?Ye.Top:l,d=e.center,f=e.offset,h=Li[u],v=Li[s],p={x:i.x+h.x*f,y:i.y+h.y*f},m={x:c.x+v.x*f,y:c.y+v.y*f},w=Vi({source:p,sourcePosition:u,target:m}),b=0!==w.x?"x":"y",x=w[b],_=[],E={x:0,y:0},S={x:0,y:0},k=g(Ti({sourceX:i.x,sourceY:i.y,targetX:c.x,targetY:c.y}),4),N=k[0],C=k[1],O=k[2],M=k[3];if(h[b]*v[b]==-1){r=null!==(n=d.x)&&void 0!==n?n:N,o=null!==(t=d.y)&&void 0!==t?t:C;var j=[{x:r,y:p.y},{x:r,y:m.y}],I=[{x:p.x,y:o},{x:m.x,y:o}];_=h[b]===x?"x"===b?j:I:"x"===b?I:j}else{var P=[{x:p.x,y:m.y}],A=[{x:m.x,y:p.y}];if(_="x"===b?h.x===x?A:P:h.y===x?P:A,u===s){var z=Math.abs(i[b]-c[b]);if(z<=f){var T=Math.min(f-1,f-z);h[b]===x?E[b]=(p[b]>i[b]?-1:1)*T:S[b]=(m[b]>c[b]?-1:1)*T}}if(u!==s){var B="x"===b?"y":"x",D=h[b]===v[B],L=p[B]>m[B],V=p[B]<m[B];(1===h[b]&&(!D&&L||D&&V)||1!==h[b]&&(!D&&V||D&&L))&&(_="x"===b?P:A)}var R={x:p.x+E.x,y:p.y+E.y},H={x:m.x+S.x,y:m.y+S.y};Math.max(Math.abs(R.x-_[0].x),Math.abs(H.x-_[0].x))>=Math.max(Math.abs(R.y-_[0].y),Math.abs(H.y-_[0].y))?(r=(R.x+H.x)/2,o=_[0].y):(r=_[0].x,o=(R.y+H.y)/2)}return[y(y([i,{x:p.x+E.x,y:p.y+E.y}],g(_),!1),[{x:m.x+S.x,y:m.y+S.y},c],!1),r,o,O,M]}({source:{x:n,y:t},sourcePosition:o,target:{x:i,y:a},targetPosition:c,center:{x:d,y:f},offset:void 0===h?20:h}),5),p=v[0],m=v[1],w=v[2],b=v[3],x=v[4],_=p.reduce((function(e,n,t){var r="";return r=t>0&&t<p.length-1?function(e,n,t,r){var o=Math.min(Ri(e,n)/2,Ri(n,t)/2,r),i=n.x,a=n.y;if(e.x===i&&i===t.x||e.y===a&&a===t.y)return"L".concat(i," ").concat(a);if(e.y===a){var u=e.x<t.x?-1:1,c=e.y<t.y?1:-1;return"L ".concat(i+o*u,",").concat(a,"Q ").concat(i,",").concat(a," ").concat(i,",").concat(a+o*c)}var l=e.x<t.x?1:-1,s=e.y<t.y?-1:1;return"L ".concat(i,",").concat(a+o*s,"Q ").concat(i,",").concat(a," ").concat(i+o*l,",").concat(a)}(p[t-1],n,p[t+1],s):"".concat(0===t?"M":"L").concat(n.x," ").concat(n.y),e+=r}),"");return[_,m,w,b,x]}function Zi(e,n,t,r){return(n[t]||[]).reduce((function(n,o){return"".concat(e.id,"-").concat(o.id,"-").concat(t)!==r&&n.push({id:o.id||null,type:t,nodeId:e.id,x:e.internals.positionAbsolute.x+o.x+o.width/2,y:e.internals.positionAbsolute.y+o.y+o.height/2}),n}),[])}function Yi(e,n){return e||((null==n?void 0:n.classList.contains("target"))?"target":(null==n?void 0:n.classList.contains("source"))?"source":null)}var Xi=function(){return!0},Fi=null;function Ui(e,n){var t=n.handle,r=n.connectionMode,o=n.fromNodeId,i=n.fromHandleId,a=n.fromType,u=n.doc,c=n.lib,l=n.flowId,s=n.isValidConnection,d=void 0===s?Xi:s,f="target"===a,h=t?u.querySelector(".".concat(c,'-flow__handle[data-id="').concat(l,"-").concat(null==t?void 0:t.nodeId,"-").concat(null==t?void 0:t.id,"-").concat(null==t?void 0:t.type,'"]')):null,v=Ie(e),p=v.x,g=v.y,y=u.elementFromPoint(p,g),m=(null==y?void 0:y.classList.contains("".concat(c,"-flow__handle")))?y:h,w={handleDomNode:m,isValid:!1,connection:null,endHandle:null};if(m){var b=Yi(void 0,m),x=m.getAttribute("data-nodeid"),_=m.getAttribute("data-handleid"),E=m.classList.contains("connectable"),S=m.classList.contains("connectableend");if(!x)return w;var k={source:f?x:o,sourceHandle:f?_:i,target:f?o:x,targetHandle:f?i:_};w.connection=k,E&&S&&(r===Le.Strict?f&&"source"===b||!f&&"target"===b:x!==o||_!==i)&&(w.endHandle={nodeId:x,handleId:_,type:b},w.isValid=d(k))}return w}var Gi={onPointerDown:function(e,n){var t,r=n.connectionMode,o=n.connectionRadius,i=n.handleId,a=n.nodeId,u=n.edgeUpdaterType,c=n.isTarget,l=n.domNode,s=n.nodeLookup,d=n.lib,f=n.autoPanOnConnect,h=n.flowId,v=n.panBy,m=n.cancelConnection,w=n.onConnectStart,b=n.onConnect,x=n.onConnectEnd,_=n.isValidConnection,E=void 0===_?Xi:_,S=n.onEdgeUpdateEnd,k=n.updateConnection,N=n.getTransform,C=n.getConnectionStartHandle,O=Ce(e.target),M=0,j=Ie(e),I=j.x,P=j.y,A=null==O?void 0:O.elementFromPoint(I,P),z=Yi(u,A),T=null==l?void 0:l.getBoundingClientRect();if(T&&z){var B=Ie(e,T),D=!1,L=null,V=!1,R=null,H=function(e){var n,t,r=e.nodeLookup,o=e.nodeId,i=e.handleId,a=e.handleType,u=[];try{for(var c=p(r),l=c.next();!l.done;l=c.next()){var s=g(l.value,2)[1];if(s.internals.handleBounds){var d="".concat(o,"-").concat(i,"-").concat(a),f=Zi(s,s.internals.handleBounds,"source",d),h=Zi(s,s.internals.handleBounds,"target",d);u.push.apply(u,y(y([],g(f),!1),g(h),!1))}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(t=c.return)&&t.call(c)}finally{if(n)throw n.error}}return u}({nodeLookup:s,nodeId:a,handleId:i,handleType:z});k({connectionPosition:B,connectionStatus:null,connectionStartHandle:Fi={nodeId:a,handleId:i,type:z},connectionEndHandle:null}),null==w||w(e,{nodeId:a,handleId:i,handleType:z}),O.addEventListener("mousemove",Y),O.addEventListener("mouseup",X),O.addEventListener("touchmove",Y),O.addEventListener("touchend",X)}function Z(){if(f&&T){var e=g(me(B,T),2),n=e[0],t=e[1];v({x:n,y:t}),M=requestAnimationFrame(Z)}}function Y(e){C()||X(e);var n=N();B=Ie(e,T),t=function(e,n,t){var r,o,i=[],a=1/0;try{for(var u=p(t),c=u.next();!c.done;c=u.next()){var l=c.value,s=Math.sqrt(Math.pow(l.x-e.x,2)+Math.pow(l.y-e.y,2));s<=n&&(s<a?i=[l]:s===a&&i.push(l),a=s)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}return i.length?1===i.length?i[0]:i.find((function(e){return"target"===e.type}))||i[0]:null}(ae(B,n,!1,[1,1]),o,H),D||(Z(),D=!0);var u,l,s,f=Ui(e,{handle:t,connectionMode:r,fromNodeId:a,fromHandleId:i,fromType:c?"target":"source",isValidConnection:E,doc:O,lib:d,flowId:h});R=f.handleDomNode,L=f.connection,V=f.isValid,k({connectionStartHandle:Fi,connectionPosition:t&&V?be({x:t.x,y:t.y},n):B,connectionStatus:(u=!!t,l=V,s=null,l?s="valid":u&&!l&&(s="invalid"),s),connectionEndHandle:f.endHandle})}function X(e){(t||R)&&L&&V&&(null==b||b(L)),null==x||x(e),u&&(null==S||S(e)),m(),cancelAnimationFrame(M),D=!1,V=!1,L=null,R=null,Fi=null,O.removeEventListener("mousemove",Y),O.removeEventListener("mouseup",X),O.removeEventListener("touchmove",Y),O.removeEventListener("touchend",X)}},isValid:Ui},$i=function(e){return{connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}};var Wi=c(he((function(e,n){var r,o,i=e.type,a=void 0===i?"source":i,u=e.position,c=void 0===u?Ye.Top:u,l=e.isValidConnection,s=e.isConnectable,h=void 0===s||s,v=e.isConnectableStart,p=void 0===v||v,g=e.isConnectableEnd,y=void 0===g||g,m=e.id,w=e.onConnect,b=e.children,x=e.className,_=e.onMouseDown,S=e.onTouchStart,k=f(e,["type","position","isValidConnection","isConnectable","isConnectableStart","isConnectableEnd","id","onConnect","children","className","onMouseDown","onTouchStart"]),N=m||null,C="target"===a,M=$(),j=t(Oi),I=G($i,De),P=I.connectOnClick,A=I.noPanClassName,z=I.rfId,T=G(function(e,n,t){return function(r){var o=r.connectionStartHandle,i=r.connectionEndHandle,a=r.connectionClickStartHandle,u=r.connectionMode,c=r.connectionStatus,l=(null==i?void 0:i.nodeId)===e&&(null==i?void 0:i.handleId)===n&&(null==i?void 0:i.type)===t;return{connectingFrom:(null==o?void 0:o.nodeId)===e&&(null==o?void 0:o.handleId)===n&&(null==o?void 0:o.type)===t,connectingTo:l,clickConnecting:(null==a?void 0:a.nodeId)===e&&(null==a?void 0:a.handleId)===n&&(null==a?void 0:a.type)===t,isPossibleEndHandle:u===Le.Strict?(null==o?void 0:o.type)!==t:e!==(null==o?void 0:o.nodeId)||n!==(null==o?void 0:o.handleId),connectionInProcess:!!o,valid:l&&"valid"===c}}}(j,N,a),De),B=T.connectingFrom,D=T.connectingTo,L=T.clickConnecting,V=T.isPossibleEndHandle,R=T.connectionInProcess,H=T.valid;j||null===(o=(r=M.getState()).onError)||void 0===o||o.call(r,"010",Y.error010());var Z=function(e){var n=M.getState(),t=n.defaultEdgeOptions,r=n.onConnect,o=n.hasDefaultEdges,i=d(d({},t),e);if(o){var a=M.getState(),u=a.edges;(0,a.setEdges)(function(e,n){return e.source&&e.target?function(e,n){return n.some((function(n){return!(n.source!==e.source||n.target!==e.target||n.sourceHandle!==e.sourceHandle&&(n.sourceHandle||e.sourceHandle)||n.targetHandle!==e.targetHandle&&(n.targetHandle||e.targetHandle))}))}(t="id"in(r=e)&&"source"in r&&"target"in r?d({},e):d(d({},e),{id:Di(e)}),n)?n:(null===t.sourceHandle&&delete t.sourceHandle,null===t.targetHandle&&delete t.targetHandle,n.concat(t)):n;var t,r}(i,u))}null==r||r(i),null==w||w(i)},X=function(e){if(j){var n=je(e.nativeEvent);if(p&&(n&&0===e.button||!n)){var t=M.getState();Gi.onPointerDown(e.nativeEvent,{autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:C,handleId:N,nodeId:j,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:t.onConnectEnd,updateConnection:t.updateConnection,onConnect:Z,isValidConnection:l||t.isValidConnection,getTransform:function(){return M.getState().transform},getConnectionStartHandle:function(){return M.getState().connectionStartHandle}})}n?null==_||_(e):null==S||S(e)}};return E.jsx("div",d({"data-handleid":N,"data-nodeid":j,"data-handlepos":c,"data-id":"".concat(z,"-").concat(j,"-").concat(N,"-").concat(a),className:O(["ink-flow__handle","ink-flow__handle-".concat(c),"nodrag",A,x,{source:!C,target:C,connectable:h,connectablestart:p,connectableend:y,clickconnecting:L,connectingfrom:B,connectingto:D,valid:H,connectionindicator:h&&(!R||V)&&(R?y:p)}]),onMouseDown:X,onTouchStart:X,onClick:P?function(e){var n=M.getState(),t=n.onClickConnectStart,r=n.onClickConnectEnd,o=n.connectionClickStartHandle,i=n.connectionMode,u=n.isValidConnection,c=n.lib,s=n.rfId;if(j&&(o||p)){if(!o)return null==t||t(e.nativeEvent,{nodeId:j,handleId:N,handleType:a}),void M.setState({connectionClickStartHandle:{nodeId:j,type:a,handleId:N}});var d=Ce(e.target),f=l||u,h=Gi.isValid(e.nativeEvent,{handle:{nodeId:j,id:N,type:a},connectionMode:i,fromNodeId:o.nodeId,fromHandleId:o.handleId||null,fromType:o.type,isValidConnection:f,flowId:s,doc:d,lib:c}),v=h.connection;h.isValid&&v&&Z(v),null==r||r(e),M.setState({connectionClickStartHandle:null})}}:void 0,ref:n},k,{children:b}))})));var qi={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Ki={input:function(e){var n=e.data,t=e.isConnectable,r=e.sourcePosition,o=void 0===r?Ye.Bottom:r;return E.jsxs(E.Fragment,{children:[null==n?void 0:n.label,E.jsx(Wi,{type:"source",position:o,isConnectable:t})]})},default:function(e){var n=e.data,t=e.isConnectable,r=e.targetPosition,o=void 0===r?Ye.Top:r,i=e.sourcePosition,a=void 0===i?Ye.Bottom:i;return E.jsxs(E.Fragment,{children:[E.jsx(Wi,{type:"target",position:o,isConnectable:t}),null==n?void 0:n.label,E.jsx(Wi,{type:"source",position:a,isConnectable:t})]})},output:function(e){var n=e.data,t=e.isConnectable,r=e.targetPosition,o=void 0===r?Ye.Top:r;return E.jsxs(E.Fragment,{children:[E.jsx(Wi,{type:"target",position:o,isConnectable:t}),null==n?void 0:n.label]})},group:function(){return null}};function Qi(e){var n=e.id,t=e.store,r=e.unselect,o=void 0!==r&&r,i=e.nodeRef,a=t.getState(),u=a.addSelectedNodes,c=a.unselectNodesAndEdges,l=a.multiSelectionActive,s=a.nodeLookup,d=a.onError,f=s.get(n);f?(t.setState({nodesSelectionActive:!1}),f.selected?(o||f.selected&&l)&&(c({nodes:[f],edges:[]}),requestAnimationFrame((function(){var e;return null===(e=null==i?void 0:i.current)||void 0===e?void 0:e.blur()}))):u([n])):null==d||d("012",Y.error012(n))}function Ji(e,n){if(!e.parentId)return!1;var t=n.get(e.parentId);return!!t&&(!!t.selected||Ji(t,n))}function ea(e,n,t){var r=e;do{if(null==r?void 0:r.matches(n))return!0;if(r===t)return!1;r=r.parentElement}while(r);return!1}function na(e){var n,t,r,o,i=e.nodeId,a=e.dragItems,u=e.nodeLookup,c=[];try{for(var l=p(a),s=l.next();!s.done;s=l.next()){var f=g(s.value,2),h=f[0],v=f[1],y=null===(r=u.get(h))||void 0===r?void 0:r.internals.userNode;y&&c.push(d(d({},y),{position:v.position}))}}catch(e){n={error:e}}finally{try{s&&!s.done&&(t=l.return)&&t.call(l)}finally{if(n)throw n.error}}if(!i)return[c[0],c];var m=u.get(i).internals.userNode;return[d(d({},m),{position:(null===(o=a.get(i))||void 0===o?void 0:o.position)||m.position}),c]}function ta(e){var n=e.onNodeMouseDown,t=e.getStoreItems,r=e.onDragStart,o=e.onDrag,i=e.onDragStop,a={x:null,y:null},u=0,c=new Map,l=!1,s={x:0,y:0},d=null,f=!1,h=null;return{update:function(e){var v=e.noDragClassName,y=e.handleSelector,m=e.domNode,w=e.isSelectable,b=e.nodeId;function x(e,n){var r,i,u=e.x,l=e.y,s=t(),d=s.nodeLookup,f=s.nodeExtent,h=s.snapGrid,v=s.snapToGrid,y=s.nodeOrigin,m=s.onNodeDrag,w=s.onSelectionDrag,x=s.onError,_=s.updateNodePositions;a={x:u,y:l};var E=!1,S={x:0,y:0,x2:0,y2:0};if(c.size>1&&f){var k=ri(c,{nodeOrigin:y});S=le(k)}try{for(var N=p(c),C=N.next();!C.done;C=N.next()){var O=g(C.value,2),M=O[0],j=O[1],I={x:u-j.distance.x,y:l-j.distance.y};v&&(I=ie(I,h));var P=[[f[0][0],f[0][1]],[f[1][0],f[1][1]]];if(c.size>1&&f&&!j.extent){var A=j.internals.positionAbsolute,z=A.x-S.x+f[0][0],T=A.x+j.measured.width-S.x2+f[1][0];P=[[z,A.y-S.y+f[0][1]],[T,A.y+j.measured.height-S.y2+f[1][1]]]}var B=ui({nodeId:M,nextPosition:I,nodeLookup:d,nodeExtent:P,nodeOrigin:y,onError:x}),D=B.position,L=B.positionAbsolute;E=E||j.position.x!==D.x||j.position.y!==D.y,j.position=D,j.internals.positionAbsolute=L}}catch(e){r={error:e}}finally{try{C&&!C.done&&(i=N.return)&&i.call(N)}finally{if(r)throw r.error}}if(E&&(_(c,!0),n&&(o||m||!b&&w))){var V=g(na({nodeId:b,dragItems:c,nodeLookup:d}),2),R=V[0],H=V[1];null==o||o(n,c,R,H),null==m||m(n,R,H),b||null==w||w(n,H)}}function _(){var e,n;if(d){var r=g(me(s,d),2),o=r[0],i=r[1];if(0!==o||0!==i){var c=t(),l=c.transform,f=c.panBy;a.x=(null!==(e=a.x)&&void 0!==e?e:0)-o/l[2],a.y=(null!==(n=a.y)&&void 0!==n?n:0)-i/l[2],f({x:o,y:i})&&x(a,null)}u=requestAnimationFrame(_)}}function E(e){var o,i=t(),u=i.nodeLookup,l=i.multiSelectionActive,s=i.nodesDraggable,d=i.transform,h=i.snapGrid,v=i.snapToGrid,y=i.selectNodesOnDrag,m=i.onNodeDragStart,x=i.onSelectionDragStart,_=i.unselectNodesAndEdges;f=!0,y&&w||l||!b||(null===(o=u.get(b))||void 0===o?void 0:o.selected)||_(),w&&y&&b&&(null==n||n(b));var E=ke(e.sourceEvent,{transform:d,snapGrid:h,snapToGrid:v});if(a=E,c=function(e,n,t,r){var o,i,a,u,c=new Map;try{for(var l=p(e),s=l.next();!s.done;s=l.next()){var d=g(s.value,2),f=d[0],h=d[1];if((h.selected||h.id===r)&&(!h.parentId||!Ji(h,e))&&(h.draggable||n&&void 0===h.draggable)){var v=e.get(f);v&&c.set(f,{id:f,position:v.position||{x:0,y:0},distance:{x:t.x-v.internals.positionAbsolute.x,y:t.y-v.internals.positionAbsolute.y},extent:v.extent,parentId:v.parentId,origin:v.origin,expandParent:v.expandParent,internals:{positionAbsolute:v.internals.positionAbsolute||{x:0,y:0}},measured:{width:null!==(a=v.measured.width)&&void 0!==a?a:0,height:null!==(u=v.measured.height)&&void 0!==u?u:0}})}}}catch(e){o={error:e}}finally{try{s&&!s.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}return c}(u,s,E,b),c.size>0&&(r||m||!b&&x)){var S=g(na({nodeId:b,dragItems:c,nodeLookup:u}),2),k=S[0],N=S[1];null==r||r(e.sourceEvent,c,k,N),null==m||m(e.sourceEvent,k,N),b||null==x||x(e.sourceEvent,N)}}h=lt(m);var S=function(){var e,n,t,r,o=wt,i=bt,a=xt,u=_t,c={},l=Ue("start","drag","end"),s=0,d=0;function f(e){e.on("mousedown.drag",h).filter(u).on("touchstart.drag",g).on("touchmove.drag",y,dt).on("touchend.drag touchcancel.drag",m).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(a,u){if(!r&&o.call(this,a,u)){var c=w(this,i.call(this,a,u),a,u,"mouse");c&&(lt(a.view).on("mousemove.drag",v,ft).on("mouseup.drag",p,ft),pt(a.view),ht(a),t=!1,e=a.clientX,n=a.clientY,c("start",a))}}function v(r){if(vt(r),!t){var o=r.clientX-e,i=r.clientY-n;t=o*o+i*i>d}c.mouse("drag",r)}function p(e){lt(e.view).on("mousemove.drag mouseup.drag",null),gt(e.view,t),vt(e),c.mouse("end",e)}function g(e,n){if(o.call(this,e,n)){var t,r,a=e.changedTouches,u=i.call(this,e,n),c=a.length;for(t=0;t<c;++t)(r=w(this,u,e,n,a[t].identifier,a[t]))&&(ht(e),r("start",e,a[t]))}}function y(e){var n,t,r=e.changedTouches,o=r.length;for(n=0;n<o;++n)(t=c[r[n].identifier])&&(vt(e),t("drag",e,r[n]))}function m(e){var n,t,o=e.changedTouches,i=o.length;for(r&&clearTimeout(r),r=setTimeout((function(){r=null}),500),n=0;n<i;++n)(t=c[o[n].identifier])&&(ht(e),t("end",e,o[n]))}function w(e,n,t,r,o,i){var u,d,h,v=l.copy(),p=st(i||t,n);if(null!=(h=a.call(e,new mt("beforestart",{sourceEvent:t,target:f,identifier:o,active:s,x:p[0],y:p[1],dx:0,dy:0,dispatch:v}),r)))return u=h.x-p[0]||0,d=h.y-p[1]||0,function t(i,a,l){var g,y=p;switch(i){case"start":c[o]=t,g=s++;break;case"end":delete c[o],--s;case"drag":p=st(l||a,n),g=s}v.call(i,e,new mt(i,{sourceEvent:a,subject:h,target:f,identifier:o,active:g,x:p[0]+u,y:p[1]+d,dx:p[0]-y[0],dy:p[1]-y[1],dispatch:v}),r)}}return f.filter=function(e){return arguments.length?(o="function"==typeof e?e:yt(!!e),f):o},f.container=function(e){return arguments.length?(i="function"==typeof e?e:yt(e),f):i},f.subject=function(e){return arguments.length?(a="function"==typeof e?e:yt(e),f):a},f.touchable=function(e){return arguments.length?(u="function"==typeof e?e:yt(!!e),f):u},f.on=function(){var e=l.on.apply(l,arguments);return e===l?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}().on("start",(function(e){var n=t(),r=n.domNode,o=n.nodeDragThreshold,i=n.transform,u=n.snapGrid,c=n.snapToGrid;0===o&&E(e);var l=ke(e.sourceEvent,{transform:i,snapGrid:u,snapToGrid:c});a=l,d=(null==r?void 0:r.getBoundingClientRect())||null,s=Ie(e.sourceEvent,d)})).on("drag",(function(e){var n,r,o=t(),i=o.autoPanOnNodeDrag,u=o.transform,h=o.snapGrid,v=o.snapToGrid,p=o.nodeDragThreshold,g=ke(e.sourceEvent,{transform:u,snapGrid:h,snapToGrid:v});if(!l&&i&&f&&(l=!0,_()),!f){var y=g.xSnapped-(null!==(n=a.x)&&void 0!==n?n:0),m=g.ySnapped-(null!==(r=a.y)&&void 0!==r?r:0);Math.sqrt(y*y+m*m)>p&&E(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&c&&f&&(s=Ie(e.sourceEvent,d),x(g,e.sourceEvent))})).on("end",(function(e){if(f&&(l=!1,f=!1,cancelAnimationFrame(u),c.size>0)){var n=t(),r=n.nodeLookup,o=n.updateNodePositions,a=n.onNodeDragStop,s=n.onSelectionDragStop;if(o(c,!1),i||a||!b&&s){var d=g(na({nodeId:b,dragItems:c,nodeLookup:r}),2),h=d[0],v=d[1];null==i||i(e.sourceEvent,c,h,v),null==a||a(e.sourceEvent,h,v),b||null==s||s(e.sourceEvent,v)}}})).filter((function(e){var n=e.target;return!e.button&&(!v||!ea(n,".".concat(v),m))&&(!y||ea(n,y,m))}));h.call(S)},destroy:function(){null==h||h.on(".drag",null)}}}var ra=function(e){return function(n){return n.selected&&(n.draggable||e&&void 0===n.draggable)}};function oa(e){var n,t=e.id,r=e.onClick,o=e.onMouseEnter,c=e.onMouseMove,s=e.onMouseLeave,f=e.onContextMenu,h=e.onDoubleClick,v=e.nodesDraggable,y=e.elementsSelectable,m=e.nodesConnectable,w=e.nodesFocusable,b=e.resizeObserver,x=e.noDragClassName,_=e.noPanClassName,S=e.disableKeyboardA11y,k=e.rfId,N=e.nodeTypes,C=e.nodeExtent,M=e.nodeOrigin,j=e.onError,I=G((function(e){var n=e.nodeLookup.get(t),r=e.parentLookup.has(t);return{node:n,internals:n.internals,isParent:r}}),De),P=I.node,A=I.internals,z=I.isParent,T=P.type||"default",B=(null==N?void 0:N[T])||Ki[T];void 0===B&&(null==j||j("003",Y.error003(T)),T="default",B=Ki.default);var D=!!(P.draggable||v&&void 0===P.draggable),L=!!(P.selectable||y&&void 0===P.selectable),V=!!(P.connectable||m&&void 0===P.connectable),R=!!(P.focusable||w&&void 0===P.focusable),H=$(),Z=function(e){var n,t,r,o,i,a;return void 0!==(null!==(r=null!==(t=null===(n=e.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:e.width)&&void 0!==r?r:e.initialWidth)&&void 0!==(null!==(a=null!==(i=null===(o=e.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:e.height)&&void 0!==a?a:e.initialHeight)}(P),X=function(e){var n=e.node,t=e.nodeType,r=e.hasDimensions,o=e.resizeObserver,i=$(),c=a(null),l=a(null),s=a(n.sourcePosition),d=a(n.targetPosition),f=a(t),h=r&&!!n.internals.handleBounds&&!n.hidden;return u((function(){!c.current||h&&l.current===c.current||(l.current&&(null==o||o.unobserve(l.current)),null==o||o.observe(c.current),l.current=c.current)}),[h]),u((function(){return function(){l.current&&(null==o||o.unobserve(l.current),l.current=null)}}),[]),u((function(){if(c.current){var e=f.current!==t,r=s.current!==n.sourcePosition,o=d.current!==n.targetPosition;(e||r||o)&&(f.current=t,s.current=n.sourcePosition,d.current=n.targetPosition,i.getState().updateNodeInternals(new Map([[n.id,{id:n.id,nodeElement:c.current,force:!0}]])))}}),[n.id,t,n.sourcePosition,n.targetPosition]),c}({node:P,nodeType:T,hasDimensions:Z,resizeObserver:b}),U=function(e){var n=e.nodeRef,t=e.disabled,r=void 0!==t&&t,o=e.noDragClassName,c=e.handleSelector,l=e.nodeId,s=e.isSelectable,d=$(),f=g(i(!1),2),h=f[0],v=f[1],p=a();return u((function(){p.current=ta({getStoreItems:function(){return d.getState()},onNodeMouseDown:function(e){Qi({id:e,store:d,nodeRef:n})},onDragStart:function(){v(!0)},onDragStop:function(){v(!1)}})}),[]),u((function(){var e,t;if(r)null===(e=p.current)||void 0===e||e.destroy();else if(n.current)return null===(t=p.current)||void 0===t||t.update({noDragClassName:o,handleSelector:c,domNode:n.current,isSelectable:s,nodeId:l}),function(){var e;null===(e=p.current)||void 0===e||e.destroy()}}),[o,c,r,s,n,l]),h}({nodeRef:X,disabled:P.hidden||!D,noDragClassName:x,handleSelector:P.dragHandle,nodeId:t,isSelectable:L}),W=function(){var e=$(),n=l((function(n){var t,r,o=e.getState(),i=o.nodeExtent,a=o.snapToGrid,u=o.snapGrid,c=o.nodesDraggable,l=o.onError,s=o.updateNodePositions,d=o.nodeLookup,f=o.nodeOrigin,h=new Map,v=ra(c),y=a?u[0]:5,m=a?u[1]:5,w=n.direction.x*y*n.factor,b=n.direction.y*m*n.factor;try{for(var x=p(d),_=x.next();!_.done;_=x.next()){var E=g(_.value,2)[1];if(v(E)){var S={x:E.internals.positionAbsolute.x+w,y:E.internals.positionAbsolute.y+b};a&&(S=ie(S,u));var k=ui({nodeId:E.id,nextPosition:S,nodeLookup:d,nodeExtent:i,nodeOrigin:f,onError:l}),N=k.position,C=k.positionAbsolute;E.position=N,E.internals.positionAbsolute=C,h.set(E.id,E)}}}catch(e){t={error:e}}finally{try{_&&!_.done&&(r=x.return)&&r.call(x)}finally{if(t)throw t.error}}s(h)}),[]);return n}();if(P.hidden)return null;var q=re(P),K=function(e){var n,t,r,o,i,a,u,c,l,s;return void 0===e.internals.handleBounds?{width:null!==(t=null!==(n=e.width)&&void 0!==n?n:e.initialWidth)&&void 0!==t?t:null===(r=e.style)||void 0===r?void 0:r.width,height:null!==(i=null!==(o=e.height)&&void 0!==o?o:e.initialHeight)&&void 0!==i?i:null===(a=e.style)||void 0===a?void 0:a.height}:{width:null!==(u=e.width)&&void 0!==u?u:null===(c=e.style)||void 0===c?void 0:c.width,height:null!==(l=e.height)&&void 0!==l?l:null===(s=e.style)||void 0===s?void 0:s.height}}(P),Q=C?te(A.positionAbsolute,C):A.positionAbsolute,J=we(d(d(d({},Q),q),{origin:P.origin||M})),ee=L||D||r||o||c||s,ne=o?function(e){return o(e,d({},A.userNode))}:void 0,oe=c?function(e){return c(e,d({},A.userNode))}:void 0,ae=s?function(e){return s(e,d({},A.userNode))}:void 0,ue=f?function(e){return f(e,d({},A.userNode))}:void 0,ce=h?function(e){return h(e,d({},A.userNode))}:void 0;return E.jsx("div",{className:O(["ink-flow__node","ink-flow__node-".concat(T),(n={},n[_]=D,n),P.className,{selected:P.selected,selectable:L,parent:z,draggable:D,dragging:U}]),ref:X,style:d(d({zIndex:A.z,transform:"translate(".concat(J.x,"px,").concat(J.y,"px)"),pointerEvents:ee?"all":"none",visibility:Z?"visible":"hidden"},P.style),K),"data-id":t,"data-testid":"rf__node-".concat(t),onMouseEnter:ne,onMouseMove:oe,onMouseLeave:ae,onContextMenu:ue,onClick:function(e){var n=H.getState(),o=n.selectNodesOnDrag,i=n.nodeDragThreshold;L&&(!o||!D||i>0)&&Qi({id:t,store:H,nodeRef:X}),r&&r(e,d({},A.userNode))},onDoubleClick:ce,onKeyDown:R?function(e){if(!Me(e.nativeEvent)&&!S)if(F.includes(e.key)&&L){var n="Escape"===e.key;Qi({id:t,store:H,unselect:n,nodeRef:X})}else D&&P.selected&&Object.prototype.hasOwnProperty.call(qi,e.key)&&(H.setState({ariaLiveMessage:"Moved selected node ".concat(e.key.replace("Arrow","").toLowerCase(),". New position, x: ").concat(~~Q.x,", y: ").concat(~~Q.y)}),W({direction:qi[e.key],factor:e.shiftKey?4:1}))}:void 0,tabIndex:R?0:void 0,role:R?"button":void 0,"aria-describedby":S?void 0:"".concat(ji,"-").concat(k),"aria-label":P.ariaLabel,children:E.jsx(Mi,{value:t,children:E.jsx(B,d({id:t,data:P.data,type:T,positionAbsoluteX:Q.x,positionAbsoluteY:Q.y,selected:P.selected,isConnectable:V,sourcePosition:P.sourcePosition,targetPosition:P.targetPosition,dragging:U,dragHandle:P.dragHandle,zIndex:A.z},q))})})}var ia=function(e){return{nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError}};function aa(e){var n,t=G(ia,De),r=t.nodesDraggable,o=t.nodesConnectable,a=t.nodesFocusable,c=t.elementsSelectable,s=t.onError,d=G(l(Ci(n=!1),[n]),De),f=function(){var e=G(Ni),n=g(i((function(){return"undefined"==typeof ResizeObserver?null:new ResizeObserver((function(n){var t=new Map;n.forEach((function(e){var n=e.target.getAttribute("data-id");t.set(n,{id:n,nodeElement:e.target})})),e(t)}))})),1),t=n[0];return u((function(){return function(){null==t||t.disconnect()}}),[t]),t}();return E.jsx("div",{className:"ink-flow__nodes",style:Xe,children:d.map((function(n){return E.jsx(oa,{id:n,nodeTypes:e.nodeTypes,nodeOrigin:e.nodeOrigin,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:f,nodesDraggable:r,nodesConnectable:o,nodesFocusable:a,elementsSelectable:c,onError:s},n)}))})}aa.displayName="NodeRenderer";var ua,ca=c(aa),la=((ua={})[Ze.Arrow]=function(e){var n=e.color,t=void 0===n?"none":n,r=e.strokeWidth,o=void 0===r?1:r;return E.jsx("polyline",{style:{stroke:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"})},ua[Ze.ArrowClosed]=function(e){var n=e.color,t=void 0===n?"none":n,r=e.strokeWidth,o=void 0===r?1:r;return E.jsx("polyline",{style:{stroke:t,fill:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},ua);function sa(e,n){if(!e)return"";if("string"==typeof e)return e;var t=n?"".concat(n,"__"):"";return"".concat(t).concat(Object.keys(e).sort().map((function(n){return"".concat(n,"=").concat(e[n])})).join("&"))}var da=function(e){var n=e.id,t=e.type,o=e.color,i=e.width,a=void 0===i?12.5:i,u=e.height,c=void 0===u?12.5:u,l=e.markerUnits,s=void 0===l?"strokeWidth":l,d=e.strokeWidth,f=e.orient,h=void 0===f?"auto-start-reverse":f,v=function(e){var n=$(),t=r((function(){var t,r;return Object.prototype.hasOwnProperty.call(la,e)?la[e]:(null===(r=(t=n.getState()).onError)||void 0===r||r.call(t,"009",Y.error009(e)),null)}),[e]);return t}(t);return v?E.jsx("marker",{className:"ink-flow__arrowhead",id:n,markerWidth:"".concat(a),markerHeight:"".concat(c),viewBox:"-10 -10 20 20",markerUnits:s,orient:h,refX:"0",refY:"0",children:E.jsx(v,{color:o,strokeWidth:d})}):null},fa=function(e){var n=e.defaultColor,t=e.rfId,o=G((function(e){return e.edges})),i=G((function(e){return e.defaultEdgeOptions})),a=r((function(){var e=function(e,n){var t=n.id,r=n.defaultColor,o=n.defaultMarkerStart,i=n.defaultMarkerEnd,a=new Set;return e.reduce((function(e,n){return[n.markerStart||o,n.markerEnd||i].forEach((function(n){if(n&&"object"==typeof n){var o=sa(n,t);a.has(o)||(e.push(d({id:o,color:n.color||r},n)),a.add(o))}})),e}),[]).sort((function(e,n){return e.id.localeCompare(n.id)}))}(o,{id:t,defaultColor:n,defaultMarkerStart:null==i?void 0:i.markerStart,defaultMarkerEnd:null==i?void 0:i.markerEnd});return e}),[o,i,t,n]);return a.length?E.jsx("svg",{className:"ink-flow__marker",children:E.jsx("defs",{children:a.map((function(e){return E.jsx(da,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id)}))})}):null};fa.displayName="MarkerDefinitions";var ha=c(fa);function va(e){var n=e.x,t=e.y,r=e.label,o=e.labelStyle,a=void 0===o?{}:o,u=e.labelShowBg,c=void 0===u||u,s=e.labelBgStyle,h=void 0===s?{}:s,v=e.labelBgPadding,p=void 0===v?[2,4]:v,y=e.labelBgBorderRadius,m=void 0===y?2:y,w=e.children,b=e.className,x=f(e,["x","y","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","children","className"]),_=g(i({x:1,y:0,width:0,height:0}),2),S=_[0],k=_[1],N=O(["ink-flow__edge-textwrapper",b]),C=l((function(e){if(null!==e){var n=e.getBBox();k({x:n.x,y:n.y,width:n.width,height:n.height})}}),[]);return void 0!==r&&r?E.jsxs("g",d({transform:"translate(".concat(n-S.width/2," ").concat(t-S.height/2,")"),className:N,visibility:S.width?"visible":"hidden"},x,{children:[c&&E.jsx("rect",{width:S.width+2*p[0],x:-p[0],y:-p[1],height:S.height+2*p[1],className:"ink-flow__edge-textbg",style:h,rx:m,ry:m}),E.jsx("text",{className:"ink-flow__edge-text",y:S.height/2,dy:"0.3em",ref:C,style:a,children:r}),w]})):null}va.displayName="EdgeText";var pa=c(va);function ga(e){var n=e.id,t=e.path,r=e.labelX,o=e.labelY,i=e.label,a=e.labelStyle,u=e.labelShowBg,c=e.labelBgStyle,l=e.labelBgPadding,s=e.labelBgBorderRadius,d=e.style,f=e.markerEnd,h=e.markerStart,v=e.className,p=e.interactionWidth,g=void 0===p?20:p;return E.jsxs(E.Fragment,{children:[E.jsx("path",{id:n,style:d,d:t,fill:"none",className:O(["ink-flow__edge-path",v]),markerEnd:f,markerStart:h}),g&&E.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:g,className:"ink-flow__edge-interaction"}),i&&oe(r)&&oe(o)?E.jsx(pa,{x:r,y:o,label:i,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:l,labelBgBorderRadius:s}):null]})}function ya(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2;return n===Ye.Left||n===Ye.Right?[.5*(t+o),r]:[t,.5*(r+i)]}function ma(e){return c((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY,u=n.sourcePosition,c=void 0===u?Ye.Bottom:u,l=n.targetPosition,s=void 0===l?Ye.Top:l,d=n.label,f=n.labelStyle,h=n.labelShowBg,v=n.labelBgStyle,p=n.labelBgPadding,y=n.labelBgBorderRadius,m=n.style,w=n.markerEnd,b=n.markerStart,x=n.interactionWidth,_=g(function(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?Ye.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?Ye.Top:u,l=g(ya({pos:o,x1:n,y1:t,x2:i,y2:a}),2),s=l[0],d=l[1],f=g(ya({pos:c,x1:i,y1:a,x2:n,y2:t}),2),h=f[0],v=f[1],p=g(Pi({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:s,sourceControlY:d,targetControlX:h,targetControlY:v}),4),y=p[0],m=p[1],w=p[2],b=p[3];return["M".concat(n,",").concat(t," C").concat(s,",").concat(d," ").concat(h,",").concat(v," ").concat(i,",").concat(a),y,m,w,b]}({sourceX:r,sourceY:o,sourcePosition:c,targetX:i,targetY:a,targetPosition:s}),3),S=_[0],k=_[1],N=_[2],C=e.isInternal?void 0:t;return E.jsx(ga,{id:C,path:S,labelX:k,labelY:N,label:d,labelStyle:f,labelShowBg:h,labelBgStyle:v,labelBgPadding:p,labelBgBorderRadius:y,style:m,markerEnd:w,markerStart:b,interactionWidth:x})}))}var wa=ma({isInternal:!1}),ba=ma({isInternal:!0});function xa(e){return c((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY,u=n.label,c=n.labelStyle,l=n.labelShowBg,s=n.labelBgStyle,d=n.labelBgPadding,f=n.labelBgBorderRadius,h=n.style,v=n.sourcePosition,p=void 0===v?Ye.Bottom:v,y=n.targetPosition,m=void 0===y?Ye.Top:y,w=n.markerEnd,b=n.markerStart,x=n.pathOptions,_=n.interactionWidth,S=g(Hi({sourceX:r,sourceY:o,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:null==x?void 0:x.borderRadius,offset:null==x?void 0:x.offset}),3),k=S[0],N=S[1],C=S[2],O=e.isInternal?void 0:t;return E.jsx(ga,{id:O,path:k,labelX:N,labelY:C,label:u,labelStyle:c,labelShowBg:l,labelBgStyle:s,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:w,markerStart:b,interactionWidth:_})}))}wa.displayName="SimpleBezierEdge",ba.displayName="SimpleBezierEdgeInternal";var _a=xa({isInternal:!1}),Ea=xa({isInternal:!0});function Sa(e){return c((function(n){var t,o=n.id,i=f(n,["id"]),a=e.isInternal?void 0:o;return E.jsx(_a,d({},i,{id:a,pathOptions:r((function(){var e;return{borderRadius:0,offset:null===(e=i.pathOptions)||void 0===e?void 0:e.offset}}),[null===(t=i.pathOptions)||void 0===t?void 0:t.offset])}))}))}_a.displayName="SmoothStepEdge",Ea.displayName="SmoothStepEdgeInternal";var ka=Sa({isInternal:!1}),Na=Sa({isInternal:!0});function Ca(e){return c((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY,u=n.label,c=n.labelStyle,l=n.labelShowBg,s=n.labelBgStyle,d=n.labelBgPadding,f=n.labelBgBorderRadius,h=n.style,v=n.markerEnd,p=n.markerStart,y=n.interactionWidth,m=g(function(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=g(Ti({sourceX:n,sourceY:t,targetX:r,targetY:o}),4),a=i[0],u=i[1],c=i[2],l=i[3];return["M ".concat(n,",").concat(t,"L ").concat(r,",").concat(o),a,u,c,l]}({sourceX:r,sourceY:o,targetX:i,targetY:a}),3),w=m[0],b=m[1],x=m[2],_=e.isInternal?void 0:t;return E.jsx(ga,{id:_,path:w,labelX:b,labelY:x,label:u,labelStyle:c,labelShowBg:l,labelBgStyle:s,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:v,markerStart:p,interactionWidth:y})}))}ka.displayName="StepEdge",Na.displayName="StepEdgeInternal";var Oa=Ca({isInternal:!1}),Ma=Ca({isInternal:!0});function ja(e){return c((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY,u=n.sourcePosition,c=void 0===u?Ye.Bottom:u,l=n.targetPosition,s=void 0===l?Ye.Top:l,d=n.label,f=n.labelStyle,h=n.labelShowBg,v=n.labelBgStyle,p=n.labelBgPadding,y=n.labelBgBorderRadius,m=n.style,w=n.markerEnd,b=n.markerStart,x=n.pathOptions,_=n.interactionWidth,S=g(function(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?Ye.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?Ye.Top:u,l=e.curvature,s=void 0===l?.25:l,d=g(zi({pos:o,x1:n,y1:t,x2:i,y2:a,c:s}),2),f=d[0],h=d[1],v=g(zi({pos:c,x1:i,y1:a,x2:n,y2:t,c:s}),2),p=v[0],y=v[1],m=g(Pi({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:f,sourceControlY:h,targetControlX:p,targetControlY:y}),4),w=m[0],b=m[1],x=m[2],_=m[3];return["M".concat(n,",").concat(t," C").concat(f,",").concat(h," ").concat(p,",").concat(y," ").concat(i,",").concat(a),w,b,x,_]}({sourceX:r,sourceY:o,sourcePosition:c,targetX:i,targetY:a,targetPosition:s,curvature:null==x?void 0:x.curvature}),3),k=S[0],N=S[1],C=S[2],O=e.isInternal?void 0:t;return E.jsx(ga,{id:O,path:k,labelX:N,labelY:C,label:d,labelStyle:f,labelShowBg:h,labelBgStyle:v,labelBgPadding:p,labelBgBorderRadius:y,style:m,markerEnd:w,markerStart:b,interactionWidth:_})}))}Oa.displayName="StraightEdge",Ma.displayName="StraightEdgeInternal";var Ia=ja({isInternal:!1}),Pa=ja({isInternal:!0});Ia.displayName="BezierEdge",Pa.displayName="BezierEdgeInternal";var Aa={default:Pa,straight:Ma,step:Na,smoothstep:Ea,simplebezier:ba},za={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Ta=function(e,n,t){return t===Ye.Left?e-n:t===Ye.Right?e+n:e},Ba=function(e,n,t){return t===Ye.Top?e-n:t===Ye.Bottom?e+n:e},Da="ink-flow__edgeupdater";function La(e){var n=e.position,t=e.centerX,r=e.centerY,o=e.radius,i=void 0===o?10:o,a=e.onMouseDown,u=e.onMouseEnter,c=e.onMouseOut,l=e.type;return E.jsx("circle",{onMouseDown:a,onMouseEnter:u,onMouseOut:c,className:O([Da,"".concat(Da,"-").concat(l)]),cx:Ta(t,i,n),cy:Ba(r,i,n),r:i,stroke:"transparent",fill:"transparent"})}function Va(e){var n=e.isUpdatable,t=e.edgeUpdaterRadius,r=e.edge,o=e.targetHandleId,i=e.sourceHandleId,a=e.sourceX,u=e.sourceY,c=e.targetX,l=e.targetY,s=e.sourcePosition,d=e.targetPosition,f=e.onEdgeUpdate,h=e.onEdgeUpdateStart,v=e.onEdgeUpdateEnd,p=e.setUpdating,g=e.setUpdateHover,y=$(),m=function(e,n){if(0===e.button){var t=y.getState(),a=t.autoPanOnConnect,u=t.domNode,c=t.isValidConnection,l=t.connectionMode,s=t.connectionRadius,d=t.lib,g=t.onConnectStart,m=t.onConnectEnd,w=t.cancelConnection,b=t.nodeLookup,x=t.rfId,_=t.panBy,E=t.updateConnection,S=n?r.target:r.source,k=(n?o:i)||null,N=n?"target":"source",C=n;p(!0),null==h||h(e,r,N);Gi.onPointerDown(e.nativeEvent,{autoPanOnConnect:a,connectionMode:l,connectionRadius:s,domNode:u,handleId:k,nodeId:S,nodeLookup:b,isTarget:C,edgeUpdaterType:N,lib:d,flowId:x,cancelConnection:w,panBy:_,isValidConnection:c,onConnect:function(e){return null==f?void 0:f(r,e)},onConnectStart:g,onConnectEnd:m,onEdgeUpdateEnd:function(e){p(!1),null==v||v(e,r,N)},updateConnection:E,getTransform:function(){return y.getState().transform},getConnectionStartHandle:function(){return y.getState().connectionStartHandle}})}},w=function(){return g(!0)},b=function(){return g(!1)};return E.jsxs(E.Fragment,{children:[("source"===n||!0===n)&&E.jsx(La,{position:s,centerX:a,centerY:u,radius:t,onMouseDown:function(e){return m(e,!0)},onMouseEnter:w,onMouseOut:b,type:"source"}),("target"===n||!0===n)&&E.jsx(La,{position:d,centerX:c,centerY:l,radius:t,onMouseDown:function(e){return m(e,!1)},onMouseEnter:w,onMouseOut:b,type:"target"})]})}function Ra(e){var n;return e&&!(!e.internals.handleBounds&&!(null===(n=e.handles)||void 0===n?void 0:n.length))&&!!(e.measured.width||e.width||e.initialWidth)}function Ha(e){var n,t,r,o;if(!e)return null;var i=[],a=[];try{for(var u=p(e),c=u.next();!c.done;c=u.next()){var l=c.value;l.width=null!==(r=l.width)&&void 0!==r?r:1,l.height=null!==(o=l.height)&&void 0!==o?o:1,"source"===l.type?i.push(l):"target"===l.type&&a.push(l)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(t=u.return)&&t.call(u)}finally{if(n)throw n.error}}return{source:i,target:a}}function Za(e,n,t){var r,o;void 0===t&&(t=null);var i=(null!==(r=null==t?void 0:t.x)&&void 0!==r?r:0)+n.internals.positionAbsolute.x,a=(null!==(o=null==t?void 0:t.y)&&void 0!==o?o:0)+n.internals.positionAbsolute.y,u=null!=t?t:re(n),c=u.width,l=u.height;switch(e){case Ye.Top:return[i+c/2,a];case Ye.Right:return[i+c,a+l/2];case Ye.Bottom:return[i+c/2,a+l];case Ye.Left:return[i,a+l/2]}}function Ya(e,n){return e&&(n?e.find((function(e){return e.id===n})):e[0])||null}function Xa(e){var n=e.id,t=e.edgesFocusable,o=e.edgesUpdatable,u=e.elementsSelectable,c=e.onClick,s=e.onDoubleClick,f=e.onContextMenu,h=e.onMouseEnter,v=e.onMouseMove,p=e.onMouseLeave,y=e.edgeUpdaterRadius,m=e.onEdgeUpdate,w=e.onEdgeUpdateStart,b=e.onEdgeUpdateEnd,x=e.rfId,_=e.edgeTypes,S=e.noPanClassName,k=e.onError,N=e.disableKeyboardA11y,C=G((function(e){return e.edgeLookup.get(n)})),M=G((function(e){return e.defaultEdgeOptions})),j=(C=M?d(d({},M),C):C).type||"default",I=(null==_?void 0:_[j])||Aa[j];void 0===I&&(null==k||k("011",Y.error011(j)),j="default",I=Aa.default);var P=!!(C.focusable||t&&void 0===C.focusable),A=void 0!==m&&(C.updatable||o&&void 0===C.updatable),z=!!(C.selectable||u&&void 0===C.selectable),T=a(null),B=g(i(!1),2),D=B[0],L=B[1],V=g(i(!1),2),R=V[0],H=V[1],Z=$(),X=G(l((function(e){var t=e.nodeLookup.get(C.source),r=e.nodeLookup.get(C.target);if(!t||!r)return d({zIndex:C.zIndex},za);var o=function(e){var n,t,r,o,i,a=e.sourceNode,u=e.targetNode;if(!Ra(a)||!Ra(u))return null;var c=a.internals.handleBounds||Ha(a.handles),l=u.internals.handleBounds||Ha(u.handles),s=Ya(null!==(n=null==c?void 0:c.source)&&void 0!==n?n:[],e.sourceHandle),d=Ya(e.connectionMode===Le.Strict?null!==(t=null==l?void 0:l.target)&&void 0!==t?t:[]:(null!==(r=null==l?void 0:l.target)&&void 0!==r?r:[]).concat(null!==(o=null==l?void 0:l.source)&&void 0!==o?o:[]),e.targetHandle),f=(null==s?void 0:s.position)||Ye.Bottom,h=(null==d?void 0:d.position)||Ye.Top;if(!s||!d)return null===(i=e.onError)||void 0===i||i.call(e,"008",Y.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;var v=g(Za(f,a,s),2),p=v[0],y=v[1],m=g(Za(h,u,d),2);return{sourceX:p,sourceY:y,targetX:m[0],targetY:m[1],sourcePosition:f,targetPosition:h}}({id:n,sourceNode:t,targetNode:r,sourceHandle:C.sourceHandle||null,targetHandle:C.targetHandle||null,connectionMode:e.connectionMode,onError:k}),i=function(e){var n=e.sourceNode,t=e.targetNode,r=e.selected,o=void 0!==r&&r,i=e.zIndex,a=void 0===i?0:i,u=e.elevateOnSelect;if(void 0===u||!u)return a;var c=o||t.selected||n.selected,l=Math.max(n.internals.z||0,t.internals.z||0,1e3);return a+(c?l:0)}({selected:C.selected,zIndex:C.zIndex,sourceNode:t,targetNode:r,elevateOnSelect:e.elevateEdgesOnSelect});return d({zIndex:i},o||za)}),[C.source,C.target,C.sourceHandle,C.targetHandle,C.selected,C.zIndex]),De),U=X.zIndex,W=X.sourceX,q=X.sourceY,K=X.targetX,Q=X.targetY,J=X.sourcePosition,ee=X.targetPosition,ne=r((function(){return C.markerStart?"url('#".concat(sa(C.markerStart,x),"')"):void 0}),[C.markerStart,x]),te=r((function(){return C.markerEnd?"url('#".concat(sa(C.markerEnd,x),"')"):void 0}),[C.markerEnd,x]);if(C.hidden||null===W||null===q||null===K||null===Q)return null;var re=s?function(e){s(e,d({},C))}:void 0,oe=f?function(e){f(e,d({},C))}:void 0,ie=h?function(e){h(e,d({},C))}:void 0,ae=v?function(e){v(e,d({},C))}:void 0,ue=p?function(e){p(e,d({},C))}:void 0;return E.jsx("svg",{style:{zIndex:U},children:E.jsxs("g",{className:O(["ink-flow__edge","ink-flow__edge-".concat(j),C.className,S,{selected:C.selected,animated:C.animated,inactive:!z&&!c,updating:D,selectable:z}]),onClick:function(e){var t,r=Z.getState(),o=r.addSelectedEdges,i=r.unselectNodesAndEdges,a=r.multiSelectionActive;z&&(Z.setState({nodesSelectionActive:!1}),C.selected&&a?(i({nodes:[],edges:[C]}),null===(t=T.current)||void 0===t||t.blur()):o([n])),c&&c(e,C)},onDoubleClick:re,onContextMenu:oe,onMouseEnter:ie,onMouseMove:ae,onMouseLeave:ue,onKeyDown:P?function(e){var t;if(!N&&F.includes(e.key)&&z){var r=Z.getState(),o=r.unselectNodesAndEdges,i=r.addSelectedEdges;"Escape"===e.key?(null===(t=T.current)||void 0===t||t.blur(),o({edges:[C]})):i([n])}}:void 0,tabIndex:P?0:void 0,role:P?"button":"img","data-id":n,"data-testid":"rf__edge-".concat(n),"aria-label":null===C.ariaLabel?void 0:C.ariaLabel||"Edge from ".concat(C.source," to ").concat(C.target),"aria-describedby":P?"".concat(Ii,"-").concat(x):void 0,ref:T,children:[!R&&E.jsx(I,{id:n,source:C.source,target:C.target,type:C.type,selected:C.selected,animated:C.animated,label:C.label,labelStyle:C.labelStyle,labelShowBg:C.labelShowBg,labelBgStyle:C.labelBgStyle,labelBgPadding:C.labelBgPadding,labelBgBorderRadius:C.labelBgBorderRadius,sourceX:W,sourceY:q,targetX:K,targetY:Q,sourcePosition:J,targetPosition:ee,data:C.data,style:C.style,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle,markerStart:ne,markerEnd:te,pathOptions:"pathOptions"in C?C.pathOptions:void 0,interactionWidth:C.interactionWidth}),A&&E.jsx(Va,{edge:C,isUpdatable:A,edgeUpdaterRadius:y,onEdgeUpdate:m,onEdgeUpdateStart:w,onEdgeUpdateEnd:b,sourceX:W,sourceY:q,targetX:K,targetY:Q,sourcePosition:J,targetPosition:ee,setUpdateHover:L,setUpdating:H,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle})]})})}var Fa=function(e){return{width:e.width,height:e.height,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError}};function Ua(e){var n=e.rfId,t=e.noPanClassName,r=e.onEdgeUpdate,o=G(Fa,De),i=o.edgesFocusable,a=o.edgesUpdatable,u=o.elementsSelectable,c=o.onError,s=function(e){var n=G(l((function(e){return e.edges.map((function(e){return e.id}))}),[e]),De);return n}(!1);return E.jsxs("div",{className:"ink-flow__edges",children:[E.jsx(ha,{defaultColor:"",rfId:n}),s.map((function(e){return E.jsx(Xa,{id:e,edgesFocusable:i,edgesUpdatable:a,elementsSelectable:u,noPanClassName:t,onEdgeUpdate:r,rfId:n,onError:c},e)}))]})}Ua.displayName="EdgeRenderer";var Ga=c(Ua),$a=function(e){return"translate(".concat(e.transform[0],"px,").concat(e.transform[1],"px) scale(").concat(e.transform[2],")")};function Wa(e){var n=e.children,t=G($a);return E.jsx("div",{className:"ink-flow__viewport xyflow__viewport ink-flow__container",style:{transform:t},children:n})}function qa(e){var n=e.rfId,t=e.minZoom,r=e.maxZoom,o=e.noPanClassName,i=e.noDragClassName,a=e.nodeOrigin,u=e.viewport,c=e.disableKeyboardA11y,l=e.translateExtent,s=e.defaultViewport,d=e.nodeTypes,f=e.elementsSelectable,h=e.onPaneClick,v=e.onPaneContextMenu;return E.jsx(gi,{minZoom:t,maxZoom:r,noPanClassName:o,noDragClassName:i,isControlledViewport:!!u,disableKeyboardA11y:c,translateExtent:l,defaultViewport:s,elementsSelectable:f,onPaneClick:h,onPaneContextMenu:v,children:E.jsxs(Wa,{children:[E.jsx(Ga,{rfId:n,noPanClassName:o}),E.jsx("div",{className:"ink-flow__edgelabel-renderer"}),E.jsx(ca,{rfId:n,nodeTypes:d,nodeOrigin:a,noDragClassName:i,noPanClassName:o,disableKeyboardA11y:!1}),E.jsx("div",{className:"ink-flow__viewport-portal"})]})})}qa.displayName="GraphView";var Ka=c(qa),Qa=function(e){var n,t,r=void 0===e?{}:e,o=r.nodes,i=r.edges,a=r.defaultNodes,u=r.defaultEdges;r.width,r.height,r.fitView;var c=new Map,l=new Map,s=new Map,d=new Map,f=null!==(n=null!=u?u:i)&&void 0!==n?n:[],h=null!==(t=null!=a?a:o)&&void 0!==t?t:[];Q(s,d,f),J(h,c,l,{nodeOrigin:[0,0],elevateNodesOnSelect:!1});return{rfId:"1",width:0,height:0,transform:[0,0,1],nodes:h,nodeLookup:c,parentLookup:l,edges:f,edgeLookup:d,connectionLookup:s,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==a,hasDefaultEdges:void 0!==u,panZoom:null,minZoom:.5,maxZoom:2,translateExtent:X,nodeExtent:X,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Le.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,fitViewOnInit:!1,fitViewDone:!1,fitViewOnInitOptions:void 0,selectNodesOnDrag:!0,multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:void 0,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1}},Ja=function(e){var n,t,r=e.nodes,o=e.edges,i=e.defaultNodes,a=e.defaultEdges,u=e.width,c=e.height,l=e.fitView;return n=function(e,n){return d(d({},Qa({nodes:r,edges:o,width:u,height:c,fitView:l,defaultNodes:i,defaultEdges:a})),{setNodes:function(t){var r=n();J(t,r.nodeLookup,r.parentLookup,{nodeOrigin:r.nodeOrigin,elevateNodesOnSelect:r.elevateNodesOnSelect,checkEquality:!0}),e({nodes:t})},setEdges:function(t){var r=n();Q(r.connectionLookup,r.edgeLookup,t),e({edges:t})},setDefaultNodesAndEdges:function(t,r){t&&((0,n().setNodes)(t),e({hasDefaultNodes:!0})),r&&((0,n().setEdges)(r),e({hasDefaultEdges:!0}))},updateNodeInternals:function(t){var r=n(),o=r.triggerNodeChanges,i=r.fitView,a=r.nodeLookup,u=r.parentLookup,c=r.fitViewOnInit,l=r.fitViewDone,s=r.fitViewOnInitOptions,f=r.domNode,h=r.nodeOrigin,v=r.debug,p=function(e,n,t,r,o){var i=null==r?void 0:r.querySelector(".xyflow__viewport"),a=!1;if(!i)return{changes:[],updatedInternals:a};var u=[],c=window.getComputedStyle(i),l=new window.DOMMatrixReadOnly(c.transform).m22,s=[];if(e.forEach((function(e){var t=n.get(e.id);if(null==t?void 0:t.hidden)n.set(t.id,d(d({},t),{internals:d(d({},t.internals),{handleBounds:void 0})})),a=!0;else if(t){var r=Ne(e.nodeElement),i=t.measured.width!==r.width||t.measured.height!==r.height;if(r.width&&r.height&&(i||!t.internals.handleBounds||e.force)){var c=d(d({},t),{measured:r,internals:d(d({},t.internals),{handleBounds:{source:Pe(".source",e.nodeElement,l,t.origin||o),target:Pe(".target",e.nodeElement,l,t.origin||o)}})});n.set(t.id,c),a=!0,i&&(u.push({id:c.id,type:"dimensions",dimensions:r}),c.expandParent&&c.parentId&&s.push({id:c.id,parentId:c.parentId,rect:ue(c,c.origin||o)}))}}})),s.length>0){var f=ee(s,n,t,o);u.push.apply(u,y([],g(f),!1))}return{changes:u,updatedInternals:a}}(t,a,u,f,h),m=p.changes;if(p.updatedInternals){W(a,{nodeOrigin:h});var w=l;!l&&c&&(w=i(d(d({},s),{nodes:null==s?void 0:s.nodes}))),e({fitViewDone:w}),(null==m?void 0:m.length)>0&&(v&&console.log("Ink Flow: trigger node changes",m),null==o||o(m))}},updateNodePositions:function(e,t){var r,o;void 0===t&&(t=!1);var i=[],a=[];try{for(var u=p(e),c=u.next();!c.done;c=u.next()){var l=g(c.value,2),s=l[0],f=l[1],h={id:s,type:"position",position:f.position,dragging:t};(null==f?void 0:f.expandParent)&&(null==f?void 0:f.parentId)&&h.position&&(i.push({id:s,parentId:f.parentId,rect:d(d({},f.internals.positionAbsolute),{width:f.measured.width,height:f.measured.height})}),h.position.x=Math.max(0,h.position.x),h.position.y=Math.max(0,h.position.y)),a.push(h)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}if(i.length>0){var v=n(),m=ee(i,v.nodeLookup,v.parentLookup);a.push.apply(a,y([],g(m),!1))}n().triggerNodeChanges(a)},triggerNodeChanges:function(e){var t=n(),r=t.onNodesChange,o=t.setNodes,i=t.nodes,a=t.hasDefaultNodes,u=t.debug;(null==e?void 0:e.length)&&(a&&o(Ko(e,i)),u&&console.log("Ink Flow: trigger node changes",e),null==r||r(e))},triggerEdgeChanges:function(e){var t=n(),r=t.onEdgesChange,o=t.setEdges,i=t.edges,a=t.hasDefaultEdges,u=t.debug;(null==e?void 0:e.length)&&(a&&o(qo(e,i)),u&&console.log("Ink Flow: trigger edge changes",e),null==r||r(e))},addSelectedNodes:function(e){var t=n(),r=t.multiSelectionActive,o=t.edgeLookup,i=t.nodeLookup,a=t.triggerNodeChanges,u=t.triggerEdgeChanges;r?a(e.map((function(e){return Qo(e,!0)}))):(a(Jo(i,new Set(y([],g(e),!1)),!0)),u(Jo(o)))},addSelectedEdges:function(e){var t=n(),r=t.multiSelectionActive,o=t.edgeLookup,i=t.nodeLookup,a=t.triggerNodeChanges,u=t.triggerEdgeChanges;r?u(e.map((function(e){return Qo(e,!0)}))):(u(Jo(o,new Set(y([],g(e),!1)))),a(Jo(i,new Set,!0)))},unselectNodesAndEdges:function(e){var t=void 0===e?{}:e,r=t.nodes,o=t.edges,i=n(),a=i.edges,u=i.nodes,c=i.triggerNodeChanges,l=i.triggerEdgeChanges,s=o||a,d=(r||u).map((function(e){return e.selected=!1,Qo(e.id,!1)})),f=s.map((function(e){return Qo(e.id,!1)}));c(d),l(f)},setMinZoom:function(t){var r=n(),o=r.panZoom,i=r.maxZoom;null==o||o.setScaleExtent([t,i]),e({minZoom:t})},setMaxZoom:function(t){var r=n(),o=r.panZoom,i=r.minZoom;null==o||o.setScaleExtent([i,t]),e({maxZoom:t})},setTranslateExtent:function(t){var r;null===(r=n().panZoom)||void 0===r||r.setTranslateExtent(t),e({translateExtent:t})},resetSelectedElements:function(){var e=n(),t=e.edges,r=e.nodes,o=e.triggerNodeChanges,i=e.triggerEdgeChanges,a=r.reduce((function(e,n){return n.selected?y(y([],g(e),!1),[Qo(n.id,!1)],!1):e}),[]),u=t.reduce((function(e,n){return n.selected?y(y([],g(e),!1),[Qo(n.id,!1)],!1):e}),[]);o(a),i(u)},setNodeExtent:function(t){var r,o,i=n().nodeLookup;try{for(var a=p(i),u=a.next();!u.done;u=a.next()){var c=g(u.value,2)[1],l=te(c.position,t);i.set(c.id,d(d({},c),{internals:d(d({},c.internals),{positionAbsolute:l})}))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}e({nodeExtent:t})},panBy:function(e){var t=n(),r=t.transform,o=t.width,i=t.height;return function(e){var n=e.delta,t=e.panZoom,r=e.transform,o=e.translateExtent,i=e.width,a=e.height;if(!t||!n.x&&!n.y)return!1;var u=t.setViewportConstrained({x:r[0]+n.x,y:r[1]+n.y,zoom:r[2]},[[0,0],[i,a]],o);return!!u&&(u.x!==r[0]||u.y!==r[1]||u.k!==r[2])}({delta:e,panZoom:t.panZoom,transform:r,translateExtent:t.translateExtent,width:o,height:i})},fitView:function(e){var t=n(),r=t.panZoom,o=t.width,i=t.height,a=t.minZoom,u=t.maxZoom,c=t.nodeOrigin,l=t.nodeLookup;return!!r&&ai({nodeLookup:l,width:o,height:i,panZoom:r,minZoom:a,maxZoom:u,nodeOrigin:c},e)},cancelConnection:function(){return e({connectionStatus:null,connectionStartHandle:null,connectionEndHandle:null})},updateConnection:function(t){var r,o=n().connectionPosition,i=d(d({},t),{connectionPosition:null!==(r=t.connectionPosition)&&void 0!==r?r:o});e(i)},reset:function(){return e(d({},Qa()))}})},t=Object.is,n?R(n,t):R};function eu(e){var n=e.initialNodes,t=e.initialEdges,r=e.defaultNodes,o=e.defaultEdges,a=e.initialWidth,u=e.initialHeight,c=e.fitView,l=e.children,s=g(i((function(){return Ja({nodes:n,edges:t,defaultNodes:r,defaultEdges:o,width:a,height:u,fitView:c})})),1)[0];return E.jsx(Z,{value:s,children:E.jsx(_i,{children:l})})}function nu(e){var n=e.children,r=e.nodes,o=e.edges,i=e.defaultNodes,a=e.defaultEdges,u=e.width,c=e.height,l=e.fitView;return t(H)?E.jsx(E.Fragment,{children:n}):E.jsx(eu,{initialNodes:r,initialEdges:o,defaultNodes:i,defaultEdges:a,initialWidth:u,initialHeight:c,fitView:l,children:n})}var tu={x:0,y:0,zoom:1},ru=y(y([],g(["nodes","edges","defaultNodes","defaultEdges","nodesDraggable","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","translateExtent","defaultEdgeOptions","fitView","fitViewOptions"]),!1),["rfId"],!1),ou=function(e){return{setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}},iu={translateExtent:X,nodeOrigin:[0,0],minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function au(e){var n=G(ou,De),t=n.setNodes,r=n.setEdges,o=n.setMinZoom,i=n.setMaxZoom,c=n.setTranslateExtent,l=n.setNodeExtent,s=n.reset,d=n.setDefaultNodesAndEdges,f=$();u((function(){return d(e.defaultNodes,e.defaultEdges),function(){h.current=iu,s()}}),[]);var h=a(iu);return u((function(){var n,a,u;try{for(var s=p(ru),d=s.next();!d.done;d=s.next()){var v=d.value,g=e[v];g!==h.current[v]&&(void 0!==e[v]&&("nodes"===v?t(g):"edges"===v?r(g):"minZoom"===v?o(g):"maxZoom"===v?i(g):"translateExtent"===v?c(g):"nodeExtent"===v?l(g):"fitView"===v?f.setState({fitViewOnInit:g}):"fitViewOptions"===v?f.setState({fitViewOnInitOptions:g}):f.setState(((u={})[v]=g,u))))}}catch(e){n={error:e}}finally{try{d&&!d.done&&(a=s.return)&&a.call(s)}finally{if(n)throw n.error}}h.current=e}),ru.map((function(n){return e[n]}))),null}var uu={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var cu=he((function(e,n){var t=e.nodes,r=e.edges,o=e.translateExtent,i=void 0===o?X:o,a=e.defaultViewport,u=void 0===a?tu:a,c=e.minZoom,l=void 0===c?.5:c,s=e.maxZoom,h=void 0===s?2:s,v=e.nodeOrigin,p=e.noDragClassName,g=e.noPanClassName,y=e.disableKeyboardA11y,m=e.nodeTypes,w=e.onNodesChange,b=e.onEdgesChange,x=e.fitView,_=e.fitViewOptions,S=e.nodeExtent,k=e.nodesDraggable,N=e.children,C=e.id,M=e.width,j=e.height,I=e.onPaneClick,P=e.onPaneContextMenu,A=f(e,["nodes","edges","translateExtent","defaultViewport","minZoom","maxZoom","nodeOrigin","noDragClassName","noPanClassName","disableKeyboardA11y","nodeTypes","onNodesChange","onEdgesChange","fitView","fitViewOptions","nodeExtent","nodesDraggable","children","id","width","height","onPaneClick","onPaneContextMenu"]),z=C||"1";return console.log("yk 22",I,P),E.jsx("div",d({},A,{ref:n,style:d({},uu),className:O(["ink-flow"]),"data-testid":"rf__wrapper",id:C,children:E.jsxs(nu,{nodes:t,edges:r,width:M,height:j,fitView:x,children:[E.jsx(Ka,{rfId:z,nodeTypes:m,minZoom:l,maxZoom:h,nodeOrigin:v,noDragClassName:p,noPanClassName:g,disableKeyboardA11y:y,translateExtent:i,defaultViewport:u,onPaneClick:I,onPaneContextMenu:P}),E.jsx(au,{nodes:t,edges:r,rfId:z,onNodesChange:w,onEdgesChange:b,fitView:x,fitViewOptions:_,nodeExtent:S,nodesDraggable:k}),N]})}))}));function lu(){return E.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:E.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M10 4.375C10.3452 4.375 10.625 4.65482 10.625 5V9.375H15C15.3452 9.375 15.625 9.65482 15.625 10C15.625 10.3452 15.3452 10.625 15 10.625H10.625V15C10.625 15.3452 10.3452 15.625 10 15.625C9.65482 15.625 9.375 15.3452 9.375 15V10.625H5C4.65482 10.625 4.375 10.3452 4.375 10C4.375 9.65482 4.65482 9.375 5 9.375H9.375V5C9.375 4.65482 9.65482 4.375 10 4.375Z",fill:"#6B7280"})})}function su(){return E.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:E.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M4.375 10C4.375 9.65482 4.65482 9.375 5 9.375H15C15.3452 9.375 15.625 9.65482 15.625 10C15.625 10.3452 15.3452 10.625 15 10.625H5C4.65482 10.625 4.375 10.3452 4.375 10Z",fill:"#6B7280"})})}function du(){return E.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:E.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M10 1.875C10.3452 1.875 10.625 2.15482 10.625 2.5V3.57152C13.6929 3.86613 16.1339 6.30708 16.4285 9.375H17.5C17.8452 9.375 18.125 9.65482 18.125 10C18.125 10.3452 17.8452 10.625 17.5 10.625H16.4285C16.1339 13.6929 13.6929 16.1339 10.625 16.4285V17.5C10.625 17.8452 10.3452 18.125 10 18.125C9.65482 18.125 9.375 17.8452 9.375 17.5V16.4285C6.30708 16.1339 3.86613 13.6929 3.57152 10.625H2.5C2.15482 10.625 1.875 10.3452 1.875 10C1.875 9.65482 2.15482 9.375 2.5 9.375H3.57152C3.86613 6.30708 6.30708 3.86613 9.375 3.57152V2.5C9.375 2.15482 9.65482 1.875 10 1.875ZM4.82878 10.625H5.83333C6.17851 10.625 6.45833 10.3452 6.45833 10C6.45833 9.65482 6.17851 9.375 5.83333 9.375H4.82878C5.11304 6.99811 6.99811 5.11304 9.375 4.82878V5.83333C9.375 6.17851 9.65482 6.45833 10 6.45833C10.3452 6.45833 10.625 6.17851 10.625 5.83333V4.82878C13.0019 5.11304 14.887 6.99811 15.1712 9.375H14.1667C13.8215 9.375 13.5417 9.65482 13.5417 10C13.5417 10.3452 13.8215 10.625 14.1667 10.625H15.1712C14.887 13.0019 13.0019 14.887 10.625 15.1712V14.1667C10.625 13.8215 10.3452 13.5417 10 13.5417C9.65482 13.5417 9.375 13.8215 9.375 14.1667V15.1712C6.99811 14.887 5.11304 13.0019 4.82878 10.625Z",fill:"#6B7280"})})}function fu(){return E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:E.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function hu(){return E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:E.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function vu(e){var n=e.children,t=e.className,r=f(e,["children","className"]);return E.jsx("button",d({type:"button",className:O(["ink-flow__controls-button",t])},r,{children:n}))}var pu=function(e){return e.userSelectionActive?"none":"all"};function gu(e){var n=e.position,t=void 0===n?"top-left":n,r=e.children,o=e.className,i=e.style,a=f(e,["position","children","className","style"]),u=G(pu),c="".concat(t).split("-");return E.jsx("div",d({className:O(y(["ink-flow__panel",o],g(c),!1)),style:d(d({},i),{pointerEvents:u})},a,{children:r}))}var yu=function(e){return{isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}};function mu(e){var n=e.style,t=e.showZoom,r=void 0===t||t,o=e.showFitView,i=void 0===o||o,a=e.showInteractive,u=void 0===a||a,c=e.fitViewOptions,l=e.onZoomIn,s=e.onZoomOut,d=e.onFitView,f=e.onInteractiveChange,h=e.className,v=e.children,p=e.position,g=void 0===p?"bottom-left":p,y=e.orientation,m=void 0===y?"vertical":y,w=e["aria-label"],b=void 0===w?"Ink Flow controls":w,x=$(),_=G(yu,De),S=_.isInteractive,k=_.minZoomReached,N=_.maxZoomReached,C=ki(),M=C.zoomIn,j=C.zoomOut,I=C.fitView,P="horizontal"===m?"horizontal":"vertical";return E.jsxs(gu,{className:O(["ink-flow__controls",P,h]),position:g,style:n,"data-testid":"rf__controls","aria-label":b,children:[i&&E.jsx(vu,{className:"ink-flow__controls-fitview",onClick:function(){I(c),null==d||d()},title:"fit view","aria-label":"fit view",children:E.jsx(du,{})}),r&&E.jsxs("div",{className:"ink-flow__controls-zoom",children:[E.jsx(vu,{onClick:function(){M(),null==l||l()},className:"ink-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:N,children:E.jsx(lu,{})}),E.jsx(vu,{onClick:function(){j(),null==s||s()},className:"ink-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:k,children:E.jsx(su,{})})]}),u&&E.jsx(vu,{className:"ink-flow__controls-interactive",onClick:function(){x.setState({nodesDraggable:!S,nodesConnectable:!S,elementsSelectable:!S}),null==f||f(!S)},title:"toggle interactivity","aria-label":"toggle interactivity",children:S?E.jsx(hu,{}):E.jsx(fu,{})}),v]})}mu.displayName="Controls";var wu=c(mu);console.log("types");var bu,xu,_u,Eu,Su,ku,Nu,Cu,Ou,Mu,ju,Iu,Pu,Au,zu,Tu,Bu,Du,Lu,Vu,Ru,Hu,Zu,Yu,Xu,Fu,Uu,Gu,$u,Wu,qu,Ku,Qu,Ju,ec,nc,tc,rc,oc,ic,ac,uc,cc,lc,sc,dc,fc,hc,vc,pc,gc,yc,mc,wc,bc,xc,_c,Ec,Sc,kc,Nc,Cc,Oc,Mc,jc,Ic,Pc,Ac,zc,Tc,Bc,Dc,Lc,Vc,Rc,Hc,Zc,Yc,Xc,Fc,Uc,Gc,$c,Wc,qc,Kc,Qc,Jc,el,nl,tl,rl,ol,il,al,ul,cl,ll,sl,dl,fl,hl,vl,pl,gl,yl,ml,wl,bl="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function xl(){return Eu?_u:(Eu=1,_u=function(e,n){return e===n||e!=e&&n!=n})}function _l(){if(ku)return Su;ku=1;var e=xl();return Su=function(n,t){for(var r=n.length;r--;)if(e(n[r][0],t))return r;return-1}}function El(){if(Tu)return zu;Tu=1;var e=xu?bu:(xu=1,bu=function(){this.__data__=[],this.size=0}),n=function(){if(Cu)return Nu;Cu=1;var e=_l(),n=Array.prototype.splice;return Nu=function(t){var r=this.__data__,o=e(r,t);return!(o<0||(o==r.length-1?r.pop():n.call(r,o,1),--this.size,0))}}(),t=function(){if(Mu)return Ou;Mu=1;var e=_l();return Ou=function(n){var t=this.__data__,r=e(t,n);return r<0?void 0:t[r][1]}}(),r=function(){if(Iu)return ju;Iu=1;var e=_l();return ju=function(n){return e(this.__data__,n)>-1}}(),o=function(){if(Au)return Pu;Au=1;var e=_l();return Pu=function(n,t){var r=this.__data__,o=e(r,n);return o<0?(++this.size,r.push([n,t])):r[o][1]=t,this}}();function i(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}return i.prototype.clear=e,i.prototype.delete=n,i.prototype.get=t,i.prototype.has=r,i.prototype.set=o,zu=i}function Sl(){if(Fu)return Xu;Fu=1;var e="object"==typeof bl&&bl&&bl.Object===Object&&bl;return Xu=e}function kl(){if(Gu)return Uu;Gu=1;var e=Sl(),n="object"==typeof self&&self&&self.Object===Object&&self,t=e||n||Function("return this")();return Uu=t}function Nl(){if(Wu)return $u;Wu=1;var e=kl().Symbol;return $u=e}function Cl(){if(nc)return ec;nc=1;var e=Nl(),n=function(){if(Ku)return qu;Ku=1;var e=Nl(),n=Object.prototype,t=n.hasOwnProperty,r=n.toString,o=e?e.toStringTag:void 0;return qu=function(e){var n=t.call(e,o),i=e[o];try{e[o]=void 0;var a=!0}catch(e){}var u=r.call(e);return a&&(n?e[o]=i:delete e[o]),u}}(),t=function(){if(Ju)return Qu;Ju=1;var e=Object.prototype.toString;return Qu=function(n){return e.call(n)}}(),r=e?e.toStringTag:void 0;return ec=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":r&&r in Object(e)?n(e):t(e)}}function Ol(){return rc?tc:(rc=1,tc=function(e){var n=typeof e;return null!=e&&("object"==n||"function"==n)})}function Ml(){if(ic)return oc;ic=1;var e=Cl(),n=Ol();return oc=function(t){if(!n(t))return!1;var r=e(t);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}}function jl(){if(dc)return sc;dc=1;var e=Function.prototype.toString;return sc=function(n){if(null!=n){try{return e.call(n)}catch(e){}try{return n+""}catch(e){}}return""}}function Il(){if(yc)return gc;yc=1;var e=function(){if(hc)return fc;hc=1;var e=Ml(),n=function(){if(lc)return cc;lc=1;var e,n=function(){if(uc)return ac;uc=1;var e=kl()["__core-js_shared__"];return ac=e}(),t=(e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return cc=function(e){return!!t&&t in e}}(),t=Ol(),r=jl(),o=/^\[object .+?Constructor\]$/,i=Function.prototype,a=Object.prototype,u=i.toString,c=a.hasOwnProperty,l=RegExp("^"+u.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return fc=function(i){return!(!t(i)||n(i))&&(e(i)?l:o).test(r(i))}}(),n=pc?vc:(pc=1,vc=function(e,n){return null==e?void 0:e[n]});return gc=function(t,r){var o=n(t,r);return e(o)?o:void 0}}function Pl(){if(wc)return mc;wc=1;var e=Il()(kl(),"Map");return mc=e}function Al(){if(xc)return bc;xc=1;var e=Il()(Object,"create");return bc=e}function zl(){if(Vc)return Lc;Vc=1;var e=Dc?Bc:(Dc=1,Bc=function(e){var n=typeof e;return"string"==n||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==e:null===e});return Lc=function(n,t){var r=n.__data__;return e(t)?r["string"==typeof t?"string":"hash"]:r.map}}function Tl(){if(Wc)return $c;Wc=1;var e=function(){if(Tc)return zc;Tc=1;var e=function(){if(Ac)return Pc;Ac=1;var e=function(){if(Ec)return _c;Ec=1;var e=Al();return _c=function(){this.__data__=e?e(null):{},this.size=0}}(),n=kc?Sc:(kc=1,Sc=function(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n}),t=function(){if(Cc)return Nc;Cc=1;var e=Al(),n=Object.prototype.hasOwnProperty;return Nc=function(t){var r=this.__data__;if(e){var o=r[t];return"__lodash_hash_undefined__"===o?void 0:o}return n.call(r,t)?r[t]:void 0}}(),r=function(){if(Mc)return Oc;Mc=1;var e=Al(),n=Object.prototype.hasOwnProperty;return Oc=function(t){var r=this.__data__;return e?void 0!==r[t]:n.call(r,t)}}(),o=function(){if(Ic)return jc;Ic=1;var e=Al();return jc=function(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=e&&void 0===t?"__lodash_hash_undefined__":t,this}}();function i(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}return i.prototype.clear=e,i.prototype.delete=n,i.prototype.get=t,i.prototype.has=r,i.prototype.set=o,Pc=i}(),n=El(),t=Pl();return zc=function(){this.size=0,this.__data__={hash:new e,map:new(t||n),string:new e}}}(),n=function(){if(Hc)return Rc;Hc=1;var e=zl();return Rc=function(n){var t=e(this,n).delete(n);return this.size-=t?1:0,t}}(),t=function(){if(Yc)return Zc;Yc=1;var e=zl();return Zc=function(n){return e(this,n).get(n)}}(),r=function(){if(Fc)return Xc;Fc=1;var e=zl();return Xc=function(n){return e(this,n).has(n)}}(),o=function(){if(Gc)return Uc;Gc=1;var e=zl();return Uc=function(n,t){var r=e(this,n),o=r.size;return r.set(n,t),this.size+=r.size==o?0:1,this}}();function i(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}return i.prototype.clear=e,i.prototype.delete=n,i.prototype.get=t,i.prototype.has=r,i.prototype.set=o,$c=i}function Bl(){if(Jc)return Qc;Jc=1;var e=El(),n=function(){if(Du)return Bu;Du=1;var e=El();return Bu=function(){this.__data__=new e,this.size=0}}(),t=Vu?Lu:(Vu=1,Lu=function(e){var n=this.__data__,t=n.delete(e);return this.size=n.size,t}),r=Hu?Ru:(Hu=1,Ru=function(e){return this.__data__.get(e)}),o=Yu?Zu:(Yu=1,Zu=function(e){return this.__data__.has(e)}),i=function(){if(Kc)return qc;Kc=1;var e=El(),n=Pl(),t=Tl();return qc=function(r,o){var i=this.__data__;if(i instanceof e){var a=i.__data__;if(!n||a.length<199)return a.push([r,o]),this.size=++i.size,this;i=this.__data__=new t(a)}return i.set(r,o),this.size=i.size,this}}();function a(n){var t=this.__data__=new e(n);this.size=t.size}return a.prototype.clear=n,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=o,a.prototype.set=i,Qc=a}function Dl(){return nl?el:(nl=1,el=function(e,n){for(var t=-1,r=null==e?0:e.length;++t<r&&!1!==n(e[t],t,e););return e})}function Ll(){if(rl)return tl;rl=1;var e=Il(),n=function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch(e){}}();return tl=n}function Vl(){if(il)return ol;il=1;var e=Ll();return ol=function(n,t,r){"__proto__"==t&&e?e(n,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[t]=r}}function Rl(){if(ul)return al;ul=1;var e=Vl(),n=xl(),t=Object.prototype.hasOwnProperty;return al=function(r,o,i){var a=r[o];t.call(r,o)&&n(a,i)&&(void 0!==i||o in r)||e(r,o,i)}}function Hl(){if(ll)return cl;ll=1;var e=Rl(),n=Vl();return cl=function(t,r,o,i){var a=!o;o||(o={});for(var u=-1,c=r.length;++u<c;){var l=r[u],s=i?i(o[l],t[l],l,o,t):void 0;void 0===s&&(s=t[l]),a?n(o,l,s):e(o,l,s)}return o}}function Zl(){return hl?fl:(hl=1,fl=function(e){return null!=e&&"object"==typeof e})}function Yl(){if(yl)return gl;yl=1;var e=function(){if(pl)return vl;pl=1;var e=Cl(),n=Zl();return vl=function(t){return n(t)&&"[object Arguments]"==e(t)}}(),n=Zl(),t=Object.prototype,r=t.hasOwnProperty,o=t.propertyIsEnumerable,i=e(function(){return arguments}())?e:function(e){return n(e)&&r.call(e,"callee")&&!o.call(e,"callee")};return gl=i}function Xl(){if(wl)return ml;wl=1;var e=Array.isArray;return ml=e}var Fl,Ul,Gl,$l,Wl,ql,Kl,Ql,Jl,es,ns,ts={exports:{}};function rs(){return Gl||(Gl=1,function(e,n){var t=kl(),r=Ul?Fl:(Ul=1,Fl=function(){return!1}),o=n&&!n.nodeType&&n,i=o&&e&&!e.nodeType&&e,a=i&&i.exports===o?t.Buffer:void 0,u=(a?a.isBuffer:void 0)||r;e.exports=u}(ts,ts.exports)),ts.exports}function os(){if(Wl)return $l;Wl=1;var e=/^(?:0|[1-9]\d*)$/;return $l=function(n,t){var r=typeof n;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&e.test(n))&&n>-1&&n%1==0&&n<t}}function is(){return Kl?ql:(Kl=1,ql=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991})}function as(){return ns?es:(ns=1,es=function(e){return function(n){return e(n)}})}ts.exports;var us,cs,ls,ss,ds,fs,hs,vs,ps,gs,ys,ms,ws,bs,xs,_s,Es,Ss,ks,Ns,Cs,Os,Ms,js,Is,Ps,As,zs={exports:{}};function Ts(){return us||(us=1,e=zs,n=zs.exports,t=Sl(),r=n&&!n.nodeType&&n,o=r&&e&&!e.nodeType&&e,i=o&&o.exports===r&&t.process,a=function(){try{return o&&o.require&&o.require("util").types||i&&i.binding&&i.binding("util")}catch(e){}}(),e.exports=a),zs.exports;var e,n,t,r,o,i,a}function Bs(){if(ls)return cs;ls=1;var e=function(){if(Jl)return Ql;Jl=1;var e=Cl(),n=is(),t=Zl(),r={};return r["[object Float32Array]"]=r["[object Float64Array]"]=r["[object Int8Array]"]=r["[object Int16Array]"]=r["[object Int32Array]"]=r["[object Uint8Array]"]=r["[object Uint8ClampedArray]"]=r["[object Uint16Array]"]=r["[object Uint32Array]"]=!0,r["[object Arguments]"]=r["[object Array]"]=r["[object ArrayBuffer]"]=r["[object Boolean]"]=r["[object DataView]"]=r["[object Date]"]=r["[object Error]"]=r["[object Function]"]=r["[object Map]"]=r["[object Number]"]=r["[object Object]"]=r["[object RegExp]"]=r["[object Set]"]=r["[object String]"]=r["[object WeakMap]"]=!1,Ql=function(o){return t(o)&&n(o.length)&&!!r[e(o)]}}(),n=as(),t=Ts(),r=t&&t.isTypedArray,o=r?n(r):e;return cs=o}function Ds(){if(ds)return ss;ds=1;var e=dl?sl:(dl=1,sl=function(e,n){for(var t=-1,r=Array(e);++t<e;)r[t]=n(t);return r}),n=Yl(),t=Xl(),r=rs(),o=os(),i=Bs(),a=Object.prototype.hasOwnProperty;return ss=function(u,c){var l=t(u),s=!l&&n(u),d=!l&&!s&&r(u),f=!l&&!s&&!d&&i(u),h=l||s||d||f,v=h?e(u.length,String):[],p=v.length;for(var g in u)!c&&!a.call(u,g)||h&&("length"==g||d&&("offset"==g||"parent"==g)||f&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||o(g,p))||v.push(g);return v}}function Ls(){if(hs)return fs;hs=1;var e=Object.prototype;return fs=function(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||e)}}function Vs(){return ps?vs:(ps=1,vs=function(e,n){return function(t){return e(n(t))}})}function Rs(){if(ws)return ms;ws=1;var e=Ls(),n=function(){if(ys)return gs;ys=1;var e=Vs()(Object.keys,Object);return gs=e}(),t=Object.prototype.hasOwnProperty;return ms=function(r){if(!e(r))return n(r);var o=[];for(var i in Object(r))t.call(r,i)&&"constructor"!=i&&o.push(i);return o}}function Hs(){if(xs)return bs;xs=1;var e=Ml(),n=is();return bs=function(t){return null!=t&&n(t.length)&&!e(t)}}function Zs(){if(Es)return _s;Es=1;var e=Ds(),n=Rs(),t=Hs();return _s=function(r){return t(r)?e(r):n(r)}}function Ys(){if(Is)return js;Is=1;var e=Ds(),n=function(){if(Ms)return Os;Ms=1;var e=Ol(),n=Ls(),t=Cs?Ns:(Cs=1,Ns=function(e){var n=[];if(null!=e)for(var t in Object(e))n.push(t);return n}),r=Object.prototype.hasOwnProperty;return Os=function(o){if(!e(o))return t(o);var i=n(o),a=[];for(var u in o)("constructor"!=u||!i&&r.call(o,u))&&a.push(u);return a}}(),t=Hs();return js=function(r){return t(r)?e(r,!0):n(r)}}zs.exports;var Xs,Fs,Us,Gs,$s,Ws,qs,Ks,Qs,Js,ed,nd,td,rd,od,id,ad,ud,cd,ld,sd,dd,fd,hd,vd,pd,gd,yd,md,wd,bd,xd,_d,Ed,Sd,kd,Nd,Cd,Od,Md,jd,Id,Pd,Ad,zd,Td,Bd,Dd,Ld,Vd,Rd,Hd,Zd,Yd,Xd,Fd,Ud,Gd,$d,Wd,qd,Kd,Qd,Jd,ef,nf,tf,rf,of,af,uf,cf,lf,sf,df,ff,hf,vf,pf,gf,yf,mf,wf,bf,xf,_f,Ef,Sf,kf,Nf,Cf,Of,Mf,jf,If,Pf,Af,zf,Tf,Bf,Df,Lf,Vf,Rf,Hf,Zf,Yf,Xf,Ff,Uf,Gf,$f,Wf,qf,Kf,Qf,Jf,eh,nh,th,rh,oh,ih,ah,uh,ch,lh,sh,dh,fh,hh,vh,ph,gh,yh,mh,wh,bh,xh,_h,Eh,Sh,kh,Nh,Ch,Oh,Mh,jh,Ih,Ph,Ah,zh,Th,Bh,Dh,Lh,Vh,Rh,Hh,Zh,Yh,Xh,Fh,Uh,Gh,$h,Wh,qh,Kh,Qh,Jh,ev,nv,tv,rv,ov,iv,av,uv,cv,lv,sv,dv,fv,hv,vv,pv,gv,yv,mv,wv,bv,xv,_v,Ev,Sv,kv,Nv,Cv,Ov,Mv,jv,Iv,Pv,Av,zv,Tv,Bv,Dv,Lv,Vv,Rv,Hv,Zv,Yv,Xv,Fv,Uv,Gv,$v,Wv,qv,Kv,Qv,Jv,ep,np,tp,rp,op,ip,ap,up,cp,lp,sp,dp,fp,hp,vp,pp,gp,yp,mp,wp,bp,xp,_p,Ep,Sp,kp,Np,Cp,Op,Mp,jp,Ip,Pp,Ap,zp,Tp,Bp,Dp,Lp,Vp,Rp,Hp,Zp,Yp,Xp,Fp,Up,Gp,$p,Wp,qp,Kp,Qp,Jp,eg,ng={exports:{}};function tg(){return Xs||(Xs=1,e=ng,n=ng.exports,t=kl(),i=(o=(r=n&&!n.nodeType&&n)&&e&&!e.nodeType&&e)&&o.exports===r?t.Buffer:void 0,a=i?i.allocUnsafe:void 0,e.exports=function(e,n){if(n)return e.slice();var t=e.length,r=a?a(t):new e.constructor(t);return e.copy(r),r}),ng.exports;var e,n,t,r,o,i,a}function rg(){return Us?Fs:(Us=1,Fs=function(e,n){var t=-1,r=e.length;for(n||(n=Array(r));++t<r;)n[t]=e[t];return n})}function og(){return $s?Gs:($s=1,Gs=function(e,n){for(var t=-1,r=null==e?0:e.length,o=0,i=[];++t<r;){var a=e[t];n(a,t,e)&&(i[o++]=a)}return i})}function ig(){return qs?Ws:(qs=1,Ws=function(){return[]})}function ag(){if(Qs)return Ks;Qs=1;var e=og(),n=ig(),t=Object.prototype.propertyIsEnumerable,r=Object.getOwnPropertySymbols;return Ks=r?function(n){return null==n?[]:(n=Object(n),e(r(n),(function(e){return t.call(n,e)})))}:n}function ug(){return td?nd:(td=1,nd=function(e,n){for(var t=-1,r=n.length,o=e.length;++t<r;)e[o+t]=n[t];return e})}function cg(){if(od)return rd;od=1;var e=Vs()(Object.getPrototypeOf,Object);return rd=e}function lg(){if(ad)return id;ad=1;var e=ug(),n=cg(),t=ag(),r=ig(),o=Object.getOwnPropertySymbols;return id=o?function(r){for(var o=[];r;)e(o,t(r)),r=n(r);return o}:r}function sg(){if(sd)return ld;sd=1;var e=ug(),n=Xl();return ld=function(t,r,o){var i=r(t);return n(t)?i:e(i,o(t))}}function dg(){if(fd)return dd;fd=1;var e=sg(),n=ag(),t=Zs();return dd=function(r){return e(r,t,n)}}function fg(){if(bd)return wd;bd=1;var e=Il()(kl(),"Set");return wd=e}function hg(){if(Sd)return Ed;Sd=1;var e=function(){if(gd)return pd;gd=1;var e=Il()(kl(),"DataView");return pd=e}(),n=Pl(),t=function(){if(md)return yd;md=1;var e=Il()(kl(),"Promise");return yd=e}(),r=fg(),o=function(){if(_d)return xd;_d=1;var e=Il()(kl(),"WeakMap");return xd=e}(),i=Cl(),a=jl(),u="[object Map]",c="[object Promise]",l="[object Set]",s="[object WeakMap]",d="[object DataView]",f=a(e),h=a(n),v=a(t),p=a(r),g=a(o),y=i;return(e&&y(new e(new ArrayBuffer(1)))!=d||n&&y(new n)!=u||t&&y(t.resolve())!=c||r&&y(new r)!=l||o&&y(new o)!=s)&&(y=function(e){var n=i(e),t="[object Object]"==n?e.constructor:void 0,r=t?a(t):"";if(r)switch(r){case f:return d;case h:return u;case v:return c;case p:return l;case g:return s}return n}),Ed=y}function vg(){if(Od)return Cd;Od=1;var e=kl().Uint8Array;return Cd=e}function pg(){if(jd)return Md;jd=1;var e=vg();return Md=function(n){var t=new n.constructor(n.byteLength);return new e(t).set(new e(n)),t}}function gg(){if(Ld)return Dd;Ld=1;var e=pg();return Dd=function(n,t){var r=t?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}}function yg(){if(Zd)return Hd;Zd=1;var e=Ol(),n=Object.create,t=function(){function t(){}return function(r){if(!e(r))return{};if(n)return n(r);t.prototype=r;var o=new t;return t.prototype=void 0,o}}();return Hd=t}function mg(){if(Xd)return Yd;Xd=1;var e=yg(),n=cg(),t=Ls();return Yd=function(r){return"function"!=typeof r.constructor||t(r)?{}:e(n(r))}}function wg(){if(ef)return Jd;ef=1;var e=Bl(),n=Dl(),t=Rl(),r=function(){if(ks)return Ss;ks=1;var e=Hl(),n=Zs();return Ss=function(t,r){return t&&e(r,n(r),t)}}(),o=function(){if(As)return Ps;As=1;var e=Hl(),n=Ys();return Ps=function(t,r){return t&&e(r,n(r),t)}}(),i=tg(),a=rg(),u=function(){if(ed)return Js;ed=1;var e=Hl(),n=ag();return Js=function(t,r){return e(t,n(t),r)}}(),c=function(){if(cd)return ud;cd=1;var e=Hl(),n=lg();return ud=function(t,r){return e(t,n(t),r)}}(),l=dg(),s=function(){if(vd)return hd;vd=1;var e=sg(),n=lg(),t=Ys();return hd=function(r){return e(r,t,n)}}(),d=hg(),f=function(){if(Nd)return kd;Nd=1;var e=Object.prototype.hasOwnProperty;return kd=function(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&e.call(n,"index")&&(r.index=n.index,r.input=n.input),r}}(),h=function(){if(Rd)return Vd;Rd=1;var e=pg(),n=function(){if(Pd)return Id;Pd=1;var e=pg();return Id=function(n,t){var r=t?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}}(),t=function(){if(zd)return Ad;zd=1;var e=/\w*$/;return Ad=function(n){var t=new n.constructor(n.source,e.exec(n));return t.lastIndex=n.lastIndex,t}}(),r=function(){if(Bd)return Td;Bd=1;var e=Nl(),n=e?e.prototype:void 0,t=n?n.valueOf:void 0;return Td=function(e){return t?Object(t.call(e)):{}}}(),o=gg();return Vd=function(i,a,u){var c=i.constructor;switch(a){case"[object ArrayBuffer]":return e(i);case"[object Boolean]":case"[object Date]":return new c(+i);case"[object DataView]":return n(i,u);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return o(i,u);case"[object Map]":case"[object Set]":return new c;case"[object Number]":case"[object String]":return new c(i);case"[object RegExp]":return t(i);case"[object Symbol]":return r(i)}}}(),v=mg(),p=Xl(),g=rs(),y=function(){if($d)return Gd;$d=1;var e=function(){if(Ud)return Fd;Ud=1;var e=hg(),n=Zl();return Fd=function(t){return n(t)&&"[object Map]"==e(t)}}(),n=as(),t=Ts(),r=t&&t.isMap,o=r?n(r):e;return Gd=o}(),m=Ol(),w=function(){if(Qd)return Kd;Qd=1;var e=function(){if(qd)return Wd;qd=1;var e=hg(),n=Zl();return Wd=function(t){return n(t)&&"[object Set]"==e(t)}}(),n=as(),t=Ts(),r=t&&t.isSet,o=r?n(r):e;return Kd=o}(),b=Zs(),x=Ys(),_="[object Arguments]",E="[object Function]",S="[object Object]",k={};return k[_]=k["[object Array]"]=k["[object ArrayBuffer]"]=k["[object DataView]"]=k["[object Boolean]"]=k["[object Date]"]=k["[object Float32Array]"]=k["[object Float64Array]"]=k["[object Int8Array]"]=k["[object Int16Array]"]=k["[object Int32Array]"]=k["[object Map]"]=k["[object Number]"]=k[S]=k["[object RegExp]"]=k["[object Set]"]=k["[object String]"]=k["[object Symbol]"]=k["[object Uint8Array]"]=k["[object Uint8ClampedArray]"]=k["[object Uint16Array]"]=k["[object Uint32Array]"]=!0,k["[object Error]"]=k[E]=k["[object WeakMap]"]=!1,Jd=function N(C,O,M,j,I,P){var A,z=1&O,T=2&O,B=4&O;if(M&&(A=I?M(C,j,I,P):M(C)),void 0!==A)return A;if(!m(C))return C;var D=p(C);if(D){if(A=f(C),!z)return a(C,A)}else{var L=d(C),V=L==E||"[object GeneratorFunction]"==L;if(g(C))return i(C,z);if(L==S||L==_||V&&!I){if(A=T||V?{}:v(C),!z)return T?c(C,o(A,C)):u(C,r(A,C))}else{if(!k[L])return I?C:{};A=h(C,L,z)}}P||(P=new e);var R=P.get(C);if(R)return R;P.set(C,A),w(C)?C.forEach((function(e){A.add(N(e,O,M,e,C,P))})):y(C)&&C.forEach((function(e,n){A.set(n,N(e,O,M,n,C,P))}));var H=D?void 0:(B?T?s:l:T?x:b)(C);return n(H||C,(function(e,n){H&&(e=C[n=e]),t(A,n,N(e,O,M,n,C,P))})),A},Jd}function bg(){if(tf)return nf;tf=1;var e=wg();return nf=function(n){return e(n,4)}}function xg(){return of?rf:(of=1,rf=function(e){return function(){return e}})}function _g(){if(lf)return cf;lf=1;var e=(uf?af:(uf=1,af=function(e){return function(n,t,r){for(var o=-1,i=Object(n),a=r(n),u=a.length;u--;){var c=a[e?u:++o];if(!1===t(i[c],c,i))break}return n}}))();return cf=e}function Eg(){if(df)return sf;df=1;var e=_g(),n=Zs();return sf=function(t,r){return t&&e(t,r,n)}}function Sg(){if(pf)return vf;pf=1;var e=Eg(),n=function(){if(hf)return ff;hf=1;var e=Hs();return ff=function(n,t){return function(r,o){if(null==r)return r;if(!e(r))return n(r,o);for(var i=r.length,a=t?i:-1,u=Object(r);(t?a--:++a<i)&&!1!==o(u[a],a,u););return r}}}()(e);return vf=n}function kg(){return yf?gf:(yf=1,gf=function(e){return e})}function Ng(){if(wf)return mf;wf=1;var e=kg();return mf=function(n){return"function"==typeof n?n:e}}function Cg(){if(xf)return bf;xf=1;var e=Dl(),n=Sg(),t=Ng(),r=Xl();return bf=function(o,i){return(r(o)?e:n)(o,t(i))}}function Og(){return Ef?_f:(Ef=1,_f=Cg())}function Mg(){if(If)return jf;If=1;var e=Tl(),n=Cf?Nf:(Cf=1,Nf=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}),t=Mf?Of:(Mf=1,Of=function(e){return this.__data__.has(e)});function r(n){var t=-1,r=null==n?0:n.length;for(this.__data__=new e;++t<r;)this.add(n[t])}return r.prototype.add=r.prototype.push=n,r.prototype.has=t,jf=r}function jg(){return Tf?zf:(Tf=1,zf=function(e,n){return e.has(n)})}function Ig(){if(Df)return Bf;Df=1;var e=Mg(),n=Af?Pf:(Af=1,Pf=function(e,n){for(var t=-1,r=null==e?0:e.length;++t<r;)if(n(e[t],t,e))return!0;return!1}),t=jg();return Bf=function(r,o,i,a,u,c){var l=1&i,s=r.length,d=o.length;if(s!=d&&!(l&&d>s))return!1;var f=c.get(r),h=c.get(o);if(f&&h)return f==o&&h==r;var v=-1,p=!0,g=2&i?new e:void 0;for(c.set(r,o),c.set(o,r);++v<s;){var y=r[v],m=o[v];if(a)var w=l?a(m,y,v,o,r,c):a(y,m,v,r,o,c);if(void 0!==w){if(w)continue;p=!1;break}if(g){if(!n(o,(function(e,n){if(!t(g,n)&&(y===e||u(y,e,i,a,c)))return g.push(n)}))){p=!1;break}}else if(y!==m&&!u(y,m,i,a,c)){p=!1;break}}return c.delete(r),c.delete(o),p}}function Pg(){return Hf?Rf:(Hf=1,Rf=function(e){var n=-1,t=Array(e.size);return e.forEach((function(e){t[++n]=e})),t})}function Ag(){if(Gf)return Uf;Gf=1;var e=Bl(),n=Ig(),t=function(){if(Yf)return Zf;Yf=1;var e=Nl(),n=vg(),t=xl(),r=Ig(),o=Vf?Lf:(Vf=1,Lf=function(e){var n=-1,t=Array(e.size);return e.forEach((function(e,r){t[++n]=[r,e]})),t}),i=Pg(),a=e?e.prototype:void 0,u=a?a.valueOf:void 0;return Zf=function(e,a,c,l,s,d,f){switch(c){case"[object DataView]":if(e.byteLength!=a.byteLength||e.byteOffset!=a.byteOffset)return!1;e=e.buffer,a=a.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=a.byteLength||!d(new n(e),new n(a)));case"[object Boolean]":case"[object Date]":case"[object Number]":return t(+e,+a);case"[object Error]":return e.name==a.name&&e.message==a.message;case"[object RegExp]":case"[object String]":return e==a+"";case"[object Map]":var h=o;case"[object Set]":var v=1&l;if(h||(h=i),e.size!=a.size&&!v)return!1;var p=f.get(e);if(p)return p==a;l|=2,f.set(e,a);var g=r(h(e),h(a),l,s,d,f);return f.delete(e),g;case"[object Symbol]":if(u)return u.call(e)==u.call(a)}return!1}}(),r=function(){if(Ff)return Xf;Ff=1;var e=dg(),n=Object.prototype.hasOwnProperty;return Xf=function(t,r,o,i,a,u){var c=1&o,l=e(t),s=l.length;if(s!=e(r).length&&!c)return!1;for(var d=s;d--;){var f=l[d];if(!(c?f in r:n.call(r,f)))return!1}var h=u.get(t),v=u.get(r);if(h&&v)return h==r&&v==t;var p=!0;u.set(t,r),u.set(r,t);for(var g=c;++d<s;){var y=t[f=l[d]],m=r[f];if(i)var w=c?i(m,y,f,r,t,u):i(y,m,f,t,r,u);if(!(void 0===w?y===m||a(y,m,o,i,u):w)){p=!1;break}g||(g="constructor"==f)}if(p&&!g){var b=t.constructor,x=r.constructor;b==x||!("constructor"in t)||!("constructor"in r)||"function"==typeof b&&b instanceof b&&"function"==typeof x&&x instanceof x||(p=!1)}return u.delete(t),u.delete(r),p}}(),o=hg(),i=Xl(),a=rs(),u=Bs(),c="[object Arguments]",l="[object Array]",s="[object Object]",d=Object.prototype.hasOwnProperty;return Uf=function(f,h,v,p,g,y){var m=i(f),w=i(h),b=m?l:o(f),x=w?l:o(h),_=(b=b==c?s:b)==s,E=(x=x==c?s:x)==s,S=b==x;if(S&&a(f)){if(!a(h))return!1;m=!0,_=!1}if(S&&!_)return y||(y=new e),m||u(f)?n(f,h,v,p,g,y):t(f,h,b,v,p,g,y);if(!(1&v)){var k=_&&d.call(f,"__wrapped__"),N=E&&d.call(h,"__wrapped__");if(k||N){var C=k?f.value():f,O=N?h.value():h;return y||(y=new e),g(C,O,v,p,y)}}return!!S&&(y||(y=new e),r(f,h,v,p,g,y))}}function zg(){if(Wf)return $f;Wf=1;var e=Ag(),n=Zl();return $f=function t(r,o,i,a,u){return r===o||(null==r||null==o||!n(r)&&!n(o)?r!=r&&o!=o:e(r,o,i,a,t,u))},$f}function Tg(){if(Jf)return Qf;Jf=1;var e=Ol();return Qf=function(n){return n==n&&!e(n)}}function Bg(){return rh?th:(rh=1,th=function(e,n){return function(t){return null!=t&&t[e]===n&&(void 0!==n||e in Object(t))}})}function Dg(){if(uh)return ah;uh=1;var e=Cl(),n=Zl();return ah=function(t){return"symbol"==typeof t||n(t)&&"[object Symbol]"==e(t)}}function Lg(){if(lh)return ch;lh=1;var e=Xl(),n=Dg(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;return ch=function(o,i){if(e(o))return!1;var a=typeof o;return!("number"!=a&&"symbol"!=a&&"boolean"!=a&&null!=o&&!n(o))||r.test(o)||!t.test(o)||null!=i&&o in Object(i)}}function Vg(){return yh?gh:(yh=1,gh=function(e,n){for(var t=-1,r=null==e?0:e.length,o=Array(r);++t<r;)o[t]=n(e[t],t,e);return o})}function Rg(){if(xh)return bh;xh=1;var e=function(){if(wh)return mh;wh=1;var e=Nl(),n=Vg(),t=Xl(),r=Dg(),o=e?e.prototype:void 0,i=o?o.toString:void 0;return mh=function e(o){if("string"==typeof o)return o;if(t(o))return n(o,e)+"";if(r(o))return i?i.call(o):"";var a=o+"";return"0"==a&&1/o==-1/0?"-0":a},mh}();return bh=function(n){return null==n?"":e(n)}}function Hg(){if(Eh)return _h;Eh=1;var e=Xl(),n=Lg(),t=function(){if(ph)return vh;ph=1;var e=function(){if(hh)return fh;hh=1;var e=function(){if(dh)return sh;dh=1;var e=Tl();function n(t,r){if("function"!=typeof t||null!=r&&"function"!=typeof r)throw new TypeError("Expected a function");var o=function(){var e=arguments,n=r?r.apply(this,e):e[0],i=o.cache;if(i.has(n))return i.get(n);var a=t.apply(this,e);return o.cache=i.set(n,a)||i,a};return o.cache=new(n.Cache||e),o}return n.Cache=e,sh=n}();return fh=function(n){var t=e(n,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}}(),n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,r=e((function(e){var r=[];return 46===e.charCodeAt(0)&&r.push(""),e.replace(n,(function(e,n,o,i){r.push(o?i.replace(t,"$1"):n||e)})),r}));return vh=r}(),r=Rg();return _h=function(o,i){return e(o)?o:n(o,i)?[o]:t(r(o))}}function Zg(){if(kh)return Sh;kh=1;var e=Dg();return Sh=function(n){if("string"==typeof n||e(n))return n;var t=n+"";return"0"==t&&1/n==-1/0?"-0":t}}function Yg(){if(Ch)return Nh;Ch=1;var e=Hg(),n=Zg();return Nh=function(t,r){for(var o=0,i=(r=e(r,t)).length;null!=t&&o<i;)t=t[n(r[o++])];return o&&o==i?t:void 0}}function Xg(){if(Ah)return Ph;Ah=1;var e=Hg(),n=Yl(),t=Xl(),r=os(),o=is(),i=Zg();return Ph=function(a,u,c){for(var l=-1,s=(u=e(u,a)).length,d=!1;++l<s;){var f=i(u[l]);if(!(d=null!=a&&c(a,f)))break;a=a[f]}return d||++l!=s?d:!!(s=null==a?0:a.length)&&o(s)&&r(f,s)&&(t(a)||n(a))}}function Fg(){if(Th)return zh;Th=1;var e=Ih?jh:(Ih=1,jh=function(e,n){return null!=e&&n in Object(e)}),n=Xg();return zh=function(t,r){return null!=t&&n(t,r,e)}}function Ug(){return Vh?Lh:(Vh=1,Lh=function(e){return function(n){return null==n?void 0:n[e]}})}function Gg(){if(Fh)return Xh;Fh=1;var e=function(){if(ih)return oh;ih=1;var e=function(){if(Kf)return qf;Kf=1;var e=Bl(),n=zg();return qf=function(t,r,o,i){var a=o.length,u=a,c=!i;if(null==t)return!u;for(t=Object(t);a--;){var l=o[a];if(c&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++a<u;){var s=(l=o[a])[0],d=t[s],f=l[1];if(c&&l[2]){if(void 0===d&&!(s in t))return!1}else{var h=new e;if(i)var v=i(d,f,s,t,r,h);if(!(void 0===v?n(f,d,3,i,h):v))return!1}}return!0}}(),n=function(){if(nh)return eh;nh=1;var e=Tg(),n=Zs();return eh=function(t){for(var r=n(t),o=r.length;o--;){var i=r[o],a=t[i];r[o]=[i,a,e(a)]}return r}}(),t=Bg();return oh=function(r){var o=n(r);return 1==o.length&&o[0][2]?t(o[0][0],o[0][1]):function(n){return n===r||e(n,r,o)}}}(),n=function(){if(Dh)return Bh;Dh=1;var e=zg(),n=function(){if(Mh)return Oh;Mh=1;var e=Yg();return Oh=function(n,t,r){var o=null==n?void 0:e(n,t);return void 0===o?r:o}}(),t=Fg(),r=Lg(),o=Tg(),i=Bg(),a=Zg();return Bh=function(u,c){return r(u)&&o(c)?i(a(u),c):function(r){var o=n(r,u);return void 0===o&&o===c?t(r,u):e(c,o,3)}}}(),t=kg(),r=Xl(),o=function(){if(Yh)return Zh;Yh=1;var e=Ug(),n=function(){if(Hh)return Rh;Hh=1;var e=Yg();return Rh=function(n){return function(t){return e(t,n)}}}(),t=Lg(),r=Zg();return Zh=function(o){return t(o)?e(r(o)):n(o)}}();return Xh=function(i){return"function"==typeof i?i:null==i?t:"object"==typeof i?r(i)?n(i[0],i[1]):e(i):o(i)}}function $g(){if(Gh)return Uh;Gh=1;var e=og(),n=function(){if(kf)return Sf;kf=1;var e=Sg();return Sf=function(n,t){var r=[];return e(n,(function(e,n,o){t(e,n,o)&&r.push(e)})),r}}(),t=Gg(),r=Xl();return Uh=function(o,i){return(r(o)?e:n)(o,t(i,3))}}function Wg(){if(Kh)return qh;Kh=1;var e=function(){if(Wh)return $h;Wh=1;var e=Object.prototype.hasOwnProperty;return $h=function(n,t){return null!=n&&e.call(n,t)}}(),n=Xg();return qh=function(t,r){return null!=t&&n(t,r,e)}}function qg(){if(Jh)return Qh;Jh=1;var e=Rs(),n=hg(),t=Yl(),r=Xl(),o=Hs(),i=rs(),a=Ls(),u=Bs(),c=Object.prototype.hasOwnProperty;return Qh=function(l){if(null==l)return!0;if(o(l)&&(r(l)||"string"==typeof l||"function"==typeof l.splice||i(l)||u(l)||t(l)))return!l.length;var s=n(l);if("[object Map]"==s||"[object Set]"==s)return!l.size;if(a(l))return!e(l).length;for(var d in l)if(c.call(l,d))return!1;return!0}}function Kg(){return nv?ev:(nv=1,ev=function(e){return void 0===e})}function Qg(){if(rv)return tv;rv=1;var e=Sg(),n=Hs();return tv=function(t,r){var o=-1,i=n(t)?Array(t.length):[];return e(t,(function(e,n,t){i[++o]=r(e,n,t)})),i}}function Jg(){if(iv)return ov;iv=1;var e=Vg(),n=Gg(),t=Qg(),r=Xl();return ov=function(o,i){return(r(o)?e:t)(o,n(i,3))}}function ey(){if(dv)return sv;dv=1;var e=uv?av:(uv=1,av=function(e,n,t,r){var o=-1,i=null==e?0:e.length;for(r&&i&&(t=e[++o]);++o<i;)t=n(t,e[o],o,e);return t}),n=Sg(),t=Gg(),r=lv?cv:(lv=1,cv=function(e,n,t,r,o){return o(e,(function(e,o,i){t=r?(r=!1,e):n(t,e,o,i)})),t}),o=Xl();return sv=function(i,a,u){var c=o(i)?e:r,l=arguments.length<3;return c(i,t(a,4),u,l,n)},sv}function ny(){if(Ev)return _v;Ev=1;var e=Rs(),n=hg(),t=Hs(),r=function(){if(hv)return fv;hv=1;var e=Cl(),n=Xl(),t=Zl();return fv=function(r){return"string"==typeof r||!n(r)&&t(r)&&"[object String]"==e(r)}}(),o=function(){if(xv)return bv;xv=1;var e=function(){if(pv)return vv;pv=1;var e=Ug()("length");return vv=e}(),n=function(){if(yv)return gv;yv=1;var e=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");return gv=function(n){return e.test(n)}}(),t=function(){if(wv)return mv;wv=1;var e="\\ud800-\\udfff",n="["+e+"]",t="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",r="\\ud83c[\\udffb-\\udfff]",o="[^"+e+"]",i="(?:\\ud83c[\\udde6-\\uddff]){2}",a="[\\ud800-\\udbff][\\udc00-\\udfff]",u="(?:"+t+"|"+r+")?",c="[\\ufe0e\\ufe0f]?",l=c+u+"(?:\\u200d(?:"+[o,i,a].join("|")+")"+c+u+")*",s="(?:"+[o+t+"?",t,i,a,n].join("|")+")",d=RegExp(r+"(?="+r+")|"+s+l,"g");return mv=function(e){for(var n=d.lastIndex=0;d.test(e);)++n;return n}}();return bv=function(r){return n(r)?t(r):e(r)}}();return _v=function(i){if(null==i)return 0;if(t(i))return r(i)?o(i):i.length;var a=n(i);return"[object Map]"==a||"[object Set]"==a?i.size:e(i).length}}function ty(){if(kv)return Sv;kv=1;var e=Dl(),n=yg(),t=Eg(),r=Gg(),o=cg(),i=Xl(),a=rs(),u=Ml(),c=Ol(),l=Bs();return Sv=function(s,d,f){var h=i(s),v=h||a(s)||l(s);if(d=r(d,4),null==f){var p=s&&s.constructor;f=v?h?new p:[]:c(s)&&u(p)?n(o(s)):{}}return(v?e:t)(s,(function(e,n,t){return d(f,e,n,t)})),f}}function ry(){if(Mv)return Ov;Mv=1;var e=ug(),n=function(){if(Cv)return Nv;Cv=1;var e=Nl(),n=Yl(),t=Xl(),r=e?e.isConcatSpreadable:void 0;return Nv=function(e){return t(e)||n(e)||!!(r&&e&&e[r])}}();return Ov=function t(r,o,i,a,u){var c=-1,l=r.length;for(i||(i=n),u||(u=[]);++c<l;){var s=r[c];o>0&&i(s)?o>1?t(s,o-1,i,a,u):e(u,s):a||(u[u.length]=s)}return u},Ov}function oy(){if(Av)return Pv;Av=1;var e=Iv?jv:(Iv=1,jv=function(e,n,t){switch(t.length){case 0:return e.call(n);case 1:return e.call(n,t[0]);case 2:return e.call(n,t[0],t[1]);case 3:return e.call(n,t[0],t[1],t[2])}return e.apply(n,t)}),n=Math.max;return Pv=function(t,r,o){return r=n(void 0===r?t.length-1:r,0),function(){for(var i=arguments,a=-1,u=n(i.length-r,0),c=Array(u);++a<u;)c[a]=i[r+a];a=-1;for(var l=Array(r+1);++a<r;)l[a]=i[a];return l[r]=o(c),e(t,this,l)}},Pv}function iy(){if(Vv)return Lv;Vv=1;var e=function(){if(Tv)return zv;Tv=1;var e=xg(),n=Ll(),t=kg();return zv=n?function(t,r){return n(t,"toString",{configurable:!0,enumerable:!1,value:e(r),writable:!0})}:t}(),n=function(){if(Dv)return Bv;Dv=1;var e=Date.now;return Bv=function(n){var t=0,r=0;return function(){var o=e(),i=16-(o-r);if(r=o,i>0){if(++t>=800)return arguments[0]}else t=0;return n.apply(void 0,arguments)}},Bv}(),t=n(e);return Lv=t}function ay(){if(Hv)return Rv;Hv=1;var e=kg(),n=oy(),t=iy();return Rv=function(r,o){return t(n(r,o,e),r+"")}}function uy(){return Yv?Zv:(Yv=1,Zv=function(e,n,t,r){for(var o=e.length,i=t+(r?1:-1);r?i--:++i<o;)if(n(e[i],i,e))return i;return-1})}function cy(){if(ip)return op;ip=1;var e=Mg(),n=function(){if(Kv)return qv;Kv=1;var e=function(){if(Wv)return $v;Wv=1;var e=uy(),n=Fv?Xv:(Fv=1,Xv=function(e){return e!=e}),t=Gv?Uv:(Gv=1,Uv=function(e,n,t){for(var r=t-1,o=e.length;++r<o;)if(e[r]===n)return r;return-1});return $v=function(r,o,i){return o==o?t(r,o,i):e(r,n,i)}}();return qv=function(n,t){return!(null==n||!n.length)&&e(n,t,0)>-1}}(),t=Jv?Qv:(Jv=1,Qv=function(e,n,t){for(var r=-1,o=null==e?0:e.length;++r<o;)if(t(n,e[r]))return!0;return!1}),r=jg(),o=function(){if(rp)return tp;rp=1;var e=fg(),n=np?ep:(np=1,ep=function(){}),t=Pg(),r=e&&1/t(new e([,-0]))[1]==1/0?function(n){return new e(n)}:n;return tp=r}(),i=Pg();return op=function(a,u,c){var l=-1,s=n,d=a.length,f=!0,h=[],v=h;if(c)f=!1,s=t;else if(d>=200){var p=u?null:o(a);if(p)return i(p);f=!1,s=r,v=new e}else v=u?[]:h;e:for(;++l<d;){var g=a[l],y=u?u(g):g;if(g=c||0!==g?g:0,f&&y==y){for(var m=v.length;m--;)if(v[m]===y)continue e;u&&v.push(y),h.push(g)}else s(v,y,c)||(v!==h&&v.push(y),h.push(g))}return h}}function ly(){if(up)return ap;up=1;var e=Hs(),n=Zl();return ap=function(t){return n(t)&&e(t)}}function sy(){if(lp)return cp;lp=1;var e=ry(),n=ay(),t=cy(),r=ly(),o=n((function(n){return t(e(n,1,r,!0))}));return cp=o}function dy(){if(hp)return fp;hp=1;var e=function(){if(dp)return sp;dp=1;var e=Vg();return sp=function(n,t){return e(t,(function(e){return n[e]}))}}(),n=Zs();return fp=function(t){return null==t?[]:e(t,n(t))}}function fy(){if(pp)return vp;var e;pp=1;try{e={clone:bg(),constant:xg(),each:Og(),filter:$g(),has:Wg(),isArray:Xl(),isEmpty:qg(),isFunction:Ml(),isUndefined:Kg(),keys:Zs(),map:Jg(),reduce:ey(),size:ny(),transform:ty(),union:sy(),values:dy()}}catch(e){}return e||(e=window._),vp=e}function hy(){if(yp)return gp;yp=1;var e=fy();gp=o;var n="\0",t="\0",r="";function o(n){this._isDirected=!e.has(n,"directed")||n.directed,this._isMultigraph=!!e.has(n,"multigraph")&&n.multigraph,this._isCompound=!!e.has(n,"compound")&&n.compound,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[t]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function i(e,n){e[n]?e[n]++:e[n]=1}function a(e,n){--e[n]||delete e[n]}function u(t,o,i,a){var u=""+o,c=""+i;if(!t&&u>c){var l=u;u=c,c=l}return u+r+c+r+(e.isUndefined(a)?n:a)}function c(e,n){return u(e,n.v,n.w,n.name)}return o.prototype._nodeCount=0,o.prototype._edgeCount=0,o.prototype.isDirected=function(){return this._isDirected},o.prototype.isMultigraph=function(){return this._isMultigraph},o.prototype.isCompound=function(){return this._isCompound},o.prototype.setGraph=function(e){return this._label=e,this},o.prototype.graph=function(){return this._label},o.prototype.setDefaultNodeLabel=function(n){return e.isFunction(n)||(n=e.constant(n)),this._defaultNodeLabelFn=n,this},o.prototype.nodeCount=function(){return this._nodeCount},o.prototype.nodes=function(){return e.keys(this._nodes)},o.prototype.sources=function(){var n=this;return e.filter(this.nodes(),(function(t){return e.isEmpty(n._in[t])}))},o.prototype.sinks=function(){var n=this;return e.filter(this.nodes(),(function(t){return e.isEmpty(n._out[t])}))},o.prototype.setNodes=function(n,t){var r=arguments,o=this;return e.each(n,(function(e){r.length>1?o.setNode(e,t):o.setNode(e)})),this},o.prototype.setNode=function(n,r){return e.has(this._nodes,n)?(arguments.length>1&&(this._nodes[n]=r),this):(this._nodes[n]=arguments.length>1?r:this._defaultNodeLabelFn(n),this._isCompound&&(this._parent[n]=t,this._children[n]={},this._children[t][n]=!0),this._in[n]={},this._preds[n]={},this._out[n]={},this._sucs[n]={},++this._nodeCount,this)},o.prototype.node=function(e){return this._nodes[e]},o.prototype.hasNode=function(n){return e.has(this._nodes,n)},o.prototype.removeNode=function(n){var t=this;if(e.has(this._nodes,n)){var r=function(e){t.removeEdge(t._edgeObjs[e])};delete this._nodes[n],this._isCompound&&(this._removeFromParentsChildList(n),delete this._parent[n],e.each(this.children(n),(function(e){t.setParent(e)})),delete this._children[n]),e.each(e.keys(this._in[n]),r),delete this._in[n],delete this._preds[n],e.each(e.keys(this._out[n]),r),delete this._out[n],delete this._sucs[n],--this._nodeCount}return this},o.prototype.setParent=function(n,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(r))r=t;else{for(var o=r+="";!e.isUndefined(o);o=this.parent(o))if(o===n)throw new Error("Setting "+r+" as parent of "+n+" would create a cycle");this.setNode(r)}return this.setNode(n),this._removeFromParentsChildList(n),this._parent[n]=r,this._children[r][n]=!0,this},o.prototype._removeFromParentsChildList=function(e){delete this._children[this._parent[e]][e]},o.prototype.parent=function(e){if(this._isCompound){var n=this._parent[e];if(n!==t)return n}},o.prototype.children=function(n){if(e.isUndefined(n)&&(n=t),this._isCompound){var r=this._children[n];if(r)return e.keys(r)}else{if(n===t)return this.nodes();if(this.hasNode(n))return[]}},o.prototype.predecessors=function(n){var t=this._preds[n];if(t)return e.keys(t)},o.prototype.successors=function(n){var t=this._sucs[n];if(t)return e.keys(t)},o.prototype.neighbors=function(n){var t=this.predecessors(n);if(t)return e.union(t,this.successors(n))},o.prototype.isLeaf=function(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length},o.prototype.filterNodes=function(n){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var r=this;e.each(this._nodes,(function(e,r){n(r)&&t.setNode(r,e)})),e.each(this._edgeObjs,(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,r.edge(e))}));var o={};function i(e){var n=r.parent(e);return void 0===n||t.hasNode(n)?(o[e]=n,n):n in o?o[n]:i(n)}return this._isCompound&&e.each(t.nodes(),(function(e){t.setParent(e,i(e))})),t},o.prototype.setDefaultEdgeLabel=function(n){return e.isFunction(n)||(n=e.constant(n)),this._defaultEdgeLabelFn=n,this},o.prototype.edgeCount=function(){return this._edgeCount},o.prototype.edges=function(){return e.values(this._edgeObjs)},o.prototype.setPath=function(n,t){var r=this,o=arguments;return e.reduce(n,(function(e,n){return o.length>1?r.setEdge(e,n,t):r.setEdge(e,n),n})),this},o.prototype.setEdge=function(){var n,t,r,o,a=!1,c=arguments[0];"object"==typeof c&&null!==c&&"v"in c?(n=c.v,t=c.w,r=c.name,2===arguments.length&&(o=arguments[1],a=!0)):(n=c,t=arguments[1],r=arguments[3],arguments.length>2&&(o=arguments[2],a=!0)),n=""+n,t=""+t,e.isUndefined(r)||(r=""+r);var l=u(this._isDirected,n,t,r);if(e.has(this._edgeLabels,l))return a&&(this._edgeLabels[l]=o),this;if(!e.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(n),this.setNode(t),this._edgeLabels[l]=a?o:this._defaultEdgeLabelFn(n,t,r);var s=function(e,n,t,r){var o=""+n,i=""+t;if(!e&&o>i){var a=o;o=i,i=a}var u={v:o,w:i};return r&&(u.name=r),u}(this._isDirected,n,t,r);return n=s.v,t=s.w,Object.freeze(s),this._edgeObjs[l]=s,i(this._preds[t],n),i(this._sucs[n],t),this._in[t][l]=s,this._out[n][l]=s,this._edgeCount++,this},o.prototype.edge=function(e,n,t){var r=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,e,n,t);return this._edgeLabels[r]},o.prototype.hasEdge=function(n,t,r){var o=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,n,t,r);return e.has(this._edgeLabels,o)},o.prototype.removeEdge=function(e,n,t){var r=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,e,n,t),o=this._edgeObjs[r];return o&&(e=o.v,n=o.w,delete this._edgeLabels[r],delete this._edgeObjs[r],a(this._preds[n],e),a(this._sucs[e],n),delete this._in[n][r],delete this._out[e][r],this._edgeCount--),this},o.prototype.inEdges=function(n,t){var r=this._in[n];if(r){var o=e.values(r);return t?e.filter(o,(function(e){return e.v===t})):o}},o.prototype.outEdges=function(n,t){var r=this._out[n];if(r){var o=e.values(r);return t?e.filter(o,(function(e){return e.w===t})):o}},o.prototype.nodeEdges=function(e,n){var t=this.inEdges(e,n);if(t)return t.concat(this.outEdges(e,n))},gp}function vy(){if(Ep)return _p;Ep=1;var e=fy(),n=hy();function t(n){return e.map(n.nodes(),(function(t){var r=n.node(t),o=n.parent(t),i={v:t};return e.isUndefined(r)||(i.value=r),e.isUndefined(o)||(i.parent=o),i}))}function r(n){return e.map(n.edges(),(function(t){var r=n.edge(t),o={v:t.v,w:t.w};return e.isUndefined(t.name)||(o.name=t.name),e.isUndefined(r)||(o.value=r),o}))}return _p={write:function(n){var o={options:{directed:n.isDirected(),multigraph:n.isMultigraph(),compound:n.isCompound()},nodes:t(n),edges:r(n)};return e.isUndefined(n.graph())||(o.value=e.clone(n.graph())),o},read:function(t){var r=new n(t.options).setGraph(t.value);return e.each(t.nodes,(function(e){r.setNode(e.v,e.value),e.parent&&r.setParent(e.v,e.parent)})),e.each(t.edges,(function(e){r.setEdge({v:e.v,w:e.w,name:e.name},e.value)})),r}}}function py(){if(kp)return Sp;kp=1;var e=fy();return Sp=function(n){var t,r={},o=[];function i(o){e.has(r,o)||(r[o]=!0,t.push(o),e.each(n.successors(o),i),e.each(n.predecessors(o),i))}return e.each(n.nodes(),(function(e){t=[],i(e),t.length&&o.push(t)})),o},Sp}function gy(){if(Cp)return Np;Cp=1;var e=fy();function n(){this._arr=[],this._keyIndices={}}return Np=n,n.prototype.size=function(){return this._arr.length},n.prototype.keys=function(){return this._arr.map((function(e){return e.key}))},n.prototype.has=function(n){return e.has(this._keyIndices,n)},n.prototype.priority=function(e){var n=this._keyIndices[e];if(void 0!==n)return this._arr[n].priority},n.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},n.prototype.add=function(n,t){var r=this._keyIndices;if(n=String(n),!e.has(r,n)){var o=this._arr,i=o.length;return r[n]=i,o.push({key:n,priority:t}),this._decrease(i),!0}return!1},n.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},n.prototype.decrease=function(e,n){var t=this._keyIndices[e];if(n>this._arr[t].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[t].priority+" New: "+n);this._arr[t].priority=n,this._decrease(t)},n.prototype._heapify=function(e){var n=this._arr,t=2*e,r=t+1,o=e;t<n.length&&(o=n[t].priority<n[o].priority?t:o,r<n.length&&(o=n[r].priority<n[o].priority?r:o),o!==e&&(this._swap(e,o),this._heapify(o)))},n.prototype._decrease=function(e){for(var n,t=this._arr,r=t[e].priority;0!==e&&!(t[n=e>>1].priority<r);)this._swap(e,n),e=n},n.prototype._swap=function(e,n){var t=this._arr,r=this._keyIndices,o=t[e],i=t[n];t[e]=i,t[n]=o,r[i.key]=e,r[o.key]=n},Np}function yy(){if(Mp)return Op;Mp=1;var e=fy(),n=gy();Op=function(e,r,o,i){return function(e,t,r,o){var i,a,u={},c=new n,l=function(e){var n=e.v!==i?e.v:e.w,t=u[n],o=r(e),l=a.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+o);l<t.distance&&(t.distance=l,t.predecessor=i,c.decrease(n,l))};for(e.nodes().forEach((function(e){var n=e===t?0:Number.POSITIVE_INFINITY;u[e]={distance:n},c.add(e,n)}));c.size()>0&&(i=c.removeMin(),(a=u[i]).distance!==Number.POSITIVE_INFINITY);)o(i).forEach(l);return u}(e,String(r),o||t,i||function(n){return e.outEdges(n)})};var t=e.constant(1);return Op}function my(){if(Ip)return jp;Ip=1;var e=yy(),n=fy();return jp=function(t,r,o){return n.transform(t.nodes(),(function(n,i){n[i]=e(t,i,r,o)}),{})}}function wy(){if(Ap)return Pp;Ap=1;var e=fy();return Pp=function(n){var t=0,r=[],o={},i=[];function a(u){var c=o[u]={onStack:!0,lowlink:t,index:t++};if(r.push(u),n.successors(u).forEach((function(n){e.has(o,n)?o[n].onStack&&(c.lowlink=Math.min(c.lowlink,o[n].index)):(a(n),c.lowlink=Math.min(c.lowlink,o[n].lowlink))})),c.lowlink===c.index){var l,s=[];do{l=r.pop(),o[l].onStack=!1,s.push(l)}while(u!==l);i.push(s)}}return n.nodes().forEach((function(n){e.has(o,n)||a(n)})),i},Pp}function by(){if(Tp)return zp;Tp=1;var e=fy(),n=wy();return zp=function(t){return e.filter(n(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}}function xy(){if(Dp)return Bp;Dp=1;var e=fy();Bp=function(e,t,r){return function(e,n,t){var r={},o=e.nodes();return o.forEach((function(e){r[e]={},r[e][e]={distance:0},o.forEach((function(n){e!==n&&(r[e][n]={distance:Number.POSITIVE_INFINITY})})),t(e).forEach((function(t){var o=t.v===e?t.w:t.v,i=n(t);r[e][o]={distance:i,predecessor:e}}))})),o.forEach((function(e){var n=r[e];o.forEach((function(t){var i=r[t];o.forEach((function(t){var r=i[e],o=n[t],a=i[t],u=r.distance+o.distance;u<a.distance&&(a.distance=u,a.predecessor=o.predecessor)}))}))})),r}(e,t||n,r||function(n){return e.outEdges(n)})};var n=e.constant(1);return Bp}function _y(){if(Vp)return Lp;Vp=1;var e=fy();function n(n){var r={},o={},i=[];if(e.each(n.sinks(),(function a(u){if(e.has(o,u))throw new t;e.has(r,u)||(o[u]=!0,r[u]=!0,e.each(n.predecessors(u),a),delete o[u],i.push(u))})),e.size(r)!==n.nodeCount())throw new t;return i}function t(){}return Lp=n,n.CycleException=t,t.prototype=new Error,Lp}function Ey(){if(Hp)return Rp;Hp=1;var e=_y();return Rp=function(n){try{e(n)}catch(n){if(n instanceof e.CycleException)return!1;throw n}return!0}}function Sy(){if(Yp)return Zp;Yp=1;var e=fy();function n(t,r,o,i,a,u){e.has(i,r)||(i[r]=!0,o||u.push(r),e.each(a(r),(function(e){n(t,e,o,i,a,u)})),o&&u.push(r))}return Zp=function(t,r,o){e.isArray(r)||(r=[r]);var i=(t.isDirected()?t.successors:t.neighbors).bind(t),a=[],u={};return e.each(r,(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);n(t,e,"post"===o,u,i,a)})),a},Zp}function ky(){if(Fp)return Xp;Fp=1;var e=Sy();return Xp=function(n,t){return e(n,t,"post")}}function Ny(){if(Gp)return Up;Gp=1;var e=Sy();return Up=function(n,t){return e(n,t,"pre")}}function Cy(){if(Wp)return $p;Wp=1;var e=fy(),n=hy(),t=gy();return $p=function(r,o){var i,a=new n,u={},c=new t;function l(e){var n=e.v===i?e.w:e.v,t=c.priority(n);if(void 0!==t){var r=o(e);r<t&&(u[n]=i,c.decrease(n,r))}}if(0===r.nodeCount())return a;e.each(r.nodes(),(function(e){c.add(e,Number.POSITIVE_INFINITY),a.setNode(e)})),c.decrease(r.nodes()[0],0);for(var s=!1;c.size()>0;){if(i=c.removeMin(),e.has(u,i))a.setEdge(i,u[i]);else{if(s)throw new Error("Input graph is not connected: "+r);s=!0}r.nodeEdges(i).forEach(l)}return a}}ng.exports;try{eg=function(){if(Jp)return Qp;Jp=1;var e=xp?bp:(xp=1,bp={Graph:hy(),version:wp?mp:(wp=1,mp="2.1.8")});return Qp={Graph:e.Graph,json:vy(),alg:Kp?qp:(Kp=1,qp={components:py(),dijkstra:yy(),dijkstraAll:my(),findCycles:by(),floydWarshall:xy(),isAcyclic:Ey(),postorder:ky(),preorder:Ny(),prim:Cy(),tarjan:wy(),topsort:_y()}),version:e.version}}()}catch(bu){}eg||(eg=window.graphlib);var Oy,My,jy,Iy,Py,Ay,zy,Ty,By,Dy,Ly,Vy,Ry,Hy,Zy,Yy,Xy,Fy,Uy,Gy,$y,Wy,qy,Ky,Qy,Jy,em,nm,tm,rm,om,im,am,um,cm,lm,sm,dm,fm,hm,vm,pm,gm,ym,mm,wm,bm,xm,_m,Em,Sm,km,Nm,Cm,Om,Mm,jm,Im,Pm,Am,zm,Tm,Bm,Dm,Lm,Vm,Rm,Hm,Zm,Ym,Xm,Fm,Um,Gm,$m,Wm,qm,Km,Qm,Jm,ew,nw,tw,rw,ow,iw,aw,uw,cw,lw,sw,dw,fw,hw=eg;function vw(){if(Iy)return jy;Iy=1;var e=xl(),n=Hs(),t=os(),r=Ol();return jy=function(o,i,a){if(!r(a))return!1;var u=typeof i;return!!("number"==u?n(a)&&t(i,a.length):"string"==u&&i in a)&&e(a[i],o)}}function pw(){if(Yy)return Zy;Yy=1;var e=function(){if(Hy)return Ry;Hy=1;var e=function(){if(Vy)return Ly;Vy=1;var e=function(){if(Dy)return By;Dy=1;var e=/\s/;return By=function(n){for(var t=n.length;t--&&e.test(n.charAt(t)););return t}}(),n=/^\s+/;return Ly=function(t){return t?t.slice(0,e(t)+1).replace(n,""):t}}(),n=Ol(),t=Dg(),r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt;return Ry=function(u){if("number"==typeof u)return u;if(t(u))return NaN;if(n(u)){var c="function"==typeof u.valueOf?u.valueOf():u;u=n(c)?c+"":c}if("string"!=typeof u)return 0===u?u:+u;u=e(u);var l=o.test(u);return l||i.test(u)?a(u.slice(2),l?2:8):r.test(u)?NaN:+u}}(),n=1/0;return Zy=function(t){return t?(t=e(t))===n||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}}function gw(){if(Ky)return qy;Ky=1;var e=ry();return qy=function(n){return null!=n&&n.length?e(n,1):[]}}function yw(){if(im)return om;im=1;var e=Dg();return om=function(n,t,r){for(var o=-1,i=n.length;++o<i;){var a=n[o],u=t(a);if(null!=u&&(void 0===c?u==u&&!e(u):r(u,c)))var c=u,l=a}return l}}function mw(){if(dm)return sm;dm=1;var e=Vl(),n=xl();return sm=function(t,r,o){(void 0!==o&&!n(t[r],o)||void 0===o&&!(r in t))&&e(t,r,o)}}function ww(){return pm?vm:(pm=1,vm=function(e,n){if(("constructor"!==n||"function"!=typeof e[n])&&"__proto__"!=n)return e[n]})}function bw(){return Cm?Nm:(Cm=1,Nm=function(e,n){return e<n})}function xw(){if(rw)return tw;rw=1;var e=Vg(),n=Yg(),t=Gg(),r=Qg(),o=Km?qm:(Km=1,qm=function(e,n){var t=e.length;for(e.sort(n);t--;)e[t]=e[t].value;return e}),i=as(),a=function(){if(nw)return ew;nw=1;var e=function(){if(Jm)return Qm;Jm=1;var e=Dg();return Qm=function(n,t){if(n!==t){var r=void 0!==n,o=null===n,i=n==n,a=e(n),u=void 0!==t,c=null===t,l=t==t,s=e(t);if(!c&&!s&&!a&&n>t||a&&u&&l&&!c&&!s||o&&u&&l||!r&&l||!i)return 1;if(!o&&!a&&!s&&n<t||s&&r&&i&&!o&&!a||c&&r&&i||!u&&i||!l)return-1}return 0}}();return ew=function(n,t,r){for(var o=-1,i=n.criteria,a=t.criteria,u=i.length,c=r.length;++o<u;){var l=e(i[o],a[o]);if(l)return o>=c?l:l*("desc"==r[o]?-1:1)}return n.index-t.index}}(),u=kg(),c=Xl();return tw=function(l,s,d){s=s.length?e(s,(function(e){return c(e)?function(t){return n(t,1===e.length?e[0]:e)}:e})):[u];var f=-1;s=e(s,i(t));var h=r(l,(function(n,t,r){return{criteria:e(s,(function(e){return e(n)})),index:++f,value:n}}));return o(h,(function(e,n){return a(e,n,d)}))}}try{fw={cloneDeep:function(){if(My)return Oy;My=1;var e=wg();return Oy=function(n){return e(n,5)}}(),constant:xg(),defaults:function(){if(Ay)return Py;Ay=1;var e=ay(),n=xl(),t=vw(),r=Ys(),o=Object.prototype,i=o.hasOwnProperty,a=e((function(e,a){e=Object(e);var u=-1,c=a.length,l=c>2?a[2]:void 0;for(l&&t(a[0],a[1],l)&&(c=1);++u<c;)for(var s=a[u],d=r(s),f=-1,h=d.length;++f<h;){var v=d[f],p=e[v];(void 0===p||n(p,o[v])&&!i.call(e,v))&&(e[v]=s[v])}return e}));return Py=a}(),each:Og(),filter:$g(),find:function(){if(Wy)return $y;Wy=1;var e=function(){if(Ty)return zy;Ty=1;var e=Gg(),n=Hs(),t=Zs();return zy=function(r){return function(o,i,a){var u=Object(o);if(!n(o)){var c=e(i,3);o=t(o),i=function(e){return c(u[e],e,u)}}var l=r(o,i,a);return l>-1?u[c?o[l]:l]:void 0}}}()(function(){if(Gy)return Uy;Gy=1;var e=uy(),n=Gg(),t=function(){if(Fy)return Xy;Fy=1;var e=pw();return Xy=function(n){var t=e(n),r=t%1;return t==t?r?t-r:t:0}}(),r=Math.max;return Uy=function(o,i,a){var u=null==o?0:o.length;if(!u)return-1;var c=null==a?0:t(a);return c<0&&(c=r(u+c,0)),e(o,n(i,3),c)}}());return $y=e}(),flatten:gw(),forEach:Cg(),forIn:function(){if(Jy)return Qy;Jy=1;var e=_g(),n=Ng(),t=Ys();return Qy=function(r,o){return null==r?r:e(r,n(o),t)}}(),has:Wg(),isUndefined:Kg(),last:nm?em:(nm=1,em=function(e){var n=null==e?0:e.length;return n?e[n-1]:void 0}),map:Jg(),mapValues:function(){if(rm)return tm;rm=1;var e=Vl(),n=Eg(),t=Gg();return tm=function(r,o){var i={};return o=t(o,3),n(r,(function(n,t,r){e(i,t,o(n,t,r))})),i}}(),max:function(){if(lm)return cm;lm=1;var e=yw(),n=um?am:(um=1,am=function(e,n){return e>n}),t=kg();return cm=function(r){return r&&r.length?e(r,t,n):void 0}}(),merge:function(){if(km)return Sm;km=1;var e=function(){if(xm)return bm;xm=1;var e=Bl(),n=mw(),t=_g(),r=function(){if(wm)return mm;wm=1;var e=mw(),n=tg(),t=gg(),r=rg(),o=mg(),i=Yl(),a=Xl(),u=ly(),c=rs(),l=Ml(),s=Ol(),d=function(){if(hm)return fm;hm=1;var e=Cl(),n=cg(),t=Zl(),r=Function.prototype,o=Object.prototype,i=r.toString,a=o.hasOwnProperty,u=i.call(Object);return fm=function(r){if(!t(r)||"[object Object]"!=e(r))return!1;var o=n(r);if(null===o)return!0;var c=a.call(o,"constructor")&&o.constructor;return"function"==typeof c&&c instanceof c&&i.call(c)==u}}(),f=Bs(),h=ww(),v=function(){if(ym)return gm;ym=1;var e=Hl(),n=Ys();return gm=function(t){return e(t,n(t))}}();return mm=function(p,g,y,m,w,b,x){var _=h(p,y),E=h(g,y),S=x.get(E);if(S)e(p,y,S);else{var k=b?b(_,E,y+"",p,g,x):void 0,N=void 0===k;if(N){var C=a(E),O=!C&&c(E),M=!C&&!O&&f(E);k=E,C||O||M?a(_)?k=_:u(_)?k=r(_):O?(N=!1,k=n(E,!0)):M?(N=!1,k=t(E,!0)):k=[]:d(E)||i(E)?(k=_,i(_)?k=v(_):s(_)&&!l(_)||(k=o(E))):N=!1}N&&(x.set(E,k),w(k,E,m,b,x),x.delete(E)),e(p,y,k)}}}(),o=Ol(),i=Ys(),a=ww();return bm=function u(c,l,s,d,f){c!==l&&t(l,(function(t,i){if(f||(f=new e),o(t))r(c,l,i,s,u,d,f);else{var h=d?d(a(c,i),t,i+"",c,l,f):void 0;void 0===h&&(h=t),n(c,i,h)}}),i)},bm}(),n=function(){if(Em)return _m;Em=1;var e=ay(),n=vw();return _m=function(t){return e((function(e,r){var o=-1,i=r.length,a=i>1?r[i-1]:void 0,u=i>2?r[2]:void 0;for(a=t.length>3&&"function"==typeof a?(i--,a):void 0,u&&n(r[0],r[1],u)&&(a=i<3?void 0:a,i=1),e=Object(e);++o<i;){var c=r[o];c&&t(e,c,o,a)}return e}))}}()((function(n,t,r){e(n,t,r)}));return Sm=n}(),min:function(){if(Mm)return Om;Mm=1;var e=yw(),n=bw(),t=kg();return Om=function(r){return r&&r.length?e(r,t,n):void 0}}(),minBy:function(){if(Im)return jm;Im=1;var e=yw(),n=Gg(),t=bw();return jm=function(r,o){return r&&r.length?e(r,n(o,2),t):void 0}}(),now:function(){if(Am)return Pm;Am=1;var e=kl();return Pm=function(){return e.Date.now()}}(),pick:function(){if(Ym)return Zm;Ym=1;var e=function(){if(Vm)return Lm;Vm=1;var e=function(){if(Dm)return Bm;Dm=1;var e=Yg(),n=function(){if(Tm)return zm;Tm=1;var e=Rl(),n=Hg(),t=os(),r=Ol(),o=Zg();return zm=function(i,a,u,c){if(!r(i))return i;for(var l=-1,s=(a=n(a,i)).length,d=s-1,f=i;null!=f&&++l<s;){var h=o(a[l]),v=u;if("__proto__"===h||"constructor"===h||"prototype"===h)return i;if(l!=d){var p=f[h];void 0===(v=c?c(p,h,f):void 0)&&(v=r(p)?p:t(a[l+1])?[]:{})}e(f,h,v),f=f[h]}return i}}(),t=Hg();return Bm=function(r,o,i){for(var a=-1,u=o.length,c={};++a<u;){var l=o[a],s=e(r,l);i(s,l)&&n(c,t(l,r),s)}return c}}(),n=Fg();return Lm=function(t,r){return e(t,r,(function(e,r){return n(t,r)}))}}(),n=function(){if(Hm)return Rm;Hm=1;var e=gw(),n=oy(),t=iy();return Rm=function(r){return t(n(r,void 0,e),r+"")}}()((function(n,t){return null==n?{}:e(n,t)}));return Zm=n}(),range:function(){if(Wm)return $m;Wm=1;var e=function(){if(Gm)return Um;Gm=1;var e=function(){if(Fm)return Xm;Fm=1;var e=Math.ceil,n=Math.max;return Xm=function(t,r,o,i){for(var a=-1,u=n(e((r-t)/(o||1)),0),c=Array(u);u--;)c[i?u:++a]=t,t+=o;return c}}(),n=vw(),t=pw();return Um=function(r){return function(o,i,a){return a&&"number"!=typeof a&&n(o,i,a)&&(i=a=void 0),o=t(o),void 0===i?(i=o,o=0):i=t(i),a=void 0===a?o<i?1:-1:t(a),e(o,i,a,r)}}}()();return $m=e}(),reduce:ey(),sortBy:function(){if(iw)return ow;iw=1;var e=ry(),n=xw(),t=ay(),r=vw(),o=t((function(t,o){if(null==t)return[];var i=o.length;return i>1&&r(t,o[0],o[1])?o=[]:i>2&&r(o[0],o[1],o[2])&&(o=[o[0]]),n(t,e(o,1),[])}));return ow=o}(),uniqueId:function(){if(uw)return aw;uw=1;var e=Rg(),n=0;return aw=function(t){var r=++n;return e(t)+r}}(),values:dy(),zipObject:function(){if(dw)return sw;dw=1;var e=Rl(),n=lw?cw:(lw=1,cw=function(e,n,t){for(var r=-1,o=e.length,i=n.length,a={};++r<o;){var u=r<i?n[r]:void 0;t(a,e[r],u)}return a});return sw=function(t,r){return n(t||[],r||[],e)}}()}}catch(bu){}fw||(fw=window._);var _w=fw,Ew=Sw;function Sw(){var e={};e._next=e._prev=e,this._sentinel=e}function kw(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Nw(e,n){if("_next"!==e&&"_prev"!==e)return n}Sw.prototype.dequeue=function(){var e=this._sentinel,n=e._prev;if(n!==e)return kw(n),n},Sw.prototype.enqueue=function(e){var n=this._sentinel;e._prev&&e._next&&kw(e),e._next=n._next,n._next._prev=e,n._next=e,e._prev=n},Sw.prototype.toString=function(){for(var e=[],n=this._sentinel,t=n._prev;t!==n;)e.push(JSON.stringify(t,Nw)),t=t._prev;return"["+e.join(", ")+"]"};var Cw=_w,Ow=hw.Graph,Mw=Ew,jw=Cw.constant(1);function Iw(e,n,t,r,o){var i=o?[]:void 0;return Cw.forEach(e.inEdges(r.v),(function(r){var a=e.edge(r),u=e.node(r.v);o&&i.push({v:r.v,w:r.w}),u.out-=a,Pw(n,t,u)})),Cw.forEach(e.outEdges(r.v),(function(r){var o=e.edge(r),i=r.w,a=e.node(i);a.in-=o,Pw(n,t,a)})),e.removeNode(r.v),i}function Pw(e,n,t){t.out?t.in?e[t.out-t.in+n].enqueue(t):e[e.length-1].enqueue(t):e[0].enqueue(t)}var Aw=_w,zw=function(e,n){if(e.nodeCount()<=1)return[];var t=function(e,n){var t=new Ow,r=0,o=0;Cw.forEach(e.nodes(),(function(e){t.setNode(e,{v:e,in:0,out:0})})),Cw.forEach(e.edges(),(function(e){var i=t.edge(e.v,e.w)||0,a=n(e),u=i+a;t.setEdge(e.v,e.w,u),o=Math.max(o,t.node(e.v).out+=a),r=Math.max(r,t.node(e.w).in+=a)}));var i=Cw.range(o+r+3).map((function(){return new Mw})),a=r+1;return Cw.forEach(t.nodes(),(function(e){Pw(i,a,t.node(e))})),{graph:t,buckets:i,zeroIdx:a}}(e,n||jw),r=function(e,n,t){for(var r,o=[],i=n[n.length-1],a=n[0];e.nodeCount();){for(;r=a.dequeue();)Iw(e,n,t,r);for(;r=i.dequeue();)Iw(e,n,t,r);if(e.nodeCount())for(var u=n.length-2;u>0;--u)if(r=n[u].dequeue()){o=o.concat(Iw(e,n,t,r,!0));break}}return o}(t.graph,t.buckets,t.zeroIdx);return Cw.flatten(Cw.map(r,(function(n){return e.outEdges(n.v,n.w)})),!0)},Tw={run:function(e){var n="greedy"===e.graph().acyclicer?zw(e,function(e){return function(n){return e.edge(n).weight}}(e)):function(e){var n=[],t={},r={};return Aw.forEach(e.nodes(),(function o(i){Aw.has(r,i)||(r[i]=!0,t[i]=!0,Aw.forEach(e.outEdges(i),(function(e){Aw.has(t,e.w)?n.push(e):o(e.w)})),delete t[i])})),n}(e);Aw.forEach(n,(function(n){var t=e.edge(n);e.removeEdge(n),t.forwardName=n.name,t.reversed=!0,e.setEdge(n.w,n.v,t,Aw.uniqueId("rev"))}))},undo:function(e){Aw.forEach(e.edges(),(function(n){var t=e.edge(n);if(t.reversed){e.removeEdge(n);var r=t.forwardName;delete t.reversed,delete t.forwardName,e.setEdge(n.w,n.v,t,r)}}))}},Bw=_w,Dw=hw.Graph,Lw={addDummyNode:Vw,simplify:function(e){var n=(new Dw).setGraph(e.graph());return Bw.forEach(e.nodes(),(function(t){n.setNode(t,e.node(t))})),Bw.forEach(e.edges(),(function(t){var r=n.edge(t.v,t.w)||{weight:0,minlen:1},o=e.edge(t);n.setEdge(t.v,t.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})})),n},asNonCompoundGraph:function(e){var n=new Dw({multigraph:e.isMultigraph()}).setGraph(e.graph());return Bw.forEach(e.nodes(),(function(t){e.children(t).length||n.setNode(t,e.node(t))})),Bw.forEach(e.edges(),(function(t){n.setEdge(t,e.edge(t))})),n},successorWeights:function(e){var n=Bw.map(e.nodes(),(function(n){var t={};return Bw.forEach(e.outEdges(n),(function(n){t[n.w]=(t[n.w]||0)+e.edge(n).weight})),t}));return Bw.zipObject(e.nodes(),n)},predecessorWeights:function(e){var n=Bw.map(e.nodes(),(function(n){var t={};return Bw.forEach(e.inEdges(n),(function(n){t[n.v]=(t[n.v]||0)+e.edge(n).weight})),t}));return Bw.zipObject(e.nodes(),n)},intersectRect:function(e,n){var t,r,o=e.x,i=e.y,a=n.x-o,u=n.y-i,c=e.width/2,l=e.height/2;if(!a&&!u)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(u)*c>Math.abs(a)*l?(u<0&&(l=-l),t=l*a/u,r=l):(a<0&&(c=-c),t=c,r=c*u/a),{x:o+t,y:i+r}},buildLayerMatrix:function(e){var n=Bw.map(Bw.range(Rw(e)+1),(function(){return[]}));return Bw.forEach(e.nodes(),(function(t){var r=e.node(t),o=r.rank;Bw.isUndefined(o)||(n[o][r.order]=t)})),n},normalizeRanks:function(e){var n=Bw.min(Bw.map(e.nodes(),(function(n){return e.node(n).rank})));Bw.forEach(e.nodes(),(function(t){var r=e.node(t);Bw.has(r,"rank")&&(r.rank-=n)}))},removeEmptyRanks:function(e){var n=Bw.min(Bw.map(e.nodes(),(function(n){return e.node(n).rank}))),t=[];Bw.forEach(e.nodes(),(function(r){var o=e.node(r).rank-n;t[o]||(t[o]=[]),t[o].push(r)}));var r=0,o=e.graph().nodeRankFactor;Bw.forEach(t,(function(n,t){Bw.isUndefined(n)&&t%o!=0?--r:r&&Bw.forEach(n,(function(n){e.node(n).rank+=r}))}))},addBorderNode:function(e,n,t,r){var o={width:0,height:0};return arguments.length>=4&&(o.rank=t,o.order=r),Vw(e,"border",o,n)},maxRank:Rw,partition:function(e,n){var t={lhs:[],rhs:[]};return Bw.forEach(e,(function(e){n(e)?t.lhs.push(e):t.rhs.push(e)})),t},time:function(e,n){var t=Bw.now();try{return n()}finally{console.log(e+" time: "+(Bw.now()-t)+"ms")}},notime:function(e,n){return n()}};function Vw(e,n,t,r){var o;do{o=Bw.uniqueId(r)}while(e.hasNode(o));return t.dummy=n,e.setNode(o,t),o}function Rw(e){return Bw.max(Bw.map(e.nodes(),(function(n){var t=e.node(n).rank;if(!Bw.isUndefined(t))return t})))}var Hw=_w,Zw=Lw,Yw={run:function(e){e.graph().dummyChains=[],Hw.forEach(e.edges(),(function(n){!function(e,n){var t,r,o,i=n.v,a=e.node(i).rank,u=n.w,c=e.node(u).rank,l=n.name,s=e.edge(n),d=s.labelRank;if(c!==a+1){for(e.removeEdge(n),o=0,++a;a<c;++o,++a)s.points=[],r={width:0,height:0,edgeLabel:s,edgeObj:n,rank:a},t=Zw.addDummyNode(e,"edge",r,"_d"),a===d&&(r.width=s.width,r.height=s.height,r.dummy="edge-label",r.labelpos=s.labelpos),e.setEdge(i,t,{weight:s.weight},l),0===o&&e.graph().dummyChains.push(t),i=t;e.setEdge(i,u,{weight:s.weight},l)}}(e,n)}))},undo:function(e){Hw.forEach(e.graph().dummyChains,(function(n){var t,r=e.node(n),o=r.edgeLabel;for(e.setEdge(r.edgeObj,o);r.dummy;)t=e.successors(n)[0],e.removeNode(n),o.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(o.x=r.x,o.y=r.y,o.width=r.width,o.height=r.height),n=t,r=e.node(n)}))}},Xw=_w,Fw=function(e){var n={};Xw.forEach(e.sources(),(function t(r){var o=e.node(r);if(Xw.has(n,r))return o.rank;n[r]=!0;var i=Xw.min(Xw.map(e.outEdges(r),(function(n){return t(n.w)-e.edge(n).minlen})));return i!==Number.POSITIVE_INFINITY&&null!=i||(i=0),o.rank=i}))},Uw=function(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen},Gw=_w,$w=hw.Graph,Ww=Uw,qw=function(e){var n,t,r=new $w({directed:!1}),o=e.nodes()[0],i=e.nodeCount();for(r.setNode(o,{});Kw(r,e)<i;)n=Qw(r,e),t=r.hasNode(n.v)?Ww(e,n):-Ww(e,n),Jw(r,e,t);return r};function Kw(e,n){return Gw.forEach(e.nodes(),(function t(r){Gw.forEach(n.nodeEdges(r),(function(o){var i=o.v,a=r===i?o.w:i;e.hasNode(a)||Ww(n,o)||(e.setNode(a,{}),e.setEdge(r,a,{}),t(a))}))})),e.nodeCount()}function Qw(e,n){return Gw.minBy(n.edges(),(function(t){if(e.hasNode(t.v)!==e.hasNode(t.w))return Ww(n,t)}))}function Jw(e,n,t){Gw.forEach(e.nodes(),(function(e){n.node(e).rank+=t}))}var eb=_w,nb=qw,tb=Uw,rb=Fw,ob=hw.alg.preorder,ib=hw.alg.postorder,ab=Lw.simplify,ub=cb;function cb(e){e=ab(e),rb(e);var n,t=nb(e);for(db(t),lb(t,e);n=hb(t);)pb(t,e,n,vb(t,e,n))}function lb(e,n){var t=ib(e,e.nodes());t=t.slice(0,t.length-1),eb.forEach(t,(function(t){!function(e,n,t){var r=e.node(t).parent;e.edge(t,r).cutvalue=sb(e,n,t)}(e,n,t)}))}function sb(e,n,t){var r=e.node(t).parent,o=!0,i=n.edge(t,r),a=0;return i||(o=!1,i=n.edge(r,t)),a=i.weight,eb.forEach(n.nodeEdges(t),(function(i){var u,c,l=i.v===t,s=l?i.w:i.v;if(s!==r){var d=l===o,f=n.edge(i).weight;if(a+=d?f:-f,u=t,c=s,e.hasEdge(u,c)){var h=e.edge(t,s).cutvalue;a+=d?-h:h}}})),a}function db(e,n){arguments.length<2&&(n=e.nodes()[0]),fb(e,{},1,n)}function fb(e,n,t,r,o){var i=t,a=e.node(r);return n[r]=!0,eb.forEach(e.neighbors(r),(function(o){eb.has(n,o)||(t=fb(e,n,t,o,r))})),a.low=i,a.lim=t++,o?a.parent=o:delete a.parent,t}function hb(e){return eb.find(e.edges(),(function(n){return e.edge(n).cutvalue<0}))}function vb(e,n,t){var r=t.v,o=t.w;n.hasEdge(r,o)||(r=t.w,o=t.v);var i=e.node(r),a=e.node(o),u=i,c=!1;i.lim>a.lim&&(u=a,c=!0);var l=eb.filter(n.edges(),(function(n){return c===gb(e,e.node(n.v),u)&&c!==gb(e,e.node(n.w),u)}));return eb.minBy(l,(function(e){return tb(n,e)}))}function pb(e,n,t,r){var o=t.v,i=t.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),db(e),lb(e,n),function(e,n){var t=eb.find(e.nodes(),(function(e){return!n.node(e).parent})),r=ob(e,t);r=r.slice(1),eb.forEach(r,(function(t){var r=e.node(t).parent,o=n.edge(t,r),i=!1;o||(o=n.edge(r,t),i=!0),n.node(t).rank=n.node(r).rank+(i?o.minlen:-o.minlen)}))}(e,n)}function gb(e,n,t){return t.low<=n.lim&&n.lim<=t.lim}cb.initLowLimValues=db,cb.initCutValues=lb,cb.calcCutValue=sb,cb.leaveEdge=hb,cb.enterEdge=vb,cb.exchangeEdges=pb;var yb=Fw,mb=qw,wb=ub,bb=yb;var xb=_w,_b=_w,Eb=Lw,Sb={run:function(e){var n=Eb.addDummyNode(e,"root",{},"_root"),t=function(e){var n={};function t(r,o){var i=e.children(r);i&&i.length&&_b.forEach(i,(function(e){t(e,o+1)})),n[r]=o}return _b.forEach(e.children(),(function(e){t(e,1)})),n}(e),r=_b.max(_b.values(t))-1,o=2*r+1;e.graph().nestingRoot=n,_b.forEach(e.edges(),(function(n){e.edge(n).minlen*=o}));var i=function(e){return _b.reduce(e.edges(),(function(n,t){return n+e.edge(t).weight}),0)}(e)+1;_b.forEach(e.children(),(function(a){kb(e,n,o,i,r,t,a)})),e.graph().nodeRankFactor=o},cleanup:function(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,_b.forEach(e.edges(),(function(n){e.edge(n).nestingEdge&&e.removeEdge(n)}))}};function kb(e,n,t,r,o,i,a){var u=e.children(a);if(u.length){var c=Eb.addBorderNode(e,"_bt"),l=Eb.addBorderNode(e,"_bb"),s=e.node(a);e.setParent(c,a),s.borderTop=c,e.setParent(l,a),s.borderBottom=l,_b.forEach(u,(function(u){kb(e,n,t,r,o,i,u);var s=e.node(u),d=s.borderTop?s.borderTop:u,f=s.borderBottom?s.borderBottom:u,h=s.borderTop?r:2*r,v=d!==f?1:o-i[a]+1;e.setEdge(c,d,{weight:h,minlen:v,nestingEdge:!0}),e.setEdge(f,l,{weight:h,minlen:v,nestingEdge:!0})})),e.parent(a)||e.setEdge(n,c,{weight:0,minlen:o+i[a]})}else a!==n&&e.setEdge(n,a,{weight:0,minlen:t})}var Nb=_w,Cb=Lw;function Ob(e,n,t,r,o,i){var a={width:0,height:0,rank:i,borderType:n},u=o[n][i-1],c=Cb.addDummyNode(e,"border",a,t);o[n][i]=c,e.setParent(c,r),u&&e.setEdge(u,c,{weight:1})}var Mb=_w,jb={adjust:function(e){var n=e.graph().rankdir.toLowerCase();"lr"!==n&&"rl"!==n||Ib(e)},undo:function(e){var n=e.graph().rankdir.toLowerCase();"bt"!==n&&"rl"!==n||function(e){Mb.forEach(e.nodes(),(function(n){Ab(e.node(n))})),Mb.forEach(e.edges(),(function(n){var t=e.edge(n);Mb.forEach(t.points,Ab),Mb.has(t,"y")&&Ab(t)}))}(e),"lr"!==n&&"rl"!==n||(function(e){Mb.forEach(e.nodes(),(function(n){zb(e.node(n))})),Mb.forEach(e.edges(),(function(n){var t=e.edge(n);Mb.forEach(t.points,zb),Mb.has(t,"x")&&zb(t)}))}(e),Ib(e))}};function Ib(e){Mb.forEach(e.nodes(),(function(n){Pb(e.node(n))})),Mb.forEach(e.edges(),(function(n){Pb(e.edge(n))}))}function Pb(e){var n=e.width;e.width=e.height,e.height=n}function Ab(e){e.y=-e.y}function zb(e){var n=e.x;e.x=e.y,e.y=n}var Tb=_w,Bb=_w;function Db(e,n,t){for(var r=Bb.zipObject(t,Bb.map(t,(function(e,n){return n}))),o=Bb.flatten(Bb.map(n,(function(n){return Bb.sortBy(Bb.map(e.outEdges(n),(function(n){return{pos:r[n.w],weight:e.edge(n).weight}})),"pos")})),!0),i=1;i<t.length;)i<<=1;var a=2*i-1;i-=1;var u=Bb.map(new Array(a),(function(){return 0})),c=0;return Bb.forEach(o.forEach((function(e){var n=e.pos+i;u[n]+=e.weight;for(var t=0;n>0;)n%2&&(t+=u[n+1]),u[n=n-1>>1]+=e.weight;c+=e.weight*t}))),c}var Lb=_w,Vb=_w,Rb=_w,Hb=Lw;function Zb(e,n,t){for(var r;n.length&&(r=Rb.last(n)).i<=t;)n.pop(),e.push(r.vs),t++;return t}var Yb=_w,Xb=_w,Fb=hw.Graph,Ub=_w,Gb=_w,$b=function(e){var n={},t=Tb.filter(e.nodes(),(function(n){return!e.children(n).length})),r=Tb.max(Tb.map(t,(function(n){return e.node(n).rank}))),o=Tb.map(Tb.range(r+1),(function(){return[]}));var i=Tb.sortBy(t,(function(n){return e.node(n).rank}));return Tb.forEach(i,(function t(r){if(!Tb.has(n,r)){n[r]=!0;var i=e.node(r);o[i.rank].push(r),Tb.forEach(e.successors(r),t)}})),o},Wb=function(e,n){for(var t=0,r=1;r<n.length;++r)t+=Db(e,n[r-1],n[r]);return t},qb=function e(n,t,r,o){var i=n.children(t),a=n.node(t),u=a?a.borderLeft:void 0,c=a?a.borderRight:void 0,l={};u&&(i=Yb.filter(i,(function(e){return e!==u&&e!==c})));var s=function(e,n){return Lb.map(n,(function(n){var t=e.inEdges(n);if(t.length){var r=Lb.reduce(t,(function(n,t){var r=e.edge(t),o=e.node(t.v);return{sum:n.sum+r.weight*o.order,weight:n.weight+r.weight}}),{sum:0,weight:0});return{v:n,barycenter:r.sum/r.weight,weight:r.weight}}return{v:n}}))}(n,i);Yb.forEach(s,(function(t){if(n.children(t.v).length){var i=e(n,t.v,r,o);l[t.v]=i,Yb.has(i,"barycenter")&&(a=t,u=i,Yb.isUndefined(a.barycenter)?(a.barycenter=u.barycenter,a.weight=u.weight):(a.barycenter=(a.barycenter*a.weight+u.barycenter*u.weight)/(a.weight+u.weight),a.weight+=u.weight))}var a,u}));var d=function(e,n){var t={};return Vb.forEach(e,(function(e,n){var r=t[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:n};Vb.isUndefined(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)})),Vb.forEach(n.edges(),(function(e){var n=t[e.v],r=t[e.w];Vb.isUndefined(n)||Vb.isUndefined(r)||(r.indegree++,n.out.push(t[e.w]))})),function(e){var n=[];function t(e){return function(n){n.merged||(Vb.isUndefined(n.barycenter)||Vb.isUndefined(e.barycenter)||n.barycenter>=e.barycenter)&&function(e,n){var t=0,r=0;e.weight&&(t+=e.barycenter*e.weight,r+=e.weight),n.weight&&(t+=n.barycenter*n.weight,r+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=t/r,e.weight=r,e.i=Math.min(n.i,e.i),n.merged=!0}(e,n)}}function r(n){return function(t){t.in.push(n),0==--t.indegree&&e.push(t)}}for(;e.length;){var o=e.pop();n.push(o),Vb.forEach(o.in.reverse(),t(o)),Vb.forEach(o.out,r(o))}return Vb.map(Vb.filter(n,(function(e){return!e.merged})),(function(e){return Vb.pick(e,["vs","i","barycenter","weight"])}))}(Vb.filter(t,(function(e){return!e.indegree})))}(s,r);!function(e,n){Yb.forEach(e,(function(e){e.vs=Yb.flatten(e.vs.map((function(e){return n[e]?n[e].vs:e})),!0)}))}(d,l);var f=function(e,n){var t,r=Hb.partition(e,(function(e){return Rb.has(e,"barycenter")})),o=r.lhs,i=Rb.sortBy(r.rhs,(function(e){return-e.i})),a=[],u=0,c=0,l=0;o.sort((t=!!n,function(e,n){return e.barycenter<n.barycenter?-1:e.barycenter>n.barycenter?1:t?n.i-e.i:e.i-n.i})),l=Zb(a,i,l),Rb.forEach(o,(function(e){l+=e.vs.length,a.push(e.vs),u+=e.barycenter*e.weight,c+=e.weight,l=Zb(a,i,l)}));var s={vs:Rb.flatten(a,!0)};return c&&(s.barycenter=u/c,s.weight=c),s}(d,o);if(u&&(f.vs=Yb.flatten([u,f.vs,c],!0),n.predecessors(u).length)){var h=n.node(n.predecessors(u)[0]),v=n.node(n.predecessors(c)[0]);Yb.has(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+h.order+v.order)/(f.weight+2),f.weight+=2}return f},Kb=function(e,n,t){var r=function(e){for(var n;e.hasNode(n=Xb.uniqueId("_root")););return n}(e),o=new Fb({compound:!0}).setGraph({root:r}).setDefaultNodeLabel((function(n){return e.node(n)}));return Xb.forEach(e.nodes(),(function(i){var a=e.node(i),u=e.parent(i);(a.rank===n||a.minRank<=n&&n<=a.maxRank)&&(o.setNode(i),o.setParent(i,u||r),Xb.forEach(e[t](i),(function(n){var t=n.v===i?n.w:n.v,r=o.edge(t,i),a=Xb.isUndefined(r)?0:r.weight;o.setEdge(t,i,{weight:e.edge(n).weight+a})})),Xb.has(a,"minRank")&&o.setNode(i,{borderLeft:a.borderLeft[n],borderRight:a.borderRight[n]}))})),o},Qb=hw.Graph,Jb=Lw;function ex(e,n,t){return Gb.map(n,(function(n){return Kb(e,n,t)}))}function nx(e,n){var t=new Qb;Gb.forEach(e,(function(e){var r=e.graph().root,o=qb(e,r,t,n);Gb.forEach(o.vs,(function(n,t){e.node(n).order=t})),function(e,n,t){var r,o={};Ub.forEach(t,(function(t){for(var i,a,u=e.parent(t);u;){if((i=e.parent(u))?(a=o[i],o[i]=u):(a=r,r=u),a&&a!==u)return void n.setEdge(a,u);u=i}}))}(e,t,o.vs)}))}function tx(e,n){Gb.forEach(n,(function(n){Gb.forEach(n,(function(n,t){e.node(n).order=t}))}))}var rx=_w,ox=hw.Graph,ix=Lw;function ax(e,n,t){if(n>t){var r=n;n=t,t=r}var o=e[n];o||(e[n]=o={}),o[t]=!0}function ux(e,n,t){if(n>t){var r=n;n=t,t=r}return rx.has(e[n],t)}var cx=_w,lx=Lw,sx=function(e){var n,t=ix.buildLayerMatrix(e),r=rx.merge(function(e,n){var t={};return rx.reduce(n,(function(n,r){var o=0,i=0,a=n.length,u=rx.last(r);return rx.forEach(r,(function(n,c){var l=function(e,n){if(e.node(n).dummy)return rx.find(e.predecessors(n),(function(n){return e.node(n).dummy}))}(e,n),s=l?e.node(l).order:a;(l||n===u)&&(rx.forEach(r.slice(i,c+1),(function(n){rx.forEach(e.predecessors(n),(function(r){var i=e.node(r),a=i.order;!(a<o||s<a)||i.dummy&&e.node(n).dummy||ax(t,r,n)}))})),i=c+1,o=s)})),r})),t}(e,t),function(e,n){var t={};function r(n,r,o,i,a){var u;rx.forEach(rx.range(r,o),(function(r){u=n[r],e.node(u).dummy&&rx.forEach(e.predecessors(u),(function(n){var r=e.node(n);r.dummy&&(r.order<i||r.order>a)&&ax(t,n,u)}))}))}return rx.reduce(n,(function(n,t){var o,i=-1,a=0;return rx.forEach(t,(function(u,c){if("border"===e.node(u).dummy){var l=e.predecessors(u);l.length&&(o=e.node(l[0]).order,r(t,a,c,i,o),a=c,i=o)}r(t,a,t.length,o,n.length)})),t})),t}(e,t)),o={};rx.forEach(["u","d"],(function(i){n="u"===i?t:rx.values(t).reverse(),rx.forEach(["l","r"],(function(t){"r"===t&&(n=rx.map(n,(function(e){return rx.values(e).reverse()})));var a=("u"===i?e.predecessors:e.successors).bind(e),u=function(e,n,t,r){var o={},i={},a={};return rx.forEach(n,(function(e){rx.forEach(e,(function(e,n){o[e]=e,i[e]=e,a[e]=n}))})),rx.forEach(n,(function(e){var n=-1;rx.forEach(e,(function(e){var u=r(e);if(u.length){u=rx.sortBy(u,(function(e){return a[e]}));for(var c=(u.length-1)/2,l=Math.floor(c),s=Math.ceil(c);l<=s;++l){var d=u[l];i[e]===e&&n<a[d]&&!ux(t,e,d)&&(i[d]=e,i[e]=o[e]=o[d],n=a[d])}}}))})),{root:o,align:i}}(0,n,r,a),c=function(e,n,t,r,o){var i={},a=function(e,n,t,r){var o=new ox,i=e.graph(),a=function(e,n,t){return function(r,o,i){var a,u=r.node(o),c=r.node(i),l=0;if(l+=u.width/2,rx.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(l+=t?a:-a),a=0,l+=(u.dummy?n:e)/2,l+=(c.dummy?n:e)/2,l+=c.width/2,rx.has(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":a=c.width/2;break;case"r":a=-c.width/2}return a&&(l+=t?a:-a),a=0,l}}(i.nodesep,i.edgesep,r);return rx.forEach(n,(function(n){var r;rx.forEach(n,(function(n){var i=t[n];if(o.setNode(i),r){var u=t[r],c=o.edge(u,i);o.setEdge(u,i,Math.max(a(e,n,r),c||0))}r=n}))})),o}(e,n,t,o),u=o?"borderLeft":"borderRight";function c(e,n){for(var t=a.nodes(),r=t.pop(),o={};r;)o[r]?e(r):(o[r]=!0,t.push(r),t=t.concat(n(r))),r=t.pop()}return c((function(e){i[e]=a.inEdges(e).reduce((function(e,n){return Math.max(e,i[n.v]+a.edge(n))}),0)}),a.predecessors.bind(a)),c((function(n){var t=a.outEdges(n).reduce((function(e,n){return Math.min(e,i[n.w]-a.edge(n))}),Number.POSITIVE_INFINITY),r=e.node(n);t!==Number.POSITIVE_INFINITY&&r.borderType!==u&&(i[n]=Math.max(i[n],t))}),a.successors.bind(a)),rx.forEach(r,(function(e){i[e]=i[t[e]]})),i}(e,n,u.root,u.align,"r"===t);"r"===t&&(c=rx.mapValues(c,(function(e){return-e}))),o[i+t]=c}))}));var i=function(e,n){return rx.minBy(rx.values(n),(function(n){var t=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;return rx.forIn(n,(function(n,o){var i=function(e,n){return e.node(n).width}(e,o)/2;t=Math.max(n+i,t),r=Math.min(n-i,r)})),t-r}))}(e,o);return function(e,n){var t=rx.values(n),r=rx.min(t),o=rx.max(t);rx.forEach(["u","d"],(function(t){rx.forEach(["l","r"],(function(i){var a,u=t+i,c=e[u];if(c!==n){var l=rx.values(c);(a="l"===i?r-rx.min(l):o-rx.max(l))&&(e[u]=rx.mapValues(c,(function(e){return e+a})))}}))}))}(o,i),function(e,n){return rx.mapValues(e.ul,(function(t,r){if(n)return e[n.toLowerCase()][r];var o=rx.sortBy(rx.map(e,r));return(o[1]+o[2])/2}))}(o,e.graph().align)},dx=_w,fx=Tw,hx=Yw,vx=function(e){switch(e.graph().ranker){case"network-simplex":default:!function(e){wb(e)}(e);break;case"tight-tree":!function(e){yb(e),mb(e)}(e);break;case"longest-path":bb(e)}},px=Lw.normalizeRanks,gx=function(e){var n=function(e){var n={},t=0;return xb.forEach(e.children(),(function r(o){var i=t;xb.forEach(e.children(o),r),n[o]={low:i,lim:t++}})),n}(e);xb.forEach(e.graph().dummyChains,(function(t){for(var r=e.node(t),o=r.edgeObj,i=function(e,n,t,r){var o,i,a=[],u=[],c=Math.min(n[t].low,n[r].low),l=Math.max(n[t].lim,n[r].lim);o=t;do{o=e.parent(o),a.push(o)}while(o&&(n[o].low>c||l>n[o].lim));for(i=o,o=r;(o=e.parent(o))!==i;)u.push(o);return{path:a.concat(u.reverse()),lca:i}}(e,n,o.v,o.w),a=i.path,u=i.lca,c=0,l=a[c],s=!0;t!==o.w;){if(r=e.node(t),s){for(;(l=a[c])!==u&&e.node(l).maxRank<r.rank;)c++;l===u&&(s=!1)}if(!s){for(;c<a.length-1&&e.node(l=a[c+1]).minRank<=r.rank;)c++;l=a[c]}e.setParent(t,l),t=e.successors(t)[0]}}))},yx=Lw.removeEmptyRanks,mx=Sb,wx=function(e){Nb.forEach(e.children(),(function n(t){var r=e.children(t),o=e.node(t);if(r.length&&Nb.forEach(r,n),Nb.has(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var i=o.minRank,a=o.maxRank+1;i<a;++i)Ob(e,"borderLeft","_bl",t,o,i),Ob(e,"borderRight","_br",t,o,i)}}))},bx=jb,xx=function(e){var n=Jb.maxRank(e),t=ex(e,Gb.range(1,n+1),"inEdges"),r=ex(e,Gb.range(n-1,-1,-1),"outEdges"),o=$b(e);tx(e,o);for(var i,a=Number.POSITIVE_INFINITY,u=0,c=0;c<4;++u,++c){nx(u%2?t:r,u%4>=2),o=Jb.buildLayerMatrix(e);var l=Wb(e,o);l<a&&(c=0,i=Gb.cloneDeep(o),a=l)}tx(e,i)},_x=Lw,Ex=hw.Graph,Sx=["nodesep","edgesep","ranksep","marginx","marginy"],kx={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Nx=["acyclicer","ranker","rankdir","align"],Cx=["width","height"],Ox={width:0,height:0},Mx=["minlen","weight","width","height","labeloffset"],jx={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Ix=["labelpos"];function Px(e,n){return dx.mapValues(dx.pick(e,n),Number)}function Ax(e){var n={};return dx.forEach(e,(function(e,t){n[t.toLowerCase()]=e})),n}var zx=_w,Tx=Lw,Bx=hw.Graph,Dx=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}({graphlib:hw,layout:function(e,n){var t=n&&n.debugTiming?_x.time:_x.notime;t("layout",(function(){var n=t(" buildLayoutGraph",(function(){return function(e){var n=new Ex({multigraph:!0,compound:!0}),t=Ax(e.graph());return n.setGraph(dx.merge({},kx,Px(t,Sx),dx.pick(t,Nx))),dx.forEach(e.nodes(),(function(t){var r=Ax(e.node(t));n.setNode(t,dx.defaults(Px(r,Cx),Ox)),n.setParent(t,e.parent(t))})),dx.forEach(e.edges(),(function(t){var r=Ax(e.edge(t));n.setEdge(t,dx.merge({},jx,Px(r,Mx),dx.pick(r,Ix)))})),n}(e)}));t(" runLayout",(function(){!function(e,n){n(" makeSpaceForEdgeLabels",(function(){!function(e){var n=e.graph();n.ranksep/=2,dx.forEach(e.edges(),(function(t){var r=e.edge(t);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===n.rankdir||"BT"===n.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)}))}(e)})),n(" removeSelfEdges",(function(){!function(e){dx.forEach(e.edges(),(function(n){if(n.v===n.w){var t=e.node(n.v);t.selfEdges||(t.selfEdges=[]),t.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}}))}(e)})),n(" acyclic",(function(){fx.run(e)})),n(" nestingGraph.run",(function(){mx.run(e)})),n(" rank",(function(){vx(_x.asNonCompoundGraph(e))})),n(" injectEdgeLabelProxies",(function(){!function(e){dx.forEach(e.edges(),(function(n){var t=e.edge(n);if(t.width&&t.height){var r=e.node(n.v),o={rank:(e.node(n.w).rank-r.rank)/2+r.rank,e:n};_x.addDummyNode(e,"edge-proxy",o,"_ep")}}))}(e)})),n(" removeEmptyRanks",(function(){yx(e)})),n(" nestingGraph.cleanup",(function(){mx.cleanup(e)})),n(" normalizeRanks",(function(){px(e)})),n(" assignRankMinMax",(function(){!function(e){var n=0;dx.forEach(e.nodes(),(function(t){var r=e.node(t);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,n=dx.max(n,r.maxRank))})),e.graph().maxRank=n}(e)})),n(" removeEdgeLabelProxies",(function(){!function(e){dx.forEach(e.nodes(),(function(n){var t=e.node(n);"edge-proxy"===t.dummy&&(e.edge(t.e).labelRank=t.rank,e.removeNode(n))}))}(e)})),n(" normalize.run",(function(){hx.run(e)})),n(" parentDummyChains",(function(){gx(e)})),n(" addBorderSegments",(function(){wx(e)})),n(" order",(function(){xx(e)})),n(" insertSelfEdges",(function(){!function(e){var n=_x.buildLayerMatrix(e);dx.forEach(n,(function(n){var t=0;dx.forEach(n,(function(n,r){var o=e.node(n);o.order=r+t,dx.forEach(o.selfEdges,(function(n){_x.addDummyNode(e,"selfedge",{width:n.label.width,height:n.label.height,rank:o.rank,order:r+ ++t,e:n.e,label:n.label},"_se")})),delete o.selfEdges}))}))}(e)})),n(" adjustCoordinateSystem",(function(){bx.adjust(e)})),n(" position",(function(){!function(e){(function(e){var n=lx.buildLayerMatrix(e),t=e.graph().ranksep,r=0;cx.forEach(n,(function(n){var o=cx.max(cx.map(n,(function(n){return e.node(n).height})));cx.forEach(n,(function(n){e.node(n).y=r+o/2})),r+=o+t}))})(e=lx.asNonCompoundGraph(e)),cx.forEach(sx(e),(function(n,t){e.node(t).x=n}))}(e)})),n(" positionSelfEdges",(function(){!function(e){dx.forEach(e.nodes(),(function(n){var t=e.node(n);if("selfedge"===t.dummy){var r=e.node(t.e.v),o=r.x+r.width/2,i=r.y,a=t.x-o,u=r.height/2;e.setEdge(t.e,t.label),e.removeNode(n),t.label.points=[{x:o+2*a/3,y:i-u},{x:o+5*a/6,y:i-u},{x:o+a,y:i},{x:o+5*a/6,y:i+u},{x:o+2*a/3,y:i+u}],t.label.x=t.x,t.label.y=t.y}}))}(e)})),n(" removeBorderNodes",(function(){!function(e){dx.forEach(e.nodes(),(function(n){if(e.children(n).length){var t=e.node(n),r=e.node(t.borderTop),o=e.node(t.borderBottom),i=e.node(dx.last(t.borderLeft)),a=e.node(dx.last(t.borderRight));t.width=Math.abs(a.x-i.x),t.height=Math.abs(o.y-r.y),t.x=i.x+t.width/2,t.y=r.y+t.height/2}})),dx.forEach(e.nodes(),(function(n){"border"===e.node(n).dummy&&e.removeNode(n)}))}(e)})),n(" normalize.undo",(function(){hx.undo(e)})),n(" fixupEdgeLabelCoords",(function(){!function(e){dx.forEach(e.edges(),(function(n){var t=e.edge(n);if(dx.has(t,"x"))switch("l"!==t.labelpos&&"r"!==t.labelpos||(t.width-=t.labeloffset),t.labelpos){case"l":t.x-=t.width/2+t.labeloffset;break;case"r":t.x+=t.width/2+t.labeloffset}}))}(e)})),n(" undoCoordinateSystem",(function(){bx.undo(e)})),n(" translateGraph",(function(){!function(e){var n=Number.POSITIVE_INFINITY,t=0,r=Number.POSITIVE_INFINITY,o=0,i=e.graph(),a=i.marginx||0,u=i.marginy||0;function c(e){var i=e.x,a=e.y,u=e.width,c=e.height;n=Math.min(n,i-u/2),t=Math.max(t,i+u/2),r=Math.min(r,a-c/2),o=Math.max(o,a+c/2)}dx.forEach(e.nodes(),(function(n){c(e.node(n))})),dx.forEach(e.edges(),(function(n){var t=e.edge(n);dx.has(t,"x")&&c(t)})),n-=a,r-=u,dx.forEach(e.nodes(),(function(t){var o=e.node(t);o.x-=n,o.y-=r})),dx.forEach(e.edges(),(function(t){var o=e.edge(t);dx.forEach(o.points,(function(e){e.x-=n,e.y-=r})),dx.has(o,"x")&&(o.x-=n),dx.has(o,"y")&&(o.y-=r)})),i.width=t-n+a,i.height=o-r+u}(e)})),n(" assignNodeIntersects",(function(){!function(e){dx.forEach(e.edges(),(function(n){var t,r,o=e.edge(n),i=e.node(n.v),a=e.node(n.w);o.points?(t=o.points[0],r=o.points[o.points.length-1]):(o.points=[],t=a,r=i),o.points.unshift(_x.intersectRect(i,t)),o.points.push(_x.intersectRect(a,r))}))}(e)})),n(" reversePoints",(function(){!function(e){dx.forEach(e.edges(),(function(n){var t=e.edge(n);t.reversed&&t.points.reverse()}))}(e)})),n(" acyclic.undo",(function(){fx.undo(e)}))}(n,t)})),t(" updateInputGraph",(function(){!function(e,n){dx.forEach(e.nodes(),(function(t){var r=e.node(t),o=n.node(t);r&&(r.x=o.x,r.y=o.y,n.children(t).length&&(r.width=o.width,r.height=o.height))})),dx.forEach(e.edges(),(function(t){var r=e.edge(t),o=n.edge(t);r.points=o.points,dx.has(o,"x")&&(r.x=o.x,r.y=o.y)})),e.graph().width=n.graph().width,e.graph().height=n.graph().height}(e,n)}))}))},debug:{debugOrdering:function(e){var n=Tx.buildLayerMatrix(e),t=new Bx({compound:!0,multigraph:!0}).setGraph({});return zx.forEach(e.nodes(),(function(n){t.setNode(n,{label:n}),t.setParent(n,"layer"+e.node(n).rank)})),zx.forEach(e.edges(),(function(e){t.setEdge(e.v,e.w,{},e.name)})),zx.forEach(n,(function(e,n){var r="layer"+n;t.setNode(r,{rank:"same"}),zx.reduce(e,(function(e,n){return t.setEdge(e,n,{style:"invis"}),n}))})),t}},util:{time:Lw.time,notime:Lw.notime},version:"0.8.5"});function Lx(e,n,t){void 0===t&&(t={rankdir:"TB"});var r=t.rankdir,o=new Dx.graphlib.Graph;return o.setDefaultEdgeLabel((function(){return{}})),o.setGraph({rankdir:r}),e.forEach((function(e){var n,t;if(!e.id)throw new Error('Node "id" does not exist');var r=(null===(n=e.data)||void 0===n?void 0:n.width)||200,i=(null===(t=e.data)||void 0===t?void 0:t.height)||56;o.setNode(e.id,{width:r,height:i})})),n.forEach((function(e){o.setEdge(e.source,e.target)})),Dx.layout(o),e.forEach((function(e){var n=o.node(e.id),t="bottom",i="top";switch(r){case"TB":t="bottom",i="top";break;case"BT":t="top",i="bottom";break;case"LR":case"RL":t="right",i="left"}e.targetPosition=i,e.sourcePosition=t,e.position={x:n.x-n.width/2,y:n.y-n.height/2}})),{nodes:e,edges:n}}export{vu as ControlButton,wu as Controls,Wi as Handle,eu as InkFlowProvider,Ye as Position,Lx as dagreLayout,cu as default,yi as useEdgesState,ki as useInkFlow,mi as useNodesState,G as useStore,$ as useStoreApi};
17
- //# sourceMappingURL=index.esm.js.map