Files
meshero.fr/en.search.min.6d39eea7d5f460265013dcf9314a599356de1552b08716d5c057206ea51e87e2.js
T
2026-11-08 15:17:21 +01:00

2 lines
2.7 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(function(){const o="/en.search-data.min.7c084e10d80d8432dcd879abe2a210ab0538068d9abdf0762cec3b1655109268.json";let n,t,e=null;function s(){if(e)return e;const i=(async()=>{const i="forward",r=new RegExp(`[一-鿿぀-ゟ゠-ヿ가-힣㐀-䶿𠀀-𪛟𪜀-𫜿𫝀-𫠟𫠠-𬺯𬺰-𮯯𰀀-𱍏𱍐-𲎯𮯰-𮹟豈-﫿丽-𯨟]|[0-9A-Za-zа-яÀ-ſЀ-ӿ؀-ۿঀ-৿Ḁ-ỿ֐-׿]+`,"mug"),a=e=>(""+e).toLowerCase().match(r)??[];n=new FlexSearch.Document({tokenize:i,encode:a,cache:100,document:{id:"id",store:["title","breadcrumbs"],index:"content"}}),t=new FlexSearch.Document({tokenize:i,encode:a,cache:100,document:{id:"id",store:["title","content","url","display","crumb"],index:"content",tag:[{field:"pageId"}]}});const c=await fetch(o),e=await c.json();let s=0;for(const o in e){let c="";++s;const r=o.split("/").filter(e=>e!==""&&!e.startsWith("#"));let i="";const l=[];let a="/";for(let t=0;t<r.length;t++){const s=r[t];a+=s+"/";const c=e[a];if(!c){console.debug("Excluded page",a,"- will not be included for search result breadcrumb for",o);continue}let n=e[a].title;n==="_index"&&(n=s.split("-").map(e=>e).join(" ")),l.push(n),i+=n,t<r.length-1&&(i+=" > ")}for(const n in e[o].data){const a=n.indexOf("#"),u=a===-1?n:n.slice(0,a),m=a===-1?"":n.slice(a+1),r=u?`${o}#${u}`:o,l=m||e[o].title,h=e[o].data[n]||"",d=h.split(`
`).filter(Boolean);t.add({id:r,url:r,title:l,crumb:i,pageId:`page_${s}`,content:l,...d[0]&&{display:d[0]}});for(let e=0;e<d.length;e++)t.add({id:`${r}_${e}`,url:r,title:l,crumb:i,pageId:`page_${s}`,content:d[e]});c+=` ${l} ${h}`}n.add({id:s,title:e[o].title,breadcrumbs:l.slice(0,-1),content:c})}})(),s=i.catch(o=>{throw e===s&&(e=null),n=0[0],t=0[0],o});return e=s,e}function i(e){const r=parseInt("20",10),c=parseInt("10",10),o=n.search(e,r,{enrich:!0,suggest:!0})[0]?.result||[],i=[],s={};for(let n=0;n<o.length;n++){const r=o[n];s[n]=0;const l=t.search(e,{enrich:!0,suggest:!0,tag:{pageId:`page_${r.id}`}})[0]?.result||[],d={},a={_page_rk:n,route:"",title:r.doc.title,breadcrumbs:r.doc.breadcrumbs||[],matches:[]},u=Math.min(l.length,c);for(let o=0;o<u;o++){const{doc:e}=l[o],r=e.display!==0[0];r&&s[n]++;const{url:t,title:c}=e,i=e.display||e.content;if(d[t+"@"+i])continue;d[t+"@"+i]=!0,a.route||(a.route=t.split("#")[0]),a.matches.push({route:t,title:c,content:i})}a.matches.length&&i.push(a)}let a=0;return i.sort((e,t)=>s[e._page_rk]!==s[t._page_rk]?s[t._page_rk]-s[e._page_rk]:e._page_rk-t._page_rk).map(e=>({id:`hextra-search-opt-${a++}`,route:e.route,title:e.title,breadcrumbs:e.breadcrumbs,matches:e.matches.map(e=>({id:`hextra-search-opt-${a++}`,route:e.route,title:e.title,content:e.content}))}))}window.hextraSearch={preload:s,async search(e){return await s(),i(e)}}})()