"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.transformMarkup = exports.parseAttributes = exports.stripTags = exports.createTagRegex = void 0; /** Create a tag matching regexp. */ function createTagRegex(tagName, flags) { return new RegExp(`/|<${tagName}(\\s[^]*?)?(?:>([^]*?)<\\/${tagName}>|\\/>)`, flags); } exports.createTagRegex = createTagRegex; /** Strip script and style tags from markup. */ function stripTags(markup) { return markup .replace(createTagRegex('style', 'gi'), '') .replace(createTagRegex('script', 'gi'), ''); } exports.stripTags = stripTags; /** Transform an attribute string into a key-value object */ function parseAttributes(attributesStr) { return attributesStr .split(/\s+/) .filter(Boolean) .reduce((acc, attr) => { const [name, value] = attr.split('='); // istanbul ignore next acc[name] = value ? value.replace(/['"]/g, '') : true; return acc; }, {}); } exports.parseAttributes = parseAttributes; async function transformMarkup({ content, filename }, transformer, options = {}) { let { markupTagName = 'template' } = options; markupTagName = markupTagName.toLocaleLowerCase(); const markupPattern = createTagRegex(markupTagName); const templateMatch = content.match(markupPattern); /** If no