@smartmemory/compose 0.1.8-beta → 0.1.10-beta

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 (69) hide show
  1. package/bin/compose.js +171 -39
  2. package/bin/git-hooks/post-commit.template +2 -1
  3. package/bin/git-hooks/pre-push.template +2 -1
  4. package/dist/assets/{_baseUniq-3jW4HAOf.js → _baseUniq-1Y6jTF8t.js} +1 -1
  5. package/dist/assets/{arc-DzzDimyd.js → arc-D6ZzqBFD.js} +1 -1
  6. package/dist/assets/{architectureDiagram-Q4EWVU46-CtAgwORz.js → architectureDiagram-Q4EWVU46-Dz07OB2P.js} +1 -1
  7. package/dist/assets/{blockDiagram-DXYQGD6D-Bryby0c_.js → blockDiagram-DXYQGD6D-CIx_vZA9.js} +1 -1
  8. package/dist/assets/{c4Diagram-AHTNJAMY-C7N9RTJ8.js → c4Diagram-AHTNJAMY-oPCtldKL.js} +1 -1
  9. package/dist/assets/channel-BOEco5yc.js +1 -0
  10. package/dist/assets/{chunk-4BX2VUAB-wijkFgZY.js → chunk-4BX2VUAB-DE1mVs3B.js} +1 -1
  11. package/dist/assets/{chunk-4TB4RGXK-zdSZGRS2.js → chunk-4TB4RGXK-BBOEH_yf.js} +1 -1
  12. package/dist/assets/{chunk-55IACEB6-6zqzTZQQ.js → chunk-55IACEB6-BNnoj3te.js} +1 -1
  13. package/dist/assets/{chunk-EDXVE4YY-frd1Vwf-.js → chunk-EDXVE4YY-BONF1eoC.js} +1 -1
  14. package/dist/assets/{chunk-FMBD7UC4-CdkRK5Hx.js → chunk-FMBD7UC4-ij7VBSva.js} +1 -1
  15. package/dist/assets/{chunk-OYMX7WX6-C6bMB0cf.js → chunk-OYMX7WX6-CzccIkdC.js} +1 -1
  16. package/dist/assets/{chunk-QZHKN3VN-4vsxN3jq.js → chunk-QZHKN3VN-6U3wTZV_.js} +1 -1
  17. package/dist/assets/{chunk-YZCP3GAM-DbNARKip.js → chunk-YZCP3GAM-B0KFbf0L.js} +1 -1
  18. package/dist/assets/classDiagram-6PBFFD2Q-Z--fTQT6.js +1 -0
  19. package/dist/assets/classDiagram-v2-HSJHXN6E-Z--fTQT6.js +1 -0
  20. package/dist/assets/clone-WlHlToLE.js +1 -0
  21. package/dist/assets/{cose-bilkent-S5V4N54A-BpXeV7Vj.js → cose-bilkent-S5V4N54A-CicoNwP8.js} +1 -1
  22. package/dist/assets/{dagre-KV5264BT-DQLu_W8r.js → dagre-KV5264BT-CwIGE26v.js} +1 -1
  23. package/dist/assets/{diagram-5BDNPKRD-skaOoe5A.js → diagram-5BDNPKRD-2VTTGl95.js} +1 -1
  24. package/dist/assets/{diagram-G4DWMVQ6-DezlfFH4.js → diagram-G4DWMVQ6-3Pf96ieo.js} +1 -1
  25. package/dist/assets/{diagram-MMDJMWI5-BUu-v-wT.js → diagram-MMDJMWI5-BMJV4Wvv.js} +1 -1
  26. package/dist/assets/{diagram-TYMM5635-CziQ6LPs.js → diagram-TYMM5635-DekMw47L.js} +1 -1
  27. package/dist/assets/{erDiagram-SMLLAGMA-BsAyOVTI.js → erDiagram-SMLLAGMA-CoDv7HYm.js} +1 -1
  28. package/dist/assets/{flowDiagram-DWJPFMVM-CbYWJOLq.js → flowDiagram-DWJPFMVM-Cnh8oAOL.js} +1 -1
  29. package/dist/assets/{ganttDiagram-T4ZO3ILL-CAwgDkLl.js → ganttDiagram-T4ZO3ILL-4E_ddNnO.js} +1 -1
  30. package/dist/assets/{gitGraphDiagram-UUTBAWPF-DK4RlkjO.js → gitGraphDiagram-UUTBAWPF-BezAbuh1.js} +1 -1
  31. package/dist/assets/{graph-orv1XHGx.js → graph-Dwh_GDZn.js} +1 -1
  32. package/dist/assets/{index-Ceywghsu.js → index-DHdiTAmV.js} +224 -224
  33. package/dist/assets/{infoDiagram-42DDH7IO-DQyA75sK.js → infoDiagram-42DDH7IO-CQG6i5uG.js} +1 -1
  34. package/dist/assets/{ishikawaDiagram-UXIWVN3A-C-F_5q4k.js → ishikawaDiagram-UXIWVN3A-DU-pg-DQ.js} +1 -1
  35. package/dist/assets/{journeyDiagram-VCZTEJTY-Bj8UIvK-.js → journeyDiagram-VCZTEJTY-D16FySlp.js} +1 -1
  36. package/dist/assets/{kanban-definition-6JOO6SKY-DZYr8Dp1.js → kanban-definition-6JOO6SKY-CeBu_tC8.js} +1 -1
  37. package/dist/assets/{layout-CBaTKjpX.js → layout-20cH9PdF.js} +1 -1
  38. package/dist/assets/{linear-j1sI_SiN.js → linear-BJLAYBLR.js} +1 -1
  39. package/dist/assets/{min-DtJISjld.js → min-DpwGyJGd.js} +1 -1
  40. package/dist/assets/{mindmap-definition-QFDTVHPH-Bulb64RS.js → mindmap-definition-QFDTVHPH-Cs8A-hRb.js} +1 -1
  41. package/dist/assets/{pieDiagram-DEJITSTG-D11keQxr.js → pieDiagram-DEJITSTG-B_3gJ-t1.js} +1 -1
  42. package/dist/assets/{quadrantDiagram-34T5L4WZ-BEcWQiEG.js → quadrantDiagram-34T5L4WZ-CWwkmlo7.js} +1 -1
  43. package/dist/assets/{requirementDiagram-MS252O5E-Cbp23uDf.js → requirementDiagram-MS252O5E-B5_FnptK.js} +1 -1
  44. package/dist/assets/{sankeyDiagram-XADWPNL6-Dae1hMc5.js → sankeyDiagram-XADWPNL6-C1V7g3pp.js} +1 -1
  45. package/dist/assets/{sequenceDiagram-FGHM5R23-C16abORi.js → sequenceDiagram-FGHM5R23-Cx40AcDN.js} +1 -1
  46. package/dist/assets/{stateDiagram-FHFEXIEX-CbEtfhbx.js → stateDiagram-FHFEXIEX-MB9EofRm.js} +1 -1
  47. package/dist/assets/stateDiagram-v2-QKLJ7IA2-B2uq4PdS.js +1 -0
  48. package/dist/assets/{timeline-definition-GMOUNBTQ-BV7JTNMI.js → timeline-definition-GMOUNBTQ-BVeH32Lw.js} +1 -1
  49. package/dist/assets/{vennDiagram-DHZGUBPP-DBZiT48j.js → vennDiagram-DHZGUBPP-COiwH6EY.js} +1 -1
  50. package/dist/assets/{wardley-RL74JXVD-Cc8uoiL3.js → wardley-RL74JXVD-BOOKZXAy.js} +1 -1
  51. package/dist/assets/{wardleyDiagram-NUSXRM2D-DEYcWGo5.js → wardleyDiagram-NUSXRM2D-Cjobr6lF.js} +1 -1
  52. package/dist/assets/{xychartDiagram-5P7HB3ND-bFhLXv2b.js → xychartDiagram-5P7HB3ND-Bj1YVrJO.js} +1 -1
  53. package/dist/index.html +1 -1
  54. package/lib/discover-workspaces.js +109 -0
  55. package/lib/resolve-workspace.js +166 -0
  56. package/lib/vision-writer.js +7 -1
  57. package/package.json +1 -2
  58. package/server/compose-mcp-tools.js +114 -93
  59. package/server/compose-mcp.js +42 -0
  60. package/server/design-routes.js +5 -2
  61. package/server/index.js +5 -0
  62. package/server/project-root.js +4 -0
  63. package/server/workspace-middleware.js +120 -0
  64. package/server/workspace-routes.js +25 -0
  65. package/dist/assets/channel-DDkv7DUd.js +0 -1
  66. package/dist/assets/classDiagram-6PBFFD2Q-J6ZTeCbW.js +0 -1
  67. package/dist/assets/classDiagram-v2-HSJHXN6E-J6ZTeCbW.js +0 -1
  68. package/dist/assets/clone-5MVZ89iV.js +0 -1
  69. package/dist/assets/stateDiagram-v2-QKLJ7IA2-CyY84hEA.js +0 -1
package/bin/compose.js CHANGED
@@ -15,10 +15,67 @@ import { homedir } from 'os'
15
15
  import { spawn, spawnSync } from 'child_process'
16
16
  import { fileURLToPath } from 'url'
17
17
  import { findProjectRoot } from '../server/find-root.js'
18
+ import { resolveWorkspace, getWorkspaceFlag } from '../lib/resolve-workspace.js'
18
19
 
19
20
  const __dirname = dirname(fileURLToPath(import.meta.url))
20
21
  const PACKAGE_ROOT = resolve(__dirname, '..')
21
22
 
23
+ function dieOnWorkspaceError(err) {
24
+ switch (err.code) {
25
+ case 'WorkspaceAmbiguous':
26
+ console.error('Multiple workspaces match cwd. Add --workspace=<id> or set COMPOSE_TARGET:')
27
+ for (const c of err.candidates) console.error(` --workspace=${c.id} (${c.root})`)
28
+ process.exit(1)
29
+ case 'WorkspaceIdCollision':
30
+ console.error(`workspaceId "${err.id}" is used by multiple roots:`)
31
+ for (const r of err.roots) console.error(` ${r}`)
32
+ console.error('Set an explicit workspaceId in each .compose/compose.json.')
33
+ process.exit(1)
34
+ case 'WorkspaceUnknown':
35
+ // err.message may be the path-doesn't-exist form; prefer it when richer.
36
+ console.error(err.message.includes('does not exist') ? err.message : `Unknown workspace: ${err.id}. Run \`compose doctor\` to list candidates.`)
37
+ process.exit(1)
38
+ case 'WorkspaceUnset':
39
+ console.error('No compose workspace found from the current directory.')
40
+ console.error('Run `compose init` to scaffold one, or cd into a project that has a .compose/ directory.')
41
+ process.exit(1)
42
+ case 'WorkspaceDiscoveryTooBroad':
43
+ console.error('Workspace discovery exceeded its bound from anchor.')
44
+ console.error('Set COMPOSE_TARGET=/absolute/path/to/workspace to bypass discovery.')
45
+ process.exit(1)
46
+ default:
47
+ throw err
48
+ }
49
+ }
50
+
51
+ // Cache the resolved cwd for the lifetime of this CLI process. resolveCwdWithWorkspace
52
+ // strips --workspace from args on first call (via getWorkspaceFlag splice), so a second
53
+ // call would re-resolve without the hint. Cache prevents this; ensures auto-init paths
54
+ // (runInit re-entry from build/fix/import/new) see the same workspace.
55
+ //
56
+ // COMP-WORKSPACE-HTTP T7: shape changed from bare string root → { root, id }.
57
+ // Consumers read `.root` for path; HTTP callers read `.id` to inject
58
+ // `X-Compose-Workspace-Id` header. id may be null/undefined when a workspace
59
+ // resolved without an id (legacy projects).
60
+ let _resolvedCwdCache = null
61
+
62
+ function resolveCwdWithWorkspace(args) {
63
+ if (_resolvedCwdCache !== null) return _resolvedCwdCache
64
+ let wsId = getWorkspaceFlag(args)
65
+ // Legacy hooks may pass the unsubstituted token literally — treat as absent.
66
+ if (wsId === '__COMPOSE_WORKSPACE_ID__') {
67
+ console.warn('[compose] hook predates workspace-aware install — re-run `compose hooks install`')
68
+ wsId = null
69
+ }
70
+ try {
71
+ const ws = resolveWorkspace({ workspaceId: wsId })
72
+ _resolvedCwdCache = { root: ws.root, id: ws.id }
73
+ return _resolvedCwdCache
74
+ } catch (err) {
75
+ dieOnWorkspaceError(err)
76
+ }
77
+ }
78
+
22
79
  // ---------------------------------------------------------------------------
23
80
  // --team flag (COMP-TEAMS)
24
81
  // ---------------------------------------------------------------------------
@@ -267,6 +324,10 @@ async function runDoctor(flags = []) {
267
324
  async function runInit(flags) {
268
325
  const noStratum = flags.includes('--no-stratum')
269
326
  const noLifecycle = flags.includes('--no-lifecycle')
327
+ // init creates the workspace — never go through resolveCwdWithWorkspace (which
328
+ // requires one to exist). Strip --workspace if present to avoid leaving it in
329
+ // the shared args array for downstream subcommands.
330
+ getWorkspaceFlag(args)
270
331
  const cwd = process.cwd()
271
332
 
272
333
  // 1. Create .compose/ directory
@@ -516,7 +577,21 @@ function getGitSha(repoPath) {
516
577
 
517
578
  async function runUpdate(flags) {
518
579
  const force = flags.includes('--force')
519
- const cwd = process.cwd()
580
+ // update is user-global — workspace is optional. Try to resolve; if no
581
+ // workspace exists, just use process.cwd() (we may still operate on
582
+ // user-global state below).
583
+ const wsId = getWorkspaceFlag(args)
584
+ let cwd
585
+ try {
586
+ const ws = resolveWorkspace({ workspaceId: wsId })
587
+ cwd = ws.root
588
+ _resolvedCwdCache = { root: ws.root, id: ws.id }
589
+ } catch (err) {
590
+ // Only WorkspaceUnset is benign for `update` (user-global). Any explicit
591
+ // mistake (bad --workspace, collision, ambiguity, too-broad) should still die.
592
+ if (err.code !== 'WorkspaceUnset') dieOnWorkspaceError(err)
593
+ cwd = process.cwd()
594
+ }
520
595
  const { style, root } = detectInstallStyle()
521
596
 
522
597
  console.log(`compose update — install style: ${style}`)
@@ -623,7 +698,7 @@ if (cmd === 'install') {
623
698
  }
624
699
 
625
700
  if (cmd === 'import') {
626
- const cwd = process.cwd()
701
+ const { root: cwd } = resolveCwdWithWorkspace(args)
627
702
 
628
703
  // Auto-init if needed
629
704
  if (!existsSync(join(cwd, '.compose', 'compose.json'))) {
@@ -664,7 +739,7 @@ if (cmd === 'new') {
664
739
  process.exit(1)
665
740
  }
666
741
 
667
- const cwd = process.cwd()
742
+ const { root: cwd } = resolveCwdWithWorkspace(args)
668
743
  const name = basename(cwd)
669
744
 
670
745
  // --from-idea <ID>: pre-populate intent from a promoted ideabox entry (Item 184)
@@ -792,7 +867,7 @@ if (cmd === 'feature') {
792
867
  process.exit(1)
793
868
  }
794
869
 
795
- const cwd = process.cwd()
870
+ const { root: cwd } = resolveCwdWithWorkspace(args)
796
871
  const configPath = join(cwd, '.compose', 'compose.json')
797
872
  if (!existsSync(configPath)) {
798
873
  console.error("No .compose/compose.json found. Run 'compose init' first.")
@@ -958,7 +1033,7 @@ if (cmd === 'roadmap') {
958
1033
  // compose roadmap generate — regenerate ROADMAP.md from feature.json files
959
1034
  if (subcmd === 'generate' || subcmd === 'gen') {
960
1035
  const { writeRoadmap } = await import('../lib/roadmap-gen.js')
961
- const cwd = process.cwd()
1036
+ const { root: cwd } = resolveCwdWithWorkspace(args)
962
1037
  const path = writeRoadmap(cwd)
963
1038
  console.log(`Generated ${path} from feature.json files`)
964
1039
  process.exit(0)
@@ -967,7 +1042,7 @@ if (cmd === 'roadmap') {
967
1042
  // compose roadmap migrate — extract ROADMAP.md entries into feature.json files
968
1043
  if (subcmd === 'migrate') {
969
1044
  const { migrateRoadmap } = await import('../lib/migrate-roadmap.js')
970
- const cwd = process.cwd()
1045
+ const { root: cwd } = resolveCwdWithWorkspace(args)
971
1046
  const dryRun = args.includes('--dry-run')
972
1047
  const overwrite = args.includes('--overwrite')
973
1048
  const result = migrateRoadmap(cwd, { dryRun, overwrite })
@@ -986,7 +1061,7 @@ if (cmd === 'roadmap') {
986
1061
  if (subcmd === 'check') {
987
1062
  const { listFeatures } = await import('../lib/feature-json.js')
988
1063
  const { parseRoadmap } = await import('../lib/roadmap-parser.js')
989
- const cwd = process.cwd()
1064
+ const { root: cwd } = resolveCwdWithWorkspace(args)
990
1065
  const roadmapPath = join(cwd, 'ROADMAP.md')
991
1066
  if (!existsSync(roadmapPath)) {
992
1067
  console.error('No ROADMAP.md found. Run: compose roadmap generate')
@@ -1107,7 +1182,7 @@ if (cmd === 'roadmap') {
1107
1182
  }
1108
1183
  }
1109
1184
 
1110
- const cwd = process.cwd()
1185
+ const { root: cwd } = resolveCwdWithWorkspace(args)
1111
1186
  const roadmapPath = join(cwd, 'ROADMAP.md')
1112
1187
 
1113
1188
  if (existsSync(roadmapPath)) {
@@ -1264,7 +1339,7 @@ if (cmd === 'record-completion') {
1264
1339
  if (flags['force'] === true) completionArgs.force = true
1265
1340
  if (flags['idempotency-key']) completionArgs.idempotency_key = flags['idempotency-key']
1266
1341
 
1267
- const cwd = findProjectRoot(process.cwd())
1342
+ const { root: cwd } = resolveCwdWithWorkspace(args)
1268
1343
  const { recordCompletion } = await import('../lib/completion-writer.js')
1269
1344
  try {
1270
1345
  const result = await recordCompletion(cwd, completionArgs)
@@ -1332,7 +1407,7 @@ if (cmd === 'hooks') {
1332
1407
  const { join: pjoin, resolve: presolve } = await import('path')
1333
1408
  const { fileURLToPath: futp } = await import('url')
1334
1409
 
1335
- const projectRoot = findProjectRoot(process.cwd())
1410
+ const { root: projectRoot } = resolveCwdWithWorkspace(args)
1336
1411
  const gitDir = pjoin(projectRoot, '.git')
1337
1412
  if (!exSync(gitDir)) {
1338
1413
  console.error('Error: not a git repository (no .git directory found)')
@@ -1387,14 +1462,24 @@ if (cmd === 'hooks') {
1387
1462
  return 1
1388
1463
  }
1389
1464
  }
1465
+ // Hook install must pick exactly one workspace. Repo-level hooks bake one ID.
1466
+ const wsHint = hookFlags['workspace']
1467
+ let wsId
1468
+ try {
1469
+ wsId = resolveWorkspace({ cwd: projectRoot, workspaceId: wsHint }).id
1470
+ } catch (err) {
1471
+ dieOnWorkspaceError(err)
1472
+ }
1390
1473
  const substituted = template
1391
1474
  .replace(/__COMPOSE_NODE__/g, composeNode)
1392
1475
  .replace(/__COMPOSE_BIN__/g, composeBin)
1476
+ .replace(/__COMPOSE_WORKSPACE_ID__/g, wsId)
1393
1477
  wfSync(dest, substituted)
1394
1478
  chmodSync(dest, 0o755)
1395
1479
  console.log(`Installed ${type} hook at ${dest}`)
1396
1480
  console.log(` COMPOSE_NODE=${composeNode}`)
1397
1481
  console.log(` COMPOSE_BIN=${composeBin}`)
1482
+ console.log(` COMPOSE_WORKSPACE_ID=${wsId}`)
1398
1483
  return 0
1399
1484
  }
1400
1485
 
@@ -1415,6 +1500,11 @@ if (cmd === 'hooks') {
1415
1500
  return 0
1416
1501
  }
1417
1502
 
1503
+ function extractBakedWorkspaceId(content) {
1504
+ const m = content.match(/^COMPOSE_WORKSPACE_ID="([^"]*)"$/m)
1505
+ return m ? m[1] : null
1506
+ }
1507
+
1418
1508
  function statusOne(type) {
1419
1509
  const { marker, dest } = HOOK_TYPES[type]
1420
1510
  if (!exSync(dest)) {
@@ -1426,12 +1516,29 @@ if (cmd === 'hooks') {
1426
1516
  console.log(`${type}: foreign — hook exists but is not a Compose hook`)
1427
1517
  return
1428
1518
  }
1519
+ const wsHint = hookFlags['workspace']
1520
+ let expectedWsId = null
1521
+ if (wsHint) {
1522
+ try { expectedWsId = resolveWorkspace({ cwd: projectRoot, workspaceId: wsHint }).id } catch { /* ignore for status */ }
1523
+ } else {
1524
+ try { expectedWsId = resolveWorkspace({ cwd: projectRoot }).id } catch { /* ignore for status */ }
1525
+ }
1429
1526
  const nodeMatch = content.includes(`COMPOSE_NODE="${composeNode}"`)
1430
1527
  const binMatch = content.includes(`COMPOSE_BIN="${composeBin}"`)
1431
- if (nodeMatch && binMatch) {
1528
+ const hasRawToken = content.includes('__COMPOSE_WORKSPACE_ID__')
1529
+ const wsMatch = hasRawToken ? false
1530
+ : expectedWsId ? content.includes(`COMPOSE_WORKSPACE_ID="${expectedWsId}"`)
1531
+ : true
1532
+ if (nodeMatch && binMatch && wsMatch && !hasRawToken) {
1432
1533
  console.log(`${type}: installed (current)`)
1534
+ const baked = extractBakedWorkspaceId(content)
1535
+ if (baked) console.log(` workspace: ${baked}`)
1433
1536
  } else {
1434
- console.log(`${type}: installed (stale paths re-run install)`)
1537
+ const reason = hasRawToken ? 'MISSING_WORKSPACE_ID'
1538
+ : (expectedWsId && !wsMatch) ? 'STALE_WORKSPACE_ID'
1539
+ : 'stale paths'
1540
+ console.log(`${type}: installed (${reason} — re-run install)`)
1541
+ if (expectedWsId && !wsMatch && !hasRawToken) console.log(` expected COMPOSE_WORKSPACE_ID="${expectedWsId}"`)
1435
1542
  if (!nodeMatch) console.log(` expected COMPOSE_NODE="${composeNode}"`)
1436
1543
  if (!binMatch) console.log(` expected COMPOSE_BIN="${composeBin}"`)
1437
1544
  }
@@ -1522,11 +1629,12 @@ Exit codes:
1522
1629
  }
1523
1630
 
1524
1631
  const { validateFeature, validateProject } = await import('../lib/feature-validator.js')
1632
+ const { root: valCwd } = resolveCwdWithWorkspace(args)
1525
1633
  let result
1526
1634
  try {
1527
1635
  result = scope === 'feature'
1528
- ? await validateFeature(process.cwd(), code)
1529
- : await validateProject(process.cwd())
1636
+ ? await validateFeature(valCwd, code)
1637
+ : await validateProject(valCwd)
1530
1638
  } catch (err) {
1531
1639
  if (err.code === 'INVALID_INPUT') {
1532
1640
  console.error(`Error [INVALID_INPUT]: ${err.message}`)
@@ -1568,8 +1676,9 @@ Exit codes:
1568
1676
 
1569
1677
  if (cmd === 'pipeline') {
1570
1678
  const { runPipelineCli } = await import('../lib/pipeline-cli.js')
1679
+ const { root: pipeCwd } = resolveCwdWithWorkspace(args)
1571
1680
  try {
1572
- runPipelineCli(process.cwd(), args)
1681
+ runPipelineCli(pipeCwd, args)
1573
1682
  } catch (err) {
1574
1683
  console.error(`Error: ${err.message}`)
1575
1684
  process.exit(1)
@@ -1650,7 +1759,7 @@ if (cmd === 'build') {
1650
1759
  }
1651
1760
 
1652
1761
  // Auto-init if needed
1653
- const buildCwd = process.cwd()
1762
+ const { root: buildCwd } = resolveCwdWithWorkspace(args)
1654
1763
  if (!existsSync(join(buildCwd, '.compose', 'compose.json')) || !existsSync(join(buildCwd, 'pipelines', 'build.stratum.yaml'))) {
1655
1764
  console.log('Running compose init...\n')
1656
1765
  await runInit(args.filter(a => a.startsWith('--')))
@@ -1725,7 +1834,7 @@ if (cmd === 'build') {
1725
1834
  process.exit(1)
1726
1835
  }
1727
1836
 
1728
- const fixCwd = process.cwd()
1837
+ const { root: fixCwd } = resolveCwdWithWorkspace(args)
1729
1838
  if (!existsSync(join(fixCwd, '.compose', 'compose.json')) || !existsSync(join(fixCwd, 'pipelines', 'bug-fix.stratum.yaml'))) {
1730
1839
  console.log('Running compose init...\n')
1731
1840
  await runInit(args.filter(a => a.startsWith('--')))
@@ -1812,7 +1921,7 @@ if (cmd === 'build') {
1812
1921
  }
1813
1922
  import('../lib/triage.js').then(({ runTriage }) => {
1814
1923
  import('../lib/feature-json.js').then(({ readFeature, writeFeature, updateFeature }) => {
1815
- const trCwd = process.cwd()
1924
+ const { root: trCwd } = resolveCwdWithWorkspace(args)
1816
1925
  runTriage(triageCode, { cwd: trCwd }).then((result) => {
1817
1926
  console.log(`\nFeature: ${triageCode}`)
1818
1927
  console.log(`Tier: ${result.tier}`)
@@ -1856,16 +1965,11 @@ if (cmd === 'build') {
1856
1965
  })
1857
1966
  })
1858
1967
  } else if (cmd === 'start') {
1859
- // Resolve target root BEFORE spawning supervisor
1860
- const explicitTarget = process.env.COMPOSE_TARGET
1861
- const targetRoot = explicitTarget
1862
- ? resolve(explicitTarget)
1863
- : findProjectRoot(process.cwd())
1864
-
1865
- if (explicitTarget && !existsSync(resolve(explicitTarget))) {
1866
- console.error(`[compose] COMPOSE_TARGET=${explicitTarget} does not exist.`)
1867
- process.exit(1)
1868
- }
1968
+ // Resolve target root BEFORE spawning supervisor.
1969
+ // Use the unified resolver — it handles COMPOSE_TARGET as either ID or absolute path,
1970
+ // --workspace=<id>, and discovery. No need for the legacy explicitTarget short-circuit.
1971
+ const { root: targetRoot } = resolveCwdWithWorkspace(args)
1972
+
1869
1973
  if (!targetRoot || !existsSync(join(targetRoot, '.compose', 'compose.json'))) {
1870
1974
  console.error('[compose] No .compose/ found (searched from cwd upward).')
1871
1975
  console.error("[compose] Run 'compose init' first, or set COMPOSE_TARGET.")
@@ -1887,7 +1991,7 @@ if (cmd === 'build') {
1887
1991
  // compose ideabox — idea management CLI
1888
1992
  // ---------------------------------------------------------------------------
1889
1993
  const ibSubcmd = args[0]
1890
- const ibCwd = process.cwd()
1994
+ const { root: ibCwd } = resolveCwdWithWorkspace(args)
1891
1995
 
1892
1996
  // Resolve compose config (paths, etc.)
1893
1997
  function loadComposeConfig(cwd) {
@@ -2186,7 +2290,7 @@ if (cmd === 'build') {
2186
2290
  process.exit(1)
2187
2291
  }
2188
2292
 
2189
- const qsCwd = process.cwd()
2293
+ const { root: qsCwd } = resolveCwdWithWorkspace(args)
2190
2294
 
2191
2295
  import('../lib/feature-json.js').then(({ readFeature }) => {
2192
2296
  import('../lib/qa-scoping.js').then(({ mapFilesToRoutes, classifyRoutes }) => {
@@ -2349,31 +2453,59 @@ if (cmd === 'build') {
2349
2453
  // Resolve compose server URL (default http://localhost:3000)
2350
2454
  const baseUrl = process.env.COMPOSE_URL || 'http://localhost:3000'
2351
2455
 
2352
- async function httpGet(url) {
2456
+ // COMP-WORKSPACE-HTTP T7: resolve workspace tolerantly so we can attach
2457
+ // X-Compose-Workspace-Id to the HTTP calls below. Loops CLI did not previously
2458
+ // need a workspace; if resolution fails for any reason, we send no header
2459
+ // (server middleware soft-falls back to boot workspace, preserving prior
2460
+ // behavior). We call resolveWorkspace directly so we can swallow the error
2461
+ // instead of going through resolveCwdWithWorkspace -> dieOnWorkspaceError.
2462
+ let _loopsWorkspaceId = null
2463
+ try {
2464
+ const wsId = getWorkspaceFlag(args)
2465
+ const ws = resolveWorkspace({ workspaceId: wsId === '__COMPOSE_WORKSPACE_ID__' ? null : wsId })
2466
+ _loopsWorkspaceId = ws.id || null
2467
+ _resolvedCwdCache = { root: ws.root, id: ws.id }
2468
+ } catch { /* preserve prior tolerant behavior — no header sent */ }
2469
+
2470
+ async function httpGet(url, workspaceId) {
2353
2471
  const { default: http } = await import(url.startsWith('https') ? 'https' : 'http')
2354
2472
  return new Promise((resolve, reject) => {
2355
- http.get(url, (res) => {
2473
+ const u = new URL(url)
2474
+ const headers = {}
2475
+ if (workspaceId) headers['X-Compose-Workspace-Id'] = workspaceId
2476
+ const options = {
2477
+ hostname: u.hostname,
2478
+ port: u.port || (url.startsWith('https') ? 443 : 80),
2479
+ path: u.pathname + u.search,
2480
+ method: 'GET',
2481
+ headers,
2482
+ }
2483
+ const req = http.request(options, (res) => {
2356
2484
  let buf = ''
2357
2485
  res.on('data', c => { buf += c })
2358
2486
  res.on('end', () => {
2359
2487
  try { resolve({ status: res.statusCode, body: JSON.parse(buf) }) }
2360
2488
  catch { resolve({ status: res.statusCode, body: buf }) }
2361
2489
  })
2362
- }).on('error', reject)
2490
+ })
2491
+ req.on('error', reject)
2492
+ req.end()
2363
2493
  })
2364
2494
  }
2365
2495
 
2366
- async function httpPost(urlStr, body) {
2496
+ async function httpPost(urlStr, body, workspaceId) {
2367
2497
  const { default: http } = await import(urlStr.startsWith('https') ? 'https' : 'http')
2368
2498
  return new Promise((resolve, reject) => {
2369
2499
  const data = JSON.stringify(body)
2370
2500
  const url = new URL(urlStr)
2501
+ const headers = { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(data) }
2502
+ if (workspaceId) headers['X-Compose-Workspace-Id'] = workspaceId
2371
2503
  const options = {
2372
2504
  hostname: url.hostname,
2373
2505
  port: url.port || (urlStr.startsWith('https') ? 443 : 80),
2374
2506
  path: url.pathname + url.search,
2375
2507
  method: 'POST',
2376
- headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(data) },
2508
+ headers,
2377
2509
  }
2378
2510
  const req = http.request(options, (res) => {
2379
2511
  let buf = ''
@@ -2390,7 +2522,7 @@ if (cmd === 'build') {
2390
2522
 
2391
2523
  // Resolve item id from feature code
2392
2524
  async function getItemByFeatureCode(fc) {
2393
- const r = await httpGet(`${baseUrl}/api/vision/items`)
2525
+ const r = await httpGet(`${baseUrl}/api/vision/items`, _loopsWorkspaceId)
2394
2526
  if (r.status !== 200) throw new Error(`Failed to list items: ${JSON.stringify(r.body)}`)
2395
2527
  const items = r.body.items || r.body
2396
2528
  const item = items.find(i => i.lifecycle?.featureCode === fc)
@@ -2409,7 +2541,7 @@ if (cmd === 'build') {
2409
2541
 
2410
2542
  try {
2411
2543
  const item = await getItemByFeatureCode(featureCode)
2412
- const r = await httpPost(`${baseUrl}/api/vision/items/${item.id}/loops`, { kind, summary, ttl_days: ttlDays, parent_branch: parentBranch })
2544
+ const r = await httpPost(`${baseUrl}/api/vision/items/${item.id}/loops`, { kind, summary, ttl_days: ttlDays, parent_branch: parentBranch }, _loopsWorkspaceId)
2413
2545
  if (r.status !== 201) {
2414
2546
  console.error(`Error: ${JSON.stringify(r.body)}`)
2415
2547
  process.exit(1)
@@ -2435,7 +2567,7 @@ if (cmd === 'build') {
2435
2567
 
2436
2568
  try {
2437
2569
  const item = await getItemByFeatureCode(featureCode)
2438
- const r = await httpGet(`${baseUrl}/api/vision/items/${item.id}/loops${includeResolved ? '?includeResolved=true' : ''}`)
2570
+ const r = await httpGet(`${baseUrl}/api/vision/items/${item.id}/loops${includeResolved ? '?includeResolved=true' : ''}`, _loopsWorkspaceId)
2439
2571
  if (r.status !== 200) {
2440
2572
  console.error(`Error: ${JSON.stringify(r.body)}`)
2441
2573
  process.exit(1)
@@ -2486,7 +2618,7 @@ if (cmd === 'build') {
2486
2618
  const r = await httpPost(`${baseUrl}/api/vision/items/${item.id}/loops/${loopId}/resolve`, {
2487
2619
  note,
2488
2620
  resolved_by: process.env.USER || 'unknown',
2489
- })
2621
+ }, _loopsWorkspaceId)
2490
2622
  if (r.status !== 200) {
2491
2623
  console.error(`Error: ${JSON.stringify(r.body)}`)
2492
2624
  process.exit(1)
@@ -6,6 +6,7 @@
6
6
  set -u
7
7
  COMPOSE_NODE="__COMPOSE_NODE__"
8
8
  COMPOSE_BIN="__COMPOSE_BIN__"
9
+ COMPOSE_WORKSPACE_ID="__COMPOSE_WORKSPACE_ID__"
9
10
  LOG="${COMPOSE_HOOK_LOG:-.compose/data/post-commit.log}"
10
11
  mkdir -p "$(dirname "$LOG")"
11
12
 
@@ -52,7 +53,7 @@ echo "$trailers" | while IFS= read -r line; do
52
53
  done
53
54
 
54
55
  if ! echo "$files" | "$COMPOSE_NODE" "$COMPOSE_BIN" record-completion "$code" \
55
- --commit-sha="$sha" --tests-pass="$tp" --notes="$notes" \
56
+ --commit-sha="$sha" --tests-pass="$tp" --notes="$notes" --workspace="$COMPOSE_WORKSPACE_ID" \
56
57
  --files-changed-from-stdin >> "$LOG" 2>&1; then
57
58
  echo "[$(date -Iseconds)] hook: record_completion failed for $code (sha=$sha) — see above" >> "$LOG"
58
59
  fi
@@ -6,10 +6,11 @@
6
6
  set -u
7
7
  COMPOSE_NODE="__COMPOSE_NODE__"
8
8
  COMPOSE_BIN="__COMPOSE_BIN__"
9
+ COMPOSE_WORKSPACE_ID="__COMPOSE_WORKSPACE_ID__"
9
10
  LOG="${COMPOSE_HOOK_LOG:-.compose/data/pre-push.log}"
10
11
  mkdir -p "$(dirname "$LOG")" 2>/dev/null || true
11
12
 
12
- OUTPUT=$("$COMPOSE_NODE" "$COMPOSE_BIN" validate --scope=project --block-on=error 2>&1)
13
+ OUTPUT=$("$COMPOSE_NODE" "$COMPOSE_BIN" validate --scope=project --block-on=error --workspace="$COMPOSE_WORKSPACE_ID" 2>&1)
13
14
  EXIT_CODE=$?
14
15
 
15
16
  if [ "$EXIT_CODE" -ne 0 ]; then
@@ -1 +1 @@
1
- import{a_ as S,bw as ln,aM as A,aY as b,aL as z,bx as gn,by as dn,bz as hn,bA as W,bB as pn,br as An,bC as N,a$ as m,b4 as B,b7 as T,bD as _n,b2 as on,bE as wn,bu as On,aN as V,bs as Pn,bF as I}from"./index-Ceywghsu.js";var bn="[object Symbol]";function x(n){return typeof n=="symbol"||S(n)&&ln(n)==bn}function vn(n,r){for(var e=-1,i=n==null?0:n.length,f=Array(i);++e<i;)f[e]=r(n[e],e,n);return f}var U=b?b.prototype:void 0,K=U?U.toString:void 0;function k(n){if(typeof n=="string")return n;if(A(n))return vn(n,k)+"";if(x(n))return K?K.call(n):"";var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function yn(){}function En(n,r){for(var e=-1,i=n==null?0:n.length;++e<i&&r(n[e],e,n)!==!1;);return n}function cn(n,r,e,i){for(var f=n.length,t=e+-1;++t<f;)if(r(n[t],t,n))return t;return-1}function Tn(n){return n!==n}function Rn(n,r,e){for(var i=e-1,f=n.length;++i<f;)if(n[i]===r)return i;return-1}function In(n,r,e){return r===r?Rn(n,r,e):cn(n,Tn,e)}function Ln(n,r){var e=n==null?0:n.length;return!!e&&In(n,r,0)>-1}function M(n){return z(n)?gn(n):dn(n)}var Sn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,xn=/^\w*$/;function $(n,r){if(A(n))return!1;var e=typeof n;return e=="number"||e=="symbol"||e=="boolean"||n==null||x(n)?!0:xn.test(n)||!Sn.test(n)||r!=null&&n in Object(r)}var Mn=500;function $n(n){var r=hn(n,function(i){return e.size===Mn&&e.clear(),i}),e=r.cache;return r}var Cn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Dn=/\\(\\)?/g,Fn=$n(function(n){var r=[];return n.charCodeAt(0)===46&&r.push(""),n.replace(Cn,function(e,i,f,t){r.push(f?t.replace(Dn,"$1"):i||e)}),r});function Gn(n){return n==null?"":k(n)}function j(n,r){return A(n)?n:$(n,r)?[n]:Fn(Gn(n))}function R(n){if(typeof n=="string"||x(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function nn(n,r){r=j(r,n);for(var e=0,i=r.length;n!=null&&e<i;)n=n[R(r[e++])];return e&&e==i?n:void 0}function Nn(n,r,e){var i=n==null?void 0:nn(n,r);return i===void 0?e:i}function rn(n,r){for(var e=-1,i=r.length,f=n.length;++e<i;)n[f+e]=r[e];return n}var H=b?b.isConcatSpreadable:void 0;function mn(n){return A(n)||W(n)||!!(H&&n&&n[H])}function Hr(n,r,e,i,f){var t=-1,s=n.length;for(e||(e=mn),f||(f=[]);++t<s;){var u=n[t];e(u)?rn(f,u):i||(f[f.length]=u)}return f}function Bn(n,r,e,i){var f=-1,t=n==null?0:n.length;for(i&&t&&(e=n[++f]);++f<t;)e=r(e,n[f],f,n);return e}function en(n,r){for(var e=-1,i=n==null?0:n.length,f=0,t=[];++e<i;){var s=n[e];r(s,e,n)&&(t[f++]=s)}return t}function Un(){return[]}var Kn=Object.prototype,Hn=Kn.propertyIsEnumerable,q=Object.getOwnPropertySymbols,qn=q?function(n){return n==null?[]:(n=Object(n),en(q(n),function(r){return Hn.call(n,r)}))}:Un;function Yn(n,r,e){var i=r(n);return A(n)?i:rn(i,e(n))}function Y(n){return Yn(n,M,qn)}var Zn="__lodash_hash_undefined__";function Xn(n){return this.__data__.set(n,Zn),this}function Jn(n){return this.__data__.has(n)}function v(n){var r=-1,e=n==null?0:n.length;for(this.__data__=new pn;++r<e;)this.add(n[r])}v.prototype.add=v.prototype.push=Xn;v.prototype.has=Jn;function Qn(n,r){for(var e=-1,i=n==null?0:n.length;++e<i;)if(r(n[e],e,n))return!0;return!1}function tn(n,r){return n.has(r)}var zn=1,Wn=2;function fn(n,r,e,i,f,t){var s=e&zn,u=n.length,a=r.length;if(u!=a&&!(s&&a>u))return!1;var h=t.get(n),g=t.get(r);if(h&&g)return h==r&&g==n;var l=-1,d=!0,o=e&Wn?new v:void 0;for(t.set(n,r),t.set(r,n);++l<u;){var p=n[l],_=r[l];if(i)var w=s?i(_,p,l,r,n,t):i(p,_,l,n,r,t);if(w!==void 0){if(w)continue;d=!1;break}if(o){if(!Qn(r,function(O,P){if(!tn(o,P)&&(p===O||f(p,O,e,i,t)))return o.push(P)})){d=!1;break}}else if(!(p===_||f(p,_,e,i,t))){d=!1;break}}return t.delete(n),t.delete(r),d}function Vn(n){var r=-1,e=Array(n.size);return n.forEach(function(i,f){e[++r]=[f,i]}),e}function C(n){var r=-1,e=Array(n.size);return n.forEach(function(i){e[++r]=i}),e}var kn=1,jn=2,nr="[object Boolean]",rr="[object Date]",er="[object Error]",ir="[object Map]",tr="[object Number]",fr="[object RegExp]",sr="[object Set]",ur="[object String]",ar="[object Symbol]",lr="[object ArrayBuffer]",gr="[object DataView]",Z=b?b.prototype:void 0,L=Z?Z.valueOf:void 0;function dr(n,r,e,i,f,t,s){switch(e){case gr:if(n.byteLength!=r.byteLength||n.byteOffset!=r.byteOffset)return!1;n=n.buffer,r=r.buffer;case lr:return!(n.byteLength!=r.byteLength||!t(new N(n),new N(r)));case nr:case rr:case tr:return An(+n,+r);case er:return n.name==r.name&&n.message==r.message;case fr:case ur:return n==r+"";case ir:var u=Vn;case sr:var a=i&kn;if(u||(u=C),n.size!=r.size&&!a)return!1;var h=s.get(n);if(h)return h==r;i|=jn,s.set(n,r);var g=fn(u(n),u(r),i,f,t,s);return s.delete(n),g;case ar:if(L)return L.call(n)==L.call(r)}return!1}var hr=1,pr=Object.prototype,Ar=pr.hasOwnProperty;function _r(n,r,e,i,f,t){var s=e&hr,u=Y(n),a=u.length,h=Y(r),g=h.length;if(a!=g&&!s)return!1;for(var l=a;l--;){var d=u[l];if(!(s?d in r:Ar.call(r,d)))return!1}var o=t.get(n),p=t.get(r);if(o&&p)return o==r&&p==n;var _=!0;t.set(n,r),t.set(r,n);for(var w=s;++l<a;){d=u[l];var O=n[d],P=r[d];if(i)var G=s?i(P,O,d,r,n,t):i(O,P,d,n,r,t);if(!(G===void 0?O===P||f(O,P,e,i,t):G)){_=!1;break}w||(w=d=="constructor")}if(_&&!w){var y=n.constructor,E=r.constructor;y!=E&&"constructor"in n&&"constructor"in r&&!(typeof y=="function"&&y instanceof y&&typeof E=="function"&&E instanceof E)&&(_=!1)}return t.delete(n),t.delete(r),_}var or=1,X="[object Arguments]",J="[object Array]",c="[object Object]",wr=Object.prototype,Q=wr.hasOwnProperty;function Or(n,r,e,i,f,t){var s=A(n),u=A(r),a=s?J:m(n),h=u?J:m(r);a=a==X?c:a,h=h==X?c:h;var g=a==c,l=h==c,d=a==h;if(d&&B(n)){if(!B(r))return!1;s=!0,g=!1}if(d&&!g)return t||(t=new T),s||_n(n)?fn(n,r,e,i,f,t):dr(n,r,a,e,i,f,t);if(!(e&or)){var o=g&&Q.call(n,"__wrapped__"),p=l&&Q.call(r,"__wrapped__");if(o||p){var _=o?n.value():n,w=p?r.value():r;return t||(t=new T),f(_,w,e,i,t)}}return d?(t||(t=new T),_r(n,r,e,i,f,t)):!1}function D(n,r,e,i,f){return n===r?!0:n==null||r==null||!S(n)&&!S(r)?n!==n&&r!==r:Or(n,r,e,i,D,f)}var Pr=1,br=2;function vr(n,r,e,i){var f=e.length,t=f;if(n==null)return!t;for(n=Object(n);f--;){var s=e[f];if(s[2]?s[1]!==n[s[0]]:!(s[0]in n))return!1}for(;++f<t;){s=e[f];var u=s[0],a=n[u],h=s[1];if(s[2]){if(a===void 0&&!(u in n))return!1}else{var g=new T,l;if(!(l===void 0?D(h,a,Pr|br,i,g):l))return!1}}return!0}function sn(n){return n===n&&!on(n)}function yr(n){for(var r=M(n),e=r.length;e--;){var i=r[e],f=n[i];r[e]=[i,f,sn(f)]}return r}function un(n,r){return function(e){return e==null?!1:e[n]===r&&(r!==void 0||n in Object(e))}}function Er(n){var r=yr(n);return r.length==1&&r[0][2]?un(r[0][0],r[0][1]):function(e){return e===n||vr(e,n,r)}}function cr(n,r){return n!=null&&r in Object(n)}function Tr(n,r,e){r=j(r,n);for(var i=-1,f=r.length,t=!1;++i<f;){var s=R(r[i]);if(!(t=n!=null&&e(n,s)))break;n=n[s]}return t||++i!=f?t:(f=n==null?0:n.length,!!f&&wn(f)&&On(s,f)&&(A(n)||W(n)))}function Rr(n,r){return n!=null&&Tr(n,r,cr)}var Ir=1,Lr=2;function Sr(n,r){return $(n)&&sn(r)?un(R(n),r):function(e){var i=Nn(e,n);return i===void 0&&i===r?Rr(e,n):D(r,i,Ir|Lr)}}function xr(n){return function(r){return r==null?void 0:r[n]}}function Mr(n){return function(r){return nn(r,n)}}function $r(n){return $(n)?xr(R(n)):Mr(n)}function an(n){return typeof n=="function"?n:n==null?V:typeof n=="object"?A(n)?Sr(n[0],n[1]):Er(n):$r(n)}function Cr(n,r){return n&&Pn(n,r,M)}function Dr(n,r){return function(e,i){if(e==null)return e;if(!z(e))return n(e,i);for(var f=e.length,t=-1,s=Object(e);++t<f&&i(s[t],t,s)!==!1;);return e}}var F=Dr(Cr);function Fr(n){return typeof n=="function"?n:V}function qr(n,r){var e=A(n)?En:F;return e(n,Fr(r))}function Gr(n,r){var e=[];return F(n,function(i,f,t){r(i,f,t)&&e.push(i)}),e}function Yr(n,r){var e=A(n)?en:Gr;return e(n,an(r))}function Nr(n,r,e,i,f){return f(n,function(t,s,u){e=i?(i=!1,t):r(e,t,s,u)}),e}function Zr(n,r,e){var i=A(n)?Bn:Nr,f=arguments.length<3;return i(n,an(r),e,f,F)}var mr=1/0,Br=I&&1/C(new I([,-0]))[1]==mr?function(n){return new I(n)}:yn,Ur=200;function Xr(n,r,e){var i=-1,f=Ln,t=n.length,s=!0,u=[],a=u;if(t>=Ur){var h=r?null:Br(n);if(h)return C(h);s=!1,f=tn,a=new v}else a=r?[]:u;n:for(;++i<t;){var g=n[i],l=r?r(g):g;if(g=g!==0?g:0,s&&l===l){for(var d=a.length;d--;)if(a[d]===l)continue n;r&&a.push(l),u.push(g)}else f(a,l,e)||(a!==u&&a.push(l),u.push(g))}return u}export{F as a,Hr as b,an as c,vn as d,rn as e,Yn as f,qn as g,En as h,x as i,Y as j,M as k,Xr as l,Yr as m,qr as n,cn as o,Fr as p,Cr as q,Zr as r,Un as s,Tr as t,j as u,R as v,nn as w,Rr as x,Gn as y};
1
+ import{a_ as S,bw as ln,aM as A,aY as b,aL as z,bx as gn,by as dn,bz as hn,bA as W,bB as pn,br as An,bC as N,a$ as m,b4 as B,b7 as T,bD as _n,b2 as on,bE as wn,bu as On,aN as V,bs as Pn,bF as I}from"./index-DHdiTAmV.js";var bn="[object Symbol]";function x(n){return typeof n=="symbol"||S(n)&&ln(n)==bn}function vn(n,r){for(var e=-1,i=n==null?0:n.length,f=Array(i);++e<i;)f[e]=r(n[e],e,n);return f}var U=b?b.prototype:void 0,K=U?U.toString:void 0;function k(n){if(typeof n=="string")return n;if(A(n))return vn(n,k)+"";if(x(n))return K?K.call(n):"";var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function yn(){}function En(n,r){for(var e=-1,i=n==null?0:n.length;++e<i&&r(n[e],e,n)!==!1;);return n}function cn(n,r,e,i){for(var f=n.length,t=e+-1;++t<f;)if(r(n[t],t,n))return t;return-1}function Tn(n){return n!==n}function Rn(n,r,e){for(var i=e-1,f=n.length;++i<f;)if(n[i]===r)return i;return-1}function In(n,r,e){return r===r?Rn(n,r,e):cn(n,Tn,e)}function Ln(n,r){var e=n==null?0:n.length;return!!e&&In(n,r,0)>-1}function M(n){return z(n)?gn(n):dn(n)}var Sn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,xn=/^\w*$/;function $(n,r){if(A(n))return!1;var e=typeof n;return e=="number"||e=="symbol"||e=="boolean"||n==null||x(n)?!0:xn.test(n)||!Sn.test(n)||r!=null&&n in Object(r)}var Mn=500;function $n(n){var r=hn(n,function(i){return e.size===Mn&&e.clear(),i}),e=r.cache;return r}var Cn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Dn=/\\(\\)?/g,Fn=$n(function(n){var r=[];return n.charCodeAt(0)===46&&r.push(""),n.replace(Cn,function(e,i,f,t){r.push(f?t.replace(Dn,"$1"):i||e)}),r});function Gn(n){return n==null?"":k(n)}function j(n,r){return A(n)?n:$(n,r)?[n]:Fn(Gn(n))}function R(n){if(typeof n=="string"||x(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function nn(n,r){r=j(r,n);for(var e=0,i=r.length;n!=null&&e<i;)n=n[R(r[e++])];return e&&e==i?n:void 0}function Nn(n,r,e){var i=n==null?void 0:nn(n,r);return i===void 0?e:i}function rn(n,r){for(var e=-1,i=r.length,f=n.length;++e<i;)n[f+e]=r[e];return n}var H=b?b.isConcatSpreadable:void 0;function mn(n){return A(n)||W(n)||!!(H&&n&&n[H])}function Hr(n,r,e,i,f){var t=-1,s=n.length;for(e||(e=mn),f||(f=[]);++t<s;){var u=n[t];e(u)?rn(f,u):i||(f[f.length]=u)}return f}function Bn(n,r,e,i){var f=-1,t=n==null?0:n.length;for(i&&t&&(e=n[++f]);++f<t;)e=r(e,n[f],f,n);return e}function en(n,r){for(var e=-1,i=n==null?0:n.length,f=0,t=[];++e<i;){var s=n[e];r(s,e,n)&&(t[f++]=s)}return t}function Un(){return[]}var Kn=Object.prototype,Hn=Kn.propertyIsEnumerable,q=Object.getOwnPropertySymbols,qn=q?function(n){return n==null?[]:(n=Object(n),en(q(n),function(r){return Hn.call(n,r)}))}:Un;function Yn(n,r,e){var i=r(n);return A(n)?i:rn(i,e(n))}function Y(n){return Yn(n,M,qn)}var Zn="__lodash_hash_undefined__";function Xn(n){return this.__data__.set(n,Zn),this}function Jn(n){return this.__data__.has(n)}function v(n){var r=-1,e=n==null?0:n.length;for(this.__data__=new pn;++r<e;)this.add(n[r])}v.prototype.add=v.prototype.push=Xn;v.prototype.has=Jn;function Qn(n,r){for(var e=-1,i=n==null?0:n.length;++e<i;)if(r(n[e],e,n))return!0;return!1}function tn(n,r){return n.has(r)}var zn=1,Wn=2;function fn(n,r,e,i,f,t){var s=e&zn,u=n.length,a=r.length;if(u!=a&&!(s&&a>u))return!1;var h=t.get(n),g=t.get(r);if(h&&g)return h==r&&g==n;var l=-1,d=!0,o=e&Wn?new v:void 0;for(t.set(n,r),t.set(r,n);++l<u;){var p=n[l],_=r[l];if(i)var w=s?i(_,p,l,r,n,t):i(p,_,l,n,r,t);if(w!==void 0){if(w)continue;d=!1;break}if(o){if(!Qn(r,function(O,P){if(!tn(o,P)&&(p===O||f(p,O,e,i,t)))return o.push(P)})){d=!1;break}}else if(!(p===_||f(p,_,e,i,t))){d=!1;break}}return t.delete(n),t.delete(r),d}function Vn(n){var r=-1,e=Array(n.size);return n.forEach(function(i,f){e[++r]=[f,i]}),e}function C(n){var r=-1,e=Array(n.size);return n.forEach(function(i){e[++r]=i}),e}var kn=1,jn=2,nr="[object Boolean]",rr="[object Date]",er="[object Error]",ir="[object Map]",tr="[object Number]",fr="[object RegExp]",sr="[object Set]",ur="[object String]",ar="[object Symbol]",lr="[object ArrayBuffer]",gr="[object DataView]",Z=b?b.prototype:void 0,L=Z?Z.valueOf:void 0;function dr(n,r,e,i,f,t,s){switch(e){case gr:if(n.byteLength!=r.byteLength||n.byteOffset!=r.byteOffset)return!1;n=n.buffer,r=r.buffer;case lr:return!(n.byteLength!=r.byteLength||!t(new N(n),new N(r)));case nr:case rr:case tr:return An(+n,+r);case er:return n.name==r.name&&n.message==r.message;case fr:case ur:return n==r+"";case ir:var u=Vn;case sr:var a=i&kn;if(u||(u=C),n.size!=r.size&&!a)return!1;var h=s.get(n);if(h)return h==r;i|=jn,s.set(n,r);var g=fn(u(n),u(r),i,f,t,s);return s.delete(n),g;case ar:if(L)return L.call(n)==L.call(r)}return!1}var hr=1,pr=Object.prototype,Ar=pr.hasOwnProperty;function _r(n,r,e,i,f,t){var s=e&hr,u=Y(n),a=u.length,h=Y(r),g=h.length;if(a!=g&&!s)return!1;for(var l=a;l--;){var d=u[l];if(!(s?d in r:Ar.call(r,d)))return!1}var o=t.get(n),p=t.get(r);if(o&&p)return o==r&&p==n;var _=!0;t.set(n,r),t.set(r,n);for(var w=s;++l<a;){d=u[l];var O=n[d],P=r[d];if(i)var G=s?i(P,O,d,r,n,t):i(O,P,d,n,r,t);if(!(G===void 0?O===P||f(O,P,e,i,t):G)){_=!1;break}w||(w=d=="constructor")}if(_&&!w){var y=n.constructor,E=r.constructor;y!=E&&"constructor"in n&&"constructor"in r&&!(typeof y=="function"&&y instanceof y&&typeof E=="function"&&E instanceof E)&&(_=!1)}return t.delete(n),t.delete(r),_}var or=1,X="[object Arguments]",J="[object Array]",c="[object Object]",wr=Object.prototype,Q=wr.hasOwnProperty;function Or(n,r,e,i,f,t){var s=A(n),u=A(r),a=s?J:m(n),h=u?J:m(r);a=a==X?c:a,h=h==X?c:h;var g=a==c,l=h==c,d=a==h;if(d&&B(n)){if(!B(r))return!1;s=!0,g=!1}if(d&&!g)return t||(t=new T),s||_n(n)?fn(n,r,e,i,f,t):dr(n,r,a,e,i,f,t);if(!(e&or)){var o=g&&Q.call(n,"__wrapped__"),p=l&&Q.call(r,"__wrapped__");if(o||p){var _=o?n.value():n,w=p?r.value():r;return t||(t=new T),f(_,w,e,i,t)}}return d?(t||(t=new T),_r(n,r,e,i,f,t)):!1}function D(n,r,e,i,f){return n===r?!0:n==null||r==null||!S(n)&&!S(r)?n!==n&&r!==r:Or(n,r,e,i,D,f)}var Pr=1,br=2;function vr(n,r,e,i){var f=e.length,t=f;if(n==null)return!t;for(n=Object(n);f--;){var s=e[f];if(s[2]?s[1]!==n[s[0]]:!(s[0]in n))return!1}for(;++f<t;){s=e[f];var u=s[0],a=n[u],h=s[1];if(s[2]){if(a===void 0&&!(u in n))return!1}else{var g=new T,l;if(!(l===void 0?D(h,a,Pr|br,i,g):l))return!1}}return!0}function sn(n){return n===n&&!on(n)}function yr(n){for(var r=M(n),e=r.length;e--;){var i=r[e],f=n[i];r[e]=[i,f,sn(f)]}return r}function un(n,r){return function(e){return e==null?!1:e[n]===r&&(r!==void 0||n in Object(e))}}function Er(n){var r=yr(n);return r.length==1&&r[0][2]?un(r[0][0],r[0][1]):function(e){return e===n||vr(e,n,r)}}function cr(n,r){return n!=null&&r in Object(n)}function Tr(n,r,e){r=j(r,n);for(var i=-1,f=r.length,t=!1;++i<f;){var s=R(r[i]);if(!(t=n!=null&&e(n,s)))break;n=n[s]}return t||++i!=f?t:(f=n==null?0:n.length,!!f&&wn(f)&&On(s,f)&&(A(n)||W(n)))}function Rr(n,r){return n!=null&&Tr(n,r,cr)}var Ir=1,Lr=2;function Sr(n,r){return $(n)&&sn(r)?un(R(n),r):function(e){var i=Nn(e,n);return i===void 0&&i===r?Rr(e,n):D(r,i,Ir|Lr)}}function xr(n){return function(r){return r==null?void 0:r[n]}}function Mr(n){return function(r){return nn(r,n)}}function $r(n){return $(n)?xr(R(n)):Mr(n)}function an(n){return typeof n=="function"?n:n==null?V:typeof n=="object"?A(n)?Sr(n[0],n[1]):Er(n):$r(n)}function Cr(n,r){return n&&Pn(n,r,M)}function Dr(n,r){return function(e,i){if(e==null)return e;if(!z(e))return n(e,i);for(var f=e.length,t=-1,s=Object(e);++t<f&&i(s[t],t,s)!==!1;);return e}}var F=Dr(Cr);function Fr(n){return typeof n=="function"?n:V}function qr(n,r){var e=A(n)?En:F;return e(n,Fr(r))}function Gr(n,r){var e=[];return F(n,function(i,f,t){r(i,f,t)&&e.push(i)}),e}function Yr(n,r){var e=A(n)?en:Gr;return e(n,an(r))}function Nr(n,r,e,i,f){return f(n,function(t,s,u){e=i?(i=!1,t):r(e,t,s,u)}),e}function Zr(n,r,e){var i=A(n)?Bn:Nr,f=arguments.length<3;return i(n,an(r),e,f,F)}var mr=1/0,Br=I&&1/C(new I([,-0]))[1]==mr?function(n){return new I(n)}:yn,Ur=200;function Xr(n,r,e){var i=-1,f=Ln,t=n.length,s=!0,u=[],a=u;if(t>=Ur){var h=r?null:Br(n);if(h)return C(h);s=!1,f=tn,a=new v}else a=r?[]:u;n:for(;++i<t;){var g=n[i],l=r?r(g):g;if(g=g!==0?g:0,s&&l===l){for(var d=a.length;d--;)if(a[d]===l)continue n;r&&a.push(l),u.push(g)}else f(a,l,e)||(a!==u&&a.push(l),u.push(g))}return u}export{F as a,Hr as b,an as c,vn as d,rn as e,Yn as f,qn as g,En as h,x as i,Y as j,M as k,Xr as l,Yr as m,qr as n,cn as o,Fr as p,Cr as q,Zr as r,Un as s,Tr as t,j as u,R as v,nn as w,Rr as x,Gn as y};
@@ -1 +1 @@
1
- import{a0 as ln,a1 as an,a2 as y,a3 as tn,a4 as H,a5 as q,a6 as _,a7 as un,a8 as rn,a9 as L,aa as o,ab as B,ac as sn,ad as on,ae as fn}from"./index-Ceywghsu.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,C,a){var O=I-l,i=D-h,n=C-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function W(l,h,I,D,v,A,C){var a=l-I,O=h-D,i=(C?A:-A)/L(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,F=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*L(fn(0,T*T*R-P*P)),j=(P*g-m*S)/R,z=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=j-F,e=z-t,r=w-F,G=p-t;return x*x+e*e>r*r+G*G&&(j=w,z=p),{cx:j,cy:z,x01:-n,y01:-d,x11:j*(v/T-1),y11:z*(v/T-1)}}function hn(){var l=cn,h=yn,I=B(0),D=null,v=gn,A=dn,C=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=A.apply(this,arguments)-an,F=un(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(F>tn-y)a.moveTo(s*H(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*H(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=F,S=F,j=C.apply(this,arguments)/2,z=j>y&&(D?+D.apply(this,arguments):L(u*u+s*s)),w=_(un(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(z>y){var G=sn(z/u*q(j)),M=sn(z/s*q(j));(P-=G*2)>y?(G*=t?1:-1,R+=G,T-=G):(P=0,R=T=(f+c)/2),(S-=M*2)>y?(M*=t?1:-1,m+=M,g-=M):(S=0,m=g=(f+c)/2)}var J=s*H(m),K=s*q(m),N=u*H(T),Q=u*q(T);if(w>y){var U=s*H(g),V=s*q(g),X=u*H(R),Y=u*q(R),E;if(F<rn)if(E=pn(J,K,X,Y,U,V,N,Q)){var Z=J-E[0],$=K-E[1],b=U-E[0],k=V-E[1],nn=1/q(on((Z*b+$*k)/(L(Z*Z+$*$)*L(b*b+k*k)))/2),en=L(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=W(X,Y,J,K,s,x,t),r=W(U,V,N,Q,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(J,K),a.arc(0,0,s,m,g,!t)):a.moveTo(J,K),!(u>y)||!(P>y)?a.lineTo(N,Q):p>y?(e=W(N,Q,U,V,u,-p,t),r=W(J,K,X,Y,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-rn/2;return[H(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:B(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:B(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:B(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:B(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:B(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:B(+n),i):A},i.padAngle=function(n){return arguments.length?(C=typeof n=="function"?n:B(+n),i):C},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
1
+ import{a0 as ln,a1 as an,a2 as y,a3 as tn,a4 as H,a5 as q,a6 as _,a7 as un,a8 as rn,a9 as L,aa as o,ab as B,ac as sn,ad as on,ae as fn}from"./index-DHdiTAmV.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,C,a){var O=I-l,i=D-h,n=C-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function W(l,h,I,D,v,A,C){var a=l-I,O=h-D,i=(C?A:-A)/L(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,F=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*L(fn(0,T*T*R-P*P)),j=(P*g-m*S)/R,z=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=j-F,e=z-t,r=w-F,G=p-t;return x*x+e*e>r*r+G*G&&(j=w,z=p),{cx:j,cy:z,x01:-n,y01:-d,x11:j*(v/T-1),y11:z*(v/T-1)}}function hn(){var l=cn,h=yn,I=B(0),D=null,v=gn,A=dn,C=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=A.apply(this,arguments)-an,F=un(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(F>tn-y)a.moveTo(s*H(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*H(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=F,S=F,j=C.apply(this,arguments)/2,z=j>y&&(D?+D.apply(this,arguments):L(u*u+s*s)),w=_(un(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(z>y){var G=sn(z/u*q(j)),M=sn(z/s*q(j));(P-=G*2)>y?(G*=t?1:-1,R+=G,T-=G):(P=0,R=T=(f+c)/2),(S-=M*2)>y?(M*=t?1:-1,m+=M,g-=M):(S=0,m=g=(f+c)/2)}var J=s*H(m),K=s*q(m),N=u*H(T),Q=u*q(T);if(w>y){var U=s*H(g),V=s*q(g),X=u*H(R),Y=u*q(R),E;if(F<rn)if(E=pn(J,K,X,Y,U,V,N,Q)){var Z=J-E[0],$=K-E[1],b=U-E[0],k=V-E[1],nn=1/q(on((Z*b+$*k)/(L(Z*Z+$*$)*L(b*b+k*k)))/2),en=L(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=W(X,Y,J,K,s,x,t),r=W(U,V,N,Q,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(J,K),a.arc(0,0,s,m,g,!t)):a.moveTo(J,K),!(u>y)||!(P>y)?a.lineTo(N,Q):p>y?(e=W(N,Q,U,V,u,-p,t),r=W(J,K,X,Y,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-rn/2;return[H(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:B(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:B(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:B(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:B(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:B(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:B(+n),i):A},i.padAngle=function(n){return arguments.length?(C=typeof n=="function"?n:B(+n),i):C},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
@@ -1,4 +1,4 @@
1
- import{_ as g,I as ht,Y as gt,l as K,b as ut,a as pt,p as mt,q as yt,g as wt,s as kt,z as xt,F as bt,G as vt,D as $t,c as J,ak as Z,as as N,i as Et,d as St,at as tt,x as Dt,au as Tt,av as At,aw as Bt}from"./index-Ceywghsu.js";import{p as Ct}from"./chunk-4BX2VUAB-wijkFgZY.js";import{p as It}from"./wardley-RL74JXVD-Cc8uoiL3.js";import"./min-DtJISjld.js";import"./_baseUniq-3jW4HAOf.js";var W={L:"left",R:"right",T:"top",B:"bottom"},Q={L:g(e=>`${e},${e/2} 0,${e} 0,0`,"L"),R:g(e=>`0,${e/2} ${e},0 ${e},${e}`,"R"),T:g(e=>`0,0 ${e},0 ${e/2},${e}`,"T"),B:g(e=>`${e/2},0 ${e},${e} 0,${e}`,"B")},X={L:g((e,t)=>e-t+2,"L"),R:g((e,t)=>e-2,"R"),T:g((e,t)=>e-t+2,"T"),B:g((e,t)=>e-2,"B")},jt=g(function(e){return S(e)?e==="L"?"R":"L":e==="T"?"B":"T"},"getOppositeArchitectureDirection"),U=g(function(e){const t=e;return t==="L"||t==="R"||t==="T"||t==="B"},"isArchitectureDirection"),S=g(function(e){const t=e;return t==="L"||t==="R"},"isArchitectureDirectionX"),L=g(function(e){const t=e;return t==="T"||t==="B"},"isArchitectureDirectionY"),V=g(function(e,t){const i=S(e)&&L(t),r=L(e)&&S(t);return i||r},"isArchitectureDirectionXY"),Lt=g(function(e){const t=e[0],i=e[1],r=S(t)&&L(i),n=L(t)&&S(i);return r||n},"isArchitecturePairXY"),zt=g(function(e){return e!=="LL"&&e!=="RR"&&e!=="TT"&&e!=="BB"},"isValidArchitectureDirectionPair"),_=g(function(e,t){const i=`${e}${t}`;return zt(i)?i:void 0},"getArchitectureDirectionPair"),Ft=g(function([e,t],i){const r=i[0],n=i[1];return S(r)?L(n)?[e+(r==="L"?-1:1),t+(n==="T"?1:-1)]:[e+(r==="L"?-1:1),t]:S(n)?[e+(n==="L"?1:-1),t+(r==="T"?1:-1)]:[e,t+(r==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Pt=g(function(e){return e==="LT"||e==="TL"?[1,1]:e==="BL"||e==="LB"?[1,-1]:e==="BR"||e==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),Yt=g(function(e,t){return V(e,t)?"bend":S(e)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Rt=g(function(e){return e.type==="service"},"isArchitectureService"),Xt=g(function(e){return e.type==="junction"},"isArchitectureJunction"),et=g(e=>e.data(),"edgeData"),F=g(e=>e.data(),"nodeData"),Ot=vt.architecture,P,it=(P=class{constructor(){this.nodes={},this.groups={},this.edges=[],this.registeredIds={},this.elements={},this.diagramId="",this.setAccTitle=ut,this.getAccTitle=pt,this.setDiagramTitle=mt,this.getDiagramTitle=yt,this.getAccDescription=wt,this.setAccDescription=kt,this.clear()}setDiagramId(t){this.diagramId=t}getDiagramId(){return this.diagramId}clear(){this.nodes={},this.groups={},this.edges=[],this.registeredIds={},this.dataStructures=void 0,this.elements={},this.diagramId="",xt()}addService({id:t,icon:i,in:r,title:n,iconText:c}){if(this.registeredIds[t]!==void 0)throw new Error(`The service id [${t}] is already in use by another ${this.registeredIds[t]}`);if(r!==void 0){if(t===r)throw new Error(`The service [${t}] cannot be placed within itself`);if(this.registeredIds[r]===void 0)throw new Error(`The service [${t}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds[r]==="node")throw new Error(`The service [${t}]'s parent is not a group`)}this.registeredIds[t]="node",this.nodes[t]={id:t,type:"service",icon:i,iconText:c,title:n,edges:[],in:r}}getServices(){return Object.values(this.nodes).filter(Rt)}addJunction({id:t,in:i}){if(this.registeredIds[t]!==void 0)throw new Error(`The junction id [${t}] is already in use by another ${this.registeredIds[t]}`);if(i!==void 0){if(t===i)throw new Error(`The junction [${t}] cannot be placed within itself`);if(this.registeredIds[i]===void 0)throw new Error(`The junction [${t}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds[i]==="node")throw new Error(`The junction [${t}]'s parent is not a group`)}this.registeredIds[t]="node",this.nodes[t]={id:t,type:"junction",edges:[],in:i}}getJunctions(){return Object.values(this.nodes).filter(Xt)}getNodes(){return Object.values(this.nodes)}getNode(t){return this.nodes[t]??null}addGroup({id:t,icon:i,in:r,title:n}){var c,p,d;if(((c=this.registeredIds)==null?void 0:c[t])!==void 0)throw new Error(`The group id [${t}] is already in use by another ${this.registeredIds[t]}`);if(r!==void 0){if(t===r)throw new Error(`The group [${t}] cannot be placed within itself`);if(((p=this.registeredIds)==null?void 0:p[r])===void 0)throw new Error(`The group [${t}]'s parent does not exist. Please make sure the parent is created before this group`);if(((d=this.registeredIds)==null?void 0:d[r])==="node")throw new Error(`The group [${t}]'s parent is not a group`)}this.registeredIds[t]="group",this.groups[t]={id:t,icon:i,title:n,in:r}}getGroups(){return Object.values(this.groups)}addEdge({lhsId:t,rhsId:i,lhsDir:r,rhsDir:n,lhsInto:c,rhsInto:p,lhsGroup:d,rhsGroup:l,title:s}){if(!U(r))throw new Error(`Invalid direction given for left hand side of edge ${t}--${i}. Expected (L,R,T,B) got ${String(r)}`);if(!U(n))throw new Error(`Invalid direction given for right hand side of edge ${t}--${i}. Expected (L,R,T,B) got ${String(n)}`);if(this.nodes[t]===void 0&&this.groups[t]===void 0)throw new Error(`The left-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(this.nodes[i]===void 0&&this.groups[i]===void 0)throw new Error(`The right-hand id [${i}] does not yet exist. Please create the service/group before declaring an edge to it.`);const o=this.nodes[t].in,a=this.nodes[i].in;if(d&&o&&a&&o==a)throw new Error(`The left-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(l&&o&&a&&o==a)throw new Error(`The right-hand id [${i}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const u={lhsId:t,lhsDir:r,lhsInto:c,lhsGroup:d,rhsId:i,rhsDir:n,rhsInto:p,rhsGroup:l,title:s};this.edges.push(u),this.nodes[t]&&this.nodes[i]&&(this.nodes[t].edges.push(this.edges[this.edges.length-1]),this.nodes[i].edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}getDataStructures(){if(this.dataStructures===void 0){const t={},i=Object.entries(this.nodes).reduce((l,[s,o])=>(l[s]=o.edges.reduce((a,u)=>{var h,w;const f=(h=this.getNode(u.lhsId))==null?void 0:h.in,m=(w=this.getNode(u.rhsId))==null?void 0:w.in;if(f&&m&&f!==m){const y=Yt(u.lhsDir,u.rhsDir);y!=="bend"&&(t[f]??(t[f]={}),t[f][m]=y,t[m]??(t[m]={}),t[m][f]=y)}if(u.lhsId===s){const y=_(u.lhsDir,u.rhsDir);y&&(a[y]=u.rhsId)}else{const y=_(u.rhsDir,u.lhsDir);y&&(a[y]=u.lhsId)}return a},{}),l),{}),r=Object.keys(i)[0],n={[r]:1},c=Object.keys(i).reduce((l,s)=>s===r?l:{...l,[s]:1},{}),p=g(l=>{const s={[l]:[0,0]},o=[l];for(;o.length>0;){const a=o.shift();if(a){n[a]=1,delete c[a];const u=i[a],[f,m]=s[a];Object.entries(u).forEach(([h,w])=>{n[w]||(s[w]=Ft([f,m],h),o.push(w))})}}return s},"BFS"),d=[p(r)];for(;Object.keys(c).length>0;)d.push(p(Object.keys(c)[0]));this.dataStructures={adjList:i,spatialMaps:d,groupAlignments:t}}return this.dataStructures}setElementForId(t,i){this.elements[t]=i}getElementById(t){return this.elements[t]}getConfig(){return bt({...Ot,...$t().architecture})}getConfigField(t){return this.getConfig()[t]}},g(P,"ArchitectureDB"),P),Mt=g((e,t)=>{Ct(e,t),e.groups.map(i=>t.addGroup(i)),e.services.map(i=>t.addService({...i,type:"service"})),e.junctions.map(i=>t.addJunction({...i,type:"junction"})),e.edges.map(i=>t.addEdge(i))},"populateDb"),rt={parser:{yy:void 0},parse:g(async e=>{var r;const t=await It("architecture",e);K.debug(t);const i=(r=rt.parser)==null?void 0:r.yy;if(!(i instanceof it))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Mt(t,i)},"parse")},Gt=g(e=>`
1
+ import{_ as g,I as ht,Y as gt,l as K,b as ut,a as pt,p as mt,q as yt,g as wt,s as kt,z as xt,F as bt,G as vt,D as $t,c as J,ak as Z,as as N,i as Et,d as St,at as tt,x as Dt,au as Tt,av as At,aw as Bt}from"./index-DHdiTAmV.js";import{p as Ct}from"./chunk-4BX2VUAB-DE1mVs3B.js";import{p as It}from"./wardley-RL74JXVD-BOOKZXAy.js";import"./min-DpwGyJGd.js";import"./_baseUniq-1Y6jTF8t.js";var W={L:"left",R:"right",T:"top",B:"bottom"},Q={L:g(e=>`${e},${e/2} 0,${e} 0,0`,"L"),R:g(e=>`0,${e/2} ${e},0 ${e},${e}`,"R"),T:g(e=>`0,0 ${e},0 ${e/2},${e}`,"T"),B:g(e=>`${e/2},0 ${e},${e} 0,${e}`,"B")},X={L:g((e,t)=>e-t+2,"L"),R:g((e,t)=>e-2,"R"),T:g((e,t)=>e-t+2,"T"),B:g((e,t)=>e-2,"B")},jt=g(function(e){return S(e)?e==="L"?"R":"L":e==="T"?"B":"T"},"getOppositeArchitectureDirection"),U=g(function(e){const t=e;return t==="L"||t==="R"||t==="T"||t==="B"},"isArchitectureDirection"),S=g(function(e){const t=e;return t==="L"||t==="R"},"isArchitectureDirectionX"),L=g(function(e){const t=e;return t==="T"||t==="B"},"isArchitectureDirectionY"),V=g(function(e,t){const i=S(e)&&L(t),r=L(e)&&S(t);return i||r},"isArchitectureDirectionXY"),Lt=g(function(e){const t=e[0],i=e[1],r=S(t)&&L(i),n=L(t)&&S(i);return r||n},"isArchitecturePairXY"),zt=g(function(e){return e!=="LL"&&e!=="RR"&&e!=="TT"&&e!=="BB"},"isValidArchitectureDirectionPair"),_=g(function(e,t){const i=`${e}${t}`;return zt(i)?i:void 0},"getArchitectureDirectionPair"),Ft=g(function([e,t],i){const r=i[0],n=i[1];return S(r)?L(n)?[e+(r==="L"?-1:1),t+(n==="T"?1:-1)]:[e+(r==="L"?-1:1),t]:S(n)?[e+(n==="L"?1:-1),t+(r==="T"?1:-1)]:[e,t+(r==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Pt=g(function(e){return e==="LT"||e==="TL"?[1,1]:e==="BL"||e==="LB"?[1,-1]:e==="BR"||e==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),Yt=g(function(e,t){return V(e,t)?"bend":S(e)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Rt=g(function(e){return e.type==="service"},"isArchitectureService"),Xt=g(function(e){return e.type==="junction"},"isArchitectureJunction"),et=g(e=>e.data(),"edgeData"),F=g(e=>e.data(),"nodeData"),Ot=vt.architecture,P,it=(P=class{constructor(){this.nodes={},this.groups={},this.edges=[],this.registeredIds={},this.elements={},this.diagramId="",this.setAccTitle=ut,this.getAccTitle=pt,this.setDiagramTitle=mt,this.getDiagramTitle=yt,this.getAccDescription=wt,this.setAccDescription=kt,this.clear()}setDiagramId(t){this.diagramId=t}getDiagramId(){return this.diagramId}clear(){this.nodes={},this.groups={},this.edges=[],this.registeredIds={},this.dataStructures=void 0,this.elements={},this.diagramId="",xt()}addService({id:t,icon:i,in:r,title:n,iconText:c}){if(this.registeredIds[t]!==void 0)throw new Error(`The service id [${t}] is already in use by another ${this.registeredIds[t]}`);if(r!==void 0){if(t===r)throw new Error(`The service [${t}] cannot be placed within itself`);if(this.registeredIds[r]===void 0)throw new Error(`The service [${t}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds[r]==="node")throw new Error(`The service [${t}]'s parent is not a group`)}this.registeredIds[t]="node",this.nodes[t]={id:t,type:"service",icon:i,iconText:c,title:n,edges:[],in:r}}getServices(){return Object.values(this.nodes).filter(Rt)}addJunction({id:t,in:i}){if(this.registeredIds[t]!==void 0)throw new Error(`The junction id [${t}] is already in use by another ${this.registeredIds[t]}`);if(i!==void 0){if(t===i)throw new Error(`The junction [${t}] cannot be placed within itself`);if(this.registeredIds[i]===void 0)throw new Error(`The junction [${t}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds[i]==="node")throw new Error(`The junction [${t}]'s parent is not a group`)}this.registeredIds[t]="node",this.nodes[t]={id:t,type:"junction",edges:[],in:i}}getJunctions(){return Object.values(this.nodes).filter(Xt)}getNodes(){return Object.values(this.nodes)}getNode(t){return this.nodes[t]??null}addGroup({id:t,icon:i,in:r,title:n}){var c,p,d;if(((c=this.registeredIds)==null?void 0:c[t])!==void 0)throw new Error(`The group id [${t}] is already in use by another ${this.registeredIds[t]}`);if(r!==void 0){if(t===r)throw new Error(`The group [${t}] cannot be placed within itself`);if(((p=this.registeredIds)==null?void 0:p[r])===void 0)throw new Error(`The group [${t}]'s parent does not exist. Please make sure the parent is created before this group`);if(((d=this.registeredIds)==null?void 0:d[r])==="node")throw new Error(`The group [${t}]'s parent is not a group`)}this.registeredIds[t]="group",this.groups[t]={id:t,icon:i,title:n,in:r}}getGroups(){return Object.values(this.groups)}addEdge({lhsId:t,rhsId:i,lhsDir:r,rhsDir:n,lhsInto:c,rhsInto:p,lhsGroup:d,rhsGroup:l,title:s}){if(!U(r))throw new Error(`Invalid direction given for left hand side of edge ${t}--${i}. Expected (L,R,T,B) got ${String(r)}`);if(!U(n))throw new Error(`Invalid direction given for right hand side of edge ${t}--${i}. Expected (L,R,T,B) got ${String(n)}`);if(this.nodes[t]===void 0&&this.groups[t]===void 0)throw new Error(`The left-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(this.nodes[i]===void 0&&this.groups[i]===void 0)throw new Error(`The right-hand id [${i}] does not yet exist. Please create the service/group before declaring an edge to it.`);const o=this.nodes[t].in,a=this.nodes[i].in;if(d&&o&&a&&o==a)throw new Error(`The left-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(l&&o&&a&&o==a)throw new Error(`The right-hand id [${i}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const u={lhsId:t,lhsDir:r,lhsInto:c,lhsGroup:d,rhsId:i,rhsDir:n,rhsInto:p,rhsGroup:l,title:s};this.edges.push(u),this.nodes[t]&&this.nodes[i]&&(this.nodes[t].edges.push(this.edges[this.edges.length-1]),this.nodes[i].edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}getDataStructures(){if(this.dataStructures===void 0){const t={},i=Object.entries(this.nodes).reduce((l,[s,o])=>(l[s]=o.edges.reduce((a,u)=>{var h,w;const f=(h=this.getNode(u.lhsId))==null?void 0:h.in,m=(w=this.getNode(u.rhsId))==null?void 0:w.in;if(f&&m&&f!==m){const y=Yt(u.lhsDir,u.rhsDir);y!=="bend"&&(t[f]??(t[f]={}),t[f][m]=y,t[m]??(t[m]={}),t[m][f]=y)}if(u.lhsId===s){const y=_(u.lhsDir,u.rhsDir);y&&(a[y]=u.rhsId)}else{const y=_(u.rhsDir,u.lhsDir);y&&(a[y]=u.lhsId)}return a},{}),l),{}),r=Object.keys(i)[0],n={[r]:1},c=Object.keys(i).reduce((l,s)=>s===r?l:{...l,[s]:1},{}),p=g(l=>{const s={[l]:[0,0]},o=[l];for(;o.length>0;){const a=o.shift();if(a){n[a]=1,delete c[a];const u=i[a],[f,m]=s[a];Object.entries(u).forEach(([h,w])=>{n[w]||(s[w]=Ft([f,m],h),o.push(w))})}}return s},"BFS"),d=[p(r)];for(;Object.keys(c).length>0;)d.push(p(Object.keys(c)[0]));this.dataStructures={adjList:i,spatialMaps:d,groupAlignments:t}}return this.dataStructures}setElementForId(t,i){this.elements[t]=i}getElementById(t){return this.elements[t]}getConfig(){return bt({...Ot,...$t().architecture})}getConfigField(t){return this.getConfig()[t]}},g(P,"ArchitectureDB"),P),Mt=g((e,t)=>{Ct(e,t),e.groups.map(i=>t.addGroup(i)),e.services.map(i=>t.addService({...i,type:"service"})),e.junctions.map(i=>t.addJunction({...i,type:"junction"})),e.edges.map(i=>t.addEdge(i))},"populateDb"),rt={parser:{yy:void 0},parse:g(async e=>{var r;const t=await It("architecture",e);K.debug(t);const i=(r=rt.parser)==null?void 0:r.yy;if(!(i instanceof it))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Mt(t,i)},"parse")},Gt=g(e=>`
2
2
  .edge {
3
3
  stroke-width: ${e.archEdgeWidth};
4
4
  stroke: ${e.archEdgeColor};
@@ -1,4 +1,4 @@
1
- import{g as ge}from"./chunk-FMBD7UC4-CdkRK5Hx.js";import{_ as d,D as lt,d as C,e as de,l as v,z as ue,B as pe,ai as fe,R as xe,S as ye,c as M,O as be,aj as Y,ak as vt,al as at,am as we,u as st,k as me,an as Le,i as Ct,ao as Ot,ap as Se}from"./index-Ceywghsu.js";import{c as ve}from"./clone-5MVZ89iV.js";import{G as Ee}from"./graph-orv1XHGx.js";import{c as _e}from"./channel-DDkv7DUd.js";import"./_baseUniq-3jW4HAOf.js";var bt=(function(){var e=d(function(N,y,u,p){for(u=u||{},p=N.length;p--;u[N[p]]=y);return u},"o"),t=[1,15],a=[1,7],i=[1,13],l=[1,14],s=[1,19],r=[1,16],n=[1,17],c=[1,18],x=[8,30],h=[8,10,21,28,29,30,31,39,43,46],f=[1,23],w=[1,24],b=[8,10,15,16,21,28,29,30,31,39,43,46],m=[8,10,15,16,21,27,28,29,30,31,39,43,46],_=[1,49],L={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:d(function(y,u,p,S,E,o,k){var g=o.length-1;switch(E){case 4:S.getLogger().debug("Rule: separator (NL) ");break;case 5:S.getLogger().debug("Rule: separator (Space) ");break;case 6:S.getLogger().debug("Rule: separator (EOF) ");break;case 7:S.getLogger().debug("Rule: hierarchy: ",o[g-1]),S.setHierarchy(o[g-1]);break;case 8:S.getLogger().debug("Stop NL ");break;case 9:S.getLogger().debug("Stop EOF ");break;case 10:S.getLogger().debug("Stop NL2 ");break;case 11:S.getLogger().debug("Stop EOF2 ");break;case 12:S.getLogger().debug("Rule: statement: ",o[g]),typeof o[g].length=="number"?this.$=o[g]:this.$=[o[g]];break;case 13:S.getLogger().debug("Rule: statement #2: ",o[g-1]),this.$=[o[g-1]].concat(o[g]);break;case 14:S.getLogger().debug("Rule: link: ",o[g],y),this.$={edgeTypeStr:o[g],label:""};break;case 15:S.getLogger().debug("Rule: LABEL link: ",o[g-3],o[g-1],o[g]),this.$={edgeTypeStr:o[g],label:o[g-1]};break;case 18:const D=parseInt(o[g]),T=S.generateId();this.$={id:T,type:"space",label:"",width:D,children:[]};break;case 23:S.getLogger().debug("Rule: (nodeStatement link node) ",o[g-2],o[g-1],o[g]," typestr: ",o[g-1].edgeTypeStr);const K=S.edgeStrToEdgeData(o[g-1].edgeTypeStr);this.$=[{id:o[g-2].id,label:o[g-2].label,type:o[g-2].type,directions:o[g-2].directions},{id:o[g-2].id+"-"+o[g].id,start:o[g-2].id,end:o[g].id,label:o[g-1].label,type:"edge",directions:o[g].directions,arrowTypeEnd:K,arrowTypeStart:"arrow_open"},{id:o[g].id,label:o[g].label,type:S.typeStr2Type(o[g].typeStr),directions:o[g].directions}];break;case 24:S.getLogger().debug("Rule: nodeStatement (abc88 node size) ",o[g-1],o[g]),this.$={id:o[g-1].id,label:o[g-1].label,type:S.typeStr2Type(o[g-1].typeStr),directions:o[g-1].directions,widthInColumns:parseInt(o[g],10)};break;case 25:S.getLogger().debug("Rule: nodeStatement (node) ",o[g]),this.$={id:o[g].id,label:o[g].label,type:S.typeStr2Type(o[g].typeStr),directions:o[g].directions,widthInColumns:1};break;case 26:S.getLogger().debug("APA123",this?this:"na"),S.getLogger().debug("COLUMNS: ",o[g]),this.$={type:"column-setting",columns:o[g]==="auto"?-1:parseInt(o[g])};break;case 27:S.getLogger().debug("Rule: id-block statement : ",o[g-2],o[g-1]),S.generateId(),this.$={...o[g-2],type:"composite",children:o[g-1]};break;case 28:S.getLogger().debug("Rule: blockStatement : ",o[g-2],o[g-1],o[g]);const P=S.generateId();this.$={id:P,type:"composite",label:"",children:o[g-1]};break;case 29:S.getLogger().debug("Rule: node (NODE_ID separator): ",o[g]),this.$={id:o[g]};break;case 30:S.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",o[g-1],o[g]),this.$={id:o[g-1],label:o[g].label,typeStr:o[g].typeStr,directions:o[g].directions};break;case 31:S.getLogger().debug("Rule: dirList: ",o[g]),this.$=[o[g]];break;case 32:S.getLogger().debug("Rule: dirList: ",o[g-1],o[g]),this.$=[o[g-1]].concat(o[g]);break;case 33:S.getLogger().debug("Rule: nodeShapeNLabel: ",o[g-2],o[g-1],o[g]),this.$={typeStr:o[g-2]+o[g],label:o[g-1]};break;case 34:S.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",o[g-3],o[g-2]," #3:",o[g-1],o[g]),this.$={typeStr:o[g-3]+o[g],label:o[g-2],directions:o[g-1]};break;case 35:case 36:this.$={type:"classDef",id:o[g-1].trim(),css:o[g].trim()};break;case 37:this.$={type:"applyClass",id:o[g-1].trim(),styleClass:o[g].trim()};break;case 38:this.$={type:"applyStyles",id:o[g-1].trim(),stylesStr:o[g].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:t,11:3,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:i,29:l,31:s,39:r,43:n,46:c},{8:[1,20]},e(x,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:t,21:a,28:i,29:l,31:s,39:r,43:n,46:c}),e(h,[2,16],{14:22,15:f,16:w}),e(h,[2,17]),e(h,[2,18]),e(h,[2,19]),e(h,[2,20]),e(h,[2,21]),e(h,[2,22]),e(b,[2,25],{27:[1,25]}),e(h,[2,26]),{19:26,26:12,31:s},{10:t,11:27,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:i,29:l,31:s,39:r,43:n,46:c},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(m,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(x,[2,13]),{26:35,31:s},{31:[2,14]},{17:[1,36]},e(b,[2,24]),{10:t,11:37,13:4,14:22,15:f,16:w,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:i,29:l,31:s,39:r,43:n,46:c},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(m,[2,30]),{18:[1,43]},{18:[1,44]},e(b,[2,23]),{18:[1,45]},{30:[1,46]},e(h,[2,28]),e(h,[2,35]),e(h,[2,36]),e(h,[2,37]),e(h,[2,38]),{36:[1,47]},{33:48,34:_},{15:[1,50]},e(h,[2,27]),e(m,[2,33]),{38:[1,51]},{33:52,34:_,38:[2,31]},{31:[2,15]},e(m,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:d(function(y,u){if(u.recoverable)this.trace(y);else{var p=new Error(y);throw p.hash=u,p}},"parseError"),parse:d(function(y){var u=this,p=[0],S=[],E=[null],o=[],k=this.table,g="",D=0,T=0,K=2,P=1,Q=o.slice.call(arguments,1),R=Object.create(this.lexer),U={yy:{}};for(var et in this.yy)Object.prototype.hasOwnProperty.call(this.yy,et)&&(U.yy[et]=this.yy[et]);R.setInput(y,U.yy),U.yy.lexer=R,U.yy.parser=this,typeof R.yylloc>"u"&&(R.yylloc={});var rt=R.yylloc;o.push(rt);var oe=R.options&&R.options.ranges;typeof U.yy.parseError=="function"?this.parseError=U.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function he(X){p.length=p.length-2*X,E.length=E.length-X,o.length=o.length-X}d(he,"popStack");function It(){var X;return X=S.pop()||R.lex()||P,typeof X!="number"&&(X instanceof Array&&(S=X,X=S.pop()),X=u.symbols_[X]||X),X}d(It,"lex");for(var H,$,V,ft,tt={},ct,J,Bt,ot;;){if($=p[p.length-1],this.defaultActions[$]?V=this.defaultActions[$]:((H===null||typeof H>"u")&&(H=It()),V=k[$]&&k[$][H]),typeof V>"u"||!V.length||!V[0]){var xt="";ot=[];for(ct in k[$])this.terminals_[ct]&&ct>K&&ot.push("'"+this.terminals_[ct]+"'");R.showPosition?xt="Parse error on line "+(D+1)+`:
1
+ import{g as ge}from"./chunk-FMBD7UC4-ij7VBSva.js";import{_ as d,D as lt,d as C,e as de,l as v,z as ue,B as pe,ai as fe,R as xe,S as ye,c as M,O as be,aj as Y,ak as vt,al as at,am as we,u as st,k as me,an as Le,i as Ct,ao as Ot,ap as Se}from"./index-DHdiTAmV.js";import{c as ve}from"./clone-WlHlToLE.js";import{G as Ee}from"./graph-Dwh_GDZn.js";import{c as _e}from"./channel-BOEco5yc.js";import"./_baseUniq-1Y6jTF8t.js";var bt=(function(){var e=d(function(N,y,u,p){for(u=u||{},p=N.length;p--;u[N[p]]=y);return u},"o"),t=[1,15],a=[1,7],i=[1,13],l=[1,14],s=[1,19],r=[1,16],n=[1,17],c=[1,18],x=[8,30],h=[8,10,21,28,29,30,31,39,43,46],f=[1,23],w=[1,24],b=[8,10,15,16,21,28,29,30,31,39,43,46],m=[8,10,15,16,21,27,28,29,30,31,39,43,46],_=[1,49],L={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:d(function(y,u,p,S,E,o,k){var g=o.length-1;switch(E){case 4:S.getLogger().debug("Rule: separator (NL) ");break;case 5:S.getLogger().debug("Rule: separator (Space) ");break;case 6:S.getLogger().debug("Rule: separator (EOF) ");break;case 7:S.getLogger().debug("Rule: hierarchy: ",o[g-1]),S.setHierarchy(o[g-1]);break;case 8:S.getLogger().debug("Stop NL ");break;case 9:S.getLogger().debug("Stop EOF ");break;case 10:S.getLogger().debug("Stop NL2 ");break;case 11:S.getLogger().debug("Stop EOF2 ");break;case 12:S.getLogger().debug("Rule: statement: ",o[g]),typeof o[g].length=="number"?this.$=o[g]:this.$=[o[g]];break;case 13:S.getLogger().debug("Rule: statement #2: ",o[g-1]),this.$=[o[g-1]].concat(o[g]);break;case 14:S.getLogger().debug("Rule: link: ",o[g],y),this.$={edgeTypeStr:o[g],label:""};break;case 15:S.getLogger().debug("Rule: LABEL link: ",o[g-3],o[g-1],o[g]),this.$={edgeTypeStr:o[g],label:o[g-1]};break;case 18:const D=parseInt(o[g]),T=S.generateId();this.$={id:T,type:"space",label:"",width:D,children:[]};break;case 23:S.getLogger().debug("Rule: (nodeStatement link node) ",o[g-2],o[g-1],o[g]," typestr: ",o[g-1].edgeTypeStr);const K=S.edgeStrToEdgeData(o[g-1].edgeTypeStr);this.$=[{id:o[g-2].id,label:o[g-2].label,type:o[g-2].type,directions:o[g-2].directions},{id:o[g-2].id+"-"+o[g].id,start:o[g-2].id,end:o[g].id,label:o[g-1].label,type:"edge",directions:o[g].directions,arrowTypeEnd:K,arrowTypeStart:"arrow_open"},{id:o[g].id,label:o[g].label,type:S.typeStr2Type(o[g].typeStr),directions:o[g].directions}];break;case 24:S.getLogger().debug("Rule: nodeStatement (abc88 node size) ",o[g-1],o[g]),this.$={id:o[g-1].id,label:o[g-1].label,type:S.typeStr2Type(o[g-1].typeStr),directions:o[g-1].directions,widthInColumns:parseInt(o[g],10)};break;case 25:S.getLogger().debug("Rule: nodeStatement (node) ",o[g]),this.$={id:o[g].id,label:o[g].label,type:S.typeStr2Type(o[g].typeStr),directions:o[g].directions,widthInColumns:1};break;case 26:S.getLogger().debug("APA123",this?this:"na"),S.getLogger().debug("COLUMNS: ",o[g]),this.$={type:"column-setting",columns:o[g]==="auto"?-1:parseInt(o[g])};break;case 27:S.getLogger().debug("Rule: id-block statement : ",o[g-2],o[g-1]),S.generateId(),this.$={...o[g-2],type:"composite",children:o[g-1]};break;case 28:S.getLogger().debug("Rule: blockStatement : ",o[g-2],o[g-1],o[g]);const P=S.generateId();this.$={id:P,type:"composite",label:"",children:o[g-1]};break;case 29:S.getLogger().debug("Rule: node (NODE_ID separator): ",o[g]),this.$={id:o[g]};break;case 30:S.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",o[g-1],o[g]),this.$={id:o[g-1],label:o[g].label,typeStr:o[g].typeStr,directions:o[g].directions};break;case 31:S.getLogger().debug("Rule: dirList: ",o[g]),this.$=[o[g]];break;case 32:S.getLogger().debug("Rule: dirList: ",o[g-1],o[g]),this.$=[o[g-1]].concat(o[g]);break;case 33:S.getLogger().debug("Rule: nodeShapeNLabel: ",o[g-2],o[g-1],o[g]),this.$={typeStr:o[g-2]+o[g],label:o[g-1]};break;case 34:S.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",o[g-3],o[g-2]," #3:",o[g-1],o[g]),this.$={typeStr:o[g-3]+o[g],label:o[g-2],directions:o[g-1]};break;case 35:case 36:this.$={type:"classDef",id:o[g-1].trim(),css:o[g].trim()};break;case 37:this.$={type:"applyClass",id:o[g-1].trim(),styleClass:o[g].trim()};break;case 38:this.$={type:"applyStyles",id:o[g-1].trim(),stylesStr:o[g].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:t,11:3,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:i,29:l,31:s,39:r,43:n,46:c},{8:[1,20]},e(x,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:t,21:a,28:i,29:l,31:s,39:r,43:n,46:c}),e(h,[2,16],{14:22,15:f,16:w}),e(h,[2,17]),e(h,[2,18]),e(h,[2,19]),e(h,[2,20]),e(h,[2,21]),e(h,[2,22]),e(b,[2,25],{27:[1,25]}),e(h,[2,26]),{19:26,26:12,31:s},{10:t,11:27,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:i,29:l,31:s,39:r,43:n,46:c},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(m,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(x,[2,13]),{26:35,31:s},{31:[2,14]},{17:[1,36]},e(b,[2,24]),{10:t,11:37,13:4,14:22,15:f,16:w,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:i,29:l,31:s,39:r,43:n,46:c},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(m,[2,30]),{18:[1,43]},{18:[1,44]},e(b,[2,23]),{18:[1,45]},{30:[1,46]},e(h,[2,28]),e(h,[2,35]),e(h,[2,36]),e(h,[2,37]),e(h,[2,38]),{36:[1,47]},{33:48,34:_},{15:[1,50]},e(h,[2,27]),e(m,[2,33]),{38:[1,51]},{33:52,34:_,38:[2,31]},{31:[2,15]},e(m,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:d(function(y,u){if(u.recoverable)this.trace(y);else{var p=new Error(y);throw p.hash=u,p}},"parseError"),parse:d(function(y){var u=this,p=[0],S=[],E=[null],o=[],k=this.table,g="",D=0,T=0,K=2,P=1,Q=o.slice.call(arguments,1),R=Object.create(this.lexer),U={yy:{}};for(var et in this.yy)Object.prototype.hasOwnProperty.call(this.yy,et)&&(U.yy[et]=this.yy[et]);R.setInput(y,U.yy),U.yy.lexer=R,U.yy.parser=this,typeof R.yylloc>"u"&&(R.yylloc={});var rt=R.yylloc;o.push(rt);var oe=R.options&&R.options.ranges;typeof U.yy.parseError=="function"?this.parseError=U.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function he(X){p.length=p.length-2*X,E.length=E.length-X,o.length=o.length-X}d(he,"popStack");function It(){var X;return X=S.pop()||R.lex()||P,typeof X!="number"&&(X instanceof Array&&(S=X,X=S.pop()),X=u.symbols_[X]||X),X}d(It,"lex");for(var H,$,V,ft,tt={},ct,J,Bt,ot;;){if($=p[p.length-1],this.defaultActions[$]?V=this.defaultActions[$]:((H===null||typeof H>"u")&&(H=It()),V=k[$]&&k[$][H]),typeof V>"u"||!V.length||!V[0]){var xt="";ot=[];for(ct in k[$])this.terminals_[ct]&&ct>K&&ot.push("'"+this.terminals_[ct]+"'");R.showPosition?xt="Parse error on line "+(D+1)+`:
2
2
  `+R.showPosition()+`
3
3
  Expecting `+ot.join(", ")+", got '"+(this.terminals_[H]||H)+"'":xt="Parse error on line "+(D+1)+": Unexpected "+(H==P?"end of input":"'"+(this.terminals_[H]||H)+"'"),this.parseError(xt,{text:R.match,token:this.terminals_[H]||H,line:R.yylineno,loc:rt,expected:ot})}if(V[0]instanceof Array&&V.length>1)throw new Error("Parse Error: multiple actions possible at state: "+$+", token: "+H);switch(V[0]){case 1:p.push(H),E.push(R.yytext),o.push(R.yylloc),p.push(V[1]),H=null,T=R.yyleng,g=R.yytext,D=R.yylineno,rt=R.yylloc;break;case 2:if(J=this.productions_[V[1]][1],tt.$=E[E.length-J],tt._$={first_line:o[o.length-(J||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(J||1)].first_column,last_column:o[o.length-1].last_column},oe&&(tt._$.range=[o[o.length-(J||1)].range[0],o[o.length-1].range[1]]),ft=this.performAction.apply(tt,[g,T,D,U.yy,V[1],E,o].concat(Q)),typeof ft<"u")return ft;J&&(p=p.slice(0,-1*J*2),E=E.slice(0,-1*J),o=o.slice(0,-1*J)),p.push(this.productions_[V[1]][0]),E.push(tt.$),o.push(tt._$),Bt=k[p[p.length-2]][p[p.length-1]],p.push(Bt);break;case 3:return!0}}return!0},"parse")},B=(function(){var N={EOF:1,parseError:d(function(u,p){if(this.yy.parser)this.yy.parser.parseError(u,p);else throw new Error(u)},"parseError"),setInput:d(function(y,u){return this.yy=u||this.yy||{},this._input=y,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:d(function(){var y=this._input[0];this.yytext+=y,this.yyleng++,this.offset++,this.match+=y,this.matched+=y;var u=y.match(/(?:\r\n?|\n).*/g);return u?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),y},"input"),unput:d(function(y){var u=y.length,p=y.split(/(?:\r\n?|\n)/g);this._input=y+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-u),this.offset-=u;var S=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),p.length-1&&(this.yylineno-=p.length-1);var E=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:p?(p.length===S.length?this.yylloc.first_column:0)+S[S.length-p.length].length-p[0].length:this.yylloc.first_column-u},this.options.ranges&&(this.yylloc.range=[E[0],E[0]+this.yyleng-u]),this.yyleng=this.yytext.length,this},"unput"),more:d(function(){return this._more=!0,this},"more"),reject:d(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:d(function(y){this.unput(this.match.slice(y))},"less"),pastInput:d(function(){var y=this.matched.substr(0,this.matched.length-this.match.length);return(y.length>20?"...":"")+y.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:d(function(){var y=this.match;return y.length<20&&(y+=this._input.substr(0,20-y.length)),(y.substr(0,20)+(y.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:d(function(){var y=this.pastInput(),u=new Array(y.length+1).join("-");return y+this.upcomingInput()+`