import{u as j,j as r}from"./query-ATBhtd3K.js";import{r as s}from"./vendor-EnoIVk-c.js";import{d as v,e as w,f as A,g as C,i as L,E as k,T as I}from"./en-IUV4ZXKH-BjYNERUx.js";import{T as D}from"./ToolbarPanels-tcvPzqNN.js";import{u as M}from"./i18n-BYxb14hm.js";import"./index-D4SjcYxX.js";import"./useAuth-CqtZE9nt.js";import"./AuthContext-CYne_gJM.js";import"./routing-nZgBtxly.js";import"./KnowledgeBaseContext-CgnF8K-_.js";import"./PlusIcon-qGFPUzg0.js";function G(){const{t:m}=M(),e=(t,N)=>m(`ModerateEntityTags.${t}`,N),[a,i]=s.useState(""),[p,o]=s.useState(""),T=j(),{activePanel:y}=v(),{theme:h,setTheme:c}=w(),{showLineNumbers:f,toggleLineNumbers:d}=A(),E=s.useCallback(({theme:t})=>{c(t)},[c]),b=s.useCallback(()=>{d()},[d]);C({"settings:theme-changed":E,"settings:line-numbers-toggled":b});const l=L(),{data:n,isLoading:u}=l.list.useQuery({refetchInterval:3e4,refetchIntervalInBackground:!0}),x=(n==null?void 0:n.entityTypes)||[],g=l.add.useMutation(),P=async()=>{if(a.trim()){o("");try{await g.mutateAsync(a.trim()),T.invalidateQueries({queryKey:["/api/entity-types"]}),i("")}catch(t){o(t instanceof Error?t.message:e("errorFailedToAdd"))}}};return u?r.jsx("div",{className:"flex items-center justify-center py-20",children:r.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:e("loading")})}):r.jsx(k,{entityTypes:x,isLoading:u,error:p,newTag:a,onNewTagChange:i,onAddTag:P,isAddingTag:g.isPending,theme:h,showLineNumbers:f,activePanel:y,translations:{pageTitle:e("pageTitle"),pageDescription:e("pageDescription"),sectionTitle:e("sectionTitle"),sectionDescription:e("sectionDescription"),inputPlaceholder:e("inputPlaceholder"),addTag:e("addTag"),adding:e("adding")},ToolbarPanels:D,Toolbar:I})}export{G as default};
//# sourceMappingURL=page-BBEm8LmA.js.map
