const u=new Set(["the","a","an","of","to","for","and","or","is","in","on","at","by","with","的","了","是","在","和","与","把","从","到","怎么","如何","怎样"]);function f(r){const n=[],o=r.toLowerCase(),e=o.match(/[a-z0-9][a-z0-9_\-+./]*/g)||[];for(const s of e)s.length>0&&!u.has(s)&&n.push(s);const t=o.match(/[\u4e00-\u9fff]+/g)||[];for(const s of t)if(!u.has(s)){n.push(s);for(let c=0;c<s.length;c++){const a=s[c];u.has(a)||n.push(a),c+1<s.length&&n.push(s.slice(c,c+2))}}return n}const l={删除:["delete","remove","rm","unlink","erase","drop"],清理:["clean","purge","prune","gc","rm"],查找:["find","search","locate","grep","lookup"],搜索:["find","search","grep","rg","ag"],创建:["create","make","mkdir","touch","new","init"],新建:["create","new","init","mkdir","touch"],复制:["copy","cp","duplicate","clone"],移动:["move","mv","rename"],重命名:["rename","mv"],压缩:["compress","tar","gzip","zip","xz","bzip2"],解压:["extract","tar","untar","unzip","gunzip"],归档:["archive","tar","zip"],权限:["permission","chmod","chown","chgrp","umask","acl"],网络:["network","net","ip","curl","wget","ss","netstat","dig","nslookup","ping","traceroute"],端口:["port","ss","netstat","lsof"],进程:["process","ps","top","htop","kill","pkill","pgrep"],杀死:["kill","pkill","killall","sigterm","sigkill"],服务:["service","systemctl","systemd","daemon"],日志:["log","journalctl","tail","less","logger"],磁盘:["disk","df","du","lsblk","fdisk","mount"],内存:["memory","free","mem","swap","vmstat"],用户:["user","useradd","usermod","userdel","passwd","whoami","id"],环境变量:["env","export","PATH","environment"],软链:["symlink","ln","link"],替换:["replace","sed","tr","awk"],统计:["count","wc","stat"],排序:["sort","uniq"],去重:["unique","uniq","sort","dedupe"],管道:["pipe","xargs","tee"],容器:["container","docker","podman"],镜像:["image","docker","mirror","registry","source","repo"],远端:["remote","origin","upstream"],远程:["remote","origin","upstream","ssh","scp","rsync"],传输:["rsync","scp","transfer"],下载:["download","curl","wget"],上传:["upload","curl","rsync","scp"],撤销:["undo","revert","reset","restore","checkout"],回滚:["rollback","revert","reset"],恢复:["restore","recover","reflog","reset","checkout"],丢失:["lost","reflog","fsck","dangling"],冲突:["conflict","merge","mergetool","rebase"],合并:["merge","rebase","pull"],分支:["branch","switch","checkout"],提交:["commit","amend"],修改提交:["amend","commit"],历史:["log","reflog","history"],差异:["diff","show","compare"],暂存:["stash","staging","index"],标签:["tag"],推送:["push"],拉取:["pull","fetch"],克隆:["clone"],签名:["sign","gpg","ssh"],钩子:["hook","hooks"],挑选:["cherry-pick","pick"],二分:["bisect"],子模块:["submodule"],工作树:["worktree"],配置:["config","configuration"],忽略:["ignore","gitignore","exclude"],追踪:["blame","log"],目录:["directory","folder","dir","cd","mkdir","rmdir"],文件:["file"],查看:["view","cat","less","more","head","tail"],编辑:["edit","vim","nano","emacs"],解压缩:["extract","unzip","tar"],崩溃:["crash","core","dump","panic"],诊断:["diagnose","strace","lsof","tcpdump"],监控:["monitor","top","htop","watch","iostat"],仓库:["repository","repo","registry","index"],加速:["speed","mirror","fast","accelerate","proxy"],国内:["china","cn","mirror","aliyun","tencent","tuna","ustc"],阿里:["aliyun","alibaba","alicdn"],阿里云:["aliyun","alibaba"],腾讯:["tencent","tencentyun"],腾讯云:["tencent","tencentyun"],清华:["tuna","tsinghua"],中科大:["ustc"],科大:["ustc"],字节:["bytedance","rsproxy","volcano","volcengine"],华为:["huaweicloud","huawei"],华为云:["huaweicloud","huawei"],网易:["163","netease"],换源:["mirror","source","sources.list","registry"]};function m(r){const n=new Set;for(const o of r){if(n.add(o),l[o])for(const e of l[o])n.add(e.toLowerCase());if(o.length>1){for(const e of o)if(l[e])for(const t of l[e])n.add(t.toLowerCase())}}return Array.from(n)}function i(r,n){if(!r)return 0;const o=r.toLowerCase();let e=0;for(const t of n)t&&o.includes(t)&&(e+=t.length>=3?1:.5,new RegExp(`(^|\\W)${g(t)}`).test(o)&&(e+=.5));return e}function g(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function h(r,n){const o=n.trim();if(!o)return 1;const e=f(o);if(e.length===0)return 0;const t=m(e),s=i(r.cmd,t),c=i((r.keywords||[]).join(" "),t),a=i(r.desc,t),p=i(r.cat,t),d=i(r.example||"",t);return s*5+c*4+a*3+p*2+d*1}function w(r,n){if(!n.trim())return r;const o=[];for(const e of r){const t=h(e,n);t>0&&o.push({it:e,s:t})}return o.sort((e,t)=>t.s-e.s),o.map(e=>e.it)}export{w as a,h as s};
