PageSourceSearch

https://www.elliptic.co/_nuxt/Di2-snIT.js

js elliptic.co collected 2026-10-02 02:15:35 UTC 4,610 bytes, 1 lines download raw bytes

1import{A as z}from"./UG8pIHQv.js";import V from"./DIYysZrV.js";import{t as N,p as B,q as J,s as K,v as H,x as S,y as W,k as E,z as P,d as X,c as Y,w as Z,e as Q,f as b,g as j,o as ee,A as te,B as se,h as re,l as ne,m as ae}from"./DRREkx-t.js";import{C as ie}from"./BmnpE1lZ.js";import{u as oe}from"./BMq9mDWV.js";import"./B2eE2O7_.js";const le=(A,f)=>{let h;return(..._)=>{clearTimeout(h),h=setTimeout(()=>A(..._),f)}},ce=1,ue=300,R=100,fe=30;async function he(A={}){const{target:f="search",minimumTermLength:h=ce,debounceMs:_=ue,formatTag:w=e=>{if(e?.ancestors&&Array.isArray(e.ancestors)&&e.ancestors.length>0)return e.ancestors.map(r=>r.title).filter(Boolean).join(" / ");if(e?.uri==="__home__")return N("Home");const s=ie[e?.sectionHandle??""]?.title;return s?N(s):e?.title??N("Pages")},site:g="default"}=A,c=B(),d=J(),C=K(c.path),L=!1,x=c.query.q?.replace(/\+/g," ")??"",p=S(x),y=S([]),u=S(!1);let T=S([]);T=await oe(f,{site:g});const q=E(()=>{const e=T.value,s=e?.pages||(Array.isArray(e)?e:[]);return Array.isArray(s)?s.filter(r=>r?.uri!==C&&r?.excludeFromSearch!==!0&&!W(r)):[]});function M(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function I(e){const s=[];function r(t){if(!(!t||typeof t!="object")){if(Array.isArray(t)){t.forEach(r);return}typeof t.rawHtml=="string"&&s.push(P(t.rawHtml)),typeof t.plainText=="string"&&s.push(P(t.plainText)),typeof t.quote=="string"&&s.push(P(t.quote)),typeof t.title=="string"&&t.__typename!=="pages_Entry"&&t.__typename!=="article_Entry"&&s.push(P(t.title));for(const n in t)n!=="seo"&&n!=="ancestors"&&n!=="asset"&&r(t[n])}}return r(e),s.filter(Boolean).join(" ")}function D(e,s,r,t,n){if(!t.length)return 0;const a=(e.title??"").toLowerCase(),i=s.toLowerCase(),m=r.toLowerCase();if(!t.every(l=>a.includes(l)||i.includes(l)||m.includes(l)))return 0;let o=0;return a===n?o+=200:a.includes(n)&&(o+=100),i.includes(n)&&(o+=50),t.forEach(l=>{if(a.includes(l)&&(o+=20),m.includes(l)&&(o+=25),i.includes(l)){o+=5;const G=(i.match(new RegExp(M(l),"g"))||[]).length;o+=Math.min(G,3)}}),o}function O(e,s,r){if(!e)return e;const n=r.split(" ").length>1&&e.toLowerCase().includes(r)?[r]:[...new Set(s)].sort((i,m)=>m.length-i.length);if(!n.length)return e;const a=new RegExp(`(${n.map(M).join("|")})`,"gi");return e.replace(a,"<strong>$1</strong>")}function $(e,s,r){if(!e||!s.length)return"";const t=e.toLowerCase();let n=t.indexOf(r);if(n===-1)for(const o of s){const l=t.indexOf(o);l!==-1&&(n===-1||l<n)&&(n=l)}if(n===-1){let o=e.substring(0,R);return e.length>R&&(o+="..."),o}let a=Math.max(0,n-fe);const i=e.substring(0,n),m=Math.max(i.lastIndexOf("."),i.lastIndexOf("?"),i.lastIndexOf("!"));m!==-1&&m>a-50&&(a=m+1);let v=e.substring(a,a+R);return a>0&&(v="..."+v),a+R<e.length&&(v+="..."),O(v,s,r)}function F(e,s,r){return O(e,s,r)}async function k(e){if(!e||e.length<h){y.value=[];return}const s=e.toLowerCase().trim(),r=s.split(" ").filter(t=>t.length>=h);u.value=!0;try{L||(y.value=q.value.map(t=>{const n=I(t),a=w(t),i=D(t,n,a,r,s);return i<=0?null:{tag:a,heading:F(t.title??"",r,s),snippet:$(n,r,s),link:{url:`/${t.uri}/`,type:"internal",target:"_self"},score:i}}).filter(t=>t!==null).sort((t,n)=>n.score-t.score))}finally{u.value=!1}}const U=le(e=>k(e.trim()),_);return H(p,e=>{if(e)d.replace({path:c.path,query:{...c.query,q:e.replace(/ /g,"+")}});else{const{q:s,...r}=c.query;d.replace({path:c.path,query:r})}U(e)}),H(()=>c.query.q,e=>{const s=e?.replace(/\+/g," ")??"";s!==p.value&&(p.value=s,s?k(s):y.value=[])}),p.value&&await k(p.value),{searchTerm:p,searchResults:y,isSearching:u}}const we=X({name:"search-results-page",__name:"search-results",async setup(A){let f,h;const _=ae(),{locale:w,t:g}=Y();let c;const{searchTerm:d,searchResults:C}=([f,h]=Z(()=>he({site:w.value})),f=await f,h(),f);c=E(()=>C.value.map(u=>({headline:u.heading,snippet:u.snippet,link:u.link,tag:u.tag})));const L=E(()=>({heading:g("Search results"),inputPlaceholder:g("Search"),noResultsMessage:g("No results found"),results:c.value??[]})),x=B(),p=E(()=>Object.keys(x.query).length>0),y=E(()=>({title:g("Search results"),siteName:"Elliptic",uri:"search-results",seo:{description:g("Browse search results to quickly find the information, products, or resources you're looking for."),...p.value&&{advanced:{robots:["noindex","follow"]}}},url:`${_.public.APP_ROOT}${ne("search-results",w.value)}`,schemaType:"SearchResultsPage",siteHandle:w.value}));return Q(y),(u,T)=>(ee(),b(z,{class:"flow"},{default:j(()=>[te(V,{module:L.value,searchTerm:re(d),"onUpdate:searchTerm":T[0]||(T[0]=q=>se(d)?d.value=q:null)},null,8,["module","searchTerm"])]),_:1}))}});
1export{we 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.