@seanyeh77/ui 0.41.0 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (677) hide show
  1. package/README.md +32 -0
  2. package/dist/announce.d.ts +3 -0
  3. package/dist/announce.js +35 -0
  4. package/dist/announce.js.map +1 -0
  5. package/dist/bundle.js +24 -24
  6. package/dist/bundle.js.map +1 -1
  7. package/dist/components/AccentPicker/AccentPicker.d.ts +12 -0
  8. package/dist/components/AccentPicker/AccentPicker.js +99 -0
  9. package/dist/components/AccentPicker/AccentPicker.js.map +1 -0
  10. package/dist/components/ActionBar/ActionBar.d.ts +27 -0
  11. package/dist/components/ActionBar/ActionBar.js +62 -0
  12. package/dist/components/ActionBar/ActionBar.js.map +1 -0
  13. package/dist/components/AiMark/AiMark.d.ts +10 -0
  14. package/dist/components/AiMark/AiMark.js +21 -0
  15. package/dist/components/AiMark/AiMark.js.map +1 -0
  16. package/dist/components/Alert/Alert.d.ts +17 -0
  17. package/dist/components/Alert/Alert.js +59 -0
  18. package/dist/components/Alert/Alert.js.map +1 -0
  19. package/dist/components/AppShell/AppShell.d.ts +36 -0
  20. package/dist/components/AppShell/AppShell.js +198 -0
  21. package/dist/components/AppShell/AppShell.js.map +1 -0
  22. package/dist/components/Badge/Badge.d.ts +12 -0
  23. package/dist/components/Badge/Badge.js +58 -0
  24. package/dist/components/Badge/Badge.js.map +1 -0
  25. package/dist/components/BarChart/BarChart.d.ts +19 -0
  26. package/dist/components/BarChart/BarChart.js +78 -0
  27. package/dist/components/BarChart/BarChart.js.map +1 -0
  28. package/dist/components/Breadcrumb/Breadcrumb.d.ts +11 -0
  29. package/dist/components/Breadcrumb/Breadcrumb.js +29 -0
  30. package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -0
  31. package/dist/components/Button/Button.d.ts +39 -0
  32. package/dist/components/Button/Button.js +55 -0
  33. package/dist/components/Button/Button.js.map +1 -0
  34. package/dist/components/Calendar/Calendar.d.ts +18 -0
  35. package/dist/components/Calendar/Calendar.js +129 -0
  36. package/dist/components/Calendar/Calendar.js.map +1 -0
  37. package/dist/components/Card/Card.d.ts +14 -0
  38. package/dist/components/Card/Card.js +33 -0
  39. package/dist/components/Card/Card.js.map +1 -0
  40. package/dist/components/Checkbox/Checkbox.d.ts +14 -0
  41. package/dist/components/Checkbox/Checkbox.js +27 -0
  42. package/dist/components/Checkbox/Checkbox.js.map +1 -0
  43. package/dist/components/CodeView/CodeView.d.ts +111 -0
  44. package/dist/components/CodeView/CodeView.js +794 -0
  45. package/dist/components/CodeView/CodeView.js.map +1 -0
  46. package/dist/components/CodeView/tokens.d.ts +5 -0
  47. package/dist/components/CodeView/tokens.js +70 -0
  48. package/dist/components/CodeView/tokens.js.map +1 -0
  49. package/dist/components/CommandPalette/CommandPalette.d.ts +52 -0
  50. package/dist/components/CommandPalette/CommandPalette.js +250 -0
  51. package/dist/components/CommandPalette/CommandPalette.js.map +1 -0
  52. package/dist/components/ConsoleLayout/ConsoleLayout.d.ts +44 -0
  53. package/dist/components/ConsoleLayout/ConsoleLayout.js +123 -0
  54. package/dist/components/ConsoleLayout/ConsoleLayout.js.map +1 -0
  55. package/dist/components/DangerZone/DangerZone.d.ts +16 -0
  56. package/dist/components/DangerZone/DangerZone.js +28 -0
  57. package/dist/components/DangerZone/DangerZone.js.map +1 -0
  58. package/dist/components/DataTable/DataTable.d.ts +99 -0
  59. package/dist/components/DataTable/DataTable.js +1272 -0
  60. package/dist/components/DataTable/DataTable.js.map +1 -0
  61. package/dist/components/DataTable/SortButton.js +228 -0
  62. package/dist/components/DataTable/SortButton.js.map +1 -0
  63. package/dist/components/DataTable/filters.js +147 -0
  64. package/dist/components/DataTable/filters.js.map +1 -0
  65. package/dist/components/DataTable/parts.js +383 -0
  66. package/dist/components/DataTable/parts.js.map +1 -0
  67. package/dist/components/DataTable/types.d.ts +85 -0
  68. package/dist/components/DatePicker/DatePicker.d.ts +15 -0
  69. package/dist/components/DatePicker/DatePicker.js +107 -0
  70. package/dist/components/DatePicker/DatePicker.js.map +1 -0
  71. package/dist/components/DateRangePicker/DateRangePicker.d.ts +11 -0
  72. package/dist/components/DateRangePicker/DateRangePicker.js +91 -0
  73. package/dist/components/DateRangePicker/DateRangePicker.js.map +1 -0
  74. package/dist/components/DetailList/DetailList.d.ts +17 -0
  75. package/dist/components/DetailList/DetailList.js +18 -0
  76. package/dist/components/DetailList/DetailList.js.map +1 -0
  77. package/dist/components/Dialog/Dialog.d.ts +30 -0
  78. package/dist/components/Dialog/Dialog.js +90 -0
  79. package/dist/components/Dialog/Dialog.js.map +1 -0
  80. package/dist/components/Drawer/Drawer.d.ts +20 -0
  81. package/dist/components/Drawer/Drawer.js +67 -0
  82. package/dist/components/Drawer/Drawer.js.map +1 -0
  83. package/dist/components/EmptyState/EmptyState.d.ts +15 -0
  84. package/dist/components/EmptyState/EmptyState.js +34 -0
  85. package/dist/components/EmptyState/EmptyState.js.map +1 -0
  86. package/dist/components/ErrorPage/ErrorPage.d.ts +14 -0
  87. package/dist/components/ErrorPage/ErrorPage.js +47 -0
  88. package/dist/components/ErrorPage/ErrorPage.js.map +1 -0
  89. package/dist/components/EventTimeline/EventTimeline.d.ts +19 -0
  90. package/dist/components/EventTimeline/EventTimeline.js +69 -0
  91. package/dist/components/EventTimeline/EventTimeline.js.map +1 -0
  92. package/dist/components/FileUpload/FileUpload.d.ts +27 -0
  93. package/dist/components/FileUpload/FileUpload.js +126 -0
  94. package/dist/components/FileUpload/FileUpload.js.map +1 -0
  95. package/dist/components/FormGrid/FormGrid.d.ts +7 -0
  96. package/dist/components/FormGrid/FormGrid.js +14 -0
  97. package/dist/components/FormGrid/FormGrid.js.map +1 -0
  98. package/dist/components/Graph/Graph.d.ts +18 -0
  99. package/dist/components/Graph/Graph.js +97 -0
  100. package/dist/components/Graph/Graph.js.map +1 -0
  101. package/dist/components/Grid/Grid.d.ts +16 -0
  102. package/dist/components/Grid/Grid.js +21 -0
  103. package/dist/components/Grid/Grid.js.map +1 -0
  104. package/dist/components/IconButton/IconButton.d.ts +32 -0
  105. package/dist/components/IconButton/IconButton.js +107 -0
  106. package/dist/components/IconButton/IconButton.js.map +1 -0
  107. package/dist/components/InlineCode/InlineCode.d.ts +46 -0
  108. package/dist/components/InlineCode/InlineCode.js +71 -0
  109. package/dist/components/InlineCode/InlineCode.js.map +1 -0
  110. package/dist/components/KpiCard/KpiCard.d.ts +38 -0
  111. package/dist/components/KpiCard/KpiCard.js +116 -0
  112. package/dist/components/KpiCard/KpiCard.js.map +1 -0
  113. package/dist/components/LayerGraph/LayerGraph.d.ts +117 -0
  114. package/dist/components/LayerGraph/LayerGraph.js +1648 -0
  115. package/dist/components/LayerGraph/LayerGraph.js.map +1 -0
  116. package/dist/components/LineChart/LineChart.d.ts +73 -0
  117. package/dist/components/LineChart/LineChart.js +337 -0
  118. package/dist/components/LineChart/LineChart.js.map +1 -0
  119. package/dist/components/LoadingBar/LoadingBar.d.ts +7 -0
  120. package/dist/components/LoadingBar/LoadingBar.js +18 -0
  121. package/dist/components/LoadingBar/LoadingBar.js.map +1 -0
  122. package/dist/components/LoginCard/LoginCard.d.ts +23 -0
  123. package/dist/components/LoginCard/LoginCard.js +117 -0
  124. package/dist/components/LoginCard/LoginCard.js.map +1 -0
  125. package/dist/components/Markdown/Markdown.d.ts +38 -0
  126. package/dist/components/Markdown/Markdown.js +719 -0
  127. package/dist/components/Markdown/Markdown.js.map +1 -0
  128. package/dist/components/Menu/Menu.d.ts +33 -0
  129. package/dist/components/Menu/Menu.js +78 -0
  130. package/dist/components/Menu/Menu.js.map +1 -0
  131. package/dist/components/Meter/Meter.d.ts +20 -0
  132. package/dist/components/Meter/Meter.js +120 -0
  133. package/dist/components/Meter/Meter.js.map +1 -0
  134. package/dist/components/MobileTabBar/MobileTabBar.d.ts +21 -0
  135. package/dist/components/MobileTabBar/MobileTabBar.js +47 -0
  136. package/dist/components/MobileTabBar/MobileTabBar.js.map +1 -0
  137. package/dist/components/MultiSelect/MultiSelect.d.ts +25 -0
  138. package/dist/components/MultiSelect/MultiSelect.js +119 -0
  139. package/dist/components/MultiSelect/MultiSelect.js.map +1 -0
  140. package/dist/components/NotificationBell/NotificationBell.d.ts +20 -0
  141. package/dist/components/NotificationBell/NotificationBell.js +95 -0
  142. package/dist/components/NotificationBell/NotificationBell.js.map +1 -0
  143. package/dist/components/Popover/Popover.d.ts +20 -0
  144. package/dist/components/Popover/Popover.js +48 -0
  145. package/dist/components/Popover/Popover.js.map +1 -0
  146. package/dist/components/ProgressBar/ProgressBar.d.ts +10 -0
  147. package/dist/components/ProgressBar/ProgressBar.js +38 -0
  148. package/dist/components/ProgressBar/ProgressBar.js.map +1 -0
  149. package/dist/components/ProgressRing/ProgressRing.d.ts +11 -0
  150. package/dist/components/ProgressRing/ProgressRing.js +53 -0
  151. package/dist/components/ProgressRing/ProgressRing.js.map +1 -0
  152. package/dist/components/ProjectSwitcher/ProjectSwitcher.d.ts +25 -0
  153. package/dist/components/ProjectSwitcher/ProjectSwitcher.js +100 -0
  154. package/dist/components/ProjectSwitcher/ProjectSwitcher.js.map +1 -0
  155. package/dist/components/RadioGroup/RadioGroup.d.ts +18 -0
  156. package/dist/components/RadioGroup/RadioGroup.js +63 -0
  157. package/dist/components/RadioGroup/RadioGroup.js.map +1 -0
  158. package/dist/components/SearchField/SearchField.d.ts +9 -0
  159. package/dist/components/SearchField/SearchField.js +50 -0
  160. package/dist/components/SearchField/SearchField.js.map +1 -0
  161. package/dist/components/Section/Section.d.ts +50 -0
  162. package/dist/components/Section/Section.js +225 -0
  163. package/dist/components/Section/Section.js.map +1 -0
  164. package/dist/components/SegmentedControl/SegmentedControl.d.ts +23 -0
  165. package/dist/components/SegmentedControl/SegmentedControl.js +86 -0
  166. package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -0
  167. package/dist/components/Select/Select.d.ts +31 -0
  168. package/dist/components/Select/Select.js +143 -0
  169. package/dist/components/Select/Select.js.map +1 -0
  170. package/dist/components/SettingsLayout/SettingsLayout.d.ts +27 -0
  171. package/dist/components/SettingsLayout/SettingsLayout.js +69 -0
  172. package/dist/components/SettingsLayout/SettingsLayout.js.map +1 -0
  173. package/dist/components/SideNav/SideNav.d.ts +48 -0
  174. package/dist/components/SideNav/SideNav.js +225 -0
  175. package/dist/components/SideNav/SideNav.js.map +1 -0
  176. package/dist/components/Skeleton/Skeleton.d.ts +8 -0
  177. package/dist/components/Skeleton/Skeleton.js +17 -0
  178. package/dist/components/Skeleton/Skeleton.js.map +1 -0
  179. package/dist/components/SplitPane/SplitPane.d.ts +23 -0
  180. package/dist/components/SplitPane/SplitPane.js +140 -0
  181. package/dist/components/SplitPane/SplitPane.js.map +1 -0
  182. package/dist/components/StatusBand/StatusBand.d.ts +31 -0
  183. package/dist/components/StatusBand/StatusBand.js +43 -0
  184. package/dist/components/StatusBand/StatusBand.js.map +1 -0
  185. package/dist/components/Suggestion/Suggestion.d.ts +22 -0
  186. package/dist/components/Suggestion/Suggestion.js +75 -0
  187. package/dist/components/Suggestion/Suggestion.js.map +1 -0
  188. package/dist/components/Switch/Switch.d.ts +11 -0
  189. package/dist/components/Switch/Switch.js +56 -0
  190. package/dist/components/Switch/Switch.js.map +1 -0
  191. package/dist/components/Tabs/Tabs.d.ts +23 -0
  192. package/dist/components/Tabs/Tabs.js +117 -0
  193. package/dist/components/Tabs/Tabs.js.map +1 -0
  194. package/dist/components/Tag/Tag.d.ts +13 -0
  195. package/dist/components/Tag/Tag.js +26 -0
  196. package/dist/components/Tag/Tag.js.map +1 -0
  197. package/dist/components/Term/Term.d.ts +34 -0
  198. package/dist/components/Term/Term.js +143 -0
  199. package/dist/components/Term/Term.js.map +1 -0
  200. package/dist/components/TextArea/TextArea.d.ts +15 -0
  201. package/dist/components/TextArea/TextArea.js +75 -0
  202. package/dist/components/TextArea/TextArea.js.map +1 -0
  203. package/dist/components/TextField/TextField.d.ts +15 -0
  204. package/dist/components/TextField/TextField.js +43 -0
  205. package/dist/components/TextField/TextField.js.map +1 -0
  206. package/dist/components/ThemePicker/ThemePicker.d.ts +13 -0
  207. package/dist/components/ThemePicker/ThemePicker.js +66 -0
  208. package/dist/components/ThemePicker/ThemePicker.js.map +1 -0
  209. package/dist/components/TimeControl/TimeControl.d.ts +19 -0
  210. package/dist/components/TimeControl/TimeControl.js +47 -0
  211. package/dist/components/TimeControl/TimeControl.js.map +1 -0
  212. package/dist/components/Toast/Toast.d.ts +10 -0
  213. package/dist/components/Toast/Toast.js +30 -0
  214. package/dist/components/Toast/Toast.js.map +1 -0
  215. package/dist/components/Tooltip/Tooltip.d.ts +17 -0
  216. package/dist/components/Tooltip/Tooltip.js +69 -0
  217. package/dist/components/Tooltip/Tooltip.js.map +1 -0
  218. package/dist/components/TopBar/TopBar.d.ts +18 -0
  219. package/dist/components/TopBar/TopBar.js +59 -0
  220. package/dist/components/TopBar/TopBar.js.map +1 -0
  221. package/dist/components/Tour/Tour.d.ts +44 -0
  222. package/dist/components/Tour/Tour.js +440 -0
  223. package/dist/components/Tour/Tour.js.map +1 -0
  224. package/dist/components/TreeList/TreeList.d.ts +90 -0
  225. package/dist/components/TreeList/TreeList.js +594 -0
  226. package/dist/components/TreeList/TreeList.js.map +1 -0
  227. package/dist/components/TreeList/helpers.d.ts +2 -0
  228. package/dist/components/TreeList/helpers.js +104 -0
  229. package/dist/components/TreeList/helpers.js.map +1 -0
  230. package/dist/components/Workbench/Workbench.d.ts +100 -0
  231. package/dist/components/Workbench/Workbench.js +1142 -0
  232. package/dist/components/Workbench/Workbench.js.map +1 -0
  233. package/dist/components/ZoneMap/ZoneMap.d.ts +49 -0
  234. package/dist/components/ZoneMap/ZoneMap.js +89 -0
  235. package/dist/components/ZoneMap/ZoneMap.js.map +1 -0
  236. package/dist/css/AccentPicker.css +49 -0
  237. package/dist/css/ActionBar.css +36 -0
  238. package/dist/css/AiMark.css +14 -0
  239. package/dist/css/Alert.css +80 -0
  240. package/dist/css/AppShell.css +81 -0
  241. package/dist/css/Badge.css +68 -0
  242. package/dist/css/BarChart.css +66 -0
  243. package/dist/css/Breadcrumb.css +33 -0
  244. package/dist/css/Button.css +190 -0
  245. package/dist/css/Calendar.css +96 -0
  246. package/dist/css/Card.css +70 -0
  247. package/dist/css/Checkbox.css +38 -0
  248. package/dist/css/CodeView.css +302 -0
  249. package/dist/css/CommandPalette.css +232 -0
  250. package/dist/css/ConsoleLayout.css +131 -0
  251. package/dist/css/DangerZone.css +32 -0
  252. package/dist/css/DataTable.css +1195 -0
  253. package/dist/css/DatePicker.css +38 -0
  254. package/dist/css/DateRangePicker.css +70 -0
  255. package/dist/css/DetailList.css +69 -0
  256. package/dist/css/Dialog.css +3 -0
  257. package/dist/css/Drawer.css +90 -0
  258. package/dist/css/EmptyState.css +61 -0
  259. package/dist/css/ErrorPage.css +40 -0
  260. package/dist/css/EventTimeline.css +43 -0
  261. package/dist/css/FileUpload.css +92 -0
  262. package/dist/css/FormGrid.css +17 -0
  263. package/dist/css/Graph.css +99 -0
  264. package/dist/css/Grid.css +48 -0
  265. package/dist/css/IconButton.css +149 -0
  266. package/dist/css/InlineCode.css +92 -0
  267. package/dist/css/KpiCard.css +121 -0
  268. package/dist/css/LayerGraph.css +575 -0
  269. package/dist/css/LineChart.css +3 -0
  270. package/dist/css/LoadingBar.css +45 -0
  271. package/dist/css/LoginCard.css +65 -0
  272. package/dist/css/Markdown.css +266 -0
  273. package/dist/css/Menu.css +88 -0
  274. package/dist/css/Meter.css +110 -0
  275. package/dist/css/MobileTabBar.css +63 -0
  276. package/dist/css/MultiSelect.css +78 -0
  277. package/dist/css/NotificationBell.css +129 -0
  278. package/dist/css/Popover.css +57 -0
  279. package/dist/css/ProgressBar.css +42 -0
  280. package/dist/css/ProgressRing.css +19 -0
  281. package/dist/css/ProjectSwitcher.css +153 -0
  282. package/dist/css/RadioGroup.css +52 -0
  283. package/dist/css/SearchField.css +79 -0
  284. package/dist/css/Section.css +115 -0
  285. package/dist/css/SegmentedControl.css +67 -0
  286. package/dist/css/Select.css +136 -0
  287. package/dist/css/SettingsLayout.css +110 -0
  288. package/dist/css/SideNav.css +281 -0
  289. package/dist/css/Skeleton.css +19 -0
  290. package/dist/css/SplitPane.css +108 -0
  291. package/dist/css/StatusBand.css +23 -0
  292. package/dist/css/Suggestion.css +82 -0
  293. package/dist/css/Switch.css +46 -0
  294. package/dist/css/Tabs.css +91 -0
  295. package/dist/css/Tag.css +36 -0
  296. package/dist/css/Term.css +160 -0
  297. package/dist/css/TextArea.css +22 -0
  298. package/dist/css/TextField.css +2 -0
  299. package/dist/css/ThemePicker.css +70 -0
  300. package/dist/css/TimeControl.css +33 -0
  301. package/dist/css/Toast.css +47 -0
  302. package/dist/css/Tooltip.css +58 -0
  303. package/dist/css/TopBar.css +86 -0
  304. package/dist/css/Tour.css +90 -0
  305. package/dist/css/TreeList.css +532 -0
  306. package/dist/css/Workbench.css +652 -0
  307. package/dist/css/ZoneMap.css +203 -0
  308. package/dist/css/base.css +556 -0
  309. package/dist/css/end.css +273 -0
  310. package/dist/format-entry.d.ts +3 -0
  311. package/dist/format-entry.js +3 -0
  312. package/dist/format.d.ts +68 -2
  313. package/dist/format.js +237 -1
  314. package/dist/format.js.map +1 -0
  315. package/dist/i18n.d.ts +11 -0
  316. package/dist/{format-entry-CyChe8bk.js → i18n.js} +2 -235
  317. package/dist/i18n.js.map +1 -0
  318. package/dist/icons/Icon.d.ts +24 -0
  319. package/dist/icons/Icon.js +66 -0
  320. package/dist/icons/Icon.js.map +1 -0
  321. package/dist/icons/Spinner.js +18 -0
  322. package/dist/icons/Spinner.js.map +1 -0
  323. package/dist/icons/all.js +212 -0
  324. package/dist/icons/all.js.map +1 -0
  325. package/dist/icons/map.d.ts +3 -0
  326. package/dist/icons/map.js +31 -0
  327. package/dist/icons/map.js.map +1 -0
  328. package/dist/icons/names.d.ts +253 -0
  329. package/dist/icons/names.js +153 -0
  330. package/dist/icons/names.js.map +1 -0
  331. package/dist/icons/ph/archive.d.ts +10 -0
  332. package/dist/icons/ph/archive.js +11 -0
  333. package/dist/icons/ph/archive.js.map +1 -0
  334. package/dist/icons/ph/arrow-down.d.ts +10 -0
  335. package/dist/icons/ph/arrow-down.js +11 -0
  336. package/dist/icons/ph/arrow-down.js.map +1 -0
  337. package/dist/icons/ph/arrow-left.d.ts +10 -0
  338. package/dist/icons/ph/arrow-left.js +11 -0
  339. package/dist/icons/ph/arrow-left.js.map +1 -0
  340. package/dist/icons/ph/arrow-right.d.ts +10 -0
  341. package/dist/icons/ph/arrow-right.js +11 -0
  342. package/dist/icons/ph/arrow-right.js.map +1 -0
  343. package/dist/icons/ph/arrow-square-out.d.ts +10 -0
  344. package/dist/icons/ph/arrow-square-out.js +11 -0
  345. package/dist/icons/ph/arrow-square-out.js.map +1 -0
  346. package/dist/icons/ph/arrow-u-up-left.d.ts +10 -0
  347. package/dist/icons/ph/arrow-u-up-left.js +11 -0
  348. package/dist/icons/ph/arrow-u-up-left.js.map +1 -0
  349. package/dist/icons/ph/arrow-u-up-right.d.ts +10 -0
  350. package/dist/icons/ph/arrow-u-up-right.js +11 -0
  351. package/dist/icons/ph/arrow-u-up-right.js.map +1 -0
  352. package/dist/icons/ph/arrow-up.d.ts +10 -0
  353. package/dist/icons/ph/arrow-up.js +11 -0
  354. package/dist/icons/ph/arrow-up.js.map +1 -0
  355. package/dist/icons/ph/arrows-clockwise.d.ts +10 -0
  356. package/dist/icons/ph/arrows-clockwise.js +11 -0
  357. package/dist/icons/ph/arrows-clockwise.js.map +1 -0
  358. package/dist/icons/ph/arrows-in-line-vertical.d.ts +10 -0
  359. package/dist/icons/ph/arrows-in-line-vertical.js +11 -0
  360. package/dist/icons/ph/arrows-in-line-vertical.js.map +1 -0
  361. package/dist/icons/ph/arrows-left-right.d.ts +10 -0
  362. package/dist/icons/ph/arrows-left-right.js +11 -0
  363. package/dist/icons/ph/arrows-left-right.js.map +1 -0
  364. package/dist/icons/ph/arrows-out-line-vertical.d.ts +10 -0
  365. package/dist/icons/ph/arrows-out-line-vertical.js +11 -0
  366. package/dist/icons/ph/arrows-out-line-vertical.js.map +1 -0
  367. package/dist/icons/ph/bell.d.ts +10 -0
  368. package/dist/icons/ph/bell.js +11 -0
  369. package/dist/icons/ph/bell.js.map +1 -0
  370. package/dist/icons/ph/brackets-curly.d.ts +10 -0
  371. package/dist/icons/ph/brackets-curly.js +11 -0
  372. package/dist/icons/ph/brackets-curly.js.map +1 -0
  373. package/dist/icons/ph/calendar-blank.d.ts +10 -0
  374. package/dist/icons/ph/calendar-blank.js +11 -0
  375. package/dist/icons/ph/calendar-blank.js.map +1 -0
  376. package/dist/icons/ph/caret-down.d.ts +10 -0
  377. package/dist/icons/ph/caret-down.js +11 -0
  378. package/dist/icons/ph/caret-down.js.map +1 -0
  379. package/dist/icons/ph/caret-left.d.ts +10 -0
  380. package/dist/icons/ph/caret-left.js +11 -0
  381. package/dist/icons/ph/caret-left.js.map +1 -0
  382. package/dist/icons/ph/caret-right.d.ts +10 -0
  383. package/dist/icons/ph/caret-right.js +11 -0
  384. package/dist/icons/ph/caret-right.js.map +1 -0
  385. package/dist/icons/ph/caret-up.d.ts +10 -0
  386. package/dist/icons/ph/caret-up.js +11 -0
  387. package/dist/icons/ph/caret-up.js.map +1 -0
  388. package/dist/icons/ph/chart-bar.d.ts +10 -0
  389. package/dist/icons/ph/chart-bar.js +11 -0
  390. package/dist/icons/ph/chart-bar.js.map +1 -0
  391. package/dist/icons/ph/chart-line.d.ts +10 -0
  392. package/dist/icons/ph/chart-line.js +11 -0
  393. package/dist/icons/ph/chart-line.js.map +1 -0
  394. package/dist/icons/ph/chart-pie.d.ts +10 -0
  395. package/dist/icons/ph/chart-pie.js +11 -0
  396. package/dist/icons/ph/chart-pie.js.map +1 -0
  397. package/dist/icons/ph/chat-centered.d.ts +10 -0
  398. package/dist/icons/ph/chat-centered.js +11 -0
  399. package/dist/icons/ph/chat-centered.js.map +1 -0
  400. package/dist/icons/ph/check-circle.d.ts +10 -0
  401. package/dist/icons/ph/check-circle.js +11 -0
  402. package/dist/icons/ph/check-circle.js.map +1 -0
  403. package/dist/icons/ph/check-square.d.ts +10 -0
  404. package/dist/icons/ph/check-square.js +11 -0
  405. package/dist/icons/ph/check-square.js.map +1 -0
  406. package/dist/icons/ph/check.d.ts +10 -0
  407. package/dist/icons/ph/check.js +11 -0
  408. package/dist/icons/ph/check.js.map +1 -0
  409. package/dist/icons/ph/circle-notch.d.ts +10 -0
  410. package/dist/icons/ph/circle-notch.js +11 -0
  411. package/dist/icons/ph/circle-notch.js.map +1 -0
  412. package/dist/icons/ph/clock.d.ts +10 -0
  413. package/dist/icons/ph/clock.js +11 -0
  414. package/dist/icons/ph/clock.js.map +1 -0
  415. package/dist/icons/ph/cloud.d.ts +10 -0
  416. package/dist/icons/ph/cloud.js +11 -0
  417. package/dist/icons/ph/cloud.js.map +1 -0
  418. package/dist/icons/ph/columns.d.ts +10 -0
  419. package/dist/icons/ph/columns.js +11 -0
  420. package/dist/icons/ph/columns.js.map +1 -0
  421. package/dist/icons/ph/command.d.ts +10 -0
  422. package/dist/icons/ph/command.js +11 -0
  423. package/dist/icons/ph/command.js.map +1 -0
  424. package/dist/icons/ph/copy.d.ts +10 -0
  425. package/dist/icons/ph/copy.js +11 -0
  426. package/dist/icons/ph/copy.js.map +1 -0
  427. package/dist/icons/ph/corners-in.d.ts +10 -0
  428. package/dist/icons/ph/corners-in.js +11 -0
  429. package/dist/icons/ph/corners-in.js.map +1 -0
  430. package/dist/icons/ph/corners-out.d.ts +10 -0
  431. package/dist/icons/ph/corners-out.js +11 -0
  432. package/dist/icons/ph/corners-out.js.map +1 -0
  433. package/dist/icons/ph/cpu.d.ts +10 -0
  434. package/dist/icons/ph/cpu.js +11 -0
  435. package/dist/icons/ph/cpu.js.map +1 -0
  436. package/dist/icons/ph/database.d.ts +10 -0
  437. package/dist/icons/ph/database.js +11 -0
  438. package/dist/icons/ph/database.js.map +1 -0
  439. package/dist/icons/ph/dots-six-vertical.d.ts +10 -0
  440. package/dist/icons/ph/dots-six-vertical.js +11 -0
  441. package/dist/icons/ph/dots-six-vertical.js.map +1 -0
  442. package/dist/icons/ph/dots-three-vertical.d.ts +10 -0
  443. package/dist/icons/ph/dots-three-vertical.js +11 -0
  444. package/dist/icons/ph/dots-three-vertical.js.map +1 -0
  445. package/dist/icons/ph/dots-three.d.ts +10 -0
  446. package/dist/icons/ph/dots-three.js +11 -0
  447. package/dist/icons/ph/dots-three.js.map +1 -0
  448. package/dist/icons/ph/download-simple.d.ts +10 -0
  449. package/dist/icons/ph/download-simple.js +11 -0
  450. package/dist/icons/ph/download-simple.js.map +1 -0
  451. package/dist/icons/ph/envelope-simple.d.ts +10 -0
  452. package/dist/icons/ph/envelope-simple.js +11 -0
  453. package/dist/icons/ph/envelope-simple.js.map +1 -0
  454. package/dist/icons/ph/eye-slash.d.ts +10 -0
  455. package/dist/icons/ph/eye-slash.js +11 -0
  456. package/dist/icons/ph/eye-slash.js.map +1 -0
  457. package/dist/icons/ph/eye.d.ts +10 -0
  458. package/dist/icons/ph/eye.js +11 -0
  459. package/dist/icons/ph/eye.js.map +1 -0
  460. package/dist/icons/ph/file-code.d.ts +10 -0
  461. package/dist/icons/ph/file-code.js +11 -0
  462. package/dist/icons/ph/file-code.js.map +1 -0
  463. package/dist/icons/ph/file-text.d.ts +10 -0
  464. package/dist/icons/ph/file-text.js +11 -0
  465. package/dist/icons/ph/file-text.js.map +1 -0
  466. package/dist/icons/ph/file.d.ts +10 -0
  467. package/dist/icons/ph/file.js +11 -0
  468. package/dist/icons/ph/file.js.map +1 -0
  469. package/dist/icons/ph/floppy-disk.d.ts +10 -0
  470. package/dist/icons/ph/floppy-disk.js +11 -0
  471. package/dist/icons/ph/floppy-disk.js.map +1 -0
  472. package/dist/icons/ph/folder-open.d.ts +10 -0
  473. package/dist/icons/ph/folder-open.js +11 -0
  474. package/dist/icons/ph/folder-open.js.map +1 -0
  475. package/dist/icons/ph/folder.d.ts +10 -0
  476. package/dist/icons/ph/folder.js +11 -0
  477. package/dist/icons/ph/folder.js.map +1 -0
  478. package/dist/icons/ph/function.d.ts +10 -0
  479. package/dist/icons/ph/function.js +11 -0
  480. package/dist/icons/ph/function.js.map +1 -0
  481. package/dist/icons/ph/funnel.d.ts +10 -0
  482. package/dist/icons/ph/funnel.js +11 -0
  483. package/dist/icons/ph/funnel.js.map +1 -0
  484. package/dist/icons/ph/gauge.d.ts +10 -0
  485. package/dist/icons/ph/gauge.js +11 -0
  486. package/dist/icons/ph/gauge.js.map +1 -0
  487. package/dist/icons/ph/gear.d.ts +10 -0
  488. package/dist/icons/ph/gear.js +11 -0
  489. package/dist/icons/ph/gear.js.map +1 -0
  490. package/dist/icons/ph/globe.d.ts +10 -0
  491. package/dist/icons/ph/globe.js +11 -0
  492. package/dist/icons/ph/globe.js.map +1 -0
  493. package/dist/icons/ph/hard-drives.d.ts +10 -0
  494. package/dist/icons/ph/hard-drives.js +11 -0
  495. package/dist/icons/ph/hard-drives.js.map +1 -0
  496. package/dist/icons/ph/hash.d.ts +10 -0
  497. package/dist/icons/ph/hash.js +11 -0
  498. package/dist/icons/ph/hash.js.map +1 -0
  499. package/dist/icons/ph/heart.d.ts +10 -0
  500. package/dist/icons/ph/heart.js +11 -0
  501. package/dist/icons/ph/heart.js.map +1 -0
  502. package/dist/icons/ph/house.d.ts +10 -0
  503. package/dist/icons/ph/house.js +11 -0
  504. package/dist/icons/ph/house.js.map +1 -0
  505. package/dist/icons/ph/image.d.ts +10 -0
  506. package/dist/icons/ph/image.js +11 -0
  507. package/dist/icons/ph/image.js.map +1 -0
  508. package/dist/icons/ph/info.d.ts +10 -0
  509. package/dist/icons/ph/info.js +11 -0
  510. package/dist/icons/ph/info.js.map +1 -0
  511. package/dist/icons/ph/key.d.ts +10 -0
  512. package/dist/icons/ph/key.js +11 -0
  513. package/dist/icons/ph/key.js.map +1 -0
  514. package/dist/icons/ph/keyboard.d.ts +10 -0
  515. package/dist/icons/ph/keyboard.js +11 -0
  516. package/dist/icons/ph/keyboard.js.map +1 -0
  517. package/dist/icons/ph/layout.d.ts +10 -0
  518. package/dist/icons/ph/layout.js +11 -0
  519. package/dist/icons/ph/layout.js.map +1 -0
  520. package/dist/icons/ph/link.d.ts +10 -0
  521. package/dist/icons/ph/link.js +11 -0
  522. package/dist/icons/ph/link.js.map +1 -0
  523. package/dist/icons/ph/list-bullets.d.ts +10 -0
  524. package/dist/icons/ph/list-bullets.js +11 -0
  525. package/dist/icons/ph/list-bullets.js.map +1 -0
  526. package/dist/icons/ph/list.d.ts +10 -0
  527. package/dist/icons/ph/list.js +11 -0
  528. package/dist/icons/ph/list.js.map +1 -0
  529. package/dist/icons/ph/lock.d.ts +10 -0
  530. package/dist/icons/ph/lock.js +11 -0
  531. package/dist/icons/ph/lock.js.map +1 -0
  532. package/dist/icons/ph/magnifying-glass.d.ts +10 -0
  533. package/dist/icons/ph/magnifying-glass.js +11 -0
  534. package/dist/icons/ph/magnifying-glass.js.map +1 -0
  535. package/dist/icons/ph/minus.d.ts +10 -0
  536. package/dist/icons/ph/minus.js +11 -0
  537. package/dist/icons/ph/minus.js.map +1 -0
  538. package/dist/icons/ph/monitor.d.ts +10 -0
  539. package/dist/icons/ph/monitor.js +11 -0
  540. package/dist/icons/ph/monitor.js.map +1 -0
  541. package/dist/icons/ph/moon.d.ts +10 -0
  542. package/dist/icons/ph/moon.js +11 -0
  543. package/dist/icons/ph/moon.js.map +1 -0
  544. package/dist/icons/ph/paper-plane-tilt.d.ts +10 -0
  545. package/dist/icons/ph/paper-plane-tilt.js +11 -0
  546. package/dist/icons/ph/paper-plane-tilt.js.map +1 -0
  547. package/dist/icons/ph/pencil-simple.d.ts +10 -0
  548. package/dist/icons/ph/pencil-simple.js +11 -0
  549. package/dist/icons/ph/pencil-simple.js.map +1 -0
  550. package/dist/icons/ph/plus.d.ts +10 -0
  551. package/dist/icons/ph/plus.js +11 -0
  552. package/dist/icons/ph/plus.js.map +1 -0
  553. package/dist/icons/ph/printer.d.ts +10 -0
  554. package/dist/icons/ph/printer.js +11 -0
  555. package/dist/icons/ph/printer.js.map +1 -0
  556. package/dist/icons/ph/pulse.d.ts +10 -0
  557. package/dist/icons/ph/pulse.js +11 -0
  558. package/dist/icons/ph/pulse.js.map +1 -0
  559. package/dist/icons/ph/push-pin.d.ts +10 -0
  560. package/dist/icons/ph/push-pin.js +11 -0
  561. package/dist/icons/ph/push-pin.js.map +1 -0
  562. package/dist/icons/ph/question.d.ts +10 -0
  563. package/dist/icons/ph/question.js +11 -0
  564. package/dist/icons/ph/question.js.map +1 -0
  565. package/dist/icons/ph/share-network.d.ts +10 -0
  566. package/dist/icons/ph/share-network.js +11 -0
  567. package/dist/icons/ph/share-network.js.map +1 -0
  568. package/dist/icons/ph/shield.d.ts +10 -0
  569. package/dist/icons/ph/shield.js +11 -0
  570. package/dist/icons/ph/shield.js.map +1 -0
  571. package/dist/icons/ph/sidebar-simple.d.ts +10 -0
  572. package/dist/icons/ph/sidebar-simple.js +11 -0
  573. package/dist/icons/ph/sidebar-simple.js.map +1 -0
  574. package/dist/icons/ph/sign-in.d.ts +10 -0
  575. package/dist/icons/ph/sign-in.js +11 -0
  576. package/dist/icons/ph/sign-in.js.map +1 -0
  577. package/dist/icons/ph/sign-out.d.ts +10 -0
  578. package/dist/icons/ph/sign-out.js +11 -0
  579. package/dist/icons/ph/sign-out.js.map +1 -0
  580. package/dist/icons/ph/sliders-horizontal.d.ts +10 -0
  581. package/dist/icons/ph/sliders-horizontal.js +11 -0
  582. package/dist/icons/ph/sliders-horizontal.js.map +1 -0
  583. package/dist/icons/ph/sort-ascending.d.ts +10 -0
  584. package/dist/icons/ph/sort-ascending.js +11 -0
  585. package/dist/icons/ph/sort-ascending.js.map +1 -0
  586. package/dist/icons/ph/sparkle.d.ts +10 -0
  587. package/dist/icons/ph/sparkle.js +11 -0
  588. package/dist/icons/ph/sparkle.js.map +1 -0
  589. package/dist/icons/ph/square.d.ts +10 -0
  590. package/dist/icons/ph/square.js +11 -0
  591. package/dist/icons/ph/square.js.map +1 -0
  592. package/dist/icons/ph/squares-four.d.ts +10 -0
  593. package/dist/icons/ph/squares-four.js +11 -0
  594. package/dist/icons/ph/squares-four.js.map +1 -0
  595. package/dist/icons/ph/stack.d.ts +10 -0
  596. package/dist/icons/ph/stack.js +11 -0
  597. package/dist/icons/ph/stack.js.map +1 -0
  598. package/dist/icons/ph/star.d.ts +10 -0
  599. package/dist/icons/ph/star.js +11 -0
  600. package/dist/icons/ph/star.js.map +1 -0
  601. package/dist/icons/ph/sun.d.ts +10 -0
  602. package/dist/icons/ph/sun.js +11 -0
  603. package/dist/icons/ph/sun.js.map +1 -0
  604. package/dist/icons/ph/tag.d.ts +10 -0
  605. package/dist/icons/ph/tag.js +11 -0
  606. package/dist/icons/ph/tag.js.map +1 -0
  607. package/dist/icons/ph/terminal-window.d.ts +10 -0
  608. package/dist/icons/ph/terminal-window.js +11 -0
  609. package/dist/icons/ph/terminal-window.js.map +1 -0
  610. package/dist/icons/ph/trash.d.ts +10 -0
  611. package/dist/icons/ph/trash.js +11 -0
  612. package/dist/icons/ph/trash.js.map +1 -0
  613. package/dist/icons/ph/trend-up.d.ts +10 -0
  614. package/dist/icons/ph/trend-up.js +11 -0
  615. package/dist/icons/ph/trend-up.js.map +1 -0
  616. package/dist/icons/ph/upload-simple.d.ts +10 -0
  617. package/dist/icons/ph/upload-simple.js +11 -0
  618. package/dist/icons/ph/upload-simple.js.map +1 -0
  619. package/dist/icons/ph/user.d.ts +10 -0
  620. package/dist/icons/ph/user.js +11 -0
  621. package/dist/icons/ph/user.js.map +1 -0
  622. package/dist/icons/ph/users.d.ts +10 -0
  623. package/dist/icons/ph/users.js +11 -0
  624. package/dist/icons/ph/users.js.map +1 -0
  625. package/dist/icons/ph/warning-circle.d.ts +10 -0
  626. package/dist/icons/ph/warning-circle.js +11 -0
  627. package/dist/icons/ph/warning-circle.js.map +1 -0
  628. package/dist/icons/ph/warning.d.ts +10 -0
  629. package/dist/icons/ph/warning.js +11 -0
  630. package/dist/icons/ph/warning.js.map +1 -0
  631. package/dist/icons/ph/x-circle.d.ts +10 -0
  632. package/dist/icons/ph/x-circle.js +11 -0
  633. package/dist/icons/ph/x-circle.js.map +1 -0
  634. package/dist/icons/ph/x.d.ts +10 -0
  635. package/dist/icons/ph/x.js +11 -0
  636. package/dist/icons/ph/x.js.map +1 -0
  637. package/dist/icons/store.d.ts +6 -0
  638. package/dist/icons/store.js +77 -0
  639. package/dist/icons/store.js.map +1 -0
  640. package/dist/index.d.ts +86 -2293
  641. package/dist/index.js +82 -13349
  642. package/dist/internal/Field.js +74 -0
  643. package/dist/internal/Field.js.map +1 -0
  644. package/dist/internal/FloatingPanel.js +41 -0
  645. package/dist/internal/FloatingPanel.js.map +1 -0
  646. package/dist/internal/chart.js +131 -0
  647. package/dist/internal/chart.js.map +1 -0
  648. package/dist/internal/dev.js +21 -0
  649. package/dist/internal/dev.js.map +1 -0
  650. package/dist/internal/focus.js +94 -0
  651. package/dist/internal/focus.js.map +1 -0
  652. package/dist/internal/focusMain.d.ts +4 -0
  653. package/dist/internal/focusMain.js +22 -0
  654. package/dist/internal/focusMain.js.map +1 -0
  655. package/dist/internal/scrollHint.js +78 -0
  656. package/dist/internal/scrollHint.js.map +1 -0
  657. package/dist/internal/tableTools.js +114 -0
  658. package/dist/internal/tableTools.js.map +1 -0
  659. package/dist/internal/terms.d.ts +18 -0
  660. package/dist/internal/terms.js +64 -0
  661. package/dist/internal/terms.js.map +1 -0
  662. package/dist/internal/util.js +107 -0
  663. package/dist/internal/util.js.map +1 -0
  664. package/dist/motion.d.ts +5 -0
  665. package/dist/motion.js +29 -0
  666. package/dist/motion.js.map +1 -0
  667. package/dist/styles.css +4280 -4265
  668. package/dist/theme.d.ts +20 -0
  669. package/dist/theme.js +210 -0
  670. package/dist/theme.js.map +1 -0
  671. package/dist/tokens.css +4 -0
  672. package/docs/guidelines.md +1 -0
  673. package/docs/theme.md +51 -0
  674. package/package.json +5 -4
  675. package/dist/format-entry-CgMBtkni.d.ts +0 -79
  676. package/dist/format-entry-CyChe8bk.js.map +0 -1
  677. package/dist/index.js.map +0 -1
@@ -0,0 +1,1648 @@
1
+ "use client";
2
+ import { GraphLegend } from "../Graph/Graph.js";
3
+ import { Tabs } from "../Tabs/Tabs.js";
4
+ import { IconButton } from "../IconButton/IconButton.js";
5
+ import { Switch } from "../Switch/Switch.js";
6
+ import { tr } from "../../i18n.js";
7
+ import { format } from "../../format.js";
8
+ import { cx, monoNums } from "../../internal/util.js";
9
+ import { ScrollHint, useScrollHint } from "../../internal/scrollHint.js";
10
+ import { devWarn } from "../../internal/dev.js";
11
+ import { Icon } from "../../icons/Icon.js";
12
+ import { includeIcons } from "../../icons/store.js";
13
+ import lock_default from "../../icons/ph/lock.js";
14
+ import tag_default from "../../icons/ph/tag.js";
15
+ import * as React from "react";
16
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
17
+ // src/components/LayerGraph/LayerGraph.tsx
18
+ includeIcons(lock_default, tag_default);
19
+ const scrollMemory = /* @__PURE__ */ new Map();
20
+ let measure;
21
+ const SPLIT = /(`[^`]+`|\d[\d,.]*)/;
22
+ /** A label with a number: {n} in a string, or a function of the number; the number comes back as \u0001 (monoNums). */
23
+ function withNum(label, n, fallback) {
24
+ if (typeof label === "function") {
25
+ const t = label(n);
26
+ for (const s of [format.number(n), String(n)]) if (t.includes(s)) return t.replace(s, "");
27
+ return t;
28
+ }
29
+ return (label ?? fallback(n)).replace("{n}", "");
30
+ }
31
+ /** The default for one (「1 call」) where the language has its own word for it, else the {n} form. */
32
+ function byCount(n, one, many) {
33
+ const t = n === 1 ? tr(one) : "";
34
+ return t && t !== one ? t : tr(many);
35
+ }
36
+ /** A box reached with the keyboard while partly scrolled out of the diagram's frame (phones): scroll it fully into view,
37
+ * with its focus outline (scroll-margin in styles.css). The browser scrolls only boxes that are wholly out of view. */
38
+ function showWhole(e) {
39
+ if (e.currentTarget.matches(":focus-visible")) e.currentTarget.scrollIntoView({
40
+ block: "nearest",
41
+ inline: "nearest"
42
+ });
43
+ }
44
+ /** The width of text in a font (`600 13px` and mono or sans), measured on a canvas. */
45
+ function textWidth(text, size, code) {
46
+ if (measure === void 0) measure = document.createElement("canvas").getContext("2d");
47
+ const c = measure;
48
+ if (!c) return text.length * size * .6;
49
+ const cs = getComputedStyle(document.documentElement);
50
+ c.font = `600 ${size}px ` + ((code ? cs.getPropertyValue("--font-mono") : cs.getPropertyValue("--font-sans")) || "sans-serif");
51
+ return c.measureText(text).width;
52
+ }
53
+ const TAG_KEEP = 8;
54
+ const MIN_FRAME = 160;
55
+ const MAX_EXTRA = 200;
56
+ /** HC: the bar under the diagram: drag it, ↑↓ 16 px, Enter or a double-click back to the drawn height. */
57
+ function HeightHandle(p) {
58
+ const [dragging, setDragging] = React.useState(false);
59
+ const from = React.useRef(null);
60
+ return /* @__PURE__ */ jsx("div", {
61
+ className: cx("ui-lg-resize", dragging && "is-dragging"),
62
+ role: "separator",
63
+ "aria-orientation": "horizontal",
64
+ "aria-label": tr("調整架構圖高度"),
65
+ "aria-valuenow": p.value,
66
+ "aria-valuemin": p.min,
67
+ "aria-valuemax": p.max,
68
+ "aria-valuetext": tr("{n} px", { n: p.value }),
69
+ tabIndex: 0,
70
+ onPointerDown: (e) => {
71
+ if (e.button !== 0) return;
72
+ e.preventDefault();
73
+ e.currentTarget.setPointerCapture(e.pointerId);
74
+ from.current = {
75
+ y: e.clientY,
76
+ d: p.start()
77
+ };
78
+ setDragging(true);
79
+ },
80
+ onPointerMove: (e) => {
81
+ if (!from.current) return;
82
+ p.onDrag(from.current.d + e.clientY - from.current.y);
83
+ },
84
+ onPointerUp: () => {
85
+ from.current = null;
86
+ setDragging(false);
87
+ },
88
+ onPointerCancel: () => {
89
+ from.current = null;
90
+ setDragging(false);
91
+ },
92
+ onDoubleClick: p.onReset,
93
+ onKeyDown: (e) => {
94
+ if (e.altKey || e.metaKey || e.ctrlKey) return;
95
+ if (e.key === "ArrowUp" || e.key === "ArrowDown") {
96
+ e.preventDefault();
97
+ p.onKey(e.key === "ArrowUp" ? -16 : 16);
98
+ } else if (e.key === "Enter") {
99
+ e.preventDefault();
100
+ p.onReset();
101
+ }
102
+ },
103
+ children: /* @__PURE__ */ jsxs("span", {
104
+ className: "ui-lg-resize-grip",
105
+ "aria-hidden": "true",
106
+ children: [
107
+ /* @__PURE__ */ jsx("i", {}),
108
+ /* @__PURE__ */ jsx("i", {}),
109
+ /* @__PURE__ */ jsx("i", {})
110
+ ]
111
+ })
112
+ });
113
+ }
114
+ function labelWidth(text) {
115
+ const parts = text.split(SPLIT).filter(Boolean);
116
+ if (measure === void 0) measure = document.createElement("canvas").getContext("2d");
117
+ const c = measure;
118
+ if (!c) return text.length * 9;
119
+ const cs = getComputedStyle(document.documentElement);
120
+ const sans = cs.getPropertyValue("--font-sans") || "sans-serif";
121
+ const mono = cs.getPropertyValue("--font-mono") || "monospace";
122
+ return parts.reduce((w, t) => {
123
+ const code = t[0] === "`" || /^\d/.test(t);
124
+ c.font = "600 12px " + (code ? mono : sans);
125
+ return w + c.measureText(t[0] === "`" ? t.slice(1, -1) : t).width;
126
+ }, 0);
127
+ }
128
+ const LABELS_KEY = "ui-lg-labels:";
129
+ const allIds = (nodes) => nodes.map((n) => n.id).join("|");
130
+ const GROW = 24;
131
+ const GROW_MAX = 144;
132
+ /** The label on 1 line, then wrapped onto 2, 3 and 4 lines as evenly as it goes. Breaks between Chinese characters
133
+ * and at spaces; never inside `code`, a word or a number, between a number and the word after it, before a closing
134
+ * mark or after an opening one. */
135
+ function wraps(text) {
136
+ const atoms = [];
137
+ for (const t of text.match(/`[^`]+`|[A-Za-z0-9_./:#@-]+|\s+|[\s\S]/gu) ?? []) {
138
+ const prev = atoms[atoms.length - 1];
139
+ const unit = /\d\s*$/.test(prev ?? "") && !/^[A-Za-z0-9_]/.test(t);
140
+ if (prev != null && (unit || /^[)」』、,。:;!?)\],;!?]/.test(t) || /[(「『([]$/.test(prev))) atoms[atoms.length - 1] = prev + t;
141
+ else atoms.push(t);
142
+ }
143
+ const fill = (max) => {
144
+ const lines = [];
145
+ let cur = "";
146
+ for (const a of atoms) {
147
+ if (/^\s+$/.test(a)) {
148
+ if (cur) cur += a;
149
+ continue;
150
+ }
151
+ if (cur && labelWidth(cur.trimEnd() + a) > max) {
152
+ lines.push(cur.trimEnd());
153
+ cur = a;
154
+ } else cur += a;
155
+ }
156
+ if (cur.trim()) lines.push(cur.trimEnd());
157
+ return lines;
158
+ };
159
+ const full = labelWidth(text);
160
+ const out = [[text]];
161
+ for (let n = 2; n <= 4; n++) {
162
+ let lo = Math.max(...atoms.filter((a) => a.trim()).map(labelWidth)) - 1;
163
+ let hi = full;
164
+ while (hi - lo > 1) {
165
+ const mid = (lo + hi) / 2;
166
+ if (fill(mid).length <= n) hi = mid;
167
+ else lo = mid;
168
+ }
169
+ const lines = fill(hi);
170
+ if (lines.length > out[out.length - 1].length) out.push(lines);
171
+ }
172
+ return out;
173
+ }
174
+ function labelParts(text) {
175
+ return text.split(SPLIT).filter(Boolean).map((t, i) => t[0] === "`" || /^\d/.test(t) ? /* @__PURE__ */ jsx("span", {
176
+ className: "ui-lg-code",
177
+ children: t[0] === "`" ? t.slice(1, -1) : t
178
+ }, i) : t);
179
+ }
180
+ /** Rounded orthogonal path through the points. */
181
+ function route(pts, R) {
182
+ let d = `M${pts[0][0]} ${pts[0][1]}`;
183
+ for (let i = 1; i < pts.length - 1; i++) {
184
+ const [a, b, c] = [
185
+ pts[i - 1],
186
+ pts[i],
187
+ pts[i + 1]
188
+ ];
189
+ const r = Math.min(R, Math.abs(b[0] - a[0] + b[1] - a[1]) / 2, Math.abs(c[0] - b[0] + c[1] - b[1]) / 2);
190
+ const ux = Math.sign(b[0] - a[0]);
191
+ const uy = Math.sign(b[1] - a[1]);
192
+ const vx = Math.sign(c[0] - b[0]);
193
+ const vy = Math.sign(c[1] - b[1]);
194
+ d += ` L${b[0] - ux * r} ${b[1] - uy * r} Q${b[0]} ${b[1]} ${b[0] + vx * r} ${b[1] + vy * r}`;
195
+ }
196
+ const z = pts[pts.length - 1];
197
+ return `${d} L${z[0]} ${z[1]}`;
198
+ }
199
+ /** Drops repeated points and points in the middle of a straight run. */
200
+ const clean = (pts) => pts.filter((q, i) => {
201
+ const o = pts[i - 1];
202
+ return !o || o[0] !== q[0] || o[1] !== q[1];
203
+ }).filter((q, i, arr) => {
204
+ const a = arr[i - 1];
205
+ const c = arr[i + 1];
206
+ return !a || !c || !(a[0] === q[0] && q[0] === c[0] || a[1] === q[1] && q[1] === c[1]);
207
+ });
208
+ /** Architecture as layers of boxes with arrows. Line width shows how often; inferred relations are dashed and labelled;
209
+ * shared items are listed under the diagram instead of drawn. Wider than its box: the boxes narrow (down to 120 px),
210
+ * then the whole diagram scales down (to 0.75 at least); past that it scrolls sideways at full width (PM, WA). */
211
+ function LayerGraph(p) {
212
+ const [avail, setAvail] = React.useState(0);
213
+ const [fit, setFit] = React.useState(null);
214
+ const fitted = fit && fit.at === avail ? fit : null;
215
+ const NW = fitted?.nw ?? (p.nodeWidth || 200);
216
+ const GAP = 56;
217
+ const [dh, setDhState] = React.useState(() => {
218
+ if (!p.resizable || !p.heightKey) return 0;
219
+ try {
220
+ const v = Number(localStorage.getItem("ui-lg-height:" + p.heightKey));
221
+ return Number.isFinite(v) ? v : 0;
222
+ } catch {
223
+ return 0;
224
+ }
225
+ });
226
+ const setDh = React.useCallback((v) => {
227
+ setDhState(v);
228
+ if (!p.heightKey) return;
229
+ try {
230
+ localStorage.setItem("ui-lg-height:" + p.heightKey, String(Math.round(v)));
231
+ } catch {}
232
+ }, [p.heightKey]);
233
+ const spreadKey = avail + "#" + p.nodes.map((n) => n.id).join("|") + "#" + p.edges.map((e) => e.from + ">" + e.to + ":" + (e.label ?? "")).join("|");
234
+ const [spreadAt, setSpread] = React.useState({
235
+ key: "",
236
+ n: 0
237
+ });
238
+ const spread = spreadAt.key === spreadKey ? spreadAt.n : 0;
239
+ const COL = (fitted?.col ?? 40) + spread * 24;
240
+ const scale = fitted?.scale ?? 1;
241
+ const PAD = 16;
242
+ const all = p.nodes;
243
+ const sel = p.selected ?? null;
244
+ devWarn(all.some((n) => n.fns != null), "LayerGraph", "fns is renamed size; pass size and, for the text under the bar, sizeLabel such as 「{n} 個函式」.");
245
+ devWarn(all.some((n) => n.external && n.shared), "LayerGraph", "a node is both external and shared; it is drawn as shared. Keep one of the two.");
246
+ const sizeOf = (n) => n.external && !n.shared ? void 0 : n.size ?? n.fns;
247
+ const sharedIds = new Set(all.filter((n) => n.shared).map((n) => n.id));
248
+ const main = all.filter((n) => !n.shared);
249
+ const tagLine = main.some((n) => {
250
+ if (!n.tag) return false;
251
+ const name = n.name || n.id;
252
+ const tagW = textWidth(n.tag, 12, false) + 12 + (n.tagTone === "warning" ? 15 : 0);
253
+ return NW - (n.external ? 24 : 28) - 6 - tagW < textWidth(name.slice(0, TAG_KEEP), 13, !!n.code) + (name.length > TAG_KEEP ? 1 : 0);
254
+ });
255
+ const NH = tagLine ? 76 : 60;
256
+ const shared = all.filter((n) => n.shared);
257
+ const edges = p.edges.filter((e) => !sharedIds.has(e.from) && !sharedIds.has(e.to));
258
+ const lab = (e) => !!(e.inferred || e.declared);
259
+ const byLayer = /* @__PURE__ */ new Map();
260
+ const EXTERNAL = Number.NEGATIVE_INFINITY;
261
+ for (const n of main) {
262
+ const l = n.external ? EXTERNAL : n.layer || 0;
263
+ byLayer.set(l, [...byLayer.get(l) ?? [], n]);
264
+ }
265
+ const layers = [...byLayer.keys()].sort((a, b) => a - b);
266
+ const cols = Math.max(1, ...layers.map((l) => byLayer.get(l)?.length ?? 0));
267
+ let W = 32 + cols * NW + (cols - 1) * COL;
268
+ const between = Math.max(0, layers.length - 1);
269
+ const extra = p.resizable && dh > 0 && between ? Math.min(MAX_EXTRA, dh / scale / between) : 0;
270
+ const gaps = layers.map((_, k) => GAP + (k < between ? extra : 0));
271
+ let H = 0;
272
+ const pos = {};
273
+ const layerIndex = {};
274
+ layers.forEach((l, k) => {
275
+ const row = byLayer.get(l) ?? [];
276
+ const off = (W - (row.length * NW + (row.length - 1) * COL)) / 2;
277
+ row.forEach((n, i) => {
278
+ pos[n.id] = {
279
+ x: off + i * (NW + COL),
280
+ y: 0
281
+ };
282
+ layerIndex[n.id] = k;
283
+ });
284
+ });
285
+ const rowTop = (k) => PAD + k * NH + gaps.slice(0, k).reduce((a, b) => a + b, 0);
286
+ const extRow = byLayer.get(EXTERNAL) ?? [];
287
+ const extW = Math.max(NW, Math.min(p.nodeWidth || 200, W - PAD));
288
+ const boxOf = (id) => {
289
+ const wide = extRow.length === 1 && extRow[0].id === id ? extW : NW;
290
+ return {
291
+ x: pos[id].x + (NW - wide) / 2,
292
+ w: wide
293
+ };
294
+ };
295
+ const placeRows = () => {
296
+ for (const id in pos) pos[id].y = rowTop(layerIndex[id]);
297
+ H = rowTop(layers.length - 1) + NH + PAD + (flatRow[layers.length - 1]?.length ? FLAT_ROOM : 0);
298
+ };
299
+ const maxSize = Math.max(1, ...main.map((n) => sizeOf(n) || 0));
300
+ const maxCount = Math.max(1, ...edges.map((e) => e.count || 0));
301
+ const isUp = (e) => !!pos[e.from] && !!pos[e.to] && layerIndex[e.to] < layerIndex[e.from];
302
+ const isFlat = (e) => !!pos[e.from] && !!pos[e.to] && e.from !== e.to && layerIndex[e.to] === layerIndex[e.from];
303
+ const flatIn = {};
304
+ const flatRow = {};
305
+ const outs = {};
306
+ const ins = {};
307
+ const upOut = {};
308
+ const upIn = {};
309
+ for (const e of edges) {
310
+ if (!pos[e.from] || !pos[e.to]) continue;
311
+ if (isUp(e)) {
312
+ (upOut[e.from] ??= []).push(e);
313
+ (upIn[e.to] ??= []).push(e);
314
+ continue;
315
+ }
316
+ (outs[e.from] ??= []).push(e);
317
+ if (isFlat(e)) {
318
+ (flatIn[e.to] ??= []).push(e);
319
+ (flatRow[layerIndex[e.from]] ??= []).push(e);
320
+ continue;
321
+ }
322
+ (ins[e.to] ??= []).push(e);
323
+ }
324
+ const FLAT_ROOM = 20 + 10 * Math.max(0, (flatRow[layers.length - 1]?.length ?? 0) - 1);
325
+ const ups = edges.filter(isUp);
326
+ const rowOf = (id) => byLayer.get(layers[layerIndex[id]]) ?? [];
327
+ const rightmost = (id) => rowOf(id)[rowOf(id).length - 1]?.id === id;
328
+ const leftmost = (id) => rowOf(id)[0]?.id === id;
329
+ const onLeft = (e) => !rightmost(e.to) && leftmost(e.to);
330
+ const upsL = ups.filter(onLeft);
331
+ const upsR = ups.filter((e) => !onLeft(e));
332
+ const LANE = 20;
333
+ const LANE_STEP = 12;
334
+ for (const k in outs) outs[k].sort((a, b) => pos[a.to].x - pos[b.to].x);
335
+ for (const k in ins) ins[k].sort((a, b) => pos[a.from].x - pos[b.from].x);
336
+ const edgeId = (e) => e.id ?? `${e.from}->${e.to}`;
337
+ const pickEdge = p.onSelectEdge;
338
+ const [labelsOn, setLabelsOn] = React.useState(() => {
339
+ try {
340
+ const v = window.localStorage.getItem(LABELS_KEY + (p.scrollKey ?? allIds(p.nodes)));
341
+ if (v === "1" || v === "0") return v === "1";
342
+ } catch {}
343
+ return p.edgeLabels !== "hover";
344
+ });
345
+ const peek = !labelsOn;
346
+ const switchLabels = () => {
347
+ const on = !labelsOn;
348
+ setLabelsOn(on);
349
+ try {
350
+ window.localStorage.setItem(LABELS_KEY + (p.scrollKey ?? allIds(p.nodes)), on ? "1" : "0");
351
+ } catch {}
352
+ };
353
+ const [hover, setHover] = React.useState(null);
354
+ const { ref: scrollRef, more: scrollMore, overflows, scrolled, onScroll } = useScrollHint();
355
+ const uid = React.useId().replace(/:/g, "");
356
+ const [view, setView] = React.useState("graph");
357
+ const memKey = p.scrollKey ?? all.map((n) => n.id).join("|");
358
+ React.useLayoutEffect(() => {
359
+ const el = scrollRef.current;
360
+ const x = scrollMemory.get(memKey);
361
+ if (el && x) el.scrollLeft = x;
362
+ }, [
363
+ memKey,
364
+ view,
365
+ scrollRef
366
+ ]);
367
+ const onScrollKeep = () => {
368
+ const el = scrollRef.current;
369
+ if (el) scrollMemory.set(memKey, el.scrollLeft);
370
+ onScroll();
371
+ };
372
+ const selEdge = pickEdge && edges.find((e) => edgeId(e) === p.selectedEdge) || null;
373
+ const selListEdge = pickEdge && p.edges.find((e) => edgeId(e) === p.selectedEdge) || null;
374
+ const nodeIdsAll = new Set(all.map((n) => n.id));
375
+ const uses = {};
376
+ for (const e of p.edges) if (sharedIds.has(e.to) && e.from !== e.to && nodeIdsAll.has(e.from)) (uses[e.to] ??= {})[e.from] = (uses[e.to]?.[e.from] ?? 0) + (e.count || 0);
377
+ const selShared = !selEdge && sel != null && sharedIds.has(sel) ? sel : null;
378
+ const related = (e) => selEdge ? e === selEdge : !!sel && !selShared && (e.from === sel || e.to === sel);
379
+ const focus = !!sel || !!selEdge;
380
+ const near = (id) => selEdge ? id === selEdge.from || id === selEdge.to : selShared ? id === selShared || id in (uses[selShared] ?? {}) : !sel || id === sel || edges.some((e) => related(e) && (e.from === id || e.to === id));
381
+ const pick = (id, on) => {
382
+ if (!on && p.selectedEdge != null) pickEdge?.(null);
383
+ p.onSelect?.(on ? null : id);
384
+ };
385
+ const nameOf = (id) => all.find((n) => n.id === id)?.name || id;
386
+ const countText = (e) => {
387
+ const n = e.count ?? 0;
388
+ return typeof p.countLabel === "function" ? p.countLabel(n) : (p.countLabel ?? byCount(n, "1 次", "{n} 次")).replace("{n}", format.number(n));
389
+ };
390
+ const midSentence = (t) => /^[A-Z][a-z]/.test(t) && !/^zh/i.test(format.locale()) ? t[0].toLowerCase() + t.slice(1) : t;
391
+ const sameLabel = /* @__PURE__ */ new Map();
392
+ for (const e of edges) if (lab(e) && e.label && pos[e.from] && pos[e.to]) sameLabel.set(e.label, (sameLabel.get(e.label) ?? 0) + 1);
393
+ const kindWord = (e) => e.declared ? p.declaredLabel || tr("宣告") : p.inferredLabel || tr("推測");
394
+ const inferredText = (e) => e.label && (sameLabel.get(e.label) ?? 0) > 1 ? tr("來自 {from},{label}", {
395
+ from: nameOf(e.from),
396
+ label: midSentence(e.label)
397
+ }) : e.label || kindWord(e);
398
+ const markText = (e) => lab(e) ? inferredText(e) : countText(e);
399
+ if (upsL.length) {
400
+ const left0 = Math.min(...main.map((n) => pos[n.id].x));
401
+ const shift = Math.max(0, PAD + (upsL.length - 1) * LANE_STEP + LANE - left0);
402
+ for (const id in pos) pos[id] = {
403
+ x: pos[id].x + shift,
404
+ y: pos[id].y
405
+ };
406
+ W += shift;
407
+ }
408
+ const boxesLeft = () => Math.min(...main.map((n) => pos[n.id].x));
409
+ const boxesRight = () => Math.max(0, ...main.map((n) => pos[n.id].x + NW));
410
+ const laneX = (e) => onLeft(e) ? boxesLeft() - LANE - upsL.indexOf(e) * LANE_STEP : boxesRight() + LANE + upsR.indexOf(e) * LANE_STEP;
411
+ const upLabelX = () => boxesLeft() - LANE + 8;
412
+ const upLabelEndL = () => boxesRight() + LANE - 8;
413
+ if (upsR.length) W = Math.max(W, boxesRight() + LANE + (upsR.length - 1) * LANE_STEP + PAD);
414
+ const choose = (e) => {
415
+ const id = edgeId(e);
416
+ const next = p.selectedEdge === id ? null : id;
417
+ if (next && sel != null) p.onSelect?.(null);
418
+ pickEdge?.(next);
419
+ };
420
+ const LANE_H = 28;
421
+ const txOf = (e) => Math.round(pos[e.to].x + NW * (ins[e.to].indexOf(e) + 1) / (ins[e.to].length + 1));
422
+ const laneGroups = {};
423
+ const laneCount = {};
424
+ {
425
+ const into = {};
426
+ for (const e of edges) if (ins[e.to]?.includes(e) && (lab(e) || related(e))) (into[e.to] ??= []).push(e);
427
+ for (const id in into) {
428
+ if (into[id].length < 2) continue;
429
+ laneGroups[id] = into[id].sort((a, b) => txOf(b) - txOf(a));
430
+ laneCount[id] = into[id].length;
431
+ }
432
+ }
433
+ const draw = () => {
434
+ const paths = [];
435
+ const labels = [];
436
+ const need = /* @__PURE__ */ new Set();
437
+ const crowd = /* @__PURE__ */ new Set();
438
+ let covered = 0;
439
+ const geomOf = (e) => {
440
+ const a = pos[e.from];
441
+ const b = pos[e.to];
442
+ const oi = outs[e.from].indexOf(e);
443
+ const on = outs[e.from].length;
444
+ const sx = outX(a.x, oi, on);
445
+ const sy = a.y + NH;
446
+ const tx = txOf(e);
447
+ const ty = b.y;
448
+ const off = (oi - (on - 1) / 2) * 6;
449
+ const skip = layerIndex[e.to] - layerIndex[e.from] > 1;
450
+ const y1 = sy + gaps[layerIndex[e.from]] / 2 + off;
451
+ let chx = sx;
452
+ if (skip) {
453
+ const next = (byLayer.get(layers[layerIndex[e.from] + 1]) ?? []).map((n) => pos[n.id]);
454
+ const mid = (sx + tx) / 2;
455
+ const chans = [next[0].x - COL / 2, ...next.map((q) => q.x + NW + COL / 2)].map((c) => Math.max(PAD / 2, Math.min(W - PAD / 2, c)));
456
+ chx = chans.reduce((best, c) => Math.abs(c - mid) < Math.abs(best - mid) ? c : best, chans[0]) + off;
457
+ }
458
+ return {
459
+ sx,
460
+ sy,
461
+ tx,
462
+ ty,
463
+ off,
464
+ skip,
465
+ y1,
466
+ chx,
467
+ from: skip ? chx : sx,
468
+ startY: skip ? y1 : sy
469
+ };
470
+ };
471
+ const lanes = /* @__PURE__ */ new Map();
472
+ const outX = (x, i, n) => Math.round(n < 2 ? x + NW / 2 : x + 16 + (NW - 32) * i / (n - 1));
473
+ const flatOf = (e) => {
474
+ const a = pos[e.from];
475
+ const b = pos[e.to];
476
+ const oi = outs[e.from].indexOf(e);
477
+ const on = outs[e.from].length;
478
+ const sx = outX(a.x, oi, on);
479
+ const j = flatRow[layerIndex[e.from]].indexOf(e);
480
+ const ti = flatIn[e.to].indexOf(e);
481
+ const tx = Math.round(b.x + NW - 24 - ti * 12);
482
+ return {
483
+ sx,
484
+ sy: a.y + NH,
485
+ y: a.y + NH + 14 + j * 10,
486
+ tx,
487
+ ty: b.y + NH
488
+ };
489
+ };
490
+ const vertsOf = (e) => {
491
+ if (isFlat(e)) {
492
+ const f = flatOf(e);
493
+ return [{
494
+ x: f.sx,
495
+ y0: f.sy,
496
+ y1: f.y
497
+ }, {
498
+ x: f.tx,
499
+ y0: f.ty,
500
+ y1: f.y
501
+ }];
502
+ }
503
+ if (isUp(e)) return [{
504
+ x: laneX(e),
505
+ y0: pos[e.to].y,
506
+ y1: pos[e.from].y + NH
507
+ }];
508
+ const g = geomOf(e);
509
+ if (!g.skip) return [{
510
+ x: g.sx,
511
+ y0: g.sy,
512
+ y1: g.y1
513
+ }, {
514
+ x: g.tx,
515
+ y0: g.y1,
516
+ y1: g.ty
517
+ }];
518
+ const y2 = g.ty - gaps[layerIndex[e.to] - 1] / 2 + g.off;
519
+ return [
520
+ {
521
+ x: g.sx,
522
+ y0: g.sy,
523
+ y1: g.y1
524
+ },
525
+ {
526
+ x: g.chx,
527
+ y0: g.y1,
528
+ y1: y2
529
+ },
530
+ {
531
+ x: g.tx,
532
+ y0: y2,
533
+ y1: g.ty
534
+ }
535
+ ];
536
+ };
537
+ for (const id in laneGroups) {
538
+ const group = laneGroups[id].map((e) => ({
539
+ e,
540
+ g: geomOf(e),
541
+ w: Math.ceil(labelWidth(markText(e)))
542
+ }));
543
+ const others = edges.filter((e) => !laneGroups[id].includes(e) && pos[e.from] && pos[e.to]).flatMap((e) => vertsOf(e).map((v) => ({
544
+ k: -1,
545
+ ...v
546
+ })));
547
+ const n = group.length;
548
+ const laneY = (j) => group[0].g.ty - 8 - 16 - j * LANE_H;
549
+ const perms = [];
550
+ const permute = (rest, acc) => {
551
+ if (!rest.length) perms.push(acc);
552
+ else rest.forEach((x, k) => permute([...rest.slice(0, k), ...rest.slice(k + 1)], [...acc, x]));
553
+ };
554
+ if (n <= 6) permute([...group.keys()], []);
555
+ else perms.push([...group.keys()]);
556
+ let best = null;
557
+ for (const perm of perms) {
558
+ const ys = [];
559
+ perm.forEach((k, j) => ys[k] = laneY(j));
560
+ const verts = [...group.flatMap((q, k) => [{
561
+ k,
562
+ x: q.g.from,
563
+ y0: q.g.startY,
564
+ y1: ys[k]
565
+ }, {
566
+ k,
567
+ x: q.g.tx,
568
+ y0: ys[k],
569
+ y1: q.g.ty - 8
570
+ }]), ...others];
571
+ const free = (k, x0, x1) => verts.every((v) => v.k === k ? !(v.x > x0 - 1 && v.x < x1 + 1 && v.y0 < ys[k] + 7 && v.y1 > ys[k] - 7) : !(v.x > x0 - 5 && v.x < x1 + 5 && v.y0 < ys[k] + 10 && v.y1 > ys[k] - 10));
572
+ let fails = 0;
573
+ const sides = [];
574
+ group.forEach((q, k) => {
575
+ const r0 = Math.max(q.g.from, q.g.tx) + 8;
576
+ const l1 = Math.min(q.g.from, q.g.tx) - 8;
577
+ if (free(k, r0, r0 + q.w)) sides[k] = "right";
578
+ else if (free(k, l1 - q.w, l1)) sides[k] = "left";
579
+ else {
580
+ sides[k] = "right";
581
+ fails++;
582
+ }
583
+ });
584
+ if (!best || fails < best.fails) best = {
585
+ fails,
586
+ ys,
587
+ sides
588
+ };
589
+ if (!fails) break;
590
+ }
591
+ if (best) group.forEach((q, k) => lanes.set(q.e, {
592
+ y: best.ys[k],
593
+ side: best.sides[k]
594
+ }));
595
+ }
596
+ const marks = [];
597
+ let wide = 0;
598
+ let least = 0;
599
+ const runs = [];
600
+ const segs = [];
601
+ const ptsOf = {};
602
+ const arrows = [];
603
+ const hitPaths = [];
604
+ edges.forEach((e, idx) => {
605
+ const a = pos[e.from];
606
+ const b = pos[e.to];
607
+ if (!a || !b) return;
608
+ const r = related(e);
609
+ const dim = focus && !r;
610
+ const picked = e === selEdge;
611
+ const hovered = !!pickEdge && hover === edgeId(e) && !r;
612
+ const up = isUp(e);
613
+ let pts;
614
+ let tx;
615
+ let ty;
616
+ let arrow;
617
+ let inn = 1;
618
+ let laneAt = null;
619
+ let turnFrom = 0;
620
+ let laneSide = "right";
621
+ if (up) {
622
+ const lx = laneX(e);
623
+ const L = onLeft(e);
624
+ const si = upOut[e.from].indexOf(e);
625
+ const sn = upOut[e.from].length;
626
+ const ti = upIn[e.to].indexOf(e);
627
+ const tn = upIn[e.to].length;
628
+ const start = [];
629
+ let y0;
630
+ if (L ? leftmost(e.from) : rightmost(e.from)) {
631
+ y0 = Math.round(a.y + NH / 2 + (si - (sn - 1) / 2) * 10);
632
+ start.push([L ? a.x : a.x + NW, y0], [lx, y0]);
633
+ } else {
634
+ const px = L ? a.x + 20 + si * 10 : a.x + NW - 20 - si * 10;
635
+ y0 = a.y - 12 - si * 6;
636
+ start.push([px, a.y], [px, y0], [lx, y0]);
637
+ }
638
+ let y1;
639
+ if (L || rightmost(e.to)) {
640
+ y1 = Math.round(b.y + NH / 2 + (ti - (tn - 1) / 2) * 10);
641
+ tx = L ? b.x : b.x + NW;
642
+ ty = y1;
643
+ const back = L ? tx - 9 : tx + 9;
644
+ pts = [
645
+ ...start,
646
+ [lx, y1],
647
+ [back, y1]
648
+ ];
649
+ arrow = `M${back} ${ty - 5} L${back} ${ty + 5} L${tx} ${ty} Z`;
650
+ arrows.push([
651
+ Math.min(tx, back),
652
+ Math.max(tx, back),
653
+ ty - 5,
654
+ ty + 5
655
+ ]);
656
+ runs.push([
657
+ Math.min(tx, lx),
658
+ Math.max(tx, lx),
659
+ y1 - 3,
660
+ y1 + 3
661
+ ]);
662
+ } else {
663
+ tx = b.x + NW - 20 - ti * 10;
664
+ y1 = b.y + NH + 12 + ti * 6;
665
+ ty = b.y + NH;
666
+ pts = [
667
+ ...start,
668
+ [lx, y1],
669
+ [tx, y1],
670
+ [tx, ty + 9]
671
+ ];
672
+ arrow = `M${tx - 5} ${ty + 9} L${tx + 5} ${ty + 9} L${tx} ${ty} Z`;
673
+ arrows.push([
674
+ tx - 5,
675
+ tx + 5,
676
+ ty,
677
+ ty + 9
678
+ ]);
679
+ runs.push([
680
+ tx,
681
+ lx,
682
+ y1 - 3,
683
+ y1 + 3
684
+ ]);
685
+ }
686
+ const sx0 = start[start.length - 2][0];
687
+ runs.push([
688
+ Math.min(sx0, lx),
689
+ Math.max(sx0, lx),
690
+ y0 - 3,
691
+ y0 + 3
692
+ ]);
693
+ if (lab(e) || r) {
694
+ const text = markText(e);
695
+ marks.push({
696
+ idx,
697
+ e,
698
+ text,
699
+ tx: L ? upLabelX() : upLabelEndL(),
700
+ ty: Math.round((y0 + y1) / 2),
701
+ left: !L,
702
+ r,
703
+ dim,
704
+ up: true
705
+ });
706
+ }
707
+ } else if (isFlat(e)) {
708
+ const f = flatOf(e);
709
+ tx = f.tx;
710
+ ty = f.ty;
711
+ pts = [
712
+ [f.sx, f.sy],
713
+ [f.sx, f.y],
714
+ [f.tx, f.y],
715
+ [f.tx, f.ty + 9]
716
+ ];
717
+ arrow = `M${tx - 5} ${ty + 9} L${tx + 5} ${ty + 9} L${tx} ${ty} Z`;
718
+ arrows.push([
719
+ tx - 5,
720
+ tx + 5,
721
+ ty,
722
+ ty + 9
723
+ ]);
724
+ runs.push([
725
+ Math.min(f.sx, f.tx),
726
+ Math.max(f.sx, f.tx),
727
+ f.y - 3,
728
+ f.y + 3
729
+ ]);
730
+ if (lab(e) || r) {
731
+ const text = markText(e);
732
+ marks.push({
733
+ idx,
734
+ e,
735
+ text,
736
+ tx: Math.round((f.sx + f.tx) / 2),
737
+ ty: f.y,
738
+ left: false,
739
+ r,
740
+ dim,
741
+ flat: true
742
+ });
743
+ }
744
+ } else {
745
+ inn = ins[e.to].length;
746
+ const g = geomOf(e);
747
+ const { sx, sy, skip } = g;
748
+ tx = g.tx;
749
+ ty = g.ty;
750
+ const lane = lanes.get(e);
751
+ const laneY = lane ? lane.y : null;
752
+ const y1 = !skip && laneY != null ? laneY : g.y1;
753
+ if (skip) {
754
+ const y2 = laneY ?? ty - gaps[layerIndex[e.to] - 1] / 2 + g.off;
755
+ pts = [
756
+ [sx, sy],
757
+ [sx, y1],
758
+ [g.chx, y1],
759
+ [g.chx, y2],
760
+ [tx, y2],
761
+ [tx, ty - 8]
762
+ ];
763
+ } else pts = [
764
+ [sx, sy],
765
+ [sx, y1],
766
+ [tx, y1],
767
+ [tx, ty - 8]
768
+ ];
769
+ turnFrom = g.from;
770
+ laneAt = laneY;
771
+ laneSide = lane?.side ?? "right";
772
+ arrow = `M${tx - 5} ${ty - 9} L${tx + 5} ${ty - 9} L${tx} ${ty} Z`;
773
+ arrows.push([
774
+ tx - 5,
775
+ tx + 5,
776
+ ty - 9,
777
+ ty
778
+ ]);
779
+ }
780
+ const w = (lab(e) ? 1.5 : 1.5 + 5.5 * ((e.count || 0) / maxCount)) + (picked ? 1.5 : 0) + (hovered ? 2 : 0);
781
+ const cpts = clean(pts);
782
+ ptsOf[idx] = cpts;
783
+ for (let k = 1; k < cpts.length; k++) {
784
+ const [ax, ay] = cpts[k - 1];
785
+ const [bx, by] = cpts[k];
786
+ segs.push({
787
+ idx,
788
+ box: [
789
+ Math.min(ax, bx) - 3,
790
+ Math.max(ax, bx) + 3,
791
+ Math.min(ay, by) - 3,
792
+ Math.max(ay, by) + 3
793
+ ]
794
+ });
795
+ }
796
+ const d = route(cpts, 10);
797
+ paths.push(/* @__PURE__ */ jsx("path", {
798
+ className: cx("ui-lg-edge", e.declared ? "is-declared" : e.inferred && "is-inferred", r && "is-related", dim && "is-dim", hovered && "is-hover"),
799
+ d,
800
+ strokeWidth: w
801
+ }, "p" + idx));
802
+ if (!pickEdge && peek) hitPaths.push(/* @__PURE__ */ jsx("path", {
803
+ className: "ui-lg-hit is-peek",
804
+ d,
805
+ onPointerEnter: () => setHover(edgeId(e)),
806
+ onPointerLeave: () => setHover(null)
807
+ }, "h" + idx));
808
+ if (pickEdge) hitPaths.push(/* @__PURE__ */ jsx("path", {
809
+ className: "ui-lg-hit",
810
+ "data-edge": edgeId(e),
811
+ d,
812
+ role: "button",
813
+ tabIndex: 0,
814
+ "aria-label": tr("{from} 到 {to},{what}", {
815
+ from: nameOf(e.from),
816
+ to: nameOf(e.to),
817
+ what: markText(e).replace(/`/g, "")
818
+ }),
819
+ "aria-pressed": picked,
820
+ onClick: (ev) => {
821
+ ev.stopPropagation();
822
+ choose(e);
823
+ },
824
+ onPointerEnter: () => setHover(edgeId(e)),
825
+ onPointerLeave: () => setHover(null),
826
+ onFocus: peek ? () => setHover(edgeId(e)) : void 0,
827
+ onBlur: peek ? () => setHover(null) : void 0,
828
+ onKeyDown: (ev) => {
829
+ if (ev.key === "Enter" || ev.key === " ") {
830
+ ev.preventDefault();
831
+ choose(e);
832
+ } else if (ev.key === "Escape" && picked) pickEdge(null);
833
+ }
834
+ }, "h" + idx));
835
+ paths.push(/* @__PURE__ */ jsx("path", {
836
+ className: cx("ui-lg-arrow", r && "is-related", dim && "is-dim"),
837
+ d: arrow
838
+ }, "a" + idx));
839
+ if (!up && !isFlat(e) && (lab(e) || r)) {
840
+ const text = markText(e);
841
+ marks.push({
842
+ idx,
843
+ e,
844
+ text,
845
+ tx,
846
+ ty,
847
+ left: inn > 1 && tx < b.x + NW / 2,
848
+ r,
849
+ dim,
850
+ lane: laneAt,
851
+ from: turnFrom,
852
+ side: laneSide
853
+ });
854
+ }
855
+ });
856
+ const placed = [...arrows, ...runs];
857
+ const boxRects = main.map((n) => [
858
+ boxOf(n.id).x,
859
+ boxOf(n.id).x + boxOf(n.id).w,
860
+ pos[n.id].y,
861
+ pos[n.id].y + NH
862
+ ]);
863
+ const hits = (x0, x1, y0, y1) => placed.some((q) => x0 < q[1] + (q[4] || 0) && q[0] < x1 + (q[4] || 0) && y0 < q[3] && q[2] < y1);
864
+ const cross = (q, x0, lw, y0, y1) => x0 < q[1] - 1 && q[0] + 1 < x0 + lw && y0 < q[3] - 1 && q[2] + 1 < y1;
865
+ const gapTo = (b, x0, lw, y0, y1) => Math.hypot(Math.max(0, b[0] - (x0 + lw), x0 - b[1]), Math.max(0, b[2] - y1, y0 - b[3]));
866
+ const isMine = (idx, x0, lw, y0, y1) => {
867
+ let self = Infinity;
868
+ let other = Infinity;
869
+ for (const sg of segs) {
870
+ const d = gapTo(sg.box, x0, lw, y0, y1);
871
+ if (sg.idx === idx) self = Math.min(self, d);
872
+ else other = Math.min(other, d);
873
+ }
874
+ return self + 4 < other && other >= 8;
875
+ };
876
+ const alongLine = (m, own = true) => {
877
+ const pts = ptsOf[m.idx] ?? [];
878
+ const mine = (x0, lw, y0, y1) => isMine(m.idx, x0, lw, y0, y1);
879
+ const ok = (x0, lw, y0, y1) => (!own || mine(x0, lw, y0, y1)) && x0 >= PAD / 2 && x0 + lw <= W - PAD / 2 && y0 >= 2 && y1 <= H - 2 && !hits(x0 - 2, x0 + lw + 2, y0 - 2, y1 + 2) && !boxRects.some((q) => x0 < q[1] + 4 && q[0] < x0 + lw + 4 && y0 < q[3] + 4 && q[2] < y1 + 4) && !segs.some((sg) => sg.idx === m.idx ? cross(sg.box, x0, lw, y0, y1) : x0 < sg.box[1] + 2 && sg.box[0] < x0 + lw + 2 && y0 < sg.box[3] + 2 && sg.box[2] < y1 + 2);
880
+ for (const lines of wraps(m.text)) {
881
+ const lw = Math.ceil(Math.max(...lines.map(labelWidth)));
882
+ const lh = lines.length * 16;
883
+ let best = null;
884
+ for (let k = 1; k < pts.length; k++) {
885
+ const [ax, ay] = pts[k - 1];
886
+ const [bx, by] = pts[k];
887
+ const len = Math.hypot(bx - ax, by - ay);
888
+ for (let t = 0; t <= len; t += 6) {
889
+ const x = ax + (bx - ax) * t / len;
890
+ const y = ay + (by - ay) * t / len;
891
+ const cands = ax === bx ? [[x + 8, y], [x - 8 - lw, y]] : [[x - lw / 2, y - 6 - lh / 2], [x - lw / 2, y + 6 + lh / 2]];
892
+ for (const [x0, top] of cands) {
893
+ const d = Math.hypot(x0 + lw / 2 - m.tx, top - m.ty);
894
+ if (best && d >= best.d) continue;
895
+ if (ok(x0, lw, top - lh / 2, top + lh / 2)) best = {
896
+ x0,
897
+ top,
898
+ d
899
+ };
900
+ }
901
+ }
902
+ }
903
+ if (best) return {
904
+ x0: Math.round(best.x0),
905
+ top: Math.round(best.top),
906
+ lw,
907
+ lh,
908
+ lines
909
+ };
910
+ }
911
+ return null;
912
+ };
913
+ const numbered = [];
914
+ const numberOn = (m, near) => {
915
+ const pts = ptsOf[m.idx] ?? [];
916
+ const cx = near.x0 + near.lw / 2;
917
+ const cy = near.top;
918
+ let best = null;
919
+ for (let k = 0; k + 1 < pts.length; k++) {
920
+ const [x1, y1] = pts[k];
921
+ const [x2, y2] = pts[k + 1];
922
+ const len = Math.hypot(x2 - x1, y2 - y1);
923
+ for (let t = 12; t <= len - 12; t += 4) {
924
+ const x = x1 + (x2 - x1) * t / len;
925
+ const y = y1 + (y2 - y1) * t / len;
926
+ const clear = !segs.some((sg) => sg.idx !== m.idx && gapTo(sg.box, x - 14, 28, y - 14, y + 14) === 0) && !boxRects.some((q) => x + 14 > q[0] && x - 14 < q[1] && y + 14 > q[2] && y - 14 < q[3]) && !hits(x - 14, x + 14, y - 14, y + 14) && !numbered.some((o) => Math.hypot(o.x - x, o.y - y) < 28);
927
+ const d = Math.hypot(x - cx, y - cy);
928
+ if (!best || clear && !best.clear || clear === best.clear && d < best.d) best = {
929
+ x,
930
+ y,
931
+ d,
932
+ clear
933
+ };
934
+ }
935
+ }
936
+ const at = best ?? {
937
+ x: m.tx,
938
+ y: m.ty - 20
939
+ };
940
+ numbered.push({
941
+ n: numbered.length + 1,
942
+ m,
943
+ x: Math.round(at.x),
944
+ y: Math.round(at.y)
945
+ });
946
+ return numbered.length;
947
+ };
948
+ const labelEl = (m, x0, top, lines = [m.text], over = false, num = 0) => /* @__PURE__ */ jsx("span", {
949
+ "aria-hidden": pickEdge ? true : void 0,
950
+ className: cx("ui-lg-label", over && "is-over", num > 0 && "is-numbered", num > 0 && (hover === edgeId(m.e) || m.e === selEdge) && "is-shown", pickEdge && "is-clickable", pickEdge && hover === edgeId(m.e) && "is-hover", m.r && "is-related", m.dim && "is-dim", peek && !m.r && hover !== edgeId(m.e) && m.e !== selEdge && "is-quiet"),
951
+ style: {
952
+ left: x0,
953
+ top
954
+ },
955
+ onClick: pickEdge ? (ev) => {
956
+ ev.stopPropagation();
957
+ choose(m.e);
958
+ } : void 0,
959
+ onPointerEnter: pickEdge ? () => setHover(edgeId(m.e)) : void 0,
960
+ onPointerLeave: pickEdge ? () => setHover(null) : void 0,
961
+ children: lines.map((t, i) => /* @__PURE__ */ jsxs(React.Fragment, { children: [i ? /* @__PURE__ */ jsx("br", {}) : null, labelParts(t)] }, i))
962
+ }, "l" + m.idx);
963
+ const later = [];
964
+ const place = (m, last) => {
965
+ const w = Math.ceil(labelWidth(m.text));
966
+ if (m.flat) {
967
+ let spot = alongLine(m);
968
+ if (!spot) {
969
+ const g = layerIndex[m.e.from];
970
+ if (g < layers.length - 1) need.add(g);
971
+ covered++;
972
+ const x0 = Math.max(PAD / 2, Math.min(W - PAD / 2 - w, m.tx - w / 2));
973
+ const taken = (t) => hits(x0, x0 + w, t - 10, t + 10) || boxRects.some((q) => x0 < q[1] + 2 && q[0] < x0 + w + 2 && t - 10 < q[3] && q[2] < t + 10);
974
+ let top = m.ty + 14;
975
+ for (let k = 0; k < 8 && taken(top); k++) top += 18;
976
+ spot = {
977
+ x0,
978
+ top,
979
+ lw: w,
980
+ lh: 16,
981
+ lines: [m.text]
982
+ };
983
+ labels.push(labelEl(m, spot.x0, spot.top, spot.lines, true, numberOn(m, spot)));
984
+ return;
985
+ }
986
+ placed.push([
987
+ spot.x0,
988
+ spot.x0 + spot.lw,
989
+ spot.top - spot.lh / 2 - 4,
990
+ spot.top + spot.lh / 2 + 4,
991
+ 6
992
+ ]);
993
+ labels.push(labelEl(m, spot.x0, spot.top, spot.lines));
994
+ return;
995
+ }
996
+ if (m.up) {
997
+ const p0 = ptsOf[m.idx]?.[0];
998
+ const near = p0 ? alongLine({
999
+ ...m,
1000
+ tx: p0[0],
1001
+ ty: p0[1]
1002
+ }, true) : null;
1003
+ if (near) {
1004
+ placed.push([
1005
+ near.x0,
1006
+ near.x0 + near.lw,
1007
+ near.top - near.lh / 2 - 4,
1008
+ near.top + near.lh / 2 + 4,
1009
+ 6
1010
+ ]);
1011
+ labels.push(labelEl(m, near.x0, near.top, near.lines));
1012
+ return;
1013
+ }
1014
+ const x0Of = (lw) => Math.max(PAD / 2, Math.min(W - PAD / 2 - lw, m.left ? m.tx - lw : m.tx));
1015
+ const start0 = Math.max(10, Math.min(H - 10, m.ty));
1016
+ const find = (x0, lw, lh, withLines) => {
1017
+ const over = (q, y0, y1) => x0 < q[1] + 4 && q[0] < x0 + lw + 4 && y0 < q[3] + 4 && q[2] < y1 + 4;
1018
+ const bad = (y0, y1) => hits(x0, x0 + lw, y0 - 4, y1 + 4) || boxRects.some((q) => over(q, y0, y1)) || withLines && segs.some((g) => g.idx === m.idx ? cross(g.box, x0, lw, y0, y1) : over(g.box, y0, y1)) || withLines && !isMine(m.idx, x0, lw, y0, y1);
1019
+ for (let k = 0; k <= 16; k++) for (const dir of k ? [-1, 1] : [0]) {
1020
+ const t = start0 + dir * k * 18;
1021
+ if (t - lh / 2 >= 2 && t + lh / 2 <= H - 2 && !bad(t - lh / 2, t + lh / 2)) return t;
1022
+ }
1023
+ return null;
1024
+ };
1025
+ let spot = null;
1026
+ for (const lines of wraps(m.text)) {
1027
+ const lw = Math.ceil(Math.max(...lines.map(labelWidth)));
1028
+ const lh = lines.length * 16;
1029
+ const x0 = x0Of(lw);
1030
+ const top = find(x0, lw, lh, true);
1031
+ if (top != null) {
1032
+ spot = {
1033
+ x0,
1034
+ top,
1035
+ lw,
1036
+ lh,
1037
+ lines
1038
+ };
1039
+ break;
1040
+ }
1041
+ }
1042
+ if (!spot) spot = alongLine(m);
1043
+ if (!spot) {
1044
+ const g = Math.max(0, Math.min(layers.length - 2, layers.findIndex((_, k) => k < layers.length - 1 && m.ty < rowTop(k + 1))));
1045
+ need.add(g);
1046
+ covered++;
1047
+ const x0 = x0Of(w);
1048
+ const top = find(x0, w, 16, false);
1049
+ if (top == null) crowd.add(g);
1050
+ const at = {
1051
+ x0,
1052
+ top: top ?? start0,
1053
+ lw: w,
1054
+ lh: 16,
1055
+ lines: [m.text]
1056
+ };
1057
+ labels.push(labelEl(m, at.x0, at.top, at.lines, true, numberOn(m, at)));
1058
+ return;
1059
+ }
1060
+ placed.push([
1061
+ spot.x0,
1062
+ spot.x0 + spot.lw,
1063
+ spot.top - spot.lh / 2 - 4,
1064
+ spot.top + spot.lh / 2 + 4,
1065
+ 6
1066
+ ]);
1067
+ labels.push(labelEl(m, spot.x0, spot.top, spot.lines));
1068
+ return;
1069
+ }
1070
+ const g = layerIndex[m.e.to] - 1;
1071
+ const gapTop = g >= 0 ? rowTop(g) + NH : 0;
1072
+ const sideOf = (lw) => {
1073
+ let left = m.left;
1074
+ if (left && m.tx - 8 - lw < 0) left = false;
1075
+ else if (!left && m.tx + 8 + lw > W) left = m.tx - 8 - lw >= 0;
1076
+ return left;
1077
+ };
1078
+ const at = (left, lw) => left ? m.tx - 8 - lw : Math.min(m.tx + 8, W - lw);
1079
+ const clear = (x0, lw, y0, y1) => {
1080
+ const over = (q) => x0 < q[1] + 2 && q[0] < x0 + lw + 2 && y0 < q[3] + 2 && q[2] < y1 + 2;
1081
+ return !hits(x0, x0 + lw, y0, y1) && !boxRects.some(over) && !segs.some((sg) => sg.idx === m.idx ? cross(sg.box, x0, lw, y0, y1) : over(sg.box));
1082
+ };
1083
+ let spot = null;
1084
+ if (m.lane != null) {
1085
+ const lane = m.lane;
1086
+ for (const lines of wraps(m.text)) {
1087
+ if (spot) break;
1088
+ const lw = Math.ceil(Math.max(...lines.map(labelWidth)));
1089
+ const lh = lines.length * 16;
1090
+ const right = Math.max(m.tx, m.from ?? m.tx) + 8;
1091
+ const left = Math.min(m.tx, m.from ?? m.tx) - 8 - lw;
1092
+ for (const x0 of m.side === "left" ? [left, right] : [right, left]) if (!spot && clear(x0, lw, lane - lh / 2, lane + lh / 2)) spot = {
1093
+ x0,
1094
+ top: lane,
1095
+ lw,
1096
+ lh,
1097
+ lines
1098
+ };
1099
+ }
1100
+ }
1101
+ for (const lines of spot ? [] : wraps(m.text)) {
1102
+ const lw = Math.ceil(Math.max(...lines.map(labelWidth)));
1103
+ const lh = lines.length * 16;
1104
+ const pref = sideOf(lw);
1105
+ for (const left of [pref, !pref]) {
1106
+ const x0 = at(left, lw);
1107
+ if (x0 < 0 || x0 + lw > W) continue;
1108
+ for (let k = 0; k < 8 && !spot; k++) {
1109
+ const top = m.ty - 8 - lh / 2 - k * 18;
1110
+ if (top - lh / 2 < Math.max(2, gapTop + 2)) break;
1111
+ if (clear(x0, lw, top - lh / 2, top + lh / 2)) spot = {
1112
+ x0,
1113
+ top,
1114
+ lw,
1115
+ lh,
1116
+ lines
1117
+ };
1118
+ }
1119
+ if (spot) break;
1120
+ }
1121
+ if (spot) break;
1122
+ }
1123
+ if (!spot) spot = alongLine(m);
1124
+ if (!spot && !last) {
1125
+ later.push(m);
1126
+ return;
1127
+ }
1128
+ const over = !spot;
1129
+ if (!spot) {
1130
+ if (g >= 0) need.add(g);
1131
+ covered++;
1132
+ const offBoxes = (x0, lw, y0, y1) => !hits(x0, x0 + lw, y0, y1) && !boxRects.some((q) => x0 < q[1] + 2 && q[0] < x0 + lw + 2 && y0 < q[3] + 2 && q[2] < y1 + 2);
1133
+ for (const lines of wraps(m.text)) {
1134
+ const lw = Math.ceil(Math.max(...lines.map(labelWidth)));
1135
+ const lh = lines.length * 16;
1136
+ const pref = sideOf(lw);
1137
+ for (const left of [pref, !pref]) {
1138
+ const x0 = at(left, lw);
1139
+ if (x0 < 0 || x0 + lw > W) continue;
1140
+ for (let k = 0; k < 8 && !spot; k++) {
1141
+ const top = m.ty - 8 - lh / 2 - k * 18;
1142
+ if (top - lh / 2 < Math.max(2, gapTop + 2)) break;
1143
+ if (offBoxes(x0, lw, top - lh / 2, top + lh / 2)) spot = {
1144
+ x0,
1145
+ top,
1146
+ lw,
1147
+ lh,
1148
+ lines
1149
+ };
1150
+ }
1151
+ if (spot) break;
1152
+ }
1153
+ if (spot) break;
1154
+ }
1155
+ if (!spot) {
1156
+ if (g >= 0) crowd.add(g);
1157
+ const x0 = at(sideOf(w), w);
1158
+ let top = m.ty - 16;
1159
+ for (let k = 0; k < 8 && hits(x0, x0 + w, top - 8, top + 8); k++) top -= 18;
1160
+ spot = {
1161
+ x0,
1162
+ top,
1163
+ lw: w,
1164
+ lh: 16,
1165
+ lines: [m.text]
1166
+ };
1167
+ }
1168
+ }
1169
+ if (over) {
1170
+ labels.push(labelEl(m, spot.x0, spot.top, spot.lines, true, numberOn(m, spot)));
1171
+ return;
1172
+ }
1173
+ placed.push([
1174
+ spot.x0,
1175
+ spot.x0 + spot.lw,
1176
+ spot.top - spot.lh / 2 - 4,
1177
+ spot.top + spot.lh / 2 + 4,
1178
+ 6
1179
+ ]);
1180
+ wide = Math.max(wide, spot.x0 + spot.lw + PAD / 2 + 4);
1181
+ least = Math.min(least, spot.x0 - PAD / 2 - 4);
1182
+ labels.push(labelEl(m, spot.x0, spot.top, spot.lines, over));
1183
+ };
1184
+ marks.sort((m, n) => Number(!!m.up) - Number(!!n.up) || m.ty - n.ty || m.tx - n.tx).forEach((m) => place(m, false));
1185
+ later.forEach((m) => place(m, true));
1186
+ for (const o of numbered) labels.push(/* @__PURE__ */ jsx("span", {
1187
+ className: cx("ui-lg-num", o.m.dim && "is-dim", (hover === edgeId(o.m.e) || o.m.e === selEdge) && "is-on"),
1188
+ style: {
1189
+ left: o.x,
1190
+ top: o.y
1191
+ },
1192
+ "aria-hidden": "true",
1193
+ onPointerEnter: pickEdge ? () => setHover(edgeId(o.m.e)) : void 0,
1194
+ onPointerLeave: pickEdge ? () => setHover(null) : void 0,
1195
+ children: o.n
1196
+ }, "n" + o.m.idx));
1197
+ return {
1198
+ paths,
1199
+ labels,
1200
+ hitPaths,
1201
+ need,
1202
+ crowd,
1203
+ wide,
1204
+ least,
1205
+ covered,
1206
+ numbered
1207
+ };
1208
+ };
1209
+ for (const id in laneCount) {
1210
+ const g = layerIndex[id] - 1;
1211
+ if (g >= 0) gaps[g] = Math.max(gaps[g], laneCount[id] * LANE_H + 40);
1212
+ }
1213
+ const floor = gaps.slice();
1214
+ placeRows();
1215
+ let drawn = draw();
1216
+ const grows = () => [...drawn.need].filter((g) => gaps[g] < floor[g] + GROW_MAX);
1217
+ for (let k = 0; k < GROW_MAX / GROW && grows().length; k++) {
1218
+ for (const g of grows()) gaps[g] = Math.min(floor[g] + GROW_MAX, gaps[g] + GROW);
1219
+ placeRows();
1220
+ drawn = draw();
1221
+ }
1222
+ const stuck = [...drawn.need].filter((g) => gaps[g] >= floor[g] + GROW_MAX);
1223
+ if (stuck.length) {
1224
+ for (const g of stuck) gaps[g] = floor[g];
1225
+ placeRows();
1226
+ drawn = draw();
1227
+ const crowded = () => [...drawn.crowd].filter((g) => stuck.includes(g) && gaps[g] < floor[g] + GROW_MAX);
1228
+ for (let k = 0; k < GROW_MAX / GROW && crowded().length; k++) {
1229
+ for (const g of crowded()) gaps[g] = Math.min(floor[g] + GROW_MAX, gaps[g] + GROW);
1230
+ placeRows();
1231
+ drawn = draw();
1232
+ }
1233
+ }
1234
+ for (let k = 0; k < 3 && drawn.least < 0; k++) {
1235
+ const shift = Math.ceil(-drawn.least);
1236
+ for (const id in pos) pos[id].x += shift;
1237
+ W += shift;
1238
+ drawn = draw();
1239
+ }
1240
+ if (drawn.wide > W) {
1241
+ W = Math.ceil(drawn.wide);
1242
+ drawn = draw();
1243
+ }
1244
+ const { paths, labels, hitPaths, numbered } = drawn;
1245
+ const firstX = Math.min(...main.filter((n) => pos[n.id]).map((n) => boxOf(n.id).x), W);
1246
+ const selBox = sel != null && pos[sel] ? boxOf(sel) : null;
1247
+ const sizeText = (n) => withNum(p.sizeLabel, n, () => byCount(n, "1 個項目", "{n} 個項目"));
1248
+ const externalText = p.externalLabel ?? tr("repo 外");
1249
+ const useText = p.useLabel ?? tr("使用 {n} 次");
1250
+ const tagOf = (n) => n.tag ? /* @__PURE__ */ jsxs("span", {
1251
+ className: cx("ui-lg-tag", n.tagTone === "warning" && "is-warning"),
1252
+ children: [n.tagTone === "warning" ? /* @__PURE__ */ jsx(Icon, {
1253
+ name: "lock",
1254
+ size: 12
1255
+ }) : null, n.tag]
1256
+ }) : null;
1257
+ const nodes = main.map((n) => {
1258
+ const q = pos[n.id];
1259
+ const on = n.id === sel;
1260
+ const size = sizeOf(n);
1261
+ const used = selShared ? uses[selShared]?.[n.id] : void 0;
1262
+ return /* @__PURE__ */ jsxs("button", {
1263
+ type: "button",
1264
+ className: cx("ui-lg-node", n.external && "is-external", on && "is-selected", !near(n.id) && "is-dim"),
1265
+ onFocus: showWhole,
1266
+ style: {
1267
+ left: boxOf(n.id).x,
1268
+ top: q.y,
1269
+ width: boxOf(n.id).w,
1270
+ height: NH
1271
+ },
1272
+ "aria-pressed": p.onSelect ? on : void 0,
1273
+ onClick: p.onSelect ? () => pick(n.id, on) : void 0,
1274
+ children: [
1275
+ /* @__PURE__ */ jsxs("span", {
1276
+ className: "ui-lg-head",
1277
+ children: [
1278
+ /* @__PURE__ */ jsx("span", {
1279
+ className: cx("ui-lg-name", n.code && "is-code"),
1280
+ children: n.name || n.id
1281
+ }),
1282
+ tagLine ? null : tagOf(n),
1283
+ used ? /* @__PURE__ */ jsx("span", {
1284
+ className: "ui-lg-use",
1285
+ children: monoNums(useText.replace("{n}", ""), [used])
1286
+ }) : null
1287
+ ]
1288
+ }),
1289
+ tagLine ? tagOf(n) : null,
1290
+ n.external ? /* @__PURE__ */ jsx("span", {
1291
+ className: "ui-lg-ext",
1292
+ children: externalText
1293
+ }) : null,
1294
+ size != null ? /* @__PURE__ */ jsxs("span", {
1295
+ className: "ui-lg-size",
1296
+ children: [/* @__PURE__ */ jsx("span", {
1297
+ className: "ui-lg-track",
1298
+ "aria-hidden": "true",
1299
+ children: /* @__PURE__ */ jsx("span", { style: { width: Math.round(size / maxSize * 100) + "%" } })
1300
+ }), /* @__PURE__ */ jsx("span", {
1301
+ className: "ui-lg-count",
1302
+ children: monoNums(sizeText(size), [format.number(size)])
1303
+ })]
1304
+ }) : null
1305
+ ]
1306
+ }, n.id);
1307
+ });
1308
+ const sharedMeta = p.sharedMeta ?? tr("{a} 個項目使用,共 {b} 次");
1309
+ const sharedBoxes = shared.map((s) => {
1310
+ const by = uses[s.id] ?? {};
1311
+ const total = Object.values(by).reduce((a, b) => a + b, 0);
1312
+ const on = s.id === sel;
1313
+ const dim = !!selEdge || sel != null && !on && (selShared != null ? !(s.id in (uses[selShared] ?? {})) && !(selShared in by) : !(sel in by));
1314
+ return /* @__PURE__ */ jsxs("button", {
1315
+ type: "button",
1316
+ className: cx("ui-lg-node", "ui-lg-chip", on && "is-selected", dim && "is-dim"),
1317
+ onFocus: showWhole,
1318
+ "aria-pressed": p.onSelect ? on : void 0,
1319
+ onClick: p.onSelect ? () => pick(s.id, on) : void 0,
1320
+ children: [/* @__PURE__ */ jsxs("span", {
1321
+ className: "ui-lg-head",
1322
+ children: [/* @__PURE__ */ jsx("span", {
1323
+ className: cx("ui-lg-name", s.code && "is-code"),
1324
+ children: s.name || s.id
1325
+ }), tagOf(s)]
1326
+ }), /* @__PURE__ */ jsx("span", {
1327
+ className: "ui-lg-shared-meta",
1328
+ children: monoNums(sharedMeta.replace("{a}", "").replace("{b}", ""), [Object.keys(by).length, total])
1329
+ })]
1330
+ }, s.id);
1331
+ });
1332
+ const edgeText = (e) => lab(e) ? e.label ? tr("{label}({inferred})", {
1333
+ label: e.label,
1334
+ inferred: kindWord(e)
1335
+ }) : kindWord(e) : countText(e);
1336
+ const listItem = (key, on, dim, onClick, head, rest) => /* @__PURE__ */ jsxs("li", {
1337
+ className: cx("ui-lg-li", dim && "is-dim"),
1338
+ children: [onClick ? /* @__PURE__ */ jsx("button", {
1339
+ type: "button",
1340
+ className: cx("ui-lg-libtn", on && "is-selected"),
1341
+ "aria-pressed": on,
1342
+ onClick,
1343
+ children: head
1344
+ }) : /* @__PURE__ */ jsx("span", {
1345
+ className: "ui-lg-lihead",
1346
+ children: head
1347
+ }), rest]
1348
+ }, key);
1349
+ const nodeIds = new Set(all.map((n) => n.id));
1350
+ const list = /* @__PURE__ */ jsxs("div", {
1351
+ className: "ui-lg-list",
1352
+ children: [/* @__PURE__ */ jsxs("section", {
1353
+ "aria-labelledby": `${uid}-ln`,
1354
+ children: [/* @__PURE__ */ jsx("h3", {
1355
+ id: `${uid}-ln`,
1356
+ className: "ui-lg-listtitle",
1357
+ children: p.listLabels?.nodes ?? tr("項目")
1358
+ }), /* @__PURE__ */ jsx("ul", { children: all.map((n) => {
1359
+ const size = sizeOf(n);
1360
+ return listItem(n.id, n.id === sel, !near(n.id), p.onSelect ? () => pick(n.id, n.id === sel) : void 0, /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
1361
+ className: cx("ui-lg-liname", n.code && "ui-lg-code"),
1362
+ children: n.name || n.id
1363
+ }), tagOf(n)] }), n.external && !n.shared ? /* @__PURE__ */ jsxs("span", {
1364
+ className: "ui-lg-limeta",
1365
+ children: [tr(","), externalText]
1366
+ }) : size != null ? /* @__PURE__ */ jsxs("span", {
1367
+ className: "ui-lg-limeta",
1368
+ children: [tr(","), monoNums(sizeText(size), [format.number(size)])]
1369
+ }) : null);
1370
+ }) })]
1371
+ }), /* @__PURE__ */ jsxs("section", {
1372
+ "aria-labelledby": `${uid}-le`,
1373
+ children: [/* @__PURE__ */ jsx("h3", {
1374
+ id: `${uid}-le`,
1375
+ className: "ui-lg-listtitle",
1376
+ children: p.listLabels?.edges ?? tr("關係")
1377
+ }), /* @__PURE__ */ jsx("ul", { children: p.edges.filter((e) => nodeIds.has(e.from) && nodeIds.has(e.to)).map((e, i) => listItem(edgeId(e) + ":" + i, e === selListEdge, focus && !related(e) && !(selShared && e.to === selShared), pickEdge ? () => choose(e) : void 0, /* @__PURE__ */ jsxs(Fragment, { children: [
1378
+ /* @__PURE__ */ jsx("span", {
1379
+ className: "ui-lg-code",
1380
+ children: nameOf(e.from)
1381
+ }),
1382
+ " ",
1383
+ /* @__PURE__ */ jsx("span", {
1384
+ "aria-hidden": "true",
1385
+ children: "→"
1386
+ }),
1387
+ /* @__PURE__ */ jsx("span", {
1388
+ className: "ui-visually-hidden",
1389
+ children: tr("到")
1390
+ }),
1391
+ " ",
1392
+ /* @__PURE__ */ jsx("span", {
1393
+ className: "ui-lg-code",
1394
+ children: nameOf(e.to)
1395
+ }),
1396
+ /* @__PURE__ */ jsxs("span", {
1397
+ className: "ui-lg-limeta",
1398
+ children: [tr(":"), labelParts(edgeText(e))]
1399
+ })
1400
+ ] }), null)) })]
1401
+ })]
1402
+ });
1403
+ const showList = p.listView !== false && view === "list";
1404
+ const started = React.useRef("");
1405
+ React.useLayoutEffect(() => {
1406
+ const el = scrollRef.current;
1407
+ if (!el || showList || !fitted?.full || started.current === memKey) return;
1408
+ started.current = memKey;
1409
+ if (scrollMemory.get(memKey)) return;
1410
+ const x = selBox ? selBox.x + selBox.w / 2 - el.clientWidth / (2 * scale) : firstX - 16;
1411
+ el.scrollLeft = Math.max(0, x * scale);
1412
+ });
1413
+ const selX = selBox?.x;
1414
+ const selW = selBox?.w;
1415
+ React.useEffect(() => {
1416
+ const el = scrollRef.current;
1417
+ if (!el || showList || selX == null || selW == null) return;
1418
+ const l = selX * scale;
1419
+ const r = (selX + selW) * scale;
1420
+ if (l < el.scrollLeft) el.scrollLeft = Math.max(0, l - 16);
1421
+ else if (r > el.scrollLeft + el.clientWidth) el.scrollLeft = r - el.clientWidth + 16;
1422
+ }, [
1423
+ sel,
1424
+ selX,
1425
+ selW,
1426
+ scale,
1427
+ showList,
1428
+ scrollRef
1429
+ ]);
1430
+ const toggleShown = p.labelToggle !== false && !showList && p.edges.some((e) => lab(e));
1431
+ React.useLayoutEffect(() => {
1432
+ const el = scrollRef.current;
1433
+ if (!el) return;
1434
+ const measure = () => setAvail(el.clientWidth);
1435
+ measure();
1436
+ const ro = new ResizeObserver(measure);
1437
+ ro.observe(el);
1438
+ return () => ro.disconnect();
1439
+ }, [scrollRef, showList]);
1440
+ React.useLayoutEffect(() => {
1441
+ if (!avail || showList) return;
1442
+ if (!fitted) {
1443
+ if (W <= avail + .5) return;
1444
+ const base = p.nodeWidth || 200;
1445
+ const lose = W - avail - (cols - 1) * 16;
1446
+ const nw = Math.max(Math.min(base, 120), Math.floor(base - Math.max(0, lose) / cols));
1447
+ setFit({
1448
+ at: avail,
1449
+ nw,
1450
+ col: 24,
1451
+ scale: 1
1452
+ });
1453
+ return;
1454
+ }
1455
+ if (fitted.full) return;
1456
+ const s = Math.floor(avail / W * 1e3) / 1e3;
1457
+ if (W > avail + .5 && s < .75) {
1458
+ setFit({
1459
+ ...fitted,
1460
+ nw: p.nodeWidth || 200,
1461
+ col: 40,
1462
+ scale: 1,
1463
+ full: true
1464
+ });
1465
+ return;
1466
+ }
1467
+ const want = W <= avail + .5 ? 1 : s;
1468
+ if (want !== fitted.scale) setFit({
1469
+ ...fitted,
1470
+ scale: want
1471
+ });
1472
+ }, [
1473
+ avail,
1474
+ showList,
1475
+ fitted,
1476
+ W,
1477
+ p.nodeWidth,
1478
+ cols
1479
+ ]);
1480
+ const coveredNow = drawn.covered;
1481
+ React.useLayoutEffect(() => {
1482
+ if (coveredNow && spread < 5) setSpread({
1483
+ key: spreadKey,
1484
+ n: spread + 1
1485
+ });
1486
+ }, [
1487
+ coveredNow,
1488
+ spread,
1489
+ spreadKey
1490
+ ]);
1491
+ const drawnH = H * scale;
1492
+ const naturalH = drawnH - Math.max(0, dh);
1493
+ const frameH = p.resizable && dh < 0 ? Math.max(Math.min(MIN_FRAME, naturalH), naturalH + dh) : null;
1494
+ const dragTo = (v) => Math.max(Math.min(MIN_FRAME, naturalH) - naturalH, Math.min(v, between ? MAX_EXTRA * between * scale : 0));
1495
+ return /* @__PURE__ */ jsxs("div", {
1496
+ className: cx("ui-graph ui-lg", p.className),
1497
+ children: [
1498
+ p.listView === false && !toggleShown && !p.toolbar ? null : /* @__PURE__ */ jsxs("div", {
1499
+ className: "ui-lg-bar",
1500
+ children: [
1501
+ p.toolbar ? /* @__PURE__ */ jsx("div", {
1502
+ className: "ui-lg-toolbar",
1503
+ children: p.toolbar
1504
+ }) : null,
1505
+ toggleShown && p.labelToggle === "icon" ? /* @__PURE__ */ jsx(IconButton, {
1506
+ className: "ui-lg-labels-btn",
1507
+ icon: "tag",
1508
+ filled: labelsOn,
1509
+ label: tr("顯示線上文字"),
1510
+ "aria-pressed": labelsOn,
1511
+ onClick: switchLabels
1512
+ }) : toggleShown ? /* @__PURE__ */ jsxs("label", {
1513
+ className: "ui-lg-labels-switch",
1514
+ children: [/* @__PURE__ */ jsx(Switch, {
1515
+ checked: labelsOn,
1516
+ onChange: switchLabels,
1517
+ label: tr("線上文字")
1518
+ }), /* @__PURE__ */ jsx("span", {
1519
+ "aria-hidden": "true",
1520
+ children: tr("線上文字")
1521
+ })]
1522
+ }) : null,
1523
+ p.listView === false ? null : /* @__PURE__ */ jsx(Tabs, {
1524
+ label: tr("顯示方式"),
1525
+ value: view,
1526
+ onChange: setView,
1527
+ items: [{
1528
+ id: "graph",
1529
+ label: tr("圖")
1530
+ }, {
1531
+ id: "list",
1532
+ label: tr("清單")
1533
+ }]
1534
+ })
1535
+ ]
1536
+ }),
1537
+ showList ? list : null,
1538
+ /* @__PURE__ */ jsx("div", {
1539
+ className: cx("ui-lg-scroller", scrollMore && "has-more", showList && "is-hidden"),
1540
+ children: /* @__PURE__ */ jsx("div", {
1541
+ className: cx("ui-lg-scroll", frameH != null && "is-framed"),
1542
+ ref: scrollRef,
1543
+ onScroll: onScrollKeep,
1544
+ style: frameH != null ? { height: frameH } : void 0,
1545
+ children: /* @__PURE__ */ jsxs("div", {
1546
+ className: "ui-lg-canvas",
1547
+ style: scale === 1 ? {
1548
+ width: W,
1549
+ height: H
1550
+ } : {
1551
+ width: W,
1552
+ height: H,
1553
+ transform: `scale(${scale})`,
1554
+ transformOrigin: "0 0",
1555
+ marginRight: W * (scale - 1),
1556
+ marginBottom: H * (scale - 1),
1557
+ "--lg-scale": scale
1558
+ },
1559
+ role: "group",
1560
+ "aria-label": p.label || tr("架構圖"),
1561
+ onClick: pickEdge && p.selectedEdge != null ? () => pickEdge(null) : void 0,
1562
+ children: [
1563
+ /* @__PURE__ */ jsx("svg", {
1564
+ width: W,
1565
+ height: H,
1566
+ viewBox: `0 0 ${W} ${H}`,
1567
+ "aria-hidden": "true",
1568
+ children: paths
1569
+ }),
1570
+ nodes,
1571
+ labels,
1572
+ hitPaths.length && !pickEdge ? /* @__PURE__ */ jsx("svg", {
1573
+ className: "ui-lg-hits",
1574
+ width: W,
1575
+ height: H,
1576
+ viewBox: `0 0 ${W} ${H}`,
1577
+ "aria-hidden": "true",
1578
+ children: hitPaths
1579
+ }) : hitPaths.length ? /* @__PURE__ */ jsx("svg", {
1580
+ className: "ui-lg-hits",
1581
+ width: W,
1582
+ height: H,
1583
+ viewBox: `0 0 ${W} ${H}`,
1584
+ role: "group",
1585
+ "aria-label": tr("關係"),
1586
+ children: hitPaths
1587
+ }) : null
1588
+ ]
1589
+ })
1590
+ })
1591
+ }),
1592
+ p.resizable && !showList ? /* @__PURE__ */ jsx(HeightHandle, {
1593
+ value: Math.round(drawnH + Math.min(0, dh)),
1594
+ min: Math.round(Math.min(MIN_FRAME, drawnH)),
1595
+ max: Math.round(drawnH - Math.max(0, dh) + MAX_EXTRA * between * scale),
1596
+ onDrag: (d) => setDh(dragTo(d)),
1597
+ onKey: (step) => setDh(dragTo(dh + step)),
1598
+ onReset: () => setDh(0),
1599
+ start: () => dh
1600
+ }) : null,
1601
+ showList ? null : /* @__PURE__ */ jsx(ScrollHint, {
1602
+ show: overflows,
1603
+ done: scrolled
1604
+ }),
1605
+ showList || !numbered.length ? null : /* @__PURE__ */ jsx("ol", {
1606
+ className: "ui-lg-numlist",
1607
+ "aria-label": tr("編號的線"),
1608
+ children: numbered.map((o) => /* @__PURE__ */ jsxs("li", {
1609
+ className: cx(o.m.dim && "is-dim"),
1610
+ children: [/* @__PURE__ */ jsx("span", {
1611
+ className: "ui-lg-num is-static",
1612
+ "aria-hidden": "true",
1613
+ children: o.n
1614
+ }), /* @__PURE__ */ jsx("span", { children: labelParts(o.m.text) })]
1615
+ }, o.n))
1616
+ }),
1617
+ shared.length && !showList ? /* @__PURE__ */ jsxs("div", {
1618
+ className: "ui-lg-shared",
1619
+ children: [/* @__PURE__ */ jsx("div", {
1620
+ className: "ui-lg-shared-title",
1621
+ children: p.sharedLabel || tr("共用項目")
1622
+ }), /* @__PURE__ */ jsx("div", {
1623
+ className: "ui-lg-chips",
1624
+ children: sharedBoxes
1625
+ })]
1626
+ }) : null,
1627
+ showList || p.legend === false || !p.legendItems && !edges.some((e) => pos[e.from] && pos[e.to]) ? null : /* @__PURE__ */ jsx(GraphLegend, { items: p.legendItems || [
1628
+ ...edges.some((e) => !lab(e) && pos[e.from] && pos[e.to]) ? [{
1629
+ type: "weight",
1630
+ label: "次數越多線越粗"
1631
+ }] : [],
1632
+ ...edges.some((e) => e.inferred && !e.declared && pos[e.from] && pos[e.to]) ? [{
1633
+ type: "inferred",
1634
+ label: p.inferredLabel || "推測的關係",
1635
+ text: p.inferredText
1636
+ }] : [],
1637
+ ...edges.some((e) => e.declared && pos[e.from] && pos[e.to]) ? [{
1638
+ type: "declared",
1639
+ label: p.declaredLegend || "專案宣告的關係",
1640
+ text: p.declaredText
1641
+ }] : []
1642
+ ] })
1643
+ ]
1644
+ });
1645
+ }
1646
+ export { LayerGraph };
1647
+
1648
+ //# sourceMappingURL=LayerGraph.js.map