async function d(n){let{stdout:r}=await n({command:"zsh",args:["-c","cat ${${ZSHZ_DATA:-${_Z_DATA:-${HOME}/.z}}:A}"]});return r.split(`
`).map(e=>{let[i,s,o]=e.split("|"),c=i.split("/");return{name:c[c.length-1],path:i,weight:75+Number(s)*25/9e3,time:Number(o)}})}async function g(n,r){let{stdout:e}=await r({command:"bash",args:["-c","ls -d */"]});return e.split(`
`).map(i=>{let s=i.replace("/","");return{name:s,path:`${n}/${s}`}})}function p(n,r){let e=new Set(n);return r.filter(({name:i,path:s})=>!e.has(i)&&n.every(o=>s.includes(o)))}var l={name:"z",description:"CLI tool to jump around directories",args:{name:"directory",isVariadic:!0,isOptional:!0,generators:{custom:async(n,r,e)=>{let{currentWorkingDirectory:i}=e,[s,o]=await Promise.all([d(r),g(i,r)]),c=[...s,...o].reduce((t,m)=>(t.some(({path:u})=>u===m.path)||t.push(m),t),[]);return p(n.filter(t=>t&&t!=="z"&&!t.startsWith("-")),c).map(t=>({name:t.name,icon:"\u{1F4C1}",description:t.path,priority:t.weight,insertValue:t.name,displayName:t.name}))}}},options:[{name:"-c",description:"Restrict matches to subdirectories of the current directory"},{name:"-e",description:"Echo the best match, don't cd"},{name:"-h",description:"Show a brief help message"},{name:"-l",description:"List only"},{name:"-r",description:"Match by rank only"},{name:"-t",description:"Match by recent access only"},{name:"-x",description:"Remove the current directory from the datafile"}]},h={name:"z",description:"Smarter cd command, inspired by z and autojump",args:{name:"directory",filterStrategy:"fuzzy",suggestCurrentToken:!0,isVariadic:!0,generators:{custom:async(n,r)=>{let e;n.length<2||n[1]===""?e=["query","--list","--score"]:e=["query","--list","--score","--",n.slice(1).join(" ")];let{stdout:i}=await r({command:"zoxide",args:e});return i.split(`
`).map(s=>{let o=s.trim(),c=o.indexOf(" "),a=Number(o.slice(0,c));return{name:o.slice(c+1),description:`Score: ${a}`}})},trigger:{on:"change"}}}},y={name:"z",generateSpec:async(n,r)=>{try{let{status:e}=await r({command:"bash",args:["-c","command -v zoxide"]});if(e===0)return h}catch{}return l}},S=y;export{S as default};
