import{s as e}from"./DrKWWDpL.js";import{Hn as t}from"./DIQmuJJZ.js";import{t as n}from"./CxlOpib82.js";import{t as r}from"./BYJC6_MM.js";var i=e(r(),1),a={retries:{retries:3,minTimeout:100,maxTimeout:1e3,factor:2},stale:1e4,realpath:!1};async function o(e,r){try{return await i.default.lock(e,{...a,...r?.stale!==void 0&&{stale:r.stale},...r?.retries!==void 0&&{retries:{...a.retries,retries:r.retries}}})}catch(r){throw new n(t.LOCK_TIMEOUT,`Failed to acquire lock: ${e}`,{fix:`Another process may be writing to this file. Wait and retry.`,cause:r})}}async function s(e,t,n){let r=await o(e,n);try{return await t()}finally{await r()}}export{s as t};