@shell-shock/unified 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/html/index.cjs +1 -1
- package/dist/html/index.mjs +1 -1
- package/dist/html-BK9y-nf5.cjs +4 -0
- package/dist/html-DzncQodH.mjs +5 -0
- package/dist/html-DzncQodH.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/markdown/index.cjs +1 -1
- package/dist/markdown/index.mjs +1 -1
- package/dist/{markdown-OuY_JOk0.mjs → markdown-BiaU4FQg.mjs} +2 -2
- package/dist/{markdown-OuY_JOk0.mjs.map → markdown-BiaU4FQg.mjs.map} +1 -1
- package/dist/{markdown-Q_Sr7IsK.cjs → markdown-DX-arJZe.cjs} +1 -1
- package/package.json +3 -9
- package/dist/html-Di3_LwV3.mjs +0 -5
- package/dist/html-Di3_LwV3.mjs.map +0 -1
- package/dist/html-y4ndTJv8.cjs +0 -4
package/dist/html/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../html-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../html-BK9y-nf5.cjs`);exports.renderHtml=e.t;
|
package/dist/html/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"../html-
|
|
1
|
+
import{t as e}from"../html-DzncQodH.mjs";export{e as renderHtml};
|
|
@@ -0,0 +1,4 @@
|
|
|
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),require(`wrap-ansi`);const d=e=>({pre:!1,lineWidth:120,fontAttrs:!0,depth:0,asciiMode:!1,...e}),f=(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},p=new WeakMap,m=(e,t,n=null)=>{if(!e||typeof e!=`object`||!t||typeof t!=`string`)return n;let r=p.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,p.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,p.set(e,r)),!i||i.value===void 0)return r.set(t,null),n;let a=i.value;return r.set(t,a),a},h=l.default.decode,g=u.default,_=(e,t)=>{let n=String(e.value??``);if(t.pre)return{pre:null,value:h(n),post:null,type:`inline`,nodeName:`#text`};let r=[...(g(n)||``).replaceAll(`
|
|
2
|
+
`,` `)],i=[` `,`
|
|
3
|
+
`].includes(r[0]??``)?r.shift()??null:null,a=[` `,`
|
|
4
|
+
`].includes(r.at(-1)??``)?r.pop()??null:null;return{pre:i,value:r.length>0?`${h(r.join(``))}`:null,post:a,type:`inline`,nodeName:`#text`}},v=e=>(t,n)=>{let r=e??(e=>e??null),i=x.span;if(!t||!t.childNodes)return null;let a=t.childNodes.reduce((e,r)=>{let a=E(r,n,i);return a?{...f(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}},y=v((e,t,n)=>{let r=m(t,`href`,null),i=m(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}"`:``}),b=v((e,t)=>{let n=m(t,`title`,null);return e?n?`${e} (${n})`:e:``});var x={"#text":_,a:y,abbr:b};const S=process.env.CACHE_RENDER!==`false`,C=new WeakMap,w=(e,t)=>{if(!S||!e||typeof e!=`object`)return;let n=C.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(!S||!e||typeof e!=`object`)return;let r=C.get(e);if(r||(r=new Map,C.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=(e,t,n=x.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=w(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 D(e,t){return`${(E((0,c.parse)(e,{sourceCodeLocationInfo:!0}),d(t))||{value:``}).value}\n`}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return D}});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{parse as e}from"parse5";import t from"he";import n from"normalize-html-whitespace";import"wrap-ansi";const r=e=>({pre:!1,lineWidth:120,fontAttrs:!0,depth:0,asciiMode:!1,...e}),i=(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},a=new WeakMap,o=(e,t,n=null)=>{if(!e||typeof e!=`object`||!t||typeof t!=`string`)return n;let r=a.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,a.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,a.set(e,r)),!i||i.value===void 0)return r.set(t,null),n;let o=i.value;return r.set(t,o),o},s=t.decode,c=n,l=(e,t)=>{let n=String(e.value??``);if(t.pre)return{pre:null,value:s(n),post:null,type:`inline`,nodeName:`#text`};let r=[...(c(n)||``).replaceAll(`
|
|
2
|
+
`,` `)],i=[` `,`
|
|
3
|
+
`].includes(r[0]??``)?r.shift()??null:null,a=[` `,`
|
|
4
|
+
`].includes(r.at(-1)??``)?r.pop()??null:null;return{pre:i,value:r.length>0?`${s(r.join(``))}`:null,post:a,type:`inline`,nodeName:`#text`}},u=e=>(t,n)=>{let r=e??(e=>e??null),a=p.span;if(!t||!t.childNodes)return null;let o=t.childNodes.reduce((e,r)=>{let o=v(r,n,a);return o?{...i(e,o),type:`inline`,nodeName:t.nodeName}:e},null);return{pre:o?.pre?r(o.pre,t,n):null,value:r(o?.value,t,n),post:o?.post?r(o.post,t,n):null,type:`inline`,nodeName:t.nodeName}},d=u((e,t,n)=>{let r=o(t,`href`,null),i=o(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}"`:``}),f=u((e,t)=>{let n=o(t,`title`,null);return e?n?`${e} (${n})`:e:``});var p={"#text":l,a:d,abbr:f};const m=process.env.CACHE_RENDER!==`false`,h=new WeakMap,g=(e,t)=>{if(!m||!e||typeof e!=`object`)return;let n=h.get(e);if(n)return n.get(JSON.stringify({lineWidth:t.lineWidth,pre:t.pre,listDepth:t.listDepth,listType:t.listType,depth:t.depth}))},_=(e,t,n)=>{if(!m||!e||typeof e!=`object`)return;let r=h.get(e);if(r||(r=new Map,h.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)}},v=(e,t,n=p.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=g(e,i);if(a!==void 0)return a;let o=null;try{o=(p[e.nodeName||`#text`]||n)(e,i),_(e,i,o)}catch{o=null}return o};function y(t,n){return`${(v(e(t,{sourceCodeLocationInfo:!0}),r(n))||{value:``}).value}\n`}export{y as t};
|
|
5
|
+
//# sourceMappingURL=html-DzncQodH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-DzncQodH.mjs","names":["tags","tags"],"sources":["../src/html/helpers/options.ts","../src/html/helpers/concat.ts","../src/html/helpers/get-attribute.ts","../src/html/helpers/tag-utilities.ts","../src/html/tags/a.ts","../src/html/tags/abbr.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,\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","/* -------------------------------------------------------------------\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 [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 [key: string]: unknown;\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 BlockTagValue {\n marginTop: number;\n value: string | null;\n marginBottom: number;\n type: \"block\";\n nodeName: string | undefined;\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 | undefined\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 (accumulator: BlockTagAccumulator, node: HtmlNode) => {\n const nodeTag = renderTag(node, {\n ...context,\n liItemNumber\n }) as RenderedTag | null;\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 } as BlockTagAccumulator\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 =\n (wrapper?: InlineTagWrapper) =>\n (tag: HtmlNode, context: RenderContext): InlineTagValue | null => {\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 null;\n }\n\n const value = tag.childNodes.reduce(\n (accumulator, node) => {\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),\n type: \"inline\",\n nodeName: tag.nodeName\n };\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 = (): null => null;\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","/* -------------------------------------------------------------------\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 } from \"./abbr\";\n\nexport default {\n \"#text\": textNode,\n a,\n abbr\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"],"mappings":"4GAoBA,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,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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"}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./html-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./html-BK9y-nf5.cjs`),t=require(`./markdown-DX-arJZe.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.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./html-
|
|
1
|
+
import{t as e}from"./html-DzncQodH.mjs";import{t}from"./markdown-BiaU4FQg.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
|
package/dist/markdown/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../markdown-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../markdown-DX-arJZe.cjs`);exports.renderMarkdown=e.t;
|
package/dist/markdown/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"../markdown-
|
|
1
|
+
import{t as e}from"../markdown-BiaU4FQg.mjs";export{e as renderMarkdown};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{t as e}from"./html-
|
|
1
|
+
import{t as e}from"./html-DzncQodH.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
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-
|
|
3
|
+
//# sourceMappingURL=markdown-BiaU4FQg.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-
|
|
1
|
+
{"version":3,"file":"markdown-BiaU4FQg.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 +1,2 @@
|
|
|
1
|
-
const e=require(`./html-
|
|
1
|
+
const e=require(`./html-BK9y-nf5.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
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}});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shell-shock/unified",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
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,7 @@
|
|
|
91
91
|
"files": ["dist/**/*"],
|
|
92
92
|
"dependencies": {
|
|
93
93
|
"@mdit/plugin-alert": "^0.23.2",
|
|
94
|
-
"@shell-shock/core": "^0.17.
|
|
94
|
+
"@shell-shock/core": "^0.17.1",
|
|
95
95
|
"@stryke/path": "^0.27.4",
|
|
96
96
|
"@stryke/string-format": "^0.17.9",
|
|
97
97
|
"@stryke/type-checks": "^0.6.1",
|
|
@@ -120,11 +120,5 @@
|
|
|
120
120
|
"@types/node": "^25.5.2"
|
|
121
121
|
},
|
|
122
122
|
"publishConfig": { "access": "public" },
|
|
123
|
-
"
|
|
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"
|
|
123
|
+
"gitHead": "0a96451134431381e1d79f85dceaaafd5cf94cfe"
|
|
130
124
|
}
|
package/dist/html-Di3_LwV3.mjs
DELETED
|
@@ -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}[0f`:`${n.eraseScreen}[3J[H`,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,KACb,CAGC,EAAM,OAAS,KACV,CACL,IACE,EAAM,KAAO,KACT,EAAM,MAAQ,KACZ,EAAO,KAAO,KACZ,GACA,EAAO,IACT,EAAM,KACR,EAAM,IACZ,MAAO,EAAO,MACd,KAAM,EAAO,KACd,CAGC,EAAM,MAAQ,KAQd,EAAO,KAAO,KAQX,CACL,IAAK,EAAM,IACX,MAAO,GAAG,EAAM,QAAQ,EAAO,QAC/B,KAAM,EAAO,KACd,CAXQ,CACL,IAAK,EAAM,IACX,MAAO,GAAG,EAAM,QAAQ,EAAO,MAAM,EAAO,QAC5C,KAAM,EAAO,KACd,CAZM,CACL,IAAK,EAAM,IACX,MAAO,GAAG,EAAM,QAAQ,EAAM,OAAO,EAAO,QAC5C,KAAM,EAAO,KACd,CC3FC,EAAiB,IAAI,QASd,GACX,EACA,EACA,IACqB,CAMrB,GAJI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Ac,EAA0B,CAGjE,MAAO,IAAI,EAFM,EAAM,EAAM,CAAE,uBAAwB,GAAM,CAAC,CAE/B,EAAW,EAAQ,CAAC,EAAI,CAAE,MAAO,GAAI,EAAE,MAAM"}
|
package/dist/html-y4ndTJv8.cjs
DELETED
|
@@ -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}[0f`:`${n.eraseScreen}[3J[H`,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}});
|