@stacksjs/bunpress 0.2.21 → 0.2.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.d.ts +2 -4
- package/dist/bin/cli.js +1 -1
- package/dist/{chunk-9ytw3mfw.js → chunk-3z2k0ntf.js} +1 -1
- package/dist/{chunk-3ymfys00.js → chunk-8rsrw3sw.js} +26 -26
- package/dist/{chunk-hz4fjaxv.js → chunk-a68w1rpw.js} +1 -1
- package/dist/chunk-amkb7f82.js +2 -0
- package/dist/{chunk-7jcye3th.js → chunk-m7y4g28p.js} +151 -143
- package/dist/{chunk-rcr6k1et.js → chunk-xjz041s0.js} +2 -2
- package/dist/{chunk-rnzqf7rp.js → chunk-ynp2pgxy.js} +1 -1
- package/dist/chunk-zpf2c5ag.js +393 -0
- package/dist/src/build-output.d.ts +2 -0
- package/dist/src/html-entities.d.ts +7 -0
- package/dist/src/index.js +1 -1
- package/dist/src/markdown-pages.d.ts +22 -0
- package/dist/src/serve.d.ts +4 -7
- package/package.json +1 -1
- package/dist/chunk-yave4hym.js +0 -393
- package/dist/chunk-ynq8k1af.js +0 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
`).map((X)=>`<span class="line">${
|
|
4
|
-
`);try{let
|
|
5
|
-
`);return(await Promise.all(
|
|
6
|
-
`)}catch(
|
|
7
|
-
`).map((q)=>`<span class="line">${
|
|
8
|
-
`)}}function
|
|
2
|
+
import{$ as gQ,A as HQ,C as P,F as n,G as xQ,H as GJ,I as CQ,J as bQ,K as CJ,L as bJ,N as fQ,O as pQ,P as uQ,R as hQ,_ as jJ,aa as dQ,ba as fJ,ca as E,da as mQ,ea as cQ,fa as lQ}from"./chunk-8rsrw3sw.js";import{ga as o,ha as e,ia as vJ,ja as xJ,ka as yQ,la as PQ,na as SQ,oa as kJ,pa as kQ,qa as vQ}from"./chunk-ynp2pgxy.js";var{Glob:IQ,YAML:TQ}=globalThis.Bun;import{randomUUID as sQ}from"crypto";import{stat as DQ}from"fs/promises";import{join as UJ,resolve as pZ}from"path";import a from"process";var{Glob:KZ}=globalThis.Bun;import{join as lJ,resolve as VZ}from"path";import _Z from"process";var YJ=new Map;function GZ(J,Z,Q){let $=Z.split("."),Y=J;for(let X=0;X<$.length-1;X++){let q=$[X];if(typeof Y[q]!=="object"||Y[q]===null)Y[q]={};Y=Y[q]}Y[$[$.length-1]]=Q}async function sJ(J,Z){let Q=Z?VZ(_Z.cwd(),Z):lJ(J,".data");if(YJ.has(Q))return YJ.get(Q);let $={};try{let Y=new KZ("**/*.json");for await(let X of Y.scan({cwd:Q,absolute:!1}))try{let q=await Bun.file(lJ(Q,X)).text(),W=X.replace(/\.json$/,"").replace(/[/\\]/g,".");GZ($,W,JSON.parse(q))}catch{}}catch{}return YJ.set(Q,$),$}function rJ(){YJ.clear()}import{createHighlighter as jZ,highlight as UZ,listLanguages as OZ}from"ts-syntax-highlighter";var s=null;function g0(){s=null}async function iJ(){if(s)return s;return s=await jZ({theme:"github-light",cache:!0}),s}var DJ=null;function oJ(){if(DJ)return DJ;let J=new Map;try{for(let Z of OZ()){J.set(Z.id.toLowerCase(),Z.id);for(let Q of Z.aliases??[])J.set(Q.toLowerCase(),Z.id)}}catch{}return DJ=J,J}var XJ={};function aJ(J){XJ={};for(let[Z,Q]of Object.entries(J??{}))XJ[Z.toLowerCase().trim()]=Q.toLowerCase().trim()}function nJ(J){let Z=J.toLowerCase().trim(),Q=XJ[Z]??Z;return oJ().get(Q)??Q}function tJ(J){let Z=J.toLowerCase().trim();return oJ().has(XJ[Z]??Z)}function qJ(J){return J.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function NZ(J,Z){let Q=/<span[^>]*class="token[^"]*"[^>]*>([^<]*)<\/span>/g,$=[],Y;while((Y=Q.exec(Z))!==null){let W=Y[1].replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�*39;/g,"'");if(W)$.push({text:W,span:Y[0]})}if($.length===0)return Z;let X="",q=0;for(let W=0;W<$.length;W++){let{text:z,span:_}=$[W],K=J.indexOf(z,q);if(K===-1){X+=_;continue}if(K>q){let G=J.substring(q,K);if(/^\s+$/.test(G))X+=G}X+=_,q=K+z.length}return X}async function WJ(J,Z,Q="github-light"){let $=nJ(Z);if(!tJ($))return J.split(`
|
|
3
|
+
`).map((X)=>`<span class="line">${qJ(X)}</span>`).join(`
|
|
4
|
+
`);try{let Y=J.split(`
|
|
5
|
+
`);return(await Promise.all(Y.map(async(q)=>{if(!q.trim())return`<span class="line">${q}</span>`;let z=(await UZ(q,$,{theme:Q})).html;if(z=z.replace(/<div[^>]*class="syntax-wrapper"[^>]*>/g,""),z=z.replace(/<\/div>\s*$/g,""),z=z.replace(/<pre[^>]*>/g,""),z=z.replace(/<\/pre>/g,""),z=z.replace(/<code[^>]*>/g,""),z=z.replace(/<\/code>/g,""),z=NZ(q,z.trim()),!z.startsWith('<span class="line">'))z=`<span class="line">${z}</span>`;return z}))).join(`
|
|
6
|
+
`)}catch(Y){return console.warn(`Failed to highlight code for language "${Z}":`,Y),J.split(`
|
|
7
|
+
`).map((q)=>`<span class="line">${qJ(q)}</span>`).join(`
|
|
8
|
+
`)}}function d0(J,Z){let Q=nJ(Z);if(!tJ(Q))return qJ(J);return qJ(J)}function eJ(){return`
|
|
9
9
|
/* Basic syntax highlighting styles for ts-syntax-highlighter */
|
|
10
10
|
/* The actual theme colors are injected by ts-syntax-highlighter */
|
|
11
11
|
|
|
@@ -196,12 +196,12 @@ html.dark .token[class*='invalid'] {
|
|
|
196
196
|
color: #9ca3af;
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
-
`}async function
|
|
200
|
-
`)){if(!W.trim())continue;if(/^\d{4}-\d{2}-\d{2}T/.test(W)){q=W.trim();continue}if(q&&!X.has(W))X.set(W,q)}return
|
|
199
|
+
`}async function m0(){await iJ()}async function c0(){return iJ()}import{stat as RZ}from"fs/promises";import{relative as JQ,resolve as i}from"path";import BZ from"process";var r=new Map;async function EZ(J){let Z=i(J);if(r.has(Z))return r.get(Z);try{let Q=Bun.spawn(["git","log","--pretty=format:%cI","--name-only","--relative","--no-merges","--","."],{cwd:Z,stdout:"pipe",stderr:"ignore"}),[$,Y]=await Promise.all([Q.exited,new Response(Q.stdout).text()]);if($!==0)return r.set(Z,null),null;let X=new Map,q="";for(let W of Y.split(`
|
|
200
|
+
`)){if(!W.trim())continue;if(/^\d{4}-\d{2}-\d{2}T/.test(W)){q=W.trim();continue}if(q&&!X.has(W))X.set(W,q)}return r.set(Z,X),X}catch{return r.set(Z,null),null}}async function QQ(J,Z){let Q=await EZ(J);if(Q){let $=JQ(i(J),i(Z)).replace(/\\/g,"/"),Y=Q.get($);if(Y)return Y}try{return(await RZ(Z)).mtime.toISOString()}catch{return null}}function ZQ(J,Z,Q){let $=JQ(i(BZ.cwd(),Z),i(Q)).replace(/\\/g,"/");return J.includes(":path")?J.replace(":path",$):`${J.replace(/\/$/,"")}/${$}`}function $Q(J,Z,Q){let $=new Date(J);if(Number.isNaN($.getTime()))return"";try{return new Intl.DateTimeFormat(Z,Q??{dateStyle:"medium"}).format($)}catch{return $.toISOString().slice(0,10)}}import{join as wJ}from"path";var zJ=new Map,YQ="\x00BPCODE",XQ="\x00";async function qQ(J,Z){let Q=wJ(J,Z);if(zJ.has(Q))return zJ.get(Q);let $=[wJ(J,`${Z}.stx`),wJ(J,Z,"index.stx")],Y=null;for(let X of $){let q=Bun.file(X);if(await q.exists()){Y={source:await q.text(),path:X};break}}return zJ.set(Q,Y),Y}function WQ(){zJ.clear()}function FZ(J,Z){try{let Q=Object.keys(Z),$=Q.map((Y)=>Z[Y]);return Function(...Q,`"use strict"; return (${J});`)(...$)}catch{return}}function MZ(J,Z){let Q={};if(!J)return Q;let $=/([:@]?[\w-]+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]*)\}))?/g,Y;while(Y=$.exec(J)){let X=Y[1];if(!X)continue;let q=X.startsWith(":"),W=X.replace(/^[:@]/,""),z=Y[2],_=Y[3],K=Y[4],G=z??_??K;if(G===void 0)Q[W]=!0;else if(q||K!==void 0)Q[W]=FZ(G,Z);else Q[W]=G}return Q}async function LJ(J,Z,Q,$={},Y=0){if(Y>10||!J.includes("<"))return J;let X=[],q=J.replace(/```[\s\S]*?```/g,(V)=>{return X.push(V),`${YQ}${X.length-1}${XQ}`}).replace(/`[^`\n]*`/g,(V)=>{return X.push(V),`${YQ}${X.length-1}${XQ}`}),W=/<([A-Z][A-Za-z0-9]*)((?:\s[^>]*?)?)(\/?)>/g,z="",_=0,K=!1,G;while(G=W.exec(q)){let V=G[0],U=G[1],N=G[2],B=G[3],F=await qQ(Z,U)??($.fallbackComponentsDir?await qQ($.fallbackComponentsDir,U):null);if(F==null)continue;K=!0,z+=q.slice(_,G.index);let M="",A=G.index+V.length;if(!B){let R=new RegExp(`</${U}>`,"g");R.lastIndex=A;let j=R.exec(q);if(j)M=q.slice(A,j.index).trim(),A=j.index+j[0].length}let D=MZ(N.trim(),Q),I;try{let{renderTemplateString:R}=await import("@stacksjs/stx/render"),j=/<script\b[^>]*\bclient\b/.test(F.source);if(I=await R(F.source,F.path,{context:{...Q,...D,slot:M},options:{componentsDir:Z,fallbackComponentsDir:$.fallbackComponentsDir},injectCSS:j,templateOnly:!j}),j&&$.rendered){let O=`BPLIVECOMPONENT${$.rendered.size}END`;$.rendered.set(O,I),I=`
|
|
201
201
|
|
|
202
|
-
${
|
|
202
|
+
${O}
|
|
203
203
|
|
|
204
|
-
`}}catch(
|
|
204
|
+
`}}catch(R){let j=R instanceof Error?R.message:String(R);throw Error(`Failed to render BunPress component ${U}: ${j}`,{cause:R})}z+=I,_=A,W.lastIndex=A}if(z+=q.slice(_),z=z.replace(/\u0000BPCODE(\d+)\u0000/g,(V,U)=>X[Number(U)]??""),K)return LJ(z,Z,Q,$,Y+1);return z}import{join as VQ}from"path";var IZ=VQ(import.meta.dir,"templates"),KJ=new Map;async function TZ(J){if(KJ.has(J))return KJ.get(J);let Z=VQ(IZ,`${J}.stx`),Q=Bun.file(Z);if(!await Q.exists())throw Error(`Template not found: ${J}`);let $=await Q.text();return KJ.set(J,$),$}async function H(J,Z){let Q=await TZ(J);return DZ(Q,Z)}function _Q(){KJ.clear()}function DZ(J,Z){return J.replace(/\{!!\s*([\w.]+)\s*!!\}|\{\{\s*([\w.]+)\s*\}\}/g,(Q,$,Y)=>{if($!==void 0)return KQ(zQ(Z,$));return wZ(KQ(zQ(Z,Y)))})}function zQ(J,Z){return Z.split(".").reduce((Q,$)=>{if(Q==null||typeof Q!=="object")return;return Q[$]},J)}function KQ(J){if(J==null)return"";return String(J)}function wZ(J){return J.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var GQ=`/**
|
|
205
205
|
* VitePress Theme for BunPress - Layout & Chrome
|
|
206
206
|
* -------------------------------------------------------------------------- */
|
|
207
207
|
|
|
@@ -4943,7 +4943,7 @@ ${`/**
|
|
|
4943
4943
|
border-radius: 0;
|
|
4944
4944
|
border: none;
|
|
4945
4945
|
}`}
|
|
4946
|
-
`}function
|
|
4946
|
+
`}function LZ(){return`/**
|
|
4947
4947
|
* VitePress Theme for BunPress
|
|
4948
4948
|
* Colors: Solid
|
|
4949
4949
|
* -------------------------------------------------------------------------- */
|
|
@@ -5512,7 +5512,7 @@ ${`/**
|
|
|
5512
5512
|
|
|
5513
5513
|
.bpi-corner-down-left {
|
|
5514
5514
|
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M20 4v7a4 4 0 0 1-4 4H4'/%3E%3Cpath d='m9 10l-5 5l5 5'/%3E%3C/g%3E%3C/svg%3E");
|
|
5515
|
-
}`}function
|
|
5515
|
+
}`}function AZ(){return`/**
|
|
5516
5516
|
* VitePress Theme for BunPress - Base Styles
|
|
5517
5517
|
* -------------------------------------------------------------------------- */
|
|
5518
5518
|
|
|
@@ -6517,7 +6517,7 @@ mjx-container > svg {
|
|
|
6517
6517
|
.bp-doc .custom-block .bp-code-group .tabs {
|
|
6518
6518
|
margin: 0;
|
|
6519
6519
|
border-radius: 8px 8px 0 0;
|
|
6520
|
-
}`}function
|
|
6520
|
+
}`}function HZ(){return`/**
|
|
6521
6521
|
* VitePress Theme for BunPress - Custom Blocks
|
|
6522
6522
|
* -------------------------------------------------------------------------- */
|
|
6523
6523
|
|
|
@@ -6945,7 +6945,7 @@ mjx-container > svg {
|
|
|
6945
6945
|
|
|
6946
6946
|
.github-alert-caution .github-alert-icon {
|
|
6947
6947
|
fill: var(--bp-c-caution-1);
|
|
6948
|
-
}`}function
|
|
6948
|
+
}`}function yZ(){return`/**
|
|
6949
6949
|
* VitePress Theme for BunPress - Code Groups
|
|
6950
6950
|
* -------------------------------------------------------------------------- */
|
|
6951
6951
|
|
|
@@ -7086,7 +7086,7 @@ mjx-container > svg {
|
|
|
7086
7086
|
margin: 0;
|
|
7087
7087
|
border-radius: 0;
|
|
7088
7088
|
border: none;
|
|
7089
|
-
}`}var
|
|
7089
|
+
}`}var PZ={name:"vitepress",getCSS:AJ,getVars:LZ,getBase:AZ,getCustomBlocks:HZ,getCodeGroups:yZ},jQ=PZ;var UQ=`/**
|
|
7090
7090
|
* Bun Theme for BunPress
|
|
7091
7091
|
* Colors extracted from bun.sh
|
|
7092
7092
|
* -------------------------------------------------------------------------- */
|
|
@@ -8439,7 +8439,7 @@ p {
|
|
|
8439
8439
|
.bp-doc .custom-block .bp-code-group .tabs {
|
|
8440
8440
|
margin: 0;
|
|
8441
8441
|
border-radius: 5px 5px 0 0;
|
|
8442
|
-
}`,
|
|
8442
|
+
}`,NQ=`/**
|
|
8443
8443
|
* Bun Theme for BunPress - Custom Blocks
|
|
8444
8444
|
* -------------------------------------------------------------------------- */
|
|
8445
8445
|
|
|
@@ -8803,7 +8803,7 @@ p {
|
|
|
8803
8803
|
|
|
8804
8804
|
.github-alert-caution .github-alert-icon {
|
|
8805
8805
|
fill: var(--bp-c-caution-1);
|
|
8806
|
-
}`,
|
|
8806
|
+
}`,RQ=`/**
|
|
8807
8807
|
* Bun Theme for BunPress - Code Groups
|
|
8808
8808
|
* -------------------------------------------------------------------------- */
|
|
8809
8809
|
|
|
@@ -8933,7 +8933,7 @@ p {
|
|
|
8933
8933
|
margin: 0;
|
|
8934
8934
|
border-radius: 0;
|
|
8935
8935
|
border: none;
|
|
8936
|
-
}`,
|
|
8936
|
+
}`,BQ=`/**
|
|
8937
8937
|
* Bun Theme for BunPress - Extra Bun-specific styles
|
|
8938
8938
|
* -------------------------------------------------------------------------- */
|
|
8939
8939
|
|
|
@@ -9087,35 +9087,35 @@ p {
|
|
|
9087
9087
|
|
|
9088
9088
|
.interactive-hover:hover {
|
|
9089
9089
|
transform: scale(1.06);
|
|
9090
|
-
}`;function
|
|
9090
|
+
}`;function EQ(){return`
|
|
9091
9091
|
/* Bun Theme for BunPress */
|
|
9092
9092
|
/* Colors extracted from bun.sh */
|
|
9093
|
-
${jQ}
|
|
9094
|
-
${OQ}
|
|
9095
|
-
${_Q}
|
|
9096
9093
|
${UQ}
|
|
9094
|
+
${OQ}
|
|
9095
|
+
${GQ}
|
|
9097
9096
|
${NQ}
|
|
9098
9097
|
${RQ}
|
|
9099
|
-
|
|
9098
|
+
${BQ}
|
|
9099
|
+
`}function SZ(){return UQ}function kZ(){return OQ}function vZ(){return NQ}function xZ(){return RQ}function CZ(){return BQ}var bZ={name:"bun",getCSS:EQ,getVars:SZ,getBase:kZ,getCustomBlocks:vZ,getCodeGroups:xZ,getExtras:CZ},FQ=bZ;var fZ={vitepress:jQ,bun:FQ};function MQ(J="vitepress"){let Z=fZ[J];if(!Z)return console.warn(`[BunPress] Unknown theme: ${J}, falling back to vitepress`),AJ();return Z.getCSS()}async function uZ(J,Z){let Q=J.themeConfig?.sidebar||J.sidebar||J.markdown?.sidebar;if(!Q)return"";let $=[];if(Array.isArray(Q))$=Q;else if(typeof Q==="object"){let q=Object.keys(Q).sort((W,z)=>z.length-W.length).find((W)=>Z.startsWith(W))||"/";$=Q[q]||[]}let Y=await Promise.all($.map(async(X)=>{let{html:q,active:W}=X.items?rQ(J,X.items,Z,0):{html:"",active:!1};return await H("sidebar-section",{title:X.text,items:q,collapsedClass:X.collapsed&&!W?" collapsed":""})}));return await H("sidebar",{sections:Y.join("")})}function rQ(J,Z,Q,$){let Y=!1;return{html:Z.map((q)=>{let W=!!q.link&&q.link===Q;if(q.items?.length){let K=rQ(J,q.items,Q,$+1),G=W||K.active;Y||=G;let V=q.collapsed&&!G,U=q.link?`<a class="BPSidebarGroup-link${W?" is-active":""}" href="${g(J,q.link)}">${q.text}</a>`:`<span class="BPSidebarGroup-text">${q.text}</span>`;return`<li class="BPSidebarGroup${V?" collapsed":""}${G?" has-active":""}" style="--bp-sidebar-depth:${$}"><div class="BPSidebarGroup-head">${U}<button class="BPSidebarGroup-toggle" type="button" aria-expanded="${V?"false":"true"}" aria-label="Toggle ${q.text.replace(/"/g,""")}" onclick="toggleSidebarGroup(this)"><svg class="chevron" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg></button></div><div class="BPSidebarGroup-items"><ul class="sidebar-items">${K.html}</ul></div></li>`}Y||=W;let z=g(J,q.link||"/");return`<li style="--bp-sidebar-depth:${$}"><a class="${W?"BPSidebarItem-link is-active":"BPSidebarItem-link"}" href="${z}">${q.text}</a></li>`}).join(""),active:Y}}aJ(P.markdown?.languageAliases);var hZ=`<button class="BPNavBarHamburger" type="button" aria-label="Toggle navigation" onclick="toggleSidebar()">
|
|
9100
9100
|
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
|
|
9101
9101
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
|
|
9102
9102
|
</svg>
|
|
9103
|
-
</button>`,
|
|
9103
|
+
</button>`,gZ=`<button class="BPNavToggle" type="button" aria-label="Menu" aria-expanded="false" aria-controls="bp-nav-screen" onclick="toggleNavScreen()">
|
|
9104
9104
|
<svg class="BPNavToggle-open" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
|
|
9105
9105
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 7h16M4 12h16M4 17h16"></path>
|
|
9106
9106
|
</svg>
|
|
9107
9107
|
<svg class="BPNavToggle-close" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
|
|
9108
9108
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 6l12 12M18 6L6 18"></path>
|
|
9109
9109
|
</svg>
|
|
9110
|
-
</button>`;function
|
|
9110
|
+
</button>`;function dZ(J){if(!J.keyboard||!J.keys.length)return{hint:"",aria:""};let Z=(Q,$)=>{let Y=[];if(Q.ctrl)Y.push($?"Ctrl":"Control");if(Q.meta)Y.push($?"\u2318":"Meta");if(Q.alt)Y.push($?"\u2325":"Alt");if(Q.shift)Y.push("Shift");return Y.push(Q.key.length===1?Q.key.toUpperCase():Q.key),$?Y.join(""):Y.join("+")};return{hint:Z(J.keys[0],!0),aria:J.keys.map((Q)=>Z(Q,!1)).join(" ")}}function mZ(J,Z){let{hint:Q,aria:$}=dZ(Z),Y=E(J);return`<button class="BPNavBarSearch" type="button" aria-label="${Y}"${$?` aria-keyshortcuts="${E($)}"`:""}>
|
|
9111
9111
|
<svg class="BPNavBarSearch-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
|
|
9112
9112
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
|
|
9113
9113
|
</svg>
|
|
9114
|
-
<span class="BPNavBarSearch-label">${
|
|
9114
|
+
<span class="BPNavBarSearch-label">${Y}</span>
|
|
9115
9115
|
${Q?`<kbd class="BPNavBarSearch-kbd">${E(Q)}</kbd>`:""}
|
|
9116
|
-
</button>`}var
|
|
9117
|
-
`)}
|
|
9118
|
-
`);return{aside:await
|
|
9116
|
+
</button>`}var cZ={github:'<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/>',twitter:'<path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/>',discord:'<path d="M20.317 4.37a19.79 19.79 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.6 12.6 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.74 19.74 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.1 13.1 0 0 1-1.872-.892.077.077 0 0 1-.008-.128c.126-.094.252-.192.372-.291a.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.009c.12.099.246.198.373.292a.077.077 0 0 1-.006.127 12.3 12.3 0 0 1-1.873.891.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.84 19.84 0 0 0 6.002-3.03.077.077 0 0 0 .032-.056c.5-5.177-.838-9.674-3.549-13.66a.06.06 0 0 0-.031-.028M8.02 15.331c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418m7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418"/>',x:'<path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/>'};function lZ(J){return(J.themeConfig?.socialLinks??[]).map(({icon:Q,link:$})=>{let Y=cZ[Q?.toLowerCase()],X=Q?Q.charAt(0).toUpperCase()+Q.slice(1):"Link",q=Y?`<svg fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">${Y}</svg>`:`<span class="BPSocialLinks-text">${E(X)}</span>`;return`<a href="${E($)}" target="_blank" rel="noopener external" aria-label="${E(X)}">${q}</a>`}).join(`
|
|
9117
|
+
`)}async function sZ(J,Z="On this page"){let Q=J.replace(/<nav class="table-of-contents[\s\S]*?<\/nav>/g,""),$=/<h([2-6])([^>]*)>(.*?)<\/h\1>/g,Y=[],X;while((X=$.exec(Q))!==null){let W=Number.parseInt(X[1]),z=X[2],_=X[3];_=_.replace(/<[^>]*>/g,"");let K=z.match(/id="([^"]*)"/),G=K?K[1]:_.toLowerCase().replace(/\s+/g,"-").replace(/[^\w-]/g,"");Y.push({level:W,text:_,id:G})}if(Y.length===0)return{aside:"",inline:""};let q=Y.map((W)=>{let z=W.level>2?`level-${W.level}`:"";return`<a href="#${W.id}" class="${z}">${W.text}</a>`}).join(`
|
|
9118
|
+
`);return{aside:await H("page-toc",{items:q,title:Z}),inline:await H("page-outline",{items:q,count:String(Y.length),title:Z})}}function rZ(J){let Z=new Set;return J.replace(/<h([1-6])([^>]*)>(.*?)<\/h\1>/g,(Q,$,Y,X)=>{if(Y.includes("id=")){let _=Y.match(/\bid=["']([^"']+)["']/)?.[1];if(_)Z.add(_);return Q}let q=X.match(/\s*\{#([\w-]+)\}\s*$/),W,z=X;if(q)W=q[1],z=X.replace(/\s*\{#[\w-]+\}\s*$/,"");else{let _=X.replace(/<[^>]*>/g,"");W=CJ(_)}return W=bJ(W,Z),`<h${$}${Y} id="${W}">${z}</h${$}>`})}function iZ(J,Z,Q=""){if(!Z&&!Q)return J;let $=!1,Y=J.replace(/<h1(?:\s[^>]*)?>[\s\S]*?<\/h1>/,(X)=>{return $=!0,`<div class="bp-page-header">${X}${Z}</div>${Q}`});return $?Y:`${Q}${J}`}function HJ(J,Z=""){let Q=oZ(Z),$=J.lastIndexOf("</body>");if($===-1)return J+Q;return J.slice(0,$)+Q+J.slice($)}function yJ(J,Z){if(!Z)return J;let Q=J.lastIndexOf("</body>");if(Q===-1)return J+Z;return J.slice(0,Q)+Z+J.slice(Q)}function oZ(J=""){return`<script data-bp-router="1">
|
|
9119
9119
|
(function(){
|
|
9120
9120
|
// The site's mount point ('/docs'). Links are written with it; the page can
|
|
9121
9121
|
// be reached without it (the dev server answers both), so paths are compared
|
|
@@ -9431,54 +9431,54 @@ ${RQ}
|
|
|
9431
9431
|
|
|
9432
9432
|
updateActiveLinks();
|
|
9433
9433
|
})();
|
|
9434
|
-
<`+"/script>"}var
|
|
9434
|
+
<`+"/script>"}var iQ=`<svg class="chevron" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
|
|
9435
9435
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
|
|
9436
|
-
</svg>`;function
|
|
9437
|
-
${
|
|
9436
|
+
</svg>`;function oQ(J){return J.themeConfig?.nav||J.markdown?.nav||J.nav||[]}function aQ(J){if(typeof J.mega==="boolean")return J.mega;return(J.items??[]).some((Z)=>!!Z.description||(Z.items?.length??0)>0)}function nQ(J){let Z=J.items??[],Q=Z.filter((X)=>(X.items?.length??0)>0);if(Q.length===0)return[{items:Z}];let $=Z.filter((X)=>(X.items?.length??0)===0),Y=Q.map((X)=>({text:X.text,items:X.items??[]}));return $.length>0?[{items:$},...Y]:Y}function aZ(J,Z=""){let Q=oQ(J);if(Q.length===0)return"";let $=(K)=>{return g(J,K||"/")},Y=(K)=>tQ(K,Z),X=(K)=>Y(K)||(K.items??[]).some((G)=>X(G)),q=(K)=>{let G=K.icon?`<span class="BPMega-item-icon" aria-hidden="true">${K.icon}</span>`:"",V=K.description?`<span class="BPMega-item-desc">${K.description}</span>`:"";return`<a class="BPMega-item${Y(K)?" is-active":""}" href="${E($(K.link))}">
|
|
9437
|
+
${G}
|
|
9438
9438
|
<span class="BPMega-item-body">
|
|
9439
|
-
<span class="BPMega-item-title">${
|
|
9440
|
-
${
|
|
9439
|
+
<span class="BPMega-item-title">${K.text}</span>
|
|
9440
|
+
${V}
|
|
9441
9441
|
</span>
|
|
9442
|
-
</a>`},W=(
|
|
9443
|
-
${
|
|
9444
|
-
${
|
|
9442
|
+
</a>`},W=(K)=>{let G=nQ(K),V=Math.max(1,Math.min(K.columns??G.length,4)),U=G.map((B)=>{return`<div class="BPMega-group">
|
|
9443
|
+
${B.text?`<p class="BPMega-group-title">${B.text}</p>`:""}
|
|
9444
|
+
${B.items.map(q).join(`
|
|
9445
9445
|
`)}
|
|
9446
9446
|
</div>`}).join(`
|
|
9447
|
-
`),N=
|
|
9448
|
-
${
|
|
9449
|
-
<a class="BPMega-footer-link" href="${E(
|
|
9450
|
-
</div>`:"";return`<div class="BPMega BPNavBarMenu-group-items" style="--bp-mega-columns:${
|
|
9447
|
+
`),N=K.footer?`<div class="BPMega-footer">
|
|
9448
|
+
${K.footer.note?`<span class="BPMega-footer-note">${K.footer.note}</span>`:""}
|
|
9449
|
+
<a class="BPMega-footer-link" href="${E($(K.footer.link))}">${K.footer.text}</a>
|
|
9450
|
+
</div>`:"";return`<div class="BPMega BPNavBarMenu-group-items" style="--bp-mega-columns:${V}">
|
|
9451
9451
|
<div class="BPMega-columns">
|
|
9452
|
-
${
|
|
9452
|
+
${U}
|
|
9453
9453
|
</div>
|
|
9454
9454
|
${N}
|
|
9455
|
-
</div>`},
|
|
9456
|
-
${(
|
|
9457
|
-
</div>`;return Q.map((
|
|
9455
|
+
</div>`},z=(K)=>`<div class="BPNavBarMenu-group-items">
|
|
9456
|
+
${(K.items??[]).map((G)=>`<a href="${E($(G.link))}"${Y(G)?' class="is-active"':""}>${G.text}</a>`).join("")}
|
|
9457
|
+
</div>`;return Q.map((K)=>{if(K.items&&K.items.length>0){let V=aQ(K),U=X(K)?" is-active":"";return`<div class="BPNavBarMenu-group${V?" is-mega":""}${U}">
|
|
9458
9458
|
<button class="BPNavBarMenu-group-button" type="button" aria-expanded="false" aria-haspopup="true">
|
|
9459
|
-
<span>${
|
|
9460
|
-
${
|
|
9459
|
+
<span>${K.text}</span>
|
|
9460
|
+
${iQ}
|
|
9461
9461
|
</button>
|
|
9462
|
-
${
|
|
9463
|
-
</div>`}return`<a class="BPNavBarMenu-link${
|
|
9464
|
-
<nav class="BPNavScreen-nav" aria-label="Site">${Q.map((W)=>{if(!W.items||W.items.length===0)return`<div class="BPNavScreen-section">${X(W,"BPNavScreen-link")}</div>`;let
|
|
9465
|
-
<summary class="BPNavScreen-summary">${W.text}${
|
|
9466
|
-
<div class="BPNavScreen-items">${
|
|
9462
|
+
${V?W(K):z(K)}
|
|
9463
|
+
</div>`}return`<a class="BPNavBarMenu-link${Y(K)?" is-active":""}" href="${E($(K.link))}">${K.text}</a>`}).join("")}function tQ(J,Z){if(J.activeMatch)try{return new RegExp(J.activeMatch).test(Z)}catch{return!1}if(!J.link)return!1;let Q=J.link.split("#")[0].replace(/\/$/,"");return Q!==""&&Q!=="/"&&(Z===Q||Z.startsWith(`${Q}/`))}function nZ(J,Z=""){let Q=oQ(J);if(Q.length===0)return"";let $=(W)=>g(J,W||"/"),Y=(W)=>tQ(W,Z),X=(W,z)=>`<a class="${z}${Y(W)?" is-active":""}" href="${E($(W.link))}">${W.text}</a>`;return`<div class="BPNavScreen" id="bp-nav-screen" hidden>
|
|
9464
|
+
<nav class="BPNavScreen-nav" aria-label="Site">${Q.map((W)=>{if(!W.items||W.items.length===0)return`<div class="BPNavScreen-section">${X(W,"BPNavScreen-link")}</div>`;let _=(aQ(W)?nQ(W):[{items:W.items}]).map((K)=>{return`${K.text?`<p class="BPNavScreen-subtitle">${K.text}</p>`:""}${K.items.map((V)=>X(V,"BPNavScreen-link")).join("")}`}).join("");return`<details class="BPNavScreen-section"${(W.items??[]).some((K)=>Y(K))?" open":""}>
|
|
9465
|
+
<summary class="BPNavScreen-summary">${W.text}${iQ}</summary>
|
|
9466
|
+
<div class="BPNavScreen-items">${_}</div>
|
|
9467
9467
|
</details>`}).join("")}</nav>
|
|
9468
|
-
</div>`}function
|
|
9469
|
-
`)}function
|
|
9470
|
-
`)}function
|
|
9471
|
-
${JSON.stringify(
|
|
9472
|
-
</script>`}let W={"@context":"https://schema.org","@type":"TechArticle",headline:J,description:Z,url:q},
|
|
9468
|
+
</div>`}function t(J){if(J.basePath){let Q=J.basePath.trim().replace(/\/+$/,"");if(!Q||Q==="/")return"";return Q.startsWith("/")?Q:`/${Q}`}let Z=e(J);if(!Z)return"";try{let Q=new URL(Z).pathname.replace(/\/+$/,"");return Q==="/"?"":Q}catch{return""}}function tZ(J,Z){let Q=t(J);if(!Q)return Z;if(Z===Q||Z.startsWith(`${Q}/`))return Z.slice(Q.length)||"/";return Z}function g(J,Z){let Q=t(J);if(!Q||!Z.startsWith("/")||Z.startsWith("//"))return Z;if(Z===Q||Z.startsWith(`${Q}/`))return Z;return Z==="/"?`${Q}/`:`${Q}${Z}`}function PJ(J,Z){return J.replace(/\b(href|src|action)="(\/[^"]*)"/g,(Q,$,Y)=>{let X=g(Z,Y);return X===Y?Q:`${$}="${X}"`})}function OJ(J){if(J==="/index")return"/";return J.endsWith("/index")?J.slice(0,-6):J}function eZ(J,Z,Q){if(Q)return`<link rel="canonical" href="${E(Q)}">`;let $=e(J);if(!$)return"";let Y=OJ(Z);return`<link rel="canonical" href="${$}${Y}">`}function J0(J,Z,Q,$,Y){let X=e(Q);if(!X)return"";let q=OJ($),W=`${X}${q}`,z=Q.title||Q.markdown?.title||J,_=Y||Q.markdown?.meta?.["og:image"]||Q.markdown?.meta?.ogImage,K=['<meta property="og:type" content="website">',`<meta property="og:url" content="${W}">`,`<meta property="og:title" content="${E(J)}">`,`<meta property="og:description" content="${E(Z)}">`,`<meta property="og:site_name" content="${E(z)}">`];if(_){K.push(`<meta property="og:image" content="${_}">`);let G=Q.markdown?.meta??{};for(let V of["og:image:width","og:image:height","og:image:type","og:image:alt"]){let U=G[V];if(U!==void 0&&U!==null&&U!=="")K.push(`<meta property="${V}" content="${U}">`)}}return K.join(`
|
|
9469
|
+
`)}function Q0(J,Z,Q,$){let Y=Q.markdown?.meta?.["twitter:card"]||Q.markdown?.meta?.twitterCard||"summary",X=Q.markdown?.meta?.["twitter:site"]||Q.markdown?.meta?.twitterSite,q=$||Q.markdown?.meta?.["twitter:image"]||Q.markdown?.meta?.twitterImage||Q.markdown?.meta?.["og:image"]||Q.markdown?.meta?.ogImage,W=[`<meta name="twitter:card" content="${Y}">`,`<meta name="twitter:title" content="${E(J)}">`,`<meta name="twitter:description" content="${E(Z)}">`];if(X)W.push(`<meta name="twitter:site" content="${X}">`);if(q){W.push(`<meta name="twitter:image" content="${q}">`);let z=Q.markdown?.meta?.["twitter:image:alt"]??Q.markdown?.meta?.["og:image:alt"];if(z!==void 0&&z!==null&&z!=="")W.push(`<meta name="twitter:image:alt" content="${z}">`)}return W.join(`
|
|
9470
|
+
`)}function Z0(J,Z,Q,$){let Y=e(Q);if(!Y)return"";let X=OJ($),q=`${Y}${X}`;if(X==="/"){let K={"@context":"https://schema.org","@type":"WebSite",name:Q.title||Q.markdown?.title||J,description:Z,url:Y};return`<script type="application/ld+json">
|
|
9471
|
+
${JSON.stringify(K,null,2)}
|
|
9472
|
+
</script>`}let W={"@context":"https://schema.org","@type":"TechArticle",headline:J,description:Z,url:q},z=X.split("/").filter(Boolean),_=z.map((K,G)=>{let V=G+1,U=`${Y}/${z.slice(0,V).join("/")}`;return{"@type":"ListItem",position:V,name:K.replace(/-/g," ").replace(/\b\w/g,(N)=>N.toUpperCase()),item:U}});if(_.length>0){let K={"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:_};return`<script type="application/ld+json">
|
|
9473
9473
|
${JSON.stringify(W,null,2)}
|
|
9474
9474
|
</script>
|
|
9475
9475
|
<script type="application/ld+json">
|
|
9476
|
-
${JSON.stringify(
|
|
9476
|
+
${JSON.stringify(K,null,2)}
|
|
9477
9477
|
</script>`}return`<script type="application/ld+json">
|
|
9478
9478
|
${JSON.stringify(W,null,2)}
|
|
9479
|
-
</script>`}function
|
|
9479
|
+
</script>`}function $0(J){let Z=J.fonts;if(!Z)return{fontLinks:"",fontFaceCss:""};let Q=[],$=Z.google?.filter(Boolean)??[];if($.length>0){if(Z.preconnect!==!1)Q.push('<link rel="preconnect" href="https://fonts.googleapis.com">'),Q.push('<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>');let X=$.map((W)=>`family=${W.trim().replace(/\s+/g,"+")}`).join("&"),q=Z.display??"swap";Q.push(`<link href="https://fonts.googleapis.com/css2?${X}&display=${q}" rel="stylesheet">`)}let Y=(Z.faces??[]).map((X)=>X.trim()).filter(Boolean).join(`
|
|
9480
9480
|
`);return{fontLinks:Q.join(`
|
|
9481
|
-
`),fontFaceCss
|
|
9481
|
+
`),fontFaceCss:Y}}function Y0(J){let Z={...J.markdown?.themeConfig,...J.themeConfig},Q=[],$=(W,z)=>{if(z)Q.push(` ${W}: ${z};`)},Y=Z.colors??{};$("--bp-c-brand-1",Y.primary),$("--bp-c-brand-2",Y.secondary||Y.primary),$("--bp-c-brand-3",Y.accent||Y.secondary||Y.primary),$("--bp-c-bg",Y.background),$("--bp-c-bg-alt",Y.surface),$("--bp-c-bg-soft",Y.surface),$("--bp-c-text-1",Y.text),$("--bp-c-text-2",Y.muted);let X=Z.fonts??{};$("--bp-font-family-base",X.body),$("--bp-font-family-mono",X.mono);for(let[W,z]of Object.entries(Z.cssVars??{}))$(W.startsWith("--")?W:`--${W}`,z);let q=[];if(Q.length)q.push(`:root {
|
|
9482
9482
|
${Q.join(`
|
|
9483
9483
|
`)}
|
|
9484
9484
|
}`);if(X.heading)q.push(`.bp-doc h1,
|
|
@@ -9491,41 +9491,41 @@ ${Q.join(`
|
|
|
9491
9491
|
font-family: ${X.heading};
|
|
9492
9492
|
}`);if(Z.css)q.push(Z.css);return q.join(`
|
|
9493
9493
|
|
|
9494
|
-
`)}function
|
|
9495
|
-
`)}}function
|
|
9496
|
-
`),{fontLinks:
|
|
9497
|
-
`),
|
|
9498
|
-
`),RJ=
|
|
9499
|
-
`)||"",
|
|
9500
|
-
`),
|
|
9501
|
-
`)}):""
|
|
9502
|
-
${
|
|
9503
|
-
${
|
|
9504
|
-
${
|
|
9505
|
-
${
|
|
9494
|
+
`)}function X0(J,Z,Q,$){let Y=Z.match(/<h1(?:\s[^>]*)?>([\s\S]*?)<\/h1>/),X=Y?fJ(Y[1].replace(/<[^>]+>/g,"")).trim():"",q=typeof J.title==="string"&&J.title.trim()||X||Q,W=q&&q!==Q?`${q} | ${Q}`:Q,z=typeof J.description==="string"&&J.description.trim()||$.description||$.markdown?.meta?.description||"Documentation built with BunPress",_=[],K=(N)=>{_.push(N)},G=J.keywords;if(G){let N=Array.isArray(G)?G.join(", "):String(G);if(N.trim())K(`<meta name="keywords" content="${E(N)}">`)}if(typeof J.author==="string"&&J.author.trim())K(`<meta name="author" content="${E(J.author)}">`);if(typeof J.robots==="string"&&J.robots.trim())K(`<meta name="robots" content="${E(J.robots)}">`);if(J.meta&&typeof J.meta==="object")for(let[N,B]of Object.entries(J.meta)){if(B===void 0||B===null)continue;let F=N.startsWith("og:")?"property":"name";K(`<meta ${F}="${E(N)}" content="${E(String(B))}">`)}for(let N of eQ(J.head))K(N);let V=typeof J.image==="string"?J.image:void 0,U=typeof J.canonical==="string"?J.canonical:void 0;return{documentTitle:W,pageTitle:q,description:z,image:V,canonical:U,extraTags:_.join(`
|
|
9495
|
+
`)}}function eQ(J){if(!Array.isArray(J))return[];let Z=[];for(let Q of J){if(!Array.isArray(Q)||typeof Q[0]!=="string")continue;let[$,Y]=Q;if(!["meta","link","base"].includes($.toLowerCase()))continue;let X=Object.entries(Y??{}).map(([q,W])=>`${E(q)}="${E(String(W))}"`).join(" ");Z.push(`<${$.toLowerCase()}${X?` ${X}`:""}>`)}return Z}async function q0(J,Z,Q,$,Y){let X=J.themeConfig,q="",W="",z=X?.editLink?.pattern;if(z&&Y&&Z.editLink!==!1){let U=ZQ(z,$,Y),N=X?.editLink?.text??"Edit this page";q=`<a class="BPDocFooter-edit" href="${E(U)}" target="_blank" rel="noopener"><svg fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path></svg>${E(N)}</a>`}let _=X?.lastUpdated,K=Z.lastUpdated!==!1,G=_!==void 0&&_!==!1,V=typeof Z.lastUpdated==="string"?Z.lastUpdated:void 0;if(K&&(G||Z.lastUpdated===!0||V)){let U=V??(Y?await QQ($,Y):null);if(U){let N=typeof _==="object"?_:{},B=$Q(U,Q,N.formatOptions);if(B){let F=N.text??"Last updated";W=`<p class="BPDocFooter-updated">${E(F)}: <time datetime="${E(U)}">${E(B)}</time></p>`}}}if(!q&&!W)return"";return H("doc-footer",{editLink:q,lastUpdated:W})}async function wQ(J,Z,Q,$="doc",Y={},X={}){let{i18n:q,locale:W,sourceFile:z,docsDir:_=Z.docsDir||"./docs"}=X,K=q??await xJ(vJ(Z),Z),G=W||K.defaultLocale,V=SQ(Z,K,G),U=(T)=>K.translate(T,G),N=V.title||V.themeConfig?.siteTitle||V.markdown?.title||"BunPress Documentation",B=X0(Y,J,N,V),F=B.documentTitle,M=B.description,A=V.theme||"vitepress",D=MQ(A),I=eJ(),R=HQ.markdown?.css||"",j=V.markdown?.css||"",O=j&&j!==R?j:"",w=Y0(V),k=eZ(V,Q,B.canonical),x=J0(B.pageTitle,M,V,Q,B.image),p=Q0(B.pageTitle,M,V,B.image),d=Z0(B.pageTitle,M,V,Q),pJ=Object.entries(V.markdown?.meta||{}).filter(([T])=>!T.startsWith("og:")&&!T.startsWith("twitter:")&&T!=="description"&&T!=="ogImage"&&T!=="twitterCard"&&T!=="twitterSite"&&T!=="twitterImage").map(([T,f])=>`<meta name="${T}" content="${f}">`).join(`
|
|
9496
|
+
`),{fontLinks:v,fontFaceCss:y}=$0(V),L=kQ(K,V,Q),NJ=eQ(V.head).join(`
|
|
9497
|
+
`),u=[pJ,NJ,k,L,x,p,B.extraTags,v].filter(Boolean).join(`
|
|
9498
|
+
`),RJ=z0(V),BJ=K0(V),EJ=V.markdown?.scripts?.map((T)=>`<script>${T}</script>`).join(`
|
|
9499
|
+
`)||"",JJ=vQ(K),S=[d,RJ,BJ,EJ,JJ?`<script>${JJ}</script>`:""].filter(Boolean).join(`
|
|
9500
|
+
`),C=aZ(V,Q),m=V.search??V.markdown?.search,c=m?.enabled!==!1,QJ=m?.algolia,uJ=m?.provider==="algolia"&&!!QJ?.appId&&!!QJ?.apiKey&&!!QJ?.indexName,b=gQ(V,g(V,jJ));if(!V.search?.placeholder&&!V.markdown?.search?.placeholder)b.placeholder=U("search.placeholder");b.locale=K.enabled?G:null;let FJ=c?await H(uJ?"search-algolia":"search",{placeholder:b.placeholder,runtimeConfig:JSON.stringify(uJ?{...b,algolia:QJ}:b).replace(/</g,"\\u003c")}):"",h=V.themeConfig?.footer,MJ=h?.message||h?.copyright?await H("footer",{message:h.message?`<p class="BPFooter-message">${h.message}</p>`:"",copyright:h.copyright?`<p class="BPFooter-copyright">${h.copyright}</p>`:""}):"",ZZ=K.enabled?await H("locale-switcher",{label:U("nav.menu"),current:kJ(K,G),options:K.locales.map((T)=>{let f=PQ(K,T,OJ(Q)),l=T===G?' aria-current="true"':"";return`<li><a href="${E(f)}" data-locale="${E(T)}"${l}>${E(kJ(K,T))}</a></li>`}).join(`
|
|
9501
|
+
`)}):"",$Z=V.themeConfig?.logo?`<img class="BPNavBarTitle-logo" src="${E(V.themeConfig.logo)}" alt="">`:"",hJ=nZ(V,Q),IJ=async(T)=>Y.navbar===!1?"":H("navbar",{title:N,logo:$Z,localeSwitcher:ZZ,nav:C,navScreen:T==="doc"?"":hJ,navToggle:T==="doc"||!hJ?"":gZ,searchTrigger:c?mZ(b.placeholder,b.shortcuts):"",hamburger:T==="doc"?hZ:"",socialLinks:lZ(V)}),ZJ=V.darkMode??V.themeConfig?.darkMode??"auto",$J=ZJ===!0||ZJ==="dark"?"dark":ZJ===!1||ZJ==="light"?"light":"auto",TJ=$J==="dark"?"dark":"";if($==="home"){let T=await SJ(`${J}
|
|
9502
|
+
${C}`),f=`${y}
|
|
9503
|
+
${D}
|
|
9504
|
+
${I}
|
|
9505
|
+
${GJ}
|
|
9506
|
+
${T}
|
|
9507
|
+
${R}
|
|
9508
|
+
${O}
|
|
9509
|
+
${w}`,l=await H("layout-home",{htmlClass:TJ,themeMode:$J,lang:G,title:N,documentTitle:F,description:M,meta:u,customCSS:f,navbar:await IJ("plain"),search:FJ,footer:MJ,content:J});return PJ(HJ(yJ(l,S),t(V)),V)}if($==="page"){let T=await SJ(`${J}
|
|
9510
|
+
${C}`),f=`${y}
|
|
9506
9511
|
${D}
|
|
9507
|
-
${
|
|
9508
|
-
${
|
|
9509
|
-
${
|
|
9510
|
-
${
|
|
9511
|
-
${
|
|
9512
|
-
${
|
|
9513
|
-
${
|
|
9512
|
+
${I}
|
|
9513
|
+
${GJ}
|
|
9514
|
+
${T}
|
|
9515
|
+
${R}
|
|
9516
|
+
${O}
|
|
9517
|
+
${w}`,l=await H("layout-page",{htmlClass:TJ,themeMode:$J,lang:G,title:N,documentTitle:F,description:M,meta:u,customCSS:f,navbar:await IJ("plain"),search:FJ,footer:MJ,content:J});return PJ(HJ(yJ(l,S),t(V)),V)}let gJ=rZ(J),dJ=await sZ(gJ,U("toc.title")),mJ=await uZ(V,Q),cJ=iZ(gJ,await H("copy-page",{}),dJ.inline),YZ=dJ.aside,XZ=await SJ(`${cJ}
|
|
9518
|
+
${C}
|
|
9519
|
+
${mJ}`),qZ=`${y}
|
|
9514
9520
|
${D}
|
|
9515
|
-
${
|
|
9516
|
-
${
|
|
9517
|
-
${
|
|
9518
|
-
${
|
|
9519
|
-
${
|
|
9520
|
-
${
|
|
9521
|
-
${
|
|
9522
|
-
${
|
|
9523
|
-
${QZ}
|
|
9524
|
-
${M}
|
|
9525
|
-
${L}
|
|
9526
|
-
${C}`,$Z=await $0(_,$,V,G,K),YZ=await A("layout-doc",{htmlClass:TJ,themeMode:e,lang:V,title:N,documentTitle:F,description:T,meta:f,customCSS:ZZ,navbar:await IJ("doc"),search:MJ,docFooter:$Z,footer:FJ,sidebar:$.sidebar===!1?"":dJ,content:mJ,pageTOC:JZ});return yJ(HJ(PJ(YZ,y),i(_)),_)}var qJ=null,wQ=!1;async function Y0(){if(wQ)return qJ;wQ=!0;try{qJ=await import("@cwcss/crosswind")}catch{qJ=null}return qJ}async function SJ(J){let Z=await Y0();if(!Z)return"";let Y=new Z.Scanner([]).scanContent(J);if(Y.size===0)return"";let $=new Z.CSSGenerator(Z.defaultConfig);for(let X of Y)$.generate(X);return $.toCSS(!1,!1)}function X0(J){if(!J.fathom?.enabled||!J.fathom?.siteId)return"";let Z=J.fathom.scriptUrl||"https://cdn.usefathom.com/script.js",Q=J.fathom.defer!==!1,Y=J.fathom.honorDNT||!1,$=J.fathom.auto!==!1,X=J.fathom.canonical,q=J.fathom.spa||!1,W=[`data-site="${J.fathom.siteId}"`,Y?'data-honor-dnt="true"':"",!$?'data-auto="false"':"",X?`data-canonical="${X}"`:"",q?'data-spa="auto"':""].filter(Boolean).join(" ");return`<script src="${Z}" ${W}${Q?" defer":""}></script>`}function q0(J){let Z=J.analytics||J.selfHostedAnalytics;if(!Z?.enabled||!Z?.siteId)return"";let Q=WJ(Z.siteId);if(Z.scriptSrc)return`<script defer src="${WJ(Z.scriptSrc)}" data-site="${Q}"></script>`;let Y=Z.apiEndpoint?WJ(Z.apiEndpoint):"",$=Z.honorDNT?`var dnt=n.doNotTrack||w.doNotTrack||n.msDoNotTrack;if(dnt==="1"||dnt==="yes"||dnt===true){l('DNT enabled, skipping');return;}`:"",X=Z.trackHashChanges?"w.addEventListener('hashchange',function(){pv();});":"",q=Z.trackOutboundLinks?`d.addEventListener('click',function(e){try{var a=e.target.closest('a');if(a&&a.hostname&&a.hostname!==location.hostname){t('outbound',{url:a.href,text:(a.textContent||'').slice(0,100)});}}
|
|
9527
|
-
catch (err){l('Outbound error',err);}});`:"",W=Y?` data-api="${Y}"`:"",K=Z.collectEndpoint?`/${Z.collectEndpoint.replace(/^\/+/,"")}`:"/collect",G=K==="/collect"?"":` data-collect="${WJ(K)}"`;return`<!-- ts-analytics: privacy-first analytics -->
|
|
9528
|
-
<script data-site="${Q}"${W}${G} defer>
|
|
9521
|
+
${I}
|
|
9522
|
+
${GJ}
|
|
9523
|
+
${XZ}
|
|
9524
|
+
${R}
|
|
9525
|
+
${O}
|
|
9526
|
+
${w}`,WZ=await q0(V,Y,G,_,z),zZ=await H("layout-doc",{htmlClass:TJ,themeMode:$J,lang:G,title:N,documentTitle:F,description:M,meta:u,customCSS:qZ,navbar:await IJ("doc"),search:FJ,docFooter:WZ,footer:MJ,sidebar:Y.sidebar===!1?"":mJ,content:cJ,pageTOC:YZ});return PJ(HJ(yJ(zZ,S),t(V)),V)}var VJ=null,LQ=!1;async function W0(){if(LQ)return VJ;LQ=!0;try{VJ=await import("@cwcss/crosswind")}catch{VJ=null}return VJ}async function SJ(J){let Z=await W0();if(!Z)return"";let $=new Z.Scanner([]).scanContent(J);if($.size===0)return"";let Y=new Z.CSSGenerator(Z.defaultConfig);for(let X of $)Y.generate(X);return Y.toCSS(!1,!1)}function z0(J){if(!J.fathom?.enabled||!J.fathom?.siteId)return"";let Z=J.fathom.scriptUrl||"https://cdn.usefathom.com/script.js",Q=J.fathom.defer!==!1,$=J.fathom.honorDNT||!1,Y=J.fathom.auto!==!1,X=J.fathom.canonical,q=J.fathom.spa||!1,W=[`data-site="${J.fathom.siteId}"`,$?'data-honor-dnt="true"':"",!Y?'data-auto="false"':"",X?`data-canonical="${X}"`:"",q?'data-spa="auto"':""].filter(Boolean).join(" ");return`<script src="${Z}" ${W}${Q?" defer":""}></script>`}function K0(J){let Z=J.analytics||J.selfHostedAnalytics;if(!Z?.enabled||!Z?.siteId)return"";let Q=_J(Z.siteId);if(Z.scriptSrc)return`<script defer src="${_J(Z.scriptSrc)}" data-site="${Q}"></script>`;let $=Z.apiEndpoint?_J(Z.apiEndpoint):"",Y=Z.honorDNT?`var dnt=n.doNotTrack||w.doNotTrack||n.msDoNotTrack;if(dnt==="1"||dnt==="yes"||dnt===true){l('DNT enabled, skipping');return;}`:"",X=Z.trackHashChanges?"w.addEventListener('hashchange',function(){pv();});":"",q=Z.trackOutboundLinks?`d.addEventListener('click',function(e){try{var a=e.target.closest('a');if(a&&a.hostname&&a.hostname!==location.hostname){t('outbound',{url:a.href,text:(a.textContent||'').slice(0,100)});}}
|
|
9527
|
+
catch (err){l('Outbound error',err);}});`:"",W=$?` data-api="${$}"`:"",z=Z.collectEndpoint?`/${Z.collectEndpoint.replace(/^\/+/,"")}`:"/collect",_=z==="/collect"?"":` data-collect="${_J(z)}"`;return`<!-- ts-analytics: privacy-first analytics -->
|
|
9528
|
+
<script data-site="${Q}"${W}${_} defer>
|
|
9529
9529
|
(function(){
|
|
9530
9530
|
'use strict';
|
|
9531
9531
|
var d=document,w=window,n=navigator,ss=w.sessionStorage,s=d.currentScript;
|
|
@@ -9534,7 +9534,7 @@ var collect=s.dataset.collect||'/collect';
|
|
|
9534
9534
|
var debug=w.ANALYTICS_DEBUG||false;
|
|
9535
9535
|
function l(){if(debug&&w.console)console.log.apply(console,['[Analytics]'].concat([].slice.call(arguments)));}
|
|
9536
9536
|
try{
|
|
9537
|
-
${
|
|
9537
|
+
${Y}
|
|
9538
9538
|
var SK='_tsa_sid',VK='_tsa_vid';
|
|
9539
9539
|
var sid=ss.getItem(SK);
|
|
9540
9540
|
if(!sid){sid=Math.random().toString(36).slice(2)+Date.now().toString(36);ss.setItem(SK,sid);l('New session',sid);}
|
|
@@ -9587,61 +9587,69 @@ l('Initialized',site);
|
|
|
9587
9587
|
}
|
|
9588
9588
|
catch(err){if(w.console)console.error('[Analytics] Init error:',err);}
|
|
9589
9589
|
})();
|
|
9590
|
-
</script>`}function
|
|
9591
|
-
`),Q=/^---\n([\s\S]*?)\n---\n
|
|
9590
|
+
</script>`}function _J(J){return J.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function V0(J){let Z=J.replace(/\r\n/g,`
|
|
9591
|
+
`),Q=/^---\n([\s\S]*?)\n---\n?/,$=Z.match(Q);if(!$)return{frontmatter:{},content:Z};let Y=$[1],X=Z.slice($[0].length);try{return{frontmatter:TQ.parse(Y),content:X}}catch{try{let q=Y.replace(/^(\s*\w+:\s*)"(.+)",\s*(.+)$/gm,`$1'"$2," $3'`);return{frontmatter:TQ.parse(q),content:X}}catch(q){return console.error("Failed to parse frontmatter YAML:",q),{frontmatter:{},content:J}}}}async function _0(J){if(!J)return"";let Z=J.name?`<p class="BPHero-name">${J.name}</p>`:"",Q=J.text?`<h1 class="BPHero-text">${J.text}</h1>`:"",$=J.tagline?`<p class="BPHero-tagline">${J.tagline}</p>`:"",Y="";if(J.actions)Y=`<div class="BPHero-actions">${J.actions.map((_)=>{return`<a class="${_.theme==="brand"?"BPButton BPButton-brand":"BPButton BPButton-alt"}" href="${_.link}">${_.text}</a>`}).join(`
|
|
9592
9592
|
`)}</div>`;let X=J.announcement?`<a class="BPHero-announcement" href="${E(J.announcement.link||"#")}">
|
|
9593
9593
|
${J.announcement.tag?`<span class="BPHero-announcement-tag">${J.announcement.tag}</span>`:""}
|
|
9594
9594
|
<span class="BPHero-announcement-text">${J.announcement.text||""}</span>
|
|
9595
9595
|
<svg class="BPHero-announcement-arrow" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg>
|
|
9596
|
-
</a>`:"",q=J.image?`<div class="hero-image"><img src="${E(J.image)}" alt="${E(J.name||"")}" /></div>`:"",W=(J.code?await
|
|
9597
|
-
<pre data-lang="${E(W)}"><code class="language-${E(W)}">${
|
|
9596
|
+
</a>`:"",q=J.image?`<div class="hero-image"><img src="${E(J.image)}" alt="${E(J.name||"")}" /></div>`:"",W=(J.code?await G0(J.code):"")||q;return await H("hero",{announcement:X,name:Z,text:Q,tagline:$,actions:Y,image:W})}async function G0(J){let Q=(Array.isArray(J)?J:[J]).filter((X)=>typeof X?.content==="string"&&X.content.trim());if(Q.length===0)return"";let $=await Promise.all(Q.map(async(X,q)=>{let W=X.lang||"ts",z=await WJ(X.content.replace(/\n+$/,""),W);return`<div class="BPHeroCode-panel" data-index="${q}"${q===0?"":" hidden"}>
|
|
9597
|
+
<pre data-lang="${E(W)}"><code class="language-${E(W)}">${z}</code></pre>
|
|
9598
9598
|
</div>`}));return`<div class="BPHeroCode">
|
|
9599
9599
|
<div class="BPHeroCode-head">${Q.length>1?`<div class="BPHeroCode-tabs" role="tablist">${Q.map((X,q)=>`<button class="BPHeroCode-tab${q===0?" is-active":""}" type="button" role="tab" aria-selected="${q===0}" onclick="switchHeroCodeTab(this, ${q})">${X.file||X.lang||`Example ${q+1}`}</button>`).join("")}</div>`:Q[0].file?`<span class="BPHeroCode-file">${Q[0].file}</span>`:""}</div>
|
|
9600
|
-
<div class="BPHeroCode-body">${
|
|
9601
|
-
</div>`}var
|
|
9602
|
-
<${q} class="BPFeature${
|
|
9603
|
-
${
|
|
9600
|
+
<div class="BPHeroCode-body">${$.join("")}</div>
|
|
9601
|
+
</div>`}var j0={Fast:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z"/></svg>',Shield:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg>',Blade:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>',Tools:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>',Components:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/></svg>',Stream:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M2 12h6l3-9 3 18 3-9h5"/></svg>',Desktop:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="2" y="3" width="20" height="14" rx="2"/><path d="M8 21h8m-4-4v4"/></svg>',Parser:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M16 18l6-6-6-6M8 6l-6 6 6 6"/></svg>',Icons:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="4"/><path d="M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"/></svg>'};function U0(J){if(J.startsWith("<")||/\p{Emoji}/u.test(J))return J;return j0[J]||`<span class="BPFeature-icon-text">${J.charAt(0)}</span>`}async function O0(J){if(!J||J.length===0)return"";let Z=J.map((Q)=>{let $=Q.icon?U0(Q.icon):"",Y=$?`<div class="BPFeature-icon">${$}</div>`:"",X=Q.link,q=X?"a":"div",W=X?` href="${E(X)}"`:"",z=Number(Q.span)>1?` style="--bp-feature-span:${Math.min(Math.trunc(Number(Q.span)),3)}"`:"",_=X?" is-linked":"",K=X?`<span class="BPFeature-link">${Q.linkText||"Learn more"}<svg fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg></span>`:"";return`
|
|
9602
|
+
<${q} class="BPFeature${_}"${W}${z}>
|
|
9603
|
+
${Y}
|
|
9604
9604
|
<h3 class="BPFeature-title">${Q.title||""}</h3>
|
|
9605
9605
|
<p class="BPFeature-details">${Q.details||""}</p>
|
|
9606
|
-
${
|
|
9607
|
-
</${q}>`}).join("");return await
|
|
9608
|
-
`),Q=Z.filter((X)=>X.trim()).map((X)=>X.match(/^[ \t]*/)[0].length)
|
|
9609
|
-
`).trim();return
|
|
9610
|
-
|
|
9611
|
-
${
|
|
9612
|
-
|
|
9613
|
-
`:""}async function
|
|
9614
|
-
`).map((
|
|
9615
|
-
`),
|
|
9616
|
-
|
|
9617
|
-
${
|
|
9618
|
-
|
|
9619
|
-
${Y.
|
|
9620
|
-
`),F=W.split(".").pop()||"",
|
|
9621
|
-
`),
|
|
9622
|
-
${
|
|
9623
|
-
|
|
9624
|
-
`);if(G&&
|
|
9625
|
-
`),
|
|
9626
|
-
|
|
9627
|
-
|
|
9606
|
+
${K}
|
|
9607
|
+
</${q}>`}).join("");return await H("features",{items:Z})}function N0(J){let Z={smile:"\uD83D\uDE04",laughing:"\uD83D\uDE06",blush:"\uD83D\uDE0A",heart_eyes:"\uD83D\uDE0D",kissing_heart:"\uD83D\uDE18",relaxed:"\u263A\uFE0F",wink:"\uD83D\uDE09",grin:"\uD83D\uDE01",joy:"\uD83D\uDE02",sweat_smile:"\uD83D\uDE05",rofl:"\uD83E\uDD23",thinking:"\uD83E\uDD14",zipper_mouth:"\uD83E\uDD10",neutral_face:"\uD83D\uDE10",expressionless:"\uD83D\uDE11",confused:"\uD83D\uDE15",worried:"\uD83D\uDE1F",slightly_frowning_face:"\uD83D\uDE41",frowning_face:"\u2639\uFE0F",persevere:"\uD83D\uDE23",disappointed:"\uD83D\uDE1E",sweat:"\uD83D\uDE13",tired_face:"\uD83D\uDE2B",cry:"\uD83D\uDE22",sob:"\uD83D\uDE2D",triumph:"\uD83D\uDE24",angry:"\uD83D\uDE20",rage:"\uD83D\uDE21",no_mouth:"\uD83D\uDE36",sleeping:"\uD83D\uDE34","+1":"\uD83D\uDC4D",thumbsup:"\uD83D\uDC4D","-1":"\uD83D\uDC4E",thumbsdown:"\uD83D\uDC4E",clap:"\uD83D\uDC4F",raised_hands:"\uD83D\uDE4C",pray:"\uD83D\uDE4F",wave:"\uD83D\uDC4B",ok_hand:"\uD83D\uDC4C",point_up:"\u261D\uFE0F",point_down:"\uD83D\uDC47",point_left:"\uD83D\uDC48",point_right:"\uD83D\uDC49",muscle:"\uD83D\uDCAA",heart:"\u2764\uFE0F",blue_heart:"\uD83D\uDC99",green_heart:"\uD83D\uDC9A",yellow_heart:"\uD83D\uDC9B",purple_heart:"\uD83D\uDC9C",broken_heart:"\uD83D\uDC94",sparkling_heart:"\uD83D\uDC96",star:"\u2B50",star2:"\uD83C\uDF1F",sparkles:"\u2728",boom:"\uD83D\uDCA5",fire:"\uD83D\uDD25",tada:"\uD83C\uDF89",confetti_ball:"\uD83C\uDF8A",rocket:"\uD83D\uDE80",zap:"\u26A1",bulb:"\uD83D\uDCA1",bell:"\uD83D\uDD14",mega:"\uD83D\uDCE3",loudspeaker:"\uD83D\uDCE2",warning:"\u26A0\uFE0F",white_check_mark:"\u2705",check:"\u2705",x:"\u274C",heavy_check_mark:"\u2714\uFE0F",heavy_multiplication_x:"\u2716\uFE0F",question:"\u2753",grey_question:"\u2754",exclamation:"\u2757",grey_exclamation:"\u2755",heavy_plus_sign:"\u2795",heavy_minus_sign:"\u2796",pencil2:"\u270F\uFE0F",memo:"\uD83D\uDCDD",book:"\uD83D\uDCD6",books:"\uD83D\uDCDA",bookmark:"\uD83D\uDD16",mag:"\uD83D\uDD0D",mag_right:"\uD83D\uDD0E",lock:"\uD83D\uDD12",unlock:"\uD83D\uDD13",key:"\uD83D\uDD11",link:"\uD83D\uDD17",computer:"\uD83D\uDCBB",email:"\uD83D\uDCE7",inbox_tray:"\uD83D\uDCE5",outbox_tray:"\uD83D\uDCE4",package:"\uD83D\uDCE6",file_folder:"\uD83D\uDCC1",open_file_folder:"\uD83D\uDCC2",page_facing_up:"\uD83D\uDCC4",calendar:"\uD83D\uDCC5",chart_with_upwards_trend:"\uD83D\uDCC8",chart_with_downwards_trend:"\uD83D\uDCC9",bar_chart:"\uD83D\uDCCA",clipboard:"\uD83D\uDCCB",pushpin:"\uD83D\uDCCC",round_pushpin:"\uD83D\uDCCD",paperclip:"\uD83D\uDCCE",straight_ruler:"\uD83D\uDCCF",wrench:"\uD83D\uDD27",hammer:"\uD83D\uDD28",gear:"\u2699\uFE0F",nut_and_bolt:"\uD83D\uDD29",seedling:"\uD83C\uDF31",evergreen_tree:"\uD83C\uDF32",deciduous_tree:"\uD83C\uDF33",palm_tree:"\uD83C\uDF34",cactus:"\uD83C\uDF35",herb:"\uD83C\uDF3F",shamrock:"\u2618\uFE0F",four_leaf_clover:"\uD83C\uDF40",bug:"\uD83D\uDC1B",bee:"\uD83D\uDC1D",bird:"\uD83D\uDC26",dog:"\uD83D\uDC36",cat:"\uD83D\uDC31",penguin:"\uD83D\uDC27",turtle:"\uD83D\uDC22",fish:"\uD83D\uDC1F",coffee:"\u2615",tea:"\uD83C\uDF75",beer:"\uD83C\uDF7A",beers:"\uD83C\uDF7B",wine_glass:"\uD83C\uDF77",pizza:"\uD83C\uDF55",hamburger:"\uD83C\uDF54",fries:"\uD83C\uDF5F",cake:"\uD83C\uDF70",birthday:"\uD83C\uDF82",cookie:"\uD83C\uDF6A",doughnut:"\uD83C\uDF69",apple:"\uD83C\uDF4E",green_apple:"\uD83C\uDF4F",banana:"\uD83C\uDF4C",strawberry:"\uD83C\uDF53",house:"\uD83C\uDFE0",office:"\uD83C\uDFE2",hospital:"\uD83C\uDFE5",school:"\uD83C\uDFEB",car:"\uD83D\uDE97",taxi:"\uD83D\uDE95",bus:"\uD83D\uDE8C",train:"\uD83D\uDE82",airplane:"\u2708\uFE0F",ship:"\uD83D\uDEA2",bike:"\uD83D\uDEB2",soccer:"\u26BD",basketball:"\uD83C\uDFC0",football:"\uD83C\uDFC8",baseball:"\u26BE",tennis:"\uD83C\uDFBE",trophy:"\uD83C\uDFC6",medal:"\uD83C\uDFC5",dart:"\uD83C\uDFAF",game_die:"\uD83C\uDFB2",musical_note:"\uD83C\uDFB5",notes:"\uD83C\uDFB6",art:"\uD83C\uDFA8",camera:"\uD83D\uDCF7",movie_camera:"\uD83C\uDFA5",checkered_flag:"\uD83C\uDFC1",triangular_flag_on_post:"\uD83D\uDEA9",flag_us:"\uD83C\uDDFA\uD83C\uDDF8",flag_gb:"\uD83C\uDDEC\uD83C\uDDE7",flag_fr:"\uD83C\uDDEB\uD83C\uDDF7",flag_de:"\uD83C\uDDE9\uD83C\uDDEA",flag_jp:"\uD83C\uDDEF\uD83C\uDDF5",flag_cn:"\uD83C\uDDE8\uD83C\uDDF3"};return J.replace(/:(\w+):/g,(Q,$)=>{return Z[$]||Q})}function R0(J){let Z=/<Badge([^/>]+)\/>/gi;return J.replace(Z,(Q,$)=>{let Y=$.match(/type="(info|tip|warning|danger)"/i),X=$.match(/text="([^"]+)"/),q=Y?Y[1].toLowerCase():"info",W=X?X[1]:"";return`<span class="badge badge-${q}">${W}</span>`})}function B0(J,Z=!0,Q=!0){return J.replace(/<a\s+href="([^"]+)"([^>]*)>/g,($,Y,X)=>{if(X.includes("target="))return $;if(Y.startsWith("http://")||Y.startsWith("https://"))return`<a href="${Y}"${Z?' target="_blank"':""}${Q?' rel="noreferrer noopener"':""}${X}>`;return $})}function E0(J){return J.replace(/<a\s+href="([^"]+)"\s+target="_blank"[^>]*>[\s\S]+?<\/a>/g,(Z,Q)=>{if(Z.includes("external-link-icon"))return Z;let $='<svg class="external-link-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg>';return Z.replace("</a>",`${$}</a>`)})}function F0(J){return J.replace(/<img([^>]+)>/g,(Z,Q)=>{if(Q.includes("loading="))return Z;return`<img ${Q} loading="lazy" decoding="async">`})}function M0(J,Z){if(!J.includes("[[toc]]"))return{content:J,tocHtml:null};let Q=fQ(J),$={...CQ,...Z},Y=uQ(Q,$),q={items:pQ(Y),title:$.title||"Table of Contents",config:$},W=hQ(q),z="<!--INLINE_TOC_PLACEHOLDER-->";return{content:J.replace(/\[\[toc\]\]/g,z),tocHtml:W}}function I0(J,Z){return J.replace(/<!--INLINE_TOC_PLACEHOLDER-->/g,Z)}function JZ(J){let Z=J.replace(/\s+$/,"").split(`
|
|
9608
|
+
`),Q=Z.filter((X)=>X.trim()).map((X)=>X.match(/^[ \t]*/)[0].length),$=Q.length>0?Math.min(...Q):0,Y=Z.map((X)=>X.slice($)).join(`
|
|
9609
|
+
`).trim();return Y?`
|
|
9610
|
+
|
|
9611
|
+
${Y}
|
|
9612
|
+
|
|
9613
|
+
`:""}async function T0(J){let Z=/^>\s*\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*\n((?:>\s*.*\n?)*)/gm,Q=Array.from(J.matchAll(Z)),$=J;for(let Y of Q.reverse()){let[X,q,W]=Y,z=W.split(`
|
|
9614
|
+
`).map((G)=>G.replace(/^>\s?/,"")).join(`
|
|
9615
|
+
`),_=q.toLowerCase(),K=await H(`blocks/alerts/${_}`,{content:JZ(z)});$=`${$.slice(0,Y.index)}
|
|
9616
|
+
|
|
9617
|
+
${K}
|
|
9618
|
+
|
|
9619
|
+
${$.slice(Y.index+X.length)}`}return $}async function D0(J,Z){let Q=/^<<<\s+@\/([^\s[{#]+)(?:\{(\d+)-(\d+)\}|#(\w+))?\s*(?:\[[^\]]+\]\s*)?$/gm,$=Array.from(J.matchAll(Q)),Y=J;for(let X of $.reverse()){let[q,W,z,_,K]=X;try{let{join:G}=await import("path"),V=G(Z,W),U=Bun.file(V);if(!await U.exists()){console.warn(`Code import: File not found: ${V}`);continue}let B=(await U.text()).split(`
|
|
9620
|
+
`),F=W.split(".").pop()||"",A={js:"javascript",ts:"typescript",jsx:"jsx",tsx:"tsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",cpp:"cpp",c:"c",cs:"csharp",php:"php",sh:"bash",bash:"bash",yaml:"yaml",yml:"yaml",json:"json",md:"markdown",html:"html",css:"css",scss:"scss",vue:"vue"}[F]||F;if(z&&_){let R=Number.parseInt(z)-1,j=Number.parseInt(_);B=B.slice(R,j)}else if(K){let R=B.findIndex((O)=>O.includes(`#region ${K}`)||O.includes(`// region ${K}`)||O.includes(`# region ${K}`)),j=B.findIndex((O,w)=>w>R&&(O.includes("#endregion")||O.includes("// endregion")||O.includes("# endregion")));if(R!==-1&&j!==-1)B=B.slice(R+1,j);else console.warn(`Code import: Region '${K}' not found in ${W}`)}let D=B.join(`
|
|
9621
|
+
`),I=`\`\`\`${A}
|
|
9622
|
+
${D}
|
|
9623
|
+
\`\`\``;Y=Y.slice(0,X.index)+I+Y.slice(X.index+q.length)}catch(G){console.error(`Error importing code from ${W}:`,G)}}return Y}async function QZ(J,Z,Q=new Set,$,Y){let X=/<!--@include:\s*([^\s{]+)(?:\{(\d+)-(\d+)\}|\{#([\w-]+)\})?\s*-->/g,q=Array.from(J.matchAll(X)),W=J;for(let z of q.reverse()){let[_,K,G,V,U]=z;try{if($){let j=J.slice(0,z.index),O=J.slice(z.index+_.length);if(!/(?:^|\n) {0,3}$/.test(j)||!/^[ \t]*(?:\r?\n|$)/.test(O))throw Error("Source-aware Markdown includes must be on their own line")}let{join:N,resolve:B}=await import("path"),F=B(N(Z,K));if(Q.has(F)){console.warn(`Markdown include: Circular reference detected for ${K}`);continue}let M=Bun.file(F);if(!await M.exists()){console.warn(`Markdown include: File not found: ${F}`);continue}let D=(await M.text()).split(`
|
|
9624
|
+
`);if(G&&V){let j=Number.parseInt(G)-1,O=Number.parseInt(V);D=D.slice(j,O)}else if(U){let j=D.findIndex((w)=>w.includes(`<!-- #region ${U} -->`)||w.includes(`<!-- region ${U} -->`)),O=D.findIndex((w,k)=>k>j&&(w.includes("<!-- #endregion -->")||w.includes("<!-- endregion -->")));if(j!==-1&&O!==-1)D=D.slice(j+1,O);else{console.warn(`Markdown include: Region '${U}' not found in ${K}`);continue}}let I=D.join(`
|
|
9625
|
+
`),R=new Set(Q);if(R.add(F),I=await n(I,(j)=>QZ(j,Z,R,$,Y)),$&&Y){let j=`bunpress-source-${sQ()}`;Y.set(`${j}:start`,{...$.page,sourceFile:F}),Y.set(`${j}:end`,null),I=`
|
|
9626
|
+
<!--${j}:start-->
|
|
9627
|
+
|
|
9628
|
+
${I}
|
|
9629
|
+
|
|
9630
|
+
<!--${j}:end-->
|
|
9631
|
+
`}W=W.slice(0,z.index)+I+W.slice(z.index+_.length)}catch(N){if($)throw N;console.error(`Error including markdown from ${K}:`,N)}}return W}async function w0(J){let Z=/^:::\s+code-group[ \t]*\n((?:(?!^:::)[\s\S])*)^:::$/gm,Q=Array.from(J.matchAll(Z)),$=J;for(let Y of Q.reverse()){let[X,q]=Y,W=/^```(\w+)[ \t]+\[([^\]]+)\][ \t]*\n((?:(?!^```)[\s\S])*)^```$/gm,z=Array.from(q.matchAll(W));if(z.length===0)continue;let _=new Bun.CryptoHasher("sha256");_.update(`${Y.index}\x00${X}`);let K=`code-group-${_.digest("hex").slice(0,12)}`,G=z.map((N,B)=>{let F=N[2];return`<button class="code-group-tab${B===0?" active":""}" onclick="switchCodeTab('${K}', ${B})">${F}</button>`}).join(""),V=await Promise.all(z.map(async(N,B)=>{let F=N[1],M=N[3],A=B===0,D=P.markdown?.syntaxHighlightTheme||"github-light",I=await WJ(M,F,D),R=`<pre data-lang="${F}"><code class="language-${F}">${I}</code></pre>`;return`<div class="code-group-panel${A?" active":""}" data-panel="${B}">
|
|
9632
|
+
${R}
|
|
9633
|
+
</div>`})),U=[`<div class="code-group" id="${K}">`,' <div class="code-group-tabs">',` ${G}`," </div>",' <div class="code-group-panels">',` ${V.join(`
|
|
9628
9634
|
`)}`," </div>","</div>"].join(`
|
|
9629
|
-
`)
|
|
9630
|
-
|
|
9631
|
-
${
|
|
9632
|
-
|
|
9633
|
-
${Y.
|
|
9634
|
-
`));if(
|
|
9635
|
-
`),
|
|
9636
|
-
`).map((
|
|
9637
|
-
`),
|
|
9638
|
-
`)
|
|
9639
|
-
`)}function
|
|
9640
|
-
`:""}<table${Z?' class="enhanced-table"':""}>`;J=J.replace(/<table>/g
|
|
9641
|
-
</div>`:"</table>")}if(
|
|
9635
|
+
`);$=$.slice(0,Y.index)+U+$.slice(Y.index+X.length)}return $}async function L0(J){let Z=/^:::\s+(info|tip|warning|danger|details|raw)(?: +([^\n\t ][^\n]*))?\n((?:(?!^:::)[\s\S])*)^:::$/gm,Q=Array.from(J.matchAll(Z)),$=J;for(let Y of Q.reverse()){let[X,q,W,z]=Y,_={info:"INFO",tip:"TIP",warning:"WARNING",danger:"DANGER",details:"Details",raw:""},K=W&&W.trim()||_[q],G=await H(`blocks/containers/${q}`,{title:K,content:JZ(z)});$=`${$.slice(0,Y.index)}
|
|
9636
|
+
|
|
9637
|
+
${G}
|
|
9638
|
+
|
|
9639
|
+
${$.slice(Y.index+X.length)}`}return $}function A0(J){let Z=J.match(/^(\w+)/),Q=Z?Z[1]:"",$=J.match(/\{([^}]+)\}/),Y=[];if($){let q=$[1].split(",");for(let W of q){let z=W.trim();if(z.includes("-")){let[_,K]=z.split("-").map(Number);for(let G=_;G<=K;G++)Y.push(G)}else Y.push(Number(z))}}let X=J.includes(":line-numbers");return{lang:Q,highlights:Y,showLineNumbers:X}}async function H0(J,Z,Q){let $=J[Z],Y=$.match(/^(`{3,})/),X=Y?Y[1].length:3,q="`".repeat(X),W=$.substring(X).trim(),z=A0(W),_=z.lang,K=Q.lineHighlighting?z.highlights:[],G=Q.lineNumbers?z.showLineNumbers:!1,V=[],U=Z+1;while(U<J.length){let v=J[U];if(v.match(new RegExp(`^\`{${X},}\\s*$`)))break;V.push(v),U++}if(Q.messagePreviews){let v=xQ(_,V.join(`
|
|
9640
|
+
`));if(v!==null)return{html:v,endIndex:U}}let N=new Set,B=new Set,F=new Set,M=new Set,A=new Set,D=V.map((v,y)=>{let L=v;if(L.includes("// [!code focus]"))N.add(y),L=L.replace(/\/\/ \[!code focus\]/,"").trimEnd();if(L.includes("// [!code ++]"))B.add(y),L=L.replace(/\/\/ \[!code \+\+\]/,"").trimEnd();if(L.includes("// [!code --]"))F.add(y),L=L.replace(/\/\/ \[!code --\]/,"").trimEnd();if(L.includes("// [!code error]"))M.add(y),L=L.replace(/\/\/ \[!code error\]/,"").trimEnd();if(L.includes("// [!code warning]"))A.add(y),L=L.replace(/\/\/ \[!code warning\]/,"").trimEnd();return L}),I=N.size>0,R=D.join(`
|
|
9641
|
+
`),j=P.markdown?.syntaxHighlightTheme||"github-light",k=(await WJ(R,_,j)).split(`
|
|
9642
|
+
`).map((v,y)=>{let L=y+1,NJ=K.includes(L),u=N.has(y),RJ=Q.diffs&&B.has(y),BJ=Q.diffs&&F.has(y),EJ=Q.errorWarningMarkers&&M.has(y),JJ=Q.errorWarningMarkers&&A.has(y),S=["line"];if(NJ)S.push("highlighted");if(u)S.push("focused");if(I&&!u)S.push("dimmed");if(RJ)S.push("diff-add");if(BJ)S.push("diff-remove");if(EJ)S.push("has-error");if(JJ)S.push("has-warning");if(v.startsWith('<span class="line">')){let m=S.join(" "),c=v.replace('<span class="line">',`<span class="${m}">`);if(G)return`<span class="${S.join(" ")}"><span class="line-number">${L}</span>${c.replace(/^<span class="[^"]*">/,"").replace(/<\/span>$/,"")}</span>`;return c}let C=S.length>0?` class="${S.join(" ")}"`:"";if(G)return`<span${C}><span class="line-number">${L}</span>${v}</span>`;return`<span${C}>${v}</span>`}).join(`
|
|
9643
|
+
`),x=[];if(G)x.push("line-numbers-mode");if(I)x.push("has-focused-lines");let p=x.length>0?` class="${x.join(" ")}"`:"",d=_?` data-lang="${_}"`:"";return{html:`<pre${p}${d}><code class="language-${_}">${k}</code></pre>`,endIndex:U}}function y0(J){let Z=new Map;return{content:J.replace(/^(#{1,6})\s+(.*?)\s*\{#([\w-]+)\}\s*$/gm,($,Y,X,q)=>{let W=bQ(X),z=Z.get(W)??[];return z.push(q),Z.set(W,z),`${Y} ${X.trim()}`}),customAnchors:Z}}async function P0(J,Z,Q){let $=J.split(`
|
|
9644
|
+
`),Y=[],X=0,q=0;while(X<$.length){let W=$[X];if(W.match(/^`{3,}/)){let{html:z,endIndex:_}=await H0($,X,Q),K=`<!--BUNPRESS_CODE_${q++}-->`;Z.set(K,z),Y.push(""),Y.push(K),Y.push(""),X=_+1}else Y.push(W),X++}return Y.join(`
|
|
9645
|
+
`)}function S0(J){return J=J.replace(/==(.+?)==/g,"<mark>$1</mark>"),J=J.replace(/\^(.+?)\^/g,"<sup>$1</sup>"),J=J.replace(/(?<!~)~(?!~)(.+?)(?<!~)~(?!~)/g,"<sub>$1</sub>"),J}function k0(J,Z=!0,Q=!0,$=!0){if(Q||Z){let Y=`${Q?`<div class="table-responsive">
|
|
9646
|
+
`:""}<table${Z?' class="enhanced-table"':""}>`;J=J.replace(/<table>/g,Y),J=J.replace(/<\/table>/g,Q?`</table>
|
|
9647
|
+
</div>`:"</table>")}if($)J=J.replace(/<(th|td) align="(left|center|right)">/g,(Y,X,q)=>{return`<${X} style="text-align: ${q}">`}),J=J.replace(/<(th|td)>/g,(Y,X)=>{return`<${X} style="text-align: left">`});return J}function v0(J,Z){let Q=new Set;return J.replace(/<h([1-6])([^>]*)>([\s\S]*?)<\/h\1>/g,($,Y,X,q)=>{if(X.includes(" id="))return $;let W=q.replace(/<[^>]+>/g,"").trim(),_=Z.get(W)?.shift();if(!_)_=CJ(W);return _=bJ(_,Q),`<h${Y} id="${_}"${X}>${q}</h${Y}>`})}async function x0(J,Z="./docs",Q){let{frontmatter:$,content:Y}=V0(J);if($.layout==="home"){let q=await _0($.hero),W=await O0($.features),z=Y.trim()?await AQ(Y,$,Z,Q):"",_=z?`<div class="BPHome-content"><div class="container bp-doc vp-doc">${z}</div></div>`:"";return{html:q+W+_,frontmatter:$}}return{html:await AQ(Y,$,Z,Q),frontmatter:$}}async function AQ(J,Z,Q,$){let Y=new Map,X=P.markdown?.features,q=(j)=>{if(!X)return!0;let O=X[j];return O===void 0||O===!0||typeof O==="object"&&O!==null},W=(j,O)=>{if(!q(j))return!1;let w=X?.[j];if(typeof w!=="object"||w===null)return!0;return w[O]!==!1},z=q("includes")?await n(J,(j)=>QZ(j,Q,new Set($?[$.page.sourceFile]:[]),$,Y)):J,_={...Z,data:await sJ(Q,P.dataDir),site:{title:P.title||P.markdown?.title||"",description:P.description||P.markdown?.meta?.description||"",themeConfig:P.themeConfig}},K=P.componentsDir?UJ(a.cwd(),P.componentsDir):UJ(Q,".components"),G=new Map,V=P.fallbackComponentsDir;z=await LJ(z,K,_,{fallbackComponentsDir:V?pZ(V):void 0,rendered:G});let U=z.replace(/```[\s\S]*?```/g,"");if(U.includes("@if")||U.includes("@foreach")||U.includes("@for (")||U.includes("<script server")||U.includes("@include")||/\{\{(?!\{)\s*\w/.test(U))try{let j=await import("@stacksjs/stx/render"),O=[],w=z.replace(/```[\s\S]*?```/g,(k)=>{return O.push(k),`\x00BPSTXCODE${O.length-1}\x00`}).replace(/`[^`\n]*`/g,(k)=>{return O.push(k),`\x00BPSTXCODE${O.length-1}\x00`});z=await j.renderString(w,_,{injectCSS:!1,templateOnly:!0}),z=z.replace(/\u0000BPSTXCODE(\d+)\u0000/g,(k,x)=>O[Number(x)]??"")}catch(j){let O=j instanceof Error?j.message:String(j);throw Error(`Failed to render BunPress stx syntax: ${O}`,{cause:j})}let{content:B,tocHtml:F}=q("inlineToc")?M0(z,Z.toc):{content:z,tocHtml:""};z=q("codeImports")?await n(B,(j)=>D0(j,Q)):B,z=q("codeGroups")?await w0(z):z,z=await n(z,async(j)=>{let O=q("githubAlerts")?await T0(j):j;return O=q("containers")?await L0(O):O,O=q("emoji")?N0(O):O,O=q("badges")?R0(O):O,O});let{content:M,customAnchors:A}=q("customAnchors")?y0(z):{content:z,customAnchors:new Map};z=M;let D=new Map;z=q("codeBlocks")?await P0(z,D,{lineHighlighting:W("codeBlocks","lineHighlighting"),lineNumbers:W("codeBlocks","lineNumbers"),diffs:W("codeBlocks","diffs"),errorWarningMarkers:W("codeBlocks","errorWarningMarkers"),messagePreviews:q("messagePreviews")}):z;let I={tables:!0,strikethrough:!0,tasklists:!0,autolinks:!0,...P.markdown?.parserOptions??{}};if(Y.size){let j=new Set;for(let O=z.indexOf("]:");O!==-1;O=z.indexOf("]:",O+2))for(let w=z.lastIndexOf("[",O-1);w!==-1;w=w===0?-1:z.lastIndexOf("[",w-1)){let k=z.slice(w+1,O);if(j.has(k))continue;if(j.add(k),j.size>256)throw Error("Markdown include reference validation exceeded 256 candidate labels. Split the document or use inline links.");let x=`bunpress-reference-${sQ()}`,p=!1;if(Bun.markdown.render(`[${x}][${k}]
|
|
9648
|
+
|
|
9649
|
+
${z}`,{link(d){if(d===x)p=!0;return""}},I),p)throw Error("Markdown includes cannot be combined with reference definitions. Use inline links instead.")}}let R=Bun.markdown.html(z,I);if($)R=await lQ(R,$,Y);for(let[j,O]of D)R=R.replace(`<p>${j}</p>`,O),R=R.replace(j,O);if(q("inlineFormatting"))R=S0(R);if(q("tables"))R=k0(R,W("tables","enhancedStyling"),W("tables","responsive"),W("tables","alignment"));if(R=v0(R,A),F)R=I0(R,F);if(q("externalLinks")){if(W("externalLinks","autoTarget")||W("externalLinks","autoRel"))R=B0(R,W("externalLinks","autoTarget"),W("externalLinks","autoRel"));if(W("externalLinks","showIcon"))R=E0(R)}if(q("imageLazyLoading"))R=F0(R);for(let[j,O]of G)R=R.replace(`<p>${j}</p>`,()=>O),R=R.replace(j,()=>O);return R}async function C0(J={}){let Z=J.config||P,Q=J.port??3000,$=J.root||"./docs",Y=await xJ(vJ(Z),Z),X=Bun.serve({port:Q,async fetch(z){let _=new URL(z.url),K=tZ(Z,_.pathname);if(K==="/")K="/index";else if(K.length>1&&K.endsWith("/"))K=K.replace(/\/+$/,"");if(K===jJ.replace(/\.json$/,"")||_.pathname.endsWith(jJ)){let N=await dQ($,Z);return new Response(JSON.stringify(N),{headers:{"Content-Type":"application/json","Cache-Control":"no-store"}})}if([".png",".jpg",".jpeg",".gif",".svg",".css",".js",".ico",".woff",".woff2",".ttf"].some((N)=>K.endsWith(N)))try{let N=`${$}/public${K}`,B=Bun.file(N);if(await B.exists())return new Response(B);let F=`${$}${K}`,M=Bun.file(F);if(await M.exists())return new Response(M)}catch{}let{locale:V,path:U}=yQ(Y,K);try{let N=cQ(await mQ($),$,Y),B=N.findPage(V,U);if(B){let F=await Bun.file(B.sourceFile).text(),{html:M,frontmatter:A}=await x0(F,$,{page:B,catalog:N}),D=A.layout||"doc",I=await wQ(M,Z,U,D,A,{i18n:Y,locale:V,sourceFile:B.sourceFile,docsDir:$});return new Response(I,{headers:{"Content-Type":"text/html; charset=utf-8"}})}}catch{return new Response("Documentation page could not be rendered",{status:500})}return new Response(await wQ("<h1>404 - Page Not Found</h1><p>The page you are looking for does not exist.</p>",Z,K),{status:404,headers:{"Content-Type":"text/html; charset=utf-8"}})}}),q=`http://localhost:${X.port}`,W=()=>X.stop();if(!J.quiet)console.log(`
|
|
9642
9650
|
\uD83D\uDCDA BunPress documentation server running at ${q}`),console.log(`Press Ctrl+C to stop
|
|
9643
|
-
`);return{server:X,url:q,stop:W}}async function
|
|
9644
|
-
`);try{let
|
|
9645
|
-
Shutting down server...`),Z(),
|
|
9646
|
-
Shutting down server...`),Z(),
|
|
9647
|
-
export{
|
|
9651
|
+
`);return{server:X,url:q,stop:W}}async function L1(J={}){let{stop:Z}=await C0(J),Q=J.watch!==void 0?J.watch:!0,$=J.root||"./docs";if(Q){console.log(`Watching for changes in ${$} directory...
|
|
9652
|
+
`);try{let Y=new Map,X=new IQ("**/*.{md,stx,ts,js,css,html}");for await(let z of X.scan($))try{let _=UJ($,z),K=await DQ(_);Y.set(z,K.mtimeMs)}catch{}let q=null,W=()=>{if(q)clearTimeout(q);q=setTimeout(async()=>{console.log("File changed detected, reloading..."),_Q(),WQ(),rJ(),console.log("Ready for requests")},100)};setInterval(async()=>{try{let z=!1,_=new Set,K=new IQ("**/*.{md,stx,ts,js,css,html}");for await(let G of K.scan($)){_.add(G);try{let V=UJ($,G),U=await DQ(V),N=Y.get(G);if(N===void 0||U.mtimeMs>N)z=!0,Y.set(G,U.mtimeMs)}catch{}}for(let G of Y.keys())if(!_.has(G))z=!0,Y.delete(G);if(z)W()}catch{}},1000)}catch(Y){console.error("Error setting up file watcher:",Y)}}a.on("SIGINT",()=>{console.log(`
|
|
9653
|
+
Shutting down server...`),Z(),a.exit(0)}),a.on("SIGTERM",()=>{console.log(`
|
|
9654
|
+
Shutting down server...`),Z(),a.exit(0)}),await new Promise(()=>{})}
|
|
9655
|
+
export{g0 as a,aJ as b,nJ as c,tJ as d,WJ as e,d0 as f,eJ as g,m0 as h,c0 as i,t as j,tZ as k,wQ as l,x0 as m,C0 as n,L1 as o};
|