`.
/** @type {Element} */
let result = {
type: 'element',
tagName: 'code',
properties,
children: [{
type: 'text',
value
}]
};
if (node.meta) {
result.data = {
meta: node.meta
};
}
state.patch(node, result);
result = state.applyData(node, result);
// Create ``.
result = {
type: 'element',
tagName: 'pre',
properties: {},
children: [result]
};
state.patch(node, result);
return result;
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/handlers/delete.js
/**
* @typedef {import('hast').Element} Element
* @typedef {import('mdast').Delete} Delete
* @typedef {import('../state.js').State} State
*/
/**
* Turn an mdast `delete` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Delete} node
* mdast node.
* @returns {Element}
* hast node.
*/
function strikethrough(state, node) {
/** @type {Element} */
const result = {
type: 'element',
tagName: 'del',
properties: {},
children: state.all(node)
};
state.patch(node, result);
return state.applyData(node, result);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/handlers/emphasis.js
/**
* @typedef {import('hast').Element} Element
* @typedef {import('mdast').Emphasis} Emphasis
* @typedef {import('../state.js').State} State
*/
/**
* Turn an mdast `emphasis` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Emphasis} node
* mdast node.
* @returns {Element}
* hast node.
*/
function emphasis(state, node) {
/** @type {Element} */
const result = {
type: 'element',
tagName: 'em',
properties: {},
children: state.all(node)
};
state.patch(node, result);
return state.applyData(node, result);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/handlers/footnote-reference.js
/**
* @typedef {import('mdast').FootnoteReference} FootnoteReference
* @typedef {import('hast').Element} Element
* @typedef {import('../state.js').State} State
*/
/**
* Turn an mdast `footnoteReference` node into hast.
*
* @param {State} state
* Info passed around.
* @param {FootnoteReference} node
* mdast node.
* @returns {Element}
* hast node.
*/
function footnoteReference(state, node) {
const id = String(node.identifier).toUpperCase();
const safeId = normalizeUri(id.toLowerCase());
const index = state.footnoteOrder.indexOf(id);
/** @type {number} */
let counter;
if (index === -1) {
state.footnoteOrder.push(id);
state.footnoteCounts[id] = 1;
counter = state.footnoteOrder.length;
} else {
state.footnoteCounts[id]++;
counter = index + 1;
}
const reuseCounter = state.footnoteCounts[id];
/** @type {Element} */
const link = {
type: 'element',
tagName: 'a',
properties: {
href: '#' + state.clobberPrefix + 'fn-' + safeId,
id: state.clobberPrefix + 'fnref-' + safeId + (reuseCounter > 1 ? '-' + reuseCounter : ''),
dataFootnoteRef: true,
ariaDescribedBy: ['footnote-label']
},
children: [{
type: 'text',
value: String(counter)
}]
};
state.patch(node, link);
/** @type {Element} */
const sup = {
type: 'element',
tagName: 'sup',
properties: {},
children: [link]
};
state.patch(node, sup);
return state.applyData(node, sup);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/handlers/footnote.js
/**
* @typedef {import('hast').Element} Element
* @typedef {import('mdast').Footnote} Footnote
* @typedef {import('../state.js').State} State
*/
// To do: when both:
// *
// *
// …are archived, remove this (also from mdast).
// These inline notes are not used in GFM.
/**
* Turn an mdast `footnote` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Footnote} node
* mdast node.
* @returns {Element}
* hast node.
*/
function footnote(state, node) {
const footnoteById = state.footnoteById;
let no = 1;
while (no in footnoteById) no++;
const identifier = String(no);
footnoteById[identifier] = {
type: 'footnoteDefinition',
identifier,
children: [{
type: 'paragraph',
children: node.children
}],
position: node.position
};
return footnoteReference(state, {
type: 'footnoteReference',
identifier,
position: node.position
});
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/handlers/heading.js
/**
* @typedef {import('hast').Element} Element
* @typedef {import('mdast').Heading} Heading
* @typedef {import('../state.js').State} State
*/
/**
* Turn an mdast `heading` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Heading} node
* mdast node.
* @returns {Element}
* hast node.
*/
function heading(state, node) {
/** @type {Element} */
const result = {
type: 'element',
tagName: 'h' + node.depth,
properties: {},
children: state.all(node)
};
state.patch(node, result);
return state.applyData(node, result);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/handlers/html.js
/**
* @typedef {import('hast').Element} Element
* @typedef {import('mdast').HTML} Html
* @typedef {import('../state.js').State} State
* @typedef {import('../../index.js').Raw} Raw
*/
/**
* Turn an mdast `html` node into hast (`raw` node in dangerous mode, otherwise
* nothing).
*
* @param {State} state
* Info passed around.
* @param {Html} node
* mdast node.
* @returns {Raw | Element | null}
* hast node.
*/
function html(state, node) {
if (state.dangerous) {
/** @type {Raw} */
const result = {
type: 'raw',
value: node.value
};
state.patch(node, result);
return state.applyData(node, result);
}
// To do: next major: return `undefined`.
return null;
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/revert.js
/**
* @typedef {import('hast').ElementContent} ElementContent
*
* @typedef {import('mdast').Content} Content
* @typedef {import('mdast').Reference} Reference
* @typedef {import('mdast').Root} Root
*
* @typedef {import('./state.js').State} State
*/
/**
* @typedef {Root | Content} Nodes
* @typedef {Extract} References
*/
// To do: next major: always return array.
/**
* Return the content of a reference without definition as plain text.
*
* @param {State} state
* Info passed around.
* @param {References} node
* Reference node (image, link).
* @returns {ElementContent | Array}
* hast content.
*/
function revert(state, node) {
const subtype = node.referenceType;
let suffix = ']';
if (subtype === 'collapsed') {
suffix += '[]';
} else if (subtype === 'full') {
suffix += '[' + (node.label || node.identifier) + ']';
}
if (node.type === 'imageReference') {
return {
type: 'text',
value: '![' + node.alt + suffix
};
}
const contents = state.all(node);
const head = contents[0];
if (head && head.type === 'text') {
head.value = '[' + head.value;
} else {
contents.unshift({
type: 'text',
value: '['
});
}
const tail = contents[contents.length - 1];
if (tail && tail.type === 'text') {
tail.value += suffix;
} else {
contents.push({
type: 'text',
value: suffix
});
}
return contents;
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/handlers/image-reference.js
/**
* @typedef {import('hast').ElementContent} ElementContent
* @typedef {import('hast').Element} Element
* @typedef {import('hast').Properties} Properties
* @typedef {import('mdast').ImageReference} ImageReference
* @typedef {import('../state.js').State} State
*/
/**
* Turn an mdast `imageReference` node into hast.
*
* @param {State} state
* Info passed around.
* @param {ImageReference} node
* mdast node.
* @returns {ElementContent | Array}
* hast node.
*/
function imageReference(state, node) {
const def = state.definition(node.identifier);
if (!def) {
return revert(state, node);
}
/** @type {Properties} */
const properties = {
src: normalizeUri(def.url || ''),
alt: node.alt
};
if (def.title !== null && def.title !== undefined) {
properties.title = def.title;
}
/** @type {Element} */
const result = {
type: 'element',
tagName: 'img',
properties,
children: []
};
state.patch(node, result);
return state.applyData(node, result);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/handlers/image.js
/**
* @typedef {import('hast').Element} Element
* @typedef {import('hast').Properties} Properties
* @typedef {import('mdast').Image} Image
* @typedef {import('../state.js').State} State
*/
/**
* Turn an mdast `image` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Image} node
* mdast node.
* @returns {Element}
* hast node.
*/
function image_image(state, node) {
/** @type {Properties} */
const properties = {
src: normalizeUri(node.url)
};
if (node.alt !== null && node.alt !== undefined) {
properties.alt = node.alt;
}
if (node.title !== null && node.title !== undefined) {
properties.title = node.title;
}
/** @type {Element} */
const result = {
type: 'element',
tagName: 'img',
properties,
children: []
};
state.patch(node, result);
return state.applyData(node, result);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/handlers/inline-code.js
/**
* @typedef {import('hast').Element} Element
* @typedef {import('hast').Text} Text
* @typedef {import('mdast').InlineCode} InlineCode
* @typedef {import('../state.js').State} State
*/
/**
* Turn an mdast `inlineCode` node into hast.
*
* @param {State} state
* Info passed around.
* @param {InlineCode} node
* mdast node.
* @returns {Element}
* hast node.
*/
function inlineCode(state, node) {
/** @type {Text} */
const text = {
type: 'text',
value: node.value.replace(/\r?\n|\r/g, ' ')
};
state.patch(node, text);
/** @type {Element} */
const result = {
type: 'element',
tagName: 'code',
properties: {},
children: [text]
};
state.patch(node, result);
return state.applyData(node, result);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/handlers/link-reference.js
/**
* @typedef {import('hast').Element} Element
* @typedef {import('hast').ElementContent} ElementContent
* @typedef {import('hast').Properties} Properties
* @typedef {import('mdast').LinkReference} LinkReference
* @typedef {import('../state.js').State} State
*/
/**
* Turn an mdast `linkReference` node into hast.
*
* @param {State} state
* Info passed around.
* @param {LinkReference} node
* mdast node.
* @returns {ElementContent | Array}
* hast node.
*/
function linkReference(state, node) {
const def = state.definition(node.identifier);
if (!def) {
return revert(state, node);
}
/** @type {Properties} */
const properties = {
href: normalizeUri(def.url || '')
};
if (def.title !== null && def.title !== undefined) {
properties.title = def.title;
}
/** @type {Element} */
const result = {
type: 'element',
tagName: 'a',
properties,
children: state.all(node)
};
state.patch(node, result);
return state.applyData(node, result);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/handlers/link.js
/**
* @typedef {import('hast').Element} Element
* @typedef {import('hast').Properties} Properties
* @typedef {import('mdast').Link} Link
* @typedef {import('../state.js').State} State
*/
/**
* Turn an mdast `link` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Link} node
* mdast node.
* @returns {Element}
* hast node.
*/
function link_link(state, node) {
/** @type {Properties} */
const properties = {
href: normalizeUri(node.url)
};
if (node.title !== null && node.title !== undefined) {
properties.title = node.title;
}
/** @type {Element} */
const result = {
type: 'element',
tagName: 'a',
properties,
children: state.all(node)
};
state.patch(node, result);
return state.applyData(node, result);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/handlers/list-item.js
/**
* @typedef {import('hast').Element} Element
* @typedef {import('hast').ElementContent} ElementContent
* @typedef {import('hast').Properties} Properties
* @typedef {import('mdast').Content} Content
* @typedef {import('mdast').ListItem} ListItem
* @typedef {import('mdast').Parent} Parent
* @typedef {import('mdast').Root} Root
* @typedef {import('../state.js').State} State
*/
/**
* @typedef {Root | Content} Nodes
* @typedef {Extract} Parents
*/
/**
* Turn an mdast `listItem` node into hast.
*
* @param {State} state
* Info passed around.
* @param {ListItem} node
* mdast node.
* @param {Parents | null | undefined} parent
* Parent of `node`.
* @returns {Element}
* hast node.
*/
function listItem(state, node, parent) {
const results = state.all(node);
const loose = parent ? listLoose(parent) : listItemLoose(node);
/** @type {Properties} */
const properties = {};
/** @type {Array} */
const children = [];
if (typeof node.checked === 'boolean') {
const head = results[0];
/** @type {Element} */
let paragraph;
if (head && head.type === 'element' && head.tagName === 'p') {
paragraph = head;
} else {
paragraph = {
type: 'element',
tagName: 'p',
properties: {},
children: []
};
results.unshift(paragraph);
}
if (paragraph.children.length > 0) {
paragraph.children.unshift({
type: 'text',
value: ' '
});
}
paragraph.children.unshift({
type: 'element',
tagName: 'input',
properties: {
type: 'checkbox',
checked: node.checked,
disabled: true
},
children: []
});
// According to github-markdown-css, this class hides bullet.
// See: .
properties.className = ['task-list-item'];
}
let index = -1;
while (++index < results.length) {
const child = results[index];
// Add eols before nodes, except if this is a loose, first paragraph.
if (loose || index !== 0 || child.type !== 'element' || child.tagName !== 'p') {
children.push({
type: 'text',
value: '\n'
});
}
if (child.type === 'element' && child.tagName === 'p' && !loose) {
children.push(...child.children);
} else {
children.push(child);
}
}
const tail = results[results.length - 1];
// Add a final eol.
if (tail && (loose || tail.type !== 'element' || tail.tagName !== 'p')) {
children.push({
type: 'text',
value: '\n'
});
}
/** @type {Element} */
const result = {
type: 'element',
tagName: 'li',
properties,
children
};
state.patch(node, result);
return state.applyData(node, result);
}
/**
* @param {Parents} node
* @return {Boolean}
*/
function listLoose(node) {
let loose = false;
if (node.type === 'list') {
loose = node.spread || false;
const children = node.children;
let index = -1;
while (!loose && ++index < children.length) {
loose = listItemLoose(children[index]);
}
}
return loose;
}
/**
* @param {ListItem} node
* @return {Boolean}
*/
function listItemLoose(node) {
const spread = node.spread;
return spread === undefined || spread === null ? node.children.length > 1 : spread;
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/handlers/list.js
/**
* @typedef {import('hast').Element} Element
* @typedef {import('hast').Properties} Properties
* @typedef {import('mdast').List} List
* @typedef {import('../state.js').State} State
*/
/**
* Turn an mdast `list` node into hast.
*
* @param {State} state
* Info passed around.
* @param {List} node
* mdast node.
* @returns {Element}
* hast node.
*/
function list_list(state, node) {
/** @type {Properties} */
const properties = {};
const results = state.all(node);
let index = -1;
if (typeof node.start === 'number' && node.start !== 1) {
properties.start = node.start;
}
// Like GitHub, add a class for custom styling.
while (++index < results.length) {
const child = results[index];
if (child.type === 'element' && child.tagName === 'li' && child.properties && Array.isArray(child.properties.className) && child.properties.className.includes('task-list-item')) {
properties.className = ['contains-task-list'];
break;
}
}
/** @type {Element} */
const result = {
type: 'element',
tagName: node.ordered ? 'ol' : 'ul',
properties,
children: state.wrap(results, true)
};
state.patch(node, result);
return state.applyData(node, result);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/handlers/paragraph.js
/**
* @typedef {import('hast').Element} Element
* @typedef {import('mdast').Paragraph} Paragraph
* @typedef {import('../state.js').State} State
*/
/**
* Turn an mdast `paragraph` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Paragraph} node
* mdast node.
* @returns {Element}
* hast node.
*/
function paragraph(state, node) {
/** @type {Element} */
const result = {
type: 'element',
tagName: 'p',
properties: {},
children: state.all(node)
};
state.patch(node, result);
return state.applyData(node, result);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/handlers/root.js
/**
* @typedef {import('hast').Root} HastRoot
* @typedef {import('hast').Element} HastElement
* @typedef {import('mdast').Root} MdastRoot
* @typedef {import('../state.js').State} State
*/
/**
* Turn an mdast `root` node into hast.
*
* @param {State} state
* Info passed around.
* @param {MdastRoot} node
* mdast node.
* @returns {HastRoot | HastElement}
* hast node.
*/
function root(state, node) {
/** @type {HastRoot} */
const result = {
type: 'root',
children: state.wrap(state.all(node))
};
state.patch(node, result);
return state.applyData(node, result);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/handlers/strong.js
/**
* @typedef {import('hast').Element} Element
* @typedef {import('mdast').Strong} Strong
* @typedef {import('../state.js').State} State
*/
/**
* Turn an mdast `strong` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Strong} node
* mdast node.
* @returns {Element}
* hast node.
*/
function strong(state, node) {
/** @type {Element} */
const result = {
type: 'element',
tagName: 'strong',
properties: {},
children: state.all(node)
};
state.patch(node, result);
return state.applyData(node, result);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/handlers/table.js
/**
* @typedef {import('hast').Element} Element
* @typedef {import('mdast').Table} Table
* @typedef {import('../state.js').State} State
*/
/**
* Turn an mdast `table` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Table} node
* mdast node.
* @returns {Element}
* hast node.
*/
function table(state, node) {
const rows = state.all(node);
const firstRow = rows.shift();
/** @type {Array} */
const tableContent = [];
if (firstRow) {
/** @type {Element} */
const head = {
type: 'element',
tagName: 'thead',
properties: {},
children: state.wrap([firstRow], true)
};
state.patch(node.children[0], head);
tableContent.push(head);
}
if (rows.length > 0) {
/** @type {Element} */
const body = {
type: 'element',
tagName: 'tbody',
properties: {},
children: state.wrap(rows, true)
};
const start = pointStart(node.children[1]);
const end = pointEnd(node.children[node.children.length - 1]);
if (start.line && end.line) body.position = {
start,
end
};
tableContent.push(body);
}
/** @type {Element} */
const result = {
type: 'element',
tagName: 'table',
properties: {},
children: state.wrap(tableContent, true)
};
state.patch(node, result);
return state.applyData(node, result);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/handlers/table-row.js
/**
* @typedef {import('hast').Properties} Properties
* @typedef {import('hast').Element} Element
* @typedef {import('hast').ElementContent} ElementContent
* @typedef {import('mdast').Content} Content
* @typedef {import('mdast').Parent} Parent
* @typedef {import('mdast').Root} Root
* @typedef {import('mdast').TableRow} TableRow
* @typedef {import('../state.js').State} State
*/
/**
* @typedef {Root | Content} Nodes
* @typedef {Extract} Parents
*/
/**
* Turn an mdast `tableRow` node into hast.
*
* @param {State} state
* Info passed around.
* @param {TableRow} node
* mdast node.
* @param {Parents | null | undefined} parent
* Parent of `node`.
* @returns {Element}
* hast node.
*/
function tableRow(state, node, parent) {
const siblings = parent ? parent.children : undefined;
// Generate a body row when without parent.
const rowIndex = siblings ? siblings.indexOf(node) : 1;
const tagName = rowIndex === 0 ? 'th' : 'td';
const align = parent && parent.type === 'table' ? parent.align : undefined;
const length = align ? align.length : node.children.length;
let cellIndex = -1;
/** @type {Array} */
const cells = [];
while (++cellIndex < length) {
// Note: can also be undefined.
const cell = node.children[cellIndex];
/** @type {Properties} */
const properties = {};
const alignValue = align ? align[cellIndex] : undefined;
if (alignValue) {
properties.align = alignValue;
}
/** @type {Element} */
let result = {
type: 'element',
tagName,
properties,
children: []
};
if (cell) {
result.children = state.all(cell);
state.patch(cell, result);
result = state.applyData(node, result);
}
cells.push(result);
}
/** @type {Element} */
const result = {
type: 'element',
tagName: 'tr',
properties: {},
children: state.wrap(cells, true)
};
state.patch(node, result);
return state.applyData(node, result);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/handlers/table-cell.js
/**
* @typedef {import('hast').Element} Element
* @typedef {import('mdast').TableCell} TableCell
* @typedef {import('../state.js').State} State
*/
/**
* Turn an mdast `tableCell` node into hast.
*
* @param {State} state
* Info passed around.
* @param {TableCell} node
* mdast node.
* @returns {Element}
* hast node.
*/
function tableCell(state, node) {
// Note: this function is normally not called: see `table-row` for how rows
// and their cells are compiled.
/** @type {Element} */
const result = {
type: 'element',
tagName: 'td',
// Assume body cell.
properties: {},
children: state.all(node)
};
state.patch(node, result);
return state.applyData(node, result);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/trim-lines@3.0.1/node_modules/trim-lines/index.js
const tab = 9; /* `\t` */
const space = 32; /* ` ` */
/**
* Remove initial and final spaces and tabs at the line breaks in `value`.
* Does not trim initial and final spaces and tabs of the value itself.
*
* @param {string} value
* Value to trim.
* @returns {string}
* Trimmed value.
*/
function trimLines(value) {
const source = String(value);
const search = /\r?\n|\r/g;
let match = search.exec(source);
let last = 0;
/** @type {Array} */
const lines = [];
while (match) {
lines.push(trimLine(source.slice(last, match.index), last > 0, true), match[0]);
last = match.index + match[0].length;
match = search.exec(source);
}
lines.push(trimLine(source.slice(last), last > 0, false));
return lines.join('');
}
/**
* @param {string} value
* Line to trim.
* @param {boolean} start
* Whether to trim the start of the line.
* @param {boolean} end
* Whether to trim the end of the line.
* @returns {string}
* Trimmed line.
*/
function trimLine(value, start, end) {
let startIndex = 0;
let endIndex = value.length;
if (start) {
let code = value.codePointAt(startIndex);
while (code === tab || code === space) {
startIndex++;
code = value.codePointAt(startIndex);
}
}
if (end) {
let code = value.codePointAt(endIndex - 1);
while (code === tab || code === space) {
endIndex--;
code = value.codePointAt(endIndex - 1);
}
}
return endIndex > startIndex ? value.slice(startIndex, endIndex) : '';
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/handlers/text.js
/**
* @typedef {import('hast').Element} HastElement
* @typedef {import('hast').Text} HastText
* @typedef {import('mdast').Text} MdastText
* @typedef {import('../state.js').State} State
*/
/**
* Turn an mdast `text` node into hast.
*
* @param {State} state
* Info passed around.
* @param {MdastText} node
* mdast node.
* @returns {HastText | HastElement}
* hast node.
*/
function handlers_text_text(state, node) {
/** @type {HastText} */
const result = {
type: 'text',
value: trimLines(String(node.value))
};
state.patch(node, result);
return state.applyData(node, result);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/handlers/thematic-break.js
/**
* @typedef {import('hast').Element} Element
* @typedef {import('mdast').ThematicBreak} ThematicBreak
* @typedef {import('../state.js').State} State
*/
/**
* Turn an mdast `thematicBreak` node into hast.
*
* @param {State} state
* Info passed around.
* @param {ThematicBreak} node
* mdast node.
* @returns {Element}
* hast node.
*/
function thematic_break_thematicBreak(state, node) {
/** @type {Element} */
const result = {
type: 'element',
tagName: 'hr',
properties: {},
children: []
};
state.patch(node, result);
return state.applyData(node, result);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/handlers/index.js
/**
* Default handlers for nodes.
*/
const handlers = {
blockquote: blockquote,
break: hardBreak,
code: code,
delete: strikethrough,
emphasis: emphasis,
footnoteReference: footnoteReference,
footnote: footnote,
heading: heading,
html: html,
imageReference: imageReference,
image: image_image,
inlineCode: inlineCode,
linkReference: linkReference,
link: link_link,
listItem: listItem,
list: list_list,
paragraph: paragraph,
root: root,
strong: strong,
table: table,
tableCell: tableCell,
tableRow: tableRow,
text: handlers_text_text,
thematicBreak: thematic_break_thematicBreak,
toml: ignore,
yaml: ignore,
definition: ignore,
footnoteDefinition: ignore
};
// Return nothing for nodes that are ignored.
function ignore() {
// To do: next major: return `undefined`.
return null;
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/state.js
/**
* @typedef {import('hast').Content} HastContent
* @typedef {import('hast').Element} HastElement
* @typedef {import('hast').ElementContent} HastElementContent
* @typedef {import('hast').Properties} HastProperties
* @typedef {import('hast').Root} HastRoot
* @typedef {import('hast').Text} HastText
*
* @typedef {import('mdast').Content} MdastContent
* @typedef {import('mdast').Definition} MdastDefinition
* @typedef {import('mdast').FootnoteDefinition} MdastFootnoteDefinition
* @typedef {import('mdast').Parent} MdastParent
* @typedef {import('mdast').Root} MdastRoot
*/
/**
* @typedef {HastRoot | HastContent} HastNodes
* @typedef {MdastRoot | MdastContent} MdastNodes
* @typedef {Extract} MdastParents
*
* @typedef EmbeddedHastFields
* hast fields.
* @property {string | null | undefined} [hName]
* Generate a specific element with this tag name instead.
* @property {HastProperties | null | undefined} [hProperties]
* Generate an element with these properties instead.
* @property {Array | null | undefined} [hChildren]
* Generate an element with this content instead.
*
* @typedef {Record & EmbeddedHastFields} MdastData
* mdast data with embedded hast fields.
*
* @typedef {MdastNodes & {data?: MdastData | null | undefined}} MdastNodeWithData
* mdast node with embedded hast data.
*
* @typedef PointLike
* Point-like value.
* @property {number | null | undefined} [line]
* Line.
* @property {number | null | undefined} [column]
* Column.
* @property {number | null | undefined} [offset]
* Offset.
*
* @typedef PositionLike
* Position-like value.
* @property {PointLike | null | undefined} [start]
* Point-like value.
* @property {PointLike | null | undefined} [end]
* Point-like value.
*
* @callback Handler
* Handle a node.
* @param {State} state
* Info passed around.
* @param {any} node
* mdast node to handle.
* @param {MdastParents | null | undefined} parent
* Parent of `node`.
* @returns {HastElementContent | Array | null | undefined}
* hast node.
*
* @callback HFunctionProps
* Signature of `state` for when props are passed.
* @param {MdastNodes | PositionLike | null | undefined} node
* mdast node or unist position.
* @param {string} tagName
* HTML tag name.
* @param {HastProperties} props
* Properties.
* @param {Array | null | undefined} [children]
* hast content.
* @returns {HastElement}
* Compiled element.
*
* @callback HFunctionNoProps
* Signature of `state` for when no props are passed.
* @param {MdastNodes | PositionLike | null | undefined} node
* mdast node or unist position.
* @param {string} tagName
* HTML tag name.
* @param {Array | null | undefined} [children]
* hast content.
* @returns {HastElement}
* Compiled element.
*
* @typedef HFields
* Info on `state`.
* @property {boolean} dangerous
* Whether HTML is allowed.
* @property {string} clobberPrefix
* Prefix to use to prevent DOM clobbering.
* @property {string} footnoteLabel
* Label to use to introduce the footnote section.
* @property {string} footnoteLabelTagName
* HTML used for the footnote label.
* @property {HastProperties} footnoteLabelProperties
* Properties on the HTML tag used for the footnote label.
* @property {string} footnoteBackLabel
* Label to use from backreferences back to their footnote call.
* @property {(identifier: string) => MdastDefinition | null} definition
* Definition cache.
* @property {Record} footnoteById
* Footnote definitions by their identifier.
* @property {Array} footnoteOrder
* Identifiers of order when footnote calls first appear in tree order.
* @property {Record} footnoteCounts
* Counts for how often the same footnote was called.
* @property {Handlers} handlers
* Applied handlers.
* @property {Handler} unknownHandler
* Handler for any none not in `passThrough` or otherwise handled.
* @property {(from: MdastNodes, node: HastNodes) => void} patch
* Copy a node’s positional info.
* @property {(from: MdastNodes, to: Type) => Type | HastElement} applyData
* Honor the `data` of `from`, and generate an element instead of `node`.
* @property {(node: MdastNodes, parent: MdastParents | null | undefined) => HastElementContent | Array | null | undefined} one
* Transform an mdast node to hast.
* @property {(node: MdastNodes) => Array} all
* Transform the children of an mdast parent to hast.
* @property {(nodes: Array, loose?: boolean | null | undefined) => Array} wrap
* Wrap `nodes` with line endings between each node, adds initial/final line endings when `loose`.
* @property {(left: MdastNodeWithData | PositionLike | null | undefined, right: HastElementContent) => HastElementContent} augment
* Like `state` but lower-level and usable on non-elements.
* Deprecated: use `patch` and `applyData`.
* @property {Array} passThrough
* List of node types to pass through untouched (except for their children).
*
* @typedef Options
* Configuration (optional).
* @property {boolean | null | undefined} [allowDangerousHtml=false]
* Whether to persist raw HTML in markdown in the hast tree.
* @property {string | null | undefined} [clobberPrefix='user-content-']
* Prefix to use before the `id` attribute on footnotes to prevent it from
* *clobbering*.
* @property {string | null | undefined} [footnoteBackLabel='Back to content']
* Label to use from backreferences back to their footnote call (affects
* screen readers).
* @property {string | null | undefined} [footnoteLabel='Footnotes']
* Label to use for the footnotes section (affects screen readers).
* @property {HastProperties | null | undefined} [footnoteLabelProperties={className: ['sr-only']}]
* Properties to use on the footnote label (note that `id: 'footnote-label'`
* is always added as footnote calls use it with `aria-describedby` to
* provide an accessible label).
* @property {string | null | undefined} [footnoteLabelTagName='h2']
* Tag name to use for the footnote label.
* @property {Handlers | null | undefined} [handlers]
* Extra handlers for nodes.
* @property {Array | null | undefined} [passThrough]
* List of custom mdast node types to pass through (keep) in hast (note that
* the node itself is passed, but eventual children are transformed).
* @property {Handler | null | undefined} [unknownHandler]
* Handler for all unknown nodes.
*
* @typedef {Record} Handlers
* Handle nodes.
*
* @typedef {HFunctionProps & HFunctionNoProps & HFields} State
* Info passed around.
*/
const state_own = {}.hasOwnProperty;
/**
* Create `state` from an mdast tree.
*
* @param {MdastNodes} tree
* mdast node to transform.
* @param {Options | null | undefined} [options]
* Configuration.
* @returns {State}
* `state` function.
*/
function createState(tree, options) {
const settings = options || {};
const dangerous = settings.allowDangerousHtml || false;
/** @type {Record} */
const footnoteById = {};
// To do: next major: add `options` to state, remove:
// `dangerous`, `clobberPrefix`, `footnoteLabel`, `footnoteLabelTagName`,
// `footnoteLabelProperties`, `footnoteBackLabel`, `passThrough`,
// `unknownHandler`.
// To do: next major: move to `state.options.allowDangerousHtml`.
state.dangerous = dangerous;
// To do: next major: move to `state.options`.
state.clobberPrefix = settings.clobberPrefix === undefined || settings.clobberPrefix === null ? 'user-content-' : settings.clobberPrefix;
// To do: next major: move to `state.options`.
state.footnoteLabel = settings.footnoteLabel || 'Footnotes';
// To do: next major: move to `state.options`.
state.footnoteLabelTagName = settings.footnoteLabelTagName || 'h2';
// To do: next major: move to `state.options`.
state.footnoteLabelProperties = settings.footnoteLabelProperties || {
className: ['sr-only']
};
// To do: next major: move to `state.options`.
state.footnoteBackLabel = settings.footnoteBackLabel || 'Back to content';
// To do: next major: move to `state.options`.
state.unknownHandler = settings.unknownHandler;
// To do: next major: move to `state.options`.
state.passThrough = settings.passThrough;
state.handlers = {
...handlers,
...settings.handlers
};
// To do: next major: replace utility with `definitionById` object, so we
// only walk once (as we need footnotes too).
state.definition = definitions(tree);
state.footnoteById = footnoteById;
/** @type {Array} */
state.footnoteOrder = [];
/** @type {Record} */
state.footnoteCounts = {};
state.patch = patch;
state.applyData = applyData;
state.one = oneBound;
state.all = allBound;
state.wrap = state_wrap;
// To do: next major: remove `augment`.
state.augment = augment;
visit(tree, 'footnoteDefinition', definition => {
const id = String(definition.identifier).toUpperCase();
// Mimick CM behavior of link definitions.
// See: .
if (!state_own.call(footnoteById, id)) {
footnoteById[id] = definition;
}
});
// @ts-expect-error Hush, it’s fine!
return state;
/**
* Finalise the created `right`, a hast node, from `left`, an mdast node.
*
* @param {MdastNodeWithData | PositionLike | null | undefined} left
* @param {HastElementContent} right
* @returns {HastElementContent}
*/
/* c8 ignore start */
// To do: next major: remove.
function augment(left, right) {
// Handle `data.hName`, `data.hProperties, `data.hChildren`.
if (left && 'data' in left && left.data) {
/** @type {MdastData} */
const data = left.data;
if (data.hName) {
if (right.type !== 'element') {
right = {
type: 'element',
tagName: '',
properties: {},
children: []
};
}
right.tagName = data.hName;
}
if (right.type === 'element' && data.hProperties) {
right.properties = {
...right.properties,
...data.hProperties
};
}
if ('children' in right && right.children && data.hChildren) {
right.children = data.hChildren;
}
}
if (left) {
const ctx = 'type' in left ? left : {
position: left
};
if (!generated(ctx)) {
// @ts-expect-error: fine.
right.position = {
start: pointStart(ctx),
end: pointEnd(ctx)
};
}
}
return right;
}
/* c8 ignore stop */
/**
* Create an element for `node`.
*
* @type {HFunctionProps}
*/
/* c8 ignore start */
// To do: next major: remove.
function state(node, tagName, props, children) {
if (Array.isArray(props)) {
children = props;
props = {};
}
// @ts-expect-error augmenting an element yields an element.
return augment(node, {
type: 'element',
tagName,
properties: props || {},
children: children || []
});
}
/* c8 ignore stop */
/**
* Transform an mdast node into a hast node.
*
* @param {MdastNodes} node
* mdast node.
* @param {MdastParents | null | undefined} [parent]
* Parent of `node`.
* @returns {HastElementContent | Array | null | undefined}
* Resulting hast node.
*/
function oneBound(node, parent) {
// @ts-expect-error: that’s a state :)
return state_one(state, node, parent);
}
/**
* Transform the children of an mdast node into hast nodes.
*
* @param {MdastNodes} parent
* mdast node to compile
* @returns {Array}
* Resulting hast nodes.
*/
function allBound(parent) {
// @ts-expect-error: that’s a state :)
return state_all(state, parent);
}
}
/**
* Copy a node’s positional info.
*
* @param {MdastNodes} from
* mdast node to copy from.
* @param {HastNodes} to
* hast node to copy into.
* @returns {void}
* Nothing.
*/
function patch(from, to) {
if (from.position) to.position = lib_position(from);
}
/**
* Honor the `data` of `from` and maybe generate an element instead of `to`.
*
* @template {HastNodes} Type
* Node type.
* @param {MdastNodes} from
* mdast node to use data from.
* @param {Type} to
* hast node to change.
* @returns {Type | HastElement}
* Nothing.
*/
function applyData(from, to) {
/** @type {Type | HastElement} */
let result = to;
// Handle `data.hName`, `data.hProperties, `data.hChildren`.
if (from && from.data) {
const hName = from.data.hName;
const hChildren = from.data.hChildren;
const hProperties = from.data.hProperties;
if (typeof hName === 'string') {
// Transforming the node resulted in an element with a different name
// than wanted:
if (result.type === 'element') {
result.tagName = hName;
}
// Transforming the node resulted in a non-element, which happens for
// raw, text, and root nodes (unless custom handlers are passed).
// The intent is likely to keep the content around (otherwise: pass
// `hChildren`).
else {
result = {
type: 'element',
tagName: hName,
properties: {},
children: []
};
// To do: next major: take the children from the `root`, or inject the
// raw/text/comment or so into the element?
// if ('children' in node) {
// // @ts-expect-error: assume `children` are allowed in elements.
// result.children = node.children
// } else {
// // @ts-expect-error: assume `node` is allowed in elements.
// result.children.push(node)
// }
}
}
if (result.type === 'element' && hProperties) {
result.properties = {
...result.properties,
...hProperties
};
}
if ('children' in result && result.children && hChildren !== null && hChildren !== undefined) {
// @ts-expect-error: assume valid children are defined.
result.children = hChildren;
}
}
return result;
}
/**
* Transform an mdast node into a hast node.
*
* @param {State} state
* Info passed around.
* @param {MdastNodes} node
* mdast node.
* @param {MdastParents | null | undefined} [parent]
* Parent of `node`.
* @returns {HastElementContent | Array | null | undefined}
* Resulting hast node.
*/
// To do: next major: do not expose, keep bound.
function state_one(state, node, parent) {
const type = node && node.type;
// Fail on non-nodes.
if (!type) {
throw new Error('Expected node, got `' + node + '`');
}
if (state_own.call(state.handlers, type)) {
return state.handlers[type](state, node, parent);
}
if (state.passThrough && state.passThrough.includes(type)) {
// To do: next major: deep clone.
// @ts-expect-error: types of passed through nodes are expected to be added manually.
return 'children' in node ? {
...node,
children: state_all(state, node)
} : node;
}
if (state.unknownHandler) {
return state.unknownHandler(state, node, parent);
}
return defaultUnknownHandler(state, node);
}
/**
* Transform the children of an mdast node into hast nodes.
*
* @param {State} state
* Info passed around.
* @param {MdastNodes} parent
* mdast node to compile
* @returns {Array}
* Resulting hast nodes.
*/
// To do: next major: do not expose, keep bound.
function state_all(state, parent) {
/** @type {Array} */
const values = [];
if ('children' in parent) {
const nodes = parent.children;
let index = -1;
while (++index < nodes.length) {
const result = state_one(state, nodes[index], parent);
// To do: see if we van clean this? Can we merge texts?
if (result) {
if (index && nodes[index - 1].type === 'break') {
if (!Array.isArray(result) && result.type === 'text') {
result.value = result.value.replace(/^\s+/, '');
}
if (!Array.isArray(result) && result.type === 'element') {
const head = result.children[0];
if (head && head.type === 'text') {
head.value = head.value.replace(/^\s+/, '');
}
}
}
if (Array.isArray(result)) {
values.push(...result);
} else {
values.push(result);
}
}
}
}
return values;
}
/**
* Transform an unknown node.
*
* @param {State} state
* Info passed around.
* @param {MdastNodes} node
* Unknown mdast node.
* @returns {HastText | HastElement}
* Resulting hast node.
*/
function defaultUnknownHandler(state, node) {
const data = node.data || {};
/** @type {HastText | HastElement} */
const result = 'value' in node && !(state_own.call(data, 'hProperties') || state_own.call(data, 'hChildren')) ? {
type: 'text',
value: node.value
} : {
type: 'element',
tagName: 'div',
properties: {},
children: state_all(state, node)
};
state.patch(node, result);
return state.applyData(node, result);
}
/**
* Wrap `nodes` with line endings between each node.
*
* @template {HastContent} Type
* Node type.
* @param {Array} nodes
* List of nodes to wrap.
* @param {boolean | null | undefined} [loose=false]
* Whether to add line endings at start and end.
* @returns {Array}
* Wrapped nodes.
*/
function state_wrap(nodes, loose) {
/** @type {Array} */
const result = [];
let index = -1;
if (loose) {
result.push({
type: 'text',
value: '\n'
});
}
while (++index < nodes.length) {
if (index) result.push({
type: 'text',
value: '\n'
});
result.push(nodes[index]);
}
if (loose && nodes.length > 0) {
result.push({
type: 'text',
value: '\n'
});
}
return result;
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/mdast-util-to-hast@12.3.0/node_modules/mdast-util-to-hast/lib/index.js
/**
* @typedef {import('hast').Content} HastContent
* @typedef {import('hast').Root} HastRoot
*
* @typedef {import('mdast').Content} MdastContent
* @typedef {import('mdast').Root} MdastRoot
*
* @typedef {import('./state.js').Options} Options
*/
/**
* @typedef {HastRoot | HastContent} HastNodes
* @typedef {MdastRoot | MdastContent} MdastNodes
*/
/**
* Transform mdast to hast.
*
* ##### Notes
*
* ###### HTML
*
* Raw HTML is available in mdast as `html` nodes and can be embedded in hast
* as semistandard `raw` nodes.
* Most utilities ignore `raw` nodes but two notable ones don’t:
*
* * `hast-util-to-html` also has an option `allowDangerousHtml` which will
* output the raw HTML.
* This is typically discouraged as noted by the option name but is useful
* if you completely trust authors
* * `hast-util-raw` can handle the raw embedded HTML strings by parsing them
* into standard hast nodes (`element`, `text`, etc).
* This is a heavy task as it needs a full HTML parser, but it is the only
* way to support untrusted content
*
* ###### Footnotes
*
* Many options supported here relate to footnotes.
* Footnotes are not specified by CommonMark, which we follow by default.
* They are supported by GitHub, so footnotes can be enabled in markdown with
* `mdast-util-gfm`.
*
* The options `footnoteBackLabel` and `footnoteLabel` define natural language
* that explains footnotes, which is hidden for sighted users but shown to
* assistive technology.
* When your page is not in English, you must define translated values.
*
* Back references use ARIA attributes, but the section label itself uses a
* heading that is hidden with an `sr-only` class.
* To show it to sighted users, define different attributes in
* `footnoteLabelProperties`.
*
* ###### Clobbering
*
* Footnotes introduces a problem, as it links footnote calls to footnote
* definitions on the page through `id` attributes generated from user content,
* which results in DOM clobbering.
*
* DOM clobbering is this:
*
* ```html
*
*
* ```
*
* Elements by their ID are made available by browsers on the `window` object,
* which is a security risk.
* Using a prefix solves this problem.
*
* More information on how to handle clobbering and the prefix is explained in
* Example: headings (DOM clobbering) in `rehype-sanitize`.
*
* ###### Unknown nodes
*
* Unknown nodes are nodes with a type that isn’t in `handlers` or `passThrough`.
* The default behavior for unknown nodes is:
*
* * when the node has a `value` (and doesn’t have `data.hName`,
* `data.hProperties`, or `data.hChildren`, see later), create a hast `text`
* node
* * otherwise, create a `` element (which could be changed with
* `data.hName`), with its children mapped from mdast to hast as well
*
* This behavior can be changed by passing an `unknownHandler`.
*
* @param {MdastNodes} tree
* mdast tree.
* @param {Options | null | undefined} [options]
* Configuration.
* @returns {HastNodes | null | undefined}
* hast tree.
*/
// To do: next major: always return a single `root`.
function toHast(tree, options) {
const state = createState(tree, options);
const node = state.one(tree, null);
const foot = footer(state);
if (foot) {
// @ts-expect-error If there’s a footer, there were definitions, meaning block
// content.
// So assume `node` is a parent node.
node.children.push({
type: 'text',
value: '\n'
}, foot);
}
// To do: next major: always return root?
return Array.isArray(node) ? {
type: 'root',
children: node
} : node;
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/remark-rehype@10.1.0/node_modules/remark-rehype/lib/index.js
/**
* @typedef {import('hast').Root} HastRoot
* @typedef {import('mdast').Root} MdastRoot
* @typedef {import('mdast-util-to-hast').Options} Options
* @typedef {import('unified').Processor
} Processor
*
* @typedef {import('mdast-util-to-hast')} DoNotTouchAsThisImportIncludesRawInTree
*/
// Note: the `` overload doesn’t seem to work :'(
/**
* Plugin that turns markdown into HTML to support rehype.
*
* * If a destination processor is given, that processor runs with a new HTML
* (hast) tree (bridge-mode).
* As the given processor runs with a hast tree, and rehype plugins support
* hast, that means rehype plugins can be used with the given processor.
* The hast tree is discarded in the end.
* It’s highly unlikely that you want to do this.
* * The common case is to not pass a destination processor, in which case the
* current processor continues running with a new HTML (hast) tree
* (mutate-mode).
* As the current processor continues with a hast tree, and rehype plugins
* support hast, that means rehype plugins can be used after
* `remark-rehype`.
* It’s likely that this is what you want to do.
*
* @param destination
* Optional unified processor.
* @param options
* Options passed to `mdast-util-to-hast`.
*/
const remarkRehype = /** @type {(import('unified').Plugin<[Processor, Options?]|[null|undefined, Options?]|[Options]|[], MdastRoot>)} */
function (destination, options) {
return destination && 'run' in destination ? bridge(destination, options) : mutate(destination || options);
};
/* harmony default export */ const lib = (remarkRehype);
/**
* Bridge-mode.
* Runs the destination with the new hast tree.
*
* @type {import('unified').Plugin<[Processor, Options?], MdastRoot>}
*/
function bridge(destination, options) {
return (node, file, next) => {
destination.run(toHast(node, options), file, error => {
next(error);
});
};
}
/**
* Mutate-mode.
* Further plugins run on the hast tree.
*
* @type {import('unified').Plugin<[Options?]|void[], MdastRoot, HastRoot>}
*/
function mutate(options) {
// @ts-expect-error: assume a corresponding node is returned by `toHast`.
return node => toHast(node, options);
}
// EXTERNAL MODULE: ./node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js
var prop_types = __webpack_require__(7897);
;// CONCATENATED MODULE: ./node_modules/.pnpm/property-information@6.3.0/node_modules/property-information/lib/util/schema.js
/**
* @typedef {import('./info.js').Info} Info
* @typedef {Record} Properties
* @typedef {Record} Normal
*/
class Schema {
/**
* @constructor
* @param {Properties} property
* @param {Normal} normal
* @param {string} [space]
*/
constructor(property, normal, space) {
this.property = property;
this.normal = normal;
if (space) {
this.space = space;
}
}
}
/** @type {Properties} */
Schema.prototype.property = {};
/** @type {Normal} */
Schema.prototype.normal = {};
/** @type {string|null} */
Schema.prototype.space = null;
;// CONCATENATED MODULE: ./node_modules/.pnpm/property-information@6.3.0/node_modules/property-information/lib/util/merge.js
/**
* @typedef {import('./schema.js').Properties} Properties
* @typedef {import('./schema.js').Normal} Normal
*/
/**
* @param {Schema[]} definitions
* @param {string} [space]
* @returns {Schema}
*/
function merge(definitions, space) {
/** @type {Properties} */
const property = {};
/** @type {Normal} */
const normal = {};
let index = -1;
while (++index < definitions.length) {
Object.assign(property, definitions[index].property);
Object.assign(normal, definitions[index].normal);
}
return new Schema(property, normal, space);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/property-information@6.3.0/node_modules/property-information/lib/normalize.js
/**
* @param {string} value
* @returns {string}
*/
function normalize_normalize(value) {
return value.toLowerCase();
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/property-information@6.3.0/node_modules/property-information/lib/util/info.js
class Info {
/**
* @constructor
* @param {string} property
* @param {string} attribute
*/
constructor(property, attribute) {
/** @type {string} */
this.property = property;
/** @type {string} */
this.attribute = attribute;
}
}
/** @type {string|null} */
Info.prototype.space = null;
Info.prototype.boolean = false;
Info.prototype.booleanish = false;
Info.prototype.overloadedBoolean = false;
Info.prototype.number = false;
Info.prototype.commaSeparated = false;
Info.prototype.spaceSeparated = false;
Info.prototype.commaOrSpaceSeparated = false;
Info.prototype.mustUseProperty = false;
Info.prototype.defined = false;
;// CONCATENATED MODULE: ./node_modules/.pnpm/property-information@6.3.0/node_modules/property-information/lib/util/types.js
let powers = 0;
const types_boolean = increment();
const booleanish = increment();
const overloadedBoolean = increment();
const number = increment();
const spaceSeparated = increment();
const commaSeparated = increment();
const commaOrSpaceSeparated = increment();
function increment() {
return 2 ** ++powers;
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/property-information@6.3.0/node_modules/property-information/lib/util/defined-info.js
/** @type {Array} */
// @ts-expect-error: hush.
const checks = Object.keys(types_namespaceObject);
class DefinedInfo extends Info {
/**
* @constructor
* @param {string} property
* @param {string} attribute
* @param {number|null} [mask]
* @param {string} [space]
*/
constructor(property, attribute, mask, space) {
let index = -1;
super(property, attribute);
mark(this, 'space', space);
if (typeof mask === 'number') {
while (++index < checks.length) {
const check = checks[index];
mark(this, checks[index], (mask & types_namespaceObject[check]) === types_namespaceObject[check]);
}
}
}
}
DefinedInfo.prototype.defined = true;
/**
* @param {DefinedInfo} values
* @param {string} key
* @param {unknown} value
*/
function mark(values, key, value) {
if (value) {
// @ts-expect-error: assume `value` matches the expected value of `key`.
values[key] = value;
}
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/property-information@6.3.0/node_modules/property-information/lib/util/create.js
/**
* @typedef {import('./schema.js').Properties} Properties
* @typedef {import('./schema.js').Normal} Normal
*
* @typedef {Record} Attributes
*
* @typedef {Object} Definition
* @property {Record} properties
* @property {(attributes: Attributes, property: string) => string} transform
* @property {string} [space]
* @property {Attributes} [attributes]
* @property {Array} [mustUseProperty]
*/
const create_own = {}.hasOwnProperty;
/**
* @param {Definition} definition
* @returns {Schema}
*/
function create(definition) {
/** @type {Properties} */
const property = {};
/** @type {Normal} */
const normal = {};
/** @type {string} */
let prop;
for (prop in definition.properties) {
if (create_own.call(definition.properties, prop)) {
const value = definition.properties[prop];
const info = new DefinedInfo(prop, definition.transform(definition.attributes || {}, prop), value, definition.space);
if (definition.mustUseProperty && definition.mustUseProperty.includes(prop)) {
info.mustUseProperty = true;
}
property[prop] = info;
normal[normalize_normalize(prop)] = prop;
normal[normalize_normalize(info.attribute)] = prop;
}
}
return new Schema(property, normal, definition.space);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/property-information@6.3.0/node_modules/property-information/lib/xlink.js
const xlink = create({
space: 'xlink',
transform(_, prop) {
return 'xlink:' + prop.slice(5).toLowerCase();
},
properties: {
xLinkActuate: null,
xLinkArcRole: null,
xLinkHref: null,
xLinkRole: null,
xLinkShow: null,
xLinkTitle: null,
xLinkType: null
}
});
;// CONCATENATED MODULE: ./node_modules/.pnpm/property-information@6.3.0/node_modules/property-information/lib/xml.js
const xml = create({
space: 'xml',
transform(_, prop) {
return 'xml:' + prop.slice(3).toLowerCase();
},
properties: {
xmlLang: null,
xmlBase: null,
xmlSpace: null
}
});
;// CONCATENATED MODULE: ./node_modules/.pnpm/property-information@6.3.0/node_modules/property-information/lib/util/case-sensitive-transform.js
/**
* @param {Record} attributes
* @param {string} attribute
* @returns {string}
*/
function caseSensitiveTransform(attributes, attribute) {
return attribute in attributes ? attributes[attribute] : attribute;
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/property-information@6.3.0/node_modules/property-information/lib/util/case-insensitive-transform.js
/**
* @param {Record} attributes
* @param {string} property
* @returns {string}
*/
function caseInsensitiveTransform(attributes, property) {
return caseSensitiveTransform(attributes, property.toLowerCase());
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/property-information@6.3.0/node_modules/property-information/lib/xmlns.js
const xmlns = create({
space: 'xmlns',
attributes: {
xmlnsxlink: 'xmlns:xlink'
},
transform: caseInsensitiveTransform,
properties: {
xmlns: null,
xmlnsXLink: null
}
});
;// CONCATENATED MODULE: ./node_modules/.pnpm/property-information@6.3.0/node_modules/property-information/lib/aria.js
const aria = create({
transform(_, prop) {
return prop === 'role' ? prop : 'aria-' + prop.slice(4).toLowerCase();
},
properties: {
ariaActiveDescendant: null,
ariaAtomic: booleanish,
ariaAutoComplete: null,
ariaBusy: booleanish,
ariaChecked: booleanish,
ariaColCount: number,
ariaColIndex: number,
ariaColSpan: number,
ariaControls: spaceSeparated,
ariaCurrent: null,
ariaDescribedBy: spaceSeparated,
ariaDetails: null,
ariaDisabled: booleanish,
ariaDropEffect: spaceSeparated,
ariaErrorMessage: null,
ariaExpanded: booleanish,
ariaFlowTo: spaceSeparated,
ariaGrabbed: booleanish,
ariaHasPopup: null,
ariaHidden: booleanish,
ariaInvalid: null,
ariaKeyShortcuts: null,
ariaLabel: null,
ariaLabelledBy: spaceSeparated,
ariaLevel: number,
ariaLive: null,
ariaModal: booleanish,
ariaMultiLine: booleanish,
ariaMultiSelectable: booleanish,
ariaOrientation: null,
ariaOwns: spaceSeparated,
ariaPlaceholder: null,
ariaPosInSet: number,
ariaPressed: booleanish,
ariaReadOnly: booleanish,
ariaRelevant: null,
ariaRequired: booleanish,
ariaRoleDescription: spaceSeparated,
ariaRowCount: number,
ariaRowIndex: number,
ariaRowSpan: number,
ariaSelected: booleanish,
ariaSetSize: number,
ariaSort: null,
ariaValueMax: number,
ariaValueMin: number,
ariaValueNow: number,
ariaValueText: null,
role: null
}
});
;// CONCATENATED MODULE: ./node_modules/.pnpm/property-information@6.3.0/node_modules/property-information/lib/html.js
const html_html = create({
space: 'html',
attributes: {
acceptcharset: 'accept-charset',
classname: 'class',
htmlfor: 'for',
httpequiv: 'http-equiv'
},
transform: caseInsensitiveTransform,
mustUseProperty: ['checked', 'multiple', 'muted', 'selected'],
properties: {
// Standard Properties.
abbr: null,
accept: commaSeparated,
acceptCharset: spaceSeparated,
accessKey: spaceSeparated,
action: null,
allow: null,
allowFullScreen: types_boolean,
allowPaymentRequest: types_boolean,
allowUserMedia: types_boolean,
alt: null,
as: null,
async: types_boolean,
autoCapitalize: null,
autoComplete: spaceSeparated,
autoFocus: types_boolean,
autoPlay: types_boolean,
blocking: spaceSeparated,
capture: types_boolean,
charSet: null,
checked: types_boolean,
cite: null,
className: spaceSeparated,
cols: number,
colSpan: null,
content: null,
contentEditable: booleanish,
controls: types_boolean,
controlsList: spaceSeparated,
coords: number | commaSeparated,
crossOrigin: null,
data: null,
dateTime: null,
decoding: null,
default: types_boolean,
defer: types_boolean,
dir: null,
dirName: null,
disabled: types_boolean,
download: overloadedBoolean,
draggable: booleanish,
encType: null,
enterKeyHint: null,
fetchPriority: null,
form: null,
formAction: null,
formEncType: null,
formMethod: null,
formNoValidate: types_boolean,
formTarget: null,
headers: spaceSeparated,
height: number,
hidden: types_boolean,
high: number,
href: null,
hrefLang: null,
htmlFor: spaceSeparated,
httpEquiv: spaceSeparated,
id: null,
imageSizes: null,
imageSrcSet: null,
inert: types_boolean,
inputMode: null,
integrity: null,
is: null,
isMap: types_boolean,
itemId: null,
itemProp: spaceSeparated,
itemRef: spaceSeparated,
itemScope: types_boolean,
itemType: spaceSeparated,
kind: null,
label: null,
lang: null,
language: null,
list: null,
loading: null,
loop: types_boolean,
low: number,
manifest: null,
max: null,
maxLength: number,
media: null,
method: null,
min: null,
minLength: number,
multiple: types_boolean,
muted: types_boolean,
name: null,
nonce: null,
noModule: types_boolean,
noValidate: types_boolean,
onAbort: null,
onAfterPrint: null,
onAuxClick: null,
onBeforeMatch: null,
onBeforePrint: null,
onBeforeUnload: null,
onBlur: null,
onCancel: null,
onCanPlay: null,
onCanPlayThrough: null,
onChange: null,
onClick: null,
onClose: null,
onContextLost: null,
onContextMenu: null,
onContextRestored: null,
onCopy: null,
onCueChange: null,
onCut: null,
onDblClick: null,
onDrag: null,
onDragEnd: null,
onDragEnter: null,
onDragExit: null,
onDragLeave: null,
onDragOver: null,
onDragStart: null,
onDrop: null,
onDurationChange: null,
onEmptied: null,
onEnded: null,
onError: null,
onFocus: null,
onFormData: null,
onHashChange: null,
onInput: null,
onInvalid: null,
onKeyDown: null,
onKeyPress: null,
onKeyUp: null,
onLanguageChange: null,
onLoad: null,
onLoadedData: null,
onLoadedMetadata: null,
onLoadEnd: null,
onLoadStart: null,
onMessage: null,
onMessageError: null,
onMouseDown: null,
onMouseEnter: null,
onMouseLeave: null,
onMouseMove: null,
onMouseOut: null,
onMouseOver: null,
onMouseUp: null,
onOffline: null,
onOnline: null,
onPageHide: null,
onPageShow: null,
onPaste: null,
onPause: null,
onPlay: null,
onPlaying: null,
onPopState: null,
onProgress: null,
onRateChange: null,
onRejectionHandled: null,
onReset: null,
onResize: null,
onScroll: null,
onScrollEnd: null,
onSecurityPolicyViolation: null,
onSeeked: null,
onSeeking: null,
onSelect: null,
onSlotChange: null,
onStalled: null,
onStorage: null,
onSubmit: null,
onSuspend: null,
onTimeUpdate: null,
onToggle: null,
onUnhandledRejection: null,
onUnload: null,
onVolumeChange: null,
onWaiting: null,
onWheel: null,
open: types_boolean,
optimum: number,
pattern: null,
ping: spaceSeparated,
placeholder: null,
playsInline: types_boolean,
popover: null,
popoverTarget: null,
popoverTargetAction: null,
poster: null,
preload: null,
readOnly: types_boolean,
referrerPolicy: null,
rel: spaceSeparated,
required: types_boolean,
reversed: types_boolean,
rows: number,
rowSpan: number,
sandbox: spaceSeparated,
scope: null,
scoped: types_boolean,
seamless: types_boolean,
selected: types_boolean,
shape: null,
size: number,
sizes: null,
slot: null,
span: number,
spellCheck: booleanish,
src: null,
srcDoc: null,
srcLang: null,
srcSet: null,
start: number,
step: null,
style: null,
tabIndex: number,
target: null,
title: null,
translate: null,
type: null,
typeMustMatch: types_boolean,
useMap: null,
value: booleanish,
width: number,
wrap: null,
// Legacy.
// See: https://html.spec.whatwg.org/#other-elements,-attributes-and-apis
align: null,
// Several. Use CSS `text-align` instead,
aLink: null,
// ``. Use CSS `a:active {color}` instead
archive: spaceSeparated,
// `