@docs-sdk-dev/reader 0.0.0-stage → 0.4.0-next.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 (108) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +97 -2
  3. package/dist/annotation-projection.d.ts +35 -0
  4. package/dist/annotation-projection.js +78 -0
  5. package/dist/annotation-projection.js.map +1 -0
  6. package/dist/artifacts.d.ts +19 -0
  7. package/dist/artifacts.js +33 -0
  8. package/dist/artifacts.js.map +1 -0
  9. package/dist/ask.d.ts +41 -0
  10. package/dist/ask.js +89 -0
  11. package/dist/ask.js.map +1 -0
  12. package/dist/collection-view.d.ts +190 -0
  13. package/dist/collection-view.js +170 -0
  14. package/dist/collection-view.js.map +1 -0
  15. package/dist/composition.d.ts +199 -0
  16. package/dist/composition.js +473 -0
  17. package/dist/composition.js.map +1 -0
  18. package/dist/condition.d.ts +17 -0
  19. package/dist/condition.js +61 -0
  20. package/dist/condition.js.map +1 -0
  21. package/dist/content-schema.d.ts +182 -0
  22. package/dist/content-schema.js +288 -0
  23. package/dist/content-schema.js.map +1 -0
  24. package/dist/context-search.d.ts +168 -0
  25. package/dist/context-search.js +73 -0
  26. package/dist/context-search.js.map +1 -0
  27. package/dist/context-store.d.ts +93 -0
  28. package/dist/context-store.js +438 -0
  29. package/dist/context-store.js.map +1 -0
  30. package/dist/dimension-runtime.d.ts +203 -0
  31. package/dist/dimension-runtime.js +737 -0
  32. package/dist/dimension-runtime.js.map +1 -0
  33. package/dist/dimensions.d.ts +84 -0
  34. package/dist/dimensions.js +136 -0
  35. package/dist/dimensions.js.map +1 -0
  36. package/dist/directory-navigation.d.ts +60 -0
  37. package/dist/directory-navigation.js +41 -0
  38. package/dist/directory-navigation.js.map +1 -0
  39. package/dist/directory-sections.d.ts +9 -0
  40. package/dist/directory-sections.js +76 -0
  41. package/dist/directory-sections.js.map +1 -0
  42. package/dist/document-reader.d.ts +1017 -0
  43. package/dist/document-reader.js +396 -0
  44. package/dist/document-reader.js.map +1 -0
  45. package/dist/document-selection.d.ts +412 -0
  46. package/dist/document-selection.js +45 -0
  47. package/dist/document-selection.js.map +1 -0
  48. package/dist/evidence.d.ts +102 -0
  49. package/dist/evidence.js +104 -0
  50. package/dist/evidence.js.map +1 -0
  51. package/dist/index.d.ts +19 -0
  52. package/dist/index.js +23 -0
  53. package/dist/model.d.ts +89 -0
  54. package/dist/model.js +31 -0
  55. package/dist/model.js.map +1 -0
  56. package/dist/module.d.ts +657 -0
  57. package/dist/module.js +199 -0
  58. package/dist/module.js.map +1 -0
  59. package/dist/navigation-view.d.ts +33 -0
  60. package/dist/navigation-view.js +68 -0
  61. package/dist/navigation-view.js.map +1 -0
  62. package/dist/node.d.ts +2004 -0
  63. package/dist/node.js +210 -0
  64. package/dist/node.js.map +1 -0
  65. package/dist/open-docs.d.ts +1396 -0
  66. package/dist/open-docs.js +198 -0
  67. package/dist/open-docs.js.map +1 -0
  68. package/dist/outline.d.ts +97 -0
  69. package/dist/outline.js +171 -0
  70. package/dist/outline.js.map +1 -0
  71. package/dist/persistence.d.ts +82 -0
  72. package/dist/persistence.js +377 -0
  73. package/dist/persistence.js.map +1 -0
  74. package/dist/projection-catalog.d.ts +23 -0
  75. package/dist/projection-catalog.js +45 -0
  76. package/dist/projection-catalog.js.map +1 -0
  77. package/dist/publication.d.ts +59 -0
  78. package/dist/publication.js +11 -0
  79. package/dist/publication.js.map +1 -0
  80. package/dist/reader.d.ts +236 -0
  81. package/dist/reader.js +400 -0
  82. package/dist/reader.js.map +1 -0
  83. package/dist/references.d.ts +54 -0
  84. package/dist/references.js +70 -0
  85. package/dist/references.js.map +1 -0
  86. package/dist/retrieval.d.ts +82 -0
  87. package/dist/retrieval.js +135 -0
  88. package/dist/retrieval.js.map +1 -0
  89. package/dist/search-view.d.ts +11 -0
  90. package/dist/search-view.js +30 -0
  91. package/dist/search-view.js.map +1 -0
  92. package/dist/search.d.ts +95 -0
  93. package/dist/search.js +234 -0
  94. package/dist/search.js.map +1 -0
  95. package/dist/semantic.d.ts +177 -0
  96. package/dist/semantic.js +104 -0
  97. package/dist/semantic.js.map +1 -0
  98. package/dist/skills.d.ts +21 -0
  99. package/dist/skills.js +42 -0
  100. package/dist/skills.js.map +1 -0
  101. package/docs/index.md +10 -0
  102. package/docs/sdk/composition.md +72 -0
  103. package/docs/sdk/reader-storage.md +70 -0
  104. package/docs/sdk/reader.md +99 -0
  105. package/docs/zh-CN/sdk/composition.md +72 -0
  106. package/docs/zh-CN/sdk/reader-storage.md +70 -0
  107. package/docs/zh-CN/sdk/reader.md +99 -0
  108. package/package.json +69 -4
package/dist/node.js ADDED
@@ -0,0 +1,210 @@
1
+ import { fileURLToPath } from "node:url";
2
+ import { createHash } from "node:crypto";
3
+ import { lstat, readFile, realpath } from "node:fs/promises";
4
+ import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
5
+ import { compareDocumentExports, decodeDocumentModule, isSoftwarePackageName, openDocumentModule, validateDocumentExports } from "./module.js";
6
+
7
+ // src/node.ts
8
+ const missing = (error) => error?.code === "ENOENT";
9
+ /** Resolve physical node_modules installs (including workspace symlinks) from the actual importing directory. */
10
+ async function findInstalledPackage(fromDirectory, name, options = {}) {
11
+ if (!isSoftwarePackageName(name)) throw new Error(`Invalid package name: ${name}`);
12
+ const boundary = options.projectRoot ? await realpath(options.projectRoot) : void 0;
13
+ async function metadata(directory) {
14
+ try {
15
+ const path = await realpath(join(directory, "package.json"));
16
+ if (boundary) within(boundary, path);
17
+ return JSON.parse(await readFile(path, "utf8"));
18
+ } catch (error) {
19
+ if (missing(error)) return;
20
+ throw error;
21
+ }
22
+ }
23
+ async function location(directory, manifest) {
24
+ if (manifest?.name !== name || typeof manifest.version !== "string" || !manifest.version) throw new Error(`Installed package does not identify ${name} and an exact version at ${directory}.`);
25
+ const path = await realpath(directory);
26
+ if (boundary && path !== boundary) within(boundary, path);
27
+ return {
28
+ directory: path,
29
+ manifest
30
+ };
31
+ }
32
+ let directory = await realpath(fromDirectory);
33
+ if (boundary && directory !== boundary) within(boundary, directory);
34
+ const ancestors = [];
35
+ for (;;) {
36
+ ancestors.push(directory);
37
+ const parent = dirname(directory);
38
+ if (parent === directory || boundary === directory) break;
39
+ directory = parent;
40
+ }
41
+ for (const current of ancestors) {
42
+ if (basename(current) === "node_modules") break;
43
+ const manifest = await metadata(current);
44
+ if (manifest === void 0) continue;
45
+ if (manifest?.name === name) return location(current, manifest);
46
+ break;
47
+ }
48
+ for (const current of ancestors) {
49
+ if (basename(current) === "node_modules") continue;
50
+ const directory = join(current, "node_modules", name);
51
+ try {
52
+ await lstat(directory);
53
+ } catch (error) {
54
+ if (missing(error)) continue;
55
+ throw error;
56
+ }
57
+ const manifest = await metadata(directory);
58
+ if (manifest === void 0) throw new Error(`Installed package metadata missing for ${name} at ${directory}.`);
59
+ return location(directory, manifest);
60
+ }
61
+ }
62
+ function declaration(value) {
63
+ const item = value;
64
+ if (!item || item.schemaVersion !== 1 || typeof item.inventoryRevision !== "string" || !/^[a-f0-9]{64}$/.test(item.inventoryRevision) || !(item.distribution === "embedded" || item.distribution === "sidecar" && typeof item.package === "string" && isSoftwarePackageName(item.package) || item.distribution === "remote" && typeof item.base === "string")) throw new Error("Invalid version 1 docsSdk package declaration.");
65
+ return item;
66
+ }
67
+ function relativeArtifact(path) {
68
+ if (!path || /[\\%?#:\x00-\x1f]/.test(path) || path.split("/").some((part) => !part || part === "." || part === "..")) throw new Error("Invalid relative documentation artifact path.");
69
+ return path;
70
+ }
71
+ function within(root, path) {
72
+ const child = relative(root, path);
73
+ if (!child || child === ".." || child.startsWith(".." + sep) || isAbsolute(child)) throw new Error("Documentation path escapes its package.");
74
+ return path;
75
+ }
76
+ function remoteBase(value) {
77
+ const url = new URL(value);
78
+ if (!["http:", "https:"].includes(url.protocol) || url.search || url.hash || url.username || url.password) throw new Error("Expected an HTTP(S) publication directory without credentials, query, or fragment.");
79
+ if (!url.pathname.endsWith("/")) url.pathname += "/";
80
+ return url.href;
81
+ }
82
+ var MissingPublication = class extends Error {};
83
+ /** A single operation sees each installed package declaration and opened publication exactly once. */
84
+ function createDocumentationResolver(fromDirectory, options = {}) {
85
+ const locations = /* @__PURE__ */ new Map();
86
+ const publications = /* @__PURE__ */ new Map();
87
+ function find(name) {
88
+ let location = locations.get(name);
89
+ if (!location) {
90
+ location = findInstalledPackage(fromDirectory, name, options).then((installed) => {
91
+ options.onInstallation?.({
92
+ from: fromDirectory,
93
+ name,
94
+ ...installed && {
95
+ version: installed.manifest.version,
96
+ manifest: join(installed.directory, "package.json")
97
+ }
98
+ });
99
+ return installed;
100
+ });
101
+ locations.set(name, location);
102
+ }
103
+ return location;
104
+ }
105
+ return {
106
+ find,
107
+ open(name) {
108
+ let publication = publications.get(name);
109
+ if (!publication) {
110
+ publication = openInstalled(name, find, options);
111
+ publications.set(name, publication);
112
+ }
113
+ return publication;
114
+ }
115
+ };
116
+ }
117
+ function discoverDocumentation(fromDirectory, name, options = {}) {
118
+ return createDocumentationResolver(fromDirectory, options).open(name);
119
+ }
120
+ /** Resolve documentation relative to an importing module, including nested installs. */
121
+ async function openPackageDocs(name, { from, ...options }) {
122
+ const file = new URL(from);
123
+ const path = fileURLToPath(file);
124
+ const result = await discoverDocumentation(file.pathname.endsWith("/") ? path : dirname(path), name, options);
125
+ if (result.status !== "opened") return result;
126
+ return {
127
+ status: result.status,
128
+ docs: result
129
+ };
130
+ }
131
+ async function openInstalled(name, find, options) {
132
+ const installed = await find(name);
133
+ if (!installed) return {
134
+ status: "package-missing",
135
+ package: name
136
+ };
137
+ const software = {
138
+ name,
139
+ version: installed.manifest.version
140
+ };
141
+ if (installed.manifest.docsSdk === void 0) return {
142
+ status: "declaration-missing",
143
+ software
144
+ };
145
+ const source = declaration(installed.manifest.docsSdk);
146
+ const inventoryRevision = source.inventoryRevision;
147
+ let readBytes;
148
+ if (source.distribution === "remote") {
149
+ const base = remoteBase(source.base);
150
+ if (!(options.remoteBases ?? []).some((allowed) => remoteBase(allowed) === base)) return {
151
+ status: "remote-denied",
152
+ software,
153
+ base
154
+ };
155
+ readBytes = async (path) => {
156
+ const encoded = relativeArtifact(path).split("/").map(encodeURIComponent).join("/");
157
+ const response = await fetch(new URL(inventoryRevision + "/" + encoded, base), {
158
+ redirect: "error",
159
+ credentials: "omit"
160
+ });
161
+ if (path === "artifacts.json" && (response.status === 404 || response.status === 410)) throw new MissingPublication();
162
+ if (!response.ok) throw new Error(`Missing remote documentation artifact ${path} (HTTP ${response.status}).`);
163
+ return new Uint8Array(await response.arrayBuffer());
164
+ };
165
+ } else {
166
+ const owner = source.distribution === "embedded" ? installed : await find(source.package);
167
+ if (!owner) return {
168
+ status: "sidecar-missing",
169
+ software
170
+ };
171
+ const release = await realpath(resolve(owner.directory, "docs", inventoryRevision)).catch((error) => {
172
+ if (missing(error)) return void 0;
173
+ throw error;
174
+ });
175
+ if (!release) return {
176
+ status: "publication-missing",
177
+ software,
178
+ inventoryRevision
179
+ };
180
+ const root = within(owner.directory, release);
181
+ readBytes = async (path) => {
182
+ try {
183
+ return await readFile(within(root, await realpath(join(root, relativeArtifact(path)))));
184
+ } catch (error) {
185
+ if (path === "artifacts.json" && missing(error)) throw new MissingPublication();
186
+ throw error;
187
+ }
188
+ };
189
+ }
190
+ try {
191
+ const module = await openDocumentModule(inventoryRevision, software, {
192
+ readBytes,
193
+ sha256: (bytes) => createHash("sha256").update(bytes).digest("hex")
194
+ });
195
+ return module.status === "opened" ? {
196
+ ...module,
197
+ directory: installed.directory
198
+ } : module;
199
+ } catch (error) {
200
+ if (error instanceof MissingPublication) return {
201
+ status: "publication-missing",
202
+ software,
203
+ inventoryRevision
204
+ };
205
+ throw error;
206
+ }
207
+ }
208
+
209
+ export { compareDocumentExports, createDocumentationResolver, decodeDocumentModule, discoverDocumentation, findInstalledPackage, isSoftwarePackageName, openDocumentModule, openPackageDocs, validateDocumentExports };
210
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.js","names":[],"sources":["../src/node.ts"],"sourcesContent":["import { fileURLToPath } from \"node:url\"\nimport { createHash } from \"node:crypto\"\nimport { lstat, readFile, realpath } from \"node:fs/promises\"\nimport { basename, dirname, isAbsolute, join, relative, resolve, sep } from \"node:path\"\nimport { isSoftwarePackageName, openDocumentModule } from \"./module.js\"\nexport * from \"./module.js\"\n\ntype Software = { name: string; version: string; docsSdk?: unknown }\ntype Location = { directory: string; manifest: Software }\nconst missing = (error: unknown) => (error as NodeJS.ErrnoException)?.code === \"ENOENT\"\n\n/** Resolve physical node_modules installs (including workspace symlinks) from the actual importing directory. */\nexport async function findInstalledPackage(\n fromDirectory: string,\n name: string,\n options: { projectRoot?: string } = {},\n): Promise<Location | undefined> {\n if (!isSoftwarePackageName(name)) throw new Error(`Invalid package name: ${name}`)\n const boundary = options.projectRoot ? await realpath(options.projectRoot) : undefined\n async function metadata(directory: string) {\n try {\n const path = await realpath(join(directory, \"package.json\"))\n if (boundary) within(boundary, path)\n return JSON.parse(await readFile(path, \"utf8\"))\n } catch (error) {\n if (missing(error)) return\n throw error\n }\n }\n async function location(directory: string, manifest: Software) {\n if (manifest?.name !== name || typeof manifest.version !== \"string\" || !manifest.version)\n throw new Error(\n `Installed package does not identify ${name} and an exact version at ${directory}.`,\n )\n const path = await realpath(directory)\n if (boundary && path !== boundary) within(boundary, path)\n return { directory: path, manifest }\n }\n let directory = await realpath(fromDirectory)\n if (boundary && directory !== boundary) within(boundary, directory)\n const ancestors = []\n for (;;) {\n ancestors.push(directory)\n const parent = dirname(directory)\n if (parent === directory || boundary === directory) break\n directory = parent\n }\n // Only the closest package scope can be a self-reference. An enclosing monorepo is a different package.\n for (const current of ancestors) {\n if (basename(current) === \"node_modules\") break\n const manifest = await metadata(current)\n if (manifest === undefined) continue\n if (manifest?.name === name) return location(current, manifest)\n break\n }\n for (const current of ancestors) {\n if (basename(current) === \"node_modules\") continue\n const directory = join(current, \"node_modules\", name)\n try {\n await lstat(directory)\n } catch (error) {\n if (missing(error)) continue\n throw error\n }\n const manifest = await metadata(directory)\n if (manifest === undefined)\n throw new Error(`Installed package metadata missing for ${name} at ${directory}.`)\n return location(directory, manifest)\n }\n}\n\ntype Declaration = { schemaVersion: 1; inventoryRevision: string } & (\n | { distribution: \"embedded\" }\n | { distribution: \"sidecar\"; package: string }\n | { distribution: \"remote\"; base: string }\n)\nfunction declaration(value: unknown): Declaration {\n const item = value as Partial<Declaration> | null\n if (\n !item ||\n item.schemaVersion !== 1 ||\n typeof item.inventoryRevision !== \"string\" ||\n !/^[a-f0-9]{64}$/.test(item.inventoryRevision) ||\n !(\n item.distribution === \"embedded\" ||\n (item.distribution === \"sidecar\" &&\n typeof item.package === \"string\" &&\n isSoftwarePackageName(item.package)) ||\n (item.distribution === \"remote\" && typeof item.base === \"string\")\n )\n )\n throw new Error(\"Invalid version 1 docsSdk package declaration.\")\n return item as Declaration\n}\n\nfunction relativeArtifact(path: string) {\n if (\n !path ||\n /[\\\\%?#:\\x00-\\x1f]/.test(path) ||\n path.split(\"/\").some((part) => !part || part === \".\" || part === \"..\")\n )\n throw new Error(\"Invalid relative documentation artifact path.\")\n return path\n}\nfunction within(root: string, path: string) {\n const child = relative(root, path)\n if (!child || child === \"..\" || child.startsWith(\"..\" + sep) || isAbsolute(child))\n throw new Error(\"Documentation path escapes its package.\")\n return path\n}\nfunction remoteBase(value: string) {\n const url = new URL(value)\n if (\n ![\"http:\", \"https:\"].includes(url.protocol) ||\n url.search ||\n url.hash ||\n url.username ||\n url.password\n )\n throw new Error(\n \"Expected an HTTP(S) publication directory without credentials, query, or fragment.\",\n )\n if (!url.pathname.endsWith(\"/\")) url.pathname += \"/\"\n return url.href\n}\n\nexport interface InstallationRead {\n from: string\n name: string\n version?: string\n manifest?: string\n}\nexport interface DiscoveryOptions {\n remoteBases?: readonly string[]\n projectRoot?: string\n /** Observe actual package lookups, including missing packages and nested import origins. */\n onInstallation?: (read: InstallationRead) => void\n}\nclass MissingPublication extends Error {}\n\n/** A single operation sees each installed package declaration and opened publication exactly once. */\nexport function createDocumentationResolver(fromDirectory: string, options: DiscoveryOptions = {}) {\n const locations = new Map<string, Promise<Location | undefined>>()\n const publications = new Map<string, ReturnType<typeof openInstalled>>()\n function find(name: string) {\n let location = locations.get(name)\n if (!location) {\n location = findInstalledPackage(fromDirectory, name, options).then((installed) => {\n options.onInstallation?.({\n from: fromDirectory,\n name,\n ...(installed && {\n version: installed.manifest.version,\n manifest: join(installed.directory, \"package.json\"),\n }),\n })\n return installed\n })\n locations.set(name, location)\n }\n return location\n }\n return {\n find,\n open(name: string) {\n let publication = publications.get(name)\n if (!publication) {\n publication = openInstalled(name, find, options)\n publications.set(name, publication)\n }\n return publication\n },\n }\n}\n\nexport function discoverDocumentation(\n fromDirectory: string,\n name: string,\n options: DiscoveryOptions = {},\n) {\n return createDocumentationResolver(fromDirectory, options).open(name)\n}\n\n/** Resolve documentation relative to an importing module, including nested installs. */\nexport async function openPackageDocs(\n name: string,\n { from, ...options }: DiscoveryOptions & { from: URL | string },\n) {\n const file = new URL(from)\n const path = fileURLToPath(file)\n const directory = file.pathname.endsWith(\"/\") ? path : dirname(path)\n const result = await discoverDocumentation(directory, name, options)\n if (result.status !== \"opened\") return result\n return { status: result.status, docs: result }\n}\n\nasync function openInstalled(\n name: string,\n find: (name: string) => Promise<Location | undefined>,\n options: DiscoveryOptions,\n) {\n const installed = await find(name)\n if (!installed) return { status: \"package-missing\" as const, package: name }\n const software = { name, version: installed.manifest.version }\n if (installed.manifest.docsSdk === undefined)\n return { status: \"declaration-missing\" as const, software }\n const source = declaration(installed.manifest.docsSdk)\n const inventoryRevision = source.inventoryRevision\n let readBytes: (path: string) => Promise<Uint8Array>\n if (source.distribution === \"remote\") {\n const base = remoteBase(source.base)\n if (!(options.remoteBases ?? []).some((allowed) => remoteBase(allowed) === base))\n return { status: \"remote-denied\" as const, software, base }\n readBytes = async (path) => {\n const encoded = relativeArtifact(path).split(\"/\").map(encodeURIComponent).join(\"/\")\n const response = await fetch(new URL(inventoryRevision + \"/\" + encoded, base), {\n redirect: \"error\",\n credentials: \"omit\",\n })\n if (path === \"artifacts.json\" && (response.status === 404 || response.status === 410))\n throw new MissingPublication()\n if (!response.ok)\n throw new Error(`Missing remote documentation artifact ${path} (HTTP ${response.status}).`)\n return new Uint8Array(await response.arrayBuffer())\n }\n } else {\n const owner = source.distribution === \"embedded\" ? installed : await find(source.package)\n if (!owner) return { status: \"sidecar-missing\" as const, software }\n const release = await realpath(resolve(owner.directory, \"docs\", inventoryRevision)).catch(\n (error) => {\n if (missing(error)) return undefined\n throw error\n },\n )\n if (!release) return { status: \"publication-missing\" as const, software, inventoryRevision }\n const root = within(owner.directory, release)\n readBytes = async (path) => {\n try {\n return await readFile(within(root, await realpath(join(root, relativeArtifact(path)))))\n } catch (error) {\n if (path === \"artifacts.json\" && missing(error)) throw new MissingPublication()\n throw error\n }\n }\n }\n try {\n const module = await openDocumentModule(inventoryRevision, software, {\n readBytes,\n sha256: (bytes) => createHash(\"sha256\").update(bytes).digest(\"hex\"),\n })\n return module.status === \"opened\" ? { ...module, directory: installed.directory } : module\n } catch (error) {\n if (error instanceof MissingPublication)\n return { status: \"publication-missing\" as const, software, inventoryRevision }\n throw error\n }\n}\n"],"mappings":";;;;;;;AASA,MAAM,WAAW,UAAoB,OAAiC,SAAS;;AAG/E,eAAsB,qBACpB,eACA,MACA,UAAoC,CAAC,GACN;CAC/B,IAAI,CAAC,sBAAsB,IAAI,GAAG,MAAM,IAAI,MAAM,yBAAyB,MAAM;CACjF,MAAM,WAAW,QAAQ,cAAc,MAAM,SAAS,QAAQ,WAAW,IAAI;CAC7E,eAAe,SAAS,WAAmB;EACzC,IAAI;GACF,MAAM,OAAO,MAAM,SAAS,KAAK,WAAW,cAAc,CAAC;GAC3D,IAAI,UAAU,OAAO,UAAU,IAAI;GACnC,OAAO,KAAK,MAAM,MAAM,SAAS,MAAM,MAAM,CAAC;EAChD,SAAS,OAAO;GACd,IAAI,QAAQ,KAAK,GAA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