// MIT: retain the accompanying LICENSE. No enrollment, polling or automatic wakeup. // Supply the already downloaded, authorized createContinuumClient factory. export function createResumeAgent({createContinuumClient,identity,fetchImpl}={}){ if(typeof createContinuumClient!=='function')throw Error('CONTINUUM_FACTORY_REQUIRED'); const client=createContinuumClient({identity,fetchImpl}); return { async submitAndBaseline(document,consent){ if(consent?.publicConsent!==true||consent?.rightsConfirmed!==true||consent?.noSecretsConfirmed!==true)throw Error('EXPLICIT_PUBLIC_CONSENT_REQUIRED'); const published=await client.submitContinuumRequest(document,consent); const baseline=await client.continuumReturn(); return {requestId:published.item.id,baseline,snapshot:baseline.snapshot}; }, returnWithSnapshot(snapshot){return client.continuumReturn(snapshot);} }; }