import{o as e}from"./rolldown-runtime-CYczEeHN.mjs";import{Et as t,Ft as n,Lt as r,St as i,Tt as a,Vt as o,Yt as s,Zt as c,an as l,bt as u,dn as d,gt as f,hn as p,j as m,jt as h,ot as g,st as _,vt as v,wt as y,yt as b,zt as x}from"./design-system-components-BwTjgxr6.mjs";import{Oi as S,fi as C,na as w,vi as T}from"./composables-BWRDVzKT.mjs";import{c as E,p as D}from"./src-D0Eb6RrM.mjs";import{r as O,t as k}from"./piniaStores-GOtJi_95.mjs";import{i as A,n as j,r as M,t as N}from"./AppContextualHelper-k_0jBGZ7.mjs";var P=e(D()),F=t({name:`AppTile`,components:{AppImageGallery:j,AppActions:M,AppTags:A},props:{app:{type:Object,required:!0,default:()=>void 0}},emits:[`search`],setup(e,{emit:t}){return{emitSearchTerm:e=>{t(`search`,e)},APPID:O}}}),I={class:`app-tile-body flex flex-col justify-between h-full`},L={class:`app-tile-content`},R={class:`flex items-center`},z={class:`my-2 truncate mark-element app-tile-title`},B={class:`ml-2 text-role-on-surface-variant text-sm mt-1`},V={class:`my-2 mark-element`};function H(e,t,n,i,s,l){let d=o(`app-image-gallery`),f=o(`router-link`),m=o(`app-tags`),h=o(`app-actions`),g=o(`oc-card`);return r(),u(g,{tag:`li`,class:`app-tile bg-role-surface-container flex flex-col border overflow-hidden shadow-none`,"header-class":`p-0`},{header:c(()=>[a(f,{to:{name:`${e.APPID}-details`,params:{appId:encodeURIComponent(e.app.id)}}},{default:c(()=>[a(d,{app:e.app},null,8,[`app`])]),_:1},8,[`to`])]),default:c(()=>[t[4]||=y(),b(`div`,I,[b(`div`,L,[b(`div`,R,[b(`h3`,z,[a(f,{to:{name:`${e.APPID}-details`,params:{appId:encodeURIComponent(e.app.id)}}},{default:c(()=>[y(p(e.app.name),1)]),_:1},8,[`to`])]),t[0]||=y(),b(`span`,B,`
            v`+p(e.app.mostRecentVersion.version),1)]),t[1]||=y(),b(`p`,V,p(e.app.subtitle),1)]),t[2]||=y(),a(m,{app:e.app,onClick:e.emitSearchTerm},null,8,[`app`,`onClick`]),t[3]||=y(),a(h,{app:e.app,class:`mt-4`},null,8,[`app`])])]),_:1})}var U=t({name:`AppList`,components:{AppContextualHelper:N,AppTile:_(F,[[`render`,H]]),NoContentMessage:E},setup(){let{apps:e}=g(k()),t=S(),r=T(`filter`,``),i=v(()=>C(d(r))),a=l(``),o=e=>t.replace({query:{...e&&{filter:e.trim()}}}),c=(e,t)=>(t||``).trim()?new m(e,{...w,keys:[`name`,`subtitle`,`tags`]}).search(t).map(e=>e.item):e,u=v(()=>c(d(e),d(i))),f;return n(async()=>{await h(),f=new P.default(`.mark-element`)}),s([i,f],()=>{a.value=d(i),f?.unmark(),d(i)&&f?.mark(d(i),{element:`span`,className:`mark-highlight`})}),{filteredApps:u,filterTerm:i,setFilterTerm:o,filterTermInput:a}}}),W={class:`mt-0 text-lg app-list-headline`},G={class:`flex items-center mb-4`},K=[`textContent`];function q(e,t,n,s,l,d){let m=o(`app-contextual-helper`),h=o(`oc-text-input`),g=o(`no-content-message`),_=o(`app-tile`),v=o(`oc-list`);return r(),i(`div`,null,[b(`h1`,W,[y(p(e.$gettext(`App Store`))+` `,1),a(m)]),t[0]||=y(),b(`div`,G,[a(h,{id:`apps-filter`,"model-value":e.filterTermInput,label:e.$gettext(`Search`),"clear-button-enabled":!0,autocomplete:`off`,"onUpdate:modelValue":e.setFilterTerm},null,8,[`model-value`,`label`,`onUpdate:modelValue`])]),t[1]||=y(),e.filteredApps.length?(r(),u(v,{key:1,class:`grid [grid-template-columns:repeat(auto-fill,minmax(300px,1fr))] gap-4`},{default:c(()=>[(r(!0),i(f,null,x(e.filteredApps,t=>(r(),u(_,{key:`app-${t.repository.name}-${t.id}`,app:t,onSearch:e.setFilterTerm},null,8,[`app`,`onSearch`]))),128))]),_:1})):(r(),u(g,{key:0,icon:`store`},{message:c(()=>[b(`span`,{textContent:p(e.$gettext(`No apps found matching your search`))},null,8,K)]),_:1}))])}var J=_(U,[[`render`,q]]);export{J as default};