diff --git a/main.js b/main.js
index 96471a7..e4fe40e 100644
--- a/main.js
+++ b/main.js
@@ -1,9 +1,9 @@
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
*/
-"use strict";var Tn=Object.defineProperty;var Co=Object.getOwnPropertyDescriptor;var So=Object.getOwnPropertyNames;var Fo=Object.prototype.hasOwnProperty;var Ue=(e,t)=>{for(var n in t)Tn(e,n,{get:t[n],enumerable:!0})},Mo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of So(t))!Fo.call(e,i)&&i!==n&&Tn(e,i,{get:()=>t[i],enumerable:!(r=Co(t,i))||r.enumerable});return e};var vo=e=>Mo(Tn({},"__esModule",{value:!0}),e);var kl={};Ue(kl,{default:()=>hl});module.exports=vo(kl);var bo=require("obsidian");function R(e,t){return`${e}:${t}`}function An(e){return e?.cardType==="basic"}function ti(e){return e?.cardType==="cloze"}function z(e){return e?.cardType==="qa-group"}var ni=require("obsidian");function ue(){return(0,ni.getLanguage)()==="zh"?"zh":"en"}function se(e,t){return t.join(e==="zh"?"\u3001":", ")}var Dn={commands:{syncCurrentFileToAnki:"Sync current file to Anki",syncVaultToAnki:"Sync vault to Anki",clearCurrentFileSyncedCards:"Clear synced cards in current file",cleanupEmptyDecks:"Clean up empty decks"},settings:{pluginTitle:"Anki Heading Sync",ankiConnectUrl:{name:"AnkiConnect URL",desc:"Default is http://127.0.0.1:8765",placeholder:"http://127.0.0.1:8765"},qaHeadingLevel:{name:"QA heading level",desc:"Default is H4"},clozeHeadingLevel:{name:"Cloze heading level",desc:"Default is H5"},cardAnswerCutoffMode:{name:"Card answer cutoff mode",desc:"A valid sync marker always wins. Without a valid marker, either keep the whole heading block or stop before the first 2+ consecutive blank lines.",options:{headingBlock:"heading-block: whole heading block",doubleBlankLines:"double-blank-lines: stop before the first 2+ blank lines"}},qaGroup:{title:"QA Group list notes",marker:{name:"QA Group marker",desc:"When a QA heading ends with this hashtag marker, the whole heading block syncs as one QA Group list note.",placeholder:"#anki-list"},managedNoteType:"Current note type: {{modelName}}. This route syncs QA Group list notes using the field mapping shown below.",managedModelContract:"Current note type summary: {{fieldCount}} fields and {{templateCount}} templates are available for this route."},syncOptions:{addObsidianBacklink:{name:"Add Obsidian backlink",desc:"Append a backlink to the source heading into synced cards."},obsidianBacklinkLabel:{name:"Obsidian backlink label",desc:"The text shown for the backlink. Blank input falls back to Open in Obsidian.",placeholder:"Open in Obsidian"},obsidianBacklinkPlacement:{name:"Obsidian backlink placement",desc:"Choose whether the backlink is appended to the question field or placed at the start or end of the answer body.",options:{questionLastLine:"Last line of question field",answerFirstLine:"First line of answer body",answerLastLine:"Last line of answer body"}},highlightsToCloze:{name:"Highlights to Cloze",desc:"Convert ==highlight== segments into cloze deletions for cloze cards."},syncObsidianTagsToAnki:{name:"Sync Obsidian tags to Anki",desc:"Sync Obsidian-recognized tags from the current note into Anki note tags, including nested tags. On each sync, these tags overwrite the managed tags in Anki based on the current Obsidian content."},keepPureTagLinesInCardBody:{name:"Keep pure tag lines in card body",desc:'When turned off, remove every line in the card body that contains only tags, such as "#ProjectA #\u91CD\u70B9/\u6848\u4F8B". Inline tags like "This is a #tag example" and lines with ordinary text like "\u6807\u7B7E\uFF1A#\u9879\u76EEA" are kept. Extra blank lines created by removal are cleaned up automatically.'}},mapping:{title:"Note type field mappings",refresh:{name:"Refresh note types from Anki",button:"Refresh note types"},status:{idle:"Refresh note types from Anki to load the available note types.",loadedCount:"Loaded {{count}} note types from Anki.",empty:"Anki returned no note types.",failedLoadNoteTypes:"Failed to load note types from Anki.",loadedSavedMapping:"Loaded saved mapping for {{modelName}}.",selectedModel:"Selected {{modelName}}. Read fields from Anki to create or refresh its mapping.",loadedFieldsForModel:"Loaded fields for {{modelName}}. Review the suggested mapping and save it.",failedLoadFields:"Failed to load fields for {{modelName}}.",noLoadedFields:"No loaded fields for {{modelName}}. Read fields from Anki first.",savedMapping:"Saved mapping for {{modelName}}.",failedSaveMapping:"Failed to save mapping for {{modelName}}.",savedMappingReady:"Saved mapping is ready for {{title}}.",noSavedMapping:"No saved mapping for {{title}}. Read fields from Anki first."},section:{basic:{title:"QA / Basic",description:"Choose the QA note type, read its fields from Anki, then confirm the title/body mapping."},cloze:{title:"Cloze",description:"Choose the cloze note type, read its fields from Anki, then confirm the main field mapping."}},noteTypeLabel:"{{title}} note type",noteTypeDesc:"Loaded from Anki note types. Refresh if the latest models are not shown.",fieldsLabel:"{{title}} fields",fieldsDesc:"Load the current note type fields from Anki, then review the suggested mapping.",readFieldsButton:"Read fields from Anki",loadedFields:"Loaded fields: {{fields}}",loadedFieldsNone:"Loaded fields: none. Read fields from Anki first.",mappingLabel:"{{title}} mapping",mappingDesc:"Save the current field mapping for this specific note type.",saveMappingButton:"Save mapping",titleFieldLabel:"{{title}} title field",titleFieldDesc:"Which Anki field should receive the heading/title fragment.",bodyFieldLabel:"{{title}} body field",bodyFieldDesc:"Which Anki field should receive the body fragment.",mainField:{name:"Cloze main field",desc:"The selected field receives title +
=p))){a=o===61?1:2;break}}if(e.sCount[u]<0)continue;let f=!1;for(let m=0,p=r.length;m
3||e.sCount[a]<0)continue;let c=!1;for(let l=0,d=r.length;l ${t} ]*>.*?<\/a><\/p>/g,"").replace(/ =p))){a=o===61?1:2;break}}if(e.sCount[u]<0)continue;let f=!1;for(let m=0,p=r.length;m 3||e.sCount[a]<0)continue;let c=!1;for(let l=0,d=r.length;l ${t} ]*>.*?<\/a><\/p>/g,"").replace(/te((2147483647-i)/c)&&he("overflow"),i+=(s-r)*c,r=s;for(let l of e)if(l
${t}`:t,body:e.body};let r=`
]*>.*?<\/a>/g,"").trim()}function tl(e){return e.includes("GroupId")&&e.includes("Src")&&e.some(n=>/^S\d+_Id$/i.test(n))&&e.some(n=>/^S\d+_Q$/i.test(n))&&e.some(n=>/^S\d+_A$/i.test(n))?e.filter(n=>n==="GroupId"||n==="Src"||/^S\d+_Id$/i.test(n)):[]}function nl(e){let t=[];return{text:e.replace(Wd,r=>{let i=`@@QA_GROUP_INLINE_CODE_${t.length}@@`;return t.push(r),i}),restore:r=>t.reduce((i,a,o)=>i.split(`@@QA_GROUP_INLINE_CODE_${o}@@`).join(a),r)}}var rl="manual-render-v3",Te=class{constructor(t=new Oe){this.deckResolutionService=t}resolve(t,n){let r=il(t.cardType,n),i=this.deckResolutionService.resolve(t,n.defaultDeck,n.folderDeckMode),a=i.resolvedDeck.value,o=n.noteFieldMappings[R(t.cardType,r)]??null,u=t.cardType==="cloze"&&t.clozeMode==="all"?"all":void 0,s={version:rl,cardType:t.cardType,clozeMode:u,noteModel:r,mapping:o,addObsidianBacklink:n.addObsidianBacklink,obsidianBacklinkLabel:n.obsidianBacklinkLabel,obsidianBacklinkPlacement:n.obsidianBacklinkPlacement,convertHighlightsToCloze:n.convertHighlightsToCloze,keepPureTagLinesInCardBody:n.keepPureTagLinesInCardBody},c=Q(JSON.stringify(s));return{deck:a,noteModel:r,renderConfigHash:c,warnings:i.warnings}}};function il(e,t){if(_i(e)){if(!t.clozeNoteType.trim())throw new S("errors.noteFieldMapping.noteTypeNotSelected.cloze");return t.clozeNoteType}if(!t.qaNoteType.trim())throw new S("errors.noteFieldMapping.noteTypeNotSelected.basic");return t.qaNoteType}var Yr=/`[^`\n]+`/g,Xr=/```[\s\S]*?```|~~~[\s\S]*?~~~/g,Sn=/==(.+?)==/g,Jr=/(?:(?0&&i.add(u)}for(let o of r.text.matchAll(Jr)){let u=o[1],s=u?Number(u):e.clozeMode==="all"?1:a++;Number.isInteger(s)&&s>0&&i.add(s)}return i}function $e(e,t,n){let r=[];return{text:e.replace(t,a=>{let o=`@@${n}_${r.length}@@`;return r.push(a),o}),restore:(a,o=u=>u)=>r.reduce((u,s,c)=>u.split(`@@${n}_${c}@@`).join(o(s)),a)}}var Fn=class{constructor(t=new Te){this.renderConfigService=t}plan(t,n,r,i){let a=new Map,o=new Set(n.pendingWriteBack.filter(x=>x.markerKind!=="group-gi").map(x=>_e(x.filePath,x.blockStartLine,x.rawBlockHash))),u=new Set,s=[],c=[],l=[],d=[],f=[],m=[],p=new Map,F=0;for(let x of t){if(a.has(x.syncKey))throw new Error(`Duplicate syncKey detected in current scan: ${x.syncKey}`);if(a.set(x.syncKey,x),x.noteId!==void 0){let P=q(x.noteId);if(u.has(P))throw new Error(`Duplicate noteId detected in current scan: ${x.noteId}`);u.add(P)}let C=x.noteId!==void 0?n.cards[q(x.noteId)]:void 0,h=this.renderConfigService.resolve(x,i);for(let P of h.warnings)p.set(We(P),P);let M=x.noteId,w=_e(x.filePath,x.blockStartLine,x.rawBlockHash),E={card:{...x,noteId:M},noteId:M,deck:h.deck,noteModel:h.noteModel,renderConfigHash:h.renderConfigHash};if(!M){s.push(E);continue}if(ol(C,x,i)){c.push(E);continue}if(d.push(E),(x.idMarkerState!=="present-valid"||x.noteIdSource!=="marker"||o.has(w))&&m.push(E),!C){l.push(E);continue}let T=C.rawBlockHash!==x.rawBlockHash||C.renderConfigHash!==h.renderConfigHash||!Xi(C.tagsHint,x.tagsHint)||C.orphan,N=C.deck!==h.deck;T&&l.push(E),N&&f.push(E),!T&&!N&&(F+=1)}let k=new Set(r),y=Object.values(n.cards).filter(x=>k.has(x.filePath)&&!u.has(q(x.noteId)));return{toCreate:s,toRebuild:c,toUpdate:l,toVerifyDeck:d,toChangeDeck:f,toRewriteMarker:m,toOrphan:y,unchangedCards:F,warnings:Array.from(p.values())}}};function ol(e,t,n){if(!e||e.cardType!=="cloze"||t.cardType!=="cloze")return!1;let r=Ie(e.cardType,e.clozeMode);if(r!=="sequential"||t.clozeMode!=="all")return!1;let i=ei({bodyMarkdown:e.bodyMarkdown,clozeMode:r,convertHighlightsToCloze:n.convertHighlightsToCloze}),a=ei({bodyMarkdown:t.bodyMarkdown,clozeMode:t.clozeMode,convertHighlightsToCloze:n.convertHighlightsToCloze});return i.size>a.size}var yo=new ot({breaks:!0,html:!0,linkify:!0}),ul=/(?`\\[${k.trim()}\\]`),c=c.replace(sl,(F,k)=>`\\(${k.trim()}\\)`),i&&r.convertHighlightsToCloze&&(c=c.replace(Sn,"{$1}")),i&&(c=c.replace(Jr,(F,k,y)=>`{{c${k?Number(k):n.card.clozeMode==="all"?1:d++}::${y}}}`)),c=c.replace(dl,(F,k)=>{let y=r.resourceResolver.resolveEmbed(k,n.card.filePath);return y?(l.push({kind:y.kind,fileName:y.fileName,absolutePath:y.absolutePath,altText:y.altText}),y.kind==="audio"?`[sound:${y.fileName}]`:``):F}),c=c.replace(ll,(F,k)=>{let y=r.resourceResolver.resolveWikiLink(k,n.card.filePath);return y?`${st(y.displayText)}`:F}),c=c.replace(Sn,"$1");let f=$e(c,cl,"MATH");c=f.text,c=s.restore(c),c=u.restore(c);let m=(a?yo.renderInline(c):yo.render(c)).trim(),p=f.restore(m,st);return{html:a?p:yn(p),media:l}}};function pl(e){let t=new Set;return e.filter(n=>{let r=`${n.kind}:${n.absolutePath}:${n.fileName}`;return t.has(r)?!1:(t.add(r),!0)})}function st(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}var ct=class extends S{constructor(t){super("errors.currentFileOutOfScope",{filePath:t}),this.name="CurrentFileOutOfScopeError"}},Qe=class extends S{constructor(){super("errors.runScopeNotConfigured"),this.name="RunScopeNotConfiguredError"}},vn=class{constructor(t,n,r,i=new Zt(t),a=new Fn,o=new Mn,u=new Ot(r),s=new Yt(t),c=new Te,l=()=>Date.now()){this.vaultGateway=t;this.pluginStateRepository=n;this.ankiGateway=r;this.fileIndexerService=i;this.diffPlannerService=a;this.renderer=o;this.ankiBatchExecutor=u;this.markdownWriteBackService=s;this.scanScopeService=new Pe;if(this.qaGroupSyncService=new Cn(r,void 0,void 0,void 0,void 0,void 0,void 0,this.vaultGateway.createBacklink.bind(this.vaultGateway)),fl(c)){this.renderConfigService=c,this.now=l;return}this.renderConfigService=new Te,this.now=c}async syncVault(t){le(t),this.assertRunScopeConfigured(t);let n=await this.pluginStateRepository.load(),r=await this.fileIndexerService.indexVault(t,n);return this.syncIndexedResult(r,n,t)}async syncFile(t,n){if(le(n),this.assertRunScopeConfigured(n),!this.scanScopeService.isPathInScope(t,n.scopeMode,n.includeFolders,n.excludeFolders))throw new ct(t);let r=await this.pluginStateRepository.load(),i=await this.fileIndexerService.indexFile(t,n,r);return this.syncIndexedResult(i,r,n)}assertRunScopeConfigured(t){if(!gt(t.scopeMode,t.includeFolders))throw new Qe}async syncIndexedResult(t,n,r){let i=this.diffPlannerService.plan(t.cards,n,t.scopedFilePaths,r),a={addObsidianBacklink:r.addObsidianBacklink,obsidianBacklinkLabel:r.obsidianBacklinkLabel,obsidianBacklinkPlacement:r.obsidianBacklinkPlacement,convertHighlightsToCloze:r.convertHighlightsToCloze,keepPureTagLinesInCardBody:r.keepPureTagLinesInCardBody,resourceResolver:this.vaultGateway},o=new Map;for(let m of[...i.toCreate,...i.toRebuild,...i.toUpdate])o.has(m.card.syncKey)||o.set(m.card.syncKey,this.renderer.render(m,a));let u=await this.ankiBatchExecutor.execute(i,o,async m=>this.renderer.render(m,a),r.noteFieldMappings),s=await this.qaGroupSyncService.sync(t.groupBlocks,n,r),c=new Map(t.indexedFiles.map(m=>[m.filePath,m])),l=await this.markdownWriteBackService.write(u.markerWrites,c,s.markerWrites),d=gl(n,t.scopedFilePaths,s.syncedGroupBlocks),f=this.buildNextState(n,t.cards,t.indexedFiles,s.syncedGroupBlocks,r,new Set([...u.touchedSyncKeys,...s.touchedSyncKeys,...l.writtenSyncKeys]),u.resolvedNoteIds,i.toOrphan,d);if(f.pendingWriteBack=[...n.pendingWriteBack.filter(m=>!new Set(t.scopedFilePaths).has(m.filePath)),...l.pendingEntries],this.markFilesDirty(f,[...l.failureFiles.map(m=>m.filePath),...l.conflictFiles]),await this.pluginStateRepository.save(f),l.failureFiles.length>0)throw this.createWriteBackFailureError(l.failureFiles);return{scannedFiles:t.scannedFiles,scannedCards:t.cards.length+t.groupBlocks.length,created:u.created+s.created,rebuilt:u.rebuilt,updated:u.updated+s.updated,migratedNoteTypes:u.migratedNoteTypes+s.migratedNoteTypes,migratedDecks:u.migratedDecks+s.migratedDecks,orphaned:i.toOrphan.length+d.length,uploadedMedia:u.uploadedMedia,skippedUnchangedCards:t.skippedUnchangedCards,rewrittenMarkers:l.writtenSyncKeys.length,markerWriteConflictFiles:l.conflictFiles,warnings:ml(i.warnings,s.warnings)}}buildNextState(t,n,r,i,a,o,u,s,c){let l=this.now(),d=Un(a),f=new Set(r.filter(k=>k.content!==void 0).map(k=>k.filePath)),m=new Map;for(let k of i){let y=m.get(k.filePath);y?y.push(k):m.set(k.filePath,[k])}let p={files:{...t.files},cards:{...t.cards},groupBlocks:{...t.groupBlocks??{}},pendingWriteBack:[...t.pendingWriteBack]};for(let k of f)delete p.files[k];for(let[k,y]of Object.entries(p.cards))f.has(y.filePath)&&delete p.cards[k];for(let[k,y]of Object.entries(p.groupBlocks??{}))f.has(y.filePath)&&delete p.groupBlocks?.[k];let F=new Map;for(let k of n){let y=u.get(k.syncKey)??k.noteId;y!==void 0&&F.set(k.syncKey,y)}for(let k of r){if(k.content===void 0)continue;let y=Array.from(new Set(k.cards.map(x=>F.get(x.syncKey)).filter(x=>x!==void 0)));p.files[k.filePath]={filePath:k.filePath,fileHash:k.fileHash,fileStamp:k.fileStamp,deckRulesFingerprint:d,lastIndexedAt:l,noteIds:y,groupIds:(m.get(k.filePath)??[]).map(x=>x.groupId)}}for(let k of n){let y=F.get(k.syncKey);if(y===void 0)continue;let x=t.cards[q(y)]??(k.noteId!==void 0?t.cards[q(k.noteId)]:void 0),C=this.renderConfigService.resolve(k,a);p.cards[q(y)]={noteId:y,filePath:k.filePath,heading:k.heading,backlinkHeadingText:k.backlinkHeadingText,headingLevel:k.headingLevel,bodyMarkdown:k.bodyMarkdown,cardType:k.cardType,clozeMode:k.clozeMode,blockStartOffset:k.blockStartOffset,blockEndOffset:k.blockEndOffset,blockStartLine:k.blockStartLine,bodyStartLine:k.bodyStartLine,blockEndLine:k.blockEndLine,contentEndLine:k.contentEndLine,markerLine:k.markerLine,rawBlockText:k.rawBlockText,rawBlockHash:k.rawBlockHash,renderConfigHash:C.renderConfigHash,deck:C.deck,deckHint:k.deckHint,deckHintSource:k.deckHintSource,deckWarnings:[...k.deckWarnings],tagsHint:k.tagsHint,lastSyncedAt:o.has(k.syncKey)?l:x?.lastSyncedAt??0,orphan:!1}}for(let k of s)p.cards[q(k.noteId)]={...k,orphan:!0};for(let k of i)p.groupBlocks??(p.groupBlocks={}),p.groupBlocks[k.groupId]=k;for(let k of c)p.groupBlocks??(p.groupBlocks={}),p.groupBlocks[k.groupId]={...k,orphan:!0};return p}markFilesDirty(t,n){for(let r of new Set(n))t.files[r]&&(t.files[r]={...t.files[r],fileHash:"",fileStamp:""})}createWriteBackFailureError(t){return new S("errors.writeBack.summary",{fileCount:t.length},{failures:t})}};function fl(e){return typeof e=="object"&&e!==null&&"resolve"in e}function gl(e,t,n){let r=new Set(t),i=new Set(n.map(a=>a.groupId));return Object.values(e.groupBlocks??{}).filter(a=>r.has(a.filePath)&&!i.has(a.groupId)).map(a=>({...a,orphan:!0}))}function ml(...e){let t=new Map;for(let n of e)for(let r of n)t.set(We(r),r);return[...t.values()]}var dt=class extends bo.Plugin{constructor(){super(...arguments);this.settings=H;this.noticeService=new Nt;this.ankiGateway=new vt(()=>this.settings.ankiConnectUrl);this.deckTemplateInsertionService=new mt}async onload(){let n=new wt(this);this.pluginConfigRepository=new Et(n);let r=new It(n),i=new Dt(this.app);this.vaultGateway=i;try{this.settings=await this.pluginConfigRepository.load()}catch(o){console.error("Failed to load plugin settings, falling back to defaults.",o),this.settings=H,this.noticeService.error(g("notice.invalidSettingsRestored"))}let a=new vn(i,r,this.ankiGateway);this.syncCurrentFileUseCase=new Ft(a),this.syncVaultUseCase=new Mt(a),this.clearCurrentFileSyncedCardsUseCase=new St(r,this.ankiGateway,i),this.cleanupEmptyDecksUseCase=new ht(this.ankiGateway),Ei(this),this.addSettingTab(new Bt(this))}async updateSettings(n){if(!this.pluginConfigRepository)return;let r=xe({...this.settings,...n});try{await this.pluginConfigRepository.save(r),this.settings=r}catch(i){this.noticeService.error(be(i,"notice.failedSavePluginSettings"))}}async listNoteModels(){return this.ankiGateway.listNoteModels()}async getModelFieldNamesByModelNames(n){return this.ankiGateway.getModelFieldNamesByModelNames(n)}async getNoteModelDetails(n){return this.ankiGateway.getModelDetails(n)}async listFolderTree(){return this.vaultGateway?this.vaultGateway.listFolderTree():[]}async runSyncCurrentFile(){let n=this.app.workspace.getActiveFile();if(!n||n.extension.toLowerCase()!=="md"){this.noticeService.error(g("notice.noActiveMarkdownForSync"));return}if(!this.syncCurrentFileUseCase){this.noticeService.error(g("notice.syncUseCaseNotInitialized"));return}try{let r=await this.syncCurrentFileUseCase.execute(n.path,this.settings);this.noticeService.showSyncSummary("currentFile",r)}catch(r){if(r instanceof ct||r instanceof Qe){this.noticeService.info(lt(r));return}console.error("Current file sync failed.",r),this.noticeService.error(be(r,"notice.currentFileSyncFailed"))}}async runSyncVault(){if(!this.syncVaultUseCase){this.noticeService.error(g("notice.syncUseCaseNotInitialized"));return}try{let n=await this.syncVaultUseCase.execute(this.settings);this.noticeService.showSyncSummary("vault",n)}catch(n){if(n instanceof Qe){this.noticeService.info(lt(n));return}console.error("Vault sync failed.",n),this.noticeService.error(be(n,"notice.vaultSyncFailed"))}}async insertDeckTemplateToCurrentFile(){let n=this.app.workspace.getActiveFile();if(!n||n.extension.toLowerCase()!=="md"){this.noticeService.error(g("notice.noActiveMarkdownForDeckTemplateInsertion"));return}if(!this.vaultGateway){this.noticeService.error(g("notice.vaultGatewayNotInitialized"));return}try{let r=await this.vaultGateway.readMarkdownFile(n.path);if(!r){this.noticeService.error(g("notice.markdownFileNotFound",{filePath:n.path}));return}let i=this.deckTemplateInsertionService.insert(r,this.settings.fileDeckMarker,this.settings.fileDeckTemplate,this.settings.fileDeckInsertLocation);if(i.nextContent===i.expectedContent){this.noticeService.info(g("notice.deckTemplateAlreadyCurrent"));return}await this.vaultGateway.replaceMarkdownFile(n.path,i.expectedContent,i.nextContent),this.noticeService.info(g("notice.deckTemplateInserted",{deck:i.insertedDeck}))}catch(r){console.error("Deck template insertion failed.",r),this.noticeService.error(be(r,"notice.deckTemplateInsertionFailed"))}}async runClearCurrentFileSyncedCards(){let n=this.app.workspace.getActiveFile();if(!n||n.extension.toLowerCase()!=="md"){this.noticeService.error(g("notice.noActiveMarkdownForReset"));return}if(!this.clearCurrentFileSyncedCardsUseCase){this.noticeService.error(g("notice.clearCurrentFileUseCaseNotInitialized"));return}try{if(!await this.clearCurrentFileSyncedCardsUseCase.hasTrackedCards(n.path)){this.noticeService.info(g("notice.noTrackedCardsInCurrentFile"));return}let i=await this.clearCurrentFileSyncedCardsUseCase.execute(n.path);this.noticeService.showClearCurrentFileSummary(i)}catch(r){console.error("Clear current file synced cards failed.",r),this.noticeService.error(be(r,"notice.clearCurrentFileFailed"))}}async runCleanupEmptyDecks(){if(!this.cleanupEmptyDecksUseCase){this.noticeService.error(g("notice.cleanupEmptyDecksUseCaseNotInitialized"));return}try{let n=await this.cleanupEmptyDecksUseCase.listCandidates();if(n.length===0){this.noticeService.info(g("notice.noEmptyDeckCandidates"));return}let r=await new Lt(this.app,n).openAndGetSelection();if(r===null){this.noticeService.info(g("notice.cleanupEmptyDecksCancelled"));return}let i=await this.cleanupEmptyDecksUseCase.execute(r,n);this.noticeService.showCleanupEmptyDecksSummary(i)}catch(n){console.error("Cleanup empty decks failed.",n),this.noticeService.error(be(n,"notice.cleanupEmptyDecksFailed"))}}};var hl=dt;
+`;break;default:}return r};qe.prototype.render=function(e,t,n){let r="",i=this.rules;for(let a=0,o=e.length;a
=4||e.src.charCodeAt(i)!==62)return!1;if(r)return!0;let u=[],s=[],c=[],l=[],d=e.md.block.ruler.getRules("blockquote"),f=e.parentType;e.parentType="blockquote";let m=!1,p;for(p=t;pte((2147483647-i)/c)&&he("overflow"),i+=(s-r)*c,r=s;for(let l of e)if(l
${t}`:t,body:e.body};let r=`
]*>.*?<\/a>/g,"").trim()}function rl(e){return e.includes("GroupId")&&e.includes("Src")&&e.some(n=>/^S\d+_Id$/i.test(n))&&e.some(n=>/^S\d+_Q$/i.test(n))&&e.some(n=>/^S\d+_A$/i.test(n))?e.filter(n=>n==="GroupId"||n==="Src"||/^S\d+_Id$/i.test(n)):[]}function il(e){let t=[];return{text:e.replace(Qd,r=>{let i=`@@QA_GROUP_INLINE_CODE_${t.length}@@`;return t.push(r),i}),restore:r=>t.reduce((i,a,o)=>i.split(`@@QA_GROUP_INLINE_CODE_${o}@@`).join(a),r)}}var al="manual-render-v3",Ae=class{constructor(t=new Oe){this.deckResolutionService=t}resolve(t,n){let r=ol(t.cardType,n),i=this.deckResolutionService.resolve(t,n.defaultDeck,n.folderDeckMode),a=i.resolvedDeck.value,o=n.noteFieldMappings[R(t.cardType,r)]??null,u=t.cardType==="cloze"&&t.clozeMode==="all"?"all":void 0,s={version:al,cardType:t.cardType,clozeMode:u,noteModel:r,mapping:o,addObsidianBacklink:n.addObsidianBacklink,obsidianBacklinkLabel:n.obsidianBacklinkLabel,obsidianBacklinkPlacement:n.obsidianBacklinkPlacement,convertHighlightsToCloze:n.convertHighlightsToCloze,keepPureTagLinesInCardBody:n.keepPureTagLinesInCardBody},c=Q(JSON.stringify(s));return{deck:a,noteModel:r,renderConfigHash:c,warnings:i.warnings}}};function ol(e,t){if(_i(e)){if(!t.clozeNoteType.trim())throw new S("errors.noteFieldMapping.noteTypeNotSelected.cloze");return t.clozeNoteType}if(!t.qaNoteType.trim())throw new S("errors.noteFieldMapping.noteTypeNotSelected.basic");return t.qaNoteType}var Yr=/`[^`\n]+`/g,Xr=/```[\s\S]*?```|~~~[\s\S]*?~~~/g,Sn=/==(.+?)==/g,Jr=/(?:(?0&&i.add(u)}for(let o of r.text.matchAll(Jr)){let u=o[1],s=u?Number(u):e.clozeMode==="all"?1:a++;Number.isInteger(s)&&s>0&&i.add(s)}return i}function $e(e,t,n){let r=[];return{text:e.replace(t,a=>{let o=`@@${n}_${r.length}@@`;return r.push(a),o}),restore:(a,o=u=>u)=>r.reduce((u,s,c)=>u.split(`@@${n}_${c}@@`).join(o(s)),a)}}var Fn=class{constructor(t=new Ae){this.renderConfigService=t}plan(t,n,r,i){let a=new Map,o=new Set(n.pendingWriteBack.filter(x=>x.markerKind!=="group-gi").map(x=>Ie(x.filePath,x.blockStartLine,x.rawBlockHash))),u=new Set,s=[],c=[],l=[],d=[],f=[],m=[],p=new Map,F=0;for(let x of t){if(a.has(x.syncKey))throw new Error(`Duplicate syncKey detected in current scan: ${x.syncKey}`);if(a.set(x.syncKey,x),x.noteId!==void 0){let P=q(x.noteId);if(u.has(P))throw new Error(`Duplicate noteId detected in current scan: ${x.noteId}`);u.add(P)}let C=x.noteId!==void 0?n.cards[q(x.noteId)]:void 0,h=this.renderConfigService.resolve(x,i);for(let P of h.warnings)p.set(We(P),P);let M=x.noteId,v=Ie(x.filePath,x.blockStartLine,x.rawBlockHash),T={card:{...x,noteId:M},noteId:M,deck:h.deck,noteModel:h.noteModel,renderConfigHash:h.renderConfigHash};if(!M){s.push(T);continue}if(sl(C,x,i)){c.push(T);continue}if(d.push(T),(x.idMarkerState!=="present-valid"||x.noteIdSource!=="marker"||o.has(v))&&m.push(T),!C){l.push(T);continue}let I=C.rawBlockHash!==x.rawBlockHash||C.renderConfigHash!==h.renderConfigHash||!Xi(C.tagsHint,x.tagsHint)||C.orphan,A=C.deck!==h.deck;I&&l.push(T),A&&f.push(T),!I&&!A&&(F+=1)}let k=new Set(r),y=Object.values(n.cards).filter(x=>k.has(x.filePath)&&!u.has(q(x.noteId)));return{toCreate:s,toRebuild:c,toUpdate:l,toVerifyDeck:d,toChangeDeck:f,toRewriteMarker:m,toOrphan:y,unchangedCards:F,warnings:Array.from(p.values())}}};function sl(e,t,n){if(!e||e.cardType!=="cloze"||t.cardType!=="cloze")return!1;let r=Ce(e.cardType,e.clozeMode);if(r!=="sequential"||t.clozeMode!=="all")return!1;let i=ei({bodyMarkdown:e.bodyMarkdown,clozeMode:r,convertHighlightsToCloze:n.convertHighlightsToCloze}),a=ei({bodyMarkdown:t.bodyMarkdown,clozeMode:t.clozeMode,convertHighlightsToCloze:n.convertHighlightsToCloze});return i.size>a.size}var yo=new ot({breaks:!0,html:!0,linkify:!0}),cl=/(?`\\[${k.trim()}\\]`),c=c.replace(dl,(F,k)=>`\\(${k.trim()}\\)`),i&&r.convertHighlightsToCloze&&(c=c.replace(Sn,"{$1}")),i&&(c=c.replace(Jr,(F,k,y)=>`{{c${k?Number(k):n.card.clozeMode==="all"?1:d++}::${y}}}`)),c=c.replace(pl,(F,k)=>{let y=r.resourceResolver.resolveEmbed(k,n.card.filePath);return y?(l.push({kind:y.kind,fileName:y.fileName,absolutePath:y.absolutePath,altText:y.altText}),y.kind==="audio"?`[sound:${y.fileName}]`:``):F}),c=c.replace(fl,(F,k)=>{let y=r.resourceResolver.resolveWikiLink(k,n.card.filePath);return y?`${st(y.displayText)}`:F}),c=c.replace(Sn,"$1");let f=$e(c,ll,"MATH");c=f.text,c=s.restore(c),c=u.restore(c);let m=(a?yo.renderInline(c):yo.render(c)).trim(),p=f.restore(m,st);return{html:a?p:yn(p),media:l}}};function gl(e){let t=new Set;return e.filter(n=>{let r=`${n.kind}:${n.absolutePath}:${n.fileName}`;return t.has(r)?!1:(t.add(r),!0)})}function st(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}var ct=class extends S{constructor(t){super("errors.currentFileOutOfScope",{filePath:t}),this.name="CurrentFileOutOfScopeError"}},Qe=class extends S{constructor(){super("errors.runScopeNotConfigured"),this.name="RunScopeNotConfiguredError"}},wn=class{constructor(t,n,r,i=new Zt(t),a=new Fn,o=new Mn,u=new Ot(r),s=new Yt(t),c=new Ae,l=()=>Date.now()){this.vaultGateway=t;this.pluginStateRepository=n;this.ankiGateway=r;this.fileIndexerService=i;this.diffPlannerService=a;this.renderer=o;this.ankiBatchExecutor=u;this.markdownWriteBackService=s;this.scanScopeService=new Pe;if(this.qaGroupSyncService=new Cn(r,void 0,void 0,void 0,void 0,void 0,void 0,this.vaultGateway.createBacklink.bind(this.vaultGateway)),ml(c)){this.renderConfigService=c,this.now=l;return}this.renderConfigService=new Ae,this.now=c}async syncVault(t){le(t),this.assertRunScopeConfigured(t);let n=await this.pluginStateRepository.load(),r=await this.fileIndexerService.indexVault(t,n);return this.syncIndexedResult(r,n,t)}async syncFile(t,n){if(le(n),this.assertRunScopeConfigured(n),!this.scanScopeService.isPathInScope(t,n.scopeMode,n.includeFolders,n.excludeFolders))throw new ct(t);let r=await this.pluginStateRepository.load(),i=await this.fileIndexerService.indexFile(t,n,r);return this.syncIndexedResult(i,r,n)}assertRunScopeConfigured(t){if(!gt(t.scopeMode,t.includeFolders))throw new Qe}async syncIndexedResult(t,n,r){let i=this.diffPlannerService.plan(t.cards,n,t.scopedFilePaths,r),a={addObsidianBacklink:r.addObsidianBacklink,obsidianBacklinkLabel:r.obsidianBacklinkLabel,obsidianBacklinkPlacement:r.obsidianBacklinkPlacement,convertHighlightsToCloze:r.convertHighlightsToCloze,keepPureTagLinesInCardBody:r.keepPureTagLinesInCardBody,resourceResolver:this.vaultGateway},o=new Map;for(let m of[...i.toCreate,...i.toRebuild,...i.toUpdate])o.has(m.card.syncKey)||o.set(m.card.syncKey,this.renderer.render(m,a));let u=await this.ankiBatchExecutor.execute(i,o,async m=>this.renderer.render(m,a),r.noteFieldMappings),s=await this.qaGroupSyncService.sync(t.groupBlocks,n,r),c=new Map(t.indexedFiles.map(m=>[m.filePath,m])),l=await this.markdownWriteBackService.write(u.markerWrites,c,s.markerWrites),d=hl(n,t.scopedFilePaths,s.syncedGroupBlocks),f=this.buildNextState(n,t.cards,t.indexedFiles,s.syncedGroupBlocks,r,new Set([...u.touchedSyncKeys,...s.touchedSyncKeys,...l.writtenSyncKeys]),u.resolvedNoteIds,i.toOrphan,d);if(f.pendingWriteBack=[...n.pendingWriteBack.filter(m=>!new Set(t.scopedFilePaths).has(m.filePath)),...l.pendingEntries],this.markFilesDirty(f,[...l.failureFiles.map(m=>m.filePath),...l.conflictFiles]),await this.pluginStateRepository.save(f),l.failureFiles.length>0)throw this.createWriteBackFailureError(l.failureFiles);return{scannedFiles:t.scannedFiles,scannedCards:t.cards.length+t.groupBlocks.length,created:u.created+s.created,rebuilt:u.rebuilt,updated:u.updated+s.updated,migratedNoteTypes:u.migratedNoteTypes+s.migratedNoteTypes,migratedDecks:u.migratedDecks+s.migratedDecks,orphaned:i.toOrphan.length+d.length,uploadedMedia:u.uploadedMedia,skippedUnchangedCards:t.skippedUnchangedCards,rewrittenMarkers:l.writtenSyncKeys.length,markerWriteConflictFiles:l.conflictFiles,warnings:kl(i.warnings,s.warnings)}}buildNextState(t,n,r,i,a,o,u,s,c){let l=this.now(),d=Un(a),f=new Set(r.filter(k=>k.content!==void 0).map(k=>k.filePath)),m=new Map;for(let k of i){let y=m.get(k.filePath);y?y.push(k):m.set(k.filePath,[k])}let p={files:{...t.files},cards:{...t.cards},groupBlocks:{...t.groupBlocks??{}},pendingWriteBack:[...t.pendingWriteBack]};for(let k of f)delete p.files[k];for(let[k,y]of Object.entries(p.cards))f.has(y.filePath)&&delete p.cards[k];for(let[k,y]of Object.entries(p.groupBlocks??{}))f.has(y.filePath)&&delete p.groupBlocks?.[k];let F=new Map;for(let k of n){let y=u.get(k.syncKey)??k.noteId;y!==void 0&&F.set(k.syncKey,y)}for(let k of r){if(k.content===void 0)continue;let y=Array.from(new Set(k.cards.map(x=>F.get(x.syncKey)).filter(x=>x!==void 0)));p.files[k.filePath]={filePath:k.filePath,fileHash:k.fileHash,fileStamp:k.fileStamp,deckRulesFingerprint:d,lastIndexedAt:l,noteIds:y,groupIds:(m.get(k.filePath)??[]).map(x=>x.groupId)}}for(let k of n){let y=F.get(k.syncKey);if(y===void 0)continue;let x=t.cards[q(y)]??(k.noteId!==void 0?t.cards[q(k.noteId)]:void 0),C=this.renderConfigService.resolve(k,a);p.cards[q(y)]={noteId:y,filePath:k.filePath,heading:k.heading,backlinkHeadingText:k.backlinkHeadingText,headingLevel:k.headingLevel,bodyMarkdown:k.bodyMarkdown,cardType:k.cardType,clozeMode:k.clozeMode,blockStartOffset:k.blockStartOffset,blockEndOffset:k.blockEndOffset,blockStartLine:k.blockStartLine,bodyStartLine:k.bodyStartLine,blockEndLine:k.blockEndLine,contentEndLine:k.contentEndLine,markerLine:k.markerLine,rawBlockText:k.rawBlockText,rawBlockHash:k.rawBlockHash,renderConfigHash:C.renderConfigHash,deck:C.deck,deckHint:k.deckHint,deckHintSource:k.deckHintSource,deckWarnings:[...k.deckWarnings],tagsHint:k.tagsHint,lastSyncedAt:o.has(k.syncKey)?l:x?.lastSyncedAt??0,orphan:!1}}for(let k of s)p.cards[q(k.noteId)]={...k,orphan:!0};for(let k of i)p.groupBlocks??(p.groupBlocks={}),p.groupBlocks[k.groupId]=k;for(let k of c)p.groupBlocks??(p.groupBlocks={}),p.groupBlocks[k.groupId]={...k,orphan:!0};return p}markFilesDirty(t,n){for(let r of new Set(n))t.files[r]&&(t.files[r]={...t.files[r],fileHash:"",fileStamp:""})}createWriteBackFailureError(t){return new S("errors.writeBack.summary",{fileCount:t.length},{failures:t})}};function ml(e){return typeof e=="object"&&e!==null&&"resolve"in e}function hl(e,t,n){let r=new Set(t),i=new Set(n.map(a=>a.groupId));return Object.values(e.groupBlocks??{}).filter(a=>r.has(a.filePath)&&!i.has(a.groupId)).map(a=>({...a,orphan:!0}))}function kl(...e){let t=new Map;for(let n of e)for(let r of n)t.set(We(r),r);return[...t.values()]}var dt=class extends bo.Plugin{constructor(){super(...arguments);this.settings=H;this.noticeService=new Nt;this.ankiGateway=new wt(()=>this.settings.ankiConnectUrl);this.deckTemplateInsertionService=new mt}async onload(){let n=new vt(this);this.pluginConfigRepository=new Et(n);let r=new It(n),i=new Dt(this.app);this.vaultGateway=i;try{this.settings=await this.pluginConfigRepository.load()}catch(o){console.error("Failed to load plugin settings, falling back to defaults.",o),this.settings=H,this.noticeService.error(g("notice.invalidSettingsRestored"))}let a=new wn(i,r,this.ankiGateway);this.syncCurrentFileUseCase=new Ft(a),this.syncVaultUseCase=new Mt(a),this.clearCurrentFileSyncedCardsUseCase=new St(r,this.ankiGateway,i),this.cleanupEmptyDecksUseCase=new ht(this.ankiGateway),Ei(this),this.addSettingTab(new Bt(this))}async updateSettings(n){if(!this.pluginConfigRepository)return;let r=xe({...this.settings,...n});try{await this.pluginConfigRepository.save(r),this.settings=r}catch(i){this.noticeService.error(be(i,"notice.failedSavePluginSettings"))}}async listNoteModels(){return this.ankiGateway.listNoteModels()}async getModelFieldNamesByModelNames(n){return this.ankiGateway.getModelFieldNamesByModelNames(n)}async getNoteModelDetails(n){return this.ankiGateway.getModelDetails(n)}async listFolderTree(){return this.vaultGateway?this.vaultGateway.listFolderTree():[]}async runSyncCurrentFile(){let n=this.app.workspace.getActiveFile();if(!n||n.extension.toLowerCase()!=="md"){this.noticeService.error(g("notice.noActiveMarkdownForSync"));return}if(!this.syncCurrentFileUseCase){this.noticeService.error(g("notice.syncUseCaseNotInitialized"));return}try{let r=await this.syncCurrentFileUseCase.execute(n.path,this.settings);this.noticeService.showSyncSummary("currentFile",r)}catch(r){if(r instanceof ct||r instanceof Qe){this.noticeService.info(lt(r));return}console.error("Current file sync failed.",r),this.noticeService.error(be(r,"notice.currentFileSyncFailed"))}}async runSyncVault(){if(!this.syncVaultUseCase){this.noticeService.error(g("notice.syncUseCaseNotInitialized"));return}try{let n=await this.syncVaultUseCase.execute(this.settings);this.noticeService.showSyncSummary("vault",n)}catch(n){if(n instanceof Qe){this.noticeService.info(lt(n));return}console.error("Vault sync failed.",n),this.noticeService.error(be(n,"notice.vaultSyncFailed"))}}async insertDeckTemplateToCurrentFile(){let n=this.app.workspace.getActiveFile();if(!n||n.extension.toLowerCase()!=="md"){this.noticeService.error(g("notice.noActiveMarkdownForDeckTemplateInsertion"));return}if(!this.vaultGateway){this.noticeService.error(g("notice.vaultGatewayNotInitialized"));return}try{let r=await this.vaultGateway.readMarkdownFile(n.path);if(!r){this.noticeService.error(g("notice.markdownFileNotFound",{filePath:n.path}));return}let i=this.deckTemplateInsertionService.insert(r,this.settings.fileDeckMarker,this.settings.fileDeckTemplate,this.settings.fileDeckInsertLocation);if(i.nextContent===i.expectedContent){this.noticeService.info(g("notice.deckTemplateAlreadyCurrent"));return}await this.vaultGateway.replaceMarkdownFile(n.path,i.expectedContent,i.nextContent),this.noticeService.info(g("notice.deckTemplateInserted",{deck:i.insertedDeck}))}catch(r){console.error("Deck template insertion failed.",r),this.noticeService.error(be(r,"notice.deckTemplateInsertionFailed"))}}async runClearCurrentFileSyncedCards(){let n=this.app.workspace.getActiveFile();if(!n||n.extension.toLowerCase()!=="md"){this.noticeService.error(g("notice.noActiveMarkdownForReset"));return}if(!this.clearCurrentFileSyncedCardsUseCase){this.noticeService.error(g("notice.clearCurrentFileUseCaseNotInitialized"));return}try{if(!await this.clearCurrentFileSyncedCardsUseCase.hasTrackedCards(n.path)){this.noticeService.info(g("notice.noTrackedCardsInCurrentFile"));return}let i=await this.clearCurrentFileSyncedCardsUseCase.execute(n.path);this.noticeService.showClearCurrentFileSummary(i)}catch(r){console.error("Clear current file synced cards failed.",r),this.noticeService.error(be(r,"notice.clearCurrentFileFailed"))}}async runCleanupEmptyDecks(){if(!this.cleanupEmptyDecksUseCase){this.noticeService.error(g("notice.cleanupEmptyDecksUseCaseNotInitialized"));return}try{let n=await this.cleanupEmptyDecksUseCase.listCandidates();if(n.length===0){this.noticeService.info(g("notice.noEmptyDeckCandidates"));return}let r=await new Lt(this.app,n).openAndGetSelection();if(r===null){this.noticeService.info(g("notice.cleanupEmptyDecksCancelled"));return}let i=await this.cleanupEmptyDecksUseCase.execute(r,n);this.noticeService.showCleanupEmptyDecksSummary(i)}catch(n){console.error("Cleanup empty decks failed.",n),this.noticeService.error(be(n,"notice.cleanupEmptyDecksFailed"))}}};var yl=dt;
diff --git a/src/application/services/FileIndexerService.test.ts b/src/application/services/FileIndexerService.test.ts
index ef33b53..62f81b9 100644
--- a/src/application/services/FileIndexerService.test.ts
+++ b/src/application/services/FileIndexerService.test.ts
@@ -76,6 +76,69 @@ describe("FileIndexerService", () => {
expect(result.cards[0]).toMatchObject({ noteId: 10, noteIdSource: "marker", idMarkerState: "present-valid" });
});
+ it("re-reads unchanged files when cached cloze state missed an all-cloze marker", async () => {
+ const content = [
+ "#### Cloze #anki-cloze-all",
+ "{A} {B} {C}",
+ "",
+ ].join("\n");
+ const settings = createIndexSettingsForPath("notes/one.md");
+ const vaultGateway = new FakeManualSyncVaultGateway({
+ "notes/one.md": content,
+ });
+ const service = new FileIndexerService(vaultGateway);
+ const state = {
+ files: {
+ "notes/one.md": {
+ filePath: "notes/one.md",
+ fileHash: "hash-a",
+ fileStamp: `1:${content.length}`,
+ deckRulesFingerprint: createDeckRulesFingerprint(settings),
+ lastIndexedAt: 1,
+ noteIds: [10],
+ },
+ },
+ cards: {
+ "10": {
+ noteId: 10,
+ filePath: "notes/one.md",
+ heading: "Cloze #anki-cloze-all",
+ backlinkHeadingText: "Cloze #anki-cloze-all",
+ headingLevel: 4,
+ bodyMarkdown: "{A} {B} {C}",
+ cardType: "cloze" as const,
+ clozeMode: "sequential" as const,
+ blockStartOffset: 0,
+ blockEndOffset: content.length,
+ blockStartLine: 1,
+ bodyStartLine: 2,
+ blockEndLine: 3,
+ contentEndLine: 2,
+ markerLine: 3,
+ rawBlockText: content,
+ rawBlockHash: "hash-card",
+ renderConfigHash: "render-hash",
+ deck: "Obsidian",
+ deckWarnings: [],
+ tagsHint: [],
+ lastSyncedAt: 1,
+ orphan: false,
+ },
+ },
+ pendingWriteBack: [],
+ };
+
+ const result = await service.indexVault(settings, state);
+
+ expect(result.skippedUnchangedFiles).toBe(0);
+ expect(vaultGateway.readCalls).toEqual(["notes/one.md"]);
+ expect(result.cards[0]).toMatchObject({
+ noteId: 10,
+ cardType: "cloze",
+ clozeMode: "all",
+ });
+ });
+
it("forces re-read when deck rules fingerprint changed even if file stamp is unchanged", async () => {
const content = ["#### One", "Body"].join("\n");
const vaultGateway = new FakeManualSyncVaultGateway({
@@ -252,4 +315,4 @@ function createIndexSettingsForPath(filePath: string, overrides: Parameters