@bendyline/docblocks 1.1.2 → 2.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 (270) hide show
  1. package/README.md +76 -11
  2. package/dist/chunk-2D7Y4IR3.js +1293 -0
  3. package/dist/chunk-2D7Y4IR3.js.map +1 -0
  4. package/dist/chunk-5MYAICRE.js +957 -0
  5. package/dist/chunk-5MYAICRE.js.map +1 -0
  6. package/dist/chunk-75UUF6C4.js +802 -0
  7. package/dist/chunk-75UUF6C4.js.map +1 -0
  8. package/dist/chunk-AEHCVWU5.js +25 -0
  9. package/dist/chunk-AEHCVWU5.js.map +1 -0
  10. package/dist/chunk-AYZ4HN5M.js +20 -0
  11. package/dist/chunk-AYZ4HN5M.js.map +1 -0
  12. package/dist/chunk-EGNDADXB.js +111 -0
  13. package/dist/chunk-EGNDADXB.js.map +1 -0
  14. package/dist/chunk-EZKJZUNJ.js +13 -0
  15. package/dist/chunk-EZKJZUNJ.js.map +1 -0
  16. package/dist/chunk-FNW556FN.js +75 -0
  17. package/dist/chunk-FNW556FN.js.map +1 -0
  18. package/dist/chunk-GCPBEMMH.js +563 -0
  19. package/dist/chunk-GCPBEMMH.js.map +1 -0
  20. package/dist/chunk-J32GU3F3.js +1664 -0
  21. package/dist/chunk-J32GU3F3.js.map +1 -0
  22. package/dist/chunk-PGR7LK6D.js +1062 -0
  23. package/dist/chunk-PGR7LK6D.js.map +1 -0
  24. package/dist/chunk-RQJRQF46.js +787 -0
  25. package/dist/chunk-RQJRQF46.js.map +1 -0
  26. package/dist/{chunk-ME76RUMR.js → chunk-RVQHY3XU.js} +15 -1
  27. package/dist/chunk-RVQHY3XU.js.map +1 -0
  28. package/dist/chunk-SI2LU2RP.js +224 -0
  29. package/dist/chunk-SI2LU2RP.js.map +1 -0
  30. package/dist/chunk-W5UUUII5.js +142 -0
  31. package/dist/chunk-W5UUUII5.js.map +1 -0
  32. package/dist/document/document-session.d.ts +127 -0
  33. package/dist/document/document-session.d.ts.map +1 -0
  34. package/dist/document/document-session.js +749 -0
  35. package/dist/document/document-session.js.map +1 -0
  36. package/dist/document/filesystem-target.d.ts +17 -0
  37. package/dist/document/filesystem-target.d.ts.map +1 -0
  38. package/dist/document/filesystem-target.js +70 -0
  39. package/dist/document/filesystem-target.js.map +1 -0
  40. package/dist/document/index.d.ts +6 -0
  41. package/dist/document/index.d.ts.map +1 -0
  42. package/dist/document/index.js +4 -0
  43. package/dist/document/index.js.map +1 -0
  44. package/dist/document/recovery-journal.d.ts +125 -0
  45. package/dist/document/recovery-journal.d.ts.map +1 -0
  46. package/dist/document/recovery-journal.js +385 -0
  47. package/dist/document/recovery-journal.js.map +1 -0
  48. package/dist/document/types.d.ts +89 -0
  49. package/dist/document/types.d.ts.map +1 -0
  50. package/dist/document/types.js +9 -0
  51. package/dist/document/types.js.map +1 -0
  52. package/dist/filesystem/commit-lock.d.ts +3 -0
  53. package/dist/filesystem/commit-lock.d.ts.map +1 -0
  54. package/dist/filesystem/commit-lock.js +20 -0
  55. package/dist/filesystem/commit-lock.js.map +1 -0
  56. package/dist/filesystem/dbk-workspace.d.ts +34 -0
  57. package/dist/filesystem/dbk-workspace.d.ts.map +1 -0
  58. package/dist/filesystem/dbk-workspace.js +85 -0
  59. package/dist/filesystem/dbk-workspace.js.map +1 -0
  60. package/dist/filesystem/electron-provider-v2.d.ts +36 -0
  61. package/dist/filesystem/electron-provider-v2.d.ts.map +1 -0
  62. package/dist/filesystem/electron-provider-v2.js +503 -0
  63. package/dist/filesystem/electron-provider-v2.js.map +1 -0
  64. package/dist/filesystem/electron-provider.d.ts +6 -3
  65. package/dist/filesystem/electron-provider.d.ts.map +1 -1
  66. package/dist/filesystem/electron-provider.js +18 -13
  67. package/dist/filesystem/electron-provider.js.map +1 -1
  68. package/dist/filesystem/electron.d.ts +4 -0
  69. package/dist/filesystem/electron.d.ts.map +1 -0
  70. package/dist/filesystem/electron.js +4 -0
  71. package/dist/filesystem/electron.js.map +1 -0
  72. package/dist/filesystem/filesystem-content-container.d.ts +1 -1
  73. package/dist/filesystem/filesystem-content-container.d.ts.map +1 -1
  74. package/dist/filesystem/filesystem-content-container.js +50 -13
  75. package/dist/filesystem/filesystem-content-container.js.map +1 -1
  76. package/dist/filesystem/fs-error.d.ts +46 -0
  77. package/dist/filesystem/fs-error.d.ts.map +1 -0
  78. package/dist/filesystem/fs-error.js +170 -0
  79. package/dist/filesystem/fs-error.js.map +1 -0
  80. package/dist/filesystem/index.d.ts +15 -1
  81. package/dist/filesystem/index.d.ts.map +1 -1
  82. package/dist/filesystem/index.js +13 -0
  83. package/dist/filesystem/index.js.map +1 -1
  84. package/dist/filesystem/indexeddb-content-container.d.ts +3 -1
  85. package/dist/filesystem/indexeddb-content-container.d.ts.map +1 -1
  86. package/dist/filesystem/indexeddb-content-container.js +18 -11
  87. package/dist/filesystem/indexeddb-content-container.js.map +1 -1
  88. package/dist/filesystem/indexeddb-provider-v2.d.ts +96 -0
  89. package/dist/filesystem/indexeddb-provider-v2.d.ts.map +1 -0
  90. package/dist/filesystem/indexeddb-provider-v2.js +1241 -0
  91. package/dist/filesystem/indexeddb-provider-v2.js.map +1 -0
  92. package/dist/filesystem/indexeddb-provider.d.ts +21 -14
  93. package/dist/filesystem/indexeddb-provider.d.ts.map +1 -1
  94. package/dist/filesystem/indexeddb-provider.js +111 -261
  95. package/dist/filesystem/indexeddb-provider.js.map +1 -1
  96. package/dist/filesystem/indexeddb-store.d.ts +34 -0
  97. package/dist/filesystem/indexeddb-store.d.ts.map +1 -0
  98. package/dist/filesystem/indexeddb-store.js +165 -0
  99. package/dist/filesystem/indexeddb-store.js.map +1 -0
  100. package/dist/filesystem/indexeddb.d.ts +5 -0
  101. package/dist/filesystem/indexeddb.d.ts.map +1 -0
  102. package/dist/filesystem/indexeddb.js +5 -0
  103. package/dist/filesystem/indexeddb.js.map +1 -0
  104. package/dist/filesystem/legacy-v2-adapter.d.ts +62 -0
  105. package/dist/filesystem/legacy-v2-adapter.d.ts.map +1 -0
  106. package/dist/filesystem/legacy-v2-adapter.js +499 -0
  107. package/dist/filesystem/legacy-v2-adapter.js.map +1 -0
  108. package/dist/filesystem/memory-provider-v2.d.ts +92 -0
  109. package/dist/filesystem/memory-provider-v2.d.ts.map +1 -0
  110. package/dist/filesystem/memory-provider-v2.js +615 -0
  111. package/dist/filesystem/memory-provider-v2.js.map +1 -0
  112. package/dist/filesystem/memory-provider.d.ts +54 -0
  113. package/dist/filesystem/memory-provider.d.ts.map +1 -0
  114. package/dist/filesystem/memory-provider.js +132 -0
  115. package/dist/filesystem/memory-provider.js.map +1 -0
  116. package/dist/filesystem/memory.d.ts +4 -0
  117. package/dist/filesystem/memory.d.ts.map +1 -0
  118. package/dist/filesystem/memory.js +4 -0
  119. package/dist/filesystem/memory.js.map +1 -0
  120. package/dist/filesystem/move-entry.d.ts +9 -0
  121. package/dist/filesystem/move-entry.d.ts.map +1 -0
  122. package/dist/filesystem/move-entry.js +103 -0
  123. package/dist/filesystem/move-entry.js.map +1 -0
  124. package/dist/filesystem/move-error.d.ts +53 -0
  125. package/dist/filesystem/move-error.d.ts.map +1 -0
  126. package/dist/filesystem/move-error.js +99 -0
  127. package/dist/filesystem/move-error.js.map +1 -0
  128. package/dist/filesystem/native-provider-v2.d.ts +75 -0
  129. package/dist/filesystem/native-provider-v2.d.ts.map +1 -0
  130. package/dist/filesystem/native-provider-v2.js +849 -0
  131. package/dist/filesystem/native-provider-v2.js.map +1 -0
  132. package/dist/filesystem/native-provider.d.ts +9 -1
  133. package/dist/filesystem/native-provider.d.ts.map +1 -1
  134. package/dist/filesystem/native-provider.js +172 -37
  135. package/dist/filesystem/native-provider.js.map +1 -1
  136. package/dist/filesystem/native.d.ts +4 -0
  137. package/dist/filesystem/native.d.ts.map +1 -0
  138. package/dist/filesystem/native.js +4 -0
  139. package/dist/filesystem/native.js.map +1 -0
  140. package/dist/filesystem/types.d.ts +37 -4
  141. package/dist/filesystem/types.d.ts.map +1 -1
  142. package/dist/filesystem/types.js +11 -3
  143. package/dist/filesystem/types.js.map +1 -1
  144. package/dist/filesystem/v2.d.ts +172 -0
  145. package/dist/filesystem/v2.d.ts.map +1 -0
  146. package/dist/filesystem/v2.js +16 -0
  147. package/dist/filesystem/v2.js.map +1 -0
  148. package/dist/filesystem/workspace-path.d.ts +21 -0
  149. package/dist/filesystem/workspace-path.d.ts.map +1 -0
  150. package/dist/filesystem/workspace-path.js +80 -0
  151. package/dist/filesystem/workspace-path.js.map +1 -0
  152. package/dist/host/filesystem-v2.d.ts +45 -0
  153. package/dist/host/filesystem-v2.d.ts.map +1 -0
  154. package/dist/host/filesystem-v2.js +13 -0
  155. package/dist/host/filesystem-v2.js.map +1 -0
  156. package/dist/host/git.d.ts +200 -0
  157. package/dist/host/git.d.ts.map +1 -0
  158. package/dist/host/git.js +15 -0
  159. package/dist/host/git.js.map +1 -0
  160. package/dist/host/index.d.ts +4 -1
  161. package/dist/host/index.d.ts.map +1 -1
  162. package/dist/host/index.js +2 -0
  163. package/dist/host/index.js.map +1 -1
  164. package/dist/host/types.d.ts +114 -31
  165. package/dist/host/types.d.ts.map +1 -1
  166. package/dist/host/wire-policy.d.ts +22 -0
  167. package/dist/host/wire-policy.d.ts.map +1 -0
  168. package/dist/host/wire-policy.js +92 -0
  169. package/dist/host/wire-policy.js.map +1 -0
  170. package/dist/index.d.ts +2 -1
  171. package/dist/index.d.ts.map +1 -1
  172. package/dist/index.js +2 -1
  173. package/dist/index.js.map +1 -1
  174. package/dist/mcp/index.d.ts +4 -0
  175. package/dist/mcp/index.d.ts.map +1 -0
  176. package/dist/mcp/index.js +4 -0
  177. package/dist/mcp/index.js.map +1 -0
  178. package/dist/mcp/types.d.ts +466 -0
  179. package/dist/mcp/types.d.ts.map +1 -0
  180. package/dist/mcp/types.js +25 -0
  181. package/dist/mcp/types.js.map +1 -0
  182. package/dist/mcp/wire.d.ts +29 -0
  183. package/dist/mcp/wire.d.ts.map +1 -0
  184. package/dist/mcp/wire.js +1046 -0
  185. package/dist/mcp/wire.js.map +1 -0
  186. package/dist/mcp/zod.d.ts +5763 -0
  187. package/dist/mcp/zod.d.ts.map +1 -0
  188. package/dist/mcp/zod.js +908 -0
  189. package/dist/mcp/zod.js.map +1 -0
  190. package/dist/types-CX893hgH.d.ts +468 -0
  191. package/dist/types-CsX6EN2t.d.ts +301 -0
  192. package/dist/types-eOlt9J7n.d.ts +478 -0
  193. package/dist/vscode/index.d.ts +3 -0
  194. package/dist/vscode/index.d.ts.map +1 -0
  195. package/dist/vscode/index.js +3 -0
  196. package/dist/vscode/index.js.map +1 -0
  197. package/dist/vscode/messages.d.ts +204 -0
  198. package/dist/vscode/messages.d.ts.map +1 -0
  199. package/dist/vscode/messages.js +494 -0
  200. package/dist/vscode/messages.js.map +1 -0
  201. package/dist/workspace/index.d.ts +3 -2
  202. package/dist/workspace/index.d.ts.map +1 -1
  203. package/dist/workspace/index.js +2 -1
  204. package/dist/workspace/index.js.map +1 -1
  205. package/dist/workspace/reconcile-electron.d.ts +19 -0
  206. package/dist/workspace/reconcile-electron.d.ts.map +1 -0
  207. package/dist/workspace/reconcile-electron.js +42 -0
  208. package/dist/workspace/reconcile-electron.js.map +1 -0
  209. package/dist/workspace/types.d.ts +41 -1
  210. package/dist/workspace/types.d.ts.map +1 -1
  211. package/dist/workspace/types.js +0 -4
  212. package/dist/workspace/types.js.map +1 -1
  213. package/dist/workspace/workspace-manager.d.ts +17 -5
  214. package/dist/workspace/workspace-manager.d.ts.map +1 -1
  215. package/dist/workspace/workspace-manager.js +55 -11
  216. package/dist/workspace/workspace-manager.js.map +1 -1
  217. package/dist/workspace-path-CWVrcuPL.d.ts +21 -0
  218. package/package.json +43 -2
  219. package/src/document/document-session.ts +834 -0
  220. package/src/document/filesystem-target.ts +109 -0
  221. package/src/document/index.ts +41 -0
  222. package/src/document/recovery-journal.ts +536 -0
  223. package/src/document/types.ts +116 -0
  224. package/src/filesystem/commit-lock.ts +29 -0
  225. package/src/filesystem/dbk-workspace.ts +135 -0
  226. package/src/filesystem/electron-provider-v2.ts +630 -0
  227. package/src/filesystem/electron-provider.ts +25 -14
  228. package/src/filesystem/electron.ts +3 -0
  229. package/src/filesystem/filesystem-content-container.ts +53 -15
  230. package/src/filesystem/fs-error.ts +234 -0
  231. package/src/filesystem/index.ts +119 -0
  232. package/src/filesystem/indexeddb-content-container.ts +20 -12
  233. package/src/filesystem/indexeddb-provider-v2.ts +1740 -0
  234. package/src/filesystem/indexeddb-provider.ts +126 -300
  235. package/src/filesystem/indexeddb-store.ts +207 -0
  236. package/src/filesystem/indexeddb.ts +12 -0
  237. package/src/filesystem/legacy-v2-adapter.ts +779 -0
  238. package/src/filesystem/memory-provider-v2.ts +896 -0
  239. package/src/filesystem/memory-provider.ts +180 -0
  240. package/src/filesystem/memory.ts +15 -0
  241. package/src/filesystem/move-entry.ts +142 -0
  242. package/src/filesystem/move-error.ts +159 -0
  243. package/src/filesystem/native-provider-v2.ts +1165 -0
  244. package/src/filesystem/native-provider.ts +194 -41
  245. package/src/filesystem/native.ts +16 -0
  246. package/src/filesystem/types.ts +49 -4
  247. package/src/filesystem/v2.ts +231 -0
  248. package/src/filesystem/workspace-path.ts +92 -0
  249. package/src/host/filesystem-v2.ts +104 -0
  250. package/src/host/git.ts +246 -0
  251. package/src/host/index.ts +46 -0
  252. package/src/host/types.ts +155 -34
  253. package/src/host/wire-policy.ts +103 -0
  254. package/src/index.ts +2 -1
  255. package/src/mcp/index.ts +3 -0
  256. package/src/mcp/types.ts +594 -0
  257. package/src/mcp/wire.ts +1280 -0
  258. package/src/mcp/zod.ts +1000 -0
  259. package/src/vscode/index.ts +2 -0
  260. package/src/vscode/messages.ts +704 -0
  261. package/src/workspace/index.ts +8 -1
  262. package/src/workspace/reconcile-electron.ts +65 -0
  263. package/src/workspace/types.ts +39 -1
  264. package/src/workspace/workspace-manager.ts +71 -10
  265. package/dist/chunk-GUNM43XZ.js +0 -63
  266. package/dist/chunk-GUNM43XZ.js.map +0 -1
  267. package/dist/chunk-IM7LCQJ6.js +0 -850
  268. package/dist/chunk-IM7LCQJ6.js.map +0 -1
  269. package/dist/chunk-ME76RUMR.js.map +0 -1
  270. package/dist/index-pgBHBQ9G.d.ts +0 -213
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/filesystem/native-provider-v2.ts","../src/filesystem/native-provider.ts"],"sourcesContent":["import { withFileCommitLock } from './commit-lock.js';\nimport { FsError, fsErrorFromUnknown, type FsOperation } from './fs-error.js';\nimport {\n parseFileSystemVersion,\n type FileSystemCreateDirectoryOptions,\n type FileSystemDirectorySnapshot,\n type FileSystemEntrySnapshot,\n type FileSystemFileRead,\n type FileSystemFileSnapshot,\n type FileSystemMoveOptions,\n type FileSystemProviderCapabilities,\n type FileSystemProviderV2,\n type FileSystemRemoveOptions,\n type FileSystemRemoveResult,\n type FileSystemSnapshot,\n type FileSystemSnapshotEntry,\n type FileSystemSnapshotFile,\n type FileSystemVersion,\n type FileSystemWatchListener,\n type FileSystemWatchOptions,\n type FileSystemWatchSubscription,\n type FileSystemWriteOptions,\n} from './v2.js';\nimport {\n WORKSPACE_ROOT,\n parseWorkspacePath,\n workspacePathBasename,\n workspacePathContains,\n workspacePathDirname,\n workspacePathJoin,\n type WorkspacePath,\n} from './workspace-path.js';\n\ninterface ScannedEntry<TFile extends FileSystemFileSnapshot> {\n readonly root: FileSystemDirectorySnapshot | TFile;\n readonly entries: readonly (FileSystemDirectorySnapshot | TFile)[];\n}\n\ntype MetadataScan = ScannedEntry<FileSystemFileSnapshot>;\ntype SnapshotScan = ScannedEntry<FileSystemSnapshotFile>;\n\nexport type NativeFileSystemMovePathState = 'present' | 'missing' | 'unknown';\n\nexport interface NativeFileSystemMoveRecoveryState {\n readonly source: NativeFileSystemMovePathState;\n readonly destination: NativeFileSystemMovePathState;\n}\n\n/**\n * A copy/delete move failed and the provider could not prove that rollback\n * restored the source-only state. Callers must inspect `state` before retrying.\n */\nexport class NativeFileSystemMoveRecoveryError extends FsError {\n public readonly primaryError: FsError;\n public readonly recoveryErrors: readonly FsError[];\n public readonly state: NativeFileSystemMoveRecoveryState;\n\n public constructor(\n sourcePath: WorkspacePath,\n destinationPath: WorkspacePath,\n primaryError: FsError,\n recoveryErrors: readonly FsError[],\n state: NativeFileSystemMoveRecoveryState,\n ) {\n super(\n 'io',\n `Native move recovery is incomplete (source: ${state.source}, destination: ${state.destination}).`,\n {\n operation: 'move',\n path: sourcePath,\n destinationPath,\n retryable: false,\n },\n );\n this.name = 'NativeFileSystemMoveRecoveryError';\n this.primaryError = primaryError;\n this.recoveryErrors = Object.freeze([...recoveryErrors]);\n this.state = Object.freeze({ ...state });\n }\n}\n\nconst EPOCH = new Date(0).toISOString();\n\nconst NATIVE_V2_CAPABILITIES: FileSystemProviderCapabilities = Object.freeze({\n writeAtomicity: 'none',\n moveAtomicity: 'none',\n snapshotAtomicity: 'none',\n conditionalWrite: 'process',\n recursiveRemove: true,\n watch: false,\n caseSensitivity: 'platform',\n symlinkPolicy: 'unsupported',\n durability: 'best-effort',\n});\n\n/** Direct File System Access API implementation of FileSystemProviderV2. */\nexport class NativeFileSystemProviderV2 implements FileSystemProviderV2 {\n public readonly id: string;\n public readonly label: string;\n public readonly capabilities = NATIVE_V2_CAPABILITIES;\n\n private readonly root: FileSystemDirectoryHandle;\n private readonly lockKey: string;\n private readonly subscriptions = new Set<FileSystemWatchSubscription>();\n private readonly inFlight = new Set<Promise<unknown>>();\n private disposed = false;\n private disposePromise: Promise<void> | null = null;\n\n public constructor(id: string, root: FileSystemDirectoryHandle) {\n this.id = id;\n this.label = root.name;\n this.root = root;\n this.lockKey = `native:${id}:workspace`;\n }\n\n public async stat(path: WorkspacePath): Promise<FileSystemEntrySnapshot | null> {\n const canonical = this.canonical(path);\n return this.execute('stat', canonical, null, async () => {\n const scanned = await this.tryScanMetadata(canonical, 'stat');\n return scanned ? withoutData(scanned.root) : null;\n });\n }\n\n public async readFile(path: WorkspacePath): Promise<FileSystemFileRead | null> {\n const canonical = this.canonical(path);\n return this.execute('read', canonical, null, async () => {\n const handle = await this.getHandle(canonical);\n if (!handle) return null;\n if (handle.kind !== 'file') {\n throw this.error('type-mismatch', 'read', canonical, 'Expected a file, found a directory.');\n }\n const scanned = await this.scanSnapshotHandle(canonical, handle, 'read');\n if (scanned.root.kind !== 'file') {\n throw this.error('io', 'read', canonical, 'Native file handle changed kind during read.');\n }\n return Object.freeze({\n entry: withoutData(scanned.root) as FileSystemFileSnapshot,\n data: scanned.root.data.slice(0),\n });\n });\n }\n\n public async readDirectory(path: WorkspacePath): Promise<readonly FileSystemEntrySnapshot[]> {\n const canonical = this.canonical(path);\n return this.execute('list', canonical, null, async () => {\n const handle = await this.getHandle(canonical);\n if (!handle) throw this.error('not-found', 'list', canonical, 'Directory does not exist.');\n if (handle.kind !== 'directory') {\n throw this.error('type-mismatch', 'list', canonical, 'Expected a directory, found a file.');\n }\n\n const children: FileSystemEntrySnapshot[] = [];\n for (const [name, childHandle] of await listDirectory(\n handle as FileSystemDirectoryHandle,\n 'list',\n canonical,\n )) {\n const childPath = workspacePathJoin(canonical, name);\n children.push(\n withoutData((await this.scanMetadataHandle(childPath, childHandle, 'list')).root),\n );\n }\n children.sort(compareSnapshots);\n return Object.freeze(children);\n });\n }\n\n public async writeFile(\n path: WorkspacePath,\n data: ArrayBuffer | Uint8Array,\n options: FileSystemWriteOptions = {},\n ): Promise<FileSystemFileSnapshot> {\n const canonical = this.canonicalNonRoot(path, 'write');\n const ownedData = copyBytes(data);\n return this.mutate('write', canonical, null, async () => {\n const mode = options.mode ?? 'upsert';\n if (mode !== 'upsert' && mode !== 'create' && mode !== 'replace') {\n throw this.error('invalid-path', 'write', canonical, 'Invalid write mode.');\n }\n\n const existing = await this.tryScanMetadata(canonical, 'write');\n if (existing?.root.kind === 'directory') {\n throw this.error(\n 'type-mismatch',\n 'write',\n canonical,\n 'Cannot replace a directory with a file.',\n );\n }\n if (mode === 'create' && existing) {\n throw this.error('already-exists', 'write', canonical, 'File already exists.');\n }\n if (mode === 'replace' && !existing) {\n throw this.error('not-found', 'write', canonical, 'File does not exist.');\n }\n this.assertExpectedVersion(existing?.root, options.expectedVersion, 'write', canonical);\n\n const missingParents = await this.planParents(\n canonical,\n options.createParents ?? false,\n 'write',\n );\n const createdParents = await this.createDirectories(missingParents);\n let writeCompleted = false;\n try {\n await this.writeBytes(canonical, ownedData);\n writeCompleted = true;\n const written = await this.requireSnapshot(canonical, 'write');\n if (written.root.kind !== 'file' || !equalBytes(written.root.data, ownedData)) {\n throw this.error(\n 'conflict',\n 'write',\n canonical,\n 'Stored bytes changed before the write could be verified.',\n );\n }\n return withoutData(written.root) as FileSystemFileSnapshot;\n } catch (error: unknown) {\n if (!existing && !writeCompleted) {\n await this.removeEmptyFileIfPresent(canonical).catch(() => undefined);\n }\n await this.rollbackDirectories(createdParents);\n throw error;\n }\n });\n }\n\n public async createDirectory(\n path: WorkspacePath,\n options: FileSystemCreateDirectoryOptions = {},\n ): Promise<FileSystemDirectorySnapshot> {\n const canonical = this.canonical(path);\n return this.mutate('create-directory', canonical, null, async () => {\n const mode = options.mode ?? 'ensure';\n if (mode !== 'ensure' && mode !== 'create') {\n throw this.error('invalid-path', 'create-directory', canonical, 'Invalid directory mode.');\n }\n const existing = await this.tryScanMetadata(canonical, 'create-directory');\n if (existing) {\n if (existing.root.kind !== 'directory') {\n throw this.error(\n 'type-mismatch',\n 'create-directory',\n canonical,\n 'Cannot replace a file with a directory.',\n );\n }\n if (mode === 'create') {\n throw this.error(\n 'already-exists',\n 'create-directory',\n canonical,\n 'Directory already exists.',\n );\n }\n return withoutData(existing.root) as FileSystemDirectorySnapshot;\n }\n\n const missingParents = await this.planParents(\n canonical,\n options.createParents ?? false,\n 'create-directory',\n );\n const planned = [...missingParents, canonical];\n const created = await this.createDirectories(planned);\n try {\n const scanned = await this.requireMetadata(canonical, 'create-directory');\n if (scanned.root.kind !== 'directory') {\n throw this.error(\n 'io',\n 'create-directory',\n canonical,\n 'The native backend did not create a directory.',\n );\n }\n return withoutData(scanned.root) as FileSystemDirectorySnapshot;\n } catch (error: unknown) {\n await this.rollbackDirectories(created);\n throw error;\n }\n });\n }\n\n public async remove(\n path: WorkspacePath,\n options: FileSystemRemoveOptions = {},\n ): Promise<FileSystemRemoveResult> {\n const canonical = this.canonicalNonRoot(path, 'remove');\n return this.mutate('remove', canonical, null, async () => {\n const existing = await this.tryScanMetadata(canonical, 'remove');\n if (!existing) {\n if ((options.missing ?? 'error') === 'ignore') {\n return Object.freeze({\n removed: false,\n version: await this.currentTreeVersion('remove'),\n });\n }\n throw this.error('not-found', 'remove', canonical, 'Entry does not exist.');\n }\n this.assertExpectedVersion(existing.root, options.expectedVersion, 'remove', canonical);\n if (existing.root.kind === 'directory' && !options.recursive) {\n const handle = await this.getHandle(canonical);\n if (!handle || handle.kind !== 'directory') {\n throw this.error('conflict', 'remove', canonical, 'Directory changed before removal.');\n }\n if (\n (await listDirectory(handle as FileSystemDirectoryHandle, 'remove', canonical)).length > 0\n ) {\n throw this.error('not-empty', 'remove', canonical, 'Directory is not empty.');\n }\n }\n\n await this.removeEntry(canonical, existing.root.kind === 'directory' && !!options.recursive);\n if (await this.getHandle(canonical)) {\n throw this.error('conflict', 'remove', canonical, 'Entry was recreated during removal.');\n }\n return Object.freeze({\n removed: true,\n version: await this.currentTreeVersion('remove'),\n });\n });\n }\n\n public async move(\n oldPath: WorkspacePath,\n newPath: WorkspacePath,\n options: FileSystemMoveOptions = {},\n ): Promise<FileSystemEntrySnapshot> {\n const sourcePath = this.canonicalNonRoot(oldPath, 'move');\n const destinationPath = this.canonicalNonRoot(newPath, 'move');\n return this.mutate('move', sourcePath, destinationPath, async () => {\n const sourceMetadata = await this.tryScanMetadata(sourcePath, 'move');\n if (!sourceMetadata) {\n throw this.error('not-found', 'move', sourcePath, 'Source does not exist.');\n }\n this.assertExpectedVersion(sourceMetadata.root, options.expectedVersion, 'move', sourcePath);\n if (sourcePath === destinationPath) return withoutData(sourceMetadata.root);\n if (\n sourceMetadata.root.kind === 'directory' &&\n workspacePathContains(sourcePath, destinationPath, false)\n ) {\n throw new FsError('invalid-path', 'Cannot move a directory into itself.', {\n operation: 'move',\n path: sourcePath,\n destinationPath,\n });\n }\n if (await this.getHandle(destinationPath)) {\n throw new FsError('already-exists', 'Destination already exists.', {\n operation: 'move',\n path: sourcePath,\n destinationPath,\n });\n }\n\n const missingParents = await this.planParents(\n destinationPath,\n options.createParents ?? false,\n 'move',\n );\n const source = await this.tryScanSnapshot(sourcePath, 'move');\n if (\n !source ||\n source.root.kind !== sourceMetadata.root.kind ||\n source.root.version !== sourceMetadata.root.version\n ) {\n throw new FsError('conflict', 'Source changed before the move could be copied.', {\n operation: 'move',\n path: sourcePath,\n destinationPath,\n });\n }\n const createdParents = await this.createDirectories(missingParents);\n let destinationVersion: FileSystemVersion | null = null;\n let sourceDeleted = false;\n try {\n await this.writeTree(source, sourcePath, destinationPath);\n const copied = await this.requireSnapshot(destinationPath, 'move');\n destinationVersion = copied.root.version;\n if (!equalTreeContents(source, sourcePath, copied, destinationPath)) {\n throw new FsError('conflict', 'Destination changed while the move was copied.', {\n operation: 'move',\n path: sourcePath,\n destinationPath,\n });\n }\n\n const sourceBeforeDelete = await this.tryScanMetadata(sourcePath, 'move');\n if (\n !sourceBeforeDelete ||\n sourceBeforeDelete.root.kind !== source.root.kind ||\n sourceBeforeDelete.root.version !== source.root.version\n ) {\n throw new FsError('conflict', 'Source changed while the move was copied.', {\n operation: 'move',\n path: sourcePath,\n destinationPath,\n });\n }\n\n await this.removeEntry(sourcePath, source.root.kind === 'directory');\n sourceDeleted = true;\n const [sourceAfter, destinationAfter] = await Promise.all([\n this.tryScanMetadata(sourcePath, 'move'),\n this.tryScanMetadata(destinationPath, 'move'),\n ]);\n if (\n sourceAfter ||\n !destinationAfter ||\n destinationAfter.root.kind !== source.root.kind ||\n destinationAfter.root.version !== destinationVersion\n ) {\n throw new FsError('conflict', 'Move state changed before it could be verified.', {\n operation: 'move',\n path: sourcePath,\n destinationPath,\n });\n }\n return withoutData(destinationAfter.root);\n } catch (error: unknown) {\n return await this.rollbackMoveAndThrow(\n sourcePath,\n destinationPath,\n source,\n createdParents,\n destinationVersion,\n sourceDeleted,\n error,\n );\n }\n });\n }\n\n public async snapshot(): Promise<FileSystemSnapshot> {\n return this.mutate('snapshot', WORKSPACE_ROOT, null, async () => {\n const scanned = await this.scanSnapshotHandle(WORKSPACE_ROOT, this.root, 'snapshot');\n const entries = [...scanned.entries]\n .sort((left, right) => compareText(left.path, right.path))\n .map(copySnapshotEntry);\n return Object.freeze({ version: scanned.root.version, entries: Object.freeze(entries) });\n });\n }\n\n public watch(\n _listener: FileSystemWatchListener,\n options: FileSystemWatchOptions = {},\n ): FileSystemWatchSubscription {\n this.assertOpen('watch');\n const error = new FsError('not-supported', 'Native filesystem watching is unavailable.', {\n operation: 'watch',\n });\n let closed = false;\n let disposePromise: Promise<void> | null = null;\n const ready = Promise.reject(error);\n void ready.catch((caught: FsError) => {\n try {\n options.onError?.(caught);\n } catch {\n // Observers cannot change provider state.\n }\n });\n const subscription: FileSystemWatchSubscription = {\n get closed() {\n return closed;\n },\n ready,\n dispose: () => {\n if (disposePromise) return disposePromise;\n closed = true;\n this.subscriptions.delete(subscription);\n disposePromise = Promise.resolve();\n return disposePromise;\n },\n };\n this.subscriptions.add(subscription);\n return subscription;\n }\n\n public dispose(): Promise<void> {\n if (this.disposePromise) return this.disposePromise;\n this.disposed = true;\n this.disposePromise = (async () => {\n await Promise.allSettled([...this.inFlight]);\n await Promise.all([...this.subscriptions].map((subscription) => subscription.dispose()));\n })();\n return this.disposePromise;\n }\n\n private canonical(path: WorkspacePath): WorkspacePath {\n return parseWorkspacePath(String(path));\n }\n\n private canonicalNonRoot(path: WorkspacePath, operation: FsOperation): WorkspacePath {\n const canonical = this.canonical(path);\n if (!canonical) {\n throw this.error('invalid-path', operation, canonical, 'Workspace root cannot be mutated.');\n }\n return canonical;\n }\n\n private execute<T>(\n operation: FsOperation,\n path: WorkspacePath | null,\n destinationPath: WorkspacePath | null,\n work: () => Promise<T>,\n ): Promise<T> {\n this.assertOpen(operation);\n const promise = (async () => {\n try {\n return await work();\n } catch (error: unknown) {\n throw this.translateError(error, operation, path, destinationPath);\n }\n })();\n this.inFlight.add(promise);\n void promise.then(\n () => this.inFlight.delete(promise),\n () => this.inFlight.delete(promise),\n );\n return promise;\n }\n\n private mutate<T>(\n operation: FsOperation,\n path: WorkspacePath,\n destinationPath: WorkspacePath | null,\n work: () => Promise<T>,\n ): Promise<T> {\n return this.execute(operation, path, destinationPath, () =>\n withFileCommitLock(this.lockKey, work),\n );\n }\n\n private assertOpen(operation: FsOperation): void {\n if (!this.disposed) return;\n throw new FsError('disposed', 'Filesystem provider is disposed.', { operation });\n }\n\n private translateError(\n error: unknown,\n operation: FsOperation,\n path: WorkspacePath | null,\n destinationPath: WorkspacePath | null,\n ): FsError {\n if (error instanceof FsError) return error;\n return fsErrorFromUnknown(error, {\n operation,\n path: path ?? undefined,\n destinationPath: destinationPath ?? undefined,\n });\n }\n\n private error(\n code: ConstructorParameters<typeof FsError>[0],\n operation: FsOperation,\n path: WorkspacePath,\n message: string,\n ): FsError {\n return new FsError(code, message, { operation, path });\n }\n\n private assertExpectedVersion(\n entry: FileSystemEntrySnapshot | undefined,\n expected: FileSystemVersion | null | undefined,\n operation: FsOperation,\n path: WorkspacePath,\n ): void {\n if (expected === undefined) return;\n if (expected === null ? !entry : entry?.version === expected) return;\n throw this.error(\n 'conflict',\n operation,\n path,\n 'Entry version does not match the expected version.',\n );\n }\n\n private async resolveDirectory(path: WorkspacePath): Promise<FileSystemDirectoryHandle | null> {\n if (!path) return this.root;\n let current = this.root;\n for (const segment of path.split('/')) {\n try {\n current = await current.getDirectoryHandle(segment);\n } catch (error: unknown) {\n if (errorName(error) === 'NotFoundError') return null;\n throw error;\n }\n }\n return current;\n }\n\n private async getHandle(path: WorkspacePath): Promise<FileSystemHandle | null> {\n if (!path) return this.root;\n const parent = await this.resolveDirectory(workspacePathDirname(path));\n if (!parent) return null;\n const name = workspacePathBasename(path);\n try {\n return await parent.getFileHandle(name);\n } catch (error: unknown) {\n if (!isMissingOrKindError(error)) throw error;\n }\n try {\n return await parent.getDirectoryHandle(name);\n } catch (error: unknown) {\n if (!isMissingOrKindError(error)) throw error;\n return null;\n }\n }\n\n private async tryScanMetadata(\n path: WorkspacePath,\n operation: FsOperation,\n ): Promise<MetadataScan | null> {\n const handle = await this.getHandle(path);\n return handle ? this.scanMetadataHandle(path, handle, operation) : null;\n }\n\n private async tryScanSnapshot(\n path: WorkspacePath,\n operation: FsOperation,\n ): Promise<SnapshotScan | null> {\n const handle = await this.getHandle(path);\n return handle ? this.scanSnapshotHandle(path, handle, operation) : null;\n }\n\n private async requireMetadata(\n path: WorkspacePath,\n operation: FsOperation,\n ): Promise<MetadataScan> {\n const scanned = await this.tryScanMetadata(path, operation);\n if (!scanned) throw this.error('not-found', operation, path, 'Entry does not exist.');\n return scanned;\n }\n\n private async requireSnapshot(\n path: WorkspacePath,\n operation: FsOperation,\n ): Promise<SnapshotScan> {\n const scanned = await this.tryScanSnapshot(path, operation);\n if (!scanned) throw this.error('not-found', operation, path, 'Entry does not exist.');\n return scanned;\n }\n\n private scanMetadataHandle(\n path: WorkspacePath,\n handle: FileSystemHandle,\n operation: FsOperation,\n ): Promise<MetadataScan> {\n // File snapshots expose stable size/lastModified metadata without reading payload bytes.\n // Keep stat/list/version checks on this path so directory scans scale with entries, not bytes.\n return this.scanHandle(path, handle, operation, (filePath, fileHandle) =>\n this.scanFileMetadata(filePath, fileHandle, operation),\n );\n }\n\n private scanSnapshotHandle(\n path: WorkspacePath,\n handle: FileSystemHandle,\n operation: FsOperation,\n ): Promise<SnapshotScan> {\n return this.scanHandle(path, handle, operation, (filePath, fileHandle) =>\n this.scanFileSnapshot(filePath, fileHandle, operation),\n );\n }\n\n private async scanHandle<TFile extends FileSystemFileSnapshot>(\n path: WorkspacePath,\n handle: FileSystemHandle,\n operation: FsOperation,\n scanFile: (path: WorkspacePath, handle: FileSystemFileHandle) => Promise<TFile>,\n ): Promise<ScannedEntry<TFile>> {\n if (handle.kind === 'file') {\n const entry = await scanFile(path, handle as FileSystemFileHandle);\n return { root: entry, entries: Object.freeze([entry]) };\n }\n\n const children: ScannedEntry<TFile>[] = [];\n for (const [name, childHandle] of await listDirectory(\n handle as FileSystemDirectoryHandle,\n operation,\n path,\n )) {\n children.push(\n await this.scanHandle(workspacePathJoin(path, name), childHandle, operation, scanFile),\n );\n }\n const childRoots = children.map((child) => child.root).sort(compareSnapshots);\n const version = await metadataVersion(\n 'directory',\n new TextEncoder().encode(\n childRoots\n .map((child) => `${child.kind}\\0${child.name.length}:${child.name}\\0${child.version}`)\n .join('\\n'),\n ),\n operation,\n path,\n );\n const directory: FileSystemDirectorySnapshot = Object.freeze({\n kind: 'directory' as const,\n path,\n name: workspacePathBasename(path),\n size: null,\n version,\n lastModified: newestLastModified(childRoots),\n });\n return {\n root: directory,\n entries: Object.freeze([directory, ...children.flatMap((child) => child.entries)]),\n };\n }\n\n private async scanFileMetadata(\n path: WorkspacePath,\n handle: FileSystemFileHandle,\n operation: FsOperation,\n ): Promise<FileSystemFileSnapshot> {\n const file = await this.getFileSnapshot(handle, path, operation);\n return this.fileMetadata(file, path, operation);\n }\n\n private async scanFileSnapshot(\n path: WorkspacePath,\n handle: FileSystemFileHandle,\n operation: FsOperation,\n ): Promise<FileSystemSnapshotFile> {\n const file = await this.getFileSnapshot(handle, path, operation);\n const metadata = await this.fileMetadata(file, path, operation);\n let data: ArrayBuffer;\n try {\n data = copyBytes(await file.arrayBuffer());\n } catch (error: unknown) {\n throw this.translateError(error, operation, path, null);\n }\n if (metadata.size !== data.byteLength) {\n throw this.error('io', operation, path, 'Native file metadata is inconsistent.');\n }\n return Object.freeze({ ...metadata, data });\n }\n\n private async getFileSnapshot(\n handle: FileSystemFileHandle,\n path: WorkspacePath,\n operation: FsOperation,\n ): Promise<File> {\n try {\n return await handle.getFile();\n } catch (error: unknown) {\n throw this.translateError(error, operation, path, null);\n }\n }\n\n private async fileMetadata(\n file: File,\n path: WorkspacePath,\n operation: FsOperation,\n ): Promise<FileSystemFileSnapshot> {\n if (!Number.isSafeInteger(file.size) || file.size < 0 || !Number.isFinite(file.lastModified)) {\n throw this.error('io', operation, path, 'Native file metadata is inconsistent.');\n }\n\n let lastModified: string;\n try {\n lastModified = new Date(file.lastModified).toISOString();\n } catch {\n throw this.error('io', operation, path, 'Native file metadata is inconsistent.');\n }\n\n return Object.freeze({\n kind: 'file',\n path,\n name: workspacePathBasename(path),\n size: file.size,\n version: await metadataVersion(\n 'file',\n new TextEncoder().encode(`${file.size}\\0${file.lastModified}`),\n operation,\n path,\n ),\n lastModified,\n });\n }\n\n private async planParents(\n path: WorkspacePath,\n createParents: boolean,\n operation: FsOperation,\n ): Promise<WorkspacePath[]> {\n const missing: WorkspacePath[] = [];\n for (const parent of parentChain(path)) {\n const handle = await this.getHandle(parent);\n if (handle?.kind === 'file') {\n throw this.error('type-mismatch', operation, parent, 'A parent path is a file.');\n }\n if (!handle) {\n if (!createParents) {\n throw this.error('not-found', operation, parent, 'Parent directory does not exist.');\n }\n missing.push(parent);\n }\n }\n return missing;\n }\n\n private async createDirectories(paths: readonly WorkspacePath[]): Promise<WorkspacePath[]> {\n const created: WorkspacePath[] = [];\n try {\n for (const path of paths) {\n if (!path) continue;\n const parent = await this.resolveDirectory(workspacePathDirname(path));\n if (!parent) {\n throw new DOMException('Parent directory does not exist.', 'NotFoundError');\n }\n await parent.getDirectoryHandle(workspacePathBasename(path), { create: true });\n created.push(path);\n }\n return created;\n } catch (error: unknown) {\n await this.rollbackDirectories(created);\n throw error;\n }\n }\n\n private async rollbackDirectories(paths: readonly WorkspacePath[]): Promise<void> {\n for (const path of [...paths].reverse()) {\n try {\n await this.removeEntry(path, false);\n } catch {\n // Best effort: a non-empty directory may now contain external data.\n }\n }\n }\n\n private async writeBytes(path: WorkspacePath, data: ArrayBuffer): Promise<void> {\n const parent = await this.resolveDirectory(workspacePathDirname(path));\n if (!parent) throw new DOMException('Parent directory does not exist.', 'NotFoundError');\n const fileHandle = await parent.getFileHandle(workspacePathBasename(path), { create: true });\n const writable = await fileHandle.createWritable();\n await writeAndClose(writable, data);\n }\n\n private async removeEntry(path: WorkspacePath, recursive: boolean): Promise<void> {\n const parent = await this.resolveDirectory(workspacePathDirname(path));\n if (!parent) throw new DOMException('Parent directory does not exist.', 'NotFoundError');\n await parent.removeEntry(workspacePathBasename(path), { recursive });\n }\n\n private async removeEmptyFileIfPresent(path: WorkspacePath): Promise<void> {\n const current = await this.tryScanMetadata(path, 'write');\n if (current?.root.kind !== 'file' || current.root.size !== 0) return;\n await this.removeEntry(path, false);\n }\n\n private async currentTreeVersion(operation: FsOperation): Promise<FileSystemVersion> {\n return (await this.scanMetadataHandle(WORKSPACE_ROOT, this.root, operation)).root.version;\n }\n\n private async writeTree(\n source: SnapshotScan,\n sourcePath: WorkspacePath,\n destinationPath: WorkspacePath,\n ): Promise<void> {\n const remapped = source.entries.map((entry) => {\n const suffix = entry.path.slice(sourcePath.length);\n return [entry, parseWorkspacePath(`${destinationPath}${suffix}`)] as const;\n });\n const directories = remapped\n .filter(\n (item): item is readonly [FileSystemDirectorySnapshot, WorkspacePath] =>\n item[0].kind === 'directory',\n )\n .sort((left, right) => pathDepth(left[1]) - pathDepth(right[1]));\n for (const [, path] of directories) {\n const parent = await this.resolveDirectory(workspacePathDirname(path));\n if (!parent) throw new DOMException('Parent directory does not exist.', 'NotFoundError');\n await parent.getDirectoryHandle(workspacePathBasename(path), { create: true });\n }\n for (const [entry, path] of remapped) {\n if (entry.kind === 'file') await this.writeBytes(path, entry.data);\n }\n }\n\n private async rollbackMoveAndThrow(\n sourcePath: WorkspacePath,\n destinationPath: WorkspacePath,\n source: SnapshotScan,\n createdParents: readonly WorkspacePath[],\n destinationVersion: FileSystemVersion | null,\n sourceDeleted: boolean,\n primary: unknown,\n ): Promise<never> {\n const primaryError = this.translateError(primary, 'move', sourcePath, destinationPath);\n const recoveryErrors: FsError[] = [];\n\n const sourceCurrent = await this.probeScan(sourcePath);\n if (sourceCurrent === null && sourceDeleted) {\n try {\n await this.writeTree(source, sourcePath, sourcePath);\n const restored = await this.probeSnapshot(sourcePath);\n if (!restored || !equalTreeContents(source, sourcePath, restored, sourcePath)) {\n throw new FsError('conflict', 'Restored source does not match its captured state.', {\n operation: 'move',\n path: sourcePath,\n destinationPath,\n });\n }\n } catch (error: unknown) {\n recoveryErrors.push(this.translateError(error, 'move', sourcePath, destinationPath));\n }\n }\n\n const destinationCurrent = await this.probeScan(destinationPath);\n if (destinationCurrent) {\n if (destinationVersion && destinationCurrent.root.version !== destinationVersion) {\n recoveryErrors.push(\n new FsError('conflict', 'Destination changed; rollback will not delete it.', {\n operation: 'move',\n path: sourcePath,\n destinationPath,\n }),\n );\n } else {\n try {\n await this.removeEntry(destinationPath, destinationCurrent.root.kind === 'directory');\n } catch (error: unknown) {\n recoveryErrors.push(this.translateError(error, 'move', sourcePath, destinationPath));\n }\n }\n }\n await this.rollbackDirectories(createdParents);\n\n const state: NativeFileSystemMoveRecoveryState = {\n source: await this.probePresence(sourcePath),\n destination: await this.probePresence(destinationPath),\n };\n if (\n recoveryErrors.length === 0 &&\n state.source === 'present' &&\n state.destination === 'missing'\n ) {\n throw primaryError;\n }\n throw new NativeFileSystemMoveRecoveryError(\n sourcePath,\n destinationPath,\n primaryError,\n recoveryErrors,\n state,\n );\n }\n\n private async probeScan(path: WorkspacePath): Promise<MetadataScan | null | undefined> {\n try {\n return await this.tryScanMetadata(path, 'move');\n } catch {\n return undefined;\n }\n }\n\n private async probeSnapshot(path: WorkspacePath): Promise<SnapshotScan | null | undefined> {\n try {\n return await this.tryScanSnapshot(path, 'move');\n } catch {\n return undefined;\n }\n }\n\n private async probePresence(path: WorkspacePath): Promise<NativeFileSystemMovePathState> {\n try {\n return (await this.getHandle(path)) ? 'present' : 'missing';\n } catch {\n return 'unknown';\n }\n }\n}\n\nasync function listDirectory(\n directory: FileSystemDirectoryHandle,\n operation: FsOperation,\n path: WorkspacePath,\n): Promise<readonly (readonly [string, FileSystemHandle])[]> {\n const entries: Array<readonly [string, FileSystemHandle]> = [];\n try {\n for await (const entry of directory as unknown as AsyncIterable<\n readonly [string, FileSystemHandle]\n >) {\n const [name, handle] = entry;\n if (\n typeof name !== 'string' ||\n !handle ||\n (handle.kind !== 'file' && handle.kind !== 'directory')\n ) {\n throw new FsError('io', 'Native directory returned an invalid entry.', {\n operation,\n path,\n });\n }\n entries.push([name, handle]);\n }\n } catch (error: unknown) {\n throw fsErrorFromUnknown(error, { operation, path });\n }\n entries.sort(([left], [right]) => compareText(left, right));\n return entries;\n}\n\nasync function writeAndClose(\n writable: FileSystemWritableFileStream,\n data: ArrayBuffer,\n): Promise<void> {\n try {\n await writable.write(data);\n await writable.close();\n } catch (error: unknown) {\n await writable.abort(error).catch(() => undefined);\n throw error;\n }\n}\n\nasync function metadataVersion(\n kind: 'file' | 'directory',\n metadata: Uint8Array,\n operation: FsOperation,\n path: WorkspacePath,\n): Promise<FileSystemVersion> {\n const prefix = new TextEncoder().encode(`${kind}\\0`);\n const input = new Uint8Array(prefix.byteLength + metadata.byteLength);\n input.set(prefix);\n input.set(metadata, prefix.byteLength);\n let digest: ArrayBuffer;\n try {\n digest = await globalThis.crypto.subtle.digest('SHA-256', input.buffer as ArrayBuffer);\n } catch (error: unknown) {\n throw fsErrorFromUnknown(error, {\n operation,\n path,\n defaultCode: 'not-supported',\n });\n }\n const hex = [...new Uint8Array(digest)]\n .map((value) => value.toString(16).padStart(2, '0'))\n .join('');\n return parseFileSystemVersion(`sha256:${hex}`);\n}\n\nfunction parentChain(path: WorkspacePath): WorkspacePath[] {\n const parents: WorkspacePath[] = [];\n let current = workspacePathDirname(path);\n while (current) {\n parents.unshift(current);\n current = workspacePathDirname(current);\n }\n return parents;\n}\n\nfunction pathDepth(path: WorkspacePath): number {\n return path ? path.split('/').length : 0;\n}\n\nfunction errorName(error: unknown): string | null {\n if (!error || typeof error !== 'object') return null;\n const name = (error as { name?: unknown }).name;\n return typeof name === 'string' ? name : null;\n}\n\nfunction isMissingOrKindError(error: unknown): boolean {\n const name = errorName(error);\n return name === 'NotFoundError' || name === 'TypeMismatchError';\n}\n\nfunction copyBytes(data: ArrayBuffer | Uint8Array): ArrayBuffer {\n const source = ArrayBuffer.isView(data)\n ? new Uint8Array(data.buffer, data.byteOffset, data.byteLength)\n : new Uint8Array(data);\n const copy = new Uint8Array(source.byteLength);\n copy.set(source);\n return copy.buffer as ArrayBuffer;\n}\n\nfunction equalBytes(left: ArrayBuffer, right: ArrayBuffer): boolean {\n const leftBytes = new Uint8Array(left);\n const rightBytes = new Uint8Array(right);\n return (\n leftBytes.byteLength === rightBytes.byteLength &&\n leftBytes.every((value, index) => value === rightBytes[index])\n );\n}\n\nfunction equalTreeContents(\n left: SnapshotScan,\n leftRoot: WorkspacePath,\n right: SnapshotScan,\n rightRoot: WorkspacePath,\n): boolean {\n if (left.entries.length !== right.entries.length) return false;\n\n const rightByRelativePath = new Map<\n string,\n FileSystemDirectorySnapshot | FileSystemSnapshotFile\n >();\n for (const entry of right.entries) {\n const relativePath = treeRelativePath(rightRoot, entry.path);\n if (relativePath === null || rightByRelativePath.has(relativePath)) return false;\n rightByRelativePath.set(relativePath, entry);\n }\n\n for (const entry of left.entries) {\n const relativePath = treeRelativePath(leftRoot, entry.path);\n if (relativePath === null) return false;\n const counterpart = rightByRelativePath.get(relativePath);\n if (!counterpart || counterpart.kind !== entry.kind) return false;\n if (entry.kind === 'file') {\n if (counterpart.kind !== 'file' || !equalBytes(entry.data, counterpart.data)) return false;\n }\n }\n return true;\n}\n\nfunction treeRelativePath(root: WorkspacePath, path: WorkspacePath): string | null {\n if (path === root) return '';\n const prefix = root ? `${root}/` : '';\n return path.startsWith(prefix) ? path.slice(prefix.length) : null;\n}\n\nfunction withoutData(entry: FileSystemEntrySnapshot): FileSystemEntrySnapshot {\n if (entry.kind === 'directory') return Object.freeze({ ...entry });\n return Object.freeze({\n kind: 'file',\n path: entry.path,\n name: entry.name,\n size: entry.size,\n version: entry.version,\n lastModified: entry.lastModified,\n });\n}\n\nfunction copySnapshotEntry(entry: FileSystemSnapshotEntry): FileSystemSnapshotEntry {\n if (entry.kind === 'directory') return Object.freeze({ ...entry });\n return Object.freeze({\n kind: 'file',\n path: entry.path,\n name: entry.name,\n size: entry.size,\n version: entry.version,\n lastModified: entry.lastModified,\n data: entry.data.slice(0),\n });\n}\n\nfunction newestLastModified(children: readonly FileSystemEntrySnapshot[]): string {\n let newest = 0;\n for (const child of children) {\n const timestamp = Date.parse(child.lastModified);\n if (Number.isFinite(timestamp)) newest = Math.max(newest, timestamp);\n }\n return newest ? new Date(newest).toISOString() : EPOCH;\n}\n\nfunction compareSnapshots(left: FileSystemEntrySnapshot, right: FileSystemEntrySnapshot): number {\n if (left.kind !== right.kind) return left.kind === 'directory' ? -1 : 1;\n return compareText(left.name, right.name);\n}\n\nfunction compareText(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n","/**\n * NativeFileSystemProvider — wraps the File System Access API\n * (window.showDirectoryPicker / FileSystemDirectoryHandle).\n *\n * Progressive enhancement: only available in browsers that support\n * the API (Chrome, Edge). Feature-detect with `isNativeFileSystemSupported()`.\n */\n\nimport type { FileCommitResult, FileSystemProvider, FileSystemEntry, FileMeta } from './types.js';\nimport { withFileCommitLock } from './commit-lock.js';\nimport { NativeFileSystemProviderV2 } from './native-provider-v2.js';\nimport { parseWorkspacePath } from './workspace-path.js';\n\n// ── Feature detection ──────────────────────────────────────────────\n\nexport function isNativeFileSystemSupported(): boolean {\n return (\n typeof globalThis !== 'undefined' &&\n typeof (globalThis as { showDirectoryPicker?: unknown }).showDirectoryPicker === 'function'\n );\n}\n\n// ── Handle persistence (IndexedDB, structured clone) ───────────────\n\nconst HANDLE_DB_NAME = 'docblocks-handles';\nconst HANDLE_STORE_NAME = 'directory-handles';\n\nfunction openHandleDB(): Promise<IDBDatabase> {\n return new Promise((resolve, reject) => {\n const req = indexedDB.open(HANDLE_DB_NAME, 1);\n req.onupgradeneeded = () => {\n req.result.createObjectStore(HANDLE_STORE_NAME);\n };\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n });\n}\n\n/** Persist a FileSystemDirectoryHandle so it survives page reloads. */\nexport async function storeDirectoryHandle(\n workspaceId: string,\n handle: FileSystemDirectoryHandle,\n): Promise<void> {\n const db = await openHandleDB();\n return new Promise((resolve, reject) => {\n const tx = db.transaction(HANDLE_STORE_NAME, 'readwrite');\n tx.objectStore(HANDLE_STORE_NAME).put(handle, workspaceId);\n tx.oncomplete = () => {\n db.close();\n resolve();\n };\n tx.onerror = () => {\n db.close();\n reject(tx.error);\n };\n });\n}\n\n/** Retrieve a previously stored handle. Returns null if not found. */\nexport async function loadDirectoryHandle(\n workspaceId: string,\n): Promise<FileSystemDirectoryHandle | null> {\n const db = await openHandleDB();\n return new Promise((resolve, reject) => {\n const tx = db.transaction(HANDLE_STORE_NAME, 'readonly');\n const req = tx.objectStore(HANDLE_STORE_NAME).get(workspaceId);\n req.onsuccess = () => {\n db.close();\n resolve(req.result ?? null);\n };\n req.onerror = () => {\n db.close();\n reject(req.error);\n };\n });\n}\n\n/** Remove a stored handle (e.g. when deleting a workspace). */\nexport async function removeDirectoryHandle(workspaceId: string): Promise<void> {\n const db = await openHandleDB();\n return new Promise((resolve, reject) => {\n const tx = db.transaction(HANDLE_STORE_NAME, 'readwrite');\n tx.objectStore(HANDLE_STORE_NAME).delete(workspaceId);\n tx.oncomplete = () => {\n db.close();\n resolve();\n };\n tx.onerror = () => {\n db.close();\n reject(tx.error);\n };\n });\n}\n\n// ── Helpers ────────────────────────────────────────────────────────\n\nfunction normalisePath(p: string): string {\n return parseWorkspacePath(p);\n}\n\nfunction errorName(error: unknown): string | undefined {\n return typeof error === 'object' && error !== null && 'name' in error\n ? String((error as { name?: unknown }).name)\n : undefined;\n}\n\nfunction isMissingEntryError(error: unknown): boolean {\n const name = errorName(error);\n return name === 'NotFoundError' || name === 'TypeMismatchError';\n}\n\nfunction isPermissionError(error: unknown): boolean {\n const name = errorName(error);\n return name === 'NotAllowedError' || name === 'SecurityError';\n}\n\nclass NativeMoveRecoveryError extends Error {\n readonly causes: readonly unknown[];\n\n constructor(message: string, causes: readonly unknown[]) {\n super(message);\n this.name = 'NativeMoveRecoveryError';\n this.causes = causes;\n }\n}\n\n/**\n * Walk a chain of path segments to reach a FileSystemDirectoryHandle.\n * Returns null if any segment is missing.\n */\nasync function resolveDir(\n root: FileSystemDirectoryHandle,\n dirPath: string,\n): Promise<FileSystemDirectoryHandle | null> {\n if (!dirPath) return root;\n const parts = dirPath.split('/');\n let current = root;\n for (const part of parts) {\n try {\n current = await current.getDirectoryHandle(part);\n } catch (error: unknown) {\n if (isMissingEntryError(error)) return null;\n throw error;\n }\n }\n return current;\n}\n\n/**\n * Walk path segments, creating directories as needed.\n */\nasync function resolveDirCreate(\n root: FileSystemDirectoryHandle,\n dirPath: string,\n): Promise<FileSystemDirectoryHandle> {\n if (!dirPath) return root;\n const parts = dirPath.split('/');\n let current = root;\n for (const part of parts) {\n current = await current.getDirectoryHandle(part, { create: true });\n }\n return current;\n}\n\nfunction parentDir(p: string): string {\n const idx = p.lastIndexOf('/');\n return idx === -1 ? '' : p.slice(0, idx);\n}\n\nfunction baseName(p: string): string {\n const idx = p.lastIndexOf('/');\n return idx === -1 ? p : p.slice(idx + 1);\n}\n\nfunction toWritableBinary(data: ArrayBuffer | Uint8Array): ArrayBuffer {\n if (data instanceof ArrayBuffer) return data;\n const copy = new Uint8Array(data.byteLength);\n copy.set(data);\n return copy.buffer;\n}\n\nasync function writeAndClose(\n writable: FileSystemWritableFileStream,\n data: string | ArrayBuffer,\n): Promise<void> {\n try {\n await writable.write(data);\n await writable.close();\n } catch (error: unknown) {\n await writable.abort(error).catch(() => undefined);\n throw error;\n }\n}\n\n// ── Implementation ─────────────────────────────────────────────────\n\nexport class NativeFileSystemProvider implements FileSystemProvider {\n readonly id: string;\n readonly label: string;\n readonly v2: NativeFileSystemProviderV2;\n\n private root: FileSystemDirectoryHandle;\n\n constructor(id: string, root: FileSystemDirectoryHandle) {\n this.id = id;\n this.label = root.name;\n this.root = root;\n this.v2 = new NativeFileSystemProviderV2(id, root);\n }\n\n private withMutationLock<T>(operation: () => Promise<T>): Promise<T> {\n return withFileCommitLock(`native:${this.id}:workspace`, operation);\n }\n\n private async copyDirectory(oldDirPath: string, newDirPath: string): Promise<void> {\n const source = await resolveDir(this.root, oldDirPath);\n if (!source)\n throw new DOMException(`Source directory does not exist: ${oldDirPath}`, 'NotFoundError');\n await resolveDirCreate(this.root, newDirPath);\n\n for await (const [name, handle] of source as unknown as AsyncIterable<\n [string, FileSystemHandle]\n >) {\n const oldChild = oldDirPath ? `${oldDirPath}/${name}` : name;\n const newChild = newDirPath ? `${newDirPath}/${name}` : name;\n if (handle.kind === 'directory') {\n await this.copyDirectory(oldChild, newChild);\n } else {\n const fileHandle = await source.getFileHandle(name);\n const file = await fileHandle.getFile();\n await this.writeBinaryUnlocked(newChild, await file.arrayBuffer());\n }\n }\n }\n\n async readFile(path: string): Promise<string | null> {\n const p = normalisePath(path);\n const dir = await resolveDir(this.root, parentDir(p));\n if (!dir) return null;\n try {\n const fileHandle = await dir.getFileHandle(baseName(p));\n const file = await fileHandle.getFile();\n return file.text();\n } catch (error: unknown) {\n if (isMissingEntryError(error)) return null;\n throw error;\n }\n }\n\n async writeFile(path: string, content: string): Promise<void> {\n return this.withMutationLock(() => this.writeFileUnlocked(path, content));\n }\n\n private async writeFileUnlocked(path: string, content: string): Promise<void> {\n const p = normalisePath(path);\n const dir = await resolveDirCreate(this.root, parentDir(p));\n const fileHandle = await dir.getFileHandle(baseName(p), { create: true });\n const writable = await fileHandle.createWritable();\n await writeAndClose(writable, content);\n }\n\n async commitFile(\n path: string,\n content: string,\n expectedContent: string | null,\n ): Promise<FileCommitResult> {\n const p = normalisePath(path);\n return this.withMutationLock(async () => {\n const current = await this.readFile(p);\n if (current !== expectedContent && current !== content) {\n const meta = await this.stat(p);\n return {\n status: 'conflict',\n content: current,\n version: meta?.lastModified ?? null,\n };\n }\n await this.writeFileUnlocked(p, content);\n const meta = await this.stat(p);\n return { status: 'committed', version: meta?.lastModified ?? null };\n });\n }\n\n async delete(path: string): Promise<void> {\n return this.withMutationLock(() => this.deleteUnlocked(path));\n }\n\n private async deleteUnlocked(path: string): Promise<void> {\n const p = normalisePath(path);\n if (!p) throw new Error('Cannot delete the filesystem root');\n const parent = parentDir(p);\n const name = baseName(p);\n const dir = await resolveDir(this.root, parent);\n if (!dir) return;\n try {\n await dir.removeEntry(name, { recursive: true });\n } catch (error: unknown) {\n if (isMissingEntryError(error)) return;\n throw error;\n }\n }\n\n async rename(oldPath: string, newPath: string): Promise<void> {\n return this.withMutationLock(() => this.renameUnlocked(oldPath, newPath));\n }\n\n private async renameUnlocked(oldPath: string, newPath: string): Promise<void> {\n const op = normalisePath(oldPath);\n const np = normalisePath(newPath);\n if (op === np) return;\n if (!op || !np) {\n throw new Error('Cannot rename the filesystem root');\n }\n if (np.startsWith(op + '/')) {\n throw new Error('Cannot move a directory into itself');\n }\n if (!(await this.exists(op))) {\n throw new Error(`Source does not exist: ${oldPath}`);\n }\n if (await this.exists(np)) {\n throw new Error(`Destination exists: ${newPath}`);\n }\n\n // The File System Access API doesn't have a native rename.\n // Copy → delete.\n const oldParent = await resolveDir(this.root, parentDir(op));\n if (!oldParent) {\n throw new DOMException(`Source does not exist: ${oldPath}`, 'NotFoundError');\n }\n\n let fileHandle: FileSystemFileHandle | null = null;\n try {\n fileHandle = await oldParent.getFileHandle(baseName(op));\n } catch (error: unknown) {\n if (!isMissingEntryError(error)) throw error;\n }\n\n if (fileHandle) {\n const file = await fileHandle.getFile();\n await this.writeBinaryUnlocked(np, await file.arrayBuffer());\n try {\n await this.deleteUnlocked(op);\n } catch (error: unknown) {\n try {\n await this.deleteUnlocked(np);\n } catch (rollbackError: unknown) {\n throw new NativeMoveRecoveryError(\n `Move partially completed and rollback failed: ${oldPath} -> ${newPath}`,\n [error, rollbackError],\n );\n }\n throw error;\n }\n return;\n }\n\n try {\n await this.copyDirectory(op, np);\n } catch (error: unknown) {\n try {\n await this.deleteUnlocked(np);\n } catch (rollbackError: unknown) {\n throw new NativeMoveRecoveryError(\n `Move failed and destination cleanup failed: ${oldPath} -> ${newPath}`,\n [error, rollbackError],\n );\n }\n throw error;\n }\n\n try {\n await this.deleteUnlocked(op);\n } catch (error: unknown) {\n try {\n await this.deleteUnlocked(np);\n } catch (rollbackError: unknown) {\n throw new NativeMoveRecoveryError(\n `Move partially completed and rollback failed: ${oldPath} -> ${newPath}`,\n [error, rollbackError],\n );\n }\n throw error;\n }\n }\n\n async readDirectory(path: string): Promise<FileSystemEntry[]> {\n const p = normalisePath(path);\n const dir = await resolveDir(this.root, p);\n if (!dir) return [];\n\n const entries: FileSystemEntry[] = [];\n for await (const [name, handle] of dir as unknown as AsyncIterable<\n [string, FileSystemHandle]\n >) {\n const entryPath = p ? `${p}/${name}` : name;\n if (handle.kind === 'directory') {\n entries.push({ kind: 'directory', name, path: entryPath });\n } else {\n entries.push({ kind: 'file', name, path: entryPath });\n }\n }\n\n // Sort: directories first, then alphabetical\n entries.sort((a, b) => {\n if (a.kind !== b.kind) return a.kind === 'directory' ? -1 : 1;\n return a.name.localeCompare(b.name);\n });\n\n return entries;\n }\n\n async exists(path: string): Promise<boolean> {\n const p = normalisePath(path);\n const parent = parentDir(p);\n const name = baseName(p);\n const dir = await resolveDir(this.root, parent);\n if (!dir) return false;\n\n try {\n await dir.getFileHandle(name);\n return true;\n } catch (fileError: unknown) {\n if (!isMissingEntryError(fileError)) throw fileError;\n try {\n await dir.getDirectoryHandle(name);\n return true;\n } catch (directoryError: unknown) {\n if (!isMissingEntryError(directoryError)) throw directoryError;\n return false;\n }\n }\n }\n\n async createDirectory(path: string): Promise<void> {\n return this.withMutationLock(async () => {\n const p = normalisePath(path);\n await resolveDirCreate(this.root, p);\n });\n }\n\n async stat(path: string): Promise<FileMeta | null> {\n const p = normalisePath(path);\n const dir = await resolveDir(this.root, parentDir(p));\n if (!dir) return null;\n\n try {\n const fileHandle = await dir.getFileHandle(baseName(p));\n const file = await fileHandle.getFile();\n return {\n name: file.name,\n path: p,\n size: file.size,\n lastModified: new Date(file.lastModified).toISOString(),\n };\n } catch (error: unknown) {\n if (isMissingEntryError(error)) return null;\n throw error;\n }\n }\n\n async readBinary(path: string): Promise<ArrayBuffer | null> {\n const p = normalisePath(path);\n const dir = await resolveDir(this.root, parentDir(p));\n if (!dir) return null;\n try {\n const fileHandle = await dir.getFileHandle(baseName(p));\n const file = await fileHandle.getFile();\n return file.arrayBuffer();\n } catch (error: unknown) {\n if (isMissingEntryError(error)) return null;\n throw error;\n }\n }\n\n async writeBinary(path: string, data: ArrayBuffer | Uint8Array): Promise<void> {\n return this.withMutationLock(() => this.writeBinaryUnlocked(path, data));\n }\n\n private async writeBinaryUnlocked(path: string, data: ArrayBuffer | Uint8Array): Promise<void> {\n const p = normalisePath(path);\n const dir = await resolveDirCreate(this.root, parentDir(p));\n const fileHandle = await dir.getFileHandle(baseName(p), { create: true });\n const writable = await fileHandle.createWritable();\n await writeAndClose(writable, toWritableBinary(data));\n }\n}\n\n/**\n * Prompt the user to pick a local folder and return a NativeFileSystemProvider.\n * The directory handle is persisted in IndexedDB so it can be restored later.\n * Throws if the user cancels or the API is unsupported.\n */\nexport async function openNativeFolder(): Promise<NativeFileSystemProvider> {\n if (!isNativeFileSystemSupported()) {\n throw new Error('File System Access API is not supported in this browser');\n }\n\n const handle = await (\n globalThis as unknown as {\n showDirectoryPicker: (options: { mode: 'readwrite' }) => Promise<FileSystemDirectoryHandle>;\n }\n ).showDirectoryPicker({ mode: 'readwrite' });\n const id = `native-${handle.name}-${Date.now()}`;\n await storeDirectoryHandle(id, handle);\n return new NativeFileSystemProvider(id, handle);\n}\n\n/**\n * Restore a previously opened native folder from a persisted handle.\n * Re-requests read/write permission (browser will show a prompt).\n * Returns null if the handle is not found or permission is denied.\n */\nexport async function restoreNativeFolder(\n workspaceId: string,\n): Promise<NativeFileSystemProvider | null> {\n const handle = await loadDirectoryHandle(workspaceId);\n if (!handle) return null;\n\n // Verify/request permission\n const opts = { mode: 'readwrite' as const };\n const h = handle as FileSystemDirectoryHandle & {\n queryPermission(desc: { mode: string }): Promise<string>;\n requestPermission(desc: { mode: string }): Promise<string>;\n };\n try {\n if ((await h.queryPermission(opts)) === 'granted') {\n return new NativeFileSystemProvider(workspaceId, handle);\n }\n if ((await h.requestPermission(opts)) === 'granted') {\n return new NativeFileSystemProvider(workspaceId, handle);\n }\n } catch (error: unknown) {\n if (!isPermissionError(error)) throw error;\n }\n\n return null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoDO,IAAM,oCAAN,cAAgD,QAAQ;AAAA,EAKtD,YACL,YACA,iBACA,cACA,gBACA,OACA;AACA;AAAA,MACE;AAAA,MACA,+CAA+C,MAAM,MAAM,kBAAkB,MAAM,WAAW;AAAA,MAC9F;AAAA,QACE,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,QACA,WAAW;AAAA,MACb;AAAA,IACF;AACA,SAAK,OAAO;AACZ,SAAK,eAAe;AACpB,SAAK,iBAAiB,OAAO,OAAO,CAAC,GAAG,cAAc,CAAC;AACvD,SAAK,QAAQ,OAAO,OAAO,EAAE,GAAG,MAAM,CAAC;AAAA,EACzC;AACF;AAEA,IAAM,SAAQ,oBAAI,KAAK,CAAC,GAAE,YAAY;AAEtC,IAAM,yBAAyD,OAAO,OAAO;AAAA,EAC3E,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,OAAO;AAAA,EACP,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,YAAY;AACd,CAAC;AAGM,IAAM,6BAAN,MAAiE;AAAA,EAY/D,YAAY,IAAY,MAAiC;AAThE,SAAgB,eAAe;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