@hienlh/ppm 0.9.65 → 0.9.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/web/assets/{_basePickBy-3Xe18azI.js → _basePickBy-5PGDJbfF.js} +1 -1
  3. package/dist/web/assets/{_baseUniq-Yy35llnn.js → _baseUniq-BT4Ow4Kk.js} +1 -1
  4. package/dist/web/assets/{api-settings-CgBII8jW.js → api-settings-Bn-bIxD1.js} +1 -1
  5. package/dist/web/assets/{arc-B9n1Gvb5.js → arc-BAOivWpI.js} +1 -1
  6. package/dist/web/assets/architecture-PBZL5I3N-DEO2f3VD.js +1 -0
  7. package/dist/web/assets/{architectureDiagram-2XIMDMQ5-DqAZP_F6.js → architectureDiagram-2XIMDMQ5-Z-4eN4za.js} +1 -1
  8. package/dist/web/assets/{blockDiagram-WCTKOSBZ-h3cDF2vI.js → blockDiagram-WCTKOSBZ-BCLqzhuZ.js} +1 -1
  9. package/dist/web/assets/{c4Diagram-IC4MRINW--pF1r5lr.js → c4Diagram-IC4MRINW-0Vp0Jeas.js} +1 -1
  10. package/dist/web/assets/channel-By7bn0Yq.js +1 -0
  11. package/dist/web/assets/chat-tab-onkz52iv.js +10 -0
  12. package/dist/web/assets/{chunk-4BX2VUAB-C3aZvW7B.js → chunk-4BX2VUAB-D4tOov49.js} +1 -1
  13. package/dist/web/assets/{chunk-55IACEB6-D5cABeB9.js → chunk-55IACEB6-DJ6BynZ4.js} +1 -1
  14. package/dist/web/assets/{chunk-7E7YKBS2-CkFGv6Zs.js → chunk-7E7YKBS2-CiyUJxNI.js} +1 -1
  15. package/dist/web/assets/{chunk-7R4GIKGN-Dvbyu4Zw.js → chunk-7R4GIKGN-Dv-4cAYn.js} +2 -2
  16. package/dist/web/assets/{chunk-C72U2L5F-CtqKiH4q.js → chunk-C72U2L5F-D21mS_6G.js} +1 -1
  17. package/dist/web/assets/{chunk-EGIJ26TM-Cpr87sBR.js → chunk-EGIJ26TM-DzqmU2Z7.js} +1 -1
  18. package/dist/web/assets/{chunk-FMBD7UC4-D23YVTOU.js → chunk-FMBD7UC4-DXncblvW.js} +1 -1
  19. package/dist/web/assets/{chunk-GEFDOKGD-tDjHsAUs.js → chunk-GEFDOKGD-D-pKjlVd.js} +1 -1
  20. package/dist/web/assets/chunk-GLR3WWYH-DKikpoJM.js +2 -0
  21. package/dist/web/assets/chunk-HHEYEP7N-C7vxA5i9.js +1 -0
  22. package/dist/web/assets/{chunk-JSJVCQXG-BBmymCjA.js → chunk-JSJVCQXG-99JzIdPr.js} +1 -1
  23. package/dist/web/assets/{chunk-KX2RTZJC-DP36BDiU.js → chunk-KX2RTZJC-CRq1OBZv.js} +1 -1
  24. package/dist/web/assets/{chunk-KYZI473N-Djw13C-3.js → chunk-KYZI473N-Bb0MCaIO.js} +1 -1
  25. package/dist/web/assets/{chunk-L3YUKLVL-HG_eMj_C.js → chunk-L3YUKLVL-C7qGJrfV.js} +1 -1
  26. package/dist/web/assets/{chunk-MX3YWQON-C2UEioMs.js → chunk-MX3YWQON-BpS_PtKp.js} +1 -1
  27. package/dist/web/assets/{chunk-NQ4KR5QH-DXUTQ-BL.js → chunk-NQ4KR5QH-z_blpjxi.js} +1 -1
  28. package/dist/web/assets/{chunk-O4XLMI2P-BsUWb9d0.js → chunk-O4XLMI2P-nDhi_cVu.js} +1 -1
  29. package/dist/web/assets/{chunk-OZEHJAEY-rG0P22U9.js → chunk-OZEHJAEY-BXhYx3nO.js} +1 -1
  30. package/dist/web/assets/{chunk-PQ6SQG4A-DX0xW7kO.js → chunk-PQ6SQG4A-TF58UVMU.js} +1 -1
  31. package/dist/web/assets/{chunk-PU5JKC2W-C7Gry6md.js → chunk-PU5JKC2W-ek7k4QVB.js} +1 -1
  32. package/dist/web/assets/chunk-QZHKN3VN-CYaTbeZf.js +1 -0
  33. package/dist/web/assets/{chunk-R5LLSJPH-CMY0PkRK.js → chunk-R5LLSJPH-CFwSJijQ.js} +1 -1
  34. package/dist/web/assets/{chunk-WL4C6EOR-CXuQvlyu.js → chunk-WL4C6EOR-ByUrSRin.js} +1 -1
  35. package/dist/web/assets/{chunk-XIRO2GV7-DRJEb7Zb.js → chunk-XIRO2GV7-Djlmrely.js} +1 -1
  36. package/dist/web/assets/{chunk-XPW4576I-BPEX8KhL.js → chunk-XPW4576I-BPQQBakK.js} +1 -1
  37. package/dist/web/assets/{chunk-XZSTWKYB-Cb0iqycX.js → chunk-XZSTWKYB-DxAOx4hG.js} +1 -1
  38. package/dist/web/assets/{chunk-YBOYWFTD-av5aeHLq.js → chunk-YBOYWFTD-rQG3QH5s.js} +1 -1
  39. package/dist/web/assets/classDiagram-VBA2DB6C-BA8Nj-_C.js +1 -0
  40. package/dist/web/assets/classDiagram-v2-RAHNMMFH-DjYu-6mn.js +1 -0
  41. package/dist/web/assets/clone-LRxlvnMj.js +1 -0
  42. package/dist/web/assets/code-editor-BixOXePn.js +8 -0
  43. package/dist/web/assets/{cose-bilkent-S5V4N54A-qudEiMCT.js → cose-bilkent-S5V4N54A-B_AWZsOP.js} +1 -1
  44. package/dist/web/assets/csv-parser-CNNw2RVA.js +6 -0
  45. package/dist/web/assets/{csv-preview-sx6DC51G.js → csv-preview-D2pJJj3K.js} +3 -8
  46. package/dist/web/assets/{dagre-BFcnKyBF.js → dagre-DHq9bhnd.js} +1 -1
  47. package/dist/web/assets/{dagre-KLK3FWXG-C3O-MTLf.js → dagre-KLK3FWXG-BdJr7Byp.js} +1 -1
  48. package/dist/web/assets/database-viewer-DfLe8ewt.js +2 -0
  49. package/dist/web/assets/{diagram-E7M64L7V-DxPjK7_c.js → diagram-E7M64L7V-_db4pBVA.js} +1 -1
  50. package/dist/web/assets/{diagram-IFDJBPK2-sqTog_XV.js → diagram-IFDJBPK2-xKoeuiJx.js} +1 -1
  51. package/dist/web/assets/{diagram-P4PSJMXO-hzmp0GHK.js → diagram-P4PSJMXO-C8tjJsev.js} +1 -1
  52. package/dist/web/assets/diff-viewer-eFO08m_L.js +4 -0
  53. package/dist/web/assets/dist-DIV6WgAG.js +41 -0
  54. package/dist/web/assets/{erDiagram-INFDFZHY-DLeYhAAT.js → erDiagram-INFDFZHY-BSh2z9Df.js} +1 -1
  55. package/dist/web/assets/{extension-webview-2XjXXtyy.js → extension-webview-4CL9kCKR.js} +1 -1
  56. package/dist/web/assets/{flowDiagram-PKNHOUZH-CRxlE9Sr.js → flowDiagram-PKNHOUZH-oYaovqyp.js} +1 -1
  57. package/dist/web/assets/{ganttDiagram-A5KZAMGK-BdjmoMLS.js → ganttDiagram-A5KZAMGK-DmL26q2P.js} +1 -1
  58. package/dist/web/assets/git-graph-BqeE_o17.js +1 -0
  59. package/dist/web/assets/gitGraph-HDMCJU4V-Bwna3and.js +1 -0
  60. package/dist/web/assets/{gitGraphDiagram-K3NZZRJ6-BeHSX7kk.js → gitGraphDiagram-K3NZZRJ6-CMoukSrY.js} +1 -1
  61. package/dist/web/assets/{graphlib-Duh_bWLa.js → graphlib-BcsNnGcW.js} +1 -1
  62. package/dist/web/assets/index-BWLy2h18.css +2 -0
  63. package/dist/web/assets/index-DwrCg0TN.js +30 -0
  64. package/dist/web/assets/info-3K5VOQVL-_vRxVNUm.js +1 -0
  65. package/dist/web/assets/infoDiagram-LFFYTUFH-DWwumDkq.js +2 -0
  66. package/dist/web/assets/{isEmpty-B9L-Ge-H.js → isEmpty-bnrF3Qbc.js} +1 -1
  67. package/dist/web/assets/{ishikawaDiagram-PHBUUO56-Cu0Rt1Ok.js → ishikawaDiagram-PHBUUO56-D05_LyL7.js} +1 -1
  68. package/dist/web/assets/{journeyDiagram-4ABVD52K-CgDI-UG4.js → journeyDiagram-4ABVD52K-B_L20qMe.js} +1 -1
  69. package/dist/web/assets/{kanban-definition-K7BYSVSG-h4g10UHL.js → kanban-definition-K7BYSVSG-CZ535BbZ.js} +1 -1
  70. package/dist/web/assets/keybindings-store-BNBONtSd.js +1 -0
  71. package/dist/web/assets/{line-B75-Rx70.js → line-CVvo3dRu.js} +1 -1
  72. package/dist/web/assets/{linear-Bcjv9FQt.js → linear-DP4mkX3m.js} +1 -1
  73. package/dist/web/assets/{markdown-renderer-Bb7OSpxF.js → markdown-renderer-BUqab2os.js} +5 -5
  74. package/dist/web/assets/{mermaid-parser.core-8u2leTXI.js → mermaid-parser.core-C7UwoIh6.js} +2 -2
  75. package/dist/web/assets/{mindmap-definition-YRQLILUH-BaOBwb-W.js → mindmap-definition-YRQLILUH-x0MTutJp.js} +1 -1
  76. package/dist/web/assets/{ordinal-LFEjVtwQ.js → ordinal-_K3x1fkz.js} +1 -1
  77. package/dist/web/assets/packet-RMMSAZCW-DY5PNnZU.js +1 -0
  78. package/dist/web/assets/pie-UPGHQEXC-BHncZutv.js +1 -0
  79. package/dist/web/assets/{pieDiagram-SKSYHLDU-At5Kz0KK.js → pieDiagram-SKSYHLDU-C1Gjrtzy.js} +1 -1
  80. package/dist/web/assets/{port-forwarding-tab-bD8MKumH.js → port-forwarding-tab-CfO-UJ84.js} +1 -1
  81. package/dist/web/assets/postgres-viewer-BVJZ44eU.js +13 -0
  82. package/dist/web/assets/{quadrantDiagram-337W2JSQ-CdjGIDfw.js → quadrantDiagram-337W2JSQ-C8bzJCjQ.js} +1 -1
  83. package/dist/web/assets/radar-KQ55EAFF-DH0AOkUy.js +1 -0
  84. package/dist/web/assets/{requirementDiagram-Z7DCOOCP-B9F_Cx_p.js → requirementDiagram-Z7DCOOCP-pQyah6WB.js} +1 -1
  85. package/dist/web/assets/{sankeyDiagram-WA2Y5GQK-RolPi8bU.js → sankeyDiagram-WA2Y5GQK-T6RgG-N8.js} +1 -1
  86. package/dist/web/assets/{sequenceDiagram-2WXFIKYE-DM-tMAhx.js → sequenceDiagram-2WXFIKYE-BQDJ4CVs.js} +1 -1
  87. package/dist/web/assets/settings-tab-C6hdJujW.js +1 -0
  88. package/dist/web/assets/sql-completion-provider-DM9Qov6L.js +1 -0
  89. package/dist/web/assets/sql-query-editor-OhZa4Z9F.js +3 -0
  90. package/dist/web/assets/sqlite-viewer-C8p1_jz4.js +1 -0
  91. package/dist/web/assets/{stateDiagram-RAJIS63D-C4EMl6jf.js → stateDiagram-RAJIS63D-66vhiIuk.js} +1 -1
  92. package/dist/web/assets/stateDiagram-v2-FVOUBMTO-BGVqj_g9.js +1 -0
  93. package/dist/web/assets/{terminal-tab-Cq6vQ9W9.js → terminal-tab-CaO0WnIo.js} +2 -2
  94. package/dist/web/assets/text-wrap-BWNOVswA.js +1 -0
  95. package/dist/web/assets/{timeline-definition-YZTLITO2-A4PN_Efm.js → timeline-definition-YZTLITO2-DwZqB3nn.js} +1 -1
  96. package/dist/web/assets/treemap-KZPCXAKY-B2Xkyv-K.js +1 -0
  97. package/dist/web/assets/use-monaco-theme-U9ZhfvHB.js +11 -0
  98. package/dist/web/assets/{vennDiagram-LZ73GAT5-ywK7LMaH.js → vennDiagram-LZ73GAT5-s9Z71fz-.js} +1 -1
  99. package/dist/web/assets/x-D2_KzIET.js +1 -0
  100. package/dist/web/assets/{xychartDiagram-JWTSCODW-DylHYNtJ.js → xychartDiagram-JWTSCODW-DRa_TH4B.js} +1 -1
  101. package/dist/web/index.html +9 -8
  102. package/dist/web/sw.js +1 -1
  103. package/package.json +1 -1
  104. package/src/cli/commands/bot-cmd.ts +4 -0
  105. package/src/cli/commands/db-cmd.ts +4 -3
  106. package/src/server/routes/database.ts +126 -9
  107. package/src/services/cloud.service.ts +2 -1
  108. package/src/services/database/sqlite-adapter.ts +1 -0
  109. package/src/services/db.service.ts +42 -3
  110. package/src/services/postgres.service.ts +37 -6
  111. package/src/services/sqlite.service.ts +18 -4
  112. package/src/services/table-cache.service.ts +2 -3
  113. package/src/types/database.ts +2 -0
  114. package/src/web/components/database/connection-form-dialog.tsx +17 -8
  115. package/src/web/components/database/connection-list.tsx +191 -139
  116. package/src/web/components/database/data-grid.tsx +634 -0
  117. package/src/web/components/database/database-sidebar.tsx +4 -1
  118. package/src/web/components/database/database-viewer.tsx +204 -225
  119. package/src/web/components/database/export-button.tsx +100 -0
  120. package/src/web/components/database/sql-completion-provider.ts +301 -0
  121. package/src/web/components/database/sql-query-editor.tsx +123 -0
  122. package/src/web/components/database/use-connections.ts +21 -1
  123. package/src/web/components/database/use-database.ts +59 -7
  124. package/src/web/components/editor/code-editor.tsx +224 -16
  125. package/src/web/components/sqlite/sqlite-query-editor.tsx +3 -90
  126. package/src/web/components/sqlite/sqlite-viewer.tsx +0 -2
  127. package/src/web/components/sqlite/use-sqlite.ts +1 -1
  128. package/dist/web/assets/architecture-PBZL5I3N-CFzkFKEL.js +0 -1
  129. package/dist/web/assets/channel-C2fMafck.js +0 -1
  130. package/dist/web/assets/chat-tab-CfdMDCBK.js +0 -10
  131. package/dist/web/assets/chunk-GLR3WWYH-DBdWQ3zy.js +0 -2
  132. package/dist/web/assets/chunk-HHEYEP7N-BBw_z0fW.js +0 -1
  133. package/dist/web/assets/chunk-QZHKN3VN-DFKFM_C1.js +0 -1
  134. package/dist/web/assets/classDiagram-VBA2DB6C-Dp4Kk3Yb.js +0 -1
  135. package/dist/web/assets/classDiagram-v2-RAHNMMFH-D8IvcV_B.js +0 -1
  136. package/dist/web/assets/clone-B2hUek6n.js +0 -1
  137. package/dist/web/assets/code-editor-DhCfJIpG.js +0 -2
  138. package/dist/web/assets/database-viewer-DLkAUBpm.js +0 -1
  139. package/dist/web/assets/diff-viewer-DWVWsekJ.js +0 -4
  140. package/dist/web/assets/dist-C40JmyoH.js +0 -13
  141. package/dist/web/assets/dist-DRTW9IWi.js +0 -41
  142. package/dist/web/assets/git-graph-Ds5bs1cM.js +0 -1
  143. package/dist/web/assets/gitGraph-HDMCJU4V-CNlas3Rz.js +0 -1
  144. package/dist/web/assets/index-8b0LM6IC.js +0 -30
  145. package/dist/web/assets/index-BnMECpW3.css +0 -2
  146. package/dist/web/assets/info-3K5VOQVL-BDzTLc11.js +0 -1
  147. package/dist/web/assets/infoDiagram-LFFYTUFH-ZZmpgc6t.js +0 -2
  148. package/dist/web/assets/keybindings-store-C06Z0Zhk.js +0 -1
  149. package/dist/web/assets/packet-RMMSAZCW-IVa5F-go.js +0 -1
  150. package/dist/web/assets/pie-UPGHQEXC-CvXHKAzp.js +0 -1
  151. package/dist/web/assets/postgres-viewer-C3OND65T.js +0 -1
  152. package/dist/web/assets/radar-KQ55EAFF-Z-Tr5wtS.js +0 -1
  153. package/dist/web/assets/settings-tab-cuMIkUNV.js +0 -1
  154. package/dist/web/assets/sqlite-viewer-CpjnwDtk.js +0 -1
  155. package/dist/web/assets/stateDiagram-v2-FVOUBMTO-B-UjZch3.js +0 -1
  156. package/dist/web/assets/treemap-KZPCXAKY-C9TYRE0k.js +0 -1
  157. package/dist/web/assets/use-monaco-theme-BH9sQ-Yu.js +0 -11
  158. /package/dist/web/assets/{api-client-BKIT_Qeg.js → api-client-BfBM3I7n.js} +0 -0
  159. /package/dist/web/assets/{array-DqLCdDFv.js → array-B9UHiPd-.js} +0 -0
  160. /package/dist/web/assets/{chevron-right-5HgK6l7K.js → chevron-right-4zq1jPv6.js} +0 -0
  161. /package/dist/web/assets/{columns-2-cEVJHYd7.js → columns-2-BoZAN-iw.js} +0 -0
  162. /package/dist/web/assets/{cytoscape.esm-CWPXKqbJ.js → cytoscape.esm-BW-DbntU.js} +0 -0
  163. /package/dist/web/assets/{defaultLocale-CrJzLgRD.js → defaultLocale-5eAKkKJC.js} +0 -0
  164. /package/dist/web/assets/{dist-Cep75xXf.js → dist-CSJdAyA9.js} +0 -0
  165. /package/dist/web/assets/{init-C0r9Gk5G.js → init-DlZdxViB.js} +0 -0
  166. /package/dist/web/assets/{isArrayLikeObject-CGBoxvCD.js → isArrayLikeObject-B_v2FtYn.js} +0 -0
  167. /package/dist/web/assets/{katex-DzXRfQ_m.js → katex-Bqvo_ZG0.js} +0 -0
  168. /package/dist/web/assets/{lib-mag4ySk-.js → lib-DurwGtQO.js} +0 -0
  169. /package/dist/web/assets/{math-y9zN1W-N.js → math-069Z4SuC.js} +0 -0
  170. /package/dist/web/assets/{path-DIKpVbHL.js → path-6uRLdFF7.js} +0 -0
  171. /package/dist/web/assets/{rough.esm-nHaDi0Kw.js → rough.esm-JX0wREDd.js} +0 -0
  172. /package/dist/web/assets/{src-Dw4QhedI.js → src-BqX54PbV.js} +0 -0
  173. /package/dist/web/assets/{utils-DMiycH3O.js → utils-BNytJOb1.js} +0 -0
@@ -1 +1 @@
1
- import{C as e,D as t,E as n,G as r,N as i,P as a,V as o,j as s,k as c,n as l,p as u,v as d,w as f,z as p}from"./isArrayLikeObject-CGBoxvCD.js";import{C as m,E as ee,M as h,N as te,S as ne,a as g,c as re,d as ie,f as _,i as v,m as ae,n as y,p as oe,r as b,s as x,y as se}from"./_baseUniq-Yy35llnn.js";import{a as ce,c as le,d as ue,f as S,i as de,l as C,m as w,n as T,o as fe,r as pe,s as E,t as me,u as D}from"./_basePickBy-3Xe18azI.js";import{i as he,n as ge}from"./isEmpty-B9L-Ge-H.js";import{k as O}from"./chunk-GEFDOKGD-tDjHsAUs.js";import{t as k}from"./graphlib-Duh_bWLa.js";function _e(e){return i(t(e,void 0,S),e+``)}var ve=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function ye(e){return ve.test(e)}var be=1,xe=4;function Se(e){return se(e,be|xe)}var Ce=function(){return r.Date.now()};function we(e,t){return e==null?e:l(e,re(t),u)}function Te(e,t){return e&&ie(e,re(t))}function Ee(e,t){return e>t}function A(e,t){var n={};return t=_(t,3),ie(e,function(e,r,i){s(n,r,t(e,r,i))}),n}function j(e){return e&&e.length?pe(e,p,Ee):void 0}function M(e,t){return e&&e.length?pe(e,_(t,2),de):void 0}function De(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}function Oe(e,t){if(e!==t){var n=e!==void 0,r=e===null,i=e===e,a=te(e),o=t!==void 0,s=t===null,c=t===t,l=te(t);if(!s&&!l&&!a&&e>t||a&&o&&c&&!s&&!l||r&&o&&c||!n&&c||!i)return 1;if(!r&&!a&&!l&&e<t||l&&n&&i&&!r&&!a||s&&n&&i||!o&&i||!c)return-1}return 0}function ke(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;++r<o;){var c=Oe(i[r],a[r]);if(c)return r>=s?c:c*(n[r]==`desc`?-1:1)}return e.index-t.index}function Ae(e,t,n){t=t.length?h(t,function(e){return o(e)?function(t){return m(t,e.length===1?e[0]:e)}:e}):[p];var r=-1;return t=h(t,d(_)),De(le(e,function(e,n,i){return{criteria:h(t,function(t){return t(e)}),index:++r,value:e}}),function(e,t){return ke(e,t,n)})}var je=oe(`length`),Me=`\\ud800-\\udfff`,Ne=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,Pe=`\\ufe0e\\ufe0f`,Fe=`[`+Me+`]`,N=`[`+Ne+`]`,P=`\\ud83c[\\udffb-\\udfff]`,Ie=`(?:`+N+`|`+P+`)`,Le=`[^`+Me+`]`,Re=`(?:\\ud83c[\\udde6-\\uddff]){2}`,ze=`[\\ud800-\\udbff][\\udc00-\\udfff]`,Be=`\\u200d`,Ve=Ie+`?`,He=`[`+Pe+`]?`,Ue=`(?:`+Be+`(?:`+[Le,Re,ze].join(`|`)+`)`+He+Ve+`)*`,We=He+Ve+Ue,Ge=`(?:`+[Le+N+`?`,N,Re,ze,Fe].join(`|`)+`)`,Ke=RegExp(P+`(?=`+P+`)|`+Ge+We,`g`);function qe(e){for(var t=Ke.lastIndex=0;Ke.test(e);)++t;return t}function Je(e){return ye(e)?qe(e):je(e)}function Ye(e,t){return me(e,t,function(t,n){return ae(e,n)})}var F=_e(function(e,t){return e==null?{}:Ye(e,t)}),Xe=Math.ceil,Ze=Math.max;function Qe(e,t,n,r){for(var i=-1,a=Ze(Xe((t-e)/(n||1)),0),o=Array(a);a--;)o[r?a:++i]=e,e+=n;return o}function $e(t){return function(n,r,i){return i&&typeof i!=`number`&&e(n,r,i)&&(r=i=void 0),n=w(n),r===void 0?(r=n,n=0):r=w(r),i=i===void 0?n<r?1:-1:w(i),Qe(n,r,i,t)}}var I=$e(),et=`[object Map]`,tt=`[object Set]`;function nt(e){if(e==null)return 0;if(f(e))return ce(e)?Je(e):e.length;var t=ge(e);return t==et||t==tt?e.size:he(e).length}var L=n(function(t,n){if(t==null)return[];var r=n.length;return r>1&&e(t,n[0],n[1])?n=[]:r>2&&e(n[0],n[1],n[2])&&(n=[n[0]]),Ae(t,ne(n,1),[])}),rt=0;function R(e){var t=++rt;return ee(e)+t}function it(e,t,n){for(var r=-1,i=e.length,a=t.length,o={};++r<i;){var s=r<a?t[r]:void 0;n(o,e[r],s)}return o}function at(e,t){return it(e||[],t||[],c)}var ot=class{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,t=e._prev;if(t!==e)return st(t),t}enqueue(e){var t=this._sentinel;e._prev&&e._next&&st(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){for(var e=[],t=this._sentinel,n=t._prev;n!==t;)e.push(JSON.stringify(n,ct)),n=n._prev;return`[`+e.join(`, `)+`]`}};function st(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function ct(e,t){if(e!==`_next`&&e!==`_prev`)return t}var lt=a(1);function ut(e,t){if(e.nodeCount()<=1)return[];var n=ft(e,t||lt);return S(E(dt(n.graph,n.buckets,n.zeroIdx),function(t){return e.outEdges(t.v,t.w)}))}function dt(e,t,n){for(var r=[],i=t[t.length-1],a=t[0],o;e.nodeCount();){for(;o=a.dequeue();)z(e,t,n,o);for(;o=i.dequeue();)z(e,t,n,o);if(e.nodeCount()){for(var s=t.length-2;s>0;--s)if(o=t[s].dequeue(),o){r=r.concat(z(e,t,n,o,!0));break}}}return r}function z(e,t,n,r,i){var a=i?[]:void 0;return x(e.inEdges(r.v),function(r){var o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,B(t,n,s)}),x(e.outEdges(r.v),function(r){var i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,B(t,n,o)}),e.removeNode(r.v),a}function ft(e,t){var n=new k,r=0,i=0;x(e.nodes(),function(e){n.setNode(e,{v:e,in:0,out:0})}),x(e.edges(),function(e){var a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s),i=Math.max(i,n.node(e.v).out+=o),r=Math.max(r,n.node(e.w).in+=o)});var a=I(i+r+3).map(function(){return new ot}),o=r+1;return x(n.nodes(),function(e){B(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function B(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}function pt(e){x(e.graph().acyclicer===`greedy`?ut(e,t(e)):mt(e),function(t){var n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,R(`rev`))});function t(e){return function(t){return e.edge(t).weight}}}function mt(e){var t=[],n={},r={};function i(a){Object.prototype.hasOwnProperty.call(r,a)||(r[a]=!0,n[a]=!0,x(e.outEdges(a),function(e){Object.prototype.hasOwnProperty.call(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return x(e.nodes(),i),t}function ht(e){x(e.edges(),function(t){var n=e.edge(t);if(n.reversed){e.removeEdge(t);var r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function V(e,t,n,r){var i;do i=R(r);while(e.hasNode(i));return n.dummy=t,e.setNode(i,n),i}function gt(e){var t=new k().setGraph(e.graph());return x(e.nodes(),function(n){t.setNode(n,e.node(n))}),x(e.edges(),function(n){var r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function _t(e){var t=new k({multigraph:e.isMultigraph()}).setGraph(e.graph());return x(e.nodes(),function(n){e.children(n).length||t.setNode(n,e.node(n))}),x(e.edges(),function(n){t.setEdge(n,e.edge(n))}),t}function vt(e,t){var n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);var c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function H(e){var t=E(I(St(e)+1),function(){return[]});return x(e.nodes(),function(n){var r=e.node(n),i=r.rank;b(i)||(t[i][r.order]=n)}),t}function yt(e){var t=T(E(e.nodes(),function(t){return e.node(t).rank}));x(e.nodes(),function(n){var r=e.node(n);fe(r,`rank`)&&(r.rank-=t)})}function bt(e){var t=T(E(e.nodes(),function(t){return e.node(t).rank})),n=[];x(e.nodes(),function(r){var i=e.node(r).rank-t;n[i]||(n[i]=[]),n[i].push(r)});var r=0,i=e.graph().nodeRankFactor;x(n,function(t,n){b(t)&&n%i!==0?--r:r&&x(t,function(t){e.node(t).rank+=r})})}function xt(e,t,n,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),V(e,`border`,i,t)}function St(e){return j(E(e.nodes(),function(t){var n=e.node(t).rank;if(!b(n))return n}))}function Ct(e,t){var n={lhs:[],rhs:[]};return x(e,function(e){t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function wt(e,t){var n=Ce();try{return t()}finally{console.log(e+` time: `+(Ce()-n)+`ms`)}}function Tt(e,t){return t()}function Et(e){function t(n){var r=e.children(n),i=e.node(n);if(r.length&&x(r,t),Object.prototype.hasOwnProperty.call(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,o=i.maxRank+1;a<o;++a)Dt(e,`borderLeft`,`_bl`,n,i,a),Dt(e,`borderRight`,`_br`,n,i,a)}}x(e.children(),t)}function Dt(e,t,n,r,i,a){var o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],c=V(e,`border`,o,n);i[t][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}function Ot(e){var t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&At(e)}function kt(e){var t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&jt(e),(t===`lr`||t===`rl`)&&(Mt(e),At(e))}function At(e){x(e.nodes(),function(t){U(e.node(t))}),x(e.edges(),function(t){U(e.edge(t))})}function U(e){var t=e.width;e.width=e.height,e.height=t}function jt(e){x(e.nodes(),function(t){W(e.node(t))}),x(e.edges(),function(t){var n=e.edge(t);x(n.points,W),Object.prototype.hasOwnProperty.call(n,`y`)&&W(n)})}function W(e){e.y=-e.y}function Mt(e){x(e.nodes(),function(t){G(e.node(t))}),x(e.edges(),function(t){var n=e.edge(t);x(n.points,G),Object.prototype.hasOwnProperty.call(n,`x`)&&G(n)})}function G(e){var t=e.x;e.x=e.y,e.y=t}function Nt(e){e.graph().dummyChains=[],x(e.edges(),function(t){Pt(e,t)})}function Pt(e,t){var n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a!==r+1){e.removeEdge(t);var l=void 0,u,d;for(d=0,++r;r<a;++d,++r)s.points=[],l={width:0,height:0,edgeLabel:s,edgeObj:t,rank:r},u=V(e,`edge`,l,`_d`),r===c&&(l.width=s.width,l.height=s.height,l.dummy=`edge-label`,l.labelpos=s.labelpos),e.setEdge(n,u,{weight:s.weight},o),d===0&&e.graph().dummyChains.push(u),n=u;e.setEdge(n,i,{weight:s.weight},o)}}function Ft(e){x(e.graph().dummyChains,function(t){var n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}function K(e){var t={};function n(r){var i=e.node(r);if(Object.prototype.hasOwnProperty.call(t,r))return i.rank;t[r]=!0;var a=T(E(e.outEdges(r),function(t){return n(t.w)-e.edge(t).minlen}));return(a===1/0||a==null)&&(a=0),i.rank=a}x(e.sources(),n)}function q(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}function It(e){var t=new k({directed:!1}),n=e.nodes()[0],r=e.nodeCount();t.setNode(n,{});for(var i,a;Lt(t,e)<r;)i=Rt(t,e),a=t.hasNode(i.v)?q(e,i):-q(e,i),zt(t,e,a);return t}function Lt(e,t){function n(r){x(t.nodeEdges(r),function(i){var a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!q(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return x(e.nodes(),n),e.nodeCount()}function Rt(e,t){return M(t.edges(),function(n){if(e.hasNode(n.v)!==e.hasNode(n.w))return q(t,n)})}function zt(e,t,n){x(e.nodes(),function(e){t.node(e).rank+=n})}a(1),a(1),Bt.CycleException=J;function Bt(e){var t={},n={},r=[];function i(a){if(Object.prototype.hasOwnProperty.call(n,a))throw new J;Object.prototype.hasOwnProperty.call(t,a)||(n[a]=!0,t[a]=!0,x(e.predecessors(a),i),delete n[a],r.push(a))}if(x(e.sinks(),i),nt(t)!==e.nodeCount())throw new J;return r}function J(){}J.prototype=Error();function Vt(e,t,n){o(t)||(t=[t]);var r=(e.isDirected()?e.successors:e.neighbors).bind(e),i=[],a={};return x(t,function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);Ht(e,t,n===`post`,a,r,i)}),i}function Ht(e,t,n,r,i,a){Object.prototype.hasOwnProperty.call(r,t)||(r[t]=!0,n||a.push(t),x(i(t),function(t){Ht(e,t,n,r,i,a)}),n&&a.push(t))}function Ut(e,t){return Vt(e,t,`post`)}function Wt(e,t){return Vt(e,t,`pre`)}Y.initLowLimValues=Z,Y.initCutValues=X,Y.calcCutValue=Kt,Y.leaveEdge=Jt,Y.enterEdge=Yt,Y.exchangeEdges=Xt;function Y(e){e=gt(e),K(e);var t=It(e);Z(t),X(t,e);for(var n,r;n=Jt(t);)r=Yt(t,e,n),Xt(t,e,n,r)}function X(e,t){var n=Ut(e,e.nodes());n=n.slice(0,n.length-1),x(n,function(n){Gt(e,t,n)})}function Gt(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=Kt(e,t,n)}function Kt(e,t,n){var r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;return a||=(i=!1,t.edge(r,n)),o=a.weight,x(t.nodeEdges(n),function(a){var s=a.v===n,c=s?a.w:a.v;if(c!==r){var l=s===i,u=t.edge(a).weight;if(o+=l?u:-u,Qt(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function Z(e,t){arguments.length<2&&(t=e.nodes()[0]),qt(e,{},1,t)}function qt(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,x(e.neighbors(r),function(i){Object.prototype.hasOwnProperty.call(t,i)||(n=qt(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function Jt(e){return C(e.edges(),function(t){return e.edge(t).cutvalue<0})}function Yt(e,t,n){var r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);var a=e.node(r),o=e.node(i),s=a,c=!1;return a.lim>o.lim&&(s=o,c=!0),M(g(t.edges(),function(t){return c===$t(e,e.node(t.v),s)&&c!==$t(e,e.node(t.w),s)}),function(e){return q(t,e)})}function Xt(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),Z(e),X(e,t),Zt(e,t)}function Zt(e,t){var n=Wt(e,C(e.nodes(),function(e){return!t.node(e).parent}));n=n.slice(1),x(n,function(n){var r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function Qt(e,t,n){return e.hasEdge(t,n)}function $t(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}function en(e){switch(e.graph().ranker){case`network-simplex`:rn(e);break;case`tight-tree`:nn(e);break;case`longest-path`:tn(e);break;default:rn(e)}}var tn=K;function nn(e){K(e),It(e)}function rn(e){Y(e)}function an(e){var t=V(e,`root`,{},`_root`),n=sn(e),r=j(v(n))-1,i=2*r+1;e.graph().nestingRoot=t,x(e.edges(),function(t){e.edge(t).minlen*=i});var a=cn(e)+1;x(e.children(),function(o){on(e,t,i,a,r,n,o)}),e.graph().nodeRankFactor=i}function on(e,t,n,r,i,a,o){var s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}var c=xt(e,`_bt`),l=xt(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,x(s,function(s){on(e,t,n,r,i,a,s);var u=e.node(s),d=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,p=u.borderTop?r:2*r,m=d===f?i-a[o]+1:1;e.setEdge(c,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,l,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+a[o]})}function sn(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&x(a,function(e){n(e,i+1)}),t[r]=i}return x(e.children(),function(e){n(e,1)}),t}function cn(e){return y(e.edges(),function(t,n){return t+e.edge(n).weight},0)}function ln(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,x(e.edges(),function(t){e.edge(t).nestingEdge&&e.removeEdge(t)})}function un(e,t,n){var r={},i;x(n,function(n){for(var a=e.parent(n),o,s;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}function dn(e,t,n){var r=fn(e),i=new k({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(t){return e.node(t)});return x(e.nodes(),function(a){var o=e.node(a),s=e.parent(a);(o.rank===t||o.minRank<=t&&t<=o.maxRank)&&(i.setNode(a),i.setParent(a,s||r),x(e[n](a),function(t){var n=t.v===a?t.w:t.v,r=i.edge(n,a),o=b(r)?0:r.weight;i.setEdge(n,a,{weight:e.edge(t).weight+o})}),Object.prototype.hasOwnProperty.call(o,`minRank`)&&i.setNode(a,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]}))}),i}function fn(e){for(var t;e.hasNode(t=R(`_root`)););return t}function pn(e,t){for(var n=0,r=1;r<t.length;++r)n+=mn(e,t[r-1],t[r]);return n}function mn(e,t,n){for(var r=at(n,E(n,function(e,t){return t})),i=S(E(t,function(t){return L(E(e.outEdges(t),function(t){return{pos:r[t.w],weight:e.edge(t).weight}}),`pos`)})),a=1;a<n.length;)a<<=1;var o=2*a-1;--a;var s=E(Array(o),function(){return 0}),c=0;return x(i.forEach(function(e){var t=e.pos+a;s[t]+=e.weight;for(var n=0;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*n})),c}function hn(e){var t={},n=g(e.nodes(),function(t){return!e.children(t).length}),r=E(I(j(E(n,function(t){return e.node(t).rank}))+1),function(){return[]});function i(n){fe(t,n)||(t[n]=!0,r[e.node(n).rank].push(n),x(e.successors(n),i))}return x(L(n,function(t){return e.node(t).rank}),i),r}function gn(e,t){return E(t,function(t){var n=e.inEdges(t);if(n.length){var r=y(n,function(t,n){var r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}else return{v:t}})}function _n(e,t){var n={};return x(e,function(e,t){var r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};b(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)}),x(t.edges(),function(e){var t=n[e.v],r=n[e.w];!b(t)&&!b(r)&&(r.indegree++,t.out.push(n[e.w]))}),vn(g(n,function(e){return!e.indegree}))}function vn(e){var t=[];function n(e){return function(t){t.merged||(b(t.barycenter)||b(e.barycenter)||t.barycenter>=e.barycenter)&&yn(e,t)}}function r(t){return function(n){n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){var i=e.pop();t.push(i),x(i.in.reverse(),n(i)),x(i.out,r(i))}return E(g(t,function(e){return!e.merged}),function(e){return F(e,[`vs`,`i`,`barycenter`,`weight`])})}function yn(e,t){var n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function bn(e,t){var n=Ct(e,function(e){return Object.prototype.hasOwnProperty.call(e,`barycenter`)}),r=n.lhs,i=L(n.rhs,function(e){return-e.i}),a=[],o=0,s=0,c=0;r.sort(Sn(!!t)),c=xn(a,i,c),x(r,function(e){c+=e.vs.length,a.push(e.vs),o+=e.barycenter*e.weight,s+=e.weight,c=xn(a,i,c)});var l={vs:S(a)};return s&&(l.barycenter=o/s,l.weight=s),l}function xn(e,t,n){for(var r;t.length&&(r=D(t)).i<=n;)t.pop(),e.push(r.vs),n++;return n}function Sn(e){return function(t,n){return t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}}function Cn(e,t,n,r){var i=e.children(t),a=e.node(t),o=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,c={};o&&(i=g(i,function(e){return e!==o&&e!==s}));var l=gn(e,i);x(l,function(t){if(e.children(t.v).length){var i=Cn(e,t.v,n,r);c[t.v]=i,Object.prototype.hasOwnProperty.call(i,`barycenter`)&&Tn(t,i)}});var u=_n(l,n);wn(u,c);var d=bn(u,r);if(o&&(d.vs=S([o,d.vs,s]),e.predecessors(o).length)){var f=e.node(e.predecessors(o)[0]),p=e.node(e.predecessors(s)[0]);Object.prototype.hasOwnProperty.call(d,`barycenter`)||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+f.order+p.order)/(d.weight+2),d.weight+=2}return d}function wn(e,t){x(e,function(e){e.vs=S(e.vs.map(function(e){return t[e]?t[e].vs:e}))})}function Tn(e,t){b(e.barycenter)?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function En(e){var t=St(e),n=Dn(e,I(1,t+1),`inEdges`),r=Dn(e,I(t-1,-1,-1),`outEdges`),i=hn(e);kn(e,i);for(var a=1/0,o,s=0,c=0;c<4;++s,++c){On(s%2?n:r,s%4>=2),i=H(e);var l=pn(e,i);l<a&&(c=0,o=Se(i),a=l)}kn(e,o)}function Dn(e,t,n){return E(t,function(t){return dn(e,t,n)})}function On(e,t){var n=new k;x(e,function(e){var r=e.graph().root,i=Cn(e,r,n,t);x(i.vs,function(t,n){e.node(t).order=n}),un(e,n,i.vs)})}function kn(e,t){x(t,function(t){x(t,function(t,n){e.node(t).order=n})})}function An(e){var t=Mn(e);x(e.graph().dummyChains,function(n){for(var r=e.node(n),i=r.edgeObj,a=jn(e,t,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;n!==i.w;){if(r=e.node(n),u){for(;(l=o[c])!==s&&e.node(l).maxRank<r.rank;)c++;l===s&&(u=!1)}if(!u){for(;c<o.length-1&&e.node(l=o[c+1]).minRank<=r.rank;)c++;l=o[c]}e.setParent(n,l),n=e.successors(n)[0]}})}function jn(e,t,n,r){var i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c=n,l;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));for(l=c,c=r;(c=e.parent(c))!==l;)a.push(c);return{path:i.concat(a.reverse()),lca:l}}function Mn(e){var t={},n=0;function r(i){var a=n;x(e.children(i),r),t[i]={low:a,lim:n++}}return x(e.children(),r),t}function Nn(e,t){var n={};function r(t,r){var i=0,a=0,o=t.length,s=D(r);return x(r,function(t,c){var l=Fn(e,t),u=l?e.node(l).order:o;(l||t===s)&&(x(r.slice(a,c+1),function(t){x(e.predecessors(t),function(r){var a=e.node(r),o=a.order;(o<i||u<o)&&!(a.dummy&&e.node(t).dummy)&&In(n,r,t)})}),a=c+1,i=u)}),r}return y(t,r),n}function Pn(e,t){var n={};function r(t,r,i,a,o){var s;x(I(r,i),function(r){s=t[r],e.node(s).dummy&&x(e.predecessors(s),function(t){var r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&In(n,t,s)})})}function i(t,n){var i=-1,a,o=0;return x(n,function(s,c){if(e.node(s).dummy===`border`){var l=e.predecessors(s);l.length&&(a=e.node(l[0]).order,r(n,o,c,i,a),o=c,i=a)}r(n,o,n.length,a,t.length)}),n}return y(t,i),n}function Fn(e,t){if(e.node(t).dummy)return C(e.predecessors(t),function(t){return e.node(t).dummy})}function In(e,t,n){if(t>n){var r=t;t=n,n=r}Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=e[t];Object.defineProperty(i,n,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function Ln(e,t,n){if(t>n){var r=t;t=n,n=r}return!!e[t]&&Object.prototype.hasOwnProperty.call(e[t],n)}function Rn(e,t,n,r){var i={},a={},o={};return x(t,function(e){x(e,function(e,t){i[e]=e,a[e]=e,o[e]=t})}),x(t,function(e){var t=-1;x(e,function(e){var s=r(e);if(s.length){s=L(s,function(e){return o[e]});for(var c=(s.length-1)/2,l=Math.floor(c),u=Math.ceil(c);l<=u;++l){var d=s[l];a[e]===e&&t<o[d]&&!Ln(n,e,d)&&(a[d]=e,a[e]=i[e]=i[d],t=o[d])}}})}),{root:i,align:a}}function zn(e,t,n,r,i){var a={},o=Bn(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){for(var n=o.nodes(),r=n.pop(),i={};r;)i[r]?e(r):(i[r]=!0,n.push(r),n=n.concat(t(r))),r=n.pop()}function l(e){a[e]=o.inEdges(e).reduce(function(e,t){return Math.max(e,a[t.v]+o.edge(t))},0)}function u(t){var n=o.outEdges(t).reduce(function(e,t){return Math.min(e,a[t.w]-o.edge(t))},1/0),r=e.node(t);n!==1/0&&r.borderType!==s&&(a[t]=Math.max(a[t],n))}return c(l,o.predecessors.bind(o)),c(u,o.successors.bind(o)),x(r,function(e){a[e]=a[n[e]]}),a}function Bn(e,t,n,r){var i=new k,a=e.graph(),o=Gn(a.nodesep,a.edgesep,r);return x(t,function(t){var r;x(t,function(t){var a=n[t];if(i.setNode(a),r){var s=n[r],c=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),c||0))}r=t})}),i}function Vn(e,t){return M(v(t),function(t){var n=-1/0,r=1/0;return we(t,function(t,i){var a=Kn(e,i)/2;n=Math.max(t+a,n),r=Math.min(t-a,r)}),n-r})}function Hn(e,t){var n=v(t),r=T(n),i=j(n);x([`u`,`d`],function(n){x([`l`,`r`],function(a){var o=n+a,s=e[o],c;if(s!==t){var l=v(s);c=a===`l`?r-T(l):i-j(l),c&&(e[o]=A(s,function(e){return e+c}))}})})}function Un(e,t){return A(e.ul,function(n,r){if(t)return e[t.toLowerCase()][r];var i=L(E(e,r));return(i[1]+i[2])/2})}function Wn(e){var t=H(e),n=O(Nn(e,t),Pn(e,t)),r={},i;return x([`u`,`d`],function(a){i=a===`u`?t:v(t).reverse(),x([`l`,`r`],function(t){t===`r`&&(i=E(i,function(e){return v(e).reverse()}));var o=(a===`u`?e.predecessors:e.successors).bind(e),s=Rn(e,i,n,o),c=zn(e,i,s.root,s.align,t===`r`);t===`r`&&(c=A(c,function(e){return-e})),r[a+t]=c})}),Hn(r,Vn(e,r)),Un(r,e.graph().align)}function Gn(e,t,n){return function(r,i,a){var o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.prototype.hasOwnProperty.call(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2;break}if(l&&(c+=n?l:-l),l=0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.prototype.hasOwnProperty.call(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2;break}return l&&(c+=n?l:-l),l=0,c}}function Kn(e,t){return e.node(t).width}function qn(e){e=_t(e),Jn(e),Te(Wn(e),function(t,n){e.node(n).x=t})}function Jn(e){var t=H(e),n=e.graph().ranksep,r=0;x(t,function(t){var i=j(E(t,function(t){return e.node(t).height}));x(t,function(t){e.node(t).y=r+i/2}),r+=i+n})}function Yn(e,t){var n=t&&t.debugTiming?wt:Tt;n(`layout`,()=>{var t=n(` buildLayoutGraph`,()=>or(e));n(` runLayout`,()=>Xn(t,n)),n(` updateInputGraph`,()=>Zn(e,t))})}function Xn(e,t){t(` makeSpaceForEdgeLabels`,()=>sr(e)),t(` removeSelfEdges`,()=>gr(e)),t(` acyclic`,()=>pt(e)),t(` nestingGraph.run`,()=>an(e)),t(` rank`,()=>en(_t(e))),t(` injectEdgeLabelProxies`,()=>cr(e)),t(` removeEmptyRanks`,()=>bt(e)),t(` nestingGraph.cleanup`,()=>ln(e)),t(` normalizeRanks`,()=>yt(e)),t(` assignRankMinMax`,()=>lr(e)),t(` removeEdgeLabelProxies`,()=>ur(e)),t(` normalize.run`,()=>Nt(e)),t(` parentDummyChains`,()=>An(e)),t(` addBorderSegments`,()=>Et(e)),t(` order`,()=>En(e)),t(` insertSelfEdges`,()=>_r(e)),t(` adjustCoordinateSystem`,()=>Ot(e)),t(` position`,()=>qn(e)),t(` positionSelfEdges`,()=>vr(e)),t(` removeBorderNodes`,()=>hr(e)),t(` normalize.undo`,()=>Ft(e)),t(` fixupEdgeLabelCoords`,()=>pr(e)),t(` undoCoordinateSystem`,()=>kt(e)),t(` translateGraph`,()=>dr(e)),t(` assignNodeIntersects`,()=>fr(e)),t(` reversePoints`,()=>mr(e)),t(` acyclic.undo`,()=>ht(e))}function Zn(e,t){x(e.nodes(),function(n){var r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,t.children(n).length&&(r.width=i.width,r.height=i.height))}),x(e.edges(),function(n){var r=e.edge(n),i=t.edge(n);r.points=i.points,Object.prototype.hasOwnProperty.call(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Qn=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],$n={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},er=[`acyclicer`,`ranker`,`rankdir`,`align`],tr=[`width`,`height`],nr={width:0,height:0},rr=[`minlen`,`weight`,`width`,`height`,`labeloffset`],ir={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},ar=[`labelpos`];function or(e){var t=new k({multigraph:!0,compound:!0}),n=$(e.graph());return t.setGraph(O({},$n,Q(n,Qn),F(n,er))),x(e.nodes(),function(n){var r=$(e.node(n));t.setNode(n,ue(Q(r,tr),nr)),t.setParent(n,e.parent(n))}),x(e.edges(),function(n){var r=$(e.edge(n));t.setEdge(n,O({},ir,Q(r,rr),F(r,ar)))}),t}function sr(e){var t=e.graph();t.ranksep/=2,x(e.edges(),function(n){var r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function cr(e){x(e.edges(),function(t){var n=e.edge(t);if(n.width&&n.height){var r=e.node(t.v);V(e,`edge-proxy`,{rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t},`_ep`)}})}function lr(e){var t=0;x(e.nodes(),function(n){var r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=j(t,r.maxRank))}),e.graph().maxRank=t}function ur(e){x(e.nodes(),function(t){var n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function dr(e){var t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){var a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}x(e.nodes(),function(t){c(e.node(t))}),x(e.edges(),function(t){var n=e.edge(t);Object.prototype.hasOwnProperty.call(n,`x`)&&c(n)}),t-=o,r-=s,x(e.nodes(),function(n){var i=e.node(n);i.x-=t,i.y-=r}),x(e.edges(),function(n){var i=e.edge(n);x(i.points,function(e){e.x-=t,e.y-=r}),Object.prototype.hasOwnProperty.call(i,`x`)&&(i.x-=t),Object.prototype.hasOwnProperty.call(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function fr(e){x(e.edges(),function(t){var n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(vt(r,a)),n.points.push(vt(i,o))})}function pr(e){x(e.edges(),function(t){var n=e.edge(t);if(Object.prototype.hasOwnProperty.call(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset;break}})}function mr(e){x(e.edges(),function(t){var n=e.edge(t);n.reversed&&n.points.reverse()})}function hr(e){x(e.nodes(),function(t){if(e.children(t).length){var n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(D(n.borderLeft)),o=e.node(D(n.borderRight));n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),x(e.nodes(),function(t){e.node(t).dummy===`border`&&e.removeNode(t)})}function gr(e){x(e.edges(),function(t){if(t.v===t.w){var n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function _r(e){x(H(e),function(t){var n=0;x(t,function(t,r){var i=e.node(t);i.order=r+n,x(i.selfEdges,function(t){V(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function vr(e){x(e.nodes(),function(t){var n=e.node(t);if(n.dummy===`selfedge`){var r=e.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function Q(e,t){return A(F(e,t),Number)}function $(e){var t={};return x(e,function(e,n){t[n.toLowerCase()]=e}),t}export{Yn as t};
1
+ import{C as e,D as t,E as n,G as r,N as i,P as a,V as o,j as s,k as c,n as l,p as u,v as d,w as f,z as p}from"./isArrayLikeObject-B_v2FtYn.js";import{C as m,E as ee,M as h,N as te,S as ne,a as g,c as re,d as ie,f as _,i as v,m as ae,n as y,p as oe,r as b,s as x,y as se}from"./_baseUniq-BT4Ow4Kk.js";import{a as ce,c as le,d as ue,f as S,i as de,l as C,m as w,n as T,o as fe,r as pe,s as E,t as me,u as D}from"./_basePickBy-5PGDJbfF.js";import{i as he,n as ge}from"./isEmpty-bnrF3Qbc.js";import{k as O}from"./chunk-GEFDOKGD-D-pKjlVd.js";import{t as k}from"./graphlib-BcsNnGcW.js";function _e(e){return i(t(e,void 0,S),e+``)}var ve=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function ye(e){return ve.test(e)}var be=1,xe=4;function Se(e){return se(e,be|xe)}var Ce=function(){return r.Date.now()};function we(e,t){return e==null?e:l(e,re(t),u)}function Te(e,t){return e&&ie(e,re(t))}function Ee(e,t){return e>t}function A(e,t){var n={};return t=_(t,3),ie(e,function(e,r,i){s(n,r,t(e,r,i))}),n}function j(e){return e&&e.length?pe(e,p,Ee):void 0}function M(e,t){return e&&e.length?pe(e,_(t,2),de):void 0}function De(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}function Oe(e,t){if(e!==t){var n=e!==void 0,r=e===null,i=e===e,a=te(e),o=t!==void 0,s=t===null,c=t===t,l=te(t);if(!s&&!l&&!a&&e>t||a&&o&&c&&!s&&!l||r&&o&&c||!n&&c||!i)return 1;if(!r&&!a&&!l&&e<t||l&&n&&i&&!r&&!a||s&&n&&i||!o&&i||!c)return-1}return 0}function ke(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;++r<o;){var c=Oe(i[r],a[r]);if(c)return r>=s?c:c*(n[r]==`desc`?-1:1)}return e.index-t.index}function Ae(e,t,n){t=t.length?h(t,function(e){return o(e)?function(t){return m(t,e.length===1?e[0]:e)}:e}):[p];var r=-1;return t=h(t,d(_)),De(le(e,function(e,n,i){return{criteria:h(t,function(t){return t(e)}),index:++r,value:e}}),function(e,t){return ke(e,t,n)})}var je=oe(`length`),Me=`\\ud800-\\udfff`,Ne=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,Pe=`\\ufe0e\\ufe0f`,Fe=`[`+Me+`]`,N=`[`+Ne+`]`,P=`\\ud83c[\\udffb-\\udfff]`,Ie=`(?:`+N+`|`+P+`)`,Le=`[^`+Me+`]`,Re=`(?:\\ud83c[\\udde6-\\uddff]){2}`,ze=`[\\ud800-\\udbff][\\udc00-\\udfff]`,Be=`\\u200d`,Ve=Ie+`?`,He=`[`+Pe+`]?`,Ue=`(?:`+Be+`(?:`+[Le,Re,ze].join(`|`)+`)`+He+Ve+`)*`,We=He+Ve+Ue,Ge=`(?:`+[Le+N+`?`,N,Re,ze,Fe].join(`|`)+`)`,Ke=RegExp(P+`(?=`+P+`)|`+Ge+We,`g`);function qe(e){for(var t=Ke.lastIndex=0;Ke.test(e);)++t;return t}function Je(e){return ye(e)?qe(e):je(e)}function Ye(e,t){return me(e,t,function(t,n){return ae(e,n)})}var F=_e(function(e,t){return e==null?{}:Ye(e,t)}),Xe=Math.ceil,Ze=Math.max;function Qe(e,t,n,r){for(var i=-1,a=Ze(Xe((t-e)/(n||1)),0),o=Array(a);a--;)o[r?a:++i]=e,e+=n;return o}function $e(t){return function(n,r,i){return i&&typeof i!=`number`&&e(n,r,i)&&(r=i=void 0),n=w(n),r===void 0?(r=n,n=0):r=w(r),i=i===void 0?n<r?1:-1:w(i),Qe(n,r,i,t)}}var I=$e(),et=`[object Map]`,tt=`[object Set]`;function nt(e){if(e==null)return 0;if(f(e))return ce(e)?Je(e):e.length;var t=ge(e);return t==et||t==tt?e.size:he(e).length}var L=n(function(t,n){if(t==null)return[];var r=n.length;return r>1&&e(t,n[0],n[1])?n=[]:r>2&&e(n[0],n[1],n[2])&&(n=[n[0]]),Ae(t,ne(n,1),[])}),rt=0;function R(e){var t=++rt;return ee(e)+t}function it(e,t,n){for(var r=-1,i=e.length,a=t.length,o={};++r<i;){var s=r<a?t[r]:void 0;n(o,e[r],s)}return o}function at(e,t){return it(e||[],t||[],c)}var ot=class{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,t=e._prev;if(t!==e)return st(t),t}enqueue(e){var t=this._sentinel;e._prev&&e._next&&st(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){for(var e=[],t=this._sentinel,n=t._prev;n!==t;)e.push(JSON.stringify(n,ct)),n=n._prev;return`[`+e.join(`, `)+`]`}};function st(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function ct(e,t){if(e!==`_next`&&e!==`_prev`)return t}var lt=a(1);function ut(e,t){if(e.nodeCount()<=1)return[];var n=ft(e,t||lt);return S(E(dt(n.graph,n.buckets,n.zeroIdx),function(t){return e.outEdges(t.v,t.w)}))}function dt(e,t,n){for(var r=[],i=t[t.length-1],a=t[0],o;e.nodeCount();){for(;o=a.dequeue();)z(e,t,n,o);for(;o=i.dequeue();)z(e,t,n,o);if(e.nodeCount()){for(var s=t.length-2;s>0;--s)if(o=t[s].dequeue(),o){r=r.concat(z(e,t,n,o,!0));break}}}return r}function z(e,t,n,r,i){var a=i?[]:void 0;return x(e.inEdges(r.v),function(r){var o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,B(t,n,s)}),x(e.outEdges(r.v),function(r){var i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,B(t,n,o)}),e.removeNode(r.v),a}function ft(e,t){var n=new k,r=0,i=0;x(e.nodes(),function(e){n.setNode(e,{v:e,in:0,out:0})}),x(e.edges(),function(e){var a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s),i=Math.max(i,n.node(e.v).out+=o),r=Math.max(r,n.node(e.w).in+=o)});var a=I(i+r+3).map(function(){return new ot}),o=r+1;return x(n.nodes(),function(e){B(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function B(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}function pt(e){x(e.graph().acyclicer===`greedy`?ut(e,t(e)):mt(e),function(t){var n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,R(`rev`))});function t(e){return function(t){return e.edge(t).weight}}}function mt(e){var t=[],n={},r={};function i(a){Object.prototype.hasOwnProperty.call(r,a)||(r[a]=!0,n[a]=!0,x(e.outEdges(a),function(e){Object.prototype.hasOwnProperty.call(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return x(e.nodes(),i),t}function ht(e){x(e.edges(),function(t){var n=e.edge(t);if(n.reversed){e.removeEdge(t);var r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function V(e,t,n,r){var i;do i=R(r);while(e.hasNode(i));return n.dummy=t,e.setNode(i,n),i}function gt(e){var t=new k().setGraph(e.graph());return x(e.nodes(),function(n){t.setNode(n,e.node(n))}),x(e.edges(),function(n){var r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function _t(e){var t=new k({multigraph:e.isMultigraph()}).setGraph(e.graph());return x(e.nodes(),function(n){e.children(n).length||t.setNode(n,e.node(n))}),x(e.edges(),function(n){t.setEdge(n,e.edge(n))}),t}function vt(e,t){var n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);var c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function H(e){var t=E(I(St(e)+1),function(){return[]});return x(e.nodes(),function(n){var r=e.node(n),i=r.rank;b(i)||(t[i][r.order]=n)}),t}function yt(e){var t=T(E(e.nodes(),function(t){return e.node(t).rank}));x(e.nodes(),function(n){var r=e.node(n);fe(r,`rank`)&&(r.rank-=t)})}function bt(e){var t=T(E(e.nodes(),function(t){return e.node(t).rank})),n=[];x(e.nodes(),function(r){var i=e.node(r).rank-t;n[i]||(n[i]=[]),n[i].push(r)});var r=0,i=e.graph().nodeRankFactor;x(n,function(t,n){b(t)&&n%i!==0?--r:r&&x(t,function(t){e.node(t).rank+=r})})}function xt(e,t,n,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),V(e,`border`,i,t)}function St(e){return j(E(e.nodes(),function(t){var n=e.node(t).rank;if(!b(n))return n}))}function Ct(e,t){var n={lhs:[],rhs:[]};return x(e,function(e){t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function wt(e,t){var n=Ce();try{return t()}finally{console.log(e+` time: `+(Ce()-n)+`ms`)}}function Tt(e,t){return t()}function Et(e){function t(n){var r=e.children(n),i=e.node(n);if(r.length&&x(r,t),Object.prototype.hasOwnProperty.call(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,o=i.maxRank+1;a<o;++a)Dt(e,`borderLeft`,`_bl`,n,i,a),Dt(e,`borderRight`,`_br`,n,i,a)}}x(e.children(),t)}function Dt(e,t,n,r,i,a){var o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],c=V(e,`border`,o,n);i[t][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}function Ot(e){var t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&At(e)}function kt(e){var t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&jt(e),(t===`lr`||t===`rl`)&&(Mt(e),At(e))}function At(e){x(e.nodes(),function(t){U(e.node(t))}),x(e.edges(),function(t){U(e.edge(t))})}function U(e){var t=e.width;e.width=e.height,e.height=t}function jt(e){x(e.nodes(),function(t){W(e.node(t))}),x(e.edges(),function(t){var n=e.edge(t);x(n.points,W),Object.prototype.hasOwnProperty.call(n,`y`)&&W(n)})}function W(e){e.y=-e.y}function Mt(e){x(e.nodes(),function(t){G(e.node(t))}),x(e.edges(),function(t){var n=e.edge(t);x(n.points,G),Object.prototype.hasOwnProperty.call(n,`x`)&&G(n)})}function G(e){var t=e.x;e.x=e.y,e.y=t}function Nt(e){e.graph().dummyChains=[],x(e.edges(),function(t){Pt(e,t)})}function Pt(e,t){var n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a!==r+1){e.removeEdge(t);var l=void 0,u,d;for(d=0,++r;r<a;++d,++r)s.points=[],l={width:0,height:0,edgeLabel:s,edgeObj:t,rank:r},u=V(e,`edge`,l,`_d`),r===c&&(l.width=s.width,l.height=s.height,l.dummy=`edge-label`,l.labelpos=s.labelpos),e.setEdge(n,u,{weight:s.weight},o),d===0&&e.graph().dummyChains.push(u),n=u;e.setEdge(n,i,{weight:s.weight},o)}}function Ft(e){x(e.graph().dummyChains,function(t){var n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}function K(e){var t={};function n(r){var i=e.node(r);if(Object.prototype.hasOwnProperty.call(t,r))return i.rank;t[r]=!0;var a=T(E(e.outEdges(r),function(t){return n(t.w)-e.edge(t).minlen}));return(a===1/0||a==null)&&(a=0),i.rank=a}x(e.sources(),n)}function q(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}function It(e){var t=new k({directed:!1}),n=e.nodes()[0],r=e.nodeCount();t.setNode(n,{});for(var i,a;Lt(t,e)<r;)i=Rt(t,e),a=t.hasNode(i.v)?q(e,i):-q(e,i),zt(t,e,a);return t}function Lt(e,t){function n(r){x(t.nodeEdges(r),function(i){var a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!q(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return x(e.nodes(),n),e.nodeCount()}function Rt(e,t){return M(t.edges(),function(n){if(e.hasNode(n.v)!==e.hasNode(n.w))return q(t,n)})}function zt(e,t,n){x(e.nodes(),function(e){t.node(e).rank+=n})}a(1),a(1),Bt.CycleException=J;function Bt(e){var t={},n={},r=[];function i(a){if(Object.prototype.hasOwnProperty.call(n,a))throw new J;Object.prototype.hasOwnProperty.call(t,a)||(n[a]=!0,t[a]=!0,x(e.predecessors(a),i),delete n[a],r.push(a))}if(x(e.sinks(),i),nt(t)!==e.nodeCount())throw new J;return r}function J(){}J.prototype=Error();function Vt(e,t,n){o(t)||(t=[t]);var r=(e.isDirected()?e.successors:e.neighbors).bind(e),i=[],a={};return x(t,function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);Ht(e,t,n===`post`,a,r,i)}),i}function Ht(e,t,n,r,i,a){Object.prototype.hasOwnProperty.call(r,t)||(r[t]=!0,n||a.push(t),x(i(t),function(t){Ht(e,t,n,r,i,a)}),n&&a.push(t))}function Ut(e,t){return Vt(e,t,`post`)}function Wt(e,t){return Vt(e,t,`pre`)}Y.initLowLimValues=Z,Y.initCutValues=X,Y.calcCutValue=Kt,Y.leaveEdge=Jt,Y.enterEdge=Yt,Y.exchangeEdges=Xt;function Y(e){e=gt(e),K(e);var t=It(e);Z(t),X(t,e);for(var n,r;n=Jt(t);)r=Yt(t,e,n),Xt(t,e,n,r)}function X(e,t){var n=Ut(e,e.nodes());n=n.slice(0,n.length-1),x(n,function(n){Gt(e,t,n)})}function Gt(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=Kt(e,t,n)}function Kt(e,t,n){var r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;return a||=(i=!1,t.edge(r,n)),o=a.weight,x(t.nodeEdges(n),function(a){var s=a.v===n,c=s?a.w:a.v;if(c!==r){var l=s===i,u=t.edge(a).weight;if(o+=l?u:-u,Qt(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function Z(e,t){arguments.length<2&&(t=e.nodes()[0]),qt(e,{},1,t)}function qt(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,x(e.neighbors(r),function(i){Object.prototype.hasOwnProperty.call(t,i)||(n=qt(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function Jt(e){return C(e.edges(),function(t){return e.edge(t).cutvalue<0})}function Yt(e,t,n){var r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);var a=e.node(r),o=e.node(i),s=a,c=!1;return a.lim>o.lim&&(s=o,c=!0),M(g(t.edges(),function(t){return c===$t(e,e.node(t.v),s)&&c!==$t(e,e.node(t.w),s)}),function(e){return q(t,e)})}function Xt(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),Z(e),X(e,t),Zt(e,t)}function Zt(e,t){var n=Wt(e,C(e.nodes(),function(e){return!t.node(e).parent}));n=n.slice(1),x(n,function(n){var r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function Qt(e,t,n){return e.hasEdge(t,n)}function $t(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}function en(e){switch(e.graph().ranker){case`network-simplex`:rn(e);break;case`tight-tree`:nn(e);break;case`longest-path`:tn(e);break;default:rn(e)}}var tn=K;function nn(e){K(e),It(e)}function rn(e){Y(e)}function an(e){var t=V(e,`root`,{},`_root`),n=sn(e),r=j(v(n))-1,i=2*r+1;e.graph().nestingRoot=t,x(e.edges(),function(t){e.edge(t).minlen*=i});var a=cn(e)+1;x(e.children(),function(o){on(e,t,i,a,r,n,o)}),e.graph().nodeRankFactor=i}function on(e,t,n,r,i,a,o){var s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}var c=xt(e,`_bt`),l=xt(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,x(s,function(s){on(e,t,n,r,i,a,s);var u=e.node(s),d=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,p=u.borderTop?r:2*r,m=d===f?i-a[o]+1:1;e.setEdge(c,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,l,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+a[o]})}function sn(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&x(a,function(e){n(e,i+1)}),t[r]=i}return x(e.children(),function(e){n(e,1)}),t}function cn(e){return y(e.edges(),function(t,n){return t+e.edge(n).weight},0)}function ln(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,x(e.edges(),function(t){e.edge(t).nestingEdge&&e.removeEdge(t)})}function un(e,t,n){var r={},i;x(n,function(n){for(var a=e.parent(n),o,s;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}function dn(e,t,n){var r=fn(e),i=new k({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(t){return e.node(t)});return x(e.nodes(),function(a){var o=e.node(a),s=e.parent(a);(o.rank===t||o.minRank<=t&&t<=o.maxRank)&&(i.setNode(a),i.setParent(a,s||r),x(e[n](a),function(t){var n=t.v===a?t.w:t.v,r=i.edge(n,a),o=b(r)?0:r.weight;i.setEdge(n,a,{weight:e.edge(t).weight+o})}),Object.prototype.hasOwnProperty.call(o,`minRank`)&&i.setNode(a,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]}))}),i}function fn(e){for(var t;e.hasNode(t=R(`_root`)););return t}function pn(e,t){for(var n=0,r=1;r<t.length;++r)n+=mn(e,t[r-1],t[r]);return n}function mn(e,t,n){for(var r=at(n,E(n,function(e,t){return t})),i=S(E(t,function(t){return L(E(e.outEdges(t),function(t){return{pos:r[t.w],weight:e.edge(t).weight}}),`pos`)})),a=1;a<n.length;)a<<=1;var o=2*a-1;--a;var s=E(Array(o),function(){return 0}),c=0;return x(i.forEach(function(e){var t=e.pos+a;s[t]+=e.weight;for(var n=0;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*n})),c}function hn(e){var t={},n=g(e.nodes(),function(t){return!e.children(t).length}),r=E(I(j(E(n,function(t){return e.node(t).rank}))+1),function(){return[]});function i(n){fe(t,n)||(t[n]=!0,r[e.node(n).rank].push(n),x(e.successors(n),i))}return x(L(n,function(t){return e.node(t).rank}),i),r}function gn(e,t){return E(t,function(t){var n=e.inEdges(t);if(n.length){var r=y(n,function(t,n){var r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}else return{v:t}})}function _n(e,t){var n={};return x(e,function(e,t){var r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};b(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)}),x(t.edges(),function(e){var t=n[e.v],r=n[e.w];!b(t)&&!b(r)&&(r.indegree++,t.out.push(n[e.w]))}),vn(g(n,function(e){return!e.indegree}))}function vn(e){var t=[];function n(e){return function(t){t.merged||(b(t.barycenter)||b(e.barycenter)||t.barycenter>=e.barycenter)&&yn(e,t)}}function r(t){return function(n){n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){var i=e.pop();t.push(i),x(i.in.reverse(),n(i)),x(i.out,r(i))}return E(g(t,function(e){return!e.merged}),function(e){return F(e,[`vs`,`i`,`barycenter`,`weight`])})}function yn(e,t){var n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function bn(e,t){var n=Ct(e,function(e){return Object.prototype.hasOwnProperty.call(e,`barycenter`)}),r=n.lhs,i=L(n.rhs,function(e){return-e.i}),a=[],o=0,s=0,c=0;r.sort(Sn(!!t)),c=xn(a,i,c),x(r,function(e){c+=e.vs.length,a.push(e.vs),o+=e.barycenter*e.weight,s+=e.weight,c=xn(a,i,c)});var l={vs:S(a)};return s&&(l.barycenter=o/s,l.weight=s),l}function xn(e,t,n){for(var r;t.length&&(r=D(t)).i<=n;)t.pop(),e.push(r.vs),n++;return n}function Sn(e){return function(t,n){return t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}}function Cn(e,t,n,r){var i=e.children(t),a=e.node(t),o=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,c={};o&&(i=g(i,function(e){return e!==o&&e!==s}));var l=gn(e,i);x(l,function(t){if(e.children(t.v).length){var i=Cn(e,t.v,n,r);c[t.v]=i,Object.prototype.hasOwnProperty.call(i,`barycenter`)&&Tn(t,i)}});var u=_n(l,n);wn(u,c);var d=bn(u,r);if(o&&(d.vs=S([o,d.vs,s]),e.predecessors(o).length)){var f=e.node(e.predecessors(o)[0]),p=e.node(e.predecessors(s)[0]);Object.prototype.hasOwnProperty.call(d,`barycenter`)||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+f.order+p.order)/(d.weight+2),d.weight+=2}return d}function wn(e,t){x(e,function(e){e.vs=S(e.vs.map(function(e){return t[e]?t[e].vs:e}))})}function Tn(e,t){b(e.barycenter)?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function En(e){var t=St(e),n=Dn(e,I(1,t+1),`inEdges`),r=Dn(e,I(t-1,-1,-1),`outEdges`),i=hn(e);kn(e,i);for(var a=1/0,o,s=0,c=0;c<4;++s,++c){On(s%2?n:r,s%4>=2),i=H(e);var l=pn(e,i);l<a&&(c=0,o=Se(i),a=l)}kn(e,o)}function Dn(e,t,n){return E(t,function(t){return dn(e,t,n)})}function On(e,t){var n=new k;x(e,function(e){var r=e.graph().root,i=Cn(e,r,n,t);x(i.vs,function(t,n){e.node(t).order=n}),un(e,n,i.vs)})}function kn(e,t){x(t,function(t){x(t,function(t,n){e.node(t).order=n})})}function An(e){var t=Mn(e);x(e.graph().dummyChains,function(n){for(var r=e.node(n),i=r.edgeObj,a=jn(e,t,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;n!==i.w;){if(r=e.node(n),u){for(;(l=o[c])!==s&&e.node(l).maxRank<r.rank;)c++;l===s&&(u=!1)}if(!u){for(;c<o.length-1&&e.node(l=o[c+1]).minRank<=r.rank;)c++;l=o[c]}e.setParent(n,l),n=e.successors(n)[0]}})}function jn(e,t,n,r){var i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c=n,l;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));for(l=c,c=r;(c=e.parent(c))!==l;)a.push(c);return{path:i.concat(a.reverse()),lca:l}}function Mn(e){var t={},n=0;function r(i){var a=n;x(e.children(i),r),t[i]={low:a,lim:n++}}return x(e.children(),r),t}function Nn(e,t){var n={};function r(t,r){var i=0,a=0,o=t.length,s=D(r);return x(r,function(t,c){var l=Fn(e,t),u=l?e.node(l).order:o;(l||t===s)&&(x(r.slice(a,c+1),function(t){x(e.predecessors(t),function(r){var a=e.node(r),o=a.order;(o<i||u<o)&&!(a.dummy&&e.node(t).dummy)&&In(n,r,t)})}),a=c+1,i=u)}),r}return y(t,r),n}function Pn(e,t){var n={};function r(t,r,i,a,o){var s;x(I(r,i),function(r){s=t[r],e.node(s).dummy&&x(e.predecessors(s),function(t){var r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&In(n,t,s)})})}function i(t,n){var i=-1,a,o=0;return x(n,function(s,c){if(e.node(s).dummy===`border`){var l=e.predecessors(s);l.length&&(a=e.node(l[0]).order,r(n,o,c,i,a),o=c,i=a)}r(n,o,n.length,a,t.length)}),n}return y(t,i),n}function Fn(e,t){if(e.node(t).dummy)return C(e.predecessors(t),function(t){return e.node(t).dummy})}function In(e,t,n){if(t>n){var r=t;t=n,n=r}Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=e[t];Object.defineProperty(i,n,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function Ln(e,t,n){if(t>n){var r=t;t=n,n=r}return!!e[t]&&Object.prototype.hasOwnProperty.call(e[t],n)}function Rn(e,t,n,r){var i={},a={},o={};return x(t,function(e){x(e,function(e,t){i[e]=e,a[e]=e,o[e]=t})}),x(t,function(e){var t=-1;x(e,function(e){var s=r(e);if(s.length){s=L(s,function(e){return o[e]});for(var c=(s.length-1)/2,l=Math.floor(c),u=Math.ceil(c);l<=u;++l){var d=s[l];a[e]===e&&t<o[d]&&!Ln(n,e,d)&&(a[d]=e,a[e]=i[e]=i[d],t=o[d])}}})}),{root:i,align:a}}function zn(e,t,n,r,i){var a={},o=Bn(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){for(var n=o.nodes(),r=n.pop(),i={};r;)i[r]?e(r):(i[r]=!0,n.push(r),n=n.concat(t(r))),r=n.pop()}function l(e){a[e]=o.inEdges(e).reduce(function(e,t){return Math.max(e,a[t.v]+o.edge(t))},0)}function u(t){var n=o.outEdges(t).reduce(function(e,t){return Math.min(e,a[t.w]-o.edge(t))},1/0),r=e.node(t);n!==1/0&&r.borderType!==s&&(a[t]=Math.max(a[t],n))}return c(l,o.predecessors.bind(o)),c(u,o.successors.bind(o)),x(r,function(e){a[e]=a[n[e]]}),a}function Bn(e,t,n,r){var i=new k,a=e.graph(),o=Gn(a.nodesep,a.edgesep,r);return x(t,function(t){var r;x(t,function(t){var a=n[t];if(i.setNode(a),r){var s=n[r],c=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),c||0))}r=t})}),i}function Vn(e,t){return M(v(t),function(t){var n=-1/0,r=1/0;return we(t,function(t,i){var a=Kn(e,i)/2;n=Math.max(t+a,n),r=Math.min(t-a,r)}),n-r})}function Hn(e,t){var n=v(t),r=T(n),i=j(n);x([`u`,`d`],function(n){x([`l`,`r`],function(a){var o=n+a,s=e[o],c;if(s!==t){var l=v(s);c=a===`l`?r-T(l):i-j(l),c&&(e[o]=A(s,function(e){return e+c}))}})})}function Un(e,t){return A(e.ul,function(n,r){if(t)return e[t.toLowerCase()][r];var i=L(E(e,r));return(i[1]+i[2])/2})}function Wn(e){var t=H(e),n=O(Nn(e,t),Pn(e,t)),r={},i;return x([`u`,`d`],function(a){i=a===`u`?t:v(t).reverse(),x([`l`,`r`],function(t){t===`r`&&(i=E(i,function(e){return v(e).reverse()}));var o=(a===`u`?e.predecessors:e.successors).bind(e),s=Rn(e,i,n,o),c=zn(e,i,s.root,s.align,t===`r`);t===`r`&&(c=A(c,function(e){return-e})),r[a+t]=c})}),Hn(r,Vn(e,r)),Un(r,e.graph().align)}function Gn(e,t,n){return function(r,i,a){var o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.prototype.hasOwnProperty.call(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2;break}if(l&&(c+=n?l:-l),l=0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.prototype.hasOwnProperty.call(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2;break}return l&&(c+=n?l:-l),l=0,c}}function Kn(e,t){return e.node(t).width}function qn(e){e=_t(e),Jn(e),Te(Wn(e),function(t,n){e.node(n).x=t})}function Jn(e){var t=H(e),n=e.graph().ranksep,r=0;x(t,function(t){var i=j(E(t,function(t){return e.node(t).height}));x(t,function(t){e.node(t).y=r+i/2}),r+=i+n})}function Yn(e,t){var n=t&&t.debugTiming?wt:Tt;n(`layout`,()=>{var t=n(` buildLayoutGraph`,()=>or(e));n(` runLayout`,()=>Xn(t,n)),n(` updateInputGraph`,()=>Zn(e,t))})}function Xn(e,t){t(` makeSpaceForEdgeLabels`,()=>sr(e)),t(` removeSelfEdges`,()=>gr(e)),t(` acyclic`,()=>pt(e)),t(` nestingGraph.run`,()=>an(e)),t(` rank`,()=>en(_t(e))),t(` injectEdgeLabelProxies`,()=>cr(e)),t(` removeEmptyRanks`,()=>bt(e)),t(` nestingGraph.cleanup`,()=>ln(e)),t(` normalizeRanks`,()=>yt(e)),t(` assignRankMinMax`,()=>lr(e)),t(` removeEdgeLabelProxies`,()=>ur(e)),t(` normalize.run`,()=>Nt(e)),t(` parentDummyChains`,()=>An(e)),t(` addBorderSegments`,()=>Et(e)),t(` order`,()=>En(e)),t(` insertSelfEdges`,()=>_r(e)),t(` adjustCoordinateSystem`,()=>Ot(e)),t(` position`,()=>qn(e)),t(` positionSelfEdges`,()=>vr(e)),t(` removeBorderNodes`,()=>hr(e)),t(` normalize.undo`,()=>Ft(e)),t(` fixupEdgeLabelCoords`,()=>pr(e)),t(` undoCoordinateSystem`,()=>kt(e)),t(` translateGraph`,()=>dr(e)),t(` assignNodeIntersects`,()=>fr(e)),t(` reversePoints`,()=>mr(e)),t(` acyclic.undo`,()=>ht(e))}function Zn(e,t){x(e.nodes(),function(n){var r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,t.children(n).length&&(r.width=i.width,r.height=i.height))}),x(e.edges(),function(n){var r=e.edge(n),i=t.edge(n);r.points=i.points,Object.prototype.hasOwnProperty.call(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Qn=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],$n={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},er=[`acyclicer`,`ranker`,`rankdir`,`align`],tr=[`width`,`height`],nr={width:0,height:0},rr=[`minlen`,`weight`,`width`,`height`,`labeloffset`],ir={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},ar=[`labelpos`];function or(e){var t=new k({multigraph:!0,compound:!0}),n=$(e.graph());return t.setGraph(O({},$n,Q(n,Qn),F(n,er))),x(e.nodes(),function(n){var r=$(e.node(n));t.setNode(n,ue(Q(r,tr),nr)),t.setParent(n,e.parent(n))}),x(e.edges(),function(n){var r=$(e.edge(n));t.setEdge(n,O({},ir,Q(r,rr),F(r,ar)))}),t}function sr(e){var t=e.graph();t.ranksep/=2,x(e.edges(),function(n){var r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function cr(e){x(e.edges(),function(t){var n=e.edge(t);if(n.width&&n.height){var r=e.node(t.v);V(e,`edge-proxy`,{rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t},`_ep`)}})}function lr(e){var t=0;x(e.nodes(),function(n){var r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=j(t,r.maxRank))}),e.graph().maxRank=t}function ur(e){x(e.nodes(),function(t){var n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function dr(e){var t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){var a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}x(e.nodes(),function(t){c(e.node(t))}),x(e.edges(),function(t){var n=e.edge(t);Object.prototype.hasOwnProperty.call(n,`x`)&&c(n)}),t-=o,r-=s,x(e.nodes(),function(n){var i=e.node(n);i.x-=t,i.y-=r}),x(e.edges(),function(n){var i=e.edge(n);x(i.points,function(e){e.x-=t,e.y-=r}),Object.prototype.hasOwnProperty.call(i,`x`)&&(i.x-=t),Object.prototype.hasOwnProperty.call(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function fr(e){x(e.edges(),function(t){var n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(vt(r,a)),n.points.push(vt(i,o))})}function pr(e){x(e.edges(),function(t){var n=e.edge(t);if(Object.prototype.hasOwnProperty.call(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset;break}})}function mr(e){x(e.edges(),function(t){var n=e.edge(t);n.reversed&&n.points.reverse()})}function hr(e){x(e.nodes(),function(t){if(e.children(t).length){var n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(D(n.borderLeft)),o=e.node(D(n.borderRight));n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),x(e.nodes(),function(t){e.node(t).dummy===`border`&&e.removeNode(t)})}function gr(e){x(e.edges(),function(t){if(t.v===t.w){var n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function _r(e){x(H(e),function(t){var n=0;x(t,function(t,r){var i=e.node(t);i.order=r+n,x(i.selfEdges,function(t){V(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function vr(e){x(e.nodes(),function(t){var n=e.node(t);if(n.dummy===`selfedge`){var r=e.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function Q(e,t){return A(F(e,t),Number)}function $(e){var t={};return x(e,function(e,n){t[n.toLowerCase()]=e}),t}export{Yn as t};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./_baseUniq-Yy35llnn.js";import{s as t}from"./_basePickBy-3Xe18azI.js";import{t as n}from"./dagre-BFcnKyBF.js";import"./chunk-GEFDOKGD-tDjHsAUs.js";import{t as r}from"./clone-B2hUek6n.js";import{t as i}from"./graphlib-Duh_bWLa.js";import{g as a,h as o}from"./src-Dw4QhedI.js";import{b as s}from"./chunk-7R4GIKGN-Dvbyu4Zw.js";import"./dist-Cep75xXf.js";import"./chunk-PU5JKC2W-C7Gry6md.js";import"./chunk-MX3YWQON-C2UEioMs.js";import{n as c}from"./chunk-YBOYWFTD-av5aeHLq.js";import"./chunk-PQ6SQG4A-DX0xW7kO.js";import{a as l,c as u,i as d,l as f,n as p,t as m,u as h}from"./chunk-KYZI473N-Djw13C-3.js";import{a as g,i as _,n as v,r as y,t as b}from"./chunk-O4XLMI2P-BsUWb9d0.js";function x(t){var n={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:S(t),edges:C(t)};return e(t.graph())||(n.value=r(t.graph())),n}function S(n){return t(n.nodes(),function(t){var r=n.node(t),i=n.parent(t),a={v:t};return e(r)||(a.value=r),e(i)||(a.parent=i),a})}function C(n){return t(n.edges(),function(t){var r=n.edge(t),i={v:t.v,w:t.w};return e(t.name)||(i.name=t.name),e(r)||(i.value=r),i})}var w=new Map,T=new Map,E=new Map,D=o(()=>{T.clear(),E.clear(),w.clear()},`clear`),O=o((e,t)=>{let n=T.get(t)||[];return a.trace(`In isDescendant`,t,` `,e,` = `,n.includes(e)),n.includes(e)},`isDescendant`),k=o((e,t)=>{let n=T.get(t)||[];return a.info(`Descendants of `,t,` is `,n),a.info(`Edge is `,e),e.v===t||e.w===t?!1:n?n.includes(e.v)||O(e.v,t)||O(e.w,t)||n.includes(e.w):(a.debug(`Tilt, `,t,`,not in descendants`),!1)},`edgeInCluster`),A=o((e,t,n,r)=>{a.warn(`Copying children of `,e,`root`,r,`data`,t.node(e),r);let i=t.children(e)||[];e!==r&&i.push(e),a.warn(`Copying (nodes) clusterId`,e,`nodes`,i),i.forEach(i=>{if(t.children(i).length>0)A(i,t,n,r);else{let o=t.node(i);a.info(`cp `,i,` to `,r,` with parent `,e),n.setNode(i,o),r!==t.parent(i)&&(a.warn(`Setting parent`,i,t.parent(i)),n.setParent(i,t.parent(i))),e!==r&&i!==e?(a.debug(`Setting parent`,i,e),n.setParent(i,e)):(a.info(`In copy `,e,`root`,r,`data`,t.node(e),r),a.debug(`Not Setting parent for node=`,i,`cluster!==rootId`,e!==r,`node!==clusterId`,i!==e));let s=t.edges(i);a.debug(`Copying Edges`,s),s.forEach(i=>{a.info(`Edge`,i);let o=t.edge(i.v,i.w,i.name);a.info(`Edge data`,o,r);try{k(i,r)?(a.info(`Copying as `,i.v,i.w,o,i.name),n.setEdge(i.v,i.w,o,i.name),a.info(`newGraph edges `,n.edges(),n.edge(n.edges()[0]))):a.info(`Skipping copy of edge `,i.v,`-->`,i.w,` rootId: `,r,` clusterId:`,e)}catch(e){a.error(e)}})}a.debug(`Removing node`,i),t.removeNode(i)})},`copy`),j=o((e,t)=>{let n=t.children(e),r=[...n];for(let i of n)E.set(i,e),r=[...r,...j(i,t)];return r},`extractDescendants`),M=o((e,t,n)=>{let r=e.edges().filter(e=>e.v===t||e.w===t),i=e.edges().filter(e=>e.v===n||e.w===n),a=r.map(e=>({v:e.v===t?n:e.v,w:e.w===t?t:e.w})),o=i.map(e=>({v:e.v,w:e.w}));return a.filter(e=>o.some(t=>e.v===t.v&&e.w===t.w))},`findCommonEdges`),N=o((e,t,n)=>{let r=t.children(e);if(a.trace(`Searching children of id `,e,r),r.length<1)return e;let i;for(let e of r){let r=N(e,t,n),a=M(t,n,r);if(r)if(a.length>0)i=r;else return r}return i},`findNonClusterChild`),P=o(e=>!w.has(e)||!w.get(e).externalConnections?e:w.has(e)?w.get(e).id:e,`getAnchorId`),F=o((e,t)=>{if(!e||t>10){a.debug(`Opting out, no graph `);return}else a.debug(`Opting in, graph `);e.nodes().forEach(function(t){e.children(t).length>0&&(a.warn(`Cluster identified`,t,` Replacement id in edges: `,N(t,e,t)),T.set(t,j(t,e)),w.set(t,{id:N(t,e,t),clusterData:e.node(t)}))}),e.nodes().forEach(function(t){let n=e.children(t),r=e.edges();n.length>0?(a.debug(`Cluster identified`,t,T),r.forEach(e=>{O(e.v,t)^O(e.w,t)&&(a.warn(`Edge: `,e,` leaves cluster `,t),a.warn(`Descendants of XXX `,t,`: `,T.get(t)),w.get(t).externalConnections=!0)})):a.debug(`Not a cluster `,t,T)});for(let t of w.keys()){let n=w.get(t).id,r=e.parent(n);r!==t&&w.has(r)&&!w.get(r).externalConnections&&(w.get(t).id=r)}e.edges().forEach(function(t){let n=e.edge(t);a.warn(`Edge `+t.v+` -> `+t.w+`: `+JSON.stringify(t)),a.warn(`Edge `+t.v+` -> `+t.w+`: `+JSON.stringify(e.edge(t)));let r=t.v,i=t.w;if(a.warn(`Fix XXX`,w,`ids:`,t.v,t.w,`Translating: `,w.get(t.v),` --- `,w.get(t.w)),w.get(t.v)||w.get(t.w)){if(a.warn(`Fixing and trying - removing XXX`,t.v,t.w,t.name),r=P(t.v),i=P(t.w),e.removeEdge(t.v,t.w,t.name),r!==t.v){let i=e.parent(r);w.get(i).externalConnections=!0,n.fromCluster=t.v}if(i!==t.w){let r=e.parent(i);w.get(r).externalConnections=!0,n.toCluster=t.w}a.warn(`Fix Replacing with XXX`,r,i,t.name),e.setEdge(r,i,n,t.name)}}),a.warn(`Adjusted Graph`,x(e)),I(e,0),a.trace(w)},`adjustClustersAndEdges`),I=o((e,t)=>{if(a.warn(`extractor - `,t,x(e),e.children(`D`)),t>10){a.error(`Bailing out`);return}let n=e.nodes(),r=!1;for(let t of n){let n=e.children(t);r||=n.length>0}if(!r){a.debug(`Done, no node has children`,e.nodes());return}a.debug(`Nodes = `,n,t);for(let r of n)if(a.debug(`Extracting node`,r,w,w.has(r)&&!w.get(r).externalConnections,!e.parent(r),e.node(r),e.children(`D`),` Depth `,t),!w.has(r))a.debug(`Not a cluster`,r,t);else if(!w.get(r).externalConnections&&e.children(r)&&e.children(r).length>0){a.warn(`Cluster without external connections, without a parent and with children`,r,t);let n=e.graph().rankdir===`TB`?`LR`:`TB`;w.get(r)?.clusterData?.dir&&(n=w.get(r).clusterData.dir,a.warn(`Fixing dir`,w.get(r).clusterData.dir,n));let o=new i({multigraph:!0,compound:!0}).setGraph({rankdir:n,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});a.warn(`Old graph before copy`,x(e)),A(r,e,o,r),e.setNode(r,{clusterNode:!0,id:r,clusterData:w.get(r).clusterData,label:w.get(r).label,graph:o}),a.warn(`New graph after copy node: (`,r,`)`,x(o)),a.debug(`Old graph after copy`,x(e))}else a.warn(`Cluster ** `,r,` **not meeting the criteria !externalConnections:`,!w.get(r).externalConnections,` no parent: `,!e.parent(r),` children `,e.children(r)&&e.children(r).length>0,e.children(`D`),t),a.debug(w);n=e.nodes(),a.warn(`New list of nodes`,n);for(let r of n){let n=e.node(r);a.warn(` Now next level`,r,n),n?.clusterNode&&I(n.graph,t+1)}},`extractor`),L=o((e,t)=>{if(t.length===0)return[];let n=Object.assign([],t);return t.forEach(t=>{let r=L(e,e.children(t));n=[...n,...r]}),n},`sorter`),R=o(e=>L(e,e.children()),`sortNodesByHierarchy`),z=o(async(e,t,r,i,s,p)=>{a.warn(`Graph in recursive render:XAX`,x(t),s);let m=t.graph().rankdir;a.trace(`Dir in recursive render - dir:`,m);let _=e.insert(`g`).attr(`class`,`root`);t.nodes()?a.info(`Recursive render XXX`,t.nodes()):a.info(`No nodes found for`,t),t.edges().length>0&&a.info(`Recursive edges`,t.edge(t.edges()[0]));let b=_.insert(`g`).attr(`class`,`clusters`),S=_.insert(`g`).attr(`class`,`edgePaths`),C=_.insert(`g`).attr(`class`,`edgeLabels`),T=_.insert(`g`).attr(`class`,`nodes`);await Promise.all(t.nodes().map(async function(e){let n=t.node(e);if(s!==void 0){let n=JSON.parse(JSON.stringify(s.clusterData));a.trace(`Setting data for parent cluster XXX
1
+ import{r as e}from"./_baseUniq-BT4Ow4Kk.js";import{s as t}from"./_basePickBy-5PGDJbfF.js";import{t as n}from"./dagre-DHq9bhnd.js";import"./chunk-GEFDOKGD-D-pKjlVd.js";import{t as r}from"./clone-LRxlvnMj.js";import{t as i}from"./graphlib-BcsNnGcW.js";import{g as a,h as o}from"./src-BqX54PbV.js";import{b as s}from"./chunk-7R4GIKGN-Dv-4cAYn.js";import"./dist-CSJdAyA9.js";import"./chunk-PU5JKC2W-ek7k4QVB.js";import"./chunk-MX3YWQON-BpS_PtKp.js";import{n as c}from"./chunk-YBOYWFTD-rQG3QH5s.js";import"./chunk-PQ6SQG4A-TF58UVMU.js";import{a as l,c as u,i as d,l as f,n as p,t as m,u as h}from"./chunk-KYZI473N-Bb0MCaIO.js";import{a as g,i as _,n as v,r as y,t as b}from"./chunk-O4XLMI2P-nDhi_cVu.js";function x(t){var n={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:S(t),edges:C(t)};return e(t.graph())||(n.value=r(t.graph())),n}function S(n){return t(n.nodes(),function(t){var r=n.node(t),i=n.parent(t),a={v:t};return e(r)||(a.value=r),e(i)||(a.parent=i),a})}function C(n){return t(n.edges(),function(t){var r=n.edge(t),i={v:t.v,w:t.w};return e(t.name)||(i.name=t.name),e(r)||(i.value=r),i})}var w=new Map,T=new Map,E=new Map,D=o(()=>{T.clear(),E.clear(),w.clear()},`clear`),O=o((e,t)=>{let n=T.get(t)||[];return a.trace(`In isDescendant`,t,` `,e,` = `,n.includes(e)),n.includes(e)},`isDescendant`),k=o((e,t)=>{let n=T.get(t)||[];return a.info(`Descendants of `,t,` is `,n),a.info(`Edge is `,e),e.v===t||e.w===t?!1:n?n.includes(e.v)||O(e.v,t)||O(e.w,t)||n.includes(e.w):(a.debug(`Tilt, `,t,`,not in descendants`),!1)},`edgeInCluster`),A=o((e,t,n,r)=>{a.warn(`Copying children of `,e,`root`,r,`data`,t.node(e),r);let i=t.children(e)||[];e!==r&&i.push(e),a.warn(`Copying (nodes) clusterId`,e,`nodes`,i),i.forEach(i=>{if(t.children(i).length>0)A(i,t,n,r);else{let o=t.node(i);a.info(`cp `,i,` to `,r,` with parent `,e),n.setNode(i,o),r!==t.parent(i)&&(a.warn(`Setting parent`,i,t.parent(i)),n.setParent(i,t.parent(i))),e!==r&&i!==e?(a.debug(`Setting parent`,i,e),n.setParent(i,e)):(a.info(`In copy `,e,`root`,r,`data`,t.node(e),r),a.debug(`Not Setting parent for node=`,i,`cluster!==rootId`,e!==r,`node!==clusterId`,i!==e));let s=t.edges(i);a.debug(`Copying Edges`,s),s.forEach(i=>{a.info(`Edge`,i);let o=t.edge(i.v,i.w,i.name);a.info(`Edge data`,o,r);try{k(i,r)?(a.info(`Copying as `,i.v,i.w,o,i.name),n.setEdge(i.v,i.w,o,i.name),a.info(`newGraph edges `,n.edges(),n.edge(n.edges()[0]))):a.info(`Skipping copy of edge `,i.v,`-->`,i.w,` rootId: `,r,` clusterId:`,e)}catch(e){a.error(e)}})}a.debug(`Removing node`,i),t.removeNode(i)})},`copy`),j=o((e,t)=>{let n=t.children(e),r=[...n];for(let i of n)E.set(i,e),r=[...r,...j(i,t)];return r},`extractDescendants`),M=o((e,t,n)=>{let r=e.edges().filter(e=>e.v===t||e.w===t),i=e.edges().filter(e=>e.v===n||e.w===n),a=r.map(e=>({v:e.v===t?n:e.v,w:e.w===t?t:e.w})),o=i.map(e=>({v:e.v,w:e.w}));return a.filter(e=>o.some(t=>e.v===t.v&&e.w===t.w))},`findCommonEdges`),N=o((e,t,n)=>{let r=t.children(e);if(a.trace(`Searching children of id `,e,r),r.length<1)return e;let i;for(let e of r){let r=N(e,t,n),a=M(t,n,r);if(r)if(a.length>0)i=r;else return r}return i},`findNonClusterChild`),P=o(e=>!w.has(e)||!w.get(e).externalConnections?e:w.has(e)?w.get(e).id:e,`getAnchorId`),F=o((e,t)=>{if(!e||t>10){a.debug(`Opting out, no graph `);return}else a.debug(`Opting in, graph `);e.nodes().forEach(function(t){e.children(t).length>0&&(a.warn(`Cluster identified`,t,` Replacement id in edges: `,N(t,e,t)),T.set(t,j(t,e)),w.set(t,{id:N(t,e,t),clusterData:e.node(t)}))}),e.nodes().forEach(function(t){let n=e.children(t),r=e.edges();n.length>0?(a.debug(`Cluster identified`,t,T),r.forEach(e=>{O(e.v,t)^O(e.w,t)&&(a.warn(`Edge: `,e,` leaves cluster `,t),a.warn(`Descendants of XXX `,t,`: `,T.get(t)),w.get(t).externalConnections=!0)})):a.debug(`Not a cluster `,t,T)});for(let t of w.keys()){let n=w.get(t).id,r=e.parent(n);r!==t&&w.has(r)&&!w.get(r).externalConnections&&(w.get(t).id=r)}e.edges().forEach(function(t){let n=e.edge(t);a.warn(`Edge `+t.v+` -> `+t.w+`: `+JSON.stringify(t)),a.warn(`Edge `+t.v+` -> `+t.w+`: `+JSON.stringify(e.edge(t)));let r=t.v,i=t.w;if(a.warn(`Fix XXX`,w,`ids:`,t.v,t.w,`Translating: `,w.get(t.v),` --- `,w.get(t.w)),w.get(t.v)||w.get(t.w)){if(a.warn(`Fixing and trying - removing XXX`,t.v,t.w,t.name),r=P(t.v),i=P(t.w),e.removeEdge(t.v,t.w,t.name),r!==t.v){let i=e.parent(r);w.get(i).externalConnections=!0,n.fromCluster=t.v}if(i!==t.w){let r=e.parent(i);w.get(r).externalConnections=!0,n.toCluster=t.w}a.warn(`Fix Replacing with XXX`,r,i,t.name),e.setEdge(r,i,n,t.name)}}),a.warn(`Adjusted Graph`,x(e)),I(e,0),a.trace(w)},`adjustClustersAndEdges`),I=o((e,t)=>{if(a.warn(`extractor - `,t,x(e),e.children(`D`)),t>10){a.error(`Bailing out`);return}let n=e.nodes(),r=!1;for(let t of n){let n=e.children(t);r||=n.length>0}if(!r){a.debug(`Done, no node has children`,e.nodes());return}a.debug(`Nodes = `,n,t);for(let r of n)if(a.debug(`Extracting node`,r,w,w.has(r)&&!w.get(r).externalConnections,!e.parent(r),e.node(r),e.children(`D`),` Depth `,t),!w.has(r))a.debug(`Not a cluster`,r,t);else if(!w.get(r).externalConnections&&e.children(r)&&e.children(r).length>0){a.warn(`Cluster without external connections, without a parent and with children`,r,t);let n=e.graph().rankdir===`TB`?`LR`:`TB`;w.get(r)?.clusterData?.dir&&(n=w.get(r).clusterData.dir,a.warn(`Fixing dir`,w.get(r).clusterData.dir,n));let o=new i({multigraph:!0,compound:!0}).setGraph({rankdir:n,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});a.warn(`Old graph before copy`,x(e)),A(r,e,o,r),e.setNode(r,{clusterNode:!0,id:r,clusterData:w.get(r).clusterData,label:w.get(r).label,graph:o}),a.warn(`New graph after copy node: (`,r,`)`,x(o)),a.debug(`Old graph after copy`,x(e))}else a.warn(`Cluster ** `,r,` **not meeting the criteria !externalConnections:`,!w.get(r).externalConnections,` no parent: `,!e.parent(r),` children `,e.children(r)&&e.children(r).length>0,e.children(`D`),t),a.debug(w);n=e.nodes(),a.warn(`New list of nodes`,n);for(let r of n){let n=e.node(r);a.warn(` Now next level`,r,n),n?.clusterNode&&I(n.graph,t+1)}},`extractor`),L=o((e,t)=>{if(t.length===0)return[];let n=Object.assign([],t);return t.forEach(t=>{let r=L(e,e.children(t));n=[...n,...r]}),n},`sorter`),R=o(e=>L(e,e.children()),`sortNodesByHierarchy`),z=o(async(e,t,r,i,s,p)=>{a.warn(`Graph in recursive render:XAX`,x(t),s);let m=t.graph().rankdir;a.trace(`Dir in recursive render - dir:`,m);let _=e.insert(`g`).attr(`class`,`root`);t.nodes()?a.info(`Recursive render XXX`,t.nodes()):a.info(`No nodes found for`,t),t.edges().length>0&&a.info(`Recursive edges`,t.edge(t.edges()[0]));let b=_.insert(`g`).attr(`class`,`clusters`),S=_.insert(`g`).attr(`class`,`edgePaths`),C=_.insert(`g`).attr(`class`,`edgeLabels`),T=_.insert(`g`).attr(`class`,`nodes`);await Promise.all(t.nodes().map(async function(e){let n=t.node(e);if(s!==void 0){let n=JSON.parse(JSON.stringify(s.clusterData));a.trace(`Setting data for parent cluster XXX
2
2
  Node.id = `,e,`
3
3
  data=`,n.height,`
4
4
  Parent cluster`,s.height),t.setNode(s.id,n),t.parent(e)||(a.trace(`Setting parent`,e,s.id),t.setParent(e,s.id,n))}if(a.info(`(Insert) Node XXX`+e+`: `+JSON.stringify(t.node(e))),n?.clusterNode){a.info(`Cluster identified XBX`,e,n.width,t.node(e));let{ranksep:o,nodesep:s}=t.graph();n.graph.setGraph({...n.graph.graph(),ranksep:o+25,nodesep:s});let c=await z(T,n.graph,r,i,t.node(e),p),l=c.elem;h(n,l),n.diff=c.diff||0,a.info(`New compound node after recursive render XAX`,e,`width`,n.width,`height`,n.height),f(l,n)}else t.children(e).length>0?(a.trace(`Cluster - the non recursive path XBX`,e,n.id,n,n.width,`Graph:`,t),a.trace(N(n.id,t)),w.set(n.id,{id:N(n.id,t),node:n})):(a.trace(`Node - the non recursive path XAX`,e,T,t.node(e),m),await l(T,t.node(e),{config:p,dir:m}))})),await o(async()=>{let e=t.edges().map(async function(e){let n=t.edge(e.v,e.w,e.name);a.info(`Edge `+e.v+` -> `+e.w+`: `+JSON.stringify(e)),a.info(`Edge `+e.v+` -> `+e.w+`: `,e,` `,JSON.stringify(t.edge(e))),a.info(`Fix`,w,`ids:`,e.v,e.w,`Translating: `,w.get(e.v),w.get(e.w)),await y(C,n)});await Promise.all(e)},`processEdges`)(),a.info(`Graph before layout:`,JSON.stringify(x(t))),a.info(`############################################# XXX`),a.info(`### Layout ### XXX`),a.info(`############################################# XXX`),n(t),a.info(`Graph after layout:`,JSON.stringify(x(t)));let E=0,{subGraphTitleTotalMargin:D}=c(p);return await Promise.all(R(t).map(async function(e){let n=t.node(e);if(a.info(`Position XBX => `+e+`: (`+n.x,`,`+n.y,`) width: `,n.width,` height: `,n.height),n?.clusterNode)n.y+=D,a.info(`A tainted cluster node XBX1`,e,n.id,n.width,n.height,n.x,n.y,t.parent(e)),w.get(n.id).node=n,u(n);else if(t.children(e).length>0){a.info(`A pure cluster node XBX1`,e,n.id,n.x,n.y,n.width,n.height,t.parent(e)),n.height+=D,t.node(n.parentId);let r=n?.padding/2||0,i=n?.labelBBox?.height||0,o=i-r||0;a.debug(`OffsetY`,o,`labelHeight`,i,`halfPadding`,r),await d(b,n),w.get(n.id).node=n}else{let e=t.node(n.parentId);n.y+=D/2,a.info(`A regular node XBX1 - using the padding`,n.id,`parent`,n.parentId,n.width,n.height,n.x,n.y,`offsetY`,n.offsetY,`parent`,e,e?.offsetY,n),u(n)}})),t.edges().forEach(function(e){let n=t.edge(e);a.info(`Edge `+e.v+` -> `+e.w+`: `+JSON.stringify(n),n),n.points.forEach(e=>e.y+=D/2),g(n,v(S,n,w,r,t.node(e.v),t.node(e.w),i))}),t.nodes().forEach(function(e){let n=t.node(e);a.info(e,n.type,n.diff),n.isGroup&&(E=n.diff)}),a.warn(`Returning from recursive render XAX`,_,E),{elem:_,diff:E}},`recursiveRender`),B=o(async(e,t)=>{let n=new i({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:e.config?.nodeSpacing||e.config?.flowchart?.nodeSpacing||e.nodeSpacing,ranksep:e.config?.rankSpacing||e.config?.flowchart?.rankSpacing||e.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),r=t.select(`g`);_(r,e.markers,e.type,e.diagramId),p(),b(),m(),D(),e.nodes.forEach(e=>{n.setNode(e.id,{...e}),e.parentId&&n.setParent(e.id,e.parentId)}),a.debug(`Edges:`,e.edges),e.edges.forEach(e=>{if(e.start===e.end){let t=e.start,r=t+`---`+t+`---1`,i=t+`---`+t+`---2`,a=n.node(t);n.setNode(r,{domId:r,id:r,parentId:a.parentId,labelStyle:``,label:``,padding:0,shape:`labelRect`,style:``,width:10,height:10}),n.setParent(r,a.parentId),n.setNode(i,{domId:i,id:i,parentId:a.parentId,labelStyle:``,padding:0,shape:`labelRect`,label:``,style:``,width:10,height:10}),n.setParent(i,a.parentId);let o=structuredClone(e),s=structuredClone(e),c=structuredClone(e);o.label=``,o.arrowTypeEnd=`none`,o.id=t+`-cyclic-special-1`,s.arrowTypeStart=`none`,s.arrowTypeEnd=`none`,s.id=t+`-cyclic-special-mid`,c.label=``,a.isGroup&&(o.fromCluster=t,c.toCluster=t),c.id=t+`-cyclic-special-2`,c.arrowTypeStart=`none`,n.setEdge(t,r,o,t+`-cyclic-special-0`),n.setEdge(r,i,s,t+`-cyclic-special-1`),n.setEdge(i,t,c,t+`-cyc<lic-special-2`)}else n.setEdge(e.start,e.end,{...e},e.id)}),a.warn(`Graph at first:`,JSON.stringify(x(n))),F(n),a.warn(`Graph after XAX:`,JSON.stringify(x(n)));let o=s();await z(r,n,e.type,e.diagramId,void 0,o)},`render`);export{B as render};
@@ -0,0 +1,2 @@
1
+ import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./react-nm2Ru1Pt.js";import{t as n}from"./createLucideIcon-PuMiQgHl.js";import{n as r,t as i}from"./x-D2_KzIET.js";import{t as a}from"./chevron-right-4zq1jPv6.js";import{t as o}from"./jsx-runtime-kMwlnEGE.js";import{t as s}from"./api-client-BfBM3I7n.js";import{Ct as c,Et as l,K as u,Mt as d,Nt as f,Q as p,Tt as m,it as h,mt as g,ot as _,pt as v,rt as y,st as b,tt as x}from"./index-DwrCg0TN.js";import"./use-monaco-theme-U9ZhfvHB.js";import{t as S}from"./sql-query-editor-OhZa4Z9F.js";import{n as C}from"./csv-parser-CNNw2RVA.js";var w=n(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),T=e(t(),1);function E(e,t,n,r){return`ppm-db-${e}-${n}.${t}-p${r}`}function D(e,t,n,r){try{let i=sessionStorage.getItem(E(e,t,n,r));return i?JSON.parse(i):null}catch{return null}}function ee(e,t,n,r,i,a){try{sessionStorage.setItem(E(e,t,n,r),JSON.stringify({data:i,cols:a}))}catch{}}function O(e){let t=`/api/db/connections/${e}`,[n,r]=(0,T.useState)(null),[i,a]=(0,T.useState)(`public`),[o,c]=(0,T.useState)(null),[l,u]=(0,T.useState)([]),[d,f]=(0,T.useState)(!1),[p,m]=(0,T.useState)(null),[h,g]=(0,T.useState)(1),[_,v]=(0,T.useState)(null),[y,b]=(0,T.useState)(null),[x,S]=(0,T.useState)(!1),[C,w]=(0,T.useState)(null),[E,O]=(0,T.useState)(`ASC`),k=(0,T.useCallback)(async(r,a,o,l,d)=>{let p=r??n,g=a??i;if(!p)return;f(!0);let _=l===void 0?C:l,v=d??E;try{let n=_?`&orderBy=${encodeURIComponent(_)}&orderDir=${v}`:``,[r,i]=await Promise.all([s.get(`${t}/data?table=${encodeURIComponent(p)}&schema=${g}&page=${o??h}&limit=100${n}`),s.get(`${t}/schema?table=${encodeURIComponent(p)}&schema=${g}`)]);c(r),u(i),ee(e,p,g,o??h,r,i)}catch(e){m(e.message)}finally{f(!1)}},[t,e,n,i,h,C,E]),A=(0,T.useCallback)((t,n=`public`)=>{r(t),a(n),g(1),v(null);let i=D(e,t,n,1);i?(c(i.data),u(i.cols),f(!1),k(t,n,1)):k(t,n,1)},[e,k]),j=(0,T.useCallback)(e=>{g(e),k(void 0,void 0,e)},[k]),M=(0,T.useCallback)(async e=>{S(!0),b(null);try{let r=await s.post(`${t}/query`,{sql:e});v(r),r.changeType===`modify`&&k(n??void 0,i)}catch(e){b(e.message)}finally{S(!1)}},[t,n,i,k]),N=(0,T.useCallback)(async(e,r,a,o)=>{if(!n)return;let c=n,l=i;try{await s.put(`${t}/cell`,{table:c,schema:l,pkColumn:e,pkValue:r,column:a,value:o}),k(c,l)}catch(e){m(e.message)}},[t,n,i,k]),P=(0,T.useCallback)(async(e,r)=>{if(!n)return;let a=n,o=i;try{await s.del(`${t}/row`,{table:a,schema:o,pkColumn:e,pkValue:r}),k(a,o)}catch(e){m(e.message)}},[t,n,i,k]);return{selectedTable:n,selectedSchema:i,selectTable:A,tableData:o,schema:l,loading:d,error:p,page:h,setPage:j,orderBy:C,orderDir:E,toggleSort:(0,T.useCallback)(e=>{let t,n=`ASC`;C===e?E===`ASC`?(t=e,n=`DESC`):(t=null,n=`ASC`):(t=e,n=`ASC`),w(t),O(n),g(1),k(void 0,void 0,1,t,n)},[C,E,k]),queryResult:_,queryError:y,queryLoading:x,executeQuery:M,updateCell:N,deleteRow:P,bulkDelete:(0,T.useCallback)(async(e,r)=>{if(!n)return;let a=n,o=i;try{await s.post(`${t}/rows/delete`,{table:a,schema:o,pkColumn:e,pkValues:r}),k(a,o)}catch(e){m(e.message)}},[t,n,i,k]),insertRow:(0,T.useCallback)(async e=>{if(!n)return;let r=n,a=i;try{await s.post(`${t}/row`,{table:r,schema:a,values:e}),k(r,a)}catch(e){throw m(e.message),e}},[t,n,i,k]),refreshData:k}}var k=o();function A(e,t,n){let r=new Blob([t],{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=e,a.click(),URL.revokeObjectURL(i)}function j({columns:e,rows:t,filename:n=`export`,exportAllUrl:r}){let[i,a]=(0,T.useState)(!1),[o,s]=(0,T.useState)(!1),c=(0,T.useRef)(null);(0,T.useEffect)(()=>{if(!i)return;let e=e=>{c.current&&!c.current.contains(e.target)&&a(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[i]);let l=()=>{let r=C(e,t.map(t=>e.map(e=>String(t[e]??``))));A(`${n}.csv`,r,`text/csv`),a(!1)},u=()=>{let e=JSON.stringify(t,null,2);A(`${n}.json`,e,`application/json`),a(!1)},d=async e=>{if(r){s(!0);try{let t=await(await fetch(`${r}&format=${e}&limit=10000`)).text(),i=e===`csv`?`text/csv`:`application/json`;A(`${n}-all.${e}`,t,i)}catch{}s(!1),a(!1)}};return e.length===0||t.length===0?null:(0,k.jsxs)(`div`,{className:`relative`,ref:c,children:[(0,k.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`p-1 rounded text-muted-foreground hover:text-foreground transition-colors`,title:`Export`,children:(0,k.jsx)(m,{className:`size-3.5`})}),i&&(0,k.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 z-50 bg-popover border border-border rounded-md shadow-md py-1 min-w-[160px] text-xs`,children:[(0,k.jsx)(`button`,{onClick:l,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors`,children:`Export Page (CSV)`}),(0,k.jsx)(`button`,{onClick:u,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors`,children:`Export Page (JSON)`}),r&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:`border-t border-border my-1`}),(0,k.jsx)(`button`,{onClick:()=>d(`csv`),disabled:o,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors disabled:opacity-50`,children:o?`Exporting…`:`Export All (CSV)`}),(0,k.jsx)(`button`,{onClick:()=>d(`json`),disabled:o,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors disabled:opacity-50`,children:o?`Exporting…`:`Export All (JSON)`})]})]})]})}function M({tableData:e,schema:t,loading:n,page:o,onPageChange:s,onCellUpdate:c,onRowDelete:l,orderBy:m,orderDir:g,onToggleSort:y,onBulkDelete:S,onInsertRow:C,connectionId:E,selectedTable:D,selectedSchema:ee,connectionName:O,onColumnFilter:A}){let[M,N]=(0,T.useState)(null),[P,F]=(0,T.useState)(``),[I,L]=(0,T.useState)(null),[R,re]=(0,T.useState)(``),[z,B]=(0,T.useState)(new Set),[ie,ae]=(0,T.useState)(!1),[oe,V]=(0,T.useState)({}),[se,H]=(0,T.useState)(null),[ce,U]=(0,T.useState)(!1),{openTab:le}=u(),ue=(0,T.useCallback)(e=>{le({type:`editor`,title:e.col,projectId:null,closable:!0,metadata:{inlineContent:e.value,inlineLanguage:te(e.value)}})},[le]),[W,de]=(0,T.useState)(new Set),[G,fe]=(0,T.useState)(new Set),[K,pe]=(0,T.useState)({}),[me,he]=(0,T.useState)(null),q=(0,T.useMemo)(()=>t.find(e=>e.pk)?.name||(t.find(e=>e.name.toLowerCase()===`id`)?.name??null),[t]),ge=(0,T.useRef)(M);ge.current=M;let J=(0,T.useRef)(P);J.current=P;let _e=(0,T.useRef)(z);_e.current=z;let ve=(0,T.useRef)(I);ve.current=I;let ye=(0,T.useCallback)((e,t,n)=>{N({rowIdx:e,col:t}),F(n==null?``:typeof n==`object`?JSON.stringify(n):String(n))},[]),be=(0,T.useCallback)(()=>{let t=ge.current;if(!t||!e||!q)return;let n=e.rows[t.rowIdx];if(!n)return;let r=n[t.col];String(r??``)!==J.current&&c(q,n[q],t.col,J.current===``?null:J.current),N(null)},[e,q,c]),xe=(0,T.useCallback)(()=>N(null),[]),Se=(0,T.useCallback)(t=>{if(!e||!q||!l)return;let n=e.rows[t];n&&(l(q,n[q]),L(null))},[e,q,l]),Ce=(0,T.useCallback)(e=>{de(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),we=(0,T.useCallback)(e=>{fe(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Te=(0,T.useCallback)((e,t)=>{pe(n=>{let r={...n};return t?r[e]=t:delete r[e],r})},[]),Ee=(0,T.useRef)(K);(0,T.useEffect)(()=>{Ee.current!==K&&(Ee.current=K,A?.(K))},[K,A]);let De=(0,T.useCallback)(e=>{B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Oe=(0,T.useCallback)(()=>{e&&B(t=>t.size===e.rows.length?new Set:new Set(e.rows.map((e,t)=>t)))},[e]),ke=(0,T.useCallback)(()=>{!e||!q||!S||(S(q,Array.from(z).map(t=>e.rows[t]?.[q]).filter(e=>e!=null)),B(new Set),U(!1))},[e,q,S,z]),Ae=(0,T.useCallback)(async()=>{if(C){H(null);try{let e={};for(let[t,n]of Object.entries(oe))n!==``&&(e[t]=n);await C(e),ae(!1),V({})}catch(e){H(e.message)}}},[C,oe]),Y=(0,T.useMemo)(()=>{if(!e||!R)return e?.rows??[];let t=R.toLowerCase();return e.rows.filter(n=>e.columns.some(e=>String(n[e]??``).toLowerCase().includes(t)))},[e,R]),je=(0,T.useRef)(null);if((0,T.useEffect)(()=>{let t=je.current;if(!t)return;let n=t=>{if(!(t.metaKey||t.ctrlKey)||!e)return;let n=t.target?.tagName;if(!(n===`INPUT`||n===`TEXTAREA`)&&(t.key===`a`&&(t.preventDefault(),B(new Set(e.rows.map((e,t)=>t)))),t.key===`c`&&z.size>0)){t.preventDefault();let n=e.columns,r=n.join(` `),i=Array.from(z).sort((e,t)=>e-t).map(t=>n.map(n=>{let r=e.rows[t]?.[n];return r==null?``:typeof r==`object`?JSON.stringify(r):String(r)}).join(` `));navigator.clipboard.writeText([r,...i].join(`
2
+ `))}};return t.addEventListener(`keydown`,n),()=>t.removeEventListener(`keydown`,n)},[e,z]),!e)return(0,k.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs text-muted-foreground`,children:n?(0,k.jsx)(v,{className:`size-4 animate-spin`}):`Select a table`});let Me=Math.ceil(e.total/e.limit)||1,Ne=z.size>0,Pe=z.size===e.rows.length&&e.rows.length>0,X=(0,T.useMemo)(()=>{let t=e.columns.filter(e=>W.has(e)),n=e.columns.filter(e=>!W.has(e));return[...t,...n]},[e.columns,W]),Fe=(0,T.useRef)(null),[Z,Ie]=(0,T.useState)(0),[Q,Le]=(0,T.useState)(new Map);(0,T.useEffect)(()=>{let e=Fe.current;if(!e)return;let t=()=>{Ie(e.offsetHeight);let t=new Map;e.querySelectorAll(`th[data-col]`).forEach(e=>{t.set(e.dataset.col,e.offsetWidth)});let n=e.querySelector(`th[data-col='_cb']`);n&&t.set(`_cb`,n.offsetWidth),Le(t)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[e?.columns,W]);let Re=(0,T.useMemo)(()=>{let e=new Map,t=Q.get(`_cb`)??(q?40:0);for(let n of X){if(!W.has(n))break;e.set(n,t),t+=Q.get(n)??100}return e},[X,W,q,Q]),$=(0,T.useMemo)(()=>Array.from(G).sort((e,t)=>e-t).map(e=>({idx:e,row:Y[e]})).filter(e=>e.row),[G,Y]),ze=(0,T.useRef)(new Map),[Be,Ve]=(0,T.useState)(new Map),He=(0,T.useCallback)((e,t)=>{t?ze.current.set(e,t):ze.current.delete(e)},[]);(0,T.useEffect)(()=>{if($.length===0){Be.size>0&&Ve(new Map);return}let e=requestAnimationFrame(()=>{let e=new Map;for(let{idx:t}of $){let n=ze.current.get(t);n&&e.set(t,n.offsetHeight)}Ve(e)});return()=>cancelAnimationFrame(e)},[$,e]);let Ue=(0,T.useMemo)(()=>{let e=new Map,t=Z;for(let{idx:n}of $)e.set(n,t),t+=Be.get(n)??28;return e},[Z,$,Be]);return(0,k.jsxs)(`div`,{ref:je,tabIndex:0,className:`flex flex-col h-full overflow-hidden outline-none`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1 border-b border-border bg-background shrink-0`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-1 flex-1`,children:[(0,k.jsx)(x,{className:`size-3 text-muted-foreground`}),(0,k.jsx)(`input`,{type:`text`,value:R,onChange:e=>re(e.target.value),placeholder:`Search current page…`,className:`flex-1 text-xs bg-transparent outline-none text-foreground placeholder:text-muted-foreground`}),R&&(0,k.jsx)(`button`,{type:`button`,onClick:()=>re(``),className:`text-muted-foreground hover:text-foreground`,children:(0,k.jsx)(i,{className:`size-3`})})]}),Ne&&(0,k.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,k.jsxs)(`span`,{className:`text-muted-foreground`,children:[z.size,` selected`]}),S&&q&&(ce?(0,k.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,k.jsxs)(`button`,{type:`button`,onClick:ke,className:`text-destructive text-[10px] font-medium hover:underline`,children:[`Delete `,z.size,`?`]}),(0,k.jsx)(`button`,{type:`button`,onClick:()=>U(!1),className:`text-muted-foreground text-[10px] hover:underline`,children:`Cancel`})]}):(0,k.jsx)(`button`,{type:`button`,onClick:()=>U(!0),className:`p-0.5 text-muted-foreground hover:text-destructive`,children:(0,k.jsx)(p,{className:`size-3`})})),(0,k.jsx)(j,{columns:e.columns,rows:Array.from(z).map(t=>e.rows[t]).filter(Boolean),filename:`${O??`db`}-selected`})]}),C&&(0,k.jsx)(`button`,{type:`button`,onClick:()=>{ae(!0),V({}),H(null)},className:`p-0.5 rounded text-muted-foreground hover:text-primary transition-colors`,title:`Insert row`,children:(0,k.jsx)(h,{className:`size-3.5`})})]}),ie&&(0,k.jsxs)(`div`,{className:`px-2 py-1.5 border-b border-border bg-muted/30 text-xs space-y-1`,children:[(0,k.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.filter(e=>!e.pk).map(e=>(0,k.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,k.jsx)(`label`,{className:`text-muted-foreground text-[10px] w-16 truncate`,title:e.name,children:e.name}),(0,k.jsx)(`input`,{value:oe[e.name]??``,onChange:t=>V(n=>({...n,[e.name]:t.target.value})),placeholder:e.defaultValue??(e.nullable?`NULL`:``),className:`h-5 w-24 text-[11px] px-1 rounded border border-border bg-background outline-none focus:border-primary`})]},e.name))}),(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(`button`,{type:`button`,onClick:Ae,className:`text-[10px] px-2 py-0.5 rounded bg-primary text-primary-foreground hover:bg-primary/90`,children:`Save`}),(0,k.jsx)(`button`,{type:`button`,onClick:()=>ae(!1),className:`text-[10px] text-muted-foreground hover:underline`,children:`Cancel`}),se&&(0,k.jsx)(`span`,{className:`text-[10px] text-destructive`,children:se})]})]}),(0,k.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,k.jsxs)(`table`,{className:`w-full text-xs`,style:{borderCollapse:`separate`,borderSpacing:0},children:[(0,k.jsx)(`thead`,{ref:Fe,className:`sticky top-0 z-20 bg-muted`,children:(0,k.jsxs)(`tr`,{children:[q&&(0,k.jsx)(`th`,{"data-col":`_cb`,className:`px-2 py-1.5 text-left font-medium text-muted-foreground border-b border-border w-10 bg-muted`,style:{position:`sticky`,left:0,zIndex:30},children:(0,k.jsx)(`input`,{type:`checkbox`,checked:Pe,onChange:Oe,className:`size-3 accent-primary`})}),X.map(e=>{let n=t.find(t=>t.name===e)?.pk,a=m===e,o=W.has(e),s=!!K[e],c=me===e,l=Re.get(e);return(0,k.jsxs)(`th`,{"data-col":e,className:`group/th px-2 py-1.5 text-left font-medium text-muted-foreground border-b border-border whitespace-nowrap bg-muted ${o?`border-r border-r-primary/20`:``}`,style:l==null?void 0:{position:`sticky`,left:l,zIndex:25},children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,k.jsxs)(`button`,{type:`button`,onClick:()=>y(e),className:`flex items-center gap-0.5 ${n?`font-bold`:``} hover:text-foreground transition-colors`,children:[e,a&&g===`ASC`&&(0,k.jsx)(d,{className:`size-3`}),a&&g===`DESC`&&(0,k.jsx)(r,{className:`size-3`})]}),A&&(0,k.jsx)(`button`,{type:`button`,title:`Filter column`,onClick:()=>he(c?null:e),className:`p-0.5 rounded transition-colors ${s||c?`text-primary`:`text-muted-foreground/40 md:opacity-0 md:group-hover/th:opacity-100 hover:text-foreground`}`,children:(0,k.jsx)(w,{className:`size-2.5`})}),(0,k.jsx)(`button`,{type:`button`,title:o?`Unpin column`:`Pin column`,onClick:()=>Ce(e),className:`p-0.5 rounded transition-colors ${o?`text-primary`:`text-muted-foreground/40 md:opacity-0 md:group-hover/th:opacity-100 hover:text-foreground`}`,children:o?(0,k.jsx)(b,{className:`size-2.5`}):(0,k.jsx)(_,{className:`size-2.5`})})]}),c&&(0,k.jsxs)(`div`,{className:`mt-1 flex items-center gap-1`,children:[(0,k.jsx)(`input`,{autoFocus:!0,type:`text`,value:K[e]??``,placeholder:`ILIKE filter…`,onChange:t=>Te(e,t.target.value),onKeyDown:e=>{e.key===`Escape`&&he(null)},className:`w-full h-5 text-[10px] px-1 rounded border border-border bg-background outline-none focus:border-primary`}),s&&(0,k.jsx)(`button`,{type:`button`,onClick:()=>Te(e,``),className:`text-muted-foreground hover:text-foreground`,children:(0,k.jsx)(i,{className:`size-2.5`})})]})]},e)}),l&&q&&(0,k.jsx)(`th`,{className:`px-2 py-1.5 border-b border-border w-14 bg-muted`})]})}),(0,k.jsxs)(`tbody`,{children:[$.map(({idx:e,row:t})=>(0,k.jsx)(ne,{row:t,rowIdx:e,columns:X,selected:z.has(e),onToggleSelect:De,pkCol:q,editingCell:M,editValue:P,onStartEdit:ye,onCommitEdit:be,onCancelEdit:xe,onSetEditValue:F,showDelete:!!l,confirmingDelete:I===e,onDelete:Se,onConfirmDelete:L,onViewCell:ue,pinned:!0,onTogglePin:we,pinnedCols:W,pinnedColOffsets:Re,stickyTop:Ue.get(e)??Z,trRef:t=>He(e,t)},`pin-${e}`)),Y.map((e,t)=>G.has(t)?null:(0,k.jsx)(ne,{row:e,rowIdx:t,columns:X,selected:z.has(t),onToggleSelect:De,pkCol:q,editingCell:M,editValue:P,onStartEdit:ye,onCommitEdit:be,onCancelEdit:xe,onSetEditValue:F,showDelete:!!l,confirmingDelete:I===t,onDelete:Se,onConfirmDelete:L,onViewCell:ue,pinned:!1,onTogglePin:we,pinnedCols:W,pinnedColOffsets:Re},t)),Y.length===0&&(0,k.jsx)(`tr`,{children:(0,k.jsx)(`td`,{colSpan:X.length+2,className:`px-2 py-8 text-center text-muted-foreground`,children:`No data`})})]})]})}),(0,k.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-1.5 border-t border-border bg-background shrink-0 text-xs text-muted-foreground`,children:[(0,k.jsxs)(`span`,{children:[e.total.toLocaleString(),` rows`]}),(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(`button`,{type:`button`,disabled:o<=1,onClick:()=>s(o-1),className:`p-0.5 rounded hover:bg-muted disabled:opacity-30`,children:(0,k.jsx)(f,{className:`size-3.5`})}),(0,k.jsxs)(`span`,{children:[o,` / `,Me]}),(0,k.jsx)(`button`,{type:`button`,disabled:o>=Me,onClick:()=>s(o+1),className:`p-0.5 rounded hover:bg-muted disabled:opacity-30`,children:(0,k.jsx)(a,{className:`size-3.5`})})]})]})]})}function N(e){return e==null?`NULL`:typeof e==`object`?JSON.stringify(e):String(e)}var P=200;function F(e){if(e==null)return!1;if(typeof e==`object`)return!0;let t=String(e);if(t.length>=P)return!0;let n=t.trimStart();return!!((n[0]===`{`||n[0]===`[`)&&(n.endsWith(`}`)||n.endsWith(`]`))||n.startsWith(`<?xml`)||n.startsWith(`<`)&&n.endsWith(`>`))}function te(e){let t=e.trimStart();if(t[0]===`{`||t[0]===`[`)try{return JSON.parse(t),`json`}catch{}return t.startsWith(`<?xml`)||t.startsWith(`<`)&&/<\/\w+>/.test(t)?`xml`:t.startsWith(`---`)||/^\w+:\s/m.test(t)?`yaml`:`plaintext`}var ne=(0,T.memo)(function({row:e,rowIdx:t,columns:n,selected:r,onToggleSelect:i,pkCol:a,editingCell:o,editValue:s,onStartEdit:l,onCommitEdit:u,onCancelEdit:d,onSetEditValue:f,showDelete:m,confirmingDelete:h,onDelete:g,onConfirmDelete:v,onViewCell:y,pinned:x,onTogglePin:S,pinnedCols:C,pinnedColOffsets:w,stickyTop:T,trRef:E}){let D=x?`bg-muted`:r?`bg-primary/5`:`bg-background`;return(0,k.jsxs)(`tr`,{ref:E,className:`group ${x?``:`hover:bg-muted/30`}`,style:x?{position:`sticky`,top:T,zIndex:15}:void 0,children:[a&&(0,k.jsx)(`td`,{className:`px-1 py-1 border-b border-border/50 ${D}`,style:{position:`sticky`,left:0,zIndex:12},children:(0,k.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,k.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>i(t),className:`size-3 accent-primary`}),(0,k.jsx)(`button`,{type:`button`,title:x?`Unpin row`:`Pin row`,onClick:()=>S(t),className:`p-0.5 rounded transition-colors ${x?`text-primary`:`text-muted-foreground/30 md:opacity-0 md:group-hover:opacity-100 hover:text-foreground`}`,children:x?(0,k.jsx)(b,{className:`size-2.5`}):(0,k.jsx)(_,{className:`size-2.5`})})]})}),n.map(n=>{let r=o?.rowIdx===t&&o?.col===n,i=e[n],p=!r&&F(i),m=C.has(n),h=w.get(n);return(0,k.jsx)(`td`,{className:`px-2 py-1 max-w-[300px] border-b border-border/50 ${m?`border-r border-r-primary/20`:``} ${m||x?D:``}`,style:h==null?void 0:{position:`sticky`,left:h,zIndex:10},children:r?(0,k.jsx)(`input`,{autoFocus:!0,className:`w-full bg-transparent border border-primary/50 rounded px-1 py-0 text-xs outline-none`,value:s,onChange:e=>f(e.target.value),onBlur:u,onKeyDown:e=>{e.key===`Enter`&&u(),e.key===`Escape`&&d()}}):(0,k.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,k.jsx)(`span`,{className:`cursor-pointer truncate flex-1 ${i==null?`text-muted-foreground/40 italic`:``}`,onDoubleClick:()=>a&&l(t,n,i),title:N(i),children:N(i)}),p&&(0,k.jsx)(`button`,{type:`button`,title:`View full content`,onClick:()=>y({col:n,value:N(i)}),className:`shrink-0 p-0.5 rounded text-muted-foreground/50 hover:text-foreground transition-colors`,children:(0,k.jsx)(c,{className:`size-3`})})]})},n)}),m&&a&&(0,k.jsx)(`td`,{className:`px-2 py-1 border-b border-border/50 ${x?D:``}`,children:h?(0,k.jsxs)(`span`,{className:`flex items-center gap-1 whitespace-nowrap`,children:[(0,k.jsx)(`button`,{type:`button`,onClick:()=>g(t),className:`text-destructive text-[10px] font-medium hover:underline`,children:`Confirm`}),(0,k.jsx)(`button`,{type:`button`,onClick:()=>v(null),className:`text-muted-foreground text-[10px] hover:underline`,children:`Cancel`})]}):(0,k.jsx)(`button`,{type:`button`,onClick:()=>v(t),className:`p-0.5 rounded md:opacity-0 md:group-hover:opacity-100 hover:bg-destructive/10 hover:text-destructive transition-opacity`,title:`Delete row`,children:(0,k.jsx)(p,{className:`size-3`})})})]})});function I({metadata:e}){let t=e?.connectionId,n=e?.connectionName,r=e?.tableName,i=e?.schemaName??`public`,a=e?.initialSql,o=O(t),[c,u]=(0,T.useState)([]),[d,f]=(0,T.useState)(180),p=(0,T.useRef)(null),[m,h]=(0,T.useState)({}),_=(0,T.useMemo)(()=>{if(a&&!o.selectedTable)return a;if(o.selectedTable){let e=`SELECT * FROM "${o.selectedTable}"`,t=Object.entries(m).filter(([,e])=>e.trim()).map(([e,t])=>`"${e}" ILIKE '%${t.replace(/'/g,`''`)}%'`);t.length>0&&(e+=` WHERE ${t.join(` AND `)}`),o.orderBy&&(e+=` ORDER BY "${o.orderBy}" ${o.orderDir}`);let n=(o.page-1)*100;return e+=` LIMIT 100`,n>0&&(e+=` OFFSET ${n}`),e}return`SELECT * FROM `},[a,o.selectedTable,o.orderBy,o.orderDir,o.page,m]),v=(0,T.useCallback)(e=>{h(e)},[]),b=(0,T.useRef)(void 0);(0,T.useEffect)(()=>{if(!(!o.selectedTable||Object.keys(m).length===0))return clearTimeout(b.current),b.current=setTimeout(()=>{o.executeQuery(_),D(!0)},500),()=>clearTimeout(b.current)},[m]);let x=(0,T.useCallback)(e=>{e.preventDefault();let t=e.clientY,n=d,r=e=>{let r=e.clientY-t;f(Math.max(80,Math.min(n+r,(p.current?.clientHeight??600)-100)))},i=()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i)};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)},[d]);(0,T.useEffect)(()=>{s.get(`/api/db/connections/${t}/tables?cached=1`).then(e=>u(e.map(e=>({name:e.name,schema:e.schema})))).catch(()=>{})},[t]);let C=(0,T.useMemo)(()=>{if(c.length!==0)return{tables:c,getColumns:async(e,n)=>await s.get(`/api/db/connections/${t}/schema?table=${encodeURIComponent(e)}${n?`&schema=${encodeURIComponent(n)}`:``}`)}},[t,c]),w=(0,T.useRef)(!1);(0,T.useEffect)(()=>{w.current||(w.current=!0,a?o.executeQuery(a):r&&o.selectTable(r,i))},[r,i,a]);let[E,D]=(0,T.useState)(!!a),ee=(0,T.useCallback)(e=>{D(!0),o.executeQuery(e)},[o.executeQuery]),A=(0,T.useCallback)(e=>{D(!1),o.toggleSort(e)},[o.toggleSort]),N=(0,T.useCallback)(e=>{D(!1),o.setPage(e)},[o.setPage]),P=o.queryResult,F=E&&!!(P||o.queryError),te=o.selectedTable&&!F;return(0,k.jsx)(`div`,{ref:p,className:`flex h-full w-full overflow-hidden`,children:(0,k.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border bg-background shrink-0`,children:[(0,k.jsx)(l,{className:`size-3.5 text-muted-foreground`}),(0,k.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:n??`Database`}),o.selectedTable&&(0,k.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`/ `,o.selectedTable]}),(0,k.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[o.tableData&&(0,k.jsx)(j,{columns:o.tableData.columns,rows:o.tableData.rows,filename:n?`${n}-${o.selectedTable??`data`}`:o.selectedTable??`data`,exportAllUrl:o.selectedTable?`/api/db/connections/${t}/export?table=${encodeURIComponent(o.selectedTable)}&schema=${o.selectedSchema}`:void 0}),(0,k.jsx)(`button`,{type:`button`,onClick:()=>o.refreshData(),title:`Reload data`,className:`p-1 rounded text-muted-foreground hover:text-foreground transition-colors`,children:(0,k.jsx)(y,{className:`size-3 ${o.loading?`animate-spin`:``}`})})]})]}),(0,k.jsx)(`div`,{className:`shrink-0 border-b border-border`,style:{height:d},children:(0,k.jsx)(S,{onExecute:ee,loading:o.queryLoading,defaultValue:_,schemaInfo:C})}),(0,k.jsx)(`div`,{onMouseDown:x,className:`shrink-0 h-1.5 cursor-row-resize bg-border/50 hover:bg-primary/30 flex items-center justify-center transition-colors`,children:(0,k.jsx)(g,{className:`size-3 text-muted-foreground/50`})}),(0,k.jsxs)(`div`,{className:`flex-1 overflow-hidden`,children:[te&&(0,k.jsx)(M,{tableData:o.tableData,schema:o.schema,loading:o.loading,page:o.page,onPageChange:N,onCellUpdate:o.updateCell,onRowDelete:o.deleteRow,orderBy:o.orderBy,orderDir:o.orderDir,onToggleSort:A,onBulkDelete:o.bulkDelete,onInsertRow:o.insertRow,connectionId:t,selectedTable:o.selectedTable,selectedSchema:o.selectedSchema,connectionName:n,onColumnFilter:v}),F&&(0,k.jsx)(R,{result:P,error:o.queryError,loading:o.queryLoading,schema:o.schema,connectionName:n})]})]})})}var L=()=>{};function R({result:e,error:t,loading:n,schema:r,connectionName:i}){let a=(0,T.useMemo)(()=>e?.changeType===`select`&&e.rows.length>0?{columns:e.columns,rows:e.rows,total:e.rows.length,limit:e.rows.length}:null,[e]),o=(0,T.useMemo)(()=>r?.length?r:(e?.columns??[]).map(e=>({name:e,type:`text`,nullable:!0,pk:!1,defaultValue:null})),[r,e?.columns]);return(0,k.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden text-xs`,children:[t&&(0,k.jsx)(`div`,{className:`px-3 py-2 text-destructive bg-destructive/5 shrink-0`,children:t}),e?.changeType===`modify`&&(0,k.jsxs)(`div`,{className:`px-3 py-2 text-green-500 shrink-0`,children:[e.rowsAffected,` row(s) affected`,e.executionTimeMs!=null&&(0,k.jsxs)(`span`,{className:`text-muted-foreground ml-2`,children:[e.executionTimeMs,`ms`]})]}),a&&(0,k.jsxs)(`div`,{className:`flex-1 overflow-hidden`,children:[(0,k.jsx)(M,{tableData:a,schema:o,loading:!!n,page:1,onPageChange:L,onCellUpdate:L,orderBy:null,orderDir:`ASC`,onToggleSort:L,connectionName:i}),e?.executionTimeMs!=null&&(0,k.jsxs)(`div`,{className:`px-3 py-0.5 border-t border-border text-[10px] text-muted-foreground shrink-0`,children:[e.rows.length,` rows · `,e.executionTimeMs,`ms`]})]}),e?.changeType===`select`&&e.rows.length===0&&(0,k.jsxs)(`div`,{className:`px-3 py-2 text-muted-foreground shrink-0`,children:[`No results`,e.executionTimeMs!=null&&(0,k.jsxs)(`span`,{className:`ml-2 text-muted-foreground/60`,children:[e.executionTimeMs,`ms`]})]}),!e&&!t&&(0,k.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:n?(0,k.jsx)(v,{className:`size-4 animate-spin`}):`Run a query to see results`})]})}export{I as DatabaseViewer};
@@ -1,4 +1,4 @@
1
- import"./chunk-XZSTWKYB-Cb0iqycX.js";import{r as e}from"./chunk-GEFDOKGD-tDjHsAUs.js";import"./chunk-R5LLSJPH-CMY0PkRK.js";import"./chunk-7E7YKBS2-CkFGv6Zs.js";import"./chunk-EGIJ26TM-Cpr87sBR.js";import"./chunk-C72U2L5F-CtqKiH4q.js";import"./chunk-XIRO2GV7-DRJEb7Zb.js";import"./chunk-L3YUKLVL-HG_eMj_C.js";import"./chunk-OZEHJAEY-rG0P22U9.js";import{g as t,h as n,p as r}from"./src-Dw4QhedI.js";import{B as i,C as a,V as o,W as s,_ as c,a as l,c as u,d,v as f,y as p}from"./chunk-7R4GIKGN-Dvbyu4Zw.js";import{t as m}from"./ordinal-LFEjVtwQ.js";import{t as h}from"./defaultLocale-CrJzLgRD.js";import{t as g}from"./chunk-HHEYEP7N-BBw_z0fW.js";import"./dist-Cep75xXf.js";import{t as _}from"./chunk-4BX2VUAB-C3aZvW7B.js";import{t as v}from"./mermaid-parser.core-8u2leTXI.js";import{t as y}from"./chunk-KX2RTZJC-DP36BDiU.js";import{i as b,n as x}from"./chunk-PQ6SQG4A-DX0xW7kO.js";function S(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function C(){return this.eachAfter(S)}function w(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function T(e,t){for(var n=this,r=[n],i,a,o=-1;n=r.pop();)if(e.call(t,n,++o,this),i=n.children)for(a=i.length-1;a>=0;--a)r.push(i[a]);return this}function E(e,t){for(var n=this,r=[n],i=[],a,o,s,c=-1;n=r.pop();)if(i.push(n),a=n.children)for(o=0,s=a.length;o<s;++o)r.push(a[o]);for(;n=i.pop();)e.call(t,n,++c,this);return this}function D(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function O(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function k(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function A(e){for(var t=this,n=j(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function j(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function M(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function N(){return Array.from(this)}function P(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function F(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*I(){var e=this,t,n=[e],r,i,a;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,a=r.length;i<a;++i)n.push(r[i]);while(n.length)}function L(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=B)):t===void 0&&(t=z);for(var n=new U(e),r,i=[n],a,o,s,c;r=i.pop();)if((o=t(r.data))&&(c=(o=Array.from(o)).length))for(r.children=o,s=c-1;s>=0;--s)i.push(a=o[s]=new U(o[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(H)}function R(){return L(this).eachBefore(V)}function z(e){return e.children}function B(e){return Array.isArray(e)?e[1]:null}function V(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function H(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function U(e){this.data=e,this.depth=this.height=0,this.parent=null}U.prototype=L.prototype={constructor:U,count:C,each:w,eachAfter:E,eachBefore:T,find:D,sum:O,sort:k,path:A,ancestors:M,descendants:N,leaves:P,links:F,copy:R,[Symbol.iterator]:I};function W(e){if(typeof e!=`function`)throw Error();return e}function G(){return 0}function K(e){return function(){return e}}function q(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function J(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(r-t)/e.value;++s<c;)o=a[s],o.y0=n,o.y1=i,o.x0=t,o.x1=t+=o.value*l}function ee(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(i-n)/e.value;++s<c;)o=a[s],o.x0=t,o.x1=r,o.y0=n,o.y1=n+=o.value*l}var te=(1+Math.sqrt(5))/2;function ne(e,t,n,r,i,a){for(var o=[],s=t.children,c,l,u=0,d=0,f=s.length,p,m,h=t.value,g,_,v,y,b,x,S;u<f;){p=i-n,m=a-r;do g=s[d++].value;while(!g&&d<f);for(_=v=g,x=Math.max(m/p,p/m)/(h*e),S=g*g*x,b=Math.max(v/S,S/_);d<f;++d){if(g+=l=s[d].value,l<_&&(_=l),l>v&&(v=l),S=g*g*x,y=Math.max(v/S,S/_),y>b){g-=l;break}b=y}o.push(c={value:g,dice:p<m,children:s.slice(u,d)}),c.dice?J(c,n,r,i,h?r+=m*g/h:a):ee(c,n,r,h?n+=p*g/h:i,a),h-=g,u=d}return o}var re=(function e(t){function n(e,n,r,i,a){ne(t,e,n,r,i,a)}return n.ratio=function(t){return e((t=+t)>1?t:1)},n})(te);function ie(){var e=re,t=!1,n=1,r=1,i=[0],a=G,o=G,s=G,c=G,l=G;function u(e){return e.x0=e.y0=0,e.x1=n,e.y1=r,e.eachBefore(d),i=[0],t&&e.eachBefore(q),e}function d(t){var n=i[t.depth],r=t.x0+n,u=t.y0+n,d=t.x1-n,f=t.y1-n;d<r&&(r=d=(r+d)/2),f<u&&(u=f=(u+f)/2),t.x0=r,t.y0=u,t.x1=d,t.y1=f,t.children&&(n=i[t.depth+1]=a(t)/2,r+=l(t)-n,u+=o(t)-n,d-=s(t)-n,f-=c(t)-n,d<r&&(r=d=(r+d)/2),f<u&&(u=f=(u+f)/2),e(t,r,u,d,f))}return u.round=function(e){return arguments.length?(t=!!e,u):t},u.size=function(e){return arguments.length?(n=+e[0],r=+e[1],u):[n,r]},u.tile=function(t){return arguments.length?(e=W(t),u):e},u.padding=function(e){return arguments.length?u.paddingInner(e).paddingOuter(e):u.paddingInner()},u.paddingInner=function(e){return arguments.length?(a=typeof e==`function`?e:K(+e),u):a},u.paddingOuter=function(e){return arguments.length?u.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e):u.paddingTop()},u.paddingTop=function(e){return arguments.length?(o=typeof e==`function`?e:K(+e),u):o},u.paddingRight=function(e){return arguments.length?(s=typeof e==`function`?e:K(+e),u):s},u.paddingBottom=function(e){return arguments.length?(c=typeof e==`function`?e:K(+e),u):c},u.paddingLeft=function(e){return arguments.length?(l=typeof e==`function`?e:K(+e),u):l},u}var Y=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=o,this.getAccTitle=f,this.setDiagramTitle=s,this.getDiagramTitle=a,this.getAccDescription=c,this.setAccDescription=i}static{n(this,`TreeMapDB`)}getNodes(){return this.nodes}getConfig(){let t=d,n=p();return e({...t.treemap,...n.treemap??{}})}addNode(e,t){this.nodes.push(e),this.levels.set(e,t),t===0&&(this.outerNodes.push(e),this.root??=e)}getRoot(){return{name:``,children:this.outerNodes}}addClass(e,t){let n=this.classes.get(e)??{id:e,styles:[],textStyles:[]},r=t.replace(/\\,/g,`§§§`).replace(/,/g,`;`).replace(/§§§/g,`,`).split(`;`);r&&r.forEach(e=>{x(e)&&(n?.textStyles?n.textStyles.push(e):n.textStyles=[e]),n?.styles?n.styles.push(e):n.styles=[e]}),this.classes.set(e,n)}getClasses(){return this.classes}getStylesForClass(e){return this.classes.get(e)?.styles??[]}clear(){l(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function X(e){if(!e.length)return[];let t=[],n=[];return e.forEach(e=>{let r={name:e.name,children:e.type===`Leaf`?void 0:[]};for(r.classSelector=e?.classSelector,e?.cssCompiledStyles&&(r.cssCompiledStyles=e.cssCompiledStyles),e.type===`Leaf`&&e.value!==void 0&&(r.value=e.value);n.length>0&&n[n.length-1].level>=e.level;)n.pop();if(n.length===0)t.push(r);else{let e=n[n.length-1].node;e.children?e.children.push(r):e.children=[r]}e.type!==`Leaf`&&n.push({node:r,level:e.level})}),t}n(X,`buildHierarchy`);var ae=n((e,t)=>{_(e,t);let r=[];for(let n of e.TreemapRows??[])n.$type===`ClassDefStatement`&&t.addClass(n.className??``,n.styleText??``);for(let n of e.TreemapRows??[]){let e=n.item;if(!e)continue;let i=n.indent?parseInt(n.indent):0,a=oe(e),o=e.classSelector?t.getStylesForClass(e.classSelector):[],s=o.length>0?o:void 0,c={level:i,name:a,type:e.$type,value:e.value,classSelector:e.classSelector,cssCompiledStyles:s};r.push(c)}let i=X(r),a=n((e,n)=>{for(let r of e)t.addNode(r,n),r.children&&r.children.length>0&&a(r.children,n+1)},`addNodesRecursively`);a(i,0)},`populate`),oe=n(e=>e.name?String(e.name):``,`getItemName`),Z={parser:{yy:void 0},parse:n(async e=>{try{let n=await v(`treemap`,e);t.debug(`Treemap AST:`,n);let r=Z.parser?.yy;if(!(r instanceof Y))throw Error(`parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);ae(n,r)}catch(e){throw t.error(`Error parsing treemap:`,e),e}},`parse`)},se=10,Q=10,$=25,ce={draw:n((e,i,a,o)=>{let s=o.db,c=s.getConfig(),l=c.padding??se,d=s.getDiagramTitle(),f=s.getRoot(),{themeVariables:_}=p();if(!f)return;let v=d?30:0,x=g(i),S=c.nodeWidth?c.nodeWidth*Q:960,C=c.nodeHeight?c.nodeHeight*Q:500,w=S,T=C+v;x.attr(`viewBox`,`0 0 ${w} ${T}`),u(x,T,w,c.useMaxWidth);let E;try{let e=c.valueFormat||`,`;if(e===`$0,0`)E=n(e=>`$`+h(`,`)(e),`valueFormat`);else if(e.startsWith(`$`)&&e.includes(`,`)){let t=/\.\d+/.exec(e),r=t?t[0]:``;E=n(e=>`$`+h(`,`+r)(e),`valueFormat`)}else if(e.startsWith(`$`)){let t=e.substring(1);E=n(e=>`$`+h(t||``)(e),`valueFormat`)}else E=h(e)}catch(e){t.error(`Error creating format function:`,e),E=h(`,`)}let D=m().range([`transparent`,_.cScale0,_.cScale1,_.cScale2,_.cScale3,_.cScale4,_.cScale5,_.cScale6,_.cScale7,_.cScale8,_.cScale9,_.cScale10,_.cScale11]),O=m().range([`transparent`,_.cScalePeer0,_.cScalePeer1,_.cScalePeer2,_.cScalePeer3,_.cScalePeer4,_.cScalePeer5,_.cScalePeer6,_.cScalePeer7,_.cScalePeer8,_.cScalePeer9,_.cScalePeer10,_.cScalePeer11]),k=m().range([_.cScaleLabel0,_.cScaleLabel1,_.cScaleLabel2,_.cScaleLabel3,_.cScaleLabel4,_.cScaleLabel5,_.cScaleLabel6,_.cScaleLabel7,_.cScaleLabel8,_.cScaleLabel9,_.cScaleLabel10,_.cScaleLabel11]);d&&x.append(`text`).attr(`x`,w/2).attr(`y`,v/2).attr(`class`,`treemapTitle`).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,`middle`).text(d);let A=x.append(`g`).attr(`transform`,`translate(0, ${v})`).attr(`class`,`treemapContainer`),j=L(f).sum(e=>e.value??0).sort((e,t)=>(t.value??0)-(e.value??0)),M=ie().size([S,C]).paddingTop(e=>e.children&&e.children.length>0?$+Q:0).paddingInner(l).paddingLeft(e=>e.children&&e.children.length>0?Q:0).paddingRight(e=>e.children&&e.children.length>0?Q:0).paddingBottom(e=>e.children&&e.children.length>0?Q:0).round(!0)(j),N=M.descendants().filter(e=>e.children&&e.children.length>0),P=A.selectAll(`.treemapSection`).data(N).enter().append(`g`).attr(`class`,`treemapSection`).attr(`transform`,e=>`translate(${e.x0},${e.y0})`);P.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,$).attr(`class`,`treemapSectionHeader`).attr(`fill`,`none`).attr(`fill-opacity`,.6).attr(`stroke-width`,.6).attr(`style`,e=>e.depth===0?`display: none;`:``),P.append(`clipPath`).attr(`id`,(e,t)=>`clip-section-${i}-${t}`).append(`rect`).attr(`width`,e=>Math.max(0,e.x1-e.x0-12)).attr(`height`,$),P.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,e=>e.y1-e.y0).attr(`class`,(e,t)=>`treemapSection section${t}`).attr(`fill`,e=>D(e.data.name)).attr(`fill-opacity`,.6).attr(`stroke`,e=>O(e.data.name)).attr(`stroke-width`,2).attr(`stroke-opacity`,.4).attr(`style`,e=>{if(e.depth===0)return`display: none;`;let t=b({cssCompiledStyles:e.data.cssCompiledStyles});return t.nodeStyles+`;`+t.borderStyles.join(`;`)}),P.append(`text`).attr(`class`,`treemapSectionLabel`).attr(`x`,6).attr(`y`,$/2).attr(`dominant-baseline`,`middle`).text(e=>e.depth===0?``:e.data.name).attr(`font-weight`,`bold`).attr(`style`,e=>e.depth===0?`display: none;`:`dominant-baseline: middle; font-size: 12px; fill:`+k(e.data.name)+`; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;`+b({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).each(function(e){if(e.depth===0)return;let t=r(this),n=e.data.name;t.text(n);let i=e.x1-e.x0,a;a=c.showValues!==!1&&e.value?i-10-30-10-6:i-6-6;let o=Math.max(15,a),s=t.node();if(s.getComputedTextLength()>o){let e=n;for(;e.length>0;){if(e=n.substring(0,e.length-1),e.length===0){t.text(`...`),s.getComputedTextLength()>o&&t.text(``);break}if(t.text(e+`...`),s.getComputedTextLength()<=o)break}}}),c.showValues!==!1&&P.append(`text`).attr(`class`,`treemapSectionValue`).attr(`x`,e=>e.x1-e.x0-10).attr(`y`,$/2).attr(`text-anchor`,`end`).attr(`dominant-baseline`,`middle`).text(e=>e.value?E(e.value):``).attr(`font-style`,`italic`).attr(`style`,e=>e.depth===0?`display: none;`:`text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:`+k(e.data.name)+`; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;`+b({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`));let F=M.leaves(),I=A.selectAll(`.treemapLeafGroup`).data(F).enter().append(`g`).attr(`class`,(e,t)=>`treemapNode treemapLeafGroup leaf${t}${e.data.classSelector?` ${e.data.classSelector}`:``}x`).attr(`transform`,e=>`translate(${e.x0},${e.y0})`);I.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,e=>e.y1-e.y0).attr(`class`,`treemapLeaf`).attr(`fill`,e=>e.parent?D(e.parent.data.name):D(e.data.name)).attr(`style`,e=>b({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr(`fill-opacity`,.3).attr(`stroke`,e=>e.parent?D(e.parent.data.name):D(e.data.name)).attr(`stroke-width`,3),I.append(`clipPath`).attr(`id`,(e,t)=>`clip-${i}-${t}`).append(`rect`).attr(`width`,e=>Math.max(0,e.x1-e.x0-4)).attr(`height`,e=>Math.max(0,e.y1-e.y0-4)),I.append(`text`).attr(`class`,`treemapLabel`).attr(`x`,e=>(e.x1-e.x0)/2).attr(`y`,e=>(e.y1-e.y0)/2).attr(`style`,e=>`text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:`+k(e.data.name)+`;`+b({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${i}-${t})`).text(e=>e.data.name).each(function(e){let t=r(this),n=e.x1-e.x0,i=e.y1-e.y0,a=t.node(),o=n-8,s=i-8;if(o<10||s<10){t.style(`display`,`none`);return}let c=parseInt(t.style(`font-size`),10),l=.6;for(;a.getComputedTextLength()>o&&c>8;)c--,t.style(`font-size`,`${c}px`);let u=Math.max(6,Math.min(28,Math.round(c*l))),d=c+2+u;for(;d>s&&c>8&&(c--,u=Math.max(6,Math.min(28,Math.round(c*l))),!(u<6&&c===8));)t.style(`font-size`,`${c}px`),d=c+2+u;t.style(`font-size`,`${c}px`),(a.getComputedTextLength()>o||c<8||s<c)&&t.style(`display`,`none`)}),c.showValues!==!1&&I.append(`text`).attr(`class`,`treemapValue`).attr(`x`,e=>(e.x1-e.x0)/2).attr(`y`,function(e){return(e.y1-e.y0)/2}).attr(`style`,e=>`text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:`+k(e.data.name)+`;`+b({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${i}-${t})`).text(e=>e.value?E(e.value):``).each(function(e){let t=r(this),n=this.parentNode;if(!n){t.style(`display`,`none`);return}let i=r(n).select(`.treemapLabel`);if(i.empty()||i.style(`display`)===`none`){t.style(`display`,`none`);return}let a=parseFloat(i.style(`font-size`)),o=Math.max(6,Math.min(28,Math.round(a*.6)));t.style(`font-size`,`${o}px`);let s=(e.y1-e.y0)/2+a/2+2;t.attr(`y`,s);let c=e.x1-e.x0,l=e.y1-e.y0-4,u=c-8;t.node().getComputedTextLength()>u||s+o>l||o<6?t.style(`display`,`none`):t.style(`display`,null)}),y(x,c.diagramPadding??8,`flowchart`,c?.useMaxWidth||!1)},`draw`),getClasses:n(function(e,t){return t.db.getClasses()},`getClasses`)},le={sectionStrokeColor:`black`,sectionStrokeWidth:`1`,sectionFillColor:`#efefef`,leafStrokeColor:`black`,leafStrokeWidth:`1`,leafFillColor:`#efefef`,labelColor:`black`,labelFontSize:`12px`,valueFontSize:`10px`,valueColor:`black`,titleColor:`black`,titleFontSize:`14px`},ue={parser:Z,get db(){return new Y},renderer:ce,styles:n(({treemap:t}={})=>{let n=e(le,t);return`
1
+ import"./chunk-XZSTWKYB-DxAOx4hG.js";import{r as e}from"./chunk-GEFDOKGD-D-pKjlVd.js";import"./chunk-R5LLSJPH-CFwSJijQ.js";import"./chunk-7E7YKBS2-CiyUJxNI.js";import"./chunk-EGIJ26TM-DzqmU2Z7.js";import"./chunk-C72U2L5F-D21mS_6G.js";import"./chunk-XIRO2GV7-Djlmrely.js";import"./chunk-L3YUKLVL-C7qGJrfV.js";import"./chunk-OZEHJAEY-BXhYx3nO.js";import{g as t,h as n,p as r}from"./src-BqX54PbV.js";import{B as i,C as a,V as o,W as s,_ as c,a as l,c as u,d,v as f,y as p}from"./chunk-7R4GIKGN-Dv-4cAYn.js";import{t as m}from"./ordinal-_K3x1fkz.js";import{t as h}from"./defaultLocale-5eAKkKJC.js";import{t as g}from"./chunk-HHEYEP7N-C7vxA5i9.js";import"./dist-CSJdAyA9.js";import{t as _}from"./chunk-4BX2VUAB-D4tOov49.js";import{t as v}from"./mermaid-parser.core-C7UwoIh6.js";import{t as y}from"./chunk-KX2RTZJC-CRq1OBZv.js";import{i as b,n as x}from"./chunk-PQ6SQG4A-TF58UVMU.js";function S(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function C(){return this.eachAfter(S)}function w(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function T(e,t){for(var n=this,r=[n],i,a,o=-1;n=r.pop();)if(e.call(t,n,++o,this),i=n.children)for(a=i.length-1;a>=0;--a)r.push(i[a]);return this}function E(e,t){for(var n=this,r=[n],i=[],a,o,s,c=-1;n=r.pop();)if(i.push(n),a=n.children)for(o=0,s=a.length;o<s;++o)r.push(a[o]);for(;n=i.pop();)e.call(t,n,++c,this);return this}function D(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function O(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function k(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function A(e){for(var t=this,n=j(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function j(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function M(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function N(){return Array.from(this)}function P(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function F(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*I(){var e=this,t,n=[e],r,i,a;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,a=r.length;i<a;++i)n.push(r[i]);while(n.length)}function L(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=B)):t===void 0&&(t=z);for(var n=new U(e),r,i=[n],a,o,s,c;r=i.pop();)if((o=t(r.data))&&(c=(o=Array.from(o)).length))for(r.children=o,s=c-1;s>=0;--s)i.push(a=o[s]=new U(o[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(H)}function R(){return L(this).eachBefore(V)}function z(e){return e.children}function B(e){return Array.isArray(e)?e[1]:null}function V(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function H(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function U(e){this.data=e,this.depth=this.height=0,this.parent=null}U.prototype=L.prototype={constructor:U,count:C,each:w,eachAfter:E,eachBefore:T,find:D,sum:O,sort:k,path:A,ancestors:M,descendants:N,leaves:P,links:F,copy:R,[Symbol.iterator]:I};function W(e){if(typeof e!=`function`)throw Error();return e}function G(){return 0}function K(e){return function(){return e}}function q(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function J(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(r-t)/e.value;++s<c;)o=a[s],o.y0=n,o.y1=i,o.x0=t,o.x1=t+=o.value*l}function ee(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(i-n)/e.value;++s<c;)o=a[s],o.x0=t,o.x1=r,o.y0=n,o.y1=n+=o.value*l}var te=(1+Math.sqrt(5))/2;function ne(e,t,n,r,i,a){for(var o=[],s=t.children,c,l,u=0,d=0,f=s.length,p,m,h=t.value,g,_,v,y,b,x,S;u<f;){p=i-n,m=a-r;do g=s[d++].value;while(!g&&d<f);for(_=v=g,x=Math.max(m/p,p/m)/(h*e),S=g*g*x,b=Math.max(v/S,S/_);d<f;++d){if(g+=l=s[d].value,l<_&&(_=l),l>v&&(v=l),S=g*g*x,y=Math.max(v/S,S/_),y>b){g-=l;break}b=y}o.push(c={value:g,dice:p<m,children:s.slice(u,d)}),c.dice?J(c,n,r,i,h?r+=m*g/h:a):ee(c,n,r,h?n+=p*g/h:i,a),h-=g,u=d}return o}var re=(function e(t){function n(e,n,r,i,a){ne(t,e,n,r,i,a)}return n.ratio=function(t){return e((t=+t)>1?t:1)},n})(te);function ie(){var e=re,t=!1,n=1,r=1,i=[0],a=G,o=G,s=G,c=G,l=G;function u(e){return e.x0=e.y0=0,e.x1=n,e.y1=r,e.eachBefore(d),i=[0],t&&e.eachBefore(q),e}function d(t){var n=i[t.depth],r=t.x0+n,u=t.y0+n,d=t.x1-n,f=t.y1-n;d<r&&(r=d=(r+d)/2),f<u&&(u=f=(u+f)/2),t.x0=r,t.y0=u,t.x1=d,t.y1=f,t.children&&(n=i[t.depth+1]=a(t)/2,r+=l(t)-n,u+=o(t)-n,d-=s(t)-n,f-=c(t)-n,d<r&&(r=d=(r+d)/2),f<u&&(u=f=(u+f)/2),e(t,r,u,d,f))}return u.round=function(e){return arguments.length?(t=!!e,u):t},u.size=function(e){return arguments.length?(n=+e[0],r=+e[1],u):[n,r]},u.tile=function(t){return arguments.length?(e=W(t),u):e},u.padding=function(e){return arguments.length?u.paddingInner(e).paddingOuter(e):u.paddingInner()},u.paddingInner=function(e){return arguments.length?(a=typeof e==`function`?e:K(+e),u):a},u.paddingOuter=function(e){return arguments.length?u.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e):u.paddingTop()},u.paddingTop=function(e){return arguments.length?(o=typeof e==`function`?e:K(+e),u):o},u.paddingRight=function(e){return arguments.length?(s=typeof e==`function`?e:K(+e),u):s},u.paddingBottom=function(e){return arguments.length?(c=typeof e==`function`?e:K(+e),u):c},u.paddingLeft=function(e){return arguments.length?(l=typeof e==`function`?e:K(+e),u):l},u}var Y=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=o,this.getAccTitle=f,this.setDiagramTitle=s,this.getDiagramTitle=a,this.getAccDescription=c,this.setAccDescription=i}static{n(this,`TreeMapDB`)}getNodes(){return this.nodes}getConfig(){let t=d,n=p();return e({...t.treemap,...n.treemap??{}})}addNode(e,t){this.nodes.push(e),this.levels.set(e,t),t===0&&(this.outerNodes.push(e),this.root??=e)}getRoot(){return{name:``,children:this.outerNodes}}addClass(e,t){let n=this.classes.get(e)??{id:e,styles:[],textStyles:[]},r=t.replace(/\\,/g,`§§§`).replace(/,/g,`;`).replace(/§§§/g,`,`).split(`;`);r&&r.forEach(e=>{x(e)&&(n?.textStyles?n.textStyles.push(e):n.textStyles=[e]),n?.styles?n.styles.push(e):n.styles=[e]}),this.classes.set(e,n)}getClasses(){return this.classes}getStylesForClass(e){return this.classes.get(e)?.styles??[]}clear(){l(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function X(e){if(!e.length)return[];let t=[],n=[];return e.forEach(e=>{let r={name:e.name,children:e.type===`Leaf`?void 0:[]};for(r.classSelector=e?.classSelector,e?.cssCompiledStyles&&(r.cssCompiledStyles=e.cssCompiledStyles),e.type===`Leaf`&&e.value!==void 0&&(r.value=e.value);n.length>0&&n[n.length-1].level>=e.level;)n.pop();if(n.length===0)t.push(r);else{let e=n[n.length-1].node;e.children?e.children.push(r):e.children=[r]}e.type!==`Leaf`&&n.push({node:r,level:e.level})}),t}n(X,`buildHierarchy`);var ae=n((e,t)=>{_(e,t);let r=[];for(let n of e.TreemapRows??[])n.$type===`ClassDefStatement`&&t.addClass(n.className??``,n.styleText??``);for(let n of e.TreemapRows??[]){let e=n.item;if(!e)continue;let i=n.indent?parseInt(n.indent):0,a=oe(e),o=e.classSelector?t.getStylesForClass(e.classSelector):[],s=o.length>0?o:void 0,c={level:i,name:a,type:e.$type,value:e.value,classSelector:e.classSelector,cssCompiledStyles:s};r.push(c)}let i=X(r),a=n((e,n)=>{for(let r of e)t.addNode(r,n),r.children&&r.children.length>0&&a(r.children,n+1)},`addNodesRecursively`);a(i,0)},`populate`),oe=n(e=>e.name?String(e.name):``,`getItemName`),Z={parser:{yy:void 0},parse:n(async e=>{try{let n=await v(`treemap`,e);t.debug(`Treemap AST:`,n);let r=Z.parser?.yy;if(!(r instanceof Y))throw Error(`parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);ae(n,r)}catch(e){throw t.error(`Error parsing treemap:`,e),e}},`parse`)},se=10,Q=10,$=25,ce={draw:n((e,i,a,o)=>{let s=o.db,c=s.getConfig(),l=c.padding??se,d=s.getDiagramTitle(),f=s.getRoot(),{themeVariables:_}=p();if(!f)return;let v=d?30:0,x=g(i),S=c.nodeWidth?c.nodeWidth*Q:960,C=c.nodeHeight?c.nodeHeight*Q:500,w=S,T=C+v;x.attr(`viewBox`,`0 0 ${w} ${T}`),u(x,T,w,c.useMaxWidth);let E;try{let e=c.valueFormat||`,`;if(e===`$0,0`)E=n(e=>`$`+h(`,`)(e),`valueFormat`);else if(e.startsWith(`$`)&&e.includes(`,`)){let t=/\.\d+/.exec(e),r=t?t[0]:``;E=n(e=>`$`+h(`,`+r)(e),`valueFormat`)}else if(e.startsWith(`$`)){let t=e.substring(1);E=n(e=>`$`+h(t||``)(e),`valueFormat`)}else E=h(e)}catch(e){t.error(`Error creating format function:`,e),E=h(`,`)}let D=m().range([`transparent`,_.cScale0,_.cScale1,_.cScale2,_.cScale3,_.cScale4,_.cScale5,_.cScale6,_.cScale7,_.cScale8,_.cScale9,_.cScale10,_.cScale11]),O=m().range([`transparent`,_.cScalePeer0,_.cScalePeer1,_.cScalePeer2,_.cScalePeer3,_.cScalePeer4,_.cScalePeer5,_.cScalePeer6,_.cScalePeer7,_.cScalePeer8,_.cScalePeer9,_.cScalePeer10,_.cScalePeer11]),k=m().range([_.cScaleLabel0,_.cScaleLabel1,_.cScaleLabel2,_.cScaleLabel3,_.cScaleLabel4,_.cScaleLabel5,_.cScaleLabel6,_.cScaleLabel7,_.cScaleLabel8,_.cScaleLabel9,_.cScaleLabel10,_.cScaleLabel11]);d&&x.append(`text`).attr(`x`,w/2).attr(`y`,v/2).attr(`class`,`treemapTitle`).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,`middle`).text(d);let A=x.append(`g`).attr(`transform`,`translate(0, ${v})`).attr(`class`,`treemapContainer`),j=L(f).sum(e=>e.value??0).sort((e,t)=>(t.value??0)-(e.value??0)),M=ie().size([S,C]).paddingTop(e=>e.children&&e.children.length>0?$+Q:0).paddingInner(l).paddingLeft(e=>e.children&&e.children.length>0?Q:0).paddingRight(e=>e.children&&e.children.length>0?Q:0).paddingBottom(e=>e.children&&e.children.length>0?Q:0).round(!0)(j),N=M.descendants().filter(e=>e.children&&e.children.length>0),P=A.selectAll(`.treemapSection`).data(N).enter().append(`g`).attr(`class`,`treemapSection`).attr(`transform`,e=>`translate(${e.x0},${e.y0})`);P.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,$).attr(`class`,`treemapSectionHeader`).attr(`fill`,`none`).attr(`fill-opacity`,.6).attr(`stroke-width`,.6).attr(`style`,e=>e.depth===0?`display: none;`:``),P.append(`clipPath`).attr(`id`,(e,t)=>`clip-section-${i}-${t}`).append(`rect`).attr(`width`,e=>Math.max(0,e.x1-e.x0-12)).attr(`height`,$),P.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,e=>e.y1-e.y0).attr(`class`,(e,t)=>`treemapSection section${t}`).attr(`fill`,e=>D(e.data.name)).attr(`fill-opacity`,.6).attr(`stroke`,e=>O(e.data.name)).attr(`stroke-width`,2).attr(`stroke-opacity`,.4).attr(`style`,e=>{if(e.depth===0)return`display: none;`;let t=b({cssCompiledStyles:e.data.cssCompiledStyles});return t.nodeStyles+`;`+t.borderStyles.join(`;`)}),P.append(`text`).attr(`class`,`treemapSectionLabel`).attr(`x`,6).attr(`y`,$/2).attr(`dominant-baseline`,`middle`).text(e=>e.depth===0?``:e.data.name).attr(`font-weight`,`bold`).attr(`style`,e=>e.depth===0?`display: none;`:`dominant-baseline: middle; font-size: 12px; fill:`+k(e.data.name)+`; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;`+b({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).each(function(e){if(e.depth===0)return;let t=r(this),n=e.data.name;t.text(n);let i=e.x1-e.x0,a;a=c.showValues!==!1&&e.value?i-10-30-10-6:i-6-6;let o=Math.max(15,a),s=t.node();if(s.getComputedTextLength()>o){let e=n;for(;e.length>0;){if(e=n.substring(0,e.length-1),e.length===0){t.text(`...`),s.getComputedTextLength()>o&&t.text(``);break}if(t.text(e+`...`),s.getComputedTextLength()<=o)break}}}),c.showValues!==!1&&P.append(`text`).attr(`class`,`treemapSectionValue`).attr(`x`,e=>e.x1-e.x0-10).attr(`y`,$/2).attr(`text-anchor`,`end`).attr(`dominant-baseline`,`middle`).text(e=>e.value?E(e.value):``).attr(`font-style`,`italic`).attr(`style`,e=>e.depth===0?`display: none;`:`text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:`+k(e.data.name)+`; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;`+b({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`));let F=M.leaves(),I=A.selectAll(`.treemapLeafGroup`).data(F).enter().append(`g`).attr(`class`,(e,t)=>`treemapNode treemapLeafGroup leaf${t}${e.data.classSelector?` ${e.data.classSelector}`:``}x`).attr(`transform`,e=>`translate(${e.x0},${e.y0})`);I.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,e=>e.y1-e.y0).attr(`class`,`treemapLeaf`).attr(`fill`,e=>e.parent?D(e.parent.data.name):D(e.data.name)).attr(`style`,e=>b({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr(`fill-opacity`,.3).attr(`stroke`,e=>e.parent?D(e.parent.data.name):D(e.data.name)).attr(`stroke-width`,3),I.append(`clipPath`).attr(`id`,(e,t)=>`clip-${i}-${t}`).append(`rect`).attr(`width`,e=>Math.max(0,e.x1-e.x0-4)).attr(`height`,e=>Math.max(0,e.y1-e.y0-4)),I.append(`text`).attr(`class`,`treemapLabel`).attr(`x`,e=>(e.x1-e.x0)/2).attr(`y`,e=>(e.y1-e.y0)/2).attr(`style`,e=>`text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:`+k(e.data.name)+`;`+b({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${i}-${t})`).text(e=>e.data.name).each(function(e){let t=r(this),n=e.x1-e.x0,i=e.y1-e.y0,a=t.node(),o=n-8,s=i-8;if(o<10||s<10){t.style(`display`,`none`);return}let c=parseInt(t.style(`font-size`),10),l=.6;for(;a.getComputedTextLength()>o&&c>8;)c--,t.style(`font-size`,`${c}px`);let u=Math.max(6,Math.min(28,Math.round(c*l))),d=c+2+u;for(;d>s&&c>8&&(c--,u=Math.max(6,Math.min(28,Math.round(c*l))),!(u<6&&c===8));)t.style(`font-size`,`${c}px`),d=c+2+u;t.style(`font-size`,`${c}px`),(a.getComputedTextLength()>o||c<8||s<c)&&t.style(`display`,`none`)}),c.showValues!==!1&&I.append(`text`).attr(`class`,`treemapValue`).attr(`x`,e=>(e.x1-e.x0)/2).attr(`y`,function(e){return(e.y1-e.y0)/2}).attr(`style`,e=>`text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:`+k(e.data.name)+`;`+b({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${i}-${t})`).text(e=>e.value?E(e.value):``).each(function(e){let t=r(this),n=this.parentNode;if(!n){t.style(`display`,`none`);return}let i=r(n).select(`.treemapLabel`);if(i.empty()||i.style(`display`)===`none`){t.style(`display`,`none`);return}let a=parseFloat(i.style(`font-size`)),o=Math.max(6,Math.min(28,Math.round(a*.6)));t.style(`font-size`,`${o}px`);let s=(e.y1-e.y0)/2+a/2+2;t.attr(`y`,s);let c=e.x1-e.x0,l=e.y1-e.y0-4,u=c-8;t.node().getComputedTextLength()>u||s+o>l||o<6?t.style(`display`,`none`):t.style(`display`,null)}),y(x,c.diagramPadding??8,`flowchart`,c?.useMaxWidth||!1)},`draw`),getClasses:n(function(e,t){return t.db.getClasses()},`getClasses`)},le={sectionStrokeColor:`black`,sectionStrokeWidth:`1`,sectionFillColor:`#efefef`,leafStrokeColor:`black`,leafStrokeWidth:`1`,leafFillColor:`#efefef`,labelColor:`black`,labelFontSize:`12px`,valueFontSize:`10px`,valueColor:`black`,titleColor:`black`,titleFontSize:`14px`},ue={parser:Z,get db(){return new Y},renderer:ce,styles:n(({treemap:t}={})=>{let n=e(le,t);return`
2
2
  .treemapNode.section {
3
3
  stroke: ${n.sectionStrokeColor};
4
4
  stroke-width: ${n.sectionStrokeWidth};
@@ -1,4 +1,4 @@
1
- import"./chunk-XZSTWKYB-Cb0iqycX.js";import{r as e}from"./chunk-GEFDOKGD-tDjHsAUs.js";import"./chunk-R5LLSJPH-CMY0PkRK.js";import"./chunk-7E7YKBS2-CkFGv6Zs.js";import"./chunk-EGIJ26TM-Cpr87sBR.js";import"./chunk-C72U2L5F-CtqKiH4q.js";import"./chunk-XIRO2GV7-DRJEb7Zb.js";import"./chunk-L3YUKLVL-HG_eMj_C.js";import"./chunk-OZEHJAEY-rG0P22U9.js";import{g as t,h as n}from"./src-Dw4QhedI.js";import{B as r,C as i,E as a,V as o,W as s,_ as c,a as l,c as u,d,v as f,y as p}from"./chunk-7R4GIKGN-Dvbyu4Zw.js";import{t as m}from"./chunk-HHEYEP7N-BBw_z0fW.js";import"./dist-Cep75xXf.js";import{t as h}from"./chunk-4BX2VUAB-C3aZvW7B.js";import{t as g}from"./mermaid-parser.core-8u2leTXI.js";var _={showLegend:!0,ticks:5,max:null,min:0,graticule:`circle`},v={axes:[],curves:[],options:_},y=structuredClone(v),b=d.radar,x=n(()=>e({...b,...p().radar}),`getConfig`),S=n(()=>y.axes,`getAxes`),C=n(()=>y.curves,`getCurves`),w=n(()=>y.options,`getOptions`),T=n(e=>{y.axes=e.map(e=>({name:e.name,label:e.label??e.name}))},`setAxes`),E=n(e=>{y.curves=e.map(e=>({name:e.name,label:e.label??e.name,entries:D(e.entries)}))},`setCurves`),D=n(e=>{if(e[0].axis==null)return e.map(e=>e.value);let t=S();if(t.length===0)throw Error(`Axes must be populated before curves for reference entries`);return t.map(t=>{let n=e.find(e=>e.axis?.$refText===t.name);if(n===void 0)throw Error(`Missing entry for axis `+t.label);return n.value})},`computeCurveEntries`),O={getAxes:S,getCurves:C,getOptions:w,setAxes:T,setCurves:E,setOptions:n(e=>{let t=e.reduce((e,t)=>(e[t.name]=t,e),{});y.options={showLegend:t.showLegend?.value??_.showLegend,ticks:t.ticks?.value??_.ticks,max:t.max?.value??_.max,min:t.min?.value??_.min,graticule:t.graticule?.value??_.graticule}},`setOptions`),getConfig:x,clear:n(()=>{l(),y=structuredClone(v)},`clear`),setAccTitle:o,getAccTitle:f,setDiagramTitle:s,getDiagramTitle:i,getAccDescription:c,setAccDescription:r},k=n(e=>{h(e,O);let{axes:t,curves:n,options:r}=e;O.setAxes(t),O.setCurves(n),O.setOptions(r)},`populate`),A={parse:n(async e=>{let n=await g(`radar`,e);t.debug(n),k(n)},`parse`)},j=n((e,t,n,r)=>{let i=r.db,a=i.getAxes(),o=i.getCurves(),s=i.getOptions(),c=i.getConfig(),l=i.getDiagramTitle(),u=M(m(t),c),d=s.max??Math.max(...o.map(e=>Math.max(...e.entries))),f=s.min,p=Math.min(c.width,c.height)/2;N(u,a,p,s.ticks,s.graticule),P(u,a,p,c),F(u,a,o,f,d,s.graticule,c),R(u,o,s.showLegend,c),u.append(`text`).attr(`class`,`radarTitle`).text(l).attr(`x`,0).attr(`y`,-c.height/2-c.marginTop)},`draw`),M=n((e,t)=>{let n=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,i={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return u(e,r,n,t.useMaxWidth??!0),e.attr(`viewBox`,`0 0 ${n} ${r}`),e.append(`g`).attr(`transform`,`translate(${i.x}, ${i.y})`)},`drawFrame`),N=n((e,t,n,r,i)=>{if(i===`circle`)for(let t=0;t<r;t++){let i=n*(t+1)/r;e.append(`circle`).attr(`r`,i).attr(`class`,`radarGraticule`)}else if(i===`polygon`){let i=t.length;for(let a=0;a<r;a++){let o=n*(a+1)/r,s=t.map((e,t)=>{let n=2*t*Math.PI/i-Math.PI/2;return`${o*Math.cos(n)},${o*Math.sin(n)}`}).join(` `);e.append(`polygon`).attr(`points`,s).attr(`class`,`radarGraticule`)}}},`drawGraticule`),P=n((e,t,n,r)=>{let i=t.length;for(let a=0;a<i;a++){let o=t[a].label,s=2*a*Math.PI/i-Math.PI/2;e.append(`line`).attr(`x1`,0).attr(`y1`,0).attr(`x2`,n*r.axisScaleFactor*Math.cos(s)).attr(`y2`,n*r.axisScaleFactor*Math.sin(s)).attr(`class`,`radarAxisLine`),e.append(`text`).text(o).attr(`x`,n*r.axisLabelFactor*Math.cos(s)).attr(`y`,n*r.axisLabelFactor*Math.sin(s)).attr(`class`,`radarAxisLabel`)}},`drawAxes`);function F(e,t,n,r,i,a,o){let s=t.length,c=Math.min(o.width,o.height)/2;n.forEach((t,n)=>{if(t.entries.length!==s)return;let l=t.entries.map((e,t)=>{let n=2*Math.PI*t/s-Math.PI/2,a=I(e,r,i,c);return{x:a*Math.cos(n),y:a*Math.sin(n)}});a===`circle`?e.append(`path`).attr(`d`,L(l,o.curveTension)).attr(`class`,`radarCurve-${n}`):a===`polygon`&&e.append(`polygon`).attr(`points`,l.map(e=>`${e.x},${e.y}`).join(` `)).attr(`class`,`radarCurve-${n}`)})}n(F,`drawCurves`);function I(e,t,n,r){return r*(Math.min(Math.max(e,t),n)-t)/(n-t)}n(I,`relativeRadius`);function L(e,t){let n=e.length,r=`M${e[0].x},${e[0].y}`;for(let i=0;i<n;i++){let a=e[(i-1+n)%n],o=e[i],s=e[(i+1)%n],c=e[(i+2)%n],l={x:o.x+(s.x-a.x)*t,y:o.y+(s.y-a.y)*t},u={x:s.x-(c.x-o.x)*t,y:s.y-(c.y-o.y)*t};r+=` C${l.x},${l.y} ${u.x},${u.y} ${s.x},${s.y}`}return`${r} Z`}n(L,`closedRoundCurve`);function R(e,t,n,r){if(!n)return;let i=(r.width/2+r.marginRight)*3/4,a=-(r.height/2+r.marginTop)*3/4;t.forEach((t,n)=>{let r=e.append(`g`).attr(`transform`,`translate(${i}, ${a+n*20})`);r.append(`rect`).attr(`width`,12).attr(`height`,12).attr(`class`,`radarLegendBox-${n}`),r.append(`text`).attr(`x`,16).attr(`y`,0).attr(`class`,`radarLegendText`).text(t.label)})}n(R,`drawLegend`);var z={draw:j},B=n((e,t)=>{let n=``;for(let r=0;r<e.THEME_COLOR_LIMIT;r++){let i=e[`cScale${r}`];n+=`
1
+ import"./chunk-XZSTWKYB-DxAOx4hG.js";import{r as e}from"./chunk-GEFDOKGD-D-pKjlVd.js";import"./chunk-R5LLSJPH-CFwSJijQ.js";import"./chunk-7E7YKBS2-CiyUJxNI.js";import"./chunk-EGIJ26TM-DzqmU2Z7.js";import"./chunk-C72U2L5F-D21mS_6G.js";import"./chunk-XIRO2GV7-Djlmrely.js";import"./chunk-L3YUKLVL-C7qGJrfV.js";import"./chunk-OZEHJAEY-BXhYx3nO.js";import{g as t,h as n}from"./src-BqX54PbV.js";import{B as r,C as i,E as a,V as o,W as s,_ as c,a as l,c as u,d,v as f,y as p}from"./chunk-7R4GIKGN-Dv-4cAYn.js";import{t as m}from"./chunk-HHEYEP7N-C7vxA5i9.js";import"./dist-CSJdAyA9.js";import{t as h}from"./chunk-4BX2VUAB-D4tOov49.js";import{t as g}from"./mermaid-parser.core-C7UwoIh6.js";var _={showLegend:!0,ticks:5,max:null,min:0,graticule:`circle`},v={axes:[],curves:[],options:_},y=structuredClone(v),b=d.radar,x=n(()=>e({...b,...p().radar}),`getConfig`),S=n(()=>y.axes,`getAxes`),C=n(()=>y.curves,`getCurves`),w=n(()=>y.options,`getOptions`),T=n(e=>{y.axes=e.map(e=>({name:e.name,label:e.label??e.name}))},`setAxes`),E=n(e=>{y.curves=e.map(e=>({name:e.name,label:e.label??e.name,entries:D(e.entries)}))},`setCurves`),D=n(e=>{if(e[0].axis==null)return e.map(e=>e.value);let t=S();if(t.length===0)throw Error(`Axes must be populated before curves for reference entries`);return t.map(t=>{let n=e.find(e=>e.axis?.$refText===t.name);if(n===void 0)throw Error(`Missing entry for axis `+t.label);return n.value})},`computeCurveEntries`),O={getAxes:S,getCurves:C,getOptions:w,setAxes:T,setCurves:E,setOptions:n(e=>{let t=e.reduce((e,t)=>(e[t.name]=t,e),{});y.options={showLegend:t.showLegend?.value??_.showLegend,ticks:t.ticks?.value??_.ticks,max:t.max?.value??_.max,min:t.min?.value??_.min,graticule:t.graticule?.value??_.graticule}},`setOptions`),getConfig:x,clear:n(()=>{l(),y=structuredClone(v)},`clear`),setAccTitle:o,getAccTitle:f,setDiagramTitle:s,getDiagramTitle:i,getAccDescription:c,setAccDescription:r},k=n(e=>{h(e,O);let{axes:t,curves:n,options:r}=e;O.setAxes(t),O.setCurves(n),O.setOptions(r)},`populate`),A={parse:n(async e=>{let n=await g(`radar`,e);t.debug(n),k(n)},`parse`)},j=n((e,t,n,r)=>{let i=r.db,a=i.getAxes(),o=i.getCurves(),s=i.getOptions(),c=i.getConfig(),l=i.getDiagramTitle(),u=M(m(t),c),d=s.max??Math.max(...o.map(e=>Math.max(...e.entries))),f=s.min,p=Math.min(c.width,c.height)/2;N(u,a,p,s.ticks,s.graticule),P(u,a,p,c),F(u,a,o,f,d,s.graticule,c),R(u,o,s.showLegend,c),u.append(`text`).attr(`class`,`radarTitle`).text(l).attr(`x`,0).attr(`y`,-c.height/2-c.marginTop)},`draw`),M=n((e,t)=>{let n=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,i={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return u(e,r,n,t.useMaxWidth??!0),e.attr(`viewBox`,`0 0 ${n} ${r}`),e.append(`g`).attr(`transform`,`translate(${i.x}, ${i.y})`)},`drawFrame`),N=n((e,t,n,r,i)=>{if(i===`circle`)for(let t=0;t<r;t++){let i=n*(t+1)/r;e.append(`circle`).attr(`r`,i).attr(`class`,`radarGraticule`)}else if(i===`polygon`){let i=t.length;for(let a=0;a<r;a++){let o=n*(a+1)/r,s=t.map((e,t)=>{let n=2*t*Math.PI/i-Math.PI/2;return`${o*Math.cos(n)},${o*Math.sin(n)}`}).join(` `);e.append(`polygon`).attr(`points`,s).attr(`class`,`radarGraticule`)}}},`drawGraticule`),P=n((e,t,n,r)=>{let i=t.length;for(let a=0;a<i;a++){let o=t[a].label,s=2*a*Math.PI/i-Math.PI/2;e.append(`line`).attr(`x1`,0).attr(`y1`,0).attr(`x2`,n*r.axisScaleFactor*Math.cos(s)).attr(`y2`,n*r.axisScaleFactor*Math.sin(s)).attr(`class`,`radarAxisLine`),e.append(`text`).text(o).attr(`x`,n*r.axisLabelFactor*Math.cos(s)).attr(`y`,n*r.axisLabelFactor*Math.sin(s)).attr(`class`,`radarAxisLabel`)}},`drawAxes`);function F(e,t,n,r,i,a,o){let s=t.length,c=Math.min(o.width,o.height)/2;n.forEach((t,n)=>{if(t.entries.length!==s)return;let l=t.entries.map((e,t)=>{let n=2*Math.PI*t/s-Math.PI/2,a=I(e,r,i,c);return{x:a*Math.cos(n),y:a*Math.sin(n)}});a===`circle`?e.append(`path`).attr(`d`,L(l,o.curveTension)).attr(`class`,`radarCurve-${n}`):a===`polygon`&&e.append(`polygon`).attr(`points`,l.map(e=>`${e.x},${e.y}`).join(` `)).attr(`class`,`radarCurve-${n}`)})}n(F,`drawCurves`);function I(e,t,n,r){return r*(Math.min(Math.max(e,t),n)-t)/(n-t)}n(I,`relativeRadius`);function L(e,t){let n=e.length,r=`M${e[0].x},${e[0].y}`;for(let i=0;i<n;i++){let a=e[(i-1+n)%n],o=e[i],s=e[(i+1)%n],c=e[(i+2)%n],l={x:o.x+(s.x-a.x)*t,y:o.y+(s.y-a.y)*t},u={x:s.x-(c.x-o.x)*t,y:s.y-(c.y-o.y)*t};r+=` C${l.x},${l.y} ${u.x},${u.y} ${s.x},${s.y}`}return`${r} Z`}n(L,`closedRoundCurve`);function R(e,t,n,r){if(!n)return;let i=(r.width/2+r.marginRight)*3/4,a=-(r.height/2+r.marginTop)*3/4;t.forEach((t,n)=>{let r=e.append(`g`).attr(`transform`,`translate(${i}, ${a+n*20})`);r.append(`rect`).attr(`width`,12).attr(`height`,12).attr(`class`,`radarLegendBox-${n}`),r.append(`text`).attr(`x`,16).attr(`y`,0).attr(`class`,`radarLegendText`).text(t.label)})}n(R,`drawLegend`);var z={draw:j},B=n((e,t)=>{let n=``;for(let r=0;r<e.THEME_COLOR_LIMIT;r++){let i=e[`cScale${r}`];n+=`
2
2
  .radarCurve-${r} {
3
3
  color: ${i};
4
4
  fill: ${i};
@@ -1,4 +1,4 @@
1
- import"./chunk-XZSTWKYB-Cb0iqycX.js";import{r as e}from"./chunk-GEFDOKGD-tDjHsAUs.js";import"./chunk-R5LLSJPH-CMY0PkRK.js";import"./chunk-7E7YKBS2-CkFGv6Zs.js";import"./chunk-EGIJ26TM-Cpr87sBR.js";import"./chunk-C72U2L5F-CtqKiH4q.js";import"./chunk-XIRO2GV7-DRJEb7Zb.js";import"./chunk-L3YUKLVL-HG_eMj_C.js";import"./chunk-OZEHJAEY-rG0P22U9.js";import{g as t,h as n}from"./src-Dw4QhedI.js";import{B as r,C as i,V as a,W as o,_ as s,a as c,c as l,d as u,v as d,y as f}from"./chunk-7R4GIKGN-Dvbyu4Zw.js";import{t as p}from"./chunk-HHEYEP7N-BBw_z0fW.js";import"./dist-Cep75xXf.js";import{t as m}from"./chunk-4BX2VUAB-C3aZvW7B.js";import{t as h}from"./mermaid-parser.core-8u2leTXI.js";var g=u.packet,_=class{constructor(){this.packet=[],this.setAccTitle=a,this.getAccTitle=d,this.setDiagramTitle=o,this.getDiagramTitle=i,this.getAccDescription=s,this.setAccDescription=r}static{n(this,`PacketDB`)}getConfig(){let t=e({...g,...f().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(e){e.length>0&&this.packet.push(e)}clear(){c(),this.packet=[]}},v=1e4,y=n((e,n)=>{m(e,n);let r=-1,i=[],a=1,{bitsPerRow:o}=n.getConfig();for(let{start:s,end:c,bits:l,label:u}of e.blocks){if(s!==void 0&&c!==void 0&&c<s)throw Error(`Packet block ${s} - ${c} is invalid. End must be greater than start.`);if(s??=r+1,s!==r+1)throw Error(`Packet block ${s} - ${c??s} is not contiguous. It should start from ${r+1}.`);if(l===0)throw Error(`Packet block ${s} is invalid. Cannot have a zero bit field.`);for(c??=s+(l??1)-1,l??=c-s+1,r=c,t.debug(`Packet block ${s} - ${r} with label ${u}`);i.length<=o+1&&n.getPacket().length<v;){let[e,t]=b({start:s,end:c,bits:l,label:u},a,o);if(i.push(e),e.end+1===a*o&&(n.pushWord(i),i=[],a++),!t)break;({start:s,end:c,bits:l,label:u}=t)}}n.pushWord(i)},`populate`),b=n((e,t,n)=>{if(e.start===void 0)throw Error(`start should have been set during first phase`);if(e.end===void 0)throw Error(`end should have been set during first phase`);if(e.start>e.end)throw Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*n)return[e,void 0];let r=t*n-1,i=t*n;return[{start:e.start,end:r,label:e.label,bits:r-e.start},{start:i,end:e.end,label:e.label,bits:e.end-i}]},`getNextFittingBlock`),x={parser:{yy:void 0},parse:n(async e=>{let n=await h(`packet`,e),r=x.parser?.yy;if(!(r instanceof _))throw Error(`parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);t.debug(n),y(n,r)},`parse`)},S=n((e,t,n,r)=>{let i=r.db,a=i.getConfig(),{rowHeight:o,paddingY:s,bitWidth:c,bitsPerRow:u}=a,d=i.getPacket(),f=i.getDiagramTitle(),m=o+s,h=m*(d.length+1)-(f?0:o),g=c*u+2,_=p(t);_.attr(`viewBox`,`0 0 ${g} ${h}`),l(_,h,g,a.useMaxWidth);for(let[e,t]of d.entries())C(_,t,e,a);_.append(`text`).text(f).attr(`x`,g/2).attr(`y`,h-m/2).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).attr(`class`,`packetTitle`)},`draw`),C=n((e,t,n,{rowHeight:r,paddingX:i,paddingY:a,bitWidth:o,bitsPerRow:s,showBits:c})=>{let l=e.append(`g`),u=n*(r+a)+a;for(let e of t){let t=e.start%s*o+1,n=(e.end-e.start+1)*o-i;if(l.append(`rect`).attr(`x`,t).attr(`y`,u).attr(`width`,n).attr(`height`,r).attr(`class`,`packetBlock`),l.append(`text`).attr(`x`,t+n/2).attr(`y`,u+r/2).attr(`class`,`packetLabel`).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).text(e.label),!c)continue;let a=e.end===e.start,d=u-2;l.append(`text`).attr(`x`,t+(a?n/2:0)).attr(`y`,d).attr(`class`,`packetByte start`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,a?`middle`:`start`).text(e.start),a||l.append(`text`).attr(`x`,t+n).attr(`y`,d).attr(`class`,`packetByte end`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,`end`).text(e.end)}},`drawWord`),w={draw:S},T={byteFontSize:`10px`,startByteColor:`black`,endByteColor:`black`,labelColor:`black`,labelFontSize:`12px`,titleColor:`black`,titleFontSize:`14px`,blockStrokeColor:`black`,blockStrokeWidth:`1`,blockFillColor:`#efefef`},E={parser:x,get db(){return new _},renderer:w,styles:n(({packet:t}={})=>{let n=e(T,t);return`
1
+ import"./chunk-XZSTWKYB-DxAOx4hG.js";import{r as e}from"./chunk-GEFDOKGD-D-pKjlVd.js";import"./chunk-R5LLSJPH-CFwSJijQ.js";import"./chunk-7E7YKBS2-CiyUJxNI.js";import"./chunk-EGIJ26TM-DzqmU2Z7.js";import"./chunk-C72U2L5F-D21mS_6G.js";import"./chunk-XIRO2GV7-Djlmrely.js";import"./chunk-L3YUKLVL-C7qGJrfV.js";import"./chunk-OZEHJAEY-BXhYx3nO.js";import{g as t,h as n}from"./src-BqX54PbV.js";import{B as r,C as i,V as a,W as o,_ as s,a as c,c as l,d as u,v as d,y as f}from"./chunk-7R4GIKGN-Dv-4cAYn.js";import{t as p}from"./chunk-HHEYEP7N-C7vxA5i9.js";import"./dist-CSJdAyA9.js";import{t as m}from"./chunk-4BX2VUAB-D4tOov49.js";import{t as h}from"./mermaid-parser.core-C7UwoIh6.js";var g=u.packet,_=class{constructor(){this.packet=[],this.setAccTitle=a,this.getAccTitle=d,this.setDiagramTitle=o,this.getDiagramTitle=i,this.getAccDescription=s,this.setAccDescription=r}static{n(this,`PacketDB`)}getConfig(){let t=e({...g,...f().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(e){e.length>0&&this.packet.push(e)}clear(){c(),this.packet=[]}},v=1e4,y=n((e,n)=>{m(e,n);let r=-1,i=[],a=1,{bitsPerRow:o}=n.getConfig();for(let{start:s,end:c,bits:l,label:u}of e.blocks){if(s!==void 0&&c!==void 0&&c<s)throw Error(`Packet block ${s} - ${c} is invalid. End must be greater than start.`);if(s??=r+1,s!==r+1)throw Error(`Packet block ${s} - ${c??s} is not contiguous. It should start from ${r+1}.`);if(l===0)throw Error(`Packet block ${s} is invalid. Cannot have a zero bit field.`);for(c??=s+(l??1)-1,l??=c-s+1,r=c,t.debug(`Packet block ${s} - ${r} with label ${u}`);i.length<=o+1&&n.getPacket().length<v;){let[e,t]=b({start:s,end:c,bits:l,label:u},a,o);if(i.push(e),e.end+1===a*o&&(n.pushWord(i),i=[],a++),!t)break;({start:s,end:c,bits:l,label:u}=t)}}n.pushWord(i)},`populate`),b=n((e,t,n)=>{if(e.start===void 0)throw Error(`start should have been set during first phase`);if(e.end===void 0)throw Error(`end should have been set during first phase`);if(e.start>e.end)throw Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*n)return[e,void 0];let r=t*n-1,i=t*n;return[{start:e.start,end:r,label:e.label,bits:r-e.start},{start:i,end:e.end,label:e.label,bits:e.end-i}]},`getNextFittingBlock`),x={parser:{yy:void 0},parse:n(async e=>{let n=await h(`packet`,e),r=x.parser?.yy;if(!(r instanceof _))throw Error(`parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);t.debug(n),y(n,r)},`parse`)},S=n((e,t,n,r)=>{let i=r.db,a=i.getConfig(),{rowHeight:o,paddingY:s,bitWidth:c,bitsPerRow:u}=a,d=i.getPacket(),f=i.getDiagramTitle(),m=o+s,h=m*(d.length+1)-(f?0:o),g=c*u+2,_=p(t);_.attr(`viewBox`,`0 0 ${g} ${h}`),l(_,h,g,a.useMaxWidth);for(let[e,t]of d.entries())C(_,t,e,a);_.append(`text`).text(f).attr(`x`,g/2).attr(`y`,h-m/2).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).attr(`class`,`packetTitle`)},`draw`),C=n((e,t,n,{rowHeight:r,paddingX:i,paddingY:a,bitWidth:o,bitsPerRow:s,showBits:c})=>{let l=e.append(`g`),u=n*(r+a)+a;for(let e of t){let t=e.start%s*o+1,n=(e.end-e.start+1)*o-i;if(l.append(`rect`).attr(`x`,t).attr(`y`,u).attr(`width`,n).attr(`height`,r).attr(`class`,`packetBlock`),l.append(`text`).attr(`x`,t+n/2).attr(`y`,u+r/2).attr(`class`,`packetLabel`).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).text(e.label),!c)continue;let a=e.end===e.start,d=u-2;l.append(`text`).attr(`x`,t+(a?n/2:0)).attr(`y`,d).attr(`class`,`packetByte start`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,a?`middle`:`start`).text(e.start),a||l.append(`text`).attr(`x`,t+n).attr(`y`,d).attr(`class`,`packetByte end`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,`end`).text(e.end)}},`drawWord`),w={draw:S},T={byteFontSize:`10px`,startByteColor:`black`,endByteColor:`black`,labelColor:`black`,labelFontSize:`12px`,titleColor:`black`,titleFontSize:`14px`,blockStrokeColor:`black`,blockStrokeWidth:`1`,blockFillColor:`#efefef`},E={parser:x,get db(){return new _},renderer:w,styles:n(({packet:t}={})=>{let n=e(T,t);return`
2
2
  .packetByte {
3
3
  font-size: ${n.byteFontSize};
4
4
  }
@@ -0,0 +1,4 @@
1
+ import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./react-nm2Ru1Pt.js";import{t as n}from"./createLucideIcon-PuMiQgHl.js";import{t as r}from"./columns-2-BoZAN-iw.js";import{t as i}from"./text-wrap-BWNOVswA.js";import{t as a}from"./jsx-runtime-kMwlnEGE.js";import{i as o,t as s}from"./api-client-BfBM3I7n.js";import{Y as c,lt as l,pt as u,xt as d}from"./index-DwrCg0TN.js";import{r as f,t as p}from"./use-monaco-theme-U9ZhfvHB.js";var m=n(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),h=e(t(),1),g=a();function _(e){return{js:`javascript`,jsx:`javascript`,ts:`typescript`,tsx:`typescript`,py:`python`,html:`html`,css:`css`,scss:`scss`,json:`json`,md:`markdown`,mdx:`markdown`,yaml:`yaml`,yml:`yaml`,sh:`shell`,bash:`shell`}[e.split(`.`).pop()?.toLowerCase()??``]??`plaintext`}function v({metadata:e}){let t=e?.filePath,n=e?.projectName,a=e?.ref1,v=e?.ref2,b=e?.file1,x=e?.file2,S=e?.original,C=e?.modified,w=S!=null||C!=null,T=!!(b&&x),[E,D]=(0,h.useState)(null),[O,k]=(0,h.useState)(null),[A,j]=(0,h.useState)(!w),[M,N]=(0,h.useState)(null),[P,F]=(0,h.useState)(`both`),{wordWrap:I,toggleWordWrap:L}=c(),R=p(),z=(0,h.useRef)(null),[B,V]=(0,h.useState)();(0,h.useEffect)(()=>{let e=z.current;if(!e)return;let t=new ResizeObserver(([e])=>{e&&V(Math.floor(e.contentRect.height))});return t.observe(e),()=>t.disconnect()},[A,M]),(0,h.useEffect)(()=>{if(w||!n)return;if(j(!0),N(null),b&&x){let e=new URLSearchParams({file1:b,file2:x});s.get(`${o(n)}/files/compare?${e}`).then(e=>{k(e),j(!1)}).catch(e=>{N(e instanceof Error?e.message:`Failed to compare files`),j(!1)});return}let e;if(t){let r=new URLSearchParams({file:t});a&&r.set(`ref`,a),e=`${o(n)}/git/file-diff?${r}`}else if(a||v){let t=new URLSearchParams;a&&t.set(`ref1`,a),v&&t.set(`ref2`,v),e=`${o(n)}/git/diff?${t}`}else e=`${o(n)}/git/diff`;s.get(e).then(e=>{D(e.diff),j(!1)}).catch(e=>{N(e instanceof Error?e.message:`Failed to load diff`),j(!1)})},[t,n,a,v,b,x,w]);let{original:H,modified:U}=(0,h.useMemo)(()=>w?{original:S??``,modified:C??``}:T&&O?O:E?y(E):{original:``,modified:``},[E,w,S,C,T,O]),W=(0,h.useMemo)(()=>{let e=t??x??b;return e?_(e):`plaintext`},[t,b,x]),G=typeof window<`u`&&window.innerWidth<768,K=!G&&P===`both`;return!n&&!w?(0,g.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm`,children:`No project selected.`}):A?(0,g.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-muted-foreground`,children:[(0,g.jsx)(u,{className:`size-5 animate-spin`}),(0,g.jsx)(`span`,{className:`text-sm`,children:`Loading diff...`})]}):M?(0,g.jsx)(`div`,{className:`flex items-center justify-center h-full text-destructive text-sm`,children:M}):!w&&!T&&!H&&!U?(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-2 text-muted-foreground`,children:[(0,g.jsx)(d,{className:`size-8`}),(0,g.jsx)(`p`,{className:`text-sm`,children:`No content changes`}),t&&(0,g.jsx)(`p`,{className:`text-xs font-mono`,children:t})]}):(0,g.jsxs)(`div`,{className:`flex flex-col h-full`,children:[!G&&(0,g.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5 px-2 py-0.5 border-b border-border shrink-0`,children:[(0,g.jsx)(`button`,{type:`button`,onClick:()=>F(P===`left`?`both`:`left`),className:`p-1 rounded hover:bg-muted transition-colors ${P===`left`?`bg-muted text-foreground`:``}`,title:`Expand original`,children:(0,g.jsx)(l,{className:`size-3.5`})}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>F(`both`),className:`p-1 rounded hover:bg-muted transition-colors ${P===`both`?`bg-muted text-foreground`:``}`,title:`Side by side`,children:(0,g.jsx)(r,{className:`size-3.5`})}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>F(P===`right`?`both`:`right`),className:`p-1 rounded hover:bg-muted transition-colors ${P===`right`?`bg-muted text-foreground`:``}`,title:`Expand modified`,children:(0,g.jsx)(m,{className:`size-3.5`})}),(0,g.jsx)(`div`,{className:`w-px h-3.5 bg-border mx-0.5 shrink-0`}),(0,g.jsx)(`button`,{type:`button`,onClick:L,title:`Toggle word wrap`,className:`p-1 rounded hover:bg-muted transition-colors ${I?`bg-muted text-foreground`:``}`,children:(0,g.jsx)(i,{className:`size-3.5`})})]}),(0,g.jsx)(`div`,{ref:z,className:`flex-1 overflow-hidden`,children:B&&B>0?(0,g.jsx)(f,{height:B,language:W,original:H,modified:U,theme:R,options:{fontSize:G?11:13,fontFamily:`Menlo, Monaco, Consolas, monospace`,wordWrap:G||I?`on`:`off`,renderSideBySide:K,readOnly:!0,automaticLayout:!0,scrollBeyondLastLine:!1},loading:(0,g.jsx)(u,{className:`size-5 animate-spin text-muted-foreground`})}):(0,g.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,g.jsx)(u,{className:`size-5 animate-spin text-muted-foreground`})})})]})}function y(e){let t=e.split(`
2
+ `),n=[],r=[],i=!1;for(let e of t)if(!(e.startsWith(`diff --git`)||e.startsWith(`diff --no-index`)||e.startsWith(`index `)||e.startsWith(`new file`)||e.startsWith(`deleted file`)||e.startsWith(`old mode`)||e.startsWith(`new mode`)||e.startsWith(`---`)||e.startsWith(`+++`)||e.startsWith(`Binary files`)||e.startsWith(`\\ No newline`))){if(e.startsWith(`@@`)){i=!0;continue}if(i)if(e.startsWith(`-`))n.push(e.slice(1));else if(e.startsWith(`+`))r.push(e.slice(1));else{let t=e.startsWith(` `)?e.slice(1):e;n.push(t),r.push(t)}}return{original:n.join(`
3
+ `),modified:r.join(`
4
+ `)}}export{v as DiffViewer};
@@ -0,0 +1,41 @@
1
+ import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./react-nm2Ru1Pt.js";import{t as n}from"./react-dom-Bpkvzu3U.js";import{t as r}from"./jsx-runtime-kMwlnEGE.js";var i=e(t(),1);function a(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function o(...e){return t=>{let n=!1,r=e.map(e=>{let r=a(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():a(e[t],null)}}}}function s(...e){return i.useCallback(o(...e),e)}var c=r();function l(e){let t=d(e),n=i.forwardRef((e,n)=>{let{children:r,...a}=e,o=i.Children.toArray(r),s=o.find(m);if(s){let e=s.props.children,r=o.map(t=>t===s?i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null:t);return(0,c.jsx)(t,{...a,ref:n,children:i.isValidElement(e)?i.cloneElement(e,void 0,r):null})}return(0,c.jsx)(t,{...a,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var u=l(`Slot`);function d(e){let t=i.forwardRef((e,t)=>{let{children:n,...r}=e;if(i.isValidElement(n)){let e=g(n),a=h(r,n.props);return n.type!==i.Fragment&&(a.ref=t?o(t,e):e),i.cloneElement(n,a)}return i.Children.count(n)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var f=Symbol(`radix.slottable`);function p(e){let t=({children:e})=>(0,c.jsx)(c.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=f,t}function m(e){return i.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===f}function h(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function g(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var _=e(n(),1),v=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=l(`Primitive.${t}`),r=i.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,c.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function y(e,t){e&&_.flushSync(()=>e.dispatchEvent(t))}function b(e,t){let n=i.createContext(t),r=e=>{let{children:t,...r}=e,a=i.useMemo(()=>r,Object.values(r));return(0,c.jsx)(n.Provider,{value:a,children:t})};r.displayName=e+`Provider`;function a(r){let a=i.useContext(n);if(a)return a;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,a]}function x(e,t=[]){let n=[];function r(t,r){let a=i.createContext(r),o=n.length;n=[...n,r];let s=t=>{let{scope:n,children:r,...s}=t,l=n?.[e]?.[o]||a,u=i.useMemo(()=>s,Object.values(s));return(0,c.jsx)(l.Provider,{value:u,children:r})};s.displayName=t+`Provider`;function l(n,s){let c=s?.[e]?.[o]||a,l=i.useContext(c);if(l)return l;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[s,l]}let a=()=>{let t=n.map(e=>i.createContext(e));return function(n){let r=n?.[e]||t;return i.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return a.scopeName=e,[r,S(a,...t)]}function S(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function C(e){let t=e+`CollectionProvider`,[n,r]=x(t),[a,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),u=e=>{let{scope:t,children:n}=e,r=i.useRef(null),o=i.useRef(new Map).current;return(0,c.jsx)(a,{scope:t,itemMap:o,collectionRef:r,children:n})};u.displayName=t;let d=e+`CollectionSlot`,f=l(d),p=i.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,c.jsx)(f,{ref:s(t,o(d,n).collectionRef),children:r})});p.displayName=d;let m=e+`CollectionItemSlot`,h=`data-radix-collection-item`,g=l(m),_=i.forwardRef((e,t)=>{let{scope:n,children:r,...a}=e,l=i.useRef(null),u=s(t,l),d=o(m,n);return i.useEffect(()=>(d.itemMap.set(l,{ref:l,...a}),()=>void d.itemMap.delete(l))),(0,c.jsx)(g,{[h]:``,ref:u,children:r})});_.displayName=m;function v(t){let n=o(e+`CollectionConsumer`,t);return i.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${h}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:u,Slot:p,ItemSlot:_},v,r]}typeof window<`u`&&window.document&&window.document.createElement;function w(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var T=globalThis?.document?i.useLayoutEffect:()=>{},E=i.useInsertionEffect||T;function D({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[a,o,s]=O({defaultProp:t,onChange:n}),c=e!==void 0,l=c?e:a;{let t=i.useRef(e!==void 0);i.useEffect(()=>{let e=t.current;if(e!==c){let t=e?`controlled`:`uncontrolled`,n=c?`controlled`:`uncontrolled`;console.warn(`${r} is changing from ${t} to ${n}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=c},[c,r])}return[l,i.useCallback(t=>{if(c){let n=k(t)?t(e):t;n!==e&&s.current?.(n)}else o(t)},[c,e,o,s])]}function O({defaultProp:e,onChange:t}){let[n,r]=i.useState(e),a=i.useRef(n),o=i.useRef(t);return E(()=>{o.current=t},[t]),i.useEffect(()=>{a.current!==n&&(o.current?.(n),a.current=n)},[n,a]),[n,r,o]}function k(e){return typeof e==`function`}function A(e,t){return i.useReducer((e,n)=>t[e][n]??e,e)}var j=e=>{let{present:t,children:n}=e,r=M(t),a=typeof n==`function`?n({present:r.isPresent}):i.Children.only(n),o=s(r.ref,P(a));return typeof n==`function`||r.isPresent?i.cloneElement(a,{ref:o}):null};j.displayName=`Presence`;function M(e){let[t,n]=i.useState(),r=i.useRef(null),a=i.useRef(e),o=i.useRef(`none`),[s,c]=A(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return i.useEffect(()=>{let e=N(r.current);o.current=s===`mounted`?e:`none`},[s]),T(()=>{let t=r.current,n=a.current;if(n!==e){let r=o.current,i=N(t);e?c(`MOUNT`):i===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==i?`ANIMATION_OUT`:`UNMOUNT`),a.current=e}},[e,c]),T(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,i=i=>{let o=N(r.current).includes(CSS.escape(i.animationName));if(i.target===t&&o&&(c(`ANIMATION_END`),!a.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},s=e=>{e.target===t&&(o.current=N(r.current))};return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,i),t.addEventListener(`animationend`,i),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,i),t.removeEventListener(`animationend`,i)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:i.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function N(e){return e?.animationName||`none`}function P(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ee=i.useId||(()=>void 0),te=0;function ne(e){let[t,n]=i.useState(ee());return T(()=>{e||n(e=>e??String(te++))},[e]),e||(t?`radix-${t}`:``)}var re=i.createContext(void 0);function F(e){let t=i.useContext(re);return e||t||`ltr`}function I(e){let t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>(...e)=>t.current?.(...e),[])}function ie(e,t=globalThis?.document){let n=I(e);i.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var ae=`DismissableLayer`,oe=`dismissableLayer.update`,se=`dismissableLayer.pointerDownOutside`,ce=`dismissableLayer.focusOutside`,le,ue=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),de=i.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:l,onDismiss:u,...d}=e,f=i.useContext(ue),[p,m]=i.useState(null),h=p?.ownerDocument??globalThis?.document,[,g]=i.useState({}),_=s(t,e=>m(e)),y=Array.from(f.layers),[b]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),x=y.indexOf(b),S=p?y.indexOf(p):-1,C=f.layersWithOutsidePointerEventsDisabled.size>0,T=S>=x,E=me(e=>{let t=e.target,n=[...f.branches].some(e=>e.contains(t));!T||n||(a?.(e),l?.(e),e.defaultPrevented||u?.())},h),D=he(e=>{let t=e.target;[...f.branches].some(e=>e.contains(t))||(o?.(e),l?.(e),e.defaultPrevented||u?.())},h);return ie(e=>{S===f.layers.size-1&&(r?.(e),!e.defaultPrevented&&u&&(e.preventDefault(),u()))},h),i.useEffect(()=>{if(p)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(le=h.body.style.pointerEvents,h.body.style.pointerEvents=`none`),f.layersWithOutsidePointerEventsDisabled.add(p)),f.layers.add(p),ge(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=le)}},[p,h,n,f]),i.useEffect(()=>()=>{p&&(f.layers.delete(p),f.layersWithOutsidePointerEventsDisabled.delete(p),ge())},[p,f]),i.useEffect(()=>{let e=()=>g({});return document.addEventListener(oe,e),()=>document.removeEventListener(oe,e)},[]),(0,c.jsx)(v.div,{...d,ref:_,style:{pointerEvents:C?T?`auto`:`none`:void 0,...e.style},onFocusCapture:w(e.onFocusCapture,D.onFocusCapture),onBlurCapture:w(e.onBlurCapture,D.onBlurCapture),onPointerDownCapture:w(e.onPointerDownCapture,E.onPointerDownCapture)})});de.displayName=ae;var fe=`DismissableLayerBranch`,pe=i.forwardRef((e,t)=>{let n=i.useContext(ue),r=i.useRef(null),a=s(t,r);return i.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,c.jsx)(v.div,{...e,ref:a})});pe.displayName=fe;function me(e,t=globalThis?.document){let n=I(e),r=i.useRef(!1),a=i.useRef(()=>{});return i.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){_e(se,n,i,{discrete:!0})},i={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,a.current),a.current=r,t.addEventListener(`click`,a.current,{once:!0})):r()}else t.removeEventListener(`click`,a.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(i),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,a.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function he(e,t=globalThis?.document){let n=I(e),r=i.useRef(!1);return i.useEffect(()=>{let e=e=>{e.target&&!r.current&&_e(ce,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ge(){let e=new CustomEvent(oe);document.dispatchEvent(e)}function _e(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?y(i,a):i.dispatchEvent(a)}var ve=`focusScope.autoFocusOnMount`,ye=`focusScope.autoFocusOnUnmount`,be={bubbles:!1,cancelable:!0},xe=`FocusScope`,Se=i.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...l}=e,[u,d]=i.useState(null),f=I(a),p=I(o),m=i.useRef(null),h=s(t,e=>d(e)),g=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(r){let e=function(e){if(g.paused||!u)return;let t=e.target;u.contains(t)?m.current=t:L(m.current,{select:!0})},t=function(e){if(g.paused||!u)return;let t=e.relatedTarget;t!==null&&(u.contains(t)||L(m.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&L(u)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return u&&r.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,u,g.paused]),i.useEffect(()=>{if(u){ke.add(g);let e=document.activeElement;if(!u.contains(e)){let t=new CustomEvent(ve,be);u.addEventListener(ve,f),u.dispatchEvent(t),t.defaultPrevented||(Ce(Me(Te(u)),{select:!0}),document.activeElement===e&&L(u))}return()=>{u.removeEventListener(ve,f),setTimeout(()=>{let t=new CustomEvent(ye,be);u.addEventListener(ye,p),u.dispatchEvent(t),t.defaultPrevented||L(e??document.body,{select:!0}),u.removeEventListener(ye,p),ke.remove(g)},0)}}},[u,f,p,g]);let _=i.useCallback(e=>{if(!n&&!r||g.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=we(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&L(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&L(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,g.paused]);return(0,c.jsx)(v.div,{tabIndex:-1,...l,ref:h,onKeyDown:_})});Se.displayName=xe;function Ce(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(L(r,{select:t}),document.activeElement!==n)return}function we(e){let t=Te(e);return[Ee(t,e),Ee(t.reverse(),e)]}function Te(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ee(e,t){for(let n of e)if(!De(n,{upTo:t}))return n}function De(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function Oe(e){return e instanceof HTMLInputElement&&`select`in e}function L(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Oe(e)&&t&&e.select()}}var ke=Ae();function Ae(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=je(e,t),e.unshift(t)},remove(t){e=je(e,t),e[0]?.resume()}}}function je(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Me(e){return e.filter(e=>e.tagName!==`A`)}var Ne=`Portal`,Pe=i.forwardRef((e,t)=>{let{container:n,...r}=e,[a,o]=i.useState(!1);T(()=>o(!0),[]);let s=n||a&&globalThis?.document?.body;return s?_.createPortal((0,c.jsx)(v.div,{...r,ref:t}),s):null});Pe.displayName=Ne;var Fe=0;function Ie(){i.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??Le()),document.body.insertAdjacentElement(`beforeend`,e[1]??Le()),Fe++,()=>{Fe===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Fe--}},[])}function Le(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var R=function(){return R=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},R.apply(this,arguments)};function Re(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function ze(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Be=`right-scroll-bar-position`,Ve=`width-before-scroll-bar`,He=`with-scroll-bars-hidden`,Ue=`--removed-body-scroll-bar-size`;function We(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Ge(e,t){var n=(0,i.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Ke=typeof window<`u`?i.useLayoutEffect:i.useEffect,qe=new WeakMap;function Je(e,t){var n=Ge(t||null,function(t){return e.forEach(function(e){return We(e,t)})});return Ke(function(){var t=qe.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||We(e,null)}),i.forEach(function(e){r.has(e)||We(e,a)})}qe.set(n,e)},[e]),n}function Ye(e){return e}function Xe(e,t){t===void 0&&(t=Ye);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Ze(e){e===void 0&&(e={});var t=Xe(null);return t.options=R({async:!0,ssr:!1},e),t}var Qe=function(e){var t=e.sideCar,n=Re(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return i.createElement(r,R({},n))};Qe.isSideCarExport=!0;function $e(e,t){return e.useMedium(t),Qe}var et=Ze(),tt=function(){},nt=i.forwardRef(function(e,t){var n=i.useRef(null),r=i.useState({onScrollCapture:tt,onWheelCapture:tt,onTouchMoveCapture:tt}),a=r[0],o=r[1],s=e.forwardProps,c=e.children,l=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=Re(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=p,C=Je([n,t]),w=R(R({},x),a);return i.createElement(i.Fragment,null,d&&i.createElement(S,{sideCar:et,removeScrollBar:u,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:o,allowPinchZoom:!!_,lockRef:n,gapMode:b}),s?i.cloneElement(i.Children.only(c),R(R({},w),{ref:C})):i.createElement(y,R({},w,{className:l,ref:C}),c))});nt.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},nt.classNames={fullWidth:Ve,zeroRight:Be};var rt,it=function(){if(rt)return rt;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function at(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=it();return t&&e.setAttribute(`nonce`,t),e}function ot(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function st(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var ct=function(){var e=0,t=null;return{add:function(n){e==0&&(t=at())&&(ot(t,n),st(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},lt=function(){var e=ct();return function(t,n){i.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},ut=function(){var e=lt();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},dt={left:0,top:0,right:0,gap:0},ft=function(e){return parseInt(e||``,10)||0},pt=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[ft(n),ft(r),ft(i)]},mt=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return dt;var t=pt(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},ht=ut(),gt=`data-scroll-locked`,_t=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
2
+ .${He} {
3
+ overflow: hidden ${r};
4
+ padding-right: ${s}px ${r};
5
+ }
6
+ body[${gt}] {
7
+ overflow: hidden ${r};
8
+ overscroll-behavior: contain;
9
+ ${[t&&`position: relative ${r};`,n===`margin`&&`
10
+ padding-left: ${i}px;
11
+ padding-top: ${a}px;
12
+ padding-right: ${o}px;
13
+ margin-left:0;
14
+ margin-top:0;
15
+ margin-right: ${s}px ${r};
16
+ `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
17
+ }
18
+
19
+ .${Be} {
20
+ right: ${s}px ${r};
21
+ }
22
+
23
+ .${Ve} {
24
+ margin-right: ${s}px ${r};
25
+ }
26
+
27
+ .${Be} .${Be} {
28
+ right: 0 ${r};
29
+ }
30
+
31
+ .${Ve} .${Ve} {
32
+ margin-right: 0 ${r};
33
+ }
34
+
35
+ body[${gt}] {
36
+ ${Ue}: ${s}px;
37
+ }
38
+ `},vt=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},yt=function(){i.useEffect(function(){return document.body.setAttribute(gt,(vt()+1).toString()),function(){var e=vt()-1;e<=0?document.body.removeAttribute(gt):document.body.setAttribute(gt,e.toString())}},[])},bt=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?`margin`:r;yt();var o=i.useMemo(function(){return mt(a)},[a]);return i.createElement(ht,{styles:_t(o,!t,a,n?``:`!important`)})},xt=!1;if(typeof window<`u`)try{var St=Object.defineProperty({},`passive`,{get:function(){return xt=!0,!0}});window.addEventListener(`test`,St,St),window.removeEventListener(`test`,St,St)}catch{xt=!1}var Ct=xt?{passive:!1}:!1,wt=function(e){return e.tagName===`TEXTAREA`},Tt=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!wt(e)&&n[t]===`visible`)},Et=function(e){return Tt(e,`overflowY`)},Dt=function(e){return Tt(e,`overflowX`)},Ot=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),jt(e,r)){var i=Mt(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},kt=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},At=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},jt=function(e,t){return e===`v`?Et(t):Dt(t)},Mt=function(e,t){return e===`v`?kt(t):At(t)},Nt=function(e,t){return e===`h`&&t===`rtl`?-1:1},Pt=function(e,t,n,r,i){var a=Nt(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Mt(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&jt(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Ft=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},It=function(e){return[e.deltaX,e.deltaY]},Lt=function(e){return e&&`current`in e?e.current:e},Rt=function(e,t){return e[0]===t[0]&&e[1]===t[1]},zt=function(e){return`
39
+ .block-interactivity-${e} {pointer-events: none;}
40
+ .allow-interactivity-${e} {pointer-events: all;}
41
+ `},Bt=0,Vt=[];function Ht(e){var t=i.useRef([]),n=i.useRef([0,0]),r=i.useRef(),a=i.useState(Bt++)[0],o=i.useState(ut)[0],s=i.useRef(e);i.useEffect(function(){s.current=e},[e]),i.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${a}`);var t=ze([e.lockRef.current],(e.shards||[]).map(Lt),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${a}`)}),function(){document.body.classList.remove(`block-interactivity-${a}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${a}`)})}}},[e.inert,e.lockRef.current,e.shards]);var c=i.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!s.current.allowPinchZoom;var i=Ft(e),a=n.current,o=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(o)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Ot(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Ot(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(o||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Pt(h,t,e,h===`h`?o:c,!0)},[]),l=i.useCallback(function(e){var n=e;if(!(!Vt.length||Vt[Vt.length-1]!==o)){var r=`deltaY`in n?It(n):Ft(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Rt(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var a=(s.current.shards||[]).map(Lt).filter(Boolean).filter(function(e){return e.contains(n.target)});(a.length>0?c(n,a[0]):!s.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),u=i.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Ut(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),d=i.useCallback(function(e){n.current=Ft(e),r.current=void 0},[]),f=i.useCallback(function(t){u(t.type,It(t),t.target,c(t,e.lockRef.current))},[]),p=i.useCallback(function(t){u(t.type,Ft(t),t.target,c(t,e.lockRef.current))},[]);i.useEffect(function(){return Vt.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener(`wheel`,l,Ct),document.addEventListener(`touchmove`,l,Ct),document.addEventListener(`touchstart`,d,Ct),function(){Vt=Vt.filter(function(e){return e!==o}),document.removeEventListener(`wheel`,l,Ct),document.removeEventListener(`touchmove`,l,Ct),document.removeEventListener(`touchstart`,d,Ct)}},[]);var m=e.removeScrollBar,h=e.inert;return i.createElement(i.Fragment,null,h?i.createElement(o,{styles:zt(a)}):null,m?i.createElement(bt,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Ut(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Wt=$e(et,Ht),Gt=i.forwardRef(function(e,t){return i.createElement(nt,R({},e,{ref:t,sideCar:Wt}))});Gt.classNames=nt.classNames;var Kt=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},qt=new WeakMap,Jt=new WeakMap,Yt={},Xt=0,Zt=function(e){return e&&(e.host||Zt(e.parentNode))},Qt=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Zt(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},$t=function(e,t,n,r){var i=Qt(t,Array.isArray(e)?e:[e]);Yt[n]||(Yt[n]=new WeakMap);var a=Yt[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(qt.get(e)||0)+1,l=(a.get(e)||0)+1;qt.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Jt.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Xt++,function(){o.forEach(function(e){var t=qt.get(e)-1,i=a.get(e)-1;qt.set(e,t),a.set(e,i),t||(Jt.has(e)||e.removeAttribute(r),Jt.delete(e)),i||e.removeAttribute(n)}),Xt--,Xt||(qt=new WeakMap,qt=new WeakMap,Jt=new WeakMap,Yt={})}},en=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Kt(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),$t(r,i,n,`aria-hidden`)):function(){return null}};function tn(e){let[t,n]=i.useState(void 0);return T(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var nn=[`top`,`right`,`bottom`,`left`],z=Math.min,B=Math.max,rn=Math.round,an=Math.floor,V=e=>({x:e,y:e}),on={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function sn(e,t,n){return B(e,z(t,n))}function H(e,t){return typeof e==`function`?e(t):e}function U(e){return e.split(`-`)[0]}function W(e){return e.split(`-`)[1]}function cn(e){return e===`x`?`y`:`x`}function ln(e){return e===`y`?`height`:`width`}function G(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function un(e){return cn(G(e))}function dn(e,t,n){n===void 0&&(n=!1);let r=W(e),i=un(e),a=ln(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=bn(o)),[o,bn(o)]}function fn(e){let t=bn(e);return[pn(e),t,pn(t)]}function pn(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var mn=[`left`,`right`],hn=[`right`,`left`],gn=[`top`,`bottom`],_n=[`bottom`,`top`];function vn(e,t,n){switch(e){case`top`:case`bottom`:return n?t?hn:mn:t?mn:hn;case`left`:case`right`:return t?gn:_n;default:return[]}}function yn(e,t,n,r){let i=W(e),a=vn(U(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(pn)))),a}function bn(e){let t=U(e);return on[t]+e.slice(t.length)}function xn(e){return{top:0,right:0,bottom:0,left:0,...e}}function Sn(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:xn(e)}function Cn(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function wn(e,t,n){let{reference:r,floating:i}=e,a=G(t),o=un(t),s=ln(o),c=U(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(W(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Tn(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=H(t,e),p=Sn(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Cn(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Cn(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var En=50,Dn=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Tn},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=wn(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<En&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=wn(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},On=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=H(e,t)||{};if(l==null)return{};let d=Sn(u),f={x:n,y:r},p=un(i),m=ln(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=z(d[_],T),D=z(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=sn(O,A,k),M=!c.arrow&&W(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),kn=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=H(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=U(r),_=G(o),v=U(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[bn(o)]:fn(o)),x=p!==`none`;!d&&x&&b.push(...yn(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=dn(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==G(t))||T.every(e=>G(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=G(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function An(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function jn(e){return nn.some(t=>e[t]>=0)}var Mn=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=H(e,t);switch(i){case`referenceHidden`:{let e=An(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:jn(e)}}}case`escaped`:{let e=An(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:jn(e)}}}default:return{}}}}},Nn=new Set([`left`,`top`]);async function Pn(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=U(n),s=W(n),c=G(n)===`y`,l=Nn.has(o)?-1:1,u=a&&c?-1:1,d=H(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Fn=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Pn(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},In=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=H(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=G(U(i)),p=cn(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=sn(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=sn(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Ln=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=H(e,t),u={x:n,y:r},d=G(i),f=cn(d),p=u[f],m=u[d],h=H(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Nn.has(U(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Rn=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=H(e,t),u=await o.detectOverflow(t,l),d=U(i),f=W(i),p=G(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=z(h-u[g],v),x=z(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=B(u.left,0),t=B(u.right,0),n=B(u.top,0),r=B(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:B(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:B(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function zn(){return typeof window<`u`}function Bn(e){return Vn(e)?(e.nodeName||``).toLowerCase():`#document`}function K(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function q(e){return((Vn(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Vn(e){return zn()?e instanceof Node||e instanceof K(e).Node:!1}function J(e){return zn()?e instanceof Element||e instanceof K(e).Element:!1}function Y(e){return zn()?e instanceof HTMLElement||e instanceof K(e).HTMLElement:!1}function Hn(e){return!zn()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof K(e).ShadowRoot}function Un(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Z(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Wn(e){return/^(table|td|th)$/.test(Bn(e))}function Gn(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Kn=/transform|translate|scale|rotate|perspective|filter/,qn=/paint|layout|strict|content/,X=e=>!!e&&e!==`none`,Jn;function Yn(e){let t=J(e)?Z(e):e;return X(t.transform)||X(t.translate)||X(t.scale)||X(t.rotate)||X(t.perspective)||!Zn()&&(X(t.backdropFilter)||X(t.filter))||Kn.test(t.willChange||``)||qn.test(t.contain||``)}function Xn(e){let t=Q(e);for(;Y(t)&&!Qn(t);){if(Yn(t))return t;if(Gn(t))return null;t=Q(t)}return null}function Zn(){return Jn??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Jn}function Qn(e){return/^(html|body|#document)$/.test(Bn(e))}function Z(e){return K(e).getComputedStyle(e)}function $n(e){return J(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Q(e){if(Bn(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Hn(e)&&e.host||q(e);return Hn(t)?t.host:t}function er(e){let t=Q(e);return Qn(t)?e.ownerDocument?e.ownerDocument.body:e.body:Y(t)&&Un(t)?t:er(t)}function tr(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=er(e),i=r===e.ownerDocument?.body,a=K(r);if(i){let e=nr(a);return t.concat(a,a.visualViewport||[],Un(r)?r:[],e&&n?tr(e):[])}else return t.concat(r,tr(r,[],n))}function nr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function rr(e){let t=Z(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Y(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=rn(n)!==a||rn(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function ir(e){return J(e)?e:e.contextElement}function ar(e){let t=ir(e);if(!Y(t))return V(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=rr(t),o=(a?rn(n.width):n.width)/r,s=(a?rn(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var or=V(0);function sr(e){let t=K(e);return!Zn()||!t.visualViewport?or:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function cr(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==K(e)?!1:t}function $(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=ir(e),o=V(1);t&&(r?J(r)&&(o=ar(r)):o=ar(e));let s=cr(a,n,r)?sr(a):V(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=K(a),t=r&&J(r)?K(r):r,n=e,i=nr(n);for(;i&&r&&t!==n;){let e=ar(i),t=i.getBoundingClientRect(),r=Z(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=K(i),i=nr(n)}}return Cn({width:u,height:d,x:c,y:l})}function lr(e,t){let n=$n(e).scrollLeft;return t?t.left+n:$(q(e)).left+n}function ur(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-lr(e,n),y:n.top+t.scrollTop}}function dr(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=q(r),s=t?Gn(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=V(1),u=V(0),d=Y(r);if((d||!d&&!a)&&((Bn(r)!==`body`||Un(o))&&(c=$n(r)),d)){let e=$(r);l=ar(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?ur(o,c):V(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function fr(e){return Array.from(e.getClientRects())}function pr(e){let t=q(e),n=$n(e),r=e.ownerDocument.body,i=B(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=B(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+lr(e),s=-n.scrollTop;return Z(r).direction===`rtl`&&(o+=B(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var mr=25;function hr(e,t){let n=K(e),r=q(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Zn();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=lr(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=mr&&(a-=o)}else l<=mr&&(a+=l);return{width:a,height:o,x:s,y:c}}function gr(e,t){let n=$(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Y(e)?ar(e):V(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function _r(e,t,n){let r;if(t===`viewport`)r=hr(e,n);else if(t===`document`)r=pr(q(e));else if(J(t))r=gr(t,n);else{let n=sr(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Cn(r)}function vr(e,t){let n=Q(e);return n===t||!J(n)||Qn(n)?!1:Z(n).position===`fixed`||vr(n,t)}function yr(e,t){let n=t.get(e);if(n)return n;let r=tr(e,[],!1).filter(e=>J(e)&&Bn(e)!==`body`),i=null,a=Z(e).position===`fixed`,o=a?Q(e):e;for(;J(o)&&!Qn(o);){let t=Z(o),n=Yn(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Un(o)&&!n&&vr(e,o))?r=r.filter(e=>e!==o):i=t,o=Q(o)}return t.set(e,r),r}function br(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Gn(t)?[]:yr(t,this._c):[].concat(n),r],o=_r(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=_r(t,a[e],i);s=B(n.top,s),c=z(n.right,c),l=z(n.bottom,l),u=B(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function xr(e){let{width:t,height:n}=rr(e);return{width:t,height:n}}function Sr(e,t,n){let r=Y(t),i=q(t),a=n===`fixed`,o=$(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=V(0);function l(){c.x=lr(i)}if(r||!r&&!a)if((Bn(t)!==`body`||Un(i))&&(s=$n(t)),r){let e=$(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?ur(i,s):V(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Cr(e){return Z(e).position===`static`}function wr(e,t){if(!Y(e)||Z(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return q(e)===n&&(n=n.ownerDocument.body),n}function Tr(e,t){let n=K(e);if(Gn(e))return n;if(!Y(e)){let t=Q(e);for(;t&&!Qn(t);){if(J(t)&&!Cr(t))return t;t=Q(t)}return n}let r=wr(e,t);for(;r&&Wn(r)&&Cr(r);)r=wr(r,t);return r&&Qn(r)&&Cr(r)&&!Yn(r)?n:r||Xn(e)||n}var Er=async function(e){let t=this.getOffsetParent||Tr,n=this.getDimensions,r=await n(e.floating);return{reference:Sr(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Dr(e){return Z(e).direction===`rtl`}var Or={convertOffsetParentRelativeRectToViewportRelativeRect:dr,getDocumentElement:q,getClippingRect:br,getOffsetParent:Tr,getElementRects:Er,getClientRects:fr,getDimensions:xr,getScale:ar,isElement:J,isRTL:Dr};function kr(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ar(e,t){let n=null,r,i=q(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=an(d),h=an(i.clientWidth-(u+f)),g=an(i.clientHeight-(d+p)),_=an(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:B(0,z(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!kr(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function jr(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=ir(e),u=i||a?[...l?tr(l):[],...t?tr(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Ar(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?$(e):null;c&&g();function g(){let t=$(e);h&&!kr(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Mr=Fn,Nr=In,Pr=kn,Fr=Rn,Ir=Mn,Lr=On,Rr=Ln,zr=(e,t,n)=>{let r=new Map,i={platform:Or,...n},a={...i.platform,_c:r};return Dn(e,t,{...i,platform:a})},Br=typeof document<`u`?i.useLayoutEffect:function(){};function Vr(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Vr(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Vr(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Hr(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ur(e,t){let n=Hr(e);return Math.round(t*n)/n}function Wr(e){let t=i.useRef(e);return Br(()=>{t.current=e}),t}function Gr(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:a,elements:{reference:o,floating:s}={},transform:c=!0,whileElementsMounted:l,open:u}=e,[d,f]=i.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=i.useState(r);Vr(p,r)||m(r);let[h,g]=i.useState(null),[v,y]=i.useState(null),b=i.useCallback(e=>{e!==w.current&&(w.current=e,g(e))},[]),x=i.useCallback(e=>{e!==T.current&&(T.current=e,y(e))},[]),S=o||h,C=s||v,w=i.useRef(null),T=i.useRef(null),E=i.useRef(d),D=l!=null,O=Wr(l),k=Wr(a),A=Wr(u),j=i.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:p};k.current&&(e.platform=k.current),zr(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!Vr(E.current,t)&&(E.current=t,_.flushSync(()=>{f(t)}))})},[p,t,n,k,A]);Br(()=>{u===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[u]);let M=i.useRef(!1);Br(()=>(M.current=!0,()=>{M.current=!1}),[]),Br(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=i.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),P=i.useMemo(()=>({reference:S,floating:C}),[S,C]),ee=i.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=Ur(P.floating,d.x),r=Ur(P.floating,d.y);return c?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Hr(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,c,P.floating,d.x,d.y]);return i.useMemo(()=>({...d,update:j,refs:N,elements:P,floatingStyles:ee}),[d,j,N,P,ee])}var Kr=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Lr({element:r.current,padding:i}).fn(n):r?Lr({element:r,padding:i}).fn(n):{}}}},qr=(e,t)=>{let n=Mr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jr=(e,t)=>{let n=Nr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yr=(e,t)=>({fn:Rr(e).fn,options:[e,t]}),Xr=(e,t)=>{let n=Pr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zr=(e,t)=>{let n=Fr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Qr=(e,t)=>{let n=Ir(e);return{name:n.name,fn:n.fn,options:[e,t]}},$r=(e,t)=>{let n=Kr(e);return{name:n.name,fn:n.fn,options:[e,t]}},ei=`Arrow`,ti=i.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,c.jsx)(v.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,c.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});ti.displayName=ei;var ni=ti,ri=`Popper`,[ii,ai]=x(ri),[oi,si]=ii(ri),ci=e=>{let{__scopePopper:t,children:n}=e,[r,a]=i.useState(null);return(0,c.jsx)(oi,{scope:t,anchor:r,onAnchorChange:a,children:n})};ci.displayName=ri;var li=`PopperAnchor`,ui=i.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...a}=e,o=si(li,n),l=i.useRef(null),u=s(t,l),d=i.useRef(null);return i.useEffect(()=>{let e=d.current;d.current=r?.current||l.current,e!==d.current&&o.onAnchorChange(d.current)}),r?null:(0,c.jsx)(v.div,{...a,ref:u})});ui.displayName=li;var di=`PopperContent`,[fi,pi]=ii(di),mi=i.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:l=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:m=`partial`,hideWhenDetached:h=!1,updatePositionStrategy:g=`optimized`,onPlaced:_,...y}=e,b=si(di,n),[x,S]=i.useState(null),C=s(t,e=>S(e)),[w,E]=i.useState(null),D=tn(w),O=D?.width??0,k=D?.height??0,A=r+(o===`center`?``:`-`+o),j=typeof p==`number`?p:{top:0,right:0,bottom:0,left:0,...p},M=Array.isArray(f)?f:[f],N=M.length>0,P={padding:j,boundary:M.filter(vi),altBoundary:N},{refs:ee,floatingStyles:te,placement:ne,isPositioned:re,middlewareData:F}=Gr({strategy:`fixed`,placement:A,whileElementsMounted:(...e)=>jr(...e,{animationFrame:g===`always`}),elements:{reference:b.anchor},middleware:[qr({mainAxis:a+k,alignmentAxis:l}),d&&Jr({mainAxis:!0,crossAxis:!1,limiter:m===`partial`?Yr():void 0,...P}),d&&Xr({...P}),Zr({...P,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),w&&$r({element:w,padding:u}),yi({arrowWidth:O,arrowHeight:k}),h&&Qr({strategy:`referenceHidden`,...P})]}),[ie,ae]=bi(ne),oe=I(_);T(()=>{re&&oe?.()},[re,oe]);let se=F.arrow?.x,ce=F.arrow?.y,le=F.arrow?.centerOffset!==0,[ue,de]=i.useState();return T(()=>{x&&de(window.getComputedStyle(x).zIndex)},[x]),(0,c.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...te,transform:re?te.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ue,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,c.jsx)(fi,{scope:n,placedSide:ie,onArrowChange:E,arrowX:se,arrowY:ce,shouldHideArrow:le,children:(0,c.jsx)(v.div,{"data-side":ie,"data-align":ae,...y,ref:C,style:{...y.style,animation:re?void 0:`none`}})})})});mi.displayName=di;var hi=`PopperArrow`,gi={top:`bottom`,right:`left`,bottom:`top`,left:`right`},_i=i.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=pi(hi,n),a=gi[i.placedSide];return(0,c.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,c.jsx)(ni,{...r,ref:t,style:{...r.style,display:`block`}})})});_i.displayName=hi;function vi(e){return e!==null}var yi=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=bi(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function bi(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var xi=ci,Si=ui,Ci=mi,wi=_i;export{v as C,p as D,l as E,o as O,x as S,u as T,D as _,ai as a,C as b,Gt as c,Se as d,de as f,j as g,ne as h,xi as i,s as k,Ie as l,F as m,wi as n,tn as o,I as p,Ci as r,en as s,Si as t,Pe as u,T as v,y as w,b as x,w as y};