import{cD as L,r as u,w as h,d as R,o as T,e as q,f as l,i as o,bh as E,A as a,a3 as k,cE as W,a2 as M,h as d,B as D,z as N,C as U,aH as I,ax as j,Y as B,aS as O,y as x,Z as A,aG as G,O as H,aP as Q,F as X,be as Y,bf as Z}from"./index.737529e8.1750111005555.js";import{_ as J}from"./_plugin-vue_export-helper.c27b6911.1750111005555.js";const ee=p=>(Y("data-v-efe7f2bd"),p=p(),Z(),p),se={class:"d-flex align-start"},te={class:"h-100"},ae={class:"app-bar-search-suggestions d-flex flex-column align-center justify-center text-high-emphasis h-100"},le={class:"d-flex align-center flex-wrap justify-center gap-2 text-h6 my-3"},oe=ee(()=>d("span",null,"Não encontramos nenhum resultado para ",-1)),ne={__name:"AppBarSearch",props:{isDialogVisible:{type:Boolean,required:!0},searchResults:{type:Array,required:!0}},emits:["update:isDialogVisible","search"],setup(p,{emit:C}){const _=p,w=C,{ctrl_k:z,meta_k:P}=L({passive:!1,onEventFired(e){e.ctrlKey&&e.key==="k"&&e.type==="keydown"&&e.preventDefault()}}),v=u(),$=u(),t=u("");h([z,P],()=>{w("update:isDialogVisible",!0)});const S=()=>{t.value="",w("update:isDialogVisible",!1)},F=e=>{var s,n;e.key==="ArrowDown"?(e.preventDefault(),(s=v.value)==null||s.focus("next")):e.key==="ArrowUp"&&(e.preventDefault(),(n=v.value)==null||n.focus("prev"))};h(()=>_.isDialogVisible,()=>{t.value=""});const c=u(!1);h(()=>t.value,()=>{t.value.length>0?c.value=!0:c.value=!1}),h(()=>c.value,e=>{e||(t.value="")});const K=window.innerWidth,g=u(!1);K<768&&(g.value=!0);const m=u("Pesquise por vagas..."),y=["vagas...","produtos...","eventos..."];let f=0;const b=async()=>{const e="Pesquise por ",s="...",n=y[f];for(let i=n.length+s.length;i>=0;i--)m.value=e+n.substring(0,i),await V(100);f=(f+1)%y.length;const r=y[f];for(let i=0;i<=r.length+s.length;i++)m.value=e+r.substring(0,i),await V(100);setTimeout(b,2e3)},V=e=>new Promise(s=>setTimeout(s,e));return b(),(e,s)=>{const n=R("IconBtn");return T(),q(X,null,[l(I,{class:N(a(g)?"w-100":""),style:U(a(g)?"padding-left: 6px !important;":"padding: 0px 6px; max-width: 400px;")},{default:o(()=>[l(E,{ref_key:"refSearchInput",ref:$,id:"refSearchInput",modelValue:a(t),"onUpdate:modelValue":[s[0]||(s[0]=r=>k(t)?t.value=r:null),s[1]||(s[1]=r=>e.$emit("search",a(t)))],onKeyup:W(S,["esc"]),onKeydown:F,variant:"solo-filled",placeholder:a(m),style:{border:"var(--color-akkiperto) 1px solid","border-radius":"7px"}},M({_:2},[a(t).length>0?{name:"append-inner",fn:o(()=>[d("div",se,[l(n,{size:"22",onClick:S},{default:o(()=>[l(D,{icon:"tabler-x",size:"20"})]),_:1})])]),key:"0"}:void 0]),1032,["modelValue","placeholder"])]),_:1},8,["class","style"]),l(Q,{modelValue:a(c),"onUpdate:modelValue":s[2]||(s[2]=r=>k(c)?c.value=r:null),activator:"#refSearchInput",location:"bottom center","max-height":"400","offset-y":"","close-delay":"10000","close-on-content-click":!0,persistent:!1,class:"menu-search"},{default:o(()=>[l(a(j),{options:{wheelPropagation:!1,suppressScrollX:!0},class:"h-100"},{default:o(()=>[B(l(a(O),{ref_key:"refSearchList",ref:v,density:"compact",class:"app-bar-search-list"},{default:o(()=>[x(e.$slots,"searchResult",{},void 0,!0)]),_:3},512),[[A,a(t).length&&!!_.searchResults.length]]),B(d("div",te,[x(e.$slots,"noData",{},()=>[l(G,null,{default:o(()=>[l(I,{class:"h-100"},{default:o(()=>[d("div",ae,[d("div",le,[l(D,{size:"20",icon:"tabler-file-x"}),oe,d("span",null,'"'+H(a(t))+'"',1)]),x(e.$slots,"noDataSuggestion",{},void 0,!0)])]),_:3})]),_:3})],!0)],512),[[A,!_.searchResults.length&&a(t).length]])]),_:3})]),_:3},8,["modelValue"])],64)}}},ce=J(ne,[["__scopeId","data-v-efe7f2bd"]]);export{ce as default};
