PageSourceSearch

https://supersaas.dev/_nuxt/CVHr8Tl02.js

js supersaas.dev collected 2026-10-04 00:31:03 UTC 9,873 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./V-Q23a7M2.js","./HclGiUj8.js","./DeUAwsu_2.js","./BnDTbt6S.js","./BW3xJdEx.js"])))=>i.map(i=>d[i]);
2import{a as e}from"./CQtAXI_i.js";import{En as t,Ht as n,vn as r}from"./Ib1jYPSS.js";import{_ as i}from"./fAzeDrst.js";import{t as a}from"./HclGiUj8.js";import{i as o,n as s}from"./DeUAwsu_2.js";import{n as c}from"./y6xx4Zq32.js";var l=(e,t)=>{let n=e._conditions;return n.length>0?`(${n.join(` ${t} `)})`:``},u=e=>{let t=[],n={_conditions:t,where(e,r,i){let a;switch(r.toUpperCase()){case`IN`:case`NOT IN`:if(Array.isArray(i)){let t=i.map(e=>f(e)).join(`, `);a=`"${String(e)}" ${r.toUpperCase()} (${t})`}else throw TypeError(`Value for ${r} must be an array`);break;case`BETWEEN`:case`NOT BETWEEN`:if(Array.isArray(i)&&i.length===2)a=`"${String(e)}" ${r.toUpperCase()} ${f(i[0])} AND ${f(i[1])}`;else throw Error(`Value for ${r} must be an array with two elements`);break;case`IS NULL`:case`IS NOT NULL`:a=`"${String(e)}" ${r.toUpperCase()}`;break;case`LIKE`:case`NOT LIKE`:a=`"${String(e)}" ${r.toUpperCase()} ${f(i)}`;break;default:a=`"${String(e)}" ${r} ${f(typeof i==`boolean`?Number(i):i)}`}return t.push(`${a}`),n},andWhere(r){let i=r(u(e));return t.push(l(i,`AND`)),n},orWhere(r){let i=r(u(e));return t.push(l(i,`OR`)),n}};return n},d=(e,t)=>{let n={conditions:[],selectedFields:[],offset:0,limit:0,orderBy:[],count:{field:``,distinct:!1}},r={__params:n,andWhere(t){let i=t(u(e));return n.conditions.push(l(i,`AND`)),r},orWhere(t){let i=t(u(e));return n.conditions.push(l(i,`OR`)),r},path(e){return r.where(`path`,`=`,i(e))},skip(e){return n.offset=e,r},where(e,t,n){return r.andWhere(r=>r.where(String(e),t,n)),r},limit(e){return n.limit=e,r},select(...e){return e.length&&n.selectedFields.push(...e),r},order(e,t){return n.orderBy.push(`"${String(e)}" ${t}`),r},async all(){return t(e,a()).then(e=>e||[])},async first(){return t(e,a({limit:1})).then(e=>e[0]||null)},async count(n=`*`,r=!1){return t(e,a({count:{field:String(n),distinct:r}})).then(e=>e[0].count)}};function a(t={}){let r=`SELECT `;if(t?.count)r+=`COUNT(${t.count.distinct?`DISTINCT `:``}${t.count.field}) as count`;else{let e=Array.from(new Set(n.selectedFields));r+=e.length>0?e.map(e=>`"${String(e)}"`).join(`, `):`*`}r+=` FROM ${o[String(e)]}`,n.conditions.length>0&&(r+=` WHERE ${n.conditions.join(` AND `)}`),n.orderBy.length>0?r+=` ORDER BY ${n.orderBy.join(`, `)}`:r+=` ORDER BY stem ASC`;let i=t?.limit||n.limit;return i>0&&(n.offset>0?r+=` LIMIT ${i} OFFSET ${n.offset}`:r+=` LIMIT ${i}`),r}return r};function f(e){return`'${String(e).replace(/'/g,`''`)}'`}function p(e){return t=>(t||={},(e||[]).filter(e=>t[e]!==void 0).reduce((e,n)=>Object.assign(e,{[n]:t[n]}),{}))}async function m(e,t=[]){e.__params?.orderBy?.length||(e=e.order(`stem`,`ASC`));let{contents:n,configs:r}=(await e.orWhere(e=>e.where(`navigation`,`<>`,`false`).where(`navigation`,`IS NULL`)).select(`navigation`,`stem`,`path`,`title`,`meta`,...t||[]).all()).reduce((e,t)=>{if(String(t.stem).split(`/`).pop()===`.navigation`){t.title=t.title?.toLowerCase()===`navigation`?``:t.title;let n=t.path.split(`/`).slice(0,-1).join(`/`)||`/`;e.configs[n]={...t,...t.body}}else e.contents.push(t);return e},{configs:{},contents:[]}),i=e=>({...p([`title`,...t])(e),...e.meta,...g(e?.navigation)?e.navigation:{}}),a=e=>({...p([`title`,...t])(e),...g(e?.navigation)?e.navigation:{}});return h(n.reduce((e,t)=>{let n=t.path.substring(1).split(`/`),o=t.stem.split(`/`),s=!!o[o.length-1]?.match(/([1-9]\d*\.)?index/g),c=e=>({title:e.title,path:e.path,stem:e.stem,children:[],...a(e)}),l=c(t);if(s){let n=r[l.path];if(n?.navigation!==void 0&&n?.navigation===!1)return e;if(t.path!==`/`){let e=c(t);l.children.push(e)}n&&Object.assign(l,i(n))}if(n.length===1){let t=e.find(e=>e.path===l.path&&e.page===!1);return s&&t?Object.assign(t,{page:void 0,children:[...l.children||[],...t.children||[]]}):e.push(l),e}let u=n.slice(0,-1).reduce((e,t,a)=>{let s=`/`+n.slice(0,a+1).join(`/`),c=r[s];if(c?.navigation!==void 0&&c.navigation===!1)return[];let l=e.find(e=>e.path===s);if(!l){let n=c?i(c):{};l={...n,title:n.title||_(t),path:s,stem:o.slice(0,a+1).join(`/`),children:[],page:!1},e.push(l)}return l.children},e),d=u.find(e=>e.path===l.path&&e.page===!1);return d?Object.assign(d,{...l,page:void 0,children:[...l.children||[],...d.children||[]]}):u.push(l),e},[]))}function h(e){let t=e;for(let e of t)e.children?.length?h(e.children):delete e.children;return e}function g(e){return e!==null&&Object.prototype.toString.call(e)===`[object Object]`}var _=e=>e.split(/[\s-]/g).map(c).join(` `);async function v(e,t,n){let{before:r=1,after:i=1,fields:a=[]}=n||{},o=y(await m(e,a)),s=o.findIndex(e=>e.path===t),c=s===-1?[]:o.slice(s-r,s),l=s===-1?[]:o.slice(s+1,s+i+1);return[...Array.from({length:r}).fill(null).concat(c).slice(c.length),...l.concat(Array.from({length:i}).fill(null)).slice(0,i)]}function y(e){return e.flatMap(e=>{let t=e.children?y(e.children):[];return e.page===!1||t.length&&t.find(t=>t.path===e.path)?t:[{...e,children:void 0},...t]})}function b(e){return{type:`root`,children:e.value.map(x)}}function x(e){if(typeof e==`string`)return{type:`text`,value:e};let[t,n,...r]=e;return{type:`element`,tag:t,props:n,children:r.map(x)}}var S=/^h([1-6])$/,C=e=>Number(e.match(S)?.[1]??0);async function w(e,t){let{ignoredTags:n=[],extraFields:r=[],minHeading:i=`h1`,maxHeading:a=`h6`}=t||{},o=C(i),s=C(a);return(await e.where(`extension`,`=`,`md`).select(`path`,`body`,`description`,`title`,...r||[]).all()).flatMap(e=>T(e,{ignoredTags:n,extraFields:r,minLevel:o,maxLevel:s}))}function T(e,{ignoredTags:t,extraFields:n,minLevel:r,maxLevel:i}){let a=!e.body||e.body?.type===`root`?e.body:b(e.body),o=e.path??``,s=p(n)(e),c=[{...s,id:o,title:e.title||``,titles:[],content:(e.description||``).trim(),level:1}];if(!a?.children)return c;let l=1,u=0,d=[e.title??``];for(let e of a.children){let n=C(e.tag||``);if(n>=r&&n<=i){let t=E(e).trim();n===1?d.splice(0,d.length):n<u?d.splice(n-1,d.length-1):n===u&&d.pop(),c.push({...s,id:`${o}#${e.props?.id}`,title:t,titles:[...d],content:``,level:n}),d.push(t),u=n,l+=1}else{let n=E(e,t).trim();if(l===1&&c[l-1]?.content===n)continue;c[l-1].content=`${c[l-1].content} ${n}`.trim()}}return c}function E(e,t=[]){let n=``;return e.type===`text`&&(n+=e.value||``),t.includes(e.tag??``)?``:(e.children?.length&&(n+=e.children.map(e=>
2E(e,t)).filter(Boolean).join(``)),n)}var D=`_fts_search`,O=new Set,k=!1;async function A(e){await e.exec(`DROP TABLE IF EXISTS ${D}`),O.clear(),k=!1}async function j(e,t,n,r){if(O.has(t))return;k||=(await e.exec(`CREATE VIRTUAL TABLE IF NOT EXISTS ${D} USING fts5(collection UNINDEXED, id UNINDEXED, title, title_normalized, titles UNINDEXED, content, level UNINDEXED)`),!0);let i=await w(n,r);for(let n of i){let r=n.title.replace(/([a-z])([A-Z])/g,`$1 $2`);await e.exec(`INSERT INTO ${D} (collection, id, title, title_normalized, titles, content, level) VALUES (?, ?, ?, ?, ?, ?, ?)`,[t,n.id,n.title,r,JSON.stringify(n.titles),n.content,n.level])}O.add(t)}async function M(e,t,n,r){let{limit:i=50,snippet:a,fields:o,minTermLength:s=1,weights:c}=r||{},l=c?.title??10,u=c?.content??5,d=c?.heading!==!1,f=(a?.tag??`mark`).replace(/[^a-z0-9]/gi,``),p=`<${f}>`,m=`</${f}>`,h=`collection IN (${t.map(()=>`?`).join(`, `)})`,g=`bm25(${D}, 0, 0, ${l}, ${l}, 0, ${u}, 0)`,_=`collection, id, title, titles, content, level, ${d?`(${g} / level)`:g} as rank`,v=a?.columns??(a?[`content`]:[]),y=Number(a?.around)||30,b=v.includes(`content`);b&&(_+=`, snippet(${D}, 5, '${p}', '${m}', '...', ${y}) as snippet_content`);let x=n.split(/\s+/).filter(e=>e.length>=s);if(!x.length)return[];let S=x.map(e=>{let t=e.replace(/"/g,`""`);return o?.length?o.map(e=>`${e} : "${t}"*`).join(` OR `):`"${t}"*`}).join(` `),C=`SELECT ${_} FROM ${D} WHERE ${D} MATCH ? AND ${h} ORDER BY rank LIMIT ?`,w=[S,...t,i],T;try{T=await e.all(C,w)}catch{return[]}let E=v.includes(`title`),O=E?RegExp(`(${x.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)})`,`gi`):null;return T.map(e=>({collection:e.collection,id:e.id,title:e.title,titles:JSON.parse(e.titles||`[]`),level:e.level,content:e.content,rank:e.rank,...v.length&&{snippets:{...E&&{title:e.title.replace(O,`${p}$1${m}`)},...b&&{content:e.snippet_content}}}}))}var N=t=>{let n=e()?.ssrContext?.event;return d(t,(e,t)=>R(n,e,t))};function P(e,t){return B(e,e=>m(e,t))}function F(e,t,n){return B(e,e=>v(e,t,n))}function I(e,t){return B(e,e=>w(e,t))}function L(e,i){let{immediate:o=!0,...s}=i||{},c=r(o?`loading`:`idle`),l,u,d=[];function f(){let n=t(e);return(Array.isArray(n)?n:[n]).map(String)}async function p(){let e=f();if(!e.length)return u??(l?Promise.resolve(l):Promise.reject(Error(`No collections to search`)));let t=d.some(t=>!e.includes(t)),n=e.filter(e=>!d.includes(e));return!n.length&&!t&&u?u:(c.value=`loading`,u=a(()=>import(`./V-Q23a7M2.js`).then(t=>t.loadDatabaseAdapter(e[0])),__vite__mapDeps([0,1,2,3,4]),import.meta.url).then(async r=>{l=r,t&&await A(r);let i=t?e:n;return await Promise.all(i.map(e=>j(r,e,N(e),s))),d=[...e],c.value=`ready`,r}).catch(e=>{throw c.value=`error`,e}),u)}n(()=>t(e),()=>p(),{immediate:o});async function m(e,t){return l||await p(),M(l,d,e,t)}return{status:c,search:m,init:p}}async function R(e,t,n){return window.WebAssembly?z(t,n):s(e,String(t),n)}async function z(e,t){return await a(()=>import(`./V-Q23a7M2.js`).then(t=>t.loadDatabaseAdapter(e)),__vite__mapDeps([0,1,2,3,4]),import.meta.url).then(e=>e.all(t))}function B(e,t){let n=N(e),r={where(e,t,i){return n.where(String(e),t,i),r},andWhere(e){return n.andWhere(e),r},orWhere(e){return n.orWhere(e),r},order(e,t){return n.order(String(e),t),r},then(e,r){return t(n).then(e,r)},catch(e){return this.then(void 0,e)},finally(e){return this.then(void 0,void 0).finally(e)},get[Symbol.toStringTag](){return`Promise`}};return r}export{L as a,I as i,F as n,b as o,P as r,N 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.