import{$ as e,B as t,F as n,H as r,I as i,L as a,M as o,T as s,V as c,W as l,X as u,Z as d,at as f,ot as p,st as m,tt as h,x as g,z as _}from"./vue-quasar-CzR5lecU.js";import{r as v}from"./index-C94eCAzg.js";var y={name:`SpotlightSearch`,props:{app:{type:Object,required:!0}},setup(t){e(()=>t.app.spotlightRows.value.length,e=>{if(!e){t.app.spotlightActiveIndex.value=0;return}t.app.spotlightActiveIndex.value>=e&&(t.app.spotlightActiveIndex.value=e-1)});function n(e){if(e.key===`Escape`){e.preventDefault(),t.app.closeSpotlightSearch();return}if(e.key===`ArrowDown`){e.preventDefault(),t.app.moveSpotlightSelection(1);return}e.key===`ArrowUp`&&(e.preventDefault(),t.app.moveSpotlightSelection(-1))}return{...t.app,onSpotlightKeydown:n}}},b={key:0,class:`spotlight-search__progress`,"aria-hidden":`true`},x={key:1,class:`spotlight-search__results`,role:`listbox`,"aria-label":`Search results`},S=[`aria-selected`,`onMouseenter`,`onClick`],C=[`src`],w={key:1,class:`spotlight-search__art spotlight-search__art--empty`},T={class:`spotlight-search__copy`},E={key:2,class:`spotlight-search__type`},D={key:2,class:`spotlight-search__empty`,role:`status`};function O(e,v,y,O,k,A){return u(),t(a,{to:`body`},[e.spotlightOpen?(u(),r(`div`,{key:0,class:`spotlight-search-layer`,onMousedown:v[5]||=n((...t)=>e.closeSpotlightSearch&&e.closeSpotlightSearch(...t),[`self`])},[_(`section`,{class:`spotlight-search`,role:`dialog`,"aria-modal":`true`,"aria-label":`Search Orchard`,style:p(e.playerBarStyle),onKeydown:v[4]||=(...e)=>O.onSpotlightKeydown&&O.onSpotlightKeydown(...e)},[_(`form`,{class:`spotlight-search__form`,onSubmit:v[3]||=n((...t)=>e.submitSpotlightSearch&&e.submitSpotlightSearch(...t),[`prevent`])},[l(s,{name:`search`}),h(_(`input`,{ref:`spotlightInputRef`,"onUpdate:modelValue":v[0]||=t=>e.spotlightQuery=t,type:`search`,autocomplete:`off`,spellcheck:`false`,placeholder:`Search songs, albums, artists, pages`,"aria-label":`Search songs, albums, artists, pages`,onInput:v[1]||=(...t)=>e.queueSpotlightSearch&&e.queueSpotlightSearch(...t)},null,544),[[o,e.spotlightQuery]]),_(`button`,{type:`button`,"aria-label":`Close search`,onClick:v[2]||=(...t)=>e.closeSpotlightSearch&&e.closeSpotlightSearch(...t)},[l(s,{name:`close`})])],32),e.spotlightLoading?(u(),r(`div`,b,[...v[6]||=[_(`span`,null,null,-1)]])):c(``,!0),e.spotlightRows.length?(u(),r(`div`,x,[(u(!0),r(i,null,d(e.spotlightRows,(t,n)=>(u(),r(`button`,{key:t.id,type:`button`,class:f([`spotlight-search__row`,{"spotlight-search__row--active":e.spotlightActiveIndex===n}]),"aria-selected":e.spotlightActiveIndex===n,role:`option`,onMouseenter:t=>e.spotlightActiveIndex=n,onClick:n=>e.openSpotlightRow(t)},[t.artwork?(u(),r(`img`,{key:0,src:t.artwork,alt:``,class:`spotlight-search__art`},null,8,C)):(u(),r(`span`,w,[l(s,{name:t.icon},null,8,[`name`])])),_(`span`,T,[_(`strong`,null,m(t.title),1),_(`span`,null,m(t.subtitle),1)]),t.type?(u(),r(`span`,E,m(t.type),1)):c(``,!0)],42,S))),128))])):(u(),r(`div`,D,[e.spotlightLoading?(u(),t(g,{key:0,size:`18px`})):(u(),t(s,{key:1,name:`search_off`})),_(`span`,null,m(e.spotlightLoading?`Searching...`:`No matches`),1)]))],36)],32)):c(``,!0)])}var k=v(y,[[`render`,O]]);export{k as default};