let _pdfModule=null;let _mammoth=null;
export async function loadPdfJs(){if(_pdfModule)return _pdfModule;const pdfUrl=chrome.runtime.getURL('dist/pdf.mjs');const mod=await import(pdfUrl);const pdfjsLib=mod.default?mod.default:mod;const GlobalWorkerOptions=mod.GlobalWorkerOptions||pdfjsLib.GlobalWorkerOptions;GlobalWorkerOptions.workerSrc=chrome.runtime.getURL('dist/pdf.worker.min.js');_pdfModule={pdfjsLib,GlobalWorkerOptions};return _pdfModule;}
export async function loadMammoth(){if(_mammoth)return _mammoth;await new Promise((resolve,reject)=>{const s=document.createElement('script');s.src=chrome.runtime.getURL('dist/mammoth.browser.js');s.onload=()=>resolve();s.onerror=()=>reject(new Error('Impossible de charger mammoth.browser.js'));document.head.appendChild(s);});if(!window.mammoth)throw new Error('Mammoth non initialisé');_mammoth=window.mammoth;return _mammoth;}
