@shell-shock/unified 0.1.3 → 0.2.0

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.
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../html-y4ndTJv8.cjs`);exports.renderHtml=e.t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../html-UjWBxd-n.cjs`);exports.renderHtml=e.t;
@@ -1,4 +1,4 @@
1
- import { t as Options } from "../types-C7nXIjAN.cjs";
1
+ import { t as Options } from "../types-J2htKY4q.cjs";
2
2
 
3
3
  //#region src/html/index.d.ts
4
4
  /**
@@ -8,7 +8,7 @@ import { t as Options } from "../types-C7nXIjAN.cjs";
8
8
  * @param options - Configuration options for rendering the HTML.
9
9
  * @return A string of source code that can be executed to display the rendered HTML in the terminal.
10
10
  */
11
- declare function renderHtml(html: string, options: Options): string;
11
+ declare function renderHtml(html: string, options?: Options): string;
12
12
  //#endregion
13
13
  export { renderHtml };
14
14
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/html/index.ts"],"mappings":";;;;;AA8BA;;;;;iBAAgB,UAAA,CAAW,IAAA,UAAc,OAAA,EAAS,OAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/html/index.ts"],"mappings":";;;;;AA8BA;;;;;iBAAgB,UAAA,CAAW,IAAA,UAAc,OAAA,GAAS,OAAA"}
@@ -1,4 +1,4 @@
1
- import { t as Options } from "../types-C5cPWP5x.mjs";
1
+ import { t as Options } from "../types-CCFWBb06.mjs";
2
2
 
3
3
  //#region src/html/index.d.ts
4
4
  /**
@@ -8,7 +8,7 @@ import { t as Options } from "../types-C5cPWP5x.mjs";
8
8
  * @param options - Configuration options for rendering the HTML.
9
9
  * @return A string of source code that can be executed to display the rendered HTML in the terminal.
10
10
  */
11
- declare function renderHtml(html: string, options: Options): string;
11
+ declare function renderHtml(html: string, options?: Options): string;
12
12
  //#endregion
13
13
  export { renderHtml };
14
14
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/html/index.ts"],"mappings":";;;;;AA8BA;;;;;iBAAgB,UAAA,CAAW,IAAA,UAAc,OAAA,EAAS,OAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/html/index.ts"],"mappings":";;;;;AA8BA;;;;;iBAAgB,UAAA,CAAW,IAAA,UAAc,OAAA,GAAS,OAAA"}
@@ -1 +1 @@
1
- import{t as e}from"../html-Di3_LwV3.mjs";export{e as renderHtml};
1
+ import{t as e}from"../html-Dw6VvFHa.mjs";export{e as renderHtml};
@@ -0,0 +1,14 @@
1
+ import{parse as e}from"parse5";import t from"he";import n from"normalize-html-whitespace";import r from"wrap-ansi";import{THEME_MESSAGE_VARIANTS as i}from"@shell-shock/plugin-theme/helpers/constants";const a=e=>({pre:!1,lineWidth:120,fontAttrs:!0,depth:0,asciiMode:!1,...e}),o=e=>{if(e==null)return 0;let t=Number(e);return Number.isFinite(t)?t:0},s=(e,t)=>{if(!e&&!t)return null;if(e){let e=o(t.marginTop),n=o(t.marginBottom);return{...t,marginTop:e,marginBottom:n}}if(t){let t=o(e.marginTop),n=o(e.marginBottom);return{...e,marginTop:t,marginBottom:n}}let n=o(e.marginTop),r=o(e.marginBottom),i=o(t.marginTop),a=o(t.marginBottom);if(!t.value)return{marginTop:n,value:e.value,marginBottom:Math.max(r,i,a)};if(!e.value)return{marginTop:Math.max(n,r,i),value:t.value,marginBottom:a};let s=Math.max(r,i);return{marginTop:n,value:`${e.value}${`
2
+ `.repeat(s)}${t.value}`,marginBottom:a}},c=(e,t)=>e==null&&t==null?null:e==null?t:t==null?e:t.value==null?{pre:e.pre,value:e.value,post:e.post??t.pre??t.post??``,type:`inline`,nodeName:e.nodeName}:e.value==null?{pre:e.pre??e.post??t.pre??``,value:t.value,post:t.post,type:`inline`,nodeName:t.nodeName}:e.post==null?t.pre==null?{pre:e.pre,value:`${e.value}${t.value}`,post:t.post,type:`inline`,nodeName:t.nodeName}:{pre:e.pre,value:`${e.value}${t.pre}${t.value}`,post:t.post,type:`inline`,nodeName:t.nodeName}:{pre:e.pre,value:`${e.value}${e.post}${t.value}`,post:t.post,type:`inline`,nodeName:t.nodeName},l=new WeakMap,u=(e,t,n=null)=>{if(!e||typeof e!=`object`||!t||typeof t!=`string`)return n;let r=l.get(e);if(r){let e=r.get(t);if(e!==void 0)return e??n}if(!e.attrs||!Array.isArray(e.attrs)||e.attrs.length===0)return r||(r=new Map,l.set(e,r)),r.set(t,null),n;let i=e.attrs.find(e=>e&&typeof e==`object`&&e.name===t);if(r||(r=new Map,l.set(e,r)),!i||i.value===void 0)return r.set(t,null),n;let a=i.value;return r.set(t,a),a};function d(e){let t=u(e,`class`,null);return t?t.split(/\s+/).map(e=>e.trim()).filter(e=>e.length>0):[]}const f=(e,t)=>r(e,t.lineWidth??80,{trim:!t.pre}),p=t.decode,ee=n,m=e=>e?{...e,marginTop:0,marginBottom:0,type:`block`,nodeName:`#blockTag`}:null,te=(e,t)=>{let n=String(e.value??``);if(t.pre)return{pre:null,value:p(n),post:null,type:`inline`,nodeName:`#text`};let r=[...(ee(n)||``).replaceAll(`
3
+ `,` `)],i=[` `,`
4
+ `].includes(r[0]??``)?r.shift()??null:null,a=[` `,`
5
+ `].includes(r.at(-1)??``)?r.pop()??null:null;return{pre:i,value:r.length>0?`${p(r.join(``))}`:null,post:a,type:`inline`,nodeName:`#text`}};function h(e,t){return(n,r)=>{let i=e??(e=>e);if(!n||!n.childNodes)return null;let a=Number.parseInt(u(n,`start`,`1`)??`1`,10),o=n.childNodes.reduce((e,t)=>{let n=$(t,{...r,liItemNumber:a});return n?(n.nodeName===`li`&&(a+=1),n.type===`inline`?{block:e.block,inline:c(e.inline,n)}:(e.inline&&e.inline.value&&(e.inline.value=f(e.inline.value,r)),e.block=s(e.block??null,m(e.inline)??null),e.block=s(e.block??null,n),{block:e.block,inline:null})):e},{block:null,inline:null});o.inline&&o.inline.value&&(o.inline.value=f(o.inline.value,r)),o.block=s(o.block??null,m(o.inline)??null);let l=t?.marginTop??0;l=!r||!r.pre?l+1:l;let d=t?.marginBottom??0;return d=!r||!r.pre?d+1:d,!o.block||!o.block.value?{marginTop:l,value:``,marginBottom:d,type:`block`,nodeName:n.nodeName}:{marginTop:o.block.marginTop&&o.block.marginTop>l?o.block.marginTop:l,value:i(o.block.value,n,r),marginBottom:o.block.marginBottom&&o.block.marginBottom>d?o.block.marginBottom:d,type:`block`,nodeName:n.nodeName}}}const g=e=>(t,n)=>{let r=e??(e=>e??null),i=X.span;if(!t||!t.childNodes)return;let a=t.childNodes.reduce((e,r)=>{let a=$(r,n,i);return a?{...c(e,a),type:`inline`,nodeName:t.nodeName}:e},null);return{pre:a?.pre?r(a.pre,t,n):null,value:r(a?.value,t,n),post:a?.post?r(a.post,t,n):null,type:`inline`,nodeName:t.nodeName}},_=()=>void 0,ne=g((e,t,n)=>{let r=u(t,`href`,null),i=u(t,`title`,null),a=!r||[`file://`,`http://`,`https://`,`mailto:`,`ftp://`,`ftps://`,`sftp://`,`ssh://`,`dav://`,`tel:`,`git://`].some(e=>r.startsWith(e))?r:null;return a?`link("${a}", ${i?`"${i}", `:``}${a&&(a.startsWith(`http://`)||a.startsWith(`https://`))?`true`:`false`})`:i?`"${i}"`:``}),v=g((e,t)=>{let n=u(t,`title`,null);return e?n?`${e} (${n})`:e:``}),re=v,ie=v;function y(e){return`textColors.body.primary(${JSON.stringify(String(e??``))})`}function b(e){return JSON.stringify(String(e??``))}function x(e){return`inlineCode(${b(e)})`}function S(e,t){return`code(${JSON.stringify(e)}${t?`, ${JSON.stringify(t)}`:``})`}function C(e){return e?typeof e.value==`string`?e.value:!e.childNodes||e.childNodes.length===0?``:e.childNodes.map(e=>C(e)).join(``):``}function w(e){return e.replaceAll(/\s+/g,` `).trim()}function T(e,t,n=null,r=null){return{pre:n,value:t,post:r,type:`inline`,nodeName:e}}function E(e,t,n=0,r=0){return{marginTop:n,value:t,marginBottom:r,type:`block`,nodeName:e}}function ae(e){if(!e)return null;let t=u(e,`class`,``)?.split(/\s+/).map(e=>e.trim()).filter(Boolean)??[];for(let e of t){if(e.startsWith(`language-`))return e.slice(9)||null;if(e.startsWith(`lang-`))return e.slice(5)||null}return null}function D(e,t,n=10,r=`#`,i=`-`){if(!Number.isFinite(e)||!Number.isFinite(t)||t<=0)return i.repeat(n);let a=Math.max(0,Math.min(1,e/t)),o=Math.round(a*n);return r.repeat(o)+i.repeat(Math.max(n-o,0))}const oe=h(e=>y(e)),se=g(e=>y(e)),ce=g(e=>y(e));function O(e){return String(e??``).replaceAll(`\\`,`\\\\`).replaceAll("`","\\`").replaceAll("${","\\${").replaceAll(`
6
+ `,`\\n`).replaceAll(`\r`,`\\r`).replaceAll(` `,`\\t`)}const k=e=>h(e=>`textColors.body.primary(\`${O(e)}\`)`),A=e=>g(e=>`textColors.body.primary(\`${O(e)}\`)`),le=h(e=>`textColors.body.primary(\`${O(e)}\`)`,{marginTop:1,marginBottom:1}),ue=A(`label`);A(`blink`);const de=k(`div`),fe=k(`header`),pe=k(`article`),me=k(`footer`),he=k(`section`),ge=k(`main`),_e=k(`nav`),ve=k(`aside`),j=k(`form`),M=k(`picture`),N=k(`hgroup`),P=k(`dialog`),F=g(e=>`blockquote(${e?`\`${O(e)}\``:`''`})`),ye=()=>({pre:``,value:`
7
+ `,post:``,type:`inline`}),be=h(e=>y(e)),xe=g(e=>x(e));function Se(e,t){let n=e.childNodes?.find(e=>e.nodeName===`code`)??null,r=C(n??e).replaceAll(/\n+$/g,``),i=ae(n??e);return E(e.nodeName,S(r,i),1,1)}const Ce=g((e,t)=>{let n=u(t,`value`,null),r=String(e??``);return y(n&&r&&n!==r?`${r} (${n})`:r||n||``)}),we=h(void 0,{marginTop:1,marginBottom:1}),Te=h(e=>`bold(${b(e)})`),Ee=h(e=>y(` ${String(e??``)}`)),De=(e,t)=>({pre:null,value:`bold(${b(w(e.childNodes?.map(e=>e.value??``).join(``)??``))})`,post:null,type:`inline`,nodeName:e.nodeName});function Oe(e,t){let n=w((e.childNodes?.find(e=>e.nodeName===`summary`)??null)?.childNodes?.map(e=>e.value??``).join(``)??`Details`),r=w((e.childNodes??[]).filter(e=>e.nodeName!==`summary`).map(e=>typeof e.value==`string`?e.value:e.childNodes?.map(e=>e.value??``).join(``)??``).join(`
8
+ `)),i=u(e,`open`,null)===null?`[+]`:`[-]`,a=r?`${i} ${n}\n${r}`:`${i} ${n}`;return E(e.nodeName,`blockquote(${b(a)})`,1,1)}const I=h(),ke=I,Ae=I,je=g(e=>`bold(${b(e)})`);function Me(e,t){let n=w((e.childNodes?.find(e=>e.nodeName===`legend`)??null)?.childNodes?.map(e=>e.value??``).join(``)??``),r=w((e.childNodes??[]).filter(e=>e.nodeName!==`legend`).map(e=>typeof e.value==`string`?e.value:e.childNodes?.map(e=>e.value??``).join(``)??``).join(`
9
+ `)),i=n?`${n}\n${r}`.trim():r;return E(e.nodeName,`blockquote(${b(i)})`,1,1)}const Ne=h(e=>`italic(${b(e)})`);function Pe(e,t){let n=w((e.childNodes?.find(e=>e.nodeName===`figcaption`)??null)?.childNodes?.map(e=>e.value??``).join(``)??``),r=w((e.childNodes??[]).filter(e=>e.nodeName!==`figcaption`).map(e=>typeof e.value==`string`?e.value:e.childNodes?.map(e=>e.value??``).join(``)??``).join(`
10
+ `)),i=n?`${r}\n${n}`.trim():r;return E(e.nodeName,`blockquote(${b(i)})`,1,1)}const L=e=>h(t=>`bold(textColors.heading.${e===1?`primary`:e===2?`secondary`:`tertiary`}(${b(t)}))`,{marginTop:1,marginBottom:1}),Fe=L(1),Ie=L(2),Le=L(3),Re=L(4),ze=L(5),Be=L(6);function Ve(e,t){return E(e.nodeName,`divider({ border: "primary" })`,1,1)}function He(e,t){let n=u(e,`alt`,null),r=u(e,`src`,null),i=n||r?`[Image: ${n||r}]`:`[Image]`;return T(e.nodeName,y(i))}function Ue(e,t){let n=(u(e,`type`,`text`)||`text`).toLowerCase(),r=u(e,`value`,``)||``,i=u(e,`placeholder`,``)||``,a=u(e,`checked`,null)!==null;if(n===`hidden`)return null;if(n===`checkbox`)return T(e.nodeName,y(a?`[x]`:`[ ]`));if(n===`radio`)return T(e.nodeName,y(a?`(o)`:`( )`));if([`submit`,`button`,`reset`].includes(n))return T(e.nodeName,`bold(${JSON.stringify(`[ ${r||n} ]`)})`);if(n===`range`){let t=Number.parseFloat(u(e,`max`,`100`)||`100`),n=Number.parseFloat(u(e,`value`,`0`)||`0`),r=D(n,t,10,`=`,`-`);return T(e.nodeName,y(`[${r}] ${Math.round(n)}/${Math.round(t)}`))}return T(e.nodeName,y(`[${r||i}]`))}const We=g(e=>`bold(${JSON.stringify(`[ ${String(e??`button`)} ]`)})`),Ge=g(e=>y(e)),Ke=h((e,t)=>{let n=Number.parseInt(u(t,`rows`,`0`)||`0`,10),r=C(t);return n>1||r.includes(`
11
+ `)?S(r):y(e)});function qe(e){return(e.childNodes??[]).filter(e=>e.nodeName===`li`)}function R(e,t){let n=qe(e).map((e,n)=>{let r=w(C(e));return`${t(n)} ${r}`.trimEnd()});return E(e.nodeName,y(n.join(`
12
+ `)),1,1)}function z(e,t){let n=u(e,`type`,`disc`)||`disc`,r=n===`square`?`▪`:n===`circle`?`◦`:`•`;return R(e,()=>r)}function Je(e,t){let n=Number.parseInt(u(e,`start`,`1`)||`1`,10);return R(e,e=>`${n+e}.`)}function B(e,t){let n=w(C(e));return E(e.nodeName,y(n))}const Ye=g((e,t)=>{let n=d(t).find(e=>e.startsWith(`message-type-`))?.replace(`message-type-`,``);(!n||!i.includes(n))&&(n=`info`);let r=t.childNodes?.find(e=>e.type===`message-header`||e.type===`message-title`)?.value;return`${n}(${e?`\`${O(e)}\``:`''`}${r?`, \`${O(r)}\``:``})`});function Xe(e,t){let n=Number.parseFloat(u(e,`min`,`0`)||`0`),r=Number.parseFloat(u(e,`max`,`1`)||`1`),i=Number.parseFloat(u(e,`value`,String(n))||String(n)),a=Math.max(0,i-n),o=Math.max(1,r-n),s=C(e).trim(),c=Math.round(a/o*100),l=D(a,o,10,`#`,`-`);return T(e.nodeName,y(`${s?`${s} `:``}[${l}] ${c}%`))}function Ze(e,t){let n=Number.parseFloat(u(e,`max`,`1`)||`1`),r=Number.parseFloat(u(e,`value`,`0`)||`0`),i=C(e).trim(),a=Math.round(Math.max(0,r)/Math.max(1,n)*100),o=D(r,n,10,`=`,`-`);return T(e.nodeName,y(`${i?`${i} `:``}[${o}] ${a}%`))}const Qe=g(e=>y(e)),$e=g(e=>`textColors.body.primary(${JSON.stringify(` (${String(e??``)})`)})`),et=_,tt=g(e=>y(e)),nt=h(e=>`bold(${b(e)})`);function V(e,t=``){let n=[];for(let r of e.childNodes??[]){if(r.nodeName===`optgroup`){let e=u(r,`label`,``)||w(C(r));n.push(`${t}${e}:`),n.push(...V(r,`${t} `));continue}if(r.nodeName===`option`){let e=u(r,`selected`,null)!==null;n.push(`${t}${e?`*`:`-`} ${w(C(r))}`)}}return n}function rt(e,t){let n=V(e);return E(e.nodeName,y(n.join(`
13
+ `)),1,1)}const it=g(e=>y(e));function H(e){if(!e?.childNodes)return[];let t=[];for(let n of e.childNodes){if(n.nodeName===`tr`){t.push(n);continue}[`thead`,`tbody`,`tfoot`].includes(n.nodeName??``)&&t.push(...H(n))}return t}function at(e){return(e.childNodes??[]).filter(e=>[`td`,`th`].includes(e.nodeName??``)).map(e=>w(C(e)))}const ot=h(e=>`italic(${b(e)})`),st=h(),ct=h(),lt=h(),ut=h(),dt=h(),ft=h(),pt=h(e=>y(e)),mt=h(e=>`bold(${b(e)})`);function ht(e,t){let n=H(e).map(at).filter(e=>e.length>0);return E(e.nodeName,`table(${JSON.stringify(n)})`,1,1)}const U=g(e=>y(e)),W=g(e=>`bold(${b(e)})`),G=g(e=>`italic(${b(e)})`),K=g(e=>`underline(${b(e)})`),q=g(e=>`strikethrough(${b(e)})`),J=g(e=>x(e)),gt=W,_t=U,vt=U,yt=U,bt=W,xt=G,St=q,Ct=G,wt=U,Tt=G,Et=K,Dt=G,Ot=J,kt=g(e=>`underline(bold(${b(e)}))`),At=U,jt=g(e=>y(`"${String(e??``)}"`)),Mt=q,Nt=J,Pt=U,Ft=q,It=q,Lt=W,Y=U,Rt=U,zt=U,Bt=J,Vt=K,Ht=K,Ut=J;var X={"#text":te,a:ne,abbr:v,acronym:re,address:oe,applet:_,area:_,article:pe,aside:ve,audio:_,b:gt,base:_,basefont:_,bdi:_t,bdo:vt,bgsound:_,big:yt,blink:se,dialog:P,div:de,blockquote:F,body:Ae,bold:bt,br:ye,button:We,canvas:_,caption:ot,center:be,cite:xt,code:xe,col:dt,colgroup:ft,data:Ce,datalist:_,dd:Ee,del:St,details:Oe,dfn:ie,footer:me,form:j,dl:we,dt:Te,em:Ct,embed:_,fieldset:Me,figcaption:Ne,figure:Pe,font:wt,frame:_,frameset:_,h1:Fe,h2:Ie,h3:Le,h4:Re,h5:ze,h6:Be,head:_,header:fe,hgroup:N,hr:Ve,html:ke,i:Tt,iframe:_,img:He,input:Ue,ins:Et,italic:Dt,kbd:Ot,keygen:_,label:ue,legend:je,li:B,link:_,main:ge,map:_,mark:kt,marquee:ce,math:_,menu:z,menuitem:B,message:Ye,meta:_,meter:Xe,nav:_e,nobr:At,noframes:_,noscript:_,object:_,ol:Je,optgroup:nt,option:tt,output:Ge,p:le,param:_,picture:M,plaintext:_,portal:_,pre:Se,progress:Ze,q:jt,rp:et,rt:$e,ruby:Qe,s:Mt,samp:Nt,script:_,section:he,select:rt,slot:_,small:Pt,source:_,span:it,strike:Ft,strikethrough:It,strong:Lt,style:_,sub:Y,summary:De,sup:Rt,svg:_,table:ht,tbody:lt,td:pt,template:_,textarea:Ke,tfoot:ut,th:mt,thead:ct,time:zt,title:_,tr:st,track:_,tt:Bt,u:Vt,ul:z,underline:Ht,var:Ut,video:_,wbr:_,xmp:_};const Z=process.env.CACHE_RENDER!==`false`,Q=new WeakMap,Wt=(e,t)=>{if(!Z||!e||typeof e!=`object`)return;let n=Q.get(e);if(n)return n.get(JSON.stringify({lineWidth:t.lineWidth,pre:t.pre,listDepth:t.listDepth,listType:t.listType,depth:t.depth}))},Gt=(e,t,n)=>{if(!Z||!e||typeof e!=`object`)return;let r=Q.get(e);if(r||(r=new Map,Q.set(e,r)),r.set(JSON.stringify({lineWidth:t.lineWidth,pre:t.pre,listDepth:t.listDepth,listType:t.listType,depth:t.depth}),n),r.size>10){let e=r.keys().next().value;r.delete(e)}},$=(e,t,n=X.div)=>{if(!e)return null;let r=t.depth??0;if(r>=100)return null;let i={...t,depth:r+1},a=Wt(e,i);if(a!==void 0)return a;let o=null;try{o=(X[e.nodeName||`#text`]||n)(e,i),Gt(e,i,o)}catch{o=null}return o};function Kt(t,n={}){return`${$(e(t,{sourceCodeLocationInfo:!0}),a(n))}\n`}export{Kt as t};
14
+ //# sourceMappingURL=html-Dw6VvFHa.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html-Dw6VvFHa.mjs","names":["tags","blink","parameter","tags"],"sources":["../src/html/helpers/options.ts","../src/html/helpers/concat.ts","../src/html/helpers/get-attribute.ts","../src/html/helpers/wrap-line-width.ts","../src/html/helpers/tag-utilities.ts","../src/html/tags/a.ts","../src/html/tags/abbr.ts","../src/html/tags/common.ts","../src/html/tags/address.ts","../src/html/tags/animations.ts","../src/html/helpers/escape-text.ts","../src/html/tags/base-tags.ts","../src/html/tags/blockquote.ts","../src/html/tags/br.ts","../src/html/tags/center.ts","../src/html/tags/code.ts","../src/html/tags/data.ts","../src/html/tags/definitions.ts","../src/html/tags/details.ts","../src/html/tags/document.ts","../src/html/tags/fieldset.ts","../src/html/tags/figure.ts","../src/html/tags/headers.ts","../src/html/tags/hr.ts","../src/html/tags/img.ts","../src/html/tags/inputs.ts","../src/html/tags/list.ts","../src/html/tags/message.ts","../src/html/tags/meter.ts","../src/html/tags/progress.ts","../src/html/tags/ruby.ts","../src/html/tags/select.ts","../src/html/tags/span.ts","../src/html/tags/table.ts","../src/html/tags/text-styles.ts","../src/html/tags/index.ts","../src/html/helpers/render.ts","../src/html/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Options, ResolvedOptions } from \"../../types\";\n\nexport const getOptions = (input: Options): ResolvedOptions => {\n return {\n pre: false,\n lineWidth: 120,\n fontAttrs: true,\n depth: 0,\n asciiMode: false,\n ...input\n };\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n BlockTagInput,\n BlockTagValue,\n InlineTagValue\n} from \"./tag-utilities\";\n\nconst toMarginNumber = (value: string | number | undefined) => {\n if (value == null) {\n return 0;\n }\n\n const parsed = Number(value);\n\n return Number.isFinite(parsed) ? parsed : 0;\n};\n\nexport const concatTwoBlockTags = (\n first: BlockTagInput | null,\n second: BlockTagInput | null\n): BlockTagValue | null => {\n if (!first && !second) {\n return null;\n }\n\n if (first) {\n const secondMarginTop = toMarginNumber(second!.marginTop);\n const secondMarginBottom = toMarginNumber(second!.marginBottom);\n\n return {\n ...second,\n marginTop: secondMarginTop,\n marginBottom: secondMarginBottom\n } as BlockTagValue;\n }\n\n if (second) {\n const firstMarginTop = toMarginNumber(first!.marginTop);\n const firstMarginBottom = toMarginNumber(first!.marginBottom);\n\n return {\n ...first!,\n marginTop: firstMarginTop,\n marginBottom: firstMarginBottom\n } as BlockTagValue;\n }\n\n const firstMarginTop = toMarginNumber(first!.marginTop);\n const firstMarginBottom = toMarginNumber(first!.marginBottom);\n const secondMarginTop = toMarginNumber(second!.marginTop);\n const secondMarginBottom = toMarginNumber(second!.marginBottom);\n\n if (!(second as unknown as BlockTagInput).value) {\n return {\n marginTop: firstMarginTop,\n value: first!.value,\n marginBottom: Math.max(\n firstMarginBottom,\n secondMarginTop,\n secondMarginBottom\n )\n } as BlockTagValue;\n }\n\n if (!(first as unknown as BlockTagInput).value) {\n return {\n marginTop: Math.max(firstMarginTop, firstMarginBottom, secondMarginTop),\n value: second!.value,\n marginBottom: secondMarginBottom\n } as BlockTagValue;\n }\n\n const separatorLines = Math.max(firstMarginBottom, secondMarginTop);\n\n return {\n marginTop: firstMarginTop,\n value: `${first!.value}${\"\\n\".repeat(separatorLines)}${second!.value}`,\n marginBottom: secondMarginBottom\n } as BlockTagValue;\n};\n\nexport const concatTwoInlineTags = (\n first: InlineTagValue | null,\n second: InlineTagValue | null\n): InlineTagValue | null => {\n if (first == null && second == null) {\n return null;\n }\n\n if (first == null) {\n return second;\n }\n\n if (second == null) {\n return first;\n }\n\n if (second.value == null) {\n return {\n pre: first.pre,\n value: first.value,\n post: first.post ?? second.pre ?? second.post ?? \"\",\n type: \"inline\",\n nodeName: first.nodeName\n };\n }\n\n if (first.value == null) {\n return {\n pre: first.pre ?? first.post ?? second.pre ?? \"\",\n value: second.value,\n post: second.post,\n type: \"inline\",\n nodeName: second.nodeName\n };\n }\n\n if (first.post != null) {\n return {\n pre: first.pre,\n value: `${first.value}${first.post}${second.value}`,\n post: second.post,\n type: \"inline\",\n nodeName: second.nodeName\n };\n }\n\n if (second.pre != null) {\n return {\n pre: first.pre,\n value: `${first.value}${second.pre}${second.value}`,\n post: second.post,\n type: \"inline\",\n nodeName: second.nodeName\n };\n }\n\n return {\n pre: first.pre,\n value: `${first.value}${second.value}`,\n post: second.post,\n type: \"inline\",\n nodeName: second.nodeName\n };\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { HtmlNode } from \"./tag-utilities\";\n\nconst attributeCache = new WeakMap<HtmlNode, Map<string, string | null>>();\n\n/**\n * Get attribute value from tag with validation and caching\n * @param tag - HTML tag object\n * @param attributeName - Name of attribute to get\n * @param defaultValue - Default value if attribute not found\n * @returns Attribute value or default\n */\nexport const getAttribute = (\n tag: HtmlNode,\n attributeName: string | unknown,\n defaultValue: string | null = null\n): string | null => {\n // Validate inputs\n if (!tag || typeof tag !== \"object\") {\n return defaultValue;\n }\n\n if (!attributeName || typeof attributeName !== \"string\") {\n return defaultValue;\n }\n\n // Check cache first\n let tagCache = attributeCache.get(tag);\n if (tagCache) {\n const cachedValue = tagCache.get(attributeName);\n if (cachedValue !== undefined) {\n return cachedValue ?? defaultValue;\n }\n }\n\n // Not in cache, compute value\n if (!tag.attrs || !Array.isArray(tag.attrs) || tag.attrs.length === 0) {\n // Cache the miss\n if (!tagCache) {\n tagCache = new Map();\n attributeCache.set(tag, tagCache);\n }\n tagCache.set(attributeName, null);\n return defaultValue;\n }\n\n const attribute = tag.attrs.find(\n attr => attr && typeof attr === \"object\" && attr.name === attributeName\n );\n\n // Cache the result\n if (!tagCache) {\n tagCache = new Map();\n attributeCache.set(tag, tagCache);\n }\n\n if (!attribute || attribute.value === undefined) {\n tagCache.set(attributeName, null);\n return defaultValue;\n }\n\n const value = attribute.value;\n tagCache.set(attributeName, value);\n return value;\n};\n\nexport function getClassNames(tag: HtmlNode): string[] {\n const classAttr = getAttribute(tag, \"class\", null);\n if (!classAttr) {\n return [];\n }\n\n return classAttr\n .split(/\\s+/)\n .map(className => className.trim())\n .filter(className => className.length > 0);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport wrapAnsi from \"wrap-ansi\";\nimport type { RenderContext } from \"./tag-utilities\";\n\nexport const wrapLineWidth = (text: string, context: RenderContext) =>\n wrapAnsi(text, context.lineWidth ?? 80, { trim: !context.pre });\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport he from \"he\";\nimport normalizeWhitespace from \"normalize-html-whitespace\";\nimport tags from \"../tags\";\nimport { concatTwoBlockTags, concatTwoInlineTags } from \"./concat\";\nimport { getAttribute } from \"./get-attribute\";\nimport { renderTag } from \"./render\";\nimport { wrapLineWidth } from \"./wrap-line-width\";\n\nconst decodeHtml = he.decode as (value: string) => string;\nconst normalizeHtmlWhitespace = normalizeWhitespace as (\n value: string\n) => string;\n\nexport type WrapValue = string | null | undefined;\n\nexport interface HtmlAttribute {\n name: string;\n value?: string;\n}\n\nexport interface HtmlNode {\n nodeName?: string;\n value?: string;\n childNodes?: HtmlNode[];\n attrs?: HtmlAttribute[];\n block?: BlockTagValue;\n inline?: InlineTagValue;\n [key: string]: unknown;\n}\n\nexport interface RenderContext {\n pre?: boolean | null;\n liItemNumber?: number;\n lineWidth?: number;\n listDepth?: number;\n listType?: string;\n depth?: number;\n}\n\nexport interface InlineTagValue {\n pre: string | null;\n value: string | null;\n post: string | null;\n type: \"inline\";\n nodeName: string | undefined;\n}\n\nexport interface BlockTagInput {\n marginTop?: number | string;\n marginBottom?: number | string;\n value: string | null;\n type: \"block\";\n nodeName: string | undefined;\n}\n\nexport interface BlockTagValue extends BlockTagInput {\n marginTop: number;\n marginBottom: number;\n}\n\nexport type RenderedTag = InlineTagValue | BlockTagValue;\n\nexport interface BlockTagAccumulator {\n block: BlockTagValue | null;\n inline: InlineTagValue | null;\n}\n\nexport type BlockTagWrapper = (\n value: string,\n tag: HtmlNode,\n context: RenderContext\n) => string | null;\n\nexport type InlineTagWrapper = (\n value: WrapValue,\n tag: HtmlNode,\n context: RenderContext\n) => string | null;\n\nexport interface BlockTagMargins {\n marginTop?: number;\n marginBottom?: number;\n}\n\nexport const inlineToBlockTag = (\n value: InlineTagValue | null\n): BlockTagValue | null => {\n if (!value) {\n return null;\n }\n\n return {\n ...value,\n marginTop: 0,\n marginBottom: 0,\n type: \"block\",\n nodeName: \"#blockTag\"\n };\n};\n\nexport const textNode = (\n tag: HtmlNode,\n context: RenderContext\n): InlineTagValue => {\n const textValue = String(tag.value ?? \"\");\n\n if (context.pre) {\n return {\n pre: null,\n value: decodeHtml(textValue),\n post: null,\n type: \"inline\",\n nodeName: \"#text\"\n };\n }\n\n const normalized = [\n ...(normalizeHtmlWhitespace(textValue) || \"\").replaceAll(\"\\n\", \" \")\n ];\n\n const pre = [\" \", \"\\n\"].includes(normalized[0] ?? \"\")\n ? (normalized.shift() ?? null)\n : null;\n const post = [\" \", \"\\n\"].includes(normalized.at(-1) ?? \"\")\n ? (normalized.pop() ?? null)\n : null;\n\n return {\n pre,\n value: normalized.length > 0 ? `${decodeHtml(normalized.join(\"\"))}` : null,\n post,\n type: \"inline\",\n nodeName: \"#text\"\n };\n};\n\n/**\n * A helper function to render block-level HTML tags, processing their child nodes and applying appropriate margins and formatting based on the provided context and wrapper function. The function handles both block and inline child nodes, concatenating their rendered output while managing whitespace and line breaks to ensure proper display in terminal environments.\n *\n * @param wrapper - A function that takes the rendered content of the block tag and returns a potentially modified version of it. This allows for custom processing or styling to be applied to the content of the block tag.\n * @param localContext - An optional context object that can be used to provide additional information or configuration for rendering the block tag. This context can include properties such as margin settings, theme information, or any other relevant data that may influence how the block tag is rendered.\n * @returns A function that renders a block-level HTML tag, processing its child nodes and applying appropriate margins and formatting based on the provided context and wrapper function. The function handles both block and inline child nodes, concatenating their rendered output while managing whitespace and line breaks to ensure proper display in terminal environments.\n */\nexport function blockTag(\n wrapper?: BlockTagWrapper,\n localContext?: BlockTagMargins\n): (tag: HtmlNode, context: RenderContext) => BlockTagValue | null {\n return (tag: HtmlNode, context: RenderContext): BlockTagValue | null => {\n const wrapFunction: BlockTagWrapper =\n wrapper ?? ((argument: string) => argument);\n\n if (!tag || !tag.childNodes) {\n return null;\n }\n\n let liItemNumber = Number.parseInt(\n getAttribute(tag, \"start\", \"1\") ?? \"1\",\n 10\n );\n const value = tag.childNodes.reduce(\n (ret: BlockTagAccumulator, node: HtmlNode) => {\n const nodeTag = renderTag(node, {\n ...context,\n liItemNumber\n }) as RenderedTag | null;\n\n if (!nodeTag) {\n return ret;\n }\n\n if (nodeTag.nodeName === \"li\") {\n liItemNumber += 1;\n }\n\n if (nodeTag.type === \"inline\") {\n return {\n block: ret.block,\n inline: concatTwoInlineTags(ret.inline, nodeTag)\n };\n }\n\n if (ret.inline && ret.inline.value) {\n ret.inline.value = wrapLineWidth(ret.inline.value, context);\n }\n\n ret.block = concatTwoBlockTags(\n ret.block ?? null,\n inlineToBlockTag(ret.inline) ?? null\n );\n\n ret.block = concatTwoBlockTags(ret.block ?? null, nodeTag);\n\n return {\n block: ret.block,\n inline: null\n };\n },\n {\n block: null,\n inline: null\n } as BlockTagAccumulator\n );\n\n if (value.inline && value.inline.value) {\n value.inline.value = wrapLineWidth(value.inline.value, context);\n }\n\n value.block = concatTwoBlockTags(\n value.block ?? null,\n inlineToBlockTag(value.inline) ?? null\n );\n\n let topBlock = localContext?.marginTop ?? 0;\n\n topBlock = !context || !context.pre ? topBlock + 1 : topBlock;\n\n let bottomBlock = localContext?.marginBottom ?? 0;\n\n bottomBlock = !context || !context.pre ? bottomBlock + 1 : bottomBlock;\n\n // Handle empty content - return empty string with margins instead of null\n if (!value.block || !value.block.value) {\n return {\n marginTop: topBlock,\n value: \"\",\n marginBottom: bottomBlock,\n type: \"block\",\n nodeName: tag.nodeName\n };\n }\n\n return {\n marginTop:\n value.block.marginTop && value.block.marginTop > topBlock\n ? value.block.marginTop\n : topBlock,\n value: wrapFunction(value.block.value, tag, context),\n marginBottom:\n value.block.marginBottom && value.block.marginBottom > bottomBlock\n ? value.block.marginBottom\n : bottomBlock,\n type: \"block\",\n nodeName: tag.nodeName\n };\n };\n}\n\nexport const inlineTag =\n (wrapper?: InlineTagWrapper) =>\n (tag: HtmlNode, context: RenderContext): InlineTagValue | undefined => {\n const wrapFunction: InlineTagWrapper =\n wrapper ?? ((argument: WrapValue) => argument ?? null);\n\n const spanTag = (tags as Record<string, unknown>).span;\n\n if (!tag || !tag.childNodes) {\n return undefined;\n }\n\n const value = tag.childNodes.reduce(\n (accumulator: InlineTagValue | null, node: HtmlNode) => {\n const nodeTag = renderTag(\n node,\n context,\n spanTag as Parameters<typeof renderTag>[2]\n ) as RenderedTag | null;\n\n if (!nodeTag) {\n return accumulator;\n }\n\n return {\n ...concatTwoInlineTags(accumulator, nodeTag as InlineTagValue),\n type: \"inline\",\n nodeName: tag.nodeName\n } as InlineTagValue;\n },\n null as InlineTagValue | null\n );\n\n return {\n pre: value?.pre ? wrapFunction(value.pre, tag, context) : null,\n value: wrapFunction(value?.value, tag, context),\n post: value?.post ? wrapFunction(value.post, tag, context) : null,\n type: \"inline\",\n nodeName: tag.nodeName\n };\n };\n\nexport const voidTag = (): undefined => undefined;\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getAttribute } from \"../helpers/get-attribute\";\nimport { inlineTag } from \"../helpers/tag-utilities\";\n\nexport const a = inlineTag((_, tag, __) => {\n const rawHref = getAttribute(tag, \"href\", null);\n const rawTitle = getAttribute(tag, \"title\", null);\n\n const href =\n !rawHref ||\n [\n \"file://\",\n \"http://\",\n \"https://\",\n \"mailto:\",\n \"ftp://\",\n \"ftps://\",\n \"sftp://\",\n \"ssh://\",\n \"dav://\",\n \"tel:\",\n \"git://\"\n ].some(url => rawHref.startsWith(url))\n ? rawHref\n : null;\n\n return href\n ? `link(\"${href}\", ${rawTitle ? `\"${rawTitle}\", ` : \"\"}${\n href && (href.startsWith(\"http://\") || href.startsWith(\"https://\"))\n ? \"true\"\n : \"false\"\n })`\n : rawTitle\n ? `\"${rawTitle}\"`\n : \"\";\n});\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getAttribute } from \"../helpers/get-attribute\";\nimport { inlineTag } from \"../helpers/tag-utilities\";\n\nexport const abbr = inlineTag((value, tag) => {\n const title = getAttribute(tag, \"title\", null);\n\n return value ? (title ? `${value} (${title})` : value) : \"\";\n});\n\nexport const acronym = abbr;\n\nexport const dfn = abbr;\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getAttribute } from \"../helpers/get-attribute\";\nimport type {\n BlockTagValue,\n HtmlNode,\n InlineTagValue,\n WrapValue\n} from \"../helpers/tag-utilities\";\n\nexport function bodyText(value: WrapValue): string {\n return `textColors.body.primary(${JSON.stringify(String(value ?? \"\"))})`;\n}\n\nexport function quoted(value: WrapValue): string {\n return JSON.stringify(String(value ?? \"\"));\n}\n\nexport function inlineCodeText(value: WrapValue): string {\n return `inlineCode(${quoted(value)})`;\n}\n\nexport function codeBlockText(value: string, language?: string | null): string {\n return `code(${JSON.stringify(value)}${\n language ? `, ${JSON.stringify(language)}` : \"\"\n })`;\n}\n\nexport function getTextContent(node: HtmlNode | null | undefined): string {\n if (!node) {\n return \"\";\n }\n\n if (typeof node.value === \"string\") {\n return node.value;\n }\n\n if (!node.childNodes || node.childNodes.length === 0) {\n return \"\";\n }\n\n return node.childNodes.map(childNode => getTextContent(childNode)).join(\"\");\n}\n\nexport function normalizeText(value: string): string {\n return value.replaceAll(/\\s+/g, \" \").trim();\n}\n\nexport function asInline(\n nodeName: string | undefined,\n value: string | null,\n pre: string | null = null,\n post: string | null = null\n): InlineTagValue {\n return {\n pre,\n value,\n post,\n type: \"inline\",\n nodeName\n };\n}\n\nexport function asBlock(\n nodeName: string | undefined,\n value: string | null,\n marginTop = 0,\n marginBottom = 0\n): BlockTagValue {\n return {\n marginTop,\n value,\n marginBottom,\n type: \"block\",\n nodeName\n };\n}\n\nexport function extractLanguage(\n node: HtmlNode | null | undefined\n): string | null {\n if (!node) {\n return null;\n }\n\n const classNames =\n getAttribute(node, \"class\", \"\")\n ?.split(/\\s+/)\n .map(className => className.trim())\n .filter(Boolean) ?? [];\n\n for (const className of classNames) {\n if (className.startsWith(\"language-\")) {\n return className.slice(\"language-\".length) || null;\n }\n\n if (className.startsWith(\"lang-\")) {\n return className.slice(\"lang-\".length) || null;\n }\n }\n\n return null;\n}\n\nexport function findFirstDescendant(\n node: HtmlNode | null | undefined,\n nodeName: string\n): HtmlNode | null {\n if (!node?.childNodes) {\n return null;\n }\n\n for (const childNode of node.childNodes) {\n if (childNode.nodeName === nodeName) {\n return childNode;\n }\n\n const nested = findFirstDescendant(childNode, nodeName);\n\n if (nested) {\n return nested;\n }\n }\n\n return null;\n}\n\nexport function findDescendants(\n node: HtmlNode | null | undefined,\n nodeName: string\n): HtmlNode[] {\n if (!node?.childNodes) {\n return [];\n }\n\n const matches: HtmlNode[] = [];\n\n for (const childNode of node.childNodes) {\n if (childNode.nodeName === nodeName) {\n matches.push(childNode);\n }\n\n matches.push(...findDescendants(childNode, nodeName));\n }\n\n return matches;\n}\n\nexport function buildBar(\n value: number,\n max: number,\n width = 10,\n filled = \"#\",\n empty = \"-\"\n): string {\n if (!Number.isFinite(value) || !Number.isFinite(max) || max <= 0) {\n return empty.repeat(width);\n }\n\n const ratio = Math.max(0, Math.min(1, value / max));\n const fillCount = Math.round(ratio * width);\n\n return (\n filled.repeat(fillCount) + empty.repeat(Math.max(width - fillCount, 0))\n );\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { blockTag } from \"../helpers/tag-utilities\";\nimport { bodyText } from \"./common\";\n\nexport const address = blockTag(value => bodyText(value));\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { inlineTag } from \"../helpers/tag-utilities\";\nimport { bodyText } from \"./common\";\n\nexport const blink = inlineTag(value => bodyText(value));\n\nexport const marquee = inlineTag(value => bodyText(value));\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { WrapValue } from \"./tag-utilities\";\n\nexport function escapeText(text: WrapValue): string {\n return String(text ?? \"\")\n .replaceAll(\"\\\\\", \"\\\\\\\\\")\n .replaceAll(\"`\", \"\\\\`\")\n .replaceAll(\"${\", \"\\\\${\")\n .replaceAll(\"\\n\", \"\\\\n\")\n .replaceAll(\"\\r\", \"\\\\r\")\n .replaceAll(\"\\t\", \"\\\\t\");\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { escapeText } from \"../helpers/escape-text\";\nimport { blockTag, inlineTag } from \"../helpers/tag-utilities\";\n\n// Helper to create colored block element\nconst createBlock = (_: string) =>\n blockTag(value => {\n return `textColors.body.primary(\\`${escapeText(value)}\\`)`;\n });\n\n// Helper to create colored inline element\nconst createInline = (_: string) =>\n inlineTag(value => {\n return `textColors.body.primary(\\`${escapeText(value)}\\`)`;\n });\n\n// Paragraph with margins\nexport const p = blockTag(\n value => {\n return `textColors.body.primary(\\`${escapeText(value)}\\`)`;\n },\n { marginTop: 1, marginBottom: 1 }\n);\n\n// Inline elements - each uses its own theme\nexport const label = createInline(\"label\");\nexport const blink = createInline(\"blink\");\n\n// Block container elements - each uses its own theme\nexport const div = createBlock(\"div\");\nexport const header = createBlock(\"header\");\nexport const article = createBlock(\"article\");\nexport const footer = createBlock(\"footer\");\nexport const section = createBlock(\"section\");\nexport const main = createBlock(\"main\");\nexport const nav = createBlock(\"nav\");\nexport const aside = createBlock(\"aside\");\nexport const form = createBlock(\"form\");\nexport const picture = createBlock(\"picture\");\nexport const hgroup = createBlock(\"hgroup\");\nexport const dialog = createBlock(\"dialog\");\n\n// figcaption is now handled internally by figure.js (similar to table/caption)\n// export moved to lib/tags/figure.js\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { escapeText } from \"../helpers/escape-text\";\nimport { inlineTag } from \"../helpers/tag-utilities\";\n\nexport const blockquote = inlineTag(value => {\n return `blockquote(${value ? `\\`${escapeText(value)}\\`` : \"''\"})`;\n});\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const br = () => ({\n pre: \"\",\n value: \"\\n\",\n post: \"\",\n type: \"inline\"\n});\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { blockTag } from \"../helpers/tag-utilities\";\nimport { bodyText } from \"./common\";\n\nexport const center = blockTag(value => bodyText(value));\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { HtmlNode, RenderContext } from \"../helpers/tag-utilities\";\nimport { inlineTag } from \"../helpers/tag-utilities\";\nimport {\n asBlock,\n codeBlockText,\n extractLanguage,\n getTextContent,\n inlineCodeText\n} from \"./common\";\n\nexport const code = inlineTag(value => inlineCodeText(value));\n\nexport function pre(tag: HtmlNode, _context: RenderContext) {\n const codeTag =\n tag.childNodes?.find(childNode => childNode.nodeName === \"code\") ?? null;\n const contentNode = codeTag ?? tag;\n const value = getTextContent(contentNode).replaceAll(/\\n+$/g, \"\");\n const language = extractLanguage(codeTag ?? tag);\n\n return asBlock(tag.nodeName, codeBlockText(value, language), 1, 1);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getAttribute } from \"../helpers/get-attribute\";\nimport { inlineTag } from \"../helpers/tag-utilities\";\nimport { bodyText } from \"./common\";\n\nexport const data = inlineTag((value, tag) => {\n const dataValue = getAttribute(tag, \"value\", null);\n const normalized = String(value ?? \"\");\n\n if (dataValue && normalized && dataValue !== normalized) {\n return bodyText(`${normalized} (${dataValue})`);\n }\n\n return bodyText(normalized || dataValue || \"\");\n});\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { blockTag } from \"../helpers/tag-utilities\";\nimport { bodyText, quoted } from \"./common\";\n\nexport const dl = blockTag(undefined, { marginTop: 1, marginBottom: 1 });\n\nexport const dt = blockTag(value => `bold(${quoted(value)})`);\n\nexport const dd = blockTag(value => bodyText(` ${String(value ?? \"\")}`));\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getAttribute } from \"../helpers/get-attribute\";\nimport type { HtmlNode, RenderContext } from \"../helpers/tag-utilities\";\nimport { asBlock, normalizeText, quoted } from \"./common\";\n\nexport const summary = (tag: HtmlNode, _context: RenderContext) => {\n const text = normalizeText(\n tag.childNodes?.map(childNode => childNode.value ?? \"\").join(\"\") ?? \"\"\n );\n\n return {\n pre: null,\n value: `bold(${quoted(text)})`,\n post: null,\n type: \"inline\" as const,\n nodeName: tag.nodeName\n };\n};\n\nexport function details(tag: HtmlNode, _context: RenderContext) {\n const summaryTag =\n tag.childNodes?.find(childNode => childNode.nodeName === \"summary\") ?? null;\n const summaryText = normalizeText(\n summaryTag?.childNodes?.map(childNode => childNode.value ?? \"\").join(\"\") ??\n \"Details\"\n );\n const content = normalizeText(\n (tag.childNodes ?? [])\n .filter(childNode => childNode.nodeName !== \"summary\")\n .map(childNode => {\n if (typeof childNode.value === \"string\") {\n return childNode.value;\n }\n\n return (\n childNode.childNodes\n ?.map(grandchildNode => grandchildNode.value ?? \"\")\n .join(\"\") ?? \"\"\n );\n })\n .join(\"\\n\")\n );\n const prefix = getAttribute(tag, \"open\", null) !== null ? \"[-]\" : \"[+]\";\n const value = content\n ? `${prefix} ${summaryText}\\n${content}`\n : `${prefix} ${summaryText}`;\n\n return asBlock(tag.nodeName, `blockquote(${quoted(value)})`, 1, 1);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { blockTag } from \"../helpers/tag-utilities\";\n\nconst documentTag = blockTag();\n\nexport const html = documentTag;\n\nexport const body = documentTag;\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n inlineTag,\n type HtmlNode,\n type RenderContext\n} from \"../helpers/tag-utilities\";\nimport { asBlock, normalizeText, quoted } from \"./common\";\n\nexport const legend = inlineTag(value => `bold(${quoted(value)})`);\n\nexport function fieldset(tag: HtmlNode, _context: RenderContext) {\n const legendTag =\n tag.childNodes?.find(childNode => childNode.nodeName === \"legend\") ?? null;\n const legendText = normalizeText(\n legendTag?.childNodes?.map(childNode => childNode.value ?? \"\").join(\"\") ??\n \"\"\n );\n const content = normalizeText(\n (tag.childNodes ?? [])\n .filter(childNode => childNode.nodeName !== \"legend\")\n .map(childNode => {\n if (typeof childNode.value === \"string\") {\n return childNode.value;\n }\n\n return (\n childNode.childNodes\n ?.map(grandchildNode => grandchildNode.value ?? \"\")\n .join(\"\") ?? \"\"\n );\n })\n .join(\"\\n\")\n );\n const value = legendText ? `${legendText}\\n${content}`.trim() : content;\n\n return asBlock(tag.nodeName, `blockquote(${quoted(value)})`, 1, 1);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { HtmlNode, RenderContext } from \"../helpers/tag-utilities\";\nimport { blockTag } from \"../helpers/tag-utilities\";\nimport { asBlock, normalizeText, quoted } from \"./common\";\n\nexport const figcaption = blockTag(value => `italic(${quoted(value)})`);\n\nexport function figure(tag: HtmlNode, _context: RenderContext) {\n const captionTag =\n tag.childNodes?.find(childNode => childNode.nodeName === \"figcaption\") ??\n null;\n const caption = normalizeText(\n captionTag?.childNodes?.map(childNode => childNode.value ?? \"\").join(\"\") ??\n \"\"\n );\n const content = normalizeText(\n (tag.childNodes ?? [])\n .filter(childNode => childNode.nodeName !== \"figcaption\")\n .map(childNode => {\n if (typeof childNode.value === \"string\") {\n return childNode.value;\n }\n\n return (\n childNode.childNodes\n ?.map(grandchildNode => grandchildNode.value ?? \"\")\n .join(\"\") ?? \"\"\n );\n })\n .join(\"\\n\")\n );\n const value = caption ? `${content}\\n${caption}`.trim() : content;\n\n return asBlock(tag.nodeName, `blockquote(${quoted(value)})`, 1, 1);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { blockTag } from \"../helpers/tag-utilities\";\nimport { quoted } from \"./common\";\n\nconst createHeading = (level: 1 | 2 | 3 | 4 | 5 | 6) =>\n blockTag(\n value =>\n `bold(textColors.heading.${\n level === 1 ? \"primary\" : level === 2 ? \"secondary\" : \"tertiary\"\n }(${quoted(value)}))`,\n { marginTop: 1, marginBottom: 1 }\n );\n\nexport const h1 = createHeading(1);\nexport const h2 = createHeading(2);\nexport const h3 = createHeading(3);\nexport const h4 = createHeading(4);\nexport const h5 = createHeading(5);\nexport const h6 = createHeading(6);\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { HtmlNode, RenderContext } from \"../helpers/tag-utilities\";\nimport { asBlock } from \"./common\";\n\nexport function hr(tag: HtmlNode, _context: RenderContext) {\n return asBlock(tag.nodeName, 'divider({ border: \"primary\" })', 1, 1);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getAttribute } from \"../helpers/get-attribute\";\nimport type { HtmlNode, RenderContext } from \"../helpers/tag-utilities\";\nimport { asInline, bodyText } from \"./common\";\n\nexport function img(tag: HtmlNode, _context: RenderContext) {\n const alt = getAttribute(tag, \"alt\", null);\n const src = getAttribute(tag, \"src\", null);\n const value = alt || src ? `[Image: ${alt || src}]` : \"[Image]\";\n\n return asInline(tag.nodeName, bodyText(value));\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getAttribute } from \"../helpers/get-attribute\";\nimport type { HtmlNode, RenderContext } from \"../helpers/tag-utilities\";\nimport { blockTag, inlineTag } from \"../helpers/tag-utilities\";\nimport {\n asInline,\n bodyText,\n buildBar,\n codeBlockText,\n getTextContent\n} from \"./common\";\n\nexport function input(tag: HtmlNode, _context: RenderContext) {\n const type = (getAttribute(tag, \"type\", \"text\") || \"text\").toLowerCase();\n const value = getAttribute(tag, \"value\", \"\") || \"\";\n const placeholder = getAttribute(tag, \"placeholder\", \"\") || \"\";\n const checked = getAttribute(tag, \"checked\", null) !== null;\n\n if (type === \"hidden\") {\n return null;\n }\n\n if (type === \"checkbox\") {\n return asInline(tag.nodeName, bodyText(checked ? \"[x]\" : \"[ ]\"));\n }\n\n if (type === \"radio\") {\n return asInline(tag.nodeName, bodyText(checked ? \"(o)\" : \"( )\"));\n }\n\n if ([\"submit\", \"button\", \"reset\"].includes(type)) {\n return asInline(\n tag.nodeName,\n `bold(${JSON.stringify(`[ ${value || type} ]`)})`\n );\n }\n\n if (type === \"range\") {\n const max = Number.parseFloat(getAttribute(tag, \"max\", \"100\") || \"100\");\n const current = Number.parseFloat(getAttribute(tag, \"value\", \"0\") || \"0\");\n const bar = buildBar(current, max, 10, \"=\", \"-\");\n\n return asInline(\n tag.nodeName,\n bodyText(`[${bar}] ${Math.round(current)}/${Math.round(max)}`)\n );\n }\n\n return asInline(tag.nodeName, bodyText(`[${value || placeholder}]`));\n}\n\nexport const button = inlineTag(\n value => `bold(${JSON.stringify(`[ ${String(value ?? \"button\")} ]`)})`\n);\n\nexport const output = inlineTag(value => bodyText(value));\n\nexport const textarea = blockTag((value, tag) => {\n const rows = Number.parseInt(getAttribute(tag, \"rows\", \"0\") || \"0\", 10);\n const content = getTextContent(tag);\n const rendered =\n rows > 1 || content.includes(\"\\n\")\n ? codeBlockText(content)\n : bodyText(value);\n\n return rendered;\n});\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getAttribute } from \"../helpers/get-attribute\";\nimport type { HtmlNode, RenderContext } from \"../helpers/tag-utilities\";\nimport { asBlock, bodyText, getTextContent, normalizeText } from \"./common\";\n\nfunction getListItems(tag: HtmlNode): HtmlNode[] {\n return (tag.childNodes ?? []).filter(\n childNode => childNode.nodeName === \"li\"\n );\n}\n\nfunction renderList(\n tag: HtmlNode,\n markerFactory: (index: number) => string\n): ReturnType<typeof asBlock> {\n const items = getListItems(tag);\n const lines = items.map((item, index) => {\n const text = normalizeText(getTextContent(item));\n\n return `${markerFactory(index)} ${text}`.trimEnd();\n });\n\n return asBlock(tag.nodeName, bodyText(lines.join(\"\\n\")), 1, 1);\n}\n\nexport function ul(tag: HtmlNode, _context: RenderContext) {\n const type = getAttribute(tag, \"type\", \"disc\") || \"disc\";\n const marker = type === \"square\" ? \"▪\" : type === \"circle\" ? \"◦\" : \"•\";\n\n return renderList(tag, () => marker);\n}\n\nexport function ol(tag: HtmlNode, _context: RenderContext) {\n const start = Number.parseInt(getAttribute(tag, \"start\", \"1\") || \"1\", 10);\n\n return renderList(tag, index => `${start + index}.`);\n}\n\nexport function li(tag: HtmlNode, _context: RenderContext) {\n const text = normalizeText(getTextContent(tag));\n\n return asBlock(tag.nodeName, bodyText(text));\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { THEME_MESSAGE_VARIANTS } from \"@shell-shock/plugin-theme/helpers/constants\";\nimport { escapeText } from \"../helpers/escape-text\";\nimport { getClassNames } from \"../helpers/get-attribute\";\nimport { inlineTag } from \"../helpers/tag-utilities\";\n\nexport const message = inlineTag((value, tag) => {\n let type = getClassNames(tag)\n .find(className => className.startsWith(\"message-type-\"))\n ?.replace(\"message-type-\", \"\");\n if (!type || !THEME_MESSAGE_VARIANTS.includes(type as any)) {\n type = \"info\";\n }\n\n const header = tag.childNodes?.find(\n child => child.type === \"message-header\" || child.type === \"message-title\"\n )?.value;\n\n return `${type}(${value ? `\\`${escapeText(value)}\\`` : \"''\"}${\n header ? `, \\`${escapeText(header)}\\`` : \"\"\n })`;\n});\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getAttribute } from \"../helpers/get-attribute\";\nimport type { HtmlNode, RenderContext } from \"../helpers/tag-utilities\";\nimport { asInline, bodyText, buildBar, getTextContent } from \"./common\";\n\nexport function meter(tag: HtmlNode, _context: RenderContext) {\n const min = Number.parseFloat(getAttribute(tag, \"min\", \"0\") || \"0\");\n const max = Number.parseFloat(getAttribute(tag, \"max\", \"1\") || \"1\");\n const value = Number.parseFloat(\n getAttribute(tag, \"value\", String(min)) || String(min)\n );\n const normalizedValue = Math.max(0, value - min);\n const normalizedMax = Math.max(1, max - min);\n const label = getTextContent(tag).trim();\n const percent = Math.round((normalizedValue / normalizedMax) * 100);\n const bar = buildBar(normalizedValue, normalizedMax, 10, \"#\", \"-\");\n\n return asInline(\n tag.nodeName,\n bodyText(`${label ? `${label} ` : \"\"}[${bar}] ${percent}%`)\n );\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getAttribute } from \"../helpers/get-attribute\";\nimport type { HtmlNode, RenderContext } from \"../helpers/tag-utilities\";\nimport { asInline, bodyText, buildBar, getTextContent } from \"./common\";\n\nexport function progress(tag: HtmlNode, _context: RenderContext) {\n const max = Number.parseFloat(getAttribute(tag, \"max\", \"1\") || \"1\");\n const value = Number.parseFloat(getAttribute(tag, \"value\", \"0\") || \"0\");\n const label = getTextContent(tag).trim();\n const percent = Math.round((Math.max(0, value) / Math.max(1, max)) * 100);\n const bar = buildBar(value, max, 10, \"=\", \"-\");\n\n return asInline(\n tag.nodeName,\n bodyText(`${label ? `${label} ` : \"\"}[${bar}] ${percent}%`)\n );\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { inlineTag, voidTag } from \"../helpers/tag-utilities\";\nimport { bodyText } from \"./common\";\n\nexport const ruby = inlineTag(value => bodyText(value));\n\nexport const rt = inlineTag(\n value =>\n `textColors.body.primary(${JSON.stringify(` (${String(value ?? \"\")})`)})`\n);\n\nexport const rp = voidTag;\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getAttribute } from \"../helpers/get-attribute\";\nimport type { HtmlNode, RenderContext } from \"../helpers/tag-utilities\";\nimport { blockTag, inlineTag } from \"../helpers/tag-utilities\";\nimport {\n asBlock,\n bodyText,\n getTextContent,\n normalizeText,\n quoted\n} from \"./common\";\n\nexport const option = inlineTag(value => bodyText(value));\n\nexport const optgroup = blockTag(value => `bold(${quoted(value)})`);\n\nfunction getOptionLines(tag: HtmlNode, prefix = \"\"): string[] {\n const lines: string[] = [];\n\n for (const childNode of tag.childNodes ?? []) {\n if (childNode.nodeName === \"optgroup\") {\n const label =\n getAttribute(childNode, \"label\", \"\") ||\n normalizeText(getTextContent(childNode));\n lines.push(`${prefix}${label}:`);\n lines.push(...getOptionLines(childNode, `${prefix} `));\n continue;\n }\n\n if (childNode.nodeName === \"option\") {\n const selected = getAttribute(childNode, \"selected\", null) !== null;\n lines.push(\n `${prefix}${selected ? \"*\" : \"-\"} ${normalizeText(getTextContent(childNode))}`\n );\n }\n }\n\n return lines;\n}\n\nexport function select(tag: HtmlNode, _context: RenderContext) {\n const lines = getOptionLines(tag);\n\n return asBlock(tag.nodeName, bodyText(lines.join(\"\\n\")), 1, 1);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { inlineTag } from \"../helpers/tag-utilities\";\nimport { bodyText } from \"./common\";\n\nexport const span = inlineTag(value => bodyText(value));\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { HtmlNode, RenderContext } from \"../helpers/tag-utilities\";\nimport { blockTag } from \"../helpers/tag-utilities\";\nimport {\n asBlock,\n bodyText,\n getTextContent,\n normalizeText,\n quoted\n} from \"./common\";\n\nfunction getRows(node: HtmlNode | null | undefined): HtmlNode[] {\n if (!node?.childNodes) {\n return [];\n }\n\n const rows: HtmlNode[] = [];\n\n for (const childNode of node.childNodes) {\n if (childNode.nodeName === \"tr\") {\n rows.push(childNode);\n continue;\n }\n\n if ([\"thead\", \"tbody\", \"tfoot\"].includes(childNode.nodeName ?? \"\")) {\n rows.push(...getRows(childNode));\n }\n }\n\n return rows;\n}\n\nfunction getCells(row: HtmlNode): string[] {\n return (row.childNodes ?? [])\n .filter(childNode => [\"td\", \"th\"].includes(childNode.nodeName ?? \"\"))\n .map(cell => normalizeText(getTextContent(cell)));\n}\n\nexport const caption = blockTag(value => `italic(${quoted(value)})`);\nexport const tr = blockTag();\nexport const thead = blockTag();\nexport const tbody = blockTag();\nexport const tfoot = blockTag();\nexport const col = blockTag();\nexport const colgroup = blockTag();\nexport const td = blockTag(value => bodyText(value));\nexport const th = blockTag(value => `bold(${quoted(value)})`);\n\nexport function table(tag: HtmlNode, _context: RenderContext) {\n const rows = getRows(tag)\n .map(getCells)\n .filter(row => row.length > 0);\n\n return asBlock(tag.nodeName, `table(${JSON.stringify(rows)})`, 1, 1);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { inlineTag } from \"../helpers/tag-utilities\";\nimport { bodyText, inlineCodeText, quoted } from \"./common\";\n\nconst plain = inlineTag(value => bodyText(value));\nconst boldText = inlineTag(value => `bold(${quoted(value)})`);\nconst italicText = inlineTag(value => `italic(${quoted(value)})`);\nconst underlineText = inlineTag(value => `underline(${quoted(value)})`);\nconst strikeText = inlineTag(value => `strikethrough(${quoted(value)})`);\nconst codeText = inlineTag(value => inlineCodeText(value));\n\nexport const b = boldText;\nexport const bdi = plain;\nexport const bdo = plain;\nexport const big = plain;\nexport const bold = boldText;\nexport const cite = italicText;\nexport const del = strikeText;\nexport const em = italicText;\nexport const font = plain;\nexport const i = italicText;\nexport const ins = underlineText;\nexport const italic = italicText;\nexport const kbd = codeText;\nexport const mark = inlineTag(value => `underline(bold(${quoted(value)}))`);\nexport const nobr = plain;\nexport const q = inlineTag(value => bodyText(`\"${String(value ?? \"\")}\"`));\nexport const s = strikeText;\nexport const samp = codeText;\nexport const small = plain;\nexport const strike = strikeText;\nexport const strikethrough = strikeText;\nexport const strong = boldText;\nexport const sub = plain;\nexport const sup = plain;\nexport const time = plain;\nexport const tt = codeText;\nexport const u = underlineText;\nexport const underline = underlineText;\nexport const variableTag = codeText;\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { textNode } from \"../helpers/tag-utilities\";\nimport { a } from \"./a\";\nimport { abbr, acronym, dfn } from \"./abbr\";\nimport { address } from \"./address\";\nimport { blink, marquee } from \"./animations\";\nimport {\n article,\n aside,\n dialog,\n div,\n footer,\n form,\n header,\n hgroup,\n label,\n main,\n nav,\n p,\n picture,\n section\n} from \"./base-tags\";\nimport { blockquote } from \"./blockquote\";\nimport { br } from \"./br\";\nimport { center } from \"./center\";\nimport { code, pre } from \"./code\";\nimport { data } from \"./data\";\nimport { dd, dl, dt } from \"./definitions\";\nimport { details, summary } from \"./details\";\nimport { body, html } from \"./document\";\nimport { fieldset, legend } from \"./fieldset\";\nimport { figcaption, figure } from \"./figure\";\nimport { h1, h2, h3, h4, h5, h6 } from \"./headers\";\nimport { hr } from \"./hr\";\nimport { img } from \"./img\";\nimport { button, input, output, textarea } from \"./inputs\";\nimport { li, ol, ul } from \"./list\";\nimport { menu, menuitem } from \"./menu\";\nimport { message } from \"./message\";\nimport { meter } from \"./meter\";\nimport { progress } from \"./progress\";\nimport { rp, rt, ruby } from \"./ruby\";\nimport { optgroup, option, select } from \"./select\";\nimport { span } from \"./span\";\nimport {\n caption,\n col,\n colgroup,\n table,\n tbody,\n td,\n tfoot,\n th,\n thead,\n tr\n} from \"./table\";\nimport {\n b,\n bdi,\n bdo,\n big,\n bold,\n cite,\n del,\n em,\n font,\n i,\n ins,\n italic,\n kbd,\n mark,\n nobr,\n q,\n s,\n samp,\n small,\n strike,\n strikethrough,\n strong,\n sub,\n sup,\n time,\n tt,\n u,\n underline,\n variableTag\n} from \"./text-styles\";\nimport {\n applet,\n area,\n audio,\n base,\n basefont,\n bgsound,\n canvas,\n datalist,\n embed,\n frame,\n frameset,\n head,\n iframe,\n keygen,\n link,\n map,\n math,\n meta,\n noframes,\n noscript,\n object,\n param as parameter,\n plaintext,\n portal,\n script,\n slot,\n source,\n style,\n svg,\n template,\n title,\n track,\n video,\n wbr,\n xmp\n} from \"./void\";\n\nexport default {\n \"#text\": textNode,\n a,\n abbr,\n acronym,\n address,\n applet,\n area,\n article,\n aside,\n audio,\n b,\n base,\n basefont,\n bdi,\n bdo,\n bgsound,\n big,\n blink,\n dialog,\n div,\n blockquote,\n body,\n bold,\n br,\n button,\n canvas,\n caption,\n center,\n cite,\n code,\n col,\n colgroup,\n data,\n datalist,\n dd,\n del,\n details,\n dfn,\n footer,\n form,\n dl,\n dt,\n em,\n embed,\n fieldset,\n figcaption,\n figure,\n font,\n frame,\n frameset,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n head,\n header,\n hgroup,\n hr,\n html,\n i,\n iframe,\n img,\n input,\n ins,\n italic,\n kbd,\n keygen,\n label,\n legend,\n li,\n link,\n main,\n map,\n mark,\n marquee,\n math,\n menu,\n menuitem,\n message,\n meta,\n meter,\n nav,\n nobr,\n noframes,\n noscript,\n object,\n ol,\n optgroup,\n option,\n output,\n p,\n param: parameter,\n picture,\n plaintext,\n portal,\n pre,\n progress,\n q,\n rp,\n rt,\n ruby,\n s,\n samp,\n script,\n section,\n select,\n slot,\n small,\n source,\n span,\n strike,\n strikethrough,\n strong,\n style,\n sub,\n summary,\n sup,\n svg,\n table,\n tbody,\n td,\n template,\n textarea,\n tfoot,\n th,\n thead,\n time,\n title,\n tr,\n track,\n tt,\n u,\n ul,\n underline,\n var: variableTag,\n video,\n wbr,\n xmp\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport tags from \"../tags\";\nimport type { RenderContext } from \"./tag-utilities\";\n\ninterface HtmlNode {\n nodeName?: string;\n [key: string]: unknown;\n}\n\ntype RenderResult = string | null | undefined;\n\nconst MAX_DEPTH = 100;\nconst CACHE_ENABLED = process.env.CACHE_RENDER !== \"false\";\n\n/**\n * Cache for rendered subtrees (WeakMap for automatic garbage collection)\n * Key: node object, Value: Map of context hash -\\> rendered result\n */\nconst renderCache = new WeakMap<HtmlNode, Map<string, RenderResult>>();\n\n/**\n * Get cached render result\n *\n * @param node - HTML node\n * @param context - Rendering context\n * @returns - Cached result or undefined\n */\nconst getCachedRender = (node: HtmlNode, context: RenderContext) => {\n if (!CACHE_ENABLED || !node || typeof node !== \"object\") {\n return;\n }\n\n const nodeCache = renderCache.get(node);\n if (!nodeCache) {\n return;\n }\n\n return nodeCache.get(\n JSON.stringify({\n lineWidth: context.lineWidth,\n pre: context.pre,\n listDepth: context.listDepth,\n listType: context.listType,\n depth: context.depth\n })\n );\n};\n\n/**\n * Cache render result\n *\n * @param node - HTML node\n * @param context - Rendering context\n * @param result - Render result\n */\nconst setCachedRender = (\n node: HtmlNode,\n context: RenderContext,\n result: RenderResult\n) => {\n if (!CACHE_ENABLED || !node || typeof node !== \"object\") {\n return;\n }\n\n let nodeCache = renderCache.get(node);\n if (!nodeCache) {\n nodeCache = new Map();\n renderCache.set(node, nodeCache);\n }\n\n nodeCache.set(\n JSON.stringify({\n lineWidth: context.lineWidth,\n pre: context.pre,\n listDepth: context.listDepth,\n listType: context.listType,\n depth: context.depth\n }),\n result\n );\n\n // Limit cache size per node to prevent memory bloat\n if (nodeCache.size > 10) {\n const firstKey = nodeCache.keys().next().value;\n nodeCache.delete(firstKey!);\n }\n};\n\n/**\n * Render HTML tag with optimizations for deep nesting\n *\n * @param node - HTML node\n * @param context - Rendering context\n * @param defaultTag - Default tag function\n * @returns - Render result\n */\nexport const renderTag = (\n node: HtmlNode | any,\n context: RenderContext,\n defaultTag = tags.div\n) => {\n // Validate inputs\n if (!node) {\n return null;\n }\n\n // Initialize depth on first call\n const currentDepth = context.depth ?? 0;\n\n // Check if we've exceeded maximum nesting depth\n if (currentDepth >= MAX_DEPTH) {\n return null;\n }\n\n // Create new context with incremented depth\n const newContext = { ...context, depth: currentDepth + 1 };\n\n // Check cache with new context (includes updated depth)\n const cached = getCachedRender(node, newContext);\n if (cached !== undefined) {\n return cached;\n }\n\n let result: RenderResult = null;\n\n try {\n const tagFunction =\n (tags[(node.nodeName || \"#text\") as keyof typeof tags] as (\n node: HtmlNode,\n context: RenderContext\n ) => RenderResult) || defaultTag;\n\n // Render tag\n result = tagFunction(node, newContext);\n\n // Cache result with new context (includes updated depth)\n setCachedRender(node, newContext, result);\n } catch {\n // Return null on error to skip this tag\n result = null;\n }\n\n return result;\n};\n\n/**\n * Batch render multiple nodes\n * Optimized for rendering lists and repeated structures\n * @param nodes - Array of HTML nodes\n * @param context - Rendering context\n * @param defaultTag - Default tag function\n * @returns - Array of render results\n */\nexport const renderNodes = (\n nodes: HtmlNode[],\n context: RenderContext,\n defaultTag = tags.div\n) => {\n if (!nodes || !Array.isArray(nodes) || nodes.length === 0) {\n return [];\n }\n\n const results = [];\n\n for (const node of nodes) {\n const result = renderTag(node, context, defaultTag);\n\n if (result !== null && result !== undefined) {\n results.push(result);\n }\n }\n\n return results;\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { parse } from \"parse5\";\nimport type { Options } from \"../types\";\nimport { getOptions } from \"./helpers/options\";\nimport { renderTag } from \"./helpers/render\";\n\n/**\n * Renders HTML content as source code for displaying in the terminal.\n *\n * @param html - HTML content\n * @param options - Configuration options for rendering the HTML.\n * @return A string of source code that can be executed to display the rendered HTML in the terminal.\n */\nexport function renderHtml(html: string, options: Options = {}): string {\n const document = parse(html, { sourceCodeLocationInfo: true });\n\n return `${renderTag(document, getOptions(options))}\\n`;\n}\n"],"mappings":"wMAoBA,MAAa,EAAc,IAClB,CACL,IAAK,GACL,UAAW,IACX,UAAW,GACX,MAAO,EACP,UAAW,GACX,GAAG,EACJ,ECJG,EAAkB,GAAuC,CAC7D,GAAI,GAAS,KACX,MAAO,GAGT,IAAM,EAAS,OAAO,EAAM,CAE5B,OAAO,OAAO,SAAS,EAAO,CAAG,EAAS,GAG/B,GACX,EACA,IACyB,CACzB,GAAI,CAAC,GAAS,CAAC,EACb,OAAO,KAGT,GAAI,EAAO,CACT,IAAM,EAAkB,EAAe,EAAQ,UAAU,CACnD,EAAqB,EAAe,EAAQ,aAAa,CAE/D,MAAO,CACL,GAAG,EACH,UAA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Q,EAAO,EAAM,CAAC,GAAG,CACvD,EAAa,EAAU,GAAS,UAAU,EAAO,EAAM,CAAC,GAAG,CAC3D,EAAgB,EAAU,GAAS,aAAa,EAAO,EAAM,CAAC,GAAG,CACjE,EAAa,EAAU,GAAS,iBAAiB,EAAO,EAAM,CAAC,GAAG,CAClE,EAAW,EAAU,GAAS,EAAe,EAAM,CAAC,CAE7C,GAAI,EACJ,GAAM,EACN,GAAM,EACN,GAAM,EACN,GAAO,EACP,GAAO,EACP,GAAM,EACN,GAAK,EACL,GAAO,EACP,GAAI,EACJ,GAAM,EACN,GAAS,EACT,GAAM,EACN,GAAO,EAAU,GAAS,kBAAkB,EAAO,EAAM,CAAC,IAAI,CAC9D,GAAO,EACP,GAAI,EAAU,GAAS,EAAS,IAAI,OAAO,GAAS,GAAG,CAAC,GAAG,CAAC,CAC5D,GAAI,EACJ,GAAO,EACP,GAAQ,EACR,GAAS,EACT,GAAgB,EAChB,GAAS,EACT,EAAM,EACN,GAAM,EACN,GAAO,EACP,GAAK,EACL,GAAI,EACJ,GAAY,EACZ,GAAc,ECsF3B,IAAA,EAAe,CACb,QAAS,GACT,KACA,OACA,WACA,WACA,OAAA,EACA,KAAA,EACA,WACA,SACA,MAAA,EACA,KACA,KAAA,EACA,SAAA,EACA,OACA,OACA,QAAA,EACA,OACA,MAAA,GACA,SACA,OACA,aACA,QACA,QACA,MACA,UACA,OAAA,EACA,WACA,UACA,QACA,QACA,OACA,YACA,QACA,SAAA,EACA,MACA,OACA,WACA,OACA,UACA,OACA,MACA,MACA,MACA,MAAA,EACA,YACA,cACA,UACA,QACA,MAAA,EACA,SAAA,EACA,MACA,MACA,MACA,MACA,MACA,MACA,KAAA,EACA,UACA,SACA,MACA,QACA,KACA,OAAA,EACA,OACA,SACA,OACA,UACA,OACA,OAAA,EACA,SACA,UACA,KACA,KAAA,EACA,QACA,IAAA,EACA,QACA,WACA,KAAA,EACA,KAAA,EACA,SAAA,EACA,WACA,KAAA,EACA,SACA,OAC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OAAS,EAGtC,GAAI,GAAgB,IAClB,OAAO,KAIT,IAAM,EAAa,CAAE,GAAG,EAAS,MAAO,EAAe,EAAG,CAGpD,EAAS,GAAgB,EAAM,EAAW,CAChD,GAAI,IAAW,IAAA,GACb,OAAO,EAGT,IAAI,EAAuB,KAE3B,GAAI,CAQF,GANGA,EAAM,EAAK,UAAY,UAGF,GAGH,EAAM,EAAW,CAGtC,GAAgB,EAAM,EAAY,EAAO,MACnC,CAEN,EAAS,KAGX,OAAO,GCjIT,SAAgB,GAAW,EAAc,EAAmB,EAAE,CAAU,CAGtE,MAAO,GAAG,EAFO,EAAM,EAAM,CAAE,uBAAwB,GAAM,CAAC,CAEhC,EAAW,EAAQ,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`parse5`),l=require(`he`);l=s(l);let u=require(`normalize-html-whitespace`);u=s(u);let d=require(`wrap-ansi`);d=s(d);let ee=require(`@shell-shock/plugin-theme/helpers/constants`);const te=e=>({pre:!1,lineWidth:120,fontAttrs:!0,depth:0,asciiMode:!1,...e}),f=e=>{if(e==null)return 0;let t=Number(e);return Number.isFinite(t)?t:0},p=(e,t)=>{if(!e&&!t)return null;if(e){let e=f(t.marginTop),n=f(t.marginBottom);return{...t,marginTop:e,marginBottom:n}}if(t){let t=f(e.marginTop),n=f(e.marginBottom);return{...e,marginTop:t,marginBottom:n}}let n=f(e.marginTop),r=f(e.marginBottom),i=f(t.marginTop),a=f(t.marginBottom);if(!t.value)return{marginTop:n,value:e.value,marginBottom:Math.max(r,i,a)};if(!e.value)return{marginTop:Math.max(n,r,i),value:t.value,marginBottom:a};let o=Math.max(r,i);return{marginTop:n,value:`${e.value}${`
2
+ `.repeat(o)}${t.value}`,marginBottom:a}},m=(e,t)=>e==null&&t==null?null:e==null?t:t==null?e:t.value==null?{pre:e.pre,value:e.value,post:e.post??t.pre??t.post??``,type:`inline`,nodeName:e.nodeName}:e.value==null?{pre:e.pre??e.post??t.pre??``,value:t.value,post:t.post,type:`inline`,nodeName:t.nodeName}:e.post==null?t.pre==null?{pre:e.pre,value:`${e.value}${t.value}`,post:t.post,type:`inline`,nodeName:t.nodeName}:{pre:e.pre,value:`${e.value}${t.pre}${t.value}`,post:t.post,type:`inline`,nodeName:t.nodeName}:{pre:e.pre,value:`${e.value}${e.post}${t.value}`,post:t.post,type:`inline`,nodeName:t.nodeName},h=new WeakMap,g=(e,t,n=null)=>{if(!e||typeof e!=`object`||!t||typeof t!=`string`)return n;let r=h.get(e);if(r){let e=r.get(t);if(e!==void 0)return e??n}if(!e.attrs||!Array.isArray(e.attrs)||e.attrs.length===0)return r||(r=new Map,h.set(e,r)),r.set(t,null),n;let i=e.attrs.find(e=>e&&typeof e==`object`&&e.name===t);if(r||(r=new Map,h.set(e,r)),!i||i.value===void 0)return r.set(t,null),n;let a=i.value;return r.set(t,a),a};function ne(e){let t=g(e,`class`,null);return t?t.split(/\s+/).map(e=>e.trim()).filter(e=>e.length>0):[]}const _=(e,t)=>(0,d.default)(e,t.lineWidth??80,{trim:!t.pre}),v=l.default.decode,re=u.default,y=e=>e?{...e,marginTop:0,marginBottom:0,type:`block`,nodeName:`#blockTag`}:null,ie=(e,t)=>{let n=String(e.value??``);if(t.pre)return{pre:null,value:v(n),post:null,type:`inline`,nodeName:`#text`};let r=[...(re(n)||``).replaceAll(`
3
+ `,` `)],i=[` `,`
4
+ `].includes(r[0]??``)?r.shift()??null:null,a=[` `,`
5
+ `].includes(r.at(-1)??``)?r.pop()??null:null;return{pre:i,value:r.length>0?`${v(r.join(``))}`:null,post:a,type:`inline`,nodeName:`#text`}};function b(e,t){return(n,r)=>{let i=e??(e=>e);if(!n||!n.childNodes)return null;let a=Number.parseInt(g(n,`start`,`1`)??`1`,10),o=n.childNodes.reduce((e,t)=>{let n=$(t,{...r,liItemNumber:a});return n?(n.nodeName===`li`&&(a+=1),n.type===`inline`?{block:e.block,inline:m(e.inline,n)}:(e.inline&&e.inline.value&&(e.inline.value=_(e.inline.value,r)),e.block=p(e.block??null,y(e.inline)??null),e.block=p(e.block??null,n),{block:e.block,inline:null})):e},{block:null,inline:null});o.inline&&o.inline.value&&(o.inline.value=_(o.inline.value,r)),o.block=p(o.block??null,y(o.inline)??null);let s=t?.marginTop??0;s=!r||!r.pre?s+1:s;let c=t?.marginBottom??0;return c=!r||!r.pre?c+1:c,!o.block||!o.block.value?{marginTop:s,value:``,marginBottom:c,type:`block`,nodeName:n.nodeName}:{marginTop:o.block.marginTop&&o.block.marginTop>s?o.block.marginTop:s,value:i(o.block.value,n,r),marginBottom:o.block.marginBottom&&o.block.marginBottom>c?o.block.marginBottom:c,type:`block`,nodeName:n.nodeName}}}const x=e=>(t,n)=>{let r=e??(e=>e??null),i=X.span;if(!t||!t.childNodes)return;let a=t.childNodes.reduce((e,r)=>{let a=$(r,n,i);return a?{...m(e,a),type:`inline`,nodeName:t.nodeName}:e},null);return{pre:a?.pre?r(a.pre,t,n):null,value:r(a?.value,t,n),post:a?.post?r(a.post,t,n):null,type:`inline`,nodeName:t.nodeName}},S=()=>void 0,ae=x((e,t,n)=>{let r=g(t,`href`,null),i=g(t,`title`,null),a=!r||[`file://`,`http://`,`https://`,`mailto:`,`ftp://`,`ftps://`,`sftp://`,`ssh://`,`dav://`,`tel:`,`git://`].some(e=>r.startsWith(e))?r:null;return a?`link("${a}", ${i?`"${i}", `:``}${a&&(a.startsWith(`http://`)||a.startsWith(`https://`))?`true`:`false`})`:i?`"${i}"`:``}),C=x((e,t)=>{let n=g(t,`title`,null);return e?n?`${e} (${n})`:e:``}),oe=C,se=C;function w(e){return`textColors.body.primary(${JSON.stringify(String(e??``))})`}function T(e){return JSON.stringify(String(e??``))}function E(e){return`inlineCode(${T(e)})`}function D(e,t){return`code(${JSON.stringify(e)}${t?`, ${JSON.stringify(t)}`:``})`}function O(e){return e?typeof e.value==`string`?e.value:!e.childNodes||e.childNodes.length===0?``:e.childNodes.map(e=>O(e)).join(``):``}function k(e){return e.replaceAll(/\s+/g,` `).trim()}function A(e,t,n=null,r=null){return{pre:n,value:t,post:r,type:`inline`,nodeName:e}}function j(e,t,n=0,r=0){return{marginTop:n,value:t,marginBottom:r,type:`block`,nodeName:e}}function ce(e){if(!e)return null;let t=g(e,`class`,``)?.split(/\s+/).map(e=>e.trim()).filter(Boolean)??[];for(let e of t){if(e.startsWith(`language-`))return e.slice(9)||null;if(e.startsWith(`lang-`))return e.slice(5)||null}return null}function M(e,t,n=10,r=`#`,i=`-`){if(!Number.isFinite(e)||!Number.isFinite(t)||t<=0)return i.repeat(n);let a=Math.max(0,Math.min(1,e/t)),o=Math.round(a*n);return r.repeat(o)+i.repeat(Math.max(n-o,0))}const le=b(e=>w(e)),ue=x(e=>w(e)),de=x(e=>w(e));function N(e){return String(e??``).replaceAll(`\\`,`\\\\`).replaceAll("`","\\`").replaceAll("${","\\${").replaceAll(`
6
+ `,`\\n`).replaceAll(`\r`,`\\r`).replaceAll(` `,`\\t`)}const P=e=>b(e=>`textColors.body.primary(\`${N(e)}\`)`),F=e=>x(e=>`textColors.body.primary(\`${N(e)}\`)`),fe=b(e=>`textColors.body.primary(\`${N(e)}\`)`,{marginTop:1,marginBottom:1}),pe=F(`label`);F(`blink`);const me=P(`div`),he=P(`header`),ge=P(`article`),_e=P(`footer`),ve=P(`section`),ye=P(`main`),be=P(`nav`),xe=P(`aside`),Se=P(`form`),Ce=P(`picture`),we=P(`hgroup`),Te=P(`dialog`),Ee=x(e=>`blockquote(${e?`\`${N(e)}\``:`''`})`),De=()=>({pre:``,value:`
7
+ `,post:``,type:`inline`}),Oe=b(e=>w(e)),ke=x(e=>E(e));function Ae(e,t){let n=e.childNodes?.find(e=>e.nodeName===`code`)??null,r=O(n??e).replaceAll(/\n+$/g,``),i=ce(n??e);return j(e.nodeName,D(r,i),1,1)}const je=x((e,t)=>{let n=g(t,`value`,null),r=String(e??``);return w(n&&r&&n!==r?`${r} (${n})`:r||n||``)}),Me=b(void 0,{marginTop:1,marginBottom:1}),Ne=b(e=>`bold(${T(e)})`),Pe=b(e=>w(` ${String(e??``)}`)),Fe=(e,t)=>({pre:null,value:`bold(${T(k(e.childNodes?.map(e=>e.value??``).join(``)??``))})`,post:null,type:`inline`,nodeName:e.nodeName});function Ie(e,t){let n=k((e.childNodes?.find(e=>e.nodeName===`summary`)??null)?.childNodes?.map(e=>e.value??``).join(``)??`Details`),r=k((e.childNodes??[]).filter(e=>e.nodeName!==`summary`).map(e=>typeof e.value==`string`?e.value:e.childNodes?.map(e=>e.value??``).join(``)??``).join(`
8
+ `)),i=g(e,`open`,null)===null?`[+]`:`[-]`,a=r?`${i} ${n}\n${r}`:`${i} ${n}`;return j(e.nodeName,`blockquote(${T(a)})`,1,1)}const I=b(),Le=I,Re=I,ze=x(e=>`bold(${T(e)})`);function Be(e,t){let n=k((e.childNodes?.find(e=>e.nodeName===`legend`)??null)?.childNodes?.map(e=>e.value??``).join(``)??``),r=k((e.childNodes??[]).filter(e=>e.nodeName!==`legend`).map(e=>typeof e.value==`string`?e.value:e.childNodes?.map(e=>e.value??``).join(``)??``).join(`
9
+ `)),i=n?`${n}\n${r}`.trim():r;return j(e.nodeName,`blockquote(${T(i)})`,1,1)}const Ve=b(e=>`italic(${T(e)})`);function He(e,t){let n=k((e.childNodes?.find(e=>e.nodeName===`figcaption`)??null)?.childNodes?.map(e=>e.value??``).join(``)??``),r=k((e.childNodes??[]).filter(e=>e.nodeName!==`figcaption`).map(e=>typeof e.value==`string`?e.value:e.childNodes?.map(e=>e.value??``).join(``)??``).join(`
10
+ `)),i=n?`${r}\n${n}`.trim():r;return j(e.nodeName,`blockquote(${T(i)})`,1,1)}const L=e=>b(t=>`bold(textColors.heading.${e===1?`primary`:e===2?`secondary`:`tertiary`}(${T(t)}))`,{marginTop:1,marginBottom:1}),Ue=L(1),We=L(2),Ge=L(3),Ke=L(4),qe=L(5),Je=L(6);function Ye(e,t){return j(e.nodeName,`divider({ border: "primary" })`,1,1)}function Xe(e,t){let n=g(e,`alt`,null),r=g(e,`src`,null),i=n||r?`[Image: ${n||r}]`:`[Image]`;return A(e.nodeName,w(i))}function Ze(e,t){let n=(g(e,`type`,`text`)||`text`).toLowerCase(),r=g(e,`value`,``)||``,i=g(e,`placeholder`,``)||``,a=g(e,`checked`,null)!==null;if(n===`hidden`)return null;if(n===`checkbox`)return A(e.nodeName,w(a?`[x]`:`[ ]`));if(n===`radio`)return A(e.nodeName,w(a?`(o)`:`( )`));if([`submit`,`button`,`reset`].includes(n))return A(e.nodeName,`bold(${JSON.stringify(`[ ${r||n} ]`)})`);if(n===`range`){let t=Number.parseFloat(g(e,`max`,`100`)||`100`),n=Number.parseFloat(g(e,`value`,`0`)||`0`),r=M(n,t,10,`=`,`-`);return A(e.nodeName,w(`[${r}] ${Math.round(n)}/${Math.round(t)}`))}return A(e.nodeName,w(`[${r||i}]`))}const Qe=x(e=>`bold(${JSON.stringify(`[ ${String(e??`button`)} ]`)})`),$e=x(e=>w(e)),et=b((e,t)=>{let n=Number.parseInt(g(t,`rows`,`0`)||`0`,10),r=O(t);return n>1||r.includes(`
11
+ `)?D(r):w(e)});function tt(e){return(e.childNodes??[]).filter(e=>e.nodeName===`li`)}function R(e,t){let n=tt(e).map((e,n)=>{let r=k(O(e));return`${t(n)} ${r}`.trimEnd()});return j(e.nodeName,w(n.join(`
12
+ `)),1,1)}function z(e,t){let n=g(e,`type`,`disc`)||`disc`,r=n===`square`?`▪`:n===`circle`?`◦`:`•`;return R(e,()=>r)}function nt(e,t){let n=Number.parseInt(g(e,`start`,`1`)||`1`,10);return R(e,e=>`${n+e}.`)}function B(e,t){let n=k(O(e));return j(e.nodeName,w(n))}const rt=x((e,t)=>{let n=ne(t).find(e=>e.startsWith(`message-type-`))?.replace(`message-type-`,``);(!n||!ee.THEME_MESSAGE_VARIANTS.includes(n))&&(n=`info`);let r=t.childNodes?.find(e=>e.type===`message-header`||e.type===`message-title`)?.value;return`${n}(${e?`\`${N(e)}\``:`''`}${r?`, \`${N(r)}\``:``})`});function it(e,t){let n=Number.parseFloat(g(e,`min`,`0`)||`0`),r=Number.parseFloat(g(e,`max`,`1`)||`1`),i=Number.parseFloat(g(e,`value`,String(n))||String(n)),a=Math.max(0,i-n),o=Math.max(1,r-n),s=O(e).trim(),c=Math.round(a/o*100),l=M(a,o,10,`#`,`-`);return A(e.nodeName,w(`${s?`${s} `:``}[${l}] ${c}%`))}function at(e,t){let n=Number.parseFloat(g(e,`max`,`1`)||`1`),r=Number.parseFloat(g(e,`value`,`0`)||`0`),i=O(e).trim(),a=Math.round(Math.max(0,r)/Math.max(1,n)*100),o=M(r,n,10,`=`,`-`);return A(e.nodeName,w(`${i?`${i} `:``}[${o}] ${a}%`))}const ot=x(e=>w(e)),st=x(e=>`textColors.body.primary(${JSON.stringify(` (${String(e??``)})`)})`),ct=S,V=x(e=>w(e)),lt=b(e=>`bold(${T(e)})`);function H(e,t=``){let n=[];for(let r of e.childNodes??[]){if(r.nodeName===`optgroup`){let e=g(r,`label`,``)||k(O(r));n.push(`${t}${e}:`),n.push(...H(r,`${t} `));continue}if(r.nodeName===`option`){let e=g(r,`selected`,null)!==null;n.push(`${t}${e?`*`:`-`} ${k(O(r))}`)}}return n}function ut(e,t){let n=H(e);return j(e.nodeName,w(n.join(`
13
+ `)),1,1)}const dt=x(e=>w(e));function U(e){if(!e?.childNodes)return[];let t=[];for(let n of e.childNodes){if(n.nodeName===`tr`){t.push(n);continue}[`thead`,`tbody`,`tfoot`].includes(n.nodeName??``)&&t.push(...U(n))}return t}function ft(e){return(e.childNodes??[]).filter(e=>[`td`,`th`].includes(e.nodeName??``)).map(e=>k(O(e)))}const pt=b(e=>`italic(${T(e)})`),mt=b(),ht=b(),gt=b(),_t=b(),vt=b(),yt=b(),bt=b(e=>w(e)),xt=b(e=>`bold(${T(e)})`);function St(e,t){let n=U(e).map(ft).filter(e=>e.length>0);return j(e.nodeName,`table(${JSON.stringify(n)})`,1,1)}const W=x(e=>w(e)),G=x(e=>`bold(${T(e)})`),K=x(e=>`italic(${T(e)})`),q=x(e=>`underline(${T(e)})`),J=x(e=>`strikethrough(${T(e)})`),Y=x(e=>E(e)),Ct=G,wt=W,Tt=W,Et=W,Dt=G,Ot=K,kt=J,At=K,jt=W,Mt=K,Nt=q,Pt=K,Ft=Y,It=x(e=>`underline(bold(${T(e)}))`),Lt=W,Rt=x(e=>w(`"${String(e??``)}"`)),zt=J,Bt=Y,Vt=W,Ht=J,Ut=J,Wt=G,Gt=W,Kt=W,qt=W,Jt=Y,Yt=q,Xt=q,Zt=Y;var X={"#text":ie,a:ae,abbr:C,acronym:oe,address:le,applet:S,area:S,article:ge,aside:xe,audio:S,b:Ct,base:S,basefont:S,bdi:wt,bdo:Tt,bgsound:S,big:Et,blink:ue,dialog:Te,div:me,blockquote:Ee,body:Re,bold:Dt,br:De,button:Qe,canvas:S,caption:pt,center:Oe,cite:Ot,code:ke,col:vt,colgroup:yt,data:je,datalist:S,dd:Pe,del:kt,details:Ie,dfn:se,footer:_e,form:Se,dl:Me,dt:Ne,em:At,embed:S,fieldset:Be,figcaption:Ve,figure:He,font:jt,frame:S,frameset:S,h1:Ue,h2:We,h3:Ge,h4:Ke,h5:qe,h6:Je,head:S,header:he,hgroup:we,hr:Ye,html:Le,i:Mt,iframe:S,img:Xe,input:Ze,ins:Nt,italic:Pt,kbd:Ft,keygen:S,label:pe,legend:ze,li:B,link:S,main:ye,map:S,mark:It,marquee:de,math:S,menu:z,menuitem:B,message:rt,meta:S,meter:it,nav:be,nobr:Lt,noframes:S,noscript:S,object:S,ol:nt,optgroup:lt,option:V,output:$e,p:fe,param:S,picture:Ce,plaintext:S,portal:S,pre:Ae,progress:at,q:Rt,rp:ct,rt:st,ruby:ot,s:zt,samp:Bt,script:S,section:ve,select:ut,slot:S,small:Vt,source:S,span:dt,strike:Ht,strikethrough:Ut,strong:Wt,style:S,sub:Gt,summary:Fe,sup:Kt,svg:S,table:St,tbody:gt,td:bt,template:S,textarea:et,tfoot:_t,th:xt,thead:ht,time:qt,title:S,tr:mt,track:S,tt:Jt,u:Yt,ul:z,underline:Xt,var:Zt,video:S,wbr:S,xmp:S};const Z=process.env.CACHE_RENDER!==`false`,Q=new WeakMap,Qt=(e,t)=>{if(!Z||!e||typeof e!=`object`)return;let n=Q.get(e);if(n)return n.get(JSON.stringify({lineWidth:t.lineWidth,pre:t.pre,listDepth:t.listDepth,listType:t.listType,depth:t.depth}))},$t=(e,t,n)=>{if(!Z||!e||typeof e!=`object`)return;let r=Q.get(e);if(r||(r=new Map,Q.set(e,r)),r.set(JSON.stringify({lineWidth:t.lineWidth,pre:t.pre,listDepth:t.listDepth,listType:t.listType,depth:t.depth}),n),r.size>10){let e=r.keys().next().value;r.delete(e)}},$=(e,t,n=X.div)=>{if(!e)return null;let r=t.depth??0;if(r>=100)return null;let i={...t,depth:r+1},a=Qt(e,i);if(a!==void 0)return a;let o=null;try{o=(X[e.nodeName||`#text`]||n)(e,i),$t(e,i,o)}catch{o=null}return o};function en(e,t={}){return`${$((0,c.parse)(e,{sourceCodeLocationInfo:!0}),te(t))}\n`}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return en}});
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./html-y4ndTJv8.cjs`),t=require(`./markdown-Q_Sr7IsK.cjs`),n={heading:(e,t=1)=>`bold(textColors.heading.${t===1?`primary`:t===2?`secondary`:`tertiary`}("${e}"))`,body:e=>`textColors.body.primary("${e}")`,bold:e=>`bold("${e}")`,italic:e=>`italic("${e}")`,strikethrough:e=>`strikethrough("${e}")`,underline:e=>`underline("${e}")`,blockquote:e=>`blockquote("${e}")`,link:(e,t)=>`link("${e}"${t?`, "${t}"`:``})`,table:e=>`table(${JSON.stringify(e)})`,code:(e,t)=>`code(${JSON.stringify(e)}${t?`, "${t}"`:``})`,inlineCode:e=>`inlineCode("${e}")`,break:()=>`writeLine("")`,divider:()=>`divider({ border: "primary" })`};exports.defaultRenderAdapter=n,exports.renderHtml=e.t,exports.renderMarkdown=t.t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./html-UjWBxd-n.cjs`),t=require(`./markdown-Ch_HHW7C.cjs`),n={heading:(e,t=1)=>`bold(textColors.heading.${t===1?`primary`:t===2?`secondary`:`tertiary`}("${e}"))`,body:e=>`textColors.body.primary("${e}")`,bold:e=>`bold("${e}")`,italic:e=>`italic("${e}")`,strikethrough:e=>`strikethrough("${e}")`,underline:e=>`underline("${e}")`,blockquote:e=>`blockquote("${e}")`,link:(e,t)=>`link("${e}"${t?`, "${t}"`:``})`,table:e=>`table(${JSON.stringify(e)})`,code:(e,t)=>`code(${JSON.stringify(e)}${t?`, "${t}"`:``})`,inlineCode:e=>`inlineCode("${e}")`,break:()=>`writeLine("")`,divider:()=>`divider({ border: "primary" })`};exports.defaultRenderAdapter=n,exports.renderHtml=e.t,exports.renderMarkdown=t.t;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as RenderAdapter, r as ResolvedOptions, t as Options } from "./types-C7nXIjAN.cjs";
1
+ import { n as RenderAdapter, r as ResolvedOptions, t as Options } from "./types-J2htKY4q.cjs";
2
2
  import { renderHtml } from "./html/index.cjs";
3
3
  import { renderMarkdown } from "./markdown/index.cjs";
4
4
 
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as RenderAdapter, r as ResolvedOptions, t as Options } from "./types-C5cPWP5x.mjs";
1
+ import { n as RenderAdapter, r as ResolvedOptions, t as Options } from "./types-CCFWBb06.mjs";
2
2
  import { renderHtml } from "./html/index.mjs";
3
3
  import { renderMarkdown } from "./markdown/index.mjs";
4
4
 
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{t as e}from"./html-Di3_LwV3.mjs";import{t}from"./markdown-OuY_JOk0.mjs";const n={heading:(e,t=1)=>`bold(textColors.heading.${t===1?`primary`:t===2?`secondary`:`tertiary`}("${e}"))`,body:e=>`textColors.body.primary("${e}")`,bold:e=>`bold("${e}")`,italic:e=>`italic("${e}")`,strikethrough:e=>`strikethrough("${e}")`,underline:e=>`underline("${e}")`,blockquote:e=>`blockquote("${e}")`,link:(e,t)=>`link("${e}"${t?`, "${t}"`:``})`,table:e=>`table(${JSON.stringify(e)})`,code:(e,t)=>`code(${JSON.stringify(e)}${t?`, "${t}"`:``})`,inlineCode:e=>`inlineCode("${e}")`,break:()=>`writeLine("")`,divider:()=>`divider({ border: "primary" })`};export{n as defaultRenderAdapter,e as renderHtml,t as renderMarkdown};
1
+ import{t as e}from"./html-Dw6VvFHa.mjs";import{t}from"./markdown-BGGlzivq.mjs";const n={heading:(e,t=1)=>`bold(textColors.heading.${t===1?`primary`:t===2?`secondary`:`tertiary`}("${e}"))`,body:e=>`textColors.body.primary("${e}")`,bold:e=>`bold("${e}")`,italic:e=>`italic("${e}")`,strikethrough:e=>`strikethrough("${e}")`,underline:e=>`underline("${e}")`,blockquote:e=>`blockquote("${e}")`,link:(e,t)=>`link("${e}"${t?`, "${t}"`:``})`,table:e=>`table(${JSON.stringify(e)})`,code:(e,t)=>`code(${JSON.stringify(e)}${t?`, "${t}"`:``})`,inlineCode:e=>`inlineCode("${e}")`,break:()=>`writeLine("")`,divider:()=>`divider({ border: "primary" })`};export{n as defaultRenderAdapter,e as renderHtml,t as renderMarkdown};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../markdown-Q_Sr7IsK.cjs`);exports.renderMarkdown=e.t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../markdown-Ch_HHW7C.cjs`);exports.renderMarkdown=e.t;
@@ -1,4 +1,4 @@
1
- import { t as Options } from "../types-C7nXIjAN.cjs";
1
+ import { t as Options } from "../types-J2htKY4q.cjs";
2
2
 
3
3
  //#region src/markdown/index.d.ts
4
4
  /**
@@ -8,7 +8,7 @@ import { t as Options } from "../types-C7nXIjAN.cjs";
8
8
  * @param options - Configuration options for rendering the markdown.
9
9
  * @return A string of source code that can be executed to display the rendered markdown in the terminal.
10
10
  */
11
- declare function renderMarkdown(markdown: string, options: Options): string;
11
+ declare function renderMarkdown(markdown: string, options?: Options): string;
12
12
  //#endregion
13
13
  export { renderMarkdown };
14
14
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/markdown/index.ts"],"mappings":";;;;;AA6BA;;;;;iBAAgB,cAAA,CAAe,QAAA,UAAkB,OAAA,EAAS,OAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/markdown/index.ts"],"mappings":";;;;;AA6BA;;;;;iBAAgB,cAAA,CACd,QAAA,UACA,OAAA,GAAS,OAAA"}
@@ -1,4 +1,4 @@
1
- import { t as Options } from "../types-C5cPWP5x.mjs";
1
+ import { t as Options } from "../types-CCFWBb06.mjs";
2
2
 
3
3
  //#region src/markdown/index.d.ts
4
4
  /**
@@ -8,7 +8,7 @@ import { t as Options } from "../types-C5cPWP5x.mjs";
8
8
  * @param options - Configuration options for rendering the markdown.
9
9
  * @return A string of source code that can be executed to display the rendered markdown in the terminal.
10
10
  */
11
- declare function renderMarkdown(markdown: string, options: Options): string;
11
+ declare function renderMarkdown(markdown: string, options?: Options): string;
12
12
  //#endregion
13
13
  export { renderMarkdown };
14
14
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/markdown/index.ts"],"mappings":";;;;;AA6BA;;;;;iBAAgB,cAAA,CAAe,QAAA,UAAkB,OAAA,EAAS,OAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/markdown/index.ts"],"mappings":";;;;;AA6BA;;;;;iBAAgB,cAAA,CACd,QAAA,UACA,OAAA,GAAS,OAAA"}
@@ -1 +1 @@
1
- import{t as e}from"../markdown-OuY_JOk0.mjs";export{e as renderMarkdown};
1
+ import{t as e}from"../markdown-BGGlzivq.mjs";export{e as renderMarkdown};
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./html-Dw6VvFHa.mjs";import{THEME_MESSAGE_VARIANTS as t}from"@shell-shock/plugin-theme/helpers/constants";import{alert as n}from"@mdit/plugin-alert";import{titleCase as r}from"@stryke/string-format";import i from"markdown-it";import a from"markdown-it-abbr";import o from"markdown-it-container";import s from"markdown-it-deflist";import c from"markdown-it-footnote";import l from"markdown-it-ins";import u from"markdown-it-mark";import d from"markdown-it-sub";import f from"markdown-it-sup";import p from"markdown-it-task-lists";const m=()=>{let e=i({html:!0,langPrefix:`language-`,linkify:!0}).use(c).use(l).use(u).use(s).use(a).use(o).use(f).use(d).use(p).use(n,{deep:!1,openRender(e,n){let r=e[n],i=`info`;return t.includes(r?.markup)&&(i=r?.markup),`<message class="message-type-${i}">`},closeRender(){return`</message>`},titleRender(e,t){let n=e[t];return`<message-header>${r(n?.content||``)}</message-header>`}});return e.renderer.rules.footnote_anchor=()=>``,e},h=e=>m().render(e);function g(t,n={}){return e(h(t),n)}export{g as t};
2
+ //# sourceMappingURL=markdown-BGGlzivq.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-BGGlzivq.mjs","names":[],"sources":["../src/markdown/markdown-to-html.ts","../src/markdown/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { alert } from \"@mdit/plugin-alert\";\nimport type { ThemeMessageVariant } from \"@shell-shock/plugin-theme\";\nimport { THEME_MESSAGE_VARIANTS } from \"@shell-shock/plugin-theme/helpers/constants\";\nimport { titleCase } from \"@stryke/string-format\";\nimport markdownit from \"markdown-it\";\nimport markdownItAbbr from \"markdown-it-abbr\";\nimport markdownItContainer from \"markdown-it-container\";\nimport markdownItDeflist from \"markdown-it-deflist\";\nimport markdownItFootnote from \"markdown-it-footnote\";\nimport markdownItIns from \"markdown-it-ins\";\nimport markdownItMark from \"markdown-it-mark\";\nimport markdownItSub from \"markdown-it-sub\";\nimport markdownItSup from \"markdown-it-sup\";\nimport markdownItTaskList from \"markdown-it-task-lists\";\n\n/**\n * Create a configured markdown-it instance with GFM support\n */\nexport const createMarkdownRenderer = () => {\n const md = markdownit({\n html: true,\n langPrefix: \"language-\",\n linkify: true\n })\n .use(markdownItFootnote)\n .use(markdownItIns)\n .use(markdownItMark)\n .use(markdownItDeflist)\n .use(markdownItAbbr)\n .use(markdownItContainer)\n .use(markdownItSup)\n .use(markdownItSub)\n .use(markdownItTaskList)\n .use(alert, {\n deep: false,\n\n openRender(tokens, index) {\n const token = tokens[index];\n\n let messageType: ThemeMessageVariant = \"info\";\n if (\n THEME_MESSAGE_VARIANTS.includes(token?.markup as ThemeMessageVariant)\n ) {\n messageType = token?.markup as ThemeMessageVariant;\n }\n\n return `<message class=\"message-type-${messageType}\">`;\n },\n\n closeRender() {\n return \"</message>\";\n },\n\n titleRender(tokens, index) {\n const token = tokens[index];\n\n return `<message-header>${titleCase(\n token?.content || \"\"\n )}</message-header>`;\n }\n });\n\n // Remove footnote anchors\n md.renderer.rules.footnote_anchor = () => \"\";\n\n return md;\n};\n\n/**\n * Render markdown to HTML\n *\n * @param markdown - Markdown content\n * @returns HTML string\n */\nexport const markdownToHtml = (markdown: string): string => {\n const md = createMarkdownRenderer();\n\n return md.render(markdown);\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { renderHtml } from \"../html\";\nimport type { Options } from \"../types\";\nimport { markdownToHtml } from \"./markdown-to-html\";\n\n/**\n * Renders Markdown content as source code for displaying in the terminal.\n *\n * @param markdown - Markdown content\n * @param options - Configuration options for rendering the markdown.\n * @return A string of source code that can be executed to display the rendered markdown in the terminal.\n */\nexport function renderMarkdown(\n markdown: string,\n options: Options = {}\n): string {\n return renderHtml(markdownToHtml(markdown), options);\n}\n"],"mappings":"oiBAoCA,MAAa,MAA+B,CAC1C,IAAM,EAAK,EAAW,CACpB,KAAM,GACN,WAAY,YACZ,QAAS,GACV,CAAC,CACC,IAAI,EAAmB,CACvB,IAAI,EAAc,CAClB,IAAI,EAAe,CACnB,IAAI,EAAkB,CACtB,IAAI,EAAe,CACnB,IAAI,EAAoB,CACxB,IAAI,EAAc,CAClB,IAAI,EAAc,CAClB,IAAI,EAAmB,CACvB,IAAI,EAAO,CACV,KAAM,GAEN,WAAW,EAAQ,EAAO,CACxB,IAAM,EAAQ,EAAO,GAEjB,EAAmC,OAOvC,OALE,EAAuB,SAAS,GAAO,OAA8B,GAErE,EAAc,GAAO,QAGhB,gCAAgC,EAAY,KAGrD,aAAc,CACZ,MAAO,cAGT,YAAY,EAAQ,EAAO,CACzB,IAAM,EAAQ,EAAO,GAErB,MAAO,mBAAmB,EACxB,GAAO,SAAW,GACnB,CAAC,oBAEL,CAAC,CAKJ,MAFA,GAAG,SAAS,MAAM,oBAAwB,GAEnC,GASI,EAAkB,GAClB,GAAwB,CAEzB,OAAO,EAAS,CClE5B,SAAgB,EACd,EACA,EAAmB,EAAE,CACb,CACR,OAAO,EAAW,EAAe,EAAS,CAAE,EAAQ"}
@@ -0,0 +1 @@
1
+ const e=require(`./html-UjWBxd-n.cjs`);let t=require(`@shell-shock/plugin-theme/helpers/constants`),n=require(`@mdit/plugin-alert`),r=require(`@stryke/string-format`),i=require(`markdown-it`);i=e.n(i);let a=require(`markdown-it-abbr`);a=e.n(a);let o=require(`markdown-it-container`);o=e.n(o);let s=require(`markdown-it-deflist`);s=e.n(s);let c=require(`markdown-it-footnote`);c=e.n(c);let l=require(`markdown-it-ins`);l=e.n(l);let u=require(`markdown-it-mark`);u=e.n(u);let d=require(`markdown-it-sub`);d=e.n(d);let f=require(`markdown-it-sup`);f=e.n(f);let p=require(`markdown-it-task-lists`);p=e.n(p);const m=()=>{let e=(0,i.default)({html:!0,langPrefix:`language-`,linkify:!0}).use(c.default).use(l.default).use(u.default).use(s.default).use(a.default).use(o.default).use(f.default).use(d.default).use(p.default).use(n.alert,{deep:!1,openRender(e,n){let r=e[n],i=`info`;return t.THEME_MESSAGE_VARIANTS.includes(r?.markup)&&(i=r?.markup),`<message class="message-type-${i}">`},closeRender(){return`</message>`},titleRender(e,t){let n=e[t];return`<message-header>${(0,r.titleCase)(n?.content||``)}</message-header>`}});return e.renderer.rules.footnote_anchor=()=>``,e},h=e=>m().render(e);function g(t,n={}){return e.t(h(t),n)}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return g}});
@@ -59,10 +59,6 @@ interface RenderAdapter {
59
59
  * Options for {@link toConsole}.
60
60
  */
61
61
  interface Options {
62
- /**
63
- * The rendering components to use for console output.
64
- */
65
- adapter: RenderAdapter;
66
62
  /**
67
63
  * Whether to wrap lines at a certain width.
68
64
  */
@@ -91,4 +87,4 @@ interface Options {
91
87
  type ResolvedOptions = PartialKeys<Required<Options>, "postProcess">;
92
88
  //#endregion
93
89
  export { RenderAdapter as n, ResolvedOptions as r, Options as t };
94
- //# sourceMappingURL=types-C5cPWP5x.d.mts.map
90
+ //# sourceMappingURL=types-CCFWBb06.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-CCFWBb06.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";;;UAoBiB,aAAA;;AAAjB;;EAIE,OAAA,GAAU,IAAA,UAAc,KAAA;EAJI;;;EAS5B,IAAA,GAAO,IAAA;EAAP;;;EAKA,IAAA,GAAO,IAAA;EAKP;;;EAAA,MAAA,GAAS,IAAA;EAUT;;;EALA,aAAA,GAAgB,IAAA;EAehB;;;EAVA,SAAA,GAAY,IAAA;EAeJ;;;EAVR,UAAA,GAAa,IAAA;EAoBb;;;EAfA,IAAA,GAAO,GAAA,UAAa,IAAA;EAyBb;;AAMT;EA1BE,KAAA,GAAQ,KAAA;;;;EAKR,IAAA,GAAO,IAAA,UAAc,QAAA;EAmCrB;;;EA9BA,UAAA,GAAa,IAAA;EA6CE;;;EAxCf,KAAA;EA2CyB;;;EAtCzB,OAAA;AAAA;;;;UAMe,OAAA;EAgCkC;;;EA5BjD,GAAA;;;;EAKA,SAAA;;;;EAKA,SAAA;;;;EAKA,KAAA;;;;EAKA,SAAA;;;;EAKA,WAAA,IAAe,MAAA;AAAA;AAAA,KAGL,eAAA,GAAkB,WAAA,CAAY,QAAA,CAAS,OAAA"}
@@ -59,10 +59,6 @@ interface RenderAdapter {
59
59
  * Options for {@link toConsole}.
60
60
  */
61
61
  interface Options {
62
- /**
63
- * The rendering components to use for console output.
64
- */
65
- adapter: RenderAdapter;
66
62
  /**
67
63
  * Whether to wrap lines at a certain width.
68
64
  */
@@ -91,4 +87,4 @@ interface Options {
91
87
  type ResolvedOptions = PartialKeys<Required<Options>, "postProcess">;
92
88
  //#endregion
93
89
  export { RenderAdapter as n, ResolvedOptions as r, Options as t };
94
- //# sourceMappingURL=types-C7nXIjAN.d.cts.map
90
+ //# sourceMappingURL=types-J2htKY4q.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-J2htKY4q.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";;;UAoBiB,aAAA;;AAAjB;;EAIE,OAAA,GAAU,IAAA,UAAc,KAAA;EAJI;;;EAS5B,IAAA,GAAO,IAAA;EAAP;;;EAKA,IAAA,GAAO,IAAA;EAKP;;;EAAA,MAAA,GAAS,IAAA;EAUT;;;EALA,aAAA,GAAgB,IAAA;EAehB;;;EAVA,SAAA,GAAY,IAAA;EAeJ;;;EAVR,UAAA,GAAa,IAAA;EAoBb;;;EAfA,IAAA,GAAO,GAAA,UAAa,IAAA;EAyBb;;AAMT;EA1BE,KAAA,GAAQ,KAAA;;;;EAKR,IAAA,GAAO,IAAA,UAAc,QAAA;EAmCrB;;;EA9BA,UAAA,GAAa,IAAA;EA6CE;;;EAxCf,KAAA;EA2CyB;;;EAtCzB,OAAA;AAAA;;;;UAMe,OAAA;EAgCkC;;;EA5BjD,GAAA;;;;EAKA,SAAA;;;;EAKA,SAAA;;;;EAKA,KAAA;;;;EAKA,SAAA;;;;EAKA,WAAA,IAAe,MAAA;AAAA;AAAA,KAGL,eAAA,GAAkB,WAAA,CAAY,QAAA,CAAS,OAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shell-shock/unified",
3
- "version": "0.1.3",
3
+ "version": "0.2.0",
4
4
  "private": false,
5
5
  "description": "A package containing a Shell Shock plugin to generate unified built-in modules that display information about the application.",
6
6
  "keywords": ["unified", "shell-shock", "powerlines", "storm-software"],
@@ -91,7 +91,8 @@
91
91
  "files": ["dist/**/*"],
92
92
  "dependencies": {
93
93
  "@mdit/plugin-alert": "^0.23.2",
94
- "@shell-shock/core": "^0.17.0",
94
+ "@shell-shock/core": "^0.17.2",
95
+ "@shell-shock/plugin-theme": "^0.4.15",
95
96
  "@stryke/path": "^0.27.4",
96
97
  "@stryke/string-format": "^0.17.9",
97
98
  "@stryke/type-checks": "^0.6.1",
@@ -111,20 +112,14 @@
111
112
  "markdown-it-task-lists": "^2.1.1",
112
113
  "normalize-html-whitespace": "^1.0.0",
113
114
  "parse5": "^8.0.0",
114
- "powerlines": "^0.42.33",
115
+ "powerlines": "^0.42.34",
115
116
  "terminal-size": "^4.0.1",
116
117
  "wrap-ansi": "^10.0.0"
117
118
  },
118
119
  "devDependencies": {
119
- "@powerlines/plugin-tsdown": "^0.1.334",
120
- "@types/node": "^25.5.2"
120
+ "@powerlines/plugin-tsdown": "^0.1.335",
121
+ "@types/node": "^25.6.0"
121
122
  },
122
123
  "publishConfig": { "access": "public" },
123
- "inlinedDependencies": {
124
- "ansi-escapes": "4.3.2",
125
- "has-flag": "4.0.0",
126
- "supports-color": "7.2.0",
127
- "supports-hyperlinks": "2.3.0"
128
- },
129
- "gitHead": "8ca409c1453d9722650670c3df4f4da72abdc308"
124
+ "gitHead": "38e2393cfc876607226b05a59cc9bd62e3b59960"
130
125
  }
@@ -1,5 +0,0 @@
1
- import{parse as e}from"parse5";import t from"he";import n from"normalize-html-whitespace";import"wrap-ansi";import r from"chalk-string";var i=Object.create,a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,c=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,u=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),d=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=s(t),c=0,u=i.length,d;c<u;c++)d=i[c],!l.call(e,d)&&d!==n&&a(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=o(t,d))||r.enumerable});return e},f=(e,t,n)=>(n=e==null?{}:i(c(e)),d(t||!e||!e.__esModule?a(n,`default`,{value:e,enumerable:!0}):n,e)),p=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")});const m=e=>({pre:!1,lineWidth:120,fontAttrs:!0,depth:0,asciiMode:!1,...e}),h=(e,t)=>e==null&&t==null?null:e==null?t:t==null?e:t.value==null?{pre:e.pre,value:e.value,post:e.post==null?t.pre==null?t.post==null?``:t.post:t.pre:e.post}:e.value==null?{pre:e.pre==null?e.post==null?t.pre==null?``:t.pre:e.post:e.pre,value:t.value,post:t.post}:e.post==null?t.pre==null?{pre:e.pre,value:`${e.value}${t.value}`,post:t.post}:{pre:e.pre,value:`${e.value}${t.pre}${t.value}`,post:t.post}:{pre:e.pre,value:`${e.value}${e.post}${t.value}`,post:t.post},g=new WeakMap,_=(e,t,n)=>{if(!e||typeof e!=`object`||!t||typeof t!=`string`)return n;let r=g.get(e);if(r){let e=r.get(t);if(e!==void 0)return e??n}if(!e.attrs||!Array.isArray(e.attrs)||e.attrs.length===0)return r||(r=new Map,g.set(e,r)),r.set(t,null),n;let i=e.attrs.find(e=>e&&typeof e==`object`&&e.name===t);if(r||(r=new Map,g.set(e,r)),!i||i.value===void 0)return r.set(t,null),n;let a=i.value;return r.set(t,a),a},v=(e,r)=>{if(r.pre)return{pre:null,value:t.decode(e.value),post:null,type:`inline`,nodeName:`#text`};let i=[...(n(e.value)||``).replaceAll(`
2
- `,` `)],a=[` `,`
3
- `].includes(i[0])?i.shift():null,o=[` `,`
4
- `].includes(i.at(-1))?i.pop():null;return{pre:a,value:i.length>0?`${t.decode(i.join(``))}`:null,post:o,type:`inline`,nodeName:`#text`}},y=e=>(t,n)=>{let r=e||(e=>e);if(!t||!t.childNodes)return null;let i=t.childNodes.reduce((e,r)=>{let i=M(r,n,D.span);return i?{...h(e,i),type:`inline`,nodeName:t.nodeName}:e},null);return{pre:i?.pre?r(i.pre,t,n):null,value:r(i?.value,t,n),post:i?.post?r(i.post,t,n):null,type:`inline`,nodeName:t.nodeName}};var b=u(((e,t)=>{let n=t.exports;t.exports.default=n;let r=process.env.TERM_PROGRAM===`Apple_Terminal`;n.cursorTo=(e,t)=>{if(typeof e!=`number`)throw TypeError("The `x` argument is required");return typeof t==`number`?`\x1B[`+(t+1)+`;`+(e+1)+`H`:`\x1B[`+(e+1)+`G`},n.cursorMove=(e,t)=>{if(typeof e!=`number`)throw TypeError("The `x` argument is required");let n=``;return e<0?n+=`\x1B[`+-e+`D`:e>0&&(n+=`\x1B[`+e+`C`),t<0?n+=`\x1B[`+-t+`A`:t>0&&(n+=`\x1B[`+t+`B`),n},n.cursorUp=(e=1)=>`\x1B[`+e+`A`,n.cursorDown=(e=1)=>`\x1B[`+e+`B`,n.cursorForward=(e=1)=>`\x1B[`+e+`C`,n.cursorBackward=(e=1)=>`\x1B[`+e+`D`,n.cursorLeft=`\x1B[G`,n.cursorSavePosition=r?`\x1B7`:`\x1B[s`,n.cursorRestorePosition=r?`\x1B8`:`\x1B[u`,n.cursorGetPosition=`\x1B[6n`,n.cursorNextLine=`\x1B[E`,n.cursorPrevLine=`\x1B[F`,n.cursorHide=`\x1B[?25l`,n.cursorShow=`\x1B[?25h`,n.eraseLines=e=>{let t=``;for(let r=0;r<e;r++)t+=n.eraseLine+(r<e-1?n.cursorUp():``);return e&&(t+=n.cursorLeft),t},n.eraseEndLine=`\x1B[K`,n.eraseStartLine=`\x1B[1K`,n.eraseLine=`\x1B[2K`,n.eraseDown=`\x1B[J`,n.eraseUp=`\x1B[1J`,n.eraseScreen=`\x1B[2J`,n.scrollUp=`\x1B[S`,n.scrollDown=`\x1B[T`,n.clearScreen=`\x1Bc`,n.clearTerminal=process.platform===`win32`?`${n.eraseScreen}`:`${n.eraseScreen}`,n.beep=`\x07`,n.link=(e,t)=>[`\x1B]`,`8`,`;`,`;`,t,`\x07`,e,`\x1B]`,`8`,`;`,`;`,`\x07`].join(``),n.image=(e,t={})=>{let n=`\x1B]1337;File=inline=1`;return t.width&&(n+=`;width=${t.width}`),t.height&&(n+=`;height=${t.height}`),t.preserveAspectRatio===!1&&(n+=`;preserveAspectRatio=0`),n+`:`+e.toString(`base64`)+`\x07`},n.iTerm={setCwd:(e=process.cwd())=>`]50;CurrentDir=${e}`,annotation:(e,t={})=>{let n=`\x1B]1337;`,r=t.x!==void 0,i=t.y!==void 0;if((r||i)&&!(r&&i&&t.length!==void 0))throw Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");return e=e.replace(/\|/g,``),n+=t.isHidden?`AddHiddenAnnotation=`:`AddAnnotation=`,t.length>0?n+=(r?[e,t.length,t.x,t.y]:[t.length,e]).join(`|`):n+=e,n+`\x07`}}})),x=u(((e,t)=>{t.exports=(e,t=process.argv)=>{let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)}})),S=u(((e,t)=>{let n=p(`node:os`),r=p(`node:tty`),i=x(),{env:a}=process,o;i(`no-color`)||i(`no-colors`)||i(`color=false`)||i(`color=never`)?o=0:(i(`color`)||i(`colors`)||i(`color=true`)||i(`color=always`))&&(o=1),`FORCE_COLOR`in a&&(o=a.FORCE_COLOR===`true`?1:a.FORCE_COLOR===`false`?0:a.FORCE_COLOR.length===0?1:Math.min(parseInt(a.FORCE_COLOR,10),3));function s(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function c(e,t){if(o===0)return 0;if(i(`color=16m`)||i(`color=full`)||i(`color=truecolor`))return 3;if(i(`color=256`))return 2;if(e&&!t&&o===void 0)return 0;let r=o||0;if(a.TERM===`dumb`)return r;if(process.platform===`win32`){let e=n.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in a)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`].some(e=>e in a)||a.CI_NAME===`codeship`?1:r;if(`TEAMCITY_VERSION`in a)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(a.TEAMCITY_VERSION)?1:0;if(a.COLORTERM===`truecolor`)return 3;if(`TERM_PROGRAM`in a){let e=parseInt((a.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(a.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(a.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(a.TERM)||`COLORTERM`in a?1:r}function l(e){return s(c(e,e&&e.isTTY))}t.exports={supportsColor:l,stdout:s(c(!0,r.isatty(1))),stderr:s(c(!0,r.isatty(2)))}})),C=u(((e,t)=>{let n=S(),r=x();function i(e){if(/^\d{3,4}$/.test(e)){let t=/(\d{1,2})(\d{2})/.exec(e);return{major:0,minor:parseInt(t[1],10),patch:parseInt(t[2],10)}}let t=(e||``).split(`.`).map(e=>parseInt(e,10));return{major:t[0],minor:t[1],patch:t[2]}}function a(e){let{env:t}=process;if(`FORCE_HYPERLINK`in t)return!(t.FORCE_HYPERLINK.length>0&&parseInt(t.FORCE_HYPERLINK,10)===0);if(r(`no-hyperlink`)||r(`no-hyperlinks`)||r(`hyperlink=false`)||r(`hyperlink=never`))return!1;if(r(`hyperlink=true`)||r(`hyperlink=always`)||`NETLIFY`in t)return!0;if(!n.supportsColor(e)||e&&!e.isTTY||process.platform===`win32`||`CI`in t||`TEAMCITY_VERSION`in t)return!1;if(`TERM_PROGRAM`in t){let e=i(t.TERM_PROGRAM_VERSION);switch(t.TERM_PROGRAM){case`iTerm.app`:return e.major===3?e.minor>=1:e.major>3;case`WezTerm`:return e.major>=20200620;case`vscode`:return e.major>1||e.major===1&&e.minor>=72}}if(`VTE_VERSION`in t){if(t.VTE_VERSION===`0.50.0`)return!1;let e=i(t.VTE_VERSION);return e.major>0||e.minor>=50}return!1}t.exports={supportsHyperlink:a,stdout:a(process.stdout),stderr:a(process.stderr)}})),w=f(b(),1),T=f(C(),1);const E=y((e,t,n)=>{let i=_(t,`href`,null),a=_(t,`title`,null),o=getCustomAttributes(t),s=n.theme.a||{},c=!i||[`file://`,`http://`,`https://`,`mailto:`,`ftp://`,`ftps://`,`sftp://`,`ssh://`,`dav://`,`tel:`,`git://`].some(e=>i.startsWith(e))?i:null,l=applyCustomColor(o.color,n.theme.a.color,e,r),u=o.href.enabled!==null&&o.href.enabled!==void 0?o.href.enabled:s.hrefEnabled,d;switch(u){case!0:case`true`:d=!0;break;case!1:case`false`:d=!1;break;case`auto`:d=!T.default.stdout;break;default:d=!1}let f=o.title.enabled!==null&&o.title.enabled!==void 0?o.title.enabled===`true`||o.title.enabled===!0:s.titleEnabled===!0,p=T.default.stdout&&c&&!d?w.default.link(l,c):l;if(d&&c){let e=o.href.color||s.hrefColor||`gray`,t=safeChalkString(e,{colors:!0})(` [${c}]`);p+=t}if(f&&a){let e=o.title.color||s.titleColor||`yellow`,t=o.title.prefix.marker!==void 0&&o.title.prefix.marker!==null?o.title.prefix.marker:s.titlePrefix||` (`,n=o.title.suffix.marker!==void 0&&o.title.suffix.marker!==null?o.title.suffix.marker:s.titleSuffix||`)`,r=o.title.prefix.color||s.titlePrefixColor||e,i=o.title.suffix.color||s.titleSuffixColor||e,c=r&&t!=null?safeChalkString(r,{colors:!0})(t):t||``,l=e&&a?safeChalkString(e,{colors:!0})(a):a,u=i&&n!=null?safeChalkString(i,{colors:!0})(n):n||``;p+=`${c}${l}${u}`}let m=c&&(c.startsWith(`http://`)||c.startsWith(`https://`));if((o.external.enabled!==null&&o.external.enabled!==void 0?o.external.enabled===`true`||o.external.enabled===!0:s.external?.enabled===!0)&&m){let e=o.external.marker||s.external?.marker||`↗`,t=o.external.color||s.external?.color||`gray`,n=o.external.position||s.external?.position||`after`,r=o.external.spacing!==void 0&&o.external.spacing!==null?o.external.spacing:s.external?.spacing!==void 0&&s.external?.spacing!==null?s.external.spacing:` `,i=safeChalkString(t,{colors:!0})(e);p=n===`before`?`${i}${r}${p}`:`${p}${r}${i}`}return p});var D={"#text":v,a:E};const O=process.env.CACHE_RENDER!==`false`,k=new WeakMap,A=(e,t)=>{if(!O||!e||typeof e!=`object`)return;let n=k.get(e);if(n)return n.get(JSON.stringify({lineWidth:t.lineWidth,pre:t.pre,listDepth:t.listDepth,listType:t.listType,depth:t.depth}))},j=(e,t,n)=>{if(!O||!e||typeof e!=`object`)return;let r=k.get(e);if(r||(r=new Map,k.set(e,r)),r.set(JSON.stringify({lineWidth:t.lineWidth,pre:t.pre,listDepth:t.listDepth,listType:t.listType,depth:t.depth}),n),r.size>10){let e=r.keys().next().value;r.delete(e)}},M=(e,t,n=D.div)=>{if(!e)return null;let r=t.depth===void 0?0:t.depth;if(r>=100)return null;let i={...t,depth:r+1},a=A(e,i);if(a!==void 0)return a;let o=null;try{o=(D[e.nodeName||`#text`]||n)(e,i),j(e,i,o)}catch{o=null}return o};function N(t,n){return`${(M(e(t,{sourceCodeLocationInfo:!0}),m(n))||{value:``}).value}\n`}export{N as t};
5
- //# sourceMappingURL=html-Di3_LwV3.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"html-Di3_LwV3.mjs","names":["tags","supportsHyperlinks","ansiEscapes","tags"],"sources":["../src/html/helpers/options.ts","../src/html/helpers/concat.ts","../src/html/helpers/get-attribute.ts","../src/html/helpers/tag-utilities.ts","../../../node_modules/.pnpm/ansi-escapes@4.3.2/node_modules/ansi-escapes/index.js","../../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js","../../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js","../../../node_modules/.pnpm/supports-hyperlinks@2.3.0/node_modules/supports-hyperlinks/index.js","../src/html/tags/a.ts","../src/html/tags/index.ts","../src/html/helpers/render.ts","../src/html/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Options, ResolvedOptions } from \"../../types\";\n\nexport const getOptions = (input: Options): ResolvedOptions => {\n return {\n pre: false,\n lineWidth: 120,\n fontAttrs: true,\n depth: 0,\n asciiMode: false,\n ...input\n };\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nconst toMarginNumber = value => {\n const parsed = Number(value);\n\n return Number.isFinite(parsed) ? parsed : 0;\n};\n\nexport const concatTwoBlockTags = (first, second) => {\n if (first == null && second == null) {\n return null;\n }\n\n if (first == null) {\n return second;\n }\n\n if (second == null) {\n return first;\n }\n\n const firstMarginTop = toMarginNumber(first.marginTop);\n const firstMarginBottom = toMarginNumber(first.marginBottom);\n const secondMarginTop = toMarginNumber(second.marginTop);\n const secondMarginBottom = toMarginNumber(second.marginBottom);\n\n if (second.value == null) {\n return {\n marginTop: firstMarginTop,\n value: first.value,\n marginBottom: Math.max(\n firstMarginBottom,\n secondMarginTop,\n secondMarginBottom\n )\n };\n }\n\n if (first.value == null) {\n return {\n marginTop: Math.max(firstMarginTop, firstMarginBottom, secondMarginTop),\n value: second.value,\n marginBottom: secondMarginBottom\n };\n }\n\n const separatorLines = Math.max(firstMarginBottom, secondMarginTop);\n\n return {\n marginTop: firstMarginTop,\n value: `${first.value}${\"\\n\".repeat(separatorLines)}${second.value}`,\n marginBottom: secondMarginBottom\n };\n};\n\nexport const concatTwoInlineTags = (first, second) => {\n if (first == null && second == null) {\n return null;\n }\n\n if (first == null) {\n return second;\n }\n\n if (second == null) {\n return first;\n }\n\n if (second.value == null) {\n return {\n pre: first.pre,\n value: first.value,\n post:\n first.post == null\n ? second.pre == null\n ? second.post == null\n ? \"\"\n : second.post\n : second.pre\n : first.post\n };\n }\n\n if (first.value == null) {\n return {\n pre:\n first.pre == null\n ? first.post == null\n ? second.pre == null\n ? \"\"\n : second.pre\n : first.post\n : first.pre,\n value: second.value,\n post: second.post\n };\n }\n\n if (first.post != null) {\n return {\n pre: first.pre,\n value: `${first.value}${first.post}${second.value}`,\n post: second.post\n };\n }\n\n if (second.pre != null) {\n return {\n pre: first.pre,\n value: `${first.value}${second.pre}${second.value}`,\n post: second.post\n };\n }\n\n return {\n pre: first.pre,\n value: `${first.value}${second.value}`,\n post: second.post\n };\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\ninterface TagAttribute {\n name: string;\n value?: string;\n}\n\ninterface Tag {\n attrs?: TagAttribute[];\n [key: string]: unknown;\n}\n\nconst attributeCache = new WeakMap<Tag, Map<string, string | null>>();\n\n/**\n * Get attribute value from tag with validation and caching\n * @param tag - HTML tag object\n * @param attributeName - Name of attribute to get\n * @param defaultValue - Default value if attribute not found\n * @returns Attribute value or default\n */\nexport const getAttribute = (\n tag: Tag | unknown,\n attributeName: string | unknown,\n defaultValue?: string\n): string | unknown => {\n // Validate inputs\n if (!tag || typeof tag !== \"object\") {\n return defaultValue;\n }\n\n if (!attributeName || typeof attributeName !== \"string\") {\n return defaultValue;\n }\n\n // Check cache first\n let tagCache = attributeCache.get(tag as Tag);\n if (tagCache) {\n const cachedValue = tagCache.get(attributeName);\n if (cachedValue !== undefined) {\n return cachedValue ?? defaultValue;\n }\n }\n\n // Not in cache, compute value\n if (!tag.attrs || !Array.isArray(tag.attrs) || tag.attrs.length === 0) {\n // Cache the miss\n if (!tagCache) {\n tagCache = new Map();\n attributeCache.set(tag, tagCache);\n }\n tagCache.set(attributeName, null);\n return defaultValue;\n }\n\n const attribute = tag.attrs.find(\n attribute_ =>\n attribute_ &&\n typeof attribute_ === \"object\" &&\n attribute_.name === attributeName\n );\n\n // Cache the result\n if (!tagCache) {\n tagCache = new Map();\n attributeCache.set(tag, tagCache);\n }\n\n if (!attribute || attribute.value === undefined) {\n tagCache.set(attributeName, null);\n return defaultValue;\n }\n\n const value = attribute.value;\n tagCache.set(attributeName, value);\n return value;\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport he from \"he\";\nimport normalizeWhitespace from \"normalize-html-whitespace\";\nimport tags from \"../tags\";\nimport { concatTwoBlockTags, concatTwoInlineTags } from \"./concat\";\nimport { getAttribute } from \"./get-attribute\";\nimport { renderTag } from \"./render\";\nimport { wrapLineWidth } from \"./wrap-line-width\";\n\nexport const inlineToBlockTag = value => {\n if (!value) {\n return null;\n }\n\n return {\n ...value,\n marginTop: 0,\n marginBottom: 0,\n type: \"block\",\n nodeName: \"#blockTag\"\n };\n};\n\nexport const textNode = (tag, context) => {\n if (context.pre) {\n return {\n pre: null,\n value: he.decode(tag.value),\n post: null,\n type: \"inline\",\n nodeName: \"#text\"\n };\n }\n\n const normalized = [\n ...(normalizeWhitespace(tag.value) || \"\").replaceAll(\"\\n\", \" \")\n ];\n\n const pre = [\" \", \"\\n\"].includes(normalized[0]) ? normalized.shift() : null;\n const post = [\" \", \"\\n\"].includes(normalized.at(-1))\n ? normalized.pop()\n : null;\n\n return {\n pre,\n value: normalized.length > 0 ? `${he.decode(normalized.join(\"\"))}` : null,\n post,\n type: \"inline\",\n nodeName: \"#text\"\n };\n};\n\n/**\n * A helper function to render block-level HTML tags, processing their child nodes and applying appropriate margins and formatting based on the provided context and wrapper function. The function handles both block and inline child nodes, concatenating their rendered output while managing whitespace and line breaks to ensure proper display in terminal environments.\n *\n * @param wrapper - A function that takes the rendered content of the block tag and returns a potentially modified version of it. This allows for custom processing or styling to be applied to the content of the block tag.\n * @param localContext - An optional context object that can be used to provide additional information or configuration for rendering the block tag. This context can include properties such as margin settings, theme information, or any other relevant data that may influence how the block tag is rendered.\n * @returns A function that renders a block-level HTML tag, processing its child nodes and applying appropriate margins and formatting based on the provided context and wrapper function. The function handles both block and inline child nodes, concatenating their rendered output while managing whitespace and line breaks to ensure proper display in terminal environments.\n */\nexport function blockTag(wrapper, localContext) {\n return (tag, context) => {\n const wrapFunction = wrapper || (argument => argument);\n\n if (!tag || !tag.childNodes) {\n return null;\n }\n\n let liItemNumber = Number.parseInt(getAttribute(tag, \"start\", \"1\"), 10);\n const value = tag.childNodes.reduce(\n (accumulator, node) => {\n const nodeTag = renderTag(node, { ...context, liItemNumber });\n\n if (!nodeTag) {\n return accumulator;\n }\n\n if (nodeTag.nodeName === \"li\") {\n liItemNumber += 1;\n }\n\n if (nodeTag.type === \"inline\") {\n return {\n block: accumulator.block,\n inline: concatTwoInlineTags(accumulator.inline, nodeTag)\n };\n }\n\n if (accumulator.inline && accumulator.inline.value != null) {\n accumulator.inline.value = wrapLineWidth(\n accumulator.inline.value,\n context\n );\n }\n\n accumulator.block = concatTwoBlockTags(\n accumulator.block,\n inlineToBlockTag(accumulator.inline)\n );\n\n accumulator.block = concatTwoBlockTags(accumulator.block, nodeTag);\n\n return {\n block: accumulator.block,\n inline: null\n };\n },\n {\n block: null,\n inline: null\n }\n );\n\n if (value.inline != null && value.inline.value != null) {\n value.inline.value = wrapLineWidth(value.inline.value, context);\n }\n\n value.block = concatTwoBlockTags(\n value.block,\n inlineToBlockTag(value.inline)\n );\n\n let topBlock = localContext?.marginTop || 0;\n\n topBlock = !context || !context.pre ? topBlock + 1 : topBlock;\n\n let bottomBlock = localContext?.marginBottom || 0;\n\n bottomBlock = !context || !context.pre ? bottomBlock + 1 : bottomBlock;\n\n // Handle empty content - return empty string with margins instead of null\n if (!value.block || !value.block.value) {\n return {\n marginTop: topBlock,\n value: \"\",\n marginBottom: bottomBlock,\n type: \"block\",\n nodeName: tag.nodeName\n };\n }\n\n return {\n marginTop:\n value.block.marginTop && value.block.marginTop > topBlock\n ? value.block.marginTop\n : topBlock,\n value: wrapFunction(value.block.value, tag, context),\n marginBottom:\n value.block.marginBottom && value.block.marginBottom > bottomBlock\n ? value.block.marginBottom\n : bottomBlock,\n type: \"block\",\n nodeName: tag.nodeName\n };\n };\n}\n\nexport const inlineTag = wrapper => (tag, context) => {\n const wrapFunction = wrapper || (argument => argument);\n\n if (!tag || !tag.childNodes) {\n return null;\n }\n\n const value = tag.childNodes.reduce((accumulator, node) => {\n const nodeTag = renderTag(node, context, tags.span);\n\n if (!nodeTag) {\n return accumulator;\n }\n\n return {\n ...concatTwoInlineTags(accumulator, nodeTag),\n type: \"inline\",\n nodeName: tag.nodeName\n };\n }, null);\n\n return {\n pre: value?.pre ? wrapFunction(value.pre, tag, context) : null,\n value: wrapFunction(value?.value, tag, context),\n post: value?.post ? wrapFunction(value.post, tag, context) : null,\n type: \"inline\",\n nodeName: tag.nodeName\n };\n};\n\nexport const voidTag = () => null;\n","'use strict';\nconst ansiEscapes = module.exports;\n// TODO: remove this in the next major version\nmodule.exports.default = ansiEscapes;\n\nconst ESC = '\\u001B[';\nconst OSC = '\\u001B]';\nconst BEL = '\\u0007';\nconst SEP = ';';\nconst isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal';\n\nansiEscapes.cursorTo = (x, y) => {\n\tif (typeof x !== 'number') {\n\t\tthrow new TypeError('The `x` argument is required');\n\t}\n\n\tif (typeof y !== 'number') {\n\t\treturn ESC + (x + 1) + 'G';\n\t}\n\n\treturn ESC + (y + 1) + ';' + (x + 1) + 'H';\n};\n\nansiEscapes.cursorMove = (x, y) => {\n\tif (typeof x !== 'number') {\n\t\tthrow new TypeError('The `x` argument is required');\n\t}\n\n\tlet ret = '';\n\n\tif (x < 0) {\n\t\tret += ESC + (-x) + 'D';\n\t} else if (x > 0) {\n\t\tret += ESC + x + 'C';\n\t}\n\n\tif (y < 0) {\n\t\tret += ESC + (-y) + 'A';\n\t} else if (y > 0) {\n\t\tret += ESC + y + 'B';\n\t}\n\n\treturn ret;\n};\n\nansiEscapes.cursorUp = (count = 1) => ESC + count + 'A';\nansiEscapes.cursorDown = (count = 1) => ESC + count + 'B';\nansiEscapes.cursorForward = (count = 1) => ESC + count + 'C';\nansiEscapes.cursorBackward = (count = 1) => ESC + count + 'D';\n\nansiEscapes.cursorLeft = ESC + 'G';\nansiEscapes.cursorSavePosition = isTerminalApp ? '\\u001B7' : ESC + 's';\nansiEscapes.cursorRestorePosition = isTerminalApp ? '\\u001B8' : ESC + 'u';\nansiEscapes.cursorGetPosition = ESC + '6n';\nansiEscapes.cursorNextLine = ESC + 'E';\nansiEscapes.cursorPrevLine = ESC + 'F';\nansiEscapes.cursorHide = ESC + '?25l';\nansiEscapes.cursorShow = ESC + '?25h';\n\nansiEscapes.eraseLines = count => {\n\tlet clear = '';\n\n\tfor (let i = 0; i < count; i++) {\n\t\tclear += ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : '');\n\t}\n\n\tif (count) {\n\t\tclear += ansiEscapes.cursorLeft;\n\t}\n\n\treturn clear;\n};\n\nansiEscapes.eraseEndLine = ESC + 'K';\nansiEscapes.eraseStartLine = ESC + '1K';\nansiEscapes.eraseLine = ESC + '2K';\nansiEscapes.eraseDown = ESC + 'J';\nansiEscapes.eraseUp = ESC + '1J';\nansiEscapes.eraseScreen = ESC + '2J';\nansiEscapes.scrollUp = ESC + 'S';\nansiEscapes.scrollDown = ESC + 'T';\n\nansiEscapes.clearScreen = '\\u001Bc';\n\nansiEscapes.clearTerminal = process.platform === 'win32' ?\n\t`${ansiEscapes.eraseScreen}${ESC}0f` :\n\t// 1. Erases the screen (Only done in case `2` is not supported)\n\t// 2. Erases the whole screen including scrollback buffer\n\t// 3. Moves cursor to the top-left position\n\t// More info: https://www.real-world-systems.com/docs/ANSIcode.html\n\t`${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`;\n\nansiEscapes.beep = BEL;\n\nansiEscapes.link = (text, url) => {\n\treturn [\n\t\tOSC,\n\t\t'8',\n\t\tSEP,\n\t\tSEP,\n\t\turl,\n\t\tBEL,\n\t\ttext,\n\t\tOSC,\n\t\t'8',\n\t\tSEP,\n\t\tSEP,\n\t\tBEL\n\t].join('');\n};\n\nansiEscapes.image = (buffer, options = {}) => {\n\tlet ret = `${OSC}1337;File=inline=1`;\n\n\tif (options.width) {\n\t\tret += `;width=${options.width}`;\n\t}\n\n\tif (options.height) {\n\t\tret += `;height=${options.height}`;\n\t}\n\n\tif (options.preserveAspectRatio === false) {\n\t\tret += ';preserveAspectRatio=0';\n\t}\n\n\treturn ret + ':' + buffer.toString('base64') + BEL;\n};\n\nansiEscapes.iTerm = {\n\tsetCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,\n\n\tannotation: (message, options = {}) => {\n\t\tlet ret = `${OSC}1337;`;\n\n\t\tconst hasX = typeof options.x !== 'undefined';\n\t\tconst hasY = typeof options.y !== 'undefined';\n\t\tif ((hasX || hasY) && !(hasX && hasY && typeof options.length !== 'undefined')) {\n\t\t\tthrow new Error('`x`, `y` and `length` must be defined when `x` or `y` is defined');\n\t\t}\n\n\t\tmessage = message.replace(/\\|/g, '');\n\n\t\tret += options.isHidden ? 'AddHiddenAnnotation=' : 'AddAnnotation=';\n\n\t\tif (options.length > 0) {\n\t\t\tret +=\n\t\t\t\t\t(hasX ?\n\t\t\t\t\t\t[message, options.length, options.x, options.y] :\n\t\t\t\t\t\t[options.length, message]).join('|');\n\t\t} else {\n\t\t\tret += message;\n\t\t}\n\n\t\treturn ret + BEL;\n\t}\n};\n","'use strict';\n\nmodule.exports = (flag, argv = process.argv) => {\n\tconst prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');\n\tconst position = argv.indexOf(prefix + flag);\n\tconst terminatorPosition = argv.indexOf('--');\n\treturn position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);\n};\n","'use strict';\nconst os = require('os');\nconst tty = require('tty');\nconst hasFlag = require('has-flag');\n\nconst {env} = process;\n\nlet forceColor;\nif (hasFlag('no-color') ||\n\thasFlag('no-colors') ||\n\thasFlag('color=false') ||\n\thasFlag('color=never')) {\n\tforceColor = 0;\n} else if (hasFlag('color') ||\n\thasFlag('colors') ||\n\thasFlag('color=true') ||\n\thasFlag('color=always')) {\n\tforceColor = 1;\n}\n\nif ('FORCE_COLOR' in env) {\n\tif (env.FORCE_COLOR === 'true') {\n\t\tforceColor = 1;\n\t} else if (env.FORCE_COLOR === 'false') {\n\t\tforceColor = 0;\n\t} else {\n\t\tforceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);\n\t}\n}\n\nfunction translateLevel(level) {\n\tif (level === 0) {\n\t\treturn false;\n\t}\n\n\treturn {\n\t\tlevel,\n\t\thasBasic: true,\n\t\thas256: level >= 2,\n\t\thas16m: level >= 3\n\t};\n}\n\nfunction supportsColor(haveStream, streamIsTTY) {\n\tif (forceColor === 0) {\n\t\treturn 0;\n\t}\n\n\tif (hasFlag('color=16m') ||\n\t\thasFlag('color=full') ||\n\t\thasFlag('color=truecolor')) {\n\t\treturn 3;\n\t}\n\n\tif (hasFlag('color=256')) {\n\t\treturn 2;\n\t}\n\n\tif (haveStream && !streamIsTTY && forceColor === undefined) {\n\t\treturn 0;\n\t}\n\n\tconst min = forceColor || 0;\n\n\tif (env.TERM === 'dumb') {\n\t\treturn min;\n\t}\n\n\tif (process.platform === 'win32') {\n\t\t// Windows 10 build 10586 is the first Windows release that supports 256 colors.\n\t\t// Windows 10 build 14931 is the first release that supports 16m/TrueColor.\n\t\tconst osRelease = os.release().split('.');\n\t\tif (\n\t\t\tNumber(osRelease[0]) >= 10 &&\n\t\t\tNumber(osRelease[2]) >= 10586\n\t\t) {\n\t\t\treturn Number(osRelease[2]) >= 14931 ? 3 : 2;\n\t\t}\n\n\t\treturn 1;\n\t}\n\n\tif ('CI' in env) {\n\t\tif (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn min;\n\t}\n\n\tif ('TEAMCITY_VERSION' in env) {\n\t\treturn /^(9\\.(0*[1-9]\\d*)\\.|\\d{2,}\\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;\n\t}\n\n\tif (env.COLORTERM === 'truecolor') {\n\t\treturn 3;\n\t}\n\n\tif ('TERM_PROGRAM' in env) {\n\t\tconst version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);\n\n\t\tswitch (env.TERM_PROGRAM) {\n\t\t\tcase 'iTerm.app':\n\t\t\t\treturn version >= 3 ? 3 : 2;\n\t\t\tcase 'Apple_Terminal':\n\t\t\t\treturn 2;\n\t\t\t// No default\n\t\t}\n\t}\n\n\tif (/-256(color)?$/i.test(env.TERM)) {\n\t\treturn 2;\n\t}\n\n\tif (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {\n\t\treturn 1;\n\t}\n\n\tif ('COLORTERM' in env) {\n\t\treturn 1;\n\t}\n\n\treturn min;\n}\n\nfunction getSupportLevel(stream) {\n\tconst level = supportsColor(stream, stream && stream.isTTY);\n\treturn translateLevel(level);\n}\n\nmodule.exports = {\n\tsupportsColor: getSupportLevel,\n\tstdout: translateLevel(supportsColor(true, tty.isatty(1))),\n\tstderr: translateLevel(supportsColor(true, tty.isatty(2)))\n};\n","'use strict';\nconst supportsColor = require('supports-color');\nconst hasFlag = require('has-flag');\n\nfunction parseVersion(versionString) {\n\tif (/^\\d{3,4}$/.test(versionString)) {\n\t\t// Env var doesn't always use dots. example: 4601 => 46.1.0\n\t\tconst m = /(\\d{1,2})(\\d{2})/.exec(versionString);\n\t\treturn {\n\t\t\tmajor: 0,\n\t\t\tminor: parseInt(m[1], 10),\n\t\t\tpatch: parseInt(m[2], 10)\n\t\t};\n\t}\n\n\tconst versions = (versionString || '').split('.').map(n => parseInt(n, 10));\n\treturn {\n\t\tmajor: versions[0],\n\t\tminor: versions[1],\n\t\tpatch: versions[2]\n\t};\n}\n\nfunction supportsHyperlink(stream) {\n\tconst {env} = process;\n\n\tif ('FORCE_HYPERLINK' in env) {\n\t\treturn !(env.FORCE_HYPERLINK.length > 0 && parseInt(env.FORCE_HYPERLINK, 10) === 0);\n\t}\n\n\tif (hasFlag('no-hyperlink') || hasFlag('no-hyperlinks') || hasFlag('hyperlink=false') || hasFlag('hyperlink=never')) {\n\t\treturn false;\n\t}\n\n\tif (hasFlag('hyperlink=true') || hasFlag('hyperlink=always')) {\n\t\treturn true;\n\t}\n\n\t// Netlify does not run a TTY, it does not need `supportsColor` check\n\tif ('NETLIFY' in env) {\n\t\treturn true;\n\t}\n\n\t// If they specify no colors, they probably don't want hyperlinks.\n\tif (!supportsColor.supportsColor(stream)) {\n\t\treturn false;\n\t}\n\n\tif (stream && !stream.isTTY) {\n\t\treturn false;\n\t}\n\n\tif (process.platform === 'win32') {\n\t\treturn false;\n\t}\n\n\tif ('CI' in env) {\n\t\treturn false;\n\t}\n\n\tif ('TEAMCITY_VERSION' in env) {\n\t\treturn false;\n\t}\n\n\tif ('TERM_PROGRAM' in env) {\n\t\tconst version = parseVersion(env.TERM_PROGRAM_VERSION);\n\n\t\tswitch (env.TERM_PROGRAM) {\n\t\t\tcase 'iTerm.app':\n\t\t\t\tif (version.major === 3) {\n\t\t\t\t\treturn version.minor >= 1;\n\t\t\t\t}\n\n\t\t\t\treturn version.major > 3;\n\t\t\tcase 'WezTerm':\n\t\t\t\treturn version.major >= 20200620;\n\t\t\tcase 'vscode':\n\t\t\t\treturn version.major > 1 || version.major === 1 && version.minor >= 72;\n\t\t\t// No default\n\t\t}\n\t}\n\n\tif ('VTE_VERSION' in env) {\n\t\t// 0.50.0 was supposed to support hyperlinks, but throws a segfault\n\t\tif (env.VTE_VERSION === '0.50.0') {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst version = parseVersion(env.VTE_VERSION);\n\t\treturn version.major > 0 || version.minor >= 50;\n\t}\n\n\treturn false;\n}\n\nmodule.exports = {\n\tsupportsHyperlink,\n\tstdout: supportsHyperlink(process.stdout),\n\tstderr: supportsHyperlink(process.stderr)\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport ansiEscapes from \"ansi-escapes\";\nimport chalkString from \"chalk-string\";\nimport supportsHyperlinks from \"supports-hyperlinks\";\nimport { getAttribute } from \"../helpers/get-attribute\";\nimport { inlineTag } from \"../helpers/tag-utilities\";\n\nexport const a = inlineTag((value, tag, context) => {\n const rawHref = getAttribute(tag, \"href\", null);\n const rawTitle = getAttribute(tag, \"title\", null);\n const custom = getCustomAttributes(tag);\n const theme = context.theme.a || {};\n\n const schemes = [\n \"file://\",\n \"http://\",\n \"https://\",\n \"mailto:\",\n \"ftp://\",\n \"ftps://\",\n \"sftp://\",\n \"ssh://\",\n \"dav://\",\n \"tel:\",\n \"git://\"\n ];\n\n const href =\n !rawHref || schemes.some(url => rawHref.startsWith(url)) ? rawHref : null;\n\n const linkText = applyCustomColor(\n custom.color,\n context.theme.a.color,\n value,\n chalkString\n );\n\n // Check if we should show href\n // Supports: true/false/'auto'\n // auto: show href only if terminal doesn't support hyperlinks\n const hrefEnabledValue =\n custom.href.enabled !== null && custom.href.enabled !== undefined\n ? custom.href.enabled\n : theme.hrefEnabled;\n\n let showHref;\n switch (hrefEnabledValue) {\n case true:\n case \"true\": {\n showHref = true;\n\n break;\n }\n case false:\n case \"false\": {\n showHref = false;\n\n break;\n }\n case \"auto\": {\n showHref = !supportsHyperlinks.stdout;\n\n break;\n }\n default: {\n showHref = false; // default\n }\n }\n\n // Check if we should show title\n const showTitle =\n custom.title.enabled !== null && custom.title.enabled !== undefined\n ? custom.title.enabled === \"true\" || custom.title.enabled === true\n : theme.titleEnabled === true;\n\n // Only create hyperlink if we're NOT showing href explicitly (to avoid duplication)\n const useHyperlink = supportsHyperlinks.stdout && href && !showHref;\n const linkValue = useHyperlink ? ansiEscapes.link(linkText, href) : linkText;\n\n let result = linkValue;\n\n // Add href if requested (only if hyperlink is not used)\n if (showHref && href) {\n const hrefColor = custom.href.color || theme.hrefColor || \"gray\";\n const styledHref = safeChalkString(hrefColor, { colors: true })(\n ` [${href}]`\n );\n result += styledHref;\n }\n\n // Add title if requested\n if (showTitle && rawTitle) {\n const titleColor = custom.title.color || theme.titleColor || \"yellow\";\n const titlePrefix =\n custom.title.prefix.marker !== undefined &&\n custom.title.prefix.marker !== null\n ? custom.title.prefix.marker\n : theme.titlePrefix || \" (\";\n const titleSuffix =\n custom.title.suffix.marker !== undefined &&\n custom.title.suffix.marker !== null\n ? custom.title.suffix.marker\n : theme.titleSuffix || \")\";\n\n // Support for separate prefix/suffix colors\n const titlePrefixColor =\n custom.title.prefix.color || theme.titlePrefixColor || titleColor;\n const titleSuffixColor =\n custom.title.suffix.color || theme.titleSuffixColor || titleColor;\n\n const styledPrefix =\n titlePrefixColor && titlePrefix !== null && titlePrefix !== undefined\n ? safeChalkString(titlePrefixColor, { colors: true })(titlePrefix)\n : titlePrefix || \"\";\n const styledTitle =\n titleColor && rawTitle\n ? safeChalkString(titleColor, { colors: true })(rawTitle)\n : rawTitle;\n const styledSuffix =\n titleSuffixColor && titleSuffix !== null && titleSuffix !== undefined\n ? safeChalkString(titleSuffixColor, { colors: true })(titleSuffix)\n : titleSuffix || \"\";\n\n result += `${styledPrefix}${styledTitle}${styledSuffix}`;\n }\n\n // Add external link indicator if requested\n const isExternal =\n href && (href.startsWith(\"http://\") || href.startsWith(\"https://\"));\n const showExternalIndicator =\n custom.external.enabled !== null && custom.external.enabled !== undefined\n ? custom.external.enabled === \"true\" || custom.external.enabled === true\n : theme.external?.enabled === true;\n\n if (showExternalIndicator && isExternal) {\n const externalIndicatorMarker =\n custom.external.marker || theme.external?.marker || \"↗\";\n const externalIndicatorColor =\n custom.external.color || theme.external?.color || \"gray\";\n const externalIndicatorPosition =\n custom.external.position || theme.external?.position || \"after\";\n const externalIndicatorSpacing =\n custom.external.spacing !== undefined && custom.external.spacing !== null\n ? custom.external.spacing\n : theme.external?.spacing !== undefined &&\n theme.external?.spacing !== null\n ? theme.external.spacing\n : \" \";\n\n const styledIndicator = safeChalkString(externalIndicatorColor, {\n colors: true\n })(externalIndicatorMarker);\n\n result =\n externalIndicatorPosition === \"before\"\n ? `${styledIndicator}${externalIndicatorSpacing}${result}`\n : `${result}${externalIndicatorSpacing}${styledIndicator}`;\n }\n\n return result;\n});\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { textNode } from \"../helpers/tag-utilities\";\nimport { a } from \"./a\";\n\nexport default {\n \"#text\": textNode,\n a\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport tags from \"../tags\";\n\nconst MAX_DEPTH = 100;\nconst CACHE_ENABLED = process.env.CACHE_RENDER !== \"false\";\n\n/**\n * Cache for rendered subtrees (WeakMap for automatic garbage collection)\n * Key: node object, Value: Map of context hash -\\> rendered result\n */\nconst renderCache = new WeakMap();\n\n/**\n * Get cached render result\n *\n * @param node - HTML node\n * @param context - Rendering context\n * @returns - Cached result or undefined\n */\nconst getCachedRender = (node, context) => {\n if (!CACHE_ENABLED || !node || typeof node !== \"object\") {\n return;\n }\n\n const nodeCache = renderCache.get(node);\n if (!nodeCache) {\n return;\n }\n\n return nodeCache.get(\n JSON.stringify({\n lineWidth: context.lineWidth,\n pre: context.pre,\n listDepth: context.listDepth,\n listType: context.listType,\n depth: context.depth\n })\n );\n};\n\n/**\n * Cache render result\n *\n * @param node - HTML node\n * @param context - Rendering context\n * @param result - Render result\n */\nconst setCachedRender = (node, context, result) => {\n if (!CACHE_ENABLED || !node || typeof node !== \"object\") {\n return;\n }\n\n let nodeCache = renderCache.get(node);\n if (!nodeCache) {\n nodeCache = new Map();\n renderCache.set(node, nodeCache);\n }\n\n nodeCache.set(\n JSON.stringify({\n lineWidth: context.lineWidth,\n pre: context.pre,\n listDepth: context.listDepth,\n listType: context.listType,\n depth: context.depth\n }),\n result\n );\n\n // Limit cache size per node to prevent memory bloat\n if (nodeCache.size > 10) {\n const firstKey = nodeCache.keys().next().value;\n nodeCache.delete(firstKey);\n }\n};\n\n/**\n * Render HTML tag with optimizations for deep nesting\n *\n * @param node - HTML node\n * @param context - Rendering context\n * @param defaultTag - Default tag function\n * @returns - Render result\n */\nexport const renderTag = (node, context, defaultTag = tags.div) => {\n // Validate inputs\n if (!node) {\n return null;\n }\n\n // Initialize depth on first call\n const currentDepth = context.depth === undefined ? 0 : context.depth;\n\n // Check if we've exceeded maximum nesting depth\n if (currentDepth >= MAX_DEPTH) {\n return null;\n }\n\n // Create new context with incremented depth\n const newContext = { ...context, depth: currentDepth + 1 };\n\n // Check cache with new context (includes updated depth)\n const cached = getCachedRender(node, newContext);\n if (cached !== undefined) {\n return cached;\n }\n\n let result = null;\n\n try {\n const tagFunction = tags[node.nodeName || \"#text\"] || defaultTag;\n\n // Render tag\n result = tagFunction(node, newContext);\n\n // Cache result with new context (includes updated depth)\n setCachedRender(node, newContext, result);\n } catch {\n // Return null on error to skip this tag\n result = null;\n }\n\n return result;\n};\n\n/**\n * Batch render multiple nodes\n * Optimized for rendering lists and repeated structures\n * @param nodes - Array of HTML nodes\n * @param context - Rendering context\n * @param defaultTag - Default tag function\n * @returns - Array of render results\n */\nexport const renderNodes = (nodes, context, defaultTag = tags.div) => {\n if (!nodes || !Array.isArray(nodes) || nodes.length === 0) {\n return [];\n }\n\n const results = [];\n\n for (const node of nodes) {\n const result = renderTag(node, context, defaultTag);\n\n if (result !== null && result !== undefined) {\n results.push(result);\n }\n }\n\n return results;\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { parse } from \"parse5\";\nimport type { Options } from \"../types\";\nimport { getOptions } from \"./helpers/options\";\nimport { renderTag } from \"./helpers/render\";\n\n/**\n * Renders HTML content as source code for displaying in the terminal.\n *\n * @param html - HTML content\n * @param options - Configuration options for rendering the HTML.\n * @return A string of source code that can be executed to display the rendered HTML in the terminal.\n */\nexport function renderHtml(html: string, options: Options): string {\n const document = parse(html, { sourceCodeLocationInfo: true });\n\n return `${(renderTag(document, getOptions(options)) || { value: \"\" }).value}\\n`;\n}\n"],"x_google_ignoreList":[4,5,6,7],"mappings":"+hCAoBA,MAAa,EAAc,IAClB,CACL,IAAK,GACL,UAAW,IACX,UAAW,GACX,MAAO,EACP,UAAW,GACX,GAAG,EACJ,EC2CU,GAAuB,EAAO,IACrC,GAAS,MAAQ,GAAU,KACtB,KAGL,GAAS,KACJ,EAGL,GAAU,KACL,EAGL,EAAO,OAAS,KACX,CACL,IAAK,EAAM,IACX,MAAO,EAAM,MACb,KACE,EAAM,MAAQ,KACV,EAAO,KAAO,KACZ,EAAO,MAAQ,KACb,GACA,EAAO,KACT,EAAO,IACT,EAAM,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,CACvB,IAAM,EAAW,EAAU,MAAM,CAAC,MAAM,CAAC,MACzC,EAAU,OAAO,EAAS,GAYjB,GAAa,EAAM,EAAS,EAAaC,EAAK,MAAQ,CAEjE,GAAI,CAAC,EACH,OAAO,KAIT,IAAM,EAAe,EAAQ,QAAU,IAAA,GAAY,EAAI,EAAQ,MAG/D,GAAI,GAAgB,IAClB,OAAO,KAIT,IAAM,EAAa,CAAE,GAAG,EAAS,MAAO,EAAe,EAAG,CAGpD,EAAS,EAAgB,EAAM,EAAW,CAChD,GAAI,IAAW,IAAA,GACb,OAAO,EAGT,IAAI,EAAS,KAEb,GAAI,CAIF,GAHoBA,EAAK,EAAK,UAAY,UAAY,GAGjC,EAAM,EAAW,CAGtC,EAAgB,EAAM,EAAY,EAAO,MACnC,CAEN,EAAS,KAGX,OAAO,GC7GT,SAAgB,EAAW,EAAc,EAA0B,CAGjE,MAAO,IAAI,EAFM,EAAM,EAAM,CAAE,uBAAwB,GAAM,CAAC,CAE/B,EAAW,EAAQ,CAAC,EAAI,CAAE,MAAO,GAAI,EAAE,MAAM"}
@@ -1,4 +0,0 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let l=require(`parse5`),u=require(`he`);u=c(u);let d=require(`normalize-html-whitespace`);d=c(d),require(`wrap-ansi`);let f=require(`chalk-string`);f=c(f);const p=e=>({pre:!1,lineWidth:120,fontAttrs:!0,depth:0,asciiMode:!1,...e}),m=(e,t)=>e==null&&t==null?null:e==null?t:t==null?e:t.value==null?{pre:e.pre,value:e.value,post:e.post==null?t.pre==null?t.post==null?``:t.post:t.pre:e.post}:e.value==null?{pre:e.pre==null?e.post==null?t.pre==null?``:t.pre:e.post:e.pre,value:t.value,post:t.post}:e.post==null?t.pre==null?{pre:e.pre,value:`${e.value}${t.value}`,post:t.post}:{pre:e.pre,value:`${e.value}${t.pre}${t.value}`,post:t.post}:{pre:e.pre,value:`${e.value}${e.post}${t.value}`,post:t.post},h=new WeakMap,g=(e,t,n)=>{if(!e||typeof e!=`object`||!t||typeof t!=`string`)return n;let r=h.get(e);if(r){let e=r.get(t);if(e!==void 0)return e??n}if(!e.attrs||!Array.isArray(e.attrs)||e.attrs.length===0)return r||(r=new Map,h.set(e,r)),r.set(t,null),n;let i=e.attrs.find(e=>e&&typeof e==`object`&&e.name===t);if(r||(r=new Map,h.set(e,r)),!i||i.value===void 0)return r.set(t,null),n;let a=i.value;return r.set(t,a),a},_=(e,t)=>{if(t.pre)return{pre:null,value:u.default.decode(e.value),post:null,type:`inline`,nodeName:`#text`};let n=[...((0,d.default)(e.value)||``).replaceAll(`
2
- `,` `)],r=[` `,`
3
- `].includes(n[0])?n.shift():null,i=[` `,`
4
- `].includes(n.at(-1))?n.pop():null;return{pre:r,value:n.length>0?`${u.default.decode(n.join(``))}`:null,post:i,type:`inline`,nodeName:`#text`}},v=e=>(t,n)=>{let r=e||(e=>e);if(!t||!t.childNodes)return null;let i=t.childNodes.reduce((e,r)=>{let i=j(r,n,E.span);return i?{...m(e,i),type:`inline`,nodeName:t.nodeName}:e},null);return{pre:i?.pre?r(i.pre,t,n):null,value:r(i?.value,t,n),post:i?.post?r(i.post,t,n):null,type:`inline`,nodeName:t.nodeName}};var y=o(((e,t)=>{let n=t.exports;t.exports.default=n;let r=process.env.TERM_PROGRAM===`Apple_Terminal`;n.cursorTo=(e,t)=>{if(typeof e!=`number`)throw TypeError("The `x` argument is required");return typeof t==`number`?`\x1B[`+(t+1)+`;`+(e+1)+`H`:`\x1B[`+(e+1)+`G`},n.cursorMove=(e,t)=>{if(typeof e!=`number`)throw TypeError("The `x` argument is required");let n=``;return e<0?n+=`\x1B[`+-e+`D`:e>0&&(n+=`\x1B[`+e+`C`),t<0?n+=`\x1B[`+-t+`A`:t>0&&(n+=`\x1B[`+t+`B`),n},n.cursorUp=(e=1)=>`\x1B[`+e+`A`,n.cursorDown=(e=1)=>`\x1B[`+e+`B`,n.cursorForward=(e=1)=>`\x1B[`+e+`C`,n.cursorBackward=(e=1)=>`\x1B[`+e+`D`,n.cursorLeft=`\x1B[G`,n.cursorSavePosition=r?`\x1B7`:`\x1B[s`,n.cursorRestorePosition=r?`\x1B8`:`\x1B[u`,n.cursorGetPosition=`\x1B[6n`,n.cursorNextLine=`\x1B[E`,n.cursorPrevLine=`\x1B[F`,n.cursorHide=`\x1B[?25l`,n.cursorShow=`\x1B[?25h`,n.eraseLines=e=>{let t=``;for(let r=0;r<e;r++)t+=n.eraseLine+(r<e-1?n.cursorUp():``);return e&&(t+=n.cursorLeft),t},n.eraseEndLine=`\x1B[K`,n.eraseStartLine=`\x1B[1K`,n.eraseLine=`\x1B[2K`,n.eraseDown=`\x1B[J`,n.eraseUp=`\x1B[1J`,n.eraseScreen=`\x1B[2J`,n.scrollUp=`\x1B[S`,n.scrollDown=`\x1B[T`,n.clearScreen=`\x1Bc`,n.clearTerminal=process.platform===`win32`?`${n.eraseScreen}`:`${n.eraseScreen}`,n.beep=`\x07`,n.link=(e,t)=>[`\x1B]`,`8`,`;`,`;`,t,`\x07`,e,`\x1B]`,`8`,`;`,`;`,`\x07`].join(``),n.image=(e,t={})=>{let n=`\x1B]1337;File=inline=1`;return t.width&&(n+=`;width=${t.width}`),t.height&&(n+=`;height=${t.height}`),t.preserveAspectRatio===!1&&(n+=`;preserveAspectRatio=0`),n+`:`+e.toString(`base64`)+`\x07`},n.iTerm={setCwd:(e=process.cwd())=>`]50;CurrentDir=${e}`,annotation:(e,t={})=>{let n=`\x1B]1337;`,r=t.x!==void 0,i=t.y!==void 0;if((r||i)&&!(r&&i&&t.length!==void 0))throw Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");return e=e.replace(/\|/g,``),n+=t.isHidden?`AddHiddenAnnotation=`:`AddAnnotation=`,t.length>0?n+=(r?[e,t.length,t.x,t.y]:[t.length,e]).join(`|`):n+=e,n+`\x07`}}})),b=o(((e,t)=>{t.exports=(e,t=process.argv)=>{let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)}})),x=o(((e,t)=>{let n=require(`node:os`),r=require(`node:tty`),i=b(),{env:a}=process,o;i(`no-color`)||i(`no-colors`)||i(`color=false`)||i(`color=never`)?o=0:(i(`color`)||i(`colors`)||i(`color=true`)||i(`color=always`))&&(o=1),`FORCE_COLOR`in a&&(o=a.FORCE_COLOR===`true`?1:a.FORCE_COLOR===`false`?0:a.FORCE_COLOR.length===0?1:Math.min(parseInt(a.FORCE_COLOR,10),3));function s(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function c(e,t){if(o===0)return 0;if(i(`color=16m`)||i(`color=full`)||i(`color=truecolor`))return 3;if(i(`color=256`))return 2;if(e&&!t&&o===void 0)return 0;let r=o||0;if(a.TERM===`dumb`)return r;if(process.platform===`win32`){let e=n.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in a)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`].some(e=>e in a)||a.CI_NAME===`codeship`?1:r;if(`TEAMCITY_VERSION`in a)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(a.TEAMCITY_VERSION)?1:0;if(a.COLORTERM===`truecolor`)return 3;if(`TERM_PROGRAM`in a){let e=parseInt((a.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(a.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(a.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(a.TERM)||`COLORTERM`in a?1:r}function l(e){return s(c(e,e&&e.isTTY))}t.exports={supportsColor:l,stdout:s(c(!0,r.isatty(1))),stderr:s(c(!0,r.isatty(2)))}})),S=o(((e,t)=>{let n=x(),r=b();function i(e){if(/^\d{3,4}$/.test(e)){let t=/(\d{1,2})(\d{2})/.exec(e);return{major:0,minor:parseInt(t[1],10),patch:parseInt(t[2],10)}}let t=(e||``).split(`.`).map(e=>parseInt(e,10));return{major:t[0],minor:t[1],patch:t[2]}}function a(e){let{env:t}=process;if(`FORCE_HYPERLINK`in t)return!(t.FORCE_HYPERLINK.length>0&&parseInt(t.FORCE_HYPERLINK,10)===0);if(r(`no-hyperlink`)||r(`no-hyperlinks`)||r(`hyperlink=false`)||r(`hyperlink=never`))return!1;if(r(`hyperlink=true`)||r(`hyperlink=always`)||`NETLIFY`in t)return!0;if(!n.supportsColor(e)||e&&!e.isTTY||process.platform===`win32`||`CI`in t||`TEAMCITY_VERSION`in t)return!1;if(`TERM_PROGRAM`in t){let e=i(t.TERM_PROGRAM_VERSION);switch(t.TERM_PROGRAM){case`iTerm.app`:return e.major===3?e.minor>=1:e.major>3;case`WezTerm`:return e.major>=20200620;case`vscode`:return e.major>1||e.major===1&&e.minor>=72}}if(`VTE_VERSION`in t){if(t.VTE_VERSION===`0.50.0`)return!1;let e=i(t.VTE_VERSION);return e.major>0||e.minor>=50}return!1}t.exports={supportsHyperlink:a,stdout:a(process.stdout),stderr:a(process.stderr)}})),C=c(y(),1),w=c(S(),1);const T=v((e,t,n)=>{let r=g(t,`href`,null),i=g(t,`title`,null),a=getCustomAttributes(t),o=n.theme.a||{},s=!r||[`file://`,`http://`,`https://`,`mailto:`,`ftp://`,`ftps://`,`sftp://`,`ssh://`,`dav://`,`tel:`,`git://`].some(e=>r.startsWith(e))?r:null,c=applyCustomColor(a.color,n.theme.a.color,e,f.default),l=a.href.enabled!==null&&a.href.enabled!==void 0?a.href.enabled:o.hrefEnabled,u;switch(l){case!0:case`true`:u=!0;break;case!1:case`false`:u=!1;break;case`auto`:u=!w.default.stdout;break;default:u=!1}let d=a.title.enabled!==null&&a.title.enabled!==void 0?a.title.enabled===`true`||a.title.enabled===!0:o.titleEnabled===!0,p=w.default.stdout&&s&&!u?C.default.link(c,s):c;if(u&&s){let e=a.href.color||o.hrefColor||`gray`,t=safeChalkString(e,{colors:!0})(` [${s}]`);p+=t}if(d&&i){let e=a.title.color||o.titleColor||`yellow`,t=a.title.prefix.marker!==void 0&&a.title.prefix.marker!==null?a.title.prefix.marker:o.titlePrefix||` (`,n=a.title.suffix.marker!==void 0&&a.title.suffix.marker!==null?a.title.suffix.marker:o.titleSuffix||`)`,r=a.title.prefix.color||o.titlePrefixColor||e,s=a.title.suffix.color||o.titleSuffixColor||e,c=r&&t!=null?safeChalkString(r,{colors:!0})(t):t||``,l=e&&i?safeChalkString(e,{colors:!0})(i):i,u=s&&n!=null?safeChalkString(s,{colors:!0})(n):n||``;p+=`${c}${l}${u}`}let m=s&&(s.startsWith(`http://`)||s.startsWith(`https://`));if((a.external.enabled!==null&&a.external.enabled!==void 0?a.external.enabled===`true`||a.external.enabled===!0:o.external?.enabled===!0)&&m){let e=a.external.marker||o.external?.marker||`↗`,t=a.external.color||o.external?.color||`gray`,n=a.external.position||o.external?.position||`after`,r=a.external.spacing!==void 0&&a.external.spacing!==null?a.external.spacing:o.external?.spacing!==void 0&&o.external?.spacing!==null?o.external.spacing:` `,i=safeChalkString(t,{colors:!0})(e);p=n===`before`?`${i}${r}${p}`:`${p}${r}${i}`}return p});var E={"#text":_,a:T};const D=process.env.CACHE_RENDER!==`false`,O=new WeakMap,k=(e,t)=>{if(!D||!e||typeof e!=`object`)return;let n=O.get(e);if(n)return n.get(JSON.stringify({lineWidth:t.lineWidth,pre:t.pre,listDepth:t.listDepth,listType:t.listType,depth:t.depth}))},A=(e,t,n)=>{if(!D||!e||typeof e!=`object`)return;let r=O.get(e);if(r||(r=new Map,O.set(e,r)),r.set(JSON.stringify({lineWidth:t.lineWidth,pre:t.pre,listDepth:t.listDepth,listType:t.listType,depth:t.depth}),n),r.size>10){let e=r.keys().next().value;r.delete(e)}},j=(e,t,n=E.div)=>{if(!e)return null;let r=t.depth===void 0?0:t.depth;if(r>=100)return null;let i={...t,depth:r+1},a=k(e,i);if(a!==void 0)return a;let o=null;try{o=(E[e.nodeName||`#text`]||n)(e,i),A(e,i,o)}catch{o=null}return o};function M(e,t){return`${(j((0,l.parse)(e,{sourceCodeLocationInfo:!0}),p(t))||{value:``}).value}\n`}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return M}});
@@ -1,3 +0,0 @@
1
- import{t as e}from"./html-Di3_LwV3.mjs";import{alert as t}from"@mdit/plugin-alert";import{upperCaseFirst as n}from"@stryke/string-format";import r from"markdown-it";import i from"markdown-it-abbr";import a from"markdown-it-container";import o from"markdown-it-deflist";import s from"markdown-it-footnote";import c from"markdown-it-ins";import l from"markdown-it-mark";import u from"markdown-it-sub";import d from"markdown-it-sup";import f from"markdown-it-task-lists";const p=()=>{let e=r({html:!0,langPrefix:`language-`,linkify:!0}).use(s).use(c).use(l).use(o).use(i).use(a).use(d).use(u).use(f).use(t,{deep:!1,openRender(e,t){let n=e[t],r=null;switch(n?.markup){case`important`:r=`red`;break;case`note`:r=`blue`;break;case`tip`:r=`green`;break;case`warning`:r=`yellow`;break;case`caution`:r=`magenta`;break;default:r=`blue`}return`<blockquote data-cli-color="${r}">`},closeRender(){return`</blockquote>`},titleRender(e,t){let r=e[t],i=null;switch(r?.markup){case`important`:i=`red`;break;case`note`:i=`blue`;break;case`tip`:i=`green`;break;case`warning`:i=`yellow`;break;case`caution`:i=`magenta`;break;default:i=`blue`}return`<p><span data-cli-color="${i}"><b>${n(r?.content||``)}
2
- }</b></span></p>`}});return e.renderer.rules.footnote_anchor=()=>``,e},m=e=>p().render(e);function h(t,n){return e(m(t),n)}export{h as t};
3
- //# sourceMappingURL=markdown-OuY_JOk0.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"markdown-OuY_JOk0.mjs","names":[],"sources":["../src/markdown/markdown-to-html.ts","../src/markdown/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { alert } from \"@mdit/plugin-alert\";\nimport { upperCaseFirst } from \"@stryke/string-format\";\nimport markdownit from \"markdown-it\";\nimport markdownItAbbr from \"markdown-it-abbr\";\nimport markdownItContainer from \"markdown-it-container\";\nimport markdownItDeflist from \"markdown-it-deflist\";\nimport markdownItFootnote from \"markdown-it-footnote\";\nimport markdownItIns from \"markdown-it-ins\";\nimport markdownItMark from \"markdown-it-mark\";\nimport markdownItSub from \"markdown-it-sub\";\nimport markdownItSup from \"markdown-it-sup\";\nimport markdownItTaskList from \"markdown-it-task-lists\";\n\n/**\n * Create a configured markdown-it instance with GFM support\n */\nexport const createMarkdownRenderer = () => {\n const md = markdownit({\n html: true,\n langPrefix: \"language-\",\n linkify: true\n })\n .use(markdownItFootnote)\n .use(markdownItIns)\n .use(markdownItMark)\n .use(markdownItDeflist)\n .use(markdownItAbbr)\n .use(markdownItContainer)\n .use(markdownItSup)\n .use(markdownItSub)\n .use(markdownItTaskList)\n .use(alert, {\n deep: false,\n\n openRender(tokens, index) {\n const token = tokens[index];\n\n let color = null;\n\n // Map alert types to colors\n switch (token?.markup) {\n case \"important\": {\n color = \"red\";\n break;\n }\n case \"note\": {\n color = \"blue\";\n break;\n }\n case \"tip\": {\n color = \"green\";\n break;\n }\n case \"warning\": {\n color = \"yellow\";\n break;\n }\n case \"caution\": {\n color = \"magenta\";\n break;\n }\n default: {\n color = \"blue\";\n }\n }\n\n return `<blockquote data-cli-color=\"${color}\">`;\n },\n\n closeRender() {\n return \"</blockquote>\";\n },\n\n titleRender(tokens, index) {\n const token = tokens[index];\n\n let color = null;\n\n switch (token?.markup) {\n case \"important\": {\n color = \"red\";\n break;\n }\n case \"note\": {\n color = \"blue\";\n break;\n }\n case \"tip\": {\n color = \"green\";\n break;\n }\n case \"warning\": {\n color = \"yellow\";\n break;\n }\n case \"caution\": {\n color = \"magenta\";\n break;\n }\n default: {\n color = \"blue\";\n }\n }\n\n return `<p><span data-cli-color=\"${color}\"><b>${upperCaseFirst(token?.content || \"\")}\n }</b></span></p>`;\n }\n });\n\n // Remove footnote anchors\n md.renderer.rules.footnote_anchor = () => \"\";\n\n return md;\n};\n\n/**\n * Render markdown to HTML\n *\n * @param markdown - Markdown content\n * @returns HTML string\n */\nexport const markdownToHtml = (markdown: string): string => {\n const md = createMarkdownRenderer();\n\n return md.render(markdown);\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { renderHtml } from \"../html\";\nimport type { Options } from \"../types\";\nimport { markdownToHtml } from \"./markdown-to-html\";\n\n/**\n * Renders Markdown content as source code for displaying in the terminal.\n *\n * @param markdown - Markdown content\n * @param options - Configuration options for rendering the markdown.\n * @return A string of source code that can be executed to display the rendered markdown in the terminal.\n */\nexport function renderMarkdown(markdown: string, options: Options): string {\n return renderHtml(markdownToHtml(markdown), options);\n}\n"],"mappings":"odAkCA,MAAa,MAA+B,CAC1C,IAAM,EAAK,EAAW,CACpB,KAAM,GACN,WAAY,YACZ,QAAS,GACV,CAAC,CACC,IAAI,EAAmB,CACvB,IAAI,EAAc,CAClB,IAAI,EAAe,CACnB,IAAI,EAAkB,CACtB,IAAI,EAAe,CACnB,IAAI,EAAoB,CACxB,IAAI,EAAc,CAClB,IAAI,EAAc,CAClB,IAAI,EAAmB,CACvB,IAAI,EAAO,CACV,KAAM,GAEN,WAAW,EAAQ,EAAO,CACxB,IAAM,EAAQ,EAAO,GAEjB,EAAQ,KAGZ,OAAQ,GAAO,OAAf,CACE,IAAK,YACH,EAAQ,MACR,MAEF,IAAK,OACH,EAAQ,OACR,MAEF,IAAK,MACH,EAAQ,QACR,MAEF,IAAK,UACH,EAAQ,SACR,MAEF,IAAK,UACH,EAAQ,UACR,MAEF,QACE,EAAQ,OAIZ,MAAO,+BAA+B,EAAM,KAG9C,aAAc,CACZ,MAAO,iBAGT,YAAY,EAAQ,EAAO,CACzB,IAAM,EAAQ,EAAO,GAEjB,EAAQ,KAEZ,OAAQ,GAAO,OAAf,CACE,IAAK,YACH,EAAQ,MACR,MAEF,IAAK,OACH,EAAQ,OACR,MAEF,IAAK,MACH,EAAQ,QACR,MAEF,IAAK,UACH,EAAQ,SACR,MAEF,IAAK,UACH,EAAQ,UACR,MAEF,QACE,EAAQ,OAIZ,MAAO,4BAA4B,EAAM,OAAO,EAAe,GAAO,SAAW,GAAG,CAAC;2BAGxF,CAAC,CAKJ,MAFA,GAAG,SAAS,MAAM,oBAAwB,GAEnC,GASI,EAAkB,GAClB,GAAwB,CAEzB,OAAO,EAAS,CCjH5B,SAAgB,EAAe,EAAkB,EAA0B,CACzE,OAAO,EAAW,EAAe,EAAS,CAAE,EAAQ"}
@@ -1,2 +0,0 @@
1
- const e=require(`./html-y4ndTJv8.cjs`);let t=require(`@mdit/plugin-alert`),n=require(`@stryke/string-format`),r=require(`markdown-it`);r=e.n(r);let i=require(`markdown-it-abbr`);i=e.n(i);let a=require(`markdown-it-container`);a=e.n(a);let o=require(`markdown-it-deflist`);o=e.n(o);let s=require(`markdown-it-footnote`);s=e.n(s);let c=require(`markdown-it-ins`);c=e.n(c);let l=require(`markdown-it-mark`);l=e.n(l);let u=require(`markdown-it-sub`);u=e.n(u);let d=require(`markdown-it-sup`);d=e.n(d);let f=require(`markdown-it-task-lists`);f=e.n(f);const p=()=>{let e=(0,r.default)({html:!0,langPrefix:`language-`,linkify:!0}).use(s.default).use(c.default).use(l.default).use(o.default).use(i.default).use(a.default).use(d.default).use(u.default).use(f.default).use(t.alert,{deep:!1,openRender(e,t){let n=e[t],r=null;switch(n?.markup){case`important`:r=`red`;break;case`note`:r=`blue`;break;case`tip`:r=`green`;break;case`warning`:r=`yellow`;break;case`caution`:r=`magenta`;break;default:r=`blue`}return`<blockquote data-cli-color="${r}">`},closeRender(){return`</blockquote>`},titleRender(e,t){let r=e[t],i=null;switch(r?.markup){case`important`:i=`red`;break;case`note`:i=`blue`;break;case`tip`:i=`green`;break;case`warning`:i=`yellow`;break;case`caution`:i=`magenta`;break;default:i=`blue`}return`<p><span data-cli-color="${i}"><b>${(0,n.upperCaseFirst)(r?.content||``)}
2
- }</b></span></p>`}});return e.renderer.rules.footnote_anchor=()=>``,e},m=e=>p().render(e);function h(t,n){return e.t(m(t),n)}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return h}});
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-C5cPWP5x.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";;;UAoBiB,aAAA;;AAAjB;;EAIE,OAAA,GAAU,IAAA,UAAc,KAAA;EAJI;;;EAS5B,IAAA,GAAO,IAAA;EAAP;;;E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