import{o as d,P as y,y as v}from"./vue-core-Di3IuVqe.js";function p({listeNdocs:o,ndoc:r,charger:f,estEnEdition:w,onNaviguer:c}){const i=v(()=>o.value?.length||0),l=v(()=>{const e=o.value;if(!e?.length)return 0;const n=e.indexOf(r.value);return n===-1?0:n+1}),u=async e=>{if(w?.value)return;const n=o.value;if(!n?.length)return;const a=l.value+e;if(a<1||a>i.value)return;const t=n[a-1];t==null||t===r.value||(r.value=t,await f(),c?.(t))},s=e=>{e.altKey&&(e.key==="ArrowRight"?(e.preventDefault(),u(1)):e.key==="ArrowLeft"&&(e.preventDefault(),u(-1)))};return d(()=>window.addEventListener("keydown",s)),y(()=>window.removeEventListener("keydown",s)),{totalListe:i,positionCourante:l,naviguer:u}}export{p as u};
