@stacksjs/bunpress 0.2.32 → 0.2.33
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.js +1 -1
- package/dist/{chunk-15vwh1bm.js → chunk-19em34hd.js} +1 -1
- package/dist/chunk-9kzche7g.js +2 -0
- package/dist/{chunk-f5ycxw18.js → chunk-dgdd6yma.js} +2 -2
- package/dist/{chunk-ttas3mc2.js → chunk-ds2b3vtw.js} +200 -125
- package/dist/{chunk-ebrg03kn.js → chunk-hnkqm0qx.js} +6 -6
- package/dist/{chunk-verdt5gx.js → chunk-nr19j5pk.js} +1 -1
- package/dist/{chunk-gn1n2yxt.js → chunk-twt99rzk.js} +1 -1
- package/dist/{chunk-5dtz0br7.js → chunk-zxfhq634.js} +2 -2
- package/dist/src/highlighter.d.ts +43 -1
- package/dist/src/hoist-styles.d.ts +3 -0
- package/dist/src/index.js +1 -1
- package/dist/src/long-page.d.ts +51 -0
- package/dist/src/minify-css.d.ts +1 -0
- package/dist/templates/layout-doc.stx +1 -1
- package/dist/templates/sidebar-section.stx +0 -192
- package/dist/templates/sidebar.stx +194 -0
- package/package.json +1 -1
- package/dist/chunk-fy78hg56.js +0 -2
|
@@ -1,15 +1,76 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$ as
|
|
3
|
-
`)}function
|
|
2
|
+
import{$ as YZ,A as cQ,C as y,F as QJ,G as nQ,H as BJ,I as tQ,J as eQ,K as rJ,L as sJ,N as JZ,O as QZ,P as ZZ,R as $Z,_ as EJ,aa as XZ,ba as iJ,ca as F,da as zZ,ea as WZ,fa as qZ}from"./chunk-dgdd6yma.js";import{ga as t,ha as MJ,ia as p,ja as lJ,ka as cJ,la as rQ,ma as sQ,oa as iQ,pa as mJ,qa as oQ,ra as aQ}from"./chunk-twt99rzk.js";var{Glob:pQ,YAML:uQ}=globalThis.Bun;import{randomUUID as KZ}from"crypto";import{stat as FJ}from"fs/promises";import{join as ZJ,resolve as e,sep as gQ}from"path";import JJ from"process";var{Glob:LZ}=globalThis.Bun;import{join as ZQ,resolve as AZ}from"path";import TZ from"process";var WJ=new Map;function HZ(J,Z,Q){let $=Z.split("."),Y=J;for(let X=0;X<$.length-1;X++){let W=$[X];if(typeof Y[W]!=="object"||Y[W]===null)Y[W]={};Y=Y[W]}Y[$[$.length-1]]=Q}async function $Q(J,Z){let Q=Z?AZ(TZ.cwd(),Z):ZQ(J,".data");if(WJ.has(Q))return WJ.get(Q);let $={};try{let Y=new LZ("**/*.json");for await(let X of Y.scan({cwd:Q,absolute:!1}))try{let W=await Bun.file(ZQ(Q,X)).text(),z=X.replace(/\.json$/,"").replace(/[/\\]/g,".");HZ($,z,JSON.parse(W))}catch{}}catch{}return WJ.set(Q,$),$}function YQ(){WJ.clear()}function XQ(J){return/(?:^|[\s>+~,(])(?:html)?\.dark(?![\w-])/.test(J)}function PZ(J){return yZ(J,",").map((Z)=>Z.trim()).filter((Z)=>Z&&XQ(Z)).map((Z)=>Z.replace(/^html\.dark(?![\w-])/,"html[data-theme-mode='auto']:not([data-bp-theme])").replace(/^\.dark(?![\w-])/,"html[data-theme-mode='auto']:not([data-bp-theme])").replace(/(?<=[\s>+~(])(?:html)?\.dark(?![\w-])/g,"html[data-theme-mode='auto']:not([data-bp-theme])")).join(`,
|
|
3
|
+
`)}function yZ(J,Z){let Q=[],$=0,Y=null,X=0;for(let W=0;W<J.length;W++){let z=J[W];if(Y){if(z==="\\")W++;else if(z===Y)Y=null;continue}if(z==='"'||z==="'"){Y=z;continue}if(z==="("||z==="["){$++;continue}if(z===")"||z==="]"){$--;continue}if(z===Z&&$===0)Q.push(J.slice(X,W)),X=W+1}return Q.push(J.slice(X)),Q}function kZ(J){let Z=[],Q=0,$=0;while(Q<J.length){let Y=J[Q];if(Y==="/"&&J[Q+1]==="*"){let X=J.indexOf("*/",Q+2);Q=X===-1?J.length:X+2;continue}if(Y==='"'||Y==="'"){let X=Y;Q++;while(Q<J.length&&J[Q]!==X){if(J[Q]==="\\")Q++;Q++}Q++;continue}if(Y==="{"){let X=1,W=Q+1;while(W<J.length&&X>0){let z=J[W];if(z==="/"&&J[W+1]==="*"){let q=J.indexOf("*/",W+2);W=q===-1?J.length:q+2;continue}if(z==='"'||z==="'"){let q=z;W++;while(W<J.length&&J[W]!==q){if(J[W]==="\\")W++;W++}W++;continue}if(z==="{")X++;else if(z==="}")X--;W++}if(X===0)Z.push({prelude:J.slice($,Q),body:J.slice(Q+1,W-1)});Q=W,$=Q;continue}if(Y===";"&&J.slice($,Q).trimStart().startsWith("@")){Q++,$=Q;continue}Q++}return Z}function qJ(J){let Z=[];for(let{prelude:Q,body:$}of kZ(J)){let Y=Q.replace(/\/\*[\s\S]*?\*\//g,"").trim();if(!Y||Y.startsWith("@")||!XQ(Y))continue;let X=PZ(Y);if(!X)continue;Z.push(`${X} {${$}}`)}if(!Z.length)return"";return["","/* Dark palette for a reader with no JavaScript to add the class it is"," * gated on. Generated from the dark rules above - see dark-mode-fallback.ts. */","@media (prefers-color-scheme: dark) {",Z.join(`
|
|
4
4
|
|
|
5
5
|
`),"}",""].join(`
|
|
6
|
-
`)}
|
|
7
|
-
|
|
6
|
+
`)}var i=new Map;function zQ(J){return J==="{"||J==="}"||J===";"||J===","}function m(J){let Z=i.get(J);if(Z!==void 0)return Z;let Q="",$=!1,Y=J.length,X=(z)=>{if($){let q=Q[Q.length-1],V=z[0];if(q!==void 0&&!zQ(q)&&!zQ(V)&&q!==":")Q+=" ";$=!1}if(z==="}"&&Q.endsWith(";"))Q=Q.slice(0,-1);Q+=z};for(let z=0;z<Y;z++){let q=J[z];if(q==="/"&&J[z+1]==="*"){let V=J.indexOf("*/",z+2);z=V===-1?Y:V+1,$=!0;continue}if(q==='"'||q==="'"){let V=z+1;while(V<Y&&J[V]!==q){if(J[V]==="\\")V++;V++}X(J.slice(z,V+1)),z=V;continue}if((q==="u"||q==="U")&&J.slice(z,z+4).toLowerCase()==="url("&&J[z+4]!=='"'&&J[z+4]!=="'"){let V=J.indexOf(")",z+4),K=V===-1?Y-1:V;X(J.slice(z,K+1)),z=K;continue}if(q===" "||q===`
|
|
7
|
+
`||q==="\t"||q==="\r"||q==="\f"){$=!0;continue}X(q)}let W=Q.trim();if(i.size>=32)i.delete(i.keys().next().value);return i.set(J,W),W}var KJ="data-bp-hoisted",SZ=/<script\b[^>]*>[\s\S]*?<\/script\s*>|<!--[\s\S]*?-->|<(svg|template|noscript|textarea|pre|iframe)\b[^>]*>[\s\S]*?<\/\1\s*>|<style\b([^>]*)>([\s\S]*?)<\/style\s*>/gi;function VJ(J){let Z=J.search(/<\/head\s*>/i);if(Z===-1)return J;let Q=new Set,$=[],Y=J.slice(Z).replace(SZ,(X,W,z,q)=>{if(q===void 0||!/^<style\b/i.test(X))return X;let V=(z??"").trim(),K=`${V}\x00${q.trim()}`;if(!Q.has(K)){if(Q.add(K),q.trim())$.push(`<style ${KJ}${V?` ${V}`:""}>${m(q)}</style>`)}return""});if($.length===0)return J;return`${J.slice(0,Z)}${$.join(`
|
|
8
|
+
`)}
|
|
9
|
+
${Y}`}var WQ="bp-doc--long";function qQ(J){return J.length>150000}var KQ=`
|
|
10
|
+
@supports (overflow-anchor: auto) {
|
|
11
|
+
.bp-doc--long > :nth-child(n + 41):is(p, ul, ol, pre, table, .table-responsive, div[class*="language-"]) {
|
|
12
|
+
content-visibility: auto;
|
|
13
|
+
contain-intrinsic-size: auto 96px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.bp-doc--long > :nth-child(n + 41):is(table, .table-responsive) {
|
|
17
|
+
contain-intrinsic-size: auto 240px;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`;import{createHighlighter as xZ,highlight as vZ,listLanguages as CZ}from"ts-syntax-highlighter";var o=null;function O1(){o=null}async function VQ(){if(o)return o;return o=await xZ({theme:"github-light",cache:!0}),o}var xJ=null;function GQ(){if(xJ)return xJ;let J=new Map;try{for(let Z of CZ()){J.set(Z.id.toLowerCase(),Z.id);for(let Q of Z.aliases??[])J.set(Q.toLowerCase(),Z.id)}}catch{}return xJ=J,J}var GJ={};function _Q(J){GJ={};for(let[Z,Q]of Object.entries(J??{}))GJ[Z.toLowerCase().trim()]=Q.toLowerCase().trim()}function UQ(J){let Z=J.toLowerCase().trim(),Q=GJ[Z]??Z;return GQ().get(Q)??Q}function OQ(J){let Z=J.toLowerCase().trim();return GQ().has(GJ[Z]??Z)}function _J(J){return J.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function bZ(J,Z){let Q=/<span[^>]*class="token[^"]*"[^>]*>([^<]*)<\/span>/g,$=[],Y;while((Y=Q.exec(Z))!==null){let z=Y[1].replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�*39;/g,"'");if(z)$.push({text:z,span:Y[0]})}if($.length===0)return Z;let X="",W=0;for(let z=0;z<$.length;z++){let{text:q,span:V}=$[z],K=J.indexOf(q,W);if(K===-1){X+=V;continue}if(K>W){let _=J.substring(W,K);if(/^\s+$/.test(_))X+=_}X+=V,W=K+q.length}return X}async function UJ(J,Z,Q="github-light"){let $=UQ(Z);if(!OQ($))return J.split(`
|
|
21
|
+
`).map((X)=>`<span class="line">${_J(X)}</span>`).join(`
|
|
8
22
|
`);try{let Y=J.split(`
|
|
9
|
-
`);return(await Promise.all(Y.map(async(
|
|
23
|
+
`);return(await Promise.all(Y.map(async(W)=>{if(!W.trim())return`<span class="line">${W}</span>`;let q=(await vZ(W,$,{theme:Q})).html;if(q=q.replace(/<div[^>]*class="syntax-wrapper"[^>]*>/g,""),q=q.replace(/<\/div>\s*$/g,""),q=q.replace(/<pre[^>]*>/g,""),q=q.replace(/<\/pre>/g,""),q=q.replace(/<code[^>]*>/g,""),q=q.replace(/<\/code>/g,""),q=bZ(W,q.trim()),!q.startsWith('<span class="line">'))q=`<span class="line">${q}</span>`;return q}))).join(`
|
|
10
24
|
`)}catch(Y){return console.warn(`Failed to highlight code for language "${Z}":`,Y),J.split(`
|
|
11
|
-
`).map((
|
|
12
|
-
`)}}function
|
|
25
|
+
`).map((W)=>`<span class="line">${_J(W)}</span>`).join(`
|
|
26
|
+
`)}}function j1(J,Z){let Q=UQ(Z);if(!OQ(Q))return _J(J);return _J(J)}var fZ={default:"#24292f",variable:"#953800",type:"#953800",function:"#7a3fd0",tag:"#116329",constant:"#0550ae",keyword:"#c5141f",string:"#0a3069",comment:"#5c636b",invalid:"#82071e"};function pZ(){let J=fZ;return`
|
|
27
|
+
/* Light palette over a dark inline theme (see lightPaletteForDarkInlineTheme). */
|
|
28
|
+
.token {
|
|
29
|
+
color: ${J.default} !important;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.token[class*='variable'] {
|
|
33
|
+
color: ${J.variable} !important;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.token[class*='entity-name-type'],
|
|
37
|
+
.token[class*='support-type'],
|
|
38
|
+
.token[class*='support-class'] {
|
|
39
|
+
color: ${J.type} !important;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.token[class*='entity-name-function'],
|
|
43
|
+
.token[class*='support-function'] {
|
|
44
|
+
color: ${J.function} !important;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.token[class*='entity-name-tag'],
|
|
48
|
+
.token[class*='markup-inserted'] {
|
|
49
|
+
color: ${J.tag} !important;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.token[class*='constant'],
|
|
53
|
+
.token[class*='entity-other-attribute'] {
|
|
54
|
+
color: ${J.constant} !important;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.token[class*='keyword'],
|
|
58
|
+
.token[class*='storage'] {
|
|
59
|
+
color: ${J.keyword} !important;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.token[class*='string'] {
|
|
63
|
+
color: ${J.string} !important;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.token[class*='comment'] {
|
|
67
|
+
color: ${J.comment} !important;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.token[class*='invalid'] {
|
|
71
|
+
color: ${J.invalid} !important;
|
|
72
|
+
}
|
|
73
|
+
`}function jQ(J="github-light"){return`${uZ()}${J==="github-light"?"":pZ()}`}function uZ(){return`
|
|
13
74
|
/* Basic syntax highlighting styles for ts-syntax-highlighter */
|
|
14
75
|
/* The actual theme colors are injected by ts-syntax-highlighter */
|
|
15
76
|
|
|
@@ -246,12 +307,12 @@ html.dark .token[class*='invalid'] {
|
|
|
246
307
|
html.dark .line-number {
|
|
247
308
|
color: #9ca3af;
|
|
248
309
|
}
|
|
249
|
-
`}async function
|
|
250
|
-
`)){if(!
|
|
310
|
+
`}async function N1(){await VQ()}async function R1(){return VQ()}import{stat as gZ}from"fs/promises";import{relative as NQ,resolve as n}from"path";import hZ from"process";var a=new Map;async function mZ(J){let Z=n(J);if(a.has(Z))return a.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 a.set(Z,null),null;let X=new Map,W="";for(let z of Y.split(`
|
|
311
|
+
`)){if(!z.trim())continue;if(/^\d{4}-\d{2}-\d{2}T/.test(z)){W=z.trim();continue}if(W&&!X.has(z))X.set(z,W)}return a.set(Z,X),X}catch{return a.set(Z,null),null}}async function RQ(J,Z){let Q=await mZ(J);if(Q){let $=NQ(n(J),n(Z)).replace(/\\/g,"/"),Y=Q.get($);if(Y)return Y}try{return(await gZ(Z)).mtime.toISOString()}catch{return null}}function BQ(J,Z,Q){let $=NQ(n(hZ.cwd(),Z),n(Q)).replace(/\\/g,"/");return J.includes(":path")?J.replace(":path",$):`${J.replace(/\/$/,"")}/${$}`}function EQ(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 vJ}from"path";var OJ=new Map,FQ="\x00BPCODE",MQ="\x00";async function DQ(J,Z){let Q=vJ(J,Z);if(OJ.has(Q))return OJ.get(Q);let $=[vJ(J,`${Z}.stx`),vJ(J,Z,"index.stx")],Y=null;for(let X of $){let W=Bun.file(X);if(await W.exists()){Y={source:await W.text(),path:X};break}}return OJ.set(Q,Y),Y}function IQ(){OJ.clear()}function dZ(J,Z){try{let Q=Object.keys(Z),$=Q.map((Y)=>Z[Y]);return Function(...Q,`"use strict"; return (${J});`)(...$)}catch{return}}function lZ(J,Z){let Q={};if(!J)return Q;let $=/([:@]?[\w-]+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]*)\}))?/g,Y;while(Y=$.exec(J)){let X=Y[1];if(!X)continue;let W=X.startsWith(":"),z=X.replace(/^[:@]/,""),q=Y[2],V=Y[3],K=Y[4],_=q??V??K;if(_===void 0)Q[z]=!0;else if(W||K!==void 0)Q[z]=dZ(_,Z);else Q[z]=_}return Q}async function CJ(J,Z,Q,$={},Y=0){if(Y>10||!J.includes("<"))return J;let X=[],W=J.replace(/```[\s\S]*?```/g,(G)=>{return X.push(G),`${FQ}${X.length-1}${MQ}`}).replace(/`[^`\n]*`/g,(G)=>{return X.push(G),`${FQ}${X.length-1}${MQ}`}),z=/<([A-Z][A-Za-z0-9]*)((?:\s[^>]*?)?)(\/?)>/g,q="",V=0,K=!1,_;while(_=z.exec(W)){let G=_[0],O=_[1],N=_[2],R=_[3],E=await DQ(Z,O)??($.fallbackComponentsDir?await DQ($.fallbackComponentsDir,O):null);if(E==null)continue;K=!0,q+=W.slice(V,_.index);let M="",I=_.index+G.length;if(!R){let B=new RegExp(`</${O}>`,"g");B.lastIndex=I;let U=B.exec(W);if(U)M=W.slice(I,U.index).trim(),I=U.index+U[0].length}let D=lZ(N.trim(),Q),w;try{let{renderTemplateString:B}=await import("@stacksjs/stx/render"),U=/<script\b[^>]*\bclient\b/.test(E.source);if(w=await B(E.source,E.path,{context:{...Q,...D,slot:M},options:{componentsDir:Z,fallbackComponentsDir:$.fallbackComponentsDir},injectCSS:U,templateOnly:!U}),U&&$.rendered){let j=`BPLIVECOMPONENT${$.rendered.size}END`;$.rendered.set(j,w),w=`
|
|
251
312
|
|
|
252
313
|
${j}
|
|
253
314
|
|
|
254
|
-
`}}catch(
|
|
315
|
+
`}}catch(B){let U=B instanceof Error?B.message:String(B);throw Error(`Failed to render BunPress component ${O}: ${U}`,{cause:B})}q+=w,V=I,z.lastIndex=I}if(q+=W.slice(V),q=q.replace(/\u0000BPCODE(\d+)\u0000/g,(G,O)=>X[Number(O)]??""),K)return CJ(q,Z,Q,$,Y+1);return q}import{join as AQ}from"path";var cZ=AQ(import.meta.dir,"templates"),jJ=new Map;async function rZ(J){if(jJ.has(J))return jJ.get(J);let Z=AQ(cZ,`${J}.stx`),Q=Bun.file(Z);if(!await Q.exists())throw Error(`Template not found: ${J}`);let $=await Q.text();return jJ.set(J,$),$}async function H(J,Z){let Q=await rZ(J);return sZ(Q,Z)}function TQ(){jJ.clear()}function sZ(J,Z){return J.replace(/\{!!\s*([\w.]+)\s*!!\}|\{\{\s*([\w.]+)\s*\}\}/g,(Q,$,Y)=>{if($!==void 0)return LQ(wQ(Z,$));return iZ(LQ(wQ(Z,Y)))})}function wQ(J,Z){return Z.split(".").reduce((Q,$)=>{if(Q==null||typeof Q!=="object")return;return Q[$]},J)}function LQ(J){if(J==null)return"";return String(J)}function iZ(J){return J.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var HQ=`/**
|
|
255
316
|
* VitePress Theme for BunPress - Layout & Chrome
|
|
256
317
|
* -------------------------------------------------------------------------- */
|
|
257
318
|
|
|
@@ -1570,7 +1631,7 @@ ${j}
|
|
|
1570
1631
|
padding: 20px 16px 56px;
|
|
1571
1632
|
}
|
|
1572
1633
|
}
|
|
1573
|
-
`;function
|
|
1634
|
+
`;function bJ(){return`
|
|
1574
1635
|
/* VitePress Theme for BunPress */
|
|
1575
1636
|
${`/**
|
|
1576
1637
|
* VitePress Theme for BunPress
|
|
@@ -5135,7 +5196,7 @@ ${`/**
|
|
|
5135
5196
|
border-radius: 0;
|
|
5136
5197
|
border: none;
|
|
5137
5198
|
}`}
|
|
5138
|
-
`}function
|
|
5199
|
+
`}function oZ(){return`/**
|
|
5139
5200
|
* VitePress Theme for BunPress
|
|
5140
5201
|
* Colors: Solid
|
|
5141
5202
|
* -------------------------------------------------------------------------- */
|
|
@@ -5780,7 +5841,7 @@ ${`/**
|
|
|
5780
5841
|
|
|
5781
5842
|
.bpi-corner-down-left {
|
|
5782
5843
|
--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");
|
|
5783
|
-
}`}function
|
|
5844
|
+
}`}function aZ(){return`/**
|
|
5784
5845
|
* VitePress Theme for BunPress - Base Styles
|
|
5785
5846
|
* -------------------------------------------------------------------------- */
|
|
5786
5847
|
|
|
@@ -6805,7 +6866,7 @@ mjx-container > svg {
|
|
|
6805
6866
|
.bp-doc .custom-block .bp-code-group .tabs {
|
|
6806
6867
|
margin: 0;
|
|
6807
6868
|
border-radius: 8px 8px 0 0;
|
|
6808
|
-
}`}function
|
|
6869
|
+
}`}function nZ(){return`/**
|
|
6809
6870
|
* VitePress Theme for BunPress - Custom Blocks
|
|
6810
6871
|
* -------------------------------------------------------------------------- */
|
|
6811
6872
|
|
|
@@ -7233,7 +7294,7 @@ mjx-container > svg {
|
|
|
7233
7294
|
|
|
7234
7295
|
.github-alert-caution .github-alert-icon {
|
|
7235
7296
|
fill: var(--bp-c-caution-1);
|
|
7236
|
-
}`}function
|
|
7297
|
+
}`}function tZ(){return`/**
|
|
7237
7298
|
* VitePress Theme for BunPress - Code Groups
|
|
7238
7299
|
* -------------------------------------------------------------------------- */
|
|
7239
7300
|
|
|
@@ -7374,7 +7435,7 @@ mjx-container > svg {
|
|
|
7374
7435
|
margin: 0;
|
|
7375
7436
|
border-radius: 0;
|
|
7376
7437
|
border: none;
|
|
7377
|
-
}`}var
|
|
7438
|
+
}`}var eZ={name:"vitepress",getCSS:bJ,getVars:oZ,getBase:aZ,getCustomBlocks:nZ,getCodeGroups:tZ},PQ=eZ;var yQ=`/**
|
|
7378
7439
|
* Bun Theme for BunPress
|
|
7379
7440
|
* Colors extracted from bun.sh
|
|
7380
7441
|
* -------------------------------------------------------------------------- */
|
|
@@ -7992,7 +8053,7 @@ mjx-container > svg {
|
|
|
7992
8053
|
|
|
7993
8054
|
.bpi-search {
|
|
7994
8055
|
--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='1.6'%3E%3Cpath d='m21 21l-4.34-4.34'/%3E%3Ccircle cx='11' cy='11' r='8' stroke-width='1.4'/%3E%3C/g%3E%3C/svg%3E");
|
|
7995
|
-
}`,
|
|
8056
|
+
}`,kQ=`/**
|
|
7996
8057
|
* Bun Theme for BunPress - Base Styles
|
|
7997
8058
|
* -------------------------------------------------------------------------- */
|
|
7998
8059
|
|
|
@@ -8791,7 +8852,7 @@ p {
|
|
|
8791
8852
|
.bp-doc .custom-block .bp-code-group .tabs {
|
|
8792
8853
|
margin: 0;
|
|
8793
8854
|
border-radius: 5px 5px 0 0;
|
|
8794
|
-
}`,
|
|
8855
|
+
}`,SQ=`/**
|
|
8795
8856
|
* Bun Theme for BunPress - Custom Blocks
|
|
8796
8857
|
* -------------------------------------------------------------------------- */
|
|
8797
8858
|
|
|
@@ -9155,7 +9216,7 @@ p {
|
|
|
9155
9216
|
|
|
9156
9217
|
.github-alert-caution .github-alert-icon {
|
|
9157
9218
|
fill: var(--bp-c-caution-1);
|
|
9158
|
-
}`,
|
|
9219
|
+
}`,xQ=`/**
|
|
9159
9220
|
* Bun Theme for BunPress - Code Groups
|
|
9160
9221
|
* -------------------------------------------------------------------------- */
|
|
9161
9222
|
|
|
@@ -9285,7 +9346,7 @@ p {
|
|
|
9285
9346
|
margin: 0;
|
|
9286
9347
|
border-radius: 0;
|
|
9287
9348
|
border: none;
|
|
9288
|
-
}`,
|
|
9349
|
+
}`,vQ=`/**
|
|
9289
9350
|
* Bun Theme for BunPress - Extra Bun-specific styles
|
|
9290
9351
|
* -------------------------------------------------------------------------- */
|
|
9291
9352
|
|
|
@@ -9439,35 +9500,35 @@ p {
|
|
|
9439
9500
|
|
|
9440
9501
|
.interactive-hover:hover {
|
|
9441
9502
|
transform: scale(1.06);
|
|
9442
|
-
}`;function
|
|
9503
|
+
}`;function CQ(){return`
|
|
9443
9504
|
/* Bun Theme for BunPress */
|
|
9444
9505
|
/* Colors extracted from bun.sh */
|
|
9445
|
-
${
|
|
9446
|
-
${
|
|
9447
|
-
${
|
|
9448
|
-
${
|
|
9449
|
-
${
|
|
9450
|
-
${
|
|
9451
|
-
`}function
|
|
9506
|
+
${yQ}
|
|
9507
|
+
${kQ}
|
|
9508
|
+
${HQ}
|
|
9509
|
+
${SQ}
|
|
9510
|
+
${xQ}
|
|
9511
|
+
${vQ}
|
|
9512
|
+
`}function J0(){return yQ}function Q0(){return kQ}function Z0(){return SQ}function $0(){return xQ}function Y0(){return vQ}var X0={name:"bun",getCSS:CQ,getVars:J0,getBase:Q0,getCustomBlocks:Z0,getCodeGroups:$0,getExtras:Y0},bQ=X0;var z0={vitepress:PQ,bun:bQ};function fQ(J="vitepress"){let Z=z0[J];if(!Z)return console.warn(`[BunPress] Unknown theme: ${J}, falling back to vitepress`),bJ();return Z.getCSS()}async function W0(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 W=Object.keys(Q).sort((z,q)=>q.length-z.length).find((z)=>Z.startsWith(z))||"/";$=Q[W]||[]}let Y=await Promise.all($.map(async(X)=>{if(X.link){let{html:q}=dJ(J,[X],Z,0);return await H("sidebar-section",{heading:"",items:q,collapsedClass:""})}let{html:W,active:z}=X.items?dJ(J,X.items,Z,0):{html:"",active:!1};return await H("sidebar-section",{heading:await H("sidebar-section-heading",{title:X.text}),items:W,collapsedClass:X.collapsed&&!z?" collapsed":""})}));return await H("sidebar",{sections:Y.join("")})}function dJ(J,Z,Q,$){let Y=!1;return{html:Z.map((W)=>{let z=!!W.link&&W.link===Q;if(W.items?.length){let K=dJ(J,W.items,Q,$+1),_=z||K.active;Y||=_;let G=W.collapsed&&!_,O=W.link?`<a class="BPSidebarGroup-link${z?" is-active":""}" href="${d(J,W.link)}">${W.text}</a>`:`<span class="BPSidebarGroup-text">${W.text}</span>`;return`<li class="BPSidebarGroup${G?" collapsed":""}${_?" has-active":""}" style="--bp-sidebar-depth:${$}"><div class="BPSidebarGroup-head">${O}<button class="BPSidebarGroup-toggle" type="button" aria-expanded="${G?"false":"true"}" aria-label="Toggle ${W.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||=z;let q=d(J,W.link||"/");return`<li style="--bp-sidebar-depth:${$}"><a class="${z?"BPSidebarItem-link is-active":"BPSidebarItem-link"}" href="${q}">${W.text}</a></li>`}).join(""),active:Y}}_Q(y.markdown?.languageAliases);var q0=`<button class="BPNavBarHamburger" type="button" aria-label="Toggle navigation" onclick="toggleSidebar()">
|
|
9452
9513
|
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
|
|
9453
9514
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
|
|
9454
9515
|
</svg>
|
|
9455
|
-
</button>`,
|
|
9516
|
+
</button>`,K0=`<button class="BPNavToggle" type="button" aria-label="Menu" aria-expanded="false" aria-controls="bp-nav-screen" onclick="toggleNavScreen()">
|
|
9456
9517
|
<svg class="BPNavToggle-open" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
|
|
9457
9518
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 7h16M4 12h16M4 17h16"></path>
|
|
9458
9519
|
</svg>
|
|
9459
9520
|
<svg class="BPNavToggle-close" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
|
|
9460
9521
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 6l12 12M18 6L6 18"></path>
|
|
9461
9522
|
</svg>
|
|
9462
|
-
</button>`;function
|
|
9523
|
+
</button>`;function V0(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 G0(J,Z){let{hint:Q,aria:$}=V0(Z),Y=F(J);return`<button class="BPNavBarSearch" type="button" aria-label="${Y}"${$?` aria-keyshortcuts="${F($)}"`:""}>
|
|
9463
9524
|
<svg class="BPNavBarSearch-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
|
|
9464
9525
|
<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>
|
|
9465
9526
|
</svg>
|
|
9466
9527
|
<span class="BPNavBarSearch-label">${Y}</span>
|
|
9467
9528
|
${Q?`<kbd class="BPNavBarSearch-kbd" data-hint="${F(Q)}" aria-hidden="true"></kbd>`:""}
|
|
9468
|
-
</button>`}var
|
|
9469
|
-
`)}async function
|
|
9470
|
-
`);return{aside:await H("page-toc",{items:
|
|
9529
|
+
</button>`}var _0={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 U0(J){return(J.themeConfig?.socialLinks??[]).map(({icon:Q,link:$})=>{let Y=_0[Q?.toLowerCase()],X=Q?Q.charAt(0).toUpperCase()+Q.slice(1):"Link",W=Y?`<svg fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">${Y}</svg>`:`<span class="BPSocialLinks-text">${F(X)}</span>`;return`<a href="${F($)}" target="_blank" rel="noopener external" aria-label="${F(X)}">${W}</a>`}).join(`
|
|
9530
|
+
`)}async function O0(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 z=Number.parseInt(X[1]),q=X[2],V=X[3];V=V.replace(/<[^>]*>/g,"");let K=q.match(/id="([^"]*)"/),_=K?K[1]:V.toLowerCase().replace(/\s+/g,"-").replace(/[^\w-]/g,"");Y.push({level:z,text:V,id:_})}if(Y.length===0)return{aside:"",inline:""};let W=Y.map((z)=>{let q=z.level>2?`level-${z.level}`:"";return`<a href="#${z.id}" class="${q}">${z.text}</a>`}).join(`
|
|
9531
|
+
`);return{aside:await H("page-toc",{items:W,title:Z}),inline:await H("page-outline",{items:W,count:String(Y.length),title:Z})}}function j0(J){let Z=new Set;return J.replace(/<h([1-6])([^>]*)>(.*?)<\/h\1>/g,(Q,$,Y,X)=>{if(Y.includes("id=")){let V=Y.match(/\bid=["']([^"']+)["']/)?.[1];if(V)Z.add(V);return Q}let W=X.match(/\s*\{#([\w-]+)\}\s*$/),z,q=X;if(W)z=W[1],q=X.replace(/\s*\{#[\w-]+\}\s*$/,"");else{let V=X.replace(/<[^>]*>/g,"");z=rJ(V)}return z=sJ(z,Z),`<h${$}${Y} id="${z}">${q}</h${$}>`})}function N0(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 fJ(J,Z=""){let Q=B0(Z),$=J.lastIndexOf("</body>");if($===-1)return J+Q;return J.slice(0,$)+Q+J.slice($)}function pJ(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)}var R0="<script>try{var m=document.documentElement.getAttribute('data-theme-mode');if(m!=='dark'&&m!=='light'){var t=localStorage.getItem('bunpress-theme');if(t==='dark'||t==='light'){document.documentElement.setAttribute('data-bp-theme',t);if(t==='dark')document.documentElement.classList.add('dark');else document.documentElement.classList.remove('dark')}}}catch(e){}</script>";function uJ(J){let Z=J.indexOf("</head>");if(Z===-1)return J;return J.slice(0,Z)+R0+J.slice(Z)}function B0(J=""){return`<script data-bp-router="1">
|
|
9471
9532
|
(function(){
|
|
9472
9533
|
// The site's mount point ('/docs'). Links are written with it; the page can
|
|
9473
9534
|
// be reached without it (the dev server answers both), so paths are compared
|
|
@@ -9700,6 +9761,19 @@ ${LQ}
|
|
|
9700
9761
|
newStyles.forEach(function(s) { document.head.appendChild(s.cloneNode(true)); });
|
|
9701
9762
|
}
|
|
9702
9763
|
|
|
9764
|
+
// Component styles live in the head now (hoistComponentStyles), so they
|
|
9765
|
+
// no longer travel with the markup swapped above. A page reached by
|
|
9766
|
+
// navigation may use a component this document has never rendered: its
|
|
9767
|
+
// styles are added here. Nothing is removed - a block for a component
|
|
9768
|
+
// that is no longer on screen matches nothing and costs nothing.
|
|
9769
|
+
var haveStyles = {};
|
|
9770
|
+
document.querySelectorAll('style[${KJ}]').forEach(function(s) { haveStyles[s.textContent] = true; });
|
|
9771
|
+
doc.querySelectorAll('style[${KJ}]').forEach(function(s) {
|
|
9772
|
+
if (haveStyles[s.textContent]) return;
|
|
9773
|
+
haveStyles[s.textContent] = true;
|
|
9774
|
+
document.head.appendChild(s.cloneNode(true));
|
|
9775
|
+
});
|
|
9776
|
+
|
|
9703
9777
|
lastPathname = target.pathname;
|
|
9704
9778
|
lastSearch = target.search;
|
|
9705
9779
|
updateActiveLinks();
|
|
@@ -9789,17 +9863,17 @@ ${LQ}
|
|
|
9789
9863
|
|
|
9790
9864
|
updateActiveLinks();
|
|
9791
9865
|
})();
|
|
9792
|
-
<`+"/script>"}var
|
|
9866
|
+
<`+"/script>"}var VZ=`<svg class="chevron" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
|
|
9793
9867
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
|
|
9794
|
-
</svg>`;function
|
|
9868
|
+
</svg>`;function GZ(J){return J.themeConfig?.nav||J.markdown?.nav||J.nav||[]}function _Z(J){if(typeof J.mega==="boolean")return J.mega;return(J.items??[]).some((Z)=>!!Z.description||(Z.items?.length??0)>0)}function UZ(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 E0(J,Z=""){let Q=GZ(J);if(Q.length===0)return"";let $=(K)=>{return d(J,K||"/")},Y=(K)=>OZ(K,Z),X=(K)=>Y(K)||(K.items??[]).some((_)=>X(_)),W=(K)=>{let _=K.icon?`<span class="BPMega-item-icon" aria-hidden="true">${K.icon}</span>`:"",G=K.description?`<span class="BPMega-item-desc">${K.description}</span>`:"";return`<a class="BPMega-item${Y(K)?" is-active":""}" href="${F($(K.link))}">
|
|
9795
9869
|
${_}
|
|
9796
9870
|
<span class="BPMega-item-body">
|
|
9797
9871
|
<span class="BPMega-item-title">${K.text}</span>
|
|
9798
9872
|
${G}
|
|
9799
9873
|
</span>
|
|
9800
|
-
</a>`},
|
|
9801
|
-
${
|
|
9802
|
-
${
|
|
9874
|
+
</a>`},z=(K)=>{let _=UZ(K),G=Math.max(1,Math.min(K.columns??_.length,4)),O=_.map((R)=>{return`<div class="BPMega-group">
|
|
9875
|
+
${R.text?`<p class="BPMega-group-title">${R.text}</p>`:""}
|
|
9876
|
+
${R.items.map(W).join(`
|
|
9803
9877
|
`)}
|
|
9804
9878
|
</div>`}).join(`
|
|
9805
9879
|
`),N=K.footer?`<div class="BPMega-footer">
|
|
@@ -9812,34 +9886,34 @@ ${LQ}
|
|
|
9812
9886
|
${N}
|
|
9813
9887
|
</div>`},q=(K)=>`<div class="BPNavBarMenu-group-items">
|
|
9814
9888
|
${(K.items??[]).map((_)=>`<a href="${F($(_.link))}"${Y(_)?' class="is-active"':""}>${_.text}</a>`).join("")}
|
|
9815
|
-
</div>`;return Q.map((K)=>{if(K.items&&K.items.length>0){let G=
|
|
9889
|
+
</div>`;return Q.map((K)=>{if(K.items&&K.items.length>0){let G=_Z(K),O=X(K)?" is-active":"";return`<div class="BPNavBarMenu-group${G?" is-mega":""}${O}">
|
|
9816
9890
|
<button class="BPNavBarMenu-group-button" type="button" aria-expanded="false" aria-haspopup="true">
|
|
9817
9891
|
<span>${K.text}</span>
|
|
9818
|
-
${
|
|
9892
|
+
${VZ}
|
|
9819
9893
|
</button>
|
|
9820
|
-
${G?
|
|
9821
|
-
</div>`}return`<a class="BPNavBarMenu-link${Y(K)?" is-active":""}" href="${F($(K.link))}">${K.text}</a>`}).join("")}function
|
|
9822
|
-
<nav class="BPNavScreen-nav" aria-label="Site">${Q.map((
|
|
9823
|
-
<summary class="BPNavScreen-summary">${
|
|
9894
|
+
${G?z(K):q(K)}
|
|
9895
|
+
</div>`}return`<a class="BPNavBarMenu-link${Y(K)?" is-active":""}" href="${F($(K.link))}">${K.text}</a>`}).join("")}function OZ(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 F0(J,Z=""){let Q=GZ(J);if(Q.length===0)return"";let $=(z)=>d(J,z||"/"),Y=(z)=>OZ(z,Z),X=(z,q)=>`<a class="${q}${Y(z)?" is-active":""}" href="${F($(z.link))}">${z.text}</a>`;return`<div class="BPNavScreen" id="bp-nav-screen" hidden>
|
|
9896
|
+
<nav class="BPNavScreen-nav" aria-label="Site">${Q.map((z)=>{if(!z.items||z.items.length===0)return`<div class="BPNavScreen-section">${X(z,"BPNavScreen-link")}</div>`;let V=(_Z(z)?UZ(z):[{items:z.items}]).map((K)=>{return`${K.text?`<p class="BPNavScreen-subtitle">${K.text}</p>`:""}${K.items.map((G)=>X(G,"BPNavScreen-link")).join("")}`}).join("");return`<details class="BPNavScreen-section"${(z.items??[]).some((K)=>Y(K))?" open":""}>
|
|
9897
|
+
<summary class="BPNavScreen-summary">${z.text}${VZ}</summary>
|
|
9824
9898
|
<div class="BPNavScreen-items">${V}</div>
|
|
9825
9899
|
</details>`}).join("")}</nav>
|
|
9826
|
-
</div>`}function
|
|
9827
|
-
`)}function
|
|
9828
|
-
`)}function
|
|
9900
|
+
</div>`}function hQ(J,Z){let Q=p(J);if(!Q)return Z;if(Z===Q||Z.startsWith(`${Q}/`))return Z.slice(Q.length)||"/";return Z}function d(J,Z){let Q=p(J);if(!Q||!Z.startsWith("/")||Z.startsWith("//"))return Z;if(Z===Q||Z.startsWith(`${Q}/`))return Z;return Z==="/"?`${Q}/`:`${Q}${Z}`}function gJ(J,Z){return J.replace(/\b(href|src|action)="(\/[^"]*)"/g,(Q,$,Y)=>{let X=d(Z,Y);return X===Y?Q:`${$}="${X}"`})}function DJ(J){if(J==="/index")return"/";return J.endsWith("/index")?J.slice(0,-6):J}function M0(J,Z,Q){if(Q)return`<link rel="canonical" href="${F(Q)}">`;let $=MJ(J);if(!$)return"";let Y=DJ(Z);return`<link rel="canonical" href="${$}${Y}">`}function D0(J,Z,Q,$,Y){let X=MJ(Q);if(!X)return"";let W=DJ($),z=`${X}${W}`,q=Q.title||Q.markdown?.title||J,V=Y||Q.markdown?.meta?.["og:image"]||Q.markdown?.meta?.ogImage,K=['<meta property="og:type" content="website">',`<meta property="og:url" content="${z}">`,`<meta property="og:title" content="${F(J)}">`,`<meta property="og:description" content="${F(Z)}">`,`<meta property="og:site_name" content="${F(q)}">`];if(V){K.push(`<meta property="og:image" content="${V}">`);let _=Q.markdown?.meta??{};for(let G of["og:image:width","og:image:height","og:image:type","og:image:alt"]){let O=_[G];if(O!==void 0&&O!==null&&O!=="")K.push(`<meta property="${G}" content="${O}">`)}}return K.join(`
|
|
9901
|
+
`)}function I0(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,W=$||Q.markdown?.meta?.["twitter:image"]||Q.markdown?.meta?.twitterImage||Q.markdown?.meta?.["og:image"]||Q.markdown?.meta?.ogImage,z=[`<meta name="twitter:card" content="${Y}">`,`<meta name="twitter:title" content="${F(J)}">`,`<meta name="twitter:description" content="${F(Z)}">`];if(X)z.push(`<meta name="twitter:site" content="${X}">`);if(W){z.push(`<meta name="twitter:image" content="${W}">`);let q=Q.markdown?.meta?.["twitter:image:alt"]??Q.markdown?.meta?.["og:image:alt"];if(q!==void 0&&q!==null&&q!=="")z.push(`<meta name="twitter:image:alt" content="${q}">`)}return z.join(`
|
|
9902
|
+
`)}function w0(J,Z,Q,$){let Y=MJ(Q);if(!Y)return"";let X=DJ($),W=`${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">
|
|
9829
9903
|
${JSON.stringify(K,null,2)}
|
|
9830
|
-
</script>`}let
|
|
9831
|
-
${JSON.stringify(
|
|
9904
|
+
</script>`}let z={"@context":"https://schema.org","@type":"TechArticle",headline:J,description:Z,url:W},q=X.split("/").filter(Boolean),V=q.map((K,_)=>{let G=_+1,O=`${Y}/${q.slice(0,G).join("/")}`;return{"@type":"ListItem",position:G,name:K.replace(/-/g," ").replace(/\b\w/g,(N)=>N.toUpperCase()),item:O}});if(V.length>0){let K={"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:V};return`<script type="application/ld+json">
|
|
9905
|
+
${JSON.stringify(z,null,2)}
|
|
9832
9906
|
</script>
|
|
9833
9907
|
<script type="application/ld+json">
|
|
9834
9908
|
${JSON.stringify(K,null,2)}
|
|
9835
9909
|
</script>`}return`<script type="application/ld+json">
|
|
9836
|
-
${JSON.stringify(
|
|
9837
|
-
</script>`}function
|
|
9910
|
+
${JSON.stringify(z,null,2)}
|
|
9911
|
+
</script>`}function L0(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((z)=>`family=${z.trim().replace(/\s+/g,"+")}`).join("&"),W=Z.display??"swap";Q.push(`<link href="https://fonts.googleapis.com/css2?${X}&display=${W}" rel="stylesheet">`)}let Y=(Z.faces??[]).map((X)=>X.trim()).filter(Boolean).join(`
|
|
9838
9912
|
`);return{fontLinks:Q.join(`
|
|
9839
|
-
`),fontFaceCss:Y}}function
|
|
9913
|
+
`),fontFaceCss:Y}}function A0(J){let Z={...J.markdown?.themeConfig,...J.themeConfig},Q=[],$=(z,q)=>{if(q)Q.push(` ${z}: ${q};`)},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[z,q]of Object.entries(Z.cssVars??{}))$(z.startsWith("--")?z:`--${z}`,q);let W=[];if(Q.length)W.push(`:root {
|
|
9840
9914
|
${Q.join(`
|
|
9841
9915
|
`)}
|
|
9842
|
-
}`);if(X.heading)
|
|
9916
|
+
}`);if(X.heading)W.push(`.bp-doc h1,
|
|
9843
9917
|
.bp-doc h2,
|
|
9844
9918
|
.bp-doc h3,
|
|
9845
9919
|
.bp-doc h4,
|
|
@@ -9847,46 +9921,47 @@ ${Q.join(`
|
|
|
9847
9921
|
.bp-doc h6,
|
|
9848
9922
|
.BPHero-text {
|
|
9849
9923
|
font-family: ${X.heading};
|
|
9850
|
-
}`);if(Z.css)
|
|
9851
|
-
|
|
9852
|
-
`)}function
|
|
9853
|
-
`)}}function
|
|
9854
|
-
`),{fontLinks:x,fontFaceCss:
|
|
9855
|
-
`),g=[
|
|
9856
|
-
`),
|
|
9857
|
-
`)||""
|
|
9858
|
-
`),b=
|
|
9859
|
-
`)}):"",
|
|
9860
|
-
${b}`),C=`${
|
|
9861
|
-
${
|
|
9862
|
-
${T}
|
|
9863
|
-
${OJ}
|
|
9924
|
+
}`);if(Z.css)W.push(Z.css);return W.join(`
|
|
9925
|
+
|
|
9926
|
+
`)}function T0(J,Z,Q,$){let Y=Z.match(/<h1(?:\s[^>]*)?>([\s\S]*?)<\/h1>/),X=Y?iJ(Y[1].replace(/<[^>]+>/g,"")).trim():"",W=typeof J.title==="string"&&J.title.trim()||X||Q,z=W&&W!==Q?`${W} | ${Q}`:Q,q=typeof J.description==="string"&&J.description.trim()||$.description||$.markdown?.meta?.description||"Documentation built with BunPress",V=[],K=(N)=>{V.push(N)},_=J.keywords;if(_){let N=Array.isArray(_)?_.join(", "):String(_);if(N.trim())K(`<meta name="keywords" content="${F(N)}">`)}if(typeof J.author==="string"&&J.author.trim())K(`<meta name="author" content="${F(J.author)}">`);if(typeof J.robots==="string"&&J.robots.trim())K(`<meta name="robots" content="${F(J.robots)}">`);if(J.meta&&typeof J.meta==="object")for(let[N,R]of Object.entries(J.meta)){if(R===void 0||R===null)continue;let E=N.startsWith("og:")?"property":"name";K(`<meta ${E}="${F(N)}" content="${F(String(R))}">`)}for(let N of jZ(J.head))K(N);let G=typeof J.image==="string"?J.image:void 0,O=typeof J.canonical==="string"?J.canonical:void 0;return{documentTitle:z,pageTitle:W,description:q,image:G,canonical:O,extraTags:V.join(`
|
|
9927
|
+
`)}}function jZ(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(([W,z])=>`${F(W)}="${F(String(z))}"`).join(" ");Z.push(`<${$.toLowerCase()}${X?` ${X}`:""}>`)}return Z}async function H0(J,Z,Q,$,Y){let X=J.themeConfig,W="",z="",q=X?.editLink?.pattern;if(q&&Y&&Z.editLink!==!1){let O=BQ(q,$,Y),N=X?.editLink?.text??"Edit this page";W=`<a class="BPDocFooter-edit" href="${F(O)}" 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>${F(N)}</a>`}let V=X?.lastUpdated,K=Z.lastUpdated!==!1,_=V!==void 0&&V!==!1,G=typeof Z.lastUpdated==="string"?Z.lastUpdated:void 0;if(K&&(_||Z.lastUpdated===!0||G)){let O=G??(Y?await RQ($,Y):null);if(O){let N=typeof V==="object"?V:{},R=EQ(O,Q,N.formatOptions);if(R){let E=N.text??"Last updated";z=`<p class="BPDocFooter-updated">${F(E)}: <time datetime="${F(O)}">${F(R)}</time></p>`}}}if(!W&&!z)return"";return H("doc-footer",{editLink:W,lastUpdated:z})}async function mQ(J,Z,Q,$="doc",Y={},X={}){let{i18n:W,locale:z,sourceFile:q,docsDir:V=Z.docsDir||"./docs"}=X,K=W??await cJ(lJ(Z),Z),_=z||K.defaultLocale,G=iQ(Z,K,_),O=(L)=>K.translate(L,_),N=G.title||G.themeConfig?.siteTitle||G.markdown?.title||"BunPress Documentation",R=T0(Y,J,N,G),E=R.documentTitle,M=R.description,I=G.theme||"vitepress",D=fQ(I),w=jQ(G.markdown?.syntaxHighlightTheme),B=cQ.markdown?.css||"",U=G.markdown?.css||"",j=U&&U!==B?U:"",A=A0(G),S=M0(G,Q,R.canonical),v=D0(R.pageTitle,M,G,Q,R.image),u=I0(R.pageTitle,M,G,R.image),l=w0(R.pageTitle,M,G,Q),oJ=Object.entries(G.markdown?.meta||{}).filter(([L])=>!L.startsWith("og:")&&!L.startsWith("twitter:")&&L!=="description"&&L!=="ogImage"&&L!=="twitterCard"&&L!=="twitterSite"&&L!=="twitterImage").map(([L,C])=>`<meta name="${L}" content="${C}">`).join(`
|
|
9928
|
+
`),{fontLinks:x,fontFaceCss:P}=L0(G),T=oQ(K,G,Q),IJ=jZ(G.head).join(`
|
|
9929
|
+
`),g=[oJ,IJ,S,T,v,u,R.extraTags,x].filter(Boolean).join(`
|
|
9930
|
+
`),wJ=y0(G),LJ=k0(G),AJ=G.markdown?.scripts?.map((L)=>`<script>${L}</script>`).join(`
|
|
9931
|
+
`)||"",$J=aQ(K),k=[l,wJ,LJ,AJ,$J?`<script>${$J}</script>`:""].filter(Boolean).join(`
|
|
9932
|
+
`),b=E0(G,Q),c=G.search??G.markdown?.search,r=c?.enabled!==!1,YJ=c?.algolia,aJ=c?.provider==="algolia"&&!!YJ?.appId&&!!YJ?.apiKey&&!!YJ?.indexName,f=YZ(G,d(G,EJ));if(!G.search?.placeholder&&!G.markdown?.search?.placeholder)f.placeholder=O("search.placeholder");f.locale=K.enabled?_:null;let TJ=r?await H(aJ?"search-algolia":"search",{placeholder:f.placeholder,runtimeConfig:JSON.stringify(aJ?{...f,algolia:YJ}:f).replace(/</g,"\\u003c")}):"",h=G.themeConfig?.footer,HJ=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>`:""}):"",BZ=K.enabled?await H("locale-switcher",{label:O("nav.menu"),current:mJ(K,_),options:K.locales.map((L)=>{let C=sQ(K,L,DJ(Q)),s=L===_?' aria-current="true"':"";return`<li><a href="${F(C)}" data-locale="${F(L)}"${s}>${F(mJ(K,L))}</a></li>`}).join(`
|
|
9933
|
+
`)}):"",EZ=G.themeConfig?.logo?`<img class="BPNavBarTitle-logo" src="${F(G.themeConfig.logo)}" alt="">`:"",nJ=F0(G,Q),PJ=async(L)=>Y.navbar===!1?"":H("navbar",{title:N,logo:EZ,localeSwitcher:BZ,nav:b,navScreen:L==="doc"?"":nJ,navToggle:L==="doc"||!nJ?"":K0,searchTrigger:r?G0(f.placeholder,f.shortcuts):"",hamburger:L==="doc"?q0:"",socialLinks:U0(G)}),XJ=G.darkMode??G.themeConfig?.darkMode??"auto",zJ=XJ===!0||XJ==="dark"?"dark":XJ===!1||XJ==="light"?"light":"auto",yJ=zJ==="dark"?"dark":"";if($==="home"){let L=await hJ(`${J}
|
|
9934
|
+
${b}`),C=`${P}
|
|
9935
|
+
${D}
|
|
9864
9936
|
${w}
|
|
9865
|
-
${
|
|
9937
|
+
${BJ}
|
|
9938
|
+
${L}
|
|
9939
|
+
${B}
|
|
9866
9940
|
${j}
|
|
9867
|
-
${
|
|
9868
|
-
${
|
|
9869
|
-
${b}`),C=`${
|
|
9870
|
-
${
|
|
9871
|
-
${T}
|
|
9872
|
-
${OJ}
|
|
9941
|
+
${A}`,s=m(`${C}
|
|
9942
|
+
${qJ(C)}`),SJ=await H("layout-home",{htmlClass:yJ,themeMode:zJ,lang:_,title:N,documentTitle:E,description:M,meta:g,customCSS:s,navbar:await PJ("plain"),search:TJ,footer:HJ,content:J});return gJ(fJ(uJ(pJ(VJ(SJ),k)),p(G)),G)}if($==="page"){let L=await hJ(`${J}
|
|
9943
|
+
${b}`),C=`${P}
|
|
9944
|
+
${D}
|
|
9873
9945
|
${w}
|
|
9874
|
-
${
|
|
9946
|
+
${BJ}
|
|
9947
|
+
${L}
|
|
9948
|
+
${B}
|
|
9875
9949
|
${j}
|
|
9876
|
-
${
|
|
9877
|
-
${
|
|
9950
|
+
${A}`,s=m(`${C}
|
|
9951
|
+
${qJ(C)}`),SJ=await H("layout-page",{htmlClass:yJ,themeMode:zJ,lang:_,title:N,documentTitle:E,description:M,meta:g,customCSS:s,navbar:await PJ("plain"),search:TJ,footer:HJ,content:J});return gJ(fJ(uJ(pJ(VJ(SJ),k)),p(G)),G)}let tJ=j0(J),eJ=await O0(tJ,O("toc.title")),JQ=await W0(G,Q),kJ=N0(tJ,await H("copy-page",{}),eJ.inline),FZ=eJ.aside,MZ=await hJ(`${kJ}
|
|
9878
9952
|
${b}
|
|
9879
|
-
${
|
|
9880
|
-
${
|
|
9881
|
-
${
|
|
9882
|
-
${
|
|
9883
|
-
${
|
|
9884
|
-
${
|
|
9953
|
+
${JQ}`),QQ=`${P}
|
|
9954
|
+
${D}
|
|
9955
|
+
${w}
|
|
9956
|
+
${BJ}
|
|
9957
|
+
${MZ}
|
|
9958
|
+
${B}
|
|
9959
|
+
${KQ}
|
|
9885
9960
|
${j}
|
|
9886
|
-
${
|
|
9887
|
-
${
|
|
9888
|
-
catch (err){l('Outbound error',err);}});`:"",
|
|
9889
|
-
<script data-site="${Q}"${
|
|
9961
|
+
${A}`,DZ=m(`${QQ}
|
|
9962
|
+
${qJ(QQ)}`),IZ=await H0(G,Y,_,V,q),wZ=await H("layout-doc",{htmlClass:yJ,themeMode:zJ,lang:_,title:N,documentTitle:E,description:M,meta:g,customCSS:DZ,docClass:qQ(kJ)?` ${WQ}`:"",navbar:await PJ("doc"),search:TJ,docFooter:IZ,footer:HJ,sidebar:Y.sidebar===!1?"":JQ,content:kJ,pageTOC:FZ});return gJ(fJ(uJ(pJ(VJ(wZ),k)),p(G)),G)}var NJ=null,dQ=!1;async function P0(){if(dQ)return NJ;dQ=!0;try{NJ=await import("@cwcss/crosswind")}catch{NJ=null}return NJ}async function hJ(J){let Z=await P0();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 y0(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,W=J.fathom.spa||!1,z=[`data-site="${J.fathom.siteId}"`,$?'data-honor-dnt="true"':"",!Y?'data-auto="false"':"",X?`data-canonical="${X}"`:"",W?'data-spa="auto"':""].filter(Boolean).join(" ");return`<script src="${Z}" ${z}${Q?" defer":""}></script>`}function k0(J){let Z=J.analytics||J.selfHostedAnalytics;if(!Z?.enabled||!Z?.siteId)return"";let Q=RJ(Z.siteId);if(Z.scriptSrc)return`<script defer src="${RJ(Z.scriptSrc)}" data-site="${Q}"></script>`;let $=Z.apiEndpoint?RJ(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();});":"",W=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)});}}
|
|
9963
|
+
catch (err){l('Outbound error',err);}});`:"",z=$?` data-api="${$}"`:"",q=Z.collectEndpoint?`/${Z.collectEndpoint.replace(/^\/+/,"")}`:"/collect",V=q==="/collect"?"":` data-collect="${RJ(q)}"`;return`<!-- ts-analytics: privacy-first analytics -->
|
|
9964
|
+
<script data-site="${Q}"${z}${V} defer>
|
|
9890
9965
|
(function(){
|
|
9891
9966
|
'use strict';
|
|
9892
9967
|
var d=document,w=window,n=navigator,ss=w.sessionStorage,s=d.currentScript;
|
|
@@ -9934,7 +10009,7 @@ catch(err){l('Track error',err);}
|
|
|
9934
10009
|
}
|
|
9935
10010
|
var pvSent={};function pv(){var p=location.pathname;if(pvSent[p]&&Date.now()-pvSent[p]<1000)return;pvSent[p]=Date.now();l('Pageview',p);t('pageview',{path:p});}
|
|
9936
10011
|
${X}
|
|
9937
|
-
${
|
|
10012
|
+
${W}
|
|
9938
10013
|
var hp=history.pushState;if(hp){history.pushState=function(){hp.apply(history,arguments);pv();};}
|
|
9939
10014
|
var hr=history.replaceState;if(hr){history.replaceState=function(){hr.apply(history,arguments);};}
|
|
9940
10015
|
w.addEventListener('popstate',pv);
|
|
@@ -9948,69 +10023,69 @@ l('Initialized',site);
|
|
|
9948
10023
|
}
|
|
9949
10024
|
catch(err){if(w.console)console.error('[Analytics] Init error:',err);}
|
|
9950
10025
|
})();
|
|
9951
|
-
</script>`}function
|
|
9952
|
-
`),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:
|
|
10026
|
+
</script>`}function RJ(J){return J.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function S0(J){let Z=J.replace(/\r\n/g,`
|
|
10027
|
+
`),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:uQ.parse(Y),content:X}}catch{try{let W=Y.replace(/^(\s*\w+:\s*)"(.+)",\s*(.+)$/gm,`$1'"$2," $3'`);return{frontmatter:uQ.parse(W),content:X}}catch(W){return console.error("Failed to parse frontmatter YAML:",W),{frontmatter:{},content:J}}}}async function x0(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((V)=>{return`<a class="${V.theme==="brand"?"BPButton BPButton-brand":"BPButton BPButton-alt"}" href="${V.link}">${V.text}</a>`}).join(`
|
|
9953
10028
|
`)}</div>`;let X=J.announcement?`<a class="BPHero-announcement" href="${F(J.announcement.link||"#")}">
|
|
9954
10029
|
${J.announcement.tag?`<span class="BPHero-announcement-tag">${J.announcement.tag}</span>`:""}
|
|
9955
10030
|
<span class="BPHero-announcement-text">${J.announcement.text||""}</span>
|
|
9956
10031
|
<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>
|
|
9957
|
-
</a>`:"",
|
|
9958
|
-
<pre data-lang="${F(
|
|
10032
|
+
</a>`:"",W=J.image?`<div class="hero-image"><img src="${F(J.image)}" alt="${F(J.name||"")}" /></div>`:"",z=(J.code?await v0(J.code):"")||W;return await H("hero",{announcement:X,name:Z,text:Q,tagline:$,actions:Y,image:z})}async function v0(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,W)=>{let z=X.lang||"ts",q=await UJ(X.content.replace(/\n+$/,""),z);return`<div class="BPHeroCode-panel" data-index="${W}"${W===0?"":" hidden"}>
|
|
10033
|
+
<pre data-lang="${F(z)}"><code class="language-${F(z)}">${q}</code></pre>
|
|
9959
10034
|
</div>`}));return`<div class="BPHeroCode">
|
|
9960
|
-
<div class="BPHeroCode-head">${Q.length>1?`<div class="BPHeroCode-tabs" role="tablist">${Q.map((X,
|
|
10035
|
+
<div class="BPHeroCode-head">${Q.length>1?`<div class="BPHeroCode-tabs" role="tablist">${Q.map((X,W)=>`<button class="BPHeroCode-tab${W===0?" is-active":""}" type="button" role="tab" aria-selected="${W===0}" onclick="switchHeroCodeTab(this, ${W})">${X.file||X.lang||`Example ${W+1}`}</button>`).join("")}</div>`:Q[0].file?`<span class="BPHeroCode-file">${Q[0].file}</span>`:""}</div>
|
|
9961
10036
|
<div class="BPHeroCode-body">${$.join("")}</div>
|
|
9962
|
-
</div>`}var
|
|
9963
|
-
<${
|
|
10037
|
+
</div>`}var C0={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 b0(J){if(J.startsWith("<")||/\p{Emoji}/u.test(J))return J;return C0[J]||`<span class="BPFeature-icon-text">${J.charAt(0)}</span>`}async function f0(J){if(!J||J.length===0)return"";let Z=J.map((Q)=>{let $=Q.icon?b0(Q.icon):"",Y=$?`<div class="BPFeature-icon">${$}</div>`:"",X=Q.link,W=X?"a":"div",z=X?` href="${F(X)}"`:"",q=Number(Q.span)>1?` style="--bp-feature-span:${Math.min(Math.trunc(Number(Q.span)),3)}"`:"",V=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`
|
|
10038
|
+
<${W} class="BPFeature${V}"${z}${q}>
|
|
9964
10039
|
${Y}
|
|
9965
10040
|
<h2 class="BPFeature-title">${Q.title||""}</h2>
|
|
9966
10041
|
<p class="BPFeature-details">${Q.details||""}</p>
|
|
9967
10042
|
${K}
|
|
9968
|
-
</${
|
|
10043
|
+
</${W}>`}).join("");return await H("features",{items:Z})}function p0(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 u0(J){let Z=/<Badge([^/>]+)\/>/gi;return J.replace(Z,(Q,$)=>{let Y=$.match(/type="(info|tip|warning|danger)"/i),X=$.match(/text="([^"]+)"/),W=Y?Y[1].toLowerCase():"info",z=X?X[1]:"";return`<span class="badge badge-${W}">${z}</span>`})}function g0(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 h0(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 m0(J){return J.replace(/<img([^>]+)>/g,(Z,Q)=>{if(Q.includes("loading="))return Z;return`<img ${Q} loading="lazy" decoding="async">`})}function d0(J,Z){if(!J.includes("[[toc]]"))return{content:J,tocHtml:null};let Q=JZ(J),$={...tQ,...Z},Y=ZZ(Q,$),W={items:QZ(Y),title:$.title||"Table of Contents",config:$},z=$Z(W),q="<!--INLINE_TOC_PLACEHOLDER-->";return{content:J.replace(/\[\[toc\]\]/g,q),tocHtml:z}}function l0(J,Z){return J.replace(/<!--INLINE_TOC_PLACEHOLDER-->/g,Z)}function NZ(J){let Z=J.replace(/\s+$/,"").split(`
|
|
9969
10044
|
`),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(`
|
|
9970
10045
|
`).trim();return Y?`
|
|
9971
10046
|
|
|
9972
10047
|
${Y}
|
|
9973
10048
|
|
|
9974
|
-
`:""}async function
|
|
10049
|
+
`:""}async function c0(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,W,z]=Y,q=z.split(`
|
|
9975
10050
|
`).map((_)=>_.replace(/^>\s?/,"")).join(`
|
|
9976
|
-
`),V=
|
|
10051
|
+
`),V=W.toLowerCase(),K=await H(`blocks/alerts/${V}`,{content:NZ(q)});$=`${$.slice(0,Y.index)}
|
|
9977
10052
|
|
|
9978
10053
|
${K}
|
|
9979
10054
|
|
|
9980
|
-
${$.slice(Y.index+X.length)}`}return $}async function
|
|
9981
|
-
`),
|
|
9982
|
-
`),
|
|
9983
|
-
${
|
|
9984
|
-
\`\`\``;Y=Y.slice(0,X.index)+
|
|
9985
|
-
`);if(_&&G){let U=Number.parseInt(_)-1,j=Number.parseInt(G);
|
|
9986
|
-
`),
|
|
10055
|
+
${$.slice(Y.index+X.length)}`}return $}async function r0(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[W,z,q,V,K]=X;try{let{join:_}=await import("path"),G=_(Z,z),O=Bun.file(G);if(!await O.exists()){console.warn(`Code import: File not found: ${G}`);continue}let R=(await O.text()).split(`
|
|
10056
|
+
`),E=z.split(".").pop()||"",I={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"}[E]||E;if(q&&V){let B=Number.parseInt(q)-1,U=Number.parseInt(V);R=R.slice(B,U)}else if(K){let B=R.findIndex((j)=>j.includes(`#region ${K}`)||j.includes(`// region ${K}`)||j.includes(`# region ${K}`)),U=R.findIndex((j,A)=>A>B&&(j.includes("#endregion")||j.includes("// endregion")||j.includes("# endregion")));if(B!==-1&&U!==-1)R=R.slice(B+1,U);else console.warn(`Code import: Region '${K}' not found in ${z}`)}let D=R.join(`
|
|
10057
|
+
`),w=`\`\`\`${I}
|
|
10058
|
+
${D}
|
|
10059
|
+
\`\`\``;Y=Y.slice(0,X.index)+w+Y.slice(X.index+W.length)}catch(_){console.error(`Error importing code from ${z}:`,_)}}return Y}async function RZ(J,Z,Q=new Set,$,Y){let X=/<!--@include:\s*([^\s{]+)(?:\{(\d+)-(\d+)\}|\{#([\w-]+)\})?\s*-->/g,W=Array.from(J.matchAll(X)),z=J;for(let q of W.reverse()){let[V,K,_,G,O]=q;try{if($){let U=J.slice(0,q.index),j=J.slice(q.index+V.length);if(!/(?:^|\n) {0,3}$/.test(U)||!/^[ \t]*(?:\r?\n|$)/.test(j))throw Error("Source-aware Markdown includes must be on their own line")}let{join:N,resolve:R}=await import("path"),E=R(N(Z,K));if(Q.has(E)){console.warn(`Markdown include: Circular reference detected for ${K}`);continue}let M=Bun.file(E);if(!await M.exists()){console.warn(`Markdown include: File not found: ${E}`);continue}let D=(await M.text()).split(`
|
|
10060
|
+
`);if(_&&G){let U=Number.parseInt(_)-1,j=Number.parseInt(G);D=D.slice(U,j)}else if(O){let U=D.findIndex((A)=>A.includes(`<!-- #region ${O} -->`)||A.includes(`<!-- region ${O} -->`)),j=D.findIndex((A,S)=>S>U&&(A.includes("<!-- #endregion -->")||A.includes("<!-- endregion -->")));if(U!==-1&&j!==-1)D=D.slice(U+1,j);else{console.warn(`Markdown include: Region '${O}' not found in ${K}`);continue}}let w=D.join(`
|
|
10061
|
+
`),B=new Set(Q);if(B.add(E),w=await QJ(w,(U)=>RZ(U,Z,B,$,Y)),$&&Y){let U=`bunpress-source-${KZ()}`;Y.set(`${U}:start`,{...$.page,sourceFile:E}),Y.set(`${U}:end`,null),w=`
|
|
9987
10062
|
<!--${U}:start-->
|
|
9988
10063
|
|
|
9989
|
-
${
|
|
10064
|
+
${w}
|
|
9990
10065
|
|
|
9991
10066
|
<!--${U}:end-->
|
|
9992
|
-
`}
|
|
9993
|
-
${
|
|
10067
|
+
`}z=z.slice(0,q.index)+w+z.slice(q.index+V.length)}catch(N){if($)throw N;console.error(`Error including markdown from ${K}:`,N)}}return z}async function s0(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,W]=Y,z=/^```(\w+)[ \t]+\[([^\]]+)\][ \t]*\n((?:(?!^```)[\s\S])*)^```$/gm,q=Array.from(W.matchAll(z));if(q.length===0)continue;let V=new Bun.CryptoHasher("sha256");V.update(`${Y.index}\x00${X}`);let K=`code-group-${V.digest("hex").slice(0,12)}`,_=q.map((N,R)=>{let E=N[2];return`<button class="code-group-tab${R===0?" active":""}" onclick="switchCodeTab('${K}', ${R})">${E}</button>`}).join(""),G=await Promise.all(q.map(async(N,R)=>{let E=N[1],M=N[3],I=R===0,D=y.markdown?.syntaxHighlightTheme||"github-light",w=await UJ(M,E,D),B=`<pre data-lang="${E}"><code class="language-${E}">${w}</code></pre>`;return`<div class="code-group-panel${I?" active":""}" data-panel="${R}">
|
|
10068
|
+
${B}
|
|
9994
10069
|
</div>`})),O=[`<div class="code-group" id="${K}">`,' <div class="code-group-tabs">',` ${_}`," </div>",' <div class="code-group-panels">',` ${G.join(`
|
|
9995
10070
|
`)}`," </div>","</div>"].join(`
|
|
9996
|
-
`);$=$.slice(0,Y.index)+O+$.slice(Y.index+X.length)}return $}async function
|
|
10071
|
+
`);$=$.slice(0,Y.index)+O+$.slice(Y.index+X.length)}return $}async function i0(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,W,z,q]=Y,V={info:"INFO",tip:"TIP",warning:"WARNING",danger:"DANGER",details:"Details",raw:""},K=z&&z.trim()||V[W],_=await H(`blocks/containers/${W}`,{title:K,content:NZ(q)});$=`${$.slice(0,Y.index)}
|
|
9997
10072
|
|
|
9998
10073
|
${_}
|
|
9999
10074
|
|
|
10000
|
-
${$.slice(Y.index+X.length)}`}return $}function
|
|
10001
|
-
`));if(x!==null)return{html:x,endIndex:O}}let N=new Set,
|
|
10002
|
-
`),U=
|
|
10003
|
-
`).map((x,
|
|
10004
|
-
`),v=[];if(_)v.push("line-numbers-mode");if(
|
|
10005
|
-
`),Y=[],X=0,
|
|
10006
|
-
`)}function
|
|
10075
|
+
${$.slice(Y.index+X.length)}`}return $}function o0(J){let Z=J.match(/^([\w#+.-]+)/),Q=Z?Z[1]:"",$=J.match(/\{([^}]+)\}/),Y=[];if($){let W=$[1].split(",");for(let z of W){let q=z.trim();if(q.includes("-")){let[V,K]=q.split("-").map(Number);for(let _=V;_<=K;_++)Y.push(_)}else Y.push(Number(q))}}let X=J.includes(":line-numbers");return{lang:Q,highlights:Y,showLineNumbers:X}}async function a0(J,Z,Q){let $=J[Z],Y=$.match(/^(`{3,})/),X=Y?Y[1].length:3,W="`".repeat(X),z=$.substring(X).trim(),q=o0(z),V=q.lang,K=Q.lineHighlighting?q.highlights:[],_=Q.lineNumbers?q.showLineNumbers:!1,G=[],O=Z+1;while(O<J.length){let x=J[O];if(x.match(new RegExp(`^\`{${X},}\\s*$`)))break;G.push(x),O++}if(Q.messagePreviews){let x=nQ(V,G.join(`
|
|
10076
|
+
`));if(x!==null)return{html:x,endIndex:O}}let N=new Set,R=new Set,E=new Set,M=new Set,I=new Set,D=G.map((x,P)=>{let T=x;if(T.includes("// [!code focus]"))N.add(P),T=T.replace(/\/\/ \[!code focus\]/,"").trimEnd();if(T.includes("// [!code ++]"))R.add(P),T=T.replace(/\/\/ \[!code \+\+\]/,"").trimEnd();if(T.includes("// [!code --]"))E.add(P),T=T.replace(/\/\/ \[!code --\]/,"").trimEnd();if(T.includes("// [!code error]"))M.add(P),T=T.replace(/\/\/ \[!code error\]/,"").trimEnd();if(T.includes("// [!code warning]"))I.add(P),T=T.replace(/\/\/ \[!code warning\]/,"").trimEnd();return T}),w=N.size>0,B=D.join(`
|
|
10077
|
+
`),U=y.markdown?.syntaxHighlightTheme||"github-light",S=(await UJ(B,V,U)).split(`
|
|
10078
|
+
`).map((x,P)=>{let T=P+1,IJ=K.includes(T),g=N.has(P),wJ=Q.diffs&&R.has(P),LJ=Q.diffs&&E.has(P),AJ=Q.errorWarningMarkers&&M.has(P),$J=Q.errorWarningMarkers&&I.has(P),k=["line"];if(IJ)k.push("highlighted");if(g)k.push("focused");if(w&&!g)k.push("dimmed");if(wJ)k.push("diff-add");if(LJ)k.push("diff-remove");if(AJ)k.push("has-error");if($J)k.push("has-warning");if(x.startsWith('<span class="line">')){let c=k.join(" "),r=x.replace('<span class="line">',`<span class="${c}">`);if(_)return`<span class="${k.join(" ")}"><span class="line-number">${T}</span>${r.replace(/^<span class="[^"]*">/,"").replace(/<\/span>$/,"")}</span>`;return r}let b=k.length>0?` class="${k.join(" ")}"`:"";if(_)return`<span${b}><span class="line-number">${T}</span>${x}</span>`;return`<span${b}>${x}</span>`}).join(`
|
|
10079
|
+
`),v=[];if(_)v.push("line-numbers-mode");if(w)v.push("has-focused-lines");let u=v.length>0?` class="${v.join(" ")}"`:"",l=V?` data-lang="${V}"`:"";return{html:`<pre${u}${l}><code class="language-${V}">${S}</code></pre>`,endIndex:O}}function n0(J){let Z=new Map;return{content:J.replace(/^(#{1,6})\s+(.*?)\s*\{#([\w-]+)\}\s*$/gm,($,Y,X,W)=>{let z=eQ(X),q=Z.get(z)??[];return q.push(W),Z.set(z,q),`${Y} ${X.trim()}`}),customAnchors:Z}}async function t0(J,Z,Q){let $=J.split(`
|
|
10080
|
+
`),Y=[],X=0,W=0;while(X<$.length){let z=$[X];if(z.match(/^`{3,}/)){let{html:q,endIndex:V}=await a0($,X,Q),K=`<!--BUNPRESS_CODE_${W++}-->`;Z.set(K,q),Y.push(""),Y.push(K),Y.push(""),X=V+1}else Y.push(z),X++}return Y.join(`
|
|
10081
|
+
`)}function e0(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 J1(J,Z=!0,Q=!0,$=!0){if(Q||Z){let Y=`${Q?`<div class="table-responsive">
|
|
10007
10082
|
`:""}<table${Z?' class="enhanced-table"':""}>`;J=J.replace(/<table>/g,Y),J=J.replace(/<\/table>/g,Q?`</table>
|
|
10008
|
-
</div>`:"</table>")}if($)J=J.replace(/<(th|td) align="(left|center|right)">/g,(Y,X,
|
|
10009
|
-
|
|
10010
|
-
${q}`,{link(
|
|
10011
|
-
\uD83D\uDCDA BunPress documentation server running at ${
|
|
10012
|
-
`);return{server:X,url:
|
|
10013
|
-
`);try{let Y=new Map,X=new
|
|
10014
|
-
Shutting down server...`),Z(),
|
|
10015
|
-
Shutting down server...`),Z(),
|
|
10016
|
-
export{
|
|
10083
|
+
</div>`:"</table>")}if($)J=J.replace(/<(th|td) align="(left|center|right)">/g,(Y,X,W)=>{return`<${X} style="text-align: ${W}">`}),J=J.replace(/<(th|td)>/g,(Y,X)=>{return`<${X} style="text-align: left">`});return J}function Q1(J,Z){let Q=new Set;return J.replace(/<h([1-6])([^>]*)>([\s\S]*?)<\/h\1>/g,($,Y,X,W)=>{if(X.includes(" id="))return $;let z=W.replace(/<[^>]+>/g,"").trim(),V=Z.get(z)?.shift();if(!V)V=rJ(z);return V=sJ(V,Q),`<h${Y} id="${V}"${X}>${W}</h${Y}>`})}async function Z1(J,Z="./docs",Q){let{frontmatter:$,content:Y}=S0(J);if($.layout==="home"){let W=await x0($.hero),z=await f0($.features),q=Y.trim()?await lQ(Y,$,Z,Q):"",V=q?`<div class="BPHome-content"><div class="container bp-doc vp-doc">${q}</div></div>`:"";return{html:W+z+V,frontmatter:$}}return{html:await lQ(Y,$,Z,Q),frontmatter:$}}async function lQ(J,Z,Q,$){let Y=new Map,X=y.markdown?.features,W=(U)=>{if(!X)return!0;let j=X[U];return j===void 0||j===!0||typeof j==="object"&&j!==null},z=(U,j)=>{if(!W(U))return!1;let A=X?.[U];if(typeof A!=="object"||A===null)return!0;return A[j]!==!1},q=W("includes")?await QJ(J,(U)=>RZ(U,Q,new Set($?[$.page.sourceFile]:[]),$,Y)):J,V={...Z,data:await $Q(Q,y.dataDir),site:{title:y.title||y.markdown?.title||"",description:y.description||y.markdown?.meta?.description||"",themeConfig:y.themeConfig}},K=y.componentsDir?ZJ(JJ.cwd(),y.componentsDir):ZJ(Q,".components"),_=new Map,G=y.fallbackComponentsDir;q=await CJ(q,K,V,{fallbackComponentsDir:G?e(G):void 0,rendered:_});let O=q.replace(/```[\s\S]*?```/g,"");if(O.includes("@if")||O.includes("@foreach")||O.includes("@for (")||O.includes("<script server")||O.includes("@include")||/\{\{(?!\{)\s*\w/.test(O))try{let U=await import("@stacksjs/stx/render"),j=[],A=q.replace(/```[\s\S]*?```/g,(S)=>{return j.push(S),`\x00BPSTXCODE${j.length-1}\x00`}).replace(/`[^`\n]*`/g,(S)=>{return j.push(S),`\x00BPSTXCODE${j.length-1}\x00`});q=await U.renderString(A,V,{injectCSS:!1,templateOnly:!0}),q=q.replace(/\u0000BPSTXCODE(\d+)\u0000/g,(S,v)=>j[Number(v)]??"")}catch(U){let j=U instanceof Error?U.message:String(U);throw Error(`Failed to render BunPress stx syntax: ${j}`,{cause:U})}let{content:R,tocHtml:E}=W("inlineToc")?d0(q,Z.toc):{content:q,tocHtml:""};q=W("codeImports")?await QJ(R,(U)=>r0(U,Q)):R,q=W("codeGroups")?await s0(q):q,q=await QJ(q,async(U)=>{let j=W("githubAlerts")?await c0(U):U;return j=W("containers")?await i0(j):j,j=W("emoji")?p0(j):j,j=W("badges")?u0(j):j,j});let{content:M,customAnchors:I}=W("customAnchors")?n0(q):{content:q,customAnchors:new Map};q=M;let D=new Map;q=W("codeBlocks")?await t0(q,D,{lineHighlighting:z("codeBlocks","lineHighlighting"),lineNumbers:z("codeBlocks","lineNumbers"),diffs:z("codeBlocks","diffs"),errorWarningMarkers:z("codeBlocks","errorWarningMarkers"),messagePreviews:W("messagePreviews")}):q;let w={tables:!0,strikethrough:!0,tasklists:!0,autolinks:!0,...y.markdown?.parserOptions??{}};if(Y.size){let U=new Set;for(let j=q.indexOf("]:");j!==-1;j=q.indexOf("]:",j+2))for(let A=q.lastIndexOf("[",j-1);A!==-1;A=A===0?-1:q.lastIndexOf("[",A-1)){let S=q.slice(A+1,j);if(U.has(S))continue;if(U.add(S),U.size>256)throw Error("Markdown include reference validation exceeded 256 candidate labels. Split the document or use inline links.");let v=`bunpress-reference-${KZ()}`,u=!1;if(Bun.markdown.render(`[${v}][${S}]
|
|
10084
|
+
|
|
10085
|
+
${q}`,{link(l){if(l===v)u=!0;return""}},w),u)throw Error("Markdown includes cannot be combined with reference definitions. Use inline links instead.")}}let B=Bun.markdown.html(q,w);if($)B=await qZ(B,$,Y);for(let[U,j]of D)B=B.replace(`<p>${U}</p>`,j),B=B.replace(U,j);if(W("inlineFormatting"))B=e0(B);if(W("tables"))B=J1(B,z("tables","enhancedStyling"),z("tables","responsive"),z("tables","alignment"));if(B=Q1(B,I),E)B=l0(B,E);if(W("externalLinks")){if(z("externalLinks","autoTarget")||z("externalLinks","autoRel"))B=g0(B,z("externalLinks","autoTarget"),z("externalLinks","autoRel"));if(z("externalLinks","showIcon"))B=h0(B)}if(W("imageLazyLoading"))B=m0(B);for(let[U,j]of _)B=B.replace(`<p>${U}</p>`,()=>j),B=B.replace(U,()=>j);return B}async function $1(J={}){let Z=J.config||y,Q=J.port??3000,$=J.root||"./docs",Y=await cJ(lJ(Z),Z),X=Bun.serve({port:Q,async fetch(q){let V=new URL(q.url);try{decodeURIComponent(V.pathname)}catch{return new Response("Malformed path",{status:400})}let K=hQ(Z,V.pathname);if(K==="/")K="/index";else if(K.length>1&&K.endsWith("/"))K=K.replace(/\/+$/,"");if(K===EJ.replace(/\.json$/,"")||V.pathname.endsWith(EJ)){let N=await XZ($,Z);return new Response(JSON.stringify(N),{headers:{"Content-Type":"application/json","Cache-Control":"no-store"}})}let _=[".png",".jpg",".jpeg",".gif",".webp",".avif",".svg",".css",".js",".ico",".woff",".woff2",".ttf"];try{let N=decodeURIComponent(hQ(Z,V.pathname));if(!N.split("/").some((R)=>R.startsWith("."))){let R=e($,"public"),E=e(R,`.${N}`);if(E.startsWith(`${R}${gQ}`)){let M=/\.[^/]+$/.test(N)?[E]:[ZJ(E,"index.html")];for(let I of M){let D=Bun.file(I);if(await D.exists()&&(await FJ(I)).isFile())return new Response(D)}}if(_.some((M)=>N.endsWith(M))){let M=e($),I=e(M,`.${N}`);if(I.startsWith(`${M}${gQ}`)){let D=Bun.file(I);if(await D.exists()&&(await FJ(I)).isFile())return new Response(D)}}}}catch{}let{locale:G,path:O}=rQ(Y,K);try{let N=WZ(await zZ($),$,Y),R=N.findPage(G,O);if(R){let E=await Bun.file(R.sourceFile).text(),{html:M,frontmatter:I}=await Z1(E,$,{page:R,catalog:N}),D=I.layout||"doc",w=await mQ(M,Z,O,D,I,{i18n:Y,locale:G,sourceFile:R.sourceFile,docsDir:$});return new Response(w,{headers:{"Content-Type":"text/html; charset=utf-8"}})}}catch{return new Response("Documentation page could not be rendered",{status:500})}return new Response(await mQ("<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"}})}}),W=`http://localhost:${X.port}`,z=()=>X.stop();if(!J.quiet)console.log(`
|
|
10086
|
+
\uD83D\uDCDA BunPress documentation server running at ${W}`),console.log(`Press Ctrl+C to stop
|
|
10087
|
+
`);return{server:X,url:W,stop:z}}async function $3(J={}){let{stop:Z}=await $1(J),Q=J.watch!==void 0?J.watch:!0,$=J.root||"./docs";if(Q){console.log(`Watching for changes in ${$} directory...
|
|
10088
|
+
`);try{let Y=new Map,X=new pQ("**/*.{md,stx,ts,js,css,html}");for await(let q of X.scan($))try{let V=ZJ($,q),K=await FJ(V);Y.set(q,K.mtimeMs)}catch{}let W=null,z=()=>{if(W)clearTimeout(W);W=setTimeout(async()=>{console.log("File changed detected, reloading..."),TQ(),IQ(),YQ(),console.log("Ready for requests")},100)};setInterval(async()=>{try{let q=!1,V=new Set,K=new pQ("**/*.{md,stx,ts,js,css,html}");for await(let _ of K.scan($)){V.add(_);try{let G=ZJ($,_),O=await FJ(G),N=Y.get(_);if(N===void 0||O.mtimeMs>N)q=!0,Y.set(_,O.mtimeMs)}catch{}}for(let _ of Y.keys())if(!V.has(_))q=!0,Y.delete(_);if(q)z()}catch{}},1000)}catch(Y){console.error("Error setting up file watcher:",Y)}}JJ.on("SIGINT",()=>{console.log(`
|
|
10089
|
+
Shutting down server...`),Z(),JJ.exit(0)}),JJ.on("SIGTERM",()=>{console.log(`
|
|
10090
|
+
Shutting down server...`),Z(),JJ.exit(0)}),await new Promise(()=>{})}
|
|
10091
|
+
export{O1 as a,_Q as b,UQ as c,OQ as d,UJ as e,j1 as f,fZ as g,jQ as h,N1 as i,R1 as j,hQ as k,mQ as l,Z1 as m,$1 as n,$3 as o};
|