semantic-atlas 2.8.1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/.agents/skills/semantic-atlas/SKILL.md +113 -281
  2. package/.agents/skills/semantic-atlas/agents/openai.yaml +2 -2
  3. package/.agents/skills/semantic-atlas/references/boundary-design.md +58 -0
  4. package/.agents/skills/semantic-atlas/references/diagram-design.md +172 -0
  5. package/.agents/skills/semantic-atlas/references/map-authoring.md +174 -0
  6. package/.agents/skills/semantic-atlas/references/observations.md +23 -49
  7. package/.agents/skills/semantic-atlas/references/reconciliation.md +77 -0
  8. package/README.md +56 -90
  9. package/README.zh-CN.md +50 -58
  10. package/dist/application/map-application.d.ts +3 -1
  11. package/dist/application/map-application.d.ts.map +1 -1
  12. package/dist/application/map-application.js +59 -0
  13. package/dist/application/map-application.js.map +1 -1
  14. package/dist/cli/localized-command.js +4 -0
  15. package/dist/cli/localized-command.js.map +1 -1
  16. package/dist/cli/run-cli.d.ts +2 -0
  17. package/dist/cli/run-cli.d.ts.map +1 -1
  18. package/dist/cli/run-cli.js +87 -10
  19. package/dist/cli/run-cli.js.map +1 -1
  20. package/dist/contracts/cli.d.ts +14 -2
  21. package/dist/contracts/cli.d.ts.map +1 -1
  22. package/dist/contracts/flow-navigation.d.ts +48 -0
  23. package/dist/contracts/flow-navigation.d.ts.map +1 -0
  24. package/dist/contracts/flow-navigation.js +2 -0
  25. package/dist/contracts/flow-navigation.js.map +1 -0
  26. package/dist/contracts/map.d.ts +10 -9
  27. package/dist/contracts/map.d.ts.map +1 -1
  28. package/dist/contracts/map.js +3 -1
  29. package/dist/contracts/map.js.map +1 -1
  30. package/dist/contracts/project.d.ts +13 -0
  31. package/dist/contracts/project.d.ts.map +1 -1
  32. package/dist/i18n/index.d.ts +36 -196
  33. package/dist/i18n/index.d.ts.map +1 -1
  34. package/dist/i18n/locales/en/cli.d.ts +6 -0
  35. package/dist/i18n/locales/en/cli.d.ts.map +1 -1
  36. package/dist/i18n/locales/en/cli.js +8 -2
  37. package/dist/i18n/locales/en/cli.js.map +1 -1
  38. package/dist/i18n/locales/en/errors.d.ts +5 -0
  39. package/dist/i18n/locales/en/errors.d.ts.map +1 -1
  40. package/dist/i18n/locales/en/errors.js +6 -1
  41. package/dist/i18n/locales/en/errors.js.map +1 -1
  42. package/dist/i18n/locales/en/viewer.d.ts +7 -98
  43. package/dist/i18n/locales/en/viewer.d.ts.map +1 -1
  44. package/dist/i18n/locales/en/viewer.js +14 -105
  45. package/dist/i18n/locales/en/viewer.js.map +1 -1
  46. package/dist/i18n/locales/zh-CN/cli.d.ts +6 -0
  47. package/dist/i18n/locales/zh-CN/cli.d.ts.map +1 -1
  48. package/dist/i18n/locales/zh-CN/cli.js +8 -2
  49. package/dist/i18n/locales/zh-CN/cli.js.map +1 -1
  50. package/dist/i18n/locales/zh-CN/errors.d.ts +5 -0
  51. package/dist/i18n/locales/zh-CN/errors.d.ts.map +1 -1
  52. package/dist/i18n/locales/zh-CN/errors.js +6 -1
  53. package/dist/i18n/locales/zh-CN/errors.js.map +1 -1
  54. package/dist/i18n/locales/zh-CN/viewer.d.ts +7 -98
  55. package/dist/i18n/locales/zh-CN/viewer.d.ts.map +1 -1
  56. package/dist/i18n/locales/zh-CN/viewer.js +14 -105
  57. package/dist/i18n/locales/zh-CN/viewer.js.map +1 -1
  58. package/dist/index.d.ts +3 -1
  59. package/dist/index.d.ts.map +1 -1
  60. package/dist/index.js.map +1 -1
  61. package/dist/map/business-flow-validator.js +21 -7
  62. package/dist/map/business-flow-validator.js.map +1 -1
  63. package/dist/map/map-validator.js +2 -0
  64. package/dist/map/map-validator.js.map +1 -1
  65. package/dist/projects/project-directory.d.ts +15 -0
  66. package/dist/projects/project-directory.d.ts.map +1 -0
  67. package/dist/projects/project-directory.js +119 -0
  68. package/dist/projects/project-directory.js.map +1 -0
  69. package/dist/query/concept-search-service.d.ts +1 -1
  70. package/dist/query/concept-search-service.d.ts.map +1 -1
  71. package/dist/query/concept-search-service.js +2 -2
  72. package/dist/query/concept-search-service.js.map +1 -1
  73. package/dist/query/flow-navigation-service.d.ts +16 -0
  74. package/dist/query/flow-navigation-service.d.ts.map +1 -0
  75. package/dist/query/flow-navigation-service.js +96 -0
  76. package/dist/query/flow-navigation-service.js.map +1 -0
  77. package/dist/query/flow-search-service.d.ts +9 -0
  78. package/dist/query/flow-search-service.d.ts.map +1 -0
  79. package/dist/query/flow-search-service.js +69 -0
  80. package/dist/query/flow-search-service.js.map +1 -0
  81. package/dist/rendering/flow-projector.d.ts +1 -0
  82. package/dist/rendering/flow-projector.d.ts.map +1 -1
  83. package/dist/rendering/flow-projector.js +73 -181
  84. package/dist/rendering/flow-projector.js.map +1 -1
  85. package/dist/rendering/map-projector.d.ts +4 -5
  86. package/dist/rendering/map-projector.d.ts.map +1 -1
  87. package/dist/rendering/map-projector.js +12 -289
  88. package/dist/rendering/map-projector.js.map +1 -1
  89. package/dist/rendering/viewer-browser.d.ts.map +1 -1
  90. package/dist/rendering/viewer-browser.js +517 -556
  91. package/dist/rendering/viewer-browser.js.map +1 -1
  92. package/dist/rendering/viewer-diagram.d.ts +3 -5
  93. package/dist/rendering/viewer-diagram.d.ts.map +1 -1
  94. package/dist/rendering/viewer-diagram.js +30 -93
  95. package/dist/rendering/viewer-diagram.js.map +1 -1
  96. package/dist/rendering/viewer-layout.d.ts +9 -5
  97. package/dist/rendering/viewer-layout.d.ts.map +1 -1
  98. package/dist/rendering/viewer-layout.js +107 -52
  99. package/dist/rendering/viewer-layout.js.map +1 -1
  100. package/dist/rendering/viewer-navigation.d.ts +4 -0
  101. package/dist/rendering/viewer-navigation.d.ts.map +1 -0
  102. package/dist/rendering/viewer-navigation.js +8 -0
  103. package/dist/rendering/viewer-navigation.js.map +1 -0
  104. package/dist/rendering/viewer-page.d.ts +12 -28
  105. package/dist/rendering/viewer-page.d.ts.map +1 -1
  106. package/dist/rendering/viewer-page.js +133 -563
  107. package/dist/rendering/viewer-page.js.map +1 -1
  108. package/dist/setup/managed-skill-installer.d.ts +1 -1
  109. package/dist/setup/managed-skill-installer.d.ts.map +1 -1
  110. package/dist/setup/managed-skill-installer.js +1 -1
  111. package/dist/setup/managed-skill-installer.js.map +1 -1
  112. package/dist/setup/package-upgrader.d.ts.map +1 -1
  113. package/dist/setup/package-upgrader.js +1 -4
  114. package/dist/setup/package-upgrader.js.map +1 -1
  115. package/dist/web/local-web-application.d.ts.map +1 -1
  116. package/dist/web/local-web-application.js +6 -31
  117. package/dist/web/local-web-application.js.map +1 -1
  118. package/docs/architecture.md +99 -179
  119. package/docs/evaluation.md +44 -4
  120. package/docs/index.md +9 -2
  121. package/docs/map-format.md +65 -27
  122. package/docs/observations.md +7 -3
  123. package/docs/product-contract.md +76 -103
  124. package/examples//350/256/242/345/215/225/347/256/241/347/220/206/README.md +17 -0
  125. package/examples//350/256/242/345/215/225/347/256/241/347/220/206/docs/business-map/orders.yaml +276 -0
  126. package/package.json +3 -4
  127. package/.agents/skills/semantic-atlas-maintenance/SKILL.md +0 -218
  128. package/.agents/skills/semantic-atlas-maintenance/agents/openai.yaml +0 -4
  129. package/.agents/skills/semantic-atlas-maintenance/references/boundary-design.md +0 -120
  130. package/.agents/skills/semantic-atlas-maintenance/references/map-authoring.md +0 -127
  131. package/.agents/skills/semantic-atlas-maintenance/references/reconciliation.md +0 -149
  132. package/dist/rendering/diagram-image.d.ts +0 -17
  133. package/dist/rendering/diagram-image.d.ts.map +0 -1
  134. package/dist/rendering/diagram-image.js +0 -102
  135. package/dist/rendering/diagram-image.js.map +0 -1
  136. package/dist/rendering/manual-layout.d.ts +0 -4
  137. package/dist/rendering/manual-layout.d.ts.map +0 -1
  138. package/dist/rendering/manual-layout.js +0 -72
  139. package/dist/rendering/manual-layout.js.map +0 -1
  140. package/dist/rendering/map-camera.d.ts +0 -26
  141. package/dist/rendering/map-camera.d.ts.map +0 -1
  142. package/dist/rendering/map-camera.js +0 -54
  143. package/dist/rendering/map-camera.js.map +0 -1
  144. package/dist/rendering/viewer-legend.d.ts +0 -4
  145. package/dist/rendering/viewer-legend.d.ts.map +0 -1
  146. package/dist/rendering/viewer-legend.js +0 -138
  147. package/dist/rendering/viewer-legend.js.map +0 -1
@@ -1,127 +0,0 @@
1
- # Business Map Authoring
2
-
3
- Use this reference when encoding a confirmed business partition. The Skill owns
4
- the workflow; [boundary-design.md](boundary-design.md) supplies boundary judgment.
5
- This page supplies the version 1 authoring shape. The installed package's
6
- `docs/map-format.md` defines the complete format, and `semantic-atlas validate`
7
- checks all documents together.
8
-
9
- ## Document And Concept Shape
10
-
11
- Store each owning document at `docs/business-map/<business-area>.yaml`.
12
- `map.id` identifies that document; only nodes create business graph elements.
13
- For each evidenced business area, adapt this minimal shape:
14
-
15
- ```yaml
16
- schemaVersion: 1
17
- map:
18
- id: support
19
- title: Customer support
20
- summary: Resolve customer support requests.
21
- nodes:
22
- - id: support
23
- kind: domain
24
- name: Customer support
25
- summary: Help customers resolve service problems.
26
- aliases: []
27
- anchors:
28
- - kind: document
29
- value: README.md
30
- description: Current product purpose and rules.
31
- - id: support.resolve-request
32
- kind: scenario
33
- name: Resolve request
34
- summary: A customer request reaches a supported resolution.
35
- aliases: []
36
- anchors:
37
- - kind: symbol
38
- file: src/support/resolve-request.ts
39
- value: resolveRequest
40
- description: Apply the supported resolution to a customer request.
41
- relations:
42
- - from: support.resolve-request
43
- type: part_of
44
- to: support
45
- summary: Request resolution belongs to customer support.
46
- flows:
47
- - id: support.resolve-request.flow
48
- name: Resolve request
49
- summary: Complete a supported customer request.
50
- scenario: support.resolve-request
51
- startsAt: resolve
52
- steps:
53
- - id: resolve
54
- kind: action
55
- name: Resolve request
56
- summary: Apply the supported resolution.
57
- concept: support.resolve-request
58
- - id: resolved
59
- kind: outcome
60
- name: Request resolved
61
- summary: The customer request is resolved.
62
- transitions:
63
- - from: resolve
64
- to: resolved
65
- ```
66
-
67
- Use evidence-backed names, summaries and flows rather than retaining illustrative
68
- Support meaning. Document `relations` and `flows`, and node `aliases` and `anchors`, may be
69
- empty when the evidence supplies no entries.
70
- Every node needs `id`, `kind`, `name`, `summary`, `aliases`, and `anchors`.
71
- IDs use lowercase business vocabulary separated by dots or hyphens and remain
72
- unique across the repository. Node kinds are `domain`, `capability`, `scenario`,
73
- `operation`, `data`, `invariant`, and `interface`.
74
-
75
- ## Navigation Anchors
76
-
77
- Anchors contain `kind`, `value`, and `description`. Kinds are `file`, `directory`,
78
- `document`, `symbol`, and `search`. A `symbol` may also include `file`, a
79
- normalized repository-relative source path; other kinds use only the three
80
- common fields. Its `value` names the declaration, such as
81
- `SupportService.resolveRequest` or the module function `resolveRequest`.
82
- Use the owning class or type when needed to distinguish same-named methods.
83
- The name follows the source language's vocabulary rather than a parser syntax.
84
-
85
- Prefer a file-bound symbol when current source establishes the method or
86
- function that carries a mapped business action. Open that declaration and
87
- confirm its responsibility before writing the anchor; `description` states
88
- the action, rule or state change a future task should inspect there. The
89
- Viewer shows this pair as `file#value`; the Agent locates the current declaration
90
- and body through normal repository tools. Retain the file and symbol name as
91
- navigation hints while current source supplies line locations and behavior.
92
-
93
- Choose the anchor granularity that serves the business concept: a domain can
94
- point to its directory, a data concept to its declaration file, and a durable
95
- rule to its product document. File-like `value` fields remain normalized
96
- repository-relative paths. Existing unbound symbols and file references stay
97
- valid; improve them during maintenance when evidence identifies a more precise
98
- business entry. A valid node can retain an empty anchor list when no supported
99
- location is available.
100
-
101
- ## Relations And Flows
102
-
103
- `part_of` points from child to parent, gives a concept at most one parent, and
104
- keeps domain roots top-level. It describes business containment, not execution.
105
- Use existing node IDs for every relation endpoint:
106
-
107
- - `invokes`: scenario/operation to scenario/operation;
108
- - `reads` / `writes`: scenario/operation to data;
109
- - `publishes` / `consumes`: capability/scenario/operation to interface;
110
- - `constrained_by`: business concept to invariant.
111
-
112
- Each relation includes `from`, `type`, `to`, and a business `summary`. Even a
113
- consumer's `consumes` relation points **to the interface**, not from it.
114
- The source concept owns the relation, including when its target is in another
115
- YAML. Shared concepts stay defined once in their own document.
116
-
117
- A flow belongs to an existing `scenario` and lives beside it. Steps have `id`,
118
- `kind`, `name`, `summary`, and optional `concept` referencing a repository-wide
119
- node. Actions have at most one unlabeled next transition; decisions have at
120
- least two transitions with distinct nonempty `when` labels; outcomes end paths.
121
- All steps must be reachable from `startsAt`. Preserve source-supported business
122
- branches, including refusals; use flows for durable outcomes rather than
123
- helpers or framework control flow.
124
-
125
- Run complete-graph validation and inspect each rendered domain and related flow.
126
- Separate YAML filenames organize review; distinct domain nodes and correct
127
- `part_of` relations make the business areas selectable in the Viewer.
@@ -1,149 +0,0 @@
1
- # Reconciliation Evidence Guide
2
-
3
- Use this guide for candidate reconciliation after loading the versioned report
4
- and selecting one business domain. Apply the Skill's common business-ownership
5
- rules to this domain before selecting files or accepting its recorded ownership.
6
-
7
- ## Read Candidate Provenance
8
-
9
- Each candidate group represents one exact domain, kind, and proposed summary.
10
- Every origin retains:
11
-
12
- - its task-observation ID, task/run identity, and candidate position;
13
- - the candidate-specific evidence and `confirmed`, `contradicted`, or
14
- `unresolved` disposition;
15
- - the task's map queries and current-evidence dispositions;
16
- - any task or review human correction;
17
- - every linked independent review and its accuracy assessment.
18
- - earlier unresolved maintenance classifications and current evidence, when
19
- the candidate group has become actionable again through a new origin.
20
-
21
- `confirmed` says task-time evidence supported the proposed correction.
22
- `contradicted` says current evidence contradicted the mapped statement that the
23
- candidate proposes to replace. `unresolved` identifies a useful lead whose
24
- stable meaning was not established. These task dispositions organize the
25
- maintenance investigation; independent review remains the correctness
26
- authority for the engineering run that produced them.
27
-
28
- ## Decide Whether Meaning Is Durable
29
-
30
- A correction belongs in the shared map when future tasks can independently
31
- name, navigate to, depend on, constrain, read, write, publish, consume, or
32
- change it. Keep methods, helpers, SQL details, folders, framework components,
33
- temporary migrations, and one-off execution state as implementation-local
34
- evidence.
35
-
36
- Use current tracked product documents for durable intent and current source and
37
- tests for implemented collaboration. Use runtime evidence when the conclusion
38
- depends on deployed state. When these sources disagree, state the disagreement
39
- and leave the candidate unresolved until the owning authority can decide it.
40
-
41
- ## Classify Current Evidence
42
-
43
- Classify every selected origin against current durable meaning:
44
-
45
- - `accepted`: current evidence supports the proposed durable correction;
46
- - `refined`: current evidence supports a narrower or differently worded durable
47
- correction;
48
- - `discarded`: current evidence shows implementation-local, obsolete, or
49
- unsupported meaning that does not belong in the shared map;
50
- - `unresolved`: available evidence cannot yet establish stable business meaning.
51
-
52
- A correct discarded or unresolved conclusion is complete and may have no map
53
- change. Keep that meaning outside the canonical map.
54
-
55
- ## Handle Drift And Duplicates
56
-
57
- - A stale anchor can be accepted when the business concept remains durable and
58
- current source provides the replacement navigation hint.
59
- - A contradicted relation can be replaced after both current endpoints and the
60
- relation direction are confirmed.
61
- - A missing concept can be added when current evidence establishes stable
62
- business identity, ownership, and meaning rather than only a source symbol.
63
- - A flow can be added or corrected when durable evidence establishes the
64
- scenario's business-relevant actions, decisions, labeled branches, and
65
- outcomes. Keep the flow at business granularity and classify a source
66
- discrepancy before changing the canonical path.
67
- - A repository with `MAP_NOT_FOUND` can begin with one domain-owned map when
68
- current evidence establishes that domain and the selected bounded concepts.
69
- Cross-domain relations wait until both stable endpoints can join one valid
70
- graph.
71
- - A duplicate candidate keeps all provenance but produces one YAML edit.
72
- - A transient or implementation-local observation is discarded with a concise
73
- evidence-backed reason and produces no map change.
74
-
75
- ## Keep One Candidate Domain Review Surface
76
-
77
- Edit or create one owning `docs/business-map/*.yaml` file for the selected
78
- domain when current evidence confirms that ownership. Reuse a file because its
79
- business meaning matches, and create the owning file for a new independent
80
- business domain. The Skill's common rules apply equally to an existing or
81
- initial map. When the evidence requires repartitioning existing files, prepare
82
- the complete normal authoring/reorganization Git candidate and report retained
83
- origins separately; one `owningMapPath` must not stand for a multi-file result.
84
- The original observation stays immutable, and accurate origin reconciliation
85
- remains separate from that authoring delivery. Validate the complete graph because
86
- relation endpoints and containment remain repository-wide even when the Git
87
- diff is local. Render the changed graph and inspect the selected neighborhood.
88
- The final Git diff is the independent review surface; retained observation
89
- artifacts stay unchanged.
90
-
91
- ## Record The Reviewed Outcome
92
-
93
- A maintenance observation settles retained candidates, not a general map-authoring
94
- run. Direct authoring without retained origins uses Git review and integration
95
- evidence. Ownership reorganization likewise keeps its complete Git diff distinct
96
- from the single-domain result contract. Retain exact candidate identities and
97
- report pending reconciliation when the change cannot truthfully be represented
98
- by the current result shape.
99
-
100
- One maintenance result identifies an exact source with both
101
- `taskObservationId` and zero-based `candidateIndex`. Repeated summaries do not
102
- replace this identity. The command rejects a missing source or a source owned by
103
- another `businessDomainId`.
104
-
105
- Use this shape after independent review and integration:
106
-
107
- ```json
108
- {
109
- "schemaVersion": 1,
110
- "id": "maintenance-observation-id",
111
- "recordedAt": "2026-08-31T08:00:00.000Z",
112
- "maintenance": {
113
- "taskId": "maintenance-task-id",
114
- "runId": "integration-run-id"
115
- },
116
- "businessDomainId": "commerce",
117
- "results": [
118
- {
119
- "candidate": {
120
- "taskObservationId": "task-observation-id",
121
- "candidateIndex": 0
122
- },
123
- "status": "accepted",
124
- "reason": "Current source confirms the durable business meaning.",
125
- "evidence": [
126
- { "kind": "source", "reference": "src/orders/place-order.ts" }
127
- ]
128
- }
129
- ],
130
- "mapChange": {
131
- "owningMapPath": "docs/business-map/commerce.yaml",
132
- "mergedCommit": "MERGED_COMMIT_HEX"
133
- }
134
- }
135
- ```
136
-
137
- Replace `MERGED_COMMIT_HEX` with the full hexadecimal commit that actually
138
- merged the reviewed map change before submitting the observation.
139
-
140
- `accepted` and `refined` require `mapChange`; a document containing only
141
- `discarded` and `unresolved` results omits it. Every result needs a concise
142
- reason and at least one current evidence reference. One document lists each
143
- exact candidate source once.
144
-
145
- The reconciliation report exposes only actionable groups in `domains`.
146
- `waitingForEvidenceOccurrences` counts unresolved sources for which no new
147
- origin has appeared. A new origin with the same domain, kind, and summary makes
148
- the group actionable again and returns the earlier unresolved history beside
149
- the new evidence.
@@ -1,17 +0,0 @@
1
- import type { toBlob } from "html-to-image";
2
- import type { DiagramSize } from "./viewer-layout.js";
3
- declare const t: (key: string, values?: Record<string, unknown>) => string;
4
- export interface DiagramImagePlan extends DiagramSize {
5
- readonly pixelWidth: number;
6
- readonly pixelHeight: number;
7
- }
8
- /** 只使用完整布局尺寸,屏幕大小和相机缩放不参与图片分辨率计算。 */
9
- export declare function planDiagramImage(bounds: DiagramSize, translate?: typeof t): DiagramImagePlan;
10
- /** 与布局入口一样,此函数会序列化到离线 Viewer,运行时依赖由参数传入。 */
11
- export declare function renderDiagramImage(view: HTMLElement, rasterize: typeof toBlob, planImage: typeof planDiagramImage, translate?: typeof t): Promise<{
12
- blob: Blob;
13
- width: number;
14
- height: number;
15
- }>;
16
- export {};
17
- //# sourceMappingURL=diagram-image.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"diagram-image.d.ts","sourceRoot":"","sources":["../../src/rendering/diagram-image.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,QAAA,MAAM,CAAC,2DAAsB,CAAC;AAK9B,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,qCAAqC;AACrC,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,OAAO,CAAC,GAAG,gBAAgB,CAsB5F;AAED,4CAA4C;AAC5C,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,WAAW,EACjB,SAAS,EAAE,OAAO,MAAM,EACxB,SAAS,EAAE,OAAO,gBAAgB,EAClC,SAAS,CAAC,EAAE,OAAO,CAAC,GACnB,OAAO,CAAC;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAiFxD"}
@@ -1,102 +0,0 @@
1
- import { getTranslator } from "../i18n/index.js";
2
- const t = getTranslator("en");
3
- // A local alias keeps serialized functions independent of module-loader rewrites.
4
- const defaultTranslate = t;
5
- /** 只使用完整布局尺寸,屏幕大小和相机缩放不参与图片分辨率计算。 */
6
- export function planDiagramImage(bounds, translate) {
7
- const width = Math.ceil(bounds.width);
8
- const height = Math.ceil(bounds.height);
9
- if (![width, height].every((value) => Number.isFinite(value) && value > 0)) {
10
- throw new Error((translate ?? defaultTranslate)("viewer.imageInvalidDimensions"));
11
- }
12
- // 同时限制边长和像素总量,避免大图分配数百 MB 以上的单个像素缓冲。
13
- const scale = Math.min(2, 16384 / width, 16384 / height, Math.sqrt(64_000_000 / (width * height)));
14
- if (scale < 1) {
15
- throw new Error((translate ?? defaultTranslate)("viewer.imageTooLarge"));
16
- }
17
- return {
18
- width,
19
- height,
20
- pixelWidth: Math.floor(width * scale),
21
- pixelHeight: Math.floor(height * scale),
22
- };
23
- }
24
- /** 与布局入口一样,此函数会序列化到离线 Viewer,运行时依赖由参数传入。 */
25
- export async function renderDiagramImage(view, rasterize, planImage, translate) {
26
- await document.fonts.ready;
27
- // 字体或翻译刚改变尺寸时,让 ResizeObserver 和布局帧先完成。
28
- await new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(() => resolve())));
29
- if (!view.isConnected || view.hidden) {
30
- throw new Error((translate ?? defaultTranslate)("viewer.imageSelectionChanged"));
31
- }
32
- const sourceSvg = view.querySelector("svg");
33
- if (!sourceSvg)
34
- throw new Error((translate ?? defaultTranslate)("viewer.imageNoDiagram"));
35
- const plan = planImage({
36
- width: Number(sourceSvg.dataset.canvasWidth),
37
- height: Number(sourceSvg.dataset.canvasHeight),
38
- }, translate);
39
- const snapshot = view.cloneNode(true);
40
- const svg = snapshot.querySelector("svg");
41
- const textLayer = snapshot.querySelector(".diagram-text-layer");
42
- // html-to-image 深克隆 SVG 时不复制子元素样式,先固定图形的实际绘制样式。
43
- const sourceShapes = Array.from(sourceSvg.querySelectorAll("*"));
44
- const shapes = Array.from(svg.querySelectorAll("*"));
45
- const paintProperties = [
46
- "fill",
47
- "fill-opacity",
48
- "stroke",
49
- "stroke-width",
50
- "stroke-opacity",
51
- "stroke-dasharray",
52
- "stroke-dashoffset",
53
- "stroke-linecap",
54
- "stroke-linejoin",
55
- "opacity",
56
- ];
57
- sourceShapes.forEach((source, index) => {
58
- const computed = getComputedStyle(source);
59
- for (const property of paintProperties) {
60
- const value = computed.getPropertyValue(property);
61
- const fragment = value.match(/url\(["']?[^)]*#([^"')]+)["']?\)/u);
62
- shapes[index].style.setProperty(property, fragment ? `url(#${fragment[1]})` : value);
63
- }
64
- shapes[index].style.transition = "none";
65
- });
66
- svg.setAttribute("viewBox", `0 0 ${plan.width} ${plan.height}`);
67
- textLayer.style.transform = "none";
68
- Object.assign(snapshot.style, {
69
- position: "fixed",
70
- inset: "auto",
71
- left: "-100000px",
72
- top: "0",
73
- width: `${plan.width}px`,
74
- height: `${plan.height}px`,
75
- pointerEvents: "none",
76
- });
77
- snapshot.setAttribute("aria-hidden", "true");
78
- snapshot.setAttribute("inert", "");
79
- document.body.append(snapshot);
80
- try {
81
- const blob = await rasterize(snapshot, {
82
- width: plan.width,
83
- height: plan.height,
84
- canvasWidth: plan.pixelWidth,
85
- canvasHeight: plan.pixelHeight,
86
- pixelRatio: 1,
87
- skipAutoScale: true,
88
- // Viewer 使用系统字体;导出无需扫描其他扩展注入的远程字体样式表。
89
- skipFonts: true,
90
- backgroundColor: "#f8f5ed",
91
- // 同时清除物理和逻辑偏移,避免计算样式里的 inset-inline 把图片移出画布。
92
- style: { position: "relative", inset: "auto", insetInline: "auto", insetBlock: "auto" },
93
- });
94
- if (!blob || blob.size === 0)
95
- throw new Error((translate ?? defaultTranslate)("viewer.imageCreationFailed"));
96
- return { blob, width: plan.pixelWidth, height: plan.pixelHeight };
97
- }
98
- finally {
99
- snapshot.remove();
100
- }
101
- }
102
- //# sourceMappingURL=diagram-image.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"diagram-image.js","sourceRoot":"","sources":["../../src/rendering/diagram-image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAIjD,MAAM,CAAC,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;AAE9B,kFAAkF;AAClF,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAO3B,qCAAqC;AACrC,MAAM,UAAU,gBAAgB,CAAC,MAAmB,EAAE,SAAoB;IACxE,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACtC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACxC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC;QAC3E,MAAM,IAAI,KAAK,CAAC,CAAC,SAAS,IAAI,gBAAgB,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC;IACpF,CAAC;IACD,qCAAqC;IACrC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CACpB,CAAC,EACD,KAAK,GAAG,KAAK,EACb,KAAK,GAAG,MAAM,EACd,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,CACzC,CAAC;IACF,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,CAAC,SAAS,IAAI,gBAAgB,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO;QACL,KAAK;QACL,MAAM;QACN,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,C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agramPoint } from "./viewer-layout.js";
2
- /** 只改变浏览器布局;业务图和自动布局保留为还原依据。 */
3
- export declare function repositionDiagram(base: DiagramLayout, spec: DiagramLayoutSpec, offsets: Readonly<Record<string, DiagramPoint>>): DiagramLayout;
4
- //# sourceMappingURL=manual-layout.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"manual-layout.d.ts","sourceRoot":"","sources":["../../src/rendering/manual-layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEzF,gCAAgC;AAChC,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,aAAa,EACnB,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,GAC9C,aAAa,CAsEf"}
@@ -1,72 +0,0 @@
1
- /** 只改变浏览器布局;业务图和自动布局保留为还原依据。 */
2
- export function repositionDiagram(base, spec, offsets) {
3
- if (Object.keys(offsets).length === 0)
4
- return base;
5
- const zero = { x: 0, y: 0 };
6
- const nodes = base.nodes.map((node) => {
7
- const delta = offsets[node.id] ?? zero;
8
- return { ...node, x: node.x + delta.x, y: node.y + delta.y };
9
- });
10
- const nodeById = new Map(nodes.map((node) => [node.id, node]));
11
- const definitionById = new Map(spec.nodes.map((node) => [node.id, node]));
12
- const edgeById = new Map(spec.edges.map((edge) => [edge.id, edge]));
13
- function connectBoundary(points, id, start) {
14
- const node = nodeById.get(id);
15
- const adjacent = points[start ? 1 : points.length - 2];
16
- const dx = adjacent.x - node.x;
17
- const dy = adjacent.y - node.y;
18
- const horizontal = Math.abs(dx) / (node.width / 2);
19
- const vertical = Math.abs(dy) / (node.height / 2);
20
- const distance = definitionById.get(id).kind === "decision"
21
- ? horizontal + vertical
22
- : Math.max(horizontal, vertical);
23
- points[start ? 0 : points.length - 1] =
24
- distance === 0
25
- ? { x: node.x + node.width / 2, y: node.y }
26
- : { x: node.x + dx / distance, y: node.y + dy / distance };
27
- }
28
- const edges = base.edges.map((edge) => {
29
- const definition = edgeById.get(edge.id);
30
- const from = offsets[definition.from] ?? zero;
31
- const to = offsets[definition.to] ?? zero;
32
- if (from === zero && to === zero)
33
- return edge;
34
- // 沿原路由逐渐分配两端位移,保留平行关系和循环的独立走线。
35
- const points = edge.points.map((point, index) => {
36
- const ratio = index / (edge.points.length - 1);
37
- return {
38
- x: point.x + from.x * (1 - ratio) + to.x * ratio,
39
- y: point.y + from.y * (1 - ratio) + to.y * ratio,
40
- };
41
- });
42
- connectBoundary(points, definition.from, true);
43
- connectBoundary(points, definition.to, false);
44
- return { ...edge, points, x: edge.x + (from.x + to.x) / 2, y: edge.y + (from.y + to.y) / 2 };
45
- });
46
- const extents = [
47
- ...nodes.flatMap((node) => [
48
- { x: node.x - node.width / 2, y: node.y - node.height / 2 },
49
- { x: node.x + node.width / 2, y: node.y + node.height / 2 },
50
- ]),
51
- ...edges.flatMap((edge) => {
52
- const label = edgeById.get(edge.id);
53
- return [
54
- ...edge.points,
55
- { x: edge.x - label.width / 2, y: edge.y - label.height / 2 },
56
- { x: edge.x + label.width / 2, y: edge.y + label.height / 2 },
57
- ];
58
- }),
59
- ];
60
- const margin = 28;
61
- const offsetX = Math.max(base.offsetX, margin - Math.min(...extents.map(({ x }) => x)));
62
- const offsetY = Math.max(base.offsetY, margin - Math.min(...extents.map(({ y }) => y)));
63
- return {
64
- nodes,
65
- edges,
66
- offsetX,
67
- offsetY,
68
- width: Math.max(base.width, Math.max(...extents.map(({ x }) => x)) + offsetX + margin),
69
- height: Math.max(base.height, Math.max(...extents.map(({ y }) => y)) + offsetY + margin),
70
- };
71
- }
72
- //# sourceMappingURL=manual-layout.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"manual-layout.js","sourceRoot":"","sources":["../../src/rendering/manual-layout.ts"],"names":[],"mappings":"AAEA,gCAAgC;AAChC,MAAM,UAAU,iBAAiB,CAC/B,I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AAC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxF,OAAO;QACL,KAAK;QACL,KAAK;QACL,OAAO;QACP,OAAO;QACP,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,MAAM,CAAC;QACtF,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,MAAM,CAAC;KACzF,CAAC;AACJ,CAAC"}
@@ -1,26 +0,0 @@
1
- export interface MapViewBox {
2
- readonly x: number;
3
- readonly y: number;
4
- readonly width: number;
5
- readonly height: number;
6
- }
7
- export interface MapPoint {
8
- readonly x: number;
9
- readonly y: number;
10
- }
11
- export interface MapViewport {
12
- readonly width: number;
13
- readonly height: number;
14
- }
15
- export declare const MAP_SCALE_LIMITS: {
16
- readonly minimum: 0.2;
17
- readonly maximum: 4.8;
18
- };
19
- export declare function fitViewBox(bounds: MapViewBox): MapViewBox;
20
- export declare function zoomViewBoxAt(current: MapViewBox, bounds: MapViewBox, factor: number, anchor: MapPoint): MapViewBox;
21
- export declare function panViewBox(current: MapViewBox, pointerDelta: MapPoint, viewport: MapViewport): MapViewBox;
22
- export declare function mapPointFromViewport(viewportPoint: MapPoint, viewBox: MapViewBox, viewport: MapViewport): MapPoint;
23
- export declare function viewportScale(viewBox: MapViewBox, viewport: MapViewport): number;
24
- export declare function mapPointToViewport(point: MapPoint, viewBox: MapViewBox, viewport: MapViewport): MapPoint;
25
- export declare function clamp(value: number, minimum: number, maximum: number): number;
26
- //# sourceMappingURL=map-camera.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"map-camera.d.ts","sourceRoot":"","sources":["../../src/rendering/map-camera.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,gBAAgB;;;CAGnB,CAAC;AAEX,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAEzD;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,QAAQ,GACf,UAAU,CAkBZ;AAED,wBAAgB,UAAU,CACxB,OAAO,EAAE,UAAU,EACnB,YAAY,EAAE,QAAQ,EACtB,QAAQ,EAAE,WAAW,GACpB,UAAU,CAOZ;AAED,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,QAAQ,EACvB,OAAO,EAAE,UAAU,EACnB,QAAQ,EAAE,WAAW,GACpB,QAAQ,CAWV;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,GAAG,MAAM,CAEhF;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,QAAQ,EACf,OAAO,EAAE,UAAU,EACnB,QAAQ,EAAE,WAAW,GACpB,QAAQ,CAMV;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE7E"}
@@ -1,54 +0,0 @@
1
- export const MAP_SCALE_LIMITS = {
2
- minimum: 0.2,
3
- maximum: 4.8,
4
- };
5
- export function fitViewBox(bounds) {
6
- return { ...bounds };
7
- }
8
- export function zoomViewBoxAt(current, bounds, factor, anchor) {
9
- const currentScale = bounds.width / current.width;
10
- const targetScale = clamp(currentScale * factor, MAP_SCALE_LIMITS.minimum, MAP_SCALE_LIMITS.maximum);
11
- const targetWidth = bounds.width / targetScale;
12
- const targetHeight = (current.height * targetWidth) / current.width;
13
- const anchorRatioX = (anchor.x - current.x) / current.width;
14
- const anchorRatioY = (anchor.y - current.y) / current.height;
15
- return {
16
- x: anchor.x - anchorRatioX * targetWidth,
17
- y: anchor.y - anchorRatioY * targetHeight,
18
- width: targetWidth,
19
- height: targetHeight,
20
- };
21
- }
22
- export function panViewBox(current, pointerDelta, viewport) {
23
- const scale = viewportScale(current, viewport);
24
- return {
25
- ...current,
26
- x: current.x - pointerDelta.x / scale,
27
- y: current.y - pointerDelta.y / scale,
28
- };
29
- }
30
- export function mapPointFromViewport(viewportPoint, viewBox, viewport) {
31
- const scale = viewportScale(viewBox, viewport);
32
- const renderedWidth = viewBox.width * scale;
33
- const renderedHeight = viewBox.height * scale;
34
- const offsetX = (viewport.width - renderedWidth) / 2;
35
- const offsetY = (viewport.height - renderedHeight) / 2;
36
- return {
37
- x: viewBox.x + (viewportPoint.x - offsetX) / scale,
38
- y: viewBox.y + (viewportPoint.y - offsetY) / scale,
39
- };
40
- }
41
- export function viewportScale(viewBox, viewport) {
42
- return Math.min(viewport.width / viewBox.width, viewport.height / viewBox.height);
43
- }
44
- export function mapPointToViewport(point, viewBox, viewport) {
45
- const scale = viewportScale(viewBox, viewport);
46
- return {
47
- x: (point.x - viewBox.x) * scale + (viewport.width - viewBox.width * scale) / 2,
48
- y: (point.y - viewBox.y) * scale + (viewport.height - viewBox.height * scale) / 2,
49
- };
50
- }
51
- export function clamp(value, minimum, maximum) {
52
- return Math.min(maximum, Math.max(minimum, value));
53
- }
54
- //# sourceMappingURL=map-camera.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"map-camera.js","sourceRoot":"","sources":["../../src/rendering/map-camera.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,OAAO,EAAE,GAAG;IACZ,OAAO,EAAE,GAAG;CACJ,CAAC;AAEX,MAAM,UAAU,UAAU,CAAC,MAAkB;IAC3C,OAAO,EAAE,GAAG,MAAM,EAAE,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,OAAmB,EACnB,MAAkB,EAClB,MAAc,EACd,MAAgB;IAEhB,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAClD,MAAM,WAAW,GAAG,KAAK,CACvB,YAAY,GAAG,MAAM,EACrB,gBAAgB,CAAC,OAAO,EACxB,gBAAgB,CAAC,OAAO,CACzB,CAAC;IACF,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,GAAG,WAAW,CAAC;IAC/C,MAAM,YAAY,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,WAAW,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC;IACpE,MAAM,YAAY,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC;IAC5D,MAAM,YAAY,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAE7D,OAAO;QACL,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,YAAY,GA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AG,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AACpF,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,KAAe,EACf,OAAmB,EACnB,QAAqB;IAErB,MAAM,KAAK,GAAG,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC/C,OAAO;QACL,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,QAAQ,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC;QAC/E,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,QAAQ,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC;KAClF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,KAAa,EAAE,OAAe,EAAE,OAAe;IACnE,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AACrD,CAAC"}
@@ -1,4 +0,0 @@
1
- /** 与实际图形相同的线和形状配上业务例子,区分协作方向与流程顺序。 */
2
- export declare function renderViewerLegend(): string;
3
- export declare function viewerLegendStyles(): string;
4
- //# sourceMappingURL=viewer-legend.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"viewer-legend.d.ts","sourceRoot":"","sources":["../../src/rendering/viewer-legend.ts"],"names":[],"mappings":"AAMA,sCAAsC;AACtC,wBAAgB,kBAAkB,IAAI,MAAM,CA2B3C;AAsCD,wBAAgB,kBAAkB,IAAI,MAAM,CAyE3C"}