1import{a as S}from"/chunk-HGMYEODV.js";import{m as O}from"/chunk-QDD52DGA.js";import{a as T,d as c}from"/chunk-DXYSHMUZ.js";import{a as A}from"/chunk-5EXXJK5J.js";import{a as y}from"/chunk-XVQ3NSRE.js";import{b}from"/chunk-5AGQLMAL.js";import{a as f}from"/chunk-PSDBGZLN.js";import{a as p}from"/chunk-P4BZ4TJK.js";import{f as l}from"/chunk-EMJN6GDS.js";var x=l(p());var a=l(p()),$=(e,t,r=500)=>{let s=(0,a.useRef)(),n=(0,a.useRef)(e),[,i]=(0,a.useState)(0),u=()=>{n.current=e,i(g=>g+1)};return(0,a.useEffect)(()=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>u(),r)},t),n.current};var d=l(f()),v=e=>{for(let[t,r]of Object.entries(c))if(r.includes(e))return t;return e},h=(e,t)=>{for(let[r,s]of Object.entries(c))if(s.includes(e))return`${e} => ${r}`;return t},j=Object.entries(S).reduce((e,[t,r])=>e.concat(Object.values(r).reduce((s,n)=>s.concat(n.tags.map(i=>({id:v(i),text:h(i,`[${b[t].name}/${n.namePlural}] ${i}`)}))),[])),[]),F=Object.entries(c).reduce((e,[t,r])=>e.concat([{id:t,text:`${r.join("|")} => ${t}`}]),[]),R=j.concat(F),D=(e,t)=>e.sort((r,s)=>{let n=String(r.id).includes(t),i=String(s.id).includes(t);return n&&!i?-1:!n&&i?1:0});var E=({isDisabled:e,autoComplete:t=!0,onNewTag:r,existingTags:s})=>{let[n,i]=(0,x.useState)(""),u=A(),g=$(o=>n.length<2||!t?null:o.rpc("autocompletetags",{input:n,include_adult:u}).select("*"),[n,u,t]),[C,,m]=y(g),I=t?[].concat(m?m.filter(o=>s?!s.includes(o.id):!0).map(o=>({data:o.id,label:`${o.id} (${o.count||0})`})):[]).concat(n.length>1?[{data:"",label:"Category or area:",isDisabled:!0}].concat(D(R,n).slice(0,4).map(o=>({data:o.id,label:o.text}))):[]):[];return(0,d.jsx)("div",{children:(0,d.jsx)(O,{value:n,onNewValue:o=>i(o),options:I,onSelectedOption:o=>{i(""),r(T(o.data))},label:C?"Searching...":"Start typing a tag...",textFieldProps:{fullWidth:!0,disabled:e,size:"small"}})})},U=E;export{U as a}; 2//# sourceMappingURL=/chunk-YLRAEI4R.js.map
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.