import{nQ as W,oQ as P}from"./cli-0.5.3-ytqxzjff.mjs";import{H6 as I,K7 as y,Kaa as B,Laa as O,Q6 as K,R6 as _,Yaa as F,m7 as R,n7 as A,u9 as G,w9 as S,z6 as M}from"./cli-0.5.3-t65dek0m.mjs";import{Xda as D,Yda as x}from"./cli-0.5.3-6j2jk6dt.mjs";import{Fma as $,Gma as z}from"./cli-0.5.3-2dk1sk8w.mjs";z();x();F();S();_();y();I();P();var T=[/(?:^|\/)(?:package-lock\.json|yarn\.lock|bun\.lock|bun\.lockb|pnpm-lock\.yaml|Pipfile\.lock|poetry\.lock|Cargo\.lock|Gemfile\.lock|go\.sum|composer\.lock|uv\.lock)$/,/\.generated\./,/(?:^|\/)(?:dist|build|out|target|node_modules|\.next|__pycache__)\//,/\.(?:min\.js|min\.css|map|pyc|pyo)$/,/\.(?:json|ya?ml|toml|xml|ini|cfg|conf|env|lock|txt|md|mdx|rst|csv|log|svg)$/i,/(?:^|\/)\.?(?:eslintrc|prettierrc|babelrc|editorconfig|gitignore|gitattributes|dockerignore|npmrc)/,/(?:^|\/)(?:tsconfig|jsconfig|biome|vitest\.config|jest\.config|webpack\.config|vite\.config|rollup\.config)\.[a-z]+$/,/(?:^|\/)\.(?:github|vscode|idea|claude)\//,/(?:^|\/)(?:CHANGELOG|LICENSE|CONTRIBUTING|CODEOWNERS|README)(?:\.[a-z]+)?$/i];function k(L){return!T.some((U)=>U.test(L))}function d(L,U=20){let H=new Map;for(let V of L)H.set(V,(H.get(V)||0)+1);return Array.from(H.entries()).sort((V,Q)=>Q[1]-V[1]).slice(0,U).map(([V,Q])=>`${Q.toString().padStart(6)} ${V}`).join(`
`)}function E(L,U){let H=[],V=new Set,Q=new Map;for(let J=1;H.length<U&&J<=U;J++)for(let X of L){if(H.length>=U)break;if(!k(X))continue;let Y=Math.max(X.lastIndexOf("/"),X.lastIndexOf("\\")),Z=Y>=0?X.slice(Y+1):X;if(!Z||V.has(Z))continue;let q=Y>=0?X.slice(0,Y):".";if((Q.get(q)??0)>=J)continue;H.push(Z),V.add(Z),Q.set(q,(Q.get(q)??0)+1)}return H.length>=U?H:[]}async function N(){if(G.platform==="win32")return[];if(!await A())return[];try{let L=await W(),U=["log","-n","1000","--pretty=format:","--name-only","--diff-filter=M"],H=new Map,V=(J)=>{for(let X of J.split(`
`)){let Y=X.trim();if(Y)H.set(Y,(H.get(Y)??0)+1)}};if(L){let{stdout:J}=await K("git",[...U,`--author=${L}`],{cwd:D()});V(J)}if(H.size<10){let{stdout:J}=await K(R(),U,{cwd:D()});V(J)}let Q=Array.from(H.entries()).sort((J,X)=>X[1]-J[1]).map(([J])=>J);return E(Q,5)}catch(L){return M(L),[]}}var b=604800000;function v(L){let U=B(),H=U.exampleFiles?.length?U.exampleFiles:["<filepath>"],Q=[...["fix lint errors","fix typecheck errors",`how does ${H[0]} work?`,`refactor ${H[Math.floor(H.length/2)]}`,"how do I log an error?",`edit ${H[H.length-1]} to...`,`write a test for ${H[0]}`,"create a util logging.py that..."]];for(let J=Q.length-1;J>0;J--){let X=Math.floor(Math.random()*(J+1));[Q[J],Q[X]]=[Q[X],Q[J]]}return Q.slice(0,L).map((J)=>`Try "${J}"`)}var p=$(()=>{return v(1)[0]??'Try "fix lint errors"'}),c=$((L)=>{return v(L)}),r=$(async()=>{let L=B(),U=Date.now(),H=L.exampleFilesGeneratedAt??0;if(U-H>b)L.exampleFiles=[];if(!L.exampleFiles?.length)N().then((V)=>{if(V.length)O((Q)=>({...Q,exampleFiles:V,exampleFilesGeneratedAt:Date.now()}))})});
export{d as db,E as eb,p as fb,c as gb,r as hb};
