{"version":3,"file":"html-dom-parser-Dg4oUz60.js","sources":["../../node_modules/html-dom-parser/lib/client/domparser.js","../../node_modules/html-dom-parser/lib/client/constants.js","../../node_modules/html-dom-parser/lib/client/utilities.js","../../node_modules/html-dom-parser/lib/client/html-to-dom.js"],"sourcesContent":["// constants\nvar HTML = 'html';\nvar HEAD = 'head';\nvar BODY = 'body';\nvar FIRST_TAG_REGEX = /<([a-zA-Z]+[0-9]?)/; // e.g.,

\n// match-all-characters in case of newlines (DOTALL)\nvar HEAD_TAG_REGEX = //i;\nvar BODY_TAG_REGEX = //i;\n\n// falls back to `parseFromString` if `createHTMLDocument` cannot be used\nvar parseFromDocument = function () {\n throw new Error(\n 'This browser does not support `document.implementation.createHTMLDocument`'\n );\n};\n\nvar parseFromString = function () {\n throw new Error(\n 'This browser does not support `DOMParser.prototype.parseFromString`'\n );\n};\n\nvar DOMParser = typeof window === 'object' && window.DOMParser;\n\n/**\n * DOMParser (performance: slow).\n *\n * @see https://developer.mozilla.org/docs/Web/API/DOMParser#Parsing_an_SVG_or_HTML_document\n */\nif (typeof DOMParser === 'function') {\n var domParser = new DOMParser();\n var mimeType = 'text/html';\n\n /**\n * Creates an HTML document using `DOMParser.parseFromString`.\n *\n * @param {string} html - The HTML string.\n * @param {string} [tagName] - The element to render the HTML (with 'body' as fallback).\n * @return {HTMLDocument}\n */\n parseFromString = function (html, tagName) {\n if (tagName) {\n html = '<' + tagName + '>' + html + '';\n }\n\n return domParser.parseFromString(html, mimeType);\n };\n\n parseFromDocument = parseFromString;\n}\n\n/**\n * DOMImplementation (performance: fair).\n *\n * @see https://developer.mozilla.org/docs/Web/API/DOMImplementation/createHTMLDocument\n */\nif (typeof document === 'object' && document.implementation) {\n var doc = document.implementation.createHTMLDocument();\n\n /**\n * Use HTML document created by `document.implementation.createHTMLDocument`.\n *\n * @param {string} html - The HTML string.\n * @param {string} [tagName] - The element to render the HTML (with 'body' as fallback).\n * @return {HTMLDocument}\n */\n parseFromDocument = function (html, tagName) {\n if (tagName) {\n var element = doc.documentElement.querySelector(tagName);\n element.innerHTML = html;\n return doc;\n }\n\n doc.documentElement.innerHTML = html;\n return doc;\n };\n}\n\n/**\n * Template (performance: fast).\n *\n * @see https://developer.mozilla.org/docs/Web/HTML/Element/template\n */\nvar template =\n typeof document === 'object' ? document.createElement('template') : {};\n\nvar parseFromTemplate;\n\nif (template.content) {\n /**\n * Uses a template element (content fragment) to parse HTML.\n *\n * @param {string} html - The HTML string.\n * @return {NodeList}\n */\n parseFromTemplate = function (html) {\n template.innerHTML = html;\n return template.content.childNodes;\n };\n}\n\n/**\n * Parses HTML string to DOM nodes.\n *\n * @param {string} html - HTML markup.\n * @return {NodeList}\n */\nfunction domparser(html) {\n var firstTagName;\n var match = html.match(FIRST_TAG_REGEX);\n\n if (match && match[1]) {\n firstTagName = match[1].toLowerCase();\n }\n\n var doc;\n var element;\n var elements;\n\n switch (firstTagName) {\n case HTML:\n doc = parseFromString(html);\n\n // the created document may come with filler head/body elements,\n // so make sure to remove them if they don't actually exist\n if (!HEAD_TAG_REGEX.test(html)) {\n element = doc.querySelector(HEAD);\n if (element) {\n element.parentNode.removeChild(element);\n }\n }\n\n if (!BODY_TAG_REGEX.test(html)) {\n element = doc.querySelector(BODY);\n if (element) {\n element.parentNode.removeChild(element);\n }\n }\n\n return doc.querySelectorAll(HTML);\n\n case HEAD:\n case BODY:\n doc = parseFromDocument(html);\n elements = doc.querySelectorAll(firstTagName);\n\n // if there's a sibling element, then return both elements\n if (BODY_TAG_REGEX.test(html) && HEAD_TAG_REGEX.test(html)) {\n return elements[0].parentNode.childNodes;\n }\n return elements;\n\n // low-level tag or text\n default:\n if (parseFromTemplate) {\n return parseFromTemplate(html);\n }\n element = parseFromDocument(html, BODY).querySelector(BODY);\n return element.childNodes;\n }\n}\n\nmodule.exports = domparser;\n","/**\n * SVG elements are case-sensitive.\n *\n * @see {@link https://developer.mozilla.org/docs/Web/SVG/Element#svg_elements_a_to_z}\n */\nexports.CASE_SENSITIVE_TAG_NAMES = [\n 'animateMotion',\n 'animateTransform',\n 'clipPath',\n 'feBlend',\n 'feColorMatrix',\n 'feComponentTransfer',\n 'feComposite',\n 'feConvolveMatrix',\n 'feDiffuseLighting',\n 'feDisplacementMap',\n 'feDropShadow',\n 'feFlood',\n 'feFuncA',\n 'feFuncB',\n 'feFuncG',\n 'feFuncR',\n 'feGaussianBlur',\n 'feImage',\n 'feMerge',\n 'feMergeNode',\n 'feMorphology',\n 'feOffset',\n 'fePointLight',\n 'feSpecularLighting',\n 'feSpotLight',\n 'feTile',\n 'feTurbulence',\n 'foreignObject',\n 'linearGradient',\n 'radialGradient',\n 'textPath'\n];\n","var domhandler = require('domhandler');\nvar constants = require('./constants');\n\nvar CASE_SENSITIVE_TAG_NAMES = constants.CASE_SENSITIVE_TAG_NAMES;\n\nvar Comment = domhandler.Comment;\nvar Element = domhandler.Element;\nvar ProcessingInstruction = domhandler.ProcessingInstruction;\nvar Text = domhandler.Text;\n\nvar caseSensitiveTagNamesMap = {};\nvar tagName;\n\nfor (var i = 0, len = CASE_SENSITIVE_TAG_NAMES.length; i < len; i++) {\n tagName = CASE_SENSITIVE_TAG_NAMES[i];\n caseSensitiveTagNamesMap[tagName.toLowerCase()] = tagName;\n}\n\n/**\n * Gets case-sensitive tag name.\n *\n * @param {string} tagName - Tag name in lowercase.\n * @returns {string|undefined} - Case-sensitive tag name.\n */\nfunction getCaseSensitiveTagName(tagName) {\n return caseSensitiveTagNamesMap[tagName];\n}\n\n/**\n * Formats DOM attributes to a hash map.\n *\n * @param {NamedNodeMap} attributes - List of attributes.\n * @returns {object} - Map of attribute name to value.\n */\nfunction formatAttributes(attributes) {\n var result = {};\n var attribute;\n // `NamedNodeMap` is array-like\n for (var i = 0, len = attributes.length; i < len; i++) {\n attribute = attributes[i];\n result[attribute.name] = attribute.value;\n }\n return result;\n}\n\n/**\n * Corrects the tag name if it is case-sensitive (SVG).\n * Otherwise, returns the lowercase tag name (HTML).\n *\n * @param {string} tagName - Lowercase tag name.\n * @returns {string} - Formatted tag name.\n */\nfunction formatTagName(tagName) {\n tagName = tagName.toLowerCase();\n var caseSensitiveTagName = getCaseSensitiveTagName(tagName);\n if (caseSensitiveTagName) {\n return caseSensitiveTagName;\n }\n return tagName;\n}\n\n/**\n * Transforms DOM nodes to `domhandler` nodes.\n *\n * @param {NodeList} nodes - DOM nodes.\n * @param {Element|null} [parent=null] - Parent node.\n * @param {string} [directive] - Directive.\n * @returns {Array}\n */\nfunction formatDOM(nodes, parent, directive) {\n parent = parent || null;\n var result = [];\n var tagName;\n\n for (var index = 0, len = nodes.length; index < len; index++) {\n var node = nodes[index];\n var current;\n\n // set the node data given the type\n switch (node.nodeType) {\n case 1:\n tagName = formatTagName(node.nodeName);\n // script, style, or tag\n current = new Element(tagName, formatAttributes(node.attributes));\n current.children = formatDOM(\n // template children are on content\n tagName === 'template' ? node.content.childNodes : node.childNodes,\n current\n );\n break;\n\n case 3:\n current = new Text(node.nodeValue);\n break;\n\n case 8:\n current = new Comment(node.nodeValue);\n break;\n\n default:\n continue;\n }\n\n // set previous node next\n var prev = result[index - 1] || null;\n if (prev) {\n prev.next = current;\n }\n\n // set properties for current node\n current.parent = parent;\n current.prev = prev;\n current.next = null;\n\n result.push(current);\n }\n\n if (directive) {\n current = new ProcessingInstruction(\n directive.substring(0, directive.indexOf(' ')).toLowerCase(),\n directive\n );\n current.next = result[0] || null;\n current.parent = parent;\n result.unshift(current);\n\n if (result[1]) {\n result[1].prev = result[0];\n }\n }\n\n return result;\n}\n\nexports.formatAttributes = formatAttributes;\nexports.formatDOM = formatDOM;\n","var domparser = require('./domparser');\nvar utilities = require('./utilities');\n\nvar formatDOM = utilities.formatDOM;\n\nvar DIRECTIVE_REGEX = /<(![a-zA-Z\\s]+)>/; // e.g., \n\n/**\n * Parses HTML string to DOM nodes in browser.\n *\n * @param {string} html - HTML markup.\n * @return {DomElement[]} - DOM elements.\n */\nfunction HTMLDOMParser(html) {\n if (typeof html !== 'string') {\n throw new TypeError('First argument must be a string');\n }\n\n if (html === '') {\n return [];\n }\n\n // match directive\n var match = html.match(DIRECTIVE_REGEX);\n var directive;\n\n if (match && match[1]) {\n directive = match[1];\n }\n\n return formatDOM(domparser(html), null, directive);\n}\n\nmodule.exports = HTMLDOMParser;\n"],"names":["HTML","HEAD","BODY","FIRST_TAG_REGEX","HEAD_TAG_REGEX","BODY_TAG_REGEX","parseFromDocument","parseFromString","DOMParser","domParser","mimeType","html","tagName","doc","element","template","parseFromTemplate","domparser","firstTagName","match","elements","domparser_1","constants","domhandler","require$$0","require$$1","CASE_SENSITIVE_TAG_NAMES","Comment","Element","ProcessingInstruction","Text","caseSensitiveTagNamesMap","i","len","getCaseSensitiveTagName","formatAttributes","attributes","result","attribute","formatTagName","caseSensitiveTagName","formatDOM","nodes","parent","directive","index","node","current","prev","utilities","DIRECTIVE_REGEX","HTMLDOMParser","htmlToDom"],"mappings":"mZACA,IAAIA,EAAO,OACPC,EAAO,OACPC,EAAO,OACPC,EAAkB,qBAElBC,EAAiB,cACjBC,EAAiB,cAGjBC,EAAoB,UAAY,CAClC,MAAM,IAAI,MACR,4EACD,CACH,EAEIC,EAAkB,UAAY,CAChC,MAAM,IAAI,MACR,qEACD,CACH,EAEIC,EAAY,OAAO,QAAW,UAAY,OAAO,UAOrD,GAAI,OAAOA,GAAc,WAAY,CACnC,IAAIC,EAAY,IAAID,EAChBE,EAAW,YASfH,EAAkB,SAAUI,EAAMC,EAAS,CACzC,OAAIA,IACFD,EAAO,IAAMC,EAAU,IAAMD,EAAO,KAAOC,EAAU,KAGhDH,EAAU,gBAAgBE,EAAMD,CAAQ,CAChD,EAEDJ,EAAoBC,CACtB,CAOA,GAAI,OAAO,UAAa,UAAY,SAAS,eAAgB,CAC3D,IAAIM,EAAM,SAAS,eAAe,mBAAoB,EAStDP,EAAoB,SAAUK,EAAMC,EAAS,CAC3C,GAAIA,EAAS,CACX,IAAIE,EAAUD,EAAI,gBAAgB,cAAcD,CAAO,EACvD,OAA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