dominds 1.25.0 → 1.25.2

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 (230) hide show
  1. package/README.md +4 -3
  2. package/README.zh.md +4 -3
  3. package/dist/dialog-display-state.d.ts +3 -3
  4. package/dist/dialog-display-state.js +12 -8
  5. package/dist/dialog.d.ts +3 -3
  6. package/dist/dialog.js +42 -20
  7. package/dist/docs/design.md +4 -0
  8. package/dist/docs/design.zh.md +4 -0
  9. package/dist/docs/dlg-drive-algo.zh.md +5 -0
  10. package/dist/docs/roadmap.md +2 -0
  11. package/dist/docs/roadmap.zh.md +2 -0
  12. package/dist/llm/gen/mock.d.ts +2 -2
  13. package/dist/llm/gen/mock.js +2 -2
  14. package/dist/llm/kernel-driver/drive.js +41 -14
  15. package/dist/llm/kernel-driver/engine.d.ts +1 -1
  16. package/dist/llm/kernel-driver/idle-reminder-wake.js +1 -1
  17. package/dist/llm/kernel-driver/sideDialog.d.ts +1 -1
  18. package/dist/llm/kernel-driver/sideDialog.js +7 -3
  19. package/dist/llm/kernel-driver/tellask-special.js +1 -6
  20. package/dist/llm/kernel-driver/types.d.ts +1 -1
  21. package/dist/minds/system-prompt-parts.js +4 -4
  22. package/dist/persistence.d.ts +1 -7
  23. package/dist/persistence.js +186 -149
  24. package/dist/priming.js +116 -35
  25. package/dist/runtime/driver-messages.d.ts +1 -1
  26. package/dist/runtime/driver-messages.js +37 -19
  27. package/dist/server/api-routes.js +18 -0
  28. package/dist/server/server-core.d.ts +1 -0
  29. package/dist/server/server-core.js +11 -0
  30. package/dist/server/websocket-handler.js +2 -1
  31. package/dist/shared-reminders.d.ts +11 -3
  32. package/dist/shared-reminders.js +62 -34
  33. package/dist/team.js +4 -1
  34. package/dist/tool.d.ts +1 -1
  35. package/dist/tool.js +1 -1
  36. package/dist/tools/app-reminders.js +8 -2
  37. package/dist/tools/builtins.js +30 -0
  38. package/dist/tools/ctrl.js +34 -109
  39. package/dist/tools/fs.d.ts +2 -0
  40. package/dist/tools/fs.js +281 -2
  41. package/dist/tools/os.d.ts +11 -0
  42. package/dist/tools/os.js +26 -15
  43. package/dist/tools/picture.d.ts +1 -0
  44. package/dist/tools/picture.js +64 -1
  45. package/dist/tools/prompts/codex_inspect_and_patch_tools/en/tools.md +5 -0
  46. package/dist/tools/prompts/codex_inspect_and_patch_tools/zh/tools.md +5 -0
  47. package/dist/tools/prompts/control/en/errors.md +5 -19
  48. package/dist/tools/prompts/control/en/index.md +5 -4
  49. package/dist/tools/prompts/control/en/principles.md +23 -19
  50. package/dist/tools/prompts/control/en/scenarios.md +17 -11
  51. package/dist/tools/prompts/control/en/tools.md +4 -6
  52. package/dist/tools/prompts/control/zh/errors.md +5 -19
  53. package/dist/tools/prompts/control/zh/index.md +5 -4
  54. package/dist/tools/prompts/control/zh/principles.md +22 -19
  55. package/dist/tools/prompts/control/zh/scenarios.md +17 -11
  56. package/dist/tools/prompts/control/zh/tools.md +4 -6
  57. package/dist/tools/prompts/fs_read/en/errors.md +6 -0
  58. package/dist/tools/prompts/fs_read/en/index.md +17 -0
  59. package/dist/tools/prompts/fs_read/en/principles.md +5 -0
  60. package/dist/tools/prompts/fs_read/en/scenarios.md +3 -0
  61. package/dist/tools/prompts/fs_read/en/tools.md +11 -0
  62. package/dist/tools/prompts/fs_read/zh/errors.md +6 -0
  63. package/dist/tools/prompts/fs_read/zh/index.md +17 -0
  64. package/dist/tools/prompts/fs_read/zh/principles.md +5 -0
  65. package/dist/tools/prompts/fs_read/zh/scenarios.md +3 -0
  66. package/dist/tools/prompts/fs_read/zh/tools.md +11 -0
  67. package/dist/tools/prompts/os/en/index.md +1 -1
  68. package/dist/tools/prompts/os/en/principles.md +1 -1
  69. package/dist/tools/prompts/os/en/scenarios.md +21 -0
  70. package/dist/tools/prompts/os/en/tools.md +6 -0
  71. package/dist/tools/prompts/os/zh/index.md +1 -1
  72. package/dist/tools/prompts/os/zh/principles.md +1 -1
  73. package/dist/tools/prompts/os/zh/scenarios.md +21 -0
  74. package/dist/tools/prompts/os/zh/tools.md +6 -0
  75. package/dist/tools/prompts/personal_memory/en/index.md +1 -1
  76. package/dist/tools/prompts/personal_memory/en/principles.md +2 -2
  77. package/dist/tools/prompts/personal_memory/zh/index.md +1 -1
  78. package/dist/tools/prompts/personal_memory/zh/principles.md +2 -2
  79. package/dist/tools/registry.d.ts +6 -0
  80. package/dist/tools/ripgrep.d.ts +5 -0
  81. package/dist/tools/ripgrep.js +482 -1
  82. package/dist/tools/team_mgmt.js +8 -8
  83. package/dist/tools/txt.d.ts +34 -0
  84. package/dist/tools/txt.js +221 -1
  85. package/package.json +3 -3
  86. package/webapp/dist/assets/{_basePickBy-ZLV93S3E.js → _basePickBy-CbWZ8qnS.js} +3 -3
  87. package/webapp/dist/assets/_basePickBy-CbWZ8qnS.js.map +1 -0
  88. package/webapp/dist/assets/{_baseUniq-D0wSOJ06.js → _baseUniq-IY-Vfzx1.js} +2 -2
  89. package/webapp/dist/assets/_baseUniq-IY-Vfzx1.js.map +1 -0
  90. package/webapp/dist/assets/{arc-BHclbMTS.js → arc--U2Vks6y.js} +2 -2
  91. package/webapp/dist/assets/arc--U2Vks6y.js.map +1 -0
  92. package/webapp/dist/assets/{architectureDiagram-2XIMDMQ5-CK99gE_D.js → architectureDiagram-VXUJARFQ-DpryGqjy.js} +8 -26
  93. package/webapp/dist/assets/architectureDiagram-VXUJARFQ-DpryGqjy.js.map +1 -0
  94. package/webapp/dist/assets/{blockDiagram-WCTKOSBZ-fE5MBTEU.js → blockDiagram-VD42YOAC-TTufCfiE.js} +170 -187
  95. package/webapp/dist/assets/blockDiagram-VD42YOAC-TTufCfiE.js.map +1 -0
  96. package/webapp/dist/assets/{c4Diagram-IC4MRINW-BSLyPyoU.js → c4Diagram-YG6GDRKO-B4RPsw5H.js} +4 -4
  97. package/webapp/dist/assets/c4Diagram-YG6GDRKO-B4RPsw5H.js.map +1 -0
  98. package/webapp/dist/assets/{channel-DSvMpp-a.js → channel-DAtGYJHZ.js} +2 -2
  99. package/webapp/dist/assets/channel-DAtGYJHZ.js.map +1 -0
  100. package/webapp/dist/assets/{chunk-4BX2VUAB-OXEX170k.js → chunk-4BX2VUAB-JtO__vAF.js} +2 -2
  101. package/webapp/dist/assets/chunk-4BX2VUAB-JtO__vAF.js.map +1 -0
  102. package/webapp/dist/assets/{chunk-55IACEB6-BFQ_spQD.js → chunk-55IACEB6-JMRC8yG1.js} +2 -2
  103. package/webapp/dist/assets/chunk-55IACEB6-JMRC8yG1.js.map +1 -0
  104. package/webapp/dist/assets/{chunk-WL4C6EOR-PtH-blkK.js → chunk-B4BG7PRW-BDIpf8Iz.js} +121 -171
  105. package/webapp/dist/assets/chunk-B4BG7PRW-BDIpf8Iz.js.map +1 -0
  106. package/webapp/dist/assets/{chunk-NQ4KR5QH-B_ZhWMXR.js → chunk-DI55MBZ5-j9B4rifK.js} +7 -9
  107. package/webapp/dist/assets/chunk-DI55MBZ5-j9B4rifK.js.map +1 -0
  108. package/webapp/dist/assets/{chunk-FMBD7UC4-CbQ2BBPs.js → chunk-FMBD7UC4-DFXKLjHC.js} +2 -2
  109. package/webapp/dist/assets/chunk-FMBD7UC4-DFXKLjHC.js.map +1 -0
  110. package/webapp/dist/assets/{chunk-KX2RTZJC-BMd-daMY.js → chunk-QN33PNHL-BKzkeJ-b.js} +2 -2
  111. package/webapp/dist/assets/chunk-QN33PNHL-BKzkeJ-b.js.map +1 -0
  112. package/webapp/dist/assets/{chunk-QZHKN3VN-Cbf92xIw.js → chunk-QZHKN3VN-DiZd3UNl.js} +2 -2
  113. package/webapp/dist/assets/chunk-QZHKN3VN-DiZd3UNl.js.map +1 -0
  114. package/webapp/dist/assets/{chunk-JSJVCQXG-C4P1mjCL.js → chunk-TZMSLE5B-BaE4C244.js} +6 -14
  115. package/webapp/dist/assets/chunk-TZMSLE5B-BaE4C244.js.map +1 -0
  116. package/webapp/dist/assets/{classDiagram-VBA2DB6C-Dc3ncaD0.js → classDiagram-2ON5EDUG-CNF8ZohD.js} +6 -7
  117. package/webapp/dist/assets/classDiagram-2ON5EDUG-CNF8ZohD.js.map +1 -0
  118. package/webapp/dist/assets/{classDiagram-v2-RAHNMMFH-Dc3ncaD0.js → classDiagram-v2-WZHVMYZB-CNF8ZohD.js} +6 -7
  119. package/webapp/dist/assets/classDiagram-v2-WZHVMYZB-CNF8ZohD.js.map +1 -0
  120. package/webapp/dist/assets/{clone-E9Ad85BC.js → clone-Nq0Ko0Gv.js} +2 -2
  121. package/webapp/dist/assets/clone-Nq0Ko0Gv.js.map +1 -0
  122. package/webapp/dist/assets/{cose-bilkent-S5V4N54A-B-nj0o74.js → cose-bilkent-S5V4N54A-uHPLSeKv.js} +2 -2
  123. package/webapp/dist/assets/cose-bilkent-S5V4N54A-uHPLSeKv.js.map +1 -0
  124. package/webapp/dist/assets/cytoscape.esm-Bm8DJGmZ.js.map +1 -1
  125. package/webapp/dist/assets/{dagre-KLK3FWXG-CyJYNIbm.js → dagre-6UL2VRFP-C1awWpU3.js} +7 -7
  126. package/webapp/dist/assets/dagre-6UL2VRFP-C1awWpU3.js.map +1 -0
  127. package/webapp/dist/assets/defaultLocale-B2RvLBDe.js.map +1 -1
  128. package/webapp/dist/assets/{diagram-E7M64L7V-C8eweQ7b.js → diagram-PSM6KHXK-Bf69p76M.js} +10 -10
  129. package/webapp/dist/assets/diagram-PSM6KHXK-Bf69p76M.js.map +1 -0
  130. package/webapp/dist/assets/{diagram-IFDJBPK2-DMdygRl0.js → diagram-QEK2KX5R-Bvlbx8Jp.js} +8 -9
  131. package/webapp/dist/assets/diagram-QEK2KX5R-Bvlbx8Jp.js.map +1 -0
  132. package/webapp/dist/assets/{diagram-P4PSJMXO-BQDZHb0a.js → diagram-S2PKOQOG-CGjGalBu.js} +8 -8
  133. package/webapp/dist/assets/diagram-S2PKOQOG-CGjGalBu.js.map +1 -0
  134. package/webapp/dist/assets/{erDiagram-INFDFZHY-C1HaXN6E.js → erDiagram-Q2GNP2WA-Ds3qhwkG.js} +75 -96
  135. package/webapp/dist/assets/erDiagram-Q2GNP2WA-Ds3qhwkG.js.map +1 -0
  136. package/webapp/dist/assets/{flowDiagram-PKNHOUZH-24nNqQyo.js → flowDiagram-NV44I4VS-B1wDG_l5.js} +81 -98
  137. package/webapp/dist/assets/flowDiagram-NV44I4VS-B1wDG_l5.js.map +1 -0
  138. package/webapp/dist/assets/{ganttDiagram-A5KZAMGK-BWPOFaLV.js → ganttDiagram-JELNMOA3-BwuYt2bO.js} +3 -28
  139. package/webapp/dist/assets/ganttDiagram-JELNMOA3-BwuYt2bO.js.map +1 -0
  140. package/webapp/dist/assets/{gitGraphDiagram-K3NZZRJ6-D7_L-p_Y.js → gitGraphDiagram-V2S2FVAM-B2Tw773z.js} +46 -38
  141. package/webapp/dist/assets/gitGraphDiagram-V2S2FVAM-B2Tw773z.js.map +1 -0
  142. package/webapp/dist/assets/graph-CS_H7jBi.js +425 -0
  143. package/webapp/dist/assets/graph-CS_H7jBi.js.map +1 -0
  144. package/webapp/dist/assets/{index-CDCDAfqP.js → index-arD81Nnh.js} +1086 -1044
  145. package/webapp/dist/assets/{index-CDCDAfqP.js.map → index-arD81Nnh.js.map} +1 -1
  146. package/webapp/dist/assets/{index-BQoNJEGT.css → index-yycTJNYb.css} +1 -1
  147. package/webapp/dist/assets/{infoDiagram-LFFYTUFH-CvaBM5j6.js → infoDiagram-HS3SLOUP-C9_JKYhm.js} +7 -7
  148. package/webapp/dist/assets/infoDiagram-HS3SLOUP-C9_JKYhm.js.map +1 -0
  149. package/webapp/dist/assets/init-ZxktEp_H.js.map +1 -1
  150. package/webapp/dist/assets/{journeyDiagram-4ABVD52K-TQR6_teO.js → journeyDiagram-XKPGCS4Q-BhZggYOL.js} +5 -5
  151. package/webapp/dist/assets/journeyDiagram-XKPGCS4Q-BhZggYOL.js.map +1 -0
  152. package/webapp/dist/assets/{kanban-definition-K7BYSVSG-B-BOuC-U.js → kanban-definition-3W4ZIXB7-B-R2Xm4Y.js} +3 -5
  153. package/webapp/dist/assets/kanban-definition-3W4ZIXB7-B-R2Xm4Y.js.map +1 -0
  154. package/webapp/dist/assets/{layout-B8yqIqbx.js → layout-BzMatxDa.js} +5 -5
  155. package/webapp/dist/assets/layout-BzMatxDa.js.map +1 -0
  156. package/webapp/dist/assets/{linear-CoLfiZKK.js → linear-BuuJkw_U.js} +2 -2
  157. package/webapp/dist/assets/linear-BuuJkw_U.js.map +1 -0
  158. package/webapp/dist/assets/{mindmap-definition-YRQLILUH-P70BMIHI.js → mindmap-definition-VGOIOE7T-BR7oDKBR.js} +5 -7
  159. package/webapp/dist/assets/mindmap-definition-VGOIOE7T-BR7oDKBR.js.map +1 -0
  160. package/webapp/dist/assets/ordinal-CxptdPJm.js.map +1 -1
  161. package/webapp/dist/assets/{pieDiagram-SKSYHLDU-DsS_4dTB.js → pieDiagram-ADFJNKIX--QWeT2vZ.js} +8 -8
  162. package/webapp/dist/assets/pieDiagram-ADFJNKIX--QWeT2vZ.js.map +1 -0
  163. package/webapp/dist/assets/{quadrantDiagram-337W2JSQ-DoM9PEq-.js → quadrantDiagram-AYHSOK5B-BpqtmN3r.js} +3 -3
  164. package/webapp/dist/assets/quadrantDiagram-AYHSOK5B-BpqtmN3r.js.map +1 -0
  165. package/webapp/dist/assets/{requirementDiagram-Z7DCOOCP-Bn3lYMMI.js → requirementDiagram-UZGBJVZJ-CIXjIi4F.js} +6 -16
  166. package/webapp/dist/assets/requirementDiagram-UZGBJVZJ-CIXjIi4F.js.map +1 -0
  167. package/webapp/dist/assets/{sankeyDiagram-WA2Y5GQK-97kCegRT.js → sankeyDiagram-TZEHDZUN-DJIt7SRz.js} +2 -2
  168. package/webapp/dist/assets/sankeyDiagram-TZEHDZUN-DJIt7SRz.js.map +1 -0
  169. package/webapp/dist/assets/{sequenceDiagram-2WXFIKYE-DXqjQjf6.js → sequenceDiagram-WL72ISMW-BpDK1ROT.js} +201 -601
  170. package/webapp/dist/assets/sequenceDiagram-WL72ISMW-BpDK1ROT.js.map +1 -0
  171. package/webapp/dist/assets/{stateDiagram-RAJIS63D-DQcTPKWP.js → stateDiagram-FKZM4ZOC-BoKGfmHf.js} +9 -9
  172. package/webapp/dist/assets/stateDiagram-FKZM4ZOC-BoKGfmHf.js.map +1 -0
  173. package/webapp/dist/assets/{stateDiagram-v2-FVOUBMTO-DHmxRVJn.js → stateDiagram-v2-4FDKWEC3--haXC2JK.js} +5 -5
  174. package/webapp/dist/assets/stateDiagram-v2-4FDKWEC3--haXC2JK.js.map +1 -0
  175. package/webapp/dist/assets/{timeline-definition-YZTLITO2-BlovQQ4B.js → timeline-definition-IT6M3QCI-BmSg3Hjf.js} +3 -3
  176. package/webapp/dist/assets/timeline-definition-IT6M3QCI-BmSg3Hjf.js.map +1 -0
  177. package/webapp/dist/assets/{treemap-KZPCXAKY-CGu93c9S.js → treemap-GDKQZRPO-D9OuyDVA.js} +24 -37
  178. package/webapp/dist/assets/treemap-GDKQZRPO-D9OuyDVA.js.map +1 -0
  179. package/webapp/dist/assets/{xychartDiagram-JWTSCODW-BKa1DxVq.js → xychartDiagram-PRI3JC2R-CVqSvO_S.js} +4 -4
  180. package/webapp/dist/assets/xychartDiagram-PRI3JC2R-CVqSvO_S.js.map +1 -0
  181. package/webapp/dist/index.html +2 -2
  182. package/webapp/dist/assets/_basePickBy-ZLV93S3E.js.map +0 -1
  183. package/webapp/dist/assets/_baseUniq-D0wSOJ06.js.map +0 -1
  184. package/webapp/dist/assets/arc-BHclbMTS.js.map +0 -1
  185. package/webapp/dist/assets/architectureDiagram-2XIMDMQ5-CK99gE_D.js.map +0 -1
  186. package/webapp/dist/assets/blockDiagram-WCTKOSBZ-fE5MBTEU.js.map +0 -1
  187. package/webapp/dist/assets/c4Diagram-IC4MRINW-BSLyPyoU.js.map +0 -1
  188. package/webapp/dist/assets/channel-DSvMpp-a.js.map +0 -1
  189. package/webapp/dist/assets/chunk-4BX2VUAB-OXEX170k.js.map +0 -1
  190. package/webapp/dist/assets/chunk-55IACEB6-BFQ_spQD.js.map +0 -1
  191. package/webapp/dist/assets/chunk-FMBD7UC4-CbQ2BBPs.js.map +0 -1
  192. package/webapp/dist/assets/chunk-JSJVCQXG-C4P1mjCL.js.map +0 -1
  193. package/webapp/dist/assets/chunk-KX2RTZJC-BMd-daMY.js.map +0 -1
  194. package/webapp/dist/assets/chunk-NQ4KR5QH-B_ZhWMXR.js.map +0 -1
  195. package/webapp/dist/assets/chunk-QZHKN3VN-Cbf92xIw.js.map +0 -1
  196. package/webapp/dist/assets/chunk-WL4C6EOR-PtH-blkK.js.map +0 -1
  197. package/webapp/dist/assets/classDiagram-VBA2DB6C-Dc3ncaD0.js.map +0 -1
  198. package/webapp/dist/assets/classDiagram-v2-RAHNMMFH-Dc3ncaD0.js.map +0 -1
  199. package/webapp/dist/assets/clone-E9Ad85BC.js.map +0 -1
  200. package/webapp/dist/assets/cose-bilkent-S5V4N54A-B-nj0o74.js.map +0 -1
  201. package/webapp/dist/assets/dagre-KLK3FWXG-CyJYNIbm.js.map +0 -1
  202. package/webapp/dist/assets/diagram-E7M64L7V-C8eweQ7b.js.map +0 -1
  203. package/webapp/dist/assets/diagram-IFDJBPK2-DMdygRl0.js.map +0 -1
  204. package/webapp/dist/assets/diagram-P4PSJMXO-BQDZHb0a.js.map +0 -1
  205. package/webapp/dist/assets/erDiagram-INFDFZHY-C1HaXN6E.js.map +0 -1
  206. package/webapp/dist/assets/flowDiagram-PKNHOUZH-24nNqQyo.js.map +0 -1
  207. package/webapp/dist/assets/ganttDiagram-A5KZAMGK-BWPOFaLV.js.map +0 -1
  208. package/webapp/dist/assets/gitGraphDiagram-K3NZZRJ6-D7_L-p_Y.js.map +0 -1
  209. package/webapp/dist/assets/graph-OHu4dL2n.js +0 -782
  210. package/webapp/dist/assets/graph-OHu4dL2n.js.map +0 -1
  211. package/webapp/dist/assets/infoDiagram-LFFYTUFH-CvaBM5j6.js.map +0 -1
  212. package/webapp/dist/assets/ishikawaDiagram-PHBUUO56-DB1l2Uue.js +0 -966
  213. package/webapp/dist/assets/ishikawaDiagram-PHBUUO56-DB1l2Uue.js.map +0 -1
  214. package/webapp/dist/assets/journeyDiagram-4ABVD52K-TQR6_teO.js.map +0 -1
  215. package/webapp/dist/assets/kanban-definition-K7BYSVSG-B-BOuC-U.js.map +0 -1
  216. package/webapp/dist/assets/layout-B8yqIqbx.js.map +0 -1
  217. package/webapp/dist/assets/linear-CoLfiZKK.js.map +0 -1
  218. package/webapp/dist/assets/mindmap-definition-YRQLILUH-P70BMIHI.js.map +0 -1
  219. package/webapp/dist/assets/pieDiagram-SKSYHLDU-DsS_4dTB.js.map +0 -1
  220. package/webapp/dist/assets/quadrantDiagram-337W2JSQ-DoM9PEq-.js.map +0 -1
  221. package/webapp/dist/assets/requirementDiagram-Z7DCOOCP-Bn3lYMMI.js.map +0 -1
  222. package/webapp/dist/assets/sankeyDiagram-WA2Y5GQK-97kCegRT.js.map +0 -1
  223. package/webapp/dist/assets/sequenceDiagram-2WXFIKYE-DXqjQjf6.js.map +0 -1
  224. package/webapp/dist/assets/stateDiagram-RAJIS63D-DQcTPKWP.js.map +0 -1
  225. package/webapp/dist/assets/stateDiagram-v2-FVOUBMTO-DHmxRVJn.js.map +0 -1
  226. package/webapp/dist/assets/timeline-definition-YZTLITO2-BlovQQ4B.js.map +0 -1
  227. package/webapp/dist/assets/treemap-KZPCXAKY-CGu93c9S.js.map +0 -1
  228. package/webapp/dist/assets/vennDiagram-LZ73GAT5-Do1jprrz.js +0 -2487
  229. package/webapp/dist/assets/vennDiagram-LZ73GAT5-Do1jprrz.js.map +0 -1
  230. package/webapp/dist/assets/xychartDiagram-JWTSCODW-BKa1DxVq.js.map +0 -1
@@ -1,966 +0,0 @@
1
- var _a;
2
- import { _ as __name, c as getConfig2, N as parseFontSize, I as selectSvgElement, as as at, z as clear, k as common_default, p as setDiagramTitle, a as getAccTitle, b as setAccTitle, g as getAccDescription, s as setAccDescription, q as getDiagramTitle, e as configureSvgSize } from "./index-CDCDAfqP.js";
3
- var parser = (function() {
4
- var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
5
- for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
6
- return o2;
7
- }, "o"), $V0 = [1, 4], $V1 = [1, 14], $V2 = [1, 12], $V3 = [1, 13], $V4 = [6, 7, 8], $V5 = [1, 20], $V6 = [1, 18], $V7 = [1, 19], $V8 = [6, 7, 11], $V9 = [1, 6, 13, 14], $Va = [1, 23], $Vb = [1, 24], $Vc = [1, 6, 7, 11, 13, 14];
8
- var parser2 = {
9
- trace: /* @__PURE__ */ __name(function trace() {
10
- }, "trace"),
11
- yy: {},
12
- symbols_: { "error": 2, "start": 3, "ishikawa": 4, "spaceLines": 5, "SPACELINE": 6, "NL": 7, "ISHIKAWA": 8, "document": 9, "stop": 10, "EOF": 11, "statement": 12, "SPACELIST": 13, "TEXT": 14, "$accept": 0, "$end": 1 },
13
- terminals_: { 2: "error", 6: "SPACELINE", 7: "NL", 8: "ISHIKAWA", 11: "EOF", 13: "SPACELIST", 14: "TEXT" },
14
- productions_: [0, [3, 1], [3, 2], [5, 1], [5, 2], [5, 2], [4, 2], [4, 3], [10, 1], [10, 1], [10, 1], [10, 2], [10, 2], [9, 3], [9, 2], [12, 2], [12, 1], [12, 1], [12, 1]],
15
- performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
16
- var $0 = $$.length - 1;
17
- switch (yystate) {
18
- case 6:
19
- case 7:
20
- return yy;
21
- case 15:
22
- yy.addNode($$[$0 - 1].length, $$[$0].trim());
23
- break;
24
- case 16:
25
- yy.addNode(0, $$[$0].trim());
26
- break;
27
- }
28
- }, "anonymous"),
29
- table: [{ 3: 1, 4: 2, 5: 3, 6: [1, 5], 8: $V0 }, { 1: [3] }, { 1: [2, 1] }, { 4: 6, 6: [1, 7], 7: [1, 8], 8: $V0 }, { 6: $V1, 7: [1, 10], 9: 9, 12: 11, 13: $V2, 14: $V3 }, o($V4, [2, 3]), { 1: [2, 2] }, o($V4, [2, 4]), o($V4, [2, 5]), { 1: [2, 6], 6: $V1, 12: 15, 13: $V2, 14: $V3 }, { 6: $V1, 9: 16, 12: 11, 13: $V2, 14: $V3 }, { 6: $V5, 7: $V6, 10: 17, 11: $V7 }, o($V8, [2, 18], { 14: [1, 21] }), o($V8, [2, 16]), o($V8, [2, 17]), { 6: $V5, 7: $V6, 10: 22, 11: $V7 }, { 1: [2, 7], 6: $V1, 12: 15, 13: $V2, 14: $V3 }, o($V9, [2, 14], { 7: $Va, 11: $Vb }), o($Vc, [2, 8]), o($Vc, [2, 9]), o($Vc, [2, 10]), o($V8, [2, 15]), o($V9, [2, 13], { 7: $Va, 11: $Vb }), o($Vc, [2, 11]), o($Vc, [2, 12])],
30
- defaultActions: { 2: [2, 1], 6: [2, 2] },
31
- parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
32
- if (hash.recoverable) {
33
- this.trace(str);
34
- } else {
35
- var error = new Error(str);
36
- error.hash = hash;
37
- throw error;
38
- }
39
- }, "parseError"),
40
- parse: /* @__PURE__ */ __name(function parse(input) {
41
- var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
42
- var args = lstack.slice.call(arguments, 1);
43
- var lexer2 = Object.create(this.lexer);
44
- var sharedState = { yy: {} };
45
- for (var k in this.yy) {
46
- if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
47
- sharedState.yy[k] = this.yy[k];
48
- }
49
- }
50
- lexer2.setInput(input, sharedState.yy);
51
- sharedState.yy.lexer = lexer2;
52
- sharedState.yy.parser = this;
53
- if (typeof lexer2.yylloc == "undefined") {
54
- lexer2.yylloc = {};
55
- }
56
- var yyloc = lexer2.yylloc;
57
- lstack.push(yyloc);
58
- var ranges = lexer2.options && lexer2.options.ranges;
59
- if (typeof sharedState.yy.parseError === "function") {
60
- this.parseError = sharedState.yy.parseError;
61
- } else {
62
- this.parseError = Object.getPrototypeOf(this).parseError;
63
- }
64
- function popStack(n) {
65
- stack.length = stack.length - 2 * n;
66
- vstack.length = vstack.length - n;
67
- lstack.length = lstack.length - n;
68
- }
69
- __name(popStack, "popStack");
70
- function lex() {
71
- var token;
72
- token = tstack.pop() || lexer2.lex() || EOF;
73
- if (typeof token !== "number") {
74
- if (token instanceof Array) {
75
- tstack = token;
76
- token = tstack.pop();
77
- }
78
- token = self.symbols_[token] || token;
79
- }
80
- return token;
81
- }
82
- __name(lex, "lex");
83
- var symbol, state, action, r, yyval = {}, p, len, newState, expected;
84
- while (true) {
85
- state = stack[stack.length - 1];
86
- if (this.defaultActions[state]) {
87
- action = this.defaultActions[state];
88
- } else {
89
- if (symbol === null || typeof symbol == "undefined") {
90
- symbol = lex();
91
- }
92
- action = table[state] && table[state][symbol];
93
- }
94
- if (typeof action === "undefined" || !action.length || !action[0]) {
95
- var errStr = "";
96
- expected = [];
97
- for (p in table[state]) {
98
- if (this.terminals_[p] && p > TERROR) {
99
- expected.push("'" + this.terminals_[p] + "'");
100
- }
101
- }
102
- if (lexer2.showPosition) {
103
- errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
104
- } else {
105
- errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
106
- }
107
- this.parseError(errStr, {
108
- text: lexer2.match,
109
- token: this.terminals_[symbol] || symbol,
110
- line: lexer2.yylineno,
111
- loc: yyloc,
112
- expected
113
- });
114
- }
115
- if (action[0] instanceof Array && action.length > 1) {
116
- throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
117
- }
118
- switch (action[0]) {
119
- case 1:
120
- stack.push(symbol);
121
- vstack.push(lexer2.yytext);
122
- lstack.push(lexer2.yylloc);
123
- stack.push(action[1]);
124
- symbol = null;
125
- {
126
- yyleng = lexer2.yyleng;
127
- yytext = lexer2.yytext;
128
- yylineno = lexer2.yylineno;
129
- yyloc = lexer2.yylloc;
130
- }
131
- break;
132
- case 2:
133
- len = this.productions_[action[1]][1];
134
- yyval.$ = vstack[vstack.length - len];
135
- yyval._$ = {
136
- first_line: lstack[lstack.length - (len || 1)].first_line,
137
- last_line: lstack[lstack.length - 1].last_line,
138
- first_column: lstack[lstack.length - (len || 1)].first_column,
139
- last_column: lstack[lstack.length - 1].last_column
140
- };
141
- if (ranges) {
142
- yyval._$.range = [
143
- lstack[lstack.length - (len || 1)].range[0],
144
- lstack[lstack.length - 1].range[1]
145
- ];
146
- }
147
- r = this.performAction.apply(yyval, [
148
- yytext,
149
- yyleng,
150
- yylineno,
151
- sharedState.yy,
152
- action[1],
153
- vstack,
154
- lstack
155
- ].concat(args));
156
- if (typeof r !== "undefined") {
157
- return r;
158
- }
159
- if (len) {
160
- stack = stack.slice(0, -1 * len * 2);
161
- vstack = vstack.slice(0, -1 * len);
162
- lstack = lstack.slice(0, -1 * len);
163
- }
164
- stack.push(this.productions_[action[1]][0]);
165
- vstack.push(yyval.$);
166
- lstack.push(yyval._$);
167
- newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
168
- stack.push(newState);
169
- break;
170
- case 3:
171
- return true;
172
- }
173
- }
174
- return true;
175
- }, "parse")
176
- };
177
- var lexer = /* @__PURE__ */ (function() {
178
- var lexer2 = {
179
- EOF: 1,
180
- parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
181
- if (this.yy.parser) {
182
- this.yy.parser.parseError(str, hash);
183
- } else {
184
- throw new Error(str);
185
- }
186
- }, "parseError"),
187
- // resets the lexer, sets new input
188
- setInput: /* @__PURE__ */ __name(function(input, yy) {
189
- this.yy = yy || this.yy || {};
190
- this._input = input;
191
- this._more = this._backtrack = this.done = false;
192
- this.yylineno = this.yyleng = 0;
193
- this.yytext = this.matched = this.match = "";
194
- this.conditionStack = ["INITIAL"];
195
- this.yylloc = {
196
- first_line: 1,
197
- first_column: 0,
198
- last_line: 1,
199
- last_column: 0
200
- };
201
- if (this.options.ranges) {
202
- this.yylloc.range = [0, 0];
203
- }
204
- this.offset = 0;
205
- return this;
206
- }, "setInput"),
207
- // consumes and returns one char from the input
208
- input: /* @__PURE__ */ __name(function() {
209
- var ch = this._input[0];
210
- this.yytext += ch;
211
- this.yyleng++;
212
- this.offset++;
213
- this.match += ch;
214
- this.matched += ch;
215
- var lines = ch.match(/(?:\r\n?|\n).*/g);
216
- if (lines) {
217
- this.yylineno++;
218
- this.yylloc.last_line++;
219
- } else {
220
- this.yylloc.last_column++;
221
- }
222
- if (this.options.ranges) {
223
- this.yylloc.range[1]++;
224
- }
225
- this._input = this._input.slice(1);
226
- return ch;
227
- }, "input"),
228
- // unshifts one char (or a string) into the input
229
- unput: /* @__PURE__ */ __name(function(ch) {
230
- var len = ch.length;
231
- var lines = ch.split(/(?:\r\n?|\n)/g);
232
- this._input = ch + this._input;
233
- this.yytext = this.yytext.substr(0, this.yytext.length - len);
234
- this.offset -= len;
235
- var oldLines = this.match.split(/(?:\r\n?|\n)/g);
236
- this.match = this.match.substr(0, this.match.length - 1);
237
- this.matched = this.matched.substr(0, this.matched.length - 1);
238
- if (lines.length - 1) {
239
- this.yylineno -= lines.length - 1;
240
- }
241
- var r = this.yylloc.range;
242
- this.yylloc = {
243
- first_line: this.yylloc.first_line,
244
- last_line: this.yylineno + 1,
245
- first_column: this.yylloc.first_column,
246
- last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
247
- };
248
- if (this.options.ranges) {
249
- this.yylloc.range = [r[0], r[0] + this.yyleng - len];
250
- }
251
- this.yyleng = this.yytext.length;
252
- return this;
253
- }, "unput"),
254
- // When called from action, caches matched text and appends it on next action
255
- more: /* @__PURE__ */ __name(function() {
256
- this._more = true;
257
- return this;
258
- }, "more"),
259
- // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
260
- reject: /* @__PURE__ */ __name(function() {
261
- if (this.options.backtrack_lexer) {
262
- this._backtrack = true;
263
- } else {
264
- return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
265
- text: "",
266
- token: null,
267
- line: this.yylineno
268
- });
269
- }
270
- return this;
271
- }, "reject"),
272
- // retain first n characters of the match
273
- less: /* @__PURE__ */ __name(function(n) {
274
- this.unput(this.match.slice(n));
275
- }, "less"),
276
- // displays already matched input, i.e. for error messages
277
- pastInput: /* @__PURE__ */ __name(function() {
278
- var past = this.matched.substr(0, this.matched.length - this.match.length);
279
- return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
280
- }, "pastInput"),
281
- // displays upcoming input, i.e. for error messages
282
- upcomingInput: /* @__PURE__ */ __name(function() {
283
- var next = this.match;
284
- if (next.length < 20) {
285
- next += this._input.substr(0, 20 - next.length);
286
- }
287
- return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
288
- }, "upcomingInput"),
289
- // displays the character position where the lexing error occurred, i.e. for error messages
290
- showPosition: /* @__PURE__ */ __name(function() {
291
- var pre = this.pastInput();
292
- var c = new Array(pre.length + 1).join("-");
293
- return pre + this.upcomingInput() + "\n" + c + "^";
294
- }, "showPosition"),
295
- // test the lexed token: return FALSE when not a match, otherwise return token
296
- test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
297
- var token, lines, backup;
298
- if (this.options.backtrack_lexer) {
299
- backup = {
300
- yylineno: this.yylineno,
301
- yylloc: {
302
- first_line: this.yylloc.first_line,
303
- last_line: this.last_line,
304
- first_column: this.yylloc.first_column,
305
- last_column: this.yylloc.last_column
306
- },
307
- yytext: this.yytext,
308
- match: this.match,
309
- matches: this.matches,
310
- matched: this.matched,
311
- yyleng: this.yyleng,
312
- offset: this.offset,
313
- _more: this._more,
314
- _input: this._input,
315
- yy: this.yy,
316
- conditionStack: this.conditionStack.slice(0),
317
- done: this.done
318
- };
319
- if (this.options.ranges) {
320
- backup.yylloc.range = this.yylloc.range.slice(0);
321
- }
322
- }
323
- lines = match[0].match(/(?:\r\n?|\n).*/g);
324
- if (lines) {
325
- this.yylineno += lines.length;
326
- }
327
- this.yylloc = {
328
- first_line: this.yylloc.last_line,
329
- last_line: this.yylineno + 1,
330
- first_column: this.yylloc.last_column,
331
- last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
332
- };
333
- this.yytext += match[0];
334
- this.match += match[0];
335
- this.matches = match;
336
- this.yyleng = this.yytext.length;
337
- if (this.options.ranges) {
338
- this.yylloc.range = [this.offset, this.offset += this.yyleng];
339
- }
340
- this._more = false;
341
- this._backtrack = false;
342
- this._input = this._input.slice(match[0].length);
343
- this.matched += match[0];
344
- token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
345
- if (this.done && this._input) {
346
- this.done = false;
347
- }
348
- if (token) {
349
- return token;
350
- } else if (this._backtrack) {
351
- for (var k in backup) {
352
- this[k] = backup[k];
353
- }
354
- return false;
355
- }
356
- return false;
357
- }, "test_match"),
358
- // return next match in input
359
- next: /* @__PURE__ */ __name(function() {
360
- if (this.done) {
361
- return this.EOF;
362
- }
363
- if (!this._input) {
364
- this.done = true;
365
- }
366
- var token, match, tempMatch, index;
367
- if (!this._more) {
368
- this.yytext = "";
369
- this.match = "";
370
- }
371
- var rules = this._currentRules();
372
- for (var i = 0; i < rules.length; i++) {
373
- tempMatch = this._input.match(this.rules[rules[i]]);
374
- if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
375
- match = tempMatch;
376
- index = i;
377
- if (this.options.backtrack_lexer) {
378
- token = this.test_match(tempMatch, rules[i]);
379
- if (token !== false) {
380
- return token;
381
- } else if (this._backtrack) {
382
- match = false;
383
- continue;
384
- } else {
385
- return false;
386
- }
387
- } else if (!this.options.flex) {
388
- break;
389
- }
390
- }
391
- }
392
- if (match) {
393
- token = this.test_match(match, rules[index]);
394
- if (token !== false) {
395
- return token;
396
- }
397
- return false;
398
- }
399
- if (this._input === "") {
400
- return this.EOF;
401
- } else {
402
- return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
403
- text: "",
404
- token: null,
405
- line: this.yylineno
406
- });
407
- }
408
- }, "next"),
409
- // return next match that has a token
410
- lex: /* @__PURE__ */ __name(function lex() {
411
- var r = this.next();
412
- if (r) {
413
- return r;
414
- } else {
415
- return this.lex();
416
- }
417
- }, "lex"),
418
- // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
419
- begin: /* @__PURE__ */ __name(function begin(condition) {
420
- this.conditionStack.push(condition);
421
- }, "begin"),
422
- // pop the previously active lexer condition state off the condition stack
423
- popState: /* @__PURE__ */ __name(function popState() {
424
- var n = this.conditionStack.length - 1;
425
- if (n > 0) {
426
- return this.conditionStack.pop();
427
- } else {
428
- return this.conditionStack[0];
429
- }
430
- }, "popState"),
431
- // produce the lexer rule set which is active for the currently active lexer condition state
432
- _currentRules: /* @__PURE__ */ __name(function _currentRules() {
433
- if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
434
- return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
435
- } else {
436
- return this.conditions["INITIAL"].rules;
437
- }
438
- }, "_currentRules"),
439
- // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
440
- topState: /* @__PURE__ */ __name(function topState(n) {
441
- n = this.conditionStack.length - 1 - Math.abs(n || 0);
442
- if (n >= 0) {
443
- return this.conditionStack[n];
444
- } else {
445
- return "INITIAL";
446
- }
447
- }, "topState"),
448
- // alias for begin(condition)
449
- pushState: /* @__PURE__ */ __name(function pushState(condition) {
450
- this.begin(condition);
451
- }, "pushState"),
452
- // return the number of states currently on the stack
453
- stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
454
- return this.conditionStack.length;
455
- }, "stateStackSize"),
456
- options: { "case-insensitive": true },
457
- performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
458
- switch ($avoiding_name_collisions) {
459
- case 0:
460
- return 6;
461
- case 1:
462
- return 8;
463
- case 2:
464
- return 8;
465
- case 3:
466
- return 6;
467
- case 4:
468
- return 7;
469
- case 5:
470
- return 13;
471
- case 6:
472
- return 14;
473
- case 7:
474
- return 11;
475
- }
476
- }, "anonymous"),
477
- rules: [/^(?:\s*%%.*)/i, /^(?:ishikawa-beta\b)/i, /^(?:ishikawa\b)/i, /^(?:[\s]+[\n])/i, /^(?:[\n]+)/i, /^(?:[\s]+)/i, /^(?:[^\n]+)/i, /^(?:$)/i],
478
- conditions: { "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7], "inclusive": true } }
479
- };
480
- return lexer2;
481
- })();
482
- parser2.lexer = lexer;
483
- function Parser() {
484
- this.yy = {};
485
- }
486
- __name(Parser, "Parser");
487
- Parser.prototype = parser2;
488
- parser2.Parser = Parser;
489
- return new Parser();
490
- })();
491
- parser.parser = parser;
492
- var ishikawa_default = parser;
493
- var IshikawaDB = (_a = class {
494
- constructor() {
495
- this.stack = [];
496
- this.clear = this.clear.bind(this);
497
- this.addNode = this.addNode.bind(this);
498
- this.getRoot = this.getRoot.bind(this);
499
- }
500
- clear() {
501
- this.root = void 0;
502
- this.stack = [];
503
- this.baseLevel = void 0;
504
- clear();
505
- }
506
- getRoot() {
507
- return this.root;
508
- }
509
- addNode(rawLevel, text) {
510
- const label = common_default.sanitizeText(text, getConfig2());
511
- if (!this.root) {
512
- this.baseLevel = rawLevel;
513
- this.root = { text: label, children: [] };
514
- this.stack = [{ level: 0, node: this.root }];
515
- setDiagramTitle(label);
516
- return;
517
- }
518
- let level = rawLevel - (this.baseLevel ?? 0);
519
- if (level <= 0) {
520
- level = 1;
521
- }
522
- while (this.stack.length > 1 && this.stack[this.stack.length - 1].level >= level) {
523
- this.stack.pop();
524
- }
525
- const parent = this.stack[this.stack.length - 1].node;
526
- const node = { text: label, children: [] };
527
- parent.children.push(node);
528
- this.stack.push({ level, node });
529
- }
530
- getAccTitle() {
531
- return getAccTitle();
532
- }
533
- setAccTitle(title) {
534
- setAccTitle(title);
535
- }
536
- getAccDescription() {
537
- return getAccDescription();
538
- }
539
- setAccDescription(description) {
540
- setAccDescription(description);
541
- }
542
- getDiagramTitle() {
543
- return getDiagramTitle();
544
- }
545
- setDiagramTitle(title) {
546
- setDiagramTitle(title);
547
- }
548
- }, __name(_a, "IshikawaDB"), _a);
549
- var FONT_SIZE_DEFAULT = 14;
550
- var SPINE_BASE_LENGTH = 250;
551
- var BONE_STUB = 30;
552
- var BONE_BASE = 60;
553
- var BONE_PER_CHILD = 5;
554
- var ANGLE = 82 * Math.PI / 180;
555
- var COS_A = Math.cos(ANGLE);
556
- var SIN_A = Math.sin(ANGLE);
557
- var applyPaddedViewBox = /* @__PURE__ */ __name((svgEl, pad, maxW) => {
558
- const bbox = svgEl.node().getBBox();
559
- const w = bbox.width + pad * 2;
560
- const h = bbox.height + pad * 2;
561
- configureSvgSize(svgEl, h, w, maxW);
562
- svgEl.attr("viewBox", `${bbox.x - pad} ${bbox.y - pad} ${w} ${h}`);
563
- }, "applyPaddedViewBox");
564
- var draw = /* @__PURE__ */ __name((_text, id, _version, diagram2) => {
565
- const db = diagram2.db;
566
- const root = db.getRoot();
567
- if (!root) {
568
- return;
569
- }
570
- const drawConfig = getConfig2();
571
- const { look, handDrawnSeed, themeVariables } = drawConfig;
572
- const fontSize = parseFontSize(drawConfig.fontSize)[0] ?? FONT_SIZE_DEFAULT;
573
- const isHandDrawn = look === "handDrawn";
574
- const causes = root.children ?? [];
575
- const padding = drawConfig.ishikawa?.diagramPadding ?? 20;
576
- const useMaxWidth = drawConfig.ishikawa?.useMaxWidth ?? false;
577
- const svg = selectSvgElement(id);
578
- const g = svg.append("g").attr("class", "ishikawa");
579
- const roughSvg = isHandDrawn ? at.svg(svg.node()) : void 0;
580
- const roughContext = roughSvg ? {
581
- roughSvg,
582
- seed: handDrawnSeed ?? 0,
583
- lineColor: themeVariables?.lineColor ?? "#333",
584
- fillColor: themeVariables?.mainBkg ?? "#fff"
585
- } : void 0;
586
- const markerId = `ishikawa-arrow-${id}`;
587
- if (!isHandDrawn) {
588
- g.append("defs").append("marker").attr("id", markerId).attr("viewBox", "0 0 10 10").attr("refX", 0).attr("refY", 5).attr("markerWidth", 6).attr("markerHeight", 6).attr("orient", "auto").append("path").attr("d", "M 10 0 L 0 5 L 10 10 Z").attr("class", "ishikawa-arrow");
589
- }
590
- let spineX = 0;
591
- let spineY = SPINE_BASE_LENGTH;
592
- const spineLine = isHandDrawn ? void 0 : drawLine(g, spineX, spineY, spineX, spineY, "ishikawa-spine");
593
- drawHead(g, spineX, spineY, root.text, fontSize, roughContext);
594
- if (!causes.length) {
595
- if (isHandDrawn) {
596
- drawLine(g, spineX, spineY, spineX, spineY, "ishikawa-spine", roughContext);
597
- }
598
- applyPaddedViewBox(svg, padding, useMaxWidth);
599
- return;
600
- }
601
- spineX -= 20;
602
- const upperCauses = causes.filter((_, i) => i % 2 === 0);
603
- const lowerCauses = causes.filter((_, i) => i % 2 === 1);
604
- const upperStats = sideStats(upperCauses);
605
- const lowerStats = sideStats(lowerCauses);
606
- const descendantTotal = upperStats.total + lowerStats.total;
607
- let upperLen = SPINE_BASE_LENGTH;
608
- let lowerLen = SPINE_BASE_LENGTH;
609
- if (descendantTotal > 0) {
610
- const pool = SPINE_BASE_LENGTH * 2;
611
- const minLen = SPINE_BASE_LENGTH * 0.3;
612
- upperLen = Math.max(minLen, pool * (upperStats.total / descendantTotal));
613
- lowerLen = Math.max(minLen, pool * (lowerStats.total / descendantTotal));
614
- }
615
- const minSpacing = fontSize * 2;
616
- upperLen = Math.max(upperLen, upperStats.max * minSpacing);
617
- lowerLen = Math.max(lowerLen, lowerStats.max * minSpacing);
618
- spineY = Math.max(upperLen, SPINE_BASE_LENGTH);
619
- if (spineLine) {
620
- spineLine.attr("y1", spineY).attr("y2", spineY);
621
- }
622
- g.select(".ishikawa-head-group").attr("transform", `translate(0,${spineY})`);
623
- const pairCount = Math.ceil(causes.length / 2);
624
- for (let p = 0; p < pairCount; p++) {
625
- const pg = g.append("g").attr("class", "ishikawa-pair");
626
- for (const [cause, dir, len] of [
627
- [causes[p * 2], -1, upperLen],
628
- [causes[p * 2 + 1], 1, lowerLen]
629
- ]) {
630
- if (cause) {
631
- drawBranch(pg, cause, spineX, spineY, dir, len, fontSize, roughContext);
632
- }
633
- }
634
- spineX = pg.selectAll("text").nodes().reduce((left, n) => Math.min(left, n.getBBox().x), Infinity);
635
- }
636
- if (isHandDrawn) {
637
- drawLine(g, spineX, spineY, 0, spineY, "ishikawa-spine", roughContext);
638
- } else {
639
- spineLine.attr("x1", spineX);
640
- const markerUrl = `url(#${markerId})`;
641
- g.selectAll("line.ishikawa-branch, line.ishikawa-sub-branch").attr("marker-start", markerUrl);
642
- }
643
- applyPaddedViewBox(svg, padding, useMaxWidth);
644
- }, "draw");
645
- var sideStats = /* @__PURE__ */ __name((nodes) => {
646
- const countDescendants = /* @__PURE__ */ __name((node) => node.children.reduce((sum, child) => sum + 1 + countDescendants(child), 0), "countDescendants");
647
- return nodes.reduce(
648
- (stats, node) => {
649
- const descendants = countDescendants(node);
650
- stats.total += descendants;
651
- stats.max = Math.max(stats.max, descendants);
652
- return stats;
653
- },
654
- { total: 0, max: 0 }
655
- );
656
- }, "sideStats");
657
- var drawHead = /* @__PURE__ */ __name((svg, x, y, label, fontSize, roughContext) => {
658
- const maxChars = Math.max(6, Math.floor(110 / (fontSize * 0.6)));
659
- const headGroup = svg.append("g").attr("class", "ishikawa-head-group").attr("transform", `translate(${x},${y})`);
660
- const textEl = drawMultilineText(
661
- headGroup,
662
- wrapText(label, maxChars),
663
- 0,
664
- 0,
665
- "ishikawa-head-label",
666
- "start",
667
- fontSize
668
- );
669
- const tb = textEl.node().getBBox();
670
- const w = Math.max(60, tb.width + 6);
671
- const h = Math.max(40, tb.height * 2 + 40);
672
- const headPath = `M 0 ${-h / 2} L 0 ${h / 2} Q ${w * 2.4} 0 0 ${-h / 2} Z`;
673
- if (roughContext) {
674
- const roughNode = roughContext.roughSvg.path(headPath, {
675
- roughness: 1.5,
676
- seed: roughContext.seed,
677
- fill: roughContext.fillColor,
678
- fillStyle: "hachure",
679
- fillWeight: 2.5,
680
- hachureGap: 5,
681
- stroke: roughContext.lineColor,
682
- strokeWidth: 2
683
- });
684
- headGroup.insert(() => roughNode, ":first-child").attr("class", "ishikawa-head");
685
- } else {
686
- headGroup.insert("path", ":first-child").attr("class", "ishikawa-head").attr("d", headPath);
687
- }
688
- textEl.attr("transform", `translate(${(w - tb.width) / 2 - tb.x + 3},${-tb.y - tb.height / 2})`);
689
- }, "drawHead");
690
- var flattenTree = /* @__PURE__ */ __name((children, direction) => {
691
- const entries = [];
692
- const yOrder = [];
693
- const walk = /* @__PURE__ */ __name((nodes, pid, depth) => {
694
- const ordered = direction === -1 ? [...nodes].reverse() : nodes;
695
- for (const child of ordered) {
696
- const idx = entries.length;
697
- const gc = child.children ?? [];
698
- entries.push({
699
- depth,
700
- text: wrapText(child.text, 15),
701
- parentIndex: pid,
702
- childCount: gc.length
703
- });
704
- if (depth % 2 === 0) {
705
- yOrder.push(idx);
706
- if (gc.length) {
707
- walk(gc, idx, depth + 1);
708
- }
709
- } else {
710
- if (gc.length) {
711
- walk(gc, idx, depth + 1);
712
- }
713
- yOrder.push(idx);
714
- }
715
- }
716
- }, "walk");
717
- walk(children, -1, 2);
718
- return { entries, yOrder };
719
- }, "flattenTree");
720
- var drawCauseLabel = /* @__PURE__ */ __name((svg, text, x, y, direction, fontSize, roughContext) => {
721
- const lg = svg.append("g").attr("class", "ishikawa-label-group");
722
- const lt = drawMultilineText(
723
- lg,
724
- text,
725
- x,
726
- y + 11 * direction,
727
- "ishikawa-label cause",
728
- "middle",
729
- fontSize
730
- );
731
- const tb = lt.node().getBBox();
732
- if (roughContext) {
733
- const roughNode = roughContext.roughSvg.rectangle(
734
- tb.x - 20,
735
- tb.y - 2,
736
- tb.width + 40,
737
- tb.height + 4,
738
- {
739
- roughness: 1.5,
740
- seed: roughContext.seed,
741
- fill: roughContext.fillColor,
742
- fillStyle: "hachure",
743
- fillWeight: 2.5,
744
- hachureGap: 5,
745
- stroke: roughContext.lineColor,
746
- strokeWidth: 2
747
- }
748
- );
749
- lg.insert(() => roughNode, ":first-child").attr("class", "ishikawa-label-box");
750
- } else {
751
- lg.insert("rect", ":first-child").attr("class", "ishikawa-label-box").attr("x", tb.x - 20).attr("y", tb.y - 2).attr("width", tb.width + 40).attr("height", tb.height + 4);
752
- }
753
- }, "drawCauseLabel");
754
- var drawArrowMarker = /* @__PURE__ */ __name((g, x, y, dx, dy, roughContext) => {
755
- const len = Math.sqrt(dx * dx + dy * dy);
756
- if (len === 0) {
757
- return;
758
- }
759
- const ux = dx / len;
760
- const uy = dy / len;
761
- const s = 6;
762
- const px = -uy * s;
763
- const py = ux * s;
764
- const tipX = x;
765
- const tipY = y;
766
- const d = `M ${tipX} ${tipY} L ${tipX - ux * s * 2 + px} ${tipY - uy * s * 2 + py} L ${tipX - ux * s * 2 - px} ${tipY - uy * s * 2 - py} Z`;
767
- const roughNode = roughContext.roughSvg.path(d, {
768
- roughness: 1,
769
- seed: roughContext.seed,
770
- fill: roughContext.lineColor,
771
- fillStyle: "solid",
772
- stroke: roughContext.lineColor,
773
- strokeWidth: 1
774
- });
775
- g.append(() => roughNode);
776
- }, "drawArrowMarker");
777
- var drawBranch = /* @__PURE__ */ __name((svg, node, startX, startY, direction, length, fontSize, roughContext) => {
778
- const children = node.children ?? [];
779
- const lineLen = length * (children.length ? 1 : 0.2);
780
- const dx = -COS_A * lineLen;
781
- const dy = SIN_A * lineLen * direction;
782
- const endX = startX + dx;
783
- const endY = startY + dy;
784
- drawLine(svg, startX, startY, endX, endY, "ishikawa-branch", roughContext);
785
- if (roughContext) {
786
- drawArrowMarker(svg, startX, startY, startX - endX, startY - endY, roughContext);
787
- }
788
- drawCauseLabel(svg, node.text, endX, endY, direction, fontSize, roughContext);
789
- if (!children.length) {
790
- return;
791
- }
792
- const { entries, yOrder } = flattenTree(children, direction);
793
- const entryCount = entries.length;
794
- const ys = new Array(entryCount);
795
- for (const [slot, entryIdx] of yOrder.entries()) {
796
- ys[entryIdx] = startY + dy * ((slot + 1) / (entryCount + 1));
797
- }
798
- const bones = /* @__PURE__ */ new Map();
799
- bones.set(-1, {
800
- x0: startX,
801
- y0: startY,
802
- x1: endX,
803
- y1: endY,
804
- childCount: children.length,
805
- childrenDrawn: 0
806
- });
807
- const diagonalX = -COS_A;
808
- const diagonalY = SIN_A * direction;
809
- const oddLabel = direction < 0 ? "ishikawa-label up" : "ishikawa-label down";
810
- for (const [i, e] of entries.entries()) {
811
- const y = ys[i];
812
- const par = bones.get(e.parentIndex);
813
- const grp = svg.append("g").attr("class", "ishikawa-sub-group");
814
- let bx0 = 0;
815
- let by0 = 0;
816
- let bx1 = 0;
817
- if (e.depth % 2 === 0) {
818
- const dyP = par.y1 - par.y0;
819
- bx0 = lerp(par.x0, par.x1, dyP ? (y - par.y0) / dyP : 0.5);
820
- by0 = y;
821
- bx1 = bx0 - (e.childCount > 0 ? BONE_BASE + e.childCount * BONE_PER_CHILD : BONE_STUB);
822
- drawLine(grp, bx0, y, bx1, y, "ishikawa-sub-branch", roughContext);
823
- if (roughContext) {
824
- drawArrowMarker(grp, bx0, y, 1, 0, roughContext);
825
- }
826
- drawMultilineText(grp, e.text, bx1, y, "ishikawa-label align", "end", fontSize);
827
- } else {
828
- const k = par.childrenDrawn++;
829
- bx0 = lerp(par.x0, par.x1, (par.childCount - k) / (par.childCount + 1));
830
- by0 = par.y0;
831
- bx1 = bx0 + diagonalX * ((y - by0) / diagonalY);
832
- drawLine(grp, bx0, by0, bx1, y, "ishikawa-sub-branch", roughContext);
833
- if (roughContext) {
834
- drawArrowMarker(grp, bx0, by0, bx0 - bx1, by0 - y, roughContext);
835
- }
836
- drawMultilineText(grp, e.text, bx1, y, oddLabel, "end", fontSize);
837
- }
838
- if (e.childCount > 0) {
839
- bones.set(i, {
840
- x0: bx0,
841
- y0: by0,
842
- x1: bx1,
843
- y1: y,
844
- childCount: e.childCount,
845
- childrenDrawn: 0
846
- });
847
- }
848
- }
849
- }, "drawBranch");
850
- var splitLines = /* @__PURE__ */ __name((text) => text.split(/<br\s*\/?>|\n/), "splitLines");
851
- var wrapText = /* @__PURE__ */ __name((text, maxChars) => {
852
- if (text.length <= maxChars) {
853
- return text;
854
- }
855
- const lines = [];
856
- for (const word of text.split(/\s+/)) {
857
- const last = lines.length - 1;
858
- if (last >= 0 && lines[last].length + 1 + word.length <= maxChars) {
859
- lines[last] += " " + word;
860
- } else {
861
- lines.push(word);
862
- }
863
- }
864
- return lines.join("\n");
865
- }, "wrapText");
866
- var drawMultilineText = /* @__PURE__ */ __name((g, text, x, y, cls, anchor, fontSize) => {
867
- const lines = splitLines(text);
868
- const lh = fontSize * 1.05;
869
- const el = g.append("text").attr("class", cls).attr("text-anchor", anchor).attr("x", x).attr("y", y - (lines.length - 1) * lh / 2);
870
- for (const [i, line] of lines.entries()) {
871
- el.append("tspan").attr("x", x).attr("dy", i === 0 ? 0 : lh).text(line);
872
- }
873
- return el;
874
- }, "drawMultilineText");
875
- var lerp = /* @__PURE__ */ __name((a, b, t) => a + (b - a) * t, "lerp");
876
- var drawLine = /* @__PURE__ */ __name((g, x1, y1, x2, y2, cls, roughContext) => {
877
- if (roughContext) {
878
- const roughNode = roughContext.roughSvg.line(x1, y1, x2, y2, {
879
- roughness: 1.5,
880
- seed: roughContext.seed,
881
- stroke: roughContext.lineColor,
882
- strokeWidth: 2
883
- });
884
- g.append(() => roughNode).attr("class", cls);
885
- return void 0;
886
- }
887
- return g.append("line").attr("class", cls).attr("x1", x1).attr("y1", y1).attr("x2", x2).attr("y2", y2);
888
- }, "drawLine");
889
- var renderer = { draw };
890
- var getStyles = /* @__PURE__ */ __name((options) => `
891
- .ishikawa .ishikawa-spine,
892
- .ishikawa .ishikawa-branch,
893
- .ishikawa .ishikawa-sub-branch {
894
- stroke: ${options.lineColor};
895
- stroke-width: 2;
896
- fill: none;
897
- }
898
-
899
- .ishikawa .ishikawa-sub-branch {
900
- stroke-width: 1;
901
- }
902
-
903
- .ishikawa .ishikawa-arrow {
904
- fill: ${options.lineColor};
905
- }
906
-
907
- .ishikawa .ishikawa-head {
908
- fill: ${options.mainBkg};
909
- stroke: ${options.lineColor};
910
- stroke-width: 2;
911
- }
912
-
913
- .ishikawa .ishikawa-label-box {
914
- fill: ${options.mainBkg};
915
- stroke: ${options.lineColor};
916
- stroke-width: 2;
917
- }
918
-
919
- .ishikawa text {
920
- font-family: ${options.fontFamily};
921
- font-size: ${options.fontSize};
922
- fill: ${options.textColor};
923
- }
924
-
925
- .ishikawa .ishikawa-head-label {
926
- font-weight: 600;
927
- text-anchor: middle;
928
- dominant-baseline: middle;
929
- font-size: 14px;
930
- }
931
-
932
- .ishikawa .ishikawa-label {
933
- text-anchor: end;
934
- }
935
-
936
- .ishikawa .ishikawa-label.cause {
937
- text-anchor: middle;
938
- dominant-baseline: middle;
939
- }
940
-
941
- .ishikawa .ishikawa-label.align {
942
- text-anchor: end;
943
- dominant-baseline: middle;
944
- }
945
-
946
- .ishikawa .ishikawa-label.up {
947
- dominant-baseline: baseline;
948
- }
949
-
950
- .ishikawa .ishikawa-label.down {
951
- dominant-baseline: hanging;
952
- }
953
- `, "getStyles");
954
- var ishikawaStyles_default = getStyles;
955
- var diagram = {
956
- parser: ishikawa_default,
957
- get db() {
958
- return new IshikawaDB();
959
- },
960
- renderer,
961
- styles: ishikawaStyles_default
962
- };
963
- export {
964
- diagram
965
- };
966
- //# sourceMappingURL=ishikawaDiagram-PHBUUO56-DB1l2Uue.js.map