1import{ue,a,r,s,i,o,e,t,V,l,n,oe,D,W,ft,A,ht}from"./chunk-e7xk0yn7.js";i();var se="WebAssembly unavailable";function ge(){try{if(typeof WebAssembly!=="object"||typeof WebAssembly.Module!=="function")return!1;return new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0))instanceof WebAssembly.Module}catch{return!1}}var z=null;function re(){if(!z)z=fetch("/_search/pages.json").then((c)=>c.ok?c.json():Promise.reject(Error(String(c.status)))).then((c)=>({rows:c.rows,title:c.rows.map((m)=>m[1].toLowerCase()),heads:c.rows.map((m)=>m[4].map((h)=>h[1].toLowerCase())),desc:c.rows.map((m)=>m[3].toLowerCase())})),z.catch(()=>z=null);return z}function ne(c,m){for(let h=c.indexOf(m);h>=0;h=c.indexOf(m,h+1))if(h===0||!/[a-z0-9]/.test(c[h-1]))return!0;return!1}var ye=(c)=>c.replace(/[&<>"]/g,(m)=>m==="&"?"&":m==="<"?"<":m===">"?">":""");function Ee(c,m){let h=m.filter((y)=>y.length>1).map((y)=>y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"));if(!h.length)return ye(c);return ye(c).replace(new RegExp(`(&[a-z#0-9]+;)|(${h.join("|")})`,"gi"),(y,b)=>b?y:`<mark>${y}</mark>`)}function de(c,m,h,y,b=10){let C=m.toLowerCase().split(/[^a-z0-9.$:_-]+/).filter((f)=>f.length>0);if(!C.length)return[];let N=C.map((f)=>f.length>3?f.replace(/s$/,""):f),T=[];for(let f=0;f<c.rows.length;f++){let p=c.rows[f];if(h!=="All"&&p[2]!==h)continue;let g=c.title[f],x=p[0].toLowerCase(),w=0;for(let v of N){let E=g===v?14:g.startsWith(v)?9:ne(g,v)?5:0,_=ne(x,v)?3:0,j=c.heads[f].some((J)=>ne(J,v))?3:0,O=ne(c.desc[f],v)?1:0,Q=E+_+j+O;if(!Q){w=0;break}w+=Q}if(w)T.push({i:f,s:w*y(p)})}T.sort((f,p)=>p.s-f.s||c.rows[f.i][0].length-c.rows[p.i][0].length);let L=new Set;return T.filter(({i:f})=>{let p=`${c.rows[f][2]}:${c.title[f]}`;return L.has(p)?!1:(L.add(p),!0)}).slice(0,b).map(({i:f})=>{let[p,g,x,w,v]=c.rows[f];return{id:`page:${p}`,url:p,title:g,excerpt:Ee(w,N),section:x,subs:v.filter(([,E])=>N.some((_)=>E.toLowerCase().includes(_))).slice(0,3).map(([E,_])=>({title:_,url:`${p}#${E}`,excerpt:""}))}})}var U=["All","Docs","Guides","Reference","Blog"],Z=null;function he(){if(!Z){if(!ge())return Promise.reject(Error(se));let c=["","_pagefind","pagefind.js"].join("/");Z=Function("u","return import(u)")(c).then(async(m)=>(await m.options({excerptLength:18,baseUrl:"/",ranking:{pageLength:0.3,termSaturation:1.6,termFrequency:0.9,termSimilarity:1.2}}),await m.init(),m)),Z.catch(()=>Z=null)}return Z}var xe=(c)=>c,Le={M:"module",N:"namespace",F:"function",C:"class",I:"interface",T:"type",V:"const",E:"enum",m:"method",p:"property",c:"constructor",a:"accessor",e:"member"},G=null;function ae(){if(!G)G=fetch("/_search/symbols.json").then((c)=>c.ok?c.json():Promise.reject(Error(String(c.status)))).then((c)=>({rows:c.rows,lower:c.rows.map((m)=>m[0].toLowerCase()),tail:c.rows.map((m)=>m[0].slice(m[0].lastIndexOf(".")+1).toLowerCase())})),G.catch(()=>G=null);return G}var Re=(c)=>/^[\w$.:]+\(?\)?$/.test(c)&&(/[.:]|\(\)?$/.test(c)||/[a-z][A-Z]|^[A-Z][a-z]+[A-Z]|^[A-Z]{2,}/.test(c));function ke(c,m,h){let y=m.replace(/\(\)?$/,"").toLowerCase().trim();if(y.length<2)return[];let b=y.split(/[\s/#]+/).filter(Boolean),C=[[],[],[],[],[]];if(b.length>1){let p=b[b.length-1];for(let g=0;g<c.rows.length;g++){let x=c.lower[g],w=!0;for(let E of b)if(!x.includes(E)){w=!1;break}if(!w)continue;let v=c.tail[g];C[v===p?0:v.startsWith(p)?1:x.endsWith(p)?2:3].push(g)}}else for(let p=0;p<c.rows.length;p++){let g=c.lower[p],x=c.tail[p],w=g===y||g===`bun.${y}`?0:g.startsWith(y)||g.startsWith(`bun.${y}`)?1:x===y?2:x.startsWith(y)?3:y.length>=4&&g.includes(y)?4:-1;if(w>=0)C[w].push(p)}let N=[],T=m.replace(/\(\)?$/,"").replace(/^Bun\./,"bun."),L=(p)=>c.rows[p][0]===T||c.rows[p][0]===`bun.${T}`?0:1,H=(p)=>"FCMITVNEmpcae".indexOf(c.rows[p][1]),f=(p)=>c.rows[p][0].startsWith("bun")?0:1;for(let p of C){p.sort((g,x)=>L(g)-L(x)||f(g)-f(x)||c.rows[g][0].length-c.rows[x][0].length||H(g)-H(x));for(let g of p){if(N.length>=h)break;N.push(g)}if(N.length>=h)break}return N.map((p)=>{let[g,x,w]=c.rows[p];return{id:`sym:${g}`,url:`/reference/${g.replace(":","/").replaceAll(".","/")}`,title:g,excerpt:w,section:"Reference",kind:Le[x]??x,subs:[]}})}var Se={Docs:1,Guides:0.85,Blog:0.55,Reference:0.5,Site:0.3},ve=(c)=>(Se[c[2]]??0.5)*(/^Bun v?\d/.test(c[1])?0.6:1)*(/\/docs\/project\//.test(c[0])?0.55:1),Ie=new Set("a an and are as at be but by can could do does did for from get got has have how i if in into is it its just like me my no not of on or our should so than that the their them then there these they this to too us use using via was we were what when where which who why will with would you your bun buns bun's".split(" "));function le(c){let m=c.toLowerCase().replace(/[?!.,;
1:]+/g," ").split(/\s+/).filter(Boolean);if(m.length<3)return c;let h=m.filter((y)=>!Ie.has(y));return h.length?h.join(" "):c}function ze(){he().catch(()=>{if(!ge())re().catch(()=>{})}),ae().catch(()=>{})}function Me({onClose:c,initialScope:m}){let[h,y]=s(""),[b,C]=s(m),[N,T]=s([]),[L,H]=s("idle"),[f,p]=s(null),[g,x]=s(null),[w,v]=s(0),E=r(null),_=r(null),j=r(0);a(()=>(E.current?.focus(),document.documentElement.classList.add("overflow-hidden"),he().catch((u)=>{x(u instanceof Error&&u.message===se?"wasm":"load"),re().catch(()=>H("error"))}),ae().catch(()=>{}),()=>document.documentElement.classList.remove("overflow-hidden")),[]),a(()=>{let u=h.trim();if(!u){T([]),H("idle");return}let k=++j.current;H((S)=>S==="ready"||S==="empty"?S:"loading"),(async()=>{try{let S=await he().catch((P)=>(x(P instanceof Error&&P.message===se?"wasm":"load"),null));S?.preload(u);let R=S?null:await re(),F=b==="Reference"?null:b,[be,ie]=await Promise.all([F===null||!S?Promise.resolve(null):S.debouncedSearch(le(u),F==="All"?{}:{filters:{section:F}},60),b==="All"||b==="Reference"?ae().catch(()=>null):Promise.resolve(null)]);if(k!==j.current)return;let ce=Re(u),Y=ie?ke(ie,u,b==="Reference"?30:ce?5:3):[],ee=[];if(be){let P=be.results.map((d)=>({r:d,s:d.score??1})).slice(0,40),te=await Promise.all(P.slice(0,16).map((d)=>d.r.data()));if(k!==j.current)return;let B=le(u).toLowerCase().split(/\s+/).filter((d)=>d.length>1),$e=(d)=>{let I=[d.meta?.title,...(d.sub_results||[]).map((K)=>K.title)].join(" ").toLowerCase(),M=B.filter((K)=>I.includes(K.replace(/s$/,""))).length,q=String(d.meta?.title||"").toLowerCase().split(/[^a-z0-9.]+/).filter((K)=>K.length>2),Ce=B.filter((K)=>q.some((fe)=>fe.startsWith(K)||fe.length>3&&K.startsWith(fe))).length;return(1+0.6*(M/Math.max(1,B.length)))*(1+0.9*(Ce/Math.max(1,B.length)))};ee=te.map((d,I)=>({d,w:P[I].s*(Se[d.filters?.section?.[0]||"Site"]??0.5)*$e(d)*(/^Bun v?\d/.test(d.meta?.title||"")?0.6:1)*(/\/docs\/project\//.test(d.url)?0.55:1),id:P[I].r.id})).sort((d,I)=>I.w-d.w).filter((d,I,M)=>M.findIndex((q)=>q.d.url===d.d.url||q.d.meta?.title===d.d.meta?.title&&q.d.filters?.section?.[0]===d.d.filters?.section?.[0])===I).slice(0,10).map(({d,id:I})=>({id:I,url:d.url.replace(/\.html$/,""),title:d.meta?.title||d.url,excerpt:d.excerpt||"",section:d.filters?.section?.[0]||"Site",subs:(d.sub_results||[]).filter((M)=>M.url!==d.url&&M.title!==d.meta?.title).slice(0,3).map((M)=>({title:String(M.title).replace(/#$/,""),url:M.url.replace(/\.html(?=#|$)/,""),excerpt:M.excerpt}))}))}else if(R&&F!==null)ee=de(R,le(u),F,ve);let pe=u.trim().split(/\s+/),Pe=pe[pe.length-1]?.toLowerCase()??"",we=!ce&&pe.length>1?Y.filter((P)=>P.title.toLowerCase().split(".").pop()===Pe).slice(0,2):[],Ae=Y.filter((P)=>!we.includes(P)),me=b==="Reference"?Y:ce?[...Y,...ee]:[...we,...ee,...Ae];if(T(me),v(0),H(me.length?"ready":"empty"),!me.length&&b!=="All"){let P=S?(await S.debouncedSearch(u,{},0))?.results.length??0:R?de(R,le(u),"All",ve,50).length:0,te=ie??await ae().catch(()=>null);if(k!==j.current)return;let B=P+(te?ke(te,u,5).length:0);p(B?{section:"All",count:B}:null)}else p(null)}catch{if(k===j.current)H("error")}})()},[h,b]);let O=N.flatMap((u)=>[{url:u.url,key:u.id},...u.subs.map((k,S)=>({url:k.url,key:`${u.id}:${S}`}))]),Q=(u)=>{c(),V(u)},J=()=>{let u=h.trim();c(),ht(u)},Ne=(u)=>{if(u.key==="Escape")c();else if(u.key==="ArrowDown")u.preventDefault(),v((k)=>Math.min(O.length-1,k+1));else if(u.key==="ArrowUp")u.preventDefault(),v((k)=>Math.max(0,k-1));else if(u.key==="Enter"&&(u.metaKey||u.ctrlKey)&&h.trim())u.preventDefault(),J();else if(u.key==="Enter"&&O[w])u.preventDefault(),Q(O[w].url);else if(u.key==="Enter"&&f)u.preventDefault(),C(f.section);else if(u.key==="Tab"){u.preventDefault();let k=U.indexOf(b);C(U[(k+(u.shiftKey?U.length-1:1))%U.length])}};a(()=>{_.current?.querySelector(`[data-row="${w}"]`)?.scrollIntoView({block:"nearest"})},[w]);let X=-1;return e("div",{className:"fixed inset-0 z-[120] flex items-start justify-center bg-black/40 px-3 pt-[9vh] md:pt-[12vh] dark:bg-black/65",role:"dialog","aria-modal":"true","aria-label":"Search",onMouseDown:(u)=>u.target===u.currentTarget&&c(),children:t("div",{className:"flex max-h-[76vh] w-full max-w-[44rem] flex-col border border-line bg-canvas text-fg outline outline-1 outline-fg/5",onKeyDown:Ne,children:[t("div",{className:"flex items-center gap-3 border-b border-line px-4",children:[e(
1oe,{className:"h-[18px] w-[18px] shrink-0 text-fg-faint"}),e("input",{ref:E,value:h,onChange:(u)=>y(u.target.value),placeholder:"Search docs, guides, APIs and the blog",spellCheck:!1,autoComplete:"off",className:"h-14 min-w-0 flex-1 bg-transparent text-[16px] text-fg placeholder:text-fg-faint focus:outline-none","aria-label":"Search query","aria-controls":"search-results","aria-activedescendant":O[w]?`sr-${w}`:void 0}),e(W,{label:"Escape",className:"hidden sm:inline-flex",children:e(D,{k:"esc"})})]}),t("div",{className:"flex items-center gap-1 border-b border-line px-3 py-2",role:"tablist","aria-label":"Section",children:[U.map((u)=>e("button",{role:"tab",type:"button","aria-selected":u===b,onClick:()=>{C(u),E.current?.focus()},className:n("label px-2 py-1 text-[10.5px]",u===b?"bg-slab !text-slab-fg":"hover:text-fg"),children:u},u)),t("span",{className:"ml-auto hidden text-[11.5px] text-fg-faint sm:inline",children:[e(W,{label:"Tab",children:e(D,{k:"tab"})})," ","section ·"," ",t(W,{label:"Up or down arrow",children:[e(D,{k:"up"}),e(D,{k:"down"})]})," ","move ·"," ",e(W,{label:"Enter",children:e(D,{k:"enter"})})," ","open"]})]}),g?t("p",{className:"border-b border-line px-4 py-2 text-[12px] text-fg-faint",children:[g==="wasm"?"WebAssembly is off":"Full-text search didn't load",", so search only matches titles and headings."]}):null,t("div",{ref:_,id:"search-results",role:"listbox",className:"min-h-0 flex-1 overflow-y-auto scroll-thin",children:[h.trim()?t("button",{type:"button",onClick:J,className:"flex w-full items-center gap-3 border-b border-line px-4 py-2.5 text-left hover:bg-subtle",children:[e("span",{className:"inline-flex h-7 w-7 shrink-0 items-center justify-center border border-line",children:e(A,{name:"sparkles",className:"h-4 w-4"})}),t("span",{className:"min-w-0 flex-1",children:[t("span",{className:"block truncate text-[14px] font-medium text-fg",children:["Ask AI: ",t("span",{className:"text-fg-muted",children:["â",h.trim(),"â"]})]}),e("span",{className:"block text-[12px] text-fg-faint",children:"Answer from the docs, with sources"})]}),e(ft,{className:"hidden shrink-0 sm:inline-flex"})]}):null,L==="idle"?t("p",{className:"px-4 py-6 text-[13.5px] text-fg-faint",children:["Type to search ",b==="All"?"everything":b.toLowerCase()," â try"," ",(b==="Reference"?["Bun.serve","S3Client","readFile"]:b==="Blog"?["bun install","windows","streams"]:["websocket","workspaces","Bun.serve"]).map((u,k)=>t(ue,{children:[k?", ":"",e("button",{type:"button",className:"underline underline-offset-4 hover:text-fg",onClick:()=>y(u),children:u})]},u)),"."]}):L==="error"?t("p",{className:"px-4 py-6 text-[13.5px] text-danger",children:["Search index unavailable",typeof location<"u"&&location.hostname==="localhost"?" â run `bun run build` once to generate /_pagefind for dev":"","."]}):L==="empty"?t("p",{className:"px-4 py-6 text-[13.5px] text-fg-faint",children:["Nothing for â",h,"â",b!=="All"?` in ${b}`:"",".",f?t(o,{children:[" ",t("button",{type:"button",className:"text-fg underline underline-offset-4",onClick:()=>C(f.section),children:[f.count,"+ result",f.count===1?"":"s"," elsewhere"]})," ","â press"," ",e(W,{label:"Enter",children:e(D,{k:"enter"})})]}):null]}):null,N.map((u)=>{X++;let k=X;return t("div",{className:"border-b border-line last:border-b-0",children:[t(l,{id:`sr-${k}`,"data-row":k,role:"option","aria-selected":w===k,href:u.url,onClick:c,onMouseMove:()=>v(k),className:n("block px-4 py-2.5 no-underline",w===k?"bg-subtle":""),children:[t("div",{className:"flex items-baseline gap-2",children:[e("span",{className:n("text-[14.5px] font-semibold text-fg",u.section==="Reference"&&"readout text-[13.5px]"),children:u.title}),t("span",{className:"label ml-auto shrink-0 text-[9.5px]",children:[u.kind?`${u.kind} · `:"",u.section]})]}),u.excerpt?e("p",{className:"search-excerpt mt-0.5 line-clamp-2 text-[13px] leading-snug text-fg-muted",dangerouslySetInnerHTML:{__html:xe(u.excerpt)}}):null]}),u.subs.map((S)=>{X++;let R=X;return t(l,{id:`sr-${R}`,"data-row":R,role:"option","aria-selected":w===R,href:S.url,onClick:c,onMouseMove:()=>v(R),className:n("flex gap-3 py-1.5 pl-8 pr-4 no-underline",w===R?"bg-subtle":""),children:[e("span",{className:"mt-[7px] h-1.5 w-1.5 shrink-0 bg-fg-faint","aria-hidden":!0}),t("span",{className:"min-w-0",children:[e("span",{className:"block truncate text-[13px] font-medium text-fg",children:S.title}),e("span",{className:"search-excerpt block truncate text-[12.5px] text-fg-muted",dangerouslySetInnerHTML:{__html:xe(S.excerpt)}})]})]},S.url)})]},u.id)}),L==="loading"&&!N.length?e("p",{className:"px-4 py-6 text-[13.5px] text-fg-faint",children:"Searchingâ¦"}):null]})]})})}export{U as SECTIONS,Me as default,ze as warm};
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.