Browse Source

Update JavaScript dependencies (#3654)

* update google fonts

* update Tailwind API

* update JavaScript dependencies

* fix relative paths in mermaid library

* adjustments for AG Grid version 32

* add new coremirror themes

* fix some type annotations

* fix echart test

* adjustments for vanilla-jsoneditor version 23

* clean up lib folder

* adjustments for mermaid version 11

* add missing dependencies for `ui.scene`

* fix tween update

* fix test about serving image files

* restore accidentally removed codemirror dependencies

* add missing page function for scene.initialized demo

* try to make upload test more robust

* fix overflow when adding borders to the plotly plot

* prevent some elements from overflowing their containers

* found a better workaround

* fix EChart layout issue (see #2932)

* make sure to pass kwargs to `ui.table`

* improve layout of interactive styling demo

* fix name of option "suppressFieldDotNotation"

* fix another table initializer

* fix overflowing window corners

* simplify buggy AG Grid theme demo

* wait for chart to be initialized

* improve initial scene resize

* tiny layout fix
Falko Schindler 8 months ago
parent
commit
2cf863c43b
100 changed files with 62037 additions and 54833 deletions
  1. 13 13
      DEPENDENCIES.md
  2. 5 8
      nicegui/elements/aggrid.js
  3. 11 17
      nicegui/elements/aggrid.py
  4. 43 0
      nicegui/elements/codemirror.py
  5. 5 1
      nicegui/elements/echart.js
  6. 1 1
      nicegui/elements/json_editor.js
  7. 1 1
      nicegui/elements/json_editor.py
  8. 45552 52694
      nicegui/elements/lib/aggrid/ag-grid-community.js
  9. 0 7
      nicegui/elements/lib/aggrid/ag-grid-community.min.js
  10. 0 0
      nicegui/elements/lib/codemirror/commonlisp-D09g7coK.js
  11. 0 0
      nicegui/elements/lib/codemirror/commonlisp-vq6DHwts.js
  12. 1 1
      nicegui/elements/lib/codemirror/dockerfile-DbSFhNEh.js
  13. 0 0
      nicegui/elements/lib/codemirror/editor-DzvLhhiW.js
  14. 0 0
      nicegui/elements/lib/codemirror/editor-yE9Qj0OR.js
  15. 0 0
      nicegui/elements/lib/codemirror/editor.js
  16. 1 1
      nicegui/elements/lib/codemirror/factor-D9hSz2Dc.js
  17. 0 0
      nicegui/elements/lib/codemirror/index-B5JeZsmF.js
  18. 0 0
      nicegui/elements/lib/codemirror/index-B7tHWccP.js
  19. 0 0
      nicegui/elements/lib/codemirror/index-BDz6-lbd.js
  20. 0 0
      nicegui/elements/lib/codemirror/index-BJGpgU5Y.js
  21. 0 0
      nicegui/elements/lib/codemirror/index-BJiyyGqZ.js
  22. 0 0
      nicegui/elements/lib/codemirror/index-BKjc7uyC.js
  23. 0 0
      nicegui/elements/lib/codemirror/index-BL_t_ntH.js
  24. 0 0
      nicegui/elements/lib/codemirror/index-BMNClJrW.js
  25. 0 0
      nicegui/elements/lib/codemirror/index-BTAxP3mB.js
  26. 0 0
      nicegui/elements/lib/codemirror/index-BiVteWwz.js
  27. 0 0
      nicegui/elements/lib/codemirror/index-C4TeAHpL.js
  28. 0 0
      nicegui/elements/lib/codemirror/index-C6CTVuvt.js
  29. 0 0
      nicegui/elements/lib/codemirror/index-CB606nqP.js
  30. 0 0
      nicegui/elements/lib/codemirror/index-CG3aUV_L.js
  31. 0 0
      nicegui/elements/lib/codemirror/index-CJB1zGqD.js
  32. 0 0
      nicegui/elements/lib/codemirror/index-CJhLK3a1.js
  33. 0 0
      nicegui/elements/lib/codemirror/index-CMiehYAn.js
  34. 0 0
      nicegui/elements/lib/codemirror/index-CUN-L9uH.js
  35. 0 0
      nicegui/elements/lib/codemirror/index-CYWhQqFb.js
  36. 0 0
      nicegui/elements/lib/codemirror/index-CdE5fhyF.js
  37. 0 0
      nicegui/elements/lib/codemirror/index-CgEMB2FB.js
  38. 0 0
      nicegui/elements/lib/codemirror/index-Ckjrdmtm.js
  39. 0 0
      nicegui/elements/lib/codemirror/index-Ctywxs9F.js
  40. 0 0
      nicegui/elements/lib/codemirror/index-CvY89YCL.js
  41. 0 0
      nicegui/elements/lib/codemirror/index-D6K4mE4a.js
  42. 0 0
      nicegui/elements/lib/codemirror/index-DHm9fpZm.js
  43. 0 0
      nicegui/elements/lib/codemirror/index-DWxkS7ff.js
  44. 0 0
      nicegui/elements/lib/codemirror/index-D_XwcRjc.js
  45. 0 0
      nicegui/elements/lib/codemirror/index-DyVgTn8s.js
  46. 0 0
      nicegui/elements/lib/codemirror/index-GtIxIVFm.js
  47. 0 0
      nicegui/elements/lib/codemirror/index-MSjmRdH1.js
  48. 0 0
      nicegui/elements/lib/codemirror/index-NkaBMccj.js
  49. 0 0
      nicegui/elements/lib/codemirror/index-anbJ5y0U.js
  50. 0 0
      nicegui/elements/lib/codemirror/index-dUWVmN8K.js
  51. 0 0
      nicegui/elements/lib/codemirror/index-dljVoRYZ.js
  52. 0 0
      nicegui/elements/lib/codemirror/index-objdOfoT.js
  53. 0 0
      nicegui/elements/lib/codemirror/nsis-CKXvuz-E.js
  54. 0 0
      nicegui/elements/lib/codemirror/simple-mode-D4Q6qQvj.js
  55. 0 0
      nicegui/elements/lib/codemirror/simple-mode-VRHOsiuL.js
  56. 0 0
      nicegui/elements/lib/codemirror/stylus-3mOX9C7I.js
  57. 0 0
      nicegui/elements/lib/echarts/echarts.js.map
  58. 0 34
      nicegui/elements/lib/echarts/echarts.min.js
  59. 0 144
      nicegui/elements/lib/mermaid/arc-8b90ddc8.js
  60. 0 84
      nicegui/elements/lib/mermaid/arc-907dcd53.js
  61. 0 6
      nicegui/elements/lib/mermaid/array-2ff2c7a6.js
  62. 0 6
      nicegui/elements/lib/mermaid/array-b7dcf730.js
  63. 0 183
      nicegui/elements/lib/mermaid/c4Diagram-331b94a9.js
  64. 1961 0
      nicegui/elements/lib/mermaid/chunks/mermaid.core/blockDiagram-V6UOASA5.mjs
  65. 36 21
      nicegui/elements/lib/mermaid/chunks/mermaid.core/c4Diagram-ZHOUKFWV.mjs
  66. 2284 0
      nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-5CZSE4TR.mjs
  67. 43 26
      nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-AIUMCIBP.mjs
  68. 22 0
      nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-DLZUUSFL.mjs
  69. 24 0
      nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-FBCX6ULS.mjs
  70. 44 0
      nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-FUIDI54P.mjs
  71. 97 67
      nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-IBIA4ERB.mjs
  72. 21 0
      nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-JJENOPKO.mjs
  73. 2936 0
      nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-O2AGWWWV.mjs
  74. 146 44
      nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-OERGPBFJ.mjs
  75. 454 0
      nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-PDCO53Z4.mjs
  76. 63 36
      nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-SVGOEX7Z.mjs
  77. 76 0
      nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-T3KDJ7CM.mjs
  78. 122 0
      nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-TINLTEC2.mjs
  79. 561 0
      nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-VKXSJROQ.mjs
  80. 6 0
      nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-YR4HKMZO.mjs
  81. 1402 0
      nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-Z2VRG6XP.mjs
  82. 69 55
      nicegui/elements/lib/mermaid/chunks/mermaid.core/classDiagram-MQQPYQM5.mjs
  83. 446 84
      nicegui/elements/lib/mermaid/chunks/mermaid.core/classDiagram-v2-4S5WAI72.mjs
  84. 671 0
      nicegui/elements/lib/mermaid/chunks/mermaid.core/dagre-CQ6OS2HX.mjs
  85. 220 0
      nicegui/elements/lib/mermaid/chunks/mermaid.core/diagram-KYCGQLJB.mjs
  86. 234 146
      nicegui/elements/lib/mermaid/chunks/mermaid.core/erDiagram-762WSSOR.mjs
  87. 845 4
      nicegui/elements/lib/mermaid/chunks/mermaid.core/flowDiagram-TGP4CI55.mjs
  88. 339 250
      nicegui/elements/lib/mermaid/chunks/mermaid.core/ganttDiagram-GAYIUD5S.mjs
  89. 1761 0
      nicegui/elements/lib/mermaid/chunks/mermaid.core/gitGraphDiagram-LGD5RUNZ.mjs
  90. 47 0
      nicegui/elements/lib/mermaid/chunks/mermaid.core/infoDiagram-GSXZ5C4N.mjs
  91. 236 167
      nicegui/elements/lib/mermaid/chunks/mermaid.core/journeyDiagram-35ZZFJAM.mjs
  92. 277 237
      nicegui/elements/lib/mermaid/chunks/mermaid.core/mindmap-definition-6NGNQFMS.mjs
  93. 217 0
      nicegui/elements/lib/mermaid/chunks/mermaid.core/pieDiagram-WEX7LNAG.mjs
  94. 84 47
      nicegui/elements/lib/mermaid/chunks/mermaid.core/quadrantDiagram-SRYJ5FP7.mjs
  95. 21 21
      nicegui/elements/lib/mermaid/chunks/mermaid.core/requirementDiagram-V7TESSIR.mjs
  96. 200 137
      nicegui/elements/lib/mermaid/chunks/mermaid.core/sankeyDiagram-XVFEVEVI.mjs
  97. 63 32
      nicegui/elements/lib/mermaid/chunks/mermaid.core/sequenceDiagram-6SD7JOPP.mjs
  98. 114 86
      nicegui/elements/lib/mermaid/chunks/mermaid.core/stateDiagram-N22R6T2Y.mjs
  99. 34 0
      nicegui/elements/lib/mermaid/chunks/mermaid.core/stateDiagram-v2-QXVA2PVL.mjs
  100. 228 172
      nicegui/elements/lib/mermaid/chunks/mermaid.core/timeline-definition-SFF34UE4.mjs

+ 13 - 13
DEPENDENCIES.md

@@ -1,19 +1,19 @@
 # Included Web Dependencies
 
-- vue: 3.3.6 ([MIT](https://opensource.org/licenses/MIT))
-- quasar: 2.13.0 ([MIT](https://opensource.org/licenses/MIT))
-- tailwindcss: 3.2.0 ([MIT](https://opensource.org/licenses/MIT))
-- socket.io: 4.7.2 ([MIT](https://opensource.org/licenses/MIT))
-- es-module-shims: 1.8.0 ([MIT](https://opensource.org/licenses/MIT))
-- aggrid: 30.2.0 ([MIT](https://opensource.org/licenses/MIT))
+- vue: 3.4.38 ([MIT](https://opensource.org/licenses/MIT))
+- quasar: 2.16.9 ([MIT](https://opensource.org/licenses/MIT))
+- tailwindcss: 3.4.10 ([MIT](https://opensource.org/licenses/MIT))
+- socket.io: 4.7.5 ([MIT](https://opensource.org/licenses/MIT))
+- es-module-shims: 1.10.0 ([MIT](https://opensource.org/licenses/MIT))
+- aggrid: 32.1.0 ([MIT](https://opensource.org/licenses/MIT))
 - codemirror: 6.0.1 ([MIT](https://opensource.org/licenses/MIT))
-- echarts: 5.4.3 ([Apache-2.0](https://opensource.org/licenses/Apache-2.0))
+- echarts: 5.5.1 ([Apache-2.0](https://opensource.org/licenses/Apache-2.0))
 - echarts-gl: 2.0.9 ([BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause))
 - leaflet: 1.9.4 ([BSD-2-Clause](https://opensource.org/licenses/BSD-2-Clause))
 - leaflet-draw: 1.0.4 ([MIT](https://opensource.org/licenses/MIT))
-- mermaid: 10.5.1 ([MIT](https://opensource.org/licenses/MIT))
-- nipplejs: 0.10.1 ([MIT](https://opensource.org/licenses/MIT))
-- plotly: 2.27.0 ([MIT](https://opensource.org/licenses/MIT))
-- three: 0.157.0 ([MIT](https://opensource.org/licenses/MIT))
-- tween: 21.0.0 ([MIT](https://opensource.org/licenses/MIT))
-- vanilla-jsoneditor: 0.18.10 ([ISC](https://opensource.org/licenses/ISC))
+- mermaid: 11.0.2 ([MIT](https://opensource.org/licenses/MIT))
+- nipplejs: 0.10.2 ([MIT](https://opensource.org/licenses/MIT))
+- plotly: 2.35.0 ([MIT](https://opensource.org/licenses/MIT))
+- three: 0.168.0 ([MIT](https://opensource.org/licenses/MIT))
+- tween: 25.0.0 ([MIT](https://opensource.org/licenses/MIT))
+- vanilla-jsoneditor: 0.23.8 ([ISC](https://opensource.org/licenses/ISC))

+ 5 - 8
nicegui/elements/aggrid.js

@@ -42,21 +42,18 @@ export default {
         checkboxRenderer: CheckboxRenderer,
       };
 
-      this.grid = new agGrid.Grid(this.$el, this.gridOptions);
-      this.gridOptions.api.addGlobalListener(this.handle_event);
+      this.api = agGrid.createGrid(this.$el, this.gridOptions);
+      this.api.addGlobalListener(this.handle_event);
     },
     run_grid_method(name, ...args) {
-      return runMethod(this.gridOptions.api, name, args);
-    },
-    run_column_method(name, ...args) {
-      return runMethod(this.gridOptions.columnApi, name, args);
+      return runMethod(this.api, name, args);
     },
     run_row_method(row_id, name, ...args) {
-      return runMethod(this.gridOptions.api.getRowNode(row_id), name, args);
+      return runMethod(this.api.getRowNode(row_id), name, args);
     },
     handle_event(type, args) {
       if ((type === "gridReady" || type === "gridSizeChanged") && this.auto_size_columns) {
-        this.gridOptions.api.sizeColumnsToFit();
+        this.api.sizeColumnsToFit();
       }
       this.$emit(type, {
         value: args.value,

+ 11 - 17
nicegui/elements/aggrid.py

@@ -3,7 +3,7 @@ from typing import TYPE_CHECKING, Dict, List, Literal, Optional, cast
 
 from typing_extensions import Self
 
-from .. import optional_features
+from .. import helpers, optional_features
 from ..awaitable_response import AwaitableResponse
 from ..element import Element
 
@@ -25,7 +25,7 @@ class AgGrid(Element, component='aggrid.js', dependencies=['lib/aggrid/ag-grid-c
 
         An element to create a grid using `AG Grid <https://www.ag-grid.com/>`_.
 
-        The methods `run_grid_method` and `run_column_method` can be used to interact with the AG Grid instance on the client.
+        The methods `run_grid_method` and `run_row_method` can be used to interact with the AG Grid instance on the client.
 
         :param options: dictionary of AG Grid options
         :param html_columns: list of columns that should be rendered as HTML (default: `[]`)
@@ -79,7 +79,7 @@ class AgGrid(Element, component='aggrid.js', dependencies=['lib/aggrid/ag-grid-c
         return cls({
             'columnDefs': [{'field': str(col)} for col in df.columns],
             'rowData': df.to_dict('records'),
-            'suppressDotNotation': True,
+            'suppressFieldDotNotation': True,
             **options,
         }, theme=theme, auto_size_columns=auto_size_columns)
 
@@ -108,21 +108,15 @@ class AgGrid(Element, component='aggrid.js', dependencies=['lib/aggrid/ag-grid-c
         """
         return self.run_method('run_grid_method', name, *args, timeout=timeout)
 
-    def run_column_method(self, name: str, *args, timeout: float = 1) -> AwaitableResponse:
-        """Run an AG Grid Column API method.
+    def run_column_method(self, name: str, *args, timeout: float = 1) -> AwaitableResponse:  # DEPRECATED
+        """This method is deprecated. Use `run_grid_method` instead.
 
-        See `AG Grid Column API <https://www.ag-grid.com/javascript-data-grid/column-api/>`_ for a list of methods.
-
-        If the function is awaited, the result of the method call is returned.
-        Otherwise, the method is executed without waiting for a response.
-
-        :param name: name of the method
-        :param args: arguments to pass to the method
-        :param timeout: timeout in seconds (default: 1 second)
-
-        :return: AwaitableResponse that can be awaited to get the result of the method call
+        See https://www.ag-grid.com/javascript-data-grid/column-api/ for more information
         """
-        return self.run_method('run_column_method', name, *args, timeout=timeout)
+        helpers.warn_once('The method `run_column_method` is deprecated. '
+                          'It will be removed in NiceGUI 3.0. '
+                          'Use `run_grid_method` instead.')
+        return self.run_method('run_grid_method', name, *args, timeout=timeout)
 
     def run_row_method(self, row_id: str, name: str, *args, timeout: float = 1) -> AwaitableResponse:
         """Run an AG Grid API method on a specific row.
@@ -191,7 +185,7 @@ class AgGrid(Element, component='aggrid.js', dependencies=['lib/aggrid/ag-grid-c
         }
         result = await self.client.run_javascript(f'''
             const rowData = [];
-            getElement({self.id}).gridOptions.api.{API_METHODS[method]}(node => rowData.push(node.data));
+            getElement({self.id}).api.{API_METHODS[method]}(node => rowData.push(node.data));
             return rowData;
         ''', timeout=timeout)
         return cast(List[Dict], result)

+ 43 - 0
nicegui/elements/codemirror.py

@@ -154,51 +154,94 @@ SUPPORTED_LANGUAGES = Literal[
 
 SUPPORTED_THEMES = Literal[
     'abcdef',
+    'abcdefDarkStyle',
     'abyss',
+    'abyssDarkStyle',
     'androidstudio',
+    'androidstudioDarkStyle',
     'andromeda',
+    'andromedaDarkStyle',
     'atomone',
+    'atomoneDarkStyle',
     'aura',
+    'auraDarkStyle',
     'basicDark',
+    'basicDarkStyle',
     'basicLight',
+    'basicLightStyle',
     'bbedit',
+    'bbeditLightStyle',
     'bespin',
+    'bespinDarkStyle',
     'consoleDark',
     'consoleLight',
     'copilot',
+    'copilotDarkStyle',
     'darcula',
+    'darculaDarkStyle',
+    'douToneLightStyle',
     'dracula',
+    'draculaDarkStyle',
     'duotoneDark',
+    'duotoneDarkStyle',
     'duotoneLight',
     'eclipse',
+    'eclipseLightStyle',
     'githubDark',
+    'githubDarkStyle',
     'githubLight',
+    'githubLightStyle',
     'gruvboxDark',
+    'gruvboxDarkStyle',
     'gruvboxLight',
     'kimbie',
+    'kimbieDarkStyle',
     'material',
     'materialDark',
+    'materialDarkStyle',
     'materialLight',
+    'materialLightStyle',
     'monokai',
+    'monokaiDarkStyle',
     'monokaiDimmed',
+    'monokaiDimmedDarkStyle',
     'noctisLilac',
+    'noctisLilacLightStyle',
     'nord',
+    'nordDarkStyle',
     'okaidia',
+    'okaidiaDarkStyle',
     'oneDark',
     'quietlight',
+    'quietlightStyle',
     'red',
+    'redDarkStyle',
     'solarizedDark',
+    'solarizedDarkStyle',
     'solarizedLight',
+    'solarizedLightStyle',
     'sublime',
+    'sublimeDarkStyle',
     'tokyoNight',
     'tokyoNightDay',
+    'tokyoNightDayStyle',
     'tokyoNightStorm',
+    'tokyoNightStormStyle',
+    'tokyoNightStyle',
     'tomorrowNightBlue',
+    'tomorrowNightBlueStyle',
     'vscodeDark',
+    'vscodeDarkStyle',
+    'vscodeLight',
+    'vscodeLightStyle',
     'whiteDark',
+    'whiteDarkStyle',
     'whiteLight',
+    'whiteLightStyle',
     'xcodeDark',
+    'xcodeDarkStyle',
     'xcodeLight',
+    'xcodeLightStyle',
 ]
 
 

+ 5 - 1
nicegui/elements/echart.js

@@ -4,7 +4,7 @@ import { convertDynamicProperties } from "../../static/utils/dynamic_properties.
 export default {
   template: "<div></div>",
   async mounted() {
-    await this.$nextTick(); // wait for Tailwind classes to be applied
+    await new Promise((resolve) => setTimeout(resolve, 0)); // wait for Tailwind classes to be applied
     if (this.enable_3d) {
       await import("echarts-gl");
     }
@@ -72,6 +72,10 @@ export default {
   },
   methods: {
     update_chart() {
+      if (!this.chart) {
+        setTimeout(this.update_chart, 10);
+        return;
+      }
       convertDynamicProperties(this.options, true);
       this.chart.setOption(this.options, { notMerge: this.chart.options?.series.length != this.options.series.length });
     },

+ 1 - 1
nicegui/elements/json_editor.js

@@ -1,4 +1,4 @@
-import { JSONEditor } from "index";
+import { JSONEditor } from "standalone";
 
 export default {
   template: "<div></div>",

+ 1 - 1
nicegui/elements/json_editor.py

@@ -7,7 +7,7 @@ from ..element import Element
 from ..events import GenericEventArguments, JsonEditorChangeEventArguments, JsonEditorSelectEventArguments, handle_event
 
 
-class JsonEditor(Element, component='json_editor.js', dependencies=['lib/vanilla-jsoneditor/index.js']):
+class JsonEditor(Element, component='json_editor.js', dependencies=['lib/vanilla-jsoneditor/standalone.js']):
 
     def __init__(self,
                  properties: Dict, *,

File diff suppressed because it is too large
+ 45552 - 52694
nicegui/elements/lib/aggrid/ag-grid-community.js


File diff suppressed because it is too large
+ 0 - 7
nicegui/elements/lib/aggrid/ag-grid-community.min.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/commonlisp-D09g7coK.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/commonlisp-vq6DHwts.js


+ 1 - 1
nicegui/elements/lib/codemirror/dockerfile-DuMjxlog.js → nicegui/elements/lib/codemirror/dockerfile-DbSFhNEh.js

@@ -1 +1 @@
-import{s as e}from"./simple-mode-D4Q6qQvj.js";var n="from",t=new RegExp("^(\\s*)\\b("+n+")\\b","i"),r=["run","cmd","entrypoint","shell"],o=new RegExp("^(\\s*)("+r.join("|")+")(\\s+\\[)","i"),l="expose",s=new RegExp("^(\\s*)("+l+")(\\s+)","i"),x="("+[n,l].concat(r).concat(["arg","from","maintainer","label","env","add","copy","volume","user","workdir","onbuild","stopsignal","healthcheck","shell"]).join("|")+")";const g=e({start:[{regex:/^\s*#.*$/,sol:!0,token:"comment"},{regex:t,token:[null,"keyword"],sol:!0,next:"from"},{regex:new RegExp("^(\\s*)"+x+"(\\s*)(#.*)?$","i"),token:[null,"keyword",null,"error"],sol:!0},{regex:o,token:[null,"keyword",null],sol:!0,next:"array"},{regex:s,token:[null,"keyword",null],sol:!0,next:"expose"},{regex:new RegExp("^(\\s*)"+x+"(\\s+)","i"),token:[null,"keyword",null],sol:!0,next:"arguments"},{regex:/./,token:null}],from:[{regex:/\s*$/,token:null,next:"start"},{regex:/(\s*)(#.*)$/,token:[null,"error"],next:"start"},{regex:/(\s*\S+\s+)(as)/i,token:[null,"keyword"],next:"start"},{token:null,next:"start"}],single:[{regex:/(?:[^\\']|\\.)/,token:"string"},{regex:/'/,token:"string",pop:!0}],double:[{regex:/(?:[^\\"]|\\.)/,token:"string"},{regex:/"/,token:"string",pop:!0}],array:[{regex:/\]/,token:null,next:"start"},{regex:/"(?:[^\\"]|\\.)*"?/,token:"string"}],expose:[{regex:/\d+$/,token:"number",next:"start"},{regex:/[^\d]+$/,token:null,next:"start"},{regex:/\d+/,token:"number"},{regex:/[^\d]+/,token:null},{token:null,next:"start"}],arguments:[{regex:/^\s*#.*$/,sol:!0,token:"comment"},{regex:/"(?:[^\\"]|\\.)*"?$/,token:"string",next:"start"},{regex:/"/,token:"string",push:"double"},{regex:/'(?:[^\\']|\\.)*'?$/,token:"string",next:"start"},{regex:/'/,token:"string",push:"single"},{regex:/[^#"']+[\\`]$/,token:null},{regex:/[^#"']+$/,token:null,next:"start"},{regex:/[^#"']+/,token:null},{token:null,next:"start"}],languageData:{commentTokens:{line:"#"}}});export{g as dockerFile};
+import{s as e}from"./simple-mode-VRHOsiuL.js";var n="from",t=new RegExp("^(\\s*)\\b("+n+")\\b","i"),r=["run","cmd","entrypoint","shell"],o=new RegExp("^(\\s*)("+r.join("|")+")(\\s+\\[)","i"),l="expose",s=new RegExp("^(\\s*)("+l+")(\\s+)","i"),x="("+[n,l].concat(r).concat(["arg","from","maintainer","label","env","add","copy","volume","user","workdir","onbuild","stopsignal","healthcheck","shell"]).join("|")+")";const g=e({start:[{regex:/^\s*#.*$/,sol:!0,token:"comment"},{regex:t,token:[null,"keyword"],sol:!0,next:"from"},{regex:new RegExp("^(\\s*)"+x+"(\\s*)(#.*)?$","i"),token:[null,"keyword",null,"error"],sol:!0},{regex:o,token:[null,"keyword",null],sol:!0,next:"array"},{regex:s,token:[null,"keyword",null],sol:!0,next:"expose"},{regex:new RegExp("^(\\s*)"+x+"(\\s+)","i"),token:[null,"keyword",null],sol:!0,next:"arguments"},{regex:/./,token:null}],from:[{regex:/\s*$/,token:null,next:"start"},{regex:/(\s*)(#.*)$/,token:[null,"error"],next:"start"},{regex:/(\s*\S+\s+)(as)/i,token:[null,"keyword"],next:"start"},{token:null,next:"start"}],single:[{regex:/(?:[^\\']|\\.)/,token:"string"},{regex:/'/,token:"string",pop:!0}],double:[{regex:/(?:[^\\"]|\\.)/,token:"string"},{regex:/"/,token:"string",pop:!0}],array:[{regex:/\]/,token:null,next:"start"},{regex:/"(?:[^\\"]|\\.)*"?/,token:"string"}],expose:[{regex:/\d+$/,token:"number",next:"start"},{regex:/[^\d]+$/,token:null,next:"start"},{regex:/\d+/,token:"number"},{regex:/[^\d]+/,token:null},{token:null,next:"start"}],arguments:[{regex:/^\s*#.*$/,sol:!0,token:"comment"},{regex:/"(?:[^\\"]|\\.)*"?$/,token:"string",next:"start"},{regex:/"/,token:"string",push:"double"},{regex:/'(?:[^\\']|\\.)*'?$/,token:"string",next:"start"},{regex:/'/,token:"string",push:"single"},{regex:/[^#"']+[\\`]$/,token:null},{regex:/[^#"']+$/,token:null,next:"start"},{regex:/[^#"']+/,token:null},{token:null,next:"start"}],languageData:{commentTokens:{line:"#"}}});export{g as dockerFile};

File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/editor-DzvLhhiW.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/editor-yE9Qj0OR.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/editor.js


+ 1 - 1
nicegui/elements/lib/codemirror/factor-CKY7z0Fm.js → nicegui/elements/lib/codemirror/factor-D9hSz2Dc.js

@@ -1 +1 @@
-import{s as e}from"./simple-mode-D4Q6qQvj.js";const t=e({start:[{regex:/#?!.*/,token:"comment"},{regex:/"""/,token:"string",next:"string3"},{regex:/(STRING:)(\s)/,token:["keyword",null],next:"string2"},{regex:/\S*?"/,token:"string",next:"string"},{regex:/(?:0x[\d,a-f]+)|(?:0o[0-7]+)|(?:0b[0,1]+)|(?:\-?\d+.?\d*)(?=\s)/,token:"number"},{regex:/((?:GENERIC)|\:?\:)(\s+)(\S+)(\s+)(\()/,token:["keyword",null,"def",null,"bracket"],next:"stack"},{regex:/(M\:)(\s+)(\S+)(\s+)(\S+)/,token:["keyword",null,"def",null,"tag"]},{regex:/USING\:/,token:"keyword",next:"vocabulary"},{regex:/(USE\:|IN\:)(\s+)(\S+)(?=\s|$)/,token:["keyword",null,"tag"]},{regex:/(\S+\:)(\s+)(\S+)(?=\s|$)/,token:["keyword",null,"def"]},{regex:/(?:;|\\|t|f|if|loop|while|until|do|PRIVATE>|<PRIVATE|\.|\S*\[|\]|\S*\{|\})(?=\s|$)/,token:"keyword"},{regex:/\S+[\)>\.\*\?]+(?=\s|$)/,token:"builtin"},{regex:/[\)><]+\S+(?=\s|$)/,token:"builtin"},{regex:/(?:[\+\-\=\/\*<>])(?=\s|$)/,token:"keyword"},{regex:/\S+/,token:"variable"},{regex:/\s+|./,token:null}],vocabulary:[{regex:/;/,token:"keyword",next:"start"},{regex:/\S+/,token:"tag"},{regex:/\s+|./,token:null}],string:[{regex:/(?:[^\\]|\\.)*?"/,token:"string",next:"start"},{regex:/.*/,token:"string"}],string2:[{regex:/^;/,token:"keyword",next:"start"},{regex:/.*/,token:"string"}],string3:[{regex:/(?:[^\\]|\\.)*?"""/,token:"string",next:"start"},{regex:/.*/,token:"string"}],stack:[{regex:/\)/,token:"bracket",next:"start"},{regex:/--/,token:"bracket"},{regex:/\S+/,token:"meta"},{regex:/\s+|./,token:null}],languageData:{name:"factor",dontIndentStates:["start","vocabulary","string","string3","stack"],commentTokens:{line:"!"}}});export{t as factor};
+import{s as e}from"./simple-mode-VRHOsiuL.js";const t=e({start:[{regex:/#?!.*/,token:"comment"},{regex:/"""/,token:"string",next:"string3"},{regex:/(STRING:)(\s)/,token:["keyword",null],next:"string2"},{regex:/\S*?"/,token:"string",next:"string"},{regex:/(?:0x[\d,a-f]+)|(?:0o[0-7]+)|(?:0b[0,1]+)|(?:\-?\d+.?\d*)(?=\s)/,token:"number"},{regex:/((?:GENERIC)|\:?\:)(\s+)(\S+)(\s+)(\()/,token:["keyword",null,"def",null,"bracket"],next:"stack"},{regex:/(M\:)(\s+)(\S+)(\s+)(\S+)/,token:["keyword",null,"def",null,"tag"]},{regex:/USING\:/,token:"keyword",next:"vocabulary"},{regex:/(USE\:|IN\:)(\s+)(\S+)(?=\s|$)/,token:["keyword",null,"tag"]},{regex:/(\S+\:)(\s+)(\S+)(?=\s|$)/,token:["keyword",null,"def"]},{regex:/(?:;|\\|t|f|if|loop|while|until|do|PRIVATE>|<PRIVATE|\.|\S*\[|\]|\S*\{|\})(?=\s|$)/,token:"keyword"},{regex:/\S+[\)>\.\*\?]+(?=\s|$)/,token:"builtin"},{regex:/[\)><]+\S+(?=\s|$)/,token:"builtin"},{regex:/(?:[\+\-\=\/\*<>])(?=\s|$)/,token:"keyword"},{regex:/\S+/,token:"variable"},{regex:/\s+|./,token:null}],vocabulary:[{regex:/;/,token:"keyword",next:"start"},{regex:/\S+/,token:"tag"},{regex:/\s+|./,token:null}],string:[{regex:/(?:[^\\]|\\.)*?"/,token:"string",next:"start"},{regex:/.*/,token:"string"}],string2:[{regex:/^;/,token:"keyword",next:"start"},{regex:/.*/,token:"string"}],string3:[{regex:/(?:[^\\]|\\.)*?"""/,token:"string",next:"start"},{regex:/.*/,token:"string"}],stack:[{regex:/\)/,token:"bracket",next:"start"},{regex:/--/,token:"bracket"},{regex:/\S+/,token:"meta"},{regex:/\s+|./,token:null}],languageData:{name:"factor",dontIndentStates:["start","vocabulary","string","string3","stack"],commentTokens:{line:"!"}}});export{t as factor};

File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-B5JeZsmF.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-B7tHWccP.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-BDz6-lbd.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-BJGpgU5Y.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-BJiyyGqZ.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-BKjc7uyC.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-BL_t_ntH.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-BMNClJrW.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-BTAxP3mB.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-BiVteWwz.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-C4TeAHpL.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-C6CTVuvt.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-CB606nqP.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-CG3aUV_L.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-CJB1zGqD.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-CJhLK3a1.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-CMiehYAn.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-CUN-L9uH.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-CYWhQqFb.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-CdE5fhyF.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-CgEMB2FB.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-Ckjrdmtm.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-Ctywxs9F.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-CvY89YCL.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-D6K4mE4a.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-DHm9fpZm.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-DWxkS7ff.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-D_XwcRjc.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-DyVgTn8s.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-GtIxIVFm.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-MSjmRdH1.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-NkaBMccj.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-anbJ5y0U.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-dUWVmN8K.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-dljVoRYZ.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/index-objdOfoT.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/nsis-CKXvuz-E.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/simple-mode-D4Q6qQvj.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/simple-mode-VRHOsiuL.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/codemirror/stylus-3mOX9C7I.js


File diff suppressed because it is too large
+ 0 - 0
nicegui/elements/lib/echarts/echarts.js.map


File diff suppressed because it is too large
+ 0 - 34
nicegui/elements/lib/echarts/echarts.min.js


+ 0 - 144
nicegui/elements/lib/mermaid/arc-8b90ddc8.js

@@ -1,144 +0,0 @@
-import { c as constant, p as path } from "./constant-b644328d.js";
-import { aW as pi, aX as cos, aY as sin, aZ as halfPi, a_ as epsilon, W as tau, a$ as sqrt, b0 as min, b1 as abs, b2 as atan2, b3 as asin, b4 as acos, b5 as max } from "./mermaid-f344f6a7.js";
-function arcInnerRadius(d) {
-  return d.innerRadius;
-}
-function arcOuterRadius(d) {
-  return d.outerRadius;
-}
-function arcStartAngle(d) {
-  return d.startAngle;
-}
-function arcEndAngle(d) {
-  return d.endAngle;
-}
-function arcPadAngle(d) {
-  return d && d.padAngle;
-}
-function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
-  var x10 = x1 - x0, y10 = y1 - y0, x32 = x3 - x2, y32 = y3 - y2, t = y32 * x10 - x32 * y10;
-  if (t * t < epsilon)
-    return;
-  t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;
-  return [x0 + t * x10, y0 + t * y10];
-}
-function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
-  var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00;
-  if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1)
-    cx0 = cx1, cy0 = cy1;
-  return {
-    cx: cx0,
-    cy: cy0,
-    x01: -ox,
-    y01: -oy,
-    x11: cx0 * (r1 / r - 1),
-    y11: cy0 * (r1 / r - 1)
-  };
-}
-function d3arc() {
-  var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = constant(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null;
-  function arc() {
-    var buffer, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - halfPi, a1 = endAngle.apply(this, arguments) - halfPi, da = abs(a1 - a0), cw = a1 > a0;
-    if (!context)
-      context = buffer = path();
-    if (r1 < r0)
-      r = r1, r1 = r0, r0 = r;
-    if (!(r1 > epsilon))
-      context.moveTo(0, 0);
-    else if (da > tau - epsilon) {
-      context.moveTo(r1 * cos(a0), r1 * sin(a0));
-      context.arc(0, 0, r1, a0, a1, !cw);
-      if (r0 > epsilon) {
-        context.moveTo(r0 * cos(a1), r0 * sin(a1));
-        context.arc(0, 0, r0, a1, a0, cw);
-      }
-    } else {
-      var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > epsilon && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)), rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t0, t1;
-      if (rp > epsilon) {
-        var p0 = asin(rp / r0 * sin(ap)), p1 = asin(rp / r1 * sin(ap));
-        if ((da0 -= p0 * 2) > epsilon)
-          p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0;
-        else
-          da0 = 0, a00 = a10 = (a0 + a1) / 2;
-        if ((da1 -= p1 * 2) > epsilon)
-          p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1;
-        else
-          da1 = 0, a01 = a11 = (a0 + a1) / 2;
-      }
-      var x01 = r1 * cos(a01), y01 = r1 * sin(a01), x10 = r0 * cos(a10), y10 = r0 * sin(a10);
-      if (rc > epsilon) {
-        var x11 = r1 * cos(a11), y11 = r1 * sin(a11), x00 = r0 * cos(a00), y00 = r0 * sin(a00), oc;
-        if (da < pi && (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10))) {
-          var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2), lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
-          rc0 = min(rc, (r0 - lc) / (kc - 1));
-          rc1 = min(rc, (r1 - lc) / (kc + 1));
-        }
-      }
-      if (!(da1 > epsilon))
-        context.moveTo(x01, y01);
-      else if (rc1 > epsilon) {
-        t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
-        t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);
-        context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);
-        if (rc1 < rc)
-          context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
-        else {
-          context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
-          context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
-          context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
-        }
-      } else
-        context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);
-      if (!(r0 > epsilon) || !(da0 > epsilon))
-        context.lineTo(x10, y10);
-      else if (rc0 > epsilon) {
-        t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
-        t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);
-        context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);
-        if (rc0 < rc)
-          context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
-        else {
-          context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
-          context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);
-          context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
-        }
-      } else
-        context.arc(0, 0, r0, a10, a00, cw);
-    }
-    context.closePath();
-    if (buffer)
-      return context = null, buffer + "" || null;
-  }
-  arc.centroid = function() {
-    var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;
-    return [cos(a) * r, sin(a) * r];
-  };
-  arc.innerRadius = function(_) {
-    return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant(+_), arc) : innerRadius;
-  };
-  arc.outerRadius = function(_) {
-    return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant(+_), arc) : outerRadius;
-  };
-  arc.cornerRadius = function(_) {
-    return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant(+_), arc) : cornerRadius;
-  };
-  arc.padRadius = function(_) {
-    return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant(+_), arc) : padRadius;
-  };
-  arc.startAngle = function(_) {
-    return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), arc) : startAngle;
-  };
-  arc.endAngle = function(_) {
-    return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), arc) : endAngle;
-  };
-  arc.padAngle = function(_) {
-    return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), arc) : padAngle;
-  };
-  arc.context = function(_) {
-    return arguments.length ? (context = _ == null ? null : _, arc) : context;
-  };
-  return arc;
-}
-export {
-  d3arc as d
-};

+ 0 - 84
nicegui/elements/lib/mermaid/arc-907dcd53.js

@@ -1,84 +0,0 @@
-import { c as X, p as sn } from "./constant-2fe7eae5.js";
-import { aW as en, aX as j, aY as P, aZ as an, a_ as y, W as ln, a$ as C, b0 as k, b1 as rn, b2 as t, b3 as un, b4 as on, b5 as tn } from "./mermaid-5f2d2ec5.js";
-function fn(l) {
-  return l.innerRadius;
-}
-function cn(l) {
-  return l.outerRadius;
-}
-function yn(l) {
-  return l.startAngle;
-}
-function gn(l) {
-  return l.endAngle;
-}
-function mn(l) {
-  return l && l.padAngle;
-}
-function pn(l, x, w, W, h, v, Y, a) {
-  var s = w - l, n = W - x, m = Y - h, i = a - v, r = i * s - m * n;
-  if (!(r * r < y))
-    return r = (m * (x - v) - i * (l - h)) / r, [l + r * s, x + r * n];
-}
-function K(l, x, w, W, h, v, Y) {
-  var a = l - w, s = x - W, n = (Y ? v : -v) / C(a * a + s * s), m = n * s, i = -n * a, r = l + m, f = x + i, c = w + m, D = W + i, o = (r + c) / 2, E = (f + D) / 2, p = c - r, g = D - f, A = p * p + g * g, I = h - v, b = r * D - c * f, O = (g < 0 ? -1 : 1) * C(tn(0, I * I * A - b * b)), S = (b * g - p * O) / A, d = (-b * p - g * O) / A, R = (b * g + p * O) / A, T = (-b * p + g * O) / A, e = S - o, u = d - E, Z = R - o, $ = T - E;
-  return e * e + u * u > Z * Z + $ * $ && (S = R, d = T), {
-    cx: S,
-    cy: d,
-    x01: -m,
-    y01: -i,
-    x11: S * (h / I - 1),
-    y11: d * (h / I - 1)
-  };
-}
-function hn() {
-  var l = fn, x = cn, w = X(0), W = null, h = yn, v = gn, Y = mn, a = null;
-  function s() {
-    var n, m, i = +l.apply(this, arguments), r = +x.apply(this, arguments), f = h.apply(this, arguments) - an, c = v.apply(this, arguments) - an, D = rn(c - f), o = c > f;
-    if (a || (a = n = sn()), r < i && (m = r, r = i, i = m), !(r > y))
-      a.moveTo(0, 0);
-    else if (D > ln - y)
-      a.moveTo(r * j(f), r * P(f)), a.arc(0, 0, r, f, c, !o), i > y && (a.moveTo(i * j(c), i * P(c)), a.arc(0, 0, i, c, f, o));
-    else {
-      var E = f, p = c, g = f, A = c, I = D, b = D, O = Y.apply(this, arguments) / 2, S = O > y && (W ? +W.apply(this, arguments) : C(i * i + r * r)), d = k(rn(r - i) / 2, +w.apply(this, arguments)), R = d, T = d, e, u;
-      if (S > y) {
-        var Z = un(S / i * P(O)), $ = un(S / r * P(O));
-        (I -= Z * 2) > y ? (Z *= o ? 1 : -1, g += Z, A -= Z) : (I = 0, g = A = (f + c) / 2), (b -= $ * 2) > y ? ($ *= o ? 1 : -1, E += $, p -= $) : (b = 0, E = p = (f + c) / 2);
-      }
-      var z = r * j(E), B = r * P(E), F = i * j(A), G = i * P(A);
-      if (d > y) {
-        var H = r * j(p), J = r * P(p), L = i * j(g), M = i * P(g), q;
-        if (D < en && (q = pn(z, B, L, M, H, J, F, G))) {
-          var N = z - q[0], Q = B - q[1], U = H - q[0], V = J - q[1], _ = 1 / P(on((N * U + Q * V) / (C(N * N + Q * Q) * C(U * U + V * V))) / 2), nn = C(q[0] * q[0] + q[1] * q[1]);
-          R = k(d, (i - nn) / (_ - 1)), T = k(d, (r - nn) / (_ + 1));
-        }
-      }
-      b > y ? T > y ? (e = K(L, M, z, B, r, T, o), u = K(H, J, F, G, r, T, o), a.moveTo(e.cx + e.x01, e.cy + e.y01), T < d ? a.arc(e.cx, e.cy, T, t(e.y01, e.x01), t(u.y01, u.x01), !o) : (a.arc(e.cx, e.cy, T, t(e.y01, e.x01), t(e.y11, e.x11), !o), a.arc(0, 0, r, t(e.cy + e.y11, e.cx + e.x11), t(u.cy + u.y11, u.cx + u.x11), !o), a.arc(u.cx, u.cy, T, t(u.y11, u.x11), t(u.y01, u.x01), !o))) : (a.moveTo(z, B), a.arc(0, 0, r, E, p, !o)) : a.moveTo(z, B), !(i > y) || !(I > y) ? a.lineTo(F, G) : R > y ? (e = K(F, G, H, J, i, -R, o), u = K(z, B, L, M, i, -R, o), a.lineTo(e.cx + e.x01, e.cy + e.y01), R < d ? a.arc(e.cx, e.cy, R, t(e.y01, e.x01), t(u.y01, u.x01), !o) : (a.arc(e.cx, e.cy, R, t(e.y01, e.x01), t(e.y11, e.x11), !o), a.arc(0, 0, i, t(e.cy + e.y11, e.cx + e.x11), t(u.cy + u.y11, u.cx + u.x11), o), a.arc(u.cx, u.cy, R, t(u.y11, u.x11), t(u.y01, u.x01), !o))) : a.arc(0, 0, i, A, g, o);
-    }
-    if (a.closePath(), n)
-      return a = null, n + "" || null;
-  }
-  return s.centroid = function() {
-    var n = (+l.apply(this, arguments) + +x.apply(this, arguments)) / 2, m = (+h.apply(this, arguments) + +v.apply(this, arguments)) / 2 - en / 2;
-    return [j(m) * n, P(m) * n];
-  }, s.innerRadius = function(n) {
-    return arguments.length ? (l = typeof n == "function" ? n : X(+n), s) : l;
-  }, s.outerRadius = function(n) {
-    return arguments.length ? (x = typeof n == "function" ? n : X(+n), s) : x;
-  }, s.cornerRadius = function(n) {
-    return arguments.length ? (w = typeof n == "function" ? n : X(+n), s) : w;
-  }, s.padRadius = function(n) {
-    return arguments.length ? (W = n == null ? null : typeof n == "function" ? n : X(+n), s) : W;
-  }, s.startAngle = function(n) {
-    return arguments.length ? (h = typeof n == "function" ? n : X(+n), s) : h;
-  }, s.endAngle = function(n) {
-    return arguments.length ? (v = typeof n == "function" ? n : X(+n), s) : v;
-  }, s.padAngle = function(n) {
-    return arguments.length ? (Y = typeof n == "function" ? n : X(+n), s) : Y;
-  }, s.context = function(n) {
-    return arguments.length ? (a = n ?? null, s) : a;
-  }, s;
-}
-export {
-  hn as d
-};

+ 0 - 6
nicegui/elements/lib/mermaid/array-2ff2c7a6.js

@@ -1,6 +0,0 @@
-function t(r) {
-  return typeof r == "object" && "length" in r ? r : Array.from(r);
-}
-export {
-  t as a
-};

+ 0 - 6
nicegui/elements/lib/mermaid/array-b7dcf730.js

@@ -1,6 +0,0 @@
-function array(x) {
-  return typeof x === "object" && "length" in x ? x : Array.from(x);
-}
-export {
-  array as a
-};

File diff suppressed because it is too large
+ 0 - 183
nicegui/elements/lib/mermaid/c4Diagram-331b94a9.js


+ 1961 - 0
nicegui/elements/lib/mermaid/chunks/mermaid.core/blockDiagram-V6UOASA5.mjs

@@ -0,0 +1,1961 @@
+import {
+  insertEdge,
+  insertEdgeLabel,
+  markers_default,
+  positionEdgeLabel
+} from "./chunk-PDCO53Z4.mjs";
+import {
+  insertNode,
+  positionNode
+} from "./chunk-Z2VRG6XP.mjs";
+import "./chunk-TINLTEC2.mjs";
+import "./chunk-OERGPBFJ.mjs";
+import {
+  getStylesFromArray
+} from "./chunk-VKXSJROQ.mjs";
+import {
+  __name,
+  clear,
+  common_default,
+  configureSvgSize,
+  getConfig,
+  getConfig2,
+  log
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/diagrams/block/parser/block.jison
+var parser = function() {
+  var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
+    for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
+    return o2;
+  }, "o"), $V0 = [1, 7], $V1 = [1, 13], $V2 = [1, 14], $V3 = [1, 15], $V4 = [1, 19], $V5 = [1, 16], $V6 = [1, 17], $V7 = [1, 18], $V8 = [8, 30], $V9 = [8, 21, 28, 29, 30, 31, 32, 40, 44, 47], $Va = [1, 23], $Vb = [1, 24], $Vc = [8, 15, 16, 21, 28, 29, 30, 31, 32, 40, 44, 47], $Vd = [8, 15, 16, 21, 27, 28, 29, 30, 31, 32, 40, 44, 47], $Ve = [1, 49];
+  var parser2 = {
+    trace: /* @__PURE__ */ __name(function trace() {
+    }, "trace"),
+    yy: {},
+    symbols_: { "error": 2, "spaceLines": 3, "SPACELINE": 4, "NL": 5, "separator": 6, "SPACE": 7, "EOF": 8, "start": 9, "BLOCK_DIAGRAM_KEY": 10, "document": 11, "stop": 12, "statement": 13, "link": 14, "LINK": 15, "START_LINK": 16, "LINK_LABEL": 17, "STR": 18, "nodeStatement": 19, "columnsStatement": 20, "SPACE_BLOCK": 21, "blockStatement": 22, "classDefStatement": 23, "cssClassStatement": 24, "styleStatement": 25, "node": 26, "SIZE": 27, "COLUMNS": 28, "id-block": 29, "end": 30, "block": 31, "NODE_ID": 32, "nodeShapeNLabel": 33, "dirList": 34, "DIR": 35, "NODE_DSTART": 36, "NODE_DEND": 37, "BLOCK_ARROW_START": 38, "BLOCK_ARROW_END": 39, "classDef": 40, "CLASSDEF_ID": 41, "CLASSDEF_STYLEOPTS": 42, "DEFAULT": 43, "class": 44, "CLASSENTITY_IDS": 45, "STYLECLASS": 46, "style": 47, "STYLE_ENTITY_IDS": 48, "STYLE_DEFINITION_DATA": 49, "$accept": 0, "$end": 1 },
+    terminals_: { 2: "error", 4: "SPACELINE", 5: "NL", 7: "SPACE", 8: "EOF", 10: "BLOCK_DIAGRAM_KEY", 15: "LINK", 16: "START_LINK", 17: "LINK_LABEL", 18: "STR", 21: "SPACE_BLOCK", 27: "SIZE", 28: "COLUMNS", 29: "id-block", 30: "end", 31: "block", 32: "NODE_ID", 35: "DIR", 36: "NODE_DSTART", 37: "NODE_DEND", 38: "BLOCK_ARROW_START", 39: "BLOCK_ARROW_END", 40: "classDef", 41: "CLASSDEF_ID", 42: "CLASSDEF_STYLEOPTS", 43: "DEFAULT", 44: "class", 45: "CLASSENTITY_IDS", 46: "STYLECLASS", 47: "style", 48: "STYLE_ENTITY_IDS", 49: "STYLE_DEFINITION_DATA" },
+    productions_: [0, [3, 1], [3, 2], [3, 2], [6, 1], [6, 1], [6, 1], [9, 3], [12, 1], [12, 1], [12, 2], [12, 2], [11, 1], [11, 2], [14, 1], [14, 4], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [19, 3], [19, 2], [19, 1], [20, 1], [22, 4], [22, 3], [26, 1], [26, 2], [34, 1], [34, 2], [33, 3], [33, 4], [23, 3], [23, 3], [24, 3], [25, 3]],
+    performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
+      var $0 = $$.length - 1;
+      switch (yystate) {
+        case 4:
+          yy.getLogger().debug("Rule: separator (NL) ");
+          break;
+        case 5:
+          yy.getLogger().debug("Rule: separator (Space) ");
+          break;
+        case 6:
+          yy.getLogger().debug("Rule: separator (EOF) ");
+          break;
+        case 7:
+          yy.getLogger().debug("Rule: hierarchy: ", $$[$0 - 1]);
+          yy.setHierarchy($$[$0 - 1]);
+          break;
+        case 8:
+          yy.getLogger().debug("Stop NL ");
+          break;
+        case 9:
+          yy.getLogger().debug("Stop EOF ");
+          break;
+        case 10:
+          yy.getLogger().debug("Stop NL2 ");
+          break;
+        case 11:
+          yy.getLogger().debug("Stop EOF2 ");
+          break;
+        case 12:
+          yy.getLogger().debug("Rule: statement: ", $$[$0]);
+          typeof $$[$0].length === "number" ? this.$ = $$[$0] : this.$ = [$$[$0]];
+          break;
+        case 13:
+          yy.getLogger().debug("Rule: statement #2: ", $$[$0 - 1]);
+          this.$ = [$$[$0 - 1]].concat($$[$0]);
+          break;
+        case 14:
+          yy.getLogger().debug("Rule: link: ", $$[$0], yytext);
+          this.$ = { edgeTypeStr: $$[$0], label: "" };
+          break;
+        case 15:
+          yy.getLogger().debug("Rule: LABEL link: ", $$[$0 - 3], $$[$0 - 1], $$[$0]);
+          this.$ = { edgeTypeStr: $$[$0], label: $$[$0 - 1] };
+          break;
+        case 18:
+          const num = parseInt($$[$0]);
+          const spaceId = yy.generateId();
+          this.$ = { id: spaceId, type: "space", label: "", width: num, children: [] };
+          break;
+        case 23:
+          yy.getLogger().debug("Rule: (nodeStatement link node) ", $$[$0 - 2], $$[$0 - 1], $$[$0], " typestr: ", $$[$0 - 1].edgeTypeStr);
+          const edgeData = yy.edgeStrToEdgeData($$[$0 - 1].edgeTypeStr);
+          this.$ = [
+            { id: $$[$0 - 2].id, label: $$[$0 - 2].label, type: $$[$0 - 2].type, directions: $$[$0 - 2].directions },
+            { id: $$[$0 - 2].id + "-" + $$[$0].id, start: $$[$0 - 2].id, end: $$[$0].id, label: $$[$0 - 1].label, type: "edge", directions: $$[$0].directions, arrowTypeEnd: edgeData, arrowTypeStart: "arrow_open" },
+            { id: $$[$0].id, label: $$[$0].label, type: yy.typeStr2Type($$[$0].typeStr), directions: $$[$0].directions }
+          ];
+          break;
+        case 24:
+          yy.getLogger().debug("Rule: nodeStatement (abc88 node size) ", $$[$0 - 1], $$[$0]);
+          this.$ = { id: $$[$0 - 1].id, label: $$[$0 - 1].label, type: yy.typeStr2Type($$[$0 - 1].typeStr), directions: $$[$0 - 1].directions, widthInColumns: parseInt($$[$0], 10) };
+          break;
+        case 25:
+          yy.getLogger().debug("Rule: nodeStatement (node) ", $$[$0]);
+          this.$ = { id: $$[$0].id, label: $$[$0].label, type: yy.typeStr2Type($$[$0].typeStr), directions: $$[$0].directions, widthInColumns: 1 };
+          break;
+        case 26:
+          yy.getLogger().debug("APA123", this ? this : "na");
+          yy.getLogger().debug("COLUMNS: ", $$[$0]);
+          this.$ = { type: "column-setting", columns: $$[$0] === "auto" ? -1 : parseInt($$[$0]) };
+          break;
+        case 27:
+          yy.getLogger().debug("Rule: id-block statement : ", $$[$0 - 2], $$[$0 - 1]);
+          const id2 = yy.generateId();
+          this.$ = { ...$$[$0 - 2], type: "composite", children: $$[$0 - 1] };
+          break;
+        case 28:
+          yy.getLogger().debug("Rule: blockStatement : ", $$[$0 - 2], $$[$0 - 1], $$[$0]);
+          const id = yy.generateId();
+          this.$ = { id, type: "composite", label: "", children: $$[$0 - 1] };
+          break;
+        case 29:
+          yy.getLogger().debug("Rule: node (NODE_ID separator): ", $$[$0]);
+          this.$ = { id: $$[$0] };
+          break;
+        case 30:
+          yy.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ", $$[$0 - 1], $$[$0]);
+          this.$ = { id: $$[$0 - 1], label: $$[$0].label, typeStr: $$[$0].typeStr, directions: $$[$0].directions };
+          break;
+        case 31:
+          yy.getLogger().debug("Rule: dirList: ", $$[$0]);
+          this.$ = [$$[$0]];
+          break;
+        case 32:
+          yy.getLogger().debug("Rule: dirList: ", $$[$0 - 1], $$[$0]);
+          this.$ = [$$[$0 - 1]].concat($$[$0]);
+          break;
+        case 33:
+          yy.getLogger().debug("Rule: nodeShapeNLabel: ", $$[$0 - 2], $$[$0 - 1], $$[$0]);
+          this.$ = { typeStr: $$[$0 - 2] + $$[$0], label: $$[$0 - 1] };
+          break;
+        case 34:
+          yy.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ", $$[$0 - 3], $$[$0 - 2], " #3:", $$[$0 - 1], $$[$0]);
+          this.$ = { typeStr: $$[$0 - 3] + $$[$0], label: $$[$0 - 2], directions: $$[$0 - 1] };
+          break;
+        case 35:
+        case 36:
+          this.$ = { type: "classDef", id: $$[$0 - 1].trim(), css: $$[$0].trim() };
+          break;
+        case 37:
+          this.$ = { type: "applyClass", id: $$[$0 - 1].trim(), styleClass: $$[$0].trim() };
+          break;
+        case 38:
+          this.$ = { type: "applyStyles", id: $$[$0 - 1].trim(), stylesStr: $$[$0].trim() };
+          break;
+      }
+    }, "anonymous"),
+    table: [{ 9: 1, 10: [1, 2] }, { 1: [3] }, { 11: 3, 13: 4, 19: 5, 20: 6, 21: $V0, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: $V1, 29: $V2, 31: $V3, 32: $V4, 40: $V5, 44: $V6, 47: $V7 }, { 8: [1, 20] }, o($V8, [2, 12], { 13: 4, 19: 5, 20: 6, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 11: 21, 21: $V0, 28: $V1, 29: $V2, 31: $V3, 32: $V4, 40: $V5, 44: $V6, 47: $V7 }), o($V9, [2, 16], { 14: 22, 15: $Va, 16: $Vb }), o($V9, [2, 17]), o($V9, [2, 18]), o($V9, [2, 19]), o($V9, [2, 20]), o($V9, [2, 21]), o($V9, [2, 22]), o($Vc, [2, 25], { 27: [1, 25] }), o($V9, [2, 26]), { 19: 26, 26: 12, 32: $V4 }, { 11: 27, 13: 4, 19: 5, 20: 6, 21: $V0, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: $V1, 29: $V2, 31: $V3, 32: $V4, 40: $V5, 44: $V6, 47: $V7 }, { 41: [1, 28], 43: [1, 29] }, { 45: [1, 30] }, { 48: [1, 31] }, o($Vd, [2, 29], { 33: 32, 36: [1, 33], 38: [1, 34] }), { 1: [2, 7] }, o($V8, [2, 13]), { 26: 35, 32: $V4 }, { 32: [2, 14] }, { 17: [1, 36] }, o($Vc, [2, 24]), { 11: 37, 13: 4, 14: 22, 15: $Va, 16: $Vb, 19: 5, 20: 6, 21: $V0, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: $V1, 29: $V2, 31: $V3, 32: $V4, 40: $V5, 44: $V6, 47: $V7 }, { 30: [1, 38] }, { 42: [1, 39] }, { 42: [1, 40] }, { 46: [1, 41] }, { 49: [1, 42] }, o($Vd, [2, 30]), { 18: [1, 43] }, { 18: [1, 44] }, o($Vc, [2, 23]), { 18: [1, 45] }, { 30: [1, 46] }, o($V9, [2, 28]), o($V9, [2, 35]), o($V9, [2, 36]), o($V9, [2, 37]), o($V9, [2, 38]), { 37: [1, 47] }, { 34: 48, 35: $Ve }, { 15: [1, 50] }, o($V9, [2, 27]), o($Vd, [2, 33]), { 39: [1, 51] }, { 34: 52, 35: $Ve, 39: [2, 31] }, { 32: [2, 15] }, o($Vd, [2, 34]), { 39: [2, 32] }],
+    defaultActions: { 20: [2, 7], 23: [2, 14], 50: [2, 15], 52: [2, 32] },
+    parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
+      if (hash.recoverable) {
+        this.trace(str);
+      } else {
+        var error = new Error(str);
+        error.hash = hash;
+        throw error;
+      }
+    }, "parseError"),
+    parse: /* @__PURE__ */ __name(function parse(input) {
+      var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
+      var args = lstack.slice.call(arguments, 1);
+      var lexer2 = Object.create(this.lexer);
+      var sharedState = { yy: {} };
+      for (var k in this.yy) {
+        if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
+          sharedState.yy[k] = this.yy[k];
+        }
+      }
+      lexer2.setInput(input, sharedState.yy);
+      sharedState.yy.lexer = lexer2;
+      sharedState.yy.parser = this;
+      if (typeof lexer2.yylloc == "undefined") {
+        lexer2.yylloc = {};
+      }
+      var yyloc = lexer2.yylloc;
+      lstack.push(yyloc);
+      var ranges = lexer2.options && lexer2.options.ranges;
+      if (typeof sharedState.yy.parseError === "function") {
+        this.parseError = sharedState.yy.parseError;
+      } else {
+        this.parseError = Object.getPrototypeOf(this).parseError;
+      }
+      function popStack(n) {
+        stack.length = stack.length - 2 * n;
+        vstack.length = vstack.length - n;
+        lstack.length = lstack.length - n;
+      }
+      __name(popStack, "popStack");
+      function lex() {
+        var token;
+        token = tstack.pop() || lexer2.lex() || EOF;
+        if (typeof token !== "number") {
+          if (token instanceof Array) {
+            tstack = token;
+            token = tstack.pop();
+          }
+          token = self.symbols_[token] || token;
+        }
+        return token;
+      }
+      __name(lex, "lex");
+      var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
+      while (true) {
+        state = stack[stack.length - 1];
+        if (this.defaultActions[state]) {
+          action = this.defaultActions[state];
+        } else {
+          if (symbol === null || typeof symbol == "undefined") {
+            symbol = lex();
+          }
+          action = table[state] && table[state][symbol];
+        }
+        if (typeof action === "undefined" || !action.length || !action[0]) {
+          var errStr = "";
+          expected = [];
+          for (p in table[state]) {
+            if (this.terminals_[p] && p > TERROR) {
+              expected.push("'" + this.terminals_[p] + "'");
+            }
+          }
+          if (lexer2.showPosition) {
+            errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
+          } else {
+            errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
+          }
+          this.parseError(errStr, {
+            text: lexer2.match,
+            token: this.terminals_[symbol] || symbol,
+            line: lexer2.yylineno,
+            loc: yyloc,
+            expected
+          });
+        }
+        if (action[0] instanceof Array && action.length > 1) {
+          throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
+        }
+        switch (action[0]) {
+          case 1:
+            stack.push(symbol);
+            vstack.push(lexer2.yytext);
+            lstack.push(lexer2.yylloc);
+            stack.push(action[1]);
+            symbol = null;
+            if (!preErrorSymbol) {
+              yyleng = lexer2.yyleng;
+              yytext = lexer2.yytext;
+              yylineno = lexer2.yylineno;
+              yyloc = lexer2.yylloc;
+              if (recovering > 0) {
+                recovering--;
+              }
+            } else {
+              symbol = preErrorSymbol;
+              preErrorSymbol = null;
+            }
+            break;
+          case 2:
+            len = this.productions_[action[1]][1];
+            yyval.$ = vstack[vstack.length - len];
+            yyval._$ = {
+              first_line: lstack[lstack.length - (len || 1)].first_line,
+              last_line: lstack[lstack.length - 1].last_line,
+              first_column: lstack[lstack.length - (len || 1)].first_column,
+              last_column: lstack[lstack.length - 1].last_column
+            };
+            if (ranges) {
+              yyval._$.range = [
+                lstack[lstack.length - (len || 1)].range[0],
+                lstack[lstack.length - 1].range[1]
+              ];
+            }
+            r = this.performAction.apply(yyval, [
+              yytext,
+              yyleng,
+              yylineno,
+              sharedState.yy,
+              action[1],
+              vstack,
+              lstack
+            ].concat(args));
+            if (typeof r !== "undefined") {
+              return r;
+            }
+            if (len) {
+              stack = stack.slice(0, -1 * len * 2);
+              vstack = vstack.slice(0, -1 * len);
+              lstack = lstack.slice(0, -1 * len);
+            }
+            stack.push(this.productions_[action[1]][0]);
+            vstack.push(yyval.$);
+            lstack.push(yyval._$);
+            newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
+            stack.push(newState);
+            break;
+          case 3:
+            return true;
+        }
+      }
+      return true;
+    }, "parse")
+  };
+  var lexer = /* @__PURE__ */ function() {
+    var lexer2 = {
+      EOF: 1,
+      parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
+        if (this.yy.parser) {
+          this.yy.parser.parseError(str, hash);
+        } else {
+          throw new Error(str);
+        }
+      }, "parseError"),
+      // resets the lexer, sets new input
+      setInput: /* @__PURE__ */ __name(function(input, yy) {
+        this.yy = yy || this.yy || {};
+        this._input = input;
+        this._more = this._backtrack = this.done = false;
+        this.yylineno = this.yyleng = 0;
+        this.yytext = this.matched = this.match = "";
+        this.conditionStack = ["INITIAL"];
+        this.yylloc = {
+          first_line: 1,
+          first_column: 0,
+          last_line: 1,
+          last_column: 0
+        };
+        if (this.options.ranges) {
+          this.yylloc.range = [0, 0];
+        }
+        this.offset = 0;
+        return this;
+      }, "setInput"),
+      // consumes and returns one char from the input
+      input: /* @__PURE__ */ __name(function() {
+        var ch = this._input[0];
+        this.yytext += ch;
+        this.yyleng++;
+        this.offset++;
+        this.match += ch;
+        this.matched += ch;
+        var lines = ch.match(/(?:\r\n?|\n).*/g);
+        if (lines) {
+          this.yylineno++;
+          this.yylloc.last_line++;
+        } else {
+          this.yylloc.last_column++;
+        }
+        if (this.options.ranges) {
+          this.yylloc.range[1]++;
+        }
+        this._input = this._input.slice(1);
+        return ch;
+      }, "input"),
+      // unshifts one char (or a string) into the input
+      unput: /* @__PURE__ */ __name(function(ch) {
+        var len = ch.length;
+        var lines = ch.split(/(?:\r\n?|\n)/g);
+        this._input = ch + this._input;
+        this.yytext = this.yytext.substr(0, this.yytext.length - len);
+        this.offset -= len;
+        var oldLines = this.match.split(/(?:\r\n?|\n)/g);
+        this.match = this.match.substr(0, this.match.length - 1);
+        this.matched = this.matched.substr(0, this.matched.length - 1);
+        if (lines.length - 1) {
+          this.yylineno -= lines.length - 1;
+        }
+        var r = this.yylloc.range;
+        this.yylloc = {
+          first_line: this.yylloc.first_line,
+          last_line: this.yylineno + 1,
+          first_column: this.yylloc.first_column,
+          last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
+        };
+        if (this.options.ranges) {
+          this.yylloc.range = [r[0], r[0] + this.yyleng - len];
+        }
+        this.yyleng = this.yytext.length;
+        return this;
+      }, "unput"),
+      // When called from action, caches matched text and appends it on next action
+      more: /* @__PURE__ */ __name(function() {
+        this._more = true;
+        return this;
+      }, "more"),
+      // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
+      reject: /* @__PURE__ */ __name(function() {
+        if (this.options.backtrack_lexer) {
+          this._backtrack = true;
+        } else {
+          return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
+            text: "",
+            token: null,
+            line: this.yylineno
+          });
+        }
+        return this;
+      }, "reject"),
+      // retain first n characters of the match
+      less: /* @__PURE__ */ __name(function(n) {
+        this.unput(this.match.slice(n));
+      }, "less"),
+      // displays already matched input, i.e. for error messages
+      pastInput: /* @__PURE__ */ __name(function() {
+        var past = this.matched.substr(0, this.matched.length - this.match.length);
+        return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
+      }, "pastInput"),
+      // displays upcoming input, i.e. for error messages
+      upcomingInput: /* @__PURE__ */ __name(function() {
+        var next = this.match;
+        if (next.length < 20) {
+          next += this._input.substr(0, 20 - next.length);
+        }
+        return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
+      }, "upcomingInput"),
+      // displays the character position where the lexing error occurred, i.e. for error messages
+      showPosition: /* @__PURE__ */ __name(function() {
+        var pre = this.pastInput();
+        var c = new Array(pre.length + 1).join("-");
+        return pre + this.upcomingInput() + "\n" + c + "^";
+      }, "showPosition"),
+      // test the lexed token: return FALSE when not a match, otherwise return token
+      test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
+        var token, lines, backup;
+        if (this.options.backtrack_lexer) {
+          backup = {
+            yylineno: this.yylineno,
+            yylloc: {
+              first_line: this.yylloc.first_line,
+              last_line: this.last_line,
+              first_column: this.yylloc.first_column,
+              last_column: this.yylloc.last_column
+            },
+            yytext: this.yytext,
+            match: this.match,
+            matches: this.matches,
+            matched: this.matched,
+            yyleng: this.yyleng,
+            offset: this.offset,
+            _more: this._more,
+            _input: this._input,
+            yy: this.yy,
+            conditionStack: this.conditionStack.slice(0),
+            done: this.done
+          };
+          if (this.options.ranges) {
+            backup.yylloc.range = this.yylloc.range.slice(0);
+          }
+        }
+        lines = match[0].match(/(?:\r\n?|\n).*/g);
+        if (lines) {
+          this.yylineno += lines.length;
+        }
+        this.yylloc = {
+          first_line: this.yylloc.last_line,
+          last_line: this.yylineno + 1,
+          first_column: this.yylloc.last_column,
+          last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
+        };
+        this.yytext += match[0];
+        this.match += match[0];
+        this.matches = match;
+        this.yyleng = this.yytext.length;
+        if (this.options.ranges) {
+          this.yylloc.range = [this.offset, this.offset += this.yyleng];
+        }
+        this._more = false;
+        this._backtrack = false;
+        this._input = this._input.slice(match[0].length);
+        this.matched += match[0];
+        token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
+        if (this.done && this._input) {
+          this.done = false;
+        }
+        if (token) {
+          return token;
+        } else if (this._backtrack) {
+          for (var k in backup) {
+            this[k] = backup[k];
+          }
+          return false;
+        }
+        return false;
+      }, "test_match"),
+      // return next match in input
+      next: /* @__PURE__ */ __name(function() {
+        if (this.done) {
+          return this.EOF;
+        }
+        if (!this._input) {
+          this.done = true;
+        }
+        var token, match, tempMatch, index;
+        if (!this._more) {
+          this.yytext = "";
+          this.match = "";
+        }
+        var rules = this._currentRules();
+        for (var i = 0; i < rules.length; i++) {
+          tempMatch = this._input.match(this.rules[rules[i]]);
+          if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
+            match = tempMatch;
+            index = i;
+            if (this.options.backtrack_lexer) {
+              token = this.test_match(tempMatch, rules[i]);
+              if (token !== false) {
+                return token;
+              } else if (this._backtrack) {
+                match = false;
+                continue;
+              } else {
+                return false;
+              }
+            } else if (!this.options.flex) {
+              break;
+            }
+          }
+        }
+        if (match) {
+          token = this.test_match(match, rules[index]);
+          if (token !== false) {
+            return token;
+          }
+          return false;
+        }
+        if (this._input === "") {
+          return this.EOF;
+        } else {
+          return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
+            text: "",
+            token: null,
+            line: this.yylineno
+          });
+        }
+      }, "next"),
+      // return next match that has a token
+      lex: /* @__PURE__ */ __name(function lex() {
+        var r = this.next();
+        if (r) {
+          return r;
+        } else {
+          return this.lex();
+        }
+      }, "lex"),
+      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
+      begin: /* @__PURE__ */ __name(function begin(condition) {
+        this.conditionStack.push(condition);
+      }, "begin"),
+      // pop the previously active lexer condition state off the condition stack
+      popState: /* @__PURE__ */ __name(function popState() {
+        var n = this.conditionStack.length - 1;
+        if (n > 0) {
+          return this.conditionStack.pop();
+        } else {
+          return this.conditionStack[0];
+        }
+      }, "popState"),
+      // produce the lexer rule set which is active for the currently active lexer condition state
+      _currentRules: /* @__PURE__ */ __name(function _currentRules() {
+        if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
+          return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
+        } else {
+          return this.conditions["INITIAL"].rules;
+        }
+      }, "_currentRules"),
+      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
+      topState: /* @__PURE__ */ __name(function topState(n) {
+        n = this.conditionStack.length - 1 - Math.abs(n || 0);
+        if (n >= 0) {
+          return this.conditionStack[n];
+        } else {
+          return "INITIAL";
+        }
+      }, "topState"),
+      // alias for begin(condition)
+      pushState: /* @__PURE__ */ __name(function pushState(condition) {
+        this.begin(condition);
+      }, "pushState"),
+      // return the number of states currently on the stack
+      stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
+        return this.conditionStack.length;
+      }, "stateStackSize"),
+      options: {},
+      performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
+        var YYSTATE = YY_START;
+        switch ($avoiding_name_collisions) {
+          case 0:
+            return 10;
+            break;
+          case 1:
+            yy.getLogger().debug("Found space-block");
+            return 31;
+            break;
+          case 2:
+            yy.getLogger().debug("Found nl-block");
+            return 31;
+            break;
+          case 3:
+            yy.getLogger().debug("Found space-block");
+            return 29;
+            break;
+          case 4:
+            yy.getLogger().debug(".", yy_.yytext);
+            break;
+          case 5:
+            yy.getLogger().debug("_", yy_.yytext);
+            break;
+          case 6:
+            return 5;
+            break;
+          case 7:
+            yy_.yytext = -1;
+            return 28;
+            break;
+          case 8:
+            yy_.yytext = yy_.yytext.replace(/columns\s+/, "");
+            yy.getLogger().debug("COLUMNS (LEX)", yy_.yytext);
+            return 28;
+            break;
+          case 9:
+            this.pushState("md_string");
+            break;
+          case 10:
+            return "MD_STR";
+            break;
+          case 11:
+            this.popState();
+            break;
+          case 12:
+            this.pushState("string");
+            break;
+          case 13:
+            yy.getLogger().debug("LEX: POPPING STR:", yy_.yytext);
+            this.popState();
+            break;
+          case 14:
+            yy.getLogger().debug("LEX: STR end:", yy_.yytext);
+            return "STR";
+            break;
+          case 15:
+            yy_.yytext = yy_.yytext.replace(/space\:/, "");
+            yy.getLogger().debug("SPACE NUM (LEX)", yy_.yytext);
+            return 21;
+            break;
+          case 16:
+            yy_.yytext = "1";
+            yy.getLogger().debug("COLUMNS (LEX)", yy_.yytext);
+            return 21;
+            break;
+          case 17:
+            return 43;
+            break;
+          case 18:
+            return "LINKSTYLE";
+            break;
+          case 19:
+            return "INTERPOLATE";
+            break;
+          case 20:
+            this.pushState("CLASSDEF");
+            return 40;
+            break;
+          case 21:
+            this.popState();
+            this.pushState("CLASSDEFID");
+            return "DEFAULT_CLASSDEF_ID";
+            break;
+          case 22:
+            this.popState();
+            this.pushState("CLASSDEFID");
+            return 41;
+            break;
+          case 23:
+            this.popState();
+            return 42;
+            break;
+          case 24:
+            this.pushState("CLASS");
+            return 44;
+            break;
+          case 25:
+            this.popState();
+            this.pushState("CLASS_STYLE");
+            return 45;
+            break;
+          case 26:
+            this.popState();
+            return 46;
+            break;
+          case 27:
+            this.pushState("STYLE_STMNT");
+            return 47;
+            break;
+          case 28:
+            this.popState();
+            this.pushState("STYLE_DEFINITION");
+            return 48;
+            break;
+          case 29:
+            this.popState();
+            return 49;
+            break;
+          case 30:
+            this.pushState("acc_title");
+            return "acc_title";
+            break;
+          case 31:
+            this.popState();
+            return "acc_title_value";
+            break;
+          case 32:
+            this.pushState("acc_descr");
+            return "acc_descr";
+            break;
+          case 33:
+            this.popState();
+            return "acc_descr_value";
+            break;
+          case 34:
+            this.pushState("acc_descr_multiline");
+            break;
+          case 35:
+            this.popState();
+            break;
+          case 36:
+            return "acc_descr_multiline_value";
+            break;
+          case 37:
+            return 30;
+            break;
+          case 38:
+            this.popState();
+            yy.getLogger().debug("Lex: ((");
+            return "NODE_DEND";
+            break;
+          case 39:
+            this.popState();
+            yy.getLogger().debug("Lex: ((");
+            return "NODE_DEND";
+            break;
+          case 40:
+            this.popState();
+            yy.getLogger().debug("Lex: ))");
+            return "NODE_DEND";
+            break;
+          case 41:
+            this.popState();
+            yy.getLogger().debug("Lex: ((");
+            return "NODE_DEND";
+            break;
+          case 42:
+            this.popState();
+            yy.getLogger().debug("Lex: ((");
+            return "NODE_DEND";
+            break;
+          case 43:
+            this.popState();
+            yy.getLogger().debug("Lex: (-");
+            return "NODE_DEND";
+            break;
+          case 44:
+            this.popState();
+            yy.getLogger().debug("Lex: -)");
+            return "NODE_DEND";
+            break;
+          case 45:
+            this.popState();
+            yy.getLogger().debug("Lex: ((");
+            return "NODE_DEND";
+            break;
+          case 46:
+            this.popState();
+            yy.getLogger().debug("Lex: ]]");
+            return "NODE_DEND";
+            break;
+          case 47:
+            this.popState();
+            yy.getLogger().debug("Lex: (");
+            return "NODE_DEND";
+            break;
+          case 48:
+            this.popState();
+            yy.getLogger().debug("Lex: ])");
+            return "NODE_DEND";
+            break;
+          case 49:
+            this.popState();
+            yy.getLogger().debug("Lex: /]");
+            return "NODE_DEND";
+            break;
+          case 50:
+            this.popState();
+            yy.getLogger().debug("Lex: /]");
+            return "NODE_DEND";
+            break;
+          case 51:
+            this.popState();
+            yy.getLogger().debug("Lex: )]");
+            return "NODE_DEND";
+            break;
+          case 52:
+            this.popState();
+            yy.getLogger().debug("Lex: )");
+            return "NODE_DEND";
+            break;
+          case 53:
+            this.popState();
+            yy.getLogger().debug("Lex: ]>");
+            return "NODE_DEND";
+            break;
+          case 54:
+            this.popState();
+            yy.getLogger().debug("Lex: ]");
+            return "NODE_DEND";
+            break;
+          case 55:
+            yy.getLogger().debug("Lexa: -)");
+            this.pushState("NODE");
+            return 36;
+            break;
+          case 56:
+            yy.getLogger().debug("Lexa: (-");
+            this.pushState("NODE");
+            return 36;
+            break;
+          case 57:
+            yy.getLogger().debug("Lexa: ))");
+            this.pushState("NODE");
+            return 36;
+            break;
+          case 58:
+            yy.getLogger().debug("Lexa: )");
+            this.pushState("NODE");
+            return 36;
+            break;
+          case 59:
+            yy.getLogger().debug("Lex: (((");
+            this.pushState("NODE");
+            return 36;
+            break;
+          case 60:
+            yy.getLogger().debug("Lexa: )");
+            this.pushState("NODE");
+            return 36;
+            break;
+          case 61:
+            yy.getLogger().debug("Lexa: )");
+            this.pushState("NODE");
+            return 36;
+            break;
+          case 62:
+            yy.getLogger().debug("Lexa: )");
+            this.pushState("NODE");
+            return 36;
+            break;
+          case 63:
+            yy.getLogger().debug("Lexc: >");
+            this.pushState("NODE");
+            return 36;
+            break;
+          case 64:
+            yy.getLogger().debug("Lexa: ([");
+            this.pushState("NODE");
+            return 36;
+            break;
+          case 65:
+            yy.getLogger().debug("Lexa: )");
+            this.pushState("NODE");
+            return 36;
+            break;
+          case 66:
+            this.pushState("NODE");
+            return 36;
+            break;
+          case 67:
+            this.pushState("NODE");
+            return 36;
+            break;
+          case 68:
+            this.pushState("NODE");
+            return 36;
+            break;
+          case 69:
+            this.pushState("NODE");
+            return 36;
+            break;
+          case 70:
+            this.pushState("NODE");
+            return 36;
+            break;
+          case 71:
+            this.pushState("NODE");
+            return 36;
+            break;
+          case 72:
+            this.pushState("NODE");
+            return 36;
+            break;
+          case 73:
+            yy.getLogger().debug("Lexa: [");
+            this.pushState("NODE");
+            return 36;
+            break;
+          case 74:
+            this.pushState("BLOCK_ARROW");
+            yy.getLogger().debug("LEX ARR START");
+            return 38;
+            break;
+          case 75:
+            yy.getLogger().debug("Lex: NODE_ID", yy_.yytext);
+            return 32;
+            break;
+          case 76:
+            yy.getLogger().debug("Lex: EOF", yy_.yytext);
+            return 8;
+            break;
+          case 77:
+            this.pushState("md_string");
+            break;
+          case 78:
+            this.pushState("md_string");
+            break;
+          case 79:
+            return "NODE_DESCR";
+            break;
+          case 80:
+            this.popState();
+            break;
+          case 81:
+            yy.getLogger().debug("Lex: Starting string");
+            this.pushState("string");
+            break;
+          case 82:
+            yy.getLogger().debug("LEX ARR: Starting string");
+            this.pushState("string");
+            break;
+          case 83:
+            yy.getLogger().debug("LEX: NODE_DESCR:", yy_.yytext);
+            return "NODE_DESCR";
+            break;
+          case 84:
+            yy.getLogger().debug("LEX POPPING");
+            this.popState();
+            break;
+          case 85:
+            yy.getLogger().debug("Lex: =>BAE");
+            this.pushState("ARROW_DIR");
+            break;
+          case 86:
+            yy_.yytext = yy_.yytext.replace(/^,\s*/, "");
+            yy.getLogger().debug("Lex (right): dir:", yy_.yytext);
+            return "DIR";
+            break;
+          case 87:
+            yy_.yytext = yy_.yytext.replace(/^,\s*/, "");
+            yy.getLogger().debug("Lex (left):", yy_.yytext);
+            return "DIR";
+            break;
+          case 88:
+            yy_.yytext = yy_.yytext.replace(/^,\s*/, "");
+            yy.getLogger().debug("Lex (x):", yy_.yytext);
+            return "DIR";
+            break;
+          case 89:
+            yy_.yytext = yy_.yytext.replace(/^,\s*/, "");
+            yy.getLogger().debug("Lex (y):", yy_.yytext);
+            return "DIR";
+            break;
+          case 90:
+            yy_.yytext = yy_.yytext.replace(/^,\s*/, "");
+            yy.getLogger().debug("Lex (up):", yy_.yytext);
+            return "DIR";
+            break;
+          case 91:
+            yy_.yytext = yy_.yytext.replace(/^,\s*/, "");
+            yy.getLogger().debug("Lex (down):", yy_.yytext);
+            return "DIR";
+            break;
+          case 92:
+            yy_.yytext = "]>";
+            yy.getLogger().debug("Lex (ARROW_DIR end):", yy_.yytext);
+            this.popState();
+            this.popState();
+            return "BLOCK_ARROW_END";
+            break;
+          case 93:
+            yy.getLogger().debug("Lex: LINK", "#" + yy_.yytext + "#");
+            return 15;
+            break;
+          case 94:
+            yy.getLogger().debug("Lex: LINK", yy_.yytext);
+            return 15;
+            break;
+          case 95:
+            yy.getLogger().debug("Lex: LINK", yy_.yytext);
+            return 15;
+            break;
+          case 96:
+            yy.getLogger().debug("Lex: LINK", yy_.yytext);
+            return 15;
+            break;
+          case 97:
+            yy.getLogger().debug("Lex: START_LINK", yy_.yytext);
+            this.pushState("LLABEL");
+            return 16;
+            break;
+          case 98:
+            yy.getLogger().debug("Lex: START_LINK", yy_.yytext);
+            this.pushState("LLABEL");
+            return 16;
+            break;
+          case 99:
+            yy.getLogger().debug("Lex: START_LINK", yy_.yytext);
+            this.pushState("LLABEL");
+            return 16;
+            break;
+          case 100:
+            this.pushState("md_string");
+            break;
+          case 101:
+            yy.getLogger().debug("Lex: Starting string");
+            this.pushState("string");
+            return "LINK_LABEL";
+            break;
+          case 102:
+            this.popState();
+            yy.getLogger().debug("Lex: LINK", "#" + yy_.yytext + "#");
+            return 15;
+            break;
+          case 103:
+            this.popState();
+            yy.getLogger().debug("Lex: LINK", yy_.yytext);
+            return 15;
+            break;
+          case 104:
+            this.popState();
+            yy.getLogger().debug("Lex: LINK", yy_.yytext);
+            return 15;
+            break;
+          case 105:
+            yy.getLogger().debug("Lex: COLON", yy_.yytext);
+            yy_.yytext = yy_.yytext.slice(1);
+            return 27;
+            break;
+        }
+      }, "anonymous"),
+      rules: [/^(?:block-beta\b)/, /^(?:block\s+)/, /^(?:block\n+)/, /^(?:block:)/, /^(?:[\s]+)/, /^(?:[\n]+)/, /^(?:((\u000D\u000A)|(\u000A)))/, /^(?:columns\s+auto\b)/, /^(?:columns\s+[\d]+)/, /^(?:["][`])/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["])/, /^(?:["])/, /^(?:[^"]*)/, /^(?:space[:]\d+)/, /^(?:space\b)/, /^(?:default\b)/, /^(?:linkStyle\b)/, /^(?:interpolate\b)/, /^(?:classDef\s+)/, /^(?:DEFAULT\s+)/, /^(?:\w+\s+)/, /^(?:[^\n]*)/, /^(?:class\s+)/, /^(?:(\w+)+((,\s*\w+)*))/, /^(?:[^\n]*)/, /^(?:style\s+)/, /^(?:(\w+)+((,\s*\w+)*))/, /^(?:[^\n]*)/, /^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:end\b\s*)/, /^(?:\(\(\()/, /^(?:\)\)\))/, /^(?:[\)]\))/, /^(?:\}\})/, /^(?:\})/, /^(?:\(-)/, /^(?:-\))/, /^(?:\(\()/, /^(?:\]\])/, /^(?:\()/, /^(?:\]\))/, /^(?:\\\])/, /^(?:\/\])/, /^(?:\)\])/, /^(?:[\)])/, /^(?:\]>)/, /^(?:[\]])/, /^(?:-\))/, /^(?:\(-)/, /^(?:\)\))/, /^(?:\))/, /^(?:\(\(\()/, /^(?:\(\()/, /^(?:\{\{)/, /^(?:\{)/, /^(?:>)/, /^(?:\(\[)/, /^(?:\()/, /^(?:\[\[)/, /^(?:\[\|)/, /^(?:\[\()/, /^(?:\)\)\))/, /^(?:\[\\)/, /^(?:\[\/)/, /^(?:\[\\)/, /^(?:\[)/, /^(?:<\[)/, /^(?:[^\(\[\n\-\)\{\}\s\<\>:]+)/, /^(?:$)/, /^(?:["][`])/, /^(?:["][`])/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["])/, /^(?:["])/, /^(?:[^"]+)/, /^(?:["])/, /^(?:\]>\s*\()/, /^(?:,?\s*right\s*)/, /^(?:,?\s*left\s*)/, /^(?:,?\s*x\s*)/, /^(?:,?\s*y\s*)/, /^(?:,?\s*up\s*)/, /^(?:,?\s*down\s*)/, /^(?:\)\s*)/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?:\s*~~[\~]+\s*)/, /^(?:\s*[xo<]?--\s*)/, /^(?:\s*[xo<]?==\s*)/, /^(?:\s*[xo<]?-\.\s*)/, /^(?:["][`])/, /^(?:["])/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?::\d+)/],
+      conditions: { "STYLE_DEFINITION": { "rules": [29], "inclusive": false }, "STYLE_STMNT": { "rules": [28], "inclusive": false }, "CLASSDEFID": { "rules": [23], "inclusive": false }, "CLASSDEF": { "rules": [21, 22], "inclusive": false }, "CLASS_STYLE": { "rules": [26], "inclusive": false }, "CLASS": { "rules": [25], "inclusive": false }, "LLABEL": { "rules": [100, 101, 102, 103, 104], "inclusive": false }, "ARROW_DIR": { "rules": [86, 87, 88, 89, 90, 91, 92], "inclusive": false }, "BLOCK_ARROW": { "rules": [77, 82, 85], "inclusive": false }, "NODE": { "rules": [38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 78, 81], "inclusive": false }, "md_string": { "rules": [10, 11, 79, 80], "inclusive": false }, "space": { "rules": [], "inclusive": false }, "string": { "rules": [13, 14, 83, 84], "inclusive": false }, "acc_descr_multiline": { "rules": [35, 36], "inclusive": false }, "acc_descr": { "rules": [33], "inclusive": false }, "acc_title": { "rules": [31], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 15, 16, 17, 18, 19, 20, 24, 27, 30, 32, 34, 37, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 93, 94, 95, 96, 97, 98, 99, 105], "inclusive": true } }
+    };
+    return lexer2;
+  }();
+  parser2.lexer = lexer;
+  function Parser() {
+    this.yy = {};
+  }
+  __name(Parser, "Parser");
+  Parser.prototype = parser2;
+  parser2.Parser = Parser;
+  return new Parser();
+}();
+parser.parser = parser;
+var block_default = parser;
+
+// src/diagrams/block/blockDB.ts
+import clone from "lodash-es/clone.js";
+var blockDatabase = /* @__PURE__ */ new Map();
+var edgeList = [];
+var edgeCount = /* @__PURE__ */ new Map();
+var COLOR_KEYWORD = "color";
+var FILL_KEYWORD = "fill";
+var BG_FILL = "bgFill";
+var STYLECLASS_SEP = ",";
+var config = getConfig2();
+var classes = /* @__PURE__ */ new Map();
+var sanitizeText = /* @__PURE__ */ __name((txt) => common_default.sanitizeText(txt, config), "sanitizeText");
+var addStyleClass = /* @__PURE__ */ __name(function(id, styleAttributes = "") {
+  let foundClass = classes.get(id);
+  if (!foundClass) {
+    foundClass = { id, styles: [], textStyles: [] };
+    classes.set(id, foundClass);
+  }
+  if (styleAttributes !== void 0 && styleAttributes !== null) {
+    styleAttributes.split(STYLECLASS_SEP).forEach((attrib) => {
+      const fixedAttrib = attrib.replace(/([^;]*);/, "$1").trim();
+      if (RegExp(COLOR_KEYWORD).exec(attrib)) {
+        const newStyle1 = fixedAttrib.replace(FILL_KEYWORD, BG_FILL);
+        const newStyle2 = newStyle1.replace(COLOR_KEYWORD, FILL_KEYWORD);
+        foundClass.textStyles.push(newStyle2);
+      }
+      foundClass.styles.push(fixedAttrib);
+    });
+  }
+}, "addStyleClass");
+var addStyle2Node = /* @__PURE__ */ __name(function(id, styles = "") {
+  const foundBlock = blockDatabase.get(id);
+  if (styles !== void 0 && styles !== null) {
+    foundBlock.styles = styles.split(STYLECLASS_SEP);
+  }
+}, "addStyle2Node");
+var setCssClass = /* @__PURE__ */ __name(function(itemIds, cssClassName) {
+  itemIds.split(",").forEach(function(id) {
+    let foundBlock = blockDatabase.get(id);
+    if (foundBlock === void 0) {
+      const trimmedId = id.trim();
+      foundBlock = { id: trimmedId, type: "na", children: [] };
+      blockDatabase.set(trimmedId, foundBlock);
+    }
+    if (!foundBlock.classes) {
+      foundBlock.classes = [];
+    }
+    foundBlock.classes.push(cssClassName);
+  });
+}, "setCssClass");
+var populateBlockDatabase = /* @__PURE__ */ __name((_blockList, parent) => {
+  const blockList = _blockList.flat();
+  const children = [];
+  for (const block of blockList) {
+    if (block.label) {
+      block.label = sanitizeText(block.label);
+    }
+    if (block.type === "classDef") {
+      addStyleClass(block.id, block.css);
+      continue;
+    }
+    if (block.type === "applyClass") {
+      setCssClass(block.id, block?.styleClass ?? "");
+      continue;
+    }
+    if (block.type === "applyStyles") {
+      if (block?.stylesStr) {
+        addStyle2Node(block.id, block?.stylesStr);
+      }
+      continue;
+    }
+    if (block.type === "column-setting") {
+      parent.columns = block.columns ?? -1;
+    } else if (block.type === "edge") {
+      const count = (edgeCount.get(block.id) ?? 0) + 1;
+      edgeCount.set(block.id, count);
+      block.id = count + "-" + block.id;
+      edgeList.push(block);
+    } else {
+      if (!block.label) {
+        if (block.type === "composite") {
+          block.label = "";
+        } else {
+          block.label = block.id;
+        }
+      }
+      const existingBlock = blockDatabase.get(block.id);
+      if (existingBlock === void 0) {
+        blockDatabase.set(block.id, block);
+      } else {
+        if (block.type !== "na") {
+          existingBlock.type = block.type;
+        }
+        if (block.label !== block.id) {
+          existingBlock.label = block.label;
+        }
+      }
+      if (block.children) {
+        populateBlockDatabase(block.children, block);
+      }
+      if (block.type === "space") {
+        const w = block.width ?? 1;
+        for (let j = 0; j < w; j++) {
+          const newBlock = clone(block);
+          newBlock.id = newBlock.id + "-" + j;
+          blockDatabase.set(newBlock.id, newBlock);
+          children.push(newBlock);
+        }
+      } else if (existingBlock === void 0) {
+        children.push(block);
+      }
+    }
+  }
+  parent.children = children;
+}, "populateBlockDatabase");
+var blocks = [];
+var rootBlock = { id: "root", type: "composite", children: [], columns: -1 };
+var clear2 = /* @__PURE__ */ __name(() => {
+  log.debug("Clear called");
+  clear();
+  rootBlock = { id: "root", type: "composite", children: [], columns: -1 };
+  blockDatabase = /* @__PURE__ */ new Map([["root", rootBlock]]);
+  blocks = [];
+  classes = /* @__PURE__ */ new Map();
+  edgeList = [];
+  edgeCount = /* @__PURE__ */ new Map();
+}, "clear");
+function typeStr2Type(typeStr) {
+  log.debug("typeStr2Type", typeStr);
+  switch (typeStr) {
+    case "[]":
+      return "square";
+    case "()":
+      log.debug("we have a round");
+      return "round";
+    case "(())":
+      return "circle";
+    case ">]":
+      return "rect_left_inv_arrow";
+    case "{}":
+      return "diamond";
+    case "{{}}":
+      return "hexagon";
+    case "([])":
+      return "stadium";
+    case "[[]]":
+      return "subroutine";
+    case "[()]":
+      return "cylinder";
+    case "((()))":
+      return "doublecircle";
+    case "[//]":
+      return "lean_right";
+    case "[\\\\]":
+      return "lean_left";
+    case "[/\\]":
+      return "trapezoid";
+    case "[\\/]":
+      return "inv_trapezoid";
+    case "<[]>":
+      return "block_arrow";
+    default:
+      return "na";
+  }
+}
+__name(typeStr2Type, "typeStr2Type");
+function edgeTypeStr2Type(typeStr) {
+  log.debug("typeStr2Type", typeStr);
+  switch (typeStr) {
+    case "==":
+      return "thick";
+    default:
+      return "normal";
+  }
+}
+__name(edgeTypeStr2Type, "edgeTypeStr2Type");
+function edgeStrToEdgeData(typeStr) {
+  switch (typeStr.trim()) {
+    case "--x":
+      return "arrow_cross";
+    case "--o":
+      return "arrow_circle";
+    default:
+      return "arrow_point";
+  }
+}
+__name(edgeStrToEdgeData, "edgeStrToEdgeData");
+var cnt = 0;
+var generateId = /* @__PURE__ */ __name(() => {
+  cnt++;
+  return "id-" + Math.random().toString(36).substr(2, 12) + "-" + cnt;
+}, "generateId");
+var setHierarchy = /* @__PURE__ */ __name((block) => {
+  rootBlock.children = block;
+  populateBlockDatabase(block, rootBlock);
+  blocks = rootBlock.children;
+}, "setHierarchy");
+var getColumns = /* @__PURE__ */ __name((blockId) => {
+  const block = blockDatabase.get(blockId);
+  if (!block) {
+    return -1;
+  }
+  if (block.columns) {
+    return block.columns;
+  }
+  if (!block.children) {
+    return -1;
+  }
+  return block.children.length;
+}, "getColumns");
+var getBlocksFlat = /* @__PURE__ */ __name(() => {
+  return [...blockDatabase.values()];
+}, "getBlocksFlat");
+var getBlocks = /* @__PURE__ */ __name(() => {
+  return blocks || [];
+}, "getBlocks");
+var getEdges = /* @__PURE__ */ __name(() => {
+  return edgeList;
+}, "getEdges");
+var getBlock = /* @__PURE__ */ __name((id) => {
+  return blockDatabase.get(id);
+}, "getBlock");
+var setBlock = /* @__PURE__ */ __name((block) => {
+  blockDatabase.set(block.id, block);
+}, "setBlock");
+var getLogger = /* @__PURE__ */ __name(() => console, "getLogger");
+var getClasses = /* @__PURE__ */ __name(function() {
+  return classes;
+}, "getClasses");
+var db = {
+  getConfig: /* @__PURE__ */ __name(() => getConfig().block, "getConfig"),
+  typeStr2Type,
+  edgeTypeStr2Type,
+  edgeStrToEdgeData,
+  getLogger,
+  getBlocksFlat,
+  getBlocks,
+  getEdges,
+  setHierarchy,
+  getBlock,
+  setBlock,
+  getColumns,
+  getClasses,
+  clear: clear2,
+  generateId
+};
+var blockDB_default = db;
+
+// src/diagrams/block/styles.ts
+import * as khroma from "khroma";
+var fade = /* @__PURE__ */ __name((color, opacity) => {
+  const channel2 = khroma.channel;
+  const r = channel2(color, "r");
+  const g = channel2(color, "g");
+  const b = channel2(color, "b");
+  return khroma.rgba(r, g, b, opacity);
+}, "fade");
+var getStyles = /* @__PURE__ */ __name((options) => `.label {
+    font-family: ${options.fontFamily};
+    color: ${options.nodeTextColor || options.textColor};
+  }
+  .cluster-label text {
+    fill: ${options.titleColor};
+  }
+  .cluster-label span,p {
+    color: ${options.titleColor};
+  }
+
+
+
+  .label text,span,p {
+    fill: ${options.nodeTextColor || options.textColor};
+    color: ${options.nodeTextColor || options.textColor};
+  }
+
+  .node rect,
+  .node circle,
+  .node ellipse,
+  .node polygon,
+  .node path {
+    fill: ${options.mainBkg};
+    stroke: ${options.nodeBorder};
+    stroke-width: 1px;
+  }
+  .flowchart-label text {
+    text-anchor: middle;
+  }
+  // .flowchart-label .text-outer-tspan {
+  //   text-anchor: middle;
+  // }
+  // .flowchart-label .text-inner-tspan {
+  //   text-anchor: start;
+  // }
+
+  .node .label {
+    text-align: center;
+  }
+  .node.clickable {
+    cursor: pointer;
+  }
+
+  .arrowheadPath {
+    fill: ${options.arrowheadColor};
+  }
+
+  .edgePath .path {
+    stroke: ${options.lineColor};
+    stroke-width: 2.0px;
+  }
+
+  .flowchart-link {
+    stroke: ${options.lineColor};
+    fill: none;
+  }
+
+  .edgeLabel {
+    background-color: ${options.edgeLabelBackground};
+    rect {
+      opacity: 0.5;
+      background-color: ${options.edgeLabelBackground};
+      fill: ${options.edgeLabelBackground};
+    }
+    text-align: center;
+  }
+
+  /* For html labels only */
+  .labelBkg {
+    background-color: ${fade(options.edgeLabelBackground, 0.5)};
+    // background-color:
+  }
+
+  .node .cluster {
+    // fill: ${fade(options.mainBkg, 0.5)};
+    fill: ${fade(options.clusterBkg, 0.5)};
+    stroke: ${fade(options.clusterBorder, 0.2)};
+    box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
+    stroke-width: 1px;
+  }
+
+  .cluster text {
+    fill: ${options.titleColor};
+  }
+
+  .cluster span,p {
+    color: ${options.titleColor};
+  }
+  /* .cluster div {
+    color: ${options.titleColor};
+  } */
+
+  div.mermaidTooltip {
+    position: absolute;
+    text-align: center;
+    max-width: 200px;
+    padding: 2px;
+    font-family: ${options.fontFamily};
+    font-size: 12px;
+    background: ${options.tertiaryColor};
+    border: 1px solid ${options.border2};
+    border-radius: 2px;
+    pointer-events: none;
+    z-index: 100;
+  }
+
+  .flowchartTitleText {
+    text-anchor: middle;
+    font-size: 18px;
+    fill: ${options.textColor};
+  }
+`, "getStyles");
+var styles_default = getStyles;
+
+// src/diagrams/block/blockRenderer.ts
+import { select as d3select } from "d3";
+
+// src/diagrams/block/layout.ts
+var padding = getConfig2()?.block?.padding ?? 8;
+function calculateBlockPosition(columns, position) {
+  if (columns === 0 || !Number.isInteger(columns)) {
+    throw new Error("Columns must be an integer !== 0.");
+  }
+  if (position < 0 || !Number.isInteger(position)) {
+    throw new Error("Position must be a non-negative integer." + position);
+  }
+  if (columns < 0) {
+    return { px: position, py: 0 };
+  }
+  if (columns === 1) {
+    return { px: 0, py: position };
+  }
+  const px = position % columns;
+  const py = Math.floor(position / columns);
+  return { px, py };
+}
+__name(calculateBlockPosition, "calculateBlockPosition");
+var getMaxChildSize = /* @__PURE__ */ __name((block) => {
+  let maxWidth = 0;
+  let maxHeight = 0;
+  for (const child of block.children) {
+    const { width, height, x, y } = child.size ?? { width: 0, height: 0, x: 0, y: 0 };
+    log.debug(
+      "getMaxChildSize abc95 child:",
+      child.id,
+      "width:",
+      width,
+      "height:",
+      height,
+      "x:",
+      x,
+      "y:",
+      y,
+      child.type
+    );
+    if (child.type === "space") {
+      continue;
+    }
+    if (width > maxWidth) {
+      maxWidth = width / (block.widthInColumns ?? 1);
+    }
+    if (height > maxHeight) {
+      maxHeight = height;
+    }
+  }
+  return { width: maxWidth, height: maxHeight };
+}, "getMaxChildSize");
+function setBlockSizes(block, db2, siblingWidth = 0, siblingHeight = 0) {
+  log.debug(
+    "setBlockSizes abc95 (start)",
+    block.id,
+    block?.size?.x,
+    "block width =",
+    block?.size,
+    "sieblingWidth",
+    siblingWidth
+  );
+  if (!block?.size?.width) {
+    block.size = {
+      width: siblingWidth,
+      height: siblingHeight,
+      x: 0,
+      y: 0
+    };
+  }
+  let maxWidth = 0;
+  let maxHeight = 0;
+  if (block.children?.length > 0) {
+    for (const child of block.children) {
+      setBlockSizes(child, db2);
+    }
+    const childSize = getMaxChildSize(block);
+    maxWidth = childSize.width;
+    maxHeight = childSize.height;
+    log.debug("setBlockSizes abc95 maxWidth of", block.id, ":s children is ", maxWidth, maxHeight);
+    for (const child of block.children) {
+      if (child.size) {
+        log.debug(
+          `abc95 Setting size of children of ${block.id} id=${child.id} ${maxWidth} ${maxHeight} ${JSON.stringify(child.size)}`
+        );
+        child.size.width = maxWidth * (child.widthInColumns ?? 1) + padding * ((child.widthInColumns ?? 1) - 1);
+        child.size.height = maxHeight;
+        child.size.x = 0;
+        child.size.y = 0;
+        log.debug(
+          `abc95 updating size of ${block.id} children child:${child.id} maxWidth:${maxWidth} maxHeight:${maxHeight}`
+        );
+      }
+    }
+    for (const child of block.children) {
+      setBlockSizes(child, db2, maxWidth, maxHeight);
+    }
+    const columns = block.columns ?? -1;
+    let numItems = 0;
+    for (const child of block.children) {
+      numItems += child.widthInColumns ?? 1;
+    }
+    let xSize = block.children.length;
+    if (columns > 0 && columns < numItems) {
+      xSize = columns;
+    }
+    const ySize = Math.ceil(numItems / xSize);
+    let width = xSize * (maxWidth + padding) + padding;
+    let height = ySize * (maxHeight + padding) + padding;
+    if (width < siblingWidth) {
+      log.debug(
+        `Detected to small siebling: abc95 ${block.id} sieblingWidth ${siblingWidth} sieblingHeight ${siblingHeight} width ${width}`
+      );
+      width = siblingWidth;
+      height = siblingHeight;
+      const childWidth = (siblingWidth - xSize * padding - padding) / xSize;
+      const childHeight = (siblingHeight - ySize * padding - padding) / ySize;
+      log.debug("Size indata abc88", block.id, "childWidth", childWidth, "maxWidth", maxWidth);
+      log.debug("Size indata abc88", block.id, "childHeight", childHeight, "maxHeight", maxHeight);
+      log.debug("Size indata abc88 xSize", xSize, "padding", padding);
+      for (const child of block.children) {
+        if (child.size) {
+          child.size.width = childWidth;
+          child.size.height = childHeight;
+          child.size.x = 0;
+          child.size.y = 0;
+        }
+      }
+    }
+    log.debug(
+      `abc95 (finale calc) ${block.id} xSize ${xSize} ySize ${ySize} columns ${columns}${block.children.length} width=${Math.max(width, block.size?.width || 0)}`
+    );
+    if (width < (block?.size?.width || 0)) {
+      width = block?.size?.width || 0;
+      const num = columns > 0 ? Math.min(block.children.length, columns) : block.children.length;
+      if (num > 0) {
+        const childWidth = (width - num * padding - padding) / num;
+        log.debug("abc95 (growing to fit) width", block.id, width, block.size?.width, childWidth);
+        for (const child of block.children) {
+          if (child.size) {
+            child.size.width = childWidth;
+          }
+        }
+      }
+    }
+    block.size = {
+      width,
+      height,
+      x: 0,
+      y: 0
+    };
+  }
+  log.debug(
+    "setBlockSizes abc94 (done)",
+    block.id,
+    block?.size?.x,
+    block?.size?.width,
+    block?.size?.y,
+    block?.size?.height
+  );
+}
+__name(setBlockSizes, "setBlockSizes");
+function layoutBlocks(block, db2) {
+  log.debug(
+    `abc85 layout blocks (=>layoutBlocks) ${block.id} x: ${block?.size?.x} y: ${block?.size?.y} width: ${block?.size?.width}`
+  );
+  const columns = block.columns ?? -1;
+  log.debug("layoutBlocks columns abc95", block.id, "=>", columns, block);
+  if (block.children && // find max width of children
+  block.children.length > 0) {
+    const width = block?.children[0]?.size?.width ?? 0;
+    const widthOfChildren = block.children.length * width + (block.children.length - 1) * padding;
+    log.debug("widthOfChildren 88", widthOfChildren, "posX");
+    let columnPos = 0;
+    log.debug("abc91 block?.size?.x", block.id, block?.size?.x);
+    let startingPosX = block?.size?.x ? block?.size?.x + (-block?.size?.width / 2 || 0) : -padding;
+    let rowPos = 0;
+    for (const child of block.children) {
+      const parent = block;
+      if (!child.size) {
+        continue;
+      }
+      const { width: width2, height } = child.size;
+      const { px, py } = calculateBlockPosition(columns, columnPos);
+      if (py != rowPos) {
+        rowPos = py;
+        startingPosX = block?.size?.x ? block?.size?.x + (-block?.size?.width / 2 || 0) : -padding;
+        log.debug("New row in layout for block", block.id, " and child ", child.id, rowPos);
+      }
+      log.debug(
+        `abc89 layout blocks (child) id: ${child.id} Pos: ${columnPos} (px, py) ${px},${py} (${parent?.size?.x},${parent?.size?.y}) parent: ${parent.id} width: ${width2}${padding}`
+      );
+      if (parent.size) {
+        const halfWidth = width2 / 2;
+        child.size.x = startingPosX + padding + halfWidth;
+        log.debug(
+          `abc91 layout blocks (calc) px, pyid:${child.id} startingPos=X${startingPosX} new startingPosX${child.size.x} ${halfWidth} padding=${padding} width=${width2} halfWidth=${halfWidth} => x:${child.size.x} y:${child.size.y} ${child.widthInColumns} (width * (child?.w || 1)) / 2 ${width2 * (child?.widthInColumns ?? 1) / 2}`
+        );
+        startingPosX = child.size.x + halfWidth;
+        child.size.y = parent.size.y - parent.size.height / 2 + py * (height + padding) + height / 2 + padding;
+        log.debug(
+          `abc88 layout blocks (calc) px, pyid:${child.id}startingPosX${startingPosX}${padding}${halfWidth}=>x:${child.size.x}y:${child.size.y}${child.widthInColumns}(width * (child?.w || 1)) / 2${width2 * (child?.widthInColumns ?? 1) / 2}`
+        );
+      }
+      if (child.children) {
+        layoutBlocks(child, db2);
+      }
+      columnPos += child?.widthInColumns ?? 1;
+      log.debug("abc88 columnsPos", child, columnPos);
+    }
+  }
+  log.debug(
+    `layout blocks (<==layoutBlocks) ${block.id} x: ${block?.size?.x} y: ${block?.size?.y} width: ${block?.size?.width}`
+  );
+}
+__name(layoutBlocks, "layoutBlocks");
+function findBounds(block, { minX, minY, maxX, maxY } = { minX: 0, minY: 0, maxX: 0, maxY: 0 }) {
+  if (block.size && block.id !== "root") {
+    const { x, y, width, height } = block.size;
+    if (x - width / 2 < minX) {
+      minX = x - width / 2;
+    }
+    if (y - height / 2 < minY) {
+      minY = y - height / 2;
+    }
+    if (x + width / 2 > maxX) {
+      maxX = x + width / 2;
+    }
+    if (y + height / 2 > maxY) {
+      maxY = y + height / 2;
+    }
+  }
+  if (block.children) {
+    for (const child of block.children) {
+      ({ minX, minY, maxX, maxY } = findBounds(child, { minX, minY, maxX, maxY }));
+    }
+  }
+  return { minX, minY, maxX, maxY };
+}
+__name(findBounds, "findBounds");
+function layout(db2) {
+  const root = db2.getBlock("root");
+  if (!root) {
+    return;
+  }
+  setBlockSizes(root, db2, 0, 0);
+  layoutBlocks(root, db2);
+  log.debug("getBlocks", JSON.stringify(root, null, 2));
+  const { minX, minY, maxX, maxY } = findBounds(root);
+  const height = maxY - minY;
+  const width = maxX - minX;
+  return { x: minX, y: minY, width, height };
+}
+__name(layout, "layout");
+
+// src/diagrams/block/renderHelpers.ts
+import * as graphlib from "dagre-d3-es/src/graphlib/index.js";
+function getNodeFromBlock(block, db2, positioned = false) {
+  const vertex = block;
+  let classStr = "default";
+  if ((vertex?.classes?.length || 0) > 0) {
+    classStr = (vertex?.classes ?? []).join(" ");
+  }
+  classStr = classStr + " flowchart-label";
+  let radius = 0;
+  let shape = "";
+  let padding2;
+  switch (vertex.type) {
+    case "round":
+      radius = 5;
+      shape = "rect";
+      break;
+    case "composite":
+      radius = 0;
+      shape = "composite";
+      padding2 = 0;
+      break;
+    case "square":
+      shape = "rect";
+      break;
+    case "diamond":
+      shape = "question";
+      break;
+    case "hexagon":
+      shape = "hexagon";
+      break;
+    case "block_arrow":
+      shape = "block_arrow";
+      break;
+    case "odd":
+      shape = "rect_left_inv_arrow";
+      break;
+    case "lean_right":
+      shape = "lean_right";
+      break;
+    case "lean_left":
+      shape = "lean_left";
+      break;
+    case "trapezoid":
+      shape = "trapezoid";
+      break;
+    case "inv_trapezoid":
+      shape = "inv_trapezoid";
+      break;
+    case "rect_left_inv_arrow":
+      shape = "rect_left_inv_arrow";
+      break;
+    case "circle":
+      shape = "circle";
+      break;
+    case "ellipse":
+      shape = "ellipse";
+      break;
+    case "stadium":
+      shape = "stadium";
+      break;
+    case "subroutine":
+      shape = "subroutine";
+      break;
+    case "cylinder":
+      shape = "cylinder";
+      break;
+    case "group":
+      shape = "rect";
+      break;
+    case "doublecircle":
+      shape = "doublecircle";
+      break;
+    default:
+      shape = "rect";
+  }
+  const styles = getStylesFromArray(vertex?.styles ?? []);
+  const vertexText = vertex.label;
+  const bounds = vertex.size ?? { width: 0, height: 0, x: 0, y: 0 };
+  const node = {
+    labelStyle: styles.labelStyle,
+    shape,
+    labelText: vertexText,
+    rx: radius,
+    ry: radius,
+    class: classStr,
+    style: styles.style,
+    id: vertex.id,
+    directions: vertex.directions,
+    width: bounds.width,
+    height: bounds.height,
+    x: bounds.x,
+    y: bounds.y,
+    positioned,
+    intersect: void 0,
+    type: vertex.type,
+    padding: padding2 ?? getConfig()?.block?.padding ?? 0
+  };
+  return node;
+}
+__name(getNodeFromBlock, "getNodeFromBlock");
+async function calculateBlockSize(elem, block, db2) {
+  const node = getNodeFromBlock(block, db2, false);
+  if (node.type === "group") {
+    return;
+  }
+  const nodeEl = await insertNode(elem, node);
+  const boundingBox = nodeEl.node().getBBox();
+  const obj = db2.getBlock(node.id);
+  obj.size = { width: boundingBox.width, height: boundingBox.height, x: 0, y: 0, node: nodeEl };
+  db2.setBlock(obj);
+  nodeEl.remove();
+}
+__name(calculateBlockSize, "calculateBlockSize");
+async function insertBlockPositioned(elem, block, db2) {
+  const node = getNodeFromBlock(block, db2, true);
+  const obj = db2.getBlock(node.id);
+  if (obj.type !== "space") {
+    await insertNode(elem, node);
+    block.intersect = node?.intersect;
+    positionNode(node);
+  }
+}
+__name(insertBlockPositioned, "insertBlockPositioned");
+async function performOperations(elem, blocks2, db2, operation) {
+  for (const block of blocks2) {
+    await operation(elem, block, db2);
+    if (block.children) {
+      await performOperations(elem, block.children, db2, operation);
+    }
+  }
+}
+__name(performOperations, "performOperations");
+async function calculateBlockSizes(elem, blocks2, db2) {
+  await performOperations(elem, blocks2, db2, calculateBlockSize);
+}
+__name(calculateBlockSizes, "calculateBlockSizes");
+async function insertBlocks(elem, blocks2, db2) {
+  await performOperations(elem, blocks2, db2, insertBlockPositioned);
+}
+__name(insertBlocks, "insertBlocks");
+async function insertEdges(elem, edges, blocks2, db2, id) {
+  const g = new graphlib.Graph({
+    multigraph: true,
+    compound: true
+  });
+  g.setGraph({
+    rankdir: "TB",
+    nodesep: 10,
+    ranksep: 10,
+    marginx: 8,
+    marginy: 8
+  });
+  for (const block of blocks2) {
+    if (block.size) {
+      g.setNode(block.id, {
+        width: block.size.width,
+        height: block.size.height,
+        intersect: block.intersect
+      });
+    }
+  }
+  for (const edge of edges) {
+    if (edge.start && edge.end) {
+      const startBlock = db2.getBlock(edge.start);
+      const endBlock = db2.getBlock(edge.end);
+      if (startBlock?.size && endBlock?.size) {
+        const start = startBlock.size;
+        const end = endBlock.size;
+        const points = [
+          { x: start.x, y: start.y },
+          { x: start.x + (end.x - start.x) / 2, y: start.y + (end.y - start.y) / 2 },
+          { x: end.x, y: end.y }
+        ];
+        insertEdge(
+          elem,
+          { v: edge.start, w: edge.end, name: edge.id },
+          {
+            ...edge,
+            arrowTypeEnd: edge.arrowTypeEnd,
+            arrowTypeStart: edge.arrowTypeStart,
+            points,
+            classes: "edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"
+          },
+          void 0,
+          "block",
+          g,
+          id
+        );
+        if (edge.label) {
+          await insertEdgeLabel(elem, {
+            ...edge,
+            label: edge.label,
+            labelStyle: "stroke: #333; stroke-width: 1.5px;fill:none;",
+            arrowTypeEnd: edge.arrowTypeEnd,
+            arrowTypeStart: edge.arrowTypeStart,
+            points,
+            classes: "edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"
+          });
+          positionEdgeLabel(
+            { ...edge, x: points[1].x, y: points[1].y },
+            {
+              originalPath: points
+            }
+          );
+        }
+      }
+    }
+  }
+}
+__name(insertEdges, "insertEdges");
+
+// src/diagrams/block/blockRenderer.ts
+var getClasses2 = /* @__PURE__ */ __name(function(text, diagObj) {
+  return diagObj.db.getClasses();
+}, "getClasses");
+var draw = /* @__PURE__ */ __name(async function(text, id, _version, diagObj) {
+  const { securityLevel, block: conf } = getConfig();
+  const db2 = diagObj.db;
+  let sandboxElement;
+  if (securityLevel === "sandbox") {
+    sandboxElement = d3select("#i" + id);
+  }
+  const root = securityLevel === "sandbox" ? d3select(sandboxElement.nodes()[0].contentDocument.body) : d3select("body");
+  const svg = securityLevel === "sandbox" ? root.select(`[id="${id}"]`) : d3select(`[id="${id}"]`);
+  const markers = ["point", "circle", "cross"];
+  markers_default(svg, markers, diagObj.type, id);
+  const bl = db2.getBlocks();
+  const blArr = db2.getBlocksFlat();
+  const edges = db2.getEdges();
+  const nodes = svg.insert("g").attr("class", "block");
+  await calculateBlockSizes(nodes, bl, db2);
+  const bounds = layout(db2);
+  await insertBlocks(nodes, bl, db2);
+  await insertEdges(nodes, edges, blArr, db2, id);
+  if (bounds) {
+    const bounds2 = bounds;
+    const magicFactor = Math.max(1, Math.round(0.125 * (bounds2.width / bounds2.height)));
+    const height = bounds2.height + magicFactor + 10;
+    const width = bounds2.width + 10;
+    const { useMaxWidth } = conf;
+    configureSvgSize(svg, height, width, !!useMaxWidth);
+    log.debug("Here Bounds", bounds, bounds2);
+    svg.attr(
+      "viewBox",
+      `${bounds2.x - 5} ${bounds2.y - 5} ${bounds2.width + 10} ${bounds2.height + 10}`
+    );
+  }
+}, "draw");
+var blockRenderer_default = {
+  draw,
+  getClasses: getClasses2
+};
+
+// src/diagrams/block/blockDiagram.ts
+var diagram = {
+  parser: block_default,
+  db: blockDB_default,
+  renderer: blockRenderer_default,
+  styles: styles_default
+};
+export {
+  diagram
+};

File diff suppressed because it is too large
+ 36 - 21
nicegui/elements/lib/mermaid/chunks/mermaid.core/c4Diagram-ZHOUKFWV.mjs


+ 2284 - 0
nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-5CZSE4TR.mjs

@@ -0,0 +1,2284 @@
+import {
+  getLineFunctionsWithOffset,
+  getSubGraphTitleMargins
+} from "./chunk-TINLTEC2.mjs";
+import {
+  createText
+} from "./chunk-OERGPBFJ.mjs";
+import {
+  decodeEntities,
+  utils_default
+} from "./chunk-VKXSJROQ.mjs";
+import {
+  __name,
+  common_default,
+  evaluate,
+  getConfig2 as getConfig,
+  hasKatex,
+  log,
+  renderKatex,
+  sanitizeText
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/rendering-util/rendering-elements/clusters.js
+import { select as select2 } from "d3";
+import rough from "roughjs";
+
+// src/rendering-util/rendering-elements/intersect/intersect-rect.js
+var intersectRect = /* @__PURE__ */ __name((node, point2) => {
+  var x = node.x;
+  var y = node.y;
+  var dx = point2.x - x;
+  var dy = point2.y - y;
+  var w = node.width / 2;
+  var h = node.height / 2;
+  var sx, sy;
+  if (Math.abs(dy) * w > Math.abs(dx) * h) {
+    if (dy < 0) {
+      h = -h;
+    }
+    sx = dy === 0 ? 0 : h * dx / dy;
+    sy = h;
+  } else {
+    if (dx < 0) {
+      w = -w;
+    }
+    sx = w;
+    sy = dx === 0 ? 0 : w * dy / dx;
+  }
+  return { x: x + sx, y: y + sy };
+}, "intersectRect");
+var intersect_rect_default = intersectRect;
+
+// src/rendering-util/rendering-elements/createLabel.js
+import { select } from "d3";
+function applyStyle(dom, styleFn) {
+  if (styleFn) {
+    dom.attr("style", styleFn);
+  }
+}
+__name(applyStyle, "applyStyle");
+async function addHtmlLabel(node) {
+  const fo = select(document.createElementNS("http://www.w3.org/2000/svg", "foreignObject"));
+  const div = fo.append("xhtml:div");
+  let label = node.label;
+  if (node.label && hasKatex(node.label)) {
+    label = await renderKatex(node.label.replace(common_default.lineBreakRegex, "\n"), getConfig());
+  }
+  const labelClass = node.isNode ? "nodeLabel" : "edgeLabel";
+  div.html(
+    '<span class="' + labelClass + '" ' + (node.labelStyle ? 'style="' + node.labelStyle + '"' : "") + // codeql [js/html-constructed-from-input] : false positive
+    ">" + label + "</span>"
+  );
+  applyStyle(div, node.labelStyle);
+  div.style("display", "inline-block");
+  div.style("padding-right", "1px");
+  div.style("white-space", "nowrap");
+  div.attr("xmlns", "http://www.w3.org/1999/xhtml");
+  return fo.node();
+}
+__name(addHtmlLabel, "addHtmlLabel");
+var createLabel = /* @__PURE__ */ __name(async (_vertexText, style, isTitle, isNode) => {
+  let vertexText = _vertexText || "";
+  if (typeof vertexText === "object") {
+    vertexText = vertexText[0];
+  }
+  if (evaluate(getConfig().flowchart.htmlLabels)) {
+    vertexText = vertexText.replace(/\\n|\n/g, "<br />");
+    log.info("vertexText" + vertexText);
+    const node = {
+      isNode,
+      label: decodeEntities(vertexText).replace(
+        /fa[blrs]?:fa-[\w-]+/g,
+        (s) => `<i class='${s.replace(":", " ")}'></i>`
+      ),
+      labelStyle: style ? style.replace("fill:", "color:") : style
+    };
+    let vertexNode = await addHtmlLabel(node);
+    return vertexNode;
+  } else {
+    const svgLabel = document.createElementNS("http://www.w3.org/2000/svg", "text");
+    svgLabel.setAttribute("style", style.replace("color:", "fill:"));
+    let rows = [];
+    if (typeof vertexText === "string") {
+      rows = vertexText.split(/\\n|\n|<br\s*\/?>/gi);
+    } else if (Array.isArray(vertexText)) {
+      rows = vertexText;
+    } else {
+      rows = [];
+    }
+    for (const row of rows) {
+      const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
+      tspan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
+      tspan.setAttribute("dy", "1em");
+      tspan.setAttribute("x", "0");
+      if (isTitle) {
+        tspan.setAttribute("class", "title-row");
+      } else {
+        tspan.setAttribute("class", "row");
+      }
+      tspan.textContent = row.trim();
+      svgLabel.appendChild(tspan);
+    }
+    return svgLabel;
+  }
+}, "createLabel");
+var createLabel_default = createLabel;
+
+// src/rendering-util/rendering-elements/shapes/roundedRectPath.ts
+var createRoundedRectPathD = /* @__PURE__ */ __name((x, y, totalWidth, totalHeight, radius) => [
+  "M",
+  x + radius,
+  y,
+  // Move to the first point
+  "H",
+  x + totalWidth - radius,
+  // Draw horizontal line to the beginning of the right corner
+  "A",
+  radius,
+  radius,
+  0,
+  0,
+  1,
+  x + totalWidth,
+  y + radius,
+  // Draw arc to the right top corner
+  "V",
+  y + totalHeight - radius,
+  // Draw vertical line down to the beginning of the right bottom corner
+  "A",
+  radius,
+  radius,
+  0,
+  0,
+  1,
+  x + totalWidth - radius,
+  y + totalHeight,
+  // Draw arc to the right bottom corner
+  "H",
+  x + radius,
+  // Draw horizontal line to the beginning of the left bottom corner
+  "A",
+  radius,
+  radius,
+  0,
+  0,
+  1,
+  x,
+  y + totalHeight - radius,
+  // Draw arc to the left bottom corner
+  "V",
+  y + radius,
+  // Draw vertical line up to the beginning of the left top corner
+  "A",
+  radius,
+  radius,
+  0,
+  0,
+  1,
+  x + radius,
+  y,
+  // Draw arc to the left top corner
+  "Z"
+  // Close the path
+].join(" "), "createRoundedRectPathD");
+
+// src/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.ts
+var solidStateFill = /* @__PURE__ */ __name((color) => {
+  const { handDrawnSeed } = getConfig();
+  return {
+    fill: color,
+    hachureAngle: 120,
+    // angle of hachure,
+    hachureGap: 4,
+    fillWeight: 2,
+    roughness: 0.7,
+    stroke: color,
+    seed: handDrawnSeed
+  };
+}, "solidStateFill");
+var compileStyles = /* @__PURE__ */ __name((node) => {
+  const stylesMap = styles2Map([...node.cssCompiledStyles || [], ...node.cssStyles || []]);
+  return { stylesMap, stylesArray: [...stylesMap] };
+}, "compileStyles");
+var styles2Map = /* @__PURE__ */ __name((styles) => {
+  const styleMap = /* @__PURE__ */ new Map();
+  styles.forEach((style) => {
+    const [key, value] = style.split(":");
+    styleMap.set(key.trim(), value?.trim());
+  });
+  return styleMap;
+}, "styles2Map");
+var styles2String = /* @__PURE__ */ __name((node) => {
+  const { stylesArray } = compileStyles(node);
+  const labelStyles = [];
+  const nodeStyles = [];
+  const borderStyles = [];
+  const backgroundStyles = [];
+  stylesArray.forEach((style) => {
+    const key = style[0];
+    if (key === "color" || key === "font-size" || key === "font-family" || key === "font-weight" || key === "font-style" || key === "text-decoration" || key === "text-align" || key === "text-transform" || key === "line-height" || key === "letter-spacing" || key === "word-spacing" || key === "text-shadow" || key === "text-overflow" || key === "white-space" || key === "word-wrap" || key === "word-break" || key === "overflow-wrap" || key === "hyphens") {
+      labelStyles.push(style.join(":") + " !important");
+    } else {
+      nodeStyles.push(style.join(":") + " !important");
+      if (key.includes("stroke")) {
+        borderStyles.push(style.join(":") + " !important");
+      }
+      if (key === "fill") {
+        backgroundStyles.push(style.join(":") + " !important");
+      }
+    }
+  });
+  return {
+    labelStyles: labelStyles.join(";"),
+    nodeStyles: nodeStyles.join(";"),
+    stylesArray,
+    borderStyles,
+    backgroundStyles
+  };
+}, "styles2String");
+var userNodeOverrides = /* @__PURE__ */ __name((node, options) => {
+  const { themeVariables, handDrawnSeed } = getConfig();
+  const { nodeBorder, mainBkg } = themeVariables;
+  const { stylesMap } = compileStyles(node);
+  const result = Object.assign(
+    {
+      roughness: 0.7,
+      fill: stylesMap.get("fill") || mainBkg,
+      fillStyle: "hachure",
+      // solid fill
+      fillWeight: 4,
+      stroke: stylesMap.get("stroke") || nodeBorder,
+      seed: handDrawnSeed,
+      strokeWidth: 1.3
+    },
+    options
+  );
+  return result;
+}, "userNodeOverrides");
+
+// src/rendering-util/rendering-elements/clusters.js
+var rect = /* @__PURE__ */ __name(async (parent, node) => {
+  log.info("Creating subgraph rect for ", node.id, node);
+  const siteConfig = getConfig();
+  const { themeVariables, handDrawnSeed } = siteConfig;
+  const { clusterBkg, clusterBorder } = themeVariables;
+  const { labelStyles, nodeStyles, borderStyles, backgroundStyles } = styles2String(node);
+  const shapeSvg = parent.insert("g").attr("class", "cluster " + node.cssClasses).attr("id", node.id).attr("data-look", node.look);
+  const useHtmlLabels = evaluate(siteConfig.flowchart.htmlLabels);
+  const labelEl = shapeSvg.insert("g").attr("class", "cluster-label ");
+  const text = await createText(labelEl, node.label, {
+    style: node.labelStyle,
+    useHtmlLabels,
+    isNode: true
+  });
+  let bbox = text.getBBox();
+  if (evaluate(siteConfig.flowchart.htmlLabels)) {
+    const div = text.children[0];
+    const dv = select2(text);
+    bbox = div.getBoundingClientRect();
+    dv.attr("width", bbox.width);
+    dv.attr("height", bbox.height);
+  }
+  const width = node.width <= bbox.width + node.padding ? bbox.width + node.padding : node.width;
+  if (node.width <= bbox.width + node.padding) {
+    node.diff = (width - node.width) / 2 - node.padding;
+  } else {
+    node.diff = -node.padding;
+  }
+  const height = node.height;
+  const x = node.x - width / 2;
+  const y = node.y - height / 2;
+  log.trace("Data ", node, JSON.stringify(node));
+  let rect2;
+  if (node.look === "handDrawn") {
+    const rc = rough.svg(shapeSvg);
+    const options = userNodeOverrides(node, {
+      roughness: 0.7,
+      fill: clusterBkg,
+      // fill: 'red',
+      stroke: clusterBorder,
+      fillWeight: 3,
+      seed: handDrawnSeed
+    });
+    const roughNode = rc.path(createRoundedRectPathD(x, y, width, height, 0), options);
+    rect2 = shapeSvg.insert(() => {
+      log.debug("Rough node insert CXC", roughNode);
+      return roughNode;
+    }, ":first-child");
+    rect2.select("path:nth-child(2)").attr("style", borderStyles.join(";"));
+    rect2.select("path").attr("style", backgroundStyles.join(";").replace("fill", "stroke"));
+  } else {
+    rect2 = shapeSvg.insert("rect", ":first-child");
+    rect2.attr("style", nodeStyles).attr("rx", node.rx).attr("ry", node.ry).attr("x", x).attr("y", y).attr("width", width).attr("height", height);
+  }
+  const { subGraphTitleTopMargin } = getSubGraphTitleMargins(siteConfig);
+  labelEl.attr(
+    "transform",
+    // This puts the label on top of the box instead of inside it
+    `translate(${node.x - bbox.width / 2}, ${node.y - node.height / 2 + subGraphTitleTopMargin})`
+  );
+  if (labelStyles) {
+    const span = labelEl.select("span");
+    if (span) {
+      span.attr("style", labelStyles);
+    }
+  }
+  const rectBox = rect2.node().getBBox();
+  node.offsetX = 0;
+  node.width = rectBox.width;
+  node.height = rectBox.height;
+  node.offsetY = bbox.height - node.padding / 2;
+  node.intersect = function(point2) {
+    return intersect_rect_default(node, point2);
+  };
+  return { cluster: shapeSvg, labelBBox: bbox };
+}, "rect");
+var noteGroup = /* @__PURE__ */ __name((parent, node) => {
+  const shapeSvg = parent.insert("g").attr("class", "note-cluster").attr("id", node.id);
+  const rect2 = shapeSvg.insert("rect", ":first-child");
+  const padding = 0 * node.padding;
+  const halfPadding = padding / 2;
+  rect2.attr("rx", node.rx).attr("ry", node.ry).attr("x", node.x - node.width / 2 - halfPadding).attr("y", node.y - node.height / 2 - halfPadding).attr("width", node.width + padding).attr("height", node.height + padding).attr("fill", "none");
+  const rectBox = rect2.node().getBBox();
+  node.width = rectBox.width;
+  node.height = rectBox.height;
+  node.intersect = function(point2) {
+    return intersect_rect_default(node, point2);
+  };
+  return { cluster: shapeSvg, labelBBox: { width: 0, height: 0 } };
+}, "noteGroup");
+var roundedWithTitle = /* @__PURE__ */ __name(async (parent, node) => {
+  const siteConfig = getConfig();
+  const { themeVariables, handDrawnSeed } = siteConfig;
+  const { altBackground, compositeBackground, compositeTitleBackground, nodeBorder } = themeVariables;
+  const shapeSvg = parent.insert("g").attr("class", node.cssClasses).attr("id", node.id).attr("data-id", node.id).attr("data-look", node.look);
+  const outerRectG = shapeSvg.insert("g", ":first-child");
+  const label = shapeSvg.insert("g").attr("class", "cluster-label");
+  let innerRect = shapeSvg.append("rect");
+  const text = label.node().appendChild(await createLabel_default(node.label, node.labelStyle, void 0, true));
+  let bbox = text.getBBox();
+  if (evaluate(siteConfig.flowchart.htmlLabels)) {
+    const div = text.children[0];
+    const dv = select2(text);
+    bbox = div.getBoundingClientRect();
+    dv.attr("width", bbox.width);
+    dv.attr("height", bbox.height);
+  }
+  const padding = 0 * node.padding;
+  const halfPadding = padding / 2;
+  const width = (node.width <= bbox.width + node.padding ? bbox.width + node.padding : node.width) + padding;
+  if (node.width <= bbox.width + node.padding) {
+    node.diff = (width - node.width) / 2 - node.padding;
+  } else {
+    node.diff = -node.padding;
+  }
+  const height = node.height + padding;
+  const innerHeight = node.height + padding - bbox.height - 6;
+  const x = node.x - width / 2;
+  const y = node.y - height / 2;
+  node.width = width;
+  const innerY = node.y - node.height / 2 - halfPadding + bbox.height + 2;
+  let rect2;
+  if (node.look === "handDrawn") {
+    const isAlt = node.cssClasses.includes("statediagram-cluster-alt");
+    const rc = rough.svg(shapeSvg);
+    const roughOuterNode = node.rx || node.ry ? rc.path(createRoundedRectPathD(x, y, width, height, 10), {
+      roughness: 0.7,
+      fill: compositeTitleBackground,
+      fillStyle: "solid",
+      stroke: nodeBorder,
+      seed: handDrawnSeed
+    }) : rc.rectangle(x, y, width, height, { seed: handDrawnSeed });
+    rect2 = shapeSvg.insert(() => roughOuterNode, ":first-child");
+    const roughInnerNode = rc.rectangle(x, innerY, width, innerHeight, {
+      fill: isAlt ? altBackground : compositeBackground,
+      fillStyle: isAlt ? "hachure" : "solid",
+      stroke: nodeBorder,
+      seed: handDrawnSeed
+    });
+    rect2 = shapeSvg.insert(() => roughOuterNode, ":first-child");
+    innerRect = shapeSvg.insert(() => roughInnerNode);
+  } else {
+    rect2 = outerRectG.insert("rect", ":first-child");
+    const outerRectClass = "outer";
+    rect2.attr("class", outerRectClass).attr("x", x).attr("y", y).attr("width", width).attr("height", height).attr("data-look", node.look);
+    innerRect.attr("class", "inner").attr("x", x).attr("y", innerY).attr("width", width).attr("height", innerHeight);
+  }
+  label.attr(
+    "transform",
+    `translate(${node.x - bbox.width / 2}, ${y + 1 - (evaluate(siteConfig.flowchart.htmlLabels) ? 0 : 3)})`
+  );
+  const rectBox = rect2.node().getBBox();
+  node.height = rectBox.height;
+  node.offsetX = 0;
+  node.offsetY = bbox.height - node.padding / 2;
+  node.labelBBox = bbox;
+  node.intersect = function(point2) {
+    return intersect_rect_default(node, point2);
+  };
+  return { cluster: shapeSvg, labelBBox: bbox };
+}, "roundedWithTitle");
+var divider = /* @__PURE__ */ __name((parent, node) => {
+  const siteConfig = getConfig();
+  const { themeVariables, handDrawnSeed } = siteConfig;
+  const { nodeBorder } = themeVariables;
+  const shapeSvg = parent.insert("g").attr("class", node.cssClasses).attr("id", node.id).attr("data-look", node.look);
+  const outerRectG = shapeSvg.insert("g", ":first-child");
+  const padding = 0 * node.padding;
+  const width = node.width + padding;
+  node.diff = -node.padding;
+  const height = node.height + padding;
+  const x = node.x - width / 2;
+  const y = node.y - height / 2;
+  node.width = width;
+  let rect2;
+  if (node.look === "handDrawn") {
+    const rc = rough.svg(shapeSvg);
+    const roughOuterNode = rc.rectangle(x, y, width, height, {
+      fill: "lightgrey",
+      roughness: 0.5,
+      strokeLineDash: [5],
+      stroke: nodeBorder,
+      seed: handDrawnSeed
+    });
+    rect2 = shapeSvg.insert(() => roughOuterNode, ":first-child");
+  } else {
+    rect2 = outerRectG.insert("rect", ":first-child");
+    const outerRectClass = "divider";
+    rect2.attr("class", outerRectClass).attr("x", x).attr("y", y).attr("width", width).attr("height", height).attr("data-look", node.look);
+  }
+  const rectBox = rect2.node().getBBox();
+  node.height = rectBox.height;
+  node.offsetX = 0;
+  node.offsetY = 0;
+  node.intersect = function(point2) {
+    return intersect_rect_default(node, point2);
+  };
+  return { cluster: shapeSvg, labelBBox: {} };
+}, "divider");
+var squareRect = rect;
+var shapes = {
+  rect,
+  squareRect,
+  roundedWithTitle,
+  noteGroup,
+  divider
+};
+var clusterElems = /* @__PURE__ */ new Map();
+var insertCluster = /* @__PURE__ */ __name(async (elem, node) => {
+  const shape = node.shape || "rect";
+  const cluster = await shapes[shape](elem, node);
+  clusterElems.set(node.id, cluster);
+  return cluster;
+}, "insertCluster");
+var clear = /* @__PURE__ */ __name(() => {
+  clusterElems = /* @__PURE__ */ new Map();
+}, "clear");
+
+// src/rendering-util/rendering-elements/edges.js
+import { curveBasis, line, select as select3 } from "d3";
+import rough2 from "roughjs";
+
+// src/rendering-util/rendering-elements/edgeMarker.ts
+var addEdgeMarkers = /* @__PURE__ */ __name((svgPath, edge, url, id, diagramType) => {
+  if (edge.arrowTypeStart) {
+    addEdgeMarker(svgPath, "start", edge.arrowTypeStart, url, id, diagramType);
+  }
+  if (edge.arrowTypeEnd) {
+    addEdgeMarker(svgPath, "end", edge.arrowTypeEnd, url, id, diagramType);
+  }
+}, "addEdgeMarkers");
+var arrowTypesMap = {
+  arrow_cross: "cross",
+  arrow_point: "point",
+  arrow_barb: "barb",
+  arrow_circle: "circle",
+  aggregation: "aggregation",
+  extension: "extension",
+  composition: "composition",
+  dependency: "dependency",
+  lollipop: "lollipop"
+};
+var addEdgeMarker = /* @__PURE__ */ __name((svgPath, position, arrowType, url, id, diagramType) => {
+  const endMarkerType = arrowTypesMap[arrowType];
+  if (!endMarkerType) {
+    log.warn(`Unknown arrow type: ${arrowType}`);
+    return;
+  }
+  const suffix = position === "start" ? "Start" : "End";
+  svgPath.attr(`marker-${position}`, `url(${url}#${id}_${diagramType}-${endMarkerType}${suffix})`);
+}, "addEdgeMarker");
+
+// src/rendering-util/rendering-elements/edges.js
+var edgeLabels = /* @__PURE__ */ new Map();
+var terminalLabels = /* @__PURE__ */ new Map();
+var clear2 = /* @__PURE__ */ __name(() => {
+  edgeLabels.clear();
+  terminalLabels.clear();
+}, "clear");
+var getLabelStyles = /* @__PURE__ */ __name((styleArray) => {
+  let styles = styleArray ? styleArray.reduce((acc, style) => acc + ";" + style, "") : "";
+  return styles;
+}, "getLabelStyles");
+var insertEdgeLabel = /* @__PURE__ */ __name(async (elem, edge) => {
+  let useHtmlLabels = evaluate(getConfig().flowchart.htmlLabels);
+  const labelElement = await createText(elem, edge.label, {
+    style: getLabelStyles(edge.labelStyle),
+    useHtmlLabels,
+    addSvgBackground: true,
+    isNode: false
+  });
+  log.info("abc82", edge, edge.labelType);
+  const edgeLabel = elem.insert("g").attr("class", "edgeLabel");
+  const label = edgeLabel.insert("g").attr("class", "label");
+  label.node().appendChild(labelElement);
+  let bbox = labelElement.getBBox();
+  if (useHtmlLabels) {
+    const div = labelElement.children[0];
+    const dv = select3(labelElement);
+    bbox = div.getBoundingClientRect();
+    dv.attr("width", bbox.width);
+    dv.attr("height", bbox.height);
+  }
+  label.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")");
+  edgeLabels.set(edge.id, edgeLabel);
+  edge.width = bbox.width;
+  edge.height = bbox.height;
+  let fo;
+  if (edge.startLabelLeft) {
+    const startLabelElement = await createLabel_default(
+      edge.startLabelLeft,
+      getLabelStyles(edge.labelStyle)
+    );
+    const startEdgeLabelLeft = elem.insert("g").attr("class", "edgeTerminals");
+    const inner = startEdgeLabelLeft.insert("g").attr("class", "inner");
+    fo = inner.node().appendChild(startLabelElement);
+    const slBox = startLabelElement.getBBox();
+    inner.attr("transform", "translate(" + -slBox.width / 2 + ", " + -slBox.height / 2 + ")");
+    if (!terminalLabels.get(edge.id)) {
+      terminalLabels.set(edge.id, {});
+    }
+    terminalLabels.get(edge.id).startLeft = startEdgeLabelLeft;
+    setTerminalWidth(fo, edge.startLabelLeft);
+  }
+  if (edge.startLabelRight) {
+    const startLabelElement = await createLabel_default(
+      edge.startLabelRight,
+      getLabelStyles(edge.labelStyle)
+    );
+    const startEdgeLabelRight = elem.insert("g").attr("class", "edgeTerminals");
+    const inner = startEdgeLabelRight.insert("g").attr("class", "inner");
+    fo = startEdgeLabelRight.node().appendChild(startLabelElement);
+    inner.node().appendChild(startLabelElement);
+    const slBox = startLabelElement.getBBox();
+    inner.attr("transform", "translate(" + -slBox.width / 2 + ", " + -slBox.height / 2 + ")");
+    if (!terminalLabels.get(edge.id)) {
+      terminalLabels.set(edge.id, {});
+    }
+    terminalLabels.get(edge.id).startRight = startEdgeLabelRight;
+    setTerminalWidth(fo, edge.startLabelRight);
+  }
+  if (edge.endLabelLeft) {
+    const endLabelElement = await createLabel_default(edge.endLabelLeft, getLabelStyles(edge.labelStyle));
+    const endEdgeLabelLeft = elem.insert("g").attr("class", "edgeTerminals");
+    const inner = endEdgeLabelLeft.insert("g").attr("class", "inner");
+    fo = inner.node().appendChild(endLabelElement);
+    const slBox = endLabelElement.getBBox();
+    inner.attr("transform", "translate(" + -slBox.width / 2 + ", " + -slBox.height / 2 + ")");
+    endEdgeLabelLeft.node().appendChild(endLabelElement);
+    if (!terminalLabels.get(edge.id)) {
+      terminalLabels.set(edge.id, {});
+    }
+    terminalLabels.get(edge.id).endLeft = endEdgeLabelLeft;
+    setTerminalWidth(fo, edge.endLabelLeft);
+  }
+  if (edge.endLabelRight) {
+    const endLabelElement = await createLabel_default(edge.endLabelRight, getLabelStyles(edge.labelStyle));
+    const endEdgeLabelRight = elem.insert("g").attr("class", "edgeTerminals");
+    const inner = endEdgeLabelRight.insert("g").attr("class", "inner");
+    fo = inner.node().appendChild(endLabelElement);
+    const slBox = endLabelElement.getBBox();
+    inner.attr("transform", "translate(" + -slBox.width / 2 + ", " + -slBox.height / 2 + ")");
+    endEdgeLabelRight.node().appendChild(endLabelElement);
+    if (!terminalLabels.get(edge.id)) {
+      terminalLabels.set(edge.id, {});
+    }
+    terminalLabels.get(edge.id).endRight = endEdgeLabelRight;
+    setTerminalWidth(fo, edge.endLabelRight);
+  }
+  return labelElement;
+}, "insertEdgeLabel");
+function setTerminalWidth(fo, value) {
+  if (getConfig().flowchart.htmlLabels && fo) {
+    fo.style.width = value.length * 9 + "px";
+    fo.style.height = "12px";
+  }
+}
+__name(setTerminalWidth, "setTerminalWidth");
+var positionEdgeLabel = /* @__PURE__ */ __name((edge, paths) => {
+  log.debug("Moving label abc88 ", edge.id, edge.label, edgeLabels.get(edge.id), paths);
+  let path = paths.updatedPath ? paths.updatedPath : paths.originalPath;
+  const siteConfig = getConfig();
+  const { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig);
+  if (edge.label) {
+    const el = edgeLabels.get(edge.id);
+    let x = edge.x;
+    let y = edge.y;
+    if (path) {
+      const pos = utils_default.calcLabelPosition(path);
+      log.debug(
+        "Moving label " + edge.label + " from (",
+        x,
+        ",",
+        y,
+        ") to (",
+        pos.x,
+        ",",
+        pos.y,
+        ") abc88"
+      );
+      if (paths.updatedPath) {
+        x = pos.x;
+        y = pos.y;
+      }
+    }
+    el.attr("transform", `translate(${x}, ${y + subGraphTitleTotalMargin / 2})`);
+  }
+  if (edge.startLabelLeft) {
+    const el = terminalLabels.get(edge.id).startLeft;
+    let x = edge.x;
+    let y = edge.y;
+    if (path) {
+      const pos = utils_default.calcTerminalLabelPosition(edge.arrowTypeStart ? 10 : 0, "start_left", path);
+      x = pos.x;
+      y = pos.y;
+    }
+    el.attr("transform", `translate(${x}, ${y})`);
+  }
+  if (edge.startLabelRight) {
+    const el = terminalLabels.get(edge.id).startRight;
+    let x = edge.x;
+    let y = edge.y;
+    if (path) {
+      const pos = utils_default.calcTerminalLabelPosition(
+        edge.arrowTypeStart ? 10 : 0,
+        "start_right",
+        path
+      );
+      x = pos.x;
+      y = pos.y;
+    }
+    el.attr("transform", `translate(${x}, ${y})`);
+  }
+  if (edge.endLabelLeft) {
+    const el = terminalLabels.get(edge.id).endLeft;
+    let x = edge.x;
+    let y = edge.y;
+    if (path) {
+      const pos = utils_default.calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, "end_left", path);
+      x = pos.x;
+      y = pos.y;
+    }
+    el.attr("transform", `translate(${x}, ${y})`);
+  }
+  if (edge.endLabelRight) {
+    const el = terminalLabels.get(edge.id).endRight;
+    let x = edge.x;
+    let y = edge.y;
+    if (path) {
+      const pos = utils_default.calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, "end_right", path);
+      x = pos.x;
+      y = pos.y;
+    }
+    el.attr("transform", `translate(${x}, ${y})`);
+  }
+}, "positionEdgeLabel");
+var outsideNode = /* @__PURE__ */ __name((node, point2) => {
+  const x = node.x;
+  const y = node.y;
+  const dx = Math.abs(point2.x - x);
+  const dy = Math.abs(point2.y - y);
+  const w = node.width / 2;
+  const h = node.height / 2;
+  return dx >= w || dy >= h;
+}, "outsideNode");
+var intersection = /* @__PURE__ */ __name((node, outsidePoint, insidePoint) => {
+  log.debug(`intersection calc abc89:
+  outsidePoint: ${JSON.stringify(outsidePoint)}
+  insidePoint : ${JSON.stringify(insidePoint)}
+  node        : x:${node.x} y:${node.y} w:${node.width} h:${node.height}`);
+  const x = node.x;
+  const y = node.y;
+  const dx = Math.abs(x - insidePoint.x);
+  const w = node.width / 2;
+  let r = insidePoint.x < outsidePoint.x ? w - dx : w + dx;
+  const h = node.height / 2;
+  const Q = Math.abs(outsidePoint.y - insidePoint.y);
+  const R = Math.abs(outsidePoint.x - insidePoint.x);
+  if (Math.abs(y - outsidePoint.y) * w > Math.abs(x - outsidePoint.x) * h) {
+    let q = insidePoint.y < outsidePoint.y ? outsidePoint.y - h - y : y - h - outsidePoint.y;
+    r = R * q / Q;
+    const res = {
+      x: insidePoint.x < outsidePoint.x ? insidePoint.x + r : insidePoint.x - R + r,
+      y: insidePoint.y < outsidePoint.y ? insidePoint.y + Q - q : insidePoint.y - Q + q
+    };
+    if (r === 0) {
+      res.x = outsidePoint.x;
+      res.y = outsidePoint.y;
+    }
+    if (R === 0) {
+      res.x = outsidePoint.x;
+    }
+    if (Q === 0) {
+      res.y = outsidePoint.y;
+    }
+    log.debug(`abc89 top/bottom calc, Q ${Q}, q ${q}, R ${R}, r ${r}`, res);
+    return res;
+  } else {
+    if (insidePoint.x < outsidePoint.x) {
+      r = outsidePoint.x - w - x;
+    } else {
+      r = x - w - outsidePoint.x;
+    }
+    let q = Q * r / R;
+    let _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : insidePoint.x - R + r;
+    let _y = insidePoint.y < outsidePoint.y ? insidePoint.y + q : insidePoint.y - q;
+    log.debug(`sides calc abc89, Q ${Q}, q ${q}, R ${R}, r ${r}`, { _x, _y });
+    if (r === 0) {
+      _x = outsidePoint.x;
+      _y = outsidePoint.y;
+    }
+    if (R === 0) {
+      _x = outsidePoint.x;
+    }
+    if (Q === 0) {
+      _y = outsidePoint.y;
+    }
+    return { x: _x, y: _y };
+  }
+}, "intersection");
+var cutPathAtIntersect = /* @__PURE__ */ __name((_points, boundaryNode) => {
+  log.warn("abc88 cutPathAtIntersect", _points, boundaryNode);
+  let points = [];
+  let lastPointOutside = _points[0];
+  let isInside = false;
+  _points.forEach((point2) => {
+    log.info("abc88 checking point", point2, boundaryNode);
+    if (!outsideNode(boundaryNode, point2) && !isInside) {
+      const inter = intersection(boundaryNode, lastPointOutside, point2);
+      log.debug("abc88 inside", point2, lastPointOutside, inter);
+      log.debug("abc88 intersection", inter, boundaryNode);
+      let pointPresent = false;
+      points.forEach((p) => {
+        pointPresent = pointPresent || p.x === inter.x && p.y === inter.y;
+      });
+      if (!points.some((e) => e.x === inter.x && e.y === inter.y)) {
+        points.push(inter);
+      } else {
+        log.warn("abc88 no intersect", inter, points);
+      }
+      isInside = true;
+    } else {
+      log.warn("abc88 outside", point2, lastPointOutside);
+      lastPointOutside = point2;
+      if (!isInside) {
+        points.push(point2);
+      }
+    }
+  });
+  log.debug("returning points", points);
+  return points;
+}, "cutPathAtIntersect");
+function extractCornerPoints(points) {
+  const cornerPoints = [];
+  const cornerPointPositions = [];
+  for (let i = 1; i < points.length - 1; i++) {
+    const prev = points[i - 1];
+    const curr = points[i];
+    const next = points[i + 1];
+    if (prev.x === curr.x && curr.y === next.y && Math.abs(curr.x - next.x) > 5 && Math.abs(curr.y - prev.y) > 5) {
+      cornerPoints.push(curr);
+      cornerPointPositions.push(i);
+    } else if (prev.y === curr.y && curr.x === next.x && Math.abs(curr.x - prev.x) > 5 && Math.abs(curr.y - next.y) > 5) {
+      cornerPoints.push(curr);
+      cornerPointPositions.push(i);
+    }
+  }
+  return { cornerPoints, cornerPointPositions };
+}
+__name(extractCornerPoints, "extractCornerPoints");
+var findAdjacentPoint = /* @__PURE__ */ __name(function(pointA, pointB, distance) {
+  const xDiff = pointB.x - pointA.x;
+  const yDiff = pointB.y - pointA.y;
+  const length = Math.sqrt(xDiff * xDiff + yDiff * yDiff);
+  const ratio = distance / length;
+  return { x: pointB.x - ratio * xDiff, y: pointB.y - ratio * yDiff };
+}, "findAdjacentPoint");
+var fixCorners = /* @__PURE__ */ __name(function(lineData) {
+  const { cornerPointPositions } = extractCornerPoints(lineData);
+  const newLineData = [];
+  for (let i = 0; i < lineData.length; i++) {
+    if (cornerPointPositions.includes(i)) {
+      const prevPoint = lineData[i - 1];
+      const nextPoint = lineData[i + 1];
+      const cornerPoint = lineData[i];
+      const newPrevPoint = findAdjacentPoint(prevPoint, cornerPoint, 5);
+      const newNextPoint = findAdjacentPoint(nextPoint, cornerPoint, 5);
+      const xDiff = newNextPoint.x - newPrevPoint.x;
+      const yDiff = newNextPoint.y - newPrevPoint.y;
+      newLineData.push(newPrevPoint);
+      const a = Math.sqrt(2) * 2;
+      let newCornerPoint = { x: cornerPoint.x, y: cornerPoint.y };
+      if (Math.abs(nextPoint.x - prevPoint.x) > 10 && Math.abs(nextPoint.y - prevPoint.y) >= 10) {
+        log.debug(
+          "Corner point fixing",
+          Math.abs(nextPoint.x - prevPoint.x),
+          Math.abs(nextPoint.y - prevPoint.y)
+        );
+        const r = 5;
+        if (cornerPoint.x === newPrevPoint.x) {
+          newCornerPoint = {
+            x: xDiff < 0 ? newPrevPoint.x - r + a : newPrevPoint.x + r - a,
+            y: yDiff < 0 ? newPrevPoint.y - a : newPrevPoint.y + a
+          };
+        } else {
+          newCornerPoint = {
+            x: xDiff < 0 ? newPrevPoint.x - a : newPrevPoint.x + a,
+            y: yDiff < 0 ? newPrevPoint.y - r + a : newPrevPoint.y + r - a
+          };
+        }
+      } else {
+        log.debug(
+          "Corner point skipping fixing",
+          Math.abs(nextPoint.x - prevPoint.x),
+          Math.abs(nextPoint.y - prevPoint.y)
+        );
+      }
+      newLineData.push(newCornerPoint, newNextPoint);
+    } else {
+      newLineData.push(lineData[i]);
+    }
+  }
+  return newLineData;
+}, "fixCorners");
+var insertEdge = /* @__PURE__ */ __name(function(elem, edge, clusterDb, diagramType, startNode, endNode, id) {
+  const { handDrawnSeed } = getConfig();
+  let points = edge.points;
+  let pointsHasChanged = false;
+  const tail = startNode;
+  var head = endNode;
+  if (head.intersect && tail.intersect) {
+    points = points.slice(1, edge.points.length - 1);
+    points.unshift(tail.intersect(points[0]));
+    log.debug(
+      "Last point APA12",
+      edge.start,
+      "-->",
+      edge.end,
+      points[points.length - 1],
+      head,
+      head.intersect(points[points.length - 1])
+    );
+    points.push(head.intersect(points[points.length - 1]));
+  }
+  if (edge.toCluster) {
+    log.info("to cluster abc88", clusterDb.get(edge.toCluster));
+    points = cutPathAtIntersect(edge.points, clusterDb.get(edge.toCluster).node);
+    pointsHasChanged = true;
+  }
+  if (edge.fromCluster) {
+    log.debug(
+      "from cluster abc88",
+      clusterDb.get(edge.fromCluster),
+      JSON.stringify(points, null, 2)
+    );
+    points = cutPathAtIntersect(points.reverse(), clusterDb.get(edge.fromCluster).node).reverse();
+    pointsHasChanged = true;
+  }
+  let lineData = points.filter((p) => !Number.isNaN(p.y));
+  lineData = fixCorners(lineData);
+  let lastPoint = lineData[lineData.length - 1];
+  if (lineData.length > 1) {
+    lastPoint = lineData[lineData.length - 1];
+    const secondLastPoint = lineData[lineData.length - 2];
+    const diffX = (lastPoint.x - secondLastPoint.x) / 2;
+    const diffY = (lastPoint.y - secondLastPoint.y) / 2;
+    const midPoint = { x: secondLastPoint.x + diffX, y: secondLastPoint.y + diffY };
+    lineData.splice(-1, 0, midPoint);
+  }
+  let curve = curveBasis;
+  if (edge.curve) {
+    curve = edge.curve;
+  }
+  const { x, y } = getLineFunctionsWithOffset(edge);
+  const lineFunction = line().x(x).y(y).curve(curve);
+  let strokeClasses;
+  switch (edge.thickness) {
+    case "normal":
+      strokeClasses = "edge-thickness-normal";
+      break;
+    case "thick":
+      strokeClasses = "edge-thickness-thick";
+      break;
+    case "invisible":
+      strokeClasses = "edge-thickness-invisible";
+      break;
+    default:
+      strokeClasses = "edge-thickness-normal";
+  }
+  switch (edge.pattern) {
+    case "solid":
+      strokeClasses += " edge-pattern-solid";
+      break;
+    case "dotted":
+      strokeClasses += " edge-pattern-dotted";
+      break;
+    case "dashed":
+      strokeClasses += " edge-pattern-dashed";
+      break;
+    default:
+      strokeClasses += " edge-pattern-solid";
+  }
+  let svgPath;
+  let linePath = lineFunction(lineData);
+  const edgeStyles = Array.isArray(edge.style) ? edge.style : [edge.style];
+  if (edge.look === "handDrawn") {
+    const rc = rough2.svg(elem);
+    Object.assign([], lineData);
+    const svgPathNode = rc.path(linePath, {
+      roughness: 0.3,
+      seed: handDrawnSeed
+    });
+    strokeClasses += " transition";
+    svgPath = select3(svgPathNode).select("path").attr("id", edge.id).attr("class", " " + strokeClasses + (edge.classes ? " " + edge.classes : "")).attr("style", edgeStyles ? edgeStyles.reduce((acc, style) => acc + ";" + style, "") : "");
+    let d = svgPath.attr("d");
+    svgPath.attr("d", d);
+    elem.node().appendChild(svgPath.node());
+  } else {
+    svgPath = elem.append("path").attr("d", linePath).attr("id", edge.id).attr("class", " " + strokeClasses + (edge.classes ? " " + edge.classes : "")).attr("style", edgeStyles ? edgeStyles.reduce((acc, style) => acc + ";" + style, "") : "");
+  }
+  let url = "";
+  if (getConfig().flowchart.arrowMarkerAbsolute || getConfig().state.arrowMarkerAbsolute) {
+    url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
+    url = url.replace(/\(/g, "\\(").replace(/\)/g, "\\)");
+  }
+  log.info("arrowTypeStart", edge.arrowTypeStart);
+  log.info("arrowTypeEnd", edge.arrowTypeEnd);
+  addEdgeMarkers(svgPath, edge, url, id, diagramType);
+  let paths = {};
+  if (pointsHasChanged) {
+    paths.updatedPath = points;
+  }
+  paths.originalPath = edge.points;
+  return paths;
+}, "insertEdge");
+
+// src/rendering-util/rendering-elements/markers.js
+var insertMarkers = /* @__PURE__ */ __name((elem, markerArray, type, id) => {
+  markerArray.forEach((markerName) => {
+    markers[markerName](elem, type, id);
+  });
+}, "insertMarkers");
+var extension = /* @__PURE__ */ __name((elem, type, id) => {
+  log.trace("Making markers for ", id);
+  elem.append("defs").append("marker").attr("id", id + "_" + type + "-extensionStart").attr("class", "marker extension " + type).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z");
+  elem.append("defs").append("marker").attr("id", id + "_" + type + "-extensionEnd").attr("class", "marker extension " + type).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
+}, "extension");
+var composition = /* @__PURE__ */ __name((elem, type, id) => {
+  elem.append("defs").append("marker").attr("id", id + "_" + type + "-compositionStart").attr("class", "marker composition " + type).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
+  elem.append("defs").append("marker").attr("id", id + "_" + type + "-compositionEnd").attr("class", "marker composition " + type).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
+}, "composition");
+var aggregation = /* @__PURE__ */ __name((elem, type, id) => {
+  elem.append("defs").append("marker").attr("id", id + "_" + type + "-aggregationStart").attr("class", "marker aggregation " + type).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
+  elem.append("defs").append("marker").attr("id", id + "_" + type + "-aggregationEnd").attr("class", "marker aggregation " + type).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
+}, "aggregation");
+var dependency = /* @__PURE__ */ __name((elem, type, id) => {
+  elem.append("defs").append("marker").attr("id", id + "_" + type + "-dependencyStart").attr("class", "marker dependency " + type).attr("refX", 6).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z");
+  elem.append("defs").append("marker").attr("id", id + "_" + type + "-dependencyEnd").attr("class", "marker dependency " + type).attr("refX", 13).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
+}, "dependency");
+var lollipop = /* @__PURE__ */ __name((elem, type, id) => {
+  elem.append("defs").append("marker").attr("id", id + "_" + type + "-lollipopStart").attr("class", "marker lollipop " + type).attr("refX", 13).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6);
+  elem.append("defs").append("marker").attr("id", id + "_" + type + "-lollipopEnd").attr("class", "marker lollipop " + type).attr("refX", 1).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6);
+}, "lollipop");
+var point = /* @__PURE__ */ __name((elem, type, id) => {
+  elem.append("marker").attr("id", id + "_" + type + "-pointEnd").attr("class", "marker " + type).attr("viewBox", "0 0 10 10").attr("refX", 5).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 8).attr("markerHeight", 8).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
+  elem.append("marker").attr("id", id + "_" + type + "-pointStart").attr("class", "marker " + type).attr("viewBox", "0 0 10 10").attr("refX", 4.5).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 8).attr("markerHeight", 8).attr("orient", "auto").append("path").attr("d", "M 0 5 L 10 10 L 10 0 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
+}, "point");
+var circle = /* @__PURE__ */ __name((elem, type, id) => {
+  elem.append("marker").attr("id", id + "_" + type + "-circleEnd").attr("class", "marker " + type).attr("viewBox", "0 0 10 10").attr("refX", 11).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
+  elem.append("marker").attr("id", id + "_" + type + "-circleStart").attr("class", "marker " + type).attr("viewBox", "0 0 10 10").attr("refX", -1).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
+}, "circle");
+var cross = /* @__PURE__ */ __name((elem, type, id) => {
+  elem.append("marker").attr("id", id + "_" + type + "-crossEnd").attr("class", "marker cross " + type).attr("viewBox", "0 0 11 11").attr("refX", 12).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0");
+  elem.append("marker").attr("id", id + "_" + type + "-crossStart").attr("class", "marker cross " + type).attr("viewBox", "0 0 11 11").attr("refX", -1).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0");
+}, "cross");
+var barb = /* @__PURE__ */ __name((elem, type, id) => {
+  elem.append("defs").append("marker").attr("id", id + "_" + type + "-barbEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 14).attr("markerUnits", "userSpaceOnUse").attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
+}, "barb");
+var markers = {
+  extension,
+  composition,
+  aggregation,
+  dependency,
+  lollipop,
+  point,
+  circle,
+  cross,
+  barb
+};
+var markers_default = insertMarkers;
+
+// src/rendering-util/rendering-elements/shapes/util.js
+import { select as select4 } from "d3";
+var labelHelper = /* @__PURE__ */ __name(async (parent, node, _classes) => {
+  let cssClasses;
+  const useHtmlLabels = node.useHtmlLabels || evaluate(getConfig().flowchart.htmlLabels);
+  if (!_classes) {
+    cssClasses = "node default";
+  } else {
+    cssClasses = _classes;
+  }
+  const shapeSvg = parent.insert("g").attr("class", cssClasses).attr("id", node.domId || node.id);
+  const labelEl = shapeSvg.insert("g").attr("class", "label").attr("style", node.labelStyle);
+  let label;
+  if (node.label === void 0) {
+    label = "";
+  } else {
+    label = typeof node.label === "string" ? node.label : node.label[0];
+  }
+  let text;
+  text = await createText(labelEl, sanitizeText(decodeEntities(label), getConfig()), {
+    useHtmlLabels,
+    width: node.width || getConfig().flowchart.wrappingWidth,
+    cssClasses: "markdown-node-label",
+    style: node.labelStyle
+  });
+  let bbox = text.getBBox();
+  const halfPadding = node.padding / 2;
+  if (evaluate(getConfig().flowchart.htmlLabels)) {
+    const div = text.children[0];
+    const dv = select4(text);
+    const images = div.getElementsByTagName("img");
+    if (images) {
+      const noImgText = label.replace(/<img[^>]*>/g, "").trim() === "";
+      await Promise.all(
+        [...images].map(
+          (img) => new Promise((res) => {
+            function setupImage() {
+              img.style.display = "flex";
+              img.style.flexDirection = "column";
+              if (noImgText) {
+                const bodyFontSize = getConfig().fontSize ? getConfig().fontSize : window.getComputedStyle(document.body).fontSize;
+                const enlargingFactor = 5;
+                const width = parseInt(bodyFontSize, 10) * enlargingFactor + "px";
+                img.style.minWidth = width;
+                img.style.maxWidth = width;
+              } else {
+                img.style.width = "100%";
+              }
+              res(img);
+            }
+            __name(setupImage, "setupImage");
+            setTimeout(() => {
+              if (img.complete) {
+                setupImage();
+              }
+            });
+            img.addEventListener("error", setupImage);
+            img.addEventListener("load", setupImage);
+          })
+        )
+      );
+    }
+    bbox = div.getBoundingClientRect();
+    dv.attr("width", bbox.width);
+    dv.attr("height", bbox.height);
+  }
+  if (useHtmlLabels) {
+    labelEl.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")");
+  } else {
+    labelEl.attr("transform", "translate(0, " + -bbox.height / 2 + ")");
+  }
+  if (node.centerLabel) {
+    labelEl.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")");
+  }
+  labelEl.insert("rect", ":first-child");
+  return { shapeSvg, bbox, halfPadding, label: labelEl };
+}, "labelHelper");
+var updateNodeBounds = /* @__PURE__ */ __name((node, element) => {
+  const bbox = element.node().getBBox();
+  node.width = bbox.width;
+  node.height = bbox.height;
+}, "updateNodeBounds");
+var getNodeClasses = /* @__PURE__ */ __name((node, extra) => (node.look === "handDrawn" ? "rough-node" : "node") + " " + node.cssClasses + " " + (extra || ""), "getNodeClasses");
+
+// src/rendering-util/rendering-elements/intersect/intersect-node.js
+function intersectNode(node, point2) {
+  return node.intersect(point2);
+}
+__name(intersectNode, "intersectNode");
+var intersect_node_default = intersectNode;
+
+// src/rendering-util/rendering-elements/intersect/intersect-ellipse.js
+function intersectEllipse(node, rx, ry, point2) {
+  var cx = node.x;
+  var cy = node.y;
+  var px = cx - point2.x;
+  var py = cy - point2.y;
+  var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px);
+  var dx = Math.abs(rx * ry * px / det);
+  if (point2.x < cx) {
+    dx = -dx;
+  }
+  var dy = Math.abs(rx * ry * py / det);
+  if (point2.y < cy) {
+    dy = -dy;
+  }
+  return { x: cx + dx, y: cy + dy };
+}
+__name(intersectEllipse, "intersectEllipse");
+var intersect_ellipse_default = intersectEllipse;
+
+// src/rendering-util/rendering-elements/intersect/intersect-circle.js
+function intersectCircle(node, rx, point2) {
+  return intersect_ellipse_default(node, rx, rx, point2);
+}
+__name(intersectCircle, "intersectCircle");
+var intersect_circle_default = intersectCircle;
+
+// src/rendering-util/rendering-elements/intersect/intersect-line.js
+function intersectLine(p1, p2, q1, q2) {
+  var a1, a2, b1, b2, c1, c2;
+  var r1, r2, r3, r4;
+  var denom, offset, num;
+  var x, y;
+  a1 = p2.y - p1.y;
+  b1 = p1.x - p2.x;
+  c1 = p2.x * p1.y - p1.x * p2.y;
+  r3 = a1 * q1.x + b1 * q1.y + c1;
+  r4 = a1 * q2.x + b1 * q2.y + c1;
+  if (r3 !== 0 && r4 !== 0 && sameSign(r3, r4)) {
+    return;
+  }
+  a2 = q2.y - q1.y;
+  b2 = q1.x - q2.x;
+  c2 = q2.x * q1.y - q1.x * q2.y;
+  r1 = a2 * p1.x + b2 * p1.y + c2;
+  r2 = a2 * p2.x + b2 * p2.y + c2;
+  if (r1 !== 0 && r2 !== 0 && sameSign(r1, r2)) {
+    return;
+  }
+  denom = a1 * b2 - a2 * b1;
+  if (denom === 0) {
+    return;
+  }
+  offset = Math.abs(denom / 2);
+  num = b1 * c2 - b2 * c1;
+  x = num < 0 ? (num - offset) / denom : (num + offset) / denom;
+  num = a2 * c1 - a1 * c2;
+  y = num < 0 ? (num - offset) / denom : (num + offset) / denom;
+  return { x, y };
+}
+__name(intersectLine, "intersectLine");
+function sameSign(r1, r2) {
+  return r1 * r2 > 0;
+}
+__name(sameSign, "sameSign");
+var intersect_line_default = intersectLine;
+
+// src/rendering-util/rendering-elements/intersect/intersect-polygon.js
+function intersectPolygon(node, polyPoints, point2) {
+  let x1 = node.x;
+  let y1 = node.y;
+  let intersections = [];
+  let minX = Number.POSITIVE_INFINITY;
+  let minY = Number.POSITIVE_INFINITY;
+  if (typeof polyPoints.forEach === "function") {
+    polyPoints.forEach(function(entry) {
+      minX = Math.min(minX, entry.x);
+      minY = Math.min(minY, entry.y);
+    });
+  } else {
+    minX = Math.min(minX, polyPoints.x);
+    minY = Math.min(minY, polyPoints.y);
+  }
+  let left = x1 - node.width / 2 - minX;
+  let top = y1 - node.height / 2 - minY;
+  for (let i = 0; i < polyPoints.length; i++) {
+    let p1 = polyPoints[i];
+    let p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0];
+    let intersect = intersect_line_default(
+      node,
+      point2,
+      { x: left + p1.x, y: top + p1.y },
+      { x: left + p2.x, y: top + p2.y }
+    );
+    if (intersect) {
+      intersections.push(intersect);
+    }
+  }
+  if (!intersections.length) {
+    return node;
+  }
+  if (intersections.length > 1) {
+    intersections.sort(function(p, q) {
+      let pdx = p.x - point2.x;
+      let pdy = p.y - point2.y;
+      let distp = Math.sqrt(pdx * pdx + pdy * pdy);
+      let qdx = q.x - point2.x;
+      let qdy = q.y - point2.y;
+      let distq = Math.sqrt(qdx * qdx + qdy * qdy);
+      return distp < distq ? -1 : distp === distq ? 0 : 1;
+    });
+  }
+  return intersections[0];
+}
+__name(intersectPolygon, "intersectPolygon");
+var intersect_polygon_default = intersectPolygon;
+
+// src/rendering-util/rendering-elements/intersect/index.js
+var intersect_default = {
+  node: intersect_node_default,
+  circle: intersect_circle_default,
+  ellipse: intersect_ellipse_default,
+  polygon: intersect_polygon_default,
+  rect: intersect_rect_default
+};
+
+// src/rendering-util/rendering-elements/shapes/drawRect.ts
+import rough3 from "roughjs";
+var drawRect = /* @__PURE__ */ __name(async (parent, node, options) => {
+  const { labelStyles, nodeStyles } = styles2String(node);
+  node.labelStyle = labelStyles;
+  const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
+  const totalWidth = Math.max(bbox.width + options.labelPaddingX * 2, node?.width || 0);
+  const totalHeight = Math.max(bbox.height + options.labelPaddingY * 2, node?.height || 0);
+  const x = -totalWidth / 2;
+  const y = -totalHeight / 2;
+  let rect2;
+  let { rx, ry } = node;
+  const { cssStyles } = node;
+  if (options?.rx && options.ry) {
+    rx = options.rx;
+    ry = options.ry;
+  }
+  if (node.look === "handDrawn") {
+    const rc = rough3.svg(shapeSvg);
+    const options2 = userNodeOverrides(node, {});
+    const roughNode = rx || ry ? rc.path(createRoundedRectPathD(x, y, totalWidth, totalHeight, rx || 0), options2) : rc.rectangle(x, y, totalWidth, totalHeight, options2);
+    rect2 = shapeSvg.insert(() => roughNode, ":first-child");
+    rect2.attr("class", "basic label-container").attr("style", cssStyles);
+  } else {
+    rect2 = shapeSvg.insert("rect", ":first-child");
+    rect2.attr("class", "basic label-container").attr("style", nodeStyles).attr("rx", rx).attr("data-id", "abc").attr("data-et", "node").attr("ry", ry).attr("x", x).attr("y", y).attr("width", totalWidth).attr("height", totalHeight);
+  }
+  updateNodeBounds(node, rect2);
+  node.intersect = function(point2) {
+    return intersect_default.rect(node, point2);
+  };
+  return shapeSvg;
+}, "drawRect");
+
+// src/rendering-util/rendering-elements/shapes/state.ts
+var state = /* @__PURE__ */ __name(async (parent, node) => {
+  const options = {
+    rx: 5,
+    ry: 5,
+    classes: "flowchart-node"
+  };
+  return drawRect(parent, node, options);
+}, "state");
+
+// src/rendering-util/rendering-elements/shapes/roundedRect.ts
+var roundedRect = /* @__PURE__ */ __name(async (parent, node) => {
+  const options = {
+    rx: 5,
+    ry: 5,
+    classes: "",
+    labelPaddingX: (node?.padding || 0) * 1,
+    labelPaddingY: (node?.padding || 0) * 1
+  };
+  return drawRect(parent, node, options);
+}, "roundedRect");
+
+// src/rendering-util/rendering-elements/shapes/squareRect.ts
+var squareRect2 = /* @__PURE__ */ __name(async (parent, node) => {
+  const options = {
+    rx: 0,
+    ry: 0,
+    classes: "",
+    labelPaddingX: (node?.padding || 0) * 2,
+    labelPaddingY: (node?.padding || 0) * 1
+  };
+  return drawRect(parent, node, options);
+}, "squareRect");
+
+// src/rendering-util/rendering-elements/shapes/stateStart.ts
+import rough4 from "roughjs";
+var stateStart = /* @__PURE__ */ __name((parent, node) => {
+  const { themeVariables } = getConfig();
+  const { lineColor } = themeVariables;
+  const shapeSvg = parent.insert("g").attr("class", "node default").attr("id", node.domId || node.id);
+  let circle3;
+  if (node.look === "handDrawn") {
+    const rc = rough4.svg(shapeSvg);
+    const roughNode = rc.circle(0, 0, 14, solidStateFill(lineColor));
+    circle3 = shapeSvg.insert(() => roughNode);
+  } else {
+    circle3 = shapeSvg.insert("circle", ":first-child");
+  }
+  circle3.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14);
+  updateNodeBounds(node, circle3);
+  node.intersect = function(point2) {
+    return intersect_default.circle(node, 7, point2);
+  };
+  return shapeSvg;
+}, "stateStart");
+
+// src/rendering-util/rendering-elements/shapes/stateEnd.ts
+import rough5 from "roughjs";
+var stateEnd = /* @__PURE__ */ __name((parent, node) => {
+  const { themeVariables } = getConfig();
+  const { lineColor } = themeVariables;
+  const shapeSvg = parent.insert("g").attr("class", "node default").attr("id", node.domId || node.id);
+  let circle3;
+  let innerCircle;
+  if (node.look === "handDrawn") {
+    const rc = rough5.svg(shapeSvg);
+    const roughNode = rc.circle(0, 0, 14, { ...solidStateFill(lineColor), roughness: 0.5 });
+    const roughInnerNode = rc.circle(0, 0, 5, { ...solidStateFill(lineColor), fillStyle: "solid" });
+    circle3 = shapeSvg.insert(() => roughNode);
+    innerCircle = shapeSvg.insert(() => roughInnerNode);
+  } else {
+    innerCircle = shapeSvg.insert("circle", ":first-child");
+    circle3 = shapeSvg.insert("circle", ":first-child");
+    circle3.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14);
+    innerCircle.attr("class", "state-end").attr("r", 5).attr("width", 10).attr("height", 10);
+  }
+  updateNodeBounds(node, circle3);
+  node.intersect = function(point2) {
+    return intersect_default.circle(node, 7, point2);
+  };
+  return shapeSvg;
+}, "stateEnd");
+
+// src/rendering-util/rendering-elements/shapes/forkJoin.ts
+import rough6 from "roughjs";
+var forkJoin = /* @__PURE__ */ __name((parent, node, dir) => {
+  const { themeVariables } = getConfig();
+  const { lineColor } = themeVariables;
+  const shapeSvg = parent.insert("g").attr("class", "node default").attr("id", node.domId || node.id);
+  let width = 70;
+  let height = 10;
+  if (dir === "LR") {
+    width = 10;
+    height = 70;
+  }
+  const x = -1 * width / 2;
+  const y = -1 * height / 2;
+  let shape;
+  if (node.look === "handDrawn") {
+    const rc = rough6.svg(shapeSvg);
+    const roughNode = rc.rectangle(x, y, width, height, solidStateFill(lineColor));
+    shape = shapeSvg.insert(() => roughNode);
+  } else {
+    shape = shapeSvg.append("rect").attr("x", x).attr("y", y).attr("width", width).attr("height", height).attr("class", "fork-join");
+  }
+  updateNodeBounds(node, shape);
+  let nodeHeight = 0;
+  let nodeWidth = 0;
+  let nodePadding = 10;
+  if (node.height) {
+    nodeHeight = node.height;
+  }
+  if (node.width) {
+    nodeWidth = node.width;
+  }
+  if (node.padding) {
+    nodePadding = node.padding;
+  }
+  node.height = nodeHeight + nodePadding / 2;
+  node.width = nodeWidth + nodePadding / 2;
+  node.intersect = function(point2) {
+    return intersect_default.rect(node, point2);
+  };
+  return shapeSvg;
+}, "forkJoin");
+
+// src/rendering-util/rendering-elements/shapes/choice.ts
+import rough7 from "roughjs";
+var choice = /* @__PURE__ */ __name((parent, node) => {
+  const { labelStyles, nodeStyles } = styles2String(node);
+  node.labelStyle = labelStyles;
+  const { themeVariables } = getConfig();
+  const { lineColor } = themeVariables;
+  const shapeSvg = parent.insert("g").attr("class", "node default").attr("id", node.domId || node.id);
+  const s = 28;
+  const points = [
+    { x: 0, y: s / 2 },
+    { x: s / 2, y: 0 },
+    { x: 0, y: -s / 2 },
+    { x: -s / 2, y: 0 }
+  ];
+  let choice2;
+  if (node.look === "handDrawn") {
+    const rc = rough7.svg(shapeSvg);
+    const pointArr = points.map(function(d) {
+      return [d.x, d.y];
+    });
+    const roughNode = rc.polygon(pointArr, solidStateFill(lineColor));
+    choice2 = shapeSvg.insert(() => roughNode);
+  } else {
+    choice2 = shapeSvg.insert("polygon", ":first-child").attr(
+      "points",
+      points.map(function(d) {
+        return d.x + "," + d.y;
+      }).join(" ")
+    );
+  }
+  choice2.attr("class", "state-start").attr("r", 7).attr("width", 28).attr("height", 28).attr("style", nodeStyles);
+  node.width = 28;
+  node.height = 28;
+  node.intersect = function(point2) {
+    return intersect_default.circle(node, 14, point2);
+  };
+  return shapeSvg;
+}, "choice");
+
+// src/rendering-util/rendering-elements/shapes/note.ts
+import rough8 from "roughjs";
+var note = /* @__PURE__ */ __name(async (parent, node) => {
+  const { themeVariables, handDrawnSeed } = getConfig();
+  const { noteBorderColor, noteBkgColor } = themeVariables;
+  const useHtmlLabels = node.useHtmlLabels;
+  if (!useHtmlLabels) {
+    node.centerLabel = true;
+  }
+  const { shapeSvg, bbox } = await labelHelper(parent, node, "node " + node.cssClasses);
+  log.info("Classes = ", node.cssClasses);
+  const { cssStyles } = node;
+  let rect2;
+  const totalWidth = bbox.width + node.padding;
+  const totalHeight = bbox.height + node.padding;
+  const x = -totalWidth / 2;
+  const y = -totalHeight / 2;
+  if (node.look === "handDrawn") {
+    const rc = rough8.svg(shapeSvg);
+    const roughNode = rc.rectangle(x, y, totalWidth, totalHeight, {
+      roughness: 0.7,
+      fill: noteBkgColor,
+      fillWeight: 3,
+      seed: handDrawnSeed,
+      // fillStyle: 'solid', // solid fill'
+      stroke: noteBorderColor
+    });
+    rect2 = shapeSvg.insert(() => roughNode, ":first-child");
+    rect2.attr("class", "basic label-container").attr("style", cssStyles);
+  } else {
+    rect2 = shapeSvg.insert("rect", ":first-child");
+    rect2.attr("rx", node.rx).attr("ry", node.ry).attr("x", x).attr("y", y).attr("width", totalWidth).attr("height", totalHeight);
+  }
+  updateNodeBounds(node, rect2);
+  node.intersect = function(point2) {
+    return intersect_default.rect(node, point2);
+  };
+  return shapeSvg;
+}, "note");
+
+// src/rendering-util/rendering-elements/shapes/stadium.ts
+import rough9 from "roughjs";
+var stadium = /* @__PURE__ */ __name(async (parent, node) => {
+  const { labelStyles, nodeStyles } = styles2String(node);
+  node.labelStyle = labelStyles;
+  const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
+  const h = bbox.height + node.padding;
+  const w = bbox.width + h / 4 + node.padding;
+  let rect2;
+  const { cssStyles } = node;
+  if (node.look === "handDrawn") {
+    const rc = rough9.svg(shapeSvg);
+    const options = userNodeOverrides(node, {});
+    const pathData = createRoundedRectPathD(-w / 2, -h / 2, w, h, h / 2);
+    const roughNode = rc.path(pathData, options);
+    rect2 = shapeSvg.insert(() => roughNode, ":first-child");
+    rect2.attr("class", "basic label-container").attr("style", cssStyles);
+  } else {
+    rect2 = shapeSvg.insert("rect", ":first-child");
+    rect2.attr("class", "basic label-container").attr("style", nodeStyles).attr("rx", h / 2).attr("ry", h / 2).attr("x", -w / 2).attr("y", -h / 2).attr("width", w).attr("height", h);
+  }
+  updateNodeBounds(node, rect2);
+  node.intersect = function(point2) {
+    return intersect_default.rect(node, point2);
+  };
+  return shapeSvg;
+}, "stadium");
+
+// src/rendering-util/rendering-elements/shapes/rectWithTitle.ts
+import { select as select5 } from "d3";
+import rough10 from "roughjs";
+var rectWithTitle = /* @__PURE__ */ __name(async (parent, node) => {
+  const { labelStyles, nodeStyles } = styles2String(node);
+  node.labelStyle = labelStyles;
+  let classes;
+  if (!node.cssClasses) {
+    classes = "node default";
+  } else {
+    classes = "node " + node.cssClasses;
+  }
+  const shapeSvg = parent.insert("g").attr("class", classes).attr("id", node.domId || node.id);
+  const g = shapeSvg.insert("g");
+  const label = shapeSvg.insert("g").attr("class", "label").attr("style", nodeStyles);
+  const description = node.description;
+  const title = node.label;
+  const text = label.node().appendChild(await createLabel_default(title, node.labelStyle, true, true));
+  let bbox = { width: 0, height: 0 };
+  if (evaluate(getConfig()?.flowchart?.htmlLabels)) {
+    const div2 = text.children[0];
+    const dv2 = select5(text);
+    bbox = div2.getBoundingClientRect();
+    dv2.attr("width", bbox.width);
+    dv2.attr("height", bbox.height);
+  }
+  log.info("Text 2", description);
+  const textRows = description || [];
+  const titleBox = text.getBBox();
+  const descr = label.node().appendChild(
+    await createLabel_default(
+      textRows.join ? textRows.join("<br/>") : textRows,
+      node.labelStyle,
+      true,
+      true
+    )
+  );
+  const div = descr.children[0];
+  const dv = select5(descr);
+  bbox = div.getBoundingClientRect();
+  dv.attr("width", bbox.width);
+  dv.attr("height", bbox.height);
+  const halfPadding = (node.padding || 0) / 2;
+  select5(descr).attr(
+    "transform",
+    "translate( " + (bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) + ", " + (titleBox.height + halfPadding + 5) + ")"
+  );
+  select5(text).attr(
+    "transform",
+    "translate( " + (bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) + ", 0)"
+  );
+  bbox = label.node().getBBox();
+  label.attr(
+    "transform",
+    "translate(" + -bbox.width / 2 + ", " + (-bbox.height / 2 - halfPadding + 3) + ")"
+  );
+  const totalWidth = bbox.width + (node.padding || 0);
+  const totalHeight = bbox.height + (node.padding || 0);
+  const x = -bbox.width / 2 - halfPadding;
+  const y = -bbox.height / 2 - halfPadding;
+  let rect2;
+  let innerLine;
+  if (node.look === "handDrawn") {
+    const rc = rough10.svg(shapeSvg);
+    const options = userNodeOverrides(node, {});
+    const roughNode = rc.path(
+      createRoundedRectPathD(x, y, totalWidth, totalHeight, node.rx || 0),
+      options
+    );
+    const roughLine = rc.line(
+      -bbox.width / 2 - halfPadding,
+      -bbox.height / 2 - halfPadding + titleBox.height + halfPadding,
+      bbox.width / 2 + halfPadding,
+      -bbox.height / 2 - halfPadding + titleBox.height + halfPadding,
+      options
+    );
+    innerLine = shapeSvg.insert(() => {
+      log.debug("Rough node insert CXC", roughNode);
+      return roughLine;
+    }, ":first-child");
+    rect2 = shapeSvg.insert(() => {
+      log.debug("Rough node insert CXC", roughNode);
+      return roughNode;
+    }, ":first-child");
+  } else {
+    rect2 = g.insert("rect", ":first-child");
+    innerLine = g.insert("line");
+    rect2.attr("class", "outer title-state").attr("style", nodeStyles).attr("x", -bbox.width / 2 - halfPadding).attr("y", -bbox.height / 2 - halfPadding).attr("width", bbox.width + (node.padding || 0)).attr("height", bbox.height + (node.padding || 0));
+    innerLine.attr("class", "divider").attr("x1", -bbox.width / 2 - halfPadding).attr("x2", bbox.width / 2 + halfPadding).attr("y1", -bbox.height / 2 - halfPadding + titleBox.height + halfPadding).attr("y2", -bbox.height / 2 - halfPadding + titleBox.height + halfPadding);
+  }
+  updateNodeBounds(node, rect2);
+  node.intersect = function(point2) {
+    return intersect_default.rect(node, point2);
+  };
+  return shapeSvg;
+}, "rectWithTitle");
+
+// src/rendering-util/rendering-elements/shapes/subroutine.ts
+import rough11 from "roughjs";
+
+// src/rendering-util/rendering-elements/shapes/insertPolygonShape.ts
+function insertPolygonShape(parent, w, h, points) {
+  return parent.insert("polygon", ":first-child").attr(
+    "points",
+    points.map(function(d) {
+      return d.x + "," + d.y;
+    }).join(" ")
+  ).attr("class", "label-container").attr("transform", "translate(" + -w / 2 + "," + h / 2 + ")");
+}
+__name(insertPolygonShape, "insertPolygonShape");
+
+// src/rendering-util/rendering-elements/shapes/subroutine.ts
+var subroutine = /* @__PURE__ */ __name(async (parent, node) => {
+  const { labelStyles, nodeStyles } = styles2String(node);
+  node.labelStyle = labelStyles;
+  const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
+  const halfPadding = (node?.padding || 0) / 2;
+  const w = bbox.width + node.padding;
+  const h = bbox.height + node.padding;
+  const x = -bbox.width / 2 - halfPadding;
+  const y = -bbox.height / 2 - halfPadding;
+  const points = [
+    { x: 0, y: 0 },
+    { x: w, y: 0 },
+    { x: w, y: -h },
+    { x: 0, y: -h },
+    { x: 0, y: 0 },
+    { x: -8, y: 0 },
+    { x: w + 8, y: 0 },
+    { x: w + 8, y: -h },
+    { x: -8, y: -h },
+    { x: -8, y: 0 }
+  ];
+  if (node.look === "handDrawn") {
+    const rc = rough11.svg(shapeSvg);
+    const options = userNodeOverrides(node, {});
+    const roughNode = rc.rectangle(x - 8, y, w + 16, h, options);
+    const l1 = rc.line(x, y, x, y + h, options);
+    const l2 = rc.line(x + w, y, x + w, y + h, options);
+    shapeSvg.insert(() => l1, ":first-child");
+    shapeSvg.insert(() => l2, ":first-child");
+    const rect2 = shapeSvg.insert(() => roughNode, ":first-child");
+    const { cssStyles } = node;
+    rect2.attr("class", "basic label-container").attr("style", cssStyles);
+    updateNodeBounds(node, rect2);
+  } else {
+    const el = insertPolygonShape(shapeSvg, w, h, points);
+    if (nodeStyles) {
+      el.attr("style", nodeStyles);
+    }
+    updateNodeBounds(node, el);
+  }
+  node.intersect = function(point2) {
+    return intersect_default.polygon(node, points, point2);
+  };
+  return shapeSvg;
+}, "subroutine");
+
+// src/rendering-util/rendering-elements/shapes/cylinder.ts
+import rough12 from "roughjs";
+var createCylinderPathD = /* @__PURE__ */ __name((x, y, width, height, rx, ry) => {
+  return [
+    `M${x},${y + ry}`,
+    `a${rx},${ry} 0,0,0 ${width},0`,
+    `a${rx},${ry} 0,0,0 ${-width},0`,
+    `l0,${height}`,
+    `a${rx},${ry} 0,0,0 ${width},0`,
+    `l0,${-height}`
+  ].join(" ");
+}, "createCylinderPathD");
+var createOuterCylinderPathD = /* @__PURE__ */ __name((x, y, width, height, rx, ry) => {
+  return [
+    `M${x},${y + ry}`,
+    `M${x + width},${y + ry}`,
+    `a${rx},${ry} 0,0,0 ${-width},0`,
+    `l0,${height}`,
+    `a${rx},${ry} 0,0,0 ${width},0`,
+    `l0,${-height}`
+  ].join(" ");
+}, "createOuterCylinderPathD");
+var createInnerCylinderPathD = /* @__PURE__ */ __name((x, y, width, height, rx, ry) => {
+  return [`M${x - width / 2},${-height / 2}`, `a${rx},${ry} 0,0,0 ${width},0`].join(" ");
+}, "createInnerCylinderPathD");
+var cylinder = /* @__PURE__ */ __name(async (parent, node) => {
+  const { labelStyles, nodeStyles } = styles2String(node);
+  node.labelStyle = labelStyles;
+  const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
+  const w = bbox.width + node.padding;
+  const rx = w / 2;
+  const ry = rx / (2.5 + w / 50);
+  const h = bbox.height + ry + node.padding;
+  let cylinder2;
+  const { cssStyles } = node;
+  if (node.look === "handDrawn") {
+    const rc = rough12.svg(shapeSvg);
+    const outerPathData = createOuterCylinderPathD(0, 0, w, h, rx, ry);
+    const innerPathData = createInnerCylinderPathD(0, ry, w, h, rx, ry);
+    const outerNode = rc.path(outerPathData, userNodeOverrides(node, {}));
+    const innerLine = rc.path(innerPathData, userNodeOverrides(node, { fill: "none" }));
+    cylinder2 = shapeSvg.insert(() => innerLine, ":first-child");
+    cylinder2 = shapeSvg.insert(() => outerNode, ":first-child");
+    cylinder2.attr("class", "basic label-container");
+    if (cssStyles) {
+      cylinder2.attr("style", cssStyles);
+    }
+  } else {
+    const pathData = createCylinderPathD(0, 0, w, h, rx, ry);
+    cylinder2 = shapeSvg.insert("path", ":first-child").attr("d", pathData).attr("class", "basic label-container").attr("style", cssStyles).attr("style", nodeStyles);
+  }
+  cylinder2.attr("label-offset-y", ry);
+  cylinder2.attr("transform", `translate(${-w / 2}, ${-(h / 2 + ry)})`);
+  updateNodeBounds(node, cylinder2);
+  node.intersect = function(point2) {
+    const pos = intersect_default.rect(node, point2);
+    const x = pos.x - (node.x ?? 0);
+    if (rx != 0 && (Math.abs(x) < (node.width ?? 0) / 2 || Math.abs(x) == (node.width ?? 0) / 2 && Math.abs(pos.y - (node.y ?? 0)) > (node.height ?? 0) / 2 - ry)) {
+      let y = ry * ry * (1 - x * x / (rx * rx));
+      if (y > 0) {
+        y = Math.sqrt(y);
+      }
+      y = ry - y;
+      if (point2.y - (node.y ?? 0) > 0) {
+        y = -y;
+      }
+      pos.y += y;
+    }
+    return pos;
+  };
+  return shapeSvg;
+}, "cylinder");
+
+// src/rendering-util/rendering-elements/shapes/circle.ts
+import rough13 from "roughjs";
+var circle2 = /* @__PURE__ */ __name(async (parent, node) => {
+  const { labelStyles, nodeStyles } = styles2String(node);
+  node.labelStyle = labelStyles;
+  const { shapeSvg, bbox, halfPadding } = await labelHelper(parent, node, getNodeClasses(node));
+  const radius = bbox.width / 2 + halfPadding;
+  let circleElem;
+  const { cssStyles } = node;
+  if (node.look === "handDrawn") {
+    const rc = rough13.svg(shapeSvg);
+    const options = userNodeOverrides(node, {});
+    const roughNode = rc.circle(0, 0, radius * 2, options);
+    circleElem = shapeSvg.insert(() => roughNode, ":first-child");
+    circleElem.attr("class", "basic label-container").attr("style", cssStyles);
+  } else {
+    circleElem = shapeSvg.insert("circle", ":first-child").attr("class", "basic label-container").attr("style", nodeStyles).attr("r", radius).attr("cx", 0).attr("cy", 0);
+  }
+  updateNodeBounds(node, circleElem);
+  node.intersect = function(point2) {
+    log.info("Circle intersect", node, radius, point2);
+    return intersect_default.circle(node, radius, point2);
+  };
+  return shapeSvg;
+}, "circle");
+
+// src/rendering-util/rendering-elements/shapes/doubleCircle.ts
+import rough14 from "roughjs";
+var doublecircle = /* @__PURE__ */ __name(async (parent, node) => {
+  const { labelStyles, nodeStyles } = styles2String(node);
+  node.labelStyle = labelStyles;
+  const { shapeSvg, bbox, halfPadding } = await labelHelper(parent, node, getNodeClasses(node));
+  const gap = 5;
+  const outerRadius = bbox.width / 2 + halfPadding + gap;
+  const innerRadius = bbox.width / 2 + halfPadding;
+  let circleGroup;
+  const { cssStyles } = node;
+  if (node.look === "handDrawn") {
+    const rc = rough14.svg(shapeSvg);
+    const outerOptions = userNodeOverrides(node, { roughness: 0.2, strokeWidth: 2.5 });
+    const innerOptions = userNodeOverrides(node, { roughness: 0.2, strokeWidth: 1.5 });
+    const outerRoughNode = rc.circle(0, 0, outerRadius * 2, outerOptions);
+    const innerRoughNode = rc.circle(0, 0, innerRadius * 2, innerOptions);
+    circleGroup = shapeSvg.insert("g", ":first-child");
+    circleGroup.attr("class", node.cssClasses).attr("style", cssStyles);
+    circleGroup.node()?.appendChild(outerRoughNode);
+    circleGroup.node()?.appendChild(innerRoughNode);
+  } else {
+    circleGroup = shapeSvg.insert("g", ":first-child");
+    const outerCircle = circleGroup.insert("circle", ":first-child");
+    const innerCircle = circleGroup.insert("circle");
+    circleGroup.attr("class", "basic label-container").attr("style", nodeStyles);
+    outerCircle.attr("class", "outer-circle").attr("style", nodeStyles).attr("r", outerRadius).attr("cx", 0).attr("cy", 0);
+    innerCircle.attr("class", "inner-circle").attr("style", nodeStyles).attr("r", innerRadius).attr("cx", 0).attr("cy", 0);
+  }
+  updateNodeBounds(node, circleGroup);
+  node.intersect = function(point2) {
+    log.info("DoubleCircle intersect", node, outerRadius, point2);
+    return intersect_default.circle(node, outerRadius, point2);
+  };
+  return shapeSvg;
+}, "doublecircle");
+
+// src/rendering-util/rendering-elements/shapes/rectLeftInvArrow.ts
+import rough15 from "roughjs";
+var createPolygonPathD = /* @__PURE__ */ __name((x, y, width, height) => {
+  return [
+    `M${x - height / 2},${y}`,
+    `L${x + width},${y}`,
+    `L${x + width},${y - height}`,
+    `L${x - height / 2},${y - height}`,
+    `L${x},${y - height / 2}`,
+    "Z"
+  ].join(" ");
+}, "createPolygonPathD");
+var rect_left_inv_arrow = /* @__PURE__ */ __name(async (parent, node) => {
+  const { labelStyles, nodeStyles } = styles2String(node);
+  node.labelStyle = labelStyles;
+  const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
+  const w = bbox.width + node.padding;
+  const h = bbox.height + node.padding;
+  const points = [
+    { x: -h / 2, y: 0 },
+    { x: w, y: 0 },
+    { x: w, y: -h },
+    { x: -h / 2, y: -h },
+    { x: 0, y: -h / 2 }
+  ];
+  let polygon;
+  const { cssStyles } = node;
+  if (node.look === "handDrawn") {
+    const rc = rough15.svg(shapeSvg);
+    const options = userNodeOverrides(node, {});
+    const pathData = createPolygonPathD(0, 0, w, h);
+    const roughNode = rc.path(pathData, options);
+    polygon = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-w / 2}, ${h / 2})`);
+    if (cssStyles) {
+      polygon.attr("style", cssStyles);
+    }
+  } else {
+    polygon = insertPolygonShape(shapeSvg, w, h, points);
+  }
+  if (nodeStyles) {
+    polygon.attr("style", nodeStyles);
+  }
+  node.width = w + h;
+  node.height = h;
+  updateNodeBounds(node, polygon);
+  node.intersect = function(point2) {
+    return intersect_default.polygon(node, points, point2);
+  };
+  return shapeSvg;
+}, "rect_left_inv_arrow");
+
+// src/rendering-util/rendering-elements/shapes/question.ts
+import rough16 from "roughjs";
+var createDecisionBoxPathD = /* @__PURE__ */ __name((x, y, size) => {
+  return [
+    `M${x + size / 2},${y}`,
+    `L${x + size},${y - size / 2}`,
+    `L${x + size / 2},${y - size}`,
+    `L${x},${y - size / 2}`,
+    "Z"
+  ].join(" ");
+}, "createDecisionBoxPathD");
+var question = /* @__PURE__ */ __name(async (parent, node) => {
+  const { labelStyles, nodeStyles } = styles2String(node);
+  node.labelStyle = labelStyles;
+  const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
+  const w = bbox.width + node.padding;
+  const h = bbox.height + node.padding;
+  const s = w + h;
+  const points = [
+    { x: s / 2, y: 0 },
+    { x: s, y: -s / 2 },
+    { x: s / 2, y: -s },
+    { x: 0, y: -s / 2 }
+  ];
+  let polygon;
+  const { cssStyles } = node;
+  if (node.look === "handDrawn") {
+    const rc = rough16.svg(shapeSvg);
+    const options = userNodeOverrides(node, {});
+    const pathData = createDecisionBoxPathD(0, 0, s);
+    const roughNode = rc.path(pathData, options);
+    polygon = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-s / 2}, ${s / 2})`);
+    if (cssStyles) {
+      polygon.attr("style", cssStyles);
+    }
+  } else {
+    polygon = insertPolygonShape(shapeSvg, s, s, points);
+  }
+  if (nodeStyles) {
+    polygon.attr("style", nodeStyles);
+  }
+  updateNodeBounds(node, polygon);
+  node.intersect = function(point2) {
+    log.debug(
+      "APA12 Intersect called SPLIT\npoint:",
+      point2,
+      "\nnode:\n",
+      node,
+      "\nres:",
+      intersect_default.polygon(node, points, point2)
+    );
+    return intersect_default.polygon(node, points, point2);
+  };
+  return shapeSvg;
+}, "question");
+
+// src/rendering-util/rendering-elements/shapes/hexagon.ts
+import rough17 from "roughjs";
+var createHexagonPathD = /* @__PURE__ */ __name((x, y, width, height, m) => {
+  return [
+    `M${x + m},${y}`,
+    `L${x + width - m},${y}`,
+    `L${x + width},${y - height / 2}`,
+    `L${x + width - m},${y - height}`,
+    `L${x + m},${y - height}`,
+    `L${x},${y - height / 2}`,
+    "Z"
+  ].join(" ");
+}, "createHexagonPathD");
+var hexagon = /* @__PURE__ */ __name(async (parent, node) => {
+  const { labelStyles, nodeStyles } = styles2String(node);
+  node.labelStyle = labelStyles;
+  const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
+  const f = 4;
+  const h = bbox.height + node.padding;
+  const m = h / f;
+  const w = bbox.width + 2 * m + node.padding;
+  const points = [
+    { x: m, y: 0 },
+    { x: w - m, y: 0 },
+    { x: w, y: -h / 2 },
+    { x: w - m, y: -h },
+    { x: m, y: -h },
+    { x: 0, y: -h / 2 }
+  ];
+  let polygon;
+  const { cssStyles } = node;
+  if (node.look === "handDrawn") {
+    const rc = rough17.svg(shapeSvg);
+    const options = userNodeOverrides(node, {});
+    const pathData = createHexagonPathD(0, 0, w, h, m);
+    const roughNode = rc.path(pathData, options);
+    polygon = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-w / 2}, ${h / 2})`);
+    if (cssStyles) {
+      polygon.attr("style", cssStyles);
+    }
+  } else {
+    polygon = insertPolygonShape(shapeSvg, w, h, points);
+  }
+  if (nodeStyles) {
+    polygon.attr("style", nodeStyles);
+  }
+  node.width = w;
+  node.height = h;
+  updateNodeBounds(node, polygon);
+  node.intersect = function(point2) {
+    return intersect_default.polygon(node, points, point2);
+  };
+  return shapeSvg;
+}, "hexagon");
+
+// src/rendering-util/rendering-elements/shapes/leanRight.ts
+import rough18 from "roughjs";
+var createLeanRightPathD = /* @__PURE__ */ __name((x, y, width, height) => {
+  return [
+    `M${x - 2 * height / 6},${y}`,
+    `L${x + width - height / 6},${y}`,
+    `L${x + width + 2 * height / 6},${y - height}`,
+    `L${x + height / 6},${y - height}`,
+    "Z"
+  ].join(" ");
+}, "createLeanRightPathD");
+var lean_right = /* @__PURE__ */ __name(async (parent, node) => {
+  const { labelStyles, nodeStyles } = styles2String(node);
+  node.labelStyle = labelStyles;
+  const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
+  const w = bbox.width + node.padding;
+  const h = bbox.height + node.padding;
+  const points = [
+    { x: -2 * h / 6, y: 0 },
+    { x: w - h / 6, y: 0 },
+    { x: w + 2 * h / 6, y: -h },
+    { x: h / 6, y: -h }
+  ];
+  let polygon;
+  const { cssStyles } = node;
+  if (node.look === "handDrawn") {
+    const rc = rough18.svg(shapeSvg);
+    const options = userNodeOverrides(node, {});
+    const pathData = createLeanRightPathD(0, 0, w, h);
+    const roughNode = rc.path(pathData, options);
+    polygon = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-w / 2}, ${h / 2})`);
+    if (cssStyles) {
+      polygon.attr("style", cssStyles);
+    }
+  } else {
+    polygon = insertPolygonShape(shapeSvg, w, h, points);
+  }
+  if (nodeStyles) {
+    polygon.attr("style", nodeStyles);
+  }
+  node.width = w;
+  node.height = h;
+  updateNodeBounds(node, polygon);
+  node.intersect = function(point2) {
+    return intersect_default.polygon(node, points, point2);
+  };
+  return shapeSvg;
+}, "lean_right");
+
+// src/rendering-util/rendering-elements/shapes/leanLeft.ts
+import rough19 from "roughjs";
+var createLeanLeftPathD = /* @__PURE__ */ __name((x, y, width, height) => {
+  return [
+    `M${x + 2 * height / 6},${y}`,
+    `L${x + width + height / 6},${y}`,
+    `L${x + width - 2 * height / 6},${y - height}`,
+    `L${x - height / 6},${y - height}`,
+    "Z"
+  ].join(" ");
+}, "createLeanLeftPathD");
+var lean_left = /* @__PURE__ */ __name(async (parent, node) => {
+  const { labelStyles, nodeStyles } = styles2String(node);
+  node.labelStyle = labelStyles;
+  const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
+  const w = bbox.width + node.padding;
+  const h = bbox.height + node.padding;
+  const points = [
+    { x: 2 * h / 6, y: 0 },
+    { x: w + h / 6, y: 0 },
+    { x: w - 2 * h / 6, y: -h },
+    { x: -h / 6, y: -h }
+  ];
+  let polygon;
+  const { cssStyles } = node;
+  if (node.look === "handDrawn") {
+    const rc = rough19.svg(shapeSvg);
+    const options = userNodeOverrides(node, {});
+    const pathData = createLeanLeftPathD(0, 0, w, h);
+    const roughNode = rc.path(pathData, options);
+    polygon = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-w / 2}, ${h / 2})`);
+    if (cssStyles) {
+      polygon.attr("style", cssStyles);
+    }
+  } else {
+    polygon = insertPolygonShape(shapeSvg, w, h, points);
+  }
+  if (nodeStyles) {
+    polygon.attr("style", nodeStyles);
+  }
+  node.width = w;
+  node.height = h;
+  updateNodeBounds(node, polygon);
+  node.intersect = function(point2) {
+    return intersect_default.polygon(node, points, point2);
+  };
+  return shapeSvg;
+}, "lean_left");
+
+// src/rendering-util/rendering-elements/shapes/trapezoid.ts
+import rough20 from "roughjs";
+var createTrapezoidPathD = /* @__PURE__ */ __name((x, y, width, height) => {
+  return [
+    `M${x - 2 * height / 6},${y}`,
+    `L${x + width + 2 * height / 6},${y}`,
+    `L${x + width - height / 6},${y - height}`,
+    `L${x + height / 6},${y - height}`,
+    "Z"
+  ].join(" ");
+}, "createTrapezoidPathD");
+var trapezoid = /* @__PURE__ */ __name(async (parent, node) => {
+  const { labelStyles, nodeStyles } = styles2String(node);
+  node.labelStyle = labelStyles;
+  const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
+  const w = bbox.width + node.padding;
+  const h = bbox.height + node.padding;
+  const points = [
+    { x: -2 * h / 6, y: 0 },
+    { x: w + 2 * h / 6, y: 0 },
+    { x: w - h / 6, y: -h },
+    { x: h / 6, y: -h }
+  ];
+  let polygon;
+  const { cssStyles } = node;
+  if (node.look === "handDrawn") {
+    const rc = rough20.svg(shapeSvg);
+    const options = userNodeOverrides(node, {});
+    const pathData = createTrapezoidPathD(0, 0, w, h);
+    const roughNode = rc.path(pathData, options);
+    polygon = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-w / 2}, ${h / 2})`);
+    if (cssStyles) {
+      polygon.attr("style", cssStyles);
+    }
+  } else {
+    polygon = insertPolygonShape(shapeSvg, w, h, points);
+  }
+  if (nodeStyles) {
+    polygon.attr("style", nodeStyles);
+  }
+  node.width = w;
+  node.height = h;
+  updateNodeBounds(node, polygon);
+  node.intersect = function(point2) {
+    return intersect_default.polygon(node, points, point2);
+  };
+  return shapeSvg;
+}, "trapezoid");
+
+// src/rendering-util/rendering-elements/shapes/invertedTrapezoid.ts
+import rough21 from "roughjs";
+var createInvertedTrapezoidPathD = /* @__PURE__ */ __name((x, y, width, height) => {
+  return [
+    `M${x + height / 6},${y}`,
+    `L${x + width - height / 6},${y}`,
+    `L${x + width + 2 * height / 6},${y - height}`,
+    `L${x - 2 * height / 6},${y - height}`,
+    "Z"
+  ].join(" ");
+}, "createInvertedTrapezoidPathD");
+var inv_trapezoid = /* @__PURE__ */ __name(async (parent, node) => {
+  const { labelStyles, nodeStyles } = styles2String(node);
+  node.labelStyle = labelStyles;
+  const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
+  const w = bbox.width + node.padding;
+  const h = bbox.height + node.padding;
+  const points = [
+    { x: h / 6, y: 0 },
+    { x: w - h / 6, y: 0 },
+    { x: w + 2 * h / 6, y: -h },
+    { x: -2 * h / 6, y: -h }
+  ];
+  let polygon;
+  const { cssStyles } = node;
+  if (node.look === "handDrawn") {
+    const rc = rough21.svg(shapeSvg);
+    const options = userNodeOverrides(node, {});
+    const pathData = createInvertedTrapezoidPathD(0, 0, w, h);
+    const roughNode = rc.path(pathData, options);
+    polygon = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-w / 2}, ${h / 2})`);
+    if (cssStyles) {
+      polygon.attr("style", cssStyles);
+    }
+  } else {
+    polygon = insertPolygonShape(shapeSvg, w, h, points);
+  }
+  if (nodeStyles) {
+    polygon.attr("style", nodeStyles);
+  }
+  node.width = w;
+  node.height = h;
+  updateNodeBounds(node, polygon);
+  node.intersect = function(point2) {
+    return intersect_default.polygon(node, points, point2);
+  };
+  return shapeSvg;
+}, "inv_trapezoid");
+
+// src/rendering-util/rendering-elements/shapes/labelRect.ts
+var labelRect = /* @__PURE__ */ __name(async (parent, node) => {
+  const { shapeSvg } = await labelHelper(parent, node, "label");
+  const rect2 = shapeSvg.insert("rect", ":first-child");
+  const totalWidth = 0.1;
+  const totalHeight = 0.1;
+  rect2.attr("width", totalWidth).attr("height", totalHeight);
+  shapeSvg.attr("class", "label edgeLabel");
+  updateNodeBounds(node, rect2);
+  node.intersect = function(point2) {
+    return intersect_default.rect(node, point2);
+  };
+  return shapeSvg;
+}, "labelRect");
+
+// src/rendering-util/rendering-elements/nodes.js
+var shapes2 = {
+  state,
+  stateStart,
+  stateEnd,
+  fork: forkJoin,
+  join: forkJoin,
+  choice,
+  note,
+  roundedRect,
+  rectWithTitle,
+  squareRect: squareRect2,
+  stadium,
+  subroutine,
+  cylinder,
+  circle: circle2,
+  doublecircle,
+  odd: rect_left_inv_arrow,
+  diamond: question,
+  hexagon,
+  lean_right,
+  lean_left,
+  trapezoid,
+  inv_trapezoid,
+  labelRect
+};
+var nodeElems = /* @__PURE__ */ new Map();
+var insertNode = /* @__PURE__ */ __name(async (elem, node, dir) => {
+  let newEl;
+  let el;
+  if (node.shape === "rect") {
+    if (node.rx && node.ry) {
+      node.shape = "roundedRect";
+    } else {
+      node.shape = "squareRect";
+    }
+  }
+  if (node.link) {
+    let target;
+    if (getConfig().securityLevel === "sandbox") {
+      target = "_top";
+    } else if (node.linkTarget) {
+      target = node.linkTarget || "_blank";
+    }
+    newEl = elem.insert("svg:a").attr("xlink:href", node.link).attr("target", target);
+    el = await shapes2[node.shape](newEl, node, dir);
+  } else {
+    el = await shapes2[node.shape](elem, node, dir);
+    newEl = el;
+  }
+  if (node.tooltip) {
+    el.attr("title", node.tooltip);
+  }
+  nodeElems.set(node.id, newEl);
+  if (node.haveCallback) {
+    nodeElems.get(node.id).attr("class", nodeElems.get(node.id).attr("class") + " clickable");
+  }
+  return newEl;
+}, "insertNode");
+var setNodeElem = /* @__PURE__ */ __name((elem, node) => {
+  nodeElems.set(node.id, elem);
+}, "setNodeElem");
+var clear3 = /* @__PURE__ */ __name(() => {
+  nodeElems.clear();
+}, "clear");
+var positionNode = /* @__PURE__ */ __name((node) => {
+  const el = nodeElems.get(node.id);
+  log.trace(
+    "Transforming node",
+    node.diff,
+    node,
+    "translate(" + (node.x - node.width / 2 - 5) + ", " + node.width / 2 + ")"
+  );
+  const padding = 8;
+  const diff = node.diff || 0;
+  if (node.clusterNode) {
+    el.attr(
+      "transform",
+      "translate(" + (node.x + diff - node.width / 2) + ", " + (node.y - node.height / 2 - padding) + ")"
+    );
+  } else {
+    el.attr("transform", "translate(" + node.x + ", " + node.y + ")");
+  }
+  return diff;
+}, "positionNode");
+
+export {
+  insertCluster,
+  clear,
+  clear2,
+  insertEdgeLabel,
+  positionEdgeLabel,
+  insertEdge,
+  markers_default,
+  labelHelper,
+  updateNodeBounds,
+  insertNode,
+  setNodeElem,
+  clear3,
+  positionNode
+};

+ 43 - 26
nicegui/elements/lib/mermaid/svgDrawCommon-43c67fcf.js → nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-AIUMCIBP.mjs

@@ -1,6 +1,11 @@
+import {
+  __name,
+  lineBreakRegex
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/diagrams/common/svgDrawCommon.ts
 import { sanitizeUrl } from "@braintree/sanitize-url";
-import { H as lineBreakRegex } from "./mermaid-485fd1a4.js";
-const drawRect = (element, rectData) => {
+var drawRect = /* @__PURE__ */ __name((element, rectData) => {
   const rectElement = element.append("rect");
   rectElement.attr("x", rectData.x);
   rectElement.attr("y", rectData.y);
@@ -8,17 +13,26 @@ const drawRect = (element, rectData) => {
   rectElement.attr("stroke", rectData.stroke);
   rectElement.attr("width", rectData.width);
   rectElement.attr("height", rectData.height);
-  rectData.rx !== void 0 && rectElement.attr("rx", rectData.rx);
-  rectData.ry !== void 0 && rectElement.attr("ry", rectData.ry);
+  if (rectData.name) {
+    rectElement.attr("name", rectData.name);
+  }
+  if (rectData.rx) {
+    rectElement.attr("rx", rectData.rx);
+  }
+  if (rectData.ry) {
+    rectElement.attr("ry", rectData.ry);
+  }
   if (rectData.attrs !== void 0) {
     for (const attrKey in rectData.attrs) {
       rectElement.attr(attrKey, rectData.attrs[attrKey]);
     }
   }
-  rectData.class !== void 0 && rectElement.attr("class", rectData.class);
+  if (rectData.class) {
+    rectElement.attr("class", rectData.class);
+  }
   return rectElement;
-};
-const drawBackgroundRect = (element, bounds) => {
+}, "drawRect");
+var drawBackgroundRect = /* @__PURE__ */ __name((element, bounds) => {
   const rectData = {
     x: bounds.startx,
     y: bounds.starty,
@@ -30,35 +44,37 @@ const drawBackgroundRect = (element, bounds) => {
   };
   const rectElement = drawRect(element, rectData);
   rectElement.lower();
-};
-const drawText = (element, textData) => {
+}, "drawBackgroundRect");
+var drawText = /* @__PURE__ */ __name((element, textData) => {
   const nText = textData.text.replace(lineBreakRegex, " ");
   const textElem = element.append("text");
   textElem.attr("x", textData.x);
   textElem.attr("y", textData.y);
   textElem.attr("class", "legend");
   textElem.style("text-anchor", textData.anchor);
-  textData.class !== void 0 && textElem.attr("class", textData.class);
+  if (textData.class) {
+    textElem.attr("class", textData.class);
+  }
   const tspan = textElem.append("tspan");
   tspan.attr("x", textData.x + textData.textMargin * 2);
   tspan.text(nText);
   return textElem;
-};
-const drawImage = (elem, x, y, link) => {
+}, "drawText");
+var drawImage = /* @__PURE__ */ __name((elem, x, y, link) => {
   const imageElement = elem.append("image");
   imageElement.attr("x", x);
   imageElement.attr("y", y);
   const sanitizedLink = sanitizeUrl(link);
   imageElement.attr("xlink:href", sanitizedLink);
-};
-const drawEmbeddedImage = (element, x, y, link) => {
+}, "drawImage");
+var drawEmbeddedImage = /* @__PURE__ */ __name((element, x, y, link) => {
   const imageElement = element.append("use");
   imageElement.attr("x", x);
   imageElement.attr("y", y);
   const sanitizedLink = sanitizeUrl(link);
   imageElement.attr("xlink:href", `#${sanitizedLink}`);
-};
-const getNoteRect = () => {
+}, "drawEmbeddedImage");
+var getNoteRect = /* @__PURE__ */ __name(() => {
   const noteRectData = {
     x: 0,
     y: 0,
@@ -71,8 +87,8 @@ const getNoteRect = () => {
     ry: 0
   };
   return noteRectData;
-};
-const getTextObj = () => {
+}, "getNoteRect");
+var getTextObj = /* @__PURE__ */ __name(() => {
   const testObject = {
     x: 0,
     y: 0,
@@ -86,13 +102,14 @@ const getTextObj = () => {
     tspan: true
   };
   return testObject;
-};
+}, "getTextObj");
+
 export {
-  drawBackgroundRect as a,
-  drawEmbeddedImage as b,
-  drawImage as c,
-  drawRect as d,
-  getTextObj as e,
-  drawText as f,
-  getNoteRect as g
+  drawRect,
+  drawBackgroundRect,
+  drawText,
+  drawImage,
+  drawEmbeddedImage,
+  getNoteRect,
+  getTextObj
 };

+ 22 - 0
nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-DLZUUSFL.mjs

@@ -0,0 +1,22 @@
+import {
+  __name,
+  getConfig2 as getConfig
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/rendering-util/selectSvgElement.ts
+import { select } from "d3";
+var selectSvgElement = /* @__PURE__ */ __name((id) => {
+  const { securityLevel } = getConfig();
+  let root = select("body");
+  if (securityLevel === "sandbox") {
+    const sandboxElement = select(`#i${id}`);
+    const doc = sandboxElement.node()?.contentDocument ?? document;
+    root = select(doc.body);
+  }
+  const svg = root.select(`#${id}`);
+  return svg;
+}, "selectSvgElement");
+
+export {
+  selectSvgElement
+};

+ 24 - 0
nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-FBCX6ULS.mjs

@@ -0,0 +1,24 @@
+import {
+  __name
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/utils/imperativeState.ts
+var ImperativeState = class {
+  /**
+   * @param init - Function that creates the default state.
+   */
+  constructor(init) {
+    this.init = init;
+    this.records = this.init();
+  }
+  static {
+    __name(this, "ImperativeState");
+  }
+  reset() {
+    this.records = this.init();
+  }
+};
+
+export {
+  ImperativeState
+};

+ 44 - 0
nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-FUIDI54P.mjs

@@ -0,0 +1,44 @@
+import {
+  __name,
+  configureSvgSize,
+  log
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/rendering-util/insertElementsForSize.js
+import { select } from "d3";
+var getDiagramElement = /* @__PURE__ */ __name((id, securityLevel) => {
+  let sandboxElement;
+  if (securityLevel === "sandbox") {
+    sandboxElement = select("#i" + id);
+  }
+  const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
+  const svg = root.select(`[id="${id}"]`);
+  return svg;
+}, "getDiagramElement");
+
+// src/rendering-util/setupViewPortForSVG.ts
+var setupViewPortForSVG = /* @__PURE__ */ __name((svg, padding, cssDiagram, useMaxWidth) => {
+  svg.attr("class", cssDiagram);
+  const { width, height, x, y } = calculateDimensionsWithPadding(svg, padding);
+  configureSvgSize(svg, height, width, useMaxWidth);
+  const viewBox = createViewBox(x, y, width, height, padding);
+  svg.attr("viewBox", viewBox);
+  log.debug(`viewBox configured: ${viewBox} with padding: ${padding}`);
+}, "setupViewPortForSVG");
+var calculateDimensionsWithPadding = /* @__PURE__ */ __name((svg, padding) => {
+  const bounds = svg.node()?.getBBox() || { width: 0, height: 0, x: 0, y: 0 };
+  return {
+    width: bounds.width + padding * 2,
+    height: bounds.height + padding * 2,
+    x: bounds.x,
+    y: bounds.y
+  };
+}, "calculateDimensionsWithPadding");
+var createViewBox = /* @__PURE__ */ __name((x, y, width, height, padding) => {
+  return `${x - padding} ${y - padding} ${width} ${height}`;
+}, "createViewBox");
+
+export {
+  getDiagramElement,
+  setupViewPortForSVG
+};

File diff suppressed because it is too large
+ 97 - 67
nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-IBIA4ERB.mjs


+ 21 - 0
nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-JJENOPKO.mjs

@@ -0,0 +1,21 @@
+import {
+  __name
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/diagrams/common/populateCommonDb.ts
+function populateCommonDb(ast, db) {
+  if (ast.accDescr) {
+    db.setAccDescription?.(ast.accDescr);
+  }
+  if (ast.accTitle) {
+    db.setAccTitle?.(ast.accTitle);
+  }
+  if (ast.title) {
+    db.setDiagramTitle?.(ast.title);
+  }
+}
+__name(populateCommonDb, "populateCommonDb");
+
+export {
+  populateCommonDb
+};

+ 2936 - 0
nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-O2AGWWWV.mjs

@@ -0,0 +1,2936 @@
+var __defProp = Object.defineProperty;
+var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
+var __export = (target, all) => {
+  for (var name in all)
+    __defProp(target, name, { get: all[name], enumerable: true });
+};
+
+// src/logger.ts
+import dayjs from "dayjs";
+var LEVELS = {
+  trace: 0,
+  debug: 1,
+  info: 2,
+  warn: 3,
+  error: 4,
+  fatal: 5
+};
+var log = {
+  trace: /* @__PURE__ */ __name((..._args) => {
+  }, "trace"),
+  debug: /* @__PURE__ */ __name((..._args) => {
+  }, "debug"),
+  info: /* @__PURE__ */ __name((..._args) => {
+  }, "info"),
+  warn: /* @__PURE__ */ __name((..._args) => {
+  }, "warn"),
+  error: /* @__PURE__ */ __name((..._args) => {
+  }, "error"),
+  fatal: /* @__PURE__ */ __name((..._args) => {
+  }, "fatal")
+};
+var setLogLevel = /* @__PURE__ */ __name(function(level = "fatal") {
+  let numericLevel = LEVELS.fatal;
+  if (typeof level === "string") {
+    if (level.toLowerCase() in LEVELS) {
+      numericLevel = LEVELS[level];
+    }
+  } else if (typeof level === "number") {
+    numericLevel = level;
+  }
+  log.trace = () => {
+  };
+  log.debug = () => {
+  };
+  log.info = () => {
+  };
+  log.warn = () => {
+  };
+  log.error = () => {
+  };
+  log.fatal = () => {
+  };
+  if (numericLevel <= LEVELS.fatal) {
+    log.fatal = console.error ? console.error.bind(console, format("FATAL"), "color: orange") : console.log.bind(console, "\x1B[35m", format("FATAL"));
+  }
+  if (numericLevel <= LEVELS.error) {
+    log.error = console.error ? console.error.bind(console, format("ERROR"), "color: orange") : console.log.bind(console, "\x1B[31m", format("ERROR"));
+  }
+  if (numericLevel <= LEVELS.warn) {
+    log.warn = console.warn ? console.warn.bind(console, format("WARN"), "color: orange") : console.log.bind(console, `\x1B[33m`, format("WARN"));
+  }
+  if (numericLevel <= LEVELS.info) {
+    log.info = console.info ? console.info.bind(console, format("INFO"), "color: lightblue") : console.log.bind(console, "\x1B[34m", format("INFO"));
+  }
+  if (numericLevel <= LEVELS.debug) {
+    log.debug = console.debug ? console.debug.bind(console, format("DEBUG"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", format("DEBUG"));
+  }
+  if (numericLevel <= LEVELS.trace) {
+    log.trace = console.debug ? console.debug.bind(console, format("TRACE"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", format("TRACE"));
+  }
+}, "setLogLevel");
+var format = /* @__PURE__ */ __name((level) => {
+  const time = dayjs().format("ss.SSS");
+  return `%c${time} : ${level} : `;
+}, "format");
+
+// src/diagram-api/regexes.ts
+var frontMatterRegex = /^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s;
+var directiveRegex = /%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi;
+var anyCommentRegex = /\s*%%.*\n/gm;
+
+// src/errors.ts
+var UnknownDiagramError = class extends Error {
+  static {
+    __name(this, "UnknownDiagramError");
+  }
+  constructor(message) {
+    super(message);
+    this.name = "UnknownDiagramError";
+  }
+};
+
+// src/diagram-api/detectType.ts
+var detectors = {};
+var detectType = /* @__PURE__ */ __name(function(text, config2) {
+  text = text.replace(frontMatterRegex, "").replace(directiveRegex, "").replace(anyCommentRegex, "\n");
+  for (const [key, { detector }] of Object.entries(detectors)) {
+    const diagram = detector(text, config2);
+    if (diagram) {
+      return key;
+    }
+  }
+  throw new UnknownDiagramError(
+    `No diagram type detected matching given configuration for text: ${text}`
+  );
+}, "detectType");
+var registerLazyLoadedDiagrams = /* @__PURE__ */ __name((...diagrams2) => {
+  for (const { id, detector, loader } of diagrams2) {
+    addDetector(id, detector, loader);
+  }
+}, "registerLazyLoadedDiagrams");
+var addDetector = /* @__PURE__ */ __name((key, detector, loader) => {
+  if (detectors[key]) {
+    log.warn(`Detector with key ${key} already exists. Overwriting.`);
+  }
+  detectors[key] = { detector, loader };
+  log.debug(`Detector with key ${key} added${loader ? " with loader" : ""}`);
+}, "addDetector");
+var getDiagramLoader = /* @__PURE__ */ __name((key) => {
+  return detectors[key].loader;
+}, "getDiagramLoader");
+
+// src/assignWithDepth.ts
+var assignWithDepth = /* @__PURE__ */ __name((dst, src, { depth = 2, clobber = false } = {}) => {
+  const config2 = { depth, clobber };
+  if (Array.isArray(src) && !Array.isArray(dst)) {
+    src.forEach((s) => assignWithDepth(dst, s, config2));
+    return dst;
+  } else if (Array.isArray(src) && Array.isArray(dst)) {
+    src.forEach((s) => {
+      if (!dst.includes(s)) {
+        dst.push(s);
+      }
+    });
+    return dst;
+  }
+  if (dst === void 0 || depth <= 0) {
+    if (dst !== void 0 && dst !== null && typeof dst === "object" && typeof src === "object") {
+      return Object.assign(dst, src);
+    } else {
+      return src;
+    }
+  }
+  if (src !== void 0 && typeof dst === "object" && typeof src === "object") {
+    Object.keys(src).forEach((key) => {
+      if (typeof src[key] === "object" && (dst[key] === void 0 || typeof dst[key] === "object")) {
+        if (dst[key] === void 0) {
+          dst[key] = Array.isArray(src[key]) ? [] : {};
+        }
+        dst[key] = assignWithDepth(dst[key], src[key], { depth: depth - 1, clobber });
+      } else if (clobber || typeof dst[key] !== "object" && typeof src[key] !== "object") {
+        dst[key] = src[key];
+      }
+    });
+  }
+  return dst;
+}, "assignWithDepth");
+var assignWithDepth_default = assignWithDepth;
+
+// src/themes/theme-base.js
+import { adjust as adjust2, darken, invert, isDark, lighten } from "khroma";
+
+// src/themes/erDiagram-oldHardcodedValues.ts
+var oldAttributeBackgroundColorOdd = "#ffffff";
+var oldAttributeBackgroundColorEven = "#f2f2f2";
+
+// src/themes/theme-helpers.js
+import { adjust } from "khroma";
+var mkBorder = /* @__PURE__ */ __name((col, darkMode) => darkMode ? adjust(col, { s: -40, l: 10 }) : adjust(col, { s: -40, l: -10 }), "mkBorder");
+
+// src/themes/theme-base.js
+var Theme = class {
+  static {
+    __name(this, "Theme");
+  }
+  constructor() {
+    this.background = "#f4f4f4";
+    this.primaryColor = "#fff4dd";
+    this.noteBkgColor = "#fff5ad";
+    this.noteTextColor = "#333";
+    this.THEME_COLOR_LIMIT = 12;
+    this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
+    this.fontSize = "16px";
+  }
+  updateColors() {
+    this.primaryTextColor = this.primaryTextColor || (this.darkMode ? "#eee" : "#333");
+    this.secondaryColor = this.secondaryColor || adjust2(this.primaryColor, { h: -120 });
+    this.tertiaryColor = this.tertiaryColor || adjust2(this.primaryColor, { h: 180, l: 5 });
+    this.primaryBorderColor = this.primaryBorderColor || mkBorder(this.primaryColor, this.darkMode);
+    this.secondaryBorderColor = this.secondaryBorderColor || mkBorder(this.secondaryColor, this.darkMode);
+    this.tertiaryBorderColor = this.tertiaryBorderColor || mkBorder(this.tertiaryColor, this.darkMode);
+    this.noteBorderColor = this.noteBorderColor || mkBorder(this.noteBkgColor, this.darkMode);
+    this.noteBkgColor = this.noteBkgColor || "#fff5ad";
+    this.noteTextColor = this.noteTextColor || "#333";
+    this.secondaryTextColor = this.secondaryTextColor || invert(this.secondaryColor);
+    this.tertiaryTextColor = this.tertiaryTextColor || invert(this.tertiaryColor);
+    this.lineColor = this.lineColor || invert(this.background);
+    this.arrowheadColor = this.arrowheadColor || invert(this.background);
+    this.textColor = this.textColor || this.primaryTextColor;
+    this.border2 = this.border2 || this.tertiaryBorderColor;
+    this.nodeBkg = this.nodeBkg || this.primaryColor;
+    this.mainBkg = this.mainBkg || this.primaryColor;
+    this.nodeBorder = this.nodeBorder || this.primaryBorderColor;
+    this.clusterBkg = this.clusterBkg || this.tertiaryColor;
+    this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor;
+    this.defaultLinkColor = this.defaultLinkColor || this.lineColor;
+    this.titleColor = this.titleColor || this.tertiaryTextColor;
+    this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? darken(this.secondaryColor, 30) : this.secondaryColor);
+    this.nodeTextColor = this.nodeTextColor || this.primaryTextColor;
+    this.actorBorder = this.actorBorder || this.primaryBorderColor;
+    this.actorBkg = this.actorBkg || this.mainBkg;
+    this.actorTextColor = this.actorTextColor || this.primaryTextColor;
+    this.actorLineColor = this.actorLineColor || this.actorBorder;
+    this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg;
+    this.signalColor = this.signalColor || this.textColor;
+    this.signalTextColor = this.signalTextColor || this.textColor;
+    this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder;
+    this.labelTextColor = this.labelTextColor || this.actorTextColor;
+    this.loopTextColor = this.loopTextColor || this.actorTextColor;
+    this.activationBorderColor = this.activationBorderColor || darken(this.secondaryColor, 10);
+    this.activationBkgColor = this.activationBkgColor || this.secondaryColor;
+    this.sequenceNumberColor = this.sequenceNumberColor || invert(this.lineColor);
+    this.sectionBkgColor = this.sectionBkgColor || this.tertiaryColor;
+    this.altSectionBkgColor = this.altSectionBkgColor || "white";
+    this.sectionBkgColor = this.sectionBkgColor || this.secondaryColor;
+    this.sectionBkgColor2 = this.sectionBkgColor2 || this.primaryColor;
+    this.excludeBkgColor = this.excludeBkgColor || "#eeeeee";
+    this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor;
+    this.taskBkgColor = this.taskBkgColor || this.primaryColor;
+    this.activeTaskBorderColor = this.activeTaskBorderColor || this.primaryColor;
+    this.activeTaskBkgColor = this.activeTaskBkgColor || lighten(this.primaryColor, 23);
+    this.gridColor = this.gridColor || "lightgrey";
+    this.doneTaskBkgColor = this.doneTaskBkgColor || "lightgrey";
+    this.doneTaskBorderColor = this.doneTaskBorderColor || "grey";
+    this.critBorderColor = this.critBorderColor || "#ff8888";
+    this.critBkgColor = this.critBkgColor || "red";
+    this.todayLineColor = this.todayLineColor || "red";
+    this.taskTextColor = this.taskTextColor || this.textColor;
+    this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor;
+    this.taskTextLightColor = this.taskTextLightColor || this.textColor;
+    this.taskTextColor = this.taskTextColor || this.primaryTextColor;
+    this.taskTextDarkColor = this.taskTextDarkColor || this.textColor;
+    this.taskTextClickableColor = this.taskTextClickableColor || "#003163";
+    this.personBorder = this.personBorder || this.primaryBorderColor;
+    this.personBkg = this.personBkg || this.mainBkg;
+    this.transitionColor = this.transitionColor || this.lineColor;
+    this.transitionLabelColor = this.transitionLabelColor || this.textColor;
+    this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
+    this.stateBkg = this.stateBkg || this.mainBkg;
+    this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
+    this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
+    this.altBackground = this.altBackground || this.tertiaryColor;
+    this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
+    this.compositeBorder = this.compositeBorder || this.nodeBorder;
+    this.innerEndBackground = this.nodeBorder;
+    this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
+    this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
+    this.transitionColor = this.transitionColor || this.lineColor;
+    this.specialStateColor = this.lineColor;
+    this.cScale0 = this.cScale0 || this.primaryColor;
+    this.cScale1 = this.cScale1 || this.secondaryColor;
+    this.cScale2 = this.cScale2 || this.tertiaryColor;
+    this.cScale3 = this.cScale3 || adjust2(this.primaryColor, { h: 30 });
+    this.cScale4 = this.cScale4 || adjust2(this.primaryColor, { h: 60 });
+    this.cScale5 = this.cScale5 || adjust2(this.primaryColor, { h: 90 });
+    this.cScale6 = this.cScale6 || adjust2(this.primaryColor, { h: 120 });
+    this.cScale7 = this.cScale7 || adjust2(this.primaryColor, { h: 150 });
+    this.cScale8 = this.cScale8 || adjust2(this.primaryColor, { h: 210, l: 150 });
+    this.cScale9 = this.cScale9 || adjust2(this.primaryColor, { h: 270 });
+    this.cScale10 = this.cScale10 || adjust2(this.primaryColor, { h: 300 });
+    this.cScale11 = this.cScale11 || adjust2(this.primaryColor, { h: 330 });
+    if (this.darkMode) {
+      for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
+        this["cScale" + i] = darken(this["cScale" + i], 75);
+      }
+    } else {
+      for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
+        this["cScale" + i] = darken(this["cScale" + i], 25);
+      }
+    }
+    for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
+      this["cScaleInv" + i] = this["cScaleInv" + i] || invert(this["cScale" + i]);
+    }
+    for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
+      if (this.darkMode) {
+        this["cScalePeer" + i] = this["cScalePeer" + i] || lighten(this["cScale" + i], 10);
+      } else {
+        this["cScalePeer" + i] = this["cScalePeer" + i] || darken(this["cScale" + i], 10);
+      }
+    }
+    this.scaleLabelColor = this.scaleLabelColor || this.labelTextColor;
+    for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
+      this["cScaleLabel" + i] = this["cScaleLabel" + i] || this.scaleLabelColor;
+    }
+    const multiplier = this.darkMode ? -4 : -1;
+    for (let i = 0; i < 5; i++) {
+      this["surface" + i] = this["surface" + i] || adjust2(this.mainBkg, { h: 180, s: -15, l: multiplier * (5 + i * 3) });
+      this["surfacePeer" + i] = this["surfacePeer" + i] || adjust2(this.mainBkg, { h: 180, s: -15, l: multiplier * (8 + i * 3) });
+    }
+    this.classText = this.classText || this.textColor;
+    this.fillType0 = this.fillType0 || this.primaryColor;
+    this.fillType1 = this.fillType1 || this.secondaryColor;
+    this.fillType2 = this.fillType2 || adjust2(this.primaryColor, { h: 64 });
+    this.fillType3 = this.fillType3 || adjust2(this.secondaryColor, { h: 64 });
+    this.fillType4 = this.fillType4 || adjust2(this.primaryColor, { h: -64 });
+    this.fillType5 = this.fillType5 || adjust2(this.secondaryColor, { h: -64 });
+    this.fillType6 = this.fillType6 || adjust2(this.primaryColor, { h: 128 });
+    this.fillType7 = this.fillType7 || adjust2(this.secondaryColor, { h: 128 });
+    this.pie1 = this.pie1 || this.primaryColor;
+    this.pie2 = this.pie2 || this.secondaryColor;
+    this.pie3 = this.pie3 || this.tertiaryColor;
+    this.pie4 = this.pie4 || adjust2(this.primaryColor, { l: -10 });
+    this.pie5 = this.pie5 || adjust2(this.secondaryColor, { l: -10 });
+    this.pie6 = this.pie6 || adjust2(this.tertiaryColor, { l: -10 });
+    this.pie7 = this.pie7 || adjust2(this.primaryColor, { h: 60, l: -10 });
+    this.pie8 = this.pie8 || adjust2(this.primaryColor, { h: -60, l: -10 });
+    this.pie9 = this.pie9 || adjust2(this.primaryColor, { h: 120, l: 0 });
+    this.pie10 = this.pie10 || adjust2(this.primaryColor, { h: 60, l: -20 });
+    this.pie11 = this.pie11 || adjust2(this.primaryColor, { h: -60, l: -20 });
+    this.pie12 = this.pie12 || adjust2(this.primaryColor, { h: 120, l: -10 });
+    this.pieTitleTextSize = this.pieTitleTextSize || "25px";
+    this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
+    this.pieSectionTextSize = this.pieSectionTextSize || "17px";
+    this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
+    this.pieLegendTextSize = this.pieLegendTextSize || "17px";
+    this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
+    this.pieStrokeColor = this.pieStrokeColor || "black";
+    this.pieStrokeWidth = this.pieStrokeWidth || "2px";
+    this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
+    this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
+    this.pieOpacity = this.pieOpacity || "0.7";
+    this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
+    this.quadrant2Fill = this.quadrant2Fill || adjust2(this.primaryColor, { r: 5, g: 5, b: 5 });
+    this.quadrant3Fill = this.quadrant3Fill || adjust2(this.primaryColor, { r: 10, g: 10, b: 10 });
+    this.quadrant4Fill = this.quadrant4Fill || adjust2(this.primaryColor, { r: 15, g: 15, b: 15 });
+    this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
+    this.quadrant2TextFill = this.quadrant2TextFill || adjust2(this.primaryTextColor, { r: -5, g: -5, b: -5 });
+    this.quadrant3TextFill = this.quadrant3TextFill || adjust2(this.primaryTextColor, { r: -10, g: -10, b: -10 });
+    this.quadrant4TextFill = this.quadrant4TextFill || adjust2(this.primaryTextColor, { r: -15, g: -15, b: -15 });
+    this.quadrantPointFill = this.quadrantPointFill || isDark(this.quadrant1Fill) ? lighten(this.quadrant1Fill) : darken(this.quadrant1Fill);
+    this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
+    this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
+    this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
+    this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
+    this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
+    this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
+    this.xyChart = {
+      backgroundColor: this.xyChart?.backgroundColor || this.background,
+      titleColor: this.xyChart?.titleColor || this.primaryTextColor,
+      xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor,
+      xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor,
+      xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor,
+      xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor,
+      yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor,
+      yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor,
+      yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor,
+      yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor,
+      plotColorPalette: this.xyChart?.plotColorPalette || "#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"
+    };
+    this.requirementBackground = this.requirementBackground || this.primaryColor;
+    this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
+    this.requirementBorderSize = this.requirementBorderSize || "1";
+    this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
+    this.relationColor = this.relationColor || this.lineColor;
+    this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? darken(this.secondaryColor, 30) : this.secondaryColor);
+    this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
+    this.git0 = this.git0 || this.primaryColor;
+    this.git1 = this.git1 || this.secondaryColor;
+    this.git2 = this.git2 || this.tertiaryColor;
+    this.git3 = this.git3 || adjust2(this.primaryColor, { h: -30 });
+    this.git4 = this.git4 || adjust2(this.primaryColor, { h: -60 });
+    this.git5 = this.git5 || adjust2(this.primaryColor, { h: -90 });
+    this.git6 = this.git6 || adjust2(this.primaryColor, { h: 60 });
+    this.git7 = this.git7 || adjust2(this.primaryColor, { h: 120 });
+    if (this.darkMode) {
+      this.git0 = lighten(this.git0, 25);
+      this.git1 = lighten(this.git1, 25);
+      this.git2 = lighten(this.git2, 25);
+      this.git3 = lighten(this.git3, 25);
+      this.git4 = lighten(this.git4, 25);
+      this.git5 = lighten(this.git5, 25);
+      this.git6 = lighten(this.git6, 25);
+      this.git7 = lighten(this.git7, 25);
+    } else {
+      this.git0 = darken(this.git0, 25);
+      this.git1 = darken(this.git1, 25);
+      this.git2 = darken(this.git2, 25);
+      this.git3 = darken(this.git3, 25);
+      this.git4 = darken(this.git4, 25);
+      this.git5 = darken(this.git5, 25);
+      this.git6 = darken(this.git6, 25);
+      this.git7 = darken(this.git7, 25);
+    }
+    this.gitInv0 = this.gitInv0 || invert(this.git0);
+    this.gitInv1 = this.gitInv1 || invert(this.git1);
+    this.gitInv2 = this.gitInv2 || invert(this.git2);
+    this.gitInv3 = this.gitInv3 || invert(this.git3);
+    this.gitInv4 = this.gitInv4 || invert(this.git4);
+    this.gitInv5 = this.gitInv5 || invert(this.git5);
+    this.gitInv6 = this.gitInv6 || invert(this.git6);
+    this.gitInv7 = this.gitInv7 || invert(this.git7);
+    this.branchLabelColor = this.branchLabelColor || (this.darkMode ? "black" : this.labelTextColor);
+    this.gitBranchLabel0 = this.gitBranchLabel0 || this.branchLabelColor;
+    this.gitBranchLabel1 = this.gitBranchLabel1 || this.branchLabelColor;
+    this.gitBranchLabel2 = this.gitBranchLabel2 || this.branchLabelColor;
+    this.gitBranchLabel3 = this.gitBranchLabel3 || this.branchLabelColor;
+    this.gitBranchLabel4 = this.gitBranchLabel4 || this.branchLabelColor;
+    this.gitBranchLabel5 = this.gitBranchLabel5 || this.branchLabelColor;
+    this.gitBranchLabel6 = this.gitBranchLabel6 || this.branchLabelColor;
+    this.gitBranchLabel7 = this.gitBranchLabel7 || this.branchLabelColor;
+    this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
+    this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
+    this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
+    this.tagLabelFontSize = this.tagLabelFontSize || "10px";
+    this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
+    this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
+    this.commitLabelFontSize = this.commitLabelFontSize || "10px";
+    this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
+    this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
+  }
+  calculate(overrides) {
+    if (typeof overrides !== "object") {
+      this.updateColors();
+      return;
+    }
+    const keys = Object.keys(overrides);
+    keys.forEach((k) => {
+      this[k] = overrides[k];
+    });
+    this.updateColors();
+    keys.forEach((k) => {
+      this[k] = overrides[k];
+    });
+  }
+};
+var getThemeVariables = /* @__PURE__ */ __name((userOverrides) => {
+  const theme = new Theme();
+  theme.calculate(userOverrides);
+  return theme;
+}, "getThemeVariables");
+
+// src/themes/theme-dark.js
+import { adjust as adjust3, darken as darken2, invert as invert2, isDark as isDark2, lighten as lighten2, rgba } from "khroma";
+var Theme2 = class {
+  static {
+    __name(this, "Theme");
+  }
+  constructor() {
+    this.background = "#333";
+    this.primaryColor = "#1f2020";
+    this.secondaryColor = lighten2(this.primaryColor, 16);
+    this.tertiaryColor = adjust3(this.primaryColor, { h: -160 });
+    this.primaryBorderColor = invert2(this.background);
+    this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);
+    this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);
+    this.primaryTextColor = invert2(this.primaryColor);
+    this.secondaryTextColor = invert2(this.secondaryColor);
+    this.tertiaryTextColor = invert2(this.tertiaryColor);
+    this.lineColor = invert2(this.background);
+    this.textColor = invert2(this.background);
+    this.mainBkg = "#1f2020";
+    this.secondBkg = "calculated";
+    this.mainContrastColor = "lightgrey";
+    this.darkTextColor = lighten2(invert2("#323D47"), 10);
+    this.lineColor = "calculated";
+    this.border1 = "#ccc";
+    this.border2 = rgba(255, 255, 255, 0.25);
+    this.arrowheadColor = "calculated";
+    this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
+    this.fontSize = "16px";
+    this.labelBackground = "#181818";
+    this.textColor = "#ccc";
+    this.THEME_COLOR_LIMIT = 12;
+    this.nodeBkg = "calculated";
+    this.nodeBorder = "calculated";
+    this.clusterBkg = "calculated";
+    this.clusterBorder = "calculated";
+    this.defaultLinkColor = "calculated";
+    this.titleColor = "#F9FFFE";
+    this.edgeLabelBackground = "calculated";
+    this.actorBorder = "calculated";
+    this.actorBkg = "calculated";
+    this.actorTextColor = "calculated";
+    this.actorLineColor = "calculated";
+    this.signalColor = "calculated";
+    this.signalTextColor = "calculated";
+    this.labelBoxBkgColor = "calculated";
+    this.labelBoxBorderColor = "calculated";
+    this.labelTextColor = "calculated";
+    this.loopTextColor = "calculated";
+    this.noteBorderColor = "calculated";
+    this.noteBkgColor = "#fff5ad";
+    this.noteTextColor = "calculated";
+    this.activationBorderColor = "calculated";
+    this.activationBkgColor = "calculated";
+    this.sequenceNumberColor = "black";
+    this.sectionBkgColor = darken2("#EAE8D9", 30);
+    this.altSectionBkgColor = "calculated";
+    this.sectionBkgColor2 = "#EAE8D9";
+    this.excludeBkgColor = darken2(this.sectionBkgColor, 10);
+    this.taskBorderColor = rgba(255, 255, 255, 70);
+    this.taskBkgColor = "calculated";
+    this.taskTextColor = "calculated";
+    this.taskTextLightColor = "calculated";
+    this.taskTextOutsideColor = "calculated";
+    this.taskTextClickableColor = "#003163";
+    this.activeTaskBorderColor = rgba(255, 255, 255, 50);
+    this.activeTaskBkgColor = "#81B1DB";
+    this.gridColor = "calculated";
+    this.doneTaskBkgColor = "calculated";
+    this.doneTaskBorderColor = "grey";
+    this.critBorderColor = "#E83737";
+    this.critBkgColor = "#E83737";
+    this.taskTextDarkColor = "calculated";
+    this.todayLineColor = "#DB5757";
+    this.personBorder = this.primaryBorderColor;
+    this.personBkg = this.mainBkg;
+    this.labelColor = "calculated";
+    this.errorBkgColor = "#a44141";
+    this.errorTextColor = "#ddd";
+  }
+  updateColors() {
+    this.secondBkg = lighten2(this.mainBkg, 16);
+    this.lineColor = this.mainContrastColor;
+    this.arrowheadColor = this.mainContrastColor;
+    this.nodeBkg = this.mainBkg;
+    this.nodeBorder = this.border1;
+    this.clusterBkg = this.secondBkg;
+    this.clusterBorder = this.border2;
+    this.defaultLinkColor = this.lineColor;
+    this.edgeLabelBackground = lighten2(this.labelBackground, 25);
+    this.actorBorder = this.border1;
+    this.actorBkg = this.mainBkg;
+    this.actorTextColor = this.mainContrastColor;
+    this.actorLineColor = this.actorBorder;
+    this.signalColor = this.mainContrastColor;
+    this.signalTextColor = this.mainContrastColor;
+    this.labelBoxBkgColor = this.actorBkg;
+    this.labelBoxBorderColor = this.actorBorder;
+    this.labelTextColor = this.mainContrastColor;
+    this.loopTextColor = this.mainContrastColor;
+    this.noteBorderColor = this.secondaryBorderColor;
+    this.noteBkgColor = this.secondBkg;
+    this.noteTextColor = this.secondaryTextColor;
+    this.activationBorderColor = this.border1;
+    this.activationBkgColor = this.secondBkg;
+    this.altSectionBkgColor = this.background;
+    this.taskBkgColor = lighten2(this.mainBkg, 23);
+    this.taskTextColor = this.darkTextColor;
+    this.taskTextLightColor = this.mainContrastColor;
+    this.taskTextOutsideColor = this.taskTextLightColor;
+    this.gridColor = this.mainContrastColor;
+    this.doneTaskBkgColor = this.mainContrastColor;
+    this.taskTextDarkColor = this.darkTextColor;
+    this.transitionColor = this.transitionColor || this.lineColor;
+    this.transitionLabelColor = this.transitionLabelColor || this.textColor;
+    this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
+    this.stateBkg = this.stateBkg || this.mainBkg;
+    this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
+    this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
+    this.altBackground = this.altBackground || "#555";
+    this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
+    this.compositeBorder = this.compositeBorder || this.nodeBorder;
+    this.innerEndBackground = this.primaryBorderColor;
+    this.specialStateColor = "#f4f4f4";
+    this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
+    this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
+    this.fillType0 = this.primaryColor;
+    this.fillType1 = this.secondaryColor;
+    this.fillType2 = adjust3(this.primaryColor, { h: 64 });
+    this.fillType3 = adjust3(this.secondaryColor, { h: 64 });
+    this.fillType4 = adjust3(this.primaryColor, { h: -64 });
+    this.fillType5 = adjust3(this.secondaryColor, { h: -64 });
+    this.fillType6 = adjust3(this.primaryColor, { h: 128 });
+    this.fillType7 = adjust3(this.secondaryColor, { h: 128 });
+    this.cScale1 = this.cScale1 || "#0b0000";
+    this.cScale2 = this.cScale2 || "#4d1037";
+    this.cScale3 = this.cScale3 || "#3f5258";
+    this.cScale4 = this.cScale4 || "#4f2f1b";
+    this.cScale5 = this.cScale5 || "#6e0a0a";
+    this.cScale6 = this.cScale6 || "#3b0048";
+    this.cScale7 = this.cScale7 || "#995a01";
+    this.cScale8 = this.cScale8 || "#154706";
+    this.cScale9 = this.cScale9 || "#161722";
+    this.cScale10 = this.cScale10 || "#00296f";
+    this.cScale11 = this.cScale11 || "#01629c";
+    this.cScale12 = this.cScale12 || "#010029";
+    this.cScale0 = this.cScale0 || this.primaryColor;
+    this.cScale1 = this.cScale1 || this.secondaryColor;
+    this.cScale2 = this.cScale2 || this.tertiaryColor;
+    this.cScale3 = this.cScale3 || adjust3(this.primaryColor, { h: 30 });
+    this.cScale4 = this.cScale4 || adjust3(this.primaryColor, { h: 60 });
+    this.cScale5 = this.cScale5 || adjust3(this.primaryColor, { h: 90 });
+    this.cScale6 = this.cScale6 || adjust3(this.primaryColor, { h: 120 });
+    this.cScale7 = this.cScale7 || adjust3(this.primaryColor, { h: 150 });
+    this.cScale8 = this.cScale8 || adjust3(this.primaryColor, { h: 210 });
+    this.cScale9 = this.cScale9 || adjust3(this.primaryColor, { h: 270 });
+    this.cScale10 = this.cScale10 || adjust3(this.primaryColor, { h: 300 });
+    this.cScale11 = this.cScale11 || adjust3(this.primaryColor, { h: 330 });
+    for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
+      this["cScaleInv" + i] = this["cScaleInv" + i] || invert2(this["cScale" + i]);
+    }
+    for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
+      this["cScalePeer" + i] = this["cScalePeer" + i] || lighten2(this["cScale" + i], 10);
+    }
+    for (let i = 0; i < 5; i++) {
+      this["surface" + i] = this["surface" + i] || adjust3(this.mainBkg, { h: 30, s: -30, l: -(-10 + i * 4) });
+      this["surfacePeer" + i] = this["surfacePeer" + i] || adjust3(this.mainBkg, { h: 30, s: -30, l: -(-7 + i * 4) });
+    }
+    this.scaleLabelColor = this.scaleLabelColor || (this.darkMode ? "black" : this.labelTextColor);
+    for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
+      this["cScaleLabel" + i] = this["cScaleLabel" + i] || this.scaleLabelColor;
+    }
+    for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
+      this["pie" + i] = this["cScale" + i];
+    }
+    this.pieTitleTextSize = this.pieTitleTextSize || "25px";
+    this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
+    this.pieSectionTextSize = this.pieSectionTextSize || "17px";
+    this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
+    this.pieLegendTextSize = this.pieLegendTextSize || "17px";
+    this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
+    this.pieStrokeColor = this.pieStrokeColor || "black";
+    this.pieStrokeWidth = this.pieStrokeWidth || "2px";
+    this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
+    this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
+    this.pieOpacity = this.pieOpacity || "0.7";
+    this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
+    this.quadrant2Fill = this.quadrant2Fill || adjust3(this.primaryColor, { r: 5, g: 5, b: 5 });
+    this.quadrant3Fill = this.quadrant3Fill || adjust3(this.primaryColor, { r: 10, g: 10, b: 10 });
+    this.quadrant4Fill = this.quadrant4Fill || adjust3(this.primaryColor, { r: 15, g: 15, b: 15 });
+    this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
+    this.quadrant2TextFill = this.quadrant2TextFill || adjust3(this.primaryTextColor, { r: -5, g: -5, b: -5 });
+    this.quadrant3TextFill = this.quadrant3TextFill || adjust3(this.primaryTextColor, { r: -10, g: -10, b: -10 });
+    this.quadrant4TextFill = this.quadrant4TextFill || adjust3(this.primaryTextColor, { r: -15, g: -15, b: -15 });
+    this.quadrantPointFill = this.quadrantPointFill || isDark2(this.quadrant1Fill) ? lighten2(this.quadrant1Fill) : darken2(this.quadrant1Fill);
+    this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
+    this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
+    this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
+    this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
+    this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
+    this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
+    this.xyChart = {
+      backgroundColor: this.xyChart?.backgroundColor || this.background,
+      titleColor: this.xyChart?.titleColor || this.primaryTextColor,
+      xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor,
+      xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor,
+      xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor,
+      xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor,
+      yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor,
+      yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor,
+      yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor,
+      yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor,
+      plotColorPalette: this.xyChart?.plotColorPalette || "#3498db,#2ecc71,#e74c3c,#f1c40f,#bdc3c7,#ffffff,#34495e,#9b59b6,#1abc9c,#e67e22"
+    };
+    this.packet = {
+      startByteColor: this.primaryTextColor,
+      endByteColor: this.primaryTextColor,
+      labelColor: this.primaryTextColor,
+      titleColor: this.primaryTextColor,
+      blockStrokeColor: this.primaryTextColor,
+      blockFillColor: this.background
+    };
+    this.classText = this.primaryTextColor;
+    this.requirementBackground = this.requirementBackground || this.primaryColor;
+    this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
+    this.requirementBorderSize = this.requirementBorderSize || "1";
+    this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
+    this.relationColor = this.relationColor || this.lineColor;
+    this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? darken2(this.secondaryColor, 30) : this.secondaryColor);
+    this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
+    this.git0 = lighten2(this.secondaryColor, 20);
+    this.git1 = lighten2(this.pie2 || this.secondaryColor, 20);
+    this.git2 = lighten2(this.pie3 || this.tertiaryColor, 20);
+    this.git3 = lighten2(this.pie4 || adjust3(this.primaryColor, { h: -30 }), 20);
+    this.git4 = lighten2(this.pie5 || adjust3(this.primaryColor, { h: -60 }), 20);
+    this.git5 = lighten2(this.pie6 || adjust3(this.primaryColor, { h: -90 }), 10);
+    this.git6 = lighten2(this.pie7 || adjust3(this.primaryColor, { h: 60 }), 10);
+    this.git7 = lighten2(this.pie8 || adjust3(this.primaryColor, { h: 120 }), 20);
+    this.gitInv0 = this.gitInv0 || invert2(this.git0);
+    this.gitInv1 = this.gitInv1 || invert2(this.git1);
+    this.gitInv2 = this.gitInv2 || invert2(this.git2);
+    this.gitInv3 = this.gitInv3 || invert2(this.git3);
+    this.gitInv4 = this.gitInv4 || invert2(this.git4);
+    this.gitInv5 = this.gitInv5 || invert2(this.git5);
+    this.gitInv6 = this.gitInv6 || invert2(this.git6);
+    this.gitInv7 = this.gitInv7 || invert2(this.git7);
+    this.gitBranchLabel0 = this.gitBranchLabel0 || invert2(this.labelTextColor);
+    this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor;
+    this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor;
+    this.gitBranchLabel3 = this.gitBranchLabel3 || invert2(this.labelTextColor);
+    this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor;
+    this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor;
+    this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor;
+    this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor;
+    this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
+    this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
+    this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
+    this.tagLabelFontSize = this.tagLabelFontSize || "10px";
+    this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
+    this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
+    this.commitLabelFontSize = this.commitLabelFontSize || "10px";
+    this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || lighten2(this.background, 12);
+    this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || lighten2(this.background, 2);
+    this.nodeBorder = this.nodeBorder || "#999";
+  }
+  calculate(overrides) {
+    if (typeof overrides !== "object") {
+      this.updateColors();
+      return;
+    }
+    const keys = Object.keys(overrides);
+    keys.forEach((k) => {
+      this[k] = overrides[k];
+    });
+    this.updateColors();
+    keys.forEach((k) => {
+      this[k] = overrides[k];
+    });
+  }
+};
+var getThemeVariables2 = /* @__PURE__ */ __name((userOverrides) => {
+  const theme = new Theme2();
+  theme.calculate(userOverrides);
+  return theme;
+}, "getThemeVariables");
+
+// src/themes/theme-default.js
+import { invert as invert3, lighten as lighten3, rgba as rgba2, adjust as adjust4, darken as darken3, isDark as isDark3 } from "khroma";
+var Theme3 = class {
+  static {
+    __name(this, "Theme");
+  }
+  constructor() {
+    this.background = "#f4f4f4";
+    this.primaryColor = "#ECECFF";
+    this.secondaryColor = adjust4(this.primaryColor, { h: 120 });
+    this.secondaryColor = "#ffffde";
+    this.tertiaryColor = adjust4(this.primaryColor, { h: -160 });
+    this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);
+    this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);
+    this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);
+    this.primaryTextColor = invert3(this.primaryColor);
+    this.secondaryTextColor = invert3(this.secondaryColor);
+    this.tertiaryTextColor = invert3(this.tertiaryColor);
+    this.lineColor = invert3(this.background);
+    this.textColor = invert3(this.background);
+    this.background = "white";
+    this.mainBkg = "#ECECFF";
+    this.secondBkg = "#ffffde";
+    this.lineColor = "#333333";
+    this.border1 = "#9370DB";
+    this.border2 = "#aaaa33";
+    this.arrowheadColor = "#333333";
+    this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
+    this.fontSize = "16px";
+    this.labelBackground = "rgba(232,232,232, 0.8)";
+    this.textColor = "#333";
+    this.THEME_COLOR_LIMIT = 12;
+    this.nodeBkg = "calculated";
+    this.nodeBorder = "calculated";
+    this.clusterBkg = "calculated";
+    this.clusterBorder = "calculated";
+    this.defaultLinkColor = "calculated";
+    this.titleColor = "calculated";
+    this.edgeLabelBackground = "calculated";
+    this.actorBorder = "calculated";
+    this.actorBkg = "calculated";
+    this.actorTextColor = "black";
+    this.actorLineColor = "calculated";
+    this.signalColor = "calculated";
+    this.signalTextColor = "calculated";
+    this.labelBoxBkgColor = "calculated";
+    this.labelBoxBorderColor = "calculated";
+    this.labelTextColor = "calculated";
+    this.loopTextColor = "calculated";
+    this.noteBorderColor = "calculated";
+    this.noteBkgColor = "#fff5ad";
+    this.noteTextColor = "calculated";
+    this.activationBorderColor = "#666";
+    this.activationBkgColor = "#f4f4f4";
+    this.sequenceNumberColor = "white";
+    this.sectionBkgColor = "calculated";
+    this.altSectionBkgColor = "calculated";
+    this.sectionBkgColor2 = "calculated";
+    this.excludeBkgColor = "#eeeeee";
+    this.taskBorderColor = "calculated";
+    this.taskBkgColor = "calculated";
+    this.taskTextLightColor = "calculated";
+    this.taskTextColor = this.taskTextLightColor;
+    this.taskTextDarkColor = "calculated";
+    this.taskTextOutsideColor = this.taskTextDarkColor;
+    this.taskTextClickableColor = "calculated";
+    this.activeTaskBorderColor = "calculated";
+    this.activeTaskBkgColor = "calculated";
+    this.gridColor = "calculated";
+    this.doneTaskBkgColor = "calculated";
+    this.doneTaskBorderColor = "calculated";
+    this.critBorderColor = "calculated";
+    this.critBkgColor = "calculated";
+    this.todayLineColor = "calculated";
+    this.sectionBkgColor = rgba2(102, 102, 255, 0.49);
+    this.altSectionBkgColor = "white";
+    this.sectionBkgColor2 = "#fff400";
+    this.taskBorderColor = "#534fbc";
+    this.taskBkgColor = "#8a90dd";
+    this.taskTextLightColor = "white";
+    this.taskTextColor = "calculated";
+    this.taskTextDarkColor = "black";
+    this.taskTextOutsideColor = "calculated";
+    this.taskTextClickableColor = "#003163";
+    this.activeTaskBorderColor = "#534fbc";
+    this.activeTaskBkgColor = "#bfc7ff";
+    this.gridColor = "lightgrey";
+    this.doneTaskBkgColor = "lightgrey";
+    this.doneTaskBorderColor = "grey";
+    this.critBorderColor = "#ff8888";
+    this.critBkgColor = "red";
+    this.todayLineColor = "red";
+    this.personBorder = this.primaryBorderColor;
+    this.personBkg = this.mainBkg;
+    this.labelColor = "black";
+    this.errorBkgColor = "#552222";
+    this.errorTextColor = "#552222";
+    this.updateColors();
+  }
+  updateColors() {
+    this.cScale0 = this.cScale0 || this.primaryColor;
+    this.cScale1 = this.cScale1 || this.secondaryColor;
+    this.cScale2 = this.cScale2 || this.tertiaryColor;
+    this.cScale3 = this.cScale3 || adjust4(this.primaryColor, { h: 30 });
+    this.cScale4 = this.cScale4 || adjust4(this.primaryColor, { h: 60 });
+    this.cScale5 = this.cScale5 || adjust4(this.primaryColor, { h: 90 });
+    this.cScale6 = this.cScale6 || adjust4(this.primaryColor, { h: 120 });
+    this.cScale7 = this.cScale7 || adjust4(this.primaryColor, { h: 150 });
+    this.cScale8 = this.cScale8 || adjust4(this.primaryColor, { h: 210 });
+    this.cScale9 = this.cScale9 || adjust4(this.primaryColor, { h: 270 });
+    this.cScale10 = this.cScale10 || adjust4(this.primaryColor, { h: 300 });
+    this.cScale11 = this.cScale11 || adjust4(this.primaryColor, { h: 330 });
+    this["cScalePeer1"] = this["cScalePeer1"] || darken3(this.secondaryColor, 45);
+    this["cScalePeer2"] = this["cScalePeer2"] || darken3(this.tertiaryColor, 40);
+    for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
+      this["cScale" + i] = darken3(this["cScale" + i], 10);
+      this["cScalePeer" + i] = this["cScalePeer" + i] || darken3(this["cScale" + i], 25);
+    }
+    for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
+      this["cScaleInv" + i] = this["cScaleInv" + i] || adjust4(this["cScale" + i], { h: 180 });
+    }
+    for (let i = 0; i < 5; i++) {
+      this["surface" + i] = this["surface" + i] || adjust4(this.mainBkg, { h: 30, l: -(5 + i * 5) });
+      this["surfacePeer" + i] = this["surfacePeer" + i] || adjust4(this.mainBkg, { h: 30, l: -(7 + i * 5) });
+    }
+    this.scaleLabelColor = this.scaleLabelColor !== "calculated" && this.scaleLabelColor ? this.scaleLabelColor : this.labelTextColor;
+    if (this.labelTextColor !== "calculated") {
+      this.cScaleLabel0 = this.cScaleLabel0 || invert3(this.labelTextColor);
+      this.cScaleLabel3 = this.cScaleLabel3 || invert3(this.labelTextColor);
+      for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
+        this["cScaleLabel" + i] = this["cScaleLabel" + i] || this.labelTextColor;
+      }
+    }
+    this.nodeBkg = this.mainBkg;
+    this.nodeBorder = this.border1;
+    this.clusterBkg = this.secondBkg;
+    this.clusterBorder = this.border2;
+    this.defaultLinkColor = this.lineColor;
+    this.titleColor = this.textColor;
+    this.edgeLabelBackground = this.labelBackground;
+    this.actorBorder = lighten3(this.border1, 23);
+    this.actorBkg = this.mainBkg;
+    this.labelBoxBkgColor = this.actorBkg;
+    this.signalColor = this.textColor;
+    this.signalTextColor = this.textColor;
+    this.labelBoxBorderColor = this.actorBorder;
+    this.labelTextColor = this.actorTextColor;
+    this.loopTextColor = this.actorTextColor;
+    this.noteBorderColor = this.border2;
+    this.noteTextColor = this.actorTextColor;
+    this.actorLineColor = this.actorBorder;
+    this.taskTextColor = this.taskTextLightColor;
+    this.taskTextOutsideColor = this.taskTextDarkColor;
+    this.transitionColor = this.transitionColor || this.lineColor;
+    this.transitionLabelColor = this.transitionLabelColor || this.textColor;
+    this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
+    this.stateBkg = this.stateBkg || this.mainBkg;
+    this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
+    this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
+    this.altBackground = this.altBackground || "#f0f0f0";
+    this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
+    this.compositeBorder = this.compositeBorder || this.nodeBorder;
+    this.innerEndBackground = this.nodeBorder;
+    this.specialStateColor = this.lineColor;
+    this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
+    this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
+    this.transitionColor = this.transitionColor || this.lineColor;
+    this.classText = this.primaryTextColor;
+    this.fillType0 = this.primaryColor;
+    this.fillType1 = this.secondaryColor;
+    this.fillType2 = adjust4(this.primaryColor, { h: 64 });
+    this.fillType3 = adjust4(this.secondaryColor, { h: 64 });
+    this.fillType4 = adjust4(this.primaryColor, { h: -64 });
+    this.fillType5 = adjust4(this.secondaryColor, { h: -64 });
+    this.fillType6 = adjust4(this.primaryColor, { h: 128 });
+    this.fillType7 = adjust4(this.secondaryColor, { h: 128 });
+    this.pie1 = this.pie1 || this.primaryColor;
+    this.pie2 = this.pie2 || this.secondaryColor;
+    this.pie3 = this.pie3 || adjust4(this.tertiaryColor, { l: -40 });
+    this.pie4 = this.pie4 || adjust4(this.primaryColor, { l: -10 });
+    this.pie5 = this.pie5 || adjust4(this.secondaryColor, { l: -30 });
+    this.pie6 = this.pie6 || adjust4(this.tertiaryColor, { l: -20 });
+    this.pie7 = this.pie7 || adjust4(this.primaryColor, { h: 60, l: -20 });
+    this.pie8 = this.pie8 || adjust4(this.primaryColor, { h: -60, l: -40 });
+    this.pie9 = this.pie9 || adjust4(this.primaryColor, { h: 120, l: -40 });
+    this.pie10 = this.pie10 || adjust4(this.primaryColor, { h: 60, l: -40 });
+    this.pie11 = this.pie11 || adjust4(this.primaryColor, { h: -90, l: -40 });
+    this.pie12 = this.pie12 || adjust4(this.primaryColor, { h: 120, l: -30 });
+    this.pieTitleTextSize = this.pieTitleTextSize || "25px";
+    this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
+    this.pieSectionTextSize = this.pieSectionTextSize || "17px";
+    this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
+    this.pieLegendTextSize = this.pieLegendTextSize || "17px";
+    this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
+    this.pieStrokeColor = this.pieStrokeColor || "black";
+    this.pieStrokeWidth = this.pieStrokeWidth || "2px";
+    this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
+    this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
+    this.pieOpacity = this.pieOpacity || "0.7";
+    this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
+    this.quadrant2Fill = this.quadrant2Fill || adjust4(this.primaryColor, { r: 5, g: 5, b: 5 });
+    this.quadrant3Fill = this.quadrant3Fill || adjust4(this.primaryColor, { r: 10, g: 10, b: 10 });
+    this.quadrant4Fill = this.quadrant4Fill || adjust4(this.primaryColor, { r: 15, g: 15, b: 15 });
+    this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
+    this.quadrant2TextFill = this.quadrant2TextFill || adjust4(this.primaryTextColor, { r: -5, g: -5, b: -5 });
+    this.quadrant3TextFill = this.quadrant3TextFill || adjust4(this.primaryTextColor, { r: -10, g: -10, b: -10 });
+    this.quadrant4TextFill = this.quadrant4TextFill || adjust4(this.primaryTextColor, { r: -15, g: -15, b: -15 });
+    this.quadrantPointFill = this.quadrantPointFill || isDark3(this.quadrant1Fill) ? lighten3(this.quadrant1Fill) : darken3(this.quadrant1Fill);
+    this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
+    this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
+    this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
+    this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
+    this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
+    this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
+    this.xyChart = {
+      backgroundColor: this.xyChart?.backgroundColor || this.background,
+      titleColor: this.xyChart?.titleColor || this.primaryTextColor,
+      xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor,
+      xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor,
+      xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor,
+      xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor,
+      yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor,
+      yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor,
+      yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor,
+      yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor,
+      plotColorPalette: this.xyChart?.plotColorPalette || "#ECECFF,#8493A6,#FFC3A0,#DCDDE1,#B8E994,#D1A36F,#C3CDE6,#FFB6C1,#496078,#F8F3E3"
+    };
+    this.requirementBackground = this.requirementBackground || this.primaryColor;
+    this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
+    this.requirementBorderSize = this.requirementBorderSize || "1";
+    this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
+    this.relationColor = this.relationColor || this.lineColor;
+    this.relationLabelBackground = this.relationLabelBackground || this.labelBackground;
+    this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
+    this.git0 = this.git0 || this.primaryColor;
+    this.git1 = this.git1 || this.secondaryColor;
+    this.git2 = this.git2 || this.tertiaryColor;
+    this.git3 = this.git3 || adjust4(this.primaryColor, { h: -30 });
+    this.git4 = this.git4 || adjust4(this.primaryColor, { h: -60 });
+    this.git5 = this.git5 || adjust4(this.primaryColor, { h: -90 });
+    this.git6 = this.git6 || adjust4(this.primaryColor, { h: 60 });
+    this.git7 = this.git7 || adjust4(this.primaryColor, { h: 120 });
+    if (this.darkMode) {
+      this.git0 = lighten3(this.git0, 25);
+      this.git1 = lighten3(this.git1, 25);
+      this.git2 = lighten3(this.git2, 25);
+      this.git3 = lighten3(this.git3, 25);
+      this.git4 = lighten3(this.git4, 25);
+      this.git5 = lighten3(this.git5, 25);
+      this.git6 = lighten3(this.git6, 25);
+      this.git7 = lighten3(this.git7, 25);
+    } else {
+      this.git0 = darken3(this.git0, 25);
+      this.git1 = darken3(this.git1, 25);
+      this.git2 = darken3(this.git2, 25);
+      this.git3 = darken3(this.git3, 25);
+      this.git4 = darken3(this.git4, 25);
+      this.git5 = darken3(this.git5, 25);
+      this.git6 = darken3(this.git6, 25);
+      this.git7 = darken3(this.git7, 25);
+    }
+    this.gitInv0 = this.gitInv0 || darken3(invert3(this.git0), 25);
+    this.gitInv1 = this.gitInv1 || invert3(this.git1);
+    this.gitInv2 = this.gitInv2 || invert3(this.git2);
+    this.gitInv3 = this.gitInv3 || invert3(this.git3);
+    this.gitInv4 = this.gitInv4 || invert3(this.git4);
+    this.gitInv5 = this.gitInv5 || invert3(this.git5);
+    this.gitInv6 = this.gitInv6 || invert3(this.git6);
+    this.gitInv7 = this.gitInv7 || invert3(this.git7);
+    this.gitBranchLabel0 = this.gitBranchLabel0 || invert3(this.labelTextColor);
+    this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor;
+    this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor;
+    this.gitBranchLabel3 = this.gitBranchLabel3 || invert3(this.labelTextColor);
+    this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor;
+    this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor;
+    this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor;
+    this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor;
+    this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
+    this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
+    this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
+    this.tagLabelFontSize = this.tagLabelFontSize || "10px";
+    this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
+    this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
+    this.commitLabelFontSize = this.commitLabelFontSize || "10px";
+    this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
+    this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
+  }
+  calculate(overrides) {
+    if (typeof overrides !== "object") {
+      this.updateColors();
+      return;
+    }
+    const keys = Object.keys(overrides);
+    keys.forEach((k) => {
+      this[k] = overrides[k];
+    });
+    this.updateColors();
+    keys.forEach((k) => {
+      this[k] = overrides[k];
+    });
+  }
+};
+var getThemeVariables3 = /* @__PURE__ */ __name((userOverrides) => {
+  const theme = new Theme3();
+  theme.calculate(userOverrides);
+  return theme;
+}, "getThemeVariables");
+
+// src/themes/theme-forest.js
+import { adjust as adjust5, darken as darken4, invert as invert4, isDark as isDark4, lighten as lighten4 } from "khroma";
+var Theme4 = class {
+  static {
+    __name(this, "Theme");
+  }
+  constructor() {
+    this.background = "#f4f4f4";
+    this.primaryColor = "#cde498";
+    this.secondaryColor = "#cdffb2";
+    this.background = "white";
+    this.mainBkg = "#cde498";
+    this.secondBkg = "#cdffb2";
+    this.lineColor = "green";
+    this.border1 = "#13540c";
+    this.border2 = "#6eaa49";
+    this.arrowheadColor = "green";
+    this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
+    this.fontSize = "16px";
+    this.tertiaryColor = lighten4("#cde498", 10);
+    this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);
+    this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);
+    this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);
+    this.primaryTextColor = invert4(this.primaryColor);
+    this.secondaryTextColor = invert4(this.secondaryColor);
+    this.tertiaryTextColor = invert4(this.primaryColor);
+    this.lineColor = invert4(this.background);
+    this.textColor = invert4(this.background);
+    this.THEME_COLOR_LIMIT = 12;
+    this.nodeBkg = "calculated";
+    this.nodeBorder = "calculated";
+    this.clusterBkg = "calculated";
+    this.clusterBorder = "calculated";
+    this.defaultLinkColor = "calculated";
+    this.titleColor = "#333";
+    this.edgeLabelBackground = "#e8e8e8";
+    this.actorBorder = "calculated";
+    this.actorBkg = "calculated";
+    this.actorTextColor = "black";
+    this.actorLineColor = "calculated";
+    this.signalColor = "#333";
+    this.signalTextColor = "#333";
+    this.labelBoxBkgColor = "calculated";
+    this.labelBoxBorderColor = "#326932";
+    this.labelTextColor = "calculated";
+    this.loopTextColor = "calculated";
+    this.noteBorderColor = "calculated";
+    this.noteBkgColor = "#fff5ad";
+    this.noteTextColor = "calculated";
+    this.activationBorderColor = "#666";
+    this.activationBkgColor = "#f4f4f4";
+    this.sequenceNumberColor = "white";
+    this.sectionBkgColor = "#6eaa49";
+    this.altSectionBkgColor = "white";
+    this.sectionBkgColor2 = "#6eaa49";
+    this.excludeBkgColor = "#eeeeee";
+    this.taskBorderColor = "calculated";
+    this.taskBkgColor = "#487e3a";
+    this.taskTextLightColor = "white";
+    this.taskTextColor = "calculated";
+    this.taskTextDarkColor = "black";
+    this.taskTextOutsideColor = "calculated";
+    this.taskTextClickableColor = "#003163";
+    this.activeTaskBorderColor = "calculated";
+    this.activeTaskBkgColor = "calculated";
+    this.gridColor = "lightgrey";
+    this.doneTaskBkgColor = "lightgrey";
+    this.doneTaskBorderColor = "grey";
+    this.critBorderColor = "#ff8888";
+    this.critBkgColor = "red";
+    this.todayLineColor = "red";
+    this.personBorder = this.primaryBorderColor;
+    this.personBkg = this.mainBkg;
+    this.labelColor = "black";
+    this.errorBkgColor = "#552222";
+    this.errorTextColor = "#552222";
+  }
+  updateColors() {
+    this.actorBorder = darken4(this.mainBkg, 20);
+    this.actorBkg = this.mainBkg;
+    this.labelBoxBkgColor = this.actorBkg;
+    this.labelTextColor = this.actorTextColor;
+    this.loopTextColor = this.actorTextColor;
+    this.noteBorderColor = this.border2;
+    this.noteTextColor = this.actorTextColor;
+    this.actorLineColor = this.actorBorder;
+    this.cScale0 = this.cScale0 || this.primaryColor;
+    this.cScale1 = this.cScale1 || this.secondaryColor;
+    this.cScale2 = this.cScale2 || this.tertiaryColor;
+    this.cScale3 = this.cScale3 || adjust5(this.primaryColor, { h: 30 });
+    this.cScale4 = this.cScale4 || adjust5(this.primaryColor, { h: 60 });
+    this.cScale5 = this.cScale5 || adjust5(this.primaryColor, { h: 90 });
+    this.cScale6 = this.cScale6 || adjust5(this.primaryColor, { h: 120 });
+    this.cScale7 = this.cScale7 || adjust5(this.primaryColor, { h: 150 });
+    this.cScale8 = this.cScale8 || adjust5(this.primaryColor, { h: 210 });
+    this.cScale9 = this.cScale9 || adjust5(this.primaryColor, { h: 270 });
+    this.cScale10 = this.cScale10 || adjust5(this.primaryColor, { h: 300 });
+    this.cScale11 = this.cScale11 || adjust5(this.primaryColor, { h: 330 });
+    this["cScalePeer1"] = this["cScalePeer1"] || darken4(this.secondaryColor, 45);
+    this["cScalePeer2"] = this["cScalePeer2"] || darken4(this.tertiaryColor, 40);
+    for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
+      this["cScale" + i] = darken4(this["cScale" + i], 10);
+      this["cScalePeer" + i] = this["cScalePeer" + i] || darken4(this["cScale" + i], 25);
+    }
+    for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
+      this["cScaleInv" + i] = this["cScaleInv" + i] || adjust5(this["cScale" + i], { h: 180 });
+    }
+    this.scaleLabelColor = this.scaleLabelColor !== "calculated" && this.scaleLabelColor ? this.scaleLabelColor : this.labelTextColor;
+    for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
+      this["cScaleLabel" + i] = this["cScaleLabel" + i] || this.scaleLabelColor;
+    }
+    for (let i = 0; i < 5; i++) {
+      this["surface" + i] = this["surface" + i] || adjust5(this.mainBkg, { h: 30, s: -30, l: -(5 + i * 5) });
+      this["surfacePeer" + i] = this["surfacePeer" + i] || adjust5(this.mainBkg, { h: 30, s: -30, l: -(8 + i * 5) });
+    }
+    this.nodeBkg = this.mainBkg;
+    this.nodeBorder = this.border1;
+    this.clusterBkg = this.secondBkg;
+    this.clusterBorder = this.border2;
+    this.defaultLinkColor = this.lineColor;
+    this.taskBorderColor = this.border1;
+    this.taskTextColor = this.taskTextLightColor;
+    this.taskTextOutsideColor = this.taskTextDarkColor;
+    this.activeTaskBorderColor = this.taskBorderColor;
+    this.activeTaskBkgColor = this.mainBkg;
+    this.transitionColor = this.transitionColor || this.lineColor;
+    this.transitionLabelColor = this.transitionLabelColor || this.textColor;
+    this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
+    this.stateBkg = this.stateBkg || this.mainBkg;
+    this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
+    this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
+    this.altBackground = this.altBackground || "#f0f0f0";
+    this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
+    this.compositeBorder = this.compositeBorder || this.nodeBorder;
+    this.innerEndBackground = this.primaryBorderColor;
+    this.specialStateColor = this.lineColor;
+    this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
+    this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
+    this.transitionColor = this.transitionColor || this.lineColor;
+    this.classText = this.primaryTextColor;
+    this.fillType0 = this.primaryColor;
+    this.fillType1 = this.secondaryColor;
+    this.fillType2 = adjust5(this.primaryColor, { h: 64 });
+    this.fillType3 = adjust5(this.secondaryColor, { h: 64 });
+    this.fillType4 = adjust5(this.primaryColor, { h: -64 });
+    this.fillType5 = adjust5(this.secondaryColor, { h: -64 });
+    this.fillType6 = adjust5(this.primaryColor, { h: 128 });
+    this.fillType7 = adjust5(this.secondaryColor, { h: 128 });
+    this.pie1 = this.pie1 || this.primaryColor;
+    this.pie2 = this.pie2 || this.secondaryColor;
+    this.pie3 = this.pie3 || this.tertiaryColor;
+    this.pie4 = this.pie4 || adjust5(this.primaryColor, { l: -30 });
+    this.pie5 = this.pie5 || adjust5(this.secondaryColor, { l: -30 });
+    this.pie6 = this.pie6 || adjust5(this.tertiaryColor, { h: 40, l: -40 });
+    this.pie7 = this.pie7 || adjust5(this.primaryColor, { h: 60, l: -10 });
+    this.pie8 = this.pie8 || adjust5(this.primaryColor, { h: -60, l: -10 });
+    this.pie9 = this.pie9 || adjust5(this.primaryColor, { h: 120, l: 0 });
+    this.pie10 = this.pie10 || adjust5(this.primaryColor, { h: 60, l: -50 });
+    this.pie11 = this.pie11 || adjust5(this.primaryColor, { h: -60, l: -50 });
+    this.pie12 = this.pie12 || adjust5(this.primaryColor, { h: 120, l: -50 });
+    this.pieTitleTextSize = this.pieTitleTextSize || "25px";
+    this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
+    this.pieSectionTextSize = this.pieSectionTextSize || "17px";
+    this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
+    this.pieLegendTextSize = this.pieLegendTextSize || "17px";
+    this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
+    this.pieStrokeColor = this.pieStrokeColor || "black";
+    this.pieStrokeWidth = this.pieStrokeWidth || "2px";
+    this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
+    this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
+    this.pieOpacity = this.pieOpacity || "0.7";
+    this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
+    this.quadrant2Fill = this.quadrant2Fill || adjust5(this.primaryColor, { r: 5, g: 5, b: 5 });
+    this.quadrant3Fill = this.quadrant3Fill || adjust5(this.primaryColor, { r: 10, g: 10, b: 10 });
+    this.quadrant4Fill = this.quadrant4Fill || adjust5(this.primaryColor, { r: 15, g: 15, b: 15 });
+    this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
+    this.quadrant2TextFill = this.quadrant2TextFill || adjust5(this.primaryTextColor, { r: -5, g: -5, b: -5 });
+    this.quadrant3TextFill = this.quadrant3TextFill || adjust5(this.primaryTextColor, { r: -10, g: -10, b: -10 });
+    this.quadrant4TextFill = this.quadrant4TextFill || adjust5(this.primaryTextColor, { r: -15, g: -15, b: -15 });
+    this.quadrantPointFill = this.quadrantPointFill || isDark4(this.quadrant1Fill) ? lighten4(this.quadrant1Fill) : darken4(this.quadrant1Fill);
+    this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
+    this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
+    this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
+    this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
+    this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
+    this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
+    this.packet = {
+      startByteColor: this.primaryTextColor,
+      endByteColor: this.primaryTextColor,
+      labelColor: this.primaryTextColor,
+      titleColor: this.primaryTextColor,
+      blockStrokeColor: this.primaryTextColor,
+      blockFillColor: this.mainBkg
+    };
+    this.xyChart = {
+      backgroundColor: this.xyChart?.backgroundColor || this.background,
+      titleColor: this.xyChart?.titleColor || this.primaryTextColor,
+      xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor,
+      xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor,
+      xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor,
+      xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor,
+      yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor,
+      yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor,
+      yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor,
+      yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor,
+      plotColorPalette: this.xyChart?.plotColorPalette || "#CDE498,#FF6B6B,#A0D2DB,#D7BDE2,#F0F0F0,#FFC3A0,#7FD8BE,#FF9A8B,#FAF3E0,#FFF176"
+    };
+    this.requirementBackground = this.requirementBackground || this.primaryColor;
+    this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
+    this.requirementBorderSize = this.requirementBorderSize || "1";
+    this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
+    this.relationColor = this.relationColor || this.lineColor;
+    this.relationLabelBackground = this.relationLabelBackground || this.edgeLabelBackground;
+    this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
+    this.git0 = this.git0 || this.primaryColor;
+    this.git1 = this.git1 || this.secondaryColor;
+    this.git2 = this.git2 || this.tertiaryColor;
+    this.git3 = this.git3 || adjust5(this.primaryColor, { h: -30 });
+    this.git4 = this.git4 || adjust5(this.primaryColor, { h: -60 });
+    this.git5 = this.git5 || adjust5(this.primaryColor, { h: -90 });
+    this.git6 = this.git6 || adjust5(this.primaryColor, { h: 60 });
+    this.git7 = this.git7 || adjust5(this.primaryColor, { h: 120 });
+    if (this.darkMode) {
+      this.git0 = lighten4(this.git0, 25);
+      this.git1 = lighten4(this.git1, 25);
+      this.git2 = lighten4(this.git2, 25);
+      this.git3 = lighten4(this.git3, 25);
+      this.git4 = lighten4(this.git4, 25);
+      this.git5 = lighten4(this.git5, 25);
+      this.git6 = lighten4(this.git6, 25);
+      this.git7 = lighten4(this.git7, 25);
+    } else {
+      this.git0 = darken4(this.git0, 25);
+      this.git1 = darken4(this.git1, 25);
+      this.git2 = darken4(this.git2, 25);
+      this.git3 = darken4(this.git3, 25);
+      this.git4 = darken4(this.git4, 25);
+      this.git5 = darken4(this.git5, 25);
+      this.git6 = darken4(this.git6, 25);
+      this.git7 = darken4(this.git7, 25);
+    }
+    this.gitInv0 = this.gitInv0 || invert4(this.git0);
+    this.gitInv1 = this.gitInv1 || invert4(this.git1);
+    this.gitInv2 = this.gitInv2 || invert4(this.git2);
+    this.gitInv3 = this.gitInv3 || invert4(this.git3);
+    this.gitInv4 = this.gitInv4 || invert4(this.git4);
+    this.gitInv5 = this.gitInv5 || invert4(this.git5);
+    this.gitInv6 = this.gitInv6 || invert4(this.git6);
+    this.gitInv7 = this.gitInv7 || invert4(this.git7);
+    this.gitBranchLabel0 = this.gitBranchLabel0 || invert4(this.labelTextColor);
+    this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor;
+    this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor;
+    this.gitBranchLabel3 = this.gitBranchLabel3 || invert4(this.labelTextColor);
+    this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor;
+    this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor;
+    this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor;
+    this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor;
+    this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
+    this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
+    this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
+    this.tagLabelFontSize = this.tagLabelFontSize || "10px";
+    this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
+    this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
+    this.commitLabelFontSize = this.commitLabelFontSize || "10px";
+    this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
+    this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
+  }
+  calculate(overrides) {
+    if (typeof overrides !== "object") {
+      this.updateColors();
+      return;
+    }
+    const keys = Object.keys(overrides);
+    keys.forEach((k) => {
+      this[k] = overrides[k];
+    });
+    this.updateColors();
+    keys.forEach((k) => {
+      this[k] = overrides[k];
+    });
+  }
+};
+var getThemeVariables4 = /* @__PURE__ */ __name((userOverrides) => {
+  const theme = new Theme4();
+  theme.calculate(userOverrides);
+  return theme;
+}, "getThemeVariables");
+
+// src/themes/theme-neutral.js
+import { invert as invert5, darken as darken5, lighten as lighten5, adjust as adjust6, isDark as isDark5 } from "khroma";
+var Theme5 = class {
+  static {
+    __name(this, "Theme");
+  }
+  constructor() {
+    this.primaryColor = "#eee";
+    this.contrast = "#707070";
+    this.secondaryColor = lighten5(this.contrast, 55);
+    this.background = "#ffffff";
+    this.tertiaryColor = adjust6(this.primaryColor, { h: -160 });
+    this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);
+    this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);
+    this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);
+    this.primaryTextColor = invert5(this.primaryColor);
+    this.secondaryTextColor = invert5(this.secondaryColor);
+    this.tertiaryTextColor = invert5(this.tertiaryColor);
+    this.lineColor = invert5(this.background);
+    this.textColor = invert5(this.background);
+    this.mainBkg = "#eee";
+    this.secondBkg = "calculated";
+    this.lineColor = "#666";
+    this.border1 = "#999";
+    this.border2 = "calculated";
+    this.note = "#ffa";
+    this.text = "#333";
+    this.critical = "#d42";
+    this.done = "#bbb";
+    this.arrowheadColor = "#333333";
+    this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
+    this.fontSize = "16px";
+    this.THEME_COLOR_LIMIT = 12;
+    this.nodeBkg = "calculated";
+    this.nodeBorder = "calculated";
+    this.clusterBkg = "calculated";
+    this.clusterBorder = "calculated";
+    this.defaultLinkColor = "calculated";
+    this.titleColor = "calculated";
+    this.edgeLabelBackground = "white";
+    this.actorBorder = "calculated";
+    this.actorBkg = "calculated";
+    this.actorTextColor = "calculated";
+    this.actorLineColor = this.actorBorder;
+    this.signalColor = "calculated";
+    this.signalTextColor = "calculated";
+    this.labelBoxBkgColor = "calculated";
+    this.labelBoxBorderColor = "calculated";
+    this.labelTextColor = "calculated";
+    this.loopTextColor = "calculated";
+    this.noteBorderColor = "calculated";
+    this.noteBkgColor = "calculated";
+    this.noteTextColor = "calculated";
+    this.activationBorderColor = "#666";
+    this.activationBkgColor = "#f4f4f4";
+    this.sequenceNumberColor = "white";
+    this.sectionBkgColor = "calculated";
+    this.altSectionBkgColor = "white";
+    this.sectionBkgColor2 = "calculated";
+    this.excludeBkgColor = "#eeeeee";
+    this.taskBorderColor = "calculated";
+    this.taskBkgColor = "calculated";
+    this.taskTextLightColor = "white";
+    this.taskTextColor = "calculated";
+    this.taskTextDarkColor = "calculated";
+    this.taskTextOutsideColor = "calculated";
+    this.taskTextClickableColor = "#003163";
+    this.activeTaskBorderColor = "calculated";
+    this.activeTaskBkgColor = "calculated";
+    this.gridColor = "calculated";
+    this.doneTaskBkgColor = "calculated";
+    this.doneTaskBorderColor = "calculated";
+    this.critBkgColor = "calculated";
+    this.critBorderColor = "calculated";
+    this.todayLineColor = "calculated";
+    this.personBorder = this.primaryBorderColor;
+    this.personBkg = this.mainBkg;
+    this.labelColor = "black";
+    this.errorBkgColor = "#552222";
+    this.errorTextColor = "#552222";
+  }
+  updateColors() {
+    this.secondBkg = lighten5(this.contrast, 55);
+    this.border2 = this.contrast;
+    this.actorBorder = lighten5(this.border1, 23);
+    this.actorBkg = this.mainBkg;
+    this.actorTextColor = this.text;
+    this.actorLineColor = this.actorBorder;
+    this.signalColor = this.text;
+    this.signalTextColor = this.text;
+    this.labelBoxBkgColor = this.actorBkg;
+    this.labelBoxBorderColor = this.actorBorder;
+    this.labelTextColor = this.text;
+    this.loopTextColor = this.text;
+    this.noteBorderColor = "#999";
+    this.noteBkgColor = "#666";
+    this.noteTextColor = "#fff";
+    this.cScale0 = this.cScale0 || "#555";
+    this.cScale1 = this.cScale1 || "#F4F4F4";
+    this.cScale2 = this.cScale2 || "#555";
+    this.cScale3 = this.cScale3 || "#BBB";
+    this.cScale4 = this.cScale4 || "#777";
+    this.cScale5 = this.cScale5 || "#999";
+    this.cScale6 = this.cScale6 || "#DDD";
+    this.cScale7 = this.cScale7 || "#FFF";
+    this.cScale8 = this.cScale8 || "#DDD";
+    this.cScale9 = this.cScale9 || "#BBB";
+    this.cScale10 = this.cScale10 || "#999";
+    this.cScale11 = this.cScale11 || "#777";
+    for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
+      this["cScaleInv" + i] = this["cScaleInv" + i] || invert5(this["cScale" + i]);
+    }
+    for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
+      if (this.darkMode) {
+        this["cScalePeer" + i] = this["cScalePeer" + i] || lighten5(this["cScale" + i], 10);
+      } else {
+        this["cScalePeer" + i] = this["cScalePeer" + i] || darken5(this["cScale" + i], 10);
+      }
+    }
+    this.scaleLabelColor = this.scaleLabelColor || (this.darkMode ? "black" : this.labelTextColor);
+    this.cScaleLabel0 = this.cScaleLabel0 || this.cScale1;
+    this.cScaleLabel2 = this.cScaleLabel2 || this.cScale1;
+    for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
+      this["cScaleLabel" + i] = this["cScaleLabel" + i] || this.scaleLabelColor;
+    }
+    for (let i = 0; i < 5; i++) {
+      this["surface" + i] = this["surface" + i] || adjust6(this.mainBkg, { l: -(5 + i * 5) });
+      this["surfacePeer" + i] = this["surfacePeer" + i] || adjust6(this.mainBkg, { l: -(8 + i * 5) });
+    }
+    this.nodeBkg = this.mainBkg;
+    this.nodeBorder = this.border1;
+    this.clusterBkg = this.secondBkg;
+    this.clusterBorder = this.border2;
+    this.defaultLinkColor = this.lineColor;
+    this.titleColor = this.text;
+    this.sectionBkgColor = lighten5(this.contrast, 30);
+    this.sectionBkgColor2 = lighten5(this.contrast, 30);
+    this.taskBorderColor = darken5(this.contrast, 10);
+    this.taskBkgColor = this.contrast;
+    this.taskTextColor = this.taskTextLightColor;
+    this.taskTextDarkColor = this.text;
+    this.taskTextOutsideColor = this.taskTextDarkColor;
+    this.activeTaskBorderColor = this.taskBorderColor;
+    this.activeTaskBkgColor = this.mainBkg;
+    this.gridColor = lighten5(this.border1, 30);
+    this.doneTaskBkgColor = this.done;
+    this.doneTaskBorderColor = this.lineColor;
+    this.critBkgColor = this.critical;
+    this.critBorderColor = darken5(this.critBkgColor, 10);
+    this.todayLineColor = this.critBkgColor;
+    this.transitionColor = this.transitionColor || "#000";
+    this.transitionLabelColor = this.transitionLabelColor || this.textColor;
+    this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
+    this.stateBkg = this.stateBkg || this.mainBkg;
+    this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
+    this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
+    this.altBackground = this.altBackground || "#f4f4f4";
+    this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
+    this.stateBorder = this.stateBorder || "#000";
+    this.innerEndBackground = this.primaryBorderColor;
+    this.specialStateColor = "#222";
+    this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
+    this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
+    this.classText = this.primaryTextColor;
+    this.fillType0 = this.primaryColor;
+    this.fillType1 = this.secondaryColor;
+    this.fillType2 = adjust6(this.primaryColor, { h: 64 });
+    this.fillType3 = adjust6(this.secondaryColor, { h: 64 });
+    this.fillType4 = adjust6(this.primaryColor, { h: -64 });
+    this.fillType5 = adjust6(this.secondaryColor, { h: -64 });
+    this.fillType6 = adjust6(this.primaryColor, { h: 128 });
+    this.fillType7 = adjust6(this.secondaryColor, { h: 128 });
+    for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
+      this["pie" + i] = this["cScale" + i];
+    }
+    this.pie12 = this.pie0;
+    this.pieTitleTextSize = this.pieTitleTextSize || "25px";
+    this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
+    this.pieSectionTextSize = this.pieSectionTextSize || "17px";
+    this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
+    this.pieLegendTextSize = this.pieLegendTextSize || "17px";
+    this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
+    this.pieStrokeColor = this.pieStrokeColor || "black";
+    this.pieStrokeWidth = this.pieStrokeWidth || "2px";
+    this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
+    this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
+    this.pieOpacity = this.pieOpacity || "0.7";
+    this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
+    this.quadrant2Fill = this.quadrant2Fill || adjust6(this.primaryColor, { r: 5, g: 5, b: 5 });
+    this.quadrant3Fill = this.quadrant3Fill || adjust6(this.primaryColor, { r: 10, g: 10, b: 10 });
+    this.quadrant4Fill = this.quadrant4Fill || adjust6(this.primaryColor, { r: 15, g: 15, b: 15 });
+    this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
+    this.quadrant2TextFill = this.quadrant2TextFill || adjust6(this.primaryTextColor, { r: -5, g: -5, b: -5 });
+    this.quadrant3TextFill = this.quadrant3TextFill || adjust6(this.primaryTextColor, { r: -10, g: -10, b: -10 });
+    this.quadrant4TextFill = this.quadrant4TextFill || adjust6(this.primaryTextColor, { r: -15, g: -15, b: -15 });
+    this.quadrantPointFill = this.quadrantPointFill || isDark5(this.quadrant1Fill) ? lighten5(this.quadrant1Fill) : darken5(this.quadrant1Fill);
+    this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
+    this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
+    this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
+    this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
+    this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
+    this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
+    this.xyChart = {
+      backgroundColor: this.xyChart?.backgroundColor || this.background,
+      titleColor: this.xyChart?.titleColor || this.primaryTextColor,
+      xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor,
+      xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor,
+      xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor,
+      xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor,
+      yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor,
+      yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor,
+      yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor,
+      yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor,
+      plotColorPalette: this.xyChart?.plotColorPalette || "#EEE,#6BB8E4,#8ACB88,#C7ACD6,#E8DCC2,#FFB2A8,#FFF380,#7E8D91,#FFD8B1,#FAF3E0"
+    };
+    this.requirementBackground = this.requirementBackground || this.primaryColor;
+    this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
+    this.requirementBorderSize = this.requirementBorderSize || "1";
+    this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
+    this.relationColor = this.relationColor || this.lineColor;
+    this.relationLabelBackground = this.relationLabelBackground || this.edgeLabelBackground;
+    this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
+    this.git0 = darken5(this.pie1, 25) || this.primaryColor;
+    this.git1 = this.pie2 || this.secondaryColor;
+    this.git2 = this.pie3 || this.tertiaryColor;
+    this.git3 = this.pie4 || adjust6(this.primaryColor, { h: -30 });
+    this.git4 = this.pie5 || adjust6(this.primaryColor, { h: -60 });
+    this.git5 = this.pie6 || adjust6(this.primaryColor, { h: -90 });
+    this.git6 = this.pie7 || adjust6(this.primaryColor, { h: 60 });
+    this.git7 = this.pie8 || adjust6(this.primaryColor, { h: 120 });
+    this.gitInv0 = this.gitInv0 || invert5(this.git0);
+    this.gitInv1 = this.gitInv1 || invert5(this.git1);
+    this.gitInv2 = this.gitInv2 || invert5(this.git2);
+    this.gitInv3 = this.gitInv3 || invert5(this.git3);
+    this.gitInv4 = this.gitInv4 || invert5(this.git4);
+    this.gitInv5 = this.gitInv5 || invert5(this.git5);
+    this.gitInv6 = this.gitInv6 || invert5(this.git6);
+    this.gitInv7 = this.gitInv7 || invert5(this.git7);
+    this.branchLabelColor = this.branchLabelColor || this.labelTextColor;
+    this.gitBranchLabel0 = this.branchLabelColor;
+    this.gitBranchLabel1 = "white";
+    this.gitBranchLabel2 = this.branchLabelColor;
+    this.gitBranchLabel3 = "white";
+    this.gitBranchLabel4 = this.branchLabelColor;
+    this.gitBranchLabel5 = this.branchLabelColor;
+    this.gitBranchLabel6 = this.branchLabelColor;
+    this.gitBranchLabel7 = this.branchLabelColor;
+    this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
+    this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
+    this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
+    this.tagLabelFontSize = this.tagLabelFontSize || "10px";
+    this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
+    this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
+    this.commitLabelFontSize = this.commitLabelFontSize || "10px";
+    this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
+    this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
+  }
+  calculate(overrides) {
+    if (typeof overrides !== "object") {
+      this.updateColors();
+      return;
+    }
+    const keys = Object.keys(overrides);
+    keys.forEach((k) => {
+      this[k] = overrides[k];
+    });
+    this.updateColors();
+    keys.forEach((k) => {
+      this[k] = overrides[k];
+    });
+  }
+};
+var getThemeVariables5 = /* @__PURE__ */ __name((userOverrides) => {
+  const theme = new Theme5();
+  theme.calculate(userOverrides);
+  return theme;
+}, "getThemeVariables");
+
+// src/themes/index.js
+var themes_default = {
+  base: {
+    getThemeVariables
+  },
+  dark: {
+    getThemeVariables: getThemeVariables2
+  },
+  default: {
+    getThemeVariables: getThemeVariables3
+  },
+  forest: {
+    getThemeVariables: getThemeVariables4
+  },
+  neutral: {
+    getThemeVariables: getThemeVariables5
+  }
+};
+
+// src/schemas/config.schema.yaml?only-defaults=true
+var config_schema_default = {
+  "flowchart": {
+    "useMaxWidth": true,
+    "titleTopMargin": 25,
+    "subGraphTitleMargin": {
+      "top": 0,
+      "bottom": 0
+    },
+    "diagramPadding": 8,
+    "htmlLabels": true,
+    "nodeSpacing": 50,
+    "rankSpacing": 50,
+    "curve": "basis",
+    "padding": 15,
+    "defaultRenderer": "dagre-wrapper",
+    "wrappingWidth": 200
+  },
+  "sequence": {
+    "useMaxWidth": true,
+    "hideUnusedParticipants": false,
+    "activationWidth": 10,
+    "diagramMarginX": 50,
+    "diagramMarginY": 10,
+    "actorMargin": 50,
+    "width": 150,
+    "height": 65,
+    "boxMargin": 10,
+    "boxTextMargin": 5,
+    "noteMargin": 10,
+    "messageMargin": 35,
+    "messageAlign": "center",
+    "mirrorActors": true,
+    "forceMenus": false,
+    "bottomMarginAdj": 1,
+    "rightAngles": false,
+    "showSequenceNumbers": false,
+    "actorFontSize": 14,
+    "actorFontFamily": '"Open Sans", sans-serif',
+    "actorFontWeight": 400,
+    "noteFontSize": 14,
+    "noteFontFamily": '"trebuchet ms", verdana, arial, sans-serif',
+    "noteFontWeight": 400,
+    "noteAlign": "center",
+    "messageFontSize": 16,
+    "messageFontFamily": '"trebuchet ms", verdana, arial, sans-serif',
+    "messageFontWeight": 400,
+    "wrap": false,
+    "wrapPadding": 10,
+    "labelBoxWidth": 50,
+    "labelBoxHeight": 20
+  },
+  "gantt": {
+    "useMaxWidth": true,
+    "titleTopMargin": 25,
+    "barHeight": 20,
+    "barGap": 4,
+    "topPadding": 50,
+    "rightPadding": 75,
+    "leftPadding": 75,
+    "gridLineStartPadding": 35,
+    "fontSize": 11,
+    "sectionFontSize": 11,
+    "numberSectionStyles": 4,
+    "axisFormat": "%Y-%m-%d",
+    "topAxis": false,
+    "displayMode": "",
+    "weekday": "sunday"
+  },
+  "journey": {
+    "useMaxWidth": true,
+    "diagramMarginX": 50,
+    "diagramMarginY": 10,
+    "leftMargin": 150,
+    "width": 150,
+    "height": 50,
+    "boxMargin": 10,
+    "boxTextMargin": 5,
+    "noteMargin": 10,
+    "messageMargin": 35,
+    "messageAlign": "center",
+    "bottomMarginAdj": 1,
+    "rightAngles": false,
+    "taskFontSize": 14,
+    "taskFontFamily": '"Open Sans", sans-serif',
+    "taskMargin": 50,
+    "activationWidth": 10,
+    "textPlacement": "fo",
+    "actorColours": [
+      "#8FBC8F",
+      "#7CFC00",
+      "#00FFFF",
+      "#20B2AA",
+      "#B0E0E6",
+      "#FFFFE0"
+    ],
+    "sectionFills": [
+      "#191970",
+      "#8B008B",
+      "#4B0082",
+      "#2F4F4F",
+      "#800000",
+      "#8B4513",
+      "#00008B"
+    ],
+    "sectionColours": [
+      "#fff"
+    ]
+  },
+  "class": {
+    "useMaxWidth": true,
+    "titleTopMargin": 25,
+    "arrowMarkerAbsolute": false,
+    "dividerMargin": 10,
+    "padding": 5,
+    "textHeight": 10,
+    "defaultRenderer": "dagre-wrapper",
+    "htmlLabels": false
+  },
+  "state": {
+    "useMaxWidth": true,
+    "titleTopMargin": 25,
+    "dividerMargin": 10,
+    "sizeUnit": 5,
+    "padding": 8,
+    "textHeight": 10,
+    "titleShift": -15,
+    "noteMargin": 10,
+    "forkWidth": 70,
+    "forkHeight": 7,
+    "miniPadding": 2,
+    "fontSizeFactor": 5.02,
+    "fontSize": 24,
+    "labelHeight": 16,
+    "edgeLengthFactor": "20",
+    "compositTitleSize": 35,
+    "radius": 5,
+    "defaultRenderer": "dagre-wrapper"
+  },
+  "er": {
+    "useMaxWidth": true,
+    "titleTopMargin": 25,
+    "diagramPadding": 20,
+    "layoutDirection": "TB",
+    "minEntityWidth": 100,
+    "minEntityHeight": 75,
+    "entityPadding": 15,
+    "stroke": "gray",
+    "fill": "honeydew",
+    "fontSize": 12
+  },
+  "pie": {
+    "useMaxWidth": true,
+    "textPosition": 0.75
+  },
+  "quadrantChart": {
+    "useMaxWidth": true,
+    "chartWidth": 500,
+    "chartHeight": 500,
+    "titleFontSize": 20,
+    "titlePadding": 10,
+    "quadrantPadding": 5,
+    "xAxisLabelPadding": 5,
+    "yAxisLabelPadding": 5,
+    "xAxisLabelFontSize": 16,
+    "yAxisLabelFontSize": 16,
+    "quadrantLabelFontSize": 16,
+    "quadrantTextTopPadding": 5,
+    "pointTextPadding": 5,
+    "pointLabelFontSize": 12,
+    "pointRadius": 5,
+    "xAxisPosition": "top",
+    "yAxisPosition": "left",
+    "quadrantInternalBorderStrokeWidth": 1,
+    "quadrantExternalBorderStrokeWidth": 2
+  },
+  "xyChart": {
+    "useMaxWidth": true,
+    "width": 700,
+    "height": 500,
+    "titleFontSize": 20,
+    "titlePadding": 10,
+    "showTitle": true,
+    "xAxis": {
+      "$ref": "#/$defs/XYChartAxisConfig",
+      "showLabel": true,
+      "labelFontSize": 14,
+      "labelPadding": 5,
+      "showTitle": true,
+      "titleFontSize": 16,
+      "titlePadding": 5,
+      "showTick": true,
+      "tickLength": 5,
+      "tickWidth": 2,
+      "showAxisLine": true,
+      "axisLineWidth": 2
+    },
+    "yAxis": {
+      "$ref": "#/$defs/XYChartAxisConfig",
+      "showLabel": true,
+      "labelFontSize": 14,
+      "labelPadding": 5,
+      "showTitle": true,
+      "titleFontSize": 16,
+      "titlePadding": 5,
+      "showTick": true,
+      "tickLength": 5,
+      "tickWidth": 2,
+      "showAxisLine": true,
+      "axisLineWidth": 2
+    },
+    "chartOrientation": "vertical",
+    "plotReservedSpacePercent": 50
+  },
+  "requirement": {
+    "useMaxWidth": true,
+    "rect_fill": "#f9f9f9",
+    "text_color": "#333",
+    "rect_border_size": "0.5px",
+    "rect_border_color": "#bbb",
+    "rect_min_width": 200,
+    "rect_min_height": 200,
+    "fontSize": 14,
+    "rect_padding": 10,
+    "line_height": 20
+  },
+  "mindmap": {
+    "useMaxWidth": true,
+    "padding": 10,
+    "maxNodeWidth": 200
+  },
+  "timeline": {
+    "useMaxWidth": true,
+    "diagramMarginX": 50,
+    "diagramMarginY": 10,
+    "leftMargin": 150,
+    "width": 150,
+    "height": 50,
+    "boxMargin": 10,
+    "boxTextMargin": 5,
+    "noteMargin": 10,
+    "messageMargin": 35,
+    "messageAlign": "center",
+    "bottomMarginAdj": 1,
+    "rightAngles": false,
+    "taskFontSize": 14,
+    "taskFontFamily": '"Open Sans", sans-serif',
+    "taskMargin": 50,
+    "activationWidth": 10,
+    "textPlacement": "fo",
+    "actorColours": [
+      "#8FBC8F",
+      "#7CFC00",
+      "#00FFFF",
+      "#20B2AA",
+      "#B0E0E6",
+      "#FFFFE0"
+    ],
+    "sectionFills": [
+      "#191970",
+      "#8B008B",
+      "#4B0082",
+      "#2F4F4F",
+      "#800000",
+      "#8B4513",
+      "#00008B"
+    ],
+    "sectionColours": [
+      "#fff"
+    ],
+    "disableMulticolor": false
+  },
+  "gitGraph": {
+    "useMaxWidth": true,
+    "titleTopMargin": 25,
+    "diagramPadding": 8,
+    "nodeLabel": {
+      "width": 75,
+      "height": 100,
+      "x": -25,
+      "y": 0
+    },
+    "mainBranchName": "main",
+    "mainBranchOrder": 0,
+    "showCommitLabel": true,
+    "showBranches": true,
+    "rotateCommitLabel": true,
+    "parallelCommits": false,
+    "arrowMarkerAbsolute": false
+  },
+  "c4": {
+    "useMaxWidth": true,
+    "diagramMarginX": 50,
+    "diagramMarginY": 10,
+    "c4ShapeMargin": 50,
+    "c4ShapePadding": 20,
+    "width": 216,
+    "height": 60,
+    "boxMargin": 10,
+    "c4ShapeInRow": 4,
+    "nextLinePaddingX": 0,
+    "c4BoundaryInRow": 2,
+    "personFontSize": 14,
+    "personFontFamily": '"Open Sans", sans-serif',
+    "personFontWeight": "normal",
+    "external_personFontSize": 14,
+    "external_personFontFamily": '"Open Sans", sans-serif',
+    "external_personFontWeight": "normal",
+    "systemFontSize": 14,
+    "systemFontFamily": '"Open Sans", sans-serif',
+    "systemFontWeight": "normal",
+    "external_systemFontSize": 14,
+    "external_systemFontFamily": '"Open Sans", sans-serif',
+    "external_systemFontWeight": "normal",
+    "system_dbFontSize": 14,
+    "system_dbFontFamily": '"Open Sans", sans-serif',
+    "system_dbFontWeight": "normal",
+    "external_system_dbFontSize": 14,
+    "external_system_dbFontFamily": '"Open Sans", sans-serif',
+    "external_system_dbFontWeight": "normal",
+    "system_queueFontSize": 14,
+    "system_queueFontFamily": '"Open Sans", sans-serif',
+    "system_queueFontWeight": "normal",
+    "external_system_queueFontSize": 14,
+    "external_system_queueFontFamily": '"Open Sans", sans-serif',
+    "external_system_queueFontWeight": "normal",
+    "boundaryFontSize": 14,
+    "boundaryFontFamily": '"Open Sans", sans-serif',
+    "boundaryFontWeight": "normal",
+    "messageFontSize": 12,
+    "messageFontFamily": '"Open Sans", sans-serif',
+    "messageFontWeight": "normal",
+    "containerFontSize": 14,
+    "containerFontFamily": '"Open Sans", sans-serif',
+    "containerFontWeight": "normal",
+    "external_containerFontSize": 14,
+    "external_containerFontFamily": '"Open Sans", sans-serif',
+    "external_containerFontWeight": "normal",
+    "container_dbFontSize": 14,
+    "container_dbFontFamily": '"Open Sans", sans-serif',
+    "container_dbFontWeight": "normal",
+    "external_container_dbFontSize": 14,
+    "external_container_dbFontFamily": '"Open Sans", sans-serif',
+    "external_container_dbFontWeight": "normal",
+    "container_queueFontSize": 14,
+    "container_queueFontFamily": '"Open Sans", sans-serif',
+    "container_queueFontWeight": "normal",
+    "external_container_queueFontSize": 14,
+    "external_container_queueFontFamily": '"Open Sans", sans-serif',
+    "external_container_queueFontWeight": "normal",
+    "componentFontSize": 14,
+    "componentFontFamily": '"Open Sans", sans-serif',
+    "componentFontWeight": "normal",
+    "external_componentFontSize": 14,
+    "external_componentFontFamily": '"Open Sans", sans-serif',
+    "external_componentFontWeight": "normal",
+    "component_dbFontSize": 14,
+    "component_dbFontFamily": '"Open Sans", sans-serif',
+    "component_dbFontWeight": "normal",
+    "external_component_dbFontSize": 14,
+    "external_component_dbFontFamily": '"Open Sans", sans-serif',
+    "external_component_dbFontWeight": "normal",
+    "component_queueFontSize": 14,
+    "component_queueFontFamily": '"Open Sans", sans-serif',
+    "component_queueFontWeight": "normal",
+    "external_component_queueFontSize": 14,
+    "external_component_queueFontFamily": '"Open Sans", sans-serif',
+    "external_component_queueFontWeight": "normal",
+    "wrap": true,
+    "wrapPadding": 10,
+    "person_bg_color": "#08427B",
+    "person_border_color": "#073B6F",
+    "external_person_bg_color": "#686868",
+    "external_person_border_color": "#8A8A8A",
+    "system_bg_color": "#1168BD",
+    "system_border_color": "#3C7FC0",
+    "system_db_bg_color": "#1168BD",
+    "system_db_border_color": "#3C7FC0",
+    "system_queue_bg_color": "#1168BD",
+    "system_queue_border_color": "#3C7FC0",
+    "external_system_bg_color": "#999999",
+    "external_system_border_color": "#8A8A8A",
+    "external_system_db_bg_color": "#999999",
+    "external_system_db_border_color": "#8A8A8A",
+    "external_system_queue_bg_color": "#999999",
+    "external_system_queue_border_color": "#8A8A8A",
+    "container_bg_color": "#438DD5",
+    "container_border_color": "#3C7FC0",
+    "container_db_bg_color": "#438DD5",
+    "container_db_border_color": "#3C7FC0",
+    "container_queue_bg_color": "#438DD5",
+    "container_queue_border_color": "#3C7FC0",
+    "external_container_bg_color": "#B3B3B3",
+    "external_container_border_color": "#A6A6A6",
+    "external_container_db_bg_color": "#B3B3B3",
+    "external_container_db_border_color": "#A6A6A6",
+    "external_container_queue_bg_color": "#B3B3B3",
+    "external_container_queue_border_color": "#A6A6A6",
+    "component_bg_color": "#85BBF0",
+    "component_border_color": "#78A8D8",
+    "component_db_bg_color": "#85BBF0",
+    "component_db_border_color": "#78A8D8",
+    "component_queue_bg_color": "#85BBF0",
+    "component_queue_border_color": "#78A8D8",
+    "external_component_bg_color": "#CCCCCC",
+    "external_component_border_color": "#BFBFBF",
+    "external_component_db_bg_color": "#CCCCCC",
+    "external_component_db_border_color": "#BFBFBF",
+    "external_component_queue_bg_color": "#CCCCCC",
+    "external_component_queue_border_color": "#BFBFBF"
+  },
+  "sankey": {
+    "useMaxWidth": true,
+    "width": 600,
+    "height": 400,
+    "linkColor": "gradient",
+    "nodeAlignment": "justify",
+    "showValues": true,
+    "prefix": "",
+    "suffix": ""
+  },
+  "block": {
+    "useMaxWidth": true,
+    "padding": 8
+  },
+  "packet": {
+    "useMaxWidth": true,
+    "rowHeight": 32,
+    "bitWidth": 32,
+    "bitsPerRow": 32,
+    "showBits": true,
+    "paddingX": 5,
+    "paddingY": 5
+  },
+  "theme": "default",
+  "look": "classic",
+  "handDrawnSeed": 0,
+  "layout": "dagre",
+  "maxTextSize": 5e4,
+  "maxEdges": 500,
+  "darkMode": false,
+  "fontFamily": '"trebuchet ms", verdana, arial, sans-serif;',
+  "logLevel": 5,
+  "securityLevel": "strict",
+  "startOnLoad": true,
+  "arrowMarkerAbsolute": false,
+  "secure": [
+    "secure",
+    "securityLevel",
+    "startOnLoad",
+    "maxTextSize",
+    "suppressErrorRendering",
+    "maxEdges"
+  ],
+  "legacyMathML": false,
+  "forceLegacyMathML": false,
+  "deterministicIds": false,
+  "fontSize": 16,
+  "markdownAutoWrap": true,
+  "suppressErrorRendering": false
+};
+
+// src/defaultConfig.ts
+var config = {
+  ...config_schema_default,
+  // Set, even though they're `undefined` so that `configKeys` finds these keys
+  // TODO: Should we replace these with `null` so that they can go in the JSON Schema?
+  deterministicIDSeed: void 0,
+  elk: {
+    mergeEdges: false,
+    nodePlacementStrategy: "SIMPLE"
+  },
+  themeCSS: void 0,
+  // add non-JSON default config values
+  themeVariables: themes_default.default.getThemeVariables(),
+  sequence: {
+    ...config_schema_default.sequence,
+    messageFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.messageFontFamily,
+        fontSize: this.messageFontSize,
+        fontWeight: this.messageFontWeight
+      };
+    }, "messageFont"),
+    noteFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.noteFontFamily,
+        fontSize: this.noteFontSize,
+        fontWeight: this.noteFontWeight
+      };
+    }, "noteFont"),
+    actorFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.actorFontFamily,
+        fontSize: this.actorFontSize,
+        fontWeight: this.actorFontWeight
+      };
+    }, "actorFont")
+  },
+  gantt: {
+    ...config_schema_default.gantt,
+    tickInterval: void 0,
+    useWidth: void 0
+    // can probably be removed since `configKeys` already includes this
+  },
+  c4: {
+    ...config_schema_default.c4,
+    useWidth: void 0,
+    personFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.personFontFamily,
+        fontSize: this.personFontSize,
+        fontWeight: this.personFontWeight
+      };
+    }, "personFont"),
+    external_personFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.external_personFontFamily,
+        fontSize: this.external_personFontSize,
+        fontWeight: this.external_personFontWeight
+      };
+    }, "external_personFont"),
+    systemFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.systemFontFamily,
+        fontSize: this.systemFontSize,
+        fontWeight: this.systemFontWeight
+      };
+    }, "systemFont"),
+    external_systemFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.external_systemFontFamily,
+        fontSize: this.external_systemFontSize,
+        fontWeight: this.external_systemFontWeight
+      };
+    }, "external_systemFont"),
+    system_dbFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.system_dbFontFamily,
+        fontSize: this.system_dbFontSize,
+        fontWeight: this.system_dbFontWeight
+      };
+    }, "system_dbFont"),
+    external_system_dbFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.external_system_dbFontFamily,
+        fontSize: this.external_system_dbFontSize,
+        fontWeight: this.external_system_dbFontWeight
+      };
+    }, "external_system_dbFont"),
+    system_queueFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.system_queueFontFamily,
+        fontSize: this.system_queueFontSize,
+        fontWeight: this.system_queueFontWeight
+      };
+    }, "system_queueFont"),
+    external_system_queueFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.external_system_queueFontFamily,
+        fontSize: this.external_system_queueFontSize,
+        fontWeight: this.external_system_queueFontWeight
+      };
+    }, "external_system_queueFont"),
+    containerFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.containerFontFamily,
+        fontSize: this.containerFontSize,
+        fontWeight: this.containerFontWeight
+      };
+    }, "containerFont"),
+    external_containerFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.external_containerFontFamily,
+        fontSize: this.external_containerFontSize,
+        fontWeight: this.external_containerFontWeight
+      };
+    }, "external_containerFont"),
+    container_dbFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.container_dbFontFamily,
+        fontSize: this.container_dbFontSize,
+        fontWeight: this.container_dbFontWeight
+      };
+    }, "container_dbFont"),
+    external_container_dbFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.external_container_dbFontFamily,
+        fontSize: this.external_container_dbFontSize,
+        fontWeight: this.external_container_dbFontWeight
+      };
+    }, "external_container_dbFont"),
+    container_queueFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.container_queueFontFamily,
+        fontSize: this.container_queueFontSize,
+        fontWeight: this.container_queueFontWeight
+      };
+    }, "container_queueFont"),
+    external_container_queueFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.external_container_queueFontFamily,
+        fontSize: this.external_container_queueFontSize,
+        fontWeight: this.external_container_queueFontWeight
+      };
+    }, "external_container_queueFont"),
+    componentFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.componentFontFamily,
+        fontSize: this.componentFontSize,
+        fontWeight: this.componentFontWeight
+      };
+    }, "componentFont"),
+    external_componentFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.external_componentFontFamily,
+        fontSize: this.external_componentFontSize,
+        fontWeight: this.external_componentFontWeight
+      };
+    }, "external_componentFont"),
+    component_dbFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.component_dbFontFamily,
+        fontSize: this.component_dbFontSize,
+        fontWeight: this.component_dbFontWeight
+      };
+    }, "component_dbFont"),
+    external_component_dbFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.external_component_dbFontFamily,
+        fontSize: this.external_component_dbFontSize,
+        fontWeight: this.external_component_dbFontWeight
+      };
+    }, "external_component_dbFont"),
+    component_queueFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.component_queueFontFamily,
+        fontSize: this.component_queueFontSize,
+        fontWeight: this.component_queueFontWeight
+      };
+    }, "component_queueFont"),
+    external_component_queueFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.external_component_queueFontFamily,
+        fontSize: this.external_component_queueFontSize,
+        fontWeight: this.external_component_queueFontWeight
+      };
+    }, "external_component_queueFont"),
+    boundaryFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.boundaryFontFamily,
+        fontSize: this.boundaryFontSize,
+        fontWeight: this.boundaryFontWeight
+      };
+    }, "boundaryFont"),
+    messageFont: /* @__PURE__ */ __name(function() {
+      return {
+        fontFamily: this.messageFontFamily,
+        fontSize: this.messageFontSize,
+        fontWeight: this.messageFontWeight
+      };
+    }, "messageFont")
+  },
+  pie: {
+    ...config_schema_default.pie,
+    useWidth: 984
+  },
+  xyChart: {
+    ...config_schema_default.xyChart,
+    useWidth: void 0
+  },
+  requirement: {
+    ...config_schema_default.requirement,
+    useWidth: void 0
+  },
+  packet: {
+    ...config_schema_default.packet
+  }
+};
+var keyify = /* @__PURE__ */ __name((obj, prefix = "") => Object.keys(obj).reduce((res, el) => {
+  if (Array.isArray(obj[el])) {
+    return res;
+  } else if (typeof obj[el] === "object" && obj[el] !== null) {
+    return [...res, prefix + el, ...keyify(obj[el], "")];
+  }
+  return [...res, prefix + el];
+}, []), "keyify");
+var configKeys = new Set(keyify(config, ""));
+var defaultConfig_default = config;
+
+// src/utils/sanitizeDirective.ts
+var sanitizeDirective = /* @__PURE__ */ __name((args) => {
+  log.debug("sanitizeDirective called with", args);
+  if (typeof args !== "object" || args == null) {
+    return;
+  }
+  if (Array.isArray(args)) {
+    args.forEach((arg) => sanitizeDirective(arg));
+    return;
+  }
+  for (const key of Object.keys(args)) {
+    log.debug("Checking key", key);
+    if (key.startsWith("__") || key.includes("proto") || key.includes("constr") || !configKeys.has(key) || args[key] == null) {
+      log.debug("sanitize deleting key: ", key);
+      delete args[key];
+      continue;
+    }
+    if (typeof args[key] === "object") {
+      log.debug("sanitizing object", key);
+      sanitizeDirective(args[key]);
+      continue;
+    }
+    const cssMatchers = ["themeCSS", "fontFamily", "altFontFamily"];
+    for (const cssKey of cssMatchers) {
+      if (key.includes(cssKey)) {
+        log.debug("sanitizing css option", key);
+        args[key] = sanitizeCss(args[key]);
+      }
+    }
+  }
+  if (args.themeVariables) {
+    for (const k of Object.keys(args.themeVariables)) {
+      const val = args.themeVariables[k];
+      if (val?.match && !val.match(/^[\d "#%(),.;A-Za-z]+$/)) {
+        args.themeVariables[k] = "";
+      }
+    }
+  }
+  log.debug("After sanitization", args);
+}, "sanitizeDirective");
+var sanitizeCss = /* @__PURE__ */ __name((str) => {
+  let startCnt = 0;
+  let endCnt = 0;
+  for (const element of str) {
+    if (startCnt < endCnt) {
+      return "{ /* ERROR: Unbalanced CSS */ }";
+    }
+    if (element === "{") {
+      startCnt++;
+    } else if (element === "}") {
+      endCnt++;
+    }
+  }
+  if (startCnt !== endCnt) {
+    return "{ /* ERROR: Unbalanced CSS */ }";
+  }
+  return str;
+}, "sanitizeCss");
+
+// src/config.ts
+var defaultConfig = Object.freeze(defaultConfig_default);
+var siteConfig = assignWithDepth_default({}, defaultConfig);
+var configFromInitialize;
+var directives = [];
+var currentConfig = assignWithDepth_default({}, defaultConfig);
+var updateCurrentConfig = /* @__PURE__ */ __name((siteCfg, _directives) => {
+  let cfg = assignWithDepth_default({}, siteCfg);
+  let sumOfDirectives = {};
+  for (const d of _directives) {
+    sanitize(d);
+    sumOfDirectives = assignWithDepth_default(sumOfDirectives, d);
+  }
+  cfg = assignWithDepth_default(cfg, sumOfDirectives);
+  if (sumOfDirectives.theme && sumOfDirectives.theme in themes_default) {
+    const tmpConfigFromInitialize = assignWithDepth_default({}, configFromInitialize);
+    const themeVariables = assignWithDepth_default(
+      tmpConfigFromInitialize.themeVariables || {},
+      sumOfDirectives.themeVariables
+    );
+    if (cfg.theme && cfg.theme in themes_default) {
+      cfg.themeVariables = themes_default[cfg.theme].getThemeVariables(themeVariables);
+    }
+  }
+  currentConfig = cfg;
+  checkConfig(currentConfig);
+  return currentConfig;
+}, "updateCurrentConfig");
+var setSiteConfig = /* @__PURE__ */ __name((conf) => {
+  siteConfig = assignWithDepth_default({}, defaultConfig);
+  siteConfig = assignWithDepth_default(siteConfig, conf);
+  if (conf.theme && themes_default[conf.theme]) {
+    siteConfig.themeVariables = themes_default[conf.theme].getThemeVariables(conf.themeVariables);
+  }
+  updateCurrentConfig(siteConfig, directives);
+  return siteConfig;
+}, "setSiteConfig");
+var saveConfigFromInitialize = /* @__PURE__ */ __name((conf) => {
+  configFromInitialize = assignWithDepth_default({}, conf);
+}, "saveConfigFromInitialize");
+var updateSiteConfig = /* @__PURE__ */ __name((conf) => {
+  siteConfig = assignWithDepth_default(siteConfig, conf);
+  updateCurrentConfig(siteConfig, directives);
+  return siteConfig;
+}, "updateSiteConfig");
+var getSiteConfig = /* @__PURE__ */ __name(() => {
+  return assignWithDepth_default({}, siteConfig);
+}, "getSiteConfig");
+var setConfig = /* @__PURE__ */ __name((conf) => {
+  checkConfig(conf);
+  assignWithDepth_default(currentConfig, conf);
+  return getConfig();
+}, "setConfig");
+var getConfig = /* @__PURE__ */ __name(() => {
+  return assignWithDepth_default({}, currentConfig);
+}, "getConfig");
+var sanitize = /* @__PURE__ */ __name((options) => {
+  if (!options) {
+    return;
+  }
+  ["secure", ...siteConfig.secure ?? []].forEach((key) => {
+    if (Object.hasOwn(options, key)) {
+      log.debug(`Denied attempt to modify a secure key ${key}`, options[key]);
+      delete options[key];
+    }
+  });
+  Object.keys(options).forEach((key) => {
+    if (key.startsWith("__")) {
+      delete options[key];
+    }
+  });
+  Object.keys(options).forEach((key) => {
+    if (typeof options[key] === "string" && (options[key].includes("<") || options[key].includes(">") || options[key].includes("url(data:"))) {
+      delete options[key];
+    }
+    if (typeof options[key] === "object") {
+      sanitize(options[key]);
+    }
+  });
+}, "sanitize");
+var addDirective = /* @__PURE__ */ __name((directive) => {
+  sanitizeDirective(directive);
+  if (directive.fontFamily && !directive.themeVariables?.fontFamily) {
+    directive.themeVariables = {
+      ...directive.themeVariables,
+      fontFamily: directive.fontFamily
+    };
+  }
+  directives.push(directive);
+  updateCurrentConfig(siteConfig, directives);
+}, "addDirective");
+var reset = /* @__PURE__ */ __name((config2 = siteConfig) => {
+  directives = [];
+  updateCurrentConfig(config2, directives);
+}, "reset");
+var ConfigWarning = {
+  LAZY_LOAD_DEPRECATED: "The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead."
+};
+var issuedWarnings = {};
+var issueWarning = /* @__PURE__ */ __name((warning) => {
+  if (issuedWarnings[warning]) {
+    return;
+  }
+  log.warn(ConfigWarning[warning]);
+  issuedWarnings[warning] = true;
+}, "issueWarning");
+var checkConfig = /* @__PURE__ */ __name((config2) => {
+  if (!config2) {
+    return;
+  }
+  if (config2.lazyLoadedDiagrams || config2.loadExternalDiagramsAtStartup) {
+    issueWarning("LAZY_LOAD_DEPRECATED");
+  }
+}, "checkConfig");
+
+// src/diagrams/common/common.ts
+import DOMPurify from "dompurify";
+var lineBreakRegex = /<br\s*\/?>/gi;
+var getRows = /* @__PURE__ */ __name((s) => {
+  if (!s) {
+    return [""];
+  }
+  const str = breakToPlaceholder(s).replace(/\\n/g, "#br#");
+  return str.split("#br#");
+}, "getRows");
+var setupDompurifyHooksIfNotSetup = /* @__PURE__ */ (() => {
+  let setup = false;
+  return () => {
+    if (!setup) {
+      setupDompurifyHooks();
+      setup = true;
+    }
+  };
+})();
+function setupDompurifyHooks() {
+  const TEMPORARY_ATTRIBUTE = "data-temp-href-target";
+  DOMPurify.addHook("beforeSanitizeAttributes", (node) => {
+    if (node.tagName === "A" && node.hasAttribute("target")) {
+      node.setAttribute(TEMPORARY_ATTRIBUTE, node.getAttribute("target") ?? "");
+    }
+  });
+  DOMPurify.addHook("afterSanitizeAttributes", (node) => {
+    if (node.tagName === "A" && node.hasAttribute(TEMPORARY_ATTRIBUTE)) {
+      node.setAttribute("target", node.getAttribute(TEMPORARY_ATTRIBUTE) ?? "");
+      node.removeAttribute(TEMPORARY_ATTRIBUTE);
+      if (node.getAttribute("target") === "_blank") {
+        node.setAttribute("rel", "noopener");
+      }
+    }
+  });
+}
+__name(setupDompurifyHooks, "setupDompurifyHooks");
+var removeScript = /* @__PURE__ */ __name((txt) => {
+  setupDompurifyHooksIfNotSetup();
+  const sanitizedText = DOMPurify.sanitize(txt);
+  return sanitizedText;
+}, "removeScript");
+var sanitizeMore = /* @__PURE__ */ __name((text, config2) => {
+  if (config2.flowchart?.htmlLabels !== false) {
+    const level = config2.securityLevel;
+    if (level === "antiscript" || level === "strict") {
+      text = removeScript(text);
+    } else if (level !== "loose") {
+      text = breakToPlaceholder(text);
+      text = text.replace(/</g, "&lt;").replace(/>/g, "&gt;");
+      text = text.replace(/=/g, "&equals;");
+      text = placeholderToBreak(text);
+    }
+  }
+  return text;
+}, "sanitizeMore");
+var sanitizeText = /* @__PURE__ */ __name((text, config2) => {
+  if (!text) {
+    return text;
+  }
+  if (config2.dompurifyConfig) {
+    text = DOMPurify.sanitize(sanitizeMore(text, config2), config2.dompurifyConfig).toString();
+  } else {
+    text = DOMPurify.sanitize(sanitizeMore(text, config2), {
+      FORBID_TAGS: ["style"]
+    }).toString();
+  }
+  return text;
+}, "sanitizeText");
+var sanitizeTextOrArray = /* @__PURE__ */ __name((a, config2) => {
+  if (typeof a === "string") {
+    return sanitizeText(a, config2);
+  }
+  return a.flat().map((x) => sanitizeText(x, config2));
+}, "sanitizeTextOrArray");
+var hasBreaks = /* @__PURE__ */ __name((text) => {
+  return lineBreakRegex.test(text);
+}, "hasBreaks");
+var splitBreaks = /* @__PURE__ */ __name((text) => {
+  return text.split(lineBreakRegex);
+}, "splitBreaks");
+var placeholderToBreak = /* @__PURE__ */ __name((s) => {
+  return s.replace(/#br#/g, "<br/>");
+}, "placeholderToBreak");
+var breakToPlaceholder = /* @__PURE__ */ __name((s) => {
+  return s.replace(lineBreakRegex, "#br#");
+}, "breakToPlaceholder");
+var getUrl = /* @__PURE__ */ __name((useAbsolute) => {
+  let url = "";
+  if (useAbsolute) {
+    url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
+    url = url.replaceAll(/\(/g, "\\(");
+    url = url.replaceAll(/\)/g, "\\)");
+  }
+  return url;
+}, "getUrl");
+var evaluate = /* @__PURE__ */ __name((val) => val === false || ["false", "null", "0"].includes(String(val).trim().toLowerCase()) ? false : true, "evaluate");
+var getMax = /* @__PURE__ */ __name(function(...values) {
+  const newValues = values.filter((value) => {
+    return !isNaN(value);
+  });
+  return Math.max(...newValues);
+}, "getMax");
+var getMin = /* @__PURE__ */ __name(function(...values) {
+  const newValues = values.filter((value) => {
+    return !isNaN(value);
+  });
+  return Math.min(...newValues);
+}, "getMin");
+var parseGenericTypes = /* @__PURE__ */ __name(function(input) {
+  const inputSets = input.split(/(,)/);
+  const output = [];
+  for (let i = 0; i < inputSets.length; i++) {
+    let thisSet = inputSets[i];
+    if (thisSet === "," && i > 0 && i + 1 < inputSets.length) {
+      const previousSet = inputSets[i - 1];
+      const nextSet = inputSets[i + 1];
+      if (shouldCombineSets(previousSet, nextSet)) {
+        thisSet = previousSet + "," + nextSet;
+        i++;
+        output.pop();
+      }
+    }
+    output.push(processSet(thisSet));
+  }
+  return output.join("");
+}, "parseGenericTypes");
+var countOccurrence = /* @__PURE__ */ __name((string, substring) => {
+  return Math.max(0, string.split(substring).length - 1);
+}, "countOccurrence");
+var shouldCombineSets = /* @__PURE__ */ __name((previousSet, nextSet) => {
+  const prevCount = countOccurrence(previousSet, "~");
+  const nextCount = countOccurrence(nextSet, "~");
+  return prevCount === 1 && nextCount === 1;
+}, "shouldCombineSets");
+var processSet = /* @__PURE__ */ __name((input) => {
+  const tildeCount = countOccurrence(input, "~");
+  let hasStartingTilde = false;
+  if (tildeCount <= 1) {
+    return input;
+  }
+  if (tildeCount % 2 !== 0 && input.startsWith("~")) {
+    input = input.substring(1);
+    hasStartingTilde = true;
+  }
+  const chars = [...input];
+  let first = chars.indexOf("~");
+  let last = chars.lastIndexOf("~");
+  while (first !== -1 && last !== -1 && first !== last) {
+    chars[first] = "<";
+    chars[last] = ">";
+    first = chars.indexOf("~");
+    last = chars.lastIndexOf("~");
+  }
+  if (hasStartingTilde) {
+    chars.unshift("~");
+  }
+  return chars.join("");
+}, "processSet");
+var isMathMLSupported = /* @__PURE__ */ __name(() => window.MathMLElement !== void 0, "isMathMLSupported");
+var katexRegex = /\$\$(.*)\$\$/g;
+var hasKatex = /* @__PURE__ */ __name((text) => (text.match(katexRegex)?.length ?? 0) > 0, "hasKatex");
+var calculateMathMLDimensions = /* @__PURE__ */ __name(async (text, config2) => {
+  text = await renderKatex(text, config2);
+  const divElem = document.createElement("div");
+  divElem.innerHTML = text;
+  divElem.id = "katex-temp";
+  divElem.style.visibility = "hidden";
+  divElem.style.position = "absolute";
+  divElem.style.top = "0";
+  const body = document.querySelector("body");
+  body?.insertAdjacentElement("beforeend", divElem);
+  const dim = { width: divElem.clientWidth, height: divElem.clientHeight };
+  divElem.remove();
+  return dim;
+}, "calculateMathMLDimensions");
+var renderKatex = /* @__PURE__ */ __name(async (text, config2) => {
+  if (!hasKatex(text)) {
+    return text;
+  }
+  if (!(isMathMLSupported() || config2.legacyMathML || config2.forceLegacyMathML)) {
+    return text.replace(katexRegex, "MathML is unsupported in this environment.");
+  }
+  const { default: katex } = await import("katex");
+  const outputMode = config2.forceLegacyMathML || !isMathMLSupported() && config2.legacyMathML ? "htmlAndMathml" : "mathml";
+  return text.split(lineBreakRegex).map(
+    (line) => hasKatex(line) ? `<div style="display: flex; align-items: center; justify-content: center; white-space: nowrap;">${line}</div>` : `<div>${line}</div>`
+  ).join("").replace(
+    katexRegex,
+    (_, c) => katex.renderToString(c, {
+      throwOnError: true,
+      displayMode: true,
+      output: outputMode
+    }).replace(/\n/g, " ").replace(/<annotation.*<\/annotation>/g, "")
+  );
+}, "renderKatex");
+var common_default = {
+  getRows,
+  sanitizeText,
+  sanitizeTextOrArray,
+  hasBreaks,
+  splitBreaks,
+  lineBreakRegex,
+  removeScript,
+  getUrl,
+  evaluate,
+  getMax,
+  getMin
+};
+
+// src/setupGraphViewbox.js
+var d3Attrs = /* @__PURE__ */ __name(function(d3Elem, attrs) {
+  for (let attr of attrs) {
+    d3Elem.attr(attr[0], attr[1]);
+  }
+}, "d3Attrs");
+var calculateSvgSizeAttrs = /* @__PURE__ */ __name(function(height, width, useMaxWidth) {
+  let attrs = /* @__PURE__ */ new Map();
+  if (useMaxWidth) {
+    attrs.set("width", "100%");
+    attrs.set("style", `max-width: ${width}px;`);
+  } else {
+    attrs.set("height", height);
+    attrs.set("width", width);
+  }
+  return attrs;
+}, "calculateSvgSizeAttrs");
+var configureSvgSize = /* @__PURE__ */ __name(function(svgElem, height, width, useMaxWidth) {
+  const attrs = calculateSvgSizeAttrs(height, width, useMaxWidth);
+  d3Attrs(svgElem, attrs);
+}, "configureSvgSize");
+var setupGraphViewbox = /* @__PURE__ */ __name(function(graph, svgElem, padding, useMaxWidth) {
+  const svgBounds = svgElem.node().getBBox();
+  const sWidth = svgBounds.width;
+  const sHeight = svgBounds.height;
+  log.info(`SVG bounds: ${sWidth}x${sHeight}`, svgBounds);
+  let width = 0;
+  let height = 0;
+  log.info(`Graph bounds: ${width}x${height}`, graph);
+  width = sWidth + padding * 2;
+  height = sHeight + padding * 2;
+  log.info(`Calculated bounds: ${width}x${height}`);
+  configureSvgSize(svgElem, height, width, useMaxWidth);
+  const vBox = `${svgBounds.x - padding} ${svgBounds.y - padding} ${svgBounds.width + 2 * padding} ${svgBounds.height + 2 * padding}`;
+  svgElem.attr("viewBox", vBox);
+}, "setupGraphViewbox");
+
+// src/styles.ts
+var themes = {};
+var getStyles = /* @__PURE__ */ __name((type, userStyles, options) => {
+  let diagramStyles = "";
+  if (type in themes && themes[type]) {
+    diagramStyles = themes[type](options);
+  } else {
+    log.warn(`No theme found for ${type}`);
+  }
+  return ` & {
+    font-family: ${options.fontFamily};
+    font-size: ${options.fontSize};
+    fill: ${options.textColor}
+  }
+
+  /* Classes common for multiple diagrams */
+
+  & .error-icon {
+    fill: ${options.errorBkgColor};
+  }
+  & .error-text {
+    fill: ${options.errorTextColor};
+    stroke: ${options.errorTextColor};
+  }
+
+  & .edge-thickness-normal {
+    stroke-width: 1px;
+  }
+  & .edge-thickness-thick {
+    stroke-width: 3.5px
+  }
+  & .edge-pattern-solid {
+    stroke-dasharray: 0;
+  }
+  & .edge-thickness-invisible {
+    stroke-width: 0;
+    fill: none;
+  }
+  & .edge-pattern-dashed{
+    stroke-dasharray: 3;
+  }
+  .edge-pattern-dotted {
+    stroke-dasharray: 2;
+  }
+
+  & .marker {
+    fill: ${options.lineColor};
+    stroke: ${options.lineColor};
+  }
+  & .marker.cross {
+    stroke: ${options.lineColor};
+  }
+
+  & svg {
+    font-family: ${options.fontFamily};
+    font-size: ${options.fontSize};
+  }
+   & p {
+    margin: 0
+   }
+
+  ${diagramStyles}
+
+  ${userStyles}
+`;
+}, "getStyles");
+var addStylesForDiagram = /* @__PURE__ */ __name((type, diagramTheme) => {
+  if (diagramTheme !== void 0) {
+    themes[type] = diagramTheme;
+  }
+}, "addStylesForDiagram");
+var styles_default = getStyles;
+
+// src/diagrams/common/commonDb.ts
+var commonDb_exports = {};
+__export(commonDb_exports, {
+  clear: () => clear,
+  getAccDescription: () => getAccDescription,
+  getAccTitle: () => getAccTitle,
+  getDiagramTitle: () => getDiagramTitle,
+  setAccDescription: () => setAccDescription,
+  setAccTitle: () => setAccTitle,
+  setDiagramTitle: () => setDiagramTitle
+});
+var accTitle = "";
+var diagramTitle = "";
+var accDescription = "";
+var sanitizeText2 = /* @__PURE__ */ __name((txt) => sanitizeText(txt, getConfig()), "sanitizeText");
+var clear = /* @__PURE__ */ __name(() => {
+  accTitle = "";
+  accDescription = "";
+  diagramTitle = "";
+}, "clear");
+var setAccTitle = /* @__PURE__ */ __name((txt) => {
+  accTitle = sanitizeText2(txt).replace(/^\s+/g, "");
+}, "setAccTitle");
+var getAccTitle = /* @__PURE__ */ __name(() => accTitle, "getAccTitle");
+var setAccDescription = /* @__PURE__ */ __name((txt) => {
+  accDescription = sanitizeText2(txt).replace(/\n\s+/g, "\n");
+}, "setAccDescription");
+var getAccDescription = /* @__PURE__ */ __name(() => accDescription, "getAccDescription");
+var setDiagramTitle = /* @__PURE__ */ __name((txt) => {
+  diagramTitle = sanitizeText2(txt);
+}, "setDiagramTitle");
+var getDiagramTitle = /* @__PURE__ */ __name(() => diagramTitle, "getDiagramTitle");
+
+// src/diagram-api/diagramAPI.ts
+var log2 = log;
+var setLogLevel2 = setLogLevel;
+var getConfig2 = getConfig;
+var setConfig2 = setConfig;
+var defaultConfig2 = defaultConfig;
+var sanitizeText3 = /* @__PURE__ */ __name((text) => sanitizeText(text, getConfig2()), "sanitizeText");
+var setupGraphViewbox2 = setupGraphViewbox;
+var getCommonDb = /* @__PURE__ */ __name(() => {
+  return commonDb_exports;
+}, "getCommonDb");
+var diagrams = {};
+var registerDiagram = /* @__PURE__ */ __name((id, diagram, detector) => {
+  if (diagrams[id]) {
+    log2.warn(`Diagram with id ${id} already registered. Overwriting.`);
+  }
+  diagrams[id] = diagram;
+  if (detector) {
+    addDetector(id, detector);
+  }
+  addStylesForDiagram(id, diagram.styles);
+  diagram.injectUtils?.(
+    log2,
+    setLogLevel2,
+    getConfig2,
+    sanitizeText3,
+    setupGraphViewbox2,
+    getCommonDb(),
+    () => {
+    }
+  );
+}, "registerDiagram");
+var getDiagram = /* @__PURE__ */ __name((name) => {
+  if (name in diagrams) {
+    return diagrams[name];
+  }
+  throw new DiagramNotFoundError(name);
+}, "getDiagram");
+var DiagramNotFoundError = class extends Error {
+  static {
+    __name(this, "DiagramNotFoundError");
+  }
+  constructor(name) {
+    super(`Diagram ${name} not found.`);
+  }
+};
+
+export {
+  __name,
+  __export,
+  log,
+  setLogLevel,
+  frontMatterRegex,
+  directiveRegex,
+  UnknownDiagramError,
+  detectors,
+  detectType,
+  registerLazyLoadedDiagrams,
+  getDiagramLoader,
+  assignWithDepth_default,
+  getThemeVariables3 as getThemeVariables,
+  themes_default,
+  defaultConfig_default,
+  sanitizeDirective,
+  defaultConfig,
+  setSiteConfig,
+  saveConfigFromInitialize,
+  updateSiteConfig,
+  getSiteConfig,
+  setConfig,
+  getConfig,
+  addDirective,
+  reset,
+  lineBreakRegex,
+  sanitizeText,
+  evaluate,
+  parseGenericTypes,
+  hasKatex,
+  calculateMathMLDimensions,
+  renderKatex,
+  common_default,
+  configureSvgSize,
+  setupGraphViewbox,
+  styles_default,
+  clear,
+  setAccTitle,
+  getAccTitle,
+  setAccDescription,
+  getAccDescription,
+  setDiagramTitle,
+  getDiagramTitle,
+  commonDb_exports,
+  getConfig2,
+  setConfig2,
+  defaultConfig2,
+  setupGraphViewbox2,
+  registerDiagram,
+  getDiagram
+};

+ 146 - 44
nicegui/elements/lib/mermaid/createText-b3507a77.js → nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-OERGPBFJ.mjs

@@ -1,19 +1,39 @@
-import { l as log, J as decodeEntities } from "./mermaid-485fd1a4.js";
-import { fromMarkdown } from "mdast-util-from-markdown";
+import {
+  decodeEntities
+} from "./chunk-VKXSJROQ.mjs";
+import {
+  __name,
+  common_default,
+  getConfig2 as getConfig,
+  hasKatex,
+  log,
+  renderKatex
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/rendering-util/createText.ts
+import { select } from "d3";
+
+// src/rendering-util/handle-markdown-text.ts
+import { marked } from "marked";
 import { dedent } from "ts-dedent";
-function preprocessMarkdown(markdown) {
-  const withoutMultipleNewlines = markdown.replace(/\n{2,}/g, "\n");
+function preprocessMarkdown(markdown, { markdownAutoWrap }) {
+  const withoutBR = markdown.replace(/<br\/>/g, "\n");
+  const withoutMultipleNewlines = withoutBR.replace(/\n{2,}/g, "\n");
   const withoutExtraSpaces = dedent(withoutMultipleNewlines);
+  if (markdownAutoWrap === false) {
+    return withoutExtraSpaces.replace(/ /g, "&nbsp;");
+  }
   return withoutExtraSpaces;
 }
-function markdownToLines(markdown) {
-  const preprocessedMarkdown = preprocessMarkdown(markdown);
-  const { children } = fromMarkdown(preprocessedMarkdown);
+__name(preprocessMarkdown, "preprocessMarkdown");
+function markdownToLines(markdown, config = {}) {
+  const preprocessedMarkdown = preprocessMarkdown(markdown, config);
+  const nodes = marked.lexer(preprocessedMarkdown);
   const lines = [[]];
   let currentLine = 0;
   function processNode(node, parentType = "normal") {
     if (node.type === "text") {
-      const textLines = node.value.split("\n");
+      const textLines = node.text.split("\n");
       textLines.forEach((textLine, index) => {
         if (index !== 0) {
           currentLine++;
@@ -25,47 +45,66 @@ function markdownToLines(markdown) {
           }
         });
       });
-    } else if (node.type === "strong" || node.type === "emphasis") {
-      node.children.forEach((contentNode) => {
+    } else if (node.type === "strong" || node.type === "em") {
+      node.tokens.forEach((contentNode) => {
         processNode(contentNode, node.type);
       });
+    } else if (node.type === "html") {
+      lines[currentLine].push({ content: node.text, type: "normal" });
     }
   }
-  children.forEach((treeNode) => {
+  __name(processNode, "processNode");
+  nodes.forEach((treeNode) => {
     if (treeNode.type === "paragraph") {
-      treeNode.children.forEach((contentNode) => {
+      treeNode.tokens?.forEach((contentNode) => {
         processNode(contentNode);
       });
+    } else if (treeNode.type === "html") {
+      lines[currentLine].push({ content: treeNode.text, type: "normal" });
     }
   });
   return lines;
 }
-function markdownToHTML(markdown) {
-  const { children } = fromMarkdown(markdown);
+__name(markdownToLines, "markdownToLines");
+function markdownToHTML(markdown, { markdownAutoWrap } = {}) {
+  const nodes = marked.lexer(markdown);
   function output(node) {
     if (node.type === "text") {
-      return node.value.replace(/\n/g, "<br/>");
+      if (markdownAutoWrap === false) {
+        return node.text.replace(/\n */g, "<br/>").replace(/ /g, "&nbsp;");
+      }
+      return node.text.replace(/\n */g, "<br/>");
     } else if (node.type === "strong") {
-      return `<strong>${node.children.map(output).join("")}</strong>`;
-    } else if (node.type === "emphasis") {
-      return `<em>${node.children.map(output).join("")}</em>`;
+      return `<strong>${node.tokens?.map(output).join("")}</strong>`;
+    } else if (node.type === "em") {
+      return `<em>${node.tokens?.map(output).join("")}</em>`;
     } else if (node.type === "paragraph") {
-      return `<p>${node.children.map(output).join("")}</p>`;
+      return `<p>${node.tokens?.map(output).join("")}</p>`;
+    } else if (node.type === "space") {
+      return "";
+    } else if (node.type === "html") {
+      return `${node.text}`;
     }
     return `Unsupported markdown: ${node.type}`;
   }
-  return children.map(output).join("");
+  __name(output, "output");
+  return nodes.map(output).join("");
 }
+__name(markdownToHTML, "markdownToHTML");
+
+// src/rendering-util/splitText.ts
 function splitTextToChars(text) {
   if (Intl.Segmenter) {
     return [...new Intl.Segmenter().segment(text)].map((s) => s.segment);
   }
   return [...text];
 }
+__name(splitTextToChars, "splitTextToChars");
 function splitWordToFitWidth(checkFit, word) {
   const characters = splitTextToChars(word.content);
   return splitWordToFitWidthRecursion(checkFit, [], characters, word.type);
 }
+__name(splitWordToFitWidth, "splitWordToFitWidth");
 function splitWordToFitWidthRecursion(checkFit, usedChars, remainingChars, type) {
   if (remainingChars.length === 0) {
     return [
@@ -87,12 +126,14 @@ function splitWordToFitWidthRecursion(checkFit, usedChars, remainingChars, type)
     { content: remainingChars.join(""), type }
   ];
 }
+__name(splitWordToFitWidthRecursion, "splitWordToFitWidthRecursion");
 function splitLineToFitWidth(line, checkFit) {
   if (line.some(({ content }) => content.includes("\n"))) {
     throw new Error("splitLineToFitWidth does not support newlines in the line");
   }
   return splitLineToFitWidthRecursion(line, checkFit);
 }
+__name(splitLineToFitWidth, "splitLineToFitWidth");
 function splitLineToFitWidthRecursion(words, checkFit, lines = [], newLine = []) {
   if (words.length === 0) {
     if (newLine.length > 0) {
@@ -126,24 +167,33 @@ function splitLineToFitWidthRecursion(words, checkFit, lines = [], newLine = [])
   }
   return splitLineToFitWidthRecursion(words, checkFit, lines);
 }
+__name(splitLineToFitWidthRecursion, "splitLineToFitWidthRecursion");
+
+// src/rendering-util/createText.ts
 function applyStyle(dom, styleFn) {
   if (styleFn) {
     dom.attr("style", styleFn);
   }
 }
-function addHtmlSpan(element, node, width, classes, addBackground = false) {
+__name(applyStyle, "applyStyle");
+async function addHtmlSpan(element, node, width, classes, addBackground = false) {
   const fo = element.append("foreignObject");
   const div = fo.append("xhtml:div");
-  const label = node.label;
+  let label = node.label;
+  if (node.label && hasKatex(node.label)) {
+    label = await renderKatex(node.label.replace(common_default.lineBreakRegex, "\n"), getConfig());
+  }
   const labelClass = node.isNode ? "nodeLabel" : "edgeLabel";
-  div.html(
-    `
-    <span class="${labelClass} ${classes}" ` + (node.labelStyle ? 'style="' + node.labelStyle + '"' : "") + ">" + label + "</span>"
-  );
+  const span = div.append("span");
+  span.html(label);
+  applyStyle(span, node.labelStyle);
+  span.attr("class", `${labelClass} ${classes}`);
   applyStyle(div, node.labelStyle);
   div.style("display", "table-cell");
   div.style("white-space", "nowrap");
+  div.style("line-height", "1.5");
   div.style("max-width", width + "px");
+  div.style("text-align", "center");
   div.attr("xmlns", "http://www.w3.org/1999/xhtml");
   if (addBackground) {
     div.attr("class", "labelBkg");
@@ -155,13 +205,13 @@ function addHtmlSpan(element, node, width, classes, addBackground = false) {
     div.style("width", width + "px");
     bbox = div.node().getBoundingClientRect();
   }
-  fo.style("width", bbox.width);
-  fo.style("height", bbox.height);
   return fo.node();
 }
+__name(addHtmlSpan, "addHtmlSpan");
 function createTspan(textElement, lineIndex, lineHeight) {
   return textElement.append("tspan").attr("class", "text-outer-tspan").attr("x", 0).attr("y", lineIndex * lineHeight - 0.1 + "em").attr("dy", lineHeight + "em");
 }
+__name(createTspan, "createTspan");
 function computeWidthOfText(parentNode, lineHeight, line) {
   const testElement = parentNode.append("text");
   const testSpan = createTspan(testElement, 1, lineHeight);
@@ -170,14 +220,26 @@ function computeWidthOfText(parentNode, lineHeight, line) {
   testElement.remove();
   return textLength;
 }
+__name(computeWidthOfText, "computeWidthOfText");
+function computeDimensionOfText(parentNode, lineHeight, text) {
+  const testElement = parentNode.append("text");
+  const testSpan = createTspan(testElement, 1, lineHeight);
+  updateTextContentAndStyles(testSpan, [{ content: text, type: "normal" }]);
+  const textDimension = testSpan.node()?.getBoundingClientRect();
+  if (textDimension) {
+    testElement.remove();
+  }
+  return textDimension;
+}
+__name(computeDimensionOfText, "computeDimensionOfText");
 function createFormattedText(width, g, structuredText, addBackground = false) {
   const lineHeight = 1.1;
   const labelGroup = g.append("g");
-  const bkg = labelGroup.insert("rect").attr("class", "background");
+  const bkg = labelGroup.insert("rect").attr("class", "background").attr("style", "stroke: none");
   const textElement = labelGroup.append("text").attr("y", "-10.1");
   let lineIndex = 0;
   for (const line of structuredText) {
-    const checkWidth = (line2) => computeWidthOfText(labelGroup, lineHeight, line2) <= width;
+    const checkWidth = /* @__PURE__ */ __name((line2) => computeWidthOfText(labelGroup, lineHeight, line2) <= width, "checkWidth");
     const linesUnderWidth = checkWidth(line) ? [line] : splitLineToFitWidth(line, checkWidth);
     for (const preparedLine of linesUnderWidth) {
       const tspan = createTspan(textElement, lineIndex, lineHeight);
@@ -194,10 +256,11 @@ function createFormattedText(width, g, structuredText, addBackground = false) {
     return textElement.node();
   }
 }
+__name(createFormattedText, "createFormattedText");
 function updateTextContentAndStyles(tspan, wrappedLine) {
   tspan.text("");
   wrappedLine.forEach((word, index) => {
-    const innerTspan = tspan.append("tspan").attr("font-style", word.type === "emphasis" ? "italic" : "normal").attr("class", "text-inner-tspan").attr("font-weight", word.type === "strong" ? "bold" : "normal");
+    const innerTspan = tspan.append("tspan").attr("font-style", word.type === "em" ? "italic" : "normal").attr("class", "text-inner-tspan").attr("font-weight", word.type === "strong" ? "bold" : "normal");
     if (index === 0) {
       innerTspan.text(word.content);
     } else {
@@ -205,7 +268,16 @@ function updateTextContentAndStyles(tspan, wrappedLine) {
     }
   });
 }
-const createText = (el, text = "", {
+__name(updateTextContentAndStyles, "updateTextContentAndStyles");
+function replaceIconSubstring(text) {
+  return text.replace(
+    /fa[bklrs]?:fa-[\w-]+/g,
+    // cspell: disable-line
+    (s) => `<i class='${s.replace(":", " ")}'></i>`
+  );
+}
+__name(replaceIconSubstring, "replaceIconSubstring");
+var createText = /* @__PURE__ */ __name(async (el, text = "", {
   style = "",
   isTitle = false,
   classes = "",
@@ -213,26 +285,56 @@ const createText = (el, text = "", {
   isNode = true,
   width = 200,
   addSvgBackground = false
-} = {}) => {
-  log.info("createText", text, style, isTitle, classes, useHtmlLabels, isNode, addSvgBackground);
+} = {}, config) => {
+  log.info(
+    "XYZ createText",
+    text,
+    style,
+    isTitle,
+    classes,
+    useHtmlLabels,
+    isNode,
+    "addSvgBackground: ",
+    addSvgBackground
+  );
   if (useHtmlLabels) {
-    const htmlText = markdownToHTML(text);
+    const htmlText = markdownToHTML(text, config);
+    const decodedReplacedText = replaceIconSubstring(decodeEntities(htmlText));
+    const inputForKatex = text.replace(/\\\\/g, "\\");
     const node = {
       isNode,
-      label: decodeEntities(htmlText).replace(
-        /fa[blrs]?:fa-[\w-]+/g,
-        (s) => `<i class='${s.replace(":", " ")}'></i>`
-      ),
+      label: hasKatex(text) ? inputForKatex : decodedReplacedText,
       labelStyle: style.replace("fill:", "color:")
     };
-    const vertexNode = addHtmlSpan(el, node, width, classes, addSvgBackground);
+    const vertexNode = await addHtmlSpan(el, node, width, classes, addSvgBackground);
     return vertexNode;
   } else {
-    const structuredText = markdownToLines(text);
-    const svgLabel = createFormattedText(width, el, structuredText, addSvgBackground);
+    const sanitizeBR = text.replace(/<br\s*\/?>/g, "<br/>");
+    const structuredText = markdownToLines(sanitizeBR.replace("<br>", "<br/>"), config);
+    const svgLabel = createFormattedText(
+      width,
+      el,
+      structuredText,
+      text ? addSvgBackground : false
+    );
+    if (isNode) {
+      if (/stroke:/.exec(style)) {
+        style = style.replace("stroke:", "lineColor:");
+      }
+      const nodeLabelTextStyle = style.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/color:/g, "fill:");
+      select(svgLabel).attr("style", nodeLabelTextStyle);
+    } else {
+      const edgeLabelRectStyle = style.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/background:/g, "fill:");
+      select(svgLabel).select("rect").attr("style", edgeLabelRectStyle.replace(/background:/g, "fill:"));
+      const edgeLabelTextStyle = style.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/color:/g, "fill:");
+      select(svgLabel).select("text").attr("style", edgeLabelTextStyle);
+    }
     return svgLabel;
   }
-};
+}, "createText");
+
 export {
-  createText as c
+  computeDimensionOfText,
+  replaceIconSubstring,
+  createText
 };

+ 454 - 0
nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-PDCO53Z4.mjs

@@ -0,0 +1,454 @@
+import {
+  createLabel_default
+} from "./chunk-Z2VRG6XP.mjs";
+import {
+  getLineFunctionsWithOffset,
+  getSubGraphTitleMargins
+} from "./chunk-TINLTEC2.mjs";
+import {
+  createText
+} from "./chunk-OERGPBFJ.mjs";
+import {
+  utils_default
+} from "./chunk-VKXSJROQ.mjs";
+import {
+  __name,
+  evaluate,
+  getConfig2 as getConfig,
+  log
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/dagre-wrapper/markers.js
+var insertMarkers = /* @__PURE__ */ __name((elem, markerArray, type, id) => {
+  markerArray.forEach((markerName) => {
+    markers[markerName](elem, type, id);
+  });
+}, "insertMarkers");
+var extension = /* @__PURE__ */ __name((elem, type, id) => {
+  log.trace("Making markers for ", id);
+  elem.append("defs").append("marker").attr("id", id + "_" + type + "-extensionStart").attr("class", "marker extension " + type).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z");
+  elem.append("defs").append("marker").attr("id", id + "_" + type + "-extensionEnd").attr("class", "marker extension " + type).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
+}, "extension");
+var composition = /* @__PURE__ */ __name((elem, type, id) => {
+  elem.append("defs").append("marker").attr("id", id + "_" + type + "-compositionStart").attr("class", "marker composition " + type).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
+  elem.append("defs").append("marker").attr("id", id + "_" + type + "-compositionEnd").attr("class", "marker composition " + type).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
+}, "composition");
+var aggregation = /* @__PURE__ */ __name((elem, type, id) => {
+  elem.append("defs").append("marker").attr("id", id + "_" + type + "-aggregationStart").attr("class", "marker aggregation " + type).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
+  elem.append("defs").append("marker").attr("id", id + "_" + type + "-aggregationEnd").attr("class", "marker aggregation " + type).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
+}, "aggregation");
+var dependency = /* @__PURE__ */ __name((elem, type, id) => {
+  elem.append("defs").append("marker").attr("id", id + "_" + type + "-dependencyStart").attr("class", "marker dependency " + type).attr("refX", 6).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z");
+  elem.append("defs").append("marker").attr("id", id + "_" + type + "-dependencyEnd").attr("class", "marker dependency " + type).attr("refX", 13).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
+}, "dependency");
+var lollipop = /* @__PURE__ */ __name((elem, type, id) => {
+  elem.append("defs").append("marker").attr("id", id + "_" + type + "-lollipopStart").attr("class", "marker lollipop " + type).attr("refX", 13).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6);
+  elem.append("defs").append("marker").attr("id", id + "_" + type + "-lollipopEnd").attr("class", "marker lollipop " + type).attr("refX", 1).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6);
+}, "lollipop");
+var point = /* @__PURE__ */ __name((elem, type, id) => {
+  elem.append("marker").attr("id", id + "_" + type + "-pointEnd").attr("class", "marker " + type).attr("viewBox", "0 0 10 10").attr("refX", 6).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
+  elem.append("marker").attr("id", id + "_" + type + "-pointStart").attr("class", "marker " + type).attr("viewBox", "0 0 10 10").attr("refX", 4.5).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 5 L 10 10 L 10 0 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
+}, "point");
+var circle = /* @__PURE__ */ __name((elem, type, id) => {
+  elem.append("marker").attr("id", id + "_" + type + "-circleEnd").attr("class", "marker " + type).attr("viewBox", "0 0 10 10").attr("refX", 11).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
+  elem.append("marker").attr("id", id + "_" + type + "-circleStart").attr("class", "marker " + type).attr("viewBox", "0 0 10 10").attr("refX", -1).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
+}, "circle");
+var cross = /* @__PURE__ */ __name((elem, type, id) => {
+  elem.append("marker").attr("id", id + "_" + type + "-crossEnd").attr("class", "marker cross " + type).attr("viewBox", "0 0 11 11").attr("refX", 12).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0");
+  elem.append("marker").attr("id", id + "_" + type + "-crossStart").attr("class", "marker cross " + type).attr("viewBox", "0 0 11 11").attr("refX", -1).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0");
+}, "cross");
+var barb = /* @__PURE__ */ __name((elem, type, id) => {
+  elem.append("defs").append("marker").attr("id", id + "_" + type + "-barbEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 14).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
+}, "barb");
+var markers = {
+  extension,
+  composition,
+  aggregation,
+  dependency,
+  lollipop,
+  point,
+  circle,
+  cross,
+  barb
+};
+var markers_default = insertMarkers;
+
+// src/dagre-wrapper/edges.js
+import { line, curveBasis, select } from "d3";
+
+// src/dagre-wrapper/edgeMarker.ts
+var addEdgeMarkers = /* @__PURE__ */ __name((svgPath, edge, url, id, diagramType) => {
+  if (edge.arrowTypeStart) {
+    addEdgeMarker(svgPath, "start", edge.arrowTypeStart, url, id, diagramType);
+  }
+  if (edge.arrowTypeEnd) {
+    addEdgeMarker(svgPath, "end", edge.arrowTypeEnd, url, id, diagramType);
+  }
+}, "addEdgeMarkers");
+var arrowTypesMap = {
+  arrow_cross: "cross",
+  arrow_point: "point",
+  arrow_barb: "barb",
+  arrow_circle: "circle",
+  aggregation: "aggregation",
+  extension: "extension",
+  composition: "composition",
+  dependency: "dependency",
+  lollipop: "lollipop"
+};
+var addEdgeMarker = /* @__PURE__ */ __name((svgPath, position, arrowType, url, id, diagramType) => {
+  const endMarkerType = arrowTypesMap[arrowType];
+  if (!endMarkerType) {
+    log.warn(`Unknown arrow type: ${arrowType}`);
+    return;
+  }
+  const suffix = position === "start" ? "Start" : "End";
+  svgPath.attr(`marker-${position}`, `url(${url}#${id}_${diagramType}-${endMarkerType}${suffix})`);
+}, "addEdgeMarker");
+
+// src/dagre-wrapper/edges.js
+var edgeLabels = {};
+var terminalLabels = {};
+var clear = /* @__PURE__ */ __name(() => {
+  edgeLabels = {};
+  terminalLabels = {};
+}, "clear");
+var insertEdgeLabel = /* @__PURE__ */ __name((elem, edge) => {
+  const config = getConfig();
+  const useHtmlLabels = evaluate(config.flowchart.htmlLabels);
+  const labelElement = edge.labelType === "markdown" ? createText(
+    elem,
+    edge.label,
+    {
+      style: edge.labelStyle,
+      useHtmlLabels,
+      addSvgBackground: true
+    },
+    config
+  ) : createLabel_default(edge.label, edge.labelStyle);
+  const edgeLabel = elem.insert("g").attr("class", "edgeLabel");
+  const label = edgeLabel.insert("g").attr("class", "label");
+  label.node().appendChild(labelElement);
+  let bbox = labelElement.getBBox();
+  if (useHtmlLabels) {
+    const div = labelElement.children[0];
+    const dv = select(labelElement);
+    bbox = div.getBoundingClientRect();
+    dv.attr("width", bbox.width);
+    dv.attr("height", bbox.height);
+  }
+  label.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")");
+  edgeLabels[edge.id] = edgeLabel;
+  edge.width = bbox.width;
+  edge.height = bbox.height;
+  let fo;
+  if (edge.startLabelLeft) {
+    const startLabelElement = createLabel_default(edge.startLabelLeft, edge.labelStyle);
+    const startEdgeLabelLeft = elem.insert("g").attr("class", "edgeTerminals");
+    const inner = startEdgeLabelLeft.insert("g").attr("class", "inner");
+    fo = inner.node().appendChild(startLabelElement);
+    const slBox = startLabelElement.getBBox();
+    inner.attr("transform", "translate(" + -slBox.width / 2 + ", " + -slBox.height / 2 + ")");
+    if (!terminalLabels[edge.id]) {
+      terminalLabels[edge.id] = {};
+    }
+    terminalLabels[edge.id].startLeft = startEdgeLabelLeft;
+    setTerminalWidth(fo, edge.startLabelLeft);
+  }
+  if (edge.startLabelRight) {
+    const startLabelElement = createLabel_default(edge.startLabelRight, edge.labelStyle);
+    const startEdgeLabelRight = elem.insert("g").attr("class", "edgeTerminals");
+    const inner = startEdgeLabelRight.insert("g").attr("class", "inner");
+    fo = startEdgeLabelRight.node().appendChild(startLabelElement);
+    inner.node().appendChild(startLabelElement);
+    const slBox = startLabelElement.getBBox();
+    inner.attr("transform", "translate(" + -slBox.width / 2 + ", " + -slBox.height / 2 + ")");
+    if (!terminalLabels[edge.id]) {
+      terminalLabels[edge.id] = {};
+    }
+    terminalLabels[edge.id].startRight = startEdgeLabelRight;
+    setTerminalWidth(fo, edge.startLabelRight);
+  }
+  if (edge.endLabelLeft) {
+    const endLabelElement = createLabel_default(edge.endLabelLeft, edge.labelStyle);
+    const endEdgeLabelLeft = elem.insert("g").attr("class", "edgeTerminals");
+    const inner = endEdgeLabelLeft.insert("g").attr("class", "inner");
+    fo = inner.node().appendChild(endLabelElement);
+    const slBox = endLabelElement.getBBox();
+    inner.attr("transform", "translate(" + -slBox.width / 2 + ", " + -slBox.height / 2 + ")");
+    endEdgeLabelLeft.node().appendChild(endLabelElement);
+    if (!terminalLabels[edge.id]) {
+      terminalLabels[edge.id] = {};
+    }
+    terminalLabels[edge.id].endLeft = endEdgeLabelLeft;
+    setTerminalWidth(fo, edge.endLabelLeft);
+  }
+  if (edge.endLabelRight) {
+    const endLabelElement = createLabel_default(edge.endLabelRight, edge.labelStyle);
+    const endEdgeLabelRight = elem.insert("g").attr("class", "edgeTerminals");
+    const inner = endEdgeLabelRight.insert("g").attr("class", "inner");
+    fo = inner.node().appendChild(endLabelElement);
+    const slBox = endLabelElement.getBBox();
+    inner.attr("transform", "translate(" + -slBox.width / 2 + ", " + -slBox.height / 2 + ")");
+    endEdgeLabelRight.node().appendChild(endLabelElement);
+    if (!terminalLabels[edge.id]) {
+      terminalLabels[edge.id] = {};
+    }
+    terminalLabels[edge.id].endRight = endEdgeLabelRight;
+    setTerminalWidth(fo, edge.endLabelRight);
+  }
+  return labelElement;
+}, "insertEdgeLabel");
+function setTerminalWidth(fo, value) {
+  if (getConfig().flowchart.htmlLabels && fo) {
+    fo.style.width = value.length * 9 + "px";
+    fo.style.height = "12px";
+  }
+}
+__name(setTerminalWidth, "setTerminalWidth");
+var positionEdgeLabel = /* @__PURE__ */ __name((edge, paths) => {
+  log.debug("Moving label abc88 ", edge.id, edge.label, edgeLabels[edge.id], paths);
+  let path = paths.updatedPath ? paths.updatedPath : paths.originalPath;
+  const siteConfig = getConfig();
+  const { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig);
+  if (edge.label) {
+    const el = edgeLabels[edge.id];
+    let x = edge.x;
+    let y = edge.y;
+    if (path) {
+      const pos = utils_default.calcLabelPosition(path);
+      log.debug(
+        "Moving label " + edge.label + " from (",
+        x,
+        ",",
+        y,
+        ") to (",
+        pos.x,
+        ",",
+        pos.y,
+        ") abc88"
+      );
+      if (paths.updatedPath) {
+        x = pos.x;
+        y = pos.y;
+      }
+    }
+    el.attr("transform", `translate(${x}, ${y + subGraphTitleTotalMargin / 2})`);
+  }
+  if (edge.startLabelLeft) {
+    const el = terminalLabels[edge.id].startLeft;
+    let x = edge.x;
+    let y = edge.y;
+    if (path) {
+      const pos = utils_default.calcTerminalLabelPosition(edge.arrowTypeStart ? 10 : 0, "start_left", path);
+      x = pos.x;
+      y = pos.y;
+    }
+    el.attr("transform", `translate(${x}, ${y})`);
+  }
+  if (edge.startLabelRight) {
+    const el = terminalLabels[edge.id].startRight;
+    let x = edge.x;
+    let y = edge.y;
+    if (path) {
+      const pos = utils_default.calcTerminalLabelPosition(
+        edge.arrowTypeStart ? 10 : 0,
+        "start_right",
+        path
+      );
+      x = pos.x;
+      y = pos.y;
+    }
+    el.attr("transform", `translate(${x}, ${y})`);
+  }
+  if (edge.endLabelLeft) {
+    const el = terminalLabels[edge.id].endLeft;
+    let x = edge.x;
+    let y = edge.y;
+    if (path) {
+      const pos = utils_default.calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, "end_left", path);
+      x = pos.x;
+      y = pos.y;
+    }
+    el.attr("transform", `translate(${x}, ${y})`);
+  }
+  if (edge.endLabelRight) {
+    const el = terminalLabels[edge.id].endRight;
+    let x = edge.x;
+    let y = edge.y;
+    if (path) {
+      const pos = utils_default.calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, "end_right", path);
+      x = pos.x;
+      y = pos.y;
+    }
+    el.attr("transform", `translate(${x}, ${y})`);
+  }
+}, "positionEdgeLabel");
+var outsideNode = /* @__PURE__ */ __name((node, point2) => {
+  const x = node.x;
+  const y = node.y;
+  const dx = Math.abs(point2.x - x);
+  const dy = Math.abs(point2.y - y);
+  const w = node.width / 2;
+  const h = node.height / 2;
+  if (dx >= w || dy >= h) {
+    return true;
+  }
+  return false;
+}, "outsideNode");
+var intersection = /* @__PURE__ */ __name((node, outsidePoint, insidePoint) => {
+  log.debug(`intersection calc abc89:
+  outsidePoint: ${JSON.stringify(outsidePoint)}
+  insidePoint : ${JSON.stringify(insidePoint)}
+  node        : x:${node.x} y:${node.y} w:${node.width} h:${node.height}`);
+  const x = node.x;
+  const y = node.y;
+  const dx = Math.abs(x - insidePoint.x);
+  const w = node.width / 2;
+  let r = insidePoint.x < outsidePoint.x ? w - dx : w + dx;
+  const h = node.height / 2;
+  const Q = Math.abs(outsidePoint.y - insidePoint.y);
+  const R = Math.abs(outsidePoint.x - insidePoint.x);
+  if (Math.abs(y - outsidePoint.y) * w > Math.abs(x - outsidePoint.x) * h) {
+    let q = insidePoint.y < outsidePoint.y ? outsidePoint.y - h - y : y - h - outsidePoint.y;
+    r = R * q / Q;
+    const res = {
+      x: insidePoint.x < outsidePoint.x ? insidePoint.x + r : insidePoint.x - R + r,
+      y: insidePoint.y < outsidePoint.y ? insidePoint.y + Q - q : insidePoint.y - Q + q
+    };
+    if (r === 0) {
+      res.x = outsidePoint.x;
+      res.y = outsidePoint.y;
+    }
+    if (R === 0) {
+      res.x = outsidePoint.x;
+    }
+    if (Q === 0) {
+      res.y = outsidePoint.y;
+    }
+    log.debug(`abc89 topp/bott calc, Q ${Q}, q ${q}, R ${R}, r ${r}`, res);
+    return res;
+  } else {
+    if (insidePoint.x < outsidePoint.x) {
+      r = outsidePoint.x - w - x;
+    } else {
+      r = x - w - outsidePoint.x;
+    }
+    let q = Q * r / R;
+    let _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : insidePoint.x - R + r;
+    let _y = insidePoint.y < outsidePoint.y ? insidePoint.y + q : insidePoint.y - q;
+    log.debug(`sides calc abc89, Q ${Q}, q ${q}, R ${R}, r ${r}`, { _x, _y });
+    if (r === 0) {
+      _x = outsidePoint.x;
+      _y = outsidePoint.y;
+    }
+    if (R === 0) {
+      _x = outsidePoint.x;
+    }
+    if (Q === 0) {
+      _y = outsidePoint.y;
+    }
+    return { x: _x, y: _y };
+  }
+}, "intersection");
+var cutPathAtIntersect = /* @__PURE__ */ __name((_points, boundaryNode) => {
+  log.debug("abc88 cutPathAtIntersect", _points, boundaryNode);
+  let points = [];
+  let lastPointOutside = _points[0];
+  let isInside = false;
+  _points.forEach((point2) => {
+    if (!outsideNode(boundaryNode, point2) && !isInside) {
+      const inter = intersection(boundaryNode, lastPointOutside, point2);
+      let pointPresent = false;
+      points.forEach((p) => {
+        pointPresent = pointPresent || p.x === inter.x && p.y === inter.y;
+      });
+      if (!points.some((e) => e.x === inter.x && e.y === inter.y)) {
+        points.push(inter);
+      }
+      isInside = true;
+    } else {
+      lastPointOutside = point2;
+      if (!isInside) {
+        points.push(point2);
+      }
+    }
+  });
+  return points;
+}, "cutPathAtIntersect");
+var insertEdge = /* @__PURE__ */ __name(function(elem, e, edge, clusterDb, diagramType, graph, id) {
+  let points = edge.points;
+  log.debug("abc88 InsertEdge: edge=", edge, "e=", e);
+  let pointsHasChanged = false;
+  const tail = graph.node(e.v);
+  var head = graph.node(e.w);
+  if (head?.intersect && tail?.intersect) {
+    points = points.slice(1, edge.points.length - 1);
+    points.unshift(tail.intersect(points[0]));
+    points.push(head.intersect(points[points.length - 1]));
+  }
+  if (edge.toCluster) {
+    log.debug("to cluster abc88", clusterDb[edge.toCluster]);
+    points = cutPathAtIntersect(edge.points, clusterDb[edge.toCluster].node);
+    pointsHasChanged = true;
+  }
+  if (edge.fromCluster) {
+    log.debug("from cluster abc88", clusterDb[edge.fromCluster]);
+    points = cutPathAtIntersect(points.reverse(), clusterDb[edge.fromCluster].node).reverse();
+    pointsHasChanged = true;
+  }
+  const lineData = points.filter((p) => !Number.isNaN(p.y));
+  let curve = curveBasis;
+  if (edge.curve && (diagramType === "graph" || diagramType === "flowchart")) {
+    curve = edge.curve;
+  }
+  const { x, y } = getLineFunctionsWithOffset(edge);
+  const lineFunction = line().x(x).y(y).curve(curve);
+  let strokeClasses;
+  switch (edge.thickness) {
+    case "normal":
+      strokeClasses = "edge-thickness-normal";
+      break;
+    case "thick":
+      strokeClasses = "edge-thickness-thick";
+      break;
+    case "invisible":
+      strokeClasses = "edge-thickness-thick";
+      break;
+    default:
+      strokeClasses = "";
+  }
+  switch (edge.pattern) {
+    case "solid":
+      strokeClasses += " edge-pattern-solid";
+      break;
+    case "dotted":
+      strokeClasses += " edge-pattern-dotted";
+      break;
+    case "dashed":
+      strokeClasses += " edge-pattern-dashed";
+      break;
+  }
+  const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", edge.id).attr("class", " " + strokeClasses + (edge.classes ? " " + edge.classes : "")).attr("style", edge.style);
+  let url = "";
+  if (getConfig().flowchart.arrowMarkerAbsolute || getConfig().state.arrowMarkerAbsolute) {
+    url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
+    url = url.replace(/\(/g, "\\(");
+    url = url.replace(/\)/g, "\\)");
+  }
+  addEdgeMarkers(svgPath, edge, url, id, diagramType);
+  let paths = {};
+  if (pointsHasChanged) {
+    paths.updatedPath = points;
+  }
+  paths.originalPath = edge.points;
+  return paths;
+}, "insertEdge");
+
+export {
+  markers_default,
+  clear,
+  insertEdgeLabel,
+  positionEdgeLabel,
+  insertEdge
+};

File diff suppressed because it is too large
+ 63 - 36
nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-SVGOEX7Z.mjs


+ 76 - 0
nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-T3KDJ7CM.mjs

@@ -0,0 +1,76 @@
+import {
+  insertCluster,
+  insertEdge,
+  insertEdgeLabel,
+  insertNode,
+  labelHelper,
+  markers_default,
+  positionEdgeLabel
+} from "./chunk-5CZSE4TR.mjs";
+import {
+  interpolateToCurve
+} from "./chunk-VKXSJROQ.mjs";
+import {
+  __name,
+  common_default,
+  getConfig,
+  log
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/internals.ts
+var internalHelpers = {
+  common: common_default,
+  getConfig,
+  insertCluster,
+  insertEdge,
+  insertEdgeLabel,
+  insertMarkers: markers_default,
+  insertNode,
+  interpolateToCurve,
+  labelHelper,
+  log,
+  positionEdgeLabel
+};
+
+// src/rendering-util/render.ts
+var layoutAlgorithms = {};
+var registerLayoutLoaders = /* @__PURE__ */ __name((loaders) => {
+  for (const loader of loaders) {
+    layoutAlgorithms[loader.name] = loader;
+  }
+}, "registerLayoutLoaders");
+var registerDefaultLayoutLoaders = /* @__PURE__ */ __name(() => {
+  registerLayoutLoaders([
+    {
+      name: "dagre",
+      loader: /* @__PURE__ */ __name(async () => await import("./dagre-CQ6OS2HX.mjs"), "loader")
+    }
+  ]);
+}, "registerDefaultLayoutLoaders");
+registerDefaultLayoutLoaders();
+var render = /* @__PURE__ */ __name(async (data4Layout, svg) => {
+  if (!(data4Layout.layoutAlgorithm in layoutAlgorithms)) {
+    throw new Error(`Unknown layout algorithm: ${data4Layout.layoutAlgorithm}`);
+  }
+  const layoutDefinition = layoutAlgorithms[data4Layout.layoutAlgorithm];
+  const layoutRenderer = await layoutDefinition.loader();
+  return layoutRenderer.render(data4Layout, svg, internalHelpers, {
+    algorithm: layoutDefinition.algorithm
+  });
+}, "render");
+var getRegisteredLayoutAlgorithm = /* @__PURE__ */ __name((algorithm = "", { fallback = "dagre" } = {}) => {
+  if (algorithm in layoutAlgorithms) {
+    return algorithm;
+  }
+  if (fallback in layoutAlgorithms) {
+    log.warn(`Layout algorithm ${algorithm} is not registered. Using ${fallback} as fallback.`);
+    return fallback;
+  }
+  throw new Error(`Both layout algorithms ${algorithm} and ${fallback} are not registered.`);
+}, "getRegisteredLayoutAlgorithm");
+
+export {
+  registerLayoutLoaders,
+  render,
+  getRegisteredLayoutAlgorithm
+};

+ 122 - 0
nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-TINLTEC2.mjs

@@ -0,0 +1,122 @@
+import {
+  __name
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/utils/subGraphTitleMargins.ts
+var getSubGraphTitleMargins = /* @__PURE__ */ __name(({
+  flowchart
+}) => {
+  const subGraphTitleTopMargin = flowchart?.subGraphTitleMargin?.top ?? 0;
+  const subGraphTitleBottomMargin = flowchart?.subGraphTitleMargin?.bottom ?? 0;
+  const subGraphTitleTotalMargin = subGraphTitleTopMargin + subGraphTitleBottomMargin;
+  return {
+    subGraphTitleTopMargin,
+    subGraphTitleBottomMargin,
+    subGraphTitleTotalMargin
+  };
+}, "getSubGraphTitleMargins");
+
+// src/utils/lineWithOffset.ts
+var markerOffsets = {
+  aggregation: 18,
+  extension: 18,
+  composition: 18,
+  dependency: 6,
+  lollipop: 13.5,
+  arrow_point: 4
+};
+function calculateDeltaAndAngle(point1, point2) {
+  if (point1 === void 0 || point2 === void 0) {
+    return { angle: 0, deltaX: 0, deltaY: 0 };
+  }
+  point1 = pointTransformer(point1);
+  point2 = pointTransformer(point2);
+  const [x1, y1] = [point1.x, point1.y];
+  const [x2, y2] = [point2.x, point2.y];
+  const deltaX = x2 - x1;
+  const deltaY = y2 - y1;
+  return { angle: Math.atan(deltaY / deltaX), deltaX, deltaY };
+}
+__name(calculateDeltaAndAngle, "calculateDeltaAndAngle");
+var pointTransformer = /* @__PURE__ */ __name((data) => {
+  if (Array.isArray(data)) {
+    return { x: data[0], y: data[1] };
+  }
+  return data;
+}, "pointTransformer");
+var getLineFunctionsWithOffset = /* @__PURE__ */ __name((edge) => {
+  return {
+    x: /* @__PURE__ */ __name(function(d, i, data) {
+      let offset = 0;
+      if (i === 0 && Object.hasOwn(markerOffsets, edge.arrowTypeStart)) {
+        const { angle, deltaX } = calculateDeltaAndAngle(data[0], data[1]);
+        offset = markerOffsets[edge.arrowTypeStart] * Math.cos(angle) * (deltaX >= 0 ? 1 : -1);
+      } else if (i === data.length - 1 && Object.hasOwn(markerOffsets, edge.arrowTypeEnd)) {
+        const { angle, deltaX } = calculateDeltaAndAngle(
+          data[data.length - 1],
+          data[data.length - 2]
+        );
+        offset = markerOffsets[edge.arrowTypeEnd] * Math.cos(angle) * (deltaX >= 0 ? 1 : -1);
+      }
+      return pointTransformer(d).x + offset;
+    }, "x"),
+    y: /* @__PURE__ */ __name(function(d, i, data) {
+      let offset = 0;
+      if (i === 0 && Object.hasOwn(markerOffsets, edge.arrowTypeStart)) {
+        const { angle, deltaY } = calculateDeltaAndAngle(data[0], data[1]);
+        offset = markerOffsets[edge.arrowTypeStart] * Math.abs(Math.sin(angle)) * (deltaY >= 0 ? 1 : -1);
+      } else if (i === data.length - 1 && Object.hasOwn(markerOffsets, edge.arrowTypeEnd)) {
+        const { angle, deltaY } = calculateDeltaAndAngle(
+          data[data.length - 1],
+          data[data.length - 2]
+        );
+        offset = markerOffsets[edge.arrowTypeEnd] * Math.abs(Math.sin(angle)) * (deltaY >= 0 ? 1 : -1);
+      }
+      return pointTransformer(d).y + offset;
+    }, "y")
+  };
+}, "getLineFunctionsWithOffset");
+if (void 0) {
+  const { it, expect, describe } = void 0;
+  describe("calculateDeltaAndAngle", () => {
+    it("should calculate the angle and deltas between two points", () => {
+      expect(calculateDeltaAndAngle([0, 0], [0, 1])).toStrictEqual({
+        angle: 1.5707963267948966,
+        deltaX: 0,
+        deltaY: 1
+      });
+      expect(calculateDeltaAndAngle([1, 0], [0, -1])).toStrictEqual({
+        angle: 0.7853981633974483,
+        deltaX: -1,
+        deltaY: -1
+      });
+      expect(calculateDeltaAndAngle({ x: 1, y: 0 }, [0, -1])).toStrictEqual({
+        angle: 0.7853981633974483,
+        deltaX: -1,
+        deltaY: -1
+      });
+      expect(calculateDeltaAndAngle({ x: 1, y: 0 }, { x: 1, y: 0 })).toStrictEqual({
+        angle: NaN,
+        deltaX: 0,
+        deltaY: 0
+      });
+    });
+    it("should calculate the angle and deltas if one point in undefined", () => {
+      expect(calculateDeltaAndAngle(void 0, [0, 1])).toStrictEqual({
+        angle: 0,
+        deltaX: 0,
+        deltaY: 0
+      });
+      expect(calculateDeltaAndAngle([0, 1], void 0)).toStrictEqual({
+        angle: 0,
+        deltaX: 0,
+        deltaY: 0
+      });
+    });
+  });
+}
+
+export {
+  getSubGraphTitleMargins,
+  getLineFunctionsWithOffset
+};

+ 561 - 0
nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-VKXSJROQ.mjs

@@ -0,0 +1,561 @@
+import {
+  __name,
+  assignWithDepth_default,
+  common_default,
+  detectType,
+  directiveRegex,
+  log,
+  sanitizeDirective
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/utils.ts
+import { sanitizeUrl } from "@braintree/sanitize-url";
+import {
+  curveBasis,
+  curveBasisClosed,
+  curveBasisOpen,
+  curveBumpX,
+  curveBumpY,
+  curveBundle,
+  curveCardinalClosed,
+  curveCardinalOpen,
+  curveCardinal,
+  curveCatmullRomClosed,
+  curveCatmullRomOpen,
+  curveCatmullRom,
+  curveLinear,
+  curveLinearClosed,
+  curveMonotoneX,
+  curveMonotoneY,
+  curveNatural,
+  curveStep,
+  curveStepAfter,
+  curveStepBefore,
+  select
+} from "d3";
+import memoize from "lodash-es/memoize.js";
+import merge from "lodash-es/merge.js";
+var ZERO_WIDTH_SPACE = "\u200B";
+var d3CurveTypes = {
+  curveBasis,
+  curveBasisClosed,
+  curveBasisOpen,
+  curveBumpX,
+  curveBumpY,
+  curveBundle,
+  curveCardinalClosed,
+  curveCardinalOpen,
+  curveCardinal,
+  curveCatmullRomClosed,
+  curveCatmullRomOpen,
+  curveCatmullRom,
+  curveLinear,
+  curveLinearClosed,
+  curveMonotoneX,
+  curveMonotoneY,
+  curveNatural,
+  curveStep,
+  curveStepAfter,
+  curveStepBefore
+};
+var directiveWithoutOpen = /\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi;
+var detectInit = /* @__PURE__ */ __name(function(text, config) {
+  const inits = detectDirective(text, /(?:init\b)|(?:initialize\b)/);
+  let results = {};
+  if (Array.isArray(inits)) {
+    const args = inits.map((init) => init.args);
+    sanitizeDirective(args);
+    results = assignWithDepth_default(results, [...args]);
+  } else {
+    results = inits.args;
+  }
+  if (!results) {
+    return;
+  }
+  let type = detectType(text, config);
+  const prop = "config";
+  if (results[prop] !== void 0) {
+    if (type === "flowchart-v2") {
+      type = "flowchart";
+    }
+    results[type] = results[prop];
+    delete results[prop];
+  }
+  return results;
+}, "detectInit");
+var detectDirective = /* @__PURE__ */ __name(function(text, type = null) {
+  try {
+    const commentWithoutDirectives = new RegExp(
+      `[%]{2}(?![{]${directiveWithoutOpen.source})(?=[}][%]{2}).*
+`,
+      "ig"
+    );
+    text = text.trim().replace(commentWithoutDirectives, "").replace(/'/gm, '"');
+    log.debug(
+      `Detecting diagram directive${type !== null ? " type:" + type : ""} based on the text:${text}`
+    );
+    let match;
+    const result = [];
+    while ((match = directiveRegex.exec(text)) !== null) {
+      if (match.index === directiveRegex.lastIndex) {
+        directiveRegex.lastIndex++;
+      }
+      if (match && !type || type && match[1]?.match(type) || type && match[2]?.match(type)) {
+        const type2 = match[1] ? match[1] : match[2];
+        const args = match[3] ? match[3].trim() : match[4] ? JSON.parse(match[4].trim()) : null;
+        result.push({ type: type2, args });
+      }
+    }
+    if (result.length === 0) {
+      return { type: text, args: null };
+    }
+    return result.length === 1 ? result[0] : result;
+  } catch (error) {
+    log.error(
+      `ERROR: ${error.message} - Unable to parse directive type: '${type}' based on the text: '${text}'`
+    );
+    return { type: void 0, args: null };
+  }
+}, "detectDirective");
+var removeDirectives = /* @__PURE__ */ __name(function(text) {
+  return text.replace(directiveRegex, "");
+}, "removeDirectives");
+var isSubstringInArray = /* @__PURE__ */ __name(function(str, arr) {
+  for (const [i, element] of arr.entries()) {
+    if (element.match(str)) {
+      return i;
+    }
+  }
+  return -1;
+}, "isSubstringInArray");
+function interpolateToCurve(interpolate, defaultCurve) {
+  if (!interpolate) {
+    return defaultCurve;
+  }
+  const curveName = `curve${interpolate.charAt(0).toUpperCase() + interpolate.slice(1)}`;
+  return d3CurveTypes[curveName] ?? defaultCurve;
+}
+__name(interpolateToCurve, "interpolateToCurve");
+function formatUrl(linkStr, config) {
+  const url = linkStr.trim();
+  if (!url) {
+    return void 0;
+  }
+  if (config.securityLevel !== "loose") {
+    return sanitizeUrl(url);
+  }
+  return url;
+}
+__name(formatUrl, "formatUrl");
+var runFunc = /* @__PURE__ */ __name((functionName, ...params) => {
+  const arrPaths = functionName.split(".");
+  const len = arrPaths.length - 1;
+  const fnName = arrPaths[len];
+  let obj = window;
+  for (let i = 0; i < len; i++) {
+    obj = obj[arrPaths[i]];
+    if (!obj) {
+      log.error(`Function name: ${functionName} not found in window`);
+      return;
+    }
+  }
+  obj[fnName](...params);
+}, "runFunc");
+function distance(p1, p2) {
+  if (!p1 || !p2) {
+    return 0;
+  }
+  return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));
+}
+__name(distance, "distance");
+function traverseEdge(points) {
+  let prevPoint;
+  let totalDistance = 0;
+  points.forEach((point) => {
+    totalDistance += distance(point, prevPoint);
+    prevPoint = point;
+  });
+  const remainingDistance = totalDistance / 2;
+  return calculatePoint(points, remainingDistance);
+}
+__name(traverseEdge, "traverseEdge");
+function calcLabelPosition(points) {
+  if (points.length === 1) {
+    return points[0];
+  }
+  return traverseEdge(points);
+}
+__name(calcLabelPosition, "calcLabelPosition");
+var roundNumber = /* @__PURE__ */ __name((num, precision = 2) => {
+  const factor = Math.pow(10, precision);
+  return Math.round(num * factor) / factor;
+}, "roundNumber");
+var calculatePoint = /* @__PURE__ */ __name((points, distanceToTraverse) => {
+  let prevPoint = void 0;
+  let remainingDistance = distanceToTraverse;
+  for (const point of points) {
+    if (prevPoint) {
+      const vectorDistance = distance(point, prevPoint);
+      if (vectorDistance < remainingDistance) {
+        remainingDistance -= vectorDistance;
+      } else {
+        const distanceRatio = remainingDistance / vectorDistance;
+        if (distanceRatio <= 0) {
+          return prevPoint;
+        }
+        if (distanceRatio >= 1) {
+          return { x: point.x, y: point.y };
+        }
+        if (distanceRatio > 0 && distanceRatio < 1) {
+          return {
+            x: roundNumber((1 - distanceRatio) * prevPoint.x + distanceRatio * point.x, 5),
+            y: roundNumber((1 - distanceRatio) * prevPoint.y + distanceRatio * point.y, 5)
+          };
+        }
+      }
+    }
+    prevPoint = point;
+  }
+  throw new Error("Could not find a suitable point for the given distance");
+}, "calculatePoint");
+var calcCardinalityPosition = /* @__PURE__ */ __name((isRelationTypePresent, points, initialPosition) => {
+  log.info(`our points ${JSON.stringify(points)}`);
+  if (points[0] !== initialPosition) {
+    points = points.reverse();
+  }
+  const distanceToCardinalityPoint = 25;
+  const center = calculatePoint(points, distanceToCardinalityPoint);
+  const d = isRelationTypePresent ? 10 : 5;
+  const angle = Math.atan2(points[0].y - center.y, points[0].x - center.x);
+  const cardinalityPosition = { x: 0, y: 0 };
+  cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2;
+  cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2;
+  return cardinalityPosition;
+}, "calcCardinalityPosition");
+function calcTerminalLabelPosition(terminalMarkerSize, position, _points) {
+  const points = structuredClone(_points);
+  log.info("our points", points);
+  if (position !== "start_left" && position !== "start_right") {
+    points.reverse();
+  }
+  const distanceToCardinalityPoint = 25 + terminalMarkerSize;
+  const center = calculatePoint(points, distanceToCardinalityPoint);
+  const d = 10 + terminalMarkerSize * 0.5;
+  const angle = Math.atan2(points[0].y - center.y, points[0].x - center.x);
+  const cardinalityPosition = { x: 0, y: 0 };
+  if (position === "start_left") {
+    cardinalityPosition.x = Math.sin(angle + Math.PI) * d + (points[0].x + center.x) / 2;
+    cardinalityPosition.y = -Math.cos(angle + Math.PI) * d + (points[0].y + center.y) / 2;
+  } else if (position === "end_right") {
+    cardinalityPosition.x = Math.sin(angle - Math.PI) * d + (points[0].x + center.x) / 2 - 5;
+    cardinalityPosition.y = -Math.cos(angle - Math.PI) * d + (points[0].y + center.y) / 2 - 5;
+  } else if (position === "end_left") {
+    cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2 - 5;
+    cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2 - 5;
+  } else {
+    cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2;
+    cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2;
+  }
+  return cardinalityPosition;
+}
+__name(calcTerminalLabelPosition, "calcTerminalLabelPosition");
+function getStylesFromArray(arr) {
+  let style = "";
+  let labelStyle = "";
+  for (const element of arr) {
+    if (element !== void 0) {
+      if (element.startsWith("color:") || element.startsWith("text-align:")) {
+        labelStyle = labelStyle + element + ";";
+      } else {
+        style = style + element + ";";
+      }
+    }
+  }
+  return { style, labelStyle };
+}
+__name(getStylesFromArray, "getStylesFromArray");
+var cnt = 0;
+var generateId = /* @__PURE__ */ __name(() => {
+  cnt++;
+  return "id-" + Math.random().toString(36).substr(2, 12) + "-" + cnt;
+}, "generateId");
+function makeRandomHex(length) {
+  let result = "";
+  const characters = "0123456789abcdef";
+  const charactersLength = characters.length;
+  for (let i = 0; i < length; i++) {
+    result += characters.charAt(Math.floor(Math.random() * charactersLength));
+  }
+  return result;
+}
+__name(makeRandomHex, "makeRandomHex");
+var random = /* @__PURE__ */ __name((options) => {
+  return makeRandomHex(options.length);
+}, "random");
+var getTextObj = /* @__PURE__ */ __name(function() {
+  return {
+    x: 0,
+    y: 0,
+    fill: void 0,
+    anchor: "start",
+    style: "#666",
+    width: 100,
+    height: 100,
+    textMargin: 0,
+    rx: 0,
+    ry: 0,
+    valign: void 0,
+    text: ""
+  };
+}, "getTextObj");
+var drawSimpleText = /* @__PURE__ */ __name(function(elem, textData) {
+  const nText = textData.text.replace(common_default.lineBreakRegex, " ");
+  const [, _fontSizePx] = parseFontSize(textData.fontSize);
+  const textElem = elem.append("text");
+  textElem.attr("x", textData.x);
+  textElem.attr("y", textData.y);
+  textElem.style("text-anchor", textData.anchor);
+  textElem.style("font-family", textData.fontFamily);
+  textElem.style("font-size", _fontSizePx);
+  textElem.style("font-weight", textData.fontWeight);
+  textElem.attr("fill", textData.fill);
+  if (textData.class !== void 0) {
+    textElem.attr("class", textData.class);
+  }
+  const span = textElem.append("tspan");
+  span.attr("x", textData.x + textData.textMargin * 2);
+  span.attr("fill", textData.fill);
+  span.text(nText);
+  return textElem;
+}, "drawSimpleText");
+var wrapLabel = memoize(
+  (label, maxWidth, config) => {
+    if (!label) {
+      return label;
+    }
+    config = Object.assign(
+      { fontSize: 12, fontWeight: 400, fontFamily: "Arial", joinWith: "<br/>" },
+      config
+    );
+    if (common_default.lineBreakRegex.test(label)) {
+      return label;
+    }
+    const words = label.split(" ").filter(Boolean);
+    const completedLines = [];
+    let nextLine = "";
+    words.forEach((word, index) => {
+      const wordLength = calculateTextWidth(`${word} `, config);
+      const nextLineLength = calculateTextWidth(nextLine, config);
+      if (wordLength > maxWidth) {
+        const { hyphenatedStrings, remainingWord } = breakString(word, maxWidth, "-", config);
+        completedLines.push(nextLine, ...hyphenatedStrings);
+        nextLine = remainingWord;
+      } else if (nextLineLength + wordLength >= maxWidth) {
+        completedLines.push(nextLine);
+        nextLine = word;
+      } else {
+        nextLine = [nextLine, word].filter(Boolean).join(" ");
+      }
+      const currentWord = index + 1;
+      const isLastWord = currentWord === words.length;
+      if (isLastWord) {
+        completedLines.push(nextLine);
+      }
+    });
+    return completedLines.filter((line) => line !== "").join(config.joinWith);
+  },
+  (label, maxWidth, config) => `${label}${maxWidth}${config.fontSize}${config.fontWeight}${config.fontFamily}${config.joinWith}`
+);
+var breakString = memoize(
+  (word, maxWidth, hyphenCharacter = "-", config) => {
+    config = Object.assign(
+      { fontSize: 12, fontWeight: 400, fontFamily: "Arial", margin: 0 },
+      config
+    );
+    const characters = [...word];
+    const lines = [];
+    let currentLine = "";
+    characters.forEach((character, index) => {
+      const nextLine = `${currentLine}${character}`;
+      const lineWidth = calculateTextWidth(nextLine, config);
+      if (lineWidth >= maxWidth) {
+        const currentCharacter = index + 1;
+        const isLastLine = characters.length === currentCharacter;
+        const hyphenatedNextLine = `${nextLine}${hyphenCharacter}`;
+        lines.push(isLastLine ? nextLine : hyphenatedNextLine);
+        currentLine = "";
+      } else {
+        currentLine = nextLine;
+      }
+    });
+    return { hyphenatedStrings: lines, remainingWord: currentLine };
+  },
+  (word, maxWidth, hyphenCharacter = "-", config) => `${word}${maxWidth}${hyphenCharacter}${config.fontSize}${config.fontWeight}${config.fontFamily}`
+);
+function calculateTextHeight(text, config) {
+  return calculateTextDimensions(text, config).height;
+}
+__name(calculateTextHeight, "calculateTextHeight");
+function calculateTextWidth(text, config) {
+  return calculateTextDimensions(text, config).width;
+}
+__name(calculateTextWidth, "calculateTextWidth");
+var calculateTextDimensions = memoize(
+  (text, config) => {
+    const { fontSize = 12, fontFamily = "Arial", fontWeight = 400 } = config;
+    if (!text) {
+      return { width: 0, height: 0 };
+    }
+    const [, _fontSizePx] = parseFontSize(fontSize);
+    const fontFamilies = ["sans-serif", fontFamily];
+    const lines = text.split(common_default.lineBreakRegex);
+    const dims = [];
+    const body = select("body");
+    if (!body.remove) {
+      return { width: 0, height: 0, lineHeight: 0 };
+    }
+    const g = body.append("svg");
+    for (const fontFamily2 of fontFamilies) {
+      let cHeight = 0;
+      const dim = { width: 0, height: 0, lineHeight: 0 };
+      for (const line of lines) {
+        const textObj = getTextObj();
+        textObj.text = line || ZERO_WIDTH_SPACE;
+        const textElem = drawSimpleText(g, textObj).style("font-size", _fontSizePx).style("font-weight", fontWeight).style("font-family", fontFamily2);
+        const bBox = (textElem._groups || textElem)[0][0].getBBox();
+        if (bBox.width === 0 && bBox.height === 0) {
+          throw new Error("svg element not in render tree");
+        }
+        dim.width = Math.round(Math.max(dim.width, bBox.width));
+        cHeight = Math.round(bBox.height);
+        dim.height += cHeight;
+        dim.lineHeight = Math.round(Math.max(dim.lineHeight, cHeight));
+      }
+      dims.push(dim);
+    }
+    g.remove();
+    const index = isNaN(dims[1].height) || isNaN(dims[1].width) || isNaN(dims[1].lineHeight) || dims[0].height > dims[1].height && dims[0].width > dims[1].width && dims[0].lineHeight > dims[1].lineHeight ? 0 : 1;
+    return dims[index];
+  },
+  (text, config) => `${text}${config.fontSize}${config.fontWeight}${config.fontFamily}`
+);
+var InitIDGenerator = class {
+  constructor(deterministic = false, seed) {
+    this.count = 0;
+    this.count = seed ? seed.length : 0;
+    this.next = deterministic ? () => this.count++ : () => Date.now();
+  }
+  static {
+    __name(this, "InitIDGenerator");
+  }
+};
+var decoder;
+var entityDecode = /* @__PURE__ */ __name(function(html) {
+  decoder = decoder || document.createElement("div");
+  html = escape(html).replace(/%26/g, "&").replace(/%23/g, "#").replace(/%3B/g, ";");
+  decoder.innerHTML = html;
+  return unescape(decoder.textContent);
+}, "entityDecode");
+function isDetailedError(error) {
+  return "str" in error;
+}
+__name(isDetailedError, "isDetailedError");
+var insertTitle = /* @__PURE__ */ __name((parent, cssClass, titleTopMargin, title) => {
+  if (!title) {
+    return;
+  }
+  const bounds = parent.node()?.getBBox();
+  if (!bounds) {
+    return;
+  }
+  parent.append("text").text(title).attr("x", bounds.x + bounds.width / 2).attr("y", -titleTopMargin).attr("class", cssClass);
+}, "insertTitle");
+var parseFontSize = /* @__PURE__ */ __name((fontSize) => {
+  if (typeof fontSize === "number") {
+    return [fontSize, fontSize + "px"];
+  }
+  const fontSizeNumber = parseInt(fontSize ?? "", 10);
+  if (Number.isNaN(fontSizeNumber)) {
+    return [void 0, void 0];
+  } else if (fontSize === String(fontSizeNumber)) {
+    return [fontSizeNumber, fontSize + "px"];
+  } else {
+    return [fontSizeNumber, fontSize];
+  }
+}, "parseFontSize");
+function cleanAndMerge(defaultData, data) {
+  return merge({}, defaultData, data);
+}
+__name(cleanAndMerge, "cleanAndMerge");
+var utils_default = {
+  assignWithDepth: assignWithDepth_default,
+  wrapLabel,
+  calculateTextHeight,
+  calculateTextWidth,
+  calculateTextDimensions,
+  cleanAndMerge,
+  detectInit,
+  detectDirective,
+  isSubstringInArray,
+  interpolateToCurve,
+  calcLabelPosition,
+  calcCardinalityPosition,
+  calcTerminalLabelPosition,
+  formatUrl,
+  getStylesFromArray,
+  generateId,
+  random,
+  runFunc,
+  entityDecode,
+  insertTitle,
+  parseFontSize,
+  InitIDGenerator
+};
+var encodeEntities = /* @__PURE__ */ __name(function(text) {
+  let txt = text;
+  txt = txt.replace(/style.*:\S*#.*;/g, function(s) {
+    return s.substring(0, s.length - 1);
+  });
+  txt = txt.replace(/classDef.*:\S*#.*;/g, function(s) {
+    return s.substring(0, s.length - 1);
+  });
+  txt = txt.replace(/#\w+;/g, function(s) {
+    const innerTxt = s.substring(1, s.length - 1);
+    const isInt = /^\+?\d+$/.test(innerTxt);
+    if (isInt) {
+      return "\uFB02\xB0\xB0" + innerTxt + "\xB6\xDF";
+    } else {
+      return "\uFB02\xB0" + innerTxt + "\xB6\xDF";
+    }
+  });
+  return txt;
+}, "encodeEntities");
+var decodeEntities = /* @__PURE__ */ __name(function(text) {
+  return text.replace(/fl°°/g, "&#").replace(/fl°/g, "&").replace(/¶ß/g, ";");
+}, "decodeEntities");
+var getEdgeId = /* @__PURE__ */ __name((from, to, {
+  counter = 0,
+  prefix,
+  suffix
+}) => {
+  return `${prefix ? `${prefix}_` : ""}${from}_${to}_${counter}${suffix ? `_${suffix}` : ""}`;
+}, "getEdgeId");
+
+export {
+  ZERO_WIDTH_SPACE,
+  removeDirectives,
+  interpolateToCurve,
+  getStylesFromArray,
+  generateId,
+  random,
+  wrapLabel,
+  calculateTextHeight,
+  calculateTextWidth,
+  isDetailedError,
+  parseFontSize,
+  cleanAndMerge,
+  utils_default,
+  encodeEntities,
+  decodeEntities,
+  getEdgeId
+};

+ 6 - 0
nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-YR4HKMZO.mjs

@@ -0,0 +1,6 @@
+// package.json
+var version = "11.0.2";
+
+export {
+  version
+};

+ 1402 - 0
nicegui/elements/lib/mermaid/chunks/mermaid.core/chunk-Z2VRG6XP.mjs

@@ -0,0 +1,1402 @@
+import {
+  createText,
+  replaceIconSubstring
+} from "./chunk-OERGPBFJ.mjs";
+import {
+  decodeEntities
+} from "./chunk-VKXSJROQ.mjs";
+import {
+  __name,
+  evaluate,
+  getConfig2 as getConfig,
+  log,
+  sanitizeText
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/dagre-wrapper/createLabel.js
+import { select } from "d3";
+function applyStyle(dom, styleFn) {
+  if (styleFn) {
+    dom.attr("style", styleFn);
+  }
+}
+__name(applyStyle, "applyStyle");
+function addHtmlLabel(node) {
+  const fo = select(document.createElementNS("http://www.w3.org/2000/svg", "foreignObject"));
+  const div = fo.append("xhtml:div");
+  const label = node.label;
+  const labelClass = node.isNode ? "nodeLabel" : "edgeLabel";
+  const span = div.append("span");
+  span.html(label);
+  applyStyle(span, node.labelStyle);
+  span.attr("class", labelClass);
+  applyStyle(div, node.labelStyle);
+  div.style("display", "inline-block");
+  div.style("white-space", "nowrap");
+  div.attr("xmlns", "http://www.w3.org/1999/xhtml");
+  return fo.node();
+}
+__name(addHtmlLabel, "addHtmlLabel");
+var createLabel = /* @__PURE__ */ __name((_vertexText, style, isTitle, isNode) => {
+  let vertexText = _vertexText || "";
+  if (typeof vertexText === "object") {
+    vertexText = vertexText[0];
+  }
+  if (evaluate(getConfig().flowchart.htmlLabels)) {
+    vertexText = vertexText.replace(/\\n|\n/g, "<br />");
+    log.debug("vertexText" + vertexText);
+    const node = {
+      isNode,
+      label: replaceIconSubstring(decodeEntities(vertexText)),
+      labelStyle: style.replace("fill:", "color:")
+    };
+    let vertexNode = addHtmlLabel(node);
+    return vertexNode;
+  } else {
+    const svgLabel = document.createElementNS("http://www.w3.org/2000/svg", "text");
+    svgLabel.setAttribute("style", style.replace("color:", "fill:"));
+    let rows = [];
+    if (typeof vertexText === "string") {
+      rows = vertexText.split(/\\n|\n|<br\s*\/?>/gi);
+    } else if (Array.isArray(vertexText)) {
+      rows = vertexText;
+    } else {
+      rows = [];
+    }
+    for (const row of rows) {
+      const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
+      tspan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
+      tspan.setAttribute("dy", "1em");
+      tspan.setAttribute("x", "0");
+      if (isTitle) {
+        tspan.setAttribute("class", "title-row");
+      } else {
+        tspan.setAttribute("class", "row");
+      }
+      tspan.textContent = row.trim();
+      svgLabel.appendChild(tspan);
+    }
+    return svgLabel;
+  }
+}, "createLabel");
+var createLabel_default = createLabel;
+
+// src/dagre-wrapper/shapes/util.js
+import { select as select2 } from "d3";
+var labelHelper = /* @__PURE__ */ __name(async (parent, node, _classes, isNode) => {
+  const config = getConfig();
+  let classes;
+  const useHtmlLabels = node.useHtmlLabels || evaluate(config.flowchart.htmlLabels);
+  if (!_classes) {
+    classes = "node default";
+  } else {
+    classes = _classes;
+  }
+  const shapeSvg = parent.insert("g").attr("class", classes).attr("id", node.domId || node.id);
+  const label = shapeSvg.insert("g").attr("class", "label").attr("style", node.labelStyle);
+  let labelText;
+  if (node.labelText === void 0) {
+    labelText = "";
+  } else {
+    labelText = typeof node.labelText === "string" ? node.labelText : node.labelText[0];
+  }
+  const textNode = label.node();
+  let text;
+  if (node.labelType === "markdown") {
+    text = createText(
+      label,
+      sanitizeText(decodeEntities(labelText), config),
+      {
+        useHtmlLabels,
+        width: node.width || config.flowchart.wrappingWidth,
+        classes: "markdown-node-label"
+      },
+      config
+    );
+  } else {
+    text = textNode.appendChild(
+      createLabel_default(sanitizeText(decodeEntities(labelText), config), node.labelStyle, false, isNode)
+    );
+  }
+  let bbox = text.getBBox();
+  const halfPadding = node.padding / 2;
+  if (evaluate(config.flowchart.htmlLabels)) {
+    const div = text.children[0];
+    const dv = select2(text);
+    const images = div.getElementsByTagName("img");
+    if (images) {
+      const noImgText = labelText.replace(/<img[^>]*>/g, "").trim() === "";
+      await Promise.all(
+        [...images].map(
+          (img) => new Promise((res) => {
+            function setupImage() {
+              img.style.display = "flex";
+              img.style.flexDirection = "column";
+              if (noImgText) {
+                const bodyFontSize = config.fontSize ? config.fontSize : window.getComputedStyle(document.body).fontSize;
+                const enlargingFactor = 5;
+                const width = parseInt(bodyFontSize, 10) * enlargingFactor + "px";
+                img.style.minWidth = width;
+                img.style.maxWidth = width;
+              } else {
+                img.style.width = "100%";
+              }
+              res(img);
+            }
+            __name(setupImage, "setupImage");
+            setTimeout(() => {
+              if (img.complete) {
+                setupImage();
+              }
+            });
+            img.addEventListener("error", setupImage);
+            img.addEventListener("load", setupImage);
+          })
+        )
+      );
+    }
+    bbox = div.getBoundingClientRect();
+    dv.attr("width", bbox.width);
+    dv.attr("height", bbox.height);
+  }
+  if (useHtmlLabels) {
+    label.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")");
+  } else {
+    label.attr("transform", "translate(0, " + -bbox.height / 2 + ")");
+  }
+  if (node.centerLabel) {
+    label.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")");
+  }
+  label.insert("rect", ":first-child");
+  return { shapeSvg, bbox, halfPadding, label };
+}, "labelHelper");
+var updateNodeBounds = /* @__PURE__ */ __name((node, element) => {
+  const bbox = element.node().getBBox();
+  node.width = bbox.width;
+  node.height = bbox.height;
+}, "updateNodeBounds");
+function insertPolygonShape(parent, w, h, points) {
+  return parent.insert("polygon", ":first-child").attr(
+    "points",
+    points.map(function(d) {
+      return d.x + "," + d.y;
+    }).join(" ")
+  ).attr("class", "label-container").attr("transform", "translate(" + -w / 2 + "," + h / 2 + ")");
+}
+__name(insertPolygonShape, "insertPolygonShape");
+
+// src/dagre-wrapper/nodes.js
+import { select as select3 } from "d3";
+
+// src/dagre-wrapper/blockArrowHelper.ts
+var expandAndDeduplicateDirections = /* @__PURE__ */ __name((directions) => {
+  const uniqueDirections = /* @__PURE__ */ new Set();
+  for (const direction of directions) {
+    switch (direction) {
+      case "x":
+        uniqueDirections.add("right");
+        uniqueDirections.add("left");
+        break;
+      case "y":
+        uniqueDirections.add("up");
+        uniqueDirections.add("down");
+        break;
+      default:
+        uniqueDirections.add(direction);
+        break;
+    }
+  }
+  return uniqueDirections;
+}, "expandAndDeduplicateDirections");
+var getArrowPoints = /* @__PURE__ */ __name((duplicatedDirections, bbox, node) => {
+  const directions = expandAndDeduplicateDirections(duplicatedDirections);
+  const f = 2;
+  const height = bbox.height + 2 * node.padding;
+  const midpoint = height / f;
+  const width = bbox.width + 2 * midpoint + node.padding;
+  const padding = node.padding / 2;
+  if (directions.has("right") && directions.has("left") && directions.has("up") && directions.has("down")) {
+    return [
+      // Bottom
+      { x: 0, y: 0 },
+      { x: midpoint, y: 0 },
+      { x: width / 2, y: 2 * padding },
+      { x: width - midpoint, y: 0 },
+      { x: width, y: 0 },
+      // Right
+      { x: width, y: -height / 3 },
+      { x: width + 2 * padding, y: -height / 2 },
+      { x: width, y: -2 * height / 3 },
+      { x: width, y: -height },
+      // Top
+      { x: width - midpoint, y: -height },
+      { x: width / 2, y: -height - 2 * padding },
+      { x: midpoint, y: -height },
+      // Left
+      { x: 0, y: -height },
+      { x: 0, y: -2 * height / 3 },
+      { x: -2 * padding, y: -height / 2 },
+      { x: 0, y: -height / 3 }
+    ];
+  }
+  if (directions.has("right") && directions.has("left") && directions.has("up")) {
+    return [
+      { x: midpoint, y: 0 },
+      { x: width - midpoint, y: 0 },
+      { x: width, y: -height / 2 },
+      { x: width - midpoint, y: -height },
+      { x: midpoint, y: -height },
+      { x: 0, y: -height / 2 }
+    ];
+  }
+  if (directions.has("right") && directions.has("left") && directions.has("down")) {
+    return [
+      { x: 0, y: 0 },
+      { x: midpoint, y: -height },
+      { x: width - midpoint, y: -height },
+      { x: width, y: 0 }
+    ];
+  }
+  if (directions.has("right") && directions.has("up") && directions.has("down")) {
+    return [
+      { x: 0, y: 0 },
+      { x: width, y: -midpoint },
+      { x: width, y: -height + midpoint },
+      { x: 0, y: -height }
+    ];
+  }
+  if (directions.has("left") && directions.has("up") && directions.has("down")) {
+    return [
+      { x: width, y: 0 },
+      { x: 0, y: -midpoint },
+      { x: 0, y: -height + midpoint },
+      { x: width, y: -height }
+    ];
+  }
+  if (directions.has("right") && directions.has("left")) {
+    return [
+      { x: midpoint, y: 0 },
+      { x: midpoint, y: -padding },
+      { x: width - midpoint, y: -padding },
+      { x: width - midpoint, y: 0 },
+      { x: width, y: -height / 2 },
+      { x: width - midpoint, y: -height },
+      { x: width - midpoint, y: -height + padding },
+      { x: midpoint, y: -height + padding },
+      { x: midpoint, y: -height },
+      { x: 0, y: -height / 2 }
+    ];
+  }
+  if (directions.has("up") && directions.has("down")) {
+    return [
+      // Bottom center
+      { x: width / 2, y: 0 },
+      // Left pont of bottom arrow
+      { x: 0, y: -padding },
+      { x: midpoint, y: -padding },
+      // Left top over vertical section
+      { x: midpoint, y: -height + padding },
+      { x: 0, y: -height + padding },
+      // Top of arrow
+      { x: width / 2, y: -height },
+      { x: width, y: -height + padding },
+      // Top of right vertical bar
+      { x: width - midpoint, y: -height + padding },
+      { x: width - midpoint, y: -padding },
+      { x: width, y: -padding }
+    ];
+  }
+  if (directions.has("right") && directions.has("up")) {
+    return [
+      { x: 0, y: 0 },
+      { x: width, y: -midpoint },
+      { x: 0, y: -height }
+    ];
+  }
+  if (directions.has("right") && directions.has("down")) {
+    return [
+      { x: 0, y: 0 },
+      { x: width, y: 0 },
+      { x: 0, y: -height }
+    ];
+  }
+  if (directions.has("left") && directions.has("up")) {
+    return [
+      { x: width, y: 0 },
+      { x: 0, y: -midpoint },
+      { x: width, y: -height }
+    ];
+  }
+  if (directions.has("left") && directions.has("down")) {
+    return [
+      { x: width, y: 0 },
+      { x: 0, y: 0 },
+      { x: width, y: -height }
+    ];
+  }
+  if (directions.has("right")) {
+    return [
+      { x: midpoint, y: -padding },
+      { x: midpoint, y: -padding },
+      { x: width - midpoint, y: -padding },
+      { x: width - midpoint, y: 0 },
+      { x: width, y: -height / 2 },
+      { x: width - midpoint, y: -height },
+      { x: width - midpoint, y: -height + padding },
+      // top left corner of arrow
+      { x: midpoint, y: -height + padding },
+      { x: midpoint, y: -height + padding }
+    ];
+  }
+  if (directions.has("left")) {
+    return [
+      { x: midpoint, y: 0 },
+      { x: midpoint, y: -padding },
+      // Two points, the right corners
+      { x: width - midpoint, y: -padding },
+      { x: width - midpoint, y: -height + padding },
+      { x: midpoint, y: -height + padding },
+      { x: midpoint, y: -height },
+      { x: 0, y: -height / 2 }
+    ];
+  }
+  if (directions.has("up")) {
+    return [
+      // Bottom center
+      { x: midpoint, y: -padding },
+      // Left top over vertical section
+      { x: midpoint, y: -height + padding },
+      { x: 0, y: -height + padding },
+      // Top of arrow
+      { x: width / 2, y: -height },
+      { x: width, y: -height + padding },
+      // Top of right vertical bar
+      { x: width - midpoint, y: -height + padding },
+      { x: width - midpoint, y: -padding }
+    ];
+  }
+  if (directions.has("down")) {
+    return [
+      // Bottom center
+      { x: width / 2, y: 0 },
+      // Left pont of bottom arrow
+      { x: 0, y: -padding },
+      { x: midpoint, y: -padding },
+      // Left top over vertical section
+      { x: midpoint, y: -height + padding },
+      { x: width - midpoint, y: -height + padding },
+      { x: width - midpoint, y: -padding },
+      { x: width, y: -padding }
+    ];
+  }
+  return [{ x: 0, y: 0 }];
+}, "getArrowPoints");
+
+// src/dagre-wrapper/intersect/intersect-node.js
+function intersectNode(node, point) {
+  return node.intersect(point);
+}
+__name(intersectNode, "intersectNode");
+var intersect_node_default = intersectNode;
+
+// src/dagre-wrapper/intersect/intersect-ellipse.js
+function intersectEllipse(node, rx, ry, point) {
+  var cx = node.x;
+  var cy = node.y;
+  var px = cx - point.x;
+  var py = cy - point.y;
+  var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px);
+  var dx = Math.abs(rx * ry * px / det);
+  if (point.x < cx) {
+    dx = -dx;
+  }
+  var dy = Math.abs(rx * ry * py / det);
+  if (point.y < cy) {
+    dy = -dy;
+  }
+  return { x: cx + dx, y: cy + dy };
+}
+__name(intersectEllipse, "intersectEllipse");
+var intersect_ellipse_default = intersectEllipse;
+
+// src/dagre-wrapper/intersect/intersect-circle.js
+function intersectCircle(node, rx, point) {
+  return intersect_ellipse_default(node, rx, rx, point);
+}
+__name(intersectCircle, "intersectCircle");
+var intersect_circle_default = intersectCircle;
+
+// src/dagre-wrapper/intersect/intersect-line.js
+function intersectLine(p1, p2, q1, q2) {
+  var a1, a2, b1, b2, c1, c2;
+  var r1, r2, r3, r4;
+  var denom, offset, num;
+  var x, y;
+  a1 = p2.y - p1.y;
+  b1 = p1.x - p2.x;
+  c1 = p2.x * p1.y - p1.x * p2.y;
+  r3 = a1 * q1.x + b1 * q1.y + c1;
+  r4 = a1 * q2.x + b1 * q2.y + c1;
+  if (r3 !== 0 && r4 !== 0 && sameSign(r3, r4)) {
+    return;
+  }
+  a2 = q2.y - q1.y;
+  b2 = q1.x - q2.x;
+  c2 = q2.x * q1.y - q1.x * q2.y;
+  r1 = a2 * p1.x + b2 * p1.y + c2;
+  r2 = a2 * p2.x + b2 * p2.y + c2;
+  if (r1 !== 0 && r2 !== 0 && sameSign(r1, r2)) {
+    return;
+  }
+  denom = a1 * b2 - a2 * b1;
+  if (denom === 0) {
+    return;
+  }
+  offset = Math.abs(denom / 2);
+  num = b1 * c2 - b2 * c1;
+  x = num < 0 ? (num - offset) / denom : (num + offset) / denom;
+  num = a2 * c1 - a1 * c2;
+  y = num < 0 ? (num - offset) / denom : (num + offset) / denom;
+  return { x, y };
+}
+__name(intersectLine, "intersectLine");
+function sameSign(r1, r2) {
+  return r1 * r2 > 0;
+}
+__name(sameSign, "sameSign");
+var intersect_line_default = intersectLine;
+
+// src/dagre-wrapper/intersect/intersect-polygon.js
+var intersect_polygon_default = intersectPolygon;
+function intersectPolygon(node, polyPoints, point) {
+  var x1 = node.x;
+  var y1 = node.y;
+  var intersections = [];
+  var minX = Number.POSITIVE_INFINITY;
+  var minY = Number.POSITIVE_INFINITY;
+  if (typeof polyPoints.forEach === "function") {
+    polyPoints.forEach(function(entry) {
+      minX = Math.min(minX, entry.x);
+      minY = Math.min(minY, entry.y);
+    });
+  } else {
+    minX = Math.min(minX, polyPoints.x);
+    minY = Math.min(minY, polyPoints.y);
+  }
+  var left = x1 - node.width / 2 - minX;
+  var top = y1 - node.height / 2 - minY;
+  for (var i = 0; i < polyPoints.length; i++) {
+    var p1 = polyPoints[i];
+    var p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0];
+    var intersect = intersect_line_default(
+      node,
+      point,
+      { x: left + p1.x, y: top + p1.y },
+      { x: left + p2.x, y: top + p2.y }
+    );
+    if (intersect) {
+      intersections.push(intersect);
+    }
+  }
+  if (!intersections.length) {
+    return node;
+  }
+  if (intersections.length > 1) {
+    intersections.sort(function(p, q) {
+      var pdx = p.x - point.x;
+      var pdy = p.y - point.y;
+      var distp = Math.sqrt(pdx * pdx + pdy * pdy);
+      var qdx = q.x - point.x;
+      var qdy = q.y - point.y;
+      var distq = Math.sqrt(qdx * qdx + qdy * qdy);
+      return distp < distq ? -1 : distp === distq ? 0 : 1;
+    });
+  }
+  return intersections[0];
+}
+__name(intersectPolygon, "intersectPolygon");
+
+// src/dagre-wrapper/intersect/intersect-rect.js
+var intersectRect = /* @__PURE__ */ __name((node, point) => {
+  var x = node.x;
+  var y = node.y;
+  var dx = point.x - x;
+  var dy = point.y - y;
+  var w = node.width / 2;
+  var h = node.height / 2;
+  var sx, sy;
+  if (Math.abs(dy) * w > Math.abs(dx) * h) {
+    if (dy < 0) {
+      h = -h;
+    }
+    sx = dy === 0 ? 0 : h * dx / dy;
+    sy = h;
+  } else {
+    if (dx < 0) {
+      w = -w;
+    }
+    sx = w;
+    sy = dx === 0 ? 0 : w * dy / dx;
+  }
+  return { x: x + sx, y: y + sy };
+}, "intersectRect");
+var intersect_rect_default = intersectRect;
+
+// src/dagre-wrapper/intersect/index.js
+var intersect_default = {
+  node: intersect_node_default,
+  circle: intersect_circle_default,
+  ellipse: intersect_ellipse_default,
+  polygon: intersect_polygon_default,
+  rect: intersect_rect_default
+};
+
+// src/dagre-wrapper/shapes/note.js
+var note = /* @__PURE__ */ __name(async (parent, node) => {
+  const useHtmlLabels = node.useHtmlLabels || getConfig().flowchart.htmlLabels;
+  if (!useHtmlLabels) {
+    node.centerLabel = true;
+  }
+  const { shapeSvg, bbox, halfPadding } = await labelHelper(
+    parent,
+    node,
+    "node " + node.classes,
+    true
+  );
+  log.info("Classes = ", node.classes);
+  const rect2 = shapeSvg.insert("rect", ":first-child");
+  rect2.attr("rx", node.rx).attr("ry", node.ry).attr("x", -bbox.width / 2 - halfPadding).attr("y", -bbox.height / 2 - halfPadding).attr("width", bbox.width + node.padding).attr("height", bbox.height + node.padding);
+  updateNodeBounds(node, rect2);
+  node.intersect = function(point) {
+    return intersect_default.rect(node, point);
+  };
+  return shapeSvg;
+}, "note");
+var note_default = note;
+
+// src/dagre-wrapper/nodes.js
+var formatClass = /* @__PURE__ */ __name((str) => {
+  if (str) {
+    return " " + str;
+  }
+  return "";
+}, "formatClass");
+var getClassesFromNode = /* @__PURE__ */ __name((node, otherClasses) => {
+  return `${otherClasses ? otherClasses : "node default"}${formatClass(node.classes)} ${formatClass(
+    node.class
+  )}`;
+}, "getClassesFromNode");
+var question = /* @__PURE__ */ __name(async (parent, node) => {
+  const { shapeSvg, bbox } = await labelHelper(
+    parent,
+    node,
+    getClassesFromNode(node, void 0),
+    true
+  );
+  const w = bbox.width + node.padding;
+  const h = bbox.height + node.padding;
+  const s = w + h;
+  const points = [
+    { x: s / 2, y: 0 },
+    { x: s, y: -s / 2 },
+    { x: s / 2, y: -s },
+    { x: 0, y: -s / 2 }
+  ];
+  log.info("Question main (Circle)");
+  const questionElem = insertPolygonShape(shapeSvg, s, s, points);
+  questionElem.attr("style", node.style);
+  updateNodeBounds(node, questionElem);
+  node.intersect = function(point) {
+    log.warn("Intersect called");
+    return intersect_default.polygon(node, points, point);
+  };
+  return shapeSvg;
+}, "question");
+var choice = /* @__PURE__ */ __name((parent, node) => {
+  const shapeSvg = parent.insert("g").attr("class", "node default").attr("id", node.domId || node.id);
+  const s = 28;
+  const points = [
+    { x: 0, y: s / 2 },
+    { x: s / 2, y: 0 },
+    { x: 0, y: -s / 2 },
+    { x: -s / 2, y: 0 }
+  ];
+  const choice2 = shapeSvg.insert("polygon", ":first-child").attr(
+    "points",
+    points.map(function(d) {
+      return d.x + "," + d.y;
+    }).join(" ")
+  );
+  choice2.attr("class", "state-start").attr("r", 7).attr("width", 28).attr("height", 28);
+  node.width = 28;
+  node.height = 28;
+  node.intersect = function(point) {
+    return intersect_default.circle(node, 14, point);
+  };
+  return shapeSvg;
+}, "choice");
+var hexagon = /* @__PURE__ */ __name(async (parent, node) => {
+  const { shapeSvg, bbox } = await labelHelper(
+    parent,
+    node,
+    getClassesFromNode(node, void 0),
+    true
+  );
+  const f = 4;
+  const h = bbox.height + node.padding;
+  const m = h / f;
+  const w = bbox.width + 2 * m + node.padding;
+  const points = [
+    { x: m, y: 0 },
+    { x: w - m, y: 0 },
+    { x: w, y: -h / 2 },
+    { x: w - m, y: -h },
+    { x: m, y: -h },
+    { x: 0, y: -h / 2 }
+  ];
+  const hex = insertPolygonShape(shapeSvg, w, h, points);
+  hex.attr("style", node.style);
+  updateNodeBounds(node, hex);
+  node.intersect = function(point) {
+    return intersect_default.polygon(node, points, point);
+  };
+  return shapeSvg;
+}, "hexagon");
+var block_arrow = /* @__PURE__ */ __name(async (parent, node) => {
+  const { shapeSvg, bbox } = await labelHelper(parent, node, void 0, true);
+  const f = 2;
+  const h = bbox.height + 2 * node.padding;
+  const m = h / f;
+  const w = bbox.width + 2 * m + node.padding;
+  const points = getArrowPoints(node.directions, bbox, node);
+  const blockArrow = insertPolygonShape(shapeSvg, w, h, points);
+  blockArrow.attr("style", node.style);
+  updateNodeBounds(node, blockArrow);
+  node.intersect = function(point) {
+    return intersect_default.polygon(node, points, point);
+  };
+  return shapeSvg;
+}, "block_arrow");
+var rect_left_inv_arrow = /* @__PURE__ */ __name(async (parent, node) => {
+  const { shapeSvg, bbox } = await labelHelper(
+    parent,
+    node,
+    getClassesFromNode(node, void 0),
+    true
+  );
+  const w = bbox.width + node.padding;
+  const h = bbox.height + node.padding;
+  const points = [
+    { x: -h / 2, y: 0 },
+    { x: w, y: 0 },
+    { x: w, y: -h },
+    { x: -h / 2, y: -h },
+    { x: 0, y: -h / 2 }
+  ];
+  const el = insertPolygonShape(shapeSvg, w, h, points);
+  el.attr("style", node.style);
+  node.width = w + h;
+  node.height = h;
+  node.intersect = function(point) {
+    return intersect_default.polygon(node, points, point);
+  };
+  return shapeSvg;
+}, "rect_left_inv_arrow");
+var lean_right = /* @__PURE__ */ __name(async (parent, node) => {
+  const { shapeSvg, bbox } = await labelHelper(parent, node, getClassesFromNode(node), true);
+  const w = bbox.width + node.padding;
+  const h = bbox.height + node.padding;
+  const points = [
+    { x: -2 * h / 6, y: 0 },
+    { x: w - h / 6, y: 0 },
+    { x: w + 2 * h / 6, y: -h },
+    { x: h / 6, y: -h }
+  ];
+  const el = insertPolygonShape(shapeSvg, w, h, points);
+  el.attr("style", node.style);
+  updateNodeBounds(node, el);
+  node.intersect = function(point) {
+    return intersect_default.polygon(node, points, point);
+  };
+  return shapeSvg;
+}, "lean_right");
+var lean_left = /* @__PURE__ */ __name(async (parent, node) => {
+  const { shapeSvg, bbox } = await labelHelper(
+    parent,
+    node,
+    getClassesFromNode(node, void 0),
+    true
+  );
+  const w = bbox.width + node.padding;
+  const h = bbox.height + node.padding;
+  const points = [
+    { x: 2 * h / 6, y: 0 },
+    { x: w + h / 6, y: 0 },
+    { x: w - 2 * h / 6, y: -h },
+    { x: -h / 6, y: -h }
+  ];
+  const el = insertPolygonShape(shapeSvg, w, h, points);
+  el.attr("style", node.style);
+  updateNodeBounds(node, el);
+  node.intersect = function(point) {
+    return intersect_default.polygon(node, points, point);
+  };
+  return shapeSvg;
+}, "lean_left");
+var trapezoid = /* @__PURE__ */ __name(async (parent, node) => {
+  const { shapeSvg, bbox } = await labelHelper(
+    parent,
+    node,
+    getClassesFromNode(node, void 0),
+    true
+  );
+  const w = bbox.width + node.padding;
+  const h = bbox.height + node.padding;
+  const points = [
+    { x: -2 * h / 6, y: 0 },
+    { x: w + 2 * h / 6, y: 0 },
+    { x: w - h / 6, y: -h },
+    { x: h / 6, y: -h }
+  ];
+  const el = insertPolygonShape(shapeSvg, w, h, points);
+  el.attr("style", node.style);
+  updateNodeBounds(node, el);
+  node.intersect = function(point) {
+    return intersect_default.polygon(node, points, point);
+  };
+  return shapeSvg;
+}, "trapezoid");
+var inv_trapezoid = /* @__PURE__ */ __name(async (parent, node) => {
+  const { shapeSvg, bbox } = await labelHelper(
+    parent,
+    node,
+    getClassesFromNode(node, void 0),
+    true
+  );
+  const w = bbox.width + node.padding;
+  const h = bbox.height + node.padding;
+  const points = [
+    { x: h / 6, y: 0 },
+    { x: w - h / 6, y: 0 },
+    { x: w + 2 * h / 6, y: -h },
+    { x: -2 * h / 6, y: -h }
+  ];
+  const el = insertPolygonShape(shapeSvg, w, h, points);
+  el.attr("style", node.style);
+  updateNodeBounds(node, el);
+  node.intersect = function(point) {
+    return intersect_default.polygon(node, points, point);
+  };
+  return shapeSvg;
+}, "inv_trapezoid");
+var rect_right_inv_arrow = /* @__PURE__ */ __name(async (parent, node) => {
+  const { shapeSvg, bbox } = await labelHelper(
+    parent,
+    node,
+    getClassesFromNode(node, void 0),
+    true
+  );
+  const w = bbox.width + node.padding;
+  const h = bbox.height + node.padding;
+  const points = [
+    { x: 0, y: 0 },
+    { x: w + h / 2, y: 0 },
+    { x: w, y: -h / 2 },
+    { x: w + h / 2, y: -h },
+    { x: 0, y: -h }
+  ];
+  const el = insertPolygonShape(shapeSvg, w, h, points);
+  el.attr("style", node.style);
+  updateNodeBounds(node, el);
+  node.intersect = function(point) {
+    return intersect_default.polygon(node, points, point);
+  };
+  return shapeSvg;
+}, "rect_right_inv_arrow");
+var cylinder = /* @__PURE__ */ __name(async (parent, node) => {
+  const { shapeSvg, bbox } = await labelHelper(
+    parent,
+    node,
+    getClassesFromNode(node, void 0),
+    true
+  );
+  const w = bbox.width + node.padding;
+  const rx = w / 2;
+  const ry = rx / (2.5 + w / 50);
+  const h = bbox.height + ry + node.padding;
+  const shape = "M 0," + ry + " a " + rx + "," + ry + " 0,0,0 " + w + " 0 a " + rx + "," + ry + " 0,0,0 " + -w + " 0 l 0," + h + " a " + rx + "," + ry + " 0,0,0 " + w + " 0 l 0," + -h;
+  const el = shapeSvg.attr("label-offset-y", ry).insert("path", ":first-child").attr("style", node.style).attr("d", shape).attr("transform", "translate(" + -w / 2 + "," + -(h / 2 + ry) + ")");
+  updateNodeBounds(node, el);
+  node.intersect = function(point) {
+    const pos = intersect_default.rect(node, point);
+    const x = pos.x - node.x;
+    if (rx != 0 && (Math.abs(x) < node.width / 2 || Math.abs(x) == node.width / 2 && Math.abs(pos.y - node.y) > node.height / 2 - ry)) {
+      let y = ry * ry * (1 - x * x / (rx * rx));
+      if (y != 0) {
+        y = Math.sqrt(y);
+      }
+      y = ry - y;
+      if (point.y - node.y > 0) {
+        y = -y;
+      }
+      pos.y += y;
+    }
+    return pos;
+  };
+  return shapeSvg;
+}, "cylinder");
+var rect = /* @__PURE__ */ __name(async (parent, node) => {
+  const { shapeSvg, bbox, halfPadding } = await labelHelper(
+    parent,
+    node,
+    "node " + node.classes + " " + node.class,
+    true
+  );
+  const rect2 = shapeSvg.insert("rect", ":first-child");
+  const totalWidth = node.positioned ? node.width : bbox.width + node.padding;
+  const totalHeight = node.positioned ? node.height : bbox.height + node.padding;
+  const x = node.positioned ? -totalWidth / 2 : -bbox.width / 2 - halfPadding;
+  const y = node.positioned ? -totalHeight / 2 : -bbox.height / 2 - halfPadding;
+  rect2.attr("class", "basic label-container").attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("x", x).attr("y", y).attr("width", totalWidth).attr("height", totalHeight);
+  if (node.props) {
+    const propKeys = new Set(Object.keys(node.props));
+    if (node.props.borders) {
+      applyNodePropertyBorders(rect2, node.props.borders, totalWidth, totalHeight);
+      propKeys.delete("borders");
+    }
+    propKeys.forEach((propKey) => {
+      log.warn(`Unknown node property ${propKey}`);
+    });
+  }
+  updateNodeBounds(node, rect2);
+  node.intersect = function(point) {
+    return intersect_default.rect(node, point);
+  };
+  return shapeSvg;
+}, "rect");
+var composite = /* @__PURE__ */ __name(async (parent, node) => {
+  const { shapeSvg, bbox, halfPadding } = await labelHelper(
+    parent,
+    node,
+    "node " + node.classes,
+    true
+  );
+  const rect2 = shapeSvg.insert("rect", ":first-child");
+  const totalWidth = node.positioned ? node.width : bbox.width + node.padding;
+  const totalHeight = node.positioned ? node.height : bbox.height + node.padding;
+  const x = node.positioned ? -totalWidth / 2 : -bbox.width / 2 - halfPadding;
+  const y = node.positioned ? -totalHeight / 2 : -bbox.height / 2 - halfPadding;
+  rect2.attr("class", "basic cluster composite label-container").attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("x", x).attr("y", y).attr("width", totalWidth).attr("height", totalHeight);
+  if (node.props) {
+    const propKeys = new Set(Object.keys(node.props));
+    if (node.props.borders) {
+      applyNodePropertyBorders(rect2, node.props.borders, totalWidth, totalHeight);
+      propKeys.delete("borders");
+    }
+    propKeys.forEach((propKey) => {
+      log.warn(`Unknown node property ${propKey}`);
+    });
+  }
+  updateNodeBounds(node, rect2);
+  node.intersect = function(point) {
+    return intersect_default.rect(node, point);
+  };
+  return shapeSvg;
+}, "composite");
+var labelRect = /* @__PURE__ */ __name(async (parent, node) => {
+  const { shapeSvg } = await labelHelper(parent, node, "label", true);
+  log.trace("Classes = ", node.class);
+  const rect2 = shapeSvg.insert("rect", ":first-child");
+  const totalWidth = 0;
+  const totalHeight = 0;
+  rect2.attr("width", totalWidth).attr("height", totalHeight);
+  shapeSvg.attr("class", "label edgeLabel");
+  if (node.props) {
+    const propKeys = new Set(Object.keys(node.props));
+    if (node.props.borders) {
+      applyNodePropertyBorders(rect2, node.props.borders, totalWidth, totalHeight);
+      propKeys.delete("borders");
+    }
+    propKeys.forEach((propKey) => {
+      log.warn(`Unknown node property ${propKey}`);
+    });
+  }
+  updateNodeBounds(node, rect2);
+  node.intersect = function(point) {
+    return intersect_default.rect(node, point);
+  };
+  return shapeSvg;
+}, "labelRect");
+function applyNodePropertyBorders(rect2, borders, totalWidth, totalHeight) {
+  const strokeDashArray = [];
+  const addBorder = /* @__PURE__ */ __name((length) => {
+    strokeDashArray.push(length, 0);
+  }, "addBorder");
+  const skipBorder = /* @__PURE__ */ __name((length) => {
+    strokeDashArray.push(0, length);
+  }, "skipBorder");
+  if (borders.includes("t")) {
+    log.debug("add top border");
+    addBorder(totalWidth);
+  } else {
+    skipBorder(totalWidth);
+  }
+  if (borders.includes("r")) {
+    log.debug("add right border");
+    addBorder(totalHeight);
+  } else {
+    skipBorder(totalHeight);
+  }
+  if (borders.includes("b")) {
+    log.debug("add bottom border");
+    addBorder(totalWidth);
+  } else {
+    skipBorder(totalWidth);
+  }
+  if (borders.includes("l")) {
+    log.debug("add left border");
+    addBorder(totalHeight);
+  } else {
+    skipBorder(totalHeight);
+  }
+  rect2.attr("stroke-dasharray", strokeDashArray.join(" "));
+}
+__name(applyNodePropertyBorders, "applyNodePropertyBorders");
+var rectWithTitle = /* @__PURE__ */ __name((parent, node) => {
+  let classes;
+  if (!node.classes) {
+    classes = "node default";
+  } else {
+    classes = "node " + node.classes;
+  }
+  const shapeSvg = parent.insert("g").attr("class", classes).attr("id", node.domId || node.id);
+  const rect2 = shapeSvg.insert("rect", ":first-child");
+  const innerLine = shapeSvg.insert("line");
+  const label = shapeSvg.insert("g").attr("class", "label");
+  const text2 = node.labelText.flat ? node.labelText.flat() : node.labelText;
+  let title = "";
+  if (typeof text2 === "object") {
+    title = text2[0];
+  } else {
+    title = text2;
+  }
+  log.info("Label text abc79", title, text2, typeof text2 === "object");
+  const text = label.node().appendChild(createLabel_default(title, node.labelStyle, true, true));
+  let bbox = { width: 0, height: 0 };
+  if (evaluate(getConfig().flowchart.htmlLabels)) {
+    const div = text.children[0];
+    const dv = select3(text);
+    bbox = div.getBoundingClientRect();
+    dv.attr("width", bbox.width);
+    dv.attr("height", bbox.height);
+  }
+  log.info("Text 2", text2);
+  const textRows = text2.slice(1, text2.length);
+  let titleBox = text.getBBox();
+  const descr = label.node().appendChild(
+    createLabel_default(textRows.join ? textRows.join("<br/>") : textRows, node.labelStyle, true, true)
+  );
+  if (evaluate(getConfig().flowchart.htmlLabels)) {
+    const div = descr.children[0];
+    const dv = select3(descr);
+    bbox = div.getBoundingClientRect();
+    dv.attr("width", bbox.width);
+    dv.attr("height", bbox.height);
+  }
+  const halfPadding = node.padding / 2;
+  select3(descr).attr(
+    "transform",
+    "translate( " + // (titleBox.width - bbox.width) / 2 +
+    (bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) + ", " + (titleBox.height + halfPadding + 5) + ")"
+  );
+  select3(text).attr(
+    "transform",
+    "translate( " + // (titleBox.width - bbox.width) / 2 +
+    (bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) + ", 0)"
+  );
+  bbox = label.node().getBBox();
+  label.attr(
+    "transform",
+    "translate(" + -bbox.width / 2 + ", " + (-bbox.height / 2 - halfPadding + 3) + ")"
+  );
+  rect2.attr("class", "outer title-state").attr("x", -bbox.width / 2 - halfPadding).attr("y", -bbox.height / 2 - halfPadding).attr("width", bbox.width + node.padding).attr("height", bbox.height + node.padding);
+  innerLine.attr("class", "divider").attr("x1", -bbox.width / 2 - halfPadding).attr("x2", bbox.width / 2 + halfPadding).attr("y1", -bbox.height / 2 - halfPadding + titleBox.height + halfPadding).attr("y2", -bbox.height / 2 - halfPadding + titleBox.height + halfPadding);
+  updateNodeBounds(node, rect2);
+  node.intersect = function(point) {
+    return intersect_default.rect(node, point);
+  };
+  return shapeSvg;
+}, "rectWithTitle");
+var stadium = /* @__PURE__ */ __name(async (parent, node) => {
+  const { shapeSvg, bbox } = await labelHelper(
+    parent,
+    node,
+    getClassesFromNode(node, void 0),
+    true
+  );
+  const h = bbox.height + node.padding;
+  const w = bbox.width + h / 4 + node.padding;
+  const rect2 = shapeSvg.insert("rect", ":first-child").attr("style", node.style).attr("rx", h / 2).attr("ry", h / 2).attr("x", -w / 2).attr("y", -h / 2).attr("width", w).attr("height", h);
+  updateNodeBounds(node, rect2);
+  node.intersect = function(point) {
+    return intersect_default.rect(node, point);
+  };
+  return shapeSvg;
+}, "stadium");
+var circle = /* @__PURE__ */ __name(async (parent, node) => {
+  const { shapeSvg, bbox, halfPadding } = await labelHelper(
+    parent,
+    node,
+    getClassesFromNode(node, void 0),
+    true
+  );
+  const circle2 = shapeSvg.insert("circle", ":first-child");
+  circle2.attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("r", bbox.width / 2 + halfPadding).attr("width", bbox.width + node.padding).attr("height", bbox.height + node.padding);
+  log.info("Circle main");
+  updateNodeBounds(node, circle2);
+  node.intersect = function(point) {
+    log.info("Circle intersect", node, bbox.width / 2 + halfPadding, point);
+    return intersect_default.circle(node, bbox.width / 2 + halfPadding, point);
+  };
+  return shapeSvg;
+}, "circle");
+var doublecircle = /* @__PURE__ */ __name(async (parent, node) => {
+  const { shapeSvg, bbox, halfPadding } = await labelHelper(
+    parent,
+    node,
+    getClassesFromNode(node, void 0),
+    true
+  );
+  const gap = 5;
+  const circleGroup = shapeSvg.insert("g", ":first-child");
+  const outerCircle = circleGroup.insert("circle");
+  const innerCircle = circleGroup.insert("circle");
+  circleGroup.attr("class", node.class);
+  outerCircle.attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("r", bbox.width / 2 + halfPadding + gap).attr("width", bbox.width + node.padding + gap * 2).attr("height", bbox.height + node.padding + gap * 2);
+  innerCircle.attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("r", bbox.width / 2 + halfPadding).attr("width", bbox.width + node.padding).attr("height", bbox.height + node.padding);
+  log.info("DoubleCircle main");
+  updateNodeBounds(node, outerCircle);
+  node.intersect = function(point) {
+    log.info("DoubleCircle intersect", node, bbox.width / 2 + halfPadding + gap, point);
+    return intersect_default.circle(node, bbox.width / 2 + halfPadding + gap, point);
+  };
+  return shapeSvg;
+}, "doublecircle");
+var subroutine = /* @__PURE__ */ __name(async (parent, node) => {
+  const { shapeSvg, bbox } = await labelHelper(
+    parent,
+    node,
+    getClassesFromNode(node, void 0),
+    true
+  );
+  const w = bbox.width + node.padding;
+  const h = bbox.height + node.padding;
+  const points = [
+    { x: 0, y: 0 },
+    { x: w, y: 0 },
+    { x: w, y: -h },
+    { x: 0, y: -h },
+    { x: 0, y: 0 },
+    { x: -8, y: 0 },
+    { x: w + 8, y: 0 },
+    { x: w + 8, y: -h },
+    { x: -8, y: -h },
+    { x: -8, y: 0 }
+  ];
+  const el = insertPolygonShape(shapeSvg, w, h, points);
+  el.attr("style", node.style);
+  updateNodeBounds(node, el);
+  node.intersect = function(point) {
+    return intersect_default.polygon(node, points, point);
+  };
+  return shapeSvg;
+}, "subroutine");
+var start = /* @__PURE__ */ __name((parent, node) => {
+  const shapeSvg = parent.insert("g").attr("class", "node default").attr("id", node.domId || node.id);
+  const circle2 = shapeSvg.insert("circle", ":first-child");
+  circle2.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14);
+  updateNodeBounds(node, circle2);
+  node.intersect = function(point) {
+    return intersect_default.circle(node, 7, point);
+  };
+  return shapeSvg;
+}, "start");
+var forkJoin = /* @__PURE__ */ __name((parent, node, dir) => {
+  const shapeSvg = parent.insert("g").attr("class", "node default").attr("id", node.domId || node.id);
+  let width = 70;
+  let height = 10;
+  if (dir === "LR") {
+    width = 10;
+    height = 70;
+  }
+  const shape = shapeSvg.append("rect").attr("x", -1 * width / 2).attr("y", -1 * height / 2).attr("width", width).attr("height", height).attr("class", "fork-join");
+  updateNodeBounds(node, shape);
+  node.height = node.height + node.padding / 2;
+  node.width = node.width + node.padding / 2;
+  node.intersect = function(point) {
+    return intersect_default.rect(node, point);
+  };
+  return shapeSvg;
+}, "forkJoin");
+var end = /* @__PURE__ */ __name((parent, node) => {
+  const shapeSvg = parent.insert("g").attr("class", "node default").attr("id", node.domId || node.id);
+  const innerCircle = shapeSvg.insert("circle", ":first-child");
+  const circle2 = shapeSvg.insert("circle", ":first-child");
+  circle2.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14);
+  innerCircle.attr("class", "state-end").attr("r", 5).attr("width", 10).attr("height", 10);
+  updateNodeBounds(node, circle2);
+  node.intersect = function(point) {
+    return intersect_default.circle(node, 7, point);
+  };
+  return shapeSvg;
+}, "end");
+var class_box = /* @__PURE__ */ __name((parent, node) => {
+  const halfPadding = node.padding / 2;
+  const rowPadding = 4;
+  const lineHeight = 8;
+  let classes;
+  if (!node.classes) {
+    classes = "node default";
+  } else {
+    classes = "node " + node.classes;
+  }
+  const shapeSvg = parent.insert("g").attr("class", classes).attr("id", node.domId || node.id);
+  const rect2 = shapeSvg.insert("rect", ":first-child");
+  const topLine = shapeSvg.insert("line");
+  const bottomLine = shapeSvg.insert("line");
+  let maxWidth = 0;
+  let maxHeight = rowPadding;
+  const labelContainer = shapeSvg.insert("g").attr("class", "label");
+  let verticalPos = 0;
+  const hasInterface = node.classData.annotations?.[0];
+  const interfaceLabelText = node.classData.annotations[0] ? "\xAB" + node.classData.annotations[0] + "\xBB" : "";
+  const interfaceLabel = labelContainer.node().appendChild(createLabel_default(interfaceLabelText, node.labelStyle, true, true));
+  let interfaceBBox = interfaceLabel.getBBox();
+  if (evaluate(getConfig().flowchart.htmlLabels)) {
+    const div = interfaceLabel.children[0];
+    const dv = select3(interfaceLabel);
+    interfaceBBox = div.getBoundingClientRect();
+    dv.attr("width", interfaceBBox.width);
+    dv.attr("height", interfaceBBox.height);
+  }
+  if (node.classData.annotations[0]) {
+    maxHeight += interfaceBBox.height + rowPadding;
+    maxWidth += interfaceBBox.width;
+  }
+  let classTitleString = node.classData.label;
+  if (node.classData.type !== void 0 && node.classData.type !== "") {
+    if (getConfig().flowchart.htmlLabels) {
+      classTitleString += "&lt;" + node.classData.type + "&gt;";
+    } else {
+      classTitleString += "<" + node.classData.type + ">";
+    }
+  }
+  const classTitleLabel = labelContainer.node().appendChild(createLabel_default(classTitleString, node.labelStyle, true, true));
+  select3(classTitleLabel).attr("class", "classTitle");
+  let classTitleBBox = classTitleLabel.getBBox();
+  if (evaluate(getConfig().flowchart.htmlLabels)) {
+    const div = classTitleLabel.children[0];
+    const dv = select3(classTitleLabel);
+    classTitleBBox = div.getBoundingClientRect();
+    dv.attr("width", classTitleBBox.width);
+    dv.attr("height", classTitleBBox.height);
+  }
+  maxHeight += classTitleBBox.height + rowPadding;
+  if (classTitleBBox.width > maxWidth) {
+    maxWidth = classTitleBBox.width;
+  }
+  const classAttributes = [];
+  node.classData.members.forEach((member) => {
+    const parsedInfo = member.getDisplayDetails();
+    let parsedText = parsedInfo.displayText;
+    if (getConfig().flowchart.htmlLabels) {
+      parsedText = parsedText.replace(/</g, "&lt;").replace(/>/g, "&gt;");
+    }
+    const lbl = labelContainer.node().appendChild(
+      createLabel_default(
+        parsedText,
+        parsedInfo.cssStyle ? parsedInfo.cssStyle : node.labelStyle,
+        true,
+        true
+      )
+    );
+    let bbox = lbl.getBBox();
+    if (evaluate(getConfig().flowchart.htmlLabels)) {
+      const div = lbl.children[0];
+      const dv = select3(lbl);
+      bbox = div.getBoundingClientRect();
+      dv.attr("width", bbox.width);
+      dv.attr("height", bbox.height);
+    }
+    if (bbox.width > maxWidth) {
+      maxWidth = bbox.width;
+    }
+    maxHeight += bbox.height + rowPadding;
+    classAttributes.push(lbl);
+  });
+  maxHeight += lineHeight;
+  const classMethods = [];
+  node.classData.methods.forEach((member) => {
+    const parsedInfo = member.getDisplayDetails();
+    let displayText = parsedInfo.displayText;
+    if (getConfig().flowchart.htmlLabels) {
+      displayText = displayText.replace(/</g, "&lt;").replace(/>/g, "&gt;");
+    }
+    const lbl = labelContainer.node().appendChild(
+      createLabel_default(
+        displayText,
+        parsedInfo.cssStyle ? parsedInfo.cssStyle : node.labelStyle,
+        true,
+        true
+      )
+    );
+    let bbox = lbl.getBBox();
+    if (evaluate(getConfig().flowchart.htmlLabels)) {
+      const div = lbl.children[0];
+      const dv = select3(lbl);
+      bbox = div.getBoundingClientRect();
+      dv.attr("width", bbox.width);
+      dv.attr("height", bbox.height);
+    }
+    if (bbox.width > maxWidth) {
+      maxWidth = bbox.width;
+    }
+    maxHeight += bbox.height + rowPadding;
+    classMethods.push(lbl);
+  });
+  maxHeight += lineHeight;
+  if (hasInterface) {
+    let diffX2 = (maxWidth - interfaceBBox.width) / 2;
+    select3(interfaceLabel).attr(
+      "transform",
+      "translate( " + (-1 * maxWidth / 2 + diffX2) + ", " + -1 * maxHeight / 2 + ")"
+    );
+    verticalPos = interfaceBBox.height + rowPadding;
+  }
+  let diffX = (maxWidth - classTitleBBox.width) / 2;
+  select3(classTitleLabel).attr(
+    "transform",
+    "translate( " + (-1 * maxWidth / 2 + diffX) + ", " + (-1 * maxHeight / 2 + verticalPos) + ")"
+  );
+  verticalPos += classTitleBBox.height + rowPadding;
+  topLine.attr("class", "divider").attr("x1", -maxWidth / 2 - halfPadding).attr("x2", maxWidth / 2 + halfPadding).attr("y1", -maxHeight / 2 - halfPadding + lineHeight + verticalPos).attr("y2", -maxHeight / 2 - halfPadding + lineHeight + verticalPos);
+  verticalPos += lineHeight;
+  classAttributes.forEach((lbl) => {
+    select3(lbl).attr(
+      "transform",
+      "translate( " + -maxWidth / 2 + ", " + (-1 * maxHeight / 2 + verticalPos + lineHeight / 2) + ")"
+    );
+    const memberBBox = lbl?.getBBox();
+    verticalPos += (memberBBox?.height ?? 0) + rowPadding;
+  });
+  verticalPos += lineHeight;
+  bottomLine.attr("class", "divider").attr("x1", -maxWidth / 2 - halfPadding).attr("x2", maxWidth / 2 + halfPadding).attr("y1", -maxHeight / 2 - halfPadding + lineHeight + verticalPos).attr("y2", -maxHeight / 2 - halfPadding + lineHeight + verticalPos);
+  verticalPos += lineHeight;
+  classMethods.forEach((lbl) => {
+    select3(lbl).attr(
+      "transform",
+      "translate( " + -maxWidth / 2 + ", " + (-1 * maxHeight / 2 + verticalPos) + ")"
+    );
+    const memberBBox = lbl?.getBBox();
+    verticalPos += (memberBBox?.height ?? 0) + rowPadding;
+  });
+  rect2.attr("style", node.style).attr("class", "outer title-state").attr("x", -maxWidth / 2 - halfPadding).attr("y", -(maxHeight / 2) - halfPadding).attr("width", maxWidth + node.padding).attr("height", maxHeight + node.padding);
+  updateNodeBounds(node, rect2);
+  node.intersect = function(point) {
+    return intersect_default.rect(node, point);
+  };
+  return shapeSvg;
+}, "class_box");
+var shapes = {
+  rhombus: question,
+  composite,
+  question,
+  rect,
+  labelRect,
+  rectWithTitle,
+  choice,
+  circle,
+  doublecircle,
+  stadium,
+  hexagon,
+  block_arrow,
+  rect_left_inv_arrow,
+  lean_right,
+  lean_left,
+  trapezoid,
+  inv_trapezoid,
+  rect_right_inv_arrow,
+  cylinder,
+  start,
+  end,
+  note: note_default,
+  subroutine,
+  fork: forkJoin,
+  join: forkJoin,
+  class_box
+};
+var nodeElems = {};
+var insertNode = /* @__PURE__ */ __name(async (elem, node, dir) => {
+  let newEl;
+  let el;
+  if (node.link) {
+    let target;
+    if (getConfig().securityLevel === "sandbox") {
+      target = "_top";
+    } else if (node.linkTarget) {
+      target = node.linkTarget || "_blank";
+    }
+    newEl = elem.insert("svg:a").attr("xlink:href", node.link).attr("target", target);
+    el = await shapes[node.shape](newEl, node, dir);
+  } else {
+    el = await shapes[node.shape](elem, node, dir);
+    newEl = el;
+  }
+  if (node.tooltip) {
+    el.attr("title", node.tooltip);
+  }
+  if (node.class) {
+    el.attr("class", "node default " + node.class);
+  }
+  nodeElems[node.id] = newEl;
+  if (node.haveCallback) {
+    nodeElems[node.id].attr("class", nodeElems[node.id].attr("class") + " clickable");
+  }
+  return newEl;
+}, "insertNode");
+var setNodeElem = /* @__PURE__ */ __name((elem, node) => {
+  nodeElems[node.id] = elem;
+}, "setNodeElem");
+var clear = /* @__PURE__ */ __name(() => {
+  nodeElems = {};
+}, "clear");
+var positionNode = /* @__PURE__ */ __name((node) => {
+  const el = nodeElems[node.id];
+  log.trace(
+    "Transforming node",
+    node.diff,
+    node,
+    "translate(" + (node.x - node.width / 2 - 5) + ", " + node.width / 2 + ")"
+  );
+  const padding = 8;
+  const diff = node.diff || 0;
+  if (node.clusterNode) {
+    el.attr(
+      "transform",
+      "translate(" + (node.x + diff - node.width / 2) + ", " + (node.y - node.height / 2 - padding) + ")"
+    );
+  } else {
+    el.attr("transform", "translate(" + node.x + ", " + node.y + ")");
+  }
+  return diff;
+}, "positionNode");
+
+export {
+  createLabel_default,
+  intersect_rect_default,
+  updateNodeBounds,
+  insertNode,
+  setNodeElem,
+  clear,
+  positionNode
+};

+ 69 - 55
nicegui/elements/lib/mermaid/classDiagram-bfe30095.js → nicegui/elements/lib/mermaid/chunks/mermaid.core/classDiagram-MQQPYQM5.mjs

@@ -1,20 +1,29 @@
-import { p as parser, d as db, s as styles } from "./styles-c47180b5.js";
-import { line, curveBasis, select } from "d3";
-import { layout } from "dagre-d3-es/src/dagre/index.js";
+import {
+  classDb_default,
+  classDiagram_default,
+  styles_default
+} from "./chunk-IBIA4ERB.mjs";
+import {
+  utils_default
+} from "./chunk-VKXSJROQ.mjs";
+import {
+  __name,
+  configureSvgSize,
+  getConfig2 as getConfig,
+  log,
+  parseGenericTypes
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/diagrams/class/classRenderer.js
+import { select } from "d3";
+import { layout as dagreLayout } from "dagre-d3-es/src/dagre/index.js";
 import * as graphlib from "dagre-d3-es/src/graphlib/index.js";
-import { u as utils, l as log, v as parseGenericTypes, c as getConfig, i as configureSvgSize } from "./mermaid-485fd1a4.js";
-import "ts-dedent";
-import "dayjs";
-import "@braintree/sanitize-url";
-import "dompurify";
-import "khroma";
-import "lodash-es/memoize.js";
-import "lodash-es/merge.js";
-import "stylis";
-import "lodash-es/isEmpty.js";
-let edgeCount = 0;
-const drawEdge = function(elem, path, relation, conf, diagObj) {
-  const getRelationType = function(type) {
+
+// src/diagrams/class/svgDraw.js
+import { line, curveBasis } from "d3";
+var edgeCount = 0;
+var drawEdge = /* @__PURE__ */ __name(function(elem, path, relation, conf, diagObj) {
+  const getRelationType = /* @__PURE__ */ __name(function(type) {
     switch (type) {
       case diagObj.db.relationType.AGGREGATION:
         return "aggregation";
@@ -27,7 +36,7 @@ const drawEdge = function(elem, path, relation, conf, diagObj) {
       case diagObj.db.relationType.LOLLIPOP:
         return "lollipop";
     }
-  };
+  }, "getRelationType");
   path.points = path.points.filter((p) => !Number.isNaN(p.y));
   const lineData = path.points;
   const lineFunction = line().x(function(d) {
@@ -62,18 +71,18 @@ const drawEdge = function(elem, path, relation, conf, diagObj) {
   }
   let x, y;
   const l = path.points.length;
-  let labelPosition = utils.calcLabelPosition(path.points);
+  let labelPosition = utils_default.calcLabelPosition(path.points);
   x = labelPosition.x;
   y = labelPosition.y;
   let p1_card_x, p1_card_y;
   let p2_card_x, p2_card_y;
   if (l % 2 !== 0 && l > 1) {
-    let cardinality_1_point = utils.calcCardinalityPosition(
+    let cardinality_1_point = utils_default.calcCardinalityPosition(
       relation.relation.type1 !== "none",
       path.points,
       path.points[0]
     );
-    let cardinality_2_point = utils.calcCardinalityPosition(
+    let cardinality_2_point = utils_default.calcCardinalityPosition(
       relation.relation.type2 !== "none",
       path.points,
       path.points[l - 1]
@@ -102,8 +111,8 @@ const drawEdge = function(elem, path, relation, conf, diagObj) {
     g.append("text").attr("class", "type2").attr("x", p2_card_x).attr("y", p2_card_y).attr("fill", "black").attr("font-size", "6").text(relation.relationTitle2);
   }
   edgeCount++;
-};
-const drawClass = function(elem, classDef, conf, diagObj) {
+}, "drawEdge");
+var drawClass = /* @__PURE__ */ __name(function(elem, classDef, conf, diagObj) {
   log.debug("Rendering class ", classDef, conf);
   const id = classDef.id;
   const classInfo = {
@@ -121,7 +130,7 @@ const drawClass = function(elem, classDef, conf, diagObj) {
   }
   let isFirst = true;
   classDef.annotations.forEach(function(member) {
-    const titleText2 = title.append("tspan").text("«" + member + "»");
+    const titleText2 = title.append("tspan").text("\xAB" + member + "\xBB");
     if (!isFirst) {
       titleText2.attr("dy", conf.textHeight);
     }
@@ -177,15 +186,15 @@ const drawClass = function(elem, classDef, conf, diagObj) {
   classInfo.width = rectWidth;
   classInfo.height = classBox.height + conf.padding + 0.5 * conf.dividerMargin;
   return classInfo;
-};
-const getClassTitleString = function(classDef) {
+}, "drawClass");
+var getClassTitleString = /* @__PURE__ */ __name(function(classDef) {
   let classTitleString = classDef.id;
   if (classDef.type) {
     classTitleString += "<" + parseGenericTypes(classDef.type) + ">";
   }
   return classTitleString;
-};
-const drawNote = function(elem, note, conf, diagObj) {
+}, "getClassTitleString");
+var drawNote = /* @__PURE__ */ __name(function(elem, note, conf, _diagObj) {
   log.debug("Rendering note ", note, conf);
   const id = note.id;
   const noteInfo = {
@@ -213,8 +222,8 @@ const drawNote = function(elem, note, conf, diagObj) {
   noteInfo.width = rectWidth;
   noteInfo.height = noteBox.height + lines.length * conf.textHeight + conf.padding + 0.5 * conf.dividerMargin;
   return noteInfo;
-};
-const addTspan = function(textEl, member, isFirst, conf) {
+}, "drawNote");
+var addTspan = /* @__PURE__ */ __name(function(textEl, member, isFirst, conf) {
   const { displayText, cssStyle } = member.getDisplayDetails();
   const tSpan = textEl.append("tspan").attr("x", conf.padding).text(displayText);
   if (cssStyle !== "") {
@@ -223,22 +232,24 @@ const addTspan = function(textEl, member, isFirst, conf) {
   if (!isFirst) {
     tSpan.attr("dy", conf.textHeight);
   }
-};
-const svgDraw = {
+}, "addTspan");
+var svgDraw_default = {
   getClassTitleString,
   drawClass,
   drawEdge,
   drawNote
 };
-let idCache = {};
-const padding = 20;
-const getGraphId = function(label) {
+
+// src/diagrams/class/classRenderer.js
+var idCache = {};
+var padding = 20;
+var getGraphId = /* @__PURE__ */ __name(function(label) {
   const foundEntry = Object.entries(idCache).find((entry) => entry[1].label === label);
   if (foundEntry) {
     return foundEntry[0];
   }
-};
-const insertMarkers = function(elem) {
+}, "getGraphId");
+var insertMarkers = /* @__PURE__ */ __name(function(elem) {
   elem.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z");
   elem.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
   elem.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
@@ -247,8 +258,8 @@ const insertMarkers = function(elem) {
   elem.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
   elem.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z");
   elem.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
-};
-const draw = function(text, id, _version, diagObj) {
+}, "insertMarkers");
+var draw = /* @__PURE__ */ __name(function(text, id, _version, diagObj) {
   const conf = getConfig().class;
   idCache = {};
   log.info("Rendering diagram " + text);
@@ -270,10 +281,10 @@ const draw = function(text, id, _version, diagObj) {
     return {};
   });
   const classes = diagObj.db.getClasses();
-  const keys = Object.keys(classes);
+  const keys = [...classes.keys()];
   for (const key of keys) {
-    const classDef = classes[key];
-    const node = svgDraw.drawClass(diagram2, classDef, conf, diagObj);
+    const classDef = classes.get(key);
+    const node = svgDraw_default.drawClass(diagram2, classDef, conf, diagObj);
     idCache[node.id] = node;
     g.setNode(node.id, node);
     log.info("Org height: " + node.height);
@@ -281,6 +292,7 @@ const draw = function(text, id, _version, diagObj) {
   const relations = diagObj.db.getRelations();
   relations.forEach(function(relation) {
     log.info(
+      // cspell:ignore tjoho
       "tjoho" + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation)
     );
     g.setEdge(
@@ -295,10 +307,10 @@ const draw = function(text, id, _version, diagObj) {
   const notes = diagObj.db.getNotes();
   notes.forEach(function(note) {
     log.debug(`Adding note: ${JSON.stringify(note)}`);
-    const node = svgDraw.drawNote(diagram2, note, conf, diagObj);
+    const node = svgDraw_default.drawNote(diagram2, note, conf, diagObj);
     idCache[node.id] = node;
     g.setNode(node.id, node);
-    if (note.class && note.class in classes) {
+    if (note.class && classes.has(note.class)) {
       g.setEdge(
         note.id,
         getGraphId(note.class),
@@ -317,7 +329,7 @@ const draw = function(text, id, _version, diagObj) {
       );
     }
   });
-  layout(g);
+  dagreLayout(g);
   g.nodes().forEach(function(v) {
     if (v !== void 0 && g.node(v) !== void 0) {
       log.debug("Node " + v + ": " + JSON.stringify(g.node(v)));
@@ -330,7 +342,7 @@ const draw = function(text, id, _version, diagObj) {
   g.edges().forEach(function(e) {
     if (e !== void 0 && g.edge(e) !== void 0) {
       log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(g.edge(e)));
-      svgDraw.drawEdge(diagram2, g.edge(e), g.edge(e).relation, conf, diagObj);
+      svgDraw_default.drawEdge(diagram2, g.edge(e), g.edge(e).relation, conf, diagObj);
     }
   });
   const svgBounds = diagram2.node().getBBox();
@@ -340,22 +352,24 @@ const draw = function(text, id, _version, diagObj) {
   const vBox = `${svgBounds.x - padding} ${svgBounds.y - padding} ${width} ${height}`;
   log.debug(`viewBox ${vBox}`);
   diagram2.attr("viewBox", vBox);
-};
-const renderer = {
+}, "draw");
+var classRenderer_default = {
   draw
 };
-const diagram = {
-  parser,
-  db,
-  renderer,
-  styles,
-  init: (cnf) => {
+
+// src/diagrams/class/classDiagram.ts
+var diagram = {
+  parser: classDiagram_default,
+  db: classDb_default,
+  renderer: classRenderer_default,
+  styles: styles_default,
+  init: /* @__PURE__ */ __name((cnf) => {
     if (!cnf.class) {
       cnf.class = {};
     }
     cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
-    db.clear();
-  }
+    classDb_default.clear();
+  }, "init")
 };
 export {
   diagram

+ 446 - 84
nicegui/elements/lib/mermaid/index-b0b3af87.js → nicegui/elements/lib/mermaid/chunks/mermaid.core/classDiagram-v2-4S5WAI72.mjs

@@ -1,27 +1,73 @@
-import { layout } from "dagre-d3-es/src/dagre/index.js";
+import {
+  clear as clear2,
+  insertEdge,
+  insertEdgeLabel,
+  markers_default,
+  positionEdgeLabel
+} from "./chunk-PDCO53Z4.mjs";
+import {
+  classDb_default,
+  classDiagram_default,
+  styles_default
+} from "./chunk-IBIA4ERB.mjs";
+import {
+  clear,
+  createLabel_default,
+  insertNode,
+  intersect_rect_default,
+  positionNode,
+  setNodeElem,
+  updateNodeBounds
+} from "./chunk-Z2VRG6XP.mjs";
+import {
+  getSubGraphTitleMargins
+} from "./chunk-TINLTEC2.mjs";
+import {
+  createText
+} from "./chunk-OERGPBFJ.mjs";
+import {
+  getEdgeId,
+  getStylesFromArray,
+  interpolateToCurve,
+  utils_default
+} from "./chunk-VKXSJROQ.mjs";
+import {
+  __name,
+  common_default,
+  evaluate,
+  getConfig2 as getConfig,
+  log,
+  setupGraphViewbox
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/diagrams/class/classRenderer-v2.ts
+import { select as select2, curveLinear } from "d3";
+import * as graphlib2 from "dagre-d3-es/src/graphlib/index.js";
+
+// src/dagre-wrapper/index.js
+import { layout as dagreLayout } from "dagre-d3-es/src/dagre/index.js";
+import * as graphlibJson2 from "dagre-d3-es/src/graphlib/json.js";
+
+// src/dagre-wrapper/mermaid-graphlib.js
 import * as graphlibJson from "dagre-d3-es/src/graphlib/json.js";
-import { c as createLabel, i as intersectRect, a as insertMarkers, b as clear$2, d as clear$3, u as updateNodeBounds, s as setNodeElem, e as insertNode, f as insertEdgeLabel, p as positionNode, g as insertEdge, h as positionEdgeLabel } from "./edges-bc33a094.js";
-import { l as log, m as evaluate, c as getConfig } from "./mermaid-485fd1a4.js";
 import * as graphlib from "dagre-d3-es/src/graphlib/index.js";
-import { c as createText } from "./createText-b3507a77.js";
-import { select } from "d3";
-let clusterDb = {};
-let descendants = {};
-let parents = {};
-const clear$1 = () => {
+var clusterDb = {};
+var descendants = {};
+var parents = {};
+var clear3 = /* @__PURE__ */ __name(() => {
   descendants = {};
   parents = {};
   clusterDb = {};
-};
-const isDescendant = (id, ancenstorId) => {
-  log.trace("In isDecendant", ancenstorId, " ", id, " = ", descendants[ancenstorId].includes(id));
-  if (descendants[ancenstorId].includes(id)) {
+}, "clear");
+var isDescendant = /* @__PURE__ */ __name((id, ancestorId) => {
+  log.trace("In isDescendant", ancestorId, " ", id, " = ", descendants[ancestorId].includes(id));
+  if (descendants[ancestorId].includes(id)) {
     return true;
   }
   return false;
-};
-const edgeInCluster = (edge, clusterId) => {
-  log.info("Decendants of ", clusterId, " is ", descendants[clusterId]);
+}, "isDescendant");
+var edgeInCluster = /* @__PURE__ */ __name((edge, clusterId) => {
+  log.info("Descendants of ", clusterId, " is ", descendants[clusterId]);
   log.info("Edge is ", edge);
   if (edge.v === clusterId) {
     return false;
@@ -30,12 +76,12 @@ const edgeInCluster = (edge, clusterId) => {
     return false;
   }
   if (!descendants[clusterId]) {
-    log.debug("Tilt, ", clusterId, ",not in decendants");
+    log.debug("Tilt, ", clusterId, ",not in descendants");
     return false;
   }
   return descendants[clusterId].includes(edge.v) || isDescendant(edge.v, clusterId) || isDescendant(edge.w, clusterId) || descendants[clusterId].includes(edge.w);
-};
-const copy = (clusterId, graph, newGraph, rootId) => {
+}, "edgeInCluster");
+var copy = /* @__PURE__ */ __name((clusterId, graph, newGraph, rootId) => {
   log.warn(
     "Copying children of ",
     clusterId,
@@ -106,8 +152,8 @@ const copy = (clusterId, graph, newGraph, rootId) => {
     log.debug("Removing node", node);
     graph.removeNode(node);
   });
-};
-const extractDescendants = (id, graph) => {
+}, "copy");
+var extractDescendants = /* @__PURE__ */ __name((id, graph) => {
   const children = graph.children(id);
   let res = [...children];
   for (const child of children) {
@@ -115,8 +161,8 @@ const extractDescendants = (id, graph) => {
     res = [...res, ...extractDescendants(child, graph)];
   }
   return res;
-};
-const findNonClusterChild = (id, graph) => {
+}, "extractDescendants");
+var findNonClusterChild = /* @__PURE__ */ __name((id, graph) => {
   log.trace("Searching", id);
   const children = graph.children(id);
   log.trace("Searching children of id ", id, children);
@@ -131,8 +177,8 @@ const findNonClusterChild = (id, graph) => {
       return _id;
     }
   }
-};
-const getAnchorId = (id) => {
+}, "findNonClusterChild");
+var getAnchorId = /* @__PURE__ */ __name((id) => {
   if (!clusterDb[id]) {
     return id;
   }
@@ -143,8 +189,8 @@ const getAnchorId = (id) => {
     return clusterDb[id].id;
   }
   return id;
-};
-const adjustClustersAndEdges = (graph, depth) => {
+}, "getAnchorId");
+var adjustClustersAndEdges = /* @__PURE__ */ __name((graph, depth) => {
   if (!graph || depth > 10) {
     log.debug("Opting out, no graph ");
     return;
@@ -175,7 +221,7 @@ const adjustClustersAndEdges = (graph, depth) => {
           const d2 = isDescendant(edge.w, id);
           if (d1 ^ d2) {
             log.warn("Edge: ", edge, " leaves cluster ", id);
-            log.warn("Decendants of XXX ", id, ": ", descendants[id]);
+            log.warn("Descendants of XXX ", id, ": ", descendants[id]);
             clusterDb[id].externalConnections = true;
           }
         }
@@ -184,6 +230,13 @@ const adjustClustersAndEdges = (graph, depth) => {
       log.debug("Not a cluster ", id, descendants);
     }
   });
+  for (let id of Object.keys(clusterDb)) {
+    const nonClusterChild = clusterDb[id].id;
+    const parent = graph.parent(nonClusterChild);
+    if (parent !== id && clusterDb[parent] && !clusterDb[parent].externalConnections) {
+      clusterDb[id].id = parent;
+    }
+  }
   graph.edges().forEach(function(e) {
     const edge = graph.edge(e);
     log.warn("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(e));
@@ -232,9 +285,13 @@ const adjustClustersAndEdges = (graph, depth) => {
       w = getAnchorId(e.w);
       graph.removeEdge(e.v, e.w, e.name);
       if (v !== e.v) {
+        const parent = graph.parent(v);
+        clusterDb[parent].externalConnections = true;
         edge.fromCluster = e.v;
       }
       if (w !== e.w) {
+        const parent = graph.parent(w);
+        clusterDb[parent].externalConnections = true;
         edge.toCluster = e.w;
       }
       log.warn("Fix Replacing with XXX", v, w, e.name);
@@ -244,8 +301,8 @@ const adjustClustersAndEdges = (graph, depth) => {
   log.warn("Adjusted Graph", graphlibJson.write(graph));
   extractor(graph, 0);
   log.trace(clusterDb);
-};
-const extractor = (graph, depth) => {
+}, "adjustClustersAndEdges");
+var extractor = /* @__PURE__ */ __name((graph, depth) => {
   log.warn("extractor - ", depth, graphlibJson.write(graph), graph.children("D"));
   if (depth > 10) {
     log.error("Bailing out");
@@ -285,7 +342,7 @@ const extractor = (graph, depth) => {
       );
       const graphSettings = graph.graph();
       let dir = graphSettings.rankdir === "TB" ? "LR" : "TB";
-      if (clusterDb[node] && clusterDb[node].clusterData && clusterDb[node].clusterData.dir) {
+      if (clusterDb[node]?.clusterData?.dir) {
         dir = clusterDb[node].clusterData.dir;
         log.warn("Fixing dir", clusterDb[node].clusterData.dir, dir);
       }
@@ -338,8 +395,8 @@ const extractor = (graph, depth) => {
       extractor(data.graph, depth + 1);
     }
   }
-};
-const sorter = (graph, nodes) => {
+}, "extractor");
+var sorter = /* @__PURE__ */ __name((graph, nodes) => {
   if (nodes.length === 0) {
     return [];
   }
@@ -350,17 +407,21 @@ const sorter = (graph, nodes) => {
     result = [...result, ...sorted];
   });
   return result;
-};
-const sortNodesByHierarchy = (graph) => sorter(graph, graph.children());
-const rect = (parent, node) => {
+}, "sorter");
+var sortNodesByHierarchy = /* @__PURE__ */ __name((graph) => sorter(graph, graph.children()), "sortNodesByHierarchy");
+
+// src/dagre-wrapper/clusters.js
+import { select } from "d3";
+var rect = /* @__PURE__ */ __name((parent, node) => {
   log.info("Creating subgraph rect for ", node.id, node);
+  const siteConfig = getConfig();
   const shapeSvg = parent.insert("g").attr("class", "cluster" + (node.class ? " " + node.class : "")).attr("id", node.id);
   const rect2 = shapeSvg.insert("rect", ":first-child");
-  const useHtmlLabels = evaluate(getConfig().flowchart.htmlLabels);
+  const useHtmlLabels = evaluate(siteConfig.flowchart.htmlLabels);
   const label = shapeSvg.insert("g").attr("class", "cluster-label");
-  const text = node.labelType === "markdown" ? createText(label, node.labelText, { style: node.labelStyle, useHtmlLabels }) : label.node().appendChild(createLabel(node.labelText, node.labelStyle, void 0, true));
+  const text = node.labelType === "markdown" ? createText(label, node.labelText, { style: node.labelStyle, useHtmlLabels }, siteConfig) : label.node().appendChild(createLabel_default(node.labelText, node.labelStyle, void 0, true));
   let bbox = text.getBBox();
-  if (evaluate(getConfig().flowchart.htmlLabels)) {
+  if (evaluate(siteConfig.flowchart.htmlLabels)) {
     const div = text.children[0];
     const dv = select(text);
     bbox = div.getBoundingClientRect();
@@ -377,28 +438,29 @@ const rect = (parent, node) => {
   }
   log.trace("Data ", node, JSON.stringify(node));
   rect2.attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("x", node.x - width / 2).attr("y", node.y - node.height / 2 - halfPadding).attr("width", width).attr("height", node.height + padding);
+  const { subGraphTitleTopMargin } = getSubGraphTitleMargins(siteConfig);
   if (useHtmlLabels) {
     label.attr(
       "transform",
-      // This puts the labal on top of the box instead of inside it
-      "translate(" + (node.x - bbox.width / 2) + ", " + (node.y - node.height / 2) + ")"
+      // This puts the label on top of the box instead of inside it
+      `translate(${node.x - bbox.width / 2}, ${node.y - node.height / 2 + subGraphTitleTopMargin})`
     );
   } else {
     label.attr(
       "transform",
-      // This puts the labal on top of the box instead of inside it
-      "translate(" + node.x + ", " + (node.y - node.height / 2) + ")"
+      // This puts the label on top of the box instead of inside it
+      `translate(${node.x}, ${node.y - node.height / 2 + subGraphTitleTopMargin})`
     );
   }
   const rectBox = rect2.node().getBBox();
   node.width = rectBox.width;
   node.height = rectBox.height;
   node.intersect = function(point) {
-    return intersectRect(node, point);
+    return intersect_rect_default(node, point);
   };
   return shapeSvg;
-};
-const noteGroup = (parent, node) => {
+}, "rect");
+var noteGroup = /* @__PURE__ */ __name((parent, node) => {
   const shapeSvg = parent.insert("g").attr("class", "note-cluster").attr("id", node.id);
   const rect2 = shapeSvg.insert("rect", ":first-child");
   const padding = 0 * node.padding;
@@ -408,18 +470,19 @@ const noteGroup = (parent, node) => {
   node.width = rectBox.width;
   node.height = rectBox.height;
   node.intersect = function(point) {
-    return intersectRect(node, point);
+    return intersect_rect_default(node, point);
   };
   return shapeSvg;
-};
-const roundedWithTitle = (parent, node) => {
+}, "noteGroup");
+var roundedWithTitle = /* @__PURE__ */ __name((parent, node) => {
+  const siteConfig = getConfig();
   const shapeSvg = parent.insert("g").attr("class", node.classes).attr("id", node.id);
   const rect2 = shapeSvg.insert("rect", ":first-child");
   const label = shapeSvg.insert("g").attr("class", "cluster-label");
   const innerRect = shapeSvg.append("rect");
-  const text = label.node().appendChild(createLabel(node.labelText, node.labelStyle, void 0, true));
+  const text = label.node().appendChild(createLabel_default(node.labelText, node.labelStyle, void 0, true));
   let bbox = text.getBBox();
-  if (evaluate(getConfig().flowchart.htmlLabels)) {
+  if (evaluate(siteConfig.flowchart.htmlLabels)) {
     const div = text.children[0];
     const dv = select(text);
     bbox = div.getBoundingClientRect();
@@ -437,18 +500,19 @@ const roundedWithTitle = (parent, node) => {
   }
   rect2.attr("class", "outer").attr("x", node.x - width / 2 - halfPadding).attr("y", node.y - node.height / 2 - halfPadding).attr("width", width + padding).attr("height", node.height + padding);
   innerRect.attr("class", "inner").attr("x", node.x - width / 2 - halfPadding).attr("y", node.y - node.height / 2 - halfPadding + bbox.height - 1).attr("width", width + padding).attr("height", node.height + padding - bbox.height - 3);
+  const { subGraphTitleTopMargin } = getSubGraphTitleMargins(siteConfig);
   label.attr(
     "transform",
-    "translate(" + (node.x - bbox.width / 2) + ", " + (node.y - node.height / 2 - node.padding / 3 + (evaluate(getConfig().flowchart.htmlLabels) ? 5 : 3)) + ")"
+    `translate(${node.x - bbox.width / 2}, ${node.y - node.height / 2 - node.padding / 3 + (evaluate(siteConfig.flowchart.htmlLabels) ? 5 : 3) + subGraphTitleTopMargin})`
   );
   const rectBox = rect2.node().getBBox();
   node.height = rectBox.height;
   node.intersect = function(point) {
-    return intersectRect(node, point);
+    return intersect_rect_default(node, point);
   };
   return shapeSvg;
-};
-const divider = (parent, node) => {
+}, "roundedWithTitle");
+var divider = /* @__PURE__ */ __name((parent, node) => {
   const shapeSvg = parent.insert("g").attr("class", node.classes).attr("id", node.id);
   const rect2 = shapeSvg.insert("rect", ":first-child");
   const padding = 0 * node.padding;
@@ -459,22 +523,24 @@ const divider = (parent, node) => {
   node.height = rectBox.height;
   node.diff = -node.padding / 2;
   node.intersect = function(point) {
-    return intersectRect(node, point);
+    return intersect_rect_default(node, point);
   };
   return shapeSvg;
-};
-const shapes = { rect, roundedWithTitle, noteGroup, divider };
-let clusterElems = {};
-const insertCluster = (elem, node) => {
+}, "divider");
+var shapes = { rect, roundedWithTitle, noteGroup, divider };
+var clusterElems = {};
+var insertCluster = /* @__PURE__ */ __name((elem, node) => {
   log.trace("Inserting cluster");
   const shape = node.shape || "rect";
   clusterElems[node.id] = shapes[shape](elem, node);
-};
-const clear = () => {
+}, "insertCluster");
+var clear4 = /* @__PURE__ */ __name(() => {
   clusterElems = {};
-};
-const recursiveRender = async (_elem, graph, diagramtype, id, parentCluster) => {
-  log.info("Graph in recursive render: XXX", graphlibJson.write(graph), parentCluster);
+}, "clear");
+
+// src/dagre-wrapper/index.js
+var recursiveRender = /* @__PURE__ */ __name(async (_elem, graph, diagramType, id, parentCluster, siteConfig) => {
+  log.info("Graph in recursive render: XXX", graphlibJson2.write(graph), parentCluster);
   const dir = graph.graph().rankdir;
   log.trace("Dir in recursive render - dir:", dir);
   const elem = _elem.insert("g").attr("class", "root");
@@ -503,9 +569,22 @@ const recursiveRender = async (_elem, graph, diagramtype, id, parentCluster) =>
         }
       }
       log.info("(Insert) Node XXX" + v + ": " + JSON.stringify(graph.node(v)));
-      if (node && node.clusterNode) {
+      if (node?.clusterNode) {
         log.info("Cluster identified", v, node.width, graph.node(v));
-        const o = await recursiveRender(nodes, node.graph, diagramtype, id, graph.node(v));
+        const { ranksep, nodesep } = graph.graph();
+        node.graph.setGraph({
+          ...node.graph.graph(),
+          ranksep,
+          nodesep
+        });
+        const o = await recursiveRender(
+          nodes,
+          node.graph,
+          diagramType,
+          id,
+          graph.node(v),
+          siteConfig
+        );
         const newEl = o.elem;
         updateNodeBounds(node, newEl);
         node.diff = o.diff || 0;
@@ -524,23 +603,25 @@ const recursiveRender = async (_elem, graph, diagramtype, id, parentCluster) =>
       }
     })
   );
-  graph.edges().forEach(function(e) {
+  graph.edges().forEach(async function(e) {
     const edge = graph.edge(e.v, e.w, e.name);
     log.info("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(e));
     log.info("Edge " + e.v + " -> " + e.w + ": ", e, " ", JSON.stringify(graph.edge(e)));
-    log.info("Fix", clusterDb, "ids:", e.v, e.w, "Translateing: ", clusterDb[e.v], clusterDb[e.w]);
-    insertEdgeLabel(edgeLabels, edge);
+    log.info("Fix", clusterDb, "ids:", e.v, e.w, "Translating: ", clusterDb[e.v], clusterDb[e.w]);
+    await insertEdgeLabel(edgeLabels, edge);
   });
   graph.edges().forEach(function(e) {
     log.info("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(e));
   });
+  log.info("Graph before layout:", JSON.stringify(graphlibJson2.write(graph)));
   log.info("#############################################");
   log.info("###                Layout                 ###");
   log.info("#############################################");
   log.info(graph);
-  layout(graph);
-  log.info("Graph after layout:", graphlibJson.write(graph));
+  dagreLayout(graph);
+  log.info("Graph after layout:", JSON.stringify(graphlibJson2.write(graph)));
   let diff = 0;
+  const { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig);
   sortNodesByHierarchy(graph).forEach(function(v) {
     const node = graph.node(v);
     log.info("Position " + v + ": " + JSON.stringify(graph.node(v)));
@@ -552,13 +633,16 @@ const recursiveRender = async (_elem, graph, diagramtype, id, parentCluster) =>
       " height: ",
       node.height
     );
-    if (node && node.clusterNode) {
+    if (node?.clusterNode) {
+      node.y += subGraphTitleTotalMargin;
       positionNode(node);
     } else {
       if (graph.children(v).length > 0) {
+        node.height += subGraphTitleTotalMargin;
         insertCluster(clusters, node);
         clusterDb[node.id].node = node;
       } else {
+        node.y += subGraphTitleTotalMargin / 2;
         positionNode(node);
       }
     }
@@ -566,7 +650,8 @@ const recursiveRender = async (_elem, graph, diagramtype, id, parentCluster) =>
   graph.edges().forEach(function(e) {
     const edge = graph.edge(e);
     log.info("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(edge), edge);
-    const paths = insertEdge(edgePaths, e, edge, clusterDb, diagramtype, graph, id);
+    edge.points.forEach((point) => point.y += subGraphTitleTotalMargin / 2);
+    const paths = insertEdge(edgePaths, e, edge, clusterDb, diagramType, graph, id);
     positionEdgeLabel(edge, paths);
   });
   graph.nodes().forEach(function(v) {
@@ -577,18 +662,295 @@ const recursiveRender = async (_elem, graph, diagramtype, id, parentCluster) =>
     }
   });
   return { elem, diff };
-};
-const render = async (elem, graph, markers, diagramtype, id) => {
-  insertMarkers(elem, markers, diagramtype, id);
-  clear$2();
-  clear$3();
+}, "recursiveRender");
+var render = /* @__PURE__ */ __name(async (elem, graph, markers, diagramType, id) => {
+  markers_default(elem, markers, diagramType, id);
   clear();
-  clear$1();
-  log.warn("Graph at first:", JSON.stringify(graphlibJson.write(graph)));
+  clear2();
+  clear4();
+  clear3();
+  log.warn("Graph at first:", JSON.stringify(graphlibJson2.write(graph)));
   adjustClustersAndEdges(graph);
-  log.warn("Graph after:", JSON.stringify(graphlibJson.write(graph)));
-  await recursiveRender(elem, graph, diagramtype, id);
+  log.warn("Graph after:", JSON.stringify(graphlibJson2.write(graph)));
+  const siteConfig = getConfig();
+  await recursiveRender(elem, graph, diagramType, id, void 0, siteConfig);
+}, "render");
+
+// src/diagrams/class/classRenderer-v2.ts
+var sanitizeText = /* @__PURE__ */ __name((txt) => common_default.sanitizeText(txt, getConfig()), "sanitizeText");
+var conf = {
+  dividerMargin: 10,
+  padding: 5,
+  textHeight: 10,
+  curve: void 0
+};
+var addNamespaces = /* @__PURE__ */ __name(function(namespaces, g, _id, diagObj) {
+  log.info("keys:", [...namespaces.keys()]);
+  log.info(namespaces);
+  namespaces.forEach(function(vertex) {
+    const shape = "rect";
+    const node = {
+      shape,
+      id: vertex.id,
+      domId: vertex.domId,
+      labelText: sanitizeText(vertex.id),
+      labelStyle: "",
+      style: "fill: none; stroke: black",
+      // TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
+      padding: getConfig().flowchart?.padding ?? getConfig().class?.padding
+    };
+    g.setNode(vertex.id, node);
+    addClasses(vertex.classes, g, _id, diagObj, vertex.id);
+    log.info("setNode", node);
+  });
+}, "addNamespaces");
+var addClasses = /* @__PURE__ */ __name(function(classes, g, _id, diagObj, parent) {
+  log.info("keys:", [...classes.keys()]);
+  log.info(classes);
+  [...classes.values()].filter((vertex) => vertex.parent === parent).forEach(function(vertex) {
+    const cssClassStr = vertex.cssClasses.join(" ");
+    const styles = getStylesFromArray(vertex.styles);
+    const vertexText = vertex.label ?? vertex.id;
+    const radius = 0;
+    const shape = "class_box";
+    const node = {
+      labelStyle: styles.labelStyle,
+      shape,
+      labelText: sanitizeText(vertexText),
+      classData: vertex,
+      rx: radius,
+      ry: radius,
+      class: cssClassStr,
+      style: styles.style,
+      id: vertex.id,
+      domId: vertex.domId,
+      tooltip: diagObj.db.getTooltip(vertex.id, parent) || "",
+      haveCallback: vertex.haveCallback,
+      link: vertex.link,
+      width: vertex.type === "group" ? 500 : void 0,
+      type: vertex.type,
+      // TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
+      padding: getConfig().flowchart?.padding ?? getConfig().class?.padding
+    };
+    g.setNode(vertex.id, node);
+    if (parent) {
+      g.setParent(vertex.id, parent);
+    }
+    log.info("setNode", node);
+  });
+}, "addClasses");
+var addNotes = /* @__PURE__ */ __name(function(notes, g, startEdgeId, classes) {
+  log.info(notes);
+  notes.forEach(function(note, i) {
+    const vertex = note;
+    const cssNoteStr = "";
+    const styles = { labelStyle: "", style: "" };
+    const vertexText = vertex.text;
+    const radius = 0;
+    const shape = "note";
+    const node = {
+      labelStyle: styles.labelStyle,
+      shape,
+      labelText: sanitizeText(vertexText),
+      noteData: vertex,
+      rx: radius,
+      ry: radius,
+      class: cssNoteStr,
+      style: styles.style,
+      id: vertex.id,
+      domId: vertex.id,
+      tooltip: "",
+      type: "note",
+      // TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
+      padding: getConfig().flowchart?.padding ?? getConfig().class?.padding
+    };
+    g.setNode(vertex.id, node);
+    log.info("setNode", node);
+    if (!vertex.class || !classes.has(vertex.class)) {
+      return;
+    }
+    const edgeId = startEdgeId + i;
+    const edgeData = {
+      id: `edgeNote${edgeId}`,
+      //Set relationship style and line type
+      classes: "relation",
+      pattern: "dotted",
+      // Set link type for rendering
+      arrowhead: "none",
+      //Set edge extra labels
+      startLabelRight: "",
+      endLabelLeft: "",
+      //Set relation arrow types
+      arrowTypeStart: "none",
+      arrowTypeEnd: "none",
+      style: "fill:none",
+      labelStyle: "",
+      curve: interpolateToCurve(conf.curve, curveLinear)
+    };
+    g.setEdge(vertex.id, vertex.class, edgeData, edgeId);
+  });
+}, "addNotes");
+var addRelations = /* @__PURE__ */ __name(function(relations, g) {
+  const conf2 = getConfig().flowchart;
+  let cnt = 0;
+  relations.forEach(function(edge) {
+    cnt++;
+    const edgeData = {
+      //Set relationship style and line type
+      classes: "relation",
+      pattern: edge.relation.lineType == 1 ? "dashed" : "solid",
+      id: getEdgeId(edge.id1, edge.id2, {
+        prefix: "id",
+        counter: cnt
+      }),
+      // Set link type for rendering
+      arrowhead: edge.type === "arrow_open" ? "none" : "normal",
+      //Set edge extra labels
+      startLabelRight: edge.relationTitle1 === "none" ? "" : edge.relationTitle1,
+      endLabelLeft: edge.relationTitle2 === "none" ? "" : edge.relationTitle2,
+      //Set relation arrow types
+      arrowTypeStart: getArrowMarker(edge.relation.type1),
+      arrowTypeEnd: getArrowMarker(edge.relation.type2),
+      style: "fill:none",
+      labelStyle: "",
+      curve: interpolateToCurve(conf2?.curve, curveLinear)
+    };
+    log.info(edgeData, edge);
+    if (edge.style !== void 0) {
+      const styles = getStylesFromArray(edge.style);
+      edgeData.style = styles.style;
+      edgeData.labelStyle = styles.labelStyle;
+    }
+    edge.text = edge.title;
+    if (edge.text === void 0) {
+      if (edge.style !== void 0) {
+        edgeData.arrowheadStyle = "fill: #333";
+      }
+    } else {
+      edgeData.arrowheadStyle = "fill: #333";
+      edgeData.labelpos = "c";
+      if (getConfig().flowchart?.htmlLabels ?? getConfig().htmlLabels) {
+        edgeData.labelType = "html";
+        edgeData.label = '<span class="edgeLabel">' + edge.text + "</span>";
+      } else {
+        edgeData.labelType = "text";
+        edgeData.label = edge.text.replace(common_default.lineBreakRegex, "\n");
+        if (edge.style === void 0) {
+          edgeData.style = edgeData.style || "stroke: #333; stroke-width: 1.5px;fill:none";
+        }
+        edgeData.labelStyle = edgeData.labelStyle.replace("color:", "fill:");
+      }
+    }
+    g.setEdge(edge.id1, edge.id2, edgeData, cnt);
+  });
+}, "addRelations");
+var setConf = /* @__PURE__ */ __name(function(cnf) {
+  conf = {
+    ...conf,
+    ...cnf
+  };
+}, "setConf");
+var draw = /* @__PURE__ */ __name(async function(text, id, _version, diagObj) {
+  log.info("Drawing class - ", id);
+  const conf2 = getConfig().flowchart ?? getConfig().class;
+  const securityLevel = getConfig().securityLevel;
+  log.info("config:", conf2);
+  const nodeSpacing = conf2?.nodeSpacing ?? 50;
+  const rankSpacing = conf2?.rankSpacing ?? 50;
+  const g = new graphlib2.Graph({
+    multigraph: true,
+    compound: true
+  }).setGraph({
+    rankdir: diagObj.db.getDirection(),
+    nodesep: nodeSpacing,
+    ranksep: rankSpacing,
+    marginx: 8,
+    marginy: 8
+  }).setDefaultEdgeLabel(function() {
+    return {};
+  });
+  const namespaces = diagObj.db.getNamespaces();
+  const classes = diagObj.db.getClasses();
+  const relations = diagObj.db.getRelations();
+  const notes = diagObj.db.getNotes();
+  log.info(relations);
+  addNamespaces(namespaces, g, id, diagObj);
+  addClasses(classes, g, id, diagObj);
+  addRelations(relations, g);
+  addNotes(notes, g, relations.length + 1, classes);
+  let sandboxElement;
+  if (securityLevel === "sandbox") {
+    sandboxElement = select2("#i" + id);
+  }
+  const root = securityLevel === "sandbox" ? select2(sandboxElement.nodes()[0].contentDocument.body) : select2("body");
+  const svg = root.select(`[id="${id}"]`);
+  const element = root.select("#" + id + " g");
+  await render(
+    element,
+    g,
+    ["aggregation", "extension", "composition", "dependency", "lollipop"],
+    "classDiagram",
+    id
+  );
+  utils_default.insertTitle(svg, "classTitleText", conf2?.titleTopMargin ?? 5, diagObj.db.getDiagramTitle());
+  setupGraphViewbox(g, svg, conf2?.diagramPadding, conf2?.useMaxWidth);
+  if (!conf2?.htmlLabels) {
+    const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
+    const labels = doc.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
+    for (const label of labels) {
+      const dim = label.getBBox();
+      const rect2 = doc.createElementNS("http://www.w3.org/2000/svg", "rect");
+      rect2.setAttribute("rx", 0);
+      rect2.setAttribute("ry", 0);
+      rect2.setAttribute("width", dim.width);
+      rect2.setAttribute("height", dim.height);
+      label.insertBefore(rect2, label.firstChild);
+    }
+  }
+}, "draw");
+function getArrowMarker(type) {
+  let marker;
+  switch (type) {
+    case 0:
+      marker = "aggregation";
+      break;
+    case 1:
+      marker = "extension";
+      break;
+    case 2:
+      marker = "composition";
+      break;
+    case 3:
+      marker = "dependency";
+      break;
+    case 4:
+      marker = "lollipop";
+      break;
+    default:
+      marker = "none";
+  }
+  return marker;
+}
+__name(getArrowMarker, "getArrowMarker");
+var classRenderer_v2_default = {
+  setConf,
+  draw
+};
+
+// src/diagrams/class/classDiagram-v2.ts
+var diagram = {
+  parser: classDiagram_default,
+  db: classDb_default,
+  renderer: classRenderer_v2_default,
+  styles: styles_default,
+  init: /* @__PURE__ */ __name((cnf) => {
+    if (!cnf.class) {
+      cnf.class = {};
+    }
+    cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
+    classDb_default.clear();
+  }, "init")
 };
 export {
-  render as r
+  diagram
 };

+ 671 - 0
nicegui/elements/lib/mermaid/chunks/mermaid.core/dagre-CQ6OS2HX.mjs

@@ -0,0 +1,671 @@
+import {
+  clear,
+  clear2,
+  clear3,
+  insertCluster,
+  insertEdge,
+  insertEdgeLabel,
+  insertNode,
+  markers_default,
+  positionEdgeLabel,
+  positionNode,
+  setNodeElem,
+  updateNodeBounds
+} from "./chunk-5CZSE4TR.mjs";
+import {
+  getSubGraphTitleMargins
+} from "./chunk-TINLTEC2.mjs";
+import "./chunk-OERGPBFJ.mjs";
+import "./chunk-VKXSJROQ.mjs";
+import {
+  __name,
+  getConfig2 as getConfig,
+  log
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/rendering-util/layout-algorithms/dagre/index.js
+import { layout as dagreLayout } from "dagre-d3-es/src/dagre/index.js";
+import * as graphlibJson2 from "dagre-d3-es/src/graphlib/json.js";
+import * as graphlib2 from "dagre-d3-es/src/graphlib/index.js";
+
+// src/rendering-util/layout-algorithms/dagre/mermaid-graphlib.js
+import * as graphlib from "dagre-d3-es/src/graphlib/index.js";
+import * as graphlibJson from "dagre-d3-es/src/graphlib/json.js";
+var clusterDb = /* @__PURE__ */ new Map();
+var descendants = /* @__PURE__ */ new Map();
+var parents = /* @__PURE__ */ new Map();
+var clear4 = /* @__PURE__ */ __name(() => {
+  descendants.clear();
+  parents.clear();
+  clusterDb.clear();
+}, "clear");
+var isDescendant = /* @__PURE__ */ __name((id, ancestorId) => {
+  const ancestorDescendants = descendants.get(ancestorId) || [];
+  log.trace("In isDescendant", ancestorId, " ", id, " = ", ancestorDescendants.includes(id));
+  return ancestorDescendants.includes(id);
+}, "isDescendant");
+var edgeInCluster = /* @__PURE__ */ __name((edge, clusterId) => {
+  const clusterDescendants = descendants.get(clusterId) || [];
+  log.info("Descendants of ", clusterId, " is ", clusterDescendants);
+  log.info("Edge is ", edge);
+  if (edge.v === clusterId || edge.w === clusterId) {
+    return false;
+  }
+  if (!clusterDescendants) {
+    log.debug("Tilt, ", clusterId, ",not in descendants");
+    return false;
+  }
+  return clusterDescendants.includes(edge.v) || isDescendant(edge.v, clusterId) || isDescendant(edge.w, clusterId) || clusterDescendants.includes(edge.w);
+}, "edgeInCluster");
+var copy = /* @__PURE__ */ __name((clusterId, graph, newGraph, rootId) => {
+  log.warn(
+    "Copying children of ",
+    clusterId,
+    "root",
+    rootId,
+    "data",
+    graph.node(clusterId),
+    rootId
+  );
+  const nodes = graph.children(clusterId) || [];
+  if (clusterId !== rootId) {
+    nodes.push(clusterId);
+  }
+  log.warn("Copying (nodes) clusterId", clusterId, "nodes", nodes);
+  nodes.forEach((node) => {
+    if (graph.children(node).length > 0) {
+      copy(node, graph, newGraph, rootId);
+    } else {
+      const data = graph.node(node);
+      log.info("cp ", node, " to ", rootId, " with parent ", clusterId);
+      newGraph.setNode(node, data);
+      if (rootId !== graph.parent(node)) {
+        log.warn("Setting parent", node, graph.parent(node));
+        newGraph.setParent(node, graph.parent(node));
+      }
+      if (clusterId !== rootId && node !== clusterId) {
+        log.debug("Setting parent", node, clusterId);
+        newGraph.setParent(node, clusterId);
+      } else {
+        log.info("In copy ", clusterId, "root", rootId, "data", graph.node(clusterId), rootId);
+        log.debug(
+          "Not Setting parent for node=",
+          node,
+          "cluster!==rootId",
+          clusterId !== rootId,
+          "node!==clusterId",
+          node !== clusterId
+        );
+      }
+      const edges = graph.edges(node);
+      log.debug("Copying Edges", edges);
+      edges.forEach((edge) => {
+        log.info("Edge", edge);
+        const data2 = graph.edge(edge.v, edge.w, edge.name);
+        log.info("Edge data", data2, rootId);
+        try {
+          if (edgeInCluster(edge, rootId)) {
+            log.info("Copying as ", edge.v, edge.w, data2, edge.name);
+            newGraph.setEdge(edge.v, edge.w, data2, edge.name);
+            log.info("newGraph edges ", newGraph.edges(), newGraph.edge(newGraph.edges()[0]));
+          } else {
+            log.info(
+              "Skipping copy of edge ",
+              edge.v,
+              "-->",
+              edge.w,
+              " rootId: ",
+              rootId,
+              " clusterId:",
+              clusterId
+            );
+          }
+        } catch (e) {
+          log.error(e);
+        }
+      });
+    }
+    log.debug("Removing node", node);
+    graph.removeNode(node);
+  });
+}, "copy");
+var extractDescendants = /* @__PURE__ */ __name((id, graph) => {
+  const children = graph.children(id);
+  let res = [...children];
+  for (const child of children) {
+    parents.set(child, id);
+    res = [...res, ...extractDescendants(child, graph)];
+  }
+  return res;
+}, "extractDescendants");
+var findCommonEdges = /* @__PURE__ */ __name((graph, id1, id2) => {
+  const edges1 = graph.edges().filter((edge) => edge.v === id1 || edge.w === id1);
+  const edges2 = graph.edges().filter((edge) => edge.v === id2 || edge.w === id2);
+  const edges1Prim = edges1.map((edge) => {
+    return { v: edge.v === id1 ? id2 : edge.v, w: edge.w === id1 ? id1 : edge.w };
+  });
+  const edges2Prim = edges2.map((edge) => {
+    return { v: edge.v, w: edge.w };
+  });
+  const result = edges1Prim.filter((edgeIn1) => {
+    return edges2Prim.some((edge) => edgeIn1.v === edge.v && edgeIn1.w === edge.w);
+  });
+  return result;
+}, "findCommonEdges");
+var findNonClusterChild = /* @__PURE__ */ __name((id, graph, clusterId) => {
+  const children = graph.children(id);
+  log.trace("Searching children of id ", id, children);
+  if (children.length < 1) {
+    return id;
+  }
+  let reserve;
+  for (const child of children) {
+    const _id = findNonClusterChild(child, graph, clusterId);
+    const commonEdges = findCommonEdges(graph, clusterId, _id);
+    if (_id) {
+      if (commonEdges.length > 0) {
+        reserve = _id;
+      } else {
+        return _id;
+      }
+    }
+  }
+  return reserve;
+}, "findNonClusterChild");
+var getAnchorId = /* @__PURE__ */ __name((id) => {
+  if (!clusterDb.has(id)) {
+    return id;
+  }
+  if (!clusterDb.get(id).externalConnections) {
+    return id;
+  }
+  if (clusterDb.has(id)) {
+    return clusterDb.get(id).id;
+  }
+  return id;
+}, "getAnchorId");
+var adjustClustersAndEdges = /* @__PURE__ */ __name((graph, depth) => {
+  if (!graph || depth > 10) {
+    log.debug("Opting out, no graph ");
+    return;
+  } else {
+    log.debug("Opting in, graph ");
+  }
+  graph.nodes().forEach(function(id) {
+    const children = graph.children(id);
+    if (children.length > 0) {
+      log.warn(
+        "Cluster identified",
+        id,
+        " Replacement id in edges: ",
+        findNonClusterChild(id, graph, id)
+      );
+      descendants.set(id, extractDescendants(id, graph));
+      clusterDb.set(id, { id: findNonClusterChild(id, graph, id), clusterData: graph.node(id) });
+    }
+  });
+  graph.nodes().forEach(function(id) {
+    const children = graph.children(id);
+    const edges = graph.edges();
+    if (children.length > 0) {
+      log.debug("Cluster identified", id, descendants);
+      edges.forEach((edge) => {
+        const d1 = isDescendant(edge.v, id);
+        const d2 = isDescendant(edge.w, id);
+        if (d1 ^ d2) {
+          log.warn("Edge: ", edge, " leaves cluster ", id);
+          log.warn("Descendants of XXX ", id, ": ", descendants.get(id));
+          clusterDb.get(id).externalConnections = true;
+        }
+      });
+    } else {
+      log.debug("Not a cluster ", id, descendants);
+    }
+  });
+  for (let id of clusterDb.keys()) {
+    const nonClusterChild = clusterDb.get(id).id;
+    const parent = graph.parent(nonClusterChild);
+    if (parent !== id && clusterDb.has(parent) && !clusterDb.get(parent).externalConnections) {
+      clusterDb.get(id).id = parent;
+    }
+  }
+  graph.edges().forEach(function(e) {
+    const edge = graph.edge(e);
+    log.warn("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(e));
+    log.warn("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(graph.edge(e)));
+    let v = e.v;
+    let w = e.w;
+    log.warn(
+      "Fix XXX",
+      clusterDb,
+      "ids:",
+      e.v,
+      e.w,
+      "Translating: ",
+      clusterDb.get(e.v),
+      " --- ",
+      clusterDb.get(e.w)
+    );
+    if (clusterDb.get(e.v) && clusterDb.get(e.w) && clusterDb.get(e.v) === clusterDb.get(e.w)) {
+      log.warn("Fixing and trying link to self - removing XXX", e.v, e.w, e.name);
+      log.warn("Fixing and trying - removing XXX", e.v, e.w, e.name);
+      v = getAnchorId(e.v);
+      w = getAnchorId(e.w);
+      graph.removeEdge(e.v, e.w, e.name);
+      const specialId1 = e.w + "---" + e.v + "---1";
+      const specialId2 = e.w + "---" + e.v + "---2";
+      graph.setNode(specialId1, {
+        domId: specialId1,
+        id: specialId1,
+        labelStyle: "",
+        label: "",
+        padding: 0,
+        shape: "labelRect",
+        style: "",
+        width: 10,
+        height: 10
+      });
+      graph.setNode(specialId2, {
+        domId: specialId2,
+        id: specialId2,
+        labelStyle: "",
+        padding: 0,
+        shape: "labelRect",
+        style: "",
+        width: 10,
+        height: 10
+      });
+      const edge1 = structuredClone(edge);
+      const edgeMid = structuredClone(edge);
+      const edge2 = structuredClone(edge);
+      edge1.label = "";
+      edge1.arrowTypeEnd = "none";
+      edge1.id = e.name + "-cyclic-special-1";
+      edgeMid.arrowTypeEnd = "none";
+      edgeMid.id = e.name + "-cyclic-special-mid";
+      edge2.label = "";
+      edge1.fromCluster = e.v;
+      edge2.toCluster = e.v;
+      edge2.id = e.name + "-cyclic-special-2";
+      graph.setEdge(v, specialId1, edge1, e.name + "-cyclic-special-0");
+      graph.setEdge(specialId1, specialId2, edgeMid, e.name + "-cyclic-special-1");
+      graph.setEdge(specialId2, w, edge2, e.name + "-cyclic-special-2");
+    } else if (clusterDb.get(e.v) || clusterDb.get(e.w)) {
+      log.warn("Fixing and trying - removing XXX", e.v, e.w, e.name);
+      v = getAnchorId(e.v);
+      w = getAnchorId(e.w);
+      graph.removeEdge(e.v, e.w, e.name);
+      if (v !== e.v) {
+        const parent = graph.parent(v);
+        clusterDb.get(parent).externalConnections = true;
+        edge.fromCluster = e.v;
+      }
+      if (w !== e.w) {
+        const parent = graph.parent(w);
+        clusterDb.get(parent).externalConnections = true;
+        edge.toCluster = e.w;
+      }
+      log.warn("Fix Replacing with XXX", v, w, e.name);
+      graph.setEdge(v, w, edge, e.name);
+    }
+  });
+  log.warn("Adjusted Graph", graphlibJson.write(graph));
+  extractor(graph, 0);
+  log.trace(clusterDb);
+}, "adjustClustersAndEdges");
+var extractor = /* @__PURE__ */ __name((graph, depth) => {
+  log.warn("extractor - ", depth, graphlibJson.write(graph), graph.children("D"));
+  if (depth > 10) {
+    log.error("Bailing out");
+    return;
+  }
+  let nodes = graph.nodes();
+  let hasChildren = false;
+  for (const node of nodes) {
+    const children = graph.children(node);
+    hasChildren = hasChildren || children.length > 0;
+  }
+  if (!hasChildren) {
+    log.debug("Done, no node has children", graph.nodes());
+    return;
+  }
+  log.debug("Nodes = ", nodes, depth);
+  for (const node of nodes) {
+    log.debug(
+      "Extracting node",
+      node,
+      clusterDb,
+      clusterDb.has(node) && !clusterDb.get(node).externalConnections,
+      !graph.parent(node),
+      graph.node(node),
+      graph.children("D"),
+      " Depth ",
+      depth
+    );
+    if (!clusterDb.has(node)) {
+      log.debug("Not a cluster", node, depth);
+    } else if (!clusterDb.get(node).externalConnections && graph.children(node) && graph.children(node).length > 0) {
+      log.warn(
+        "Cluster without external connections, without a parent and with children",
+        node,
+        depth
+      );
+      const graphSettings = graph.graph();
+      let dir = graphSettings.rankdir === "TB" ? "LR" : "TB";
+      if (clusterDb.get(node)?.clusterData?.dir) {
+        dir = clusterDb.get(node).clusterData.dir;
+        log.warn("Fixing dir", clusterDb.get(node).clusterData.dir, dir);
+      }
+      const clusterGraph = new graphlib.Graph({
+        multigraph: true,
+        compound: true
+      }).setGraph({
+        rankdir: dir,
+        nodesep: 50,
+        ranksep: 50,
+        marginx: 8,
+        marginy: 8
+      }).setDefaultEdgeLabel(function() {
+        return {};
+      });
+      log.warn("Old graph before copy", graphlibJson.write(graph));
+      copy(node, graph, clusterGraph, node);
+      graph.setNode(node, {
+        clusterNode: true,
+        id: node,
+        clusterData: clusterDb.get(node).clusterData,
+        label: clusterDb.get(node).label,
+        graph: clusterGraph
+      });
+      log.warn("New graph after copy node: (", node, ")", graphlibJson.write(clusterGraph));
+      log.debug("Old graph after copy", graphlibJson.write(graph));
+    } else {
+      log.warn(
+        "Cluster ** ",
+        node,
+        " **not meeting the criteria !externalConnections:",
+        !clusterDb.get(node).externalConnections,
+        " no parent: ",
+        !graph.parent(node),
+        " children ",
+        graph.children(node) && graph.children(node).length > 0,
+        graph.children("D"),
+        depth
+      );
+      log.debug(clusterDb);
+    }
+  }
+  nodes = graph.nodes();
+  log.warn("New list of nodes", nodes);
+  for (const node of nodes) {
+    const data = graph.node(node);
+    log.warn(" Now next level", node, data);
+    if (data.clusterNode) {
+      extractor(data.graph, depth + 1);
+    }
+  }
+}, "extractor");
+var sorter = /* @__PURE__ */ __name((graph, nodes) => {
+  if (nodes.length === 0) {
+    return [];
+  }
+  let result = Object.assign([], nodes);
+  nodes.forEach((node) => {
+    const children = graph.children(node);
+    const sorted = sorter(graph, children);
+    result = [...result, ...sorted];
+  });
+  return result;
+}, "sorter");
+var sortNodesByHierarchy = /* @__PURE__ */ __name((graph) => sorter(graph, graph.children()), "sortNodesByHierarchy");
+
+// src/rendering-util/layout-algorithms/dagre/index.js
+var recursiveRender = /* @__PURE__ */ __name(async (_elem, graph, diagramType, id, parentCluster, siteConfig) => {
+  log.info("Graph in recursive render: XXX", graphlibJson2.write(graph), parentCluster);
+  const dir = graph.graph().rankdir;
+  log.trace("Dir in recursive render - dir:", dir);
+  const elem = _elem.insert("g").attr("class", "root");
+  if (!graph.nodes()) {
+    log.info("No nodes found for", graph);
+  } else {
+    log.info("Recursive render XXX", graph.nodes());
+  }
+  if (graph.edges().length > 0) {
+    log.info("Recursive edges", graph.edge(graph.edges()[0]));
+  }
+  const clusters = elem.insert("g").attr("class", "clusters");
+  const edgePaths = elem.insert("g").attr("class", "edgePaths");
+  const edgeLabels = elem.insert("g").attr("class", "edgeLabels");
+  const nodes = elem.insert("g").attr("class", "nodes");
+  await Promise.all(
+    graph.nodes().map(async function(v) {
+      const node = graph.node(v);
+      if (parentCluster !== void 0) {
+        const data = JSON.parse(JSON.stringify(parentCluster.clusterData));
+        log.trace(
+          "Setting data for parent cluster XXX\n Node.id = ",
+          v,
+          "\n data=",
+          data.height,
+          "\nParent cluster",
+          parentCluster.height
+        );
+        graph.setNode(parentCluster.id, data);
+        if (!graph.parent(v)) {
+          log.trace("Setting parent", v, parentCluster.id);
+          graph.setParent(v, parentCluster.id, data);
+        }
+      }
+      log.info("(Insert) Node XXX" + v + ": " + JSON.stringify(graph.node(v)));
+      if (node?.clusterNode) {
+        log.info("Cluster identified XBX", v, node.width, graph.node(v));
+        const { ranksep, nodesep } = graph.graph();
+        node.graph.setGraph({
+          ...node.graph.graph(),
+          ranksep: ranksep + 25,
+          nodesep
+        });
+        const o = await recursiveRender(
+          nodes,
+          node.graph,
+          diagramType,
+          id,
+          graph.node(v),
+          siteConfig
+        );
+        const newEl = o.elem;
+        updateNodeBounds(node, newEl);
+        node.diff = o.diff || 0;
+        log.info(
+          "New compound node after recursive render XAX",
+          v,
+          "width",
+          // node,
+          node.width,
+          "height",
+          node.height
+          // node.x,
+          // node.y
+        );
+        setNodeElem(newEl, node);
+      } else {
+        if (graph.children(v).length > 0) {
+          log.info(
+            "Cluster - the non recursive path XBX",
+            v,
+            node.id,
+            node,
+            node.width,
+            "Graph:",
+            graph
+          );
+          log.info(findNonClusterChild(node.id, graph));
+          clusterDb.set(node.id, { id: findNonClusterChild(node.id, graph), node });
+        } else {
+          log.trace("Node - the non recursive path XAX", v, node.id, node);
+          await insertNode(nodes, graph.node(v), dir);
+        }
+      }
+    })
+  );
+  const processEdges = /* @__PURE__ */ __name(async () => {
+    const edgePromises = graph.edges().map(async function(e) {
+      const edge = graph.edge(e.v, e.w, e.name);
+      log.info("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(e));
+      log.info("Edge " + e.v + " -> " + e.w + ": ", e, " ", JSON.stringify(graph.edge(e)));
+      log.info(
+        "Fix",
+        clusterDb,
+        "ids:",
+        e.v,
+        e.w,
+        "Translating: ",
+        clusterDb.get(e.v),
+        clusterDb.get(e.w)
+      );
+      await insertEdgeLabel(edgeLabels, edge);
+    });
+    await Promise.all(edgePromises);
+  }, "processEdges");
+  await processEdges();
+  log.info("Graph before layout:", JSON.stringify(graphlibJson2.write(graph)));
+  log.info("############################################# XXX");
+  log.info("###                Layout                 ### XXX");
+  log.info("############################################# XXX");
+  dagreLayout(graph);
+  log.info("Graph after layout:", JSON.stringify(graphlibJson2.write(graph)));
+  let diff = 0;
+  let { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig);
+  await Promise.all(
+    sortNodesByHierarchy(graph).map(async function(v) {
+      const node = graph.node(v);
+      log.info(
+        "Position XBX => " + v + ": (" + node.x,
+        "," + node.y,
+        ") width: ",
+        node.width,
+        " height: ",
+        node.height
+      );
+      if (node?.clusterNode) {
+        node.y += subGraphTitleTotalMargin;
+        log.info(
+          "A tainted cluster node XBX1",
+          v,
+          node.id,
+          node.width,
+          node.height,
+          node.x,
+          node.y,
+          graph.parent(v)
+        );
+        clusterDb.get(node.id).node = node;
+        positionNode(node);
+      } else {
+        if (graph.children(v).length > 0) {
+          log.info(
+            "A pure cluster node XBX1",
+            v,
+            node.id,
+            node.x,
+            node.y,
+            node.width,
+            node.height,
+            graph.parent(v)
+          );
+          node.height += subGraphTitleTotalMargin;
+          graph.node(node.parentId);
+          const halfPadding = node?.padding / 2 || 0;
+          const labelHeight = node?.labelBBox?.height || 0;
+          const offsetY = labelHeight - halfPadding || 0;
+          log.debug("OffsetY", offsetY, "labelHeight", labelHeight, "halfPadding", halfPadding);
+          await insertCluster(clusters, node);
+          clusterDb.get(node.id).node = node;
+        } else {
+          const parent = graph.node(node.parentId);
+          node.y += subGraphTitleTotalMargin / 2;
+          log.info(
+            "A regular node XBX1 - using the padding",
+            node.id,
+            "parent",
+            node.parentId,
+            node.width,
+            node.height,
+            node.x,
+            node.y,
+            "offsetY",
+            node.offsetY,
+            "parent",
+            parent,
+            parent?.offsetY,
+            node
+          );
+          positionNode(node);
+        }
+      }
+    })
+  );
+  graph.edges().forEach(function(e) {
+    const edge = graph.edge(e);
+    log.info("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(edge), edge);
+    edge.points.forEach((point) => point.y += subGraphTitleTotalMargin / 2);
+    const startNode = graph.node(e.v);
+    var endNode = graph.node(e.w);
+    const paths = insertEdge(edgePaths, edge, clusterDb, diagramType, startNode, endNode, id);
+    positionEdgeLabel(edge, paths);
+  });
+  graph.nodes().forEach(function(v) {
+    const n = graph.node(v);
+    log.info(v, n.type, n.diff);
+    if (n.isGroup) {
+      diff = n.diff;
+    }
+  });
+  log.warn("Returning from recursive render XAX", elem, diff);
+  return { elem, diff };
+}, "recursiveRender");
+var render = /* @__PURE__ */ __name(async (data4Layout, svg) => {
+  const graph = new graphlib2.Graph({
+    multigraph: true,
+    compound: true
+  }).setGraph({
+    rankdir: data4Layout.direction,
+    nodesep: data4Layout.config?.nodeSpacing || data4Layout.config?.flowchart?.nodeSpacing || data4Layout.nodeSpacing,
+    ranksep: data4Layout.config?.rankSpacing || data4Layout.config?.flowchart?.rankSpacing || data4Layout.rankSpacing,
+    marginx: 8,
+    marginy: 8
+  }).setDefaultEdgeLabel(function() {
+    return {};
+  });
+  const element = svg.select("g");
+  markers_default(element, data4Layout.markers, data4Layout.type, data4Layout.diagramId);
+  clear3();
+  clear2();
+  clear();
+  clear4();
+  data4Layout.nodes.forEach((node) => {
+    graph.setNode(node.id, { ...node });
+    if (node.parentId) {
+      graph.setParent(node.id, node.parentId);
+    }
+  });
+  log.debug("Edges:", data4Layout.edges);
+  data4Layout.edges.forEach((edge) => {
+    graph.setEdge(edge.start, edge.end, { ...edge }, edge.id);
+  });
+  log.warn("Graph at first:", JSON.stringify(graphlibJson2.write(graph)));
+  adjustClustersAndEdges(graph);
+  log.warn("Graph after:", JSON.stringify(graphlibJson2.write(graph)));
+  const siteConfig = getConfig();
+  await recursiveRender(
+    element,
+    graph,
+    data4Layout.type,
+    data4Layout.diagramId,
+    void 0,
+    siteConfig
+  );
+}, "render");
+export {
+  render
+};

+ 220 - 0
nicegui/elements/lib/mermaid/chunks/mermaid.core/diagram-KYCGQLJB.mjs

@@ -0,0 +1,220 @@
+import {
+  populateCommonDb
+} from "./chunk-JJENOPKO.mjs";
+import {
+  cleanAndMerge
+} from "./chunk-VKXSJROQ.mjs";
+import {
+  selectSvgElement
+} from "./chunk-DLZUUSFL.mjs";
+import {
+  __name,
+  clear,
+  configureSvgSize,
+  defaultConfig_default,
+  getAccDescription,
+  getAccTitle,
+  getConfig,
+  getDiagramTitle,
+  log,
+  setAccDescription,
+  setAccTitle,
+  setDiagramTitle
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/diagrams/packet/db.ts
+var defaultPacketData = {
+  packet: []
+};
+var data = structuredClone(defaultPacketData);
+var DEFAULT_PACKET_CONFIG = defaultConfig_default.packet;
+var getConfig2 = /* @__PURE__ */ __name(() => {
+  const config = cleanAndMerge({
+    ...DEFAULT_PACKET_CONFIG,
+    ...getConfig().packet
+  });
+  if (config.showBits) {
+    config.paddingY += 10;
+  }
+  return config;
+}, "getConfig");
+var getPacket = /* @__PURE__ */ __name(() => data.packet, "getPacket");
+var pushWord = /* @__PURE__ */ __name((word) => {
+  if (word.length > 0) {
+    data.packet.push(word);
+  }
+}, "pushWord");
+var clear2 = /* @__PURE__ */ __name(() => {
+  clear();
+  data = structuredClone(defaultPacketData);
+}, "clear");
+var db = {
+  pushWord,
+  getPacket,
+  getConfig: getConfig2,
+  clear: clear2,
+  setAccTitle,
+  getAccTitle,
+  setDiagramTitle,
+  getDiagramTitle,
+  getAccDescription,
+  setAccDescription
+};
+
+// src/diagrams/packet/parser.ts
+import { parse } from "@mermaid-js/parser";
+var maxPacketSize = 1e4;
+var populate = /* @__PURE__ */ __name((ast) => {
+  populateCommonDb(ast, db);
+  let lastByte = -1;
+  let word = [];
+  let row = 1;
+  const { bitsPerRow } = db.getConfig();
+  for (let { start, end, label } of ast.blocks) {
+    if (end && end < start) {
+      throw new Error(`Packet block ${start} - ${end} is invalid. End must be greater than start.`);
+    }
+    if (start !== lastByte + 1) {
+      throw new Error(
+        `Packet block ${start} - ${end ?? start} is not contiguous. It should start from ${lastByte + 1}.`
+      );
+    }
+    lastByte = end ?? start;
+    log.debug(`Packet block ${start} - ${lastByte} with label ${label}`);
+    while (word.length <= bitsPerRow + 1 && db.getPacket().length < maxPacketSize) {
+      const [block, nextBlock] = getNextFittingBlock({ start, end, label }, row, bitsPerRow);
+      word.push(block);
+      if (block.end + 1 === row * bitsPerRow) {
+        db.pushWord(word);
+        word = [];
+        row++;
+      }
+      if (!nextBlock) {
+        break;
+      }
+      ({ start, end, label } = nextBlock);
+    }
+  }
+  db.pushWord(word);
+}, "populate");
+var getNextFittingBlock = /* @__PURE__ */ __name((block, row, bitsPerRow) => {
+  if (block.end === void 0) {
+    block.end = block.start;
+  }
+  if (block.start > block.end) {
+    throw new Error(`Block start ${block.start} is greater than block end ${block.end}.`);
+  }
+  if (block.end + 1 <= row * bitsPerRow) {
+    return [block, void 0];
+  }
+  return [
+    {
+      start: block.start,
+      end: row * bitsPerRow - 1,
+      label: block.label
+    },
+    {
+      start: row * bitsPerRow,
+      end: block.end,
+      label: block.label
+    }
+  ];
+}, "getNextFittingBlock");
+var parser = {
+  parse: /* @__PURE__ */ __name(async (input) => {
+    const ast = await parse("packet", input);
+    log.debug(ast);
+    populate(ast);
+  }, "parse")
+};
+
+// src/diagrams/packet/renderer.ts
+var draw = /* @__PURE__ */ __name((_text, id, _version, diagram2) => {
+  const db2 = diagram2.db;
+  const config = db2.getConfig();
+  const { rowHeight, paddingY, bitWidth, bitsPerRow } = config;
+  const words = db2.getPacket();
+  const title = db2.getDiagramTitle();
+  const totalRowHeight = rowHeight + paddingY;
+  const svgHeight = totalRowHeight * (words.length + 1) - (title ? 0 : rowHeight);
+  const svgWidth = bitWidth * bitsPerRow + 2;
+  const svg = selectSvgElement(id);
+  svg.attr("viewbox", `0 0 ${svgWidth} ${svgHeight}`);
+  configureSvgSize(svg, svgHeight, svgWidth, config.useMaxWidth);
+  for (const [word, packet] of words.entries()) {
+    drawWord(svg, packet, word, config);
+  }
+  svg.append("text").text(title).attr("x", svgWidth / 2).attr("y", svgHeight - totalRowHeight / 2).attr("dominant-baseline", "middle").attr("text-anchor", "middle").attr("class", "packetTitle");
+}, "draw");
+var drawWord = /* @__PURE__ */ __name((svg, word, rowNumber, { rowHeight, paddingX, paddingY, bitWidth, bitsPerRow, showBits }) => {
+  const group = svg.append("g");
+  const wordY = rowNumber * (rowHeight + paddingY) + paddingY;
+  for (const block of word) {
+    const blockX = block.start % bitsPerRow * bitWidth + 1;
+    const width = (block.end - block.start + 1) * bitWidth - paddingX;
+    group.append("rect").attr("x", blockX).attr("y", wordY).attr("width", width).attr("height", rowHeight).attr("class", "packetBlock");
+    group.append("text").attr("x", blockX + width / 2).attr("y", wordY + rowHeight / 2).attr("class", "packetLabel").attr("dominant-baseline", "middle").attr("text-anchor", "middle").text(block.label);
+    if (!showBits) {
+      continue;
+    }
+    const isSingleBlock = block.end === block.start;
+    const bitNumberY = wordY - 2;
+    group.append("text").attr("x", blockX + (isSingleBlock ? width / 2 : 0)).attr("y", bitNumberY).attr("class", "packetByte start").attr("dominant-baseline", "auto").attr("text-anchor", isSingleBlock ? "middle" : "start").text(block.start);
+    if (!isSingleBlock) {
+      group.append("text").attr("x", blockX + width).attr("y", bitNumberY).attr("class", "packetByte end").attr("dominant-baseline", "auto").attr("text-anchor", "end").text(block.end);
+    }
+  }
+}, "drawWord");
+var renderer = { draw };
+
+// src/diagrams/packet/styles.ts
+var defaultPacketStyleOptions = {
+  byteFontSize: "10px",
+  startByteColor: "black",
+  endByteColor: "black",
+  labelColor: "black",
+  labelFontSize: "12px",
+  titleColor: "black",
+  titleFontSize: "14px",
+  blockStrokeColor: "black",
+  blockStrokeWidth: "1",
+  blockFillColor: "#efefef"
+};
+var styles = /* @__PURE__ */ __name(({ packet } = {}) => {
+  const options = cleanAndMerge(defaultPacketStyleOptions, packet);
+  return `
+	.packetByte {
+		font-size: ${options.byteFontSize};
+	}
+	.packetByte.start {
+		fill: ${options.startByteColor};
+	}
+	.packetByte.end {
+		fill: ${options.endByteColor};
+	}
+	.packetLabel {
+		fill: ${options.labelColor};
+		font-size: ${options.labelFontSize};
+	}
+	.packetTitle {
+		fill: ${options.titleColor};
+		font-size: ${options.titleFontSize};
+	}
+	.packetBlock {
+		stroke: ${options.blockStrokeColor};
+		stroke-width: ${options.blockStrokeWidth};
+		fill: ${options.blockFillColor};
+	}
+	`;
+}, "styles");
+
+// src/diagrams/packet/diagram.ts
+var diagram = {
+  parser,
+  db,
+  renderer,
+  styles
+};
+export {
+  diagram
+};

+ 234 - 146
nicegui/elements/lib/mermaid/erDiagram-5b6cebf0.js → nicegui/elements/lib/mermaid/chunks/mermaid.core/erDiagram-762WSSOR.mjs

@@ -1,31 +1,35 @@
-import { c as getConfig, s as setAccTitle, g as getAccTitle, b as setAccDescription, a as getAccDescription, q as setDiagramTitle, r as getDiagramTitle, l as log, t as clear$1, u as utils, i as configureSvgSize, v as parseGenericTypes } from "./mermaid-485fd1a4.js";
-import * as graphlib from "dagre-d3-es/src/graphlib/index.js";
-import { select, line, curveBasis } from "d3";
-import { layout } from "dagre-d3-es/src/dagre/index.js";
-import { v5 } from "uuid";
-import "ts-dedent";
-import "dayjs";
-import "@braintree/sanitize-url";
-import "dompurify";
-import "khroma";
-import "lodash-es/memoize.js";
-import "lodash-es/merge.js";
-import "stylis";
-import "lodash-es/isEmpty.js";
+import {
+  utils_default
+} from "./chunk-VKXSJROQ.mjs";
+import {
+  __name,
+  clear,
+  configureSvgSize,
+  getAccDescription,
+  getAccTitle,
+  getConfig2 as getConfig,
+  getDiagramTitle,
+  log,
+  parseGenericTypes,
+  setAccDescription,
+  setAccTitle,
+  setDiagramTitle
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/diagrams/er/parser/erDiagram.jison
 var parser = function() {
-  var o = function(k, v, o2, l) {
-    for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
-      ;
+  var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
+    for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
     return o2;
-  }, $V0 = [6, 8, 10, 20, 22, 24, 26, 27, 28], $V1 = [1, 10], $V2 = [1, 11], $V3 = [1, 12], $V4 = [1, 13], $V5 = [1, 14], $V6 = [1, 15], $V7 = [1, 21], $V8 = [1, 22], $V9 = [1, 23], $Va = [1, 24], $Vb = [1, 25], $Vc = [6, 8, 10, 13, 15, 18, 19, 20, 22, 24, 26, 27, 28, 41, 42, 43, 44, 45], $Vd = [1, 34], $Ve = [27, 28, 46, 47], $Vf = [41, 42, 43, 44, 45], $Vg = [17, 34], $Vh = [1, 54], $Vi = [1, 53], $Vj = [17, 34, 36, 38];
+  }, "o"), $V0 = [6, 8, 10, 20, 22, 24, 26, 27, 28], $V1 = [1, 10], $V2 = [1, 11], $V3 = [1, 12], $V4 = [1, 13], $V5 = [1, 14], $V6 = [1, 15], $V7 = [1, 21], $V8 = [1, 22], $V9 = [1, 23], $Va = [1, 24], $Vb = [1, 25], $Vc = [6, 8, 10, 13, 15, 18, 19, 20, 22, 24, 26, 27, 28, 41, 42, 43, 44, 45], $Vd = [1, 34], $Ve = [27, 28, 46, 47], $Vf = [41, 42, 43, 44, 45], $Vg = [17, 34], $Vh = [1, 54], $Vi = [1, 53], $Vj = [17, 34, 36, 38];
   var parser2 = {
-    trace: function trace() {
-    },
+    trace: /* @__PURE__ */ __name(function trace() {
+    }, "trace"),
     yy: {},
     symbols_: { "error": 2, "start": 3, "ER_DIAGRAM": 4, "document": 5, "EOF": 6, "line": 7, "SPACE": 8, "statement": 9, "NEWLINE": 10, "entityName": 11, "relSpec": 12, ":": 13, "role": 14, "BLOCK_START": 15, "attributes": 16, "BLOCK_STOP": 17, "SQS": 18, "SQE": 19, "title": 20, "title_value": 21, "acc_title": 22, "acc_title_value": 23, "acc_descr": 24, "acc_descr_value": 25, "acc_descr_multiline_value": 26, "ALPHANUM": 27, "ENTITY_NAME": 28, "attribute": 29, "attributeType": 30, "attributeName": 31, "attributeKeyTypeList": 32, "attributeComment": 33, "ATTRIBUTE_WORD": 34, "attributeKeyType": 35, "COMMA": 36, "ATTRIBUTE_KEY": 37, "COMMENT": 38, "cardinality": 39, "relType": 40, "ZERO_OR_ONE": 41, "ZERO_OR_MORE": 42, "ONE_OR_MORE": 43, "ONLY_ONE": 44, "MD_PARENT": 45, "NON_IDENTIFYING": 46, "IDENTIFYING": 47, "WORD": 48, "$accept": 0, "$end": 1 },
     terminals_: { 2: "error", 4: "ER_DIAGRAM", 6: "EOF", 8: "SPACE", 10: "NEWLINE", 13: ":", 15: "BLOCK_START", 17: "BLOCK_STOP", 18: "SQS", 19: "SQE", 20: "title", 21: "title_value", 22: "acc_title", 23: "acc_title_value", 24: "acc_descr", 25: "acc_descr_value", 26: "acc_descr_multiline_value", 27: "ALPHANUM", 28: "ENTITY_NAME", 34: "ATTRIBUTE_WORD", 36: "COMMA", 37: "ATTRIBUTE_KEY", 38: "COMMENT", 41: "ZERO_OR_ONE", 42: "ZERO_OR_MORE", 43: "ONE_OR_MORE", 44: "ONLY_ONE", 45: "MD_PARENT", 46: "NON_IDENTIFYING", 47: "IDENTIFYING", 48: "WORD" },
     productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [9, 5], [9, 4], [9, 3], [9, 1], [9, 7], [9, 6], [9, 4], [9, 2], [9, 2], [9, 2], [9, 1], [11, 1], [11, 1], [16, 1], [16, 2], [29, 2], [29, 3], [29, 3], [29, 4], [30, 1], [31, 1], [32, 1], [32, 3], [35, 1], [33, 1], [12, 3], [39, 1], [39, 1], [39, 1], [39, 1], [39, 1], [40, 1], [40, 1], [14, 1], [14, 1], [14, 1]],
-    performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
+    performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
       var $0 = $$.length - 1;
       switch (yystate) {
         case 1:
@@ -146,10 +150,10 @@ var parser = function() {
           this.$ = yy.Identification.IDENTIFYING;
           break;
       }
-    },
+    }, "anonymous"),
     table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, o($V0, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: 9, 20: $V1, 22: $V2, 24: $V3, 26: $V4, 27: $V5, 28: $V6 }, o($V0, [2, 7], { 1: [2, 1] }), o($V0, [2, 3]), { 9: 16, 11: 9, 20: $V1, 22: $V2, 24: $V3, 26: $V4, 27: $V5, 28: $V6 }, o($V0, [2, 5]), o($V0, [2, 6]), o($V0, [2, 11], { 12: 17, 39: 20, 15: [1, 18], 18: [1, 19], 41: $V7, 42: $V8, 43: $V9, 44: $Va, 45: $Vb }), { 21: [1, 26] }, { 23: [1, 27] }, { 25: [1, 28] }, o($V0, [2, 18]), o($Vc, [2, 19]), o($Vc, [2, 20]), o($V0, [2, 4]), { 11: 29, 27: $V5, 28: $V6 }, { 16: 30, 17: [1, 31], 29: 32, 30: 33, 34: $Vd }, { 11: 35, 27: $V5, 28: $V6 }, { 40: 36, 46: [1, 37], 47: [1, 38] }, o($Ve, [2, 34]), o($Ve, [2, 35]), o($Ve, [2, 36]), o($Ve, [2, 37]), o($Ve, [2, 38]), o($V0, [2, 15]), o($V0, [2, 16]), o($V0, [2, 17]), { 13: [1, 39] }, { 17: [1, 40] }, o($V0, [2, 10]), { 16: 41, 17: [2, 21], 29: 32, 30: 33, 34: $Vd }, { 31: 42, 34: [1, 43] }, { 34: [2, 27] }, { 19: [1, 44] }, { 39: 45, 41: $V7, 42: $V8, 43: $V9, 44: $Va, 45: $Vb }, o($Vf, [2, 39]), o($Vf, [2, 40]), { 14: 46, 27: [1, 49], 28: [1, 48], 48: [1, 47] }, o($V0, [2, 9]), { 17: [2, 22] }, o($Vg, [2, 23], { 32: 50, 33: 51, 35: 52, 37: $Vh, 38: $Vi }), o([17, 34, 37, 38], [2, 28]), o($V0, [2, 14], { 15: [1, 55] }), o([27, 28], [2, 33]), o($V0, [2, 8]), o($V0, [2, 41]), o($V0, [2, 42]), o($V0, [2, 43]), o($Vg, [2, 24], { 33: 56, 36: [1, 57], 38: $Vi }), o($Vg, [2, 25]), o($Vj, [2, 29]), o($Vg, [2, 32]), o($Vj, [2, 31]), { 16: 58, 17: [1, 59], 29: 32, 30: 33, 34: $Vd }, o($Vg, [2, 26]), { 35: 60, 37: $Vh }, { 17: [1, 61] }, o($V0, [2, 13]), o($Vj, [2, 30]), o($V0, [2, 12])],
     defaultActions: { 34: [2, 27], 41: [2, 22] },
-    parseError: function parseError(str, hash) {
+    parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
       if (hash.recoverable) {
         this.trace(str);
       } else {
@@ -157,9 +161,9 @@ var parser = function() {
         error.hash = hash;
         throw error;
       }
-    },
-    parse: function parse(input) {
-      var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
+    }, "parseError"),
+    parse: /* @__PURE__ */ __name(function parse(input) {
+      var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
       var args = lstack.slice.call(arguments, 1);
       var lexer2 = Object.create(this.lexer);
       var sharedState = { yy: {} };
@@ -182,6 +186,12 @@ var parser = function() {
       } else {
         this.parseError = Object.getPrototypeOf(this).parseError;
       }
+      function popStack(n) {
+        stack.length = stack.length - 2 * n;
+        vstack.length = vstack.length - n;
+        lstack.length = lstack.length - n;
+      }
+      __name(popStack, "popStack");
       function lex() {
         var token;
         token = tstack.pop() || lexer2.lex() || EOF;
@@ -194,7 +204,8 @@ var parser = function() {
         }
         return token;
       }
-      var symbol, state, action, r, yyval = {}, p, len, newState, expected;
+      __name(lex, "lex");
+      var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
       while (true) {
         state = stack[stack.length - 1];
         if (this.defaultActions[state]) {
@@ -236,11 +247,17 @@ var parser = function() {
             lstack.push(lexer2.yylloc);
             stack.push(action[1]);
             symbol = null;
-            {
+            if (!preErrorSymbol) {
               yyleng = lexer2.yyleng;
               yytext = lexer2.yytext;
               yylineno = lexer2.yylineno;
               yyloc = lexer2.yylloc;
+              if (recovering > 0) {
+                recovering--;
+              }
+            } else {
+              symbol = preErrorSymbol;
+              preErrorSymbol = null;
             }
             break;
           case 2:
@@ -286,20 +303,20 @@ var parser = function() {
         }
       }
       return true;
-    }
+    }, "parse")
   };
-  var lexer = function() {
+  var lexer = /* @__PURE__ */ function() {
     var lexer2 = {
       EOF: 1,
-      parseError: function parseError(str, hash) {
+      parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
         if (this.yy.parser) {
           this.yy.parser.parseError(str, hash);
         } else {
           throw new Error(str);
         }
-      },
+      }, "parseError"),
       // resets the lexer, sets new input
-      setInput: function(input, yy) {
+      setInput: /* @__PURE__ */ __name(function(input, yy) {
         this.yy = yy || this.yy || {};
         this._input = input;
         this._more = this._backtrack = this.done = false;
@@ -317,9 +334,9 @@ var parser = function() {
         }
         this.offset = 0;
         return this;
-      },
+      }, "setInput"),
       // consumes and returns one char from the input
-      input: function() {
+      input: /* @__PURE__ */ __name(function() {
         var ch = this._input[0];
         this.yytext += ch;
         this.yyleng++;
@@ -338,9 +355,9 @@ var parser = function() {
         }
         this._input = this._input.slice(1);
         return ch;
-      },
+      }, "input"),
       // unshifts one char (or a string) into the input
-      unput: function(ch) {
+      unput: /* @__PURE__ */ __name(function(ch) {
         var len = ch.length;
         var lines = ch.split(/(?:\r\n?|\n)/g);
         this._input = ch + this._input;
@@ -364,14 +381,14 @@ var parser = function() {
         }
         this.yyleng = this.yytext.length;
         return this;
-      },
+      }, "unput"),
       // When called from action, caches matched text and appends it on next action
-      more: function() {
+      more: /* @__PURE__ */ __name(function() {
         this._more = true;
         return this;
-      },
+      }, "more"),
       // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
-      reject: function() {
+      reject: /* @__PURE__ */ __name(function() {
         if (this.options.backtrack_lexer) {
           this._backtrack = true;
         } else {
@@ -382,32 +399,32 @@ var parser = function() {
           });
         }
         return this;
-      },
+      }, "reject"),
       // retain first n characters of the match
-      less: function(n) {
+      less: /* @__PURE__ */ __name(function(n) {
         this.unput(this.match.slice(n));
-      },
+      }, "less"),
       // displays already matched input, i.e. for error messages
-      pastInput: function() {
+      pastInput: /* @__PURE__ */ __name(function() {
         var past = this.matched.substr(0, this.matched.length - this.match.length);
         return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
-      },
+      }, "pastInput"),
       // displays upcoming input, i.e. for error messages
-      upcomingInput: function() {
+      upcomingInput: /* @__PURE__ */ __name(function() {
         var next = this.match;
         if (next.length < 20) {
           next += this._input.substr(0, 20 - next.length);
         }
         return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
-      },
+      }, "upcomingInput"),
       // displays the character position where the lexing error occurred, i.e. for error messages
-      showPosition: function() {
+      showPosition: /* @__PURE__ */ __name(function() {
         var pre = this.pastInput();
         var c = new Array(pre.length + 1).join("-");
         return pre + this.upcomingInput() + "\n" + c + "^";
-      },
+      }, "showPosition"),
       // test the lexed token: return FALSE when not a match, otherwise return token
-      test_match: function(match, indexed_rule) {
+      test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
         var token, lines, backup;
         if (this.options.backtrack_lexer) {
           backup = {
@@ -468,9 +485,9 @@ var parser = function() {
           return false;
         }
         return false;
-      },
+      }, "test_match"),
       // return next match in input
-      next: function() {
+      next: /* @__PURE__ */ __name(function() {
         if (this.done) {
           return this.EOF;
         }
@@ -519,69 +536,74 @@ var parser = function() {
             line: this.yylineno
           });
         }
-      },
+      }, "next"),
       // return next match that has a token
-      lex: function lex() {
+      lex: /* @__PURE__ */ __name(function lex() {
         var r = this.next();
         if (r) {
           return r;
         } else {
           return this.lex();
         }
-      },
+      }, "lex"),
       // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
-      begin: function begin(condition) {
+      begin: /* @__PURE__ */ __name(function begin(condition) {
         this.conditionStack.push(condition);
-      },
+      }, "begin"),
       // pop the previously active lexer condition state off the condition stack
-      popState: function popState() {
+      popState: /* @__PURE__ */ __name(function popState() {
         var n = this.conditionStack.length - 1;
         if (n > 0) {
           return this.conditionStack.pop();
         } else {
           return this.conditionStack[0];
         }
-      },
+      }, "popState"),
       // produce the lexer rule set which is active for the currently active lexer condition state
-      _currentRules: function _currentRules() {
+      _currentRules: /* @__PURE__ */ __name(function _currentRules() {
         if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
           return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
         } else {
           return this.conditions["INITIAL"].rules;
         }
-      },
+      }, "_currentRules"),
       // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
-      topState: function topState(n) {
+      topState: /* @__PURE__ */ __name(function topState(n) {
         n = this.conditionStack.length - 1 - Math.abs(n || 0);
         if (n >= 0) {
           return this.conditionStack[n];
         } else {
           return "INITIAL";
         }
-      },
+      }, "topState"),
       // alias for begin(condition)
-      pushState: function pushState(condition) {
+      pushState: /* @__PURE__ */ __name(function pushState(condition) {
         this.begin(condition);
-      },
+      }, "pushState"),
       // return the number of states currently on the stack
-      stateStackSize: function stateStackSize() {
+      stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
         return this.conditionStack.length;
-      },
+      }, "stateStackSize"),
       options: { "case-insensitive": true },
-      performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
+      performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
+        var YYSTATE = YY_START;
         switch ($avoiding_name_collisions) {
           case 0:
             this.begin("acc_title");
             return 22;
+            break;
           case 1:
             this.popState();
             return "acc_title_value";
+            break;
           case 2:
             this.begin("acc_descr");
             return 24;
+            break;
           case 3:
             this.popState();
             return "acc_descr_value";
+            break;
           case 4:
             this.begin("acc_descr_multiline");
             break;
@@ -590,108 +612,155 @@ var parser = function() {
             break;
           case 6:
             return "acc_descr_multiline_value";
+            break;
           case 7:
             return 10;
+            break;
           case 8:
             break;
           case 9:
             return 8;
+            break;
           case 10:
             return 28;
+            break;
           case 11:
             return 48;
+            break;
           case 12:
             return 4;
+            break;
           case 13:
             this.begin("block");
             return 15;
+            break;
           case 14:
             return 36;
+            break;
           case 15:
             break;
           case 16:
             return 37;
+            break;
           case 17:
             return 34;
+            break;
           case 18:
             return 34;
+            break;
           case 19:
             return 38;
+            break;
           case 20:
             break;
           case 21:
             this.popState();
             return 17;
+            break;
           case 22:
             return yy_.yytext[0];
+            break;
           case 23:
             return 18;
+            break;
           case 24:
             return 19;
+            break;
           case 25:
             return 41;
+            break;
           case 26:
             return 43;
+            break;
           case 27:
             return 43;
+            break;
           case 28:
             return 43;
+            break;
           case 29:
             return 41;
+            break;
           case 30:
             return 41;
+            break;
           case 31:
             return 42;
+            break;
           case 32:
             return 42;
+            break;
           case 33:
             return 42;
+            break;
           case 34:
             return 42;
+            break;
           case 35:
             return 42;
+            break;
           case 36:
             return 43;
+            break;
           case 37:
             return 42;
+            break;
           case 38:
             return 43;
+            break;
           case 39:
             return 44;
+            break;
           case 40:
             return 44;
+            break;
           case 41:
             return 44;
+            break;
           case 42:
             return 44;
+            break;
           case 43:
             return 41;
+            break;
           case 44:
             return 42;
+            break;
           case 45:
             return 43;
+            break;
           case 46:
             return 45;
+            break;
           case 47:
             return 46;
+            break;
           case 48:
             return 47;
+            break;
           case 49:
             return 47;
+            break;
           case 50:
             return 46;
+            break;
           case 51:
             return 46;
+            break;
           case 52:
             return 46;
+            break;
           case 53:
             return 27;
+            break;
           case 54:
             return yy_.yytext[0];
+            break;
           case 55:
             return 6;
+            break;
         }
-      },
+      }, "anonymous"),
       rules: [/^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:[\s]+)/i, /^(?:"[^"%\r\n\v\b\\]+")/i, /^(?:"[^"]*")/i, /^(?:erDiagram\b)/i, /^(?:\{)/i, /^(?:,)/i, /^(?:\s+)/i, /^(?:\b((?:PK)|(?:FK)|(?:UK))\b)/i, /^(?:(.*?)[~](.*?)*[~])/i, /^(?:[\*A-Za-z_][A-Za-z0-9\-_\[\]\(\)]*)/i, /^(?:"[^"]*")/i, /^(?:[\n]+)/i, /^(?:\})/i, /^(?:.)/i, /^(?:\[)/i, /^(?:\])/i, /^(?:one or zero\b)/i, /^(?:one or more\b)/i, /^(?:one or many\b)/i, /^(?:1\+)/i, /^(?:\|o\b)/i, /^(?:zero or one\b)/i, /^(?:zero or more\b)/i, /^(?:zero or many\b)/i, /^(?:0\+)/i, /^(?:\}o\b)/i, /^(?:many\(0\))/i, /^(?:many\(1\))/i, /^(?:many\b)/i, /^(?:\}\|)/i, /^(?:one\b)/i, /^(?:only one\b)/i, /^(?:1\b)/i, /^(?:\|\|)/i, /^(?:o\|)/i, /^(?:o\{)/i, /^(?:\|\{)/i, /^(?:\s*u\b)/i, /^(?:\.\.)/i, /^(?:--)/i, /^(?:to\b)/i, /^(?:optionally to\b)/i, /^(?:\.-)/i, /^(?:-\.)/i, /^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i, /^(?:.)/i, /^(?:$)/i],
       conditions: { "acc_descr_multiline": { "rules": [5, 6], "inclusive": false }, "acc_descr": { "rules": [3], "inclusive": false }, "acc_title": { "rules": [1], "inclusive": false }, "block": { "rules": [14, 15, 16, 17, 18, 19, 20, 21, 22], "inclusive": false }, "INITIAL": { "rules": [0, 2, 4, 7, 8, 9, 10, 11, 12, 13, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55], "inclusive": true } }
     };
@@ -701,45 +770,48 @@ var parser = function() {
   function Parser() {
     this.yy = {};
   }
+  __name(Parser, "Parser");
   Parser.prototype = parser2;
   parser2.Parser = Parser;
   return new Parser();
 }();
 parser.parser = parser;
-const erParser = parser;
-let entities = {};
-let relationships = [];
-const Cardinality = {
+var erDiagram_default = parser;
+
+// src/diagrams/er/erDb.js
+var entities = /* @__PURE__ */ new Map();
+var relationships = [];
+var Cardinality = {
   ZERO_OR_ONE: "ZERO_OR_ONE",
   ZERO_OR_MORE: "ZERO_OR_MORE",
   ONE_OR_MORE: "ONE_OR_MORE",
   ONLY_ONE: "ONLY_ONE",
   MD_PARENT: "MD_PARENT"
 };
-const Identification = {
+var Identification = {
   NON_IDENTIFYING: "NON_IDENTIFYING",
   IDENTIFYING: "IDENTIFYING"
 };
-const addEntity = function(name, alias = void 0) {
-  if (entities[name] === void 0) {
-    entities[name] = { attributes: [], alias };
+var addEntity = /* @__PURE__ */ __name(function(name, alias = void 0) {
+  if (!entities.has(name)) {
+    entities.set(name, { attributes: [], alias });
     log.info("Added new entity :", name);
-  } else if (entities[name] && !entities[name].alias && alias) {
-    entities[name].alias = alias;
+  } else if (!entities.get(name).alias && alias) {
+    entities.get(name).alias = alias;
     log.info(`Add alias '${alias}' to entity '${name}'`);
   }
-  return entities[name];
-};
-const getEntities = () => entities;
-const addAttributes = function(entityName, attribs) {
+  return entities.get(name);
+}, "addEntity");
+var getEntities = /* @__PURE__ */ __name(() => entities, "getEntities");
+var addAttributes = /* @__PURE__ */ __name(function(entityName, attribs) {
   let entity = addEntity(entityName);
   let i;
   for (i = attribs.length - 1; i >= 0; i--) {
     entity.attributes.push(attribs[i]);
     log.debug("Added attribute ", attribs[i].attributeName);
   }
-};
-const addRelationship = function(entA, rolA, entB, rSpec) {
+}, "addAttributes");
+var addRelationship = /* @__PURE__ */ __name(function(entA, rolA, entB, rSpec) {
   let rel = {
     entityA: entA,
     roleA: rolA,
@@ -748,23 +820,23 @@ const addRelationship = function(entA, rolA, entB, rSpec) {
   };
   relationships.push(rel);
   log.debug("Added new relationship :", rel);
-};
-const getRelationships = () => relationships;
-const clear = function() {
-  entities = {};
+}, "addRelationship");
+var getRelationships = /* @__PURE__ */ __name(() => relationships, "getRelationships");
+var clear2 = /* @__PURE__ */ __name(function() {
+  entities = /* @__PURE__ */ new Map();
   relationships = [];
-  clear$1();
-};
-const erDb = {
+  clear();
+}, "clear");
+var erDb_default = {
   Cardinality,
   Identification,
-  getConfig: () => getConfig().er,
+  getConfig: /* @__PURE__ */ __name(() => getConfig().er, "getConfig"),
   addEntity,
   addAttributes,
   getEntities,
   addRelationship,
   getRelationships,
-  clear,
+  clear: clear2,
   setAccTitle,
   getAccTitle,
   setAccDescription,
@@ -772,7 +844,14 @@ const erDb = {
   setDiagramTitle,
   getDiagramTitle
 };
-const ERMarkers = {
+
+// src/diagrams/er/erRenderer.js
+import * as graphlib from "dagre-d3-es/src/graphlib/index.js";
+import { line, curveBasis, select } from "d3";
+import { layout as dagreLayout } from "dagre-d3-es/src/dagre/index.js";
+
+// src/diagrams/er/erMarkers.js
+var ERMarkers = {
   ONLY_ONE_START: "ONLY_ONE_START",
   ONLY_ONE_END: "ONLY_ONE_END",
   ZERO_OR_ONE_START: "ZERO_OR_ONE_START",
@@ -784,7 +863,7 @@ const ERMarkers = {
   MD_PARENT_END: "MD_PARENT_END",
   MD_PARENT_START: "MD_PARENT_START"
 };
-const insertMarkers = function(elem, conf2) {
+var insertMarkers = /* @__PURE__ */ __name(function(elem, conf2) {
   let marker;
   elem.append("defs").append("marker").attr("id", ERMarkers.MD_PARENT_START).attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
   elem.append("defs").append("marker").attr("id", ERMarkers.MD_PARENT_END).attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
@@ -805,21 +884,24 @@ const insertMarkers = function(elem, conf2) {
   marker.append("circle").attr("stroke", conf2.stroke).attr("fill", "white").attr("cx", 9).attr("cy", 18).attr("r", 6);
   marker.append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M21,18 Q39,0 57,18 Q39,36 21,18");
   return;
-};
-const erMarkers = {
+}, "insertMarkers");
+var erMarkers_default = {
   ERMarkers,
   insertMarkers
 };
-const BAD_ID_CHARS_REGEXP = /[^\dA-Za-z](\W)*/g;
-let conf = {};
-let entityNameIds = /* @__PURE__ */ new Map();
-const setConf = function(cnf) {
+
+// src/diagrams/er/erRenderer.js
+import { v5 as uuid5 } from "uuid";
+var BAD_ID_CHARS_REGEXP = /[^\dA-Za-z](\W)*/g;
+var conf = {};
+var entityNameIds = /* @__PURE__ */ new Map();
+var setConf = /* @__PURE__ */ __name(function(cnf) {
   const keys = Object.keys(cnf);
   for (const key of keys) {
     conf[key] = cnf[key];
   }
-};
-const drawAttributes = (groupNode, entityTextNode, attributes) => {
+}, "setConf");
+var drawAttributes = /* @__PURE__ */ __name((groupNode, entityTextNode, attributes) => {
   const heightPadding = conf.entityPadding / 3;
   const widthPadding = conf.entityPadding / 3;
   const attrFontSize = conf.fontSize * 0.85;
@@ -938,9 +1020,9 @@ const drawAttributes = (groupNode, entityTextNode, attributes) => {
     entityTextNode.attr("transform", "translate(" + bBox.width / 2 + "," + bBox.height / 2 + ")");
   }
   return bBox;
-};
-const drawEntities = function(svgNode, entities2, graph) {
-  const keys = Object.keys(entities2);
+}, "drawAttributes");
+var drawEntities = /* @__PURE__ */ __name(function(svgNode, entities2, graph) {
+  const keys = [...entities2.keys()];
   let firstOne;
   keys.forEach(function(entityName) {
     const entityId = generateId(entityName, "entity");
@@ -948,11 +1030,11 @@ const drawEntities = function(svgNode, entities2, graph) {
     const groupNode = svgNode.append("g").attr("id", entityId);
     firstOne = firstOne === void 0 ? entityId : firstOne;
     const textId = "text-" + entityId;
-    const textNode = groupNode.append("text").classed("er entityLabel", true).attr("id", textId).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "middle").style("font-family", getConfig().fontFamily).style("font-size", conf.fontSize + "px").text(entities2[entityName].alias ?? entityName);
+    const textNode = groupNode.append("text").classed("er entityLabel", true).attr("id", textId).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "middle").style("font-family", getConfig().fontFamily).style("font-size", conf.fontSize + "px").text(entities2.get(entityName).alias ?? entityName);
     const { width: entityWidth, height: entityHeight } = drawAttributes(
       groupNode,
       textNode,
-      entities2[entityName].attributes
+      entities2.get(entityName).attributes
     );
     const rectNode = groupNode.insert("rect", "#" + textId).classed("er entityBox", true).attr("x", 0).attr("y", 0).attr("width", entityWidth).attr("height", entityHeight);
     const rectBBox = rectNode.node().getBBox();
@@ -964,8 +1046,8 @@ const drawEntities = function(svgNode, entities2, graph) {
     });
   });
   return firstOne;
-};
-const adjustEntities = function(svgNode, graph) {
+}, "drawEntities");
+var adjustEntities = /* @__PURE__ */ __name(function(svgNode, graph) {
   graph.nodes().forEach(function(v) {
     if (v !== void 0 && graph.node(v) !== void 0) {
       svgNode.select("#" + v).attr(
@@ -974,11 +1056,11 @@ const adjustEntities = function(svgNode, graph) {
       );
     }
   });
-};
-const getEdgeName = function(rel) {
+}, "adjustEntities");
+var getEdgeName = /* @__PURE__ */ __name(function(rel) {
   return (rel.entityA + rel.roleA + rel.entityB).replace(/\s/g, "");
-};
-const addRelationships = function(relationships2, g) {
+}, "getEdgeName");
+var addRelationships = /* @__PURE__ */ __name(function(relationships2, g) {
   relationships2.forEach(function(r) {
     g.setEdge(
       entityNameIds.get(r.entityA),
@@ -988,9 +1070,9 @@ const addRelationships = function(relationships2, g) {
     );
   });
   return relationships2;
-};
-let relCnt = 0;
-const drawRelationshipFromLayout = function(svg, rel, g, insert, diagObj) {
+}, "addRelationships");
+var relCnt = 0;
+var drawRelationshipFromLayout = /* @__PURE__ */ __name(function(svg, rel, g, insert, diagObj) {
   relCnt++;
   const edge = g.edge(
     entityNameIds.get(rel.entityA),
@@ -1014,45 +1096,45 @@ const drawRelationshipFromLayout = function(svg, rel, g, insert, diagObj) {
   }
   switch (rel.relSpec.cardA) {
     case diagObj.db.Cardinality.ZERO_OR_ONE:
-      svgPath.attr("marker-end", "url(" + url + "#" + erMarkers.ERMarkers.ZERO_OR_ONE_END + ")");
+      svgPath.attr("marker-end", "url(" + url + "#" + erMarkers_default.ERMarkers.ZERO_OR_ONE_END + ")");
       break;
     case diagObj.db.Cardinality.ZERO_OR_MORE:
-      svgPath.attr("marker-end", "url(" + url + "#" + erMarkers.ERMarkers.ZERO_OR_MORE_END + ")");
+      svgPath.attr("marker-end", "url(" + url + "#" + erMarkers_default.ERMarkers.ZERO_OR_MORE_END + ")");
       break;
     case diagObj.db.Cardinality.ONE_OR_MORE:
-      svgPath.attr("marker-end", "url(" + url + "#" + erMarkers.ERMarkers.ONE_OR_MORE_END + ")");
+      svgPath.attr("marker-end", "url(" + url + "#" + erMarkers_default.ERMarkers.ONE_OR_MORE_END + ")");
       break;
     case diagObj.db.Cardinality.ONLY_ONE:
-      svgPath.attr("marker-end", "url(" + url + "#" + erMarkers.ERMarkers.ONLY_ONE_END + ")");
+      svgPath.attr("marker-end", "url(" + url + "#" + erMarkers_default.ERMarkers.ONLY_ONE_END + ")");
       break;
     case diagObj.db.Cardinality.MD_PARENT:
-      svgPath.attr("marker-end", "url(" + url + "#" + erMarkers.ERMarkers.MD_PARENT_END + ")");
+      svgPath.attr("marker-end", "url(" + url + "#" + erMarkers_default.ERMarkers.MD_PARENT_END + ")");
       break;
   }
   switch (rel.relSpec.cardB) {
     case diagObj.db.Cardinality.ZERO_OR_ONE:
       svgPath.attr(
         "marker-start",
-        "url(" + url + "#" + erMarkers.ERMarkers.ZERO_OR_ONE_START + ")"
+        "url(" + url + "#" + erMarkers_default.ERMarkers.ZERO_OR_ONE_START + ")"
       );
       break;
     case diagObj.db.Cardinality.ZERO_OR_MORE:
       svgPath.attr(
         "marker-start",
-        "url(" + url + "#" + erMarkers.ERMarkers.ZERO_OR_MORE_START + ")"
+        "url(" + url + "#" + erMarkers_default.ERMarkers.ZERO_OR_MORE_START + ")"
       );
       break;
     case diagObj.db.Cardinality.ONE_OR_MORE:
       svgPath.attr(
         "marker-start",
-        "url(" + url + "#" + erMarkers.ERMarkers.ONE_OR_MORE_START + ")"
+        "url(" + url + "#" + erMarkers_default.ERMarkers.ONE_OR_MORE_START + ")"
       );
       break;
     case diagObj.db.Cardinality.ONLY_ONE:
-      svgPath.attr("marker-start", "url(" + url + "#" + erMarkers.ERMarkers.ONLY_ONE_START + ")");
+      svgPath.attr("marker-start", "url(" + url + "#" + erMarkers_default.ERMarkers.ONLY_ONE_START + ")");
       break;
     case diagObj.db.Cardinality.MD_PARENT:
-      svgPath.attr("marker-start", "url(" + url + "#" + erMarkers.ERMarkers.MD_PARENT_START + ")");
+      svgPath.attr("marker-start", "url(" + url + "#" + erMarkers_default.ERMarkers.MD_PARENT_START + ")");
       break;
   }
   const len = svgPath.node().getTotalLength();
@@ -1061,8 +1143,8 @@ const drawRelationshipFromLayout = function(svg, rel, g, insert, diagObj) {
   const labelNode = svg.append("text").classed("er relationshipLabel", true).attr("id", labelId).attr("x", labelPoint.x).attr("y", labelPoint.y).style("text-anchor", "middle").style("dominant-baseline", "middle").style("font-family", getConfig().fontFamily).style("font-size", conf.fontSize + "px").text(rel.roleA);
   const labelBBox = labelNode.node().getBBox();
   svg.insert("rect", "#" + labelId).classed("er relationshipLabelBox", true).attr("x", labelPoint.x - labelBBox.width / 2).attr("y", labelPoint.y - labelBBox.height / 2).attr("width", labelBBox.width).attr("height", labelBBox.height);
-};
-const draw = function(text, id, _version, diagObj) {
+}, "drawRelationshipFromLayout");
+var draw = /* @__PURE__ */ __name(function(text, id, _version, diagObj) {
   conf = getConfig().er;
   log.info("Drawing ER diagram");
   const securityLevel = getConfig().securityLevel;
@@ -1072,7 +1154,7 @@ const draw = function(text, id, _version, diagObj) {
   }
   const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
   const svg = root.select(`[id='${id}']`);
-  erMarkers.insertMarkers(svg, conf);
+  erMarkers_default.insertMarkers(svg, conf);
   let g;
   g = new graphlib.Graph({
     multigraph: true,
@@ -1090,35 +1172,39 @@ const draw = function(text, id, _version, diagObj) {
   });
   const firstEntity = drawEntities(svg, diagObj.db.getEntities(), g);
   const relationships2 = addRelationships(diagObj.db.getRelationships(), g);
-  layout(g);
+  dagreLayout(g);
   adjustEntities(svg, g);
   relationships2.forEach(function(rel) {
     drawRelationshipFromLayout(svg, rel, g, firstEntity, diagObj);
   });
   const padding = conf.diagramPadding;
-  utils.insertTitle(svg, "entityTitleText", conf.titleTopMargin, diagObj.db.getDiagramTitle());
+  utils_default.insertTitle(svg, "entityTitleText", conf.titleTopMargin, diagObj.db.getDiagramTitle());
   const svgBounds = svg.node().getBBox();
   const width = svgBounds.width + padding * 2;
   const height = svgBounds.height + padding * 2;
   configureSvgSize(svg, height, width, conf.useMaxWidth);
   svg.attr("viewBox", `${svgBounds.x - padding} ${svgBounds.y - padding} ${width} ${height}`);
-};
-const MERMAID_ERDIAGRAM_UUID = "28e9f9db-3c8d-5aa5-9faf-44286ae5937c";
+}, "draw");
+var MERMAID_ERDIAGRAM_UUID = "28e9f9db-3c8d-5aa5-9faf-44286ae5937c";
 function generateId(str = "", prefix = "") {
   const simplifiedStr = str.replace(BAD_ID_CHARS_REGEXP, "");
-  return `${strWithHyphen(prefix)}${strWithHyphen(simplifiedStr)}${v5(
+  return `${strWithHyphen(prefix)}${strWithHyphen(simplifiedStr)}${uuid5(
     str,
     MERMAID_ERDIAGRAM_UUID
   )}`;
 }
+__name(generateId, "generateId");
 function strWithHyphen(str = "") {
   return str.length > 0 ? `${str}-` : "";
 }
-const erRenderer = {
+__name(strWithHyphen, "strWithHyphen");
+var erRenderer_default = {
   setConf,
   draw
 };
-const getStyles = (options) => `
+
+// src/diagrams/er/styles.js
+var getStyles = /* @__PURE__ */ __name((options) => `
   .entityBox {
     fill: ${options.mainBkg};
     stroke: ${options.nodeBorder};
@@ -1163,13 +1249,15 @@ const getStyles = (options) => `
     stroke-width: 1;
   }
   
-`;
-const erStyles = getStyles;
-const diagram = {
-  parser: erParser,
-  db: erDb,
-  renderer: erRenderer,
-  styles: erStyles
+`, "getStyles");
+var styles_default = getStyles;
+
+// src/diagrams/er/erDiagram.ts
+var diagram = {
+  parser: erDiagram_default,
+  db: erDb_default,
+  renderer: erRenderer_default,
+  styles: styles_default
 };
 export {
   diagram

File diff suppressed because it is too large
+ 845 - 4
nicegui/elements/lib/mermaid/chunks/mermaid.core/flowDiagram-TGP4CI55.mjs


File diff suppressed because it is too large
+ 339 - 250
nicegui/elements/lib/mermaid/chunks/mermaid.core/ganttDiagram-GAYIUD5S.mjs


+ 1761 - 0
nicegui/elements/lib/mermaid/chunks/mermaid.core/gitGraphDiagram-LGD5RUNZ.mjs

@@ -0,0 +1,1761 @@
+import {
+  populateCommonDb
+} from "./chunk-JJENOPKO.mjs";
+import {
+  ImperativeState
+} from "./chunk-FBCX6ULS.mjs";
+import {
+  cleanAndMerge,
+  random,
+  utils_default
+} from "./chunk-VKXSJROQ.mjs";
+import {
+  __name,
+  clear,
+  common_default,
+  defaultConfig_default,
+  getAccDescription,
+  getAccTitle,
+  getConfig,
+  getConfig2,
+  getDiagramTitle,
+  log,
+  setAccDescription,
+  setAccTitle,
+  setDiagramTitle,
+  setupGraphViewbox2 as setupGraphViewbox
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/diagrams/git/gitGraphParser.ts
+import { parse } from "@mermaid-js/parser";
+
+// src/diagrams/git/gitGraphTypes.ts
+var commitType = {
+  NORMAL: 0,
+  REVERSE: 1,
+  HIGHLIGHT: 2,
+  MERGE: 3,
+  CHERRY_PICK: 4
+};
+
+// src/diagrams/git/gitGraphAst.ts
+var DEFAULT_GITGRAPH_CONFIG = defaultConfig_default.gitGraph;
+var getConfig3 = /* @__PURE__ */ __name(() => {
+  const config = cleanAndMerge({
+    ...DEFAULT_GITGRAPH_CONFIG,
+    ...getConfig().gitGraph
+  });
+  return config;
+}, "getConfig");
+var state = new ImperativeState(() => {
+  const config = getConfig3();
+  const mainBranchName = config.mainBranchName;
+  const mainBranchOrder = config.mainBranchOrder;
+  return {
+    mainBranchName,
+    commits: /* @__PURE__ */ new Map(),
+    head: null,
+    branchConfig: /* @__PURE__ */ new Map([[mainBranchName, { name: mainBranchName, order: mainBranchOrder }]]),
+    branches: /* @__PURE__ */ new Map([[mainBranchName, null]]),
+    currBranch: mainBranchName,
+    direction: "LR",
+    seq: 0,
+    options: {}
+  };
+});
+function getID() {
+  return random({ length: 7 });
+}
+__name(getID, "getID");
+function uniqBy(list, fn) {
+  const recordMap = /* @__PURE__ */ Object.create(null);
+  return list.reduce((out, item) => {
+    const key = fn(item);
+    if (!recordMap[key]) {
+      recordMap[key] = true;
+      out.push(item);
+    }
+    return out;
+  }, []);
+}
+__name(uniqBy, "uniqBy");
+var setDirection = /* @__PURE__ */ __name(function(dir2) {
+  state.records.direction = dir2;
+}, "setDirection");
+var setOptions = /* @__PURE__ */ __name(function(rawOptString) {
+  log.debug("options str", rawOptString);
+  rawOptString = rawOptString?.trim();
+  rawOptString = rawOptString || "{}";
+  try {
+    state.records.options = JSON.parse(rawOptString);
+  } catch (e) {
+    log.error("error while parsing gitGraph options", e.message);
+  }
+}, "setOptions");
+var getOptions = /* @__PURE__ */ __name(function() {
+  return state.records.options;
+}, "getOptions");
+var commit = /* @__PURE__ */ __name(function(commitDB) {
+  let msg = commitDB.msg;
+  let id = commitDB.id;
+  const type = commitDB.type;
+  let tags = commitDB.tags;
+  log.info("commit", msg, id, type, tags);
+  log.debug("Entering commit:", msg, id, type, tags);
+  const config = getConfig3();
+  id = common_default.sanitizeText(id, config);
+  msg = common_default.sanitizeText(msg, config);
+  tags = tags?.map((tag) => common_default.sanitizeText(tag, config));
+  const newCommit = {
+    id: id ? id : state.records.seq + "-" + getID(),
+    message: msg,
+    seq: state.records.seq++,
+    type: type ?? commitType.NORMAL,
+    tags: tags ?? [],
+    parents: state.records.head == null ? [] : [state.records.head.id],
+    branch: state.records.currBranch
+  };
+  state.records.head = newCommit;
+  log.info("main branch", config.mainBranchName);
+  state.records.commits.set(newCommit.id, newCommit);
+  state.records.branches.set(state.records.currBranch, newCommit.id);
+  log.debug("in pushCommit " + newCommit.id);
+}, "commit");
+var branch = /* @__PURE__ */ __name(function(branchDB) {
+  let name = branchDB.name;
+  const order = branchDB.order;
+  name = common_default.sanitizeText(name, getConfig3());
+  if (state.records.branches.has(name)) {
+    throw new Error(
+      `Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${name}")`
+    );
+  }
+  state.records.branches.set(name, state.records.head != null ? state.records.head.id : null);
+  state.records.branchConfig.set(name, { name, order });
+  checkout(name);
+  log.debug("in createBranch");
+}, "branch");
+var merge = /* @__PURE__ */ __name((mergeDB) => {
+  let otherBranch = mergeDB.branch;
+  let customId = mergeDB.id;
+  const overrideType = mergeDB.type;
+  const customTags = mergeDB.tags;
+  const config = getConfig3();
+  otherBranch = common_default.sanitizeText(otherBranch, config);
+  if (customId) {
+    customId = common_default.sanitizeText(customId, config);
+  }
+  const currentBranchCheck = state.records.branches.get(state.records.currBranch);
+  const otherBranchCheck = state.records.branches.get(otherBranch);
+  const currentCommit = currentBranchCheck ? state.records.commits.get(currentBranchCheck) : void 0;
+  const otherCommit = otherBranchCheck ? state.records.commits.get(otherBranchCheck) : void 0;
+  if (currentCommit && otherCommit && currentCommit.branch === otherBranch) {
+    throw new Error(`Cannot merge branch '${otherBranch}' into itself.`);
+  }
+  if (state.records.currBranch === otherBranch) {
+    const error = new Error('Incorrect usage of "merge". Cannot merge a branch to itself');
+    error.hash = {
+      text: `merge ${otherBranch}`,
+      token: `merge ${otherBranch}`,
+      expected: ["branch abc"]
+    };
+    throw error;
+  }
+  if (currentCommit === void 0 || !currentCommit) {
+    const error = new Error(
+      `Incorrect usage of "merge". Current branch (${state.records.currBranch})has no commits`
+    );
+    error.hash = {
+      text: `merge ${otherBranch}`,
+      token: `merge ${otherBranch}`,
+      expected: ["commit"]
+    };
+    throw error;
+  }
+  if (!state.records.branches.has(otherBranch)) {
+    const error = new Error(
+      'Incorrect usage of "merge". Branch to be merged (' + otherBranch + ") does not exist"
+    );
+    error.hash = {
+      text: `merge ${otherBranch}`,
+      token: `merge ${otherBranch}`,
+      expected: [`branch ${otherBranch}`]
+    };
+    throw error;
+  }
+  if (otherCommit === void 0 || !otherCommit) {
+    const error = new Error(
+      'Incorrect usage of "merge". Branch to be merged (' + otherBranch + ") has no commits"
+    );
+    error.hash = {
+      text: `merge ${otherBranch}`,
+      token: `merge ${otherBranch}`,
+      expected: ['"commit"']
+    };
+    throw error;
+  }
+  if (currentCommit === otherCommit) {
+    const error = new Error('Incorrect usage of "merge". Both branches have same head');
+    error.hash = {
+      text: `merge ${otherBranch}`,
+      token: `merge ${otherBranch}`,
+      expected: ["branch abc"]
+    };
+    throw error;
+  }
+  if (customId && state.records.commits.has(customId)) {
+    const error = new Error(
+      'Incorrect usage of "merge". Commit with id:' + customId + " already exists, use different custom Id"
+    );
+    error.hash = {
+      text: `merge ${otherBranch} ${customId} ${overrideType} ${customTags?.join(" ")}`,
+      token: `merge ${otherBranch} ${customId} ${overrideType} ${customTags?.join(" ")}`,
+      expected: [
+        `merge ${otherBranch} ${customId}_UNIQUE ${overrideType} ${customTags?.join(" ")}`
+      ]
+    };
+    throw error;
+  }
+  const verifiedBranch = otherBranchCheck ? otherBranchCheck : "";
+  const commit2 = {
+    id: customId || `${state.records.seq}-${getID()}`,
+    message: `merged branch ${otherBranch} into ${state.records.currBranch}`,
+    seq: state.records.seq++,
+    parents: state.records.head == null ? [] : [state.records.head.id, verifiedBranch],
+    branch: state.records.currBranch,
+    type: commitType.MERGE,
+    customType: overrideType,
+    customId: customId ? true : false,
+    tags: customTags ?? []
+  };
+  state.records.head = commit2;
+  state.records.commits.set(commit2.id, commit2);
+  state.records.branches.set(state.records.currBranch, commit2.id);
+  log.debug(state.records.branches);
+  log.debug("in mergeBranch");
+}, "merge");
+var cherryPick = /* @__PURE__ */ __name(function(cherryPickDB) {
+  let sourceId = cherryPickDB.id;
+  let targetId = cherryPickDB.targetId;
+  let tags = cherryPickDB.tags;
+  let parentCommitId = cherryPickDB.parent;
+  log.debug("Entering cherryPick:", sourceId, targetId, tags);
+  const config = getConfig3();
+  sourceId = common_default.sanitizeText(sourceId, config);
+  targetId = common_default.sanitizeText(targetId, config);
+  tags = tags?.map((tag) => common_default.sanitizeText(tag, config));
+  parentCommitId = common_default.sanitizeText(parentCommitId, config);
+  if (!sourceId || !state.records.commits.has(sourceId)) {
+    const error = new Error(
+      'Incorrect usage of "cherryPick". Source commit id should exist and provided'
+    );
+    error.hash = {
+      text: `cherryPick ${sourceId} ${targetId}`,
+      token: `cherryPick ${sourceId} ${targetId}`,
+      expected: ["cherry-pick abc"]
+    };
+    throw error;
+  }
+  const sourceCommit = state.records.commits.get(sourceId);
+  if (sourceCommit === void 0 || !sourceCommit) {
+    throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');
+  }
+  if (parentCommitId && !(Array.isArray(sourceCommit.parents) && sourceCommit.parents.includes(parentCommitId))) {
+    const error = new Error(
+      "Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit."
+    );
+    throw error;
+  }
+  const sourceCommitBranch = sourceCommit.branch;
+  if (sourceCommit.type === commitType.MERGE && !parentCommitId) {
+    const error = new Error(
+      "Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified."
+    );
+    throw error;
+  }
+  if (!targetId || !state.records.commits.has(targetId)) {
+    if (sourceCommitBranch === state.records.currBranch) {
+      const error = new Error(
+        'Incorrect usage of "cherryPick". Source commit is already on current branch'
+      );
+      error.hash = {
+        text: `cherryPick ${sourceId} ${targetId}`,
+        token: `cherryPick ${sourceId} ${targetId}`,
+        expected: ["cherry-pick abc"]
+      };
+      throw error;
+    }
+    const currentCommitId = state.records.branches.get(state.records.currBranch);
+    if (currentCommitId === void 0 || !currentCommitId) {
+      const error = new Error(
+        `Incorrect usage of "cherry-pick". Current branch (${state.records.currBranch})has no commits`
+      );
+      error.hash = {
+        text: `cherryPick ${sourceId} ${targetId}`,
+        token: `cherryPick ${sourceId} ${targetId}`,
+        expected: ["cherry-pick abc"]
+      };
+      throw error;
+    }
+    const currentCommit = state.records.commits.get(currentCommitId);
+    if (currentCommit === void 0 || !currentCommit) {
+      const error = new Error(
+        `Incorrect usage of "cherry-pick". Current branch (${state.records.currBranch})has no commits`
+      );
+      error.hash = {
+        text: `cherryPick ${sourceId} ${targetId}`,
+        token: `cherryPick ${sourceId} ${targetId}`,
+        expected: ["cherry-pick abc"]
+      };
+      throw error;
+    }
+    const commit2 = {
+      id: state.records.seq + "-" + getID(),
+      message: `cherry-picked ${sourceCommit?.message} into ${state.records.currBranch}`,
+      seq: state.records.seq++,
+      parents: state.records.head == null ? [] : [state.records.head.id, sourceCommit.id],
+      branch: state.records.currBranch,
+      type: commitType.CHERRY_PICK,
+      tags: tags ? tags.filter(Boolean) : [
+        `cherry-pick:${sourceCommit.id}${sourceCommit.type === commitType.MERGE ? `|parent:${parentCommitId}` : ""}`
+      ]
+    };
+    state.records.head = commit2;
+    state.records.commits.set(commit2.id, commit2);
+    state.records.branches.set(state.records.currBranch, commit2.id);
+    log.debug(state.records.branches);
+    log.debug("in cherryPick");
+  }
+}, "cherryPick");
+var checkout = /* @__PURE__ */ __name(function(branch2) {
+  branch2 = common_default.sanitizeText(branch2, getConfig3());
+  if (!state.records.branches.has(branch2)) {
+    const error = new Error(
+      `Trying to checkout branch which is not yet created. (Help try using "branch ${branch2}")`
+    );
+    error.hash = {
+      text: `checkout ${branch2}`,
+      token: `checkout ${branch2}`,
+      expected: [`branch ${branch2}`]
+    };
+    throw error;
+  } else {
+    state.records.currBranch = branch2;
+    const id = state.records.branches.get(state.records.currBranch);
+    if (id === void 0 || !id) {
+      state.records.head = null;
+    } else {
+      state.records.head = state.records.commits.get(id) ?? null;
+    }
+  }
+}, "checkout");
+function upsert(arr, key, newVal) {
+  const index = arr.indexOf(key);
+  if (index === -1) {
+    arr.push(newVal);
+  } else {
+    arr.splice(index, 1, newVal);
+  }
+}
+__name(upsert, "upsert");
+function prettyPrintCommitHistory(commitArr) {
+  const commit2 = commitArr.reduce((out, commit3) => {
+    if (out.seq > commit3.seq) {
+      return out;
+    }
+    return commit3;
+  }, commitArr[0]);
+  let line = "";
+  commitArr.forEach(function(c) {
+    if (c === commit2) {
+      line += "	*";
+    } else {
+      line += "	|";
+    }
+  });
+  const label = [line, commit2.id, commit2.seq];
+  for (const branch2 in state.records.branches) {
+    if (state.records.branches.get(branch2) === commit2.id) {
+      label.push(branch2);
+    }
+  }
+  log.debug(label.join(" "));
+  if (commit2.parents && commit2.parents.length == 2 && commit2.parents[0] && commit2.parents[1]) {
+    const newCommit = state.records.commits.get(commit2.parents[0]);
+    upsert(commitArr, commit2, newCommit);
+    if (commit2.parents[1]) {
+      commitArr.push(state.records.commits.get(commit2.parents[1]));
+    }
+  } else if (commit2.parents.length == 0) {
+    return;
+  } else {
+    if (commit2.parents[0]) {
+      const newCommit = state.records.commits.get(commit2.parents[0]);
+      upsert(commitArr, commit2, newCommit);
+    }
+  }
+  commitArr = uniqBy(commitArr, (c) => c.id);
+  prettyPrintCommitHistory(commitArr);
+}
+__name(prettyPrintCommitHistory, "prettyPrintCommitHistory");
+var prettyPrint = /* @__PURE__ */ __name(function() {
+  log.debug(state.records.commits);
+  const node = getCommitsArray()[0];
+  prettyPrintCommitHistory([node]);
+}, "prettyPrint");
+var clear2 = /* @__PURE__ */ __name(function() {
+  state.reset();
+  clear();
+}, "clear");
+var getBranchesAsObjArray = /* @__PURE__ */ __name(function() {
+  const branchesArray = [...state.records.branchConfig.values()].map((branchConfig, i) => {
+    if (branchConfig.order !== null && branchConfig.order !== void 0) {
+      return branchConfig;
+    }
+    return {
+      ...branchConfig,
+      order: parseFloat(`0.${i}`)
+    };
+  }).sort((a, b) => (a.order ?? 0) - (b.order ?? 0)).map(({ name }) => ({ name }));
+  return branchesArray;
+}, "getBranchesAsObjArray");
+var getBranches = /* @__PURE__ */ __name(function() {
+  return state.records.branches;
+}, "getBranches");
+var getCommits = /* @__PURE__ */ __name(function() {
+  return state.records.commits;
+}, "getCommits");
+var getCommitsArray = /* @__PURE__ */ __name(function() {
+  const commitArr = [...state.records.commits.values()];
+  commitArr.forEach(function(o) {
+    log.debug(o.id);
+  });
+  commitArr.sort((a, b) => a.seq - b.seq);
+  return commitArr;
+}, "getCommitsArray");
+var getCurrentBranch = /* @__PURE__ */ __name(function() {
+  return state.records.currBranch;
+}, "getCurrentBranch");
+var getDirection = /* @__PURE__ */ __name(function() {
+  return state.records.direction;
+}, "getDirection");
+var getHead = /* @__PURE__ */ __name(function() {
+  return state.records.head;
+}, "getHead");
+var db = {
+  commitType,
+  getConfig: getConfig3,
+  setDirection,
+  setOptions,
+  getOptions,
+  commit,
+  branch,
+  merge,
+  cherryPick,
+  checkout,
+  //reset,
+  prettyPrint,
+  clear: clear2,
+  getBranchesAsObjArray,
+  getBranches,
+  getCommits,
+  getCommitsArray,
+  getCurrentBranch,
+  getDirection,
+  getHead,
+  setAccTitle,
+  getAccTitle,
+  getAccDescription,
+  setAccDescription,
+  setDiagramTitle,
+  getDiagramTitle
+};
+
+// src/diagrams/git/gitGraphParser.ts
+var populate = /* @__PURE__ */ __name((ast, db2) => {
+  populateCommonDb(ast, db2);
+  if (ast.dir) {
+    db2.setDirection(ast.dir);
+  }
+  for (const statement of ast.statements) {
+    parseStatement(statement, db2);
+  }
+}, "populate");
+var parseStatement = /* @__PURE__ */ __name((statement, db2) => {
+  const parsers = {
+    Commit: /* @__PURE__ */ __name((stmt) => db2.commit(parseCommit(stmt)), "Commit"),
+    Branch: /* @__PURE__ */ __name((stmt) => db2.branch(parseBranch(stmt)), "Branch"),
+    Merge: /* @__PURE__ */ __name((stmt) => db2.merge(parseMerge(stmt)), "Merge"),
+    Checkout: /* @__PURE__ */ __name((stmt) => db2.checkout(parseCheckout(stmt)), "Checkout"),
+    CherryPicking: /* @__PURE__ */ __name((stmt) => db2.cherryPick(parseCherryPicking(stmt)), "CherryPicking")
+  };
+  const parser2 = parsers[statement.$type];
+  if (parser2) {
+    parser2(statement);
+  } else {
+    log.error(`Unknown statement type: ${statement.$type}`);
+  }
+}, "parseStatement");
+var parseCommit = /* @__PURE__ */ __name((commit2) => {
+  const commitDB = {
+    id: commit2.id,
+    msg: commit2.message ?? "",
+    type: commit2.type !== void 0 ? commitType[commit2.type] : commitType.NORMAL,
+    tags: commit2.tags ?? void 0
+  };
+  return commitDB;
+}, "parseCommit");
+var parseBranch = /* @__PURE__ */ __name((branch2) => {
+  const branchDB = {
+    name: branch2.name,
+    order: branch2.order ?? 0
+  };
+  return branchDB;
+}, "parseBranch");
+var parseMerge = /* @__PURE__ */ __name((merge2) => {
+  const mergeDB = {
+    branch: merge2.branch,
+    id: merge2.id ?? "",
+    type: merge2.type !== void 0 ? commitType[merge2.type] : void 0,
+    tags: merge2.tags ?? void 0
+  };
+  return mergeDB;
+}, "parseMerge");
+var parseCheckout = /* @__PURE__ */ __name((checkout2) => {
+  const branch2 = checkout2.branch;
+  return branch2;
+}, "parseCheckout");
+var parseCherryPicking = /* @__PURE__ */ __name((cherryPicking) => {
+  const cherryPickDB = {
+    id: cherryPicking.id,
+    targetId: "",
+    tags: cherryPicking.tags?.length === 0 ? void 0 : cherryPicking.tags,
+    parent: cherryPicking.parent
+  };
+  return cherryPickDB;
+}, "parseCherryPicking");
+var parser = {
+  parse: /* @__PURE__ */ __name(async (input) => {
+    const ast = await parse("gitGraph", input);
+    log.debug(ast);
+    populate(ast, db);
+  }, "parse")
+};
+if (void 0) {
+  const { it, expect, describe } = void 0;
+  const mockDB = {
+    commitType,
+    setDirection: vi.fn(),
+    commit: vi.fn(),
+    branch: vi.fn(),
+    merge: vi.fn(),
+    cherryPick: vi.fn(),
+    checkout: vi.fn()
+  };
+  describe("GitGraph Parser", () => {
+    it("should parse a commit statement", () => {
+      const commit2 = {
+        $type: "Commit",
+        id: "1",
+        message: "test",
+        tags: ["tag1", "tag2"],
+        type: "NORMAL"
+      };
+      parseStatement(commit2, mockDB);
+      expect(mockDB.commit).toHaveBeenCalledWith({
+        id: "1",
+        msg: "test",
+        tags: ["tag1", "tag2"],
+        type: 0
+      });
+    });
+    it("should parse a branch statement", () => {
+      const branch2 = {
+        $type: "Branch",
+        name: "newBranch",
+        order: 1
+      };
+      parseStatement(branch2, mockDB);
+      expect(mockDB.branch).toHaveBeenCalledWith({ name: "newBranch", order: 1 });
+    });
+    it("should parse a checkout statement", () => {
+      const checkout2 = {
+        $type: "Checkout",
+        branch: "newBranch"
+      };
+      parseStatement(checkout2, mockDB);
+      expect(mockDB.checkout).toHaveBeenCalledWith("newBranch");
+    });
+    it("should parse a merge statement", () => {
+      const merge2 = {
+        $type: "Merge",
+        branch: "newBranch",
+        id: "1",
+        tags: ["tag1", "tag2"],
+        type: "NORMAL"
+      };
+      parseStatement(merge2, mockDB);
+      expect(mockDB.merge).toHaveBeenCalledWith({
+        branch: "newBranch",
+        id: "1",
+        tags: ["tag1", "tag2"],
+        type: 0
+      });
+    });
+    it("should parse a cherry picking statement", () => {
+      const cherryPick2 = {
+        $type: "CherryPicking",
+        id: "1",
+        tags: ["tag1", "tag2"],
+        parent: "2"
+      };
+      parseStatement(cherryPick2, mockDB);
+      expect(mockDB.cherryPick).toHaveBeenCalledWith({
+        id: "1",
+        targetId: "",
+        parent: "2",
+        tags: ["tag1", "tag2"]
+      });
+    });
+    it("should parse a langium generated gitGraph ast", () => {
+      const dummy = {
+        $type: "GitGraph",
+        statements: []
+      };
+      const gitGraphAst = {
+        $type: "GitGraph",
+        statements: [
+          {
+            $container: dummy,
+            $type: "Commit",
+            id: "1",
+            message: "test",
+            tags: ["tag1", "tag2"],
+            type: "NORMAL"
+          },
+          {
+            $container: dummy,
+            $type: "Branch",
+            name: "newBranch",
+            order: 1
+          },
+          {
+            $container: dummy,
+            $type: "Merge",
+            branch: "newBranch",
+            id: "1",
+            tags: ["tag1", "tag2"],
+            type: "NORMAL"
+          },
+          {
+            $container: dummy,
+            $type: "Checkout",
+            branch: "newBranch"
+          },
+          {
+            $container: dummy,
+            $type: "CherryPicking",
+            id: "1",
+            tags: ["tag1", "tag2"],
+            parent: "2"
+          }
+        ]
+      };
+      populate(gitGraphAst, mockDB);
+      expect(mockDB.commit).toHaveBeenCalledWith({
+        id: "1",
+        msg: "test",
+        tags: ["tag1", "tag2"],
+        type: 0
+      });
+      expect(mockDB.branch).toHaveBeenCalledWith({ name: "newBranch", order: 1 });
+      expect(mockDB.merge).toHaveBeenCalledWith({
+        branch: "newBranch",
+        id: "1",
+        tags: ["tag1", "tag2"],
+        type: 0
+      });
+      expect(mockDB.checkout).toHaveBeenCalledWith("newBranch");
+    });
+  });
+}
+
+// src/diagrams/git/gitGraphRenderer.ts
+import { select } from "d3";
+var DEFAULT_CONFIG = getConfig2();
+var DEFAULT_GITGRAPH_CONFIG2 = DEFAULT_CONFIG?.gitGraph;
+var LAYOUT_OFFSET = 10;
+var COMMIT_STEP = 40;
+var PX = 4;
+var PY = 2;
+var THEME_COLOR_LIMIT = 8;
+var branchPos = /* @__PURE__ */ new Map();
+var commitPos = /* @__PURE__ */ new Map();
+var defaultPos = 30;
+var allCommitsDict = /* @__PURE__ */ new Map();
+var lanes = [];
+var maxPos = 0;
+var dir = "LR";
+var clear3 = /* @__PURE__ */ __name(() => {
+  branchPos.clear();
+  commitPos.clear();
+  allCommitsDict.clear();
+  maxPos = 0;
+  lanes = [];
+  dir = "LR";
+}, "clear");
+var drawText = /* @__PURE__ */ __name((txt) => {
+  const svgLabel = document.createElementNS("http://www.w3.org/2000/svg", "text");
+  const rows = typeof txt === "string" ? txt.split(/\\n|\n|<br\s*\/?>/gi) : txt;
+  rows.forEach((row) => {
+    const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
+    tspan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
+    tspan.setAttribute("dy", "1em");
+    tspan.setAttribute("x", "0");
+    tspan.setAttribute("class", "row");
+    tspan.textContent = row.trim();
+    svgLabel.appendChild(tspan);
+  });
+  return svgLabel;
+}, "drawText");
+var findClosestParent = /* @__PURE__ */ __name((parents) => {
+  let closestParent;
+  let comparisonFunc;
+  let targetPosition;
+  if (dir === "BT") {
+    comparisonFunc = /* @__PURE__ */ __name((a, b) => a <= b, "comparisonFunc");
+    targetPosition = Infinity;
+  } else {
+    comparisonFunc = /* @__PURE__ */ __name((a, b) => a >= b, "comparisonFunc");
+    targetPosition = 0;
+  }
+  parents.forEach((parent) => {
+    const parentPosition = dir === "TB" || dir == "BT" ? commitPos.get(parent)?.y : commitPos.get(parent)?.x;
+    if (parentPosition !== void 0 && comparisonFunc(parentPosition, targetPosition)) {
+      closestParent = parent;
+      targetPosition = parentPosition;
+    }
+  });
+  return closestParent;
+}, "findClosestParent");
+var findClosestParentBT = /* @__PURE__ */ __name((parents) => {
+  let closestParent = "";
+  let maxPosition = Infinity;
+  parents.forEach((parent) => {
+    const parentPosition = commitPos.get(parent).y;
+    if (parentPosition <= maxPosition) {
+      closestParent = parent;
+      maxPosition = parentPosition;
+    }
+  });
+  return closestParent || void 0;
+}, "findClosestParentBT");
+var setParallelBTPos = /* @__PURE__ */ __name((sortedKeys, commits, defaultPos2) => {
+  let curPos = defaultPos2;
+  let maxPosition = defaultPos2;
+  const roots = [];
+  sortedKeys.forEach((key) => {
+    const commit2 = commits.get(key);
+    if (!commit2) {
+      throw new Error(`Commit not found for key ${key}`);
+    }
+    if (commit2.parents.length) {
+      curPos = calculateCommitPosition(commit2);
+      maxPosition = Math.max(curPos, maxPosition);
+    } else {
+      roots.push(commit2);
+    }
+    setCommitPosition(commit2, curPos);
+  });
+  curPos = maxPosition;
+  roots.forEach((commit2) => {
+    setRootPosition(commit2, curPos, defaultPos2);
+  });
+  sortedKeys.forEach((key) => {
+    const commit2 = commits.get(key);
+    if (commit2?.parents.length) {
+      const closestParent = findClosestParentBT(commit2.parents);
+      curPos = commitPos.get(closestParent).y - COMMIT_STEP;
+      if (curPos <= maxPosition) {
+        maxPosition = curPos;
+      }
+      const x = branchPos.get(commit2.branch).pos;
+      const y = curPos - LAYOUT_OFFSET;
+      commitPos.set(commit2.id, { x, y });
+    }
+  });
+}, "setParallelBTPos");
+var findClosestParentPos = /* @__PURE__ */ __name((commit2) => {
+  const closestParent = findClosestParent(commit2.parents.filter((p) => p !== null));
+  if (!closestParent) {
+    throw new Error(`Closest parent not found for commit ${commit2.id}`);
+  }
+  const closestParentPos = commitPos.get(closestParent)?.y;
+  if (closestParentPos === void 0) {
+    throw new Error(`Closest parent position not found for commit ${commit2.id}`);
+  }
+  return closestParentPos;
+}, "findClosestParentPos");
+var calculateCommitPosition = /* @__PURE__ */ __name((commit2) => {
+  const closestParentPos = findClosestParentPos(commit2);
+  return closestParentPos + COMMIT_STEP;
+}, "calculateCommitPosition");
+var setCommitPosition = /* @__PURE__ */ __name((commit2, curPos) => {
+  const branch2 = branchPos.get(commit2.branch);
+  if (!branch2) {
+    throw new Error(`Branch not found for commit ${commit2.id}`);
+  }
+  const x = branch2.pos;
+  const y = curPos + LAYOUT_OFFSET;
+  commitPos.set(commit2.id, { x, y });
+  return { x, y };
+}, "setCommitPosition");
+var setRootPosition = /* @__PURE__ */ __name((commit2, curPos, defaultPos2) => {
+  const branch2 = branchPos.get(commit2.branch);
+  if (!branch2) {
+    throw new Error(`Branch not found for commit ${commit2.id}`);
+  }
+  const y = curPos + defaultPos2;
+  const x = branch2.pos;
+  commitPos.set(commit2.id, { x, y });
+}, "setRootPosition");
+var drawCommitBullet = /* @__PURE__ */ __name((gBullets, commit2, commitPosition, typeClass, branchIndex, commitSymbolType) => {
+  if (commitSymbolType === commitType.HIGHLIGHT) {
+    gBullets.append("rect").attr("x", commitPosition.x - 10).attr("y", commitPosition.y - 10).attr("width", 20).attr("height", 20).attr(
+      "class",
+      `commit ${commit2.id} commit-highlight${branchIndex % THEME_COLOR_LIMIT} ${typeClass}-outer`
+    );
+    gBullets.append("rect").attr("x", commitPosition.x - 6).attr("y", commitPosition.y - 6).attr("width", 12).attr("height", 12).attr(
+      "class",
+      `commit ${commit2.id} commit${branchIndex % THEME_COLOR_LIMIT} ${typeClass}-inner`
+    );
+  } else if (commitSymbolType === commitType.CHERRY_PICK) {
+    gBullets.append("circle").attr("cx", commitPosition.x).attr("cy", commitPosition.y).attr("r", 10).attr("class", `commit ${commit2.id} ${typeClass}`);
+    gBullets.append("circle").attr("cx", commitPosition.x - 3).attr("cy", commitPosition.y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${commit2.id} ${typeClass}`);
+    gBullets.append("circle").attr("cx", commitPosition.x + 3).attr("cy", commitPosition.y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${commit2.id} ${typeClass}`);
+    gBullets.append("line").attr("x1", commitPosition.x + 3).attr("y1", commitPosition.y + 1).attr("x2", commitPosition.x).attr("y2", commitPosition.y - 5).attr("stroke", "#fff").attr("class", `commit ${commit2.id} ${typeClass}`);
+    gBullets.append("line").attr("x1", commitPosition.x - 3).attr("y1", commitPosition.y + 1).attr("x2", commitPosition.x).attr("y2", commitPosition.y - 5).attr("stroke", "#fff").attr("class", `commit ${commit2.id} ${typeClass}`);
+  } else {
+    const circle = gBullets.append("circle");
+    circle.attr("cx", commitPosition.x);
+    circle.attr("cy", commitPosition.y);
+    circle.attr("r", commit2.type === commitType.MERGE ? 9 : 10);
+    circle.attr("class", `commit ${commit2.id} commit${branchIndex % THEME_COLOR_LIMIT}`);
+    if (commitSymbolType === commitType.MERGE) {
+      const circle2 = gBullets.append("circle");
+      circle2.attr("cx", commitPosition.x);
+      circle2.attr("cy", commitPosition.y);
+      circle2.attr("r", 6);
+      circle2.attr(
+        "class",
+        `commit ${typeClass} ${commit2.id} commit${branchIndex % THEME_COLOR_LIMIT}`
+      );
+    }
+    if (commitSymbolType === commitType.REVERSE) {
+      const cross = gBullets.append("path");
+      cross.attr(
+        "d",
+        `M ${commitPosition.x - 5},${commitPosition.y - 5}L${commitPosition.x + 5},${commitPosition.y + 5}M${commitPosition.x - 5},${commitPosition.y + 5}L${commitPosition.x + 5},${commitPosition.y - 5}`
+      ).attr("class", `commit ${typeClass} ${commit2.id} commit${branchIndex % THEME_COLOR_LIMIT}`);
+    }
+  }
+}, "drawCommitBullet");
+var drawCommitLabel = /* @__PURE__ */ __name((gLabels, commit2, commitPosition, pos) => {
+  if (commit2.type !== commitType.CHERRY_PICK && (commit2.customId && commit2.type === commitType.MERGE || commit2.type !== commitType.MERGE) && DEFAULT_GITGRAPH_CONFIG2?.showCommitLabel) {
+    const wrapper = gLabels.append("g");
+    const labelBkg = wrapper.insert("rect").attr("class", "commit-label-bkg");
+    const text = wrapper.append("text").attr("x", pos).attr("y", commitPosition.y + 25).attr("class", "commit-label").text(commit2.id);
+    const bbox = text.node()?.getBBox();
+    if (bbox) {
+      labelBkg.attr("x", commitPosition.posWithOffset - bbox.width / 2 - PY).attr("y", commitPosition.y + 13.5).attr("width", bbox.width + 2 * PY).attr("height", bbox.height + 2 * PY);
+      if (dir === "TB" || dir === "BT") {
+        labelBkg.attr("x", commitPosition.x - (bbox.width + 4 * PX + 5)).attr("y", commitPosition.y - 12);
+        text.attr("x", commitPosition.x - (bbox.width + 4 * PX)).attr("y", commitPosition.y + bbox.height - 12);
+      } else {
+        text.attr("x", commitPosition.posWithOffset - bbox.width / 2);
+      }
+      if (DEFAULT_GITGRAPH_CONFIG2.rotateCommitLabel) {
+        if (dir === "TB" || dir === "BT") {
+          text.attr(
+            "transform",
+            "rotate(-45, " + commitPosition.x + ", " + commitPosition.y + ")"
+          );
+          labelBkg.attr(
+            "transform",
+            "rotate(-45, " + commitPosition.x + ", " + commitPosition.y + ")"
+          );
+        } else {
+          const r_x = -7.5 - (bbox.width + 10) / 25 * 9.5;
+          const r_y = 10 + bbox.width / 25 * 8.5;
+          wrapper.attr(
+            "transform",
+            "translate(" + r_x + ", " + r_y + ") rotate(-45, " + pos + ", " + commitPosition.y + ")"
+          );
+        }
+      }
+    }
+  }
+}, "drawCommitLabel");
+var drawCommitTags = /* @__PURE__ */ __name((gLabels, commit2, commitPosition, pos) => {
+  if (commit2.tags.length > 0) {
+    let yOffset = 0;
+    let maxTagBboxWidth = 0;
+    let maxTagBboxHeight = 0;
+    const tagElements = [];
+    for (const tagValue of commit2.tags.reverse()) {
+      const rect = gLabels.insert("polygon");
+      const hole = gLabels.append("circle");
+      const tag = gLabels.append("text").attr("y", commitPosition.y - 16 - yOffset).attr("class", "tag-label").text(tagValue);
+      const tagBbox = tag.node()?.getBBox();
+      if (!tagBbox) {
+        throw new Error("Tag bbox not found");
+      }
+      maxTagBboxWidth = Math.max(maxTagBboxWidth, tagBbox.width);
+      maxTagBboxHeight = Math.max(maxTagBboxHeight, tagBbox.height);
+      tag.attr("x", commitPosition.posWithOffset - tagBbox.width / 2);
+      tagElements.push({
+        tag,
+        hole,
+        rect,
+        yOffset
+      });
+      yOffset += 20;
+    }
+    for (const { tag, hole, rect, yOffset: yOffset2 } of tagElements) {
+      const h2 = maxTagBboxHeight / 2;
+      const ly = commitPosition.y - 19.2 - yOffset2;
+      rect.attr("class", "tag-label-bkg").attr(
+        "points",
+        `
+      ${pos - maxTagBboxWidth / 2 - PX / 2},${ly + PY}  
+      ${pos - maxTagBboxWidth / 2 - PX / 2},${ly - PY}
+      ${commitPosition.posWithOffset - maxTagBboxWidth / 2 - PX},${ly - h2 - PY}
+      ${commitPosition.posWithOffset + maxTagBboxWidth / 2 + PX},${ly - h2 - PY}
+      ${commitPosition.posWithOffset + maxTagBboxWidth / 2 + PX},${ly + h2 + PY}
+      ${commitPosition.posWithOffset - maxTagBboxWidth / 2 - PX},${ly + h2 + PY}`
+      );
+      hole.attr("cy", ly).attr("cx", pos - maxTagBboxWidth / 2 + PX / 2).attr("r", 1.5).attr("class", "tag-hole");
+      if (dir === "TB" || dir === "BT") {
+        const yOrigin = pos + yOffset2;
+        rect.attr("class", "tag-label-bkg").attr(
+          "points",
+          `
+        ${commitPosition.x},${yOrigin + 2}
+        ${commitPosition.x},${yOrigin - 2}
+        ${commitPosition.x + LAYOUT_OFFSET},${yOrigin - h2 - 2}
+        ${commitPosition.x + LAYOUT_OFFSET + maxTagBboxWidth + 4},${yOrigin - h2 - 2}
+        ${commitPosition.x + LAYOUT_OFFSET + maxTagBboxWidth + 4},${yOrigin + h2 + 2}
+        ${commitPosition.x + LAYOUT_OFFSET},${yOrigin + h2 + 2}`
+        ).attr("transform", "translate(12,12) rotate(45, " + commitPosition.x + "," + pos + ")");
+        hole.attr("cx", commitPosition.x + PX / 2).attr("cy", yOrigin).attr("transform", "translate(12,12) rotate(45, " + commitPosition.x + "," + pos + ")");
+        tag.attr("x", commitPosition.x + 5).attr("y", yOrigin + 3).attr("transform", "translate(14,14) rotate(45, " + commitPosition.x + "," + pos + ")");
+      }
+    }
+  }
+}, "drawCommitTags");
+var getCommitClassType = /* @__PURE__ */ __name((commit2) => {
+  const commitSymbolType = commit2.customType ?? commit2.type;
+  switch (commitSymbolType) {
+    case commitType.NORMAL:
+      return "commit-normal";
+    case commitType.REVERSE:
+      return "commit-reverse";
+    case commitType.HIGHLIGHT:
+      return "commit-highlight";
+    case commitType.MERGE:
+      return "commit-merge";
+    case commitType.CHERRY_PICK:
+      return "commit-cherry-pick";
+    default:
+      return "commit-normal";
+  }
+}, "getCommitClassType");
+var calculatePosition = /* @__PURE__ */ __name((commit2, dir2, pos, commitPos2) => {
+  const defaultCommitPosition = { x: 0, y: 0 };
+  if (commit2.parents.length > 0) {
+    const closestParent = findClosestParent(commit2.parents);
+    if (closestParent) {
+      const parentPosition = commitPos2.get(closestParent) ?? defaultCommitPosition;
+      if (dir2 === "TB") {
+        return parentPosition.y + COMMIT_STEP;
+      } else if (dir2 === "BT") {
+        const currentPosition = commitPos2.get(commit2.id) ?? defaultCommitPosition;
+        return currentPosition.y - COMMIT_STEP;
+      } else {
+        return parentPosition.x + COMMIT_STEP;
+      }
+    }
+  } else {
+    if (dir2 === "TB") {
+      return defaultPos;
+    } else if (dir2 === "BT") {
+      const currentPosition = commitPos2.get(commit2.id) ?? defaultCommitPosition;
+      return currentPosition.y - COMMIT_STEP;
+    } else {
+      return 0;
+    }
+  }
+  return 0;
+}, "calculatePosition");
+var getCommitPosition = /* @__PURE__ */ __name((commit2, pos, isParallelCommits) => {
+  const posWithOffset = dir === "BT" && isParallelCommits ? pos : pos + LAYOUT_OFFSET;
+  const y = dir === "TB" || dir === "BT" ? posWithOffset : branchPos.get(commit2.branch)?.pos;
+  const x = dir === "TB" || dir === "BT" ? branchPos.get(commit2.branch)?.pos : posWithOffset;
+  if (x === void 0 || y === void 0) {
+    throw new Error(`Position were undefined for commit ${commit2.id}`);
+  }
+  return { x, y, posWithOffset };
+}, "getCommitPosition");
+var drawCommits = /* @__PURE__ */ __name((svg, commits, modifyGraph) => {
+  if (!DEFAULT_GITGRAPH_CONFIG2) {
+    throw new Error("GitGraph config not found");
+  }
+  const gBullets = svg.append("g").attr("class", "commit-bullets");
+  const gLabels = svg.append("g").attr("class", "commit-labels");
+  let pos = dir === "TB" || dir === "BT" ? defaultPos : 0;
+  const keys = [...commits.keys()];
+  const isParallelCommits = DEFAULT_GITGRAPH_CONFIG2?.parallelCommits ?? false;
+  const sortKeys = /* @__PURE__ */ __name((a, b) => {
+    const seqA = commits.get(a)?.seq;
+    const seqB = commits.get(b)?.seq;
+    return seqA !== void 0 && seqB !== void 0 ? seqA - seqB : 0;
+  }, "sortKeys");
+  let sortedKeys = keys.sort(sortKeys);
+  if (dir === "BT") {
+    if (isParallelCommits) {
+      setParallelBTPos(sortedKeys, commits, pos);
+    }
+    sortedKeys = sortedKeys.reverse();
+  }
+  sortedKeys.forEach((key) => {
+    const commit2 = commits.get(key);
+    if (!commit2) {
+      throw new Error(`Commit not found for key ${key}`);
+    }
+    if (isParallelCommits) {
+      pos = calculatePosition(commit2, dir, pos, commitPos);
+    }
+    const commitPosition = getCommitPosition(commit2, pos, isParallelCommits);
+    if (modifyGraph) {
+      const typeClass = getCommitClassType(commit2);
+      const commitSymbolType = commit2.customType ?? commit2.type;
+      const branchIndex = branchPos.get(commit2.branch)?.index ?? 0;
+      drawCommitBullet(gBullets, commit2, commitPosition, typeClass, branchIndex, commitSymbolType);
+      drawCommitLabel(gLabels, commit2, commitPosition, pos);
+      drawCommitTags(gLabels, commit2, commitPosition, pos);
+    }
+    if (dir === "TB" || dir === "BT") {
+      commitPos.set(commit2.id, { x: commitPosition.x, y: commitPosition.posWithOffset });
+    } else {
+      commitPos.set(commit2.id, { x: commitPosition.posWithOffset, y: commitPosition.y });
+    }
+    pos = dir === "BT" && isParallelCommits ? pos + COMMIT_STEP : pos + COMMIT_STEP + LAYOUT_OFFSET;
+    if (pos > maxPos) {
+      maxPos = pos;
+    }
+  });
+}, "drawCommits");
+var shouldRerouteArrow = /* @__PURE__ */ __name((commitA, commitB, p1, p2, allCommits) => {
+  const commitBIsFurthest = dir === "TB" || dir === "BT" ? p1.x < p2.x : p1.y < p2.y;
+  const branchToGetCurve = commitBIsFurthest ? commitB.branch : commitA.branch;
+  const isOnBranchToGetCurve = /* @__PURE__ */ __name((x) => x.branch === branchToGetCurve, "isOnBranchToGetCurve");
+  const isBetweenCommits = /* @__PURE__ */ __name((x) => x.seq > commitA.seq && x.seq < commitB.seq, "isBetweenCommits");
+  return [...allCommits.values()].some((commitX) => {
+    return isBetweenCommits(commitX) && isOnBranchToGetCurve(commitX);
+  });
+}, "shouldRerouteArrow");
+var findLane = /* @__PURE__ */ __name((y1, y2, depth = 0) => {
+  const candidate = y1 + Math.abs(y1 - y2) / 2;
+  if (depth > 5) {
+    return candidate;
+  }
+  const ok = lanes.every((lane) => Math.abs(lane - candidate) >= 10);
+  if (ok) {
+    lanes.push(candidate);
+    return candidate;
+  }
+  const diff = Math.abs(y1 - y2);
+  return findLane(y1, y2 - diff / 5, depth + 1);
+}, "findLane");
+var drawArrow = /* @__PURE__ */ __name((svg, commitA, commitB, allCommits) => {
+  const p1 = commitPos.get(commitA.id);
+  const p2 = commitPos.get(commitB.id);
+  if (p1 === void 0 || p2 === void 0) {
+    throw new Error(`Commit positions not found for commits ${commitA.id} and ${commitB.id}`);
+  }
+  const arrowNeedsRerouting = shouldRerouteArrow(commitA, commitB, p1, p2, allCommits);
+  let arc = "";
+  let arc2 = "";
+  let radius = 0;
+  let offset = 0;
+  let colorClassNum = branchPos.get(commitB.branch)?.index;
+  if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
+    colorClassNum = branchPos.get(commitA.branch)?.index;
+  }
+  let lineDef;
+  if (arrowNeedsRerouting) {
+    arc = "A 10 10, 0, 0, 0,";
+    arc2 = "A 10 10, 0, 0, 1,";
+    radius = 10;
+    offset = 10;
+    const lineY = p1.y < p2.y ? findLane(p1.y, p2.y) : findLane(p2.y, p1.y);
+    const lineX = p1.x < p2.x ? findLane(p1.x, p2.x) : findLane(p2.x, p1.x);
+    if (dir === "TB") {
+      if (p1.x < p2.x) {
+        lineDef = `M ${p1.x} ${p1.y} L ${lineX - radius} ${p1.y} ${arc2} ${lineX} ${p1.y + offset} L ${lineX} ${p2.y - radius} ${arc} ${lineX + offset} ${p2.y} L ${p2.x} ${p2.y}`;
+      } else {
+        colorClassNum = branchPos.get(commitA.branch)?.index;
+        lineDef = `M ${p1.x} ${p1.y} L ${lineX + radius} ${p1.y} ${arc} ${lineX} ${p1.y + offset} L ${lineX} ${p2.y - radius} ${arc2} ${lineX - offset} ${p2.y} L ${p2.x} ${p2.y}`;
+      }
+    } else if (dir === "BT") {
+      if (p1.x < p2.x) {
+        lineDef = `M ${p1.x} ${p1.y} L ${lineX - radius} ${p1.y} ${arc} ${lineX} ${p1.y - offset} L ${lineX} ${p2.y + radius} ${arc2} ${lineX + offset} ${p2.y} L ${p2.x} ${p2.y}`;
+      } else {
+        colorClassNum = branchPos.get(commitA.branch)?.index;
+        lineDef = `M ${p1.x} ${p1.y} L ${lineX + radius} ${p1.y} ${arc2} ${lineX} ${p1.y - offset} L ${lineX} ${p2.y + radius} ${arc} ${lineX - offset} ${p2.y} L ${p2.x} ${p2.y}`;
+      }
+    } else {
+      if (p1.y < p2.y) {
+        lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${lineY - radius} ${arc} ${p1.x + offset} ${lineY} L ${p2.x - radius} ${lineY} ${arc2} ${p2.x} ${lineY + offset} L ${p2.x} ${p2.y}`;
+      } else {
+        colorClassNum = branchPos.get(commitA.branch)?.index;
+        lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${lineY + radius} ${arc2} ${p1.x + offset} ${lineY} L ${p2.x - radius} ${lineY} ${arc} ${p2.x} ${lineY - offset} L ${p2.x} ${p2.y}`;
+      }
+    }
+  } else {
+    arc = "A 20 20, 0, 0, 0,";
+    arc2 = "A 20 20, 0, 0, 1,";
+    radius = 20;
+    offset = 20;
+    if (dir === "TB") {
+      if (p1.x < p2.x) {
+        if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
+          lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y - radius} ${arc} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;
+        } else {
+          lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc2} ${p2.x} ${p1.y + offset} L ${p2.x} ${p2.y}`;
+        }
+      }
+      if (p1.x > p2.x) {
+        arc = "A 20 20, 0, 0, 0,";
+        arc2 = "A 20 20, 0, 0, 1,";
+        radius = 20;
+        offset = 20;
+        if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
+          lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y - radius} ${arc2} ${p1.x - offset} ${p2.y} L ${p2.x} ${p2.y}`;
+        } else {
+          lineDef = `M ${p1.x} ${p1.y} L ${p2.x + radius} ${p1.y} ${arc} ${p2.x} ${p1.y + offset} L ${p2.x} ${p2.y}`;
+        }
+      }
+      if (p1.x === p2.x) {
+        lineDef = `M ${p1.x} ${p1.y} L ${p2.x} ${p2.y}`;
+      }
+    } else if (dir === "BT") {
+      if (p1.x < p2.x) {
+        if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
+          lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y + radius} ${arc2} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;
+        } else {
+          lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc} ${p2.x} ${p1.y - offset} L ${p2.x} ${p2.y}`;
+        }
+      }
+      if (p1.x > p2.x) {
+        arc = "A 20 20, 0, 0, 0,";
+        arc2 = "A 20 20, 0, 0, 1,";
+        radius = 20;
+        offset = 20;
+        if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
+          lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y + radius} ${arc} ${p1.x - offset} ${p2.y} L ${p2.x} ${p2.y}`;
+        } else {
+          lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc} ${p2.x} ${p1.y - offset} L ${p2.x} ${p2.y}`;
+        }
+      }
+      if (p1.x === p2.x) {
+        lineDef = `M ${p1.x} ${p1.y} L ${p2.x} ${p2.y}`;
+      }
+    } else {
+      if (p1.y < p2.y) {
+        if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
+          lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc2} ${p2.x} ${p1.y + offset} L ${p2.x} ${p2.y}`;
+        } else {
+          lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y - radius} ${arc} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;
+        }
+      }
+      if (p1.y > p2.y) {
+        if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
+          lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc} ${p2.x} ${p1.y - offset} L ${p2.x} ${p2.y}`;
+        } else {
+          lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y + radius} ${arc2} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;
+        }
+      }
+      if (p1.y === p2.y) {
+        lineDef = `M ${p1.x} ${p1.y} L ${p2.x} ${p2.y}`;
+      }
+    }
+  }
+  if (lineDef === void 0) {
+    throw new Error("Line definition not found");
+  }
+  svg.append("path").attr("d", lineDef).attr("class", "arrow arrow" + colorClassNum % THEME_COLOR_LIMIT);
+}, "drawArrow");
+var drawArrows = /* @__PURE__ */ __name((svg, commits) => {
+  const gArrows = svg.append("g").attr("class", "commit-arrows");
+  [...commits.keys()].forEach((key) => {
+    const commit2 = commits.get(key);
+    if (commit2.parents && commit2.parents.length > 0) {
+      commit2.parents.forEach((parent) => {
+        drawArrow(gArrows, commits.get(parent), commit2, commits);
+      });
+    }
+  });
+}, "drawArrows");
+var drawBranches = /* @__PURE__ */ __name((svg, branches) => {
+  const g = svg.append("g");
+  branches.forEach((branch2, index) => {
+    const adjustIndexForTheme = index % THEME_COLOR_LIMIT;
+    const pos = branchPos.get(branch2.name)?.pos;
+    if (pos === void 0) {
+      throw new Error(`Position not found for branch ${branch2.name}`);
+    }
+    const line = g.append("line");
+    line.attr("x1", 0);
+    line.attr("y1", pos);
+    line.attr("x2", maxPos);
+    line.attr("y2", pos);
+    line.attr("class", "branch branch" + adjustIndexForTheme);
+    if (dir === "TB") {
+      line.attr("y1", defaultPos);
+      line.attr("x1", pos);
+      line.attr("y2", maxPos);
+      line.attr("x2", pos);
+    } else if (dir === "BT") {
+      line.attr("y1", maxPos);
+      line.attr("x1", pos);
+      line.attr("y2", defaultPos);
+      line.attr("x2", pos);
+    }
+    lanes.push(pos);
+    const name = branch2.name;
+    const labelElement = drawText(name);
+    const bkg = g.insert("rect");
+    const branchLabel = g.insert("g").attr("class", "branchLabel");
+    const label = branchLabel.insert("g").attr("class", "label branch-label" + adjustIndexForTheme);
+    label.node().appendChild(labelElement);
+    const bbox = labelElement.getBBox();
+    bkg.attr("class", "branchLabelBkg label" + adjustIndexForTheme).attr("rx", 4).attr("ry", 4).attr("x", -bbox.width - 4 - (DEFAULT_GITGRAPH_CONFIG2?.rotateCommitLabel === true ? 30 : 0)).attr("y", -bbox.height / 2 + 8).attr("width", bbox.width + 18).attr("height", bbox.height + 4);
+    label.attr(
+      "transform",
+      "translate(" + (-bbox.width - 14 - (DEFAULT_GITGRAPH_CONFIG2?.rotateCommitLabel === true ? 30 : 0)) + ", " + (pos - bbox.height / 2 - 1) + ")"
+    );
+    if (dir === "TB") {
+      bkg.attr("x", pos - bbox.width / 2 - 10).attr("y", 0);
+      label.attr("transform", "translate(" + (pos - bbox.width / 2 - 5) + ", 0)");
+    } else if (dir === "BT") {
+      bkg.attr("x", pos - bbox.width / 2 - 10).attr("y", maxPos);
+      label.attr("transform", "translate(" + (pos - bbox.width / 2 - 5) + ", " + maxPos + ")");
+    } else {
+      bkg.attr("transform", "translate(-19, " + (pos - bbox.height / 2) + ")");
+    }
+  });
+}, "drawBranches");
+var setBranchPosition = /* @__PURE__ */ __name(function(name, pos, index, bbox, rotateCommitLabel) {
+  branchPos.set(name, { pos, index });
+  pos += 50 + (rotateCommitLabel ? 40 : 0) + (dir === "TB" || dir === "BT" ? bbox.width / 2 : 0);
+  return pos;
+}, "setBranchPosition");
+var draw = /* @__PURE__ */ __name(function(txt, id, ver, diagObj) {
+  clear3();
+  log.debug("in gitgraph renderer", txt + "\n", "id:", id, ver);
+  if (!DEFAULT_GITGRAPH_CONFIG2) {
+    throw new Error("GitGraph config not found");
+  }
+  const rotateCommitLabel = DEFAULT_GITGRAPH_CONFIG2.rotateCommitLabel ?? false;
+  const db2 = diagObj.db;
+  allCommitsDict = db2.getCommits();
+  const branches = db2.getBranchesAsObjArray();
+  dir = db2.getDirection();
+  const diagram2 = select(`[id="${id}"]`);
+  let pos = 0;
+  branches.forEach((branch2, index) => {
+    const labelElement = drawText(branch2.name);
+    const g = diagram2.append("g");
+    const branchLabel = g.insert("g").attr("class", "branchLabel");
+    const label = branchLabel.insert("g").attr("class", "label branch-label");
+    label.node()?.appendChild(labelElement);
+    const bbox = labelElement.getBBox();
+    pos = setBranchPosition(branch2.name, pos, index, bbox, rotateCommitLabel);
+    label.remove();
+    branchLabel.remove();
+    g.remove();
+  });
+  drawCommits(diagram2, allCommitsDict, false);
+  if (DEFAULT_GITGRAPH_CONFIG2.showBranches) {
+    drawBranches(diagram2, branches);
+  }
+  drawArrows(diagram2, allCommitsDict);
+  drawCommits(diagram2, allCommitsDict, true);
+  utils_default.insertTitle(
+    diagram2,
+    "gitTitleText",
+    DEFAULT_GITGRAPH_CONFIG2.titleTopMargin ?? 0,
+    db2.getDiagramTitle()
+  );
+  setupGraphViewbox(
+    void 0,
+    diagram2,
+    DEFAULT_GITGRAPH_CONFIG2.diagramPadding,
+    DEFAULT_GITGRAPH_CONFIG2.useMaxWidth
+  );
+}, "draw");
+var gitGraphRenderer_default = {
+  draw
+};
+if (void 0) {
+  const { it, expect, describe } = void 0;
+  describe("drawText", () => {
+    it("should drawText", () => {
+      const svgLabel = drawText("main");
+      expect(svgLabel).toBeDefined();
+      expect(svgLabel.children[0].innerHTML).toBe("main");
+    });
+  });
+  describe("branchPosition", () => {
+    const bbox = {
+      x: 0,
+      y: 0,
+      width: 10,
+      height: 10,
+      top: 0,
+      right: 0,
+      bottom: 0,
+      left: 0,
+      toJSON: /* @__PURE__ */ __name(() => "", "toJSON")
+    };
+    it("should setBranchPositions LR with two branches", () => {
+      dir = "LR";
+      const pos = setBranchPosition("main", 0, 0, bbox, true);
+      expect(pos).toBe(90);
+      expect(branchPos.get("main")).toEqual({ pos: 0, index: 0 });
+      const posNext = setBranchPosition("develop", pos, 1, bbox, true);
+      expect(posNext).toBe(180);
+      expect(branchPos.get("develop")).toEqual({ pos, index: 1 });
+    });
+    it("should setBranchPositions TB with two branches", () => {
+      dir = "TB";
+      bbox.width = 34.9921875;
+      const pos = setBranchPosition("main", 0, 0, bbox, true);
+      expect(pos).toBe(107.49609375);
+      expect(branchPos.get("main")).toEqual({ pos: 0, index: 0 });
+      bbox.width = 56.421875;
+      const posNext = setBranchPosition("develop", pos, 1, bbox, true);
+      expect(posNext).toBe(225.70703125);
+      expect(branchPos.get("develop")).toEqual({ pos, index: 1 });
+    });
+  });
+  describe("commitPosition", () => {
+    const commits = /* @__PURE__ */ new Map([
+      [
+        "commitZero",
+        {
+          id: "ZERO",
+          message: "",
+          seq: 0,
+          type: commitType.NORMAL,
+          tags: [],
+          parents: [],
+          branch: "main"
+        }
+      ],
+      [
+        "commitA",
+        {
+          id: "A",
+          message: "",
+          seq: 1,
+          type: commitType.NORMAL,
+          tags: [],
+          parents: ["ZERO"],
+          branch: "feature"
+        }
+      ],
+      [
+        "commitB",
+        {
+          id: "B",
+          message: "",
+          seq: 2,
+          type: commitType.NORMAL,
+          tags: [],
+          parents: ["A"],
+          branch: "feature"
+        }
+      ],
+      [
+        "commitM",
+        {
+          id: "M",
+          message: "merged branch feature into main",
+          seq: 3,
+          type: commitType.MERGE,
+          tags: [],
+          parents: ["ZERO", "B"],
+          branch: "main",
+          customId: true
+        }
+      ],
+      [
+        "commitC",
+        {
+          id: "C",
+          message: "",
+          seq: 4,
+          type: commitType.NORMAL,
+          tags: [],
+          parents: ["ZERO"],
+          branch: "release"
+        }
+      ],
+      [
+        "commit5_8928ea0",
+        {
+          id: "5-8928ea0",
+          message: "cherry-picked [object Object] into release",
+          seq: 5,
+          type: commitType.CHERRY_PICK,
+          tags: [],
+          parents: ["C", "M"],
+          branch: "release"
+        }
+      ],
+      [
+        "commitD",
+        {
+          id: "D",
+          message: "",
+          seq: 6,
+          type: commitType.NORMAL,
+          tags: [],
+          parents: ["5-8928ea0"],
+          branch: "release"
+        }
+      ],
+      [
+        "commit7_ed848ba",
+        {
+          id: "7-ed848ba",
+          message: "cherry-picked [object Object] into release",
+          seq: 7,
+          type: commitType.CHERRY_PICK,
+          tags: [],
+          parents: ["D", "M"],
+          branch: "release"
+        }
+      ]
+    ]);
+    let pos = 0;
+    branchPos.set("main", { pos: 0, index: 0 });
+    branchPos.set("feature", { pos: 107.49609375, index: 1 });
+    branchPos.set("release", { pos: 224.03515625, index: 2 });
+    describe("TB", () => {
+      pos = 30;
+      dir = "TB";
+      const expectedCommitPositionTB = /* @__PURE__ */ new Map([
+        ["commitZero", { x: 0, y: 40, posWithOffset: 40 }],
+        ["commitA", { x: 107.49609375, y: 90, posWithOffset: 90 }],
+        ["commitB", { x: 107.49609375, y: 140, posWithOffset: 140 }],
+        ["commitM", { x: 0, y: 190, posWithOffset: 190 }],
+        ["commitC", { x: 224.03515625, y: 240, posWithOffset: 240 }],
+        ["commit5_8928ea0", { x: 224.03515625, y: 290, posWithOffset: 290 }],
+        ["commitD", { x: 224.03515625, y: 340, posWithOffset: 340 }],
+        ["commit7_ed848ba", { x: 224.03515625, y: 390, posWithOffset: 390 }]
+      ]);
+      commits.forEach((commit2, key) => {
+        it(`should give the correct position for commit ${key}`, () => {
+          const position = getCommitPosition(commit2, pos, false);
+          expect(position).toEqual(expectedCommitPositionTB.get(key));
+          pos += 50;
+        });
+      });
+    });
+    describe("LR", () => {
+      let pos2 = 30;
+      dir = "LR";
+      const expectedCommitPositionLR = /* @__PURE__ */ new Map([
+        ["commitZero", { x: 0, y: 40, posWithOffset: 40 }],
+        ["commitA", { x: 107.49609375, y: 90, posWithOffset: 90 }],
+        ["commitB", { x: 107.49609375, y: 140, posWithOffset: 140 }],
+        ["commitM", { x: 0, y: 190, posWithOffset: 190 }],
+        ["commitC", { x: 224.03515625, y: 240, posWithOffset: 240 }],
+        ["commit5_8928ea0", { x: 224.03515625, y: 290, posWithOffset: 290 }],
+        ["commitD", { x: 224.03515625, y: 340, posWithOffset: 340 }],
+        ["commit7_ed848ba", { x: 224.03515625, y: 390, posWithOffset: 390 }]
+      ]);
+      commits.forEach((commit2, key) => {
+        it(`should give the correct position for commit ${key}`, () => {
+          const position = getCommitPosition(commit2, pos2, false);
+          expect(position).toEqual(expectedCommitPositionLR.get(key));
+          pos2 += 50;
+        });
+      });
+    });
+    describe("getCommitClassType", () => {
+      const expectedCommitClassType = /* @__PURE__ */ new Map([
+        ["commitZero", "commit-normal"],
+        ["commitA", "commit-normal"],
+        ["commitB", "commit-normal"],
+        ["commitM", "commit-merge"],
+        ["commitC", "commit-normal"],
+        ["commit5_8928ea0", "commit-cherry-pick"],
+        ["commitD", "commit-normal"],
+        ["commit7_ed848ba", "commit-cherry-pick"]
+      ]);
+      commits.forEach((commit2, key) => {
+        it(`should give the correct class type for commit ${key}`, () => {
+          const classType = getCommitClassType(commit2);
+          expect(classType).toBe(expectedCommitClassType.get(key));
+        });
+      });
+    });
+  });
+  describe("building BT parallel commit diagram", () => {
+    const commits = /* @__PURE__ */ new Map([
+      [
+        "1-abcdefg",
+        {
+          id: "1-abcdefg",
+          message: "",
+          seq: 0,
+          type: 0,
+          tags: [],
+          parents: [],
+          branch: "main"
+        }
+      ],
+      [
+        "2-abcdefg",
+        {
+          id: "2-abcdefg",
+          message: "",
+          seq: 1,
+          type: 0,
+          tags: [],
+          parents: ["1-abcdefg"],
+          branch: "main"
+        }
+      ],
+      [
+        "3-abcdefg",
+        {
+          id: "3-abcdefg",
+          message: "",
+          seq: 2,
+          type: 0,
+          tags: [],
+          parents: ["2-abcdefg"],
+          branch: "develop"
+        }
+      ],
+      [
+        "4-abcdefg",
+        {
+          id: "4-abcdefg",
+          message: "",
+          seq: 3,
+          type: 0,
+          tags: [],
+          parents: ["3-abcdefg"],
+          branch: "develop"
+        }
+      ],
+      [
+        "5-abcdefg",
+        {
+          id: "5-abcdefg",
+          message: "",
+          seq: 4,
+          type: 0,
+          tags: [],
+          parents: ["2-abcdefg"],
+          branch: "feature"
+        }
+      ],
+      [
+        "6-abcdefg",
+        {
+          id: "6-abcdefg",
+          message: "",
+          seq: 5,
+          type: 0,
+          tags: [],
+          parents: ["5-abcdefg"],
+          branch: "feature"
+        }
+      ],
+      [
+        "7-abcdefg",
+        {
+          id: "7-abcdefg",
+          message: "",
+          seq: 6,
+          type: 0,
+          tags: [],
+          parents: ["2-abcdefg"],
+          branch: "main"
+        }
+      ],
+      [
+        "8-abcdefg",
+        {
+          id: "8-abcdefg",
+          message: "",
+          seq: 7,
+          type: 0,
+          tags: [],
+          parents: ["7-abcdefg"],
+          branch: "main"
+        }
+      ]
+    ]);
+    const expectedCommitPosition = /* @__PURE__ */ new Map([
+      ["1-abcdefg", { x: 0, y: 40 }],
+      ["2-abcdefg", { x: 0, y: 90 }],
+      ["3-abcdefg", { x: 107.49609375, y: 140 }],
+      ["4-abcdefg", { x: 107.49609375, y: 190 }],
+      ["5-abcdefg", { x: 225.70703125, y: 140 }],
+      ["6-abcdefg", { x: 225.70703125, y: 190 }],
+      ["7-abcdefg", { x: 0, y: 140 }],
+      ["8-abcdefg", { x: 0, y: 190 }]
+    ]);
+    const expectedCommitPositionAfterParallel = /* @__PURE__ */ new Map([
+      ["1-abcdefg", { x: 0, y: 210 }],
+      ["2-abcdefg", { x: 0, y: 160 }],
+      ["3-abcdefg", { x: 107.49609375, y: 110 }],
+      ["4-abcdefg", { x: 107.49609375, y: 60 }],
+      ["5-abcdefg", { x: 225.70703125, y: 110 }],
+      ["6-abcdefg", { x: 225.70703125, y: 60 }],
+      ["7-abcdefg", { x: 0, y: 110 }],
+      ["8-abcdefg", { x: 0, y: 60 }]
+    ]);
+    const expectedCommitCurrentPosition = /* @__PURE__ */ new Map([
+      ["1-abcdefg", 30],
+      ["2-abcdefg", 80],
+      ["3-abcdefg", 130],
+      ["4-abcdefg", 180],
+      ["5-abcdefg", 130],
+      ["6-abcdefg", 180],
+      ["7-abcdefg", 130],
+      ["8-abcdefg", 180]
+    ]);
+    const sortedKeys = [...expectedCommitPosition.keys()];
+    it("should get the correct commit position and current position", () => {
+      dir = "BT";
+      let curPos = 30;
+      commitPos.clear();
+      branchPos.clear();
+      branchPos.set("main", { pos: 0, index: 0 });
+      branchPos.set("develop", { pos: 107.49609375, index: 1 });
+      branchPos.set("feature", { pos: 225.70703125, index: 2 });
+      DEFAULT_GITGRAPH_CONFIG2.parallelCommits = true;
+      commits.forEach((commit2, key) => {
+        if (commit2.parents.length > 0) {
+          curPos = calculateCommitPosition(commit2);
+        }
+        const position = setCommitPosition(commit2, curPos);
+        expect(position).toEqual(expectedCommitPosition.get(key));
+        expect(curPos).toEqual(expectedCommitCurrentPosition.get(key));
+      });
+    });
+    it("should get the correct commit position after parallel commits", () => {
+      commitPos.clear();
+      branchPos.clear();
+      dir = "BT";
+      const curPos = 30;
+      commitPos.clear();
+      branchPos.clear();
+      branchPos.set("main", { pos: 0, index: 0 });
+      branchPos.set("develop", { pos: 107.49609375, index: 1 });
+      branchPos.set("feature", { pos: 225.70703125, index: 2 });
+      setParallelBTPos(sortedKeys, commits, curPos);
+      sortedKeys.forEach((commit2) => {
+        const position = commitPos.get(commit2);
+        expect(position).toEqual(expectedCommitPositionAfterParallel.get(commit2));
+      });
+    });
+  });
+  DEFAULT_GITGRAPH_CONFIG2.parallelCommits = false;
+  it("add", () => {
+    commitPos.set("parent1", { x: 1, y: 1 });
+    commitPos.set("parent2", { x: 2, y: 2 });
+    commitPos.set("parent3", { x: 3, y: 3 });
+    dir = "LR";
+    const parents = ["parent1", "parent2", "parent3"];
+    const closestParent = findClosestParent(parents);
+    expect(closestParent).toBe("parent3");
+    commitPos.clear();
+  });
+}
+
+// src/diagrams/git/styles.js
+var getStyles = /* @__PURE__ */ __name((options) => `
+  .commit-id,
+  .commit-msg,
+  .branch-label {
+    fill: lightgrey;
+    color: lightgrey;
+    font-family: 'trebuchet ms', verdana, arial, sans-serif;
+    font-family: var(--mermaid-font-family);
+  }
+  ${[0, 1, 2, 3, 4, 5, 6, 7].map(
+  (i) => `
+        .branch-label${i} { fill: ${options["gitBranchLabel" + i]}; }
+        .commit${i} { stroke: ${options["git" + i]}; fill: ${options["git" + i]}; }
+        .commit-highlight${i} { stroke: ${options["gitInv" + i]}; fill: ${options["gitInv" + i]}; }
+        .label${i}  { fill: ${options["git" + i]}; }
+        .arrow${i} { stroke: ${options["git" + i]}; }
+        `
+).join("\n")}
+
+  .branch {
+    stroke-width: 1;
+    stroke: ${options.lineColor};
+    stroke-dasharray: 2;
+  }
+  .commit-label { font-size: ${options.commitLabelFontSize}; fill: ${options.commitLabelColor};}
+  .commit-label-bkg { font-size: ${options.commitLabelFontSize}; fill: ${options.commitLabelBackground}; opacity: 0.5; }
+  .tag-label { font-size: ${options.tagLabelFontSize}; fill: ${options.tagLabelColor};}
+  .tag-label-bkg { fill: ${options.tagLabelBackground}; stroke: ${options.tagLabelBorder}; }
+  .tag-hole { fill: ${options.textColor}; }
+
+  .commit-merge {
+    stroke: ${options.primaryColor};
+    fill: ${options.primaryColor};
+  }
+  .commit-reverse {
+    stroke: ${options.primaryColor};
+    fill: ${options.primaryColor};
+    stroke-width: 3;
+  }
+  .commit-highlight-outer {
+  }
+  .commit-highlight-inner {
+    stroke: ${options.primaryColor};
+    fill: ${options.primaryColor};
+  }
+
+  .arrow { stroke-width: 8; stroke-linecap: round; fill: none}
+  .gitTitleText {
+    text-anchor: middle;
+    font-size: 18px;
+    fill: ${options.textColor};
+  }
+`, "getStyles");
+var styles_default = getStyles;
+
+// src/diagrams/git/gitGraphDiagram.ts
+var diagram = {
+  parser,
+  db,
+  renderer: gitGraphRenderer_default,
+  styles: styles_default
+};
+export {
+  diagram
+};

+ 47 - 0
nicegui/elements/lib/mermaid/chunks/mermaid.core/infoDiagram-GSXZ5C4N.mjs

@@ -0,0 +1,47 @@
+import {
+  version
+} from "./chunk-YR4HKMZO.mjs";
+import {
+  selectSvgElement
+} from "./chunk-DLZUUSFL.mjs";
+import {
+  __name,
+  configureSvgSize,
+  log
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/diagrams/info/infoParser.ts
+import { parse } from "@mermaid-js/parser";
+var parser = {
+  parse: /* @__PURE__ */ __name(async (input) => {
+    const ast = await parse("info", input);
+    log.debug(ast);
+  }, "parse")
+};
+
+// src/diagrams/info/infoDb.ts
+var DEFAULT_INFO_DB = { version };
+var getVersion = /* @__PURE__ */ __name(() => DEFAULT_INFO_DB.version, "getVersion");
+var db = {
+  getVersion
+};
+
+// src/diagrams/info/infoRenderer.ts
+var draw = /* @__PURE__ */ __name((text, id, version2) => {
+  log.debug("rendering info diagram\n" + text);
+  const svg = selectSvgElement(id);
+  configureSvgSize(svg, 100, 400, true);
+  const group = svg.append("g");
+  group.append("text").attr("x", 100).attr("y", 40).attr("class", "version").attr("font-size", 32).style("text-anchor", "middle").text(`v${version2}`);
+}, "draw");
+var renderer = { draw };
+
+// src/diagrams/info/infoDiagram.ts
+var diagram = {
+  parser,
+  db,
+  renderer
+};
+export {
+  diagram
+};

+ 236 - 167
nicegui/elements/lib/mermaid/journeyDiagram-67cc1186.js → nicegui/elements/lib/mermaid/chunks/mermaid.core/journeyDiagram-35ZZFJAM.mjs

@@ -1,25 +1,41 @@
-import { c as getConfig, B as setDiagramTitle, D as getDiagramTitle, s as setAccTitle, g as getAccTitle, b as setAccDescription, a as getAccDescription, E as clear$1, j as d3select, k as configureSvgSize } from "./mermaid-f344f6a7.js";
-import { d as drawRect$1, f as drawText$1, a as drawBackgroundRect$1, g as getNoteRect } from "./svgDrawCommon-cae1106a.js";
-import { d as d3arc } from "./arc-8b90ddc8.js";
-import "./constant-b644328d.js";
+import {
+  drawBackgroundRect,
+  drawRect,
+  drawText,
+  getNoteRect
+} from "./chunk-AIUMCIBP.mjs";
+import {
+  __name,
+  clear,
+  configureSvgSize,
+  getAccDescription,
+  getAccTitle,
+  getConfig2 as getConfig,
+  getDiagramTitle,
+  setAccDescription,
+  setAccTitle,
+  setDiagramTitle
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/diagrams/user-journey/parser/journey.jison
 var parser = function() {
-  var o = function(k, v, o2, l) {
-    for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
-      ;
+  var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
+    for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
     return o2;
-  }, $V0 = [6, 8, 10, 11, 12, 14, 16, 17, 18], $V1 = [1, 9], $V2 = [1, 10], $V3 = [1, 11], $V4 = [1, 12], $V5 = [1, 13], $V6 = [1, 14];
+  }, "o"), $V0 = [6, 8, 10, 11, 12, 14, 16, 17, 18], $V1 = [1, 9], $V2 = [1, 10], $V3 = [1, 11], $V4 = [1, 12], $V5 = [1, 13], $V6 = [1, 14];
   var parser2 = {
-    trace: function trace() {
-    },
+    trace: /* @__PURE__ */ __name(function trace() {
+    }, "trace"),
     yy: {},
     symbols_: { "error": 2, "start": 3, "journey": 4, "document": 5, "EOF": 6, "line": 7, "SPACE": 8, "statement": 9, "NEWLINE": 10, "title": 11, "acc_title": 12, "acc_title_value": 13, "acc_descr": 14, "acc_descr_value": 15, "acc_descr_multiline_value": 16, "section": 17, "taskName": 18, "taskData": 19, "$accept": 0, "$end": 1 },
     terminals_: { 2: "error", 4: "journey", 6: "EOF", 8: "SPACE", 10: "NEWLINE", 11: "title", 12: "acc_title", 13: "acc_title_value", 14: "acc_descr", 15: "acc_descr_value", 16: "acc_descr_multiline_value", 17: "section", 18: "taskName", 19: "taskData" },
     productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 1], [9, 2]],
-    performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
+    performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
       var $0 = $$.length - 1;
       switch (yystate) {
         case 1:
           return $$[$0 - 1];
+          break;
         case 2:
           this.$ = [];
           break;
@@ -57,10 +73,10 @@ var parser = function() {
           this.$ = "task";
           break;
       }
-    },
+    }, "anonymous"),
     table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, o($V0, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: $V1, 12: $V2, 14: $V3, 16: $V4, 17: $V5, 18: $V6 }, o($V0, [2, 7], { 1: [2, 1] }), o($V0, [2, 3]), { 9: 15, 11: $V1, 12: $V2, 14: $V3, 16: $V4, 17: $V5, 18: $V6 }, o($V0, [2, 5]), o($V0, [2, 6]), o($V0, [2, 8]), { 13: [1, 16] }, { 15: [1, 17] }, o($V0, [2, 11]), o($V0, [2, 12]), { 19: [1, 18] }, o($V0, [2, 4]), o($V0, [2, 9]), o($V0, [2, 10]), o($V0, [2, 13])],
     defaultActions: {},
-    parseError: function parseError(str, hash) {
+    parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
       if (hash.recoverable) {
         this.trace(str);
       } else {
@@ -68,9 +84,9 @@ var parser = function() {
         error.hash = hash;
         throw error;
       }
-    },
-    parse: function parse(input) {
-      var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
+    }, "parseError"),
+    parse: /* @__PURE__ */ __name(function parse(input) {
+      var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
       var args = lstack.slice.call(arguments, 1);
       var lexer2 = Object.create(this.lexer);
       var sharedState = { yy: {} };
@@ -93,6 +109,12 @@ var parser = function() {
       } else {
         this.parseError = Object.getPrototypeOf(this).parseError;
       }
+      function popStack(n) {
+        stack.length = stack.length - 2 * n;
+        vstack.length = vstack.length - n;
+        lstack.length = lstack.length - n;
+      }
+      __name(popStack, "popStack");
       function lex() {
         var token;
         token = tstack.pop() || lexer2.lex() || EOF;
@@ -105,7 +127,8 @@ var parser = function() {
         }
         return token;
       }
-      var symbol, state, action, r, yyval = {}, p, len, newState, expected;
+      __name(lex, "lex");
+      var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
       while (true) {
         state = stack[stack.length - 1];
         if (this.defaultActions[state]) {
@@ -147,11 +170,17 @@ var parser = function() {
             lstack.push(lexer2.yylloc);
             stack.push(action[1]);
             symbol = null;
-            {
+            if (!preErrorSymbol) {
               yyleng = lexer2.yyleng;
               yytext = lexer2.yytext;
               yylineno = lexer2.yylineno;
               yyloc = lexer2.yylloc;
+              if (recovering > 0) {
+                recovering--;
+              }
+            } else {
+              symbol = preErrorSymbol;
+              preErrorSymbol = null;
             }
             break;
           case 2:
@@ -197,20 +226,20 @@ var parser = function() {
         }
       }
       return true;
-    }
+    }, "parse")
   };
-  var lexer = function() {
+  var lexer = /* @__PURE__ */ function() {
     var lexer2 = {
       EOF: 1,
-      parseError: function parseError(str, hash) {
+      parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
         if (this.yy.parser) {
           this.yy.parser.parseError(str, hash);
         } else {
           throw new Error(str);
         }
-      },
+      }, "parseError"),
       // resets the lexer, sets new input
-      setInput: function(input, yy) {
+      setInput: /* @__PURE__ */ __name(function(input, yy) {
         this.yy = yy || this.yy || {};
         this._input = input;
         this._more = this._backtrack = this.done = false;
@@ -228,9 +257,9 @@ var parser = function() {
         }
         this.offset = 0;
         return this;
-      },
+      }, "setInput"),
       // consumes and returns one char from the input
-      input: function() {
+      input: /* @__PURE__ */ __name(function() {
         var ch = this._input[0];
         this.yytext += ch;
         this.yyleng++;
@@ -249,9 +278,9 @@ var parser = function() {
         }
         this._input = this._input.slice(1);
         return ch;
-      },
+      }, "input"),
       // unshifts one char (or a string) into the input
-      unput: function(ch) {
+      unput: /* @__PURE__ */ __name(function(ch) {
         var len = ch.length;
         var lines = ch.split(/(?:\r\n?|\n)/g);
         this._input = ch + this._input;
@@ -275,14 +304,14 @@ var parser = function() {
         }
         this.yyleng = this.yytext.length;
         return this;
-      },
+      }, "unput"),
       // When called from action, caches matched text and appends it on next action
-      more: function() {
+      more: /* @__PURE__ */ __name(function() {
         this._more = true;
         return this;
-      },
+      }, "more"),
       // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
-      reject: function() {
+      reject: /* @__PURE__ */ __name(function() {
         if (this.options.backtrack_lexer) {
           this._backtrack = true;
         } else {
@@ -293,32 +322,32 @@ var parser = function() {
           });
         }
         return this;
-      },
+      }, "reject"),
       // retain first n characters of the match
-      less: function(n) {
+      less: /* @__PURE__ */ __name(function(n) {
         this.unput(this.match.slice(n));
-      },
+      }, "less"),
       // displays already matched input, i.e. for error messages
-      pastInput: function() {
+      pastInput: /* @__PURE__ */ __name(function() {
         var past = this.matched.substr(0, this.matched.length - this.match.length);
         return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
-      },
+      }, "pastInput"),
       // displays upcoming input, i.e. for error messages
-      upcomingInput: function() {
+      upcomingInput: /* @__PURE__ */ __name(function() {
         var next = this.match;
         if (next.length < 20) {
           next += this._input.substr(0, 20 - next.length);
         }
         return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
-      },
+      }, "upcomingInput"),
       // displays the character position where the lexing error occurred, i.e. for error messages
-      showPosition: function() {
+      showPosition: /* @__PURE__ */ __name(function() {
         var pre = this.pastInput();
         var c = new Array(pre.length + 1).join("-");
         return pre + this.upcomingInput() + "\n" + c + "^";
-      },
+      }, "showPosition"),
       // test the lexed token: return FALSE when not a match, otherwise return token
-      test_match: function(match, indexed_rule) {
+      test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
         var token, lines, backup;
         if (this.options.backtrack_lexer) {
           backup = {
@@ -379,9 +408,9 @@ var parser = function() {
           return false;
         }
         return false;
-      },
+      }, "test_match"),
       // return next match in input
-      next: function() {
+      next: /* @__PURE__ */ __name(function() {
         if (this.done) {
           return this.EOF;
         }
@@ -430,56 +459,57 @@ var parser = function() {
             line: this.yylineno
           });
         }
-      },
+      }, "next"),
       // return next match that has a token
-      lex: function lex() {
+      lex: /* @__PURE__ */ __name(function lex() {
         var r = this.next();
         if (r) {
           return r;
         } else {
           return this.lex();
         }
-      },
+      }, "lex"),
       // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
-      begin: function begin(condition) {
+      begin: /* @__PURE__ */ __name(function begin(condition) {
         this.conditionStack.push(condition);
-      },
+      }, "begin"),
       // pop the previously active lexer condition state off the condition stack
-      popState: function popState() {
+      popState: /* @__PURE__ */ __name(function popState() {
         var n = this.conditionStack.length - 1;
         if (n > 0) {
           return this.conditionStack.pop();
         } else {
           return this.conditionStack[0];
         }
-      },
+      }, "popState"),
       // produce the lexer rule set which is active for the currently active lexer condition state
-      _currentRules: function _currentRules() {
+      _currentRules: /* @__PURE__ */ __name(function _currentRules() {
         if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
           return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
         } else {
           return this.conditions["INITIAL"].rules;
         }
-      },
+      }, "_currentRules"),
       // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
-      topState: function topState(n) {
+      topState: /* @__PURE__ */ __name(function topState(n) {
         n = this.conditionStack.length - 1 - Math.abs(n || 0);
         if (n >= 0) {
           return this.conditionStack[n];
         } else {
           return "INITIAL";
         }
-      },
+      }, "topState"),
       // alias for begin(condition)
-      pushState: function pushState(condition) {
+      pushState: /* @__PURE__ */ __name(function pushState(condition) {
         this.begin(condition);
-      },
+      }, "pushState"),
       // return the number of states currently on the stack
-      stateStackSize: function stateStackSize() {
+      stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
         return this.conditionStack.length;
-      },
+      }, "stateStackSize"),
       options: { "case-insensitive": true },
-      performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
+      performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
+        var YYSTATE = YY_START;
         switch ($avoiding_name_collisions) {
           case 0:
             break;
@@ -487,26 +517,33 @@ var parser = function() {
             break;
           case 2:
             return 10;
+            break;
           case 3:
             break;
           case 4:
             break;
           case 5:
             return 4;
+            break;
           case 6:
             return 11;
+            break;
           case 7:
             this.begin("acc_title");
             return 12;
+            break;
           case 8:
             this.popState();
             return "acc_title_value";
+            break;
           case 9:
             this.begin("acc_descr");
             return 14;
+            break;
           case 10:
             this.popState();
             return "acc_descr_value";
+            break;
           case 11:
             this.begin("acc_descr_multiline");
             break;
@@ -515,20 +552,27 @@ var parser = function() {
             break;
           case 13:
             return "acc_descr_multiline_value";
+            break;
           case 14:
             return 17;
+            break;
           case 15:
             return 18;
+            break;
           case 16:
             return 19;
+            break;
           case 17:
             return ":";
+            break;
           case 18:
             return 6;
+            break;
           case 19:
             return "INVALID";
+            break;
         }
-      },
+      }, "anonymous"),
       rules: [/^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:journey\b)/i, /^(?:title\s[^#\n;]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:section\s[^#:\n;]+)/i, /^(?:[^#:\n;]+)/i, /^(?::[^#\n;]+)/i, /^(?::)/i, /^(?:$)/i, /^(?:.)/i],
       conditions: { "acc_descr_multiline": { "rules": [12, 13], "inclusive": false }, "acc_descr": { "rules": [10], "inclusive": false }, "acc_title": { "rules": [8], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 19], "inclusive": true } }
     };
@@ -538,31 +582,34 @@ var parser = function() {
   function Parser() {
     this.yy = {};
   }
+  __name(Parser, "Parser");
   Parser.prototype = parser2;
   parser2.Parser = Parser;
   return new Parser();
 }();
 parser.parser = parser;
-const parser$1 = parser;
-let currentSection = "";
-const sections = [];
-const tasks = [];
-const rawTasks = [];
-const clear = function() {
+var journey_default = parser;
+
+// src/diagrams/user-journey/journeyDb.js
+var currentSection = "";
+var sections = [];
+var tasks = [];
+var rawTasks = [];
+var clear2 = /* @__PURE__ */ __name(function() {
   sections.length = 0;
   tasks.length = 0;
   currentSection = "";
   rawTasks.length = 0;
-  clear$1();
-};
-const addSection = function(txt) {
+  clear();
+}, "clear");
+var addSection = /* @__PURE__ */ __name(function(txt) {
   currentSection = txt;
   sections.push(txt);
-};
-const getSections = function() {
+}, "addSection");
+var getSections = /* @__PURE__ */ __name(function() {
   return sections;
-};
-const getTasks = function() {
+}, "getSections");
+var getTasks = /* @__PURE__ */ __name(function() {
   let allItemsProcessed = compileTasks();
   const maxDepth = 100;
   let iterationCount = 0;
@@ -572,8 +619,8 @@ const getTasks = function() {
   }
   tasks.push(...rawTasks);
   return tasks;
-};
-const updateActors = function() {
+}, "getTasks");
+var updateActors = /* @__PURE__ */ __name(function() {
   const tempActors = [];
   tasks.forEach((task) => {
     if (task.people) {
@@ -582,8 +629,8 @@ const updateActors = function() {
   });
   const unique = new Set(tempActors);
   return [...unique].sort();
-};
-const addTask = function(descr, taskData) {
+}, "updateActors");
+var addTask = /* @__PURE__ */ __name(function(descr, taskData) {
   const pieces = taskData.substr(1).split(":");
   let score = 0;
   let peeps = [];
@@ -603,8 +650,8 @@ const addTask = function(descr, taskData) {
     score
   };
   rawTasks.push(rawTask);
-};
-const addTaskOrg = function(descr) {
+}, "addTask");
+var addTaskOrg = /* @__PURE__ */ __name(function(descr) {
   const newTask = {
     section: currentSection,
     type: currentSection,
@@ -613,24 +660,24 @@ const addTaskOrg = function(descr) {
     classes: []
   };
   tasks.push(newTask);
-};
-const compileTasks = function() {
-  const compileTask = function(pos) {
+}, "addTaskOrg");
+var compileTasks = /* @__PURE__ */ __name(function() {
+  const compileTask = /* @__PURE__ */ __name(function(pos) {
     return rawTasks[pos].processed;
-  };
+  }, "compileTask");
   let allProcessed = true;
   for (const [i, rawTask] of rawTasks.entries()) {
     compileTask(i);
     allProcessed = allProcessed && rawTask.processed;
   }
   return allProcessed;
-};
-const getActors = function() {
+}, "compileTasks");
+var getActors = /* @__PURE__ */ __name(function() {
   return updateActors();
-};
-const db = {
-  getConfig: () => getConfig().journey,
-  clear,
+}, "getActors");
+var journeyDb_default = {
+  getConfig: /* @__PURE__ */ __name(() => getConfig().journey, "getConfig"),
+  clear: clear2,
   setDiagramTitle,
   getDiagramTitle,
   setAccTitle,
@@ -644,7 +691,9 @@ const db = {
   addTaskOrg,
   getActors
 };
-const getStyles = (options) => `.label {
+
+// src/diagrams/user-journey/styles.js
+var getStyles = /* @__PURE__ */ __name((options) => `.label {
     font-family: 'trebuchet ms', verdana, arial, sans-serif;
     font-family: var(--mermaid-font-family);
     color: ${options.textColor};
@@ -777,12 +826,18 @@ const getStyles = (options) => `.label {
   .actor-5 {
     ${options.actor5 ? `fill: ${options.actor5}` : ""};
   }
-`;
-const styles = getStyles;
-const drawRect = function(elem, rectData) {
-  return drawRect$1(elem, rectData);
-};
-const drawFace = function(element, faceData) {
+`, "getStyles");
+var styles_default = getStyles;
+
+// src/diagrams/user-journey/journeyRenderer.ts
+import { select } from "d3";
+
+// src/diagrams/user-journey/svgDraw.js
+import { arc as d3arc } from "d3";
+var drawRect2 = /* @__PURE__ */ __name(function(elem, rectData) {
+  return drawRect(elem, rectData);
+}, "drawRect");
+var drawFace = /* @__PURE__ */ __name(function(element, faceData) {
   const radius = 15;
   const circleElement = element.append("circle").attr("cx", faceData.cx).attr("cy", faceData.cy).attr("class", "face").attr("r", radius).attr("stroke-width", 2).attr("overflow", "visible");
   const face = element.append("g");
@@ -792,13 +847,16 @@ const drawFace = function(element, faceData) {
     const arc = d3arc().startAngle(Math.PI / 2).endAngle(3 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2);
     face2.append("path").attr("class", "mouth").attr("d", arc).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 2) + ")");
   }
+  __name(smile, "smile");
   function sad(face2) {
     const arc = d3arc().startAngle(3 * Math.PI / 2).endAngle(5 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2);
     face2.append("path").attr("class", "mouth").attr("d", arc).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 7) + ")");
   }
+  __name(sad, "sad");
   function ambivalent(face2) {
     face2.append("line").attr("class", "mouth").attr("stroke", 2).attr("x1", faceData.cx - 5).attr("y1", faceData.cy + 7).attr("x2", faceData.cx + 5).attr("y2", faceData.cy + 7).attr("class", "mouth").attr("stroke-width", "1px").attr("stroke", "#666");
   }
+  __name(ambivalent, "ambivalent");
   if (faceData.score > 3) {
     smile(face);
   } else if (faceData.score < 3) {
@@ -807,8 +865,8 @@ const drawFace = function(element, faceData) {
     ambivalent(face);
   }
   return circleElement;
-};
-const drawCircle = function(element, circleData) {
+}, "drawFace");
+var drawCircle = /* @__PURE__ */ __name(function(element, circleData) {
   const circleElement = element.append("circle");
   circleElement.attr("cx", circleData.cx);
   circleElement.attr("cy", circleData.cy);
@@ -823,22 +881,23 @@ const drawCircle = function(element, circleData) {
     circleElement.append("title").text(circleData.title);
   }
   return circleElement;
-};
-const drawText = function(elem, textData) {
-  return drawText$1(elem, textData);
-};
-const drawLabel = function(elem, txtObject) {
+}, "drawCircle");
+var drawText2 = /* @__PURE__ */ __name(function(elem, textData) {
+  return drawText(elem, textData);
+}, "drawText");
+var drawLabel = /* @__PURE__ */ __name(function(elem, txtObject) {
   function genPoints(x, y, width, height, cut) {
     return x + "," + y + " " + (x + width) + "," + y + " " + (x + width) + "," + (y + height - cut) + " " + (x + width - cut * 1.2) + "," + (y + height) + " " + x + "," + (y + height);
   }
+  __name(genPoints, "genPoints");
   const polygon = elem.append("polygon");
   polygon.attr("points", genPoints(txtObject.x, txtObject.y, 50, 20, 7));
   polygon.attr("class", "labelBox");
   txtObject.y = txtObject.y + txtObject.labelMargin;
   txtObject.x = txtObject.x + 0.5 * txtObject.labelMargin;
-  drawText(elem, txtObject);
-};
-const drawSection = function(elem, section, conf2) {
+  drawText2(elem, txtObject);
+}, "drawLabel");
+var drawSection = /* @__PURE__ */ __name(function(elem, section, conf2) {
   const g = elem.append("g");
   const rect = getNoteRect();
   rect.x = section.x;
@@ -850,7 +909,7 @@ const drawSection = function(elem, section, conf2) {
   rect.class = "journey-section section-type-" + section.num;
   rect.rx = 3;
   rect.ry = 3;
-  drawRect(g, rect);
+  drawRect2(g, rect);
   _drawTextCandidateFunc(conf2)(
     section.text,
     g,
@@ -862,9 +921,9 @@ const drawSection = function(elem, section, conf2) {
     conf2,
     section.colour
   );
-};
-let taskCount = -1;
-const drawTask = function(elem, task, conf2) {
+}, "drawSection");
+var taskCount = -1;
+var drawTask = /* @__PURE__ */ __name(function(elem, task, conf2) {
   const center = task.x + conf2.width / 2;
   const g = elem.append("g");
   taskCount++;
@@ -884,7 +943,7 @@ const drawTask = function(elem, task, conf2) {
   rect.class = "task task-type-" + task.num;
   rect.rx = 3;
   rect.ry = 3;
-  drawRect(g, rect);
+  drawRect2(g, rect);
   let xPos = task.x + 14;
   task.people.forEach((person) => {
     const colour = task.actors[person].color;
@@ -911,15 +970,16 @@ const drawTask = function(elem, task, conf2) {
     conf2,
     task.colour
   );
-};
-const drawBackgroundRect = function(elem, bounds2) {
-  drawBackgroundRect$1(elem, bounds2);
-};
-const _drawTextCandidateFunc = function() {
+}, "drawTask");
+var drawBackgroundRect2 = /* @__PURE__ */ __name(function(elem, bounds2) {
+  drawBackgroundRect(elem, bounds2);
+}, "drawBackgroundRect");
+var _drawTextCandidateFunc = /* @__PURE__ */ function() {
   function byText(content, g, x, y, width, height, textAttrs, colour) {
     const text = g.append("text").attr("x", x + width / 2).attr("y", y + height / 2 + 5).style("font-color", colour).style("text-anchor", "middle").text(content);
     _setTextAttrs(text, textAttrs);
   }
+  __name(byText, "byText");
   function byTspan(content, g, x, y, width, height, textAttrs, conf2, colour) {
     const { taskFontSize, taskFontFamily } = conf2;
     const lines = content.split(/<br\s*\/?>/gi);
@@ -931,6 +991,7 @@ const _drawTextCandidateFunc = function() {
       _setTextAttrs(text, textAttrs);
     }
   }
+  __name(byTspan, "byTspan");
   function byFo(content, g, x, y, width, height, textAttrs, conf2) {
     const body = g.append("switch");
     const f = body.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height).attr("position", "fixed");
@@ -939,6 +1000,7 @@ const _drawTextCandidateFunc = function() {
     byTspan(content, body, x, y, width, height, textAttrs, conf2);
     _setTextAttrs(text, textAttrs);
   }
+  __name(byFo, "byFo");
   function _setTextAttrs(toText, fromTextAttrsDict) {
     for (const key in fromTextAttrsDict) {
       if (key in fromTextAttrsDict) {
@@ -946,30 +1008,33 @@ const _drawTextCandidateFunc = function() {
       }
     }
   }
+  __name(_setTextAttrs, "_setTextAttrs");
   return function(conf2) {
     return conf2.textPlacement === "fo" ? byFo : conf2.textPlacement === "old" ? byText : byTspan;
   };
 }();
-const initGraphics = function(graphics) {
+var initGraphics = /* @__PURE__ */ __name(function(graphics) {
   graphics.append("defs").append("marker").attr("id", "arrowhead").attr("refX", 5).attr("refY", 2).attr("markerWidth", 6).attr("markerHeight", 4).attr("orient", "auto").append("path").attr("d", "M 0,0 V 4 L6,2 Z");
-};
-const svgDraw = {
-  drawRect,
+}, "initGraphics");
+var svgDraw_default = {
+  drawRect: drawRect2,
   drawCircle,
   drawSection,
-  drawText,
+  drawText: drawText2,
   drawLabel,
   drawTask,
-  drawBackgroundRect,
+  drawBackgroundRect: drawBackgroundRect2,
   initGraphics
 };
-const setConf = function(cnf) {
+
+// src/diagrams/user-journey/journeyRenderer.ts
+var setConf = /* @__PURE__ */ __name(function(cnf) {
   const keys = Object.keys(cnf);
   keys.forEach(function(key) {
     conf[key] = cnf[key];
   });
-};
-const actors = {};
+}, "setConf");
+var actors = {};
 function drawActorLegend(diagram2) {
   const conf2 = getConfig().journey;
   let yPos = 60;
@@ -983,7 +1048,7 @@ function drawActorLegend(diagram2) {
       stroke: "#000",
       pos: actors[person].position
     };
-    svgDraw.drawCircle(diagram2, circleData);
+    svgDraw_default.drawCircle(diagram2, circleData);
     const labelData = {
       x: 40,
       y: yPos + 7,
@@ -991,23 +1056,24 @@ function drawActorLegend(diagram2) {
       text: person,
       textMargin: conf2.boxTextMargin | 5
     };
-    svgDraw.drawText(diagram2, labelData);
+    svgDraw_default.drawText(diagram2, labelData);
     yPos += 20;
   });
 }
-const conf = getConfig().journey;
-const LEFT_MARGIN = conf.leftMargin;
-const draw = function(text, id, version, diagObj) {
+__name(drawActorLegend, "drawActorLegend");
+var conf = getConfig().journey;
+var LEFT_MARGIN = conf.leftMargin;
+var draw = /* @__PURE__ */ __name(function(text, id, version, diagObj) {
   const conf2 = getConfig().journey;
   const securityLevel = getConfig().securityLevel;
   let sandboxElement;
   if (securityLevel === "sandbox") {
-    sandboxElement = d3select("#i" + id);
+    sandboxElement = select("#i" + id);
   }
-  const root = securityLevel === "sandbox" ? d3select(sandboxElement.nodes()[0].contentDocument.body) : d3select("body");
+  const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
   bounds.init();
   const diagram2 = root.select("#" + id);
-  svgDraw.initGraphics(diagram2);
+  svgDraw_default.initGraphics(diagram2);
   const tasks2 = diagObj.db.getTasks();
   const title = diagObj.db.getDiagramTitle();
   const actorNames = diagObj.db.getActors();
@@ -1037,8 +1103,8 @@ const draw = function(text, id, version, diagObj) {
   diagram2.attr("viewBox", `${box.startx} -25 ${width} ${height + extraVertForTitle}`);
   diagram2.attr("preserveAspectRatio", "xMinYMin meet");
   diagram2.attr("height", height + extraVertForTitle + 25);
-};
-const bounds = {
+}, "draw");
+var bounds = {
   data: {
     startx: void 0,
     stopx: void 0,
@@ -1047,7 +1113,7 @@ const bounds = {
   },
   verticalPos: 0,
   sequenceItems: [],
-  init: function() {
+  init: /* @__PURE__ */ __name(function() {
     this.sequenceItems = [];
     this.data = {
       startx: void 0,
@@ -1056,20 +1122,20 @@ const bounds = {
       stopy: void 0
     };
     this.verticalPos = 0;
-  },
-  updateVal: function(obj, key, val, fun) {
+  }, "init"),
+  updateVal: /* @__PURE__ */ __name(function(obj, key, val, fun) {
     if (obj[key] === void 0) {
       obj[key] = val;
     } else {
       obj[key] = fun(val, obj[key]);
     }
-  },
-  updateBounds: function(startx, starty, stopx, stopy) {
+  }, "updateVal"),
+  updateBounds: /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) {
     const conf2 = getConfig().journey;
     const _self = this;
     let cnt = 0;
     function updateFn(type) {
-      return function updateItemBounds(item) {
+      return /* @__PURE__ */ __name(function updateItemBounds(item) {
         cnt++;
         const n = _self.sequenceItems.length - cnt + 1;
         _self.updateVal(item, "starty", starty - n * conf2.boxMargin, Math.min);
@@ -1082,11 +1148,12 @@ const bounds = {
           _self.updateVal(bounds.data, "starty", starty - n * conf2.boxMargin, Math.min);
           _self.updateVal(bounds.data, "stopy", stopy + n * conf2.boxMargin, Math.max);
         }
-      };
+      }, "updateItemBounds");
     }
+    __name(updateFn, "updateFn");
     this.sequenceItems.forEach(updateFn());
-  },
-  insert: function(startx, starty, stopx, stopy) {
+  }, "updateBounds"),
+  insert: /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) {
     const _startx = Math.min(startx, stopx);
     const _stopx = Math.max(startx, stopx);
     const _starty = Math.min(starty, stopy);
@@ -1096,21 +1163,21 @@ const bounds = {
     this.updateVal(bounds.data, "stopx", _stopx, Math.max);
     this.updateVal(bounds.data, "stopy", _stopy, Math.max);
     this.updateBounds(_startx, _starty, _stopx, _stopy);
-  },
-  bumpVerticalPos: function(bump) {
+  }, "insert"),
+  bumpVerticalPos: /* @__PURE__ */ __name(function(bump) {
     this.verticalPos = this.verticalPos + bump;
     this.data.stopy = this.verticalPos;
-  },
-  getVerticalPos: function() {
+  }, "bumpVerticalPos"),
+  getVerticalPos: /* @__PURE__ */ __name(function() {
     return this.verticalPos;
-  },
-  getBounds: function() {
+  }, "getVerticalPos"),
+  getBounds: /* @__PURE__ */ __name(function() {
     return this.data;
-  }
+  }, "getBounds")
 };
-const fills = conf.sectionFills;
-const textColours = conf.sectionColours;
-const drawTasks = function(diagram2, tasks2, verticalPos) {
+var fills = conf.sectionFills;
+var textColours = conf.sectionColours;
+var drawTasks = /* @__PURE__ */ __name(function(diagram2, tasks2, verticalPos) {
   const conf2 = getConfig().journey;
   let lastSection = "";
   const sectionVHeight = conf2.height * 2 + conf2.diagramMarginY;
@@ -1142,7 +1209,7 @@ const drawTasks = function(diagram2, tasks2, verticalPos) {
         colour,
         taskCount: taskInSectionCount
       };
-      svgDraw.drawSection(diagram2, section, conf2);
+      svgDraw_default.drawSection(diagram2, section, conf2);
       lastSection = task.section;
       sectionNumber++;
     }
@@ -1160,23 +1227,25 @@ const drawTasks = function(diagram2, tasks2, verticalPos) {
     task.fill = fill;
     task.num = num;
     task.actors = taskActors;
-    svgDraw.drawTask(diagram2, task, conf2);
+    svgDraw_default.drawTask(diagram2, task, conf2);
     bounds.insert(task.x, task.y, task.x + task.width + conf2.taskMargin, 300 + 5 * 30);
   }
-};
-const renderer = {
+}, "drawTasks");
+var journeyRenderer_default = {
   setConf,
   draw
 };
-const diagram = {
-  parser: parser$1,
-  db,
-  renderer,
-  styles,
-  init: (cnf) => {
-    renderer.setConf(cnf.journey);
-    db.clear();
-  }
+
+// src/diagrams/user-journey/journeyDiagram.ts
+var diagram = {
+  parser: journey_default,
+  db: journeyDb_default,
+  renderer: journeyRenderer_default,
+  styles: styles_default,
+  init: /* @__PURE__ */ __name((cnf) => {
+    journeyRenderer_default.setConf(cnf.journey);
+    journeyDb_default.clear();
+  }, "init")
 };
 export {
   diagram

File diff suppressed because it is too large
+ 277 - 237
nicegui/elements/lib/mermaid/chunks/mermaid.core/mindmap-definition-6NGNQFMS.mjs


+ 217 - 0
nicegui/elements/lib/mermaid/chunks/mermaid.core/pieDiagram-WEX7LNAG.mjs

@@ -0,0 +1,217 @@
+import {
+  populateCommonDb
+} from "./chunk-JJENOPKO.mjs";
+import {
+  cleanAndMerge,
+  parseFontSize
+} from "./chunk-VKXSJROQ.mjs";
+import {
+  selectSvgElement
+} from "./chunk-DLZUUSFL.mjs";
+import {
+  __name,
+  clear,
+  configureSvgSize,
+  defaultConfig_default,
+  getAccDescription,
+  getAccTitle,
+  getConfig2 as getConfig,
+  getDiagramTitle,
+  log,
+  setAccDescription,
+  setAccTitle,
+  setDiagramTitle
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/diagrams/pie/pieParser.ts
+import { parse } from "@mermaid-js/parser";
+
+// src/diagrams/pie/pieDb.ts
+var DEFAULT_PIE_CONFIG = defaultConfig_default.pie;
+var DEFAULT_PIE_DB = {
+  sections: /* @__PURE__ */ new Map(),
+  showData: false,
+  config: DEFAULT_PIE_CONFIG
+};
+var sections = DEFAULT_PIE_DB.sections;
+var showData = DEFAULT_PIE_DB.showData;
+var config = structuredClone(DEFAULT_PIE_CONFIG);
+var getConfig2 = /* @__PURE__ */ __name(() => structuredClone(config), "getConfig");
+var clear2 = /* @__PURE__ */ __name(() => {
+  sections = /* @__PURE__ */ new Map();
+  showData = DEFAULT_PIE_DB.showData;
+  clear();
+}, "clear");
+var addSection = /* @__PURE__ */ __name(({ label, value }) => {
+  if (!sections.has(label)) {
+    sections.set(label, value);
+    log.debug(`added new section: ${label}, with value: ${value}`);
+  }
+}, "addSection");
+var getSections = /* @__PURE__ */ __name(() => sections, "getSections");
+var setShowData = /* @__PURE__ */ __name((toggle) => {
+  showData = toggle;
+}, "setShowData");
+var getShowData = /* @__PURE__ */ __name(() => showData, "getShowData");
+var db = {
+  getConfig: getConfig2,
+  clear: clear2,
+  setDiagramTitle,
+  getDiagramTitle,
+  setAccTitle,
+  getAccTitle,
+  setAccDescription,
+  getAccDescription,
+  addSection,
+  getSections,
+  setShowData,
+  getShowData
+};
+
+// src/diagrams/pie/pieParser.ts
+var populateDb = /* @__PURE__ */ __name((ast, db2) => {
+  populateCommonDb(ast, db2);
+  db2.setShowData(ast.showData);
+  ast.sections.map(db2.addSection);
+}, "populateDb");
+var parser = {
+  parse: /* @__PURE__ */ __name(async (input) => {
+    const ast = await parse("pie", input);
+    log.debug(ast);
+    populateDb(ast, db);
+  }, "parse")
+};
+
+// src/diagrams/pie/pieStyles.ts
+var getStyles = /* @__PURE__ */ __name((options) => `
+  .pieCircle{
+    stroke: ${options.pieStrokeColor};
+    stroke-width : ${options.pieStrokeWidth};
+    opacity : ${options.pieOpacity};
+  }
+  .pieOuterCircle{
+    stroke: ${options.pieOuterStrokeColor};
+    stroke-width: ${options.pieOuterStrokeWidth};
+    fill: none;
+  }
+  .pieTitleText {
+    text-anchor: middle;
+    font-size: ${options.pieTitleTextSize};
+    fill: ${options.pieTitleTextColor};
+    font-family: ${options.fontFamily};
+  }
+  .slice {
+    font-family: ${options.fontFamily};
+    fill: ${options.pieSectionTextColor};
+    font-size:${options.pieSectionTextSize};
+    // fill: white;
+  }
+  .legend text {
+    fill: ${options.pieLegendTextColor};
+    font-family: ${options.fontFamily};
+    font-size: ${options.pieLegendTextSize};
+  }
+`, "getStyles");
+var pieStyles_default = getStyles;
+
+// src/diagrams/pie/pieRenderer.ts
+import { arc, pie as d3pie, scaleOrdinal } from "d3";
+var createPieArcs = /* @__PURE__ */ __name((sections2) => {
+  const pieData = [...sections2.entries()].map((element) => {
+    return {
+      label: element[0],
+      value: element[1]
+    };
+  }).sort((a, b) => {
+    return b.value - a.value;
+  });
+  const pie = d3pie().value(
+    (d3Section) => d3Section.value
+  );
+  return pie(pieData);
+}, "createPieArcs");
+var draw = /* @__PURE__ */ __name((text, id, _version, diagObj) => {
+  log.debug("rendering pie chart\n" + text);
+  const db2 = diagObj.db;
+  const globalConfig = getConfig();
+  const pieConfig = cleanAndMerge(db2.getConfig(), globalConfig.pie);
+  const MARGIN = 40;
+  const LEGEND_RECT_SIZE = 18;
+  const LEGEND_SPACING = 4;
+  const height = 450;
+  const pieWidth = height;
+  const svg = selectSvgElement(id);
+  const group = svg.append("g");
+  group.attr("transform", "translate(" + pieWidth / 2 + "," + height / 2 + ")");
+  const { themeVariables } = globalConfig;
+  let [outerStrokeWidth] = parseFontSize(themeVariables.pieOuterStrokeWidth);
+  outerStrokeWidth ??= 2;
+  const textPosition = pieConfig.textPosition;
+  const radius = Math.min(pieWidth, height) / 2 - MARGIN;
+  const arcGenerator = arc().innerRadius(0).outerRadius(radius);
+  const labelArcGenerator = arc().innerRadius(radius * textPosition).outerRadius(radius * textPosition);
+  group.append("circle").attr("cx", 0).attr("cy", 0).attr("r", radius + outerStrokeWidth / 2).attr("class", "pieOuterCircle");
+  const sections2 = db2.getSections();
+  const arcs = createPieArcs(sections2);
+  const myGeneratedColors = [
+    themeVariables.pie1,
+    themeVariables.pie2,
+    themeVariables.pie3,
+    themeVariables.pie4,
+    themeVariables.pie5,
+    themeVariables.pie6,
+    themeVariables.pie7,
+    themeVariables.pie8,
+    themeVariables.pie9,
+    themeVariables.pie10,
+    themeVariables.pie11,
+    themeVariables.pie12
+  ];
+  const color = scaleOrdinal(myGeneratedColors);
+  group.selectAll("mySlices").data(arcs).enter().append("path").attr("d", arcGenerator).attr("fill", (datum) => {
+    return color(datum.data.label);
+  }).attr("class", "pieCircle");
+  let sum = 0;
+  sections2.forEach((section) => {
+    sum += section;
+  });
+  group.selectAll("mySlices").data(arcs).enter().append("text").text((datum) => {
+    return (datum.data.value / sum * 100).toFixed(0) + "%";
+  }).attr("transform", (datum) => {
+    return "translate(" + labelArcGenerator.centroid(datum) + ")";
+  }).style("text-anchor", "middle").attr("class", "slice");
+  group.append("text").text(db2.getDiagramTitle()).attr("x", 0).attr("y", -(height - 50) / 2).attr("class", "pieTitleText");
+  const legend = group.selectAll(".legend").data(color.domain()).enter().append("g").attr("class", "legend").attr("transform", (_datum, index) => {
+    const height2 = LEGEND_RECT_SIZE + LEGEND_SPACING;
+    const offset = height2 * color.domain().length / 2;
+    const horizontal = 12 * LEGEND_RECT_SIZE;
+    const vertical = index * height2 - offset;
+    return "translate(" + horizontal + "," + vertical + ")";
+  });
+  legend.append("rect").attr("width", LEGEND_RECT_SIZE).attr("height", LEGEND_RECT_SIZE).style("fill", color).style("stroke", color);
+  legend.data(arcs).append("text").attr("x", LEGEND_RECT_SIZE + LEGEND_SPACING).attr("y", LEGEND_RECT_SIZE - LEGEND_SPACING).text((datum) => {
+    const { label, value } = datum.data;
+    if (db2.getShowData()) {
+      return `${label} [${value}]`;
+    }
+    return label;
+  });
+  const longestTextWidth = Math.max(
+    ...legend.selectAll("text").nodes().map((node) => node?.getBoundingClientRect().width ?? 0)
+  );
+  const totalWidth = pieWidth + MARGIN + LEGEND_RECT_SIZE + LEGEND_SPACING + longestTextWidth;
+  svg.attr("viewBox", `0 0 ${totalWidth} ${height}`);
+  configureSvgSize(svg, height, totalWidth, pieConfig.useMaxWidth);
+}, "draw");
+var renderer = { draw };
+
+// src/diagrams/pie/pieDiagram.ts
+var diagram = {
+  parser,
+  db,
+  renderer,
+  styles: pieStyles_default
+};
+export {
+  diagram
+};

File diff suppressed because it is too large
+ 84 - 47
nicegui/elements/lib/mermaid/chunks/mermaid.core/quadrantDiagram-SRYJ5FP7.mjs


File diff suppressed because it is too large
+ 21 - 21
nicegui/elements/lib/mermaid/chunks/mermaid.core/requirementDiagram-V7TESSIR.mjs


+ 200 - 137
nicegui/elements/lib/mermaid/sankeyDiagram-31fcfff2.js → nicegui/elements/lib/mermaid/chunks/mermaid.core/sankeyDiagram-XVFEVEVI.mjs

@@ -1,29 +1,32 @@
-import { c as getConfig, g as getAccTitle, s as setAccTitle, a as getAccDescription, b as setAccDescription, r as getDiagramTitle, q as setDiagramTitle, t as clear$1, e as common, I as defaultConfig, i as configureSvgSize } from "./mermaid-485fd1a4.js";
-import { select, scaleOrdinal, schemeTableau10 } from "d3";
-import { sankey, sankeyLinkHorizontal, sankeyLeft, sankeyRight, sankeyCenter, sankeyJustify } from "d3-sankey";
-import "ts-dedent";
-import "dayjs";
-import "@braintree/sanitize-url";
-import "dompurify";
-import "khroma";
-import "lodash-es/memoize.js";
-import "lodash-es/merge.js";
-import "stylis";
-import "lodash-es/isEmpty.js";
+import {
+  __name,
+  clear,
+  common_default,
+  defaultConfig2 as defaultConfig,
+  getAccDescription,
+  getAccTitle,
+  getConfig2 as getConfig,
+  getDiagramTitle,
+  setAccDescription,
+  setAccTitle,
+  setDiagramTitle,
+  setupGraphViewbox
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/diagrams/sankey/parser/sankey.jison
 var parser = function() {
-  var o = function(k, v, o2, l) {
-    for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
-      ;
+  var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
+    for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
     return o2;
-  }, $V0 = [1, 9], $V1 = [1, 10], $V2 = [1, 5, 10, 12];
+  }, "o"), $V0 = [1, 9], $V1 = [1, 10], $V2 = [1, 5, 10, 12];
   var parser2 = {
-    trace: function trace() {
-    },
+    trace: /* @__PURE__ */ __name(function trace() {
+    }, "trace"),
     yy: {},
     symbols_: { "error": 2, "start": 3, "SANKEY": 4, "NEWLINE": 5, "csv": 6, "opt_eof": 7, "record": 8, "csv_tail": 9, "EOF": 10, "field[source]": 11, "COMMA": 12, "field[target]": 13, "field[value]": 14, "field": 15, "escaped": 16, "non_escaped": 17, "DQUOTE": 18, "ESCAPED_TEXT": 19, "NON_ESCAPED_TEXT": 20, "$accept": 0, "$end": 1 },
     terminals_: { 2: "error", 4: "SANKEY", 5: "NEWLINE", 10: "EOF", 11: "field[source]", 12: "COMMA", 13: "field[target]", 14: "field[value]", 18: "DQUOTE", 19: "ESCAPED_TEXT", 20: "NON_ESCAPED_TEXT" },
     productions_: [0, [3, 4], [6, 2], [9, 2], [9, 0], [7, 1], [7, 0], [8, 5], [15, 1], [15, 1], [16, 3], [17, 1]],
-    performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
+    performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
       var $0 = $$.length - 1;
       switch (yystate) {
         case 7:
@@ -41,10 +44,10 @@ var parser = function() {
           this.$ = $$[$0 - 1];
           break;
       }
-    },
+    }, "anonymous"),
     table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, { 5: [1, 3] }, { 6: 4, 8: 5, 15: 6, 16: 7, 17: 8, 18: $V0, 20: $V1 }, { 1: [2, 6], 7: 11, 10: [1, 12] }, o($V1, [2, 4], { 9: 13, 5: [1, 14] }), { 12: [1, 15] }, o($V2, [2, 8]), o($V2, [2, 9]), { 19: [1, 16] }, o($V2, [2, 11]), { 1: [2, 1] }, { 1: [2, 5] }, o($V1, [2, 2]), { 6: 17, 8: 5, 15: 6, 16: 7, 17: 8, 18: $V0, 20: $V1 }, { 15: 18, 16: 7, 17: 8, 18: $V0, 20: $V1 }, { 18: [1, 19] }, o($V1, [2, 3]), { 12: [1, 20] }, o($V2, [2, 10]), { 15: 21, 16: 7, 17: 8, 18: $V0, 20: $V1 }, o([1, 5, 10], [2, 7])],
     defaultActions: { 11: [2, 1], 12: [2, 5] },
-    parseError: function parseError(str, hash) {
+    parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
       if (hash.recoverable) {
         this.trace(str);
       } else {
@@ -52,9 +55,9 @@ var parser = function() {
         error.hash = hash;
         throw error;
       }
-    },
-    parse: function parse(input) {
-      var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
+    }, "parseError"),
+    parse: /* @__PURE__ */ __name(function parse(input) {
+      var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
       var args = lstack.slice.call(arguments, 1);
       var lexer2 = Object.create(this.lexer);
       var sharedState = { yy: {} };
@@ -77,6 +80,12 @@ var parser = function() {
       } else {
         this.parseError = Object.getPrototypeOf(this).parseError;
       }
+      function popStack(n) {
+        stack.length = stack.length - 2 * n;
+        vstack.length = vstack.length - n;
+        lstack.length = lstack.length - n;
+      }
+      __name(popStack, "popStack");
       function lex() {
         var token;
         token = tstack.pop() || lexer2.lex() || EOF;
@@ -89,7 +98,8 @@ var parser = function() {
         }
         return token;
       }
-      var symbol, state, action, r, yyval = {}, p, len, newState, expected;
+      __name(lex, "lex");
+      var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
       while (true) {
         state = stack[stack.length - 1];
         if (this.defaultActions[state]) {
@@ -131,11 +141,17 @@ var parser = function() {
             lstack.push(lexer2.yylloc);
             stack.push(action[1]);
             symbol = null;
-            {
+            if (!preErrorSymbol) {
               yyleng = lexer2.yyleng;
               yytext = lexer2.yytext;
               yylineno = lexer2.yylineno;
               yyloc = lexer2.yylloc;
+              if (recovering > 0) {
+                recovering--;
+              }
+            } else {
+              symbol = preErrorSymbol;
+              preErrorSymbol = null;
             }
             break;
           case 2:
@@ -181,20 +197,20 @@ var parser = function() {
         }
       }
       return true;
-    }
+    }, "parse")
   };
-  var lexer = function() {
+  var lexer = /* @__PURE__ */ function() {
     var lexer2 = {
       EOF: 1,
-      parseError: function parseError(str, hash) {
+      parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
         if (this.yy.parser) {
           this.yy.parser.parseError(str, hash);
         } else {
           throw new Error(str);
         }
-      },
+      }, "parseError"),
       // resets the lexer, sets new input
-      setInput: function(input, yy) {
+      setInput: /* @__PURE__ */ __name(function(input, yy) {
         this.yy = yy || this.yy || {};
         this._input = input;
         this._more = this._backtrack = this.done = false;
@@ -212,9 +228,9 @@ var parser = function() {
         }
         this.offset = 0;
         return this;
-      },
+      }, "setInput"),
       // consumes and returns one char from the input
-      input: function() {
+      input: /* @__PURE__ */ __name(function() {
         var ch = this._input[0];
         this.yytext += ch;
         this.yyleng++;
@@ -233,9 +249,9 @@ var parser = function() {
         }
         this._input = this._input.slice(1);
         return ch;
-      },
+      }, "input"),
       // unshifts one char (or a string) into the input
-      unput: function(ch) {
+      unput: /* @__PURE__ */ __name(function(ch) {
         var len = ch.length;
         var lines = ch.split(/(?:\r\n?|\n)/g);
         this._input = ch + this._input;
@@ -259,14 +275,14 @@ var parser = function() {
         }
         this.yyleng = this.yytext.length;
         return this;
-      },
+      }, "unput"),
       // When called from action, caches matched text and appends it on next action
-      more: function() {
+      more: /* @__PURE__ */ __name(function() {
         this._more = true;
         return this;
-      },
+      }, "more"),
       // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
-      reject: function() {
+      reject: /* @__PURE__ */ __name(function() {
         if (this.options.backtrack_lexer) {
           this._backtrack = true;
         } else {
@@ -277,32 +293,32 @@ var parser = function() {
           });
         }
         return this;
-      },
+      }, "reject"),
       // retain first n characters of the match
-      less: function(n) {
+      less: /* @__PURE__ */ __name(function(n) {
         this.unput(this.match.slice(n));
-      },
+      }, "less"),
       // displays already matched input, i.e. for error messages
-      pastInput: function() {
+      pastInput: /* @__PURE__ */ __name(function() {
         var past = this.matched.substr(0, this.matched.length - this.match.length);
         return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
-      },
+      }, "pastInput"),
       // displays upcoming input, i.e. for error messages
-      upcomingInput: function() {
+      upcomingInput: /* @__PURE__ */ __name(function() {
         var next = this.match;
         if (next.length < 20) {
           next += this._input.substr(0, 20 - next.length);
         }
         return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
-      },
+      }, "upcomingInput"),
       // displays the character position where the lexing error occurred, i.e. for error messages
-      showPosition: function() {
+      showPosition: /* @__PURE__ */ __name(function() {
         var pre = this.pastInput();
         var c = new Array(pre.length + 1).join("-");
         return pre + this.upcomingInput() + "\n" + c + "^";
-      },
+      }, "showPosition"),
       // test the lexed token: return FALSE when not a match, otherwise return token
-      test_match: function(match, indexed_rule) {
+      test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
         var token, lines, backup;
         if (this.options.backtrack_lexer) {
           backup = {
@@ -363,9 +379,9 @@ var parser = function() {
           return false;
         }
         return false;
-      },
+      }, "test_match"),
       // return next match in input
-      next: function() {
+      next: /* @__PURE__ */ __name(function() {
         if (this.done) {
           return this.EOF;
         }
@@ -414,79 +430,88 @@ var parser = function() {
             line: this.yylineno
           });
         }
-      },
+      }, "next"),
       // return next match that has a token
-      lex: function lex() {
+      lex: /* @__PURE__ */ __name(function lex() {
         var r = this.next();
         if (r) {
           return r;
         } else {
           return this.lex();
         }
-      },
+      }, "lex"),
       // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
-      begin: function begin(condition) {
+      begin: /* @__PURE__ */ __name(function begin(condition) {
         this.conditionStack.push(condition);
-      },
+      }, "begin"),
       // pop the previously active lexer condition state off the condition stack
-      popState: function popState() {
+      popState: /* @__PURE__ */ __name(function popState() {
         var n = this.conditionStack.length - 1;
         if (n > 0) {
           return this.conditionStack.pop();
         } else {
           return this.conditionStack[0];
         }
-      },
+      }, "popState"),
       // produce the lexer rule set which is active for the currently active lexer condition state
-      _currentRules: function _currentRules() {
+      _currentRules: /* @__PURE__ */ __name(function _currentRules() {
         if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
           return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
         } else {
           return this.conditions["INITIAL"].rules;
         }
-      },
+      }, "_currentRules"),
       // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
-      topState: function topState(n) {
+      topState: /* @__PURE__ */ __name(function topState(n) {
         n = this.conditionStack.length - 1 - Math.abs(n || 0);
         if (n >= 0) {
           return this.conditionStack[n];
         } else {
           return "INITIAL";
         }
-      },
+      }, "topState"),
       // alias for begin(condition)
-      pushState: function pushState(condition) {
+      pushState: /* @__PURE__ */ __name(function pushState(condition) {
         this.begin(condition);
-      },
+      }, "pushState"),
       // return the number of states currently on the stack
-      stateStackSize: function stateStackSize() {
+      stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
         return this.conditionStack.length;
-      },
-      options: { "easy_keword_rules": true },
-      performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
+      }, "stateStackSize"),
+      options: { "case-insensitive": true },
+      performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
+        var YYSTATE = YY_START;
         switch ($avoiding_name_collisions) {
           case 0:
             this.pushState("csv");
             return 4;
+            break;
           case 1:
             return 10;
+            break;
           case 2:
             return 5;
+            break;
           case 3:
             return 12;
+            break;
           case 4:
             this.pushState("escaped_text");
             return 18;
+            break;
           case 5:
             return 20;
+            break;
           case 6:
             this.popState("escaped_text");
             return 18;
+            break;
           case 7:
             return 19;
+            break;
         }
-      },
-      rules: [/^(?:sankey-beta\b)/, /^(?:$)/, /^(?:((\u000D\u000A)|(\u000A)))/, /^(?:(\u002C))/, /^(?:(\u0022))/, /^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/, /^(?:(\u0022)(?!(\u0022)))/, /^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/],
+      }, "anonymous"),
+      rules: [/^(?:sankey-beta\b)/i, /^(?:$)/i, /^(?:((\u000D\u000A)|(\u000A)))/i, /^(?:(\u002C))/i, /^(?:(\u0022))/i, /^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i, /^(?:(\u0022)(?!(\u0022)))/i, /^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i],
       conditions: { "csv": { "rules": [1, 2, 3, 4, 5, 6, 7], "inclusive": false }, "escaped_text": { "rules": [6, 7], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7], "inclusive": true } }
     };
     return lexer2;
@@ -495,57 +520,68 @@ var parser = function() {
   function Parser() {
     this.yy = {};
   }
+  __name(Parser, "Parser");
   Parser.prototype = parser2;
   parser2.Parser = Parser;
   return new Parser();
 }();
 parser.parser = parser;
-const parser$1 = parser;
-let links = [];
-let nodes = [];
-let nodesMap = {};
-const clear = () => {
+var sankey_default = parser;
+
+// src/diagrams/sankey/sankeyDB.ts
+var links = [];
+var nodes = [];
+var nodesMap = /* @__PURE__ */ new Map();
+var clear2 = /* @__PURE__ */ __name(() => {
   links = [];
   nodes = [];
-  nodesMap = {};
-  clear$1();
-};
-class SankeyLink {
+  nodesMap = /* @__PURE__ */ new Map();
+  clear();
+}, "clear");
+var SankeyLink = class {
   constructor(source, target, value = 0) {
     this.source = source;
     this.target = target;
     this.value = value;
   }
-}
-const addLink = (source, target, value) => {
-  links.push(new SankeyLink(source, target, value));
+  static {
+    __name(this, "SankeyLink");
+  }
 };
-class SankeyNode {
+var addLink = /* @__PURE__ */ __name((source, target, value) => {
+  links.push(new SankeyLink(source, target, value));
+}, "addLink");
+var SankeyNode = class {
   constructor(ID) {
     this.ID = ID;
   }
-}
-const findOrCreateNode = (ID) => {
-  ID = common.sanitizeText(ID, getConfig());
-  if (!nodesMap[ID]) {
-    nodesMap[ID] = new SankeyNode(ID);
-    nodes.push(nodesMap[ID]);
+  static {
+    __name(this, "SankeyNode");
   }
-  return nodesMap[ID];
 };
-const getNodes = () => nodes;
-const getLinks = () => links;
-const getGraph = () => ({
+var findOrCreateNode = /* @__PURE__ */ __name((ID) => {
+  ID = common_default.sanitizeText(ID, getConfig());
+  let node = nodesMap.get(ID);
+  if (node === void 0) {
+    node = new SankeyNode(ID);
+    nodesMap.set(ID, node);
+    nodes.push(node);
+  }
+  return node;
+}, "findOrCreateNode");
+var getNodes = /* @__PURE__ */ __name(() => nodes, "getNodes");
+var getLinks = /* @__PURE__ */ __name(() => links, "getLinks");
+var getGraph = /* @__PURE__ */ __name(() => ({
   nodes: nodes.map((node) => ({ id: node.ID })),
   links: links.map((link) => ({
     source: link.source.ID,
     target: link.target.ID,
     value: link.value
   }))
-});
-const db = {
+}), "getGraph");
+var sankeyDB_default = {
   nodesMap,
-  getConfig: () => getConfig().sankey,
+  getConfig: /* @__PURE__ */ __name(() => getConfig().sankey, "getConfig"),
   getNodes,
   getLinks,
   getGraph,
@@ -557,9 +593,32 @@ const db = {
   setAccDescription,
   getDiagramTitle,
   setDiagramTitle,
-  clear
+  clear: clear2
 };
-const _Uid = class {
+
+// src/diagrams/sankey/sankeyRenderer.ts
+import {
+  select as d3select,
+  scaleOrdinal as d3scaleOrdinal,
+  schemeTableau10 as d3schemeTableau10
+} from "d3";
+import {
+  sankey as d3Sankey,
+  sankeyLinkHorizontal as d3SankeyLinkHorizontal,
+  sankeyLeft as d3SankeyLeft,
+  sankeyRight as d3SankeyRight,
+  sankeyCenter as d3SankeyCenter,
+  sankeyJustify as d3SankeyJustify
+} from "d3-sankey";
+
+// src/rendering-util/uid.ts
+var Uid = class _Uid {
+  static {
+    __name(this, "Uid");
+  }
+  static {
+    this.count = 0;
+  }
   static next(name) {
     return new _Uid(name + ++_Uid.count);
   }
@@ -571,55 +630,54 @@ const _Uid = class {
     return "url(" + this.href + ")";
   }
 };
-let Uid = _Uid;
-Uid.count = 0;
-const alignmentsMap = {
-  left: sankeyLeft,
-  right: sankeyRight,
-  center: sankeyCenter,
-  justify: sankeyJustify
+
+// src/diagrams/sankey/sankeyRenderer.ts
+var alignmentsMap = {
+  left: d3SankeyLeft,
+  right: d3SankeyRight,
+  center: d3SankeyCenter,
+  justify: d3SankeyJustify
 };
-const draw = function(text, id, _version, diagObj) {
+var draw = /* @__PURE__ */ __name(function(text, id, _version, diagObj) {
   const { securityLevel, sankey: conf } = getConfig();
   const defaultSankeyConfig = defaultConfig.sankey;
   let sandboxElement;
   if (securityLevel === "sandbox") {
-    sandboxElement = select("#i" + id);
+    sandboxElement = d3select("#i" + id);
   }
-  const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
-  const svg = securityLevel === "sandbox" ? root.select(`[id="${id}"]`) : select(`[id="${id}"]`);
-  const width = (conf == null ? void 0 : conf.width) ?? defaultSankeyConfig.width;
-  const height = (conf == null ? void 0 : conf.height) ?? defaultSankeyConfig.width;
-  const useMaxWidth = (conf == null ? void 0 : conf.useMaxWidth) ?? defaultSankeyConfig.useMaxWidth;
-  const nodeAlignment = (conf == null ? void 0 : conf.nodeAlignment) ?? defaultSankeyConfig.nodeAlignment;
-  const prefix = (conf == null ? void 0 : conf.prefix) ?? defaultSankeyConfig.prefix;
-  const suffix = (conf == null ? void 0 : conf.suffix) ?? defaultSankeyConfig.suffix;
-  const showValues = (conf == null ? void 0 : conf.showValues) ?? defaultSankeyConfig.showValues;
-  configureSvgSize(svg, height, width, useMaxWidth);
+  const root = securityLevel === "sandbox" ? d3select(sandboxElement.nodes()[0].contentDocument.body) : d3select("body");
+  const svg = securityLevel === "sandbox" ? root.select(`[id="${id}"]`) : d3select(`[id="${id}"]`);
+  const width = conf?.width ?? defaultSankeyConfig.width;
+  const height = conf?.height ?? defaultSankeyConfig.width;
+  const useMaxWidth = conf?.useMaxWidth ?? defaultSankeyConfig.useMaxWidth;
+  const nodeAlignment = conf?.nodeAlignment ?? defaultSankeyConfig.nodeAlignment;
+  const prefix = conf?.prefix ?? defaultSankeyConfig.prefix;
+  const suffix = conf?.suffix ?? defaultSankeyConfig.suffix;
+  const showValues = conf?.showValues ?? defaultSankeyConfig.showValues;
   const graph = diagObj.db.getGraph();
   const nodeAlign = alignmentsMap[nodeAlignment];
   const nodeWidth = 10;
-  const sankey$1 = sankey().nodeId((d) => d.id).nodeWidth(nodeWidth).nodePadding(10 + (showValues ? 15 : 0)).nodeAlign(nodeAlign).extent([
+  const sankey = d3Sankey().nodeId((d) => d.id).nodeWidth(nodeWidth).nodePadding(10 + (showValues ? 15 : 0)).nodeAlign(nodeAlign).extent([
     [0, 0],
     [width, height]
   ]);
-  sankey$1(graph);
-  const colorScheme = scaleOrdinal(schemeTableau10);
+  sankey(graph);
+  const colorScheme = d3scaleOrdinal(d3schemeTableau10);
   svg.append("g").attr("class", "nodes").selectAll(".node").data(graph.nodes).join("g").attr("class", "node").attr("id", (d) => (d.uid = Uid.next("node-")).id).attr("transform", function(d) {
     return "translate(" + d.x0 + "," + d.y0 + ")";
   }).attr("x", (d) => d.x0).attr("y", (d) => d.y0).append("rect").attr("height", (d) => {
     return d.y1 - d.y0;
   }).attr("width", (d) => d.x1 - d.x0).attr("fill", (d) => colorScheme(d.id));
-  const getText = ({ id: id2, value }) => {
+  const getText = /* @__PURE__ */ __name(({ id: id2, value }) => {
     if (!showValues) {
       return id2;
     }
     return `${id2}
 ${prefix}${Math.round(value * 100) / 100}${suffix}`;
-  };
+  }, "getText");
   svg.append("g").attr("class", "node-labels").attr("font-family", "sans-serif").attr("font-size", 14).selectAll("text").data(graph.nodes).join("text").attr("x", (d) => d.x0 < width / 2 ? d.x1 + 6 : d.x0 - 6).attr("y", (d) => (d.y1 + d.y0) / 2).attr("dy", `${showValues ? "0" : "0.35"}em`).attr("text-anchor", (d) => d.x0 < width / 2 ? "start" : "end").text(getText);
   const link = svg.append("g").attr("class", "links").attr("fill", "none").attr("stroke-opacity", 0.5).selectAll(".link").data(graph.links).join("g").attr("class", "link").style("mix-blend-mode", "multiply");
-  const linkColor = (conf == null ? void 0 : conf.linkColor) || "gradient";
+  const linkColor = conf?.linkColor ?? "gradient";
   if (linkColor === "gradient") {
     const gradient = link.append("linearGradient").attr("id", (d) => (d.uid = Uid.next("linearGradient-")).id).attr("gradientUnits", "userSpaceOnUse").attr("x1", (d) => d.source.x1).attr("x2", (d) => d.target.x0);
     gradient.append("stop").attr("offset", "0%").attr("stop-color", (d) => colorScheme(d.source.id));
@@ -628,32 +686,37 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`;
   let coloring;
   switch (linkColor) {
     case "gradient":
-      coloring = (d) => d.uid;
+      coloring = /* @__PURE__ */ __name((d) => d.uid, "coloring");
       break;
     case "source":
-      coloring = (d) => colorScheme(d.source.id);
+      coloring = /* @__PURE__ */ __name((d) => colorScheme(d.source.id), "coloring");
       break;
     case "target":
-      coloring = (d) => colorScheme(d.target.id);
+      coloring = /* @__PURE__ */ __name((d) => colorScheme(d.target.id), "coloring");
       break;
     default:
       coloring = linkColor;
   }
-  link.append("path").attr("d", sankeyLinkHorizontal()).attr("stroke", coloring).attr("stroke-width", (d) => Math.max(1, d.width));
-};
-const renderer = {
+  link.append("path").attr("d", d3SankeyLinkHorizontal()).attr("stroke", coloring).attr("stroke-width", (d) => Math.max(1, d.width));
+  setupGraphViewbox(void 0, svg, 0, useMaxWidth);
+}, "draw");
+var sankeyRenderer_default = {
   draw
 };
-const prepareTextForParsing = (text) => {
+
+// src/diagrams/sankey/sankeyUtils.ts
+var prepareTextForParsing = /* @__PURE__ */ __name((text) => {
   const textToParse = text.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g, "").replaceAll(/([\n\r])+/g, "\n").trim();
   return textToParse;
-};
-const originalParse = parser$1.parse.bind(parser$1);
-parser$1.parse = (text) => originalParse(prepareTextForParsing(text));
-const diagram = {
-  parser: parser$1,
-  db,
-  renderer
+}, "prepareTextForParsing");
+
+// src/diagrams/sankey/sankeyDiagram.ts
+var originalParse = sankey_default.parse.bind(sankey_default);
+sankey_default.parse = (text) => originalParse(prepareTextForParsing(text));
+var diagram = {
+  parser: sankey_default,
+  db: sankeyDB_default,
+  renderer: sankeyRenderer_default
 };
 export {
   diagram

File diff suppressed because it is too large
+ 63 - 32
nicegui/elements/lib/mermaid/chunks/mermaid.core/sequenceDiagram-6SD7JOPP.mjs


+ 114 - 86
nicegui/elements/lib/mermaid/stateDiagram-dac17514.js → nicegui/elements/lib/mermaid/chunks/mermaid.core/stateDiagram-N22R6T2Y.mjs

@@ -1,45 +1,64 @@
-import { d as db, p as parser, s as styles } from "./styles-409bbf16.js";
-import { line, curveBasis, select } from "d3";
-import { layout } from "dagre-d3-es/src/dagre/index.js";
+import {
+  stateDb_default,
+  stateDiagram_default,
+  styles_default
+} from "./chunk-SVGOEX7Z.mjs";
+import "./chunk-FUIDI54P.mjs";
+import "./chunk-Z2VRG6XP.mjs";
+import "./chunk-T3KDJ7CM.mjs";
+import "./chunk-5CZSE4TR.mjs";
+import "./chunk-TINLTEC2.mjs";
+import "./chunk-OERGPBFJ.mjs";
+import {
+  utils_default
+} from "./chunk-VKXSJROQ.mjs";
+import {
+  __name,
+  common_default,
+  configureSvgSize,
+  getConfig2 as getConfig,
+  log
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/diagrams/state/stateRenderer.js
+import { select } from "d3";
+import { layout as dagreLayout } from "dagre-d3-es/src/dagre/index.js";
 import * as graphlib from "dagre-d3-es/src/graphlib/index.js";
-import { c as getConfig, u as utils, e as common, l as log, i as configureSvgSize } from "./mermaid-485fd1a4.js";
-import "ts-dedent";
-import "dayjs";
-import "@braintree/sanitize-url";
-import "dompurify";
-import "khroma";
-import "lodash-es/memoize.js";
-import "lodash-es/merge.js";
-import "stylis";
-import "lodash-es/isEmpty.js";
-const idCache = {};
-const set = (key, val) => {
+
+// src/diagrams/state/shapes.js
+import { line, curveBasis } from "d3";
+
+// src/diagrams/state/id-cache.js
+var idCache = {};
+var set = /* @__PURE__ */ __name((key, val) => {
   idCache[key] = val;
-};
-const get = (k) => idCache[k];
-const keys = () => Object.keys(idCache);
-const size = () => keys().length;
-const idCache$1 = {
+}, "set");
+var get = /* @__PURE__ */ __name((k) => idCache[k], "get");
+var keys = /* @__PURE__ */ __name(() => Object.keys(idCache), "keys");
+var size = /* @__PURE__ */ __name(() => keys().length, "size");
+var id_cache_default = {
   get,
   set,
   keys,
   size
 };
-const drawStartState = (g) => g.append("circle").attr("class", "start-state").attr("r", getConfig().state.sizeUnit).attr("cx", getConfig().state.padding + getConfig().state.sizeUnit).attr("cy", getConfig().state.padding + getConfig().state.sizeUnit);
-const drawDivider = (g) => g.append("line").style("stroke", "grey").style("stroke-dasharray", "3").attr("x1", getConfig().state.textHeight).attr("class", "divider").attr("x2", getConfig().state.textHeight * 2).attr("y1", 0).attr("y2", 0);
-const drawSimpleState = (g, stateDef) => {
+
+// src/diagrams/state/shapes.js
+var drawStartState = /* @__PURE__ */ __name((g) => g.append("circle").attr("class", "start-state").attr("r", getConfig().state.sizeUnit).attr("cx", getConfig().state.padding + getConfig().state.sizeUnit).attr("cy", getConfig().state.padding + getConfig().state.sizeUnit), "drawStartState");
+var drawDivider = /* @__PURE__ */ __name((g) => g.append("line").style("stroke", "grey").style("stroke-dasharray", "3").attr("x1", getConfig().state.textHeight).attr("class", "divider").attr("x2", getConfig().state.textHeight * 2).attr("y1", 0).attr("y2", 0), "drawDivider");
+var drawSimpleState = /* @__PURE__ */ __name((g, stateDef) => {
   const state = g.append("text").attr("x", 2 * getConfig().state.padding).attr("y", getConfig().state.textHeight + 2 * getConfig().state.padding).attr("font-size", getConfig().state.fontSize).attr("class", "state-title").text(stateDef.id);
   const classBox = state.node().getBBox();
   g.insert("rect", ":first-child").attr("x", getConfig().state.padding).attr("y", getConfig().state.padding).attr("width", classBox.width + 2 * getConfig().state.padding).attr("height", classBox.height + 2 * getConfig().state.padding).attr("rx", getConfig().state.radius);
   return state;
-};
-const drawDescrState = (g, stateDef) => {
-  const addTspan = function(textEl, txt, isFirst2) {
+}, "drawSimpleState");
+var drawDescrState = /* @__PURE__ */ __name((g, stateDef) => {
+  const addTspan = /* @__PURE__ */ __name(function(textEl, txt, isFirst2) {
     const tSpan = textEl.append("tspan").attr("x", 2 * getConfig().state.padding).text(txt);
     if (!isFirst2) {
       tSpan.attr("dy", getConfig().state.textHeight);
     }
-  };
+  }, "addTspan");
   const title = g.append("text").attr("x", 2 * getConfig().state.padding).attr("y", getConfig().state.textHeight + 1.3 * getConfig().state.padding).attr("font-size", getConfig().state.fontSize).attr("class", "state-title").text(stateDef.descriptions[0]);
   const titleBox = title.node().getBBox();
   const titleHeight = titleBox.height;
@@ -62,8 +81,8 @@ const drawDescrState = (g, stateDef) => {
   descrLine.attr("x2", width + 3 * getConfig().state.padding);
   g.insert("rect", ":first-child").attr("x", getConfig().state.padding).attr("y", getConfig().state.padding).attr("width", width + 2 * getConfig().state.padding).attr("height", descrBox.height + titleHeight + 2 * getConfig().state.padding).attr("rx", getConfig().state.radius);
   return g;
-};
-const addTitleAndBox = (g, stateDef, altBkg) => {
+}, "drawDescrState");
+var addTitleAndBox = /* @__PURE__ */ __name((g, stateDef, altBkg) => {
   const pad = getConfig().state.padding;
   const dblPad = 2 * getConfig().state.padding;
   const orgBox = g.node().getBBox();
@@ -78,8 +97,8 @@ const addTitleAndBox = (g, stateDef, altBkg) => {
   }
   let startX;
   const graphBox = g.node().getBBox();
-  if (stateDef.doc)
-    ;
+  if (stateDef.doc) {
+  }
   startX = orgX - pad;
   if (titleWidth > orgWidth) {
     startX = (orgWidth - width) / 2 + pad;
@@ -105,8 +124,8 @@ const addTitleAndBox = (g, stateDef, altBkg) => {
     getConfig().state.titleShift - getConfig().state.textHeight - getConfig().state.padding
   ).attr("width", width).attr("height", graphBox.height + 3 + 2 * getConfig().state.textHeight).attr("rx", getConfig().state.radius);
   return g;
-};
-const drawEndState = (g) => {
+}, "addTitleAndBox");
+var drawEndState = /* @__PURE__ */ __name((g) => {
   g.append("circle").attr("class", "end-state-outer").attr("r", getConfig().state.sizeUnit + getConfig().state.miniPadding).attr(
     "cx",
     getConfig().state.padding + getConfig().state.sizeUnit + getConfig().state.miniPadding
@@ -115,8 +134,8 @@ const drawEndState = (g) => {
     getConfig().state.padding + getConfig().state.sizeUnit + getConfig().state.miniPadding
   );
   return g.append("circle").attr("class", "end-state-inner").attr("r", getConfig().state.sizeUnit).attr("cx", getConfig().state.padding + getConfig().state.sizeUnit + 2).attr("cy", getConfig().state.padding + getConfig().state.sizeUnit + 2);
-};
-const drawForkJoinState = (g, stateDef) => {
+}, "drawEndState");
+var drawForkJoinState = /* @__PURE__ */ __name((g, stateDef) => {
   let width = getConfig().state.forkWidth;
   let height = getConfig().state.forkHeight;
   if (stateDef.parentId) {
@@ -125,15 +144,15 @@ const drawForkJoinState = (g, stateDef) => {
     height = tmp;
   }
   return g.append("rect").style("stroke", "black").style("fill", "black").attr("width", width).attr("height", height).attr("x", getConfig().state.padding).attr("y", getConfig().state.padding);
-};
-const _drawLongText = (_text, x, y, g) => {
+}, "drawForkJoinState");
+var _drawLongText = /* @__PURE__ */ __name((_text, x, y, g) => {
   let textHeight = 0;
   const textElem = g.append("text");
   textElem.style("text-anchor", "start");
   textElem.attr("class", "noteText");
   let text = _text.replace(/\r\n/g, "<br/>");
   text = text.replace(/\n/g, "<br/>");
-  const lines = text.split(common.lineBreakRegex);
+  const lines = text.split(common_default.lineBreakRegex);
   let tHeight = 1.25 * getConfig().state.noteMargin;
   for (const line2 of lines) {
     const txt = line2.trim();
@@ -150,8 +169,8 @@ const _drawLongText = (_text, x, y, g) => {
     }
   }
   return { textWidth: textElem.node().getBBox().width, textHeight };
-};
-const drawNote = (text, g) => {
+}, "_drawLongText");
+var drawNote = /* @__PURE__ */ __name((text, g) => {
   g.attr("class", "state-note");
   const note = g.append("rect").attr("x", 0).attr("y", getConfig().state.padding);
   const rectElem = g.append("g");
@@ -159,8 +178,8 @@ const drawNote = (text, g) => {
   note.attr("height", textHeight + 2 * getConfig().state.noteMargin);
   note.attr("width", textWidth + getConfig().state.noteMargin * 2);
   return note;
-};
-const drawState = function(elem, stateDef) {
+}, "drawNote");
+var drawState = /* @__PURE__ */ __name(function(elem, stateDef) {
   const id = stateDef.id;
   const stateInfo = {
     id,
@@ -193,23 +212,23 @@ const drawState = function(elem, stateDef) {
   const stateBox = g.node().getBBox();
   stateInfo.width = stateBox.width + 2 * getConfig().state.padding;
   stateInfo.height = stateBox.height + 2 * getConfig().state.padding;
-  idCache$1.set(id, stateInfo);
+  id_cache_default.set(id, stateInfo);
   return stateInfo;
-};
-let edgeCount = 0;
-const drawEdge = function(elem, path, relation) {
-  const getRelationType = function(type) {
+}, "drawState");
+var edgeCount = 0;
+var drawEdge = /* @__PURE__ */ __name(function(elem, path, relation) {
+  const getRelationType = /* @__PURE__ */ __name(function(type) {
     switch (type) {
-      case db.relationType.AGGREGATION:
+      case stateDb_default.relationType.AGGREGATION:
         return "aggregation";
-      case db.relationType.EXTENSION:
+      case stateDb_default.relationType.EXTENSION:
         return "extension";
-      case db.relationType.COMPOSITION:
+      case stateDb_default.relationType.COMPOSITION:
         return "composition";
-      case db.relationType.DEPENDENCY:
+      case stateDb_default.relationType.DEPENDENCY:
         return "dependency";
     }
-  };
+  }, "getRelationType");
   path.points = path.points.filter((p) => !Number.isNaN(p.y));
   const lineData = path.points;
   const lineFunction = line().x(function(d) {
@@ -226,22 +245,22 @@ const drawEdge = function(elem, path, relation) {
   }
   svgPath.attr(
     "marker-end",
-    "url(" + url + "#" + getRelationType(db.relationType.DEPENDENCY) + "End)"
+    "url(" + url + "#" + getRelationType(stateDb_default.relationType.DEPENDENCY) + "End)"
   );
   if (relation.title !== void 0) {
     const label = elem.append("g").attr("class", "stateLabel");
-    const { x, y } = utils.calcLabelPosition(path.points);
-    const rows = common.getRows(relation.title);
+    const { x, y } = utils_default.calcLabelPosition(path.points);
+    const rows = common_default.getRows(relation.title);
     let titleHeight = 0;
     const titleRows = [];
     let maxWidth = 0;
     let minX = 0;
     for (let i = 0; i <= rows.length; i++) {
       const title = label.append("text").attr("text-anchor", "middle").text(rows[i]).attr("x", x).attr("y", y + titleHeight);
-      const boundstmp = title.node().getBBox();
-      maxWidth = Math.max(maxWidth, boundstmp.width);
-      minX = Math.min(minX, boundstmp.x);
-      log.info(boundstmp.x, x, y + titleHeight);
+      const boundsTmp = title.node().getBBox();
+      maxWidth = Math.max(maxWidth, boundsTmp.width);
+      minX = Math.min(minX, boundsTmp.x);
+      log.info(boundsTmp.x, x, y + titleHeight);
       if (titleHeight === 0) {
         const titleBox = title.node().getBBox();
         titleHeight = titleBox.height;
@@ -260,15 +279,17 @@ const drawEdge = function(elem, path, relation) {
     log.info(bounds);
   }
   edgeCount++;
-};
-let conf;
-const transformationLog = {};
-const setConf = function() {
-};
-const insertMarkers = function(elem) {
+}, "drawEdge");
+
+// src/diagrams/state/stateRenderer.js
+var conf;
+var transformationLog = {};
+var setConf = /* @__PURE__ */ __name(function() {
+}, "setConf");
+var insertMarkers = /* @__PURE__ */ __name(function(elem) {
   elem.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
-};
-const draw = function(text, id, _version, diagObj) {
+}, "insertMarkers");
+var draw = /* @__PURE__ */ __name(function(text, id, _version, diagObj) {
   conf = getConfig().state;
   const securityLevel = getConfig().securityLevel;
   let sandboxElement;
@@ -292,11 +313,11 @@ const draw = function(text, id, _version, diagObj) {
     "viewBox",
     `${bounds.x - conf.padding}  ${bounds.y - conf.padding} ` + width + " " + height
   );
-};
-const getLabelWidth = (text) => {
+}, "draw");
+var getLabelWidth = /* @__PURE__ */ __name((text) => {
   return text ? text.length * conf.fontSizeFactor : 1;
-};
-const renderDoc = (doc, diagram2, parentId, altBkg, root, domDocument, diagObj) => {
+}, "getLabelWidth");
+var renderDoc = /* @__PURE__ */ __name((doc, diagram2, parentId, altBkg, root, domDocument, diagObj) => {
   const graph = new graphlib.Graph({
     compound: true,
     multigraph: true
@@ -344,6 +365,7 @@ const renderDoc = (doc, diagram2, parentId, altBkg, root, domDocument, diagObj)
   const states = diagObj.db.getStates();
   const relations = diagObj.db.getRelations();
   const keys2 = Object.keys(states);
+  let first = true;
   for (const key of keys2) {
     const stateDef = states[key];
     if (parentId) {
@@ -353,15 +375,19 @@ const renderDoc = (doc, diagram2, parentId, altBkg, root, domDocument, diagObj)
     if (stateDef.doc) {
       let sub = diagram2.append("g").attr("id", stateDef.id).attr("class", "stateGroup");
       node = renderDoc(stateDef.doc, sub, stateDef.id, !altBkg, root, domDocument, diagObj);
-      {
+      if (first) {
         sub = addTitleAndBox(sub, stateDef, altBkg);
         let boxBounds = sub.node().getBBox();
         node.width = boxBounds.width;
         node.height = boxBounds.height + conf.padding / 2;
         transformationLog[stateDef.id] = { y: conf.compositTitleSize };
+      } else {
+        let boxBounds = sub.node().getBBox();
+        node.width = boxBounds.width;
+        node.height = boxBounds.height;
       }
     } else {
-      node = drawState(diagram2, stateDef);
+      node = drawState(diagram2, stateDef, graph);
     }
     if (stateDef.note) {
       const noteDef = {
@@ -370,7 +396,7 @@ const renderDoc = (doc, diagram2, parentId, altBkg, root, domDocument, diagObj)
         note: stateDef.note,
         type: "note"
       };
-      const note = drawState(diagram2, noteDef);
+      const note = drawState(diagram2, noteDef, graph);
       if (stateDef.note.position === "left of") {
         graph.setNode(node.id + "-note", note);
         graph.setNode(node.id, node);
@@ -395,13 +421,13 @@ const renderDoc = (doc, diagram2, parentId, altBkg, root, domDocument, diagObj)
       {
         relation,
         width: getLabelWidth(relation.title),
-        height: conf.labelHeight * common.getRows(relation.title).length,
+        height: conf.labelHeight * common_default.getRows(relation.title).length,
         labelpos: "c"
       },
       "id" + cnt
     );
   });
-  layout(graph);
+  dagreLayout(graph);
   log.debug("Graph after layout", graph.nodes());
   const svgElem = diagram2.node();
   graph.nodes().forEach(function(v) {
@@ -451,23 +477,25 @@ const renderDoc = (doc, diagram2, parentId, altBkg, root, domDocument, diagObj)
   stateInfo.height = stateBox.height + 2 * conf.padding;
   log.debug("Doc rendered", stateInfo, graph);
   return stateInfo;
-};
-const renderer = {
+}, "renderDoc");
+var stateRenderer_default = {
   setConf,
   draw
 };
-const diagram = {
-  parser,
-  db,
-  renderer,
-  styles,
-  init: (cnf) => {
+
+// src/diagrams/state/stateDiagram.ts
+var diagram = {
+  parser: stateDiagram_default,
+  db: stateDb_default,
+  renderer: stateRenderer_default,
+  styles: styles_default,
+  init: /* @__PURE__ */ __name((cnf) => {
     if (!cnf.state) {
       cnf.state = {};
     }
     cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
-    db.clear();
-  }
+    stateDb_default.clear();
+  }, "init")
 };
 export {
   diagram

+ 34 - 0
nicegui/elements/lib/mermaid/chunks/mermaid.core/stateDiagram-v2-QXVA2PVL.mjs

@@ -0,0 +1,34 @@
+import {
+  stateDb_default,
+  stateDiagram_default,
+  stateRenderer_v3_unified_default,
+  styles_default
+} from "./chunk-SVGOEX7Z.mjs";
+import "./chunk-FUIDI54P.mjs";
+import "./chunk-Z2VRG6XP.mjs";
+import "./chunk-T3KDJ7CM.mjs";
+import "./chunk-5CZSE4TR.mjs";
+import "./chunk-TINLTEC2.mjs";
+import "./chunk-OERGPBFJ.mjs";
+import "./chunk-VKXSJROQ.mjs";
+import {
+  __name
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/diagrams/state/stateDiagram-v2.ts
+var diagram = {
+  parser: stateDiagram_default,
+  db: stateDb_default,
+  renderer: stateRenderer_v3_unified_default,
+  styles: styles_default,
+  init: /* @__PURE__ */ __name((cnf) => {
+    if (!cnf.state) {
+      cnf.state = {};
+    }
+    cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
+    stateDb_default.clear();
+  }, "init")
+};
+export {
+  diagram
+};

+ 228 - 172
nicegui/elements/lib/mermaid/timeline-definition-fd64d3c8.js → nicegui/elements/lib/mermaid/chunks/mermaid.core/timeline-definition-SFF34UE4.mjs

@@ -1,24 +1,32 @@
-import { aS as commonDb, E as clear$1, j as d3select, c as getConfig, l as log, r as setupGraphViewbox, aT as isDark, aU as lighten, aV as darken } from "./mermaid-f344f6a7.js";
-import { d as d3arc } from "./arc-8b90ddc8.js";
-import "./constant-b644328d.js";
+import {
+  __export,
+  __name,
+  clear,
+  commonDb_exports,
+  getConfig2 as getConfig,
+  log,
+  setupGraphViewbox
+} from "./chunk-O2AGWWWV.mjs";
+
+// src/diagrams/timeline/parser/timeline.jison
 var parser = function() {
-  var o = function(k, v, o2, l) {
-    for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
-      ;
+  var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
+    for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
     return o2;
-  }, $V0 = [6, 8, 10, 11, 12, 14, 16, 17, 20, 21], $V1 = [1, 9], $V2 = [1, 10], $V3 = [1, 11], $V4 = [1, 12], $V5 = [1, 13], $V6 = [1, 16], $V7 = [1, 17];
+  }, "o"), $V0 = [6, 8, 10, 11, 12, 14, 16, 17, 20, 21], $V1 = [1, 9], $V2 = [1, 10], $V3 = [1, 11], $V4 = [1, 12], $V5 = [1, 13], $V6 = [1, 16], $V7 = [1, 17];
   var parser2 = {
-    trace: function trace() {
-    },
+    trace: /* @__PURE__ */ __name(function trace() {
+    }, "trace"),
     yy: {},
     symbols_: { "error": 2, "start": 3, "timeline": 4, "document": 5, "EOF": 6, "line": 7, "SPACE": 8, "statement": 9, "NEWLINE": 10, "title": 11, "acc_title": 12, "acc_title_value": 13, "acc_descr": 14, "acc_descr_value": 15, "acc_descr_multiline_value": 16, "section": 17, "period_statement": 18, "event_statement": 19, "period": 20, "event": 21, "$accept": 0, "$end": 1 },
     terminals_: { 2: "error", 4: "timeline", 6: "EOF", 8: "SPACE", 10: "NEWLINE", 11: "title", 12: "acc_title", 13: "acc_title_value", 14: "acc_descr", 15: "acc_descr_value", 16: "acc_descr_multiline_value", 17: "section", 20: "period", 21: "event" },
     productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 1], [9, 1], [9, 1], [18, 1], [19, 1]],
-    performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
+    performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
       var $0 = $$.length - 1;
       switch (yystate) {
         case 1:
           return $$[$0 - 1];
+          break;
         case 2:
           this.$ = [];
           break;
@@ -60,10 +68,10 @@ var parser = function() {
           this.$ = $$[$0];
           break;
       }
-    },
+    }, "anonymous"),
     table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, o($V0, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: $V1, 12: $V2, 14: $V3, 16: $V4, 17: $V5, 18: 14, 19: 15, 20: $V6, 21: $V7 }, o($V0, [2, 7], { 1: [2, 1] }), o($V0, [2, 3]), { 9: 18, 11: $V1, 12: $V2, 14: $V3, 16: $V4, 17: $V5, 18: 14, 19: 15, 20: $V6, 21: $V7 }, o($V0, [2, 5]), o($V0, [2, 6]), o($V0, [2, 8]), { 13: [1, 19] }, { 15: [1, 20] }, o($V0, [2, 11]), o($V0, [2, 12]), o($V0, [2, 13]), o($V0, [2, 14]), o($V0, [2, 15]), o($V0, [2, 16]), o($V0, [2, 4]), o($V0, [2, 9]), o($V0, [2, 10])],
     defaultActions: {},
-    parseError: function parseError(str, hash) {
+    parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
       if (hash.recoverable) {
         this.trace(str);
       } else {
@@ -71,9 +79,9 @@ var parser = function() {
         error.hash = hash;
         throw error;
       }
-    },
-    parse: function parse(input) {
-      var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
+    }, "parseError"),
+    parse: /* @__PURE__ */ __name(function parse(input) {
+      var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
       var args = lstack.slice.call(arguments, 1);
       var lexer2 = Object.create(this.lexer);
       var sharedState = { yy: {} };
@@ -96,6 +104,12 @@ var parser = function() {
       } else {
         this.parseError = Object.getPrototypeOf(this).parseError;
       }
+      function popStack(n) {
+        stack.length = stack.length - 2 * n;
+        vstack.length = vstack.length - n;
+        lstack.length = lstack.length - n;
+      }
+      __name(popStack, "popStack");
       function lex() {
         var token;
         token = tstack.pop() || lexer2.lex() || EOF;
@@ -108,7 +122,8 @@ var parser = function() {
         }
         return token;
       }
-      var symbol, state, action, r, yyval = {}, p, len, newState, expected;
+      __name(lex, "lex");
+      var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
       while (true) {
         state = stack[stack.length - 1];
         if (this.defaultActions[state]) {
@@ -150,11 +165,17 @@ var parser = function() {
             lstack.push(lexer2.yylloc);
             stack.push(action[1]);
             symbol = null;
-            {
+            if (!preErrorSymbol) {
               yyleng = lexer2.yyleng;
               yytext = lexer2.yytext;
               yylineno = lexer2.yylineno;
               yyloc = lexer2.yylloc;
+              if (recovering > 0) {
+                recovering--;
+              }
+            } else {
+              symbol = preErrorSymbol;
+              preErrorSymbol = null;
             }
             break;
           case 2:
@@ -200,20 +221,20 @@ var parser = function() {
         }
       }
       return true;
-    }
+    }, "parse")
   };
-  var lexer = function() {
+  var lexer = /* @__PURE__ */ function() {
     var lexer2 = {
       EOF: 1,
-      parseError: function parseError(str, hash) {
+      parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
         if (this.yy.parser) {
           this.yy.parser.parseError(str, hash);
         } else {
           throw new Error(str);
         }
-      },
+      }, "parseError"),
       // resets the lexer, sets new input
-      setInput: function(input, yy) {
+      setInput: /* @__PURE__ */ __name(function(input, yy) {
         this.yy = yy || this.yy || {};
         this._input = input;
         this._more = this._backtrack = this.done = false;
@@ -231,9 +252,9 @@ var parser = function() {
         }
         this.offset = 0;
         return this;
-      },
+      }, "setInput"),
       // consumes and returns one char from the input
-      input: function() {
+      input: /* @__PURE__ */ __name(function() {
         var ch = this._input[0];
         this.yytext += ch;
         this.yyleng++;
@@ -252,9 +273,9 @@ var parser = function() {
         }
         this._input = this._input.slice(1);
         return ch;
-      },
+      }, "input"),
       // unshifts one char (or a string) into the input
-      unput: function(ch) {
+      unput: /* @__PURE__ */ __name(function(ch) {
         var len = ch.length;
         var lines = ch.split(/(?:\r\n?|\n)/g);
         this._input = ch + this._input;
@@ -278,14 +299,14 @@ var parser = function() {
         }
         this.yyleng = this.yytext.length;
         return this;
-      },
+      }, "unput"),
       // When called from action, caches matched text and appends it on next action
-      more: function() {
+      more: /* @__PURE__ */ __name(function() {
         this._more = true;
         return this;
-      },
+      }, "more"),
       // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
-      reject: function() {
+      reject: /* @__PURE__ */ __name(function() {
         if (this.options.backtrack_lexer) {
           this._backtrack = true;
         } else {
@@ -296,32 +317,32 @@ var parser = function() {
           });
         }
         return this;
-      },
+      }, "reject"),
       // retain first n characters of the match
-      less: function(n) {
+      less: /* @__PURE__ */ __name(function(n) {
         this.unput(this.match.slice(n));
-      },
+      }, "less"),
       // displays already matched input, i.e. for error messages
-      pastInput: function() {
+      pastInput: /* @__PURE__ */ __name(function() {
         var past = this.matched.substr(0, this.matched.length - this.match.length);
         return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
-      },
+      }, "pastInput"),
       // displays upcoming input, i.e. for error messages
-      upcomingInput: function() {
+      upcomingInput: /* @__PURE__ */ __name(function() {
         var next = this.match;
         if (next.length < 20) {
           next += this._input.substr(0, 20 - next.length);
         }
         return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
-      },
+      }, "upcomingInput"),
       // displays the character position where the lexing error occurred, i.e. for error messages
-      showPosition: function() {
+      showPosition: /* @__PURE__ */ __name(function() {
         var pre = this.pastInput();
         var c = new Array(pre.length + 1).join("-");
         return pre + this.upcomingInput() + "\n" + c + "^";
-      },
+      }, "showPosition"),
       // test the lexed token: return FALSE when not a match, otherwise return token
-      test_match: function(match, indexed_rule) {
+      test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
         var token, lines, backup;
         if (this.options.backtrack_lexer) {
           backup = {
@@ -382,9 +403,9 @@ var parser = function() {
           return false;
         }
         return false;
-      },
+      }, "test_match"),
       // return next match in input
-      next: function() {
+      next: /* @__PURE__ */ __name(function() {
         if (this.done) {
           return this.EOF;
         }
@@ -433,56 +454,57 @@ var parser = function() {
             line: this.yylineno
           });
         }
-      },
+      }, "next"),
       // return next match that has a token
-      lex: function lex() {
+      lex: /* @__PURE__ */ __name(function lex() {
         var r = this.next();
         if (r) {
           return r;
         } else {
           return this.lex();
         }
-      },
+      }, "lex"),
       // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
-      begin: function begin(condition) {
+      begin: /* @__PURE__ */ __name(function begin(condition) {
         this.conditionStack.push(condition);
-      },
+      }, "begin"),
       // pop the previously active lexer condition state off the condition stack
-      popState: function popState() {
+      popState: /* @__PURE__ */ __name(function popState() {
         var n = this.conditionStack.length - 1;
         if (n > 0) {
           return this.conditionStack.pop();
         } else {
           return this.conditionStack[0];
         }
-      },
+      }, "popState"),
       // produce the lexer rule set which is active for the currently active lexer condition state
-      _currentRules: function _currentRules() {
+      _currentRules: /* @__PURE__ */ __name(function _currentRules() {
         if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
           return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
         } else {
           return this.conditions["INITIAL"].rules;
         }
-      },
+      }, "_currentRules"),
       // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
-      topState: function topState(n) {
+      topState: /* @__PURE__ */ __name(function topState(n) {
         n = this.conditionStack.length - 1 - Math.abs(n || 0);
         if (n >= 0) {
           return this.conditionStack[n];
         } else {
           return "INITIAL";
         }
-      },
+      }, "topState"),
       // alias for begin(condition)
-      pushState: function pushState(condition) {
+      pushState: /* @__PURE__ */ __name(function pushState(condition) {
         this.begin(condition);
-      },
+      }, "pushState"),
       // return the number of states currently on the stack
-      stateStackSize: function stateStackSize() {
+      stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
         return this.conditionStack.length;
-      },
+      }, "stateStackSize"),
       options: { "case-insensitive": true },
-      performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
+      performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
+        var YYSTATE = YY_START;
         switch ($avoiding_name_collisions) {
           case 0:
             break;
@@ -490,26 +512,33 @@ var parser = function() {
             break;
           case 2:
             return 10;
+            break;
           case 3:
             break;
           case 4:
             break;
           case 5:
             return 4;
+            break;
           case 6:
             return 11;
+            break;
           case 7:
             this.begin("acc_title");
             return 12;
+            break;
           case 8:
             this.popState();
             return "acc_title_value";
+            break;
           case 9:
             this.begin("acc_descr");
             return 14;
+            break;
           case 10:
             this.popState();
             return "acc_descr_value";
+            break;
           case 11:
             this.begin("acc_descr_multiline");
             break;
@@ -518,19 +547,25 @@ var parser = function() {
             break;
           case 13:
             return "acc_descr_multiline_value";
+            break;
           case 14:
             return 17;
+            break;
           case 15:
             return 21;
+            break;
           case 16:
             return 20;
+            break;
           case 17:
             return 6;
+            break;
           case 18:
             return "INVALID";
+            break;
         }
-      },
-      rules: [/^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:timeline\b)/i, /^(?:title\s[^#\n;]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:section\s[^#:\n;]+)/i, /^(?::\s[^#:\n;]+)/i, /^(?:[^#:\n;]+)/i, /^(?:$)/i, /^(?:.)/i],
+      }, "anonymous"),
+      rules: [/^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:timeline\b)/i, /^(?:title\s[^\n]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:section\s[^:\n]+)/i, /^(?::\s[^:\n]+)/i, /^(?:[^#:\n]+)/i, /^(?:$)/i, /^(?:.)/i],
       conditions: { "acc_descr_multiline": { "rules": [12, 13], "inclusive": false }, "acc_descr": { "rules": [10], "inclusive": false }, "acc_title": { "rules": [8], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18], "inclusive": true } }
     };
     return lexer2;
@@ -539,33 +574,48 @@ var parser = function() {
   function Parser() {
     this.yy = {};
   }
+  __name(Parser, "Parser");
   Parser.prototype = parser2;
   parser2.Parser = Parser;
   return new Parser();
 }();
 parser.parser = parser;
-const parser$1 = parser;
-let currentSection = "";
-let currentTaskId = 0;
-const sections = [];
-const tasks = [];
-const rawTasks = [];
-const getCommonDb = () => commonDb;
-const clear = function() {
+var timeline_default = parser;
+
+// src/diagrams/timeline/timelineDb.js
+var timelineDb_exports = {};
+__export(timelineDb_exports, {
+  addEvent: () => addEvent,
+  addSection: () => addSection,
+  addTask: () => addTask,
+  addTaskOrg: () => addTaskOrg,
+  clear: () => clear2,
+  default: () => timelineDb_default,
+  getCommonDb: () => getCommonDb,
+  getSections: () => getSections,
+  getTasks: () => getTasks
+});
+var currentSection = "";
+var currentTaskId = 0;
+var sections = [];
+var tasks = [];
+var rawTasks = [];
+var getCommonDb = /* @__PURE__ */ __name(() => commonDb_exports, "getCommonDb");
+var clear2 = /* @__PURE__ */ __name(function() {
   sections.length = 0;
   tasks.length = 0;
   currentSection = "";
   rawTasks.length = 0;
-  clear$1();
-};
-const addSection = function(txt) {
+  clear();
+}, "clear");
+var addSection = /* @__PURE__ */ __name(function(txt) {
   currentSection = txt;
   sections.push(txt);
-};
-const getSections = function() {
+}, "addSection");
+var getSections = /* @__PURE__ */ __name(function() {
   return sections;
-};
-const getTasks = function() {
+}, "getSections");
+var getTasks = /* @__PURE__ */ __name(function() {
   let allItemsProcessed = compileTasks();
   const maxDepth = 100;
   let iterationCount = 0;
@@ -575,8 +625,8 @@ const getTasks = function() {
   }
   tasks.push(...rawTasks);
   return tasks;
-};
-const addTask = function(period, length, event) {
+}, "getTasks");
+var addTask = /* @__PURE__ */ __name(function(period, length, event) {
   const rawTask = {
     id: currentTaskId++,
     section: currentSection,
@@ -587,12 +637,12 @@ const addTask = function(period, length, event) {
     events: event ? [event] : []
   };
   rawTasks.push(rawTask);
-};
-const addEvent = function(event) {
+}, "addTask");
+var addEvent = /* @__PURE__ */ __name(function(event) {
   const currentTask = rawTasks.find((task) => task.id === currentTaskId - 1);
   currentTask.events.push(event);
-};
-const addTaskOrg = function(descr) {
+}, "addEvent");
+var addTaskOrg = /* @__PURE__ */ __name(function(descr) {
   const newTask = {
     section: currentSection,
     type: currentSection,
@@ -601,20 +651,20 @@ const addTaskOrg = function(descr) {
     classes: []
   };
   tasks.push(newTask);
-};
-const compileTasks = function() {
-  const compileTask = function(pos) {
+}, "addTaskOrg");
+var compileTasks = /* @__PURE__ */ __name(function() {
+  const compileTask = /* @__PURE__ */ __name(function(pos) {
     return rawTasks[pos].processed;
-  };
+  }, "compileTask");
   let allProcessed = true;
   for (const [i, rawTask] of rawTasks.entries()) {
     compileTask(i);
     allProcessed = allProcessed && rawTask.processed;
   }
   return allProcessed;
-};
-const timelineDb = {
-  clear,
+}, "compileTasks");
+var timelineDb_default = {
+  clear: clear2,
   getCommonDb,
   addSection,
   getSections,
@@ -623,20 +673,14 @@ const timelineDb = {
   addTaskOrg,
   addEvent
 };
-const db = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
-  __proto__: null,
-  addEvent,
-  addSection,
-  addTask,
-  addTaskOrg,
-  clear,
-  default: timelineDb,
-  getCommonDb,
-  getSections,
-  getTasks
-}, Symbol.toStringTag, { value: "Module" }));
-const MAX_SECTIONS = 12;
-const drawRect = function(elem, rectData) {
+
+// src/diagrams/timeline/timelineRenderer.ts
+import { select as select2 } from "d3";
+
+// src/diagrams/timeline/svgDraw.js
+import { arc as d3arc, select } from "d3";
+var MAX_SECTIONS = 12;
+var drawRect = /* @__PURE__ */ __name(function(elem, rectData) {
   const rectElem = elem.append("rect");
   rectElem.attr("x", rectData.x);
   rectElem.attr("y", rectData.y);
@@ -650,8 +694,8 @@ const drawRect = function(elem, rectData) {
     rectElem.attr("class", rectData.class);
   }
   return rectElem;
-};
-const drawFace = function(element, faceData) {
+}, "drawRect");
+var drawFace = /* @__PURE__ */ __name(function(element, faceData) {
   const radius = 15;
   const circleElement = element.append("circle").attr("cx", faceData.cx).attr("cy", faceData.cy).attr("class", "face").attr("r", radius).attr("stroke-width", 2).attr("overflow", "visible");
   const face = element.append("g");
@@ -661,13 +705,16 @@ const drawFace = function(element, faceData) {
     const arc = d3arc().startAngle(Math.PI / 2).endAngle(3 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2);
     face2.append("path").attr("class", "mouth").attr("d", arc).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 2) + ")");
   }
+  __name(smile, "smile");
   function sad(face2) {
     const arc = d3arc().startAngle(3 * Math.PI / 2).endAngle(5 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2);
     face2.append("path").attr("class", "mouth").attr("d", arc).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 7) + ")");
   }
+  __name(sad, "sad");
   function ambivalent(face2) {
     face2.append("line").attr("class", "mouth").attr("stroke", 2).attr("x1", faceData.cx - 5).attr("y1", faceData.cy + 7).attr("x2", faceData.cx + 5).attr("y2", faceData.cy + 7).attr("class", "mouth").attr("stroke-width", "1px").attr("stroke", "#666");
   }
+  __name(ambivalent, "ambivalent");
   if (faceData.score > 3) {
     smile(face);
   } else if (faceData.score < 3) {
@@ -676,8 +723,8 @@ const drawFace = function(element, faceData) {
     ambivalent(face);
   }
   return circleElement;
-};
-const drawCircle = function(element, circleData) {
+}, "drawFace");
+var drawCircle = /* @__PURE__ */ __name(function(element, circleData) {
   const circleElement = element.append("circle");
   circleElement.attr("cx", circleData.cx);
   circleElement.attr("cy", circleData.cy);
@@ -692,8 +739,8 @@ const drawCircle = function(element, circleData) {
     circleElement.append("title").text(circleData.title);
   }
   return circleElement;
-};
-const drawText = function(elem, textData) {
+}, "drawCircle");
+var drawText = /* @__PURE__ */ __name(function(elem, textData) {
   const nText = textData.text.replace(/<br\s*\/?>/gi, " ");
   const textElem = elem.append("text");
   textElem.attr("x", textData.x);
@@ -707,19 +754,20 @@ const drawText = function(elem, textData) {
   span.attr("x", textData.x + textData.textMargin * 2);
   span.text(nText);
   return textElem;
-};
-const drawLabel = function(elem, txtObject) {
+}, "drawText");
+var drawLabel = /* @__PURE__ */ __name(function(elem, txtObject) {
   function genPoints(x, y, width, height, cut) {
     return x + "," + y + " " + (x + width) + "," + y + " " + (x + width) + "," + (y + height - cut) + " " + (x + width - cut * 1.2) + "," + (y + height) + " " + x + "," + (y + height);
   }
+  __name(genPoints, "genPoints");
   const polygon = elem.append("polygon");
   polygon.attr("points", genPoints(txtObject.x, txtObject.y, 50, 20, 7));
   polygon.attr("class", "labelBox");
   txtObject.y = txtObject.y + txtObject.labelMargin;
   txtObject.x = txtObject.x + 0.5 * txtObject.labelMargin;
   drawText(elem, txtObject);
-};
-const drawSection = function(elem, section, conf) {
+}, "drawLabel");
+var drawSection = /* @__PURE__ */ __name(function(elem, section, conf) {
   const g = elem.append("g");
   const rect = getNoteRect();
   rect.x = section.x;
@@ -742,9 +790,9 @@ const drawSection = function(elem, section, conf) {
     conf,
     section.colour
   );
-};
-let taskCount = -1;
-const drawTask = function(elem, task, conf) {
+}, "drawSection");
+var taskCount = -1;
+var drawTask = /* @__PURE__ */ __name(function(elem, task, conf) {
   const center = task.x + conf.width / 2;
   const g = elem.append("g");
   taskCount++;
@@ -765,7 +813,6 @@ const drawTask = function(elem, task, conf) {
   rect.rx = 3;
   rect.ry = 3;
   drawRect(g, rect);
-  task.x + 14;
   _drawTextCandidateFunc(conf)(
     task.task,
     g,
@@ -777,8 +824,8 @@ const drawTask = function(elem, task, conf) {
     conf,
     task.colour
   );
-};
-const drawBackgroundRect = function(elem, bounds) {
+}, "drawTask");
+var drawBackgroundRect = /* @__PURE__ */ __name(function(elem, bounds) {
   const rectElem = drawRect(elem, {
     x: bounds.startx,
     y: bounds.starty,
@@ -788,8 +835,8 @@ const drawBackgroundRect = function(elem, bounds) {
     class: "rect"
   });
   rectElem.lower();
-};
-const getTextObj = function() {
+}, "drawBackgroundRect");
+var getTextObj = /* @__PURE__ */ __name(function() {
   return {
     x: 0,
     y: 0,
@@ -801,8 +848,8 @@ const getTextObj = function() {
     rx: 0,
     ry: 0
   };
-};
-const getNoteRect = function() {
+}, "getTextObj");
+var getNoteRect = /* @__PURE__ */ __name(function() {
   return {
     x: 0,
     y: 0,
@@ -812,12 +859,13 @@ const getNoteRect = function() {
     rx: 0,
     ry: 0
   };
-};
-const _drawTextCandidateFunc = function() {
+}, "getNoteRect");
+var _drawTextCandidateFunc = /* @__PURE__ */ function() {
   function byText(content, g, x, y, width, height, textAttrs, colour) {
     const text = g.append("text").attr("x", x + width / 2).attr("y", y + height / 2 + 5).style("font-color", colour).style("text-anchor", "middle").text(content);
     _setTextAttrs(text, textAttrs);
   }
+  __name(byText, "byText");
   function byTspan(content, g, x, y, width, height, textAttrs, conf, colour) {
     const { taskFontSize, taskFontFamily } = conf;
     const lines = content.split(/<br\s*\/?>/gi);
@@ -829,6 +877,7 @@ const _drawTextCandidateFunc = function() {
       _setTextAttrs(text, textAttrs);
     }
   }
+  __name(byTspan, "byTspan");
   function byFo(content, g, x, y, width, height, textAttrs, conf) {
     const body = g.append("switch");
     const f = body.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height).attr("position", "fixed");
@@ -837,6 +886,7 @@ const _drawTextCandidateFunc = function() {
     byTspan(content, body, x, y, width, height, textAttrs, conf);
     _setTextAttrs(text, textAttrs);
   }
+  __name(byFo, "byFo");
   function _setTextAttrs(toText, fromTextAttrsDict) {
     for (const key in fromTextAttrsDict) {
       if (key in fromTextAttrsDict) {
@@ -844,16 +894,17 @@ const _drawTextCandidateFunc = function() {
       }
     }
   }
+  __name(_setTextAttrs, "_setTextAttrs");
   return function(conf) {
     return conf.textPlacement === "fo" ? byFo : conf.textPlacement === "old" ? byText : byTspan;
   };
 }();
-const initGraphics = function(graphics) {
+var initGraphics = /* @__PURE__ */ __name(function(graphics) {
   graphics.append("defs").append("marker").attr("id", "arrowhead").attr("refX", 5).attr("refY", 2).attr("markerWidth", 6).attr("markerHeight", 4).attr("orient", "auto").append("path").attr("d", "M 0,0 V 4 L6,2 Z");
-};
+}, "initGraphics");
 function wrap(text, width) {
   text.each(function() {
-    var text2 = d3select(this), words = text2.text().split(/(\s+|<br>)/).reverse(), word, line = [], lineHeight = 1.1, y = text2.attr("y"), dy = parseFloat(text2.attr("dy")), tspan = text2.text(null).append("tspan").attr("x", 0).attr("y", y).attr("dy", dy + "em");
+    var text2 = select(this), words = text2.text().split(/(\s+|<br>)/).reverse(), word, line = [], lineHeight = 1.1, y = text2.attr("y"), dy = parseFloat(text2.attr("dy")), tspan = text2.text(null).append("tspan").attr("x", 0).attr("y", y).attr("dy", dy + "em");
     for (let j = 0; j < words.length; j++) {
       word = words[words.length - 1 - j];
       line.push(word);
@@ -871,7 +922,8 @@ function wrap(text, width) {
     }
   });
 }
-const drawNode = function(elem, node, fullSection, conf) {
+__name(wrap, "wrap");
+var drawNode = /* @__PURE__ */ __name(function(elem, node, fullSection, conf) {
   const section = fullSection % MAX_SECTIONS - 1;
   const nodeElem = elem.append("g");
   node.section = section;
@@ -883,31 +935,31 @@ const drawNode = function(elem, node, fullSection, conf) {
   const textElem = nodeElem.append("g");
   const txt = textElem.append("text").text(node.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(wrap, node.width);
   const bbox = txt.node().getBBox();
-  const fontSize = conf.fontSize && conf.fontSize.replace ? conf.fontSize.replace("px", "") : conf.fontSize;
+  const fontSize = conf.fontSize?.replace ? conf.fontSize.replace("px", "") : conf.fontSize;
   node.height = bbox.height + fontSize * 1.1 * 0.5 + node.padding;
   node.height = Math.max(node.height, node.maxHeight);
   node.width = node.width + 2 * node.padding;
   textElem.attr("transform", "translate(" + node.width / 2 + ", " + node.padding / 2 + ")");
-  defaultBkg(bkgElem, node, section);
+  defaultBkg(bkgElem, node, section, conf);
   return node;
-};
-const getVirtualNodeHeight = function(elem, node, conf) {
+}, "drawNode");
+var getVirtualNodeHeight = /* @__PURE__ */ __name(function(elem, node, conf) {
   const textElem = elem.append("g");
   const txt = textElem.append("text").text(node.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(wrap, node.width);
   const bbox = txt.node().getBBox();
-  const fontSize = conf.fontSize && conf.fontSize.replace ? conf.fontSize.replace("px", "") : conf.fontSize;
+  const fontSize = conf.fontSize?.replace ? conf.fontSize.replace("px", "") : conf.fontSize;
   textElem.remove();
   return bbox.height + fontSize * 1.1 * 0.5 + node.padding;
-};
-const defaultBkg = function(elem, node, section) {
+}, "getVirtualNodeHeight");
+var defaultBkg = /* @__PURE__ */ __name(function(elem, node, section) {
   const rd = 5;
   elem.append("path").attr("id", "node-" + node.id).attr("class", "node-bkg node-" + node.type).attr(
     "d",
     `M0 ${node.height - rd} v${-node.height + 2 * rd} q0,-5 5,-5 h${node.width - 2 * rd} q5,0 5,5 v${node.height - rd} H0 Z`
   );
   elem.append("line").attr("class", "node-line-" + section).attr("x1", 0).attr("y1", node.height).attr("x2", node.width).attr("y2", node.height);
-};
-const svgDraw = {
+}, "defaultBkg");
+var svgDraw_default = {
   drawRect,
   drawCircle,
   drawSection,
@@ -921,23 +973,24 @@ const svgDraw = {
   drawNode,
   getVirtualNodeHeight
 };
-const draw = function(text, id, version, diagObj) {
-  var _a, _b;
+
+// src/diagrams/timeline/timelineRenderer.ts
+var draw = /* @__PURE__ */ __name(function(text, id, version, diagObj) {
   const conf = getConfig();
   const LEFT_MARGIN = conf.leftMargin ?? 50;
   log.debug("timeline", diagObj.db);
   const securityLevel = conf.securityLevel;
   let sandboxElement;
   if (securityLevel === "sandbox") {
-    sandboxElement = d3select("#i" + id);
+    sandboxElement = select2("#i" + id);
   }
-  const root = securityLevel === "sandbox" ? d3select(sandboxElement.nodes()[0].contentDocument.body) : d3select("body");
+  const root = securityLevel === "sandbox" ? select2(sandboxElement.nodes()[0].contentDocument.body) : select2("body");
   const svg = root.select("#" + id);
   svg.append("g");
   const tasks2 = diagObj.db.getTasks();
   const title = diagObj.db.getCommonDb().getDiagramTitle();
   log.debug("task", tasks2);
-  svgDraw.initGraphics(svg);
+  svgDraw_default.initGraphics(svg);
   const sections2 = diagObj.db.getSections();
   log.debug("sections", sections2);
   let maxSectionHeight = 0;
@@ -958,7 +1011,7 @@ const draw = function(text, id, version, diagObj) {
       padding: 20,
       maxHeight: maxSectionHeight
     };
-    const sectionHeight = svgDraw.getVirtualNodeHeight(svg, sectionNode, conf);
+    const sectionHeight = svgDraw_default.getVirtualNodeHeight(svg, sectionNode, conf);
     log.debug("sectionHeight before draw", sectionHeight);
     maxSectionHeight = Math.max(maxSectionHeight, sectionHeight + 20);
   });
@@ -974,13 +1027,12 @@ const draw = function(text, id, version, diagObj) {
       padding: 20,
       maxHeight: maxTaskHeight
     };
-    const taskHeight = svgDraw.getVirtualNodeHeight(svg, taskNode, conf);
+    const taskHeight = svgDraw_default.getVirtualNodeHeight(svg, taskNode, conf);
     log.debug("taskHeight before draw", taskHeight);
     maxTaskHeight = Math.max(maxTaskHeight, taskHeight + 20);
     maxEventCount = Math.max(maxEventCount, task.events.length);
     let maxEventLineLengthTemp = 0;
-    for (let j = 0; j < task.events.length; j++) {
-      const event = task.events[j];
+    for (const event of task.events) {
       const eventNode = {
         descr: event,
         section: task.section,
@@ -989,7 +1041,7 @@ const draw = function(text, id, version, diagObj) {
         padding: 20,
         maxHeight: 50
       };
-      maxEventLineLengthTemp += svgDraw.getVirtualNodeHeight(svg, eventNode, conf);
+      maxEventLineLengthTemp += svgDraw_default.getVirtualNodeHeight(svg, eventNode, conf);
     }
     maxEventLineLength = Math.max(maxEventLineLength, maxEventLineLengthTemp);
   }
@@ -1008,7 +1060,7 @@ const draw = function(text, id, version, diagObj) {
       };
       log.debug("sectionNode", sectionNode);
       const sectionNodeWrapper = svg.append("g");
-      const node = svgDraw.drawNode(sectionNodeWrapper, sectionNode, sectionNumber, conf);
+      const node = svgDraw_default.drawNode(sectionNodeWrapper, sectionNode, sectionNumber, conf);
       log.debug("sectionNode output", node);
       sectionNodeWrapper.attr("transform", `translate(${masterX}, ${sectionBeginY})`);
       masterY += maxSectionHeight + 50;
@@ -1058,12 +1110,11 @@ const draw = function(text, id, version, diagObj) {
   setupGraphViewbox(
     void 0,
     svg,
-    ((_a = conf.timeline) == null ? void 0 : _a.padding) ?? 50,
-    ((_b = conf.timeline) == null ? void 0 : _b.useMaxWidth) ?? false
+    conf.timeline?.padding ?? 50,
+    conf.timeline?.useMaxWidth ?? false
   );
-};
-const drawTasks = function(diagram2, tasks2, sectionColor, masterX, masterY, maxTaskHeight, conf, maxEventCount, maxEventLineLength, maxSectionHeight, isWithoutSections) {
-  var _a;
+}, "draw");
+var drawTasks = /* @__PURE__ */ __name(function(diagram2, tasks2, sectionColor, masterX, masterY, maxTaskHeight, conf, maxEventCount, maxEventLineLength, maxSectionHeight, isWithoutSections) {
   for (const task of tasks2) {
     const taskNode = {
       descr: task.task,
@@ -1075,7 +1126,7 @@ const drawTasks = function(diagram2, tasks2, sectionColor, masterX, masterY, max
     };
     log.debug("taskNode", taskNode);
     const taskWrapper = diagram2.append("g").attr("class", "taskWrapper");
-    const node = svgDraw.drawNode(taskWrapper, taskNode, sectionColor, conf);
+    const node = svgDraw_default.drawNode(taskWrapper, taskNode, sectionColor, conf);
     const taskHeight = node.height;
     log.debug("taskHeight after draw", taskHeight);
     taskWrapper.attr("transform", `translate(${masterX}, ${masterY})`);
@@ -1092,13 +1143,13 @@ const drawTasks = function(diagram2, tasks2, sectionColor, masterX, masterY, max
       ).attr("stroke-width", 2).attr("stroke", "black").attr("marker-end", "url(#arrowhead)").attr("stroke-dasharray", "5,5");
     }
     masterX = masterX + 200;
-    if (isWithoutSections && !((_a = conf.timeline) == null ? void 0 : _a.disableMulticolor)) {
+    if (isWithoutSections && !conf.timeline?.disableMulticolor) {
       sectionColor++;
     }
   }
   masterY = masterY - 10;
-};
-const drawEvents = function(diagram2, events, sectionColor, masterX, masterY, conf) {
+}, "drawTasks");
+var drawEvents = /* @__PURE__ */ __name(function(diagram2, events, sectionColor, masterX, masterY, conf) {
   let maxEventHeight = 0;
   const eventBeginY = masterY;
   masterY = masterY + 100;
@@ -1113,7 +1164,7 @@ const drawEvents = function(diagram2, events, sectionColor, masterX, masterY, co
     };
     log.debug("eventNode", eventNode);
     const eventWrapper = diagram2.append("g").attr("class", "eventWrapper");
-    const node = svgDraw.drawNode(eventWrapper, eventNode, sectionColor, conf);
+    const node = svgDraw_default.drawNode(eventWrapper, eventNode, sectionColor, conf);
     const eventHeight = node.height;
     maxEventHeight = maxEventHeight + eventHeight;
     eventWrapper.attr("transform", `translate(${masterX}, ${masterY})`);
@@ -1121,13 +1172,16 @@ const drawEvents = function(diagram2, events, sectionColor, masterX, masterY, co
   }
   masterY = eventBeginY;
   return maxEventHeight;
-};
-const renderer = {
-  setConf: () => {
-  },
+}, "drawEvents");
+var timelineRenderer_default = {
+  setConf: /* @__PURE__ */ __name(() => {
+  }, "setConf"),
   draw
 };
-const genSections = (options) => {
+
+// src/diagrams/timeline/styles.js
+import { darken, lighten, isDark } from "khroma";
+var genSections = /* @__PURE__ */ __name((options) => {
   let sections2 = "";
   for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) {
     options["lineColor" + i] = options["lineColor" + i] || options["cScaleInv" + i];
@@ -1174,8 +1228,8 @@ const genSections = (options) => {
     `;
   }
   return sections2;
-};
-const getStyles = (options) => `
+}, "genSections");
+var getStyles = /* @__PURE__ */ __name((options) => `
   .edge {
     stroke-width: 3;
   }
@@ -1198,13 +1252,15 @@ const getStyles = (options) => `
   .eventWrapper  {
    filter: brightness(120%);
   }
-`;
-const styles = getStyles;
-const diagram = {
-  db,
-  renderer,
-  parser: parser$1,
-  styles
+`, "getStyles");
+var styles_default = getStyles;
+
+// src/diagrams/timeline/timeline-definition.ts
+var diagram = {
+  db: timelineDb_exports,
+  renderer: timelineRenderer_default,
+  parser: timeline_default,
+  styles: styles_default
 };
 export {
   diagram

Some files were not shown because too many files changed in this diff