PageSourceSearch

https://51.la/js/SensitiveWordChecker-BzJ9N05-.js

js 51.la collected 2026-10-02 02:27:21 UTC 7,907 bytes, 1 lines download raw bytes

1import{w as ne,j as se,b as oe,E as z}from"./element-BXz0WBGW.js";import{_ as le}from"./index-BWEVWcZV.js";import{H as p,L as _,P as l,M as f,O as w,X as O,F as R,Z as b,R as P,I as X,ab as q,e as g,ag as S,c as W,n as A,u as D,Y as V}from"./vue-DgJjd7my.js";import"./axios-42ANG6Sg.js";const ie=["赌博","博彩","六合彩","时时彩","色情","裸聊","援交","毒品","冰毒","海洛因","枪支","弹药","爆炸物","诈骗","传销","洗钱","黑客","木马","病毒软件","办证","假证","代开发票","走私","违禁品","翻墙","VPN破解","私服","反动","邪教","恐怖组织","极端主义","法轮功","自杀","自残","人体器官","代孕","堕胎药","迷药","春药","网赌","棋牌赌博","老虎机","百家乐","赌球","赌马","黄色网站","成人视频","偷拍","走光","一夜情","高利贷","套路贷","暴力催收","非法集资","庞氏骗局"],ae=["最强","最好","第一","首选","唯一","绝对","100%","国家级","顶级","极致","完美","史上","全网最低","独家","首发","王牌","领袖品牌","世界领先","填补国内空白","空前绝后","永久","万能","特效","迅速见效","包治百病","无效退款","点击领奖","恭喜获奖","全民免单","秒杀全网","错过就没机会","全国首创","全网首发","销量冠军","行业第一","NO.1","第一品牌","史无前例","前无古人","绝无仅有","最高级","最佳","最具","最便宜"],re=2e4;function ue(h,o=ie,v=ae){const i=String(h||"").slice(0,re);if(!i.trim())return{hits:[],sensitiveCount:0,forbiddenCount:0,sensitiveWords:[],forbiddenWords:[]};const t=[],c=(e,r)=>{let C=0;for(;C<i.length;){const m=i.indexOf(e,C);if(m===-1)break;t.push({word:e,index:m,length:e.length,type:r}),C=m+e.length}},$=[...o].sort((e,r)=>r.length-e.length),E=[...v].sort((e,r)=>r.length-e.length);$.forEach(e=>e&&c(e,"sensitive")),E.forEach(e=>e&&c(e,"forbidden")),t.sort((e,r)=>e.index-r.index||r.length-e.length);const y=[],d=[];t.forEach(e=>{const r=e.index+e.length;d.some(([m,B])=>!(r<=m||e.index>=B))||(y.push(e),d.push([e.index,r]))});const I=[...new Set(y.filter(e=>e.type==="sensitive").map(e=>e.word))],H=[...new Set(y.filter(e=>e.type==="forbidden").map(e=>e.word))];return{hits:y,sensitiveCount:y.filter(e=>e.type==="sensitive").length,forbiddenCount:y.filter(e=>e.type==="forbidden").length,sensitiveWords:I,forbiddenWords:H}}function ce(h,o){if(!o.length)return[{text:h,type:"normal"}];const v=[];let i=0;return o.forEach((t,c)=>{t.index>i&&v.push({text:h.slice(i,t.index),type:"normal"}),v.push({text:h.slice(t.index,t.index+t.length),type:t.type,word:t.word,hitIndex:c}),i=t.index+t.length}),i<h.length&&v.push({text:h.slice(i),type:"normal"}),v}function K(h,o,v){const i=new Set(o.filter(c=>c.type===v).map(c=>c.word));let t=String(h||"");return i.forEach(c=>{t=t.split(c).join("")}),t}const de={class:"tool-panel"},ve={class:"lookup-operation tool-split-panel"},pe={class:"tool-split"},fe={class:"tool-split__left"},he={class:"input-tip"},_e={class:"tool-split__right"},ge={class:"preview-head"},ye={key:0,class:"preview-head__actions"},me={class:"result-toolbar"},be={class:"result-toolbar__stats"},we={class:"stat-sensitive"},xe={class:"stat-forbidden"},ke={key:0,class:"result-toolbar__nav"},Ce={class:"nav-pos"},Se=["id"],We={key:1,class:"safe-tip"},$e={key:1,class:"preview-placeholder"},Ee={__name:"SensitiveWordChecker",setup(h){const o=g(""),v=g(!1),i=g(!1),t=g([]),c=g(0),$=g(0),E=g([]),y=g([]),d=g(-1),I=g(null),H=W(()=>i.value?ce(o.value,t.value):[]),e=W(()=>d.value>=0?d.value+1:0),r=W(()=>t.value[d.value]||null),C=W(()=>{const n=r.value;return n?`${n.type}:${n.word}`:""}),m=W(()=>{const n=[],s=new Set;return t.value.forEach((u,x)=>{const k=`${u.type}:${u.word}`;s.has(k)||(s.add(k),n.push({word:u.word,type:u.type,firstIndex:x,count:t.value.filter(T=>T.type===u.type&&T.word===u.word).length}))}),n});function B(n){const s=m.value.find(u=>`${u.type}:${u.word}`===n);s&&N(s.firstIndex)}function N(n){n<0||n>=t.value.length||(d.value=n,A(()=>{const s=I.value,u=s==null?void 0:s.querySelector(`#hit-${n}`);if(!s||!u)return;const x=u.offsetTop-s.clientHeight/2+u.offsetHeight/2;s.scrollTo({top:Math.max(0,x),behavior:"smooth"})}))}function U(){if(!t.value.length)return;const n=d.value<0?0:(d.value+1)%t.value.length;N(n)}function Y(){if(!t.value.length)return;const n=d.value<0?t.value.length-1:(d.value-1+t.value.length)%t.value.length;N(n)}
1function F(){const n=ue(o.value);t.value=n.hits,c.value=n.sensitiveCount,$.value=n.forbiddenCount,E.value=n.sensitiveWords,y.value=n.forbiddenWords,i.value=!0,d.value=-1,n.hits.length&&A(()=>N(0))}function Z(){if(!o.value.trim()){z.warning("请输入待检测内容");return}v.value=!0,F(),v.value=!1}function G(){o.value=K(o.value,t.value,"sensitive"),L()}function J(){o.value=K(o.value,t.value,"forbidden"),L()}function L(){F()}async function Q(){try{await navigator.clipboard.writeText(o.value),z.success("已复制内容")}catch{z.error("复制失败")}}return(n,s)=>{var M,j;const u=S("el-input"),x=S("el-icon"),k=S("el-button"),T=S("el-option"),ee=S("el-select");return p(),_("div",de,[l("div",ve,[l("div",pe,[l("div",fe,[f(u,{modelValue:o.value,"onUpdate:modelValue":s[0]||(s[0]=a=>o.value=a),type:"textarea",rows:12,placeholder:"请输入或粘贴待检测文本内容",resize:"none",maxlength:"20000","show-word-limit":"",class:"content-input"},null,8,["modelValue"]),l("div",he,[f(x,{class:"input-tip-icon"},{default:w(()=>[f(D(ne))]),_:1}),s[1]||(s[1]=l("span",{class:"input-tip-text"}," 敏感词(红色):涉政色情等不文明词汇;违禁词(橙色):夸张虚假宣传用语 ",-1))]),f(k,{type:"primary",class:"lookup-button",loading:v.value,onClick:Z},{default:w(()=>[...s[2]||(s[2]=[V(" 开始检测 ",-1)])]),_:1},8,["loading"])]),l("div",_e,[l("div",ge,[s[4]||(s[4]=l("span",{class:"preview-head__title"},"检测结果",-1)),i.value?(p(),_("div",ye,[f(k,{size:"small",onClick:G},{default:w(()=>[V("敏感词删除 ("+b(E.value.length)+")",1)]),_:1}),f(k,{size:"small",onClick:J},{default:w(()=>[V("违禁词删除 ("+b(y.value.length)+")",1)]),_:1}),f(k,{size:"small",type:"primary",onClick:Q},{default:w(()=>[...s[3]||(s[3]=[V("内容复制",-1)])]),_:1})])):O("",!0)]),i.value?(p(),_(R,{key:0},[l("div",me,[l("div",be,[l("span",null,"共 "+b(o.value.length)+" 字",1),l("span",we,"敏感词 "+b(c.value),1),l("span",xe,"违禁词 "+b($.value),1)]),t.value.length?(p(),_("div",ke,[l("button",{type:"button",class:"nav-icon-btn",title:"上一处",onClick:Y},[f(x,null,{default:w(()=>[f(D(se))]),_:1})]),l("span",Ce,b(e.value)+"/"+b(t.value.length),1),l("span",{class:P(["nav-current",((M=r.value)==null?void 0:M.type)==="sensitive"?"is-sensitive":"is-forbidden"])},b((j=r.value)==null?void 0:j.word),3),l("button",{type:"button",class:"nav-icon-btn",title:"下一处",onClick:U},[f(x,null,{default:w(()=>[f(D(oe))]),_:1})]),m.value.length>1?(p(),X(ee,{key:0,"model-value":C.value,size:"small",class:"nav-select",placeholder:"词条",onChange:B},{default:w(()=>[(p(!0),_(R,null,q(m.value,a=>(p(),X(T,{key:`${a.type}-${a.word}`,label:`${a.word}${a.count>1?` ×${a.count}`:""}`,value:`${a.type}:${a.word}`},null,8,["label","value"]))),128))]),_:1},8,["model-value"])):O("",!0)])):O("",!0)]),H.value.length?(p(),_("div",{key:0,ref_key:"highlightBoxRef",ref:I,class:"highlight-box"},[(p(!0),_(R,null,q(H.value,(a,te)=>(p(),_("span",{key:te,id:a.hitIndex!==void 0?`hit-${a.hitIndex}`:void 0,class:P({"hl-sensitive":a.type==="sensitive","hl-forbidden":a.type==="forbidden","hl-active":a.hitIndex===d.value})},b(a.text),11,Se))),128))],512)):(p(),_("p",We,"未检测到敏感违禁词")),s[5]||(s[5]=l("p",{class:"legend-tip"},"敏感词红色高亮,违禁词橙色高亮,检测结果仅供参考",-1))],64)):(p(),_("div",$e,"左侧输入内容并检测后,此处显示高亮结果"))])])])])}}},Ve=le(Ee,[["__scopeId","data-v-a3801b50"]]);export{Ve as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.