PageSourceSearch

https://vizops360.ai/assets/token-tag-input-DZjbZa8_.js

js vizops360.ai collected 2026-10-05 13:50:46 UTC 2,330 bytes, 1 lines download raw bytes

1import{r as i,j as f,X as E,as as R}from"./index-CpeGhXo5.js";function b(l,e){const o=new Set(l.map(p=>p.toLowerCase())),m=[...l];for(const p of e){const r=p.trim();if(!r)continue;const u=r.toLowerCase();o.has(u)||(o.add(u),m.push(r))}return m}function $({id:l,value:e,onChange:o,placeholder:m,className:p,disabled:r,autoFocus:u,validateToken:c,onBlurFlush:k,onRequestComplete:D}){const[a,h]=i.useState(""),g=i.useRef(null);i.useEffect(()=>{u&&!r&&g.current?.focus()},[u,r]);const w=i.useCallback(()=>{const t=a.trim();return!t||c&&!c(t)?e:b(e,[t])},[a,c,e]),d=i.useCallback(()=>{const t=w();return t.length!==e.length&&o(t),h(""),t},[w,o,e]),j=i.useCallback(t=>{const s=t.split(/[,;\n\r]+/).map(x=>x.trim()).filter(Boolean);if(!s.length)return;let n=[...e];for(const x of s)c&&!c(x)||(n=b(n,[x]));n.length!==e.length&&o(n),h("")},[o,c,e]),y=t=>{o(e.filter((s,n)=>n!==t))},N=t=>{if(t.key==="Enter"){if(t.preventDefault(),!a.trim()){D?.(e);return}d();return}if(t.key===","||t.key===";"){t.preventDefault(),d();return}t.key==="Backspace"&&a===""&&e.length>0&&(t.preventDefault(),y(e.length-1))},C=t=>{const s=t.clipboardData.getData("text");/[,;\n\r]/.test(s)&&(t.preventDefault(),j(s))};return f.jsxs("div",{className:R("flex min-h-8 w-full flex-wrap items-center gap-1 rounded-sm border border-input bg-background px-2 py-0.5 text-xs ring-offset-background focus-within:ring-1 focus-within:ring-ring focus-within:ring-offset-0",r&&"pointer-events-none opacity-50",p),onClick:()=>g.current?.focus(),children:[e.map((t,s)=>f.jsxs("span",{className:"inline-flex max-w-full items-center gap-0.5 rounded-sm bg-primary/10 px-1.5 py-0.5 text-2xs font-medium text-primary",children:[f.jsx("span",{className:"truncate",children:t}),!r&&f.jsx("button",{type:"button",className:"rounded-sm p-0.5 text-primary hover:bg-primary/20 shrink-0",onMouseDown:n=>n.preventDefault(),onClick:n=>{n.stopPropagation(),y(s)},"aria-label":`Remove ${t}`,children:f.jsx(E,{className:"h-3 w-3"})})]},`${t}-${s}`)),f.jsx("input",{id:l,ref:g,type:"text",disabled:r,value:a,onChange:t=>h(t.target.value),onKeyDown:N,onPaste:C,onBlur:()=>{const t=d();k?.(t)},placeholder:e.length===0?m:void 0,className:"min-w-[8rem] flex-1 border-0 bg-transparent py-0 text-xs shadow-none outline-none placeholder:text-muted-foreground focus-visible:ring-0"})]})}export{$ as T};

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.