import{r as e,t}from"./jsx-runtime-DAs1UGHr.js";import"./react-DxF41JXl.js";import"./use-runtime-config-D_-Z8FUB.js";import"./use-api-BAbm8GVs.js";import{t as n}from"./page-container-DV9_twon.js";import"./entity-service-D6-I4F0h.js";import{i as r,n as i,r as a,t as o}from"./search-input-DVDKmJAY.js";import{t as s}from"./row-action-button-CWxfWRow.js";import{t as c}from"./use-all-prompts-CDSoqi-1.js";var l=e(t(),1);function u(){let{searchTerm:e,submittedTerm:t,handleInputChange:u,handleSearchSubmit:d,handleClearSearch:f}=r(),{isLoading:p,error:m,refresh:h,allPrompts:g}=c(),_=(g||[]).filter(e=>e.name.toLowerCase().includes(t.toLowerCase())),v=e=>(0,l.jsx)(`div`,{className:`invisible group-hover:visible`,children:(0,l.jsx)(s,{entityId:e.name,route:`/prompts`,buttonText:`Manage permissions`})});return(0,l.jsxs)(n,{title:`Prompts`,children:[(0,l.jsx)(i,{isLoading:p,loadingText:`Loading prompts list...`,error:m,onRetry:h}),!p&&!m&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:`mb-2`,children:(0,l.jsx)(o,{value:e,onInputChange:u,onSubmit:d,onClear:f,placeholder:`Search prompts...`})}),(0,l.jsx)(a,{mode:`object`,data:_,columns:[{header:`Name`,render:e=>e.name},{header:`Permissions`,render:e=>v(e),className:`flex-shrink-0`}],searchTerm:t})]})]})}export{u as default};