PageSourceSearch

https://www.maggiofiorentino.com/_nuxt/DZ8eXBdp.js

js maggiofiorentino.com collected 2026-09-24 19:15:53 UTC 5,759 bytes, 1 lines download raw bytes

1import{f as z,A as B,C as T,r as y,h as L,M as A,g as D,e as F,c as l,a as o,k as v,t as r,p as e,I as Q,ah as U,b8 as j,J as E,K as m,d as S,b as J,F as C,l as q,o as n,L as K,i as G}from"./CpQMYPfN.js";import{_ as H}from"./DQvlHNqw.js";import{u as O}from"./L-OWWw3e.js";import"./Cj6hqkXK.js";import"./DlAUqK2U.js";const W={class:"bg-stone-100"},X={class:"container-padded py-6"},Y={class:"font-bold text-3xl mb-6"},Z={class:"flex gap-2"},ee={for:"search-input",class:"sr-only"},te=["placeholder"],se=["disabled"],ae={class:"h-6 mt-2"},oe={key:0,class:"text-sm text-gray-600"},re={key:0,class:"flex gap-2 mb-6 flex-wrap"},ne={key:1,class:"text-center py-12"},le={class:"mt-4 text-gray-600"},ie={key:2,class:"mb-4"},ce={class:"text-lg font-semibold"},ue={class:"font-bold"},de={key:3,class:"text-center py-12"},pe={class:"text-2xl font-bold mb-2"},ge={class:"text-gray-600"},he={key:4,class:"space-y-4 pb-6"},be={key:5,class:"flex justify-center gap-2 mt-8"},ye=["onClick"],ve={key:1,class:"px-2 py-2"},$e={__name:"index",setup(_e){const{$getLocale:M,$t:s,$localePath:me}=z(),k=B(),I=T(),P=M(),N=O(),{setPageI18n:R}=N;R([{locale:"it",slug:"/ricerca/"},{locale:"en",slug:"/ricerca/"}]);const c=y(k.query.q||""),u=y(k.query.type||"all"),d=y(parseInt(k.query.page)||1),g=y(!1),h=y(!1),$=y(""),p=y({data:[],meta:{pagination:{page:1,pageSize:10,pageCount:0,total:0}}});L(async()=>{c.value&&c.value.length>=2&&await f()}),A(u,async()=>{h.value&&(d.value=1,await f())});const f=async()=>{if(!(c.value.length<2)){g.value=!0,$.value=c.value;try{const i=await $fetch("/sapi/search",{query:{q:c.value,locale:P,type:u.value,page:d.value,pageSize:10}});p.value=i,h.value=!0,I.push({query:{q:c.value,type:u.value,page:d.value}})}catch(i){console.error("Search error:",i),p.value={data:[],meta:{pagination:{page:1,pageSize:10,pageCount:0,total:0}}}}finally{g.value=!1}}},w=async i=>{d.value=i,await f(),window.scrollTo({top:0,behavior:"smooth"})},V=D(()=>{const i=[],t=p.value.meta.pagination.pageCount,_=d.value;if(t<=7)for(let b=1;b<=t;b++)i.push(b);else{i.push(1),_>3&&i.push("...");const b=Math.max(2,_-1),a=Math.min(t-1,_+1);for(let x=b;x<=a;x++)i.push(x);_<t-2&&i.push("..."),i.push(t)}return i});return F({title:()=>s("search.title"),description:()=>s("search.placeholder")}),(i,t)=>{const _=K,b=H;return n(),l("div",null,[o("div",W,[o("div",X,[o("h1",Y,r(e(s)("search.title")),1),o("form",{onSubmit:Q(f,["prevent"]),class:"mb-6"},[o("div",Z,[o("label",ee,r(e(s)("search.title")),1),U(o("input",{id:"search-input","onUpdate:modelValue":t[0]||(t[0]=a=>E(c)?c.value=a:null),type:"text",placeholder:e(s)("search.placeholder"),class:"flex-1 px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-black",min:2},null,8,te),[[j,e(c)]]),o("button",{type:"submit",class:"px-6 py-3 bg-black text-white rounded-lg hover:bg-gray-800 transition-colors font-semibold",disabled:e(g)||e(c).length<2},r(e(s)("search.button")),9,se)]),o("div",ae,[e(c).length>0&&e(c).length<2?(n(),l("p",oe,r(e(s)("search.min_chars")),1)):v("",!0)])],32),e(h)?(n(),l("div",re,[o("button",{onClick:t[1]||(t[1]=a=>u.value="all"),class:m(["px-4 py-2 rounded-lg font-semibold transition-colors",e(u)==="all"?"bg-black text-white":"bg-white text-black border border-gray-300 hover:bg-gray-100"])},r(e(s)("search.filter_all")),3),o("button",{onClick:t[2]||(t[2]=a=>u.value="pages"),class:m(["px-4 py-2 rounded-lg font-semibold transition-colors",e(u)==="pages"?"bg-black text-white":"bg-white text-black border border-gray-300 hover:bg-gray-100"])},r(e(s)("search.filter_pages")),3),o("button",{onClick:t[3]||(t[3]=a=>u.value="events"),class:m(["px-4 py-2 rounded-lg font-semibold transition-colors",e(u)==="events"?"bg-black text-white":"bg-white text-black border border-gray-300 hover:bg-gray-100"])},r(e(s)("search.filter_events")),3),o("button",{onClick:t[4]||(t[4]=a=>u.value="news"),class:m(["px-4 py-2 rounded-lg font-semibold transition-colors",e(u)==="news"?"bg-black text-white":"bg-white text-black border border-gray-300 hover:bg-gray-100"])},r(e(s)("search.filter_news")),3)])):v("",!0),e(g)?(n(),l("div",ne,[t[7]||(t[7]=o("div",{class:"inline-block animate-spin rounded-full h-12 w-12 border-b-2 border-black"},null,-1)),o("p",le,r(e(s)("search.loading")),1)])):e(h)&&!e(g)?(n(),l("div",ie,[o("p",ce,[S(r(e(p).meta.pagination.total)+" "+r(e(p).meta.pagination.total===1?e(s)("search.result_count_singular"):e(s)("search.result_count_plural"))+" "+r(e(s)("search.results_for"))+' "',1),o("span",ue,r(e($)),1),t[8]||(t[8]=S('" '))])])):v("",!0),e(h)&&!e(g)&&e(p).data.length===0?(n(),l("div",de,[J(_,{name:"i-heroicons-magnifying-glass",class:"h-16 w-16 text-gray-400 mx-auto mb-4"}),o("h2",pe,r(e(s)("search.no_results")),1),o("p",ge,r(e(s)("search.no_results_description")),1)])):e(h)&&!e(g)&&e(p).data.length>0?(n(),l("div",he,[(n(!0),l(C,null,q(e(p).data,a=>(n(),G(b,{key:`${a.type}-${a.id}`,result:a},null,8,["result"]))),128))])):v("",!0),e(h)&&!e(g)&&e(p).meta.pagination.pageCount>1?(n(),l("div",be,[e(d)>1?(n(),l("button",{key:0,onClick:t[5]||(t[5]=a=>w(e(d)-1)),class:"px-4 py-2 bg-white border border-gray-300 rounded-lg hover:bg-gray-100 transition-colors"}," ← "+r(e(s)("previous")),1)):v("",!0),(n(!0),l(C,null,q(e(V),a=>(n(),l(C,{key:a},[a!=="..."?(n(),l("button",{key:0,onClick:x=>w(a),class:m(["px-4 py-2 rounded-lg transition-colors",a===e(d)?"bg-black text-white":"bg-white border border-gray-300 hover:bg-gray-100"])},r(a),11,ye)):(n(),l("span",ve,"..."))],64))),128)),e(d)<e(p).meta.pagination.pageCount?(n(),l("button",{key:1,onClick:t[6]||(t[6]=a=>w(e(d)+1)),class:"px-4 py-2 bg-white border border-gray-300 rounded-lg hover:bg-gray-100 transition-colors"},r(e(s)("next"))+" → ",1)):v("",!0)])):v("",!0)])])])}}};export{$e as default};

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.