UNPKG

121 kBSource Map (JSON)View Raw
1{"version":3,"file":"index.mjs","sources":["src/AttributeList.js","src/visit.js","src/Node.js","src/Comment.js","src/Container.js","src/Doctype.js","src/Fragment.js","src/Text.js","src/normalize.js","src/NodeList.js","src/parseHTMLTreeAdapter.js","src/parseHTMLTokenizer.js","src/parseHTML.js","src/Result.js","src/Element.js","src/Plugin.js","src/index.js"],"sourcesContent":["/**\n* @name AttributeList\n* @class\n* @extends Array\n* @classdesc Return a new list of {@link Element} attributes.\n* @param {...Array|AttributeList|Object} attrs - An array or object of attributes.\n* @returns {AttributeList}\n* @example\n* new AttributeList([{ name: 'class', value: 'foo' }, { name: 'id', value: 'bar' }])\n* @example\n* new AttributeList({ class: 'foo', id: 'bar' })\n*/\nclass AttributeList extends Array {\n\tconstructor (attrs) {\n\t\tsuper();\n\n\t\tif (attrs === Object(attrs)) {\n\t\t\tthis.push(...getAttributeListArray(attrs));\n\t\t}\n\t}\n\n\t/**\n\t* Add an attribute or attributes to the current {@link AttributeList}.\n\t* @param {Array|Object|RegExp|String} name - The attribute to remove.\n\t* @param {String} [value] - The value of the attribute being added.\n\t* @returns {Boolean} - Whether the attribute or attributes were added to the current {@link AttributeList}.\n\t* @example <caption>Add an empty \"id\" attribute.</caption>\n\t* attrs.add('id')\n\t* @example <caption>Add an \"id\" attribute with a value of \"bar\".</caption>\n\t* attrs.add({ id: 'bar' })\n\t* @example\n\t* attrs.add([{ name: 'id', value: 'bar' }])\n\t*/\n\tadd (name, ...args) {\n\t\treturn toggle(this, getAttributeListArray(name, ...args), true).attributeAdded;\n\t}\n\n\t/**\n\t* Return a new clone of the current {@link AttributeList} while conditionally applying additional attributes.\n\t* @param {...Array|AttributeList|Object} attrs - Additional attributes to be added to the new {@link AttributeList}.\n\t* @returns {Element} - The cloned Element.\n\t* @example\n\t* attrs.clone()\n\t* @example <caption>Clone the current attribute and add an \"id\" attribute with a value of \"bar\".</caption>\n\t* attrs.clone({ name: 'id', value: 'bar' })\n\t*/\n\tclone (...attrs) {\n\t\treturn new AttributeList(Array.from(this).concat(getAttributeListArray(attrs)));\n\t}\n\n\t/**\n\t* Return whether an attribute or attributes exists in the current {@link AttributeList}.\n\t* @param {String} name - The name or attribute object being accessed.\n\t* @returns {Boolean} - Whether the attribute exists.\n\t* @example <caption>Return whether there is an \"id\" attribute.</caption>\n\t* attrs.contains('id')\n\t* @example\n\t* attrs.contains({ id: 'bar' })\n\t* @example <caption>Return whether there is an \"id\" attribute with a value of \"bar\".</caption>\n\t* attrs.contains([{ name: 'id': value: 'bar' }])\n\t*/\n\tcontains (name) {\n\t\treturn this.indexOf(name) !== -1;\n\t}\n\n\t/**\n\t* Return an attribute value by name from the current {@link AttributeList}.\n\t* @description If the attribute exists with a value then a String is returned. If the attribute exists with no value then `null` is returned. If the attribute does not exist then `false` is returned.\n\t* @param {RegExp|String} name - The name of the attribute being accessed.\n\t* @returns {Boolean|Null|String} - The value of the attribute (a string or null) or false (if the attribute does not exist).\n\t* @example <caption>Return the value of \"id\" or `false`.</caption>\n\t* // <div>this element has no \"id\" attribute</div>\n\t* attrs.get('id') // returns false\n\t* // <div id>this element has an \"id\" attribute with no value</div>\n\t* attrs.get('id') // returns null\n\t* // <div id=\"\">this element has an \"id\" attribute with a value</div>\n\t* attrs.get('id') // returns ''\n\t*/\n\tget (name) {\n\t\tconst index = this.indexOf(name);\n\n\t\treturn index === -1\n\t\t\t? false\n\t\t: this[index].value;\n\t}\n\n\t/**\n\t* Return the position of an attribute by name or attribute object in the current {@link AttributeList}.\n\t* @param {Array|Object|RegExp|String} name - The attribute to locate.\n\t* @returns {Number} - The index of the attribute or -1.\n\t* @example <caption>Return the index of \"id\".</caption>\n\t* attrs.indexOf('id')\n\t* @example <caption>Return the index of /d$/.</caption>\n\t* attrs.indexOf(/d$/i)\n\t* @example <caption>Return the index of \"foo\" with a value of \"bar\".</caption>\n\t* attrs.indexOf({ foo: 'bar' })\n\t* @example <caption>Return the index of \"ariaLabel\" or \"aria-label\" matching /^open/.</caption>\n\t* attrs.indexOf({ ariaLabel: /^open/ })\n\t* @example <caption>Return the index of an attribute whose name matches `/^foo/`.</caption>\n\t* attrs.indexOf([{ name: /^foo/ })\n\t*/\n\tindexOf (name, ...args) {\n\t\treturn this.findIndex(\n\t\t\tArray.isArray(name)\n\t\t\t\t? findIndexByArray\n\t\t\t: isRegExp(name)\n\t\t\t\t? findIndexByRegExp\n\t\t\t: name === Object(name)\n\t\t\t\t? findIndexByObject\n\t\t\t: findIndexByString\n\t\t);\n\n\t\tfunction findIndexByArray (attr) {\n\t\t\treturn name.some(\n\t\t\t\tinnerAttr => (\n\t\t\t\t\t'name' in Object(innerAttr)\n\t\t\t\t\t\t? isRegExp(innerAttr.name)\n\t\t\t\t\t\t\t? innerAttr.name.test(attr.name)\n\t\t\t\t\t\t: String(innerAttr.name) === attr.name\n\t\t\t\t\t: true\n\t\t\t\t) && (\n\t\t\t\t\t'value' in Object(innerAttr)\n\t\t\t\t\t\t? isRegExp(innerAttr.value)\n\t\t\t\t\t\t\t? innerAttr.value.test(attr.value)\n\t\t\t\t\t\t: getAttributeValue(innerAttr.value) === attr.value\n\t\t\t\t\t: true\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\tfunction findIndexByObject (attr) {\n\t\t\tconst innerAttr = name[attr.name] || name[toCamelCaseString(attr.name)];\n\n\t\t\treturn innerAttr\n\t\t\t\t? isRegExp(innerAttr)\n\t\t\t\t\t? innerAttr.test(attr.value)\n\t\t\t\t: attr.value === innerAttr\n\t\t\t: false;\n\t\t}\n\n\t\tfunction findIndexByRegExp (attr) {\n\t\t\treturn name.test(attr.name) && (\n\t\t\t\targs.length\n\t\t\t\t\t? isRegExp(args[0])\n\t\t\t\t\t\t? args[0].test(attr.value)\n\t\t\t\t\t: attr.value === getAttributeValue(args[0])\n\t\t\t\t: true\n\t\t\t);\n\t\t}\n\n\t\tfunction findIndexByString (attr) {\n\t\t\treturn (\n\t\t\t\tattr.name === String(name) || attr.name === toKebabCaseString(name)\n\t\t\t) && (\n\t\t\t\targs.length\n\t\t\t\t\t? isRegExp(args[0])\n\t\t\t\t\t\t? args[0].test(attr.value)\n\t\t\t\t\t: attr.value === getAttributeValue(args[0])\n\t\t\t\t: true\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t* Remove an attribute or attributes from the current {@link AttributeList}.\n\t* @param {Array|Object|RegExp|String} name - The attribute to remove.\n\t* @param {String} [value] - The value of the attribute being removed.\n\t* @returns {Boolean} - Whether the attribute or attributes were removed from the {@link AttributeList}.\n\t* @example <caption>Remove the \"id\" attribute.</caption>\n\t* attrs.remove('id')\n\t* @example <caption>Remove the \"id\" attribute when it has a value of \"bar\".</caption>\n\t* attrs.remove('id', 'bar')\n\t* @example\n\t* attrs.remove({ id: 'bar' })\n\t* @example\n\t* attrs.remove([{ name: 'id', value: 'bar' }])\n\t* @example <caption>Remove the \"id\" and \"class\" attributes.</caption>\n\t* attrs.remove(['id', 'class'])\n\t*/\n\tremove (name, ...args) {\n\t\treturn toggle(this, getAttributeListArray(name, ...args), false).attributeRemoved;\n\t}\n\n\t/**\n\t* Toggle an attribute or attributes from the current {@link AttributeList}.\n\t* @param {String|Object} name_or_attrs - The name of the attribute being toggled, or an object of attributes being toggled.\n\t* @param {String|Boolean} [value_or_force] - The value of the attribute being toggled when the first argument is not an object, or attributes should be exclusively added (true) or removed (false).\n\t* @param {Boolean} [force] - Whether attributes should be exclusively added (true) or removed (false).\n\t* @returns {Boolean} - Whether any attribute was added to the current {@link AttributeList}.\n\t* @example <caption>Toggle the \"id\" attribute.</caption>\n\t* attrs.toggle('id')\n\t* @example <caption>Toggle the \"id\" attribute with a value of \"bar\".</caption>\n\t* attrs.toggle('id', 'bar')\n\t* @example\n\t* attrs.toggle({ id: 'bar' })\n\t* @example\n\t* attrs.toggle([{ name: 'id', value: 'bar' }])\n\t*/\n\ttoggle (name, ...args) {\n\t\tconst attrs = getAttributeListArray(name, ...args);\n\t\tconst force = (\n\t\t\tname === Object(name)\n\t\t\t\t? args[0] == null ? null : Boolean(args[0])\n\t\t\t: args[1] == null ? null : Boolean(args[1])\n\t\t);\n\n\t\tconst result = toggle(this, attrs, force);\n\n\t\treturn result.attributeAdded || result.atttributeModified;\n\t}\n\n\t/**\n\t* Return the current {@link AttributeList} as a String.\n\t* @returns {String} A string version of the current {@link AttributeList}\n\t* @example\n\t* attrs.toString() // returns 'class=\"foo\" data-foo=\"bar\"'\n\t*/\n\ttoString () {\n\t\treturn this.length\n\t\t\t? `${this.map(\n\t\t\t\tattr => `${Object(attr.source).before || ' '}${attr.name}${attr.value === null ? '' : `=${Object(attr.source).quote || '\"'}${attr.value}${Object(attr.source).quote || '\"'}`}`\n\t\t\t).join('')}`\n\t\t: '';\n\t}\n\n\t/**\n\t* Return the current {@link AttributeList} as an Object.\n\t* @returns {Object} point - An object version of the current {@link AttributeList}\n\t* @example\n\t* attrs.toJSON() // returns { class: 'foo', dataFoo: 'bar' } when <x class=\"foo\" data-foo: \"bar\" />\n\t*/\n\ttoJSON () {\n\t\treturn this.reduce(\n\t\t\t(object, attr) => Object.assign(\n\t\t\t\tobject,\n\t\t\t\t{\n\t\t\t\t\t[toCamelCaseString(attr.name)]: attr.value\n\t\t\t\t}\n\t\t\t),\n\t\t\t{}\n\t\t);\n\t}\n\n\t/**\n\t* Return a new {@link AttributeList} from an array or object.\n\t* @param {Array|AttributeList|Object} nodes - An array or object of attributes.\n\t* @returns {AttributeList} A new {@link AttributeList}\n\t* @example <caption>Return an array of attributes from a regular object.</caption>\n\t* AttributeList.from({ dataFoo: 'bar' }) // returns AttributeList [{ name: 'data-foo', value: 'bar' }]\n\t* @example <caption>Return a normalized array of attributes from an impure array of attributes.</caption>\n\t* AttributeList.from([{ name: 'data-foo', value: true, foo: 'bar' }]) // returns AttributeList [{ name: 'data-foo', value: 'true' }]\n\t*/\n\n\tstatic from (attrs) {\n\t\treturn new AttributeList(getAttributeListArray(attrs));\n\t}\n}\n\n/**\n* Toggle an attribute or attributes from an {@link AttributeList}.\n* @param {AttributeList} attrs - The {@link AttributeList} being modified.\n* @param {String|Object} toggles - The attributes being toggled.\n* @param {Boolean} [force] - Whether attributes should be exclusively added (true) or removed (false)\n* @returns {Object} An object specifying whether any attributes were added, removed, and/or modified.\n* @private\n*/\n\nfunction toggle (attrs, toggles, force) {\n\tlet attributeAdded = false;\n\tlet attributeRemoved = false;\n\tlet atttributeModified= false;\n\n\ttoggles.forEach(toggleAttr => {\n\t\tconst index = attrs.indexOf(toggleAttr.name);\n\n\t\tif (index === -1) {\n\t\t\tif (force !== false) {\n\t\t\t\t// add the attribute (if not exclusively removing attributes)\n\t\t\t\tattrs.push(toggleAttr);\n\n\t\t\t\tattributeAdded = true;\n\t\t\t}\n\t\t} else if (force !== true) {\n\t\t\t// remove the attribute (if not exclusively adding attributes)\n\t\t\tattrs.splice(index, 1);\n\n\t\t\tattributeRemoved = true;\n\t\t} else if (toggleAttr.value !== undefined && attrs[index].value !== toggleAttr.value) {\n\t\t\t// change the value of the attribute (if exclusively adding attributes)\n\t\t\tattrs[index].value = toggleAttr.value;\n\n\t\t\tatttributeModified = true;\n\t\t}\n\t});\n\n\treturn { attributeAdded, attributeRemoved, atttributeModified };\n}\n\n/**\n* Return an AttributeList-compatible array from an array or object.\n* @private\n*/\n\nfunction getAttributeListArray (attrs, value) {\n\treturn attrs === null || attrs === undefined\n\t\t// void values are omitted\n\t\t? []\n\t: Array.isArray(attrs)\n\t\t// arrays are sanitized as a name or value, and then optionally a source\n\t\t? attrs.reduce(\n\t\t\t(attrs, rawattr) => {\n\t\t\t\tconst attr = {};\n\n\t\t\t\tif ('name' in Object(rawattr)) {\n\t\t\t\t\tattr.name = String(rawattr.name);\n\t\t\t\t}\n\n\t\t\t\tif ('value' in Object(rawattr)) {\n\t\t\t\t\tattr.value = getAttributeValue(rawattr.value);\n\t\t\t\t}\n\n\t\t\t\tif ('source' in Object(rawattr)) {\n\t\t\t\t\tattr.source = rawattr.source;\n\t\t\t\t}\n\n\t\t\t\tif ('name' in attr || 'value' in attr) {\n\t\t\t\t\tattrs.push(attr);\n\t\t\t\t}\n\n\t\t\t\treturn attrs;\n\t\t\t},\n\t\t\t[]\n\t\t)\n\t: attrs === Object(attrs)\n\t\t// objects are sanitized as a name and value\n\t\t? Object.keys(attrs).map(\n\t\t\tname => ({\n\t\t\t\tname: toKebabCaseString(name),\n\t\t\t\tvalue: getAttributeValue(attrs[name])\n\t\t\t})\n\t\t)\n\t: 1 in arguments\n\t\t// both name and value arguments are sanitized as a name and value\n\t\t? [{\n\t\t\tname: attrs,\n\t\t\tvalue: getAttributeValue(value)\n\t\t}]\n\t// one name argument is sanitized as a name\n\t: [{\n\t\tname: attrs\n\t}];\n}\n\n/**\n* Return a value transformed into an attribute value.\n* @description Expected values are strings. Unexpected values are null, objects, and undefined. Nulls returns null, Objects with the default toString return their JSON.stringify’d value otherwise toString’d, and Undefineds return an empty string.\n* @example <caption>Expected values.</caption>\n* getAttributeValue('foo') // returns 'foo'\n* getAttributeValue('') // returns ''\n* @example <caption>Unexpected values.</caption>\n* getAttributeValue(null) // returns null\n* getAttributeValue(undefined) // returns ''\n* getAttributeValue(['foo']) // returns '[\"foo\"]'\n* getAttributeValue({ toString() { return 'bar' }}) // returns 'bar'\n* getAttributeValue({ toString: 'bar' }) // returns '{\"toString\":\"bar\"}'\n* @private\n*/\n\nfunction getAttributeValue (value) {\n\treturn value === null\n\t\t? null\n\t: value === undefined\n\t\t? ''\n\t: value === Object(value)\n\t\t? value.toString === Object.prototype.toString\n\t\t\t? JSON.stringify(value)\n\t\t: String(value)\n\t: String(value);\n}\n\n/**\n* Return a string formatted using camelCasing.\n* @param {String} value - The value being formatted.\n* @example\n* toCamelCaseString('hello-world') // returns 'helloWorld'\n* @private\n*/\n\nfunction toCamelCaseString (value) {\n\treturn isKebabCase(value)\n\t\t? String(value).replace(/-[a-z]/g, $0 => $0.slice(1).toUpperCase())\n\t: String(value);\n}\n\n/**\n* Return a string formatted using kebab-casing.\n* @param {String} value - The value being formatted.\n* @description Expected values do not already contain dashes.\n* @example <caption>Expected values.</caption>\n* toKebabCaseString('helloWorld') // returns 'hello-world'\n* toKebabCaseString('helloworld') // returns 'helloworld'\n* @example <caption>Unexpected values.</caption>\n* toKebabCaseString('hello-World') // returns 'hello-World'\n* @private\n*/\n\nfunction toKebabCaseString (value) {\n\treturn isCamelCase(value)\n\t\t? String(value).replace(/[A-Z]/g, $0 => `-${$0.toLowerCase()}`)\n\t: String(value);\n}\n\n/**\n* Return whether a value is formatted camelCase.\n* @example\n* isCamelCase('helloWorld') // returns true\n* isCamelCase('hello-world') // returns false\n* isCamelCase('helloworld') // returns false\n* @private\n*/\n\nfunction isCamelCase (value) {\n\treturn /^\\w+[A-Z]\\w*$/.test(value);\n}\n\n/**\n* Return whether a value is formatted kebab-case.\n* @example\n* isKebabCase('hello-world') // returns true\n* isKebabCase('helloworld') // returns false\n* isKebabCase('helloWorld') // returns false\n* @private\n*/\n\nfunction isKebabCase (value) {\n\treturn /^\\w+[-]\\w+$/.test(value);\n}\n\n/**\n* Return whether a value is a Regular Expression.\n* @example\n* isRegExp(/hello-world/) // returns true\n* isRegExp('/hello-world/') // returns false\n* isRegExp(new RegExp('hello-world')) // returns true\n* @private\n*/\n\nfunction isRegExp (value) {\n\treturn Object.prototype.toString.call(value) === '[object RegExp]';\n}\n\nexport default AttributeList;\n","/**\n* Transform a {@link Node} and any descendants using visitors.\n* @param {Node} node - The {@link Node} to be visited.\n* @param {Result} result - The {@link Result} to be used by visitors.\n* @param {Object} [overrideVisitors] - Alternative visitors to be used in place of {@link Result} visitors.\n* @returns {ResultPromise}\n* @private\n*/\n\nfunction visit (node, result, overrideVisitors) {\n\t// get visitors as an object\n\tconst visitors = Object(overrideVisitors || Object(result).visitors);\n\n\t// get node types\n\tconst beforeType = getTypeFromNode(node);\n\tconst beforeSubType = getSubTypeFromNode(node);\n\tconst beforeNodeType = 'Node';\n\tconst beforeRootType = 'Root';\n\tconst afterType = `after${beforeType}`;\n\tconst afterSubType = `after${beforeSubType}`;\n\tconst afterNodeType = 'afterNode';\n\tconst afterRootType = 'afterRoot';\n\n\tlet promise = Promise.resolve();\n\n\t// fire \"before\" visitors\n\tif (visitors[beforeNodeType]) {\n\t\tpromise = promise.then(\n\t\t\t() => runAll(visitors[beforeNodeType], node, result)\n\t\t);\n\t}\n\n\tif (visitors[beforeType]) {\n\t\tpromise = promise.then(\n\t\t\t() => runAll(visitors[beforeType], node, result)\n\t\t);\n\t}\n\n\tif (beforeSubType !== beforeType && visitors[beforeSubType]) {\n\t\tpromise = promise.then(\n\t\t\t() => runAll(visitors[beforeSubType], node, result)\n\t\t);\n\t}\n\n\t// dispatch before root event\n\tif (visitors[beforeRootType] && node === result.root) {\n\t\tpromise = promise.then(\n\t\t\t() => runAll(visitors[beforeRootType], node, result)\n\t\t);\n\t}\n\n\t// walk children\n\tif (Array.isArray(node.nodes)) {\n\t\tnode.nodes.slice(0).forEach(childNode => {\n\t\t\tpromise = promise.then(\n\t\t\t\t() => (\n\t\t\t\t\tchildNode.parent === node &&\n\t\t\t\t\tvisit(childNode, result, overrideVisitors)\n\t\t\t\t)\n\t\t\t);\n\t\t})\n\t}\n\n\t// fire \"after\" visitors\n\tif (visitors[afterNodeType]) {\n\t\tpromise = promise.then(\n\t\t\t() => runAll(visitors[afterNodeType], node, result)\n\t\t);\n\t}\n\n\tif (visitors[afterType]) {\n\t\tpromise = promise.then(\n\t\t\t() => runAll(visitors[afterType], node, result)\n\t\t);\n\t}\n\n\tif (afterType !== afterSubType && visitors[afterSubType]) {\n\t\tpromise = promise.then(\n\t\t\t() => runAll(visitors[afterSubType], node, result)\n\t\t);\n\t}\n\n\t// dispatch root event\n\tif (visitors[afterRootType] && node === result.root) {\n\t\tpromise = promise.then(\n\t\t\t() => runAll(visitors[afterRootType], node, result)\n\t\t);\n\t}\n\n\treturn promise.then(\n\t\t() => result\n\t);\n}\n\nexport function runAll (plugins, node, result) {\n\tlet promise = Promise.resolve();\n\n\t[].concat(plugins || []).forEach(plugin => {\n\t\t// run the current plugin\n\t\tpromise = promise.then(() => {\n\t\t\t// update the current plugin\n\t\t\tresult.currentPlugin = plugin;\n\n\t\t\treturn plugin(node, result);\n\t\t}).then(() => {\n\t\t\t// clear the current plugin\n\t\t\tresult.currentPlugin = null;\n\t\t});\n\t});\n\n\treturn promise;\n}\n\n// return normalized plugins and visitors\nfunction getVisitors (rawplugins) {\n\tconst visitors = {};\n\n\t// initialize plugins and visitors\n\t[].concat(rawplugins || []).forEach(plugin => {\n\t\tconst initializedPlugin = Object(plugin).type === 'plugin' ? plugin() : plugin;\n\n\t\tif (initializedPlugin instanceof Function) {\n\t\t\tif (!visitors.afterRoot) {\n\t\t\t\tvisitors.afterRoot = [];\n\t\t\t}\n\n\t\t\tvisitors.afterRoot.push(initializedPlugin);\n\t\t} else if (Object(initializedPlugin) === initializedPlugin && Object.keys(initializedPlugin).length) {\n\t\t\tObject.keys(initializedPlugin).forEach(key => {\n\t\t\t\tconst fn = initializedPlugin[key];\n\n\t\t\t\tif (fn instanceof Function) {\n\t\t\t\t\tif (!visitors[key]) {\n\t\t\t\t\t\tvisitors[key] = [];\n\t\t\t\t\t}\n\n\t\t\t\t\tvisitors[key].push(initializedPlugin[key]);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n\n\treturn visitors;\n}\n\nfunction getTypeFromNode (node) {\n\treturn {\n\t\t'comment': 'Comment',\n\t\t'text': 'Text',\n\t\t'doctype': 'Doctype',\n\t\t'fragment': 'Fragment'\n\t}[node.type] || 'Element';\n}\n\nfunction getSubTypeFromNode (node) {\n\treturn {\n\t\t'comment': 'Comment',\n\t\t'text': 'Text',\n\t\t'doctype': 'Doctype',\n\t\t'fragment': 'Fragment'\n\t}[node.type] || (\n\t\t!node.name\n\t\t\t? 'FragmentElement'\n\t\t: `${node.name[0].toUpperCase()}${node.name.slice(1)}Element`\n\t);\n}\n\nexport {\n\tvisit as default,\n\tgetVisitors\n};\n","import visit from './visit';\n\n/**\n* @name Node\n* @class\n* @extends Node\n* @classdesc Create a new {@link Node}.\n* @returns {Node}\n*/\nclass Node {\n\t/**\n\t* The position of the current {@link Node} from its parent.\n\t* @returns {Number}\n\t* @example\n\t* node.index // returns the index of the node or -1\n\t*/\n\tget index () {\n\t\tif (this.parent === Object(this.parent) && this.parent.nodes && this.parent.nodes.length) {\n\t\t\treturn this.parent.nodes.indexOf(this);\n\t\t}\n\n\t\treturn -1;\n\t}\n\n\t/**\n\t* The next {@link Node} after the current {@link Node}, or `null` if there is none.\n\t* @returns {Node|Null} - The next Node or null.\n\t* @example\n\t* node.next // returns null\n\t*/\n\tget next () {\n\t\tconst index = this.index;\n\n\t\tif (index !== -1) {\n\t\t\treturn this.parent.nodes[index + 1] || null;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t* The next {@link Element} after the current {@link Node}, or `null` if there is none.\n\t* @returns {Element|Null}\n\t* @example\n\t* node.nextElement // returns an element or null\n\t*/\n\tget nextElement () {\n\t\tconst index = this.index;\n\n\t\tif (index !== -1) {\n\t\t\treturn this.parent.nodes.slice(index).find(hasNodes);\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t* The previous {@link Node} before the current {@link Node}, or `null` if there is none.\n\t* @returns {Node|Null}\n\t* @example\n\t* node.previous // returns a node or null\n\t*/\n\tget previous () {\n\t\tconst index = this.index;\n\n\t\tif (index !== -1) {\n\t\t\treturn this.parent.nodes[index - 1] || null;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t* The previous {@link Element} before the current {@link Node}, or `null` if there is none.\n\t* @returns {Element|Null}\n\t* @example\n\t* node.previousElement // returns an element or null\n\t*/\n\tget previousElement () {\n\t\tconst index = this.index;\n\n\t\tif (index !== -1) {\n\t\t\treturn this.parent.nodes.slice(0, index).reverse().find(hasNodes);\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t* The top-most ancestor from the current {@link Node}.\n\t* @returns {Node}\n\t* @example\n\t* node.root // returns the top-most node or the current node itself\n\t*/\n\tget root () {\n\t\tlet parent = this;\n\n\t\twhile (parent.parent) {\n\t\t\tparent = parent.parent;\n\t\t}\n\n\t\treturn parent;\n\t}\n\n\t/**\n\t* Insert one ore more {@link Node}s after the current {@link Node}.\n\t* @param {...Node|String} nodes - Any nodes to be inserted after the current {@link Node}.\n\t* @returns {Node} - The current {@link Node}.\n\t* @example\n\t* node.after(new Text({ data: 'Hello World' }))\n\t*/\n\tafter (...nodes) {\n\t\tif (nodes.length) {\n\t\t\tconst index = this.index;\n\n\t\t\tif (index !== -1) {\n\t\t\t\tthis.parent.nodes.splice(index + 1, 0, ...nodes);\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t* Append Nodes or new Text Nodes to the current {@link Node}.\n\t* @param {...Node|String} nodes - Any nodes to be inserted after the last child of the current {@link Node}.\n\t* @returns {Node} - The current {@link Node}.\n\t* @example\n\t* node.append(someOtherNode)\n\t*/\n\tappend (...nodes) {\n\t\tif (this.nodes) {\n\t\t\tthis.nodes.splice(this.nodes.length, 0, ...nodes);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t* Append the current {@link Node} to another Node.\n\t* @param {Container} parent - The {@link Container} for the current {@link Node}.\n\t* @returns {Node} - The current {@link Node}.\n\t*/\n\tappendTo (parent) {\n\t\tif (parent && parent.nodes) {\n\t\t\tparent.nodes.splice(parent.nodes.length, 0, this);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t* Insert Nodes or new Text Nodes before the Node if it has a parent.\n\t* @param {...Node|String} nodes - Any nodes to be inserted before the current {@link Node}.\n\t* @returns {Node}\n\t* @example\n\t* node.before(new Text({ data: 'Hello World' })) // returns the current node\n\t*/\n\tbefore (...nodes) {\n\t\tif (nodes.length) {\n\t\t\tconst index = this.index;\n\n\t\t\tif (index !== -1) {\n\t\t\t\tthis.parent.nodes.splice(index, 0, ...nodes);\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t* Prepend Nodes or new Text Nodes to the current {@link Node}.\n\t* @param {...Node|String} nodes - Any nodes inserted before the first child of the current {@link Node}.\n\t* @returns {Node} - The current {@link Node}.\n\t* @example\n\t* node.prepend(someOtherNode)\n\t*/\n\tprepend (...nodes) {\n\t\tif (this.nodes) {\n\t\t\tthis.nodes.splice(0, 0, ...nodes);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t* Remove the current {@link Node} from its parent.\n\t* @returns {Node}\n\t* @example\n\t* node.remove() // returns the current node\n\t*/\n\tremove () {\n\t\tconst index = this.index;\n\n\t\tif (index !== -1) {\n\t\t\tthis.parent.nodes.splice(index, 1);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t* Replace the current {@link Node} with another Node or Nodes.\n\t* @param {...Node} nodes - Any nodes replacing the current {@link Node}.\n\t* @returns {Node} - The current {@link Node}\n\t* @example\n\t* node.replaceWith(someOtherNode) // returns the current node\n\t*/\n\treplaceWith (...nodes) {\n\t\tconst index = this.index;\n\n\t\tif (index !== -1) {\n\t\t\tthis.parent.nodes.splice(index, 1, ...nodes);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t* Transform the current {@link Node} and any descendants using visitors.\n\t* @param {Result} result - The {@link Result} to be used by visitors.\n\t* @param {Object} [overrideVisitors] - Alternative visitors to be used in place of {@link Result} visitors.\n\t* @returns {ResultPromise}\n\t* @example\n\t* await node.visit(result)\n\t* @example\n\t* await node.visit() // visit using the result of the current node\n\t* @example\n\t* await node.visit(result, {\n\t* Element () {\n\t* // do something to an element\n\t* }\n\t* })\n\t*/\n\tvisit (result, overrideVisitors) {\n\t\tconst resultToUse = 0 in arguments ? result : this.result;\n\n\t\treturn visit(this, resultToUse, overrideVisitors);\n\t}\n\n\t/**\n\t* Add a warning from the current {@link Node}.\n\t* @param {Result} result - The {@link Result} the warning is being added to.\n\t* @param {String} text - The message being sent as the warning.\n\t* @param {Object} [opts] - Additional information about the warning.\n\t* @example\n\t* node.warn(result, 'Something went wrong')\n\t* @example\n\t* node.warn(result, 'Something went wrong', {\n\t* node: someOtherNode,\n\t* plugin: someOtherPlugin\n\t* })\n\t*/\n\twarn (result, text, opts) {\n\t\tconst data = Object.assign({ node: this }, opts);\n\n\t\treturn result.warn(text, data);\n\t}\n}\n\nfunction hasNodes (node) {\n\treturn node.nodes;\n}\n\nexport default Node;\n","import Node from './Node';\n\n/**\n* @name Comment\n* @class\n* @extends Node\n* @classdesc Return a new {@link Comment} {@link Node}.\n* @param {Object|String} settings - Custom settings applied to the Comment, or the content of the {@link Comment}.\n* @param {String} settings.comment - Content of the Comment.\n* @param {Object} settings.source - Source mapping of the Comment.\n* @returns {Comment}\n* @example\n* new Comment({ comment: ' Hello World ' })\n*/\nclass Comment extends Node {\n\tconstructor (settings) {\n\t\tsuper();\n\n\t\tif (typeof settings === 'string') {\n\t\t\tsettings = { comment: settings };\n\t\t}\n\n\t\tObject.assign(this, {\n\t\t\ttype: 'comment',\n\t\t\tname: '#comment',\n\t\t\tcomment: String(Object(settings).comment || ''),\n\t\t\tsource: Object(Object(settings).source)\n\t\t});\n\t}\n\n\t/**\n\t* Return the stringified innerHTML of the current {@link Comment}.\n\t* @returns {String}\n\t* @example\n\t* attrs.innerHTML // returns ' Hello World '\n\t*/\n\tget innerHTML () {\n\t\treturn String(this.comment);\n\t}\n\n\t/**\n\t* Return the stringified outerHTML of the current {@link Comment}.\n\t* @returns {String}\n\t* @example\n\t* attrs.outerHTML // returns '<!-- Hello World -->'\n\t*/\n\tget outerHTML () {\n\t\treturn String(this);\n\t}\n\n\t/**\n\t* Return the stringified innerHTML from the source input.\n\t* @returns {String}\n\t* @example\n\t* attrs.sourceInnerHTML // returns ' Hello World '\n\t*/\n\tget sourceInnerHTML () {\n\t\treturn typeof Object(this.source.input).html !== 'string'\n\t\t\t? ''\n\t\t: this.source.input.html.slice(\n\t\t\tthis.source.startOffset + 4,\n\t\t\tthis.source.endOffset - 3\n\t\t);\n\t}\n\n\t/**\n\t* Return the stringified outerHTML from the source input.\n\t* @returns {String}\n\t* @example\n\t* attrs.sourceOuterHTML // returns '<!-- Hello World -->'\n\t*/\n\tget sourceOuterHTML () {\n\t\treturn typeof Object(this.source.input).html !== 'string'\n\t\t\t? ''\n\t\t: this.source.input.html.slice(\n\t\t\tthis.source.startOffset,\n\t\t\tthis.source.endOffset\n\t\t);\n\t}\n\n\t/**\n\t* Return a clone of the current {@link Comment}.\n\t* @param {Object} settings - Custom settings applied to the cloned {@link Comment}.\n\t* @returns {Comment} - The cloned {@link Comment}\n\t* @example\n\t* comment.clone()\n\t* @example <caption>Clone the current text with new source.</caption>\n\t* comment.clone({ source: { input: 'modified source' } })\n\t*/\n\tclone (settings) {\n\t\treturn new this.constructor(Object.assign({}, this, settings, {\n\t\t\tsource: Object.assign({}, this.source, Object(settings).source)\n\t\t}));\n\t}\n\n\t/**\n\t* Return the current {@link Comment} as a String.\n\t* @returns {String} A string version of the current {@link Comment}\n\t* @example\n\t* attrs.toJSON() // returns '<!-- Hello World -->'\n\t*/\n\ttoString () {\n\t\treturn `<!--${this.comment}-->`;\n\t}\n\n\t/**\n\t* Return the current {@link Comment} as a Object.\n\t* @returns {Object} An object version of the current {@link Comment}\n\t* @example\n\t* attrs.toJSON() // returns { comment: ' Hello World ' }\n\t*/\n\ttoJSON () {\n\t\treturn {\n\t\t\tcomment: this.comment\n\t\t};\n\t}\n}\n\nexport default Comment;\n","import Node from './Node';\n\n/**\n* @name Container\n* @class\n* @extends Node\n* @classdesc Return a new {@link Container} {@link Node}.\n* @returns {Container}\n*/\nclass Container extends Node {\n\t/**\n\t* Return the first child {@link Node} of the current {@link Container}, or `null` if there is none.\n\t* @returns {Node|Null}\n\t* @example\n\t* container.first // returns a Node or null\n\t*/\n\tget first () {\n\t\treturn this.nodes[0] || null;\n\t}\n\n\t/**\n\t* Return the first child {@link Element} of the current {@link Container}, or `null` if there is none.\n\t* @returns {Node|Null}\n\t* @example\n\t* container.firstElement // returns an Element or null\n\t*/\n\tget firstElement () {\n\t\treturn this.nodes.find(hasNodes) || null;\n\t}\n\n\t/**\n\t* Return the last child {@link Node} of the current {@link Container}, or `null` if there is none.\n\t* @returns {Node|Null}\n\t* @example\n\t* container.last // returns a Node or null\n\t*/\n\tget last () {\n\t\treturn this.nodes[this.nodes.length - 1] || null;\n\t}\n\n\t/**\n\t* Return the last child {@link Element} of the current {@link Container}, or `null` if there is none.\n\t* @returns {Node|Null}\n\t* @example\n\t* container.lastElement // returns an Element or null\n\t*/\n\tget lastElement () {\n\t\treturn this.nodes.slice().reverse().find(hasNodes) || null;\n\t}\n\n\t/**\n\t* Return a child {@link Element} {@link NodeList} of the current {@link Container}.\n\t* @returns {Array}\n\t* @example\n\t* container.elements // returns an array of Elements\n\t*/\n\tget elements () {\n\t\treturn this.nodes.filter(hasNodes) || [];\n\t}\n\n\t/**\n\t* Return the innerHTML of the current {@link Container} as a String.\n\t* @returns {String}\n\t* @example\n\t* container.innerHTML // returns a string of innerHTML\n\t*/\n\tget innerHTML () {\n\t\treturn this.nodes.innerHTML;\n\t}\n\n\t/**\n\t* Define the nodes of the current {@link Container} from a String.\n\t* @param {String} innerHTML - Source being processed.\n\t* @returns {Void}\n\t* @example\n\t* container.innerHTML = 'Hello <strong>world</strong>';\n\t* container.nodes.length; // 2\n\t*/\n\tset innerHTML (innerHTML) {\n\t\tthis.nodes.innerHTML = innerHTML;\n\t}\n\n\t/**\n\t* Return the outerHTML of the current {@link Container} as a String.\n\t* @returns {String}\n\t* @example\n\t* container.outerHTML // returns a string of outerHTML\n\t*/\n\tget outerHTML () {\n\t\treturn this.nodes.innerHTML;\n\t}\n\n\t/**\n\t* Replace the current {@link Container} from a String.\n\t* @param {String} input - Source being processed.\n\t* @returns {Void}\n\t* @example\n\t* container.outerHTML = 'Hello <strong>world</strong>';\n\t*/\n\tset outerHTML (outerHTML) {\n\t\tconst Result = Object(this.result).constructor;\n\n\t\tif (Result) {\n\t\t\tconst childNodes = new Result(outerHTML).root.nodes;\n\n\t\t\tthis.replaceWith(...childNodes);\n\t\t}\n\t}\n\n\t/**\n\t* Return the stringified innerHTML from the source input.\n\t* @returns {String}\n\t*/\n\tget sourceInnerHTML () {\n\t\treturn this.isSelfClosing || this.isVoid || typeof Object(this.source.input).html !== 'string'\n\t\t\t? ''\n\t\t: 'startInnerOffset' in this.source && 'endInnerOffset' in this.source\n\t\t\t? this.source.input.html.slice(\n\t\t\t\tthis.source.startInnerOffset,\n\t\t\t\tthis.source.endInnerOffset\n\t\t\t)\n\t\t: this.sourceOuterHTML;\n\t}\n\n\t/**\n\t* Return the stringified outerHTML from the source input.\n\t* @returns {String}\n\t*/\n\tget sourceOuterHTML () {\n\t\treturn typeof Object(this.source.input).html !== 'string'\n\t\t\t? ''\n\t\t: this.source.input.html.slice(\n\t\t\tthis.source.startOffset,\n\t\t\tthis.source.endOffset\n\t\t);\n\t}\n\n\t/**\n\t* Return the text content of the current {@link Container} as a String.\n\t* @returns {String}\n\t*/\n\tget textContent () {\n\t\treturn this.nodes.textContent;\n\t}\n\n\t/**\n\t* Define the content of the current {@link Container} as a new {@link Text} {@link Node}.\n\t* @returns {String}\n\t*/\n\tset textContent (textContent) {\n\t\tthis.nodes.textContent = textContent;\n\t}\n\n\t/**\n\t* Return a child {@link Node} of the current {@link Container} by last index, or `null` if there is none.\n\t* @returns {Node|Null}\n\t* @example\n\t* container.lastNth(0) // returns a Node or null\n\t*/\n\tlastNth (index) {\n\t\treturn this.nodes.slice().reverse()[index] || null;\n\t}\n\n\t/**\n\t* Return a child {@link Element} of the current {@link Container} by last index, or `null` if there is none.\n\t* @returns {Element|Null}\n\t* @example\n\t* container.lastNthElement(0) // returns an Element or null\n\t*/\n\tlastNthElement (index) {\n\t\treturn this.elements.reverse()[index] || null;\n\t}\n\n\t/**\n\t* Return a child {@link Node} of the current {@link Container} by index, or `null` if there is none.\n\t* @returns {Node|Null}\n\t* @example\n\t* container.nth(0) // returns a Node or null\n\t*/\n\tnth (index) {\n\t\treturn this.nodes[index] || null;\n\t}\n\n\t/**\n\t* Return an {@link Element} child of the current Container by index, or `null` if there is none.\n\t* @returns {Element|Null}\n\t* @example\n\t* container.nthElement(0) // returns an Element or null\n\t*/\n\tnthElement (index) {\n\t\treturn this.elements[index] || null;\n\t}\n\n\t/**\n\t* Replace all of the children of the current {@link Container}.\n\t* @param {...Node} nodes - Any nodes replacing the current children of the {@link Container}.\n\t* @returns {Container} - The current {@link Container}.\n\t* @example\n\t* container.replaceAll(new Text({ data: 'Hello World' }))\n\t*/\n\treplaceAll (...nodes) {\n\t\tif (this.nodes) {\n\t\t\tthis.nodes.splice(0, this.nodes.length, ...nodes);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t* Traverse the descendant {@link Node}s of the current {@link Container} with a callback function.\n\t* @param {Function|String|RegExp} callback_or_filter - A callback function, or a filter to reduce {@link Node}s the callback is applied to.\n\t* @param {Function|String|RegExp} callback - A callback function when a filter is also specified.\n\t* @returns {Container} - The current {@link Container}.\n\t* @example\n\t* container.walk(node => {\n\t* console.log(node);\n\t* })\n\t* @example\n\t* container.walk('*', node => {\n\t* console.log(node);\n\t* })\n\t* @example <caption>Walk only \"section\" {@link Element}s.</caption>\n\t* container.walk('section', node => {\n\t* console.log(node); // logs only Section Elements\n\t* })\n\t* @example\n\t* container.walk(/^section$/, node => {\n\t* console.log(node); // logs only Section Elements\n\t* })\n\t* @example\n\t* container.walk(\n\t* node => node.name.toLowerCase() === 'section',\n\t* node => {\n\t* console.log(node); // logs only Section Elements\n\t* })\n\t* @example <caption>Walk only {@link Text}.</caption>\n\t* container.walk('#text', node => {\n\t* console.log(node); // logs only Text Nodes\n\t* })\n\t*/\n\twalk () {\n\t\tconst [ cb, filter ] = getCbAndFilterFromArgs(arguments);\n\n\t\twalk(this, cb, filter);\n\n\t\treturn this;\n\t}\n}\n\nfunction walk (node, cb, filter) {\n\tif (typeof cb === 'function' && node.nodes) {\n\t\tnode.nodes.slice(0).forEach(child => {\n\t\t\tif (Object(child).parent === node) {\n\t\t\t\tif (testWithFilter(child, filter)) {\n\t\t\t\t\tcb(child); // eslint-disable-line callback-return\n\t\t\t\t}\n\n\t\t\t\tif (child.nodes) {\n\t\t\t\t\twalk(child, cb, filter);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n\nfunction getCbAndFilterFromArgs (args) {\n\tconst [ cbOrFilter, onlyCb ] = args;\n\tconst cb = onlyCb || cbOrFilter;\n\tconst filter = onlyCb ? cbOrFilter : undefined;\n\n\treturn [cb, filter];\n}\n\nfunction testWithFilter (node, filter) {\n\tif (!filter) {\n\t\treturn true;\n\t} else if (filter === '*') {\n\t\treturn Object(node).constructor.name === 'Element';\n\t} else if (typeof filter === 'string') {\n\t\treturn node.name === filter;\n\t} else if (filter instanceof RegExp) {\n\t\treturn filter.test(node.name);\n\t} else if (filter instanceof Function) {\n\t\treturn filter(node);\n\t} else {\n\t\treturn false;\n\t}\n}\n\nfunction hasNodes (node) {\n\treturn node.nodes;\n}\n\nexport default Container;\n","import Node from './Node';\n\n/**\n* @name Doctype\n* @class\n* @extends Node\n* @classdesc Create a new {@link Doctype} {@link Node}.\n* @param {Object|String} settings - Custom settings applied to the {@link Doctype}, or the name of the {@link Doctype}.\n* @param {String} settings.name - Name of the {@link Doctype}.\n* @param {String} settings.publicId - Public identifier portion of the {@link Doctype}.\n* @param {String} settings.systemId - System identifier portion of the {@link Doctype}.\n* @param {Object} settings.source - Source mapping of the {@link Doctype}.\n* @returns {Doctype}\n* @example\n* new Doctype({ name: 'html' }) // <!doctype html>\n*/\nclass Doctype extends Node {\n\tconstructor (settings) {\n\t\tsuper();\n\n\t\tif (typeof settings === 'string') {\n\t\t\tsettings = { name: settings };\n\t\t}\n\n\t\tObject.assign(this, {\n\t\t\ttype: 'doctype',\n\t\t\tdoctype: String(Object(settings).doctype || 'doctype'),\n\t\t\tname: String(Object(settings).name || 'html'),\n\t\t\tpublicId: Object(settings).publicId || null,\n\t\t\tsystemId: Object(settings).systemId || null,\n\t\t\tsource: Object.assign({\n\t\t\t\tbefore: Object(Object(settings).source).before || ' ',\n\t\t\t\tafter: Object(Object(settings).source).after || '',\n\t\t\t\tbeforePublicId: Object(Object(settings).source).beforePublicId || null,\n\t\t\t\tbeforeSystemId: Object(Object(settings).source).beforeSystemId || null\n\t\t\t}, Object(settings).source)\n\t\t});\n\t}\n\n\t/**\n\t* Return a clone of the current {@link Doctype}.\n\t* @param {Object} settings - Custom settings applied to the cloned {@link Doctype}.\n\t* @returns {Doctype} - The cloned {@link Doctype}\n\t* @example\n\t* doctype.clone()\n\t* @example <caption>Clone the current text with new source.</caption>\n\t* doctype.clone({ source: { input: 'modified source' } })\n\t*/\n\tclone (settings) {\n\t\treturn new this.constructor(Object.assign({}, this, settings, {\n\t\t\tsource: Object.assign({}, this.source, Object(settings).source)\n\t\t}));\n\t}\n\n\t/**\n\t* Return the current {@link Doctype} as a String.\n\t* @returns {String}\n\t*/\n\ttoString () {\n\t\tconst publicId = this.publicId ? `${this.source.beforePublicId || ' '}${this.publicId}` : '';\n\t\tconst systemId = this.systemId ? `${this.source.beforeSystemId || ' '}${this.systemId}` : '';\n\n\t\treturn `<!${this.doctype}${this.source.before}${this.name}${this.source.after}${publicId}${systemId}>`;\n\t}\n\n\t/**\n\t* Return the current {@link Doctype} as an Object.\n\t* @returns {Object}\n\t*/\n\ttoJSON () {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tpublicId: this.publicId,\n\t\t\tsystemId: this.systemId\n\t\t};\n\t}\n}\n\nexport default Doctype;\n","import Container from './Container';\nimport NodeList from './NodeList';\n\n/**\n* @name Fragment\n* @class\n* @extends Container\n* @classdesc Create a new {@link Fragment} {@Link Node}.\n* @param {Object} settings - Custom settings applied to the {@link Fragment}.\n* @param {Array|NodeList} settings.nodes - Nodes appended to the {@link Fragment}.\n* @param {Object} settings.source - Source mapping of the {@link Fragment}.\n* @returns {Fragment}\n* @example\n* new Fragment() // returns an empty fragment\n*\n* new Fragment({ nodes: [ new Element('span') ] }) // returns a fragment with a <span>\n*/\n\nclass Fragment extends Container {\n\tconstructor (settings) {\n\t\tsuper();\n\n\t\tObject.assign(this, settings, {\n\t\t\ttype: 'fragment',\n\t\t\tname: '#document-fragment',\n\t\t\tnodes: Array.isArray(Object(settings).nodes)\n\t\t\t\t? new NodeList(this, ...Array.from(settings.nodes))\n\t\t\t: Object(settings).nodes !== null && Object(settings).nodes !== undefined\n\t\t\t\t? new NodeList(this, settings.nodes)\n\t\t\t: new NodeList(this),\n\t\t\tsource: Object(Object(settings).source)\n\t\t});\n\t}\n\n\t/**\n\t* Return a clone of the current {@link Fragment}.\n\t* @param {Boolean} isDeep - Whether the descendants of the current Fragment should also be cloned.\n\t* @returns {Fragment} - The cloned Fragment\n\t*/\n\tclone (isDeep) {\n\t\tconst clone = new Fragment({ ...this, nodes: [] });\n\n\t\tif (isDeep) {\n\t\t\tclone.nodes = this.nodes.clone(clone);\n\t\t}\n\n\t\treturn clone;\n\t}\n\n\t/**\n\t* Return the current {@link Fragment} as an Array.\n\t* @returns {Array}\n\t* @example\n\t* fragment.toJSON() // returns []\n\t*/\n\ttoJSON () {\n\t\treturn this.nodes.toJSON();\n\t}\n\n\t/**\n\t* Return the current {@link Fragment} as a String.\n\t* @returns {String}\n\t* @example\n\t* fragment.toJSON() // returns ''\n\t*/\n\ttoString () {\n\t\treturn String(this.nodes);\n\t}\n}\n\nexport default Fragment;\n","import Node from './Node';\n\n/**\n* @name Text\n* @class\n* @extends Node\n* @classdesc Create a new {@link Text} {@link Node}.\n* @param {Object|String} settings - Custom settings applied to the {@link Text}, or the content of the {@link Text}.\n* @param {String} settings.data - Content of the {@link Text}.\n* @param {Object} settings.source - Source mapping of the {@link Text}.\n* @returns {Text}\n* @example\n* new Text({ data: 'Hello World' })\n*/\nclass Text extends Node {\n\tconstructor (settings) {\n\t\tsuper();\n\n\t\tif (typeof settings === 'string') {\n\t\t\tsettings = { data: settings };\n\t\t}\n\n\t\tObject.assign(this, {\n\t\t\ttype: 'text',\n\t\t\tname: '#text',\n\t\t\tdata: String(Object(settings).data || ''),\n\t\t\tsource: Object(Object(settings).source)\n\t\t});\n\t}\n\n\t/**\n\t* Return the stringified innerHTML from the source input.\n\t* @returns {String}\n\t*/\n\tget sourceInnerHTML () {\n\t\treturn typeof Object(this.source.input).html !== 'string'\n\t\t\t? ''\n\t\t: this.source.input.html.slice(\n\t\t\tthis.source.startOffset,\n\t\t\tthis.source.endOffset\n\t\t);\n\t}\n\n\t/**\n\t* Return the stringified outerHTML from the source input.\n\t* @returns {String}\n\t*/\n\tget sourceOuterHTML () {\n\t\treturn typeof Object(this.source.input).html !== 'string'\n\t\t\t? ''\n\t\t: this.source.input.html.slice(\n\t\t\tthis.source.startOffset,\n\t\t\tthis.source.endOffset\n\t\t);\n\t}\n\n\t/**\n\t* Return the current {@link Text} as a String.\n\t* @returns {String}\n\t* @example\n\t* text.textContent // returns ''\n\t*/\n\tget textContent () {\n\t\treturn String(this.data);\n\t}\n\n\t/**\n\t* Define the current {@link Text} from a String.\n\t* @returns {Void}\n\t* @example\n\t* text.textContent = 'Hello World'\n\t* text.textContent // 'Hello World'\n\t*/\n\tset textContent (textContent) {\n\t\tthis.data = String(textContent);\n\t}\n\n\t/**\n\t* Return a clone of the current {@link Text}.\n\t* @param {Object} settings - Custom settings applied to the cloned {@link Text}.\n\t* @returns {Text} - The cloned {@link Text}\n\t* @example\n\t* text.clone()\n\t* @example <caption>Clone the current text with new source.</caption>\n\t* text.clone({ source: { input: 'modified source' } })\n\t*/\n\tclone (settings) {\n\t\treturn new Text(Object.assign({}, this, settings, {\n\t\t\tsource: Object.assign({}, this.source, Object(settings).source)\n\t\t}));\n\t}\n\n\t/**\n\t* Return the current {@link Text} as a String.\n\t* @returns {String}\n\t* @example\n\t* text.toString() // returns ''\n\t*/\n\ttoString () {\n\t\treturn String(this.data);\n\t}\n\n\t/**\n\t* Return the current {@link Text} as a String.\n\t* @returns {String}\n\t* @example\n\t* text.toJSON() // returns ''\n\t*/\n\ttoJSON () {\n\t\treturn String(this.data);\n\t}\n}\n\nexport default Text;\n","import Comment from './Comment';\nimport Doctype from './Doctype';\nimport Element from './Element';\nimport Fragment from './Fragment';\nimport Node from './Node';\nimport Text from './Text';\n\nexport default function normalize (node) {\n\tconst nodeTypes = {\n\t\tcomment: Comment,\n\t\tdoctype: Doctype,\n\t\telement: Element,\n\t\tfragment: Fragment,\n\t\ttext: Text\n\t};\n\n\treturn node instanceof Node\n\t\t// Nodes are unchanged\n\t\t? node\n\t: node.type in nodeTypes\n\t\t// Strings are converted into Text nodes\n\t\t? new nodeTypes[node.type](node)\n\t// Node-like Objects with recognized types are normalized\n\t: new Text({ data: String(node) })\n}\n","import Fragment from './Fragment';\nimport Text from './Text';\nimport normalize from './normalize';\n\n// weak map of the parents of NodeLists\nconst parents = new WeakMap();\n\n/**\n* @name NodeList\n* @class\n* @extends Array\n* @classdesc Create a new {@link NodeList}.\n* @param {Container} parent - Parent containing the current {@link NodeList}.\n* @param {...Node} nodes - {@link Node}s belonging to the current {@link NodeList}.\n* @returns {NodeList}\n*/\nclass NodeList extends Array {\n\tconstructor (parent, ...nodes) {\n\t\tsuper();\n\n\t\tparents.set(this, parent);\n\n\t\tif (nodes.length) {\n\t\t\tthis.push(...nodes);\n\t\t}\n\t}\n\n\t/**\n\t* Return the innerHTML of the current {@link Container} as a String.\n\t* @returns {String}\n\t* @example\n\t* container.innerHTML // returns a string of innerHTML\n\t*/\n\tget innerHTML () {\n\t\treturn this.map(\n\t\t\tnode => node.type === 'text'\n\t\t\t\t? getInnerHtmlEncodedString(node.data)\n\t\t\t: 'outerHTML' in node\n\t\t\t\t? node.outerHTML\n\t\t\t: String(node)\n\t\t).join('');\n\t}\n\n\t/**\n\t* Define the nodes of the current {@link NodeList} from a String.\n\t* @param {String} innerHTML - Source being processed.\n\t* @returns {Void}\n\t* @example\n\t* nodeList.innerHTML = 'Hello <strong>world</strong>';\n\t* nodeList.length; // 2\n\t*/\n\tset innerHTML (innerHTML) {\n\t\tconst parent = this.parent;\n\n\t\tconst Result = Object(parent.result).constructor\n\n\t\tif (Result) {\n\t\t\tconst nodes = new Result(innerHTML).root.nodes;\n\n\t\t\tthis.splice(0, this.length, ...nodes);\n\t\t}\n\t}\n\n\t/**\n\t* Return the parent of the current {@link NodeList}.\n\t* @returns {Container}\n\t*/\n\tget parent () {\n\t\treturn parents.get(this);\n\t}\n\n\t/**\n\t* Return the text content of the current {@link NodeList} as a String.\n\t* @returns {String}\n\t*/\n\tget textContent () {\n\t\treturn this.map(\n\t\t\tnode => Object(node).textContent || ''\n\t\t).join('');\n\t}\n\n\t/**\n\t* Define the content of the current {@link NodeList} as a new {@link Text} {@link Node}.\n\t* @returns {String}\n\t*/\n\tset textContent (textContent) {\n\t\tthis.splice(0, this.length, new Text({ data: textContent }));\n\t}\n\n\t/**\n\t* Return a clone of the current {@link NodeList}.\n\t* @param {Object} parent - New parent containing the cloned {@link NodeList}.\n\t* @returns {NodeList} - The cloned NodeList\n\t*/\n\tclone (parent) {\n\t\treturn new NodeList(parent, ...this.map(node => node.clone({}, true)));\n\t}\n\n\t/**\n\t* Remove and return the last {@link Node} in the {@link NodeList}.\n\t* @returns {Node}\n\t*/\n\tpop () {\n\t\tconst [ remove ] = this.splice(this.length - 1, 1);\n\n\t\treturn remove;\n\t}\n\n\t/**\n\t* Add {@link Node}s to the end of the {@link NodeList} and return the new length of the {@link NodeList}.\n\t* @returns {Number}\n\t*/\n\tpush (...nodes) {\n\t\tconst parent = this.parent;\n\t\tconst inserts = nodes.filter(node => node !== parent);\n\n\t\tthis.splice(this.length, 0, ...inserts);\n\n\t\treturn this.length;\n\t}\n\n\t/**\n\t* Remove and return the first {@link Node} in the {@link NodeList}.\n\t* @returns {Node}\n\t*/\n\tshift () {\n\t\tconst [ remove ] = this.splice(0, 1);\n\n\t\treturn remove;\n\t}\n\n\t/**\n\t* Add and remove {@link Node}s to and from the {@link NodeList}.\n\t* @returns {Array}\n\t*/\n\tsplice (start, ...args) {\n\t\tconst { length, parent } = this;\n\t\tconst startIndex = start > length ? length : start < 0 ? Math.max(length + start, 0) : Number(start) || 0;\n\t\tconst deleteCount = 0 in args ? Number(args[0]) || 0 : length;\n\t\tconst inserts = getNodeListArray(args.slice(1).filter(node => node !== parent));\n\n\t\tfor (let insert of inserts) {\n\t\t\tinsert.remove();\n\n\t\t\tinsert.parent = parent;\n\t\t}\n\n\t\tconst removes = Array.prototype.splice.call(this, startIndex, deleteCount, ...inserts);\n\n\t\tfor (let remove of removes) {\n\t\t\tdelete remove.parent;\n\t\t}\n\n\t\treturn removes;\n\t}\n\n\t/**\n\t* Add {@link Node}s to the beginning of the {@link NodeList} and return the new length of the {@link NodeList}.\n\t* @returns {Number}\n\t*/\n\tunshift (...nodes) {\n\t\tconst parent = this.parent;\n\t\tconst inserts = nodes.filter(node => node !== parent);\n\n\t\tthis.splice(0, 0, ...inserts);\n\n\t\treturn this.length;\n\t}\n\n\t/**\n\t* Return the current {@link NodeList} as a String.\n\t* @returns {String}\n\t* @example\n\t* nodeList.toString() // returns ''\n\t*/\n\ttoString () {\n\t\treturn this.join('');\n\t}\n\n\t/**\n\t* Return the current {@link NodeList} as an Array.\n\t* @returns {Array}\n\t* @example\n\t* nodeList.toJSON() // returns []\n\t*/\n\ttoJSON () {\n\t\treturn Array.from(this).map(node => node.toJSON());\n\t}\n\n\t/**\n\t* Return a new {@link NodeList} from an object.\n\t* @param {Array|Node} nodes - An array or object of nodes.\n\t* @returns {NodeList} A new {@link NodeList}\n\t* @example <caption>Return a NodeList from an array of text.</caption>\n\t* NodeList.from([ 'test' ]) // returns NodeList [ Text { data: 'test' } ]\n\t*/\n\n\tstatic from (nodes) {\n\t\treturn new NodeList(new Fragment(), ...getNodeListArray(nodes));\n\t}\n}\n\nexport default NodeList;\n\n/**\n* Return an NodeList-compatible array from an array.\n* @private\n*/\n\nfunction getNodeListArray (nodes) {\n\t// coerce nodes into an array\n\treturn Object(nodes).length\n\t\t? Array.from(nodes).filter(\n\t\t\tnode => node != null\n\t\t).map(normalize)\n\t: [];\n}\n\n/**\n* Return an innerHTML-encoded string.\n* @private\n*/\n\nfunction getInnerHtmlEncodedString (string) {\n\treturn string.replace(\n\t\t/&|<|>/g,\n\t\tmatch => match === '&'\n\t\t\t? '&amp;'\n\t\t: match === '<'\n\t\t\t? '&lt;'\n\t\t: '&gt;'\n\t);\n}\n","import defaultTreeAdapter from 'parse5/lib/tree-adapters/default';\n\n// patch defaultTreeAdapter.isElementNode to support element fragments\ndefaultTreeAdapter.isElementNode = node => 'tagName' in node;\n\n// patch defaultTreeAdapter.createCommentNode to support doctype nodes\ndefaultTreeAdapter.createCommentNode = function createCommentNode (data) {\n\treturn typeof data === 'string' ? {\n\t\tnodeName: '#comment',\n\t\tdata,\n\t\tparentNode: null\n\t} : Object.assign({\n\t\tnodeName: '#documentType',\n\t\tname: data\n\t}, data);\n}\n\nexport default defaultTreeAdapter;\n","import Tokenizer from 'parse5/lib/tokenizer';\n\n// patch _createDoctypeToken to support loose doctype nodes\nTokenizer.prototype._createDoctypeToken = function _createDoctypeToken () {\n\tconst doctypeRegExp = /^(doctype)(\\s+)(html)(?:(\\s+)(public\\s+([\"']).*?\\6))?(?:(\\s+)(([\"']).*\\9))?(\\s*)/i;\n\tconst doctypeStartRegExp = /doctype\\s*$/i;\n\tconst offset = this.preprocessor.html.slice(0, this.preprocessor.pos).match(doctypeStartRegExp, '')[0].length;\n\tconst innerHTML = this.preprocessor.html.slice(this.preprocessor.pos - offset);\n\tconst [, doctype, before, name, beforePublicId, publicId, , beforeSystemId, systemId, , after] = Object(innerHTML.match(doctypeRegExp));\n\n\tthis.currentToken = {\n\t\ttype: Tokenizer.COMMENT_TOKEN,\n\t\tdata: {\n\t\t\tdoctype,\n\t\t\tname,\n\t\t\tpublicId,\n\t\t\tsystemId,\n\t\t\tsource: {\n\t\t\t\tbefore,\n\t\t\t\tbeforePublicId,\n\t\t\t\tbeforeSystemId,\n\t\t\t\tafter\n\t\t\t}\n\t\t},\n\t\tforceQuirks: false,\n\t\tpublicId: null,\n\t\tsystemId: null\n\t};\n};\n\n// patch _createAttr to include the start offset position for name\nTokenizer.prototype._createAttr = function _createAttr (attrNameFirstCh) {\n\tthis.currentAttr = {\n\t\tname: attrNameFirstCh,\n\t\tvalue: '',\n\t\tstartName: this.preprocessor.pos\n\t};\n};\n\n// patch _leaveAttrName to support duplicate attributes\nTokenizer.prototype._leaveAttrName = function _leaveAttrName (toState) {\n\tconst startName = this.currentAttr.startName;\n\tconst endName = this.currentAttr.endName = this.preprocessor.pos;\n\n\tthis.currentToken.attrs.push(this.currentAttr);\n\n\tconst before = this.preprocessor.html.slice(0, startName).match(/\\s*$/)[0];\n\n\tthis.currentAttr.raw = {\n\t\tname: this.preprocessor.html.slice(startName, endName),\n\t\tvalue: null,\n\t\tsource: { startName, endName, startValue: null, endValue: null, before, quote: '' }\n\t};\n\n\tthis.state = toState;\n};\n\n// patch _leaveAttrValue to include the offset end position for value\nTokenizer.prototype._leaveAttrValue = function _leaveAttrValue (toState) {\n\tconst startValue = this.currentAttr.endName + 1;\n\tconst endValue = this.preprocessor.pos;\n\tconst quote = endValue - this.currentAttr.value.length === startValue\n\t\t? ''\n\t: this.preprocessor.html[startValue];\n\n\tconst currentAttrValue = this.preprocessor.html.slice(\n\t\tstartValue + quote.length,\n\t\tendValue - quote.length\n\t);\n\n\tthis.currentAttr.raw.value = currentAttrValue;\n\tthis.currentAttr.raw.source.startValue = startValue;\n\tthis.currentAttr.raw.source.endValue = endValue;\n\tthis.currentAttr.raw.source.quote = quote;\n\n\tthis.state = toState;\n};\n\n// patch TAG_OPEN_STATE to support jsx-style fragments\nconst originalTAG_OPEN_STATE = Tokenizer.prototype.TAG_OPEN_STATE;\n\nTokenizer.prototype.TAG_OPEN_STATE = function TAG_OPEN_STATE (cp) {\n\tconst isReactOpeningElement = this.preprocessor.html.slice(this.preprocessor.pos - 1, this.preprocessor.pos + 1) === '<>';\n\tconst isReactClosingElement = this.preprocessor.html.slice(this.preprocessor.pos - 1, this.preprocessor.pos + 2) === '</>';\n\n\tif (isReactOpeningElement) {\n\t\tthis._createStartTagToken();\n\t\tthis._reconsumeInState('TAG_NAME_STATE');\n\t} else if (isReactClosingElement) {\n\t\tthis._createEndTagToken();\n\t\tthis._reconsumeInState('TAG_NAME_STATE');\n\t} else {\n\t\toriginalTAG_OPEN_STATE.call(this, cp);\n\t}\n};\n\nexport default Tokenizer;\n","import HTMLParser from 'parse5/lib/parser';\nimport treeAdapter from './parseHTMLTreeAdapter';\nimport Tokenizer from './parseHTMLTokenizer';\n\nfunction parseLoose (html, parseOpts) {\n\tthis.tokenizer = new Tokenizer(this.options);\n\tconst document = treeAdapter.createDocumentFragment();\n\tconst template = treeAdapter.createDocumentFragment();\n\tthis._bootstrap(document, template);\n\tthis._pushTmplInsertionMode('IN_TEMPLATE_MODE');\n\tthis._initTokenizerForFragmentParsing();\n\tthis._insertFakeRootElement();\n\tthis.tokenizer.write(html, true);\n\tthis._runParsingLoop(null);\n\n\tdocument.childNodes = filter(document.childNodes, parseOpts);\n\n\treturn document;\n}\n\nexport default function parseHTML (input, parseOpts) {\n\tconst htmlParser = new HTMLParser({\n\t\ttreeAdapter,\n\t\tsourceCodeLocationInfo: true\n\t});\n\n\treturn parseLoose.call(htmlParser, input, parseOpts);\n}\n\n// filter out generated elements\nfunction filter (childNodes, parseOpts) {\n\treturn childNodes.reduce(\n\t\t(nodes, childNode) => {\n\t\t\tconst isVoidElement = parseOpts.voidElements.includes(childNode.nodeName);\n\n\t\t\tconst grandChildNodes = childNode.childNodes\n\t\t\t\t? filter(childNode.childNodes, parseOpts)\n\t\t\t: [];\n\n\t\t\t// filter child nodes\n\t\t\tif (isVoidElement) {\n\t\t\t\tdelete childNode.childNodes;\n\t\t\t} else {\n\t\t\t\tchildNode.childNodes = grandChildNodes;\n\t\t\t}\n\n\t\t\t// push nodes with source\n\t\t\tif (childNode.sourceCodeLocation) {\n\t\t\t\tnodes.push(childNode);\n\t\t\t}\n\n\t\t\tif (!childNode.sourceCodeLocation || !childNode.childNodes) {\n\t\t\t\tnodes.push(...grandChildNodes);\n\t\t\t}\n\n\t\t\treturn nodes;\n\t\t},\n\t\t[]\n\t);\n}\n","import normalize from './normalize';\nimport parseHTML from './parseHTML';\nimport treeAdapter from './parseHTMLTreeAdapter';\nimport Comment from './Comment';\nimport Doctype from './Doctype';\nimport Element from './Element';\nimport Fragment from './Fragment';\nimport Text from './Text';\nimport visit, { getVisitors } from './visit';\n\n/**\n* @name Result\n* @class\n* @classdesc Create a new syntax tree {@link Result} from a processed input.\n* @param {Object} processOptions - Custom settings applied to the {@link Result}.\n* @param {String} processOptions.from - Source input location.\n* @param {String} processOptions.to - Destination output location.\n* @param {Array} processOptions.voidElements - Void elements.\n* @returns {Result}\n* @property {Result} result - Result of pHTML transformations.\n* @property {String} result.from - Path to the HTML source file. You should always set from, because it is used in source map generation and syntax error messages.\n* @property {String} result.to - Path to the HTML output file.\n* @property {Fragment} result.root - Object representing the parsed nodes of the HTML file.\n* @property {Array} result.messages - List of the messages gathered during transformations.\n* @property {Array} result.voidElements - List of the elements that only have a start tag, as they cannot have any content.\n*/\nclass Result {\n\tconstructor (html, processOptions) {\n\t\t// the \"to\" and \"from\" locations are always string values\n\t\tconst from = 'from' in Object(processOptions) && processOptions.from !== undefined && processOptions.from !== null\n\t\t\t? String(processOptions.from)\n\t\t: '';\n\t\tconst to = 'to' in Object(processOptions) && processOptions.to !== undefined && processOptions.to !== null\n\t\t\t? String(processOptions.to)\n\t\t: from;\n\t\tconst voidElements = 'voidElements' in Object(processOptions)\n\t\t\t? [].concat(Object(processOptions).voidElements || [])\n\t\t: Result.voidElements;\n\n\t\t// prepare visitors (which may be functions or visitors)\n\t\tconst visitors = getVisitors(Object(processOptions).visitors);\n\n\t\t// prepare the result object\n\t\tObject.assign(this, {\n\t\t\ttype: 'result',\n\t\t\tfrom,\n\t\t\tto,\n\t\t\tinput: { html, from, to },\n\t\t\troot: null,\n\t\t\tvoidElements,\n\t\t\tvisitors,\n\t\t\tmessages: []\n\t\t});\n\n\t\t// parse the html and transform it into nodes\n\t\tconst documentFragment = parseHTML(html, { voidElements });\n\n\t\tthis.root = transform(documentFragment, this);\n\t}\n\n\t/**\n\t* Current {@link Root} as a String.\n\t* @returns {String}\n\t*/\n\tget html () {\n\t\treturn String(this.root);\n\t}\n\n\t/**\n\t* Messages that are warnings.\n\t* @returns {String}\n\t*/\n\tget warnings () {\n\t\treturn this.messages.filter(message => Object(message).type === 'warning');\n\t}\n\n\t/**\n\t* Return a normalized node whose instances match the current {@link Result}.\n\t* @param {Node} [node] - the node to be normalized.\n\t* @returns {Node}\n\t* @example\n\t* result.normalize(someNode)\n\t*/\n\tnormalize (node) {\n\t\treturn normalize(node);\n\t}\n\n\t/**\n\t* The current {@link Root} as an Object.\n\t* @returns {Object}\n\t*/\n\ttoJSON () {\n\t\treturn this.root.toJSON();\n\t}\n\n\t/**\n\t* Transform the current {@link Node} and any descendants using visitors.\n\t* @param {Node} node - The {@link Node} to be visited.\n\t* @param {Object} [overrideVisitors] - Alternative visitors to be used in place of {@link Result} visitors.\n\t* @returns {ResultPromise}\n\t* @example\n\t* await result.visit(someNode)\n\t* @example\n\t* await result.visit() // visit using the root of the current result\n\t* @example\n\t* await result.visit(root, {\n\t* Element () {\n\t* // do something to an element\n\t* }\n\t* })\n\t*/\n\tvisit (node, overrideVisitors) {\n\t\tconst nodeToUse = 0 in arguments ? node : this.root;\n\n\t\treturn visit(nodeToUse, this, overrideVisitors);\n\t}\n\n\t/**\n\t* Add a warning to the current {@link Root}.\n\t* @param {String} text - The message being sent as the warning.\n\t* @param {Object} [opts] - Additional information about the warning.\n\t* @example\n\t* result.warn('Something went wrong')\n\t* @example\n\t* result.warn('Something went wrong', {\n\t* node: someNode,\n\t* plugin: somePlugin\n\t* })\n\t*/\n\twarn (text, rawopts) {\n\t\tconst opts = Object(rawopts);\n\n\t\tif (!opts.plugin) {\n\t\t\tif (Object(this.currentPlugin).name) {\n\t\t\t\topts.plugin = this.currentPlugin.name\n\t\t\t}\n\t\t}\n\n\t\tthis.messages.push({ type: 'warning', text, opts });\n\t}\n\n\tstatic voidElements = [\n\t\t'area',\n\t\t'base',\n\t\t'br',\n\t\t'col',\n\t\t'command',\n\t\t'embed',\n\t\t'hr',\n\t\t'img',\n\t\t'input',\n\t\t'keygen',\n\t\t'link',\n\t\t'meta',\n\t\t'param',\n\t\t'source',\n\t\t'track',\n\t\t'wbr'\n\t];\n}\n\nfunction transform (node, result) {\n\tconst hasSource = node.sourceCodeLocation === Object(node.sourceCodeLocation);\n\tconst source = hasSource\n\t\t? {\n\t\t\tstartOffset: node.sourceCodeLocation.startOffset,\n\t\t\tendOffset: node.sourceCodeLocation.endOffset,\n\t\t\tstartInnerOffset: Object(node.sourceCodeLocation.startTag).endOffset || node.sourceCodeLocation.startOffset,\n\t\t\tendInnerOffset: Object(node.sourceCodeLocation.endTag).startOffset || node.sourceCodeLocation.endOffset,\n\t\t\tinput: result.input\n\t\t}\n\t: {\n\t\tstartOffset: 0,\n\t\tstartInnerOffset: 0,\n\t\tendInnerOffset: result.input.html.length,\n\t\tendOffset: result.input.html.length,\n\t\tinput: result.input\n\t};\n\n\tif (Object(node.sourceCodeLocation).startTag) {\n\t\tsource.before = result.input.html.slice(source.startOffset, source.startInnerOffset - 1).match(/\\s*\\/?$/)[0]\n\t}\n\n\tif (Object(node.sourceCodeLocation).endTag) {\n\t\tsource.after = result.input.html.slice(source.endInnerOffset + 2 + node.nodeName.length, source.endOffset - 1)\n\t}\n\n\tconst $node = treeAdapter.isCommentNode(node)\n\t\t? new Comment({ comment: node.data, source, result })\n\t: treeAdapter.isDocumentTypeNode(node)\n\t\t? new Doctype(Object.assign(node, { result, source: Object.assign({}, node.source, source) }))\n\t: treeAdapter.isElementNode(node)\n\t\t? new Element({\n\t\t\tname: result.input.html.slice(source.startOffset + 1, source.startOffset + 1 + node.nodeName.length),\n\t\t\tattrs: node.attrs.map(attr => attr.raw),\n\t\t\tnodes: node.childNodes instanceof Array ? node.childNodes.map(child => transform(child, result)) : null,\n\t\t\tisSelfClosing: /\\//.test(source.before),\n\t\t\tisWithoutEndTag: !Object(node.sourceCodeLocation).endTag,\n\t\t\tisVoid: result.voidElements.includes(node.tagName),\n\t\t\tresult,\n\t\t\tsource\n\t\t})\n\t: treeAdapter.isTextNode(node)\n\t\t? new Text({\n\t\t\tdata: hasSource ? source.input.html.slice(\n\t\t\t\tsource.startInnerOffset,\n\t\t\t\tsource.endInnerOffset\n\t\t\t) : node.value,\n\t\t\tresult,\n\t\t\tsource\n\t\t})\n\t: new Fragment({\n\t\tnodes: node.childNodes instanceof Array ? node.childNodes.map(child => transform(child, result)) : null,\n\t\tresult,\n\t\tsource\n\t});\n\n\treturn $node;\n}\n\nexport default Result;\n\n/**\n* A promise to return a syntax tree.\n* @typedef {Promise} ResultPromise\n* @example\n* resultPromise.then(result => {\n* // do something with the result\n* })\n*/\n\n/**\n* A promise to return a syntax tree.\n* @typedef {Object} ProcessOptions\n* @property {Object} ProcessOptions - Custom settings applied to the {@link Result}.\n* @property {String} ProcessOptions.from - Source input location.\n* @property {String} ProcessOptions.to - Destination output location.\n* @property {Array} ProcessOptions.voidElements - Void elements.\n*/\n","import AttributeList from './AttributeList';\nimport Container from './Container';\nimport NodeList from './NodeList';\nimport Result from './Result';\n\n/**\n* @name Element\n* @class\n* @extends Container\n* @classdesc Create a new {@link Element} {@Link Node}.\n* @param {Object|String} settings - Custom settings applied to the {@link Element} or its tag name.\n* @param {String} settings.name - Tag name of the {@link Element}.\n* @param {Boolean} settings.isSelfClosing - Whether the {@link Element} is self-closing.\n* @param {Boolean} settings.isVoid - Whether the {@link Element} is void.\n* @param {Boolean} settings.isWithoutEndTag - Whether the {@link Element} uses a closing tag.\n* @param {Array|AttributeList|Object} settings.attrs - Attributes applied to the {@link Element}.\n* @param {Array|NodeList} settings.nodes - Nodes appended to the {@link Element}.\n* @param {Object} settings.source - Source mapping of the {@link Element}.\n* @param {Array|AttributeList|Object} [attrs] - Conditional override attributes applied to the {@link Element}.\n* @param {Array|NodeList} [nodes] - Conditional override nodes appended to the {@link Element}.\n* @returns {Element} A new {@link Element} {@Link Node}\n* @example\n* new Element({ name: 'p' }) // returns an element representing <p></p>\n*\n* new Element({\n* name: 'input',\n* attrs: [{ name: 'type', value: 'search' }],\n* isVoid: true\n* }) // returns an element representing <input type=\"search\">\n* @example\n* new Element('p') // returns an element representing <p></p>\n*\n* new Element('p', null,\n* new Element(\n* 'input',\n* [{ name: 'type', value: 'search' }]\n* )\n* ) // returns an element representing <p><input type=\"search\"></p>\n*/\nclass Element extends Container {\n\tconstructor (settings, ...args) {\n\t\tsuper();\n\n\t\tif (settings !== Object(settings)) {\n\t\t\tsettings = { name: String(settings == null ? 'span' : settings) };\n\t\t}\n\n\t\tif (args[0] === Object(args[0])) {\n\t\t\tsettings.attrs = args[0];\n\t\t}\n\n\t\tif (args.length > 1) {\n\t\t\tsettings.nodes = args.slice(1);\n\t\t}\n\n\t\tObject.assign(this, settings, {\n\t\t\ttype: 'element',\n\t\t\tname: settings.name,\n\t\t\tisSelfClosing: Boolean(settings.isSelfClosing),\n\t\t\tisVoid: 'isVoid' in settings\n\t\t\t\t? Boolean(settings.isVoid)\n\t\t\t: Result.voidElements.includes(settings.name),\n\t\t\tisWithoutEndTag: Boolean(settings.isWithoutEndTag),\n\t\t\tattrs: AttributeList.from(settings.attrs),\n\t\t\tnodes: Array.isArray(settings.nodes)\n\t\t\t\t? new NodeList(this, ...Array.from(settings.nodes))\n\t\t\t: settings.nodes !== null && settings.nodes !== undefined\n\t\t\t\t? new NodeList(this, settings.nodes)\n\t\t\t: new NodeList(this),\n\t\t\tsource: Object(settings.source)\n\t\t})\n\t}\n\n\t/**\n\t* Return the outerHTML of the current {@link Element} as a String.\n\t* @returns {String}\n\t* @example\n\t* element.outerHTML // returns a string of outerHTML\n\t*/\n\tget outerHTML () {\n\t\treturn `${getOpeningTagString(this)}${this.nodes.innerHTML}${getClosingTagString(this)}`;\n\t}\n\n\t/**\n\t* Replace the current {@link Element} from a String.\n\t* @param {String} input - Source being processed.\n\t* @returns {Void}\n\t* @example\n\t* element.outerHTML = 'Hello <strong>world</strong>';\n\t*/\n\tset outerHTML (outerHTML) {\n\t\tObject.getOwnPropertyDescriptor(Container.prototype, 'outerHTML').set.call(this, outerHTML);\n\t}\n\n\t/**\n\t* Return a clone of the current {@link Element}.\n\t* @param {Object} settings - Custom settings applied to the cloned {@link Element}.\n\t* @param {Boolean} isDeep - Whether the descendants of the current {@link Element} should also be cloned.\n\t* @returns {Element} - The cloned Element\n\t*/\n\tclone (settings, isDeep) {\n\t\tconst clone = new Element({\n\t\t\t...this,\n\t\t\tnodes: [],\n\t\t\t...Object(settings)\n\t\t});\n\n\t\tconst didSetNodes = 'nodes' in Object(settings);\n\n\t\tif (isDeep && !didSetNodes) {\n\t\t\tclone.nodes = this.nodes.clone(clone);\n\t\t}\n\n\t\treturn clone;\n\t}\n\n\t/**\n\t* Return the Element as a unique Object.\n\t* @returns {Object}\n\t*/\n\ttoJSON () {\n\t\tconst object = { name: this.name };\n\n\t\t// conditionally disclose whether the Element is self-closing\n\t\tif (this.isSelfClosing) {\n\t\t\tobject.isSelfClosing = true;\n\t\t}\n\n\t\t// conditionally disclose whether the Element is void\n\t\tif (this.isVoid) {\n\t\t\tobject.isVoid = true;\n\t\t}\n\n\t\t// conditionally disclose Attributes applied to the Element\n\t\tif (this.attrs.length) {\n\t\t\tobject.attrs = this.attrs.toJSON();\n\t\t}\n\n\t\t// conditionally disclose Nodes appended to the Element\n\t\tif (!this.isSelfClosing && !this.isVoid && this.nodes.length) {\n\t\t\tobject.nodes = this.nodes.toJSON();\n\t\t}\n\n\t\treturn object;\n\t}\n\n\t/**\n\t* Return the stringified Element.\n\t* @returns {String}\n\t*/\n\ttoString () {\n\t\treturn `${getOpeningTagString(this)}${this.nodes || ''}${\n\t\t\t`${getClosingTagString(this)}`\n\t\t}`;\n\t}\n}\n\nexport default Element;\n\nfunction getClosingTagString (element) {\n\treturn element.isSelfClosing || element.isVoid || element.isWithoutEndTag\n\t\t? ''\n\t: `</${element.name}${element.source.after || ''}>`;\n}\n\nfunction getOpeningTagString (element) {\n\treturn `<${element.name}${element.attrs}${element.source.before || ''}>`;\n}\n","import Result from './Result';\n\n/**\n* @name Plugin\n* @class\n* @classdesc Create a new Plugin.\n* @param {String} name - Name of the Plugin.\n* @param {Function} pluginFunction - Function executed by the Plugin during initialization.\n* @returns {Plugin}\n* @example\n* new Plugin('phtml-test', pluginOptions => {\n* // initialization logic\n*\n* return {\n* Element (element, result) {\n* // runtime logic, do something with an element\n* },\n* Root (root, result) {\n* // runtime logic, do something with the root\n* }\n* }\n* })\n* @example\n* new Plugin('phtml-test', pluginOptions => {\n* // initialization logic\n*\n* return (root, result) => {\n* // runtime logic, do something with the root\n* }\n* })\n*/\nclass Plugin extends Function {\n\tconstructor (name, pluginFunction) {\n\t\treturn Object.defineProperties(pluginFunction, {\n\t\t\tconstructor: {\n\t\t\t\tvalue: Plugin,\n\t\t\t\tconfigurable: true\n\t\t\t},\n\t\t\ttype: {\n\t\t\t\tvalue: 'plugin',\n\t\t\t\tconfigurable: true\n\t\t\t},\n\t\t\tname: {\n\t\t\t\tvalue: String(name || 'phtml-plugin'),\n\t\t\t\tconfigurable: true\n\t\t\t},\n\t\t\tpluginFunction: {\n\t\t\t\tvalue: typeof pluginFunction === 'function' ?\n\t\t\t\t\tpluginFunction\n\t\t\t\t: () => pluginFunction,\n\t\t\t\tconfigurable: true\n\t\t\t},\n\t\t\tprocess: {\n\t\t\t\tvalue (...args) {\n\t\t\t\t\treturn Plugin.prototype.process.apply(this, args);\n\t\t\t\t},\n\t\t\t\tconfigurable: true\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t* Process input with options and plugin options and return the result.\n\t* @param {String} input - Source being processed.\n\t* @param {ProcessOptions} processOptions - Custom settings applied to the Result.\n\t* @param {Object} pluginOptions - Options passed to the Plugin.\n\t* @returns {ResultPromise}\n\t* @example\n\t* plugin.process('some html', processOptions, pluginOptions)\n\t*/\n\tprocess (input, processOptions, pluginOptions) {\n\t\tconst initializedPlugin = this.pluginFunction(pluginOptions);\n\t\tconst result = new Result(input, { visitors: [ initializedPlugin ], ...Object(processOptions) });\n\n\t\treturn result.visit(result.root);\n\t}\n}\n\nexport default Plugin;\n","import AttributeList from './AttributeList';\nimport Comment from './Comment';\nimport Container from './Container';\nimport Doctype from './Doctype';\nimport Element from './Element';\nimport Fragment from './Fragment';\nimport Node from './Node';\nimport NodeList from './NodeList';\nimport Plugin from './Plugin';\nimport Result from './Result';\nimport Text from './Text';\n\n/**\n* @name PHTML\n* @class\n* @classdesc Create a new instance of {@link PHTML}.\n* @param {Array|Object|Plugin|Function} plugins - Plugin or plugins being added.\n* @returns {PHTML}\n* @example\n* new PHTML(plugin)\n* @example\n* new PHTML([ somePlugin, anotherPlugin ])\n*/\nclass PHTML {\n\tconstructor (pluginOrPlugins) {\n\t\tObject.assign(this, { plugins: [] });\n\n\t\tthis.use(pluginOrPlugins);\n\t}\n\n\t/**\n\t* Process input using plugins and return the result\n\t* @param {String} input - Source being processed.\n\t* @param {ProcessOptions} processOptions - Custom settings applied to the Result.\n\t* @returns {ResultPromise}\n\t* @example\n\t* phtml.process('some html', processOptions)\n\t*/\n\tprocess (input, processOptions) {\n\t\tconst result = new Result(input, { visitors: this.plugins, ...Object(processOptions) });\n\n\t\t// dispatch visitors and promise the result\n\t\treturn result.visit();\n\t}\n\n\t/**\n\t* Add plugins to the existing instance of PHTML\n\t* @param {Array|Object|Plugin|Function} plugins - Plugin or plugins being added.\n\t* @returns {PHTML}\n\t* @example\n\t* phtml.use(plugin)\n\t* @example\n\t* phtml.use([ somePlugin, anotherPlugin ])\n\t* @example\n\t* phtml.use(somePlugin, anotherPlugin)\n\t*/\n\tuse (pluginOrPlugins, ...additionalPlugins) {\n\t\tconst plugins = [pluginOrPlugins, ...additionalPlugins].reduce(\n\t\t\t(flattenedPlugins, plugin) => flattenedPlugins.concat(plugin),\n\t\t\t[]\n\t\t).filter(\n\t\t\t// Plugins are either a function or an object with keys\n\t\t\tplugin => (\n\t\t\t\ttypeof plugin === 'function' ||\n\t\t\t\tObject(plugin) === plugin && Object.keys(plugin).length\n\t\t\t)\n\t\t);\n\n\t\tthis.plugins.push(...plugins);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t* Process input and return the new {@link Result}\n\t* @param {ProcessOptions} [processOptions] - Custom settings applied to the {@link Result}.\n\t* @param {Array|Object|Plugin|Function} [plugins] - Custom settings applied to the {@link Result}.\n\t* @returns {ResultPromise}\n\t* @example\n\t* PHTML.process('some html', processOptions)\n\t* @example <caption>Process HTML with plugins.</caption>\n\t* PHTML.process('some html', processOptions, plugins) // returns a new PHTML instance\n\t*/\n\tstatic process (input, processOptions, pluginOrPlugins) {\n\t\tconst phtml = new PHTML(pluginOrPlugins);\n\n\t\treturn phtml.process(input, processOptions);\n\t}\n\n\t/**\n\t* Return a new {@link PHTML} instance which will use plugins\n\t* @param {Array|Object|Plugin|Function} plugin - Plugin or plugins being added.\n\t* @returns {PHTML} - New {@link PHTML} instance\n\t* @example\n\t* PHTML.use(plugin) // returns a new PHTML instance\n\t* @example\n\t* PHTML.use([ somePlugin, anotherPlugin ]) // returns a new PHTML instance\n\t* @example\n\t* PHTML.use(somePlugin, anotherPlugin) // returns a new PHTML instance\n\t*/\n\tstatic use (pluginOrPlugins, ...additionalPlugins) {\n\t\treturn new PHTML().use(\n\t\t\tpluginOrPlugins,\n\t\t\t...additionalPlugins\n\t\t);\n\t}\n\n\tstatic AttributeList = AttributeList;\n\tstatic Comment = Comment;\n\tstatic Container = Container;\n\tstatic Doctype = Doctype;\n\tstatic Element = Element;\n\tstatic Fragment = Fragment;\n\tstatic Node = Node;\n\tstatic NodeList = NodeList;\n\tstatic Plugin = Plugin;\n\tstatic Result = Result;\n\tstatic Text = Text;\n}\n\nexport default PHTML;\n"],"names":["AttributeList","Array","constructor","attrs","Object","push","getAttributeListArray","add","name","args","toggle","attributeAdded","clone","from","concat","contains","indexOf","get","index","value","findIndex","isArray","findIndexByArray","isRegExp","findIndexByRegExp","findIndexByObject","findIndexByString","attr","some","innerAttr","test","String","getAttributeValue","toCamelCaseString","length","toKebabCaseString","remove","attributeRemoved","force","Boolean","result","atttributeModified","toString","map","source","before","quote","join","toJSON","reduce","object","assign","toggles","forEach","toggleAttr","splice","undefined","rawattr","keys","arguments","prototype","JSON","stringify","isKebabCase","replace","$0","slice","toUpperCase","isCamelCase","toLowerCase","call","visit","node","overrideVisitors","visitors","beforeType","getTypeFromNode","beforeSubType","getSubTypeFromNode","beforeNodeType","beforeRootType","afterType","afterSubType","afterNodeType","afterRootType","promise","Promise","resolve","then","runAll","root","nodes","childNode","parent","plugins","plugin","currentPlugin","getVisitors","rawplugins","initializedPlugin","type","Function","afterRoot","key","fn","Node","next","nextElement","find","hasNodes","previous","previousElement","reverse","after","append","appendTo","prepend","replaceWith","resultToUse","warn","text","opts","data","Comment","settings","comment","innerHTML","outerHTML","sourceInnerHTML","input","html","startOffset","endOffset","sourceOuterHTML","Container","first","firstElement","last","lastElement","elements","filter","Result","childNodes","isSelfClosing","isVoid","startInnerOffset","endInnerOffset","textContent","lastNth","lastNthElement","nth","nthElement","replaceAll","walk","cb","getCbAndFilterFromArgs","child","testWithFilter","cbOrFilter","onlyCb","RegExp","Doctype","doctype","publicId","systemId","beforePublicId","beforeSystemId","Fragment","NodeList","isDeep","Text","normalize","nodeTypes","element","Element","fragment","parents","WeakMap","set","getInnerHtmlEncodedString","pop","inserts","shift","start","startIndex","Math","max","Number","deleteCount","getNodeListArray","insert","removes","unshift","string","match","defaultTreeAdapter","isElementNode","createCommentNode","nodeName","parentNode","Tokenizer","_createDoctypeToken","doctypeRegExp","doctypeStartRegExp","offset","preprocessor","pos","currentToken","COMMENT_TOKEN","forceQuirks","_createAttr","attrNameFirstCh","currentAttr","startName","_leaveAttrName","toState","endName","raw","startValue","endValue","state","_leaveAttrValue","currentAttrValue","originalTAG_OPEN_STATE","TAG_OPEN_STATE","cp","isReactOpeningElement","isReactClosingElement","_createStartTagToken","_reconsumeInState","_createEndTagToken","parseLoose","parseOpts","tokenizer","options","document","treeAdapter","createDocumentFragment","template","_bootstrap","_pushTmplInsertionMode","_initTokenizerForFragmentParsing","_insertFakeRootElement","write","_runParsingLoop","parseHTML","htmlParser","HTMLParser","sourceCodeLocationInfo","isVoidElement","voidElements","includes","grandChildNodes","sourceCodeLocation","processOptions","to","messages","documentFragment","transform","warnings","message","nodeToUse","rawopts","hasSource","startTag","endTag","$node","isCommentNode","isDocumentTypeNode","isWithoutEndTag","tagName","isTextNode","getOpeningTagString","getClosingTagString","getOwnPropertyDescriptor","didSetNodes","Plugin","pluginFunction","defineProperties","configurable","process","apply","pluginOptions","PHTML","pluginOrPlugins","use","additionalPlugins","flattenedPlugins","phtml"],"mappings":";;;;AAAA;;;;;;;;;;;;AAYA,MAAMA,aAAN,SAA4BC,KAA5B,CAAkC;EACjCC,WAAW,CAAEC,KAAF,EAAS;;;QAGfA,KAAK,KAAKC,MAAM,CAACD,KAAD,CAApB,EAA6B;WACvBE,IAAL,CAAU,GAAGC,qBAAqB,CAACH,KAAD,CAAlC;;;;;;;;;;;;;;;;;EAgBFI,GAAG,CAAEC,IAAF,EAAQ,GAAGC,IAAX,EAAiB;WACZC,MAAM,CAAC,IAAD,EAAOJ,qBAAqB,CAACE,IAAD,EAAO,GAAGC,IAAV,CAA5B,EAA6C,IAA7C,CAAN,CAAyDE,cAAhE;;;;;;;;;;;;;EAYDC,KAAK,CAAE,GAAGT,KAAL,EAAY;WACT,IAAIH,aAAJ,CAAkBC,KAAK,CAACY,IAAN,CAAW,IAAX,EAAiBC,MAAjB,CAAwBR,qBAAqB,CAACH,KAAD,CAA7C,CAAlB,CAAP;;;;;;;;;;;;;;;EAcDY,QAAQ,CAAEP,IAAF,EAAQ;WACR,KAAKQ,OAAL,CAAaR,IAAb,MAAuB,CAAC,CAA/B;;;;;;;;;;;;;;;;;EA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