1import{D as e,F as t,Gt as n,It as r,M as i,N as a,T as o,it as s,wt as c}from"./DidYC9GO.js";import{n as l}from"./BPp18JmO.js";import{a as u,m as d}from"#entry";import{t as f}from"./D9iUNB0w.js";import{t as p}from"./DV14I2O1.js";import"./DTI0gMoY.js";import{t as m}from"./BQYWKgQ4.js";var h=p(),g=Object.assign(t({name:`UniversityAutocomplete`,__name:`UniversityAutocomplete`,props:{id:{default:`university-autocomplete`},courseLevel:{default:``},desktopAllowMultiple:{type:Boolean,default:!0},icon:{default:null},placeholder:{default:`Digite as faculdades`},size:{default:`medium`},joinName:{type:Boolean,default:!0},returnFullnameFirst:{type:Boolean,default:!0},value:{default:()=>[]}},emits:[`change`],setup(t,{emit:p}){let g=t,_=p,v=[h.faSpinnerThird,{spin:!0}],y=r(0),b=r([]),x=r(!1),S=r(!1),C=o(()=>g.desktopAllowMultiple?g.value:g.value[0]),w=o(()=>x.value?v:g.icon);function T(){let e=[`autocomplete_enabled:true`];return g.courseLevel&&e.push(`available_simplified_levels:"${g.courseLevel}"`),e.join(` AND `)}function E(e){return g.joinName&&e.name!==e.fullName?`${e.fullName} (${e.name})`:g.returnFullnameFirst?e.fullName||e.name:e.name||e.fullName||``}let D=d(async e=>{let t=++y.value,n=T();try{let r=await m.getUniversityAutocompleteData(e,n);if(t!==y.value)return;b.value=[],(r??[]).forEach(t=>{let{mainSlug:r}=t;if(!r||r===`undefined`){console.warn(`[UniversityAutocomplete:getUniversityAutocompleteData]`,{searchString:e,filters:n,uni:t});return}b.value.push({name:E(t),mainSlug:r})})}catch{if(t!==y.value)return;b.value=[]}finally{t===y.value&&(x.value=!1)}},700);function O(e=``){let t=String(e??``);if(!t||t.trim().length<3){b.value=[];return}x.value=!0,D(t)}function k(e){e?.mainSlug&&e.mainSlug!==`undefined`&&(S.value=!0,g.desktopAllowMultiple?_(`change`,[...g.value,e]):_(`change`,[e]))}function A(e){_(`change`,g.value.filter(t=>t.mainSlug!==e.mainSlug))}function j(){b.value.length<1||(S.value?S.value=!1:k(b.value[0]))}function M(e){if(!e){_(`change`,null);return}_(`change`,l(Array.isArray(e)?e:[e],e=>({mainSlug:e.key,name:e.label})))}return(r,o)=>{let l=u,d=f;return s(),e(d,{id:t.id,multiple:t.desktopAllowMultiple,placeholder:t.placeholder,options:n(b),"internal-search":!1,icon:n(w),size:t.size,"clear-button-aria-label":`Limpar todas as universidades`,"label-by":`name`,"track-by":`mainSlug`,"auto-select":``,"hide-selected":``,value:n(C),"is-loading":n(x),"onUpdate:value":O,onSelect:k,onRemove:A,onClear:o[0]||=e=>M([]),onClose:j},{noResult:c(()=>[a(l,{class:`!ml-4`,tag:`span`,align:`left`,size:`medium`},{default:c(()=>[...o[1]||=[i(` Sem resultados para a pesquisa. `,-1)]]),_:1})]),_:1},8,[`id`,`multiple`,`placeholder`,`options`,`icon`,`size`,`value`,`is-loading`])}}}),{__name:`UniversityAutocomplete`});export{g as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.