{"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * The regular expression for an HTML element.\n */\nconst htmlSplitRegex: RegExp = ( () => {\n\tconst comments =\n\t\t'!' + // Start of comment, after the <.\n\t\t'(?:' + // Unroll the loop: Consume everything until --> is found.\n\t\t'-(?!->)' + // Dash not followed by end of comment.\n\t\t'[^\\\\-]*' + // Consume non-dashes.\n\t\t')*' + // Loop possessively.\n\t\t'(?:-->)?'; // End of comment. If not found, match all input.\n\n\tconst cdata =\n\t\t'!\\\\[CDATA\\\\[' + // Start of comment, after the <.\n\t\t'[^\\\\]]*' + // Consume non-].\n\t\t'(?:' + // Unroll the loop: Consume everything until ]]> is found.\n\t\t'](?!]>)' + // One ] not followed by end of comment.\n\t\t'[^\\\\]]*' + // Consume non-].\n\t\t')*?' + // Loop possessively.\n\t\t'(?:]]>)?'; // End of comment. If not found, match all input.\n\n\tconst escaped =\n\t\t'(?=' + // Is the element escaped?\n\t\t'!--' +\n\t\t'|' +\n\t\t'!\\\\[CDATA\\\\[' +\n\t\t')' +\n\t\t'((?=!-)' + // If yes, which type?\n\t\tcomments +\n\t\t'|' +\n\t\tcdata +\n\t\t')';\n\n\tconst regex =\n\t\t'(' + // Capture the entire match.\n\t\t'<' + // Find start of element.\n\t\t'(' + // Conditional expression follows.\n\t\tescaped + // Find end of escaped element.\n\t\t'|' + // ... else ...\n\t\t'[^>]*>?' + // Find end of normal element.\n\t\t')' +\n\t\t')';\n\n\treturn new RegExp( regex );\n} )();\n\n/**\n * Separate HTML elements and comments from the text.\n *\n * @param input The text which has to be formatted.\n *\n * @return The formatted text.\n */\nfunction htmlSplit( input: string ): string[] {\n\tconst parts = [];\n\tlet workingInput = input;\n\n\tlet match;\n\twhile ( ( match = workingInput.match( htmlSplitRegex ) ) ) {\n\t\t// The `match` result, when invoked on a RegExp with the `g` flag (`/foo/g`) will not include `index`.\n\t\t// If the `g` flag is omitted, `index` is included.\n\t\t// `htmlSplitRegex` does not have the `g` flag so we can assert it will have an index number.\n\t\t// Assert `match.index` is a number.\n\t\tconst index = match.index as number;\n\n\t\tparts.push( workingInput.slice( 0, index ) );\n\t\tparts.push( match[ 0 ] );\n\t\tworkingInput = workingInput.slice( index + match[ 0 ].length );\n\t}\n\n\tif ( workingInput.length ) {\n\t\tparts.push( workingInput );\n\t}\n\n\treturn parts;\n}\n\n/**\n * Replace characters or phrases within HTML elements only.\n *\n * @param haystack     The text which has to be formatted.\n * @param replacePairs In the form {from: 'to', …}.\n *\n * @return The formatted text.\n */\nfunction replaceInHtmlTags(\n\thaystack: string,\n\treplacePairs: Record< string, string >\n): string {\n\t// Find all elements.\n\tconst textArr = htmlSplit( haystack );\n\tlet changed = false;\n\n\t// Extract all needles.\n\tconst needles = Object.keys( replacePairs );\n\n\t// Loop through delimiters (elements) only.\n\tfor ( let i = 1; i < textArr.length; i += 2 ) {\n\t\tfor ( let j = 0; j < needles.length; j++ ) {\n\t\t\tconst needle = needles[ j ];\n\t\t\tif ( -1 !== textArr[ i ].indexOf( needle ) ) {\n\t\t\t\ttextArr[ i ] = textArr[ i ].replace(\n\t\t\t\t\tnew RegExp( needle, 'g' ),\n\t\t\t\t\treplacePairs[ needle ]\n\t\t\t\t);\n\t\t\t\tchanged = true;\n\t\t\t\t// After one strtr() break out of the foreach loop and look at next element.\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( changed ) {\n\t\thaystack = textArr.join( '' );\n\t}\n\n\treturn haystack;\n}\n\n/**\n * Replaces double line-breaks with paragraph elements.\n *\n * A group of regex replaces used to identify text formatted with newlines and\n * replace double line-breaks with HTML paragraph tags. The remaining line-\n * breaks after conversion become `<br />` tags, unless br is set to 'false'.\n *\n * @param text The text which has to be formatted.\n * @param br   Optional. If set, will convert all remaining line-\n *             breaks after paragraphing. Default true.\n *\n * @example\n *```js\n * import { autop } from '@wordpress/autop';\n * autop( 'my text' ); // \"<p>my text</p>\"\n * ```\n *\n * @return Text which has been converted into paragraph tags.\n */\nexport function autop( text: string, br: boolean = true ): string {\n\tconst preTags: Array< [ string, string ] > = [];\n\n\tif ( text.trim() === '' ) {\n\t\treturn '';\n\t}\n\n\t// Just to make things a little easier, pad the end.\n\ttext = text + '\\n';\n\n\t/*\n\t * Pre tags shouldn't be touched by autop.\n\t * Replace pre tags with placeholders and bring them back after autop.\n\t */\n\tif ( text.indexOf( '<pre' ) !== -1 ) {\n\t\tconst textParts = text.split( '</pre>' );\n\t\tconst lastText = textParts.pop();\n\t\ttext = '';\n\n\t\tfor ( let i = 0; i < textParts.length; i++ ) {\n\t\t\tconst textPart = textParts[ i ];\n\t\t\tconst start = textPart.indexOf( '<pre' );\n\n\t\t\t// Malformed html?\n\t\t\tif ( start === -1 ) {\n\t\t\t\ttext += textPart;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst name = '<pre wp-pre-tag-' + i + '></pre>';\n\t\t\tpreTags.push( [ name, textPart.substr( start ) + '</pre>' ] );\n\n\t\t\ttext += textPart.substr( 0, start ) + name;\n\t\t}\n\n\t\ttext += lastText;\n\t}\n\t// Change multiple <br>s into two line breaks, which will turn into paragraphs.\n\ttext = text.replace( /<br\\s*\\/?>\\s*<br\\s*\\/?>/g, '\\n\\n' );\n\n\tconst allBlocks =\n\t\t'(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)';\n\n\t// Add a double line break above block-level opening tags.\n\ttext = text.replace(\n\t\tnew RegExp( '(<' + allBlocks + '[\\\\s/>])', 'g' ),\n\t\t'\\n\\n$1'\n\t);\n\n\t// Add a double line break below block-level closing tags.\n\ttext = text.replace(\n\t\tnew RegExp( '(</' + allBlocks + '>)', 'g' ),\n\t\t'$1\\n\\n'\n\t);\n\n\t// Standardize newline characters to \"\\n\".\n\ttext = text.replace( /\\r\\n|\\r/g, '\\n' );\n\n\t// Find newlines in all elements and add placeholders.\n\ttext = replaceInHtmlTags( text, { '\\n': ' <!-- wpnl --> ' } );\n\n\t// Collapse line breaks before and after <option> elements so they don't get autop'd.\n\tif ( text.indexOf( '<option' ) !== -1 ) {\n\t\ttext = text.replace( /\\s*<option/g, '<option' );\n\t\ttext = text.replace( /<\\/option>\\s*/g, '</option>' );\n\t}\n\n\t/*\n\t * Collapse line breaks inside <object> elements, before <param> and <embed> elements\n\t * so they don't get autop'd.\n\t */\n\tif ( text.indexOf( '</object>' ) !== -1 ) {\n\t\ttext = text.replace( /(<object[^>]*>)\\s*/g, '$1' );\n\t\ttext = text.replace( /\\s*<\\/object>/g, '</object>' );\n\t\ttext = text.replace( /\\s*(<\\/?(?:param|embed)[^>]*>)\\s*/g, '$1' );\n\t}\n\n\t/*\n\t * Collapse line breaks inside <audio> and <video> elements,\n\t * before and after <source> and <track> elements.\n\t */\n\tif ( text.indexOf( '<source' ) !== -1 || text.indexOf( '<track' ) !== -1 ) {\n\t\ttext = text.replace( /([<\\[](?:audio|video)[^>\\]]*[>\\]])\\s*/g, '$1' );\n\t\ttext = text.replace( /\\s*([<\\[]\\/(?:audio|video)[>\\]])/g, '$1' );\n\t\ttext = text.replace( /\\s*(<(?:source|track)[^>]*>)\\s*/g, '$1' );\n\t}\n\n\t// Collapse line breaks before and after <figcaption> elements.\n\tif ( text.indexOf( '<figcaption' ) !== -1 ) {\n\t\ttext = text.replace( /\\s*(<figcaption[^>]*>)/, '$1' );\n\t\ttext = text.replace( /<\\/figcaption>\\s*/, '</figcaption>' );\n\t}\n\n\t// Remove more than two contiguous line breaks.\n\ttext = text.replace( /\\n\\n+/g, '\\n\\n' );\n\n\t// Split up the contents into an array of strings, separated by double line breaks.\n\tconst texts = text.split( /\\n\\s*\\n/ ).filter( Boolean );\n\n\t// Reset text prior to rebuilding.\n\ttext = '';\n\n\t// Rebuild the content as a string, wrapping every bit with a <p>.\n\ttexts.forEach( ( textPiece ) => {\n\t\ttext += '<p>' + textPiece.replace( /^\\n*|\\n*$/g, '' ) + '</p>\\n';\n\t} );\n\n\t// Under certain strange conditions it could create a P of entirely whitespace.\n\ttext = text.replace( /<p>\\s*<\\/p>/g, '' );\n\n\t// Add a closing <p> inside <div>, <address>, or <form> tag if missing.\n\ttext = text.replace(\n\t\t/<p>([^<]+)<\\/(div|address|form)>/g,\n\t\t'<p>$1</p></$2>'\n\t);\n\n\t// If an opening or closing block element tag is wrapped in a <p>, unwrap it.\n\ttext = text.replace(\n\t\tnew RegExp( '<p>\\\\s*(</?' + allBlocks + '[^>]*>)\\\\s*</p>', 'g' ),\n\t\t'$1'\n\t);\n\n\t// In some cases <li> may get wrapped in <p>, fix them.\n\ttext = text.replace( /<p>(<li.+?)<\\/p>/g, '$1' );\n\n\t// If a <blockquote> is wrapped with a <p>, move it inside the <blockquote>.\n\ttext = text.replace( /<p><blockquote([^>]*)>/gi, '<blockquote$1><p>' );\n\ttext = text.replace( /<\\/blockquote><\\/p>/g, '</p></blockquote>' );\n\n\t// If an opening or closing block element tag is preceded by an opening <p> tag, remove it.\n\ttext = text.replace(\n\t\tnew RegExp( '<p>\\\\s*(</?' + allBlocks + '[^>]*>)', 'g' ),\n\t\t'$1'\n\t);\n\n\t// If an opening or closing block element tag is followed by a closing <p> tag, remove it.\n\ttext = text.replace(\n\t\tnew RegExp( '(</?' + allBlocks + '[^>]*>)\\\\s*</p>', 'g' ),\n\t\t'$1'\n\t);\n\n\t// Optionally insert line breaks.\n\tif ( br ) {\n\t\t// Replace newlines that shouldn't be touched with a placeholder.\n\t\t// Note: `[\\s\\S]*?` is used (instead of `.*?`) so the match can span\n\t\t// newlines, and the backreference `\\1` (not `\\\\1`, which would be a\n\t\t// literal backslash followed by `1` in a regex literal) ensures the\n\t\t// opening and closing tag names match. This mirrors the PHP\n\t\t// `wpautop()` behavior and also protects `svg` and `math` tags.\n\t\ttext = text.replace(\n\t\t\t/<(script|style|svg|math)[\\s\\S]*?<\\/\\1>/g,\n\t\t\t( match ) => match.replace( /\\n/g, '<WPPreserveNewline />' )\n\t\t);\n\n\t\t// Normalize <br>\n\t\ttext = text.replace( /<br>|<br\\/>/g, '<br />' );\n\n\t\t// Replace any new line characters that aren't preceded by a <br /> with a <br />.\n\t\ttext = text.replace( /(<br \\/>)?\\s*\\n/g, ( a, b ) =>\n\t\t\tb ? a : '<br />\\n'\n\t\t);\n\n\t\t// Replace newline placeholders with newlines.\n\t\ttext = text.replace( /<WPPreserveNewline \\/>/g, '\\n' );\n\t}\n\n\t// If a <br /> tag is after an opening or closing block tag, remove it.\n\ttext = text.replace(\n\t\tnew RegExp( '(</?' + allBlocks + '[^>]*>)\\\\s*<br />', 'g' ),\n\t\t'$1'\n\t);\n\n\t// If a <br /> tag is before a subset of opening or closing block tags, remove it.\n\ttext = text.replace(\n\t\t/<br \\/>(\\s*<\\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)/g,\n\t\t'$1'\n\t);\n\ttext = text.replace( /\\n<\\/p>$/g, '</p>' );\n\n\t// Replace placeholder <pre> tags with their original content.\n\tpreTags.forEach( ( preTag ) => {\n\t\tconst [ name, original ] = preTag;\n\t\t// Use a function to avoid treating special replacement patterns like $' in the original content\n\t\ttext = text.replace( name, () => original );\n\t} );\n\n\t// Restore newlines in all elements.\n\tif ( -1 !== text.indexOf( '<!-- wpnl -->' ) ) {\n\t\ttext = text.replace( /\\s?<!-- wpnl -->\\s?/g, '\\n' );\n\t}\n\n\treturn text;\n}\n\n/**\n * Replaces `<p>` tags with two line breaks. \"Opposite\" of autop().\n *\n * Replaces `<p>` tags with two line breaks except where the `<p>` has attributes.\n * Unifies whitespace. Indents `<li>`, `<dt>` and `<dd>` for better readability.\n *\n * @param html The content from the editor.\n *\n * @example\n * ```js\n * import { removep } from '@wordpress/autop';\n * removep( '<p>my text</p>' ); // \"my text\"\n * ```\n *\n * @return The content with stripped paragraph tags.\n */\nexport function removep( html: string ): string {\n\tconst blocklist =\n\t\t'blockquote|ul|ol|li|dl|dt|dd|table|thead|tbody|tfoot|tr|th|td|h[1-6]|fieldset|figure';\n\tconst blocklist1 = blocklist + '|div|p';\n\tconst blocklist2 = blocklist + '|pre';\n\tconst preserve: string[] = [];\n\tlet preserveLinebreaks = false;\n\tlet preserveBr = false;\n\n\tif ( ! html ) {\n\t\treturn '';\n\t}\n\n\t// Protect script and style tags.\n\tif ( html.indexOf( '<script' ) !== -1 || html.indexOf( '<style' ) !== -1 ) {\n\t\thtml = html.replace(\n\t\t\t/<(script|style)[^>]*>[\\s\\S]*?<\\/\\1>/g,\n\t\t\t( match ) => {\n\t\t\t\tpreserve.push( match );\n\t\t\t\treturn '<wp-preserve>';\n\t\t\t}\n\t\t);\n\t}\n\n\t// Protect pre tags.\n\tif ( html.indexOf( '<pre' ) !== -1 ) {\n\t\tpreserveLinebreaks = true;\n\t\thtml = html.replace( /<pre[^>]*>[\\s\\S]+?<\\/pre>/g, ( a ) => {\n\t\t\ta = a.replace( /<br ?\\/?>(\\r\\n|\\n)?/g, '<wp-line-break>' );\n\t\t\ta = a.replace( /<\\/?p( [^>]*)?>(\\r\\n|\\n)?/g, '<wp-line-break>' );\n\t\t\treturn a.replace( /\\r?\\n/g, '<wp-line-break>' );\n\t\t} );\n\t}\n\n\t// Remove line breaks but keep <br> tags inside image captions.\n\tif ( html.indexOf( '[caption' ) !== -1 ) {\n\t\tpreserveBr = true;\n\t\thtml = html.replace( /\\[caption[\\s\\S]+?\\[\\/caption\\]/g, ( a ) => {\n\t\t\treturn a\n\t\t\t\t.replace( /<br([^>]*)>/g, '<wp-temp-br$1>' )\n\t\t\t\t.replace( /[\\r\\n\\t]+/, '' );\n\t\t} );\n\t}\n\n\t// Normalize white space characters before and after block tags.\n\thtml = html.replace(\n\t\tnew RegExp( '\\\\s*</(' + blocklist1 + ')>\\\\s*', 'g' ),\n\t\t'</$1>\\n'\n\t);\n\thtml = html.replace(\n\t\tnew RegExp( '\\\\s*<((?:' + blocklist1 + ')(?: [^>]*)?)>', 'g' ),\n\t\t'\\n<$1>'\n\t);\n\n\t// Mark </p> if it has any attributes.\n\thtml = html.replace( /(<p [^>]+>[\\s\\S]*?)<\\/p>/g, '$1</p#>' );\n\n\t// Preserve the first <p> inside a <div>.\n\thtml = html.replace( /<div( [^>]*)?>\\s*<p>/gi, '<div$1>\\n\\n' );\n\n\t// Remove paragraph tags.\n\thtml = html.replace( /\\s*<p>/gi, '' );\n\thtml = html.replace( /\\s*<\\/p>\\s*/gi, '\\n\\n' );\n\n\t// Normalize white space chars and remove multiple line breaks.\n\thtml = html.replace( /\\n[\\s\\u00a0]+\\n/g, '\\n\\n' );\n\n\t// Replace <br> tags with line breaks.\n\thtml = html.replace( /(\\s*)<br ?\\/?>\\s*/gi, ( _, space ) => {\n\t\tif ( space && space.indexOf( '\\n' ) !== -1 ) {\n\t\t\treturn '\\n\\n';\n\t\t}\n\n\t\treturn '\\n';\n\t} );\n\n\t// Fix line breaks around <div>.\n\thtml = html.replace( /\\s*<div/g, '\\n<div' );\n\thtml = html.replace( /<\\/div>\\s*/g, '</div>\\n' );\n\n\t// Fix line breaks around caption shortcodes.\n\thtml = html.replace(\n\t\t/\\s*\\[caption([^\\[]+)\\[\\/caption\\]\\s*/gi,\n\t\t'\\n\\n[caption$1[/caption]\\n\\n'\n\t);\n\thtml = html.replace( /caption\\]\\n\\n+\\[caption/g, 'caption]\\n\\n[caption' );\n\n\t// Pad block elements tags with a line break.\n\thtml = html.replace(\n\t\tnew RegExp( '\\\\s*<((?:' + blocklist2 + ')(?: [^>]*)?)\\\\s*>', 'g' ),\n\t\t'\\n<$1>'\n\t);\n\thtml = html.replace(\n\t\tnew RegExp( '\\\\s*</(' + blocklist2 + ')>\\\\s*', 'g' ),\n\t\t'</$1>\\n'\n\t);\n\n\t// Indent <li>, <dt> and <dd> tags.\n\thtml = html.replace( /<((li|dt|dd)[^>]*)>/g, ' \\t<$1>' );\n\n\t// Fix line breaks around <select> and <option>.\n\tif ( html.indexOf( '<option' ) !== -1 ) {\n\t\thtml = html.replace( /\\s*<option/g, '\\n<option' );\n\t\thtml = html.replace( /\\s*<\\/select>/g, '\\n</select>' );\n\t}\n\n\t// Pad <hr> with two line breaks.\n\tif ( html.indexOf( '<hr' ) !== -1 ) {\n\t\thtml = html.replace( /\\s*<hr( [^>]*)?>\\s*/g, '\\n\\n<hr$1>\\n\\n' );\n\t}\n\n\t// Remove line breaks in <object> tags.\n\tif ( html.indexOf( '<object' ) !== -1 ) {\n\t\thtml = html.replace( /<object[\\s\\S]+?<\\/object>/g, ( a ) => {\n\t\t\treturn a.replace( /[\\r\\n]+/g, '' );\n\t\t} );\n\t}\n\n\t// Unmark special paragraph closing tags.\n\thtml = html.replace( /<\\/p#>/g, '</p>\\n' );\n\n\t// Pad remaining <p> tags with a line break.\n\thtml = html.replace( /\\s*(<p [^>]+>[\\s\\S]*?<\\/p>)/g, '\\n$1' );\n\n\t// Trim.\n\thtml = html.replace( /^\\s+/, '' );\n\thtml = html.replace( /[\\s\\u00a0]+$/, '' );\n\n\tif ( preserveLinebreaks ) {\n\t\thtml = html.replace( /<wp-line-break>/g, '\\n' );\n\t}\n\n\tif ( preserveBr ) {\n\t\thtml = html.replace( /<wp-temp-br([^>]*)>/g, '<br$1>' );\n\t}\n\n\t// Restore preserved tags.\n\tif ( preserve.length ) {\n\t\thtml = html.replace( /<wp-preserve>/g, () => {\n\t\t\treturn preserve.shift() as string;\n\t\t} );\n\t}\n\n\treturn html;\n}\n"],"mappings":";;;;;;;;;AAGA,MAAM,wBAAiC;CAwCtC,uBAAO,IAAI,OAAQ,uHAAM;AAC1B,EAAA,CAAI;;;;;;;;AASJ,SAAS,UAAW,OAA0B;CAC7C,MAAM,QAAQ,CAAC;CACf,IAAI,eAAe;CAEnB,IAAI;CACJ,OAAU,QAAQ,aAAa,MAAO,cAAe,GAAM;EAK1D,MAAM,QAAQ,MAAM;EAEpB,MAAM,KAAM,aAAa,MAAO,GAAG,KAAM,CAAE;EAC3C,MAAM,KAAM,MAAO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