- http://jsbeautifier.org/
-
- Usage:
- style_html(html_source);
-
- style_html(html_source, options);
-
- The options are:
- indent_inner_html (default false) — indent and sections,
- indent_size (default 4) — indentation size,
- indent_char (default space) — character to indent with,
- wrap_line_length (default 250) - maximum amount of characters per line (0 = disable)
- brace_style (default "collapse") - "collapse" | "expand" | "end-expand" | "none"
- put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line, or attempt to keep them where they are.
- unformatted (defaults to inline tags) - list of tags, that shouldn't be reformatted
- indent_scripts (default normal) - "keep"|"separate"|"normal"
- preserve_newlines (default true) - whether existing line breaks before elements should be preserved
- Only works before elements, not inside tags or for text.
- max_preserve_newlines (default unlimited) - maximum number of line breaks to be preserved in one chunk
- indent_handlebars (default false) - format and indent {{#foo}} and {{/foo}}
- end_with_newline (false) - end with a newline
- extra_liners (default [head,body,/html]) -List of tags that should have an extra newline before them.
-
- e.g.
-
- style_html(html_source, {
- 'indent_inner_html': false,
- 'indent_size': 2,
- 'indent_char': ' ',
- 'wrap_line_length': 78,
- 'brace_style': 'expand',
- 'unformatted': ['a', 'sub', 'sup', 'b', 'i', 'u'],
- 'preserve_newlines': true,
- 'max_preserve_newlines': 5,
- 'indent_handlebars': false,
- 'extra_liners': ['/html']
- });
-*/
-
-(function() {
-
- function trim(s) {
- return s.replace(/^\s+|\s+$/g, '');
- }
-
- function ltrim(s) {
- return s.replace(/^\s+/g, '');
- }
-
- function rtrim(s) {
- return s.replace(/\s+$/g,'');
- }
-
- function style_html(html_source, options, js_beautify, css_beautify) {
- //Wrapper function to invoke all the necessary constructors and deal with the output.
-
- var multi_parser,
- indent_inner_html,
- indent_size,
- indent_character,
- wrap_line_length,
- brace_style,
- unformatted,
- preserve_newlines,
- max_preserve_newlines,
- indent_handlebars,
- wrap_attributes,
- wrap_attributes_indent_size,
- end_with_newline,
- extra_liners,
- eol;
-
- options = options || {};
-
- // backwards compatibility to 1.3.4
- if ((options.wrap_line_length === undefined || parseInt(options.wrap_line_length, 10) === 0) &&
- (options.max_char !== undefined && parseInt(options.max_char, 10) !== 0)) {
- options.wrap_line_length = options.max_char;
- }
-
- indent_inner_html = (options.indent_inner_html === undefined) ? false : options.indent_inner_html;
- indent_size = (options.indent_size === undefined) ? 4 : parseInt(options.indent_size, 10);
- indent_character = (options.indent_char === undefined) ? ' ' : options.indent_char;
- brace_style = (options.brace_style === undefined) ? 'collapse' : options.brace_style;
- wrap_line_length = parseInt(options.wrap_line_length, 10) === 0 ? 32786 : parseInt(options.wrap_line_length || 250, 10);
- unformatted = options.unformatted || ['a', 'span', 'img', 'bdo', 'em', 'strong', 'dfn', 'code', 'samp', 'kbd',
- 'var', 'cite', 'abbr', 'acronym', 'q', 'sub', 'sup', 'tt', 'i', 'b', 'big', 'small', 'u', 's', 'strike',
- 'font', 'ins', 'del', 'pre', 'address', 'dt', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
- preserve_newlines = (options.preserve_newlines === undefined) ? true : options.preserve_newlines;
- max_preserve_newlines = preserve_newlines ?
- (isNaN(parseInt(options.max_preserve_newlines, 10)) ? 32786 : parseInt(options.max_preserve_newlines, 10))
- : 0;
- indent_handlebars = (options.indent_handlebars === undefined) ? false : options.indent_handlebars;
- wrap_attributes = (options.wrap_attributes === undefined) ? 'auto' : options.wrap_attributes;
- wrap_attributes_indent_size = (options.wrap_attributes_indent_size === undefined) ? indent_size : parseInt(options.wrap_attributes_indent_size, 10) || indent_size;
- end_with_newline = (options.end_with_newline === undefined) ? false : options.end_with_newline;
- extra_liners = (typeof options.extra_liners == 'object') && options.extra_liners ?
- options.extra_liners.concat() : (typeof options.extra_liners === 'string') ?
- options.extra_liners.split(',') : 'head,body,/html'.split(',');
- eol = options.eol ? options.eol : '\n';
-
- if(options.indent_with_tabs){
- indent_character = '\t';
- indent_size = 1;
- }
-
- eol = eol.replace(/\\r/, '\r').replace(/\\n/, '\n')
-
- function Parser() {
-
- this.pos = 0; //Parser position
- this.token = '';
- this.current_mode = 'CONTENT'; //reflects the current Parser mode: TAG/CONTENT
- this.tags = { //An object to hold tags, their position, and their parent-tags, initiated with default values
- parent: 'parent1',
- parentcount: 1,
- parent1: ''
- };
- this.tag_type = '';
- this.token_text = this.last_token = this.last_text = this.token_type = '';
- this.newlines = 0;
- this.indent_content = indent_inner_html;
-
- this.Utils = { //Uilities made available to the various functions
- whitespace: "\n\r\t ".split(''),
- single_token: 'br,input,link,meta,source,!doctype,basefont,base,area,hr,wbr,param,img,isindex,embed'.split(','), //all the single tags for HTML
- extra_liners: extra_liners, //for tags that need a line of whitespace before them
- in_array: function(what, arr) {
- for (var i = 0; i < arr.length; i++) {
- if (what === arr[i]) {
- return true;
- }
- }
- return false;
- }
- };
-
- // Return true if the given text is composed entirely of whitespace.
- this.is_whitespace = function(text) {
- for (var n = 0; n < text.length; text++) {
- if (!this.Utils.in_array(text.charAt(n), this.Utils.whitespace)) {
- return false;
- }
- }
- return true;
- };
-
- this.traverse_whitespace = function() {
- var input_char = '';
-
- input_char = this.input.charAt(this.pos);
- if (this.Utils.in_array(input_char, this.Utils.whitespace)) {
- this.newlines = 0;
- while (this.Utils.in_array(input_char, this.Utils.whitespace)) {
- if (preserve_newlines && input_char === '\n' && this.newlines <= max_preserve_newlines) {
- this.newlines += 1;
- }
-
- this.pos++;
- input_char = this.input.charAt(this.pos);
- }
- return true;
- }
- return false;
- };
-
- // Append a space to the given content (string array) or, if we are
- // at the wrap_line_length, append a newline/indentation.
- this.space_or_wrap = function(content) {
- if (this.line_char_count >= this.wrap_line_length) { //insert a line when the wrap_line_length is reached
- this.print_newline(false, content);
- this.print_indentation(content);
- } else {
- this.line_char_count++;
- content.push(' ');
- }
- };
-
- this.get_content = function() { //function to capture regular content between tags
- var input_char = '',
- content = [],
- space = false; //if a space is needed
-
- while (this.input.charAt(this.pos) !== '<') {
- if (this.pos >= this.input.length) {
- return content.length ? content.join('') : ['', 'TK_EOF'];
- }
-
- if (this.traverse_whitespace()) {
- this.space_or_wrap(content);
- continue;
- }
-
- if (indent_handlebars) {
- // Handlebars parsing is complicated.
- // {{#foo}} and {{/foo}} are formatted tags.
- // {{something}} should get treated as content, except:
- // {{else}} specifically behaves like {{#if}} and {{/if}}
- var peek3 = this.input.substr(this.pos, 3);
- if (peek3 === '{{#' || peek3 === '{{/') {
- // These are tags and not content.
- break;
- } else if (peek3 === '{{!') {
- return [this.get_tag(), 'TK_TAG_HANDLEBARS_COMMENT'];
- } else if (this.input.substr(this.pos, 2) === '{{') {
- if (this.get_tag(true) === '{{else}}') {
- break;
- }
- }
- }
-
- input_char = this.input.charAt(this.pos);
- this.pos++;
- this.line_char_count++;
- content.push(input_char); //letter at-a-time (or string) inserted to an array
- }
- return content.length ? content.join('') : '';
- };
-
- this.get_contents_to = function(name) { //get the full content of a script or style to pass to js_beautify
- if (this.pos === this.input.length) {
- return ['', 'TK_EOF'];
- }
- var input_char = '';
- var content = '';
- var reg_match = new RegExp('' + name + '\\s*>', 'igm');
- reg_match.lastIndex = this.pos;
- var reg_array = reg_match.exec(this.input);
- var end_script = reg_array ? reg_array.index : this.input.length; //absolute end of script
- if (this.pos < end_script) { //get everything in between the script tags
- content = this.input.substring(this.pos, end_script);
- this.pos = end_script;
- }
- return content;
- };
-
- this.record_tag = function(tag) { //function to record a tag and its parent in this.tags Object
- if (this.tags[tag + 'count']) { //check for the existence of this tag type
- this.tags[tag + 'count']++;
- this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level
- } else { //otherwise initialize this tag type
- this.tags[tag + 'count'] = 1;
- this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level
- }
- this.tags[tag + this.tags[tag + 'count'] + 'parent'] = this.tags.parent; //set the parent (i.e. in the case of a div this.tags.div1parent)
- this.tags.parent = tag + this.tags[tag + 'count']; //and make this the current parent (i.e. in the case of a div 'div1')
- };
-
- this.retrieve_tag = function(tag) { //function to retrieve the opening tag to the corresponding closer
- if (this.tags[tag + 'count']) { //if the openener is not in the Object we ignore it
- var temp_parent = this.tags.parent; //check to see if it's a closable tag.
- while (temp_parent) { //till we reach '' (the initial value);
- if (tag + this.tags[tag + 'count'] === temp_parent) { //if this is it use it
- break;
- }
- temp_parent = this.tags[temp_parent + 'parent']; //otherwise keep on climbing up the DOM Tree
- }
- if (temp_parent) { //if we caught something
- this.indent_level = this.tags[tag + this.tags[tag + 'count']]; //set the indent_level accordingly
- this.tags.parent = this.tags[temp_parent + 'parent']; //and set the current parent
- }
- delete this.tags[tag + this.tags[tag + 'count'] + 'parent']; //delete the closed tags parent reference...
- delete this.tags[tag + this.tags[tag + 'count']]; //...and the tag itself
- if (this.tags[tag + 'count'] === 1) {
- delete this.tags[tag + 'count'];
- } else {
- this.tags[tag + 'count']--;
- }
- }
- };
-
- this.indent_to_tag = function(tag) {
- // Match the indentation level to the last use of this tag, but don't remove it.
- if (!this.tags[tag + 'count']) {
- return;
- }
- var temp_parent = this.tags.parent;
- while (temp_parent) {
- if (tag + this.tags[tag + 'count'] === temp_parent) {
- break;
- }
- temp_parent = this.tags[temp_parent + 'parent'];
- }
- if (temp_parent) {
- this.indent_level = this.tags[tag + this.tags[tag + 'count']];
- }
- };
-
- this.get_tag = function(peek) { //function to get a full tag and parse its type
- var input_char = '',
- content = [],
- comment = '',
- space = false,
- first_attr = true,
- tag_start, tag_end,
- tag_start_char,
- orig_pos = this.pos,
- orig_line_char_count = this.line_char_count;
-
- peek = peek !== undefined ? peek : false;
-
- do {
- if (this.pos >= this.input.length) {
- if (peek) {
- this.pos = orig_pos;
- this.line_char_count = orig_line_char_count;
- }
- return content.length ? content.join('') : ['', 'TK_EOF'];
- }
-
- input_char = this.input.charAt(this.pos);
- this.pos++;
-
- if (this.Utils.in_array(input_char, this.Utils.whitespace)) { //don't want to insert unnecessary space
- space = true;
- continue;
- }
-
- if (input_char === "'" || input_char === '"') {
- input_char += this.get_unformatted(input_char);
- space = true;
-
- }
-
- if (input_char === '=') { //no space before =
- space = false;
- }
-
- if (content.length && content[content.length - 1] !== '=' && input_char !== '>' && space) {
- //no space after = or before >
- this.space_or_wrap(content);
- space = false;
- if (!first_attr && wrap_attributes === 'force' && input_char !== '/') {
- this.print_newline(true, content);
- this.print_indentation(content);
- for (var count = 0; count < wrap_attributes_indent_size; count++) {
- content.push(indent_character);
- }
- }
- for (var i = 0; i < content.length; i++) {
- if (content[i] === ' ') {
- first_attr = false;
- break;
- }
- }
- }
-
- if (indent_handlebars && tag_start_char === '<') {
- // When inside an angle-bracket tag, put spaces around
- // handlebars not inside of strings.
- if ((input_char + this.input.charAt(this.pos)) === '{{') {
- input_char += this.get_unformatted('}}');
- if (content.length && content[content.length - 1] !== ' ' && content[content.length - 1] !== '<') {
- input_char = ' ' + input_char;
- }
- space = true;
- }
- }
-
- if (input_char === '<' && !tag_start_char) {
- tag_start = this.pos - 1;
- tag_start_char = '<';
- }
-
- if (indent_handlebars && !tag_start_char) {
- if (content.length >= 2 && content[content.length - 1] === '{' && content[content.length - 2] === '{') {
- if (input_char === '#' || input_char === '/' || input_char === '!') {
- tag_start = this.pos - 3;
- } else {
- tag_start = this.pos - 2;
- }
- tag_start_char = '{';
- }
- }
-
- this.line_char_count++;
- content.push(input_char); //inserts character at-a-time (or string)
-
- if (content[1] && (content[1] === '!' || content[1] === '?' || content[1] === '%')) { //if we're in a comment, do something special
- // We treat all comments as literals, even more than preformatted tags
- // we just look for the appropriate close tag
- content = [this.get_comment(tag_start)];
- break;
- }
-
- if (indent_handlebars && content[1] && content[1] === '{' && content[2] && content[2] === '!') { //if we're in a comment, do something special
- // We treat all comments as literals, even more than preformatted tags
- // we just look for the appropriate close tag
- content = [this.get_comment(tag_start)];
- break;
- }
-
- if (indent_handlebars && tag_start_char === '{' && content.length > 2 && content[content.length - 2] === '}' && content[content.length - 1] === '}') {
- break;
- }
- } while (input_char !== '>');
-
- var tag_complete = content.join('');
- var tag_index;
- var tag_offset;
-
- if (tag_complete.indexOf(' ') !== -1) { //if there's whitespace, thats where the tag name ends
- tag_index = tag_complete.indexOf(' ');
- } else if (tag_complete.charAt(0) === '{') {
- tag_index = tag_complete.indexOf('}');
- } else { //otherwise go with the tag ending
- tag_index = tag_complete.indexOf('>');
- }
- if (tag_complete.charAt(0) === '<' || !indent_handlebars) {
- tag_offset = 1;
- } else {
- tag_offset = tag_complete.charAt(2) === '#' ? 3 : 2;
- }
- var tag_check = tag_complete.substring(tag_offset, tag_index).toLowerCase();
- if (tag_complete.charAt(tag_complete.length - 2) === '/' ||
- this.Utils.in_array(tag_check, this.Utils.single_token)) { //if this tag name is a single tag type (either in the list or has a closing /)
- if (!peek) {
- this.tag_type = 'SINGLE';
- }
- } else if (indent_handlebars && tag_complete.charAt(0) === '{' && tag_check === 'else') {
- if (!peek) {
- this.indent_to_tag('if');
- this.tag_type = 'HANDLEBARS_ELSE';
- this.indent_content = true;
- this.traverse_whitespace();
- }
- } else if (this.is_unformatted(tag_check, unformatted)) { // do not reformat the "unformatted" tags
- comment = this.get_unformatted('' + tag_check + '>', tag_complete); //...delegate to get_unformatted function
- content.push(comment);
- tag_end = this.pos - 1;
- this.tag_type = 'SINGLE';
- } else if (tag_check === 'script' &&
- (tag_complete.search('type') === -1 ||
- (tag_complete.search('type') > -1 &&
- tag_complete.search(/\b(text|application)\/(x-)?(javascript|ecmascript|jscript|livescript)/) > -1))) {
- if (!peek) {
- this.record_tag(tag_check);
- this.tag_type = 'SCRIPT';
- }
- } else if (tag_check === 'style' &&
- (tag_complete.search('type') === -1 ||
- (tag_complete.search('type') > -1 && tag_complete.search('text/css') > -1))) {
- if (!peek) {
- this.record_tag(tag_check);
- this.tag_type = 'STYLE';
- }
- } else if (tag_check.charAt(0) === '!') { //peek for ',
- matched = false;
-
- this.pos = start_pos;
- input_char = this.input.charAt(this.pos);
- this.pos++;
-
- while (this.pos <= this.input.length) {
- comment += input_char;
-
- // only need to check for the delimiter if the last chars match
- if (comment.charAt(comment.length - 1) === delimiter.charAt(delimiter.length - 1) &&
- comment.indexOf(delimiter) !== -1) {
- break;
- }
-
- // only need to search for custom delimiter for the first few characters
- if (!matched && comment.length < 10) {
- if (comment.indexOf('';
- matched = true;
- } else if (comment.indexOf('';
- matched = true;
- } else if (comment.indexOf('';
- matched = true;
- } else if (comment.indexOf('';
- matched = true;
- } else if (comment.indexOf('{{!') === 0) { // {{! handlebars comment
- delimiter = '}}';
- matched = true;
- } else if (comment.indexOf('') === 0) { // {{! handlebars comment
- delimiter = '?>';
- matched = true;
- } else if (comment.indexOf('<%') === 0) { // {{! handlebars comment
- delimiter = '%>';
- matched = true;
- }
- }
-
- input_char = this.input.charAt(this.pos);
- this.pos++;
- }
-
- return comment;
- };
-
- this.get_unformatted = function(delimiter, orig_tag) { //function to return unformatted content in its entirety
-
- if (orig_tag && orig_tag.toLowerCase().indexOf(delimiter) !== -1) {
- return '';
- }
- var input_char = '';
- var content = '';
- var min_index = 0;
- var space = true;
- do {
-
- if (this.pos >= this.input.length) {
- return content;
- }
-
- input_char = this.input.charAt(this.pos);
- this.pos++;
-
- if (this.Utils.in_array(input_char, this.Utils.whitespace)) {
- if (!space) {
- this.line_char_count--;
- continue;
- }
- if (input_char === '\n' || input_char === '\r') {
- content += '\n';
- /* Don't change tab indention for unformatted blocks. If using code for html editing, this will greatly affect tags if they are specified in the 'unformatted array'
- for (var i=0; i]*>\s*$/);
-
- // if next_tag comes back but is not an isolated tag, then
- // let's treat the 'a' tag as having content
- // and respect the unformatted option
- if (!tag || this.Utils.in_array(tag, unformatted)) {
- return true;
- } else {
- return false;
- }
- };
-
- this.printer = function(js_source, indent_character, indent_size, wrap_line_length, brace_style) { //handles input/output and some other printing functions
-
- this.input = js_source || ''; //gets the input for the Parser
-
- // HACK: newline parsing inconsistent. This brute force normalizes the input.
- this.input = this.input.replace(/\r\n|[\r\u2028\u2029]/g, '\n')
-
- this.output = [];
- this.indent_character = indent_character;
- this.indent_string = '';
- this.indent_size = indent_size;
- this.brace_style = brace_style;
- this.indent_level = 0;
- this.wrap_line_length = wrap_line_length;
- this.line_char_count = 0; //count to see if wrap_line_length was exceeded
-
- for (var i = 0; i < this.indent_size; i++) {
- this.indent_string += this.indent_character;
- }
-
- this.print_newline = function(force, arr) {
- this.line_char_count = 0;
- if (!arr || !arr.length) {
- return;
- }
- if (force || (arr[arr.length - 1] !== '\n')) { //we might want the extra line
- if ((arr[arr.length - 1] !== '\n')) {
- arr[arr.length - 1] = rtrim(arr[arr.length - 1]);
- }
- arr.push('\n');
- }
- };
-
- this.print_indentation = function(arr) {
- for (var i = 0; i < this.indent_level; i++) {
- arr.push(this.indent_string);
- this.line_char_count += this.indent_string.length;
- }
- };
-
- this.print_token = function(text) {
- // Avoid printing initial whitespace.
- if (this.is_whitespace(text) && !this.output.length) {
- return;
- }
- if (text || text !== '') {
- if (this.output.length && this.output[this.output.length - 1] === '\n') {
- this.print_indentation(this.output);
- text = ltrim(text);
- }
- }
- this.print_token_raw(text);
- };
-
- this.print_token_raw = function(text) {
- // If we are going to print newlines, truncate trailing
- // whitespace, as the newlines will represent the space.
- if (this.newlines > 0) {
- text = rtrim(text);
- }
-
- if (text && text !== '') {
- if (text.length > 1 && text.charAt(text.length - 1) === '\n') {
- // unformatted tags can grab newlines as their last character
- this.output.push(text.slice(0, -1));
- this.print_newline(false, this.output);
- } else {
- this.output.push(text);
- }
- }
-
- for (var n = 0; n < this.newlines; n++) {
- this.print_newline(n > 0, this.output);
- }
- this.newlines = 0;
- };
-
- this.indent = function() {
- this.indent_level++;
- };
-
- this.unindent = function() {
- if (this.indent_level > 0) {
- this.indent_level--;
- }
- };
- };
- return this;
- }
-
- /*_____________________--------------------_____________________*/
-
- multi_parser = new Parser(); //wrapping functions Parser
- multi_parser.printer(html_source, indent_character, indent_size, wrap_line_length, brace_style); //initialize starting values
-
- while (true) {
- var t = multi_parser.get_token();
- multi_parser.token_text = t[0];
- multi_parser.token_type = t[1];
-
- if (multi_parser.token_type === 'TK_EOF') {
- break;
- }
-
- switch (multi_parser.token_type) {
- case 'TK_TAG_START':
- multi_parser.print_newline(false, multi_parser.output);
- multi_parser.print_token(multi_parser.token_text);
- if (multi_parser.indent_content) {
- multi_parser.indent();
- multi_parser.indent_content = false;
- }
- multi_parser.current_mode = 'CONTENT';
- break;
- case 'TK_TAG_STYLE':
- case 'TK_TAG_SCRIPT':
- multi_parser.print_newline(false, multi_parser.output);
- multi_parser.print_token(multi_parser.token_text);
- multi_parser.current_mode = 'CONTENT';
- break;
- case 'TK_TAG_END':
- //Print new line only if the tag has no content and has child
- if (multi_parser.last_token === 'TK_CONTENT' && multi_parser.last_text === '') {
- var tag_name = multi_parser.token_text.match(/\w+/)[0];
- var tag_extracted_from_last_output = null;
- if (multi_parser.output.length) {
- tag_extracted_from_last_output = multi_parser.output[multi_parser.output.length - 1].match(/(?:<|{{#)\s*(\w+)/);
- }
- if (tag_extracted_from_last_output === null ||
- (tag_extracted_from_last_output[1] !== tag_name && !multi_parser.Utils.in_array(tag_extracted_from_last_output[1], unformatted))) {
- multi_parser.print_newline(false, multi_parser.output);
- }
- }
- multi_parser.print_token(multi_parser.token_text);
- multi_parser.current_mode = 'CONTENT';
- break;
- case 'TK_TAG_SINGLE':
- // Don't add a newline before elements that should remain unformatted.
- var tag_check = multi_parser.token_text.match(/^\s*<([a-z-]+)/i);
- if (!tag_check || !multi_parser.Utils.in_array(tag_check[1], unformatted)) {
- multi_parser.print_newline(false, multi_parser.output);
- }
- multi_parser.print_token(multi_parser.token_text);
- multi_parser.current_mode = 'CONTENT';
- break;
- case 'TK_TAG_HANDLEBARS_ELSE':
- multi_parser.print_token(multi_parser.token_text);
- if (multi_parser.indent_content) {
- multi_parser.indent();
- multi_parser.indent_content = false;
- }
- multi_parser.current_mode = 'CONTENT';
- break;
- case 'TK_TAG_HANDLEBARS_COMMENT':
- multi_parser.print_token(multi_parser.token_text);
- multi_parser.current_mode = 'TAG';
- break;
- case 'TK_CONTENT':
- multi_parser.print_token(multi_parser.token_text);
- multi_parser.current_mode = 'TAG';
- break;
- case 'TK_STYLE':
- case 'TK_SCRIPT':
- if (multi_parser.token_text !== '') {
- multi_parser.print_newline(false, multi_parser.output);
- var text = multi_parser.token_text,
- _beautifier,
- script_indent_level = 1;
- if (multi_parser.token_type === 'TK_SCRIPT') {
- _beautifier = typeof js_beautify === 'function' && js_beautify;
- } else if (multi_parser.token_type === 'TK_STYLE') {
- _beautifier = typeof css_beautify === 'function' && css_beautify;
- }
-
- if (options.indent_scripts === "keep") {
- script_indent_level = 0;
- } else if (options.indent_scripts === "separate") {
- script_indent_level = -multi_parser.indent_level;
- }
-
- var indentation = multi_parser.get_full_indent(script_indent_level);
- if (_beautifier) {
-
- // call the Beautifier if avaliable
- var Child_options = function() {
- this.eol = '\n';
- };
- Child_options.prototype = options;
- var child_options = new Child_options();
- text = _beautifier(text.replace(/^\s*/, indentation), child_options);
- } else {
- // simply indent the string otherwise
- var white = text.match(/^\s*/)[0];
- var _level = white.match(/[^\n\r]*$/)[0].split(multi_parser.indent_string).length - 1;
- var reindent = multi_parser.get_full_indent(script_indent_level - _level);
- text = text.replace(/^\s*/, indentation)
- .replace(/\r\n|\r|\n/g, '\n' + reindent)
- .replace(/\s+$/, '');
- }
- if (text) {
- multi_parser.print_token_raw(text);
- multi_parser.print_newline(true, multi_parser.output);
- }
- }
- multi_parser.current_mode = 'TAG';
- break;
- default:
- // We should not be getting here but we don't want to drop input on the floor
- // Just output the text and move on
- if (multi_parser.token_text !== '') {
- multi_parser.print_token(multi_parser.token_text);
- }
- break;
- }
- multi_parser.last_token = multi_parser.token_type;
- multi_parser.last_text = multi_parser.token_text;
- }
- var sweet_code = multi_parser.output.join('').replace(/[\r\n\t ]+$/, '');
-
- // establish end_with_newline
- if (end_with_newline) {
- sweet_code += '\n';
- }
-
- if (eol != '\n') {
- sweet_code = sweet_code.replace(/[\n]/g, eol);
- }
-
- return sweet_code;
- }
-
- if (typeof define === "function" && define.amd) {
- // Add support for AMD ( https://github.com/amdjs/amdjs-api/wiki/AMD#defineamd-property- )
- define(["require", "./beautify", "./beautify-css"], function(requireamd) {
- var js_beautify = requireamd("./beautify");
- var css_beautify = requireamd("./beautify-css");
-
- return {
- html_beautify: function(html_source, options) {
- return style_html(html_source, options, js_beautify.js_beautify, css_beautify.css_beautify);
- }
- };
- });
- } else if (typeof exports !== "undefined") {
- // Add support for CommonJS. Just put this file somewhere on your require.paths
- // and you will be able to `var html_beautify = require("beautify").html_beautify`.
- var js_beautify = require('./beautify.js');
- var css_beautify = require('./beautify-css.js');
-
- exports.html_beautify = function(html_source, options) {
- return style_html(html_source, options, js_beautify.js_beautify, css_beautify.css_beautify);
- };
- } else if (typeof window !== "undefined") {
- // If we're running a web page and don't have either of the above, add our one global
- window.html_beautify = function(html_source, options) {
- return style_html(html_source, options, window.js_beautify, window.css_beautify);
- };
- } else if (typeof global !== "undefined") {
- // If we don't even have window, try global.
- global.html_beautify = function(html_source, options) {
- return style_html(html_source, options, global.js_beautify, global.css_beautify);
- };
- }
-
-}());
+(function(){var p=function(g){function h(a){if(f[a])return f[a].exports;var d=f[a]={i:a,l:!1,exports:{}};g[a].call(d.exports,d,d.exports,h);d.l=!0;return d.exports}var f={};h.m=g;h.c=f;h.d=function(a,d,c){h.o(a,d)||Object.defineProperty(a,d,{enumerable:!0,get:c})};h.r=function(a){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"});Object.defineProperty(a,"__esModule",{value:!0})};h.t=function(a,d){d&1&&(a=h(a));if(d&8||d&4&&"object"===typeof a&&
+a&&a.__esModule)return a;var c=Object.create(null);h.r(c);Object.defineProperty(c,"default",{enumerable:!0,value:a});if(d&2&&"string"!=typeof a)for(var b in a)h.d(c,b,function(b){return a[b]}.bind(null,b));return c};h.n=function(a){var d=a&&a.__esModule?function(){return a["default"]}:function(){return a};h.d(d,"a",d);return d};h.o=function(a,d){return Object.prototype.hasOwnProperty.call(a,d)};h.p="";return h(h.s=18)}([,,function(g,h,f){function a(b){this.__parent=b;this.__character_count=0;this.__indent_count=
+-1;this.__wrap_point_character_count=this.__wrap_point_index=this.__alignment_count=0;this.__wrap_point_indent_count=-1;this.__wrap_point_alignment_count=0;this.__items=[]}function d(b,e){this.__cache=[""];this.__indent_size=b.indent_size;this.__indent_string=b.indent_char;b.indent_with_tabs||(this.__indent_string=Array(b.indent_size+1).join(b.indent_char));e=e||"";0b?this.__items[this.__items.length+b]:this.__items[b]};a.prototype.has_match=function(b){for(var e=this.__items.length-1;0<=e;e--)if(this.__items[e].match(b))return!0;return!1};a.prototype.set_indent=function(b,e){this.is_empty()&&(this.__indent_count=b||0,this.__alignment_count=e||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))};a.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&
+(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)};a.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count};a.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();
+var b=this.__parent.current_line;b.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count);b.__items=this.__items.slice(this.__wrap_point_index);this.__items=this.__items.slice(0,this.__wrap_point_index);b.__character_count+=this.__character_count-this.__wrap_point_character_count;this.__character_count=this.__wrap_point_character_count;" "===b.__items[0]&&(b.__items.splice(0,1),--b.__character_count);return!0}return!1};a.prototype.is_empty=function(){return 0===this.__items.length};
+a.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]};a.prototype.push=function(b){this.__items.push(b);var e=b.lastIndexOf("\n");this.__character_count=-1!==e?b.length-e:this.__character_count+b.length};a.prototype.pop=function(){var b=null;this.is_empty()||(b=this.__items.pop(),this.__character_count-=b.length);return b};a.prototype._remove_indent=function(){0b&&(c=0);c+=b*this.__indent_size;return c+=e||0};d.prototype.get_indent_string=function(b,e){var c=this.__base_string;0>b&&(b=0,c="");e=(e||0)+b*this.__indent_size;this.__ensure_cache(e);return c+=this.__cache[e]};d.prototype.__ensure_cache=function(b){for(;b>=this.__cache.length;)this.__add_column()};d.prototype.__add_column=function(){var b=this.__cache.length,e=0,e="";this.__indent_size&&b>=this.__indent_size&&(e=Math.floor(b/this.__indent_size),b-=e*this.__indent_size,e=Array(e+1).join(this.__indent_string));
+b&&(e+=Array(b+1).join(" "));this.__cache.push(e)};c.prototype.__add_outputline=function(){this.previous_line=this.current_line;this.current_line=this.next_line.clone_empty();this.__lines.push(this.current_line)};c.prototype.get_line_number=function(){return this.__lines.length};c.prototype.get_indent_string=function(b,e){return this.__indent_cache.get_indent_string(b,e)};c.prototype.get_indent_size=function(b,e){return this.__indent_cache.get_indent_size(b,e)};c.prototype.is_empty=function(){return!this.previous_line&&
+this.current_line.is_empty()};c.prototype.add_new_line=function(b){if(this.is_empty()||!b&&this.just_added_newline())return!1;this.raw||this.__add_outputline();return!0};c.prototype.get_code=function(b){this.trim(!0);var e=this.current_line.pop();e&&("\n"===e[e.length-1]&&(e=e.replace(/\n+$/g,"")),this.current_line.push(e));this._end_with_newline&&this.__add_outputline();e=this.__lines.join("\n");"\n"!==b&&(e=e.replace(/[\n]/g,b));return e};c.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()};
+c.prototype.set_indent=function(b,e){b=b||0;e=e||0;this.next_line.set_indent(b,e);if(1=c.length&&this.__input.substring(b-c.length,b).toLowerCase()===c};g.exports.InputScanner=a},function(g,h,f){var a=f(8).InputScanner,d=f(3).Token,c=f(10).TokenStream,b=f(11).WhitespacePattern,e={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"};h=function(c,e){this._input=new a(c);this._options=e||{};this.__tokens=null;this._patterns={};this._patterns.whitespace=new b(this._input)};h.prototype.tokenize=function(){this._input.restart();this.__tokens=new c;this._reset();for(var b,a=new d(e.START,
+""),m=null,l=[],f=new c;a.type!==e.EOF;){for(b=this._get_next_token(a,m);this._is_comment(b);)f.add(b),b=this._get_next_token(a,m);f.isEmpty()||(b.comments_before=f,f=new c);b.parent=m;this._is_opening(b)?(l.push(m),m=b):m&&this._is_closing(b,m)&&(b.opened=m,m.closed=b,m=l.pop(),b.parent=m);b.previous=a;a.next=b;this.__tokens.add(b);a=b}return this.__tokens};h.prototype._is_first_token=function(){return this.__tokens.isEmpty()};h.prototype._reset=function(){};h.prototype._get_next_token=function(b,
+c){this._readWhitespace();var a=this._input.read(/.+/g);return a?this._create_token(e.RAW,a):this._create_token(e.EOF,"")};h.prototype._is_comment=function(b){return!1};h.prototype._is_opening=function(b){return!1};h.prototype._is_closing=function(b,c){return!1};h.prototype._create_token=function(b,c){return new d(b,c,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token)};h.prototype._readWhitespace=function(){return this._patterns.whitespace.read()};g.exports.Tokenizer=
+h;g.exports.TOKEN=e},function(g,h,f){function a(a){this.__tokens=[];this.__tokens_length=this.__tokens.length;this.__position=0;this.__parent_token=a}a.prototype.restart=function(){this.__position=0};a.prototype.isEmpty=function(){return 0===this.__tokens_length};a.prototype.hasNext=function(){return this.__position/),erb:f.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:f.starting_with(/{%/).until_after(/%}/),django_value:f.starting_with(/{{/).until_after(/}}/),
+django_comment:f.starting_with(/{#/).until_after(/#}/)}}var d=f(12).Pattern,c={django:!1,erb:!1,handlebars:!1,php:!1};a.prototype=new d;a.prototype._create=function(){return new a(this._input,this)};a.prototype._update=function(){this.__set_templated_pattern()};a.prototype.disable=function(b){var a=this._create();a._disabled[b]=!0;a._update();return a};a.prototype.read_options=function(b){var a=this._create(),d;for(d in c)a._disabled[d]=-1===b.templating.indexOf(d);a._update();return a};a.prototype.exclude=
+function(a){var c=this._create();c._excluded[a]=!0;c._update();return c};a.prototype.read=function(){for(var a="",a=this._match_pattern?this._input.read(this._starting_pattern):this._input.read(this._starting_pattern,this.__template_pattern),c=this._read_template();c;)c=this._match_pattern?c+this._input.read(this._match_pattern):c+this._input.readUntil(this.__template_pattern),a+=c,c=this._read_template();this._until_after&&(a+=this._input.readUntilAfter(this._until_pattern));return a};a.prototype.__set_templated_pattern=
+function(){var a=[];this._disabled.php||a.push(this.__patterns.php._starting_pattern.source);this._disabled.handlebars||a.push(this.__patterns.handlebars._starting_pattern.source);this._disabled.erb||a.push(this.__patterns.erb._starting_pattern.source);this._disabled.django||(a.push(this.__patterns.django._starting_pattern.source),a.push(this.__patterns.django_value._starting_pattern.source),a.push(this.__patterns.django_comment._starting_pattern.source));this._until_pattern&&a.push(this._until_pattern.source);
+this.__template_pattern=this._input.get_regexp("(?:"+a.join("|")+")")};a.prototype._read_template=function(){var a="",c=this._input.peek();"\x3c"===c?(c=this._input.peek(1),this._disabled.php||this._excluded.php||"?"!==c||(a=a||this.__patterns.php.read()),this._disabled.erb||this._excluded.erb||"%"!==c||(a=a||this.__patterns.erb.read())):"{"===c&&(this._disabled.handlebars||this._excluded.handlebars||(a=(a=(a=a||this.__patterns.handlebars_comment.read())||this.__patterns.handlebars_unescaped.read())||
+this.__patterns.handlebars.read()),this._disabled.django||(this._excluded.django||this._excluded.handlebars||(a=a||this.__patterns.django_value.read()),this._excluded.django||(a=(a=a||this.__patterns.django_comment.read())||this.__patterns.django.read())));return a};g.exports.TemplatablePattern=a},,,,function(g,h,f){var a=f(19).Beautifier,d=f(20).Options;g.exports=function(c,b,e,d){return(new a(c,b,e,d)).beautify()};g.exports.defaultOptions=function(){return new d}},function(g,h,f){function a(a,c,
+b){this.parent=a||null;this.tag=c?c.tag_name:"";this.indent_level=b||0;this.parser_token=c||null}function d(a){this._printer=a;this._current_frame=null}function c(a,c,u,e){this._source_text=a||"";c=c||{};this._js_beautify=u;this._css_beautify=e;this._tag_stack=null;this._options=new b(c,"html");this._is_wrap_attributes_force="force"===this._options.wrap_attributes.substr(0,5);this._is_wrap_attributes_force_expand_multiline="force-expand-multiline"===this._options.wrap_attributes;this._is_wrap_attributes_force_aligned=
+"force-aligned"===this._options.wrap_attributes;this._is_wrap_attributes_aligned_multiple="aligned-multiple"===this._options.wrap_attributes;this._is_wrap_attributes_preserve="preserve"===this._options.wrap_attributes.substr(0,8);this._is_wrap_attributes_preserve_aligned="preserve-aligned"===this._options.wrap_attributes}var b=f(20).Options,e=f(2).Output,p=f(21).Tokenizer,k=f(21).TOKEN,m=/\r\n|[\r\n]/,l=/\r\n|[\r\n]/g,n=function(a,c){this.alignment_size=this.indent_level=0;this.max_preserve_newlines=
+a.max_preserve_newlines;this.preserve_newlines=a.preserve_newlines;this._output=new e(a,c)};n.prototype.current_line_has_match=function(a){return this._output.current_line.has_match(a)};n.prototype.set_space_before_token=function(a,c){this._output.space_before_token=a;this._output.non_breaking_space=c};n.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size);this._output.set_wrap_point()};n.prototype.add_raw_token=function(a){this._output.add_raw_token(a)};
+n.prototype.print_preserved_newlines=function(a){var c=0;a.type!==k.TEXT&&a.previous.type!==k.TEXT&&(c=a.newlines?1:0);this.preserve_newlines&&(c=a.newlinesa?"":this._output.get_indent_string(a)};d.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null};d.prototype.record_tag=
+function(c){this._current_frame=new a(this._current_frame,c,this._printer.indent_level)};d.prototype._try_pop_frame=function(a){var c=null;a&&(c=a.parser_token,this._printer.indent_level=a.indent_level,this._current_frame=a.parent);return c};d.prototype._get_frame=function(a,c){for(var b=this._current_frame;b&&-1===a.indexOf(b.tag);){if(c&&-1!==c.indexOf(b.tag)){b=null;break}b=b.parent}return b};d.prototype.try_pop=function(a,c){var b=this._get_frame([a],c);return this._try_pop_frame(b)};d.prototype.indent_to_tag=
+function(a){if(a=this._get_frame(a))this._printer.indent_level=a.indent_level};c.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var a=this._source_text,c=this._options.eol;"auto"===this._options.eol&&(c="\n",a&&m.test(a)&&(c=a.match(m)[0]));var a=a.replace(l,"\n"),b=a.match(/^[\t ]*/)[0],e={text:"",type:""},f=new t,b=new n(this._options,b),a=(new p(a,this._options)).tokenize();this._tag_stack=new d(b);for(var h=null,g=a.next();g.type!==k.EOF;)g.type===k.TAG_OPEN||
+g.type===k.COMMENT?f=h=this._handle_tag_open(b,g,f,e):g.type===k.ATTRIBUTE||g.type===k.EQUALS||g.type===k.VALUE||g.type===k.TEXT&&!f.tag_complete?h=this._handle_inside_tag(b,g,f,a):g.type===k.TAG_CLOSE?h=this._handle_tag_close(b,g,f):g.type===k.TEXT?h=this._handle_text(b,g,f):b.add_raw_token(g),e=h,g=a.next();return b._output.get_code(c)};c.prototype._handle_tag_close=function(a,c,b){var e={text:c.text,type:c.type};a.alignment_size=0;b.tag_complete=!0;a.set_space_before_token(c.newlines||""!==c.whitespace_before,
+!0);b.is_unformatted?a.add_raw_token(c):("\x3c"===b.tag_start_char&&(a.set_space_before_token("/"===c.text[0],!0),this._is_wrap_attributes_force_expand_multiline&&b.has_wrapped_attrs&&a.print_newline(!1)),a.print_token(c));!b.indent_content||b.is_unformatted||b.is_content_unformatted||(a.indent(),b.indent_content=!1);b.is_inline_element||b.is_unformatted||b.is_content_unformatted||a.set_wrap_point();return e};c.prototype._handle_inside_tag=function(a,c,b,e){var d=b.has_wrapped_attrs,f={text:c.text,
+type:c.type};a.set_space_before_token(c.newlines||""!==c.whitespace_before,!0);if(b.is_unformatted)a.add_raw_token(c);else if("{"===b.tag_start_char&&c.type===k.TEXT)a.print_preserved_newlines(c)?(c.newlines=0,a.add_raw_token(c)):a.print_token(c);else{c.type===k.ATTRIBUTE?(a.set_space_before_token(!0),b.attr_count+=1):c.type===k.EQUALS?a.set_space_before_token(!1):c.type===k.VALUE&&c.previous.type===k.EQUALS&&a.set_space_before_token(!1);if(c.type===k.ATTRIBUTE&&"\x3c"===b.tag_start_char){if(this._is_wrap_attributes_preserve||
+this._is_wrap_attributes_preserve_aligned)a.traverse_whitespace(c),d=d||0!==c.newlines;if(this._is_wrap_attributes_force){var l=1m&&g.type!==k.EOF&&g.type!==k.TAG_CLOSE);l=!l}l&&(a.print_newline(!1),d=!0)}}a.print_token(c);d=d||a.previous_token_wrapped();b.has_wrapped_attrs=d}return f};c.prototype._handle_text=function(a,c,b){var e={text:c.text,
+type:"TK_CONTENT"};b.custom_beautifier_name?this._print_custom_beatifier_text(a,c,b):b.is_unformatted||b.is_content_unformatted?a.add_raw_token(c):(a.traverse_whitespace(c),a.print_token(c));return e};c.prototype._print_custom_beatifier_text=function(a,b,e){var k=this;if(""!==b.text){var d=b.text,f,l=1,m="",g="";"javascript"===e.custom_beautifier_name&&"function"===typeof this._js_beautify?f=this._js_beautify:"css"===e.custom_beautifier_name&&"function"===typeof this._css_beautify?f=this._css_beautify:
+"html"===e.custom_beautifier_name&&(f=function(a,b){return(new c(a,b,k._js_beautify,k._css_beautify)).beautify()});"keep"===this._options.indent_scripts?l=0:"separate"===this._options.indent_scripts&&(l=-a.indent_level);l=a.get_full_indent(l);d=d.replace(/\n[ \t]*$/,"");if("html"!==e.custom_beautifier_name&&"\x3c"===d[0]&&d.match(/^(\x3c!--|]*)/))?b[1]:"":(this.tag_check=(b=c.text.match(/^{{(?:[\^]|#\*?)?([^\s}]+)/))?b[1]:"","{{#\x3e"===c.text&&"\x3e"===this.tag_check&&null!==c.next&&(this.tag_check=c.next.text));this.tag_check=this.tag_check.toLowerCase();c.type===k.COMMENT&&(this.tag_complete=!0);this.tag_name=(this.is_start_tag="/"!==this.tag_check.charAt(0))?this.tag_check:this.tag_check.substr(1);this.is_end_tag=
+(this.is_end_tag=!this.is_start_tag||c.closed&&"/\x3e"===c.closed.text)||"{"===this.tag_start_char&&(3>this.text.length||/[^#\^]/.test(this.text.charAt(2)))}else this.tag_complete=!0};c.prototype._get_tag_open_token=function(a){a=new t(this._tag_stack.get_parser_token(),a);a.alignment_size=this._options.wrap_attributes_indent_size;a.is_end_tag=a.is_end_tag||-1!==this._options.void_elements.indexOf(a.tag_check);a.is_empty_element=a.tag_complete||a.is_start_tag&&a.is_end_tag;a.is_unformatted=!a.tag_complete&&
+-1!==this._options.unformatted.indexOf(a.tag_check);a.is_content_unformatted=!a.is_empty_element&&-1!==this._options.content_unformatted.indexOf(a.tag_check);a.is_inline_element=-1!==this._options.inline.indexOf(a.tag_name)||"{"===a.tag_start_char;return a};c.prototype._set_tag_position=function(a,c,b,e,d){if(!b.is_empty_element)if(b.is_end_tag)b.start_tag_token=this._tag_stack.try_pop(b.tag_name);else if(this._do_optional_end_element(b)&&(b.is_inline_element||a.print_newline(!1)),this._tag_stack.record_tag(b),
+!("script"!==b.tag_name&&"style"!==b.tag_name||b.is_unformatted||b.is_content_unformatted)){var f=b.tag_check,l=null,m=null;if(c.closed){"script"===f?l="text/javascript":"style"===f&&(l="text/css");for(var f=null,g=c.next;g.type!==k.EOF&&c.closed!==g;){if(g.type===k.ATTRIBUTE&&"type"===g.text){g.next&&g.next.type===k.EQUALS&&g.next.next&&g.next.next.type===k.VALUE&&(f=g.next.next.text);break}g=g.next}l=f||l;-1]|\/>/),element_name:l.until(/[\n\r\t >\/]/),handlebars_comment:f.starting_with(/{{!--/).until_after(/--}}/),handlebars:f.starting_with(/{{/).until_after(/}}/),handlebars_open:f.until(/[\n\r\t }]/),handlebars_raw_close:f.until(/}}/),comment:f.starting_with(/\x3c!--/).until_after(/--\x3e/),cdata:f.starting_with(//),processing:f.starting_with(/<\?/).until_after(/\?>/)};this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars"));this._unformatted_content_delimiter=null;this._options.unformatted_content_delimiter&&(l=this._input.get_literal_regexp(this._options.unformatted_content_delimiter),this.__patterns.unformatted_content_delimiter=f.matching(l).until_after(l))};f.prototype=new a;f.prototype._is_comment=function(a){return!1};
+f.prototype._is_opening=function(a){return a.type===e.TAG_OPEN};f.prototype._is_closing=function(a,b){return a.type===e.TAG_CLOSE&&b&&(("\x3e"===a.text||"/\x3e"===a.text)&&"\x3c"===b.text[0]||"}}"===a.text&&"{"===b.text[0]&&"{"===b.text[1])};f.prototype._reset=function(){this._current_tag_name=""};f.prototype._get_next_token=function(a,b){var c=null;this._readWhitespace();var d=this._input.peek();return null===d?this._create_token(e.EOF,""):c=(c=(c=(c=(c=(c=(c=(c=(c=c||this._read_open_handlebars(d,
+b))||this._read_attribute(d,a,b))||this._read_close(d,b))||this._read_raw_content(d,a,b))||this._read_content_word(d))||this._read_comment_or_cdata(d))||this._read_processing(d))||this._read_open(d,b))||this._create_token(e.UNKNOWN,this._input.next())};f.prototype._read_comment_or_cdata=function(a){var b=null,c=null,d=null;"\x3c"===a&&("!"===this._input.peek(1)&&((c=this.__patterns.comment.read())?(d=p.get_directives(c))&&"start"===d.ignore&&(c+=p.readIgnored(this._input)):c=this.__patterns.cdata.read()),
+c&&(b=this._create_token(e.COMMENT,c),b.directives=d));return b};f.prototype._read_processing=function(a){var b=null,c=null;if("\x3c"===a){a=this._input.peek(1);if("!"===a||"?"===a)c=(c=this.__patterns.conditional_comment.read())||this.__patterns.processing.read();c&&(b=this._create_token(e.COMMENT,c),b.directives=null)}return b};f.prototype._read_open=function(a,b){var c=null,c=null;b||"\x3c"!==a||(c=this._input.next(),"/"===this._input.peek()&&(c+=this._input.next()),c+=this.__patterns.element_name.read(),
+c=this._create_token(e.TAG_OPEN,c));return c};f.prototype._read_open_handlebars=function(a,b){var c=null,c=null;!b&&this._options.indent_handlebars&&"{"===a&&"{"===this._input.peek(1)&&("!"===this._input.peek(2)?(c=(c=this.__patterns.handlebars_comment.read())||this.__patterns.handlebars.read(),c=this._create_token(e.COMMENT,c)):(c=this.__patterns.handlebars_open.read(),c=this._create_token(e.TAG_OPEN,c)));return c};f.prototype._read_close=function(a,b){var c=null,c=null;b&&("\x3c"===b.text[0]&&("\x3e"===
+a||"/"===a&&"\x3e"===this._input.peek(1))?(c=this._input.next(),"/"===a&&(c+=this._input.next()),c=this._create_token(e.TAG_CLOSE,c)):"{"===b.text[0]&&"}"===a&&"}"===this._input.peek(1)&&(this._input.next(),this._input.next(),c=this._create_token(e.TAG_CLOSE,"}}")));return c};f.prototype._read_attribute=function(a,b,c){var d=null,f="";c&&"\x3c"===c.text[0]&&("\x3d"===a?d=this._create_token(e.EQUALS,this._input.next()):'"'===a||"'"===a?(b=this._input.next(),b='"'===a?b+this.__patterns.double_quote.read():
+b+this.__patterns.single_quote.read(),d=this._create_token(e.VALUE,b)):(f=this.__patterns.attribute.read())&&(d=b.type===e.EQUALS?this._create_token(e.VALUE,f):this._create_token(e.ATTRIBUTE,f)));return d};f.prototype._is_content_unformatted=function(a){return-1===this._options.void_elements.indexOf(a)&&(-1!==this._options.content_unformatted.indexOf(a)||-1!==this._options.unformatted.indexOf(a))};f.prototype._read_raw_content=function(a,b,c){var d="";if(c&&"{"===c.text[0])d=this.__patterns.handlebars_raw_close.read();
+else if(b.type===e.TAG_CLOSE&&"\x3c"===b.opened.text[0]&&"/"!==b.text[0])if(b=b.opened.text.substr(1).toLowerCase(),"script"===b||"style"===b){if(a=this._read_comment_or_cdata(a))return a.type=e.TEXT,a;d=this._input.readUntil(new RegExp("\x3c/"+b+"[\\n\\r\\t ]*?\x3e","ig"))}else this._is_content_unformatted(b)&&(d=this._input.readUntil(new RegExp("\x3c/"+b+"[\\n\\r\\t ]*?\x3e","ig")));return d?this._create_token(e.TEXT,d):null};f.prototype._read_content_word=function(a){var b="";this._options.unformatted_content_delimiter&&
+a===this._options.unformatted_content_delimiter[0]&&(b=this.__patterns.unformatted_content_delimiter.read());b||(b=this.__patterns.word.read());if(b)return this._create_token(e.TEXT,b)};g.exports.Tokenizer=f;g.exports.TOKEN=e}]);if("function"===typeof define&&define.amd)define(["require","./beautify","./beautify-css"],function(g){var h=g("./beautify"),f=g("./beautify-css");return{html_beautify:function(a,d){return p(a,d,h.js_beautify,f.css_beautify)}}});else if("undefined"!==typeof exports){var q=
+require("./beautify.js"),r=require("./beautify-css.js");exports.html_beautify=function(g,h){return p(g,h,q.js_beautify,r.css_beautify)}}else"undefined"!==typeof window?window.html_beautify=function(g,h){return p(g,h,window.js_beautify,window.css_beautify)}:"undefined"!==typeof global&&(global.html_beautify=function(g,h){return p(g,h,global.js_beautify,global.css_beautify)})})();
\ No newline at end of file
diff --git a/assets/packages/ckeditor/plugins/codemirror/js/beautify.min.js b/assets/packages/ckeditor/plugins/codemirror/js/beautify.min.js
index fd285bf7ba3..64055a6cfa3 100644
--- a/assets/packages/ckeditor/plugins/codemirror/js/beautify.min.js
+++ b/assets/packages/ckeditor/plugins/codemirror/js/beautify.min.js
@@ -1,2 +1,204 @@
-!function(){function t(t,e){for(var n=0;nn&&(n=t.line_indent_level)),{mode:e,parent:t,last_text:t?t.last_text:"",last_word:t?t.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,if_block:!1,else_block:!1,do_block:!1,do_while:!1,in_case_statement:!1,in_case:!1,case_body:!1,indentation_level:n,line_indent_level:t?t.line_indent_level:n,start_line_index:z.get_line_number(),ternary_depth:0}}function h(t){var e=t.newlines;if(et.keep_array_indentation&&x(q.mode))for(n=0;n0);else if(et.max_preserve_newlines&&e>et.max_preserve_newlines&&(e=et.max_preserve_newlines),et.preserve_newlines&&t.newlines>1){p();for(var n=1;n=et.wrap_line_length&&p(!1,!0)}}function p(t,e){if(!e&&";"!==q.last_text&&","!==q.last_text&&"="!==q.last_text&&"TK_OPERATOR"!==$)for(;q.mode===l.Statement&&!q.if_block&&!q.do_block;)K();z.add_new_line(t)&&(q.multiline_frame=!0)}function f(){z.just_added_newline()&&(et.keep_array_indentation&&x(q.mode)&&F.wanted_newline?(z.current_line.push(F.whitespace_before),z.space_before_token=!1):z.set_indent(q.indentation_level)&&(q.line_indent_level=q.indentation_level))}function d(t){if(z.raw)return void z.add_raw_token(F);et.comma_first&&"TK_COMMA"===$&&z.just_added_newline()&&","===z.previous_line.last()&&(z.previous_line.pop(),f(),z.add_token(","),z.space_before_token=!0),t=t||F.text,f(),z.add_token(t)}function T(){q.indentation_level+=1}function E(){q.indentation_level>0&&(!q.parent||q.indentation_level>q.parent.indentation_level)&&(q.indentation_level-=1)}function g(t){q?(Z.push(q),H=q):H=s(null,t),q=s(H,t)}function x(t){return t===l.ArrayLiteral}function b(e){return t(e,[l.Expression,l.ForInitializer,l.Conditional])}function K(){Z.length>0&&(H=q,q=Z.pop(),H.mode===l.Statement&&z.remove_redundant_indentation(H))}function w(){return q.parent.mode===l.ObjectLiteral&&q.mode===l.Statement&&(":"===q.last_text&&0===q.ternary_depth||"TK_RESERVED"===$&&t(q.last_text,["get","set"]))}function R(){return!!("TK_RESERVED"===$&&t(q.last_text,["var","let","const"])&&"TK_WORD"===F.type||"TK_RESERVED"===$&&"do"===q.last_text||"TK_RESERVED"===$&&"return"===q.last_text&&!F.wanted_newline||"TK_RESERVED"===$&&"else"===q.last_text&&("TK_RESERVED"!==F.type||"if"!==F.text)||"TK_END_EXPR"===$&&(H.mode===l.ForInitializer||H.mode===l.Conditional)||"TK_WORD"===$&&q.mode===l.BlockStatement&&!q.in_case&&"--"!==F.text&&"++"!==F.text&&"function"!==Q&&"TK_WORD"!==F.type&&"TK_RESERVED"!==F.type||q.mode===l.ObjectLiteral&&(":"===q.last_text&&0===q.ternary_depth||"TK_RESERVED"===$&&t(q.last_text,["get","set"])))&&(g(l.Statement),T(),"TK_RESERVED"===$&&t(q.last_text,["var","let","const"])&&"TK_WORD"===F.type&&(q.declaration_statement=!0),w()||u("TK_RESERVED"===F.type&&t(F.text,["do","for","if","while"])),!0)}function m(t,n){for(var i=0;i=nt.length?null:nt[e]}function k(){R();var e=l.Expression;if("["===F.text){if("TK_WORD"===$||")"===q.last_text)return"TK_RESERVED"===$&&t(q.last_text,X.line_starters)&&(z.space_before_token=!0),g(e),d(),T(),void(et.space_in_paren&&(z.space_before_token=!0));e=l.ArrayLiteral,x(q.mode)&&("["!==q.last_text&&(","!==q.last_text||"]"!==Q&&"}"!==Q)||et.keep_array_indentation||p())}else"TK_RESERVED"===$&&"for"===q.last_text?e=l.ForInitializer:"TK_RESERVED"===$&&t(q.last_text,["if","while"])&&(e=l.Conditional);";"===q.last_text||"TK_START_BLOCK"===$?p():"TK_END_EXPR"===$||"TK_START_EXPR"===$||"TK_END_BLOCK"===$||"."===q.last_text?u(F.wanted_newline):"TK_RESERVED"===$&&"("===F.text||"TK_WORD"===$||"TK_OPERATOR"===$?"TK_RESERVED"===$&&("function"===q.last_word||"typeof"===q.last_word)||"*"===q.last_text&&"function"===Q?et.space_after_anon_function&&(z.space_before_token=!0):"TK_RESERVED"!==$||!t(q.last_text,X.line_starters)&&"catch"!==q.last_text||et.space_before_conditional&&(z.space_before_token=!0):z.space_before_token=!0,"("===F.text&&"TK_RESERVED"===$&&"await"===q.last_word&&(z.space_before_token=!0),"("===F.text&&("TK_EQUALS"!==$&&"TK_OPERATOR"!==$||w()||u()),g(e),d(),et.space_in_paren&&(z.space_before_token=!0),T()}function S(){for(;q.mode===l.Statement;)K();q.multiline_frame&&u("]"===F.text&&x(q.mode)&&!et.keep_array_indentation),et.space_in_paren&&("TK_START_EXPR"!==$||et.space_in_empty_paren?z.space_before_token=!0:(z.trim(),z.space_before_token=!1)),"]"===F.text&&et.keep_array_indentation?(d(),K()):(K(),d()),z.remove_redundant_indentation(H),q.do_while&&H.mode===l.Conditional&&(H.mode=l.Expression,q.do_block=!1,q.do_while=!1)}function O(){var e=A(1),n=A(2);g(n&&(":"===n.text&&t(e.type,["TK_STRING","TK_WORD","TK_RESERVED"])||t(e.text,["get","set"])&&t(n.type,["TK_WORD","TK_RESERVED"]))?t(Q,["class","interface"])?l.BlockStatement:l.ObjectLiteral:l.BlockStatement);var i=!e.comments_before.length&&"}"===e.text,r=i&&"function"===q.last_word&&"TK_END_EXPR"===$;"expand"===et.brace_style||"none"===et.brace_style&&F.wanted_newline?"TK_OPERATOR"!==$&&(r||"TK_EQUALS"===$||"TK_RESERVED"===$&&v(q.last_text)&&"else"!==q.last_text)?z.space_before_token=!0:p(!1,!0):"TK_OPERATOR"!==$&&"TK_START_EXPR"!==$?"TK_START_BLOCK"===$?p():z.space_before_token=!0:x(H.mode)&&","===q.last_text&&("}"===Q?z.space_before_token=!0:p()),d(),T()}function N(){for(;q.mode===l.Statement;)K();var t="TK_START_BLOCK"===$;"expand"===et.brace_style?t||p():t||(x(q.mode)&&et.keep_array_indentation?(et.keep_array_indentation=!1,p(),et.keep_array_indentation=!0):p()),K(),d()}function D(){if("TK_RESERVED"===F.type&&q.mode!==l.ObjectLiteral&&t(F.text,["set","get"])&&(F.type="TK_WORD"),"TK_RESERVED"===F.type&&q.mode===l.ObjectLiteral){":"==A(1).text&&(F.type="TK_WORD")}if(R()||!F.wanted_newline||b(q.mode)||"TK_OPERATOR"===$&&"--"!==q.last_text&&"++"!==q.last_text||"TK_EQUALS"===$||!et.preserve_newlines&&"TK_RESERVED"===$&&t(q.last_text,["var","let","const","set","get"])||p(),q.do_block&&!q.do_while){if("TK_RESERVED"===F.type&&"while"===F.text)return z.space_before_token=!0,d(),z.space_before_token=!0,void(q.do_while=!0);p(),q.do_block=!1}if(q.if_block)if(q.else_block||"TK_RESERVED"!==F.type||"else"!==F.text){for(;q.mode===l.Statement;)K();q.if_block=!1,q.else_block=!1}else q.else_block=!0;if("TK_RESERVED"===F.type&&("case"===F.text||"default"===F.text&&q.in_case_statement))return p(),(q.case_body||et.jslint_happy)&&(E(),q.case_body=!1),d(),q.in_case=!0,void(q.in_case_statement=!0);if("TK_RESERVED"===F.type&&"function"===F.text&&((t(q.last_text,["}",";"])||z.just_added_newline()&&!t(q.last_text,["[","{",":","=",","]))&&(z.just_added_blankline()||F.comments_before.length||(p(),p(!0))),"TK_RESERVED"===$||"TK_WORD"===$?"TK_RESERVED"===$&&t(q.last_text,["get","set","new","return","export","async"])?z.space_before_token=!0:"TK_RESERVED"===$&&"default"===q.last_text&&"export"===Q?z.space_before_token=!0:p():"TK_OPERATOR"===$||"="===q.last_text?z.space_before_token=!0:(q.multiline_frame||!b(q.mode)&&!x(q.mode))&&p()),"TK_COMMA"!==$&&"TK_START_EXPR"!==$&&"TK_EQUALS"!==$&&"TK_OPERATOR"!==$||w()||u(),"TK_RESERVED"===F.type&&t(F.text,["function","get","set"]))return d(),void(q.last_word=F.text);if(J="NONE","TK_END_BLOCK"===$?"TK_RESERVED"===F.type&&t(F.text,["else","catch","finally"])?"expand"===et.brace_style||"end-expand"===et.brace_style||"none"===et.brace_style&&F.wanted_newline?J="NEWLINE":(J="SPACE",z.space_before_token=!0):J="NEWLINE":"TK_SEMICOLON"===$&&q.mode===l.BlockStatement?J="NEWLINE":"TK_SEMICOLON"===$&&b(q.mode)?J="SPACE":"TK_STRING"===$?J="NEWLINE":"TK_RESERVED"===$||"TK_WORD"===$||"*"===q.last_text&&"function"===Q?J="SPACE":"TK_START_BLOCK"===$?J="NEWLINE":"TK_END_EXPR"===$&&(z.space_before_token=!0,J="NEWLINE"),"TK_RESERVED"===F.type&&t(F.text,X.line_starters)&&")"!==q.last_text&&(J="else"===q.last_text||"export"===q.last_text?"SPACE":"NEWLINE"),"TK_RESERVED"===F.type&&t(F.text,["else","catch","finally"]))if("TK_END_BLOCK"!==$||"expand"===et.brace_style||"end-expand"===et.brace_style||"none"===et.brace_style&&F.wanted_newline)p();else{z.trim(!0);var e=z.current_line;"}"!==e.last()&&p(),z.space_before_token=!0}else"NEWLINE"===J?"TK_RESERVED"===$&&v(q.last_text)?z.space_before_token=!0:"TK_END_EXPR"!==$?"TK_START_EXPR"===$&&"TK_RESERVED"===F.type&&t(F.text,["var","let","const"])||":"===q.last_text||("TK_RESERVED"===F.type&&"if"===F.text&&"else"===q.last_text?z.space_before_token=!0:p()):"TK_RESERVED"===F.type&&t(F.text,X.line_starters)&&")"!==q.last_text&&p():q.multiline_frame&&x(q.mode)&&","===q.last_text&&"}"===Q?p():"SPACE"===J&&(z.space_before_token=!0);d(),q.last_word=F.text,"TK_RESERVED"===F.type&&"do"===F.text&&(q.do_block=!0),"TK_RESERVED"===F.type&&"if"===F.text&&(q.if_block=!0)}function C(){for(R()&&(z.space_before_token=!1);q.mode===l.Statement&&!q.if_block&&!q.do_block;)K();d()}function L(){R()?z.space_before_token=!0:"TK_RESERVED"===$||"TK_WORD"===$?z.space_before_token=!0:"TK_COMMA"===$||"TK_START_EXPR"===$||"TK_EQUALS"===$||"TK_OPERATOR"===$?w()||u():p(),d()}function I(){R(),q.declaration_statement&&(q.declaration_assignment=!0),z.space_before_token=!0,d(),z.space_before_token=!0}function j(){if(q.declaration_statement)return b(q.parent.mode)&&(q.declaration_assignment=!1),d(),void(q.declaration_assignment?(q.declaration_assignment=!1,p(!1,!0)):(z.space_before_token=!0,et.comma_first&&u()));d(),q.mode===l.ObjectLiteral||q.mode===l.Statement&&q.parent.mode===l.ObjectLiteral?(q.mode===l.Statement&&K(),p()):(z.space_before_token=!0,et.comma_first&&u())}function V(){if(R(),"TK_RESERVED"===$&&v(q.last_text))return z.space_before_token=!0,void d();if("*"===F.text&&"TK_DOT"===$)return void d();if(":"===F.text&&q.in_case)return q.case_body=!0,T(),d(),p(),void(q.in_case=!1);if("::"===F.text)return void d();"TK_OPERATOR"===$&&u();var e=!0,n=!0;t(F.text,["--","++","!","~"])||t(F.text,["-","+"])&&(t($,["TK_START_BLOCK","TK_START_EXPR","TK_EQUALS","TK_OPERATOR"])||t(q.last_text,X.line_starters)||","===q.last_text)?(e=!1,n=!1,!F.wanted_newline||"--"!==F.text&&"++"!==F.text||p(!1,!0),";"===q.last_text&&b(q.mode)&&(e=!0),"TK_RESERVED"===$?e=!0:"TK_END_EXPR"===$?e=!("]"===q.last_text&&("--"===F.text||"++"===F.text)):"TK_OPERATOR"===$&&(e=t(F.text,["--","-","++","+"])&&t(q.last_text,["--","-","++","+"]),t(F.text,["+","-"])&&t(q.last_text,["--","++"])&&(n=!0)),q.mode!==l.BlockStatement&&q.mode!==l.Statement||"{"!==q.last_text&&";"!==q.last_text||p()):":"===F.text?0===q.ternary_depth?e=!1:q.ternary_depth-=1:"?"===F.text?q.ternary_depth+=1:"*"===F.text&&"TK_RESERVED"===$&&"function"===q.last_text&&(e=!1,n=!1),z.space_before_token=z.space_before_token||e,d(),z.space_before_token=n}function P(){if(z.raw)return z.add_raw_token(F),void(F.directives&&"end"===F.directives.preserve&&(et.test_output_raw||(z.raw=!1)));if(F.directives)return p(!1,!0),d(),"start"===F.directives.preserve&&(z.raw=!0),void p(!1,!0);if(!o.newline.test(F.text)&&!F.wanted_newline)return z.space_before_token=!0,d(),void(z.space_before_token=!0);var t,e=c(F.text),i=!1,r=!1,s=F.whitespace_before,_=s.length;for(p(!1,!0),e.length>1&&(m(e.slice(1),"*")?i=!0:y(e.slice(1),s)&&(r=!0)),d(e[0]),t=1;t_?d(e[t].substring(_)):z.add_token(e[t]);p(!1,!0)}function M(){F.wanted_newline?p(!1,!0):z.trim(!0),z.space_before_token=!0,d(),p(!1,!0)}function B(){R(),"TK_RESERVED"===$&&v(q.last_text)?z.space_before_token=!0:u(")"===q.last_text&&et.break_chained_methods),d()}function U(){d(),"\n"===F.text[F.text.length-1]&&p()}function W(){for(;q.mode===l.Statement;)K()}var z,G,X,F,$,Q,Y,q,H,Z,J,tt,et,nt=[],it="";for(tt={TK_START_EXPR:k,TK_END_EXPR:S,TK_START_BLOCK:O,TK_END_BLOCK:N,TK_WORD:D,TK_RESERVED:D,TK_SEMICOLON:C,TK_STRING:L,TK_EQUALS:I,TK_OPERATOR:V,TK_COMMA:j,TK_BLOCK_COMMENT:P,TK_COMMENT:M,TK_DOT:B,TK_UNKNOWN:U,TK_EOF:W},r=r||{},et={},void 0!==r.braces_on_own_line&&(et.brace_style=r.braces_on_own_line?"expand":"collapse"),et.brace_style=r.brace_style?r.brace_style:et.brace_style?et.brace_style:"collapse","expand-strict"===et.brace_style&&(et.brace_style="expand"),et.indent_size=r.indent_size?parseInt(r.indent_size,10):4,et.indent_char=r.indent_char?r.indent_char:" ",et.eol=r.eol?r.eol:"\n",et.preserve_newlines=void 0===r.preserve_newlines||r.preserve_newlines,et.break_chained_methods=void 0!==r.break_chained_methods&&r.break_chained_methods,et.max_preserve_newlines=void 0===r.max_preserve_newlines?0:parseInt(r.max_preserve_newlines,10),et.space_in_paren=void 0!==r.space_in_paren&&r.space_in_paren,et.space_in_empty_paren=void 0!==r.space_in_empty_paren&&r.space_in_empty_paren,et.jslint_happy=void 0!==r.jslint_happy&&r.jslint_happy,et.space_after_anon_function=void 0!==r.space_after_anon_function&&r.space_after_anon_function,et.keep_array_indentation=void 0!==r.keep_array_indentation&&r.keep_array_indentation,et.space_before_conditional=void 0===r.space_before_conditional||r.space_before_conditional,et.unescape_strings=void 0!==r.unescape_strings&&r.unescape_strings,et.wrap_line_length=void 0===r.wrap_line_length?0:parseInt(r.wrap_line_length,10),et.e4x=void 0!==r.e4x&&r.e4x,et.end_with_newline=void 0!==r.end_with_newline&&r.end_with_newline,et.comma_first=void 0!==r.comma_first&&r.comma_first,et.test_output_raw=void 0!==r.test_output_raw&&r.test_output_raw,et.jslint_happy&&(et.space_after_anon_function=!0),r.indent_with_tabs&&(et.indent_char="\t",et.indent_size=1),et.eol=et.eol.replace(/\\r/,"\r").replace(/\\n/,"\n"),Y="";et.indent_size>0;)Y+=et.indent_char,et.indent_size-=1;var rt=0;if(i&&i.length){for(;" "===i.charAt(rt)||"\t"===i.charAt(rt);)it+=i.charAt(rt),rt+=1;i=i.substring(rt)}$="TK_START_BLOCK",Q="",z=new _(Y,it),z.raw=et.test_output_raw,Z=[],g(l.BlockStatement),this.beautify=function(){var t,e;for(X=new a(i,et,Y),nt=X.tokenize(),G=0;t=A();){for(var n=0;n0&&(n-=1,e-=t.indent_length)},this.trim=function(){for(;" "===this.last();){i.pop();e-=1}r=0===i.length},this.toString=function(){var e="";return this._empty||(n>=0&&(e=t.indent_cache[n]),e+=i.join("")),e}}function _(t,e){e=e||"",this.indent_cache=[e],this.baseIndentLength=e.length,this.indent_length=t.length,this.raw=!1;var n=[];this.baseIndentString=e,this.indent_string=t,this.previous_line=null,this.current_line=null,this.space_before_token=!1,this.add_outputline=function(){this.previous_line=this.current_line,this.current_line=new s(this),n.push(this.current_line)},this.add_outputline(),this.get_line_number=function(){return n.length},this.add_new_line=function(t){return(1!==this.get_line_number()||!this.just_added_newline())&&(!(!t&&this.just_added_newline())&&(this.raw||this.add_outputline(),!0))},this.get_code=function(){return n.join("\n").replace(/[\r\n\t ]+$/,"")},this.set_indent=function(t){if(n.length>1){for(;t>=this.indent_cache.length;)this.indent_cache.push(this.indent_cache[this.indent_cache.length-1]+this.indent_string);return this.current_line.set_indent(t),!0}return this.current_line.set_indent(0),!1},this.add_raw_token=function(t){for(var e=0;e1&&this.current_line.is_empty();)n.pop(),this.current_line=n[n.length-1],this.current_line.trim();this.previous_line=n.length>1?n[n.length-2]:null},this.just_added_newline=function(){return this.current_line.is_empty()},this.just_added_blankline=function(){if(this.just_added_newline()){if(1===n.length)return!0;return n[n.length-2].is_empty()}return!1}}function a(n,i,r){function s(t){if(!t.match(R))return null;var e={};m.lastIndex=0;for(var n=m.exec(t);n;)e[n[1]]=n[2],n=m.exec(t);return e}function _(){var r,_=[];if(f=0,d="",g>=x)return["","TK_EOF"];var R;R=E.length?E[E.length-1]:new h("TK_START_BLOCK","{");var m=n.charAt(g);for(g+=1;t(m,l);){if(o.newline.test(m)?"\n"===m&&"\r"===n.charAt(g-2)||(f+=1,_=[]):_.push(m),g>=x)return["","TK_EOF"];m=n.charAt(g),g+=1}if(_.length&&(d=_.join("")),c.test(m)){var A=!0,k=!0,S=c;for("0"===m&&g/))&&("TK_RESERVED"===R.type&&t(R.text,["return","case","throw","else","do","typeof","yield"])||"TK_END_EXPR"===R.type&&")"===R.text&&R.parent&&"TK_RESERVED"===R.parent.type&&t(R.parent.text,["if","while","for"])||t(R.type,["TK_COMMENT","TK_START_EXPR","TK_START_BLOCK","TK_END_BLOCK","TK_OPERATOR","TK_EQUALS","TK_EOF","TK_SEMICOLON","TK_COMMA"]))){var C=m,L=!1,I=!1;if(r=m,"/"===C)for(var j=!1;g/g,P=n.slice(g-1),M=V.exec(P);if(M&&0===M.index){for(var B=M[2],U=0;M;){var W=!!M[1],z=M[2],G=!!M[M.length-1]||"![CDATA["===z.slice(0,8);if(z!==B||G||(W?--U:++U),U<=0)break;M=V.exec(P)}var X=M?M.index+M[0].length:P.length;return P=P.slice(0,X),g+=X-1,P=P.replace(o.lineBreak,"\n"),[P,"TK_STRING"]}}else for(;g=x)););return","===m?[m,"TK_COMMA"]:"="===m?[m,"TK_EQUALS"]:[m,"TK_OPERATOR"]}return[m,"TK_UNKNOWN"]}function a(t){for(var e,n=!1,i="",r=0,s="",_=0;n||r=0&&_<32){i+="x"===e?"\\x"+s:"\\u"+s;continue}if(34===_||39===_||92===_)i+="\\"+String.fromCharCode(_);else{if("x"===e&&_>126&&_<=255)return t;i+=String.fromCharCode(_)}}else"\\"===e?n=!0:i+=e;return i}var l="\n\r\t ".split(""),c=/[0-9]/,u=/[0123456789abcdefABCDEF]/,p="+ - * / % & ++ -- = += -= *= /= %= == === != !== > < >= <= >> << >>> >>>= >>= <<= && &= | || ! ~ , : ? ^ ^= |= :: => <%= <% %> = ?>".split(" ");this.line_starters="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(",");var f,d,T,E,g,x,b=this.line_starters.concat(["do","in","else","get","set","new","catch","finally","typeof","yield","async","await"]),K=/([\s\S]*?)((?:\*\/)|$)/g,w=/([^\n\r\u2028\u2029]*)/g,R=/\/\* beautify( \w+[:]\w+)+ \*\//g,m=/ (\w+)[:](\w+)/g,y=/([\s\S]*?)((?:\/\*\sbeautify\signore:end\s\*\/)|$)/g,v=/((<\?php|<\?=)[\s\S]*?\?>)|(<%[\s\S]*?%>)/g;this.tokenize=function(){x=n.length,g=0,T=!1,E=[];for(var t,e,i,r=null,s=[],a=[];!e||"TK_EOF"!==e.type;){for(i=_(),t=new h(i[1],i[0],f,d);"TK_COMMENT"===t.type||"TK_BLOCK_COMMENT"===t.type||"TK_UNKNOWN"===t.type;)"TK_BLOCK_COMMENT"===t.type&&(t.directives=i[2]),a.push(t),i=_(),t=new h(i[1],i[0],f,d);a.length&&(t.comments_before=a,a=[]),"TK_START_BLOCK"===t.type||"TK_START_EXPR"===t.type?(t.parent=e,s.push(r),r=t):("TK_END_BLOCK"===t.type||"TK_END_EXPR"===t.type)&&r&&("]"===t.text&&"["===r.text||")"===t.text&&"("===r.text||"}"===t.text&&"{"===r.text)&&(t.parent=r.parent,r=s.pop()),E.push(t),e=t}return E}}var o={};!function(t){var e="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",n=new RegExp("["+e+"]"),i=new RegExp("["+e+"̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ؚؠ-ىٲ-ۓۧ-ۨۻ-ۼܰ-݊ࠀ-ࠔࠛ-ࠣࠥ-ࠧࠩ-࠭ࡀ-ࡗࣤ-ࣾऀ-ःऺ-़ा-ॏ॑-ॗॢ-ॣ०-९ঁ-ঃ়া-ৄেৈৗয়-ৠਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢ-ૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୟ-ୠ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఁ-ఃె-ైొ-్ౕౖౢ-ౣ౦-౯ಂಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢ-ೣ೦-೯ംഃെ-ൈൗൢ-ൣ൦-൯ංඃ්ා-ුූෘ-ෟෲෳิ-ฺเ-ๅ๐-๙ິ-ູ່-ໍ໐-໙༘༙༠-༩༹༵༷ཁ-ཇཱ-྄྆-྇ྍ-ྗྙ-ྼ࿆က-ဩ၀-၉ၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟ᜎ-ᜐᜠ-ᜰᝀ-ᝐᝲᝳក-ឲ៝០-៩᠋-᠍᠐-᠙ᤠ-ᤫᤰ-᤻ᥑ-ᥭᦰ-ᧀᧈ-ᧉ᧐-᧙ᨀ-ᨕᨠ-ᩓ᩠-᩿᩼-᪉᪐-᪙ᭆ-ᭋ᭐-᭙᭫-᭳᮰-᮹᯦-᯳ᰀ-ᰢ᱀-᱉ᱛ-ᱽ᳐-᳒ᴀ-ᶾḁ-ἕ‿⁀⁔⃐-⃥⃜⃡-⃰ⶁ-ⶖⷠ-ⷿ〡-〨゙゚Ꙁ-ꙭꙴ-꙽ꚟ꛰-꛱ꟸ-ꠀ꠆ꠋꠣ-ꠧꢀ-ꢁꢴ-꣄꣐-꣙ꣳ-ꣷ꤀-꤉ꤦ-꤭ꤰ-ꥅꦀ-ꦃ꦳-꧀ꨀ-ꨧꩀ-ꩁꩌ-ꩍ꩐-꩙ꩻꫠ-ꫩꫲ-ꫳꯀ-ꯡ꯬꯭꯰-꯹ﬠ-ﬨ︀-️︠-︦︳︴﹍-﹏0-9_]");t.newline=/[\n\r\u2028\u2029]/,t.lineBreak=/\r\n|[\n\r\u2028\u2029]/g,t.isIdentifierStart=function(t){return t<65?36===t:t<91||(t<97?95===t:t<123||t>=170&&n.test(String.fromCharCode(t)))},t.isIdentifierChar=function(t){return t<48?36===t:t<58||!(t<65)&&(t<91||(t<97?95===t:t<123||t>=170&&i.test(String.fromCharCode(t))))}}(o);var l={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"},h=function(t,e,n,i,r,s){this.type=t,this.text=e,this.comments_before=[],this.newlines=n||0,this.wanted_newline=n>0,this.whitespace_before=i||"",this.parent=null,this.directives=null};"function"==typeof define&&define.amd?define("beautify.js",[],function(){return{js_beautify:i}}):"undefined"!=typeof exports?exports.js_beautify=i:"undefined"!=typeof window?window.js_beautify=i:"undefined"!=typeof global&&(global.js_beautify=i)}(),function(){function t(t){return t.replace(/^\s+/g,"")}function e(t){return t.replace(/\s+$/g,"")}function n(n,i,r,s){function _(){return this.pos=0,this.token="",this.current_mode="CONTENT",this.tags={parent:"parent1",parentcount:1,parent1:""},this.tag_type="",this.token_text=this.last_token=this.last_text=this.token_type="",this.newlines=0,this.indent_content=o,this.Utils={whitespace:"\n\r\t ".split(""),single_token:"br,input,link,meta,source,!doctype,basefont,base,area,hr,wbr,param,img,isindex,embed".split(","),extra_liners:b,in_array:function(t,e){for(var n=0;n=this.wrap_line_length?(this.print_newline(!1,t),this.print_indentation(t)):(this.line_char_count++,t.push(" "))},this.get_content=function(){for(var t="",e=[];"<"!==this.input.charAt(this.pos);){if(this.pos>=this.input.length)return e.length?e.join(""):["","TK_EOF"];if(this.traverse_whitespace())this.space_or_wrap(e);else{if(T){var n=this.input.substr(this.pos,3);if("{{#"===n||"{{/"===n)break;if("{{!"===n)return[this.get_tag(),"TK_TAG_HANDLEBARS_COMMENT"];if("{{"===this.input.substr(this.pos,2)&&"{{else}}"===this.get_tag(!0))break}t=this.input.charAt(this.pos),this.pos++,this.line_char_count++,e.push(t)}}return e.length?e.join(""):""},this.get_contents_to=function(t){if(this.pos===this.input.length)return["","TK_EOF"];var e="",n=new RegExp(""+t+"\\s*>","igm");n.lastIndex=this.pos;var i=n.exec(this.input),r=i?i.index:this.input.length;return this.pos=this.input.length)return t&&(this.pos=o,this.line_char_count=l),r.length?r.join(""):["","TK_EOF"];if(i=this.input.charAt(this.pos),this.pos++,this.Utils.in_array(i,this.Utils.whitespace))_=!0;else{if("'"!==i&&'"'!==i||(i+=this.get_unformatted(i),_=!0),"="===i&&(_=!1),r.length&&"="!==r[r.length-1]&&">"!==i&&_){if(this.space_or_wrap(r),_=!1,!a&&"force"===E&&"/"!==i){this.print_newline(!0,r),this.print_indentation(r);for(var c=0;c=2&&"{"===r[r.length-1]&&"{"===r[r.length-2]&&(e="#"===i||"/"===i||"!"===i?this.pos-3:this.pos-2,n="{"),this.line_char_count++,r.push(i),r[1]&&("!"===r[1]||"?"===r[1]||"%"===r[1])){r=[this.get_comment(e)];break}if(T&&r[1]&&"{"===r[1]&&r[2]&&"!"===r[2]){r=[this.get_comment(e)];break}if(T&&"{"===n&&r.length>2&&"}"===r[r.length-2]&&"}"===r[r.length-1])break}}while(">"!==i);var f,d,x=r.join("");f=-1!==x.indexOf(" ")?x.indexOf(" "):"{"===x.charAt(0)?x.indexOf("}"):x.indexOf(">"),d="<"!==x.charAt(0)&&T?"#"===x.charAt(2)?3:2:1;var b=x.substring(d,f).toLowerCase();return"/"===x.charAt(x.length-2)||this.Utils.in_array(b,this.Utils.single_token)?t||(this.tag_type="SINGLE"):T&&"{"===x.charAt(0)&&"else"===b?t||(this.indent_to_tag("if"),this.tag_type="HANDLEBARS_ELSE",this.indent_content=!0,this.traverse_whitespace()):this.is_unformatted(b,p)?(s=this.get_unformatted(""+b+">",x),r.push(s),this.pos-1,this.tag_type="SINGLE"):"script"===b&&(-1===x.search("type")||x.search("type")>-1&&x.search(/\b(text|application)\/(x-)?(javascript|ecmascript|jscript|livescript)/)>-1)?t||(this.record_tag(b),this.tag_type="SCRIPT"):"style"===b&&(-1===x.search("type")||x.search("type")>-1&&x.search("text/css")>-1)?t||(this.record_tag(b),this.tag_type="STYLE"):"!"===b.charAt(0)?t||(this.tag_type="SINGLE",this.traverse_whitespace()):t||("/"===b.charAt(0)?(this.retrieve_tag(b.substring(1)),this.tag_type="END"):(this.record_tag(b),"html"!==b.toLowerCase()&&(this.indent_content=!0),this.tag_type="START"),this.traverse_whitespace()&&this.space_or_wrap(r),this.Utils.in_array(b,this.Utils.extra_liners)&&(this.print_newline(!1,this.output),this.output.length&&"\n"!==this.output[this.output.length-2]&&this.print_newline(!0,this.output))),t&&(this.pos=o,this.line_char_count=l),r.join("")},this.get_comment=function(t){var e="",n=">",i=!1;for(this.pos=t,input_char=this.input.charAt(this.pos),this.pos++;this.pos<=this.input.length&&(e+=input_char,e.charAt(e.length-1)!==n.charAt(n.length-1)||-1===e.indexOf(n));)!i&&e.length<10&&(0===e.indexOf("",i=!0):0===e.indexOf("",i=!0):0===e.indexOf("",i=!0):0===e.indexOf("\x3c!--")?(n="--\x3e",i=!0):0===e.indexOf("{{!")?(n="}}",i=!0):0===e.indexOf("")?(n="?>",i=!0):0===e.indexOf("<%")&&(n="%>",i=!0)),input_char=this.input.charAt(this.pos),this.pos++;return e},this.get_unformatted=function(t,e){
-if(e&&-1!==e.toLowerCase().indexOf(t))return"";var n="",i="",r=0,s=!0;do{if(this.pos>=this.input.length)return i;if(n=this.input.charAt(this.pos),this.pos++,this.Utils.in_array(n,this.Utils.whitespace)){if(!s){this.line_char_count--;continue}if("\n"===n||"\r"===n){i+="\n",this.line_char_count=0;continue}}i+=n,this.line_char_count++,s=!0,T&&"{"===n&&i.length&&"{"===i.charAt(i.length-2)&&(i+=this.get_unformatted("}}"),r=i.length)}while(-1===i.toLowerCase().indexOf(t,r));return i},this.get_token=function(){var t;if("TK_TAG_SCRIPT"===this.last_token||"TK_TAG_STYLE"===this.last_token){var e=this.last_token.substr(7);return t=this.get_contents_to(e),"string"!=typeof t?t:[t,"TK_"+e]}if("CONTENT"===this.current_mode)return t=this.get_content(),"string"!=typeof t?t:[t,"TK_CONTENT"];if("TAG"===this.current_mode){if("string"!=typeof(t=this.get_tag()))return t;return[t,"TK_TAG_"+this.tag_type]}},this.get_full_indent=function(t){return t=this.indent_level+t||0,t<1?"":Array(t+1).join(this.indent_string)},this.is_unformatted=function(t,e){if(!this.Utils.in_array(t,e))return!1;if("a"!==t.toLowerCase()||!this.Utils.in_array("a",e))return!0;var n=this.get_tag(!0),i=(n||"").match(/^\s*<\s*\/?([a-z]*)\s*[^>]*>\s*$/);return!(i&&!this.Utils.in_array(i,e))},this.printer=function(n,i,r,s,_){this.input=n||"",this.input=this.input.replace(/\r\n|[\r\u2028\u2029]/g,"\n"),this.output=[],this.indent_character=i,this.indent_string="",this.indent_size=r,this.brace_style=_,this.indent_level=0,this.wrap_line_length=s,this.line_char_count=0;for(var a=0;a0&&(t=e(t)),t&&""!==t&&(t.length>1&&"\n"===t.charAt(t.length-1)?(this.output.push(t.slice(0,-1)),this.print_newline(!1,this.output)):this.output.push(t));for(var n=0;n0,this.output);this.newlines=0},this.indent=function(){this.indent_level++},this.unindent=function(){this.indent_level>0&&this.indent_level--}},this}var a,o,l,h,c,u,p,f,d,T,E,g,x,b,K;for(i=i||{},void 0!==i.wrap_line_length&&0!==parseInt(i.wrap_line_length,10)||void 0===i.max_char||0===parseInt(i.max_char,10)||(i.wrap_line_length=i.max_char),o=void 0!==i.indent_inner_html&&i.indent_inner_html,l=void 0===i.indent_size?4:parseInt(i.indent_size,10),h=void 0===i.indent_char?" ":i.indent_char,u=void 0===i.brace_style?"collapse":i.brace_style,c=0===parseInt(i.wrap_line_length,10)?32786:parseInt(i.wrap_line_length||250,10),p=i.unformatted||["a","span","img","bdo","em","strong","dfn","code","samp","kbd","var","cite","abbr","acronym","q","sub","sup","tt","i","b","big","small","u","s","strike","font","ins","del","pre","address","dt","h1","h2","h3","h4","h5","h6"],f=void 0===i.preserve_newlines||i.preserve_newlines,d=f?isNaN(parseInt(i.max_preserve_newlines,10))?32786:parseInt(i.max_preserve_newlines,10):0,T=void 0!==i.indent_handlebars&&i.indent_handlebars,E=void 0===i.wrap_attributes?"auto":i.wrap_attributes,g=void 0===i.wrap_attributes_indent_size?l:parseInt(i.wrap_attributes_indent_size,10)||l,x=void 0!==i.end_with_newline&&i.end_with_newline,b="object"==typeof i.extra_liners&&i.extra_liners?i.extra_liners.concat():"string"==typeof i.extra_liners?i.extra_liners.split(","):"head,body,/html".split(","),K=i.eol?i.eol:"\n",i.indent_with_tabs&&(h="\t",l=1),K=K.replace(/\\r/,"\r").replace(/\\n/,"\n"),a=new _,a.printer(n,h,l,c,u);;){var w=a.get_token();if(a.token_text=w[0],a.token_type=w[1],"TK_EOF"===a.token_type)break;switch(a.token_type){case"TK_TAG_START":a.print_newline(!1,a.output),a.print_token(a.token_text),a.indent_content&&(a.indent(),a.indent_content=!1),a.current_mode="CONTENT";break;case"TK_TAG_STYLE":case"TK_TAG_SCRIPT":a.print_newline(!1,a.output),a.print_token(a.token_text),a.current_mode="CONTENT";break;case"TK_TAG_END":if("TK_CONTENT"===a.last_token&&""===a.last_text){var R=a.token_text.match(/\w+/)[0],m=null;a.output.length&&(m=a.output[a.output.length-1].match(/(?:<|{{#)\s*(\w+)/)),(null===m||m[1]!==R&&!a.Utils.in_array(m[1],p))&&a.print_newline(!1,a.output)}a.print_token(a.token_text),a.current_mode="CONTENT";break;case"TK_TAG_SINGLE":var y=a.token_text.match(/^\s*<([a-z-]+)/i);y&&a.Utils.in_array(y[1],p)||a.print_newline(!1,a.output),a.print_token(a.token_text),a.current_mode="CONTENT";break;case"TK_TAG_HANDLEBARS_ELSE":a.print_token(a.token_text),a.indent_content&&(a.indent(),a.indent_content=!1),a.current_mode="CONTENT";break;case"TK_TAG_HANDLEBARS_COMMENT":case"TK_CONTENT":a.print_token(a.token_text),a.current_mode="TAG";break;case"TK_STYLE":case"TK_SCRIPT":if(""!==a.token_text){a.print_newline(!1,a.output);var v,A=a.token_text,k=1;"TK_SCRIPT"===a.token_type?v="function"==typeof r&&r:"TK_STYLE"===a.token_type&&(v="function"==typeof s&&s),"keep"===i.indent_scripts?k=0:"separate"===i.indent_scripts&&(k=-a.indent_level);var S=a.get_full_indent(k);if(v){var O=function(){this.eol="\n"};O.prototype=i;var N=new O;A=v(A.replace(/^\s*/,S),N)}else{var D=A.match(/^\s*/)[0],C=D.match(/[^\n\r]*$/)[0].split(a.indent_string).length-1,L=a.get_full_indent(k-C);A=A.replace(/^\s*/,S).replace(/\r\n|\r|\n/g,"\n"+L).replace(/\s+$/,"")}A&&(a.print_token_raw(A),a.print_newline(!0,a.output))}a.current_mode="TAG";break;default:""!==a.token_text&&a.print_token(a.token_text)}a.last_token=a.token_type,a.last_text=a.token_text}var I=a.output.join("").replace(/[\r\n\t ]+$/,"");return x&&(I+="\n"),"\n"!=K&&(I=I.replace(/[\n]/g,K)),I}if("function"==typeof define&&define.amd)define("beautify-html.js",["require","./beautify","./beautify-css"],function(t){var e=t("./beautify"),i=t("./beautify-css");return{html_beautify:function(t,r){return n(t,r,e.js_beautify,i.css_beautify)}}});else if("undefined"!=typeof exports){var i=require("./beautify.js"),r=require("./beautify-css.js");exports.html_beautify=function(t,e){return n(t,e,i.js_beautify,r.css_beautify)}}else"undefined"!=typeof window?window.html_beautify=function(t,e){return n(t,e,window.js_beautify,window.css_beautify)}:"undefined"!=typeof global&&(global.html_beautify=function(t,e){return n(t,e,global.js_beautify,global.css_beautify)})}(),function(t){"function"==typeof t.define&&(t.define("beautify",["beautify.js"],function(t){return t}),t.define("beautify-css",[],function(){return{css_beautify:void 0}}),t.define("beautifyModule",["beautify","beautify-html.js"],function(e,n){t.js_beautify=e.js_beautify,t.html_beautify=n.html_beautify}))}(this);
+!function(){var r=function(q){function l(d){if(h[d])return h[d].exports;var f=h[d]={i:d,l:!1,exports:{}};return q[d].call(f.exports,f,f.exports,l),f.l=!0,f.exports}var h={};return l.m=q,l.c=h,l.d=function(d,f,c){l.o(d,f)||Object.defineProperty(d,f,{enumerable:!0,get:c})},l.r=function(d){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(d,Symbol.toStringTag,{value:"Module"});Object.defineProperty(d,"__esModule",{value:!0})},l.t=function(d,f){if((1&f&&(d=l(d)),8&f)||4&f&&"object"==
+typeof d&&d&&d.__esModule)return d;var c=Object.create(null);if(l.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:d}),2&f&&"string"!=typeof d)for(var b in d)l.d(c,b,function(b){return d[b]}.bind(null,b));return c},l.n=function(d){var f=d&&d.__esModule?function(){return d["default"]}:function(){return d};return l.d(f,"a",f),f},l.o=function(d,f){return Object.prototype.hasOwnProperty.call(d,f)},l.p="",l(l.s=0)}([function(q,l,h){var d=h(1).Beautifier,f=h(5).Options;q.exports=function(c,b){return(new d(c,
+b)).beautify()};q.exports.defaultOptions=function(){return new f}},function(q,l,h){function d(a,b){return-1!==b.indexOf(a)}function f(a,b){return a&&a.type===g.RESERVED&&a.text===b}function c(a,b){return a&&a.type===g.RESERVED&&d(a.text,b)}function b(a,b){b.multiline_frame||b.mode===m.ForInitializer||b.mode===m.Conditional||a.remove_indent(b.start_line_index)}function e(a){return d(a,[m.Expression,m.ForInitializer,m.Conditional])}function a(a,b){b=b||{};this._source_text=a||"";this._flag_store=this._previous_flags=
+this._flags=this._last_last_text=this._tokens=this._output=null;this._options=new w(b)}var k=h(2).Output,n=h(3).Token,p=h(4),w=h(5).Options,x=h(7).Tokenizer,u=h(7).line_starters,y=h(7).positionable_operators,g=h(7).TOKEN,r="case return do if throw else await break continue async".split(" "),t=function(a){for(var b={},e=0;ee&&(e=a.line_indent_level)),{mode:b,parent:a,last_token:a?a.last_token:new n(g.START_BLOCK,""),last_word:a?a.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,
+if_block:!1,else_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,indentation_level:e,alignment:0,line_indent_level:a?a.line_indent_level:e,start_line_index:this._output.get_line_number(),ternary_depth:0}};a.prototype._reset=function(a){var b=a.match(/^[\t ]*/)[0];this._last_last_text="";this._output=new k(this._options,b);this._output.raw=this._options.test_output_raw;this._flag_store=[];this.set_mode(m.BlockStatement);return this._tokens=(new x(a,this._options)).tokenize(),
+a};a.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var a=this._reset(this._source_text),b=this._options.eol;"auto"===this._options.eol&&(b="\n",a&&p.lineBreak.test(a||"")&&(b=a.match(p.lineBreak)[0]));for(a=this._tokens.next();a;)this.handle_token(a),this._last_last_text=this._flags.last_token.text,this._flags.last_token=a,a=this._tokens.next();return this._output.get_code(b)};a.prototype.handle_token=function(a,b){a.type===g.START_EXPR?this.handle_start_expr(a):
+a.type===g.END_EXPR?this.handle_end_expr(a):a.type===g.START_BLOCK?this.handle_start_block(a):a.type===g.END_BLOCK?this.handle_end_block(a):a.type===g.WORD?this.handle_word(a):a.type===g.RESERVED?this.handle_word(a):a.type===g.SEMICOLON?this.handle_semicolon(a):a.type===g.STRING?this.handle_string(a):a.type===g.EQUALS?this.handle_equals(a):a.type===g.OPERATOR?this.handle_operator(a):a.type===g.COMMA?this.handle_comma(a):a.type===g.BLOCK_COMMENT?this.handle_block_comment(a,b):a.type===g.COMMENT?this.handle_comment(a,
+b):a.type===g.DOT?this.handle_dot(a):a.type===g.EOF?this.handle_eof(a):(a.type,g.UNKNOWN,this.handle_unknown(a,b))};a.prototype.handle_whitespace_and_comments=function(a,b){var e=a.newlines,c=this._options.keep_array_indentation&&this._flags.mode===m.ArrayLiteral;if(a.comments_before)for(var t=a.comments_before.next();t;)this.handle_whitespace_and_comments(t,b),this.handle_token(t,b),t=a.comments_before.next();if(c)for(c=0;cthis._options.max_preserve_newlines&&(e=this._options.max_preserve_newlines),this._options.preserve_newlines&&1this._flags.parent.indentation_level)&&
+(--this._flags.indentation_level,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))};a.prototype.set_mode=function(a){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,a);this._flags=this.create_flags(this._previous_flags,a);this._output.set_indent(this._flags.indentation_level,this._flags.alignment)};a.prototype.restore_mode=function(){0b?this.__items[this.__items.length+b]:this.__items[b]};d.prototype.has_match=function(b){for(var e=this.__items.length-1;0<=e;e--)if(this.__items[e].match(b))return!0;
+return!1};d.prototype.set_indent=function(b,e){this.is_empty()&&(this.__indent_count=b||0,this.__alignment_count=e||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))};d.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)};
+d.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count};d.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var b=this.__parent.current_line;return b.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),b.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),
+b.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count," "===b.__items[0]&&(b.__items.splice(0,1),--b.__character_count),!0}return!1};d.prototype.is_empty=function(){return 0===this.__items.length};d.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]};d.prototype.push=function(b){this.__items.push(b);var e=b.lastIndexOf("\n");-1!==e?this.__character_count=b.length-e:this.__character_count+=
+b.length};d.prototype.pop=function(){var b=null;return this.is_empty()||(b=this.__items.pop(),this.__character_count-=b.length),b};d.prototype._remove_indent=function(){0b&&(a=0),a+=b*this.__indent_size,a+e};f.prototype.get_indent_string=function(b,e){var a=this.__base_string;return e=e||0,0>b&&(b=0,a=""),e+=b*this.__indent_size,this.__ensure_cache(e),a+
+this.__cache[e]};f.prototype.__ensure_cache=function(b){for(;b>=this.__cache.length;)this.__add_column()};f.prototype.__add_column=function(){var b=this.__cache.length,e=0,a="";this.__indent_size&&b>=this.__indent_size&&(e=Math.floor(b/this.__indent_size),b-=e*this.__indent_size,a=Array(e+1).join(this.__indent_string));b&&(a+=Array(b+1).join(" "));this.__cache.push(a)};c.prototype.__add_outputline=function(){this.previous_line=this.current_line;this.current_line=this.next_line.clone_empty();this.__lines.push(this.current_line)};
+c.prototype.get_line_number=function(){return this.__lines.length};c.prototype.get_indent_string=function(b,e){return this.__indent_cache.get_indent_string(b,e)};c.prototype.get_indent_size=function(b,e){return this.__indent_cache.get_indent_size(b,e)};c.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()};c.prototype.add_new_line=function(b){return!(this.is_empty()||!b&&this.just_added_newline())&&(this.raw||this.__add_outputline(),!0)};c.prototype.get_code=function(b){this.trim(!0);
+var e=this.current_line.pop();e&&("\n"===e[e.length-1]&&(e=e.replace(/\n+$/g,"")),this.current_line.push(e));this._end_with_newline&&this.__add_outputline();e=this.__lines.join("\n");return"\n"!==b&&(e=e.replace(/[\n]/g,b)),e};c.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()};c.prototype.set_indent=function(b,e){return b=b||0,e=e||0,this.next_line.set_indent(b,e),1/),single_quote:d.until(/['\\\n\r\u2028\u2029]/),double_quote:d.until(/["\\\n\r\u2028\u2029]/),template_text:d.until(/[`\\$]/),template_expression:d.until(/[`}\\]/)}};l.prototype=new c;l.prototype._is_comment=function(a){return a.type===n.COMMENT||a.type===n.BLOCK_COMMENT||a.type===n.UNKNOWN};l.prototype._is_opening=
+function(a){return a.type===n.START_BLOCK||a.type===n.START_EXPR};l.prototype._is_closing=function(a,b){return(a.type===n.END_BLOCK||a.type===n.END_EXPR)&&b&&("]"===a.text&&"["===b.text||")"===a.text&&"("===b.text||"}"===a.text&&"{"===b.text)};l.prototype._reset=function(){r=!1};l.prototype._get_next_token=function(a,b){var e=null;this._readWhitespace();var c=this._input.peek();return null===c?this._create_token(n.EOF,""):(e=e||this._read_non_javascript(c),e=e||this._read_string(c),e=e||this._read_word(a),
+e=e||this._read_singles(c),e=e||this._read_comment(c),e=e||this._read_regexp(c,a),e=e||this._read_xml(c,a),e=e||this._read_punctuation(),e||this._create_token(n.UNKNOWN,this._input.next()))};l.prototype._read_word=function(a){var b;return""!==(b=this.__patterns.identifier.read())?(b=b.replace(e.allLineBreaks,"\n"),a.type!==n.DOT&&(a.type!==n.RESERVED||"set"!==a.text&&"get"!==a.text)&&A.test(b)?"in"===b||"of"===b?this._create_token(n.OPERATOR,b):this._create_token(n.RESERVED,b):this._create_token(n.WORD,
+b)):(b=this.__patterns.number.read(),""!==b?this._create_token(n.WORD,b):void 0)};l.prototype._read_singles=function(a){var b=null;return"("===a||"["===a?b=this._create_token(n.START_EXPR,a):")"===a||"]"===a?b=this._create_token(n.END_EXPR,a):"{"===a?b=this._create_token(n.START_BLOCK,a):"}"===a?b=this._create_token(n.END_BLOCK,a):";"===a?b=this._create_token(n.SEMICOLON,a):"."===a&&u.test(this._input.peek(1))?b=this._create_token(n.DOT,a):","===a&&(b=this._create_token(n.COMMA,a)),b&&this._input.next(),
+b};l.prototype._read_punctuation=function(){var a=this.__patterns.punct.read();if(""!==a)return"\x3d"===a?this._create_token(n.EQUALS,a):"?."===a?this._create_token(n.DOT,a):this._create_token(n.OPERATOR,a)};l.prototype._read_non_javascript=function(a){var b="";if("#"===a){if(this._is_first_token()&&(b=this.__patterns.shebang.read())||(b=this.__patterns.include.read()))return this._create_token(n.UNKNOWN,b.trim()+"\n");this._input.next();b="#";if(this._input.hasNext()&&this._input.testChar(x)){do a=
+this._input.next(),b+=a;while(this._input.hasNext()&&"#"!==a&&"\x3d"!==a);return"#"===a||("["===this._input.peek()&&"]"===this._input.peek(1)?(b+="[]",this._input.next(),this._input.next()):"{"===this._input.peek()&&"}"===this._input.peek(1)&&(b+="{}",this._input.next(),this._input.next())),this._create_token(n.WORD,b)}this._input.back()}else if("\x3c"===a&&this._is_first_token()){if(b=this.__patterns.html_comment_start.read()){for(;this._input.hasNext()&&!this._input.testChar(e.newline);)b+=this._input.next();
+return r=!0,this._create_token(n.COMMENT,b)}}else if(r&&"-"===a&&(b=this.__patterns.html_comment_end.read()))return r=!1,this._create_token(n.COMMENT,b);return null};l.prototype._read_comment=function(a){var b=null;if("/"===a)if(a="","*"===this._input.peek(1)){a=this.__patterns.block_comment.read();var c=p.get_directives(a);c&&"start"===c.ignore&&(a+=p.readIgnored(this._input));a=a.replace(e.allLineBreaks,"\n");b=this._create_token(n.BLOCK_COMMENT,a);b.directives=c}else"/"===this._input.peek(1)&&
+(a=this.__patterns.comment.read(),b=this._create_token(n.COMMENT,a));return b};l.prototype._read_string=function(a){if("`"===a||"'"===a||'"'===a){var b=this._input.next();this.has_char_escapes=!1;b+="`"===a?this._read_string_recursive("`",!0,"${"):this._read_string_recursive(a);if(this.has_char_escapes&&this._options.unescape_strings)a:{for(var c="",k=0,d=new f(b),p=null;d.hasNext();)if(p=d.match(/([\s]|[^\\]|\\\\)+/g),p&&(c+=p[0]),"\\"===d.peek()){if(d.next(),"x"===d.peek())p=d.match(/x([0-9A-Fa-f]{2})/g);
+else{if("u"!==d.peek()){c+="\\";d.hasNext()&&(c+=d.next());continue}p=d.match(/u([0-9A-Fa-f]{4})/g)}if(!p)break a;if(126<(k=parseInt(p[1],16))&&255>=k&&0===p[0].indexOf("x"))break a;c=0<=k&&32>k?c+("\\"+p[0]):c+(34===k||39===k||92===k?"\\"+String.fromCharCode(k):String.fromCharCode(k))}b=c}return this._input.peek()===a&&(b+=this._input.next()),b=b.replace(e.allLineBreaks,"\n"),this._create_token(n.STRING,b)}return null};l.prototype._allow_regexp_or_xml=function(a){return a.type===n.RESERVED&&d(a.text,
+"return case throw else do typeof yield".split(" "))||a.type===n.END_EXPR&&")"===a.text&&a.opened.previous.type===n.RESERVED&&d(a.opened.previous.text,["if","while","for"])||d(a.type,[n.COMMENT,n.START_EXPR,n.START_BLOCK,n.START,n.END_BLOCK,n.OPERATOR,n.EQUALS,n.EOF,n.SEMICOLON,n.COMMA])};l.prototype._read_regexp=function(a,b){if("/"===a&&this._allow_regexp_or_xml(b)){for(var c=this._input.next(),k=!1,d=!1;this._input.hasNext()&&(k||d||this._input.peek()!==a)&&!this._input.testChar(e.newline);)c+=
+this._input.peek(),k?k=!1:(k="\\"===this._input.peek(),"["===this._input.peek()?d=!0:"]"===this._input.peek()&&(d=!1)),this._input.next();return this._input.peek()===a&&(c+=this._input.next(),c+=this._input.read(e.identifier)),this._create_token(n.STRING,c)}return null};l.prototype._read_xml=function(a,b){if(this._options.e4x&&"\x3c"===a&&this._allow_regexp_or_xml(b)){var c="",k=this.__patterns.xml.read_match();if(k){for(var d=k[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),f=0===d.indexOf("{"),p=
+0;k;){var g=!!k[1],h=k[2];if(!(k[k.length-1]||"![CDATA["===h.slice(0,8))&&(h===d||f&&h.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(g?--p:++p),c+=k[0],0>=p)break;k=this.__patterns.xml.read_match()}return k||(c+=this._input.match(/[\s\S]*/g)[0]),c=c.replace(e.allLineBreaks,"\n"),this._create_token(n.STRING,c)}}return null};l.prototype._read_string_recursive=function(a,b,c){var k,d;"'"===a?d=this.__patterns.single_quote:'"'===a?d=this.__patterns.double_quote:"`"===a?d=this.__patterns.template_text:
+"}"===a&&(d=this.__patterns.template_expression);for(var n=d.read(),f="";this._input.hasNext();){if((f=this._input.next())===a||!b&&e.newline.test(f)){this._input.back();break}"\\"===f&&this._input.hasNext()?(k=this._input.peek(),"x"===k||"u"===k?this.has_char_escapes=!0:"\r"===k&&"\n"===this._input.peek(1)&&this._input.next(),f+=this._input.next()):c&&("${"===c&&"$"===f&&"{"===this._input.peek()&&(f+=this._input.next()),c===f&&(f+="`"===a?this._read_string_recursive("}",b,"`"):this._read_string_recursive("`",
+b,"${"),this._input.hasNext()&&(f+=this._input.next())));f+=d.read();n+=f}return n};q.exports.Tokenizer=l;q.exports.TOKEN=n;q.exports.positionable_operators="\x3e\x3e\x3e \x3d\x3d\x3d !\x3d\x3d \x3c\x3c \x26\x26 \x3e\x3d ** !\x3d \x3d\x3d \x3c\x3d \x3e\x3e || ?? |\x3e \x3c / - + \x3e : \x26 % ? ^ | *".split(" ").slice();q.exports.line_starters=h.slice()},function(q,l,h){function d(c){this.__input=c||"";this.__input_length=this.__input.length;this.__position=0}var f=RegExp.prototype.hasOwnProperty("sticky");
+d.prototype.restart=function(){this.__position=0};d.prototype.back=function(){0=c.length&&this.__input.substring(b-c.length,b).toLowerCase()===c};q.exports.InputScanner=d},function(q,l,h){var d=h(8).InputScanner,f=h(3).Token,c=h(10).TokenStream,b=h(11).WhitespacePattern,e={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"};l=function(a,
+e){this._input=new d(a);this._options=e||{};this.__tokens=null;this._patterns={};this._patterns.whitespace=new b(this._input)};l.prototype.tokenize=function(){this._input.restart();this.__tokens=new c;this._reset();for(var a,b=new f(e.START,""),d=null,p=[],h=new c;b.type!==e.EOF;){for(a=this._get_next_token(b,d);this._is_comment(a);)h.add(a),a=this._get_next_token(b,d);h.isEmpty()||(a.comments_before=h,h=new c);a.parent=d;this._is_opening(a)?(p.push(d),d=a):d&&this._is_closing(a,d)&&(a.opened=d,d.closed=
+a,d=p.pop(),a.parent=d);a.previous=b;b.next=a;this.__tokens.add(a);b=a}return this.__tokens};l.prototype._is_first_token=function(){return this.__tokens.isEmpty()};l.prototype._reset=function(){};l.prototype._get_next_token=function(a,b){this._readWhitespace();var c=this._input.read(/.+/g);return c?this._create_token(e.RAW,c):this._create_token(e.EOF,"")};l.prototype._is_comment=function(a){return!1};l.prototype._is_opening=function(a){return!1};l.prototype._is_closing=function(a,b){return!1};l.prototype._create_token=
+function(a,b){return new f(a,b,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token)};l.prototype._readWhitespace=function(){return this._patterns.whitespace.read()};q.exports.Tokenizer=l;q.exports.TOKEN=e},function(q,l,h){function d(d){this.__tokens=[];this.__tokens_length=this.__tokens.length;this.__position=0;this.__parent_token=d}d.prototype.restart=function(){this.__position=0};d.prototype.isEmpty=function(){return 0===this.__tokens_length};d.prototype.hasNext=
+function(){return this.__position/),erb:a.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:a.starting_with(/{%/).until_after(/%}/),django_value:a.starting_with(/{{/).until_after(/}}/),django_comment:a.starting_with(/{#/).until_after(/#}/)}}var f=h(12).Pattern,c={django:!1,erb:!1,handlebars:!1,php:!1};d.prototype=new f;d.prototype._create=function(){return new d(this._input,this)};d.prototype._update=function(){this.__set_templated_pattern()};d.prototype.disable=function(b){var e=
+this._create();return e._disabled[b]=!0,e._update(),e};d.prototype.read_options=function(b){var e=this._create(),a;for(a in c)e._disabled[a]=-1===b.templating.indexOf(a);return e._update(),e};d.prototype.exclude=function(b){var e=this._create();return e._excluded[b]=!0,e._update(),e};d.prototype.read=function(){for(var b="",b=this._match_pattern?this._input.read(this._starting_pattern):this._input.read(this._starting_pattern,this.__template_pattern),e=this._read_template();e;)this._match_pattern?
+e+=this._input.read(this._match_pattern):e+=this._input.readUntil(this.__template_pattern),b+=e,e=this._read_template();return this._until_after&&(b+=this._input.readUntilAfter(this._until_pattern)),b};d.prototype.__set_templated_pattern=function(){var b=[];this._disabled.php||b.push(this.__patterns.php._starting_pattern.source);this._disabled.handlebars||b.push(this.__patterns.handlebars._starting_pattern.source);this._disabled.erb||b.push(this.__patterns.erb._starting_pattern.source);this._disabled.django||
+(b.push(this.__patterns.django._starting_pattern.source),b.push(this.__patterns.django_value._starting_pattern.source),b.push(this.__patterns.django_comment._starting_pattern.source));this._until_pattern&&b.push(this._until_pattern.source);this.__template_pattern=this._input.get_regexp("(?:"+b.join("|")+")")};d.prototype._read_template=function(){var b="",e=this._input.peek();"\x3c"===e?(e=this._input.peek(1),this._disabled.php||this._excluded.php||"?"!==e||(b=b||this.__patterns.php.read()),this._disabled.erb||
+this._excluded.erb||"%"!==e||(b=b||this.__patterns.erb.read())):"{"===e&&(this._disabled.handlebars||this._excluded.handlebars||(b=b||this.__patterns.handlebars_comment.read(),b=b||this.__patterns.handlebars_unescaped.read(),b=b||this.__patterns.handlebars.read()),this._disabled.django||(this._excluded.django||this._excluded.handlebars||(b=b||this.__patterns.django_value.read()),this._excluded.django||(b=b||this.__patterns.django_comment.read(),b=b||this.__patterns.django.read())));return b};q.exports.TemplatablePattern=
+d}]);"function"==typeof define&&define.amd?define("beautify.js",[],function(){return{js_beautify:r}}):"undefined"!=typeof exports?exports.js_beautify=r:"undefined"!=typeof window?window.js_beautify=r:"undefined"!=typeof global&&(global.js_beautify=r)}();
+(function(){var r=function(h){function d(c){if(f[c])return f[c].exports;var b=f[c]={i:c,l:!1,exports:{}};return h[c].call(b.exports,b,b.exports,d),b.l=!0,b.exports}var f={};return d.m=h,d.c=f,d.d=function(c,b,e){d.o(c,b)||Object.defineProperty(c,b,{enumerable:!0,get:e})},d.r=function(c){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(c,Symbol.toStringTag,{value:"Module"});Object.defineProperty(c,"__esModule",{value:!0})},d.t=function(c,b){if((1&b&&(c=d(c)),8&b)||4&b&&"object"==
+typeof c&&c&&c.__esModule)return c;var e=Object.create(null);if(d.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:c}),2&b&&"string"!=typeof c)for(var a in c)d.d(e,a,function(a){return c[a]}.bind(null,a));return e},d.n=function(c){var b=c&&c.__esModule?function(){return c["default"]}:function(){return c};return d.d(b,"a",b),b},d.o=function(c,b){return Object.prototype.hasOwnProperty.call(c,b)},d.p="",d(d.s=18)}([,,function(h,d,f){function c(a){this.__parent=a;this.__character_count=0;this.__indent_count=
+-1;this.__wrap_point_character_count=this.__wrap_point_index=this.__alignment_count=0;this.__wrap_point_indent_count=-1;this.__wrap_point_alignment_count=0;this.__items=[]}function b(a,b){this.__cache=[""];this.__indent_size=a.indent_size;this.__indent_string=a.indent_char;a.indent_with_tabs||(this.__indent_string=Array(a.indent_size+1).join(a.indent_char));b=b||"";0a?this.__items[this.__items.length+a]:this.__items[a]};c.prototype.has_match=function(a){for(var b=this.__items.length-1;0<=b;b--)if(this.__items[b].match(a))return!0;return!1};c.prototype.set_indent=function(a,b){this.is_empty()&&(this.__indent_count=a||0,this.__alignment_count=b||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))};c.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=
+this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)};c.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count};c.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();
+var a=this.__parent.current_line;return a.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),a.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),a.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count," "===a.__items[0]&&(a.__items.splice(0,1),--a.__character_count),!0}return!1};c.prototype.is_empty=function(){return 0===this.__items.length};
+c.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]};c.prototype.push=function(a){this.__items.push(a);var b=a.lastIndexOf("\n");-1!==b?this.__character_count=a.length-b:this.__character_count+=a.length};c.prototype.pop=function(){var a=null;return this.is_empty()||(a=this.__items.pop(),this.__character_count-=a.length),a};c.prototype._remove_indent=function(){0a&&(e=0),e+=a*this.__indent_size,e+b};b.prototype.get_indent_string=function(a,b){var e=this.__base_string;return b=b||0,0>a&&(a=0,e=""),b+=a*this.__indent_size,this.__ensure_cache(b),e+this.__cache[b]};b.prototype.__ensure_cache=function(a){for(;a>=this.__cache.length;)this.__add_column()};b.prototype.__add_column=function(){var a=this.__cache.length,b=0,e="";this.__indent_size&&a>=this.__indent_size&&(b=Math.floor(a/this.__indent_size),a-=b*this.__indent_size,
+e=Array(b+1).join(this.__indent_string));a&&(e+=Array(a+1).join(" "));this.__cache.push(e)};e.prototype.__add_outputline=function(){this.previous_line=this.current_line;this.current_line=this.next_line.clone_empty();this.__lines.push(this.current_line)};e.prototype.get_line_number=function(){return this.__lines.length};e.prototype.get_indent_string=function(a,b){return this.__indent_cache.get_indent_string(a,b)};e.prototype.get_indent_size=function(a,b){return this.__indent_cache.get_indent_size(a,
+b)};e.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()};e.prototype.add_new_line=function(a){return!(this.is_empty()||!a&&this.just_added_newline())&&(this.raw||this.__add_outputline(),!0)};e.prototype.get_code=function(a){this.trim(!0);var b=this.current_line.pop();b&&("\n"===b[b.length-1]&&(b=b.replace(/\n+$/g,"")),this.current_line.push(b));this._end_with_newline&&this.__add_outputline();b=this.__lines.join("\n");return"\n"!==a&&(b=b.replace(/[\n]/g,a)),b};
+e.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()};e.prototype.set_indent=function(a,b){return a=a||0,b=b||0,this.next_line.set_indent(a,b),1=b.length&&this.__input.substring(a-b.length,a).toLowerCase()===b};h.exports.InputScanner=c},function(h,d,f){var c=f(8).InputScanner,b=f(3).Token,e=f(10).TokenStream,a=f(11).WhitespacePattern,k={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"};d=function(b,e){this._input=new c(b);this._options=e||{};this.__tokens=null;this._patterns={};this._patterns.whitespace=new a(this._input)};d.prototype.tokenize=function(){this._input.restart();this.__tokens=new e;this._reset();for(var a,c=new b(k.START,
+""),d=null,f=[],h=new e;c.type!==k.EOF;){for(a=this._get_next_token(c,d);this._is_comment(a);)h.add(a),a=this._get_next_token(c,d);h.isEmpty()||(a.comments_before=h,h=new e);a.parent=d;this._is_opening(a)?(f.push(d),d=a):d&&this._is_closing(a,d)&&(a.opened=d,d.closed=a,d=f.pop(),a.parent=d);a.previous=c;c.next=a;this.__tokens.add(a);c=a}return this.__tokens};d.prototype._is_first_token=function(){return this.__tokens.isEmpty()};d.prototype._reset=function(){};d.prototype._get_next_token=function(a,
+b){this._readWhitespace();var c=this._input.read(/.+/g);return c?this._create_token(k.RAW,c):this._create_token(k.EOF,"")};d.prototype._is_comment=function(a){return!1};d.prototype._is_opening=function(a){return!1};d.prototype._is_closing=function(a,b){return!1};d.prototype._create_token=function(a,c){return new b(a,c,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token)};d.prototype._readWhitespace=function(){return this._patterns.whitespace.read()};h.exports.Tokenizer=
+d;h.exports.TOKEN=k},function(h,d,f){function c(b){this.__tokens=[];this.__tokens_length=this.__tokens.length;this.__position=0;this.__parent_token=b}c.prototype.restart=function(){this.__position=0};c.prototype.isEmpty=function(){return 0===this.__tokens_length};c.prototype.hasNext=function(){return this.__position/),erb:d.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:d.starting_with(/{%/).until_after(/%}/),django_value:d.starting_with(/{{/).until_after(/}}/),
+django_comment:d.starting_with(/{#/).until_after(/#}/)}}var b=f(12).Pattern,e={django:!1,erb:!1,handlebars:!1,php:!1};c.prototype=new b;c.prototype._create=function(){return new c(this._input,this)};c.prototype._update=function(){this.__set_templated_pattern()};c.prototype.disable=function(a){var b=this._create();return b._disabled[a]=!0,b._update(),b};c.prototype.read_options=function(a){var b=this._create(),c;for(c in e)b._disabled[c]=-1===a.templating.indexOf(c);return b._update(),b};c.prototype.exclude=
+function(a){var b=this._create();return b._excluded[a]=!0,b._update(),b};c.prototype.read=function(){for(var a="",a=this._match_pattern?this._input.read(this._starting_pattern):this._input.read(this._starting_pattern,this.__template_pattern),b=this._read_template();b;)this._match_pattern?b+=this._input.read(this._match_pattern):b+=this._input.readUntil(this.__template_pattern),a+=b,b=this._read_template();return this._until_after&&(a+=this._input.readUntilAfter(this._until_pattern)),a};c.prototype.__set_templated_pattern=
+function(){var a=[];this._disabled.php||a.push(this.__patterns.php._starting_pattern.source);this._disabled.handlebars||a.push(this.__patterns.handlebars._starting_pattern.source);this._disabled.erb||a.push(this.__patterns.erb._starting_pattern.source);this._disabled.django||(a.push(this.__patterns.django._starting_pattern.source),a.push(this.__patterns.django_value._starting_pattern.source),a.push(this.__patterns.django_comment._starting_pattern.source));this._until_pattern&&a.push(this._until_pattern.source);
+this.__template_pattern=this._input.get_regexp("(?:"+a.join("|")+")")};c.prototype._read_template=function(){var a="",b=this._input.peek();"\x3c"===b?(b=this._input.peek(1),this._disabled.php||this._excluded.php||"?"!==b||(a=a||this.__patterns.php.read()),this._disabled.erb||this._excluded.erb||"%"!==b||(a=a||this.__patterns.erb.read())):"{"===b&&(this._disabled.handlebars||this._excluded.handlebars||(a=a||this.__patterns.handlebars_comment.read(),a=a||this.__patterns.handlebars_unescaped.read(),
+a=a||this.__patterns.handlebars.read()),this._disabled.django||(this._excluded.django||this._excluded.handlebars||(a=a||this.__patterns.django_value.read()),this._excluded.django||(a=a||this.__patterns.django_comment.read(),a=a||this.__patterns.django.read())));return a};h.exports.TemplatablePattern=c},,,,function(h,d,f){var c=f(19).Beautifier,b=f(20).Options;h.exports=function(b,a,d,f){return(new c(b,a,d,f)).beautify()};h.exports.defaultOptions=function(){return new b}},function(h,d,f){function c(a,
+b,c){this.parent=a||null;this.tag=b?b.tag_name:"";this.indent_level=c||0;this.parser_token=b||null}function b(a){this._printer=a;this._current_frame=null}function e(b,c,e,d){this._source_text=b||"";c=c||{};this._js_beautify=e;this._css_beautify=d;this._tag_stack=null;this._options=new a(c,"html");this._is_wrap_attributes_force="force"===this._options.wrap_attributes.substr(0,5);this._is_wrap_attributes_force_expand_multiline="force-expand-multiline"===this._options.wrap_attributes;this._is_wrap_attributes_force_aligned=
+"force-aligned"===this._options.wrap_attributes;this._is_wrap_attributes_aligned_multiple="aligned-multiple"===this._options.wrap_attributes;this._is_wrap_attributes_preserve="preserve"===this._options.wrap_attributes.substr(0,8);this._is_wrap_attributes_preserve_aligned="preserve-aligned"===this._options.wrap_attributes}var a=f(20).Options,k=f(2).Output,l=f(21).Tokenizer,p=f(21).TOKEN,w=/\r\n|[\r\n]/,x=/\r\n|[\r\n]/g,u=function(a,b){this.alignment_size=this.indent_level=0;this.max_preserve_newlines=
+a.max_preserve_newlines;this.preserve_newlines=a.preserve_newlines;this._output=new k(a,b)};u.prototype.current_line_has_match=function(a){return this._output.current_line.has_match(a)};u.prototype.set_space_before_token=function(a,b){this._output.space_before_token=a;this._output.non_breaking_space=b};u.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size);this._output.set_wrap_point()};u.prototype.add_raw_token=function(a){this._output.add_raw_token(a)};
+u.prototype.print_preserved_newlines=function(a){var b=0;a.type!==p.TEXT&&a.previous.type!==p.TEXT&&(b=a.newlines?1:0);this.preserve_newlines&&(b=a.newlinesa?"":this._output.get_indent_string(a)};b.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null};b.prototype.record_tag=
+function(a){this._current_frame=new c(this._current_frame,a,this._printer.indent_level)};b.prototype._try_pop_frame=function(a){var b=null;return a&&(b=a.parser_token,this._printer.indent_level=a.indent_level,this._current_frame=a.parent),b};b.prototype._get_frame=function(a,b){for(var c=this._current_frame;c&&-1===a.indexOf(c.tag);){if(b&&-1!==b.indexOf(c.tag)){c=null;break}c=c.parent}return c};b.prototype.try_pop=function(a,b){var c=this._get_frame([a],b);return this._try_pop_frame(c)};b.prototype.indent_to_tag=
+function(a){(a=this._get_frame(a))&&(this._printer.indent_level=a.indent_level)};e.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var a=this._source_text,c=this._options.eol;"auto"===this._options.eol&&(c="\n",a&&w.test(a)&&(c=a.match(w)[0]));var a=a.replace(x,"\n"),e=a.match(/^[\t ]*/)[0],d={text:"",type:""},f=new q,e=new u(this._options,e),a=(new l(a,this._options)).tokenize();this._tag_stack=new b(e);for(var g=null,h=a.next();h.type!==p.EOF;)h.type===p.TAG_OPEN||
+h.type===p.COMMENT?(g=this._handle_tag_open(e,h,f,d),f=g):h.type===p.ATTRIBUTE||h.type===p.EQUALS||h.type===p.VALUE||h.type===p.TEXT&&!f.tag_complete?g=this._handle_inside_tag(e,h,f,a):h.type===p.TAG_CLOSE?g=this._handle_tag_close(e,h,f):h.type===p.TEXT?g=this._handle_text(e,h,f):e.add_raw_token(h),d=g,h=a.next();return e._output.get_code(c)};e.prototype._handle_tag_close=function(a,b,c){var e={text:b.text,type:b.type};return a.alignment_size=0,c.tag_complete=!0,a.set_space_before_token(b.newlines||
+""!==b.whitespace_before,!0),c.is_unformatted?a.add_raw_token(b):("\x3c"===c.tag_start_char&&(a.set_space_before_token("/"===b.text[0],!0),this._is_wrap_attributes_force_expand_multiline&&c.has_wrapped_attrs&&a.print_newline(!1)),a.print_token(b)),!c.indent_content||c.is_unformatted||c.is_content_unformatted||(a.indent(),c.indent_content=!1),c.is_inline_element||c.is_unformatted||c.is_content_unformatted||a.set_wrap_point(),e};e.prototype._handle_inside_tag=function(a,b,c,e){var d=c.has_wrapped_attrs,
+f={text:b.text,type:b.type};if(a.set_space_before_token(b.newlines||""!==b.whitespace_before,!0),c.is_unformatted)a.add_raw_token(b);else if("{"===c.tag_start_char&&b.type===p.TEXT)a.print_preserved_newlines(b)?(b.newlines=0,a.add_raw_token(b)):a.print_token(b);else{if(b.type===p.ATTRIBUTE?(a.set_space_before_token(!0),c.attr_count+=1):b.type===p.EQUALS?a.set_space_before_token(!1):b.type===p.VALUE&&b.previous.type===p.EQUALS&&a.set_space_before_token(!1),b.type===p.ATTRIBUTE&&"\x3c"===c.tag_start_char&&
+((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(a.traverse_whitespace(b),d=d||0!==b.newlines),this._is_wrap_attributes_force)){var g=1k&&h.type!==p.EOF&&h.type!==p.TAG_CLOSE);g=!g}g&&(a.print_newline(!1),d=!0)}a.print_token(b);d=d||a.previous_token_wrapped();c.has_wrapped_attrs=d}return f};e.prototype._handle_text=
+function(a,b,c){var e={text:b.text,type:"TK_CONTENT"};return c.custom_beautifier_name?this._print_custom_beatifier_text(a,b,c):c.is_unformatted||c.is_content_unformatted?a.add_raw_token(b):(a.traverse_whitespace(b),a.print_token(b)),e};e.prototype._print_custom_beatifier_text=function(a,b,c){var d=this;if(""!==b.text){var f,g=b.text,h=1,p="",k="";"javascript"===c.custom_beautifier_name&&"function"==typeof this._js_beautify?f=this._js_beautify:"css"===c.custom_beautifier_name&&"function"==typeof this._css_beautify?
+f=this._css_beautify:"html"===c.custom_beautifier_name&&(f=function(a,b){return(new e(a,b,d._js_beautify,d._css_beautify)).beautify()});"keep"===this._options.indent_scripts?h=0:"separate"===this._options.indent_scripts&&(h=-a.indent_level);h=a.get_full_indent(h);if(g=g.replace(/\n[ \t]*$/,""),"html"!==c.custom_beautifier_name&&"\x3c"===g[0]&&g.match(/^(\x3c!--|]*)/),this.tag_check=c?c[1]:""):(c=b.text.match(/^{{(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=c?c[1]:"","{{#\x3e"===b.text&&"\x3e"===this.tag_check&&null!==b.next&&(this.tag_check=b.next.text));this.tag_check=this.tag_check.toLowerCase();b.type===p.COMMENT&&(this.tag_complete=!0);this.tag_name=(this.is_start_tag="/"!==this.tag_check.charAt(0))?
+this.tag_check:this.tag_check.substr(1);this.is_end_tag=(this.is_end_tag=!this.is_start_tag||b.closed&&"/\x3e"===b.closed.text)||"{"===this.tag_start_char&&(3>this.text.length||/[^#\^]/.test(this.text.charAt(2)))}else this.tag_complete=!0};e.prototype._get_tag_open_token=function(a){a=new q(this._tag_stack.get_parser_token(),a);return a.alignment_size=this._options.wrap_attributes_indent_size,a.is_end_tag=a.is_end_tag||-1!==this._options.void_elements.indexOf(a.tag_check),a.is_empty_element=a.tag_complete||
+a.is_start_tag&&a.is_end_tag,a.is_unformatted=!a.tag_complete&&-1!==this._options.unformatted.indexOf(a.tag_check),a.is_content_unformatted=!a.is_empty_element&&-1!==this._options.content_unformatted.indexOf(a.tag_check),a.is_inline_element=-1!==this._options.inline.indexOf(a.tag_name)||"{"===a.tag_start_char,a};e.prototype._set_tag_position=function(a,b,c,d,e){if(!c.is_empty_element)if(c.is_end_tag)c.start_tag_token=this._tag_stack.try_pop(c.tag_name);else if(this._do_optional_end_element(c)&&(c.is_inline_element||
+a.print_newline(!1)),this._tag_stack.record_tag(c),!("script"!==c.tag_name&&"style"!==c.tag_name||c.is_unformatted||c.is_content_unformatted)){var f=c.tag_check,g=null,h=null;if(b.closed){"script"===f?g="text/javascript":"style"===f&&(g="text/css");for(var f=null,k=b.next;k.type!==p.EOF&&b.closed!==k;){if(k.type===p.ATTRIBUTE&&"type"===k.text){k.next&&k.next.type===p.EQUALS&&k.next.next&&k.next.next.type===p.VALUE&&(f=k.next.next.text);break}k=k.next}b=(g=f||g,-1]|\/>/),element_name:f.until(/[\n\r\t >\/]/),handlebars_comment:h.starting_with(/{{!--/).until_after(/--}}/),handlebars:h.starting_with(/{{/).until_after(/}}/),handlebars_open:h.until(/[\n\r\t }]/),handlebars_raw_close:h.until(/}}/),comment:h.starting_with(/\x3c!--/).until_after(/--\x3e/),cdata:h.starting_with(//),processing:h.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter)f=this._input.get_literal_regexp(this._options.unformatted_content_delimiter),this.__patterns.unformatted_content_delimiter=h.matching(f).until_after(f)};f.prototype=new c;f.prototype._is_comment=function(a){return!1};
+f.prototype._is_opening=function(a){return a.type===k.TAG_OPEN};f.prototype._is_closing=function(a,b){return a.type===k.TAG_CLOSE&&b&&(("\x3e"===a.text||"/\x3e"===a.text)&&"\x3c"===b.text[0]||"}}"===a.text&&"{"===b.text[0]&&"{"===b.text[1])};f.prototype._reset=function(){this._current_tag_name=""};f.prototype._get_next_token=function(a,b){var c=null;this._readWhitespace();var d=this._input.peek();return null===d?this._create_token(k.EOF,""):(c=c||this._read_open_handlebars(d,b),c=c||this._read_attribute(d,
+a,b),c=c||this._read_close(d,b),c=c||this._read_raw_content(d,a,b),c=c||this._read_content_word(d),c=c||this._read_comment_or_cdata(d),c=c||this._read_processing(d),c=c||this._read_open(d,b),c||this._create_token(k.UNKNOWN,this._input.next()))};f.prototype._read_comment_or_cdata=function(a){var b=null,c=null,d=null;"\x3c"===a&&("!"===this._input.peek(1)&&(c=this.__patterns.comment.read(),c?(d=l.get_directives(c))&&"start"===d.ignore&&(c+=l.readIgnored(this._input)):c=this.__patterns.cdata.read()),
+c&&(b=this._create_token(k.COMMENT,c),b.directives=d));return b};f.prototype._read_processing=function(a){var b=null,c=null;"\x3c"===a&&(a=this._input.peek(1),"!"!==a&&"?"!==a||(c=this.__patterns.conditional_comment.read(),c=c||this.__patterns.processing.read()),c&&(b=this._create_token(k.COMMENT,c),b.directives=null));return b};f.prototype._read_open=function(a,b){var c=null,d=null;return b||"\x3c"===a&&(c=this._input.next(),"/"===this._input.peek()&&(c+=this._input.next()),c+=this.__patterns.element_name.read(),
+d=this._create_token(k.TAG_OPEN,c)),d};f.prototype._read_open_handlebars=function(a,b){var c=null,d=null;return b||this._options.indent_handlebars&&"{"===a&&"{"===this._input.peek(1)&&("!"===this._input.peek(2)?(c=this.__patterns.handlebars_comment.read(),c=c||this.__patterns.handlebars.read(),d=this._create_token(k.COMMENT,c)):(c=this.__patterns.handlebars_open.read(),d=this._create_token(k.TAG_OPEN,c))),d};f.prototype._read_close=function(a,b){var c=null,d=null;return b&&("\x3c"===b.text[0]&&("\x3e"===
+a||"/"===a&&"\x3e"===this._input.peek(1))?(c=this._input.next(),"/"===a&&(c+=this._input.next()),d=this._create_token(k.TAG_CLOSE,c)):"{"===b.text[0]&&"}"===a&&"}"===this._input.peek(1)&&(this._input.next(),this._input.next(),d=this._create_token(k.TAG_CLOSE,"}}"))),d};f.prototype._read_attribute=function(a,b,c){var d=null,e="";c&&"\x3c"===c.text[0]&&("\x3d"===a?d=this._create_token(k.EQUALS,this._input.next()):'"'===a||"'"===a?(b=this._input.next(),b+='"'===a?this.__patterns.double_quote.read():
+this.__patterns.single_quote.read(),d=this._create_token(k.VALUE,b)):(e=this.__patterns.attribute.read())&&(d=b.type===k.EQUALS?this._create_token(k.VALUE,e):this._create_token(k.ATTRIBUTE,e)));return d};f.prototype._is_content_unformatted=function(a){return-1===this._options.void_elements.indexOf(a)&&(-1!==this._options.content_unformatted.indexOf(a)||-1!==this._options.unformatted.indexOf(a))};f.prototype._read_raw_content=function(a,b,c){var d="";if(c&&"{"===c.text[0])d=this.__patterns.handlebars_raw_close.read();
+else if(b.type===k.TAG_CLOSE&&"\x3c"===b.opened.text[0]&&"/"!==b.text[0])if(b=b.opened.text.substr(1).toLowerCase(),"script"===b||"style"===b){if(a=this._read_comment_or_cdata(a))return a.type=k.TEXT,a;d=this._input.readUntil(new RegExp("\x3c/"+b+"[\\n\\r\\t ]*?\x3e","ig"))}else this._is_content_unformatted(b)&&(d=this._input.readUntil(new RegExp("\x3c/"+b+"[\\n\\r\\t ]*?\x3e","ig")));return d?this._create_token(k.TEXT,d):null};f.prototype._read_content_word=function(a){var b="";if(this._options.unformatted_content_delimiter&&
+a===this._options.unformatted_content_delimiter[0]&&(b=this.__patterns.unformatted_content_delimiter.read()),b||(b=this.__patterns.word.read()),b)return this._create_token(k.TEXT,b)};h.exports.Tokenizer=f;h.exports.TOKEN=k}]);if("function"==typeof define&&define.amd)define("beautify-html.js",["require","./beautify","./beautify-css"],function(h){var d=h("./beautify"),f=h("./beautify-css");return{html_beautify:function(c,b){return r(c,b,d.js_beautify,f.css_beautify)}}});else if("undefined"!=typeof exports){var q=
+require("./beautify.js"),l=require("./beautify-css.js");exports.html_beautify=function(h,d){return r(h,d,q.js_beautify,l.css_beautify)}}else"undefined"!=typeof window?window.html_beautify=function(h,d){return r(h,d,window.js_beautify,window.css_beautify)}:"undefined"!=typeof global&&(global.html_beautify=function(h,d){return r(h,d,global.js_beautify,global.css_beautify)})})();
+(function(r){"function"==typeof r.define&&(r.define("beautify",["beautify.js"],function(q){return q}),r.define("beautify-css",[],function(){return{css_beautify:void 0}}),r.define("beautifyModule",["beautify","beautify-html.js"],function(q,l){r.js_beautify=q.js_beautify;r.html_beautify=l.html_beautify}))})(this);
\ No newline at end of file
diff --git a/assets/packages/ckeditor/plugins/codemirror/js/codemirror.addons.min.js b/assets/packages/ckeditor/plugins/codemirror/js/codemirror.addons.min.js
index b6466936650..8cc8fdf972a 100644
--- a/assets/packages/ckeditor/plugins/codemirror/js/codemirror.addons.min.js
+++ b/assets/packages/ckeditor/plugins/codemirror/js/codemirror.addons.min.js
@@ -1,2 +1,178 @@
-!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/comment/continuecomment.js",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(t){if(t.getOption("disableInput"))return e.Pass;for(var i,o=t.listSelections(),r=[],a=0;a=d);else if(0==s.string.indexOf(i.blockCommentStart)){if(f=h.slice(0,s.start),!/^\s*$/.test(f)){f="";for(var m=0;ms.start&&/^\s*$/.test(h.slice(0,u))&&(f=h.slice(0,u));null!=f&&(f+=i.blockCommentContinue)}if(null==f&&i.lineComment&&n(t)){var g=t.getLine(l.line),u=g.indexOf(i.lineComment);u>-1&&(f=g.slice(0,u),/\S/.test(f)?f=null:f+=i.lineComment+g.slice(u+i.lineComment.length).match(/^\s*/)[0])}if(null==f)return e.Pass;r[a]="\n"+f}t.operation(function(){for(var e=o.length-1;e>=0;e--)t.replaceRange(r[e],o[e].from(),o[e].to(),"+insert")})}function n(e){var t=e.getOption("continueComments");return!t||"object"!=typeof t||!1!==t.continueLineComment}for(var i=["clike","css","javascript"],o=0;o=0;l--){var f=a[l].head;i.replaceRange("",d(f.line,f.ch-1),d(f.line,f.ch+1),"+delete")}}function o(i){var o=n(i),r=o&&t(o,"explode");if(!r||i.getOption("disableInput"))return e.Pass;for(var a=i.listSelections(),l=0;l0;return{anchor:new d(t.anchor.line,t.anchor.ch+(n?-1:1)),head:new d(t.head.line,t.head.ch+(n?1:-1))}}function a(i,o){var a=n(i);if(!a||i.getOption("disableInput"))return e.Pass;var s=t(a,"pairs"),u=s.indexOf(o);if(-1==u)return e.Pass;for(var h,m=t(a,"triples"),g=s.charAt(u+1)==o,p=i.listSelections(),v=u%2==0,b=0;b1&&m.indexOf(o)>=0&&i.getRange(d(C.line,C.ch-2),C)==o+o&&(C.ch<=2||i.getRange(d(C.line,C.ch-3),d(C.line,C.ch-2))!=o))x="addFour";else if(g){if(e.isWordChar(k)||!c(i,C,o))return e.Pass;x="both"}else{if(!v||i.getLine(C.line).length!=C.ch&&!l(k,s)&&!/\s/.test(k))return e.Pass;x="both"}else x=g&&f(i,C)?"both":m.indexOf(o)>=0&&i.getRange(C,d(C.line,C.ch+3))==o+o+o?"skipThree":"skip";if(h){if(h!=x)return e.Pass}else h=x}var L=u%2?s.charAt(u-1):o,M=u%2?o:s.charAt(u+1);i.operation(function(){if("skip"==h)i.execCommand("goCharRight");else if("skipThree"==h)for(var e=0;e<3;e++)i.execCommand("goCharRight");else if("surround"==h){for(var t=i.getSelections(),e=0;e-1&&n%2==1}function s(e,t){var n=e.getRange(d(t.line,t.ch-1),d(t.line,t.ch+1));return 2==n.length?n:null}function c(t,n,i){var o=t.getLine(n.line),r=t.getTokenAt(n);if(/\bstring2?\b/.test(r.type)||f(t,n))return!1;var a=new e.StringStream(o.slice(0,n.ch)+i+o.slice(n.ch),4);for(a.pos=a.start=r.start;;){var l=t.getMode().token(a,r.state);if(a.pos>=n.ch+1)return/\bstring2?\b/.test(l);a.start=a.pos}}function f(e,t){var n=e.getTokenAt(d(t.line,t.ch+1));return/\bstring/.test(n.type)&&n.start==t.ch}var u={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},d=e.Pos;e.defineOption("autoCloseBrackets",!1,function(t,n,i){i&&i!=e.Init&&(t.removeKeyMap(m),t.state.closeBrackets=null),n&&(t.state.closeBrackets=n,t.addKeyMap(m))});for(var h=u.pairs+"`",m={Backspace:i,Enter:o},g=0;g=e.max))return e.ch=0,e.text=e.cm.getLine(++e.line),!0}function r(e){if(!(e.line<=e.min))return e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0}function a(e){for(;;){var t=e.text.indexOf(">",e.ch);if(-1==t){if(o(e))continue;return}{if(i(e,t+1)){var n=e.text.lastIndexOf("/",t),r=n>-1&&!/\S/.test(e.text.slice(n+1,t));return e.ch=t+1,r?"selfClose":"regular"}e.ch=t+1}}}function l(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==t){if(r(e))continue;return}if(i(e,t+1)){m.lastIndex=t,e.ch=t;var n=m.exec(e.text);if(n&&n.index==t)return n}else e.ch=t}}function s(e){for(;;){m.lastIndex=e.ch;var t=m.exec(e.text);if(!t){if(o(e))continue;return}{if(i(e,t.index+1))return e.ch=t.index+t[0].length,t;e.ch=t.index+1}}}function c(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==t){if(r(e))continue;return}{if(i(e,t+1)){var n=e.text.lastIndexOf("/",t),o=n>-1&&!/\S/.test(e.text.slice(n+1,t));return e.ch=t+1,o?"selfClose":"regular"}e.ch=t}}}function f(e,t){for(var n=[];;){var i,o=s(e),r=e.line,l=e.ch-(o?o[0].length:0);if(!o||!(i=a(e)))return;if("selfClose"!=i)if(o[1]){for(var c=n.length-1;c>=0;--c)if(n[c]==o[2]){n.length=c;break}if(c<0&&(!t||t==o[2]))return{tag:o[2],from:d(r,l),to:d(e.line,e.ch)}}else n.push(o[2])}}function u(e,t){for(var n=[];;){var i=c(e);if(!i)return;if("selfClose"!=i){var o=e.line,r=e.ch,a=l(e);if(!a)return;if(a[1])n.push(a[2]);else{for(var s=n.length-1;s>=0;--s)if(n[s]==a[2]){n.length=s;break}if(s<0&&(!t||t==a[2]))return{tag:a[2],from:d(e.line,e.ch),to:d(o,r)}}}else l(e)}}var d=e.Pos,h="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",m=new RegExp("<(/?)(["+h+"][A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*)","g");e.registerHelper("fold","xml",function(e,t){for(var i=new n(e,t.line,0);;){var o,r=s(i);if(!r||i.line!=t.line||!(o=a(i)))return;if(!r[1]&&"selfClose"!=o){var l=d(i.line,i.ch),c=f(i,r[2]);return c&&{from:l,to:c.from}}}}),e.findMatchingTag=function(e,i,o){var r=new n(e,i.line,i.ch,o);if(-1!=r.text.indexOf(">")||-1!=r.text.indexOf("<")){var s=a(r),c=s&&d(r.line,r.ch),h=s&&l(r);if(s&&h&&!(t(r,i)>0)){var m={from:d(r.line,r.ch),to:c,tag:h[2]};return"selfClose"==s?{open:m,close:null,at:"open"}:h[1]?{open:u(r,h[2]),close:m,at:"close"}:(r=new n(e,c.line,c.ch,o),{open:m,close:f(r,h[2]),at:"open"})}}},e.findEnclosingTag=function(e,t,i,o){for(var r=new n(e,t.line,t.ch,i);;){var a=u(r,o);if(!a)break;var l=new n(e,t.line,t.ch,i),s=f(l,a.tag);if(s)return{open:a,close:s}}},e.scanForClosingTag=function(e,t,i,o){return f(new n(e,t.line,t.ch,o?{from:0,to:o}:null),i)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define("addon/edit/closetag.js",["../../lib/codemirror","../fold/xml-fold"],e):e(CodeMirror)}(function(e){function t(t){if(t.getOption("disableInput"))return e.Pass;for(var n=t.listSelections(),i=[],s=0;sc.ch&&(v=v.slice(0,v.length-f.end+c.ch));var b=v.toLowerCase();if(!v||"string"==f.type&&(f.end!=c.ch||!/[\"\']/.test(f.string.charAt(f.string.length-1))||1==f.string.length)||"tag"==f.type&&"closeTag"==d.type||f.string.indexOf("/")==f.string.length-1||g&&o(g,b)>-1||r(t,v,c,d,!0))return e.Pass;var x=p&&o(p,b)>-1;i[s]={indent:x,text:">"+(x?"\n\n":"")+""+v+">",newPos:x?e.Pos(c.line+1,0):e.Pos(c.line,c.ch+1)}}for(var s=n.length-1;s>=0;s--){var y=i[s];t.replaceRange(y.text,n[s].head,n[s].anchor,"+insert");var C=t.listSelections().slice(0);C[s]={head:y.newPos,anchor:y.newPos},t.setSelections(C),y.indent&&(t.indentLine(y.newPos.line,null,!0),t.indentLine(y.newPos.line+1,null,!0))}}function n(t,n){for(var i=t.listSelections(),o=[],a=n?"/":"",l=0;l"!=t.getLine(s.line).charAt(c.end)&&(d+=">"),o[l]=d}t.replaceSelections(o),i=t.listSelections();for(var l=0;l'"]=function(e){return t(e)}),n.addKeyMap(a)}});var a=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],l=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];e.commands.closeTag=function(e){return n(e)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/edit/matchbrackets.js",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,i){var o=e.getLineHandle(t.line),r=t.ch-1,s=i&&i.afterCursor;null==s&&(s=/(^| )cm-fat-cursor($| )/.test(e.getWrapperElement().className));var c=!s&&r>=0&&l[o.text.charAt(r)]||l[o.text.charAt(++r)];if(!c)return null;var f=">"==c.charAt(1)?1:-1;if(i&&i.strict&&f>0!=(r==t.ch))return null;var u=e.getTokenTypeAt(a(t.line,r+1)),d=n(e,a(t.line,r+(f>0?1:0)),f,u||null,i);return null==d?null:{from:a(t.line,r),to:d&&d.pos,match:d&&d.ch==c.charAt(0),forward:f>0}}function n(e,t,n,i,o){for(var r=o&&o.maxScanLineLength||1e4,s=o&&o.maxScanLines||1e3,c=[],f=o&&o.bracketRegex?o.bracketRegex:/[(){}[\]]/,u=n>0?Math.min(t.line+s,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-s),d=t.line;d!=u;d+=n){var h=e.getLine(d);if(h){var m=n>0?0:h.length-1,g=n>0?h.length:-1;if(!(h.length>r))for(d==t.line&&(m=t.ch-(n<0?1:0));m!=g;m+=n){var p=h.charAt(m);if(f.test(p)&&(void 0===i||e.getTokenTypeAt(a(d,m+1))==i)){var v=l[p];if(">"==v.charAt(1)==n>0)c.push(p);else{if(!c.length)return{pos:a(d,m),ch:p};c.pop()}}}}}return d-n!=(n>0?e.lastLine():e.firstLine())&&null}function i(e,n,i){for(var o=e.state.matchBrackets.maxHighlightLineLength||1e3,l=[],s=e.listSelections(),c=0;c",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},s=null;e.defineOption("matchBrackets",!1,function(t,n,i){i&&i!=e.Init&&(t.off("cursorActivity",o),s&&(s(),s=null)),n&&(t.state.matchBrackets="object"==typeof n?n:{},t.on("cursorActivity",o))}),e.defineExtension("matchBrackets",function(){i(this,!0)}),e.defineExtension("findMatchingBracket",function(e,n,i){return(i||"boolean"==typeof n)&&(i?(i.strict=n,n=i):n=n?{strict:!0}:null),t(this,e,n)}),e.defineExtension("scanForBracket",function(e,t,i,o){return n(this,e,t,i,o)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define("addon/edit/matchtags.js",["../../lib/codemirror","../fold/xml-fold"],e):e(CodeMirror)}(function(e){"use strict";function t(e){e.state.tagHit&&e.state.tagHit.clear(),e.state.tagOther&&e.state.tagOther.clear(),e.state.tagHit=e.state.tagOther=null}function n(n){n.state.failedTagMatch=!1,n.operation(function(){if(t(n),!n.somethingSelected()){var i=n.getCursor(),o=n.getViewport();o.from=Math.min(o.from,i.line),o.to=Math.max(i.line+1,o.to);var r=e.findMatchingTag(n,i,o);if(r){if(n.state.matchBothTags){var a="open"==r.at?r.open:r.close;a&&(n.state.tagHit=n.markText(a.from,a.to,{className:"CodeMirror-matchingtag"}))}var l="close"==r.at?r.open:r.close;l?n.state.tagOther=n.markText(l.from,l.to,{className:"CodeMirror-matchingtag"}):n.state.failedTagMatch=!0}}})}function i(e){e.state.failedTagMatch&&n(e)}e.defineOption("matchTags",!1,function(o,r,a){a&&a!=e.Init&&(o.off("cursorActivity",n),o.off("viewportChange",i),t(o)),r&&(o.state.matchBothTags="object"==typeof r&&r.bothTags,o.on("cursorActivity",n),o.on("viewportChange",i),n(o))}),e.commands.toMatchingTag=function(t){var n=e.findMatchingTag(t,t.getCursor());if(n){var i="close"==n.at?n.open:n.close;i&&t.extendSelection(i.to,i.from)}}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/edit/trailingspace.js",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){e.defineOption("showTrailingSpace",!1,function(t,n,i){i==e.Init&&(i=!1),i&&!n?t.removeOverlay("trailingspace"):!i&&n&&t.addOverlay({token:function(e){for(var t=e.string.length,n=t;n&&/\s/.test(e.string.charAt(n-1));--n);return n>e.pos?(e.pos=n,null):(e.pos=t,"trailingspace")},name:"trailingspace"})})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/fold/foldcode",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(t,o,r,a){function l(e){var n=s(t,o);if(!n||n.to.line-n.from.linet.firstLine();)o=e.Pos(o.line-1,0),f=l(!1);if(f&&!f.cleared&&"unfold"!==a){var u=n(t,r);e.on(u,"mousedown",function(t){d.clear(),e.e_preventDefault(t)});var d=t.markText(f.from,f.to,{replacedWith:u,clearOnEnter:i(t,r,"clearOnEnter"),__isFold:!0});d.on("clear",function(n,i){e.signal(t,"unfold",t,n,i)}),e.signal(t,"fold",t,f.from,f.to)}}function n(e,t){var n=i(e,t,"widget");if("string"==typeof n){var o=document.createTextNode(n);n=document.createElement("span"),n.appendChild(o),n.className="CodeMirror-foldmarker"}else n&&(n=n.cloneNode(!0));return n}function i(e,t,n){if(t&&void 0!==t[n])return t[n];var i=e.options.foldOptions;return i&&void 0!==i[n]?i[n]:o[n]}e.newFoldFunction=function(e,n){return function(i,o){t(i,o,{rangeFinder:e,widget:n})}},e.defineExtension("foldCode",function(e,n,i){t(this,e,n,i)}),e.defineExtension("isFolded",function(e){for(var t=this.findMarksAt(e),n=0;n=l&&(n=o(r.indicatorOpen))}e.setGutterMarker(t,r.gutter,n),++a})}function a(e){var t=e.getViewport(),n=e.state.foldGutter;n&&(e.operation(function(){r(e,t.from,t.to)}),n.from=t.from,n.to=t.to)}function l(e,t,n){var o=e.state.foldGutter;if(o){var r=o.options;if(n==r.gutter){var a=i(e,t);a?a.clear():e.foldCode(u(t,0),r.rangeFinder)}}}function s(e){var t=e.state.foldGutter;if(t){var n=t.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){a(e)},n.foldOnChangeTimeSpan||600)}}function c(e){var t=e.state.foldGutter;if(t){var n=t.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){var n=e.getViewport();t.from==t.to||n.from-t.to>20||t.from-n.to>20?a(e):e.operation(function(){n.fromt.to&&(r(e,t.to,n.to),t.to=n.to)})},n.updateViewportTimeSpan||400)}}function f(e,t){var n=e.state.foldGutter;if(n){var i=t.line;i>=n.from&&it.lastLine())return null;var i=t.getTokenAt(e.Pos(n,1));if(/\S/.test(i.string)||(i=t.getTokenAt(e.Pos(n,i.end+1))),"keyword"!=i.type||"import"!=i.string)return null;for(var o=n,r=Math.min(t.lastLine(),n+10);o<=r;++o){var a=t.getLine(o),l=a.indexOf(";");if(-1!=l)return{startCh:i.end,end:e.Pos(o,l)}}}var o,r=n.line,a=i(r);if(!a||i(r-1)||(o=i(r-2))&&o.end.line==r-1)return null;for(var l=a.end;;){var s=i(l.line+1);if(null==s)break;l=s.end}return{from:t.clipPos(e.Pos(r,a.startCh+1)),to:l}}),e.registerHelper("fold","include",function(t,n){function i(n){if(nt.lastLine())return null;var i=t.getTokenAt(e.Pos(n,1));return/\S/.test(i.string)||(i=t.getTokenAt(e.Pos(n,i.end+1))),"meta"==i.type&&"#include"==i.string.slice(0,8)?i.start+8:void 0}var o=n.line,r=i(o);if(null==r||null!=i(o-1))return null;for(var a=o;;){if(null==i(a+1))break;++a}return{from:e.Pos(o,r+1),to:t.clipPos(e.Pos(a))}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/fold/comment-fold.js",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerGlobalHelper("fold","comment",function(e){return e.blockCommentStart&&e.blockCommentEnd},function(t,n){var i=t.getModeAt(n),o=i.blockCommentStart,r=i.blockCommentEnd;if(o&&r){for(var a,l=n.line,s=t.getLine(l),c=n.ch,f=0;;){var u=c<=0?-1:s.lastIndexOf(o,c-1);if(-1!=u){if(1==f&&uo))break;r=a}}return r?{from:e.Pos(i.line,n.getLine(i.line).length),to:e.Pos(r,n.getLine(r).length)}:void 0}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/format/autoFormatAll.js",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){e.defineExtension("autoFormatAll",function(t,n){function i(){c+="\n",u=!0,++f}for(var o=this,r=o.getMode(),a=o.getRange(t,n).split("\n"),l=e.copyState(r,o.getTokenAt(t).state),s=o.getOption("tabSize"),c="",f=0,u=0==t.ch,d=0;dn&&(r+=i(e.substring(n,o[a].start)),n=o[a].start),o[a].start<=n&&o[a].end>=n&&(r+=e.substring(n,o[a].end),n=o[a].end);n")&&"open"==this.tagType){this.tagType="";var c=this.isXML?"[^<]*?":"";return RegExp("^"+c+"","i").test(n)?(this.noBreak=!1,this.isXML||(this.tagName=""),!1):(a=this.noBreak,this.noBreak=!1,!a)}if(0==t.indexOf("")&&(this.tagType="close",l=t.match(/^<\/\s*?([\w]+?)$/i),null!=l&&(s=l[1].toLowerCase()),-1!=("|"+o+"|").indexOf("|"+s+"|")&&(this.noBreak=!0)),0==t.indexOf(">")&&"close"==this.tagType)return this.tagType="",0==n.indexOf("<")&&(l=n.match(/^<\/?\s*?([\w]+?)(\s|>)/i),s=null!=l?l[1].toLowerCase():"",-1==("|"+r+"|").indexOf("|"+s+"|"))?(this.noBreak=!1,!0):(a=this.noBreak,this.noBreak=!1,!a)}return 0==n.indexOf("<")&&(this.noBreak=!1,this.isXML&&""!=this.tagName?(this.tagName="",!1):(l=n.match(/^<\/?\s*?([\w]+?)(\s|>)/i),s=null!=l?l[1].toLowerCase():"",-1==("|"+r+"|").indexOf("|"+s+"|")))}}),e.defineExtension("commentRange",function(t,n,i){var o=this,r=e.innerMode(o.getMode(),o.getTokenAt(n).state).mode;o.operation(function(){if(t)o.replaceRange(r.commentEnd,i),o.replaceRange(r.commentStart,n),o.setSelection(n,{line:i.line,ch:i.ch+r.commentStart.length+r.commentEnd.length}),n.line==i.line&&n.ch==i.ch&&o.setCursor(n.line,n.ch+r.commentStart.length);else{var e=o.getRange(n,i),a=e.indexOf(r.commentStart),l=e.lastIndexOf(r.commentEnd);a>-1&&l>-1&&l>a&&(e=e.substr(0,a)+e.substring(a+r.commentStart.length,l)+e.substr(l+r.commentEnd.length)),o.replaceRange(e,n,i),o.setSelection(n,{line:i.line,ch:i.ch-r.commentStart.length-r.commentEnd.length})}})}),e.defineExtension("autoIndentRange",function(e,t){var n=this;this.operation(function(){for(var i=e.line;i<=t.line;i++)n.indentLine(i,"smart")})}),e.defineExtension("autoFormatRange",function(t,n){function i(){c+="\n",u=!0,++f}for(var o=this,r=o.getMode(),a=o.getRange(t,n).split("\n"),l=e.copyState(r,o.getTokenAt(t).state),s=o.getOption("tabSize"),c="",f=0,u=0==t.ch,d=0;d=l;o--,r=-1){var s=e.getLine(o);r>-1&&(s=s.slice(0,r));var c=a(s,t);if(c)return{from:g(o,c.index),to:g(o,c.index+c[0].length),match:c}}}function s(e,t,i){t=n(t);for(var o,r=1,l=i.line,s=e.firstLine();l>=s;){for(var c=0;c>1,l=i(e.slice(0,a)).length;if(l==n)return a;l>n?r=a:o=a+1}}function f(e,t,n,i){if(!t.length)return null;var o=i?h:m,r=o(t).split(/\r|\n\r?/);e:for(var a=n.line,l=n.ch,s=e.lastLine()+1-r.length;a<=s;a++,l=0){var f=e.getLine(a).slice(l),u=o(f);if(1==r.length){var d=u.indexOf(r[0]);if(-1==d)continue e;var n=c(f,u,d,o)+l;return{from:g(a,c(f,u,d,o)+l),to:g(a,c(f,u,d+r[0].length,o)+l)}}var p=u.length-r[0].length;if(u.slice(p)==r[0]){for(var v=1;v=s;a--,l=-1){var f=e.getLine(a);l>-1&&(f=f.slice(0,l));var u=o(f);if(1==r.length){var d=u.lastIndexOf(r[0]);if(-1==d)continue e;return{from:g(a,c(f,u,d,o)),to:g(a,c(f,u,d+r[0].length,o))}}var p=r[r.length-1];if(u.slice(0,p.length)==p){for(var v=1,n=a-r.length+1;v0);)i.push({anchor:o.from(),head:o.to()});i.length&&this.setSelections(i,0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/scroll/annotatescrollbar",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){function n(e){clearTimeout(i.doRedraw),i.doRedraw=setTimeout(function(){i.redraw()},e)}this.cm=e,this.options=t,this.buttonHeight=t.scrollButtonHeight||e.getOption("scrollButtonHeight"),this.annotations=[],this.doRedraw=this.doUpdate=null,this.div=e.getWrapperElement().appendChild(document.createElement("div")),this.div.style.cssText="position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none",this.computeScale();var i=this;e.on("refresh",this.resizeHandler=function(){clearTimeout(i.doUpdate),i.doUpdate=setTimeout(function(){i.computeScale()&&n(20)},100)}),e.on("markerAdded",this.resizeHandler),e.on("markerCleared",this.resizeHandler),!1!==t.listenForChanges&&e.on("change",this.changeHandler=function(){n(250)})}e.defineExtension("annotateScrollbar",function(e){return"string"==typeof e&&(e={className:e}),new t(this,e)}),e.defineOption("scrollButtonHeight",0),t.prototype.computeScale=function(){var e=this.cm,t=(e.getWrapperElement().clientHeight-e.display.barHeight-2*this.buttonHeight)/e.getScrollerElement().scrollHeight;if(t!=this.hScale)return this.hScale=t,!0},t.prototype.update=function(e){this.annotations=e,this.redraw()},t.prototype.redraw=function(e){function t(e,t){return s!=e.line&&(s=e.line,c=n.getLineHandle(s)),c.widgets&&c.widgets.length||a&&c.height>l?n.charCoords(e,"local")[t?"top":"bottom"]:n.heightAtLine(c,"local")+(t?0:c.height)}!1!==e&&this.computeScale();var n=this.cm,i=this.hScale,o=document.createDocumentFragment(),r=this.annotations,a=n.getOption("lineWrapping"),l=a&&1.5*n.defaultTextHeight(),s=null,c=null,f=n.lastLine();if(n.display.barWidth)for(var u,d=0;df)){for(var m=u||t(h.from,!0)*i,g=t(h.to,!1)*i;df)&&!((u=t(r[d+1].from,!0)*i)>g+.9);)h=r[++d],g=t(h.to,!1)*i;if(g!=m){var p=Math.max(g-m,3),v=o.appendChild(document.createElement("div"));v.style.cssText="position: absolute; right: 0px; width: "+Math.max(n.display.barWidth-1,2)+"px; top: "+(m+this.buttonHeight)+"px; height: "+p+"px",v.className=this.options.className,h.id&&v.setAttribute("annotation-id",h.id)}}}this.div.textContent="",this.div.appendChild(o)},t.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler),this.cm.off("markerAdded",this.resizeHandler),this.cm.off("markerCleared",this.resizeHandler),this.changeHandler&&this.cm.off("change",this.changeHandler),this.div.parentNode.removeChild(this.div)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../scroll/annotatescrollbar")):"function"==typeof define&&define.amd?define("addon/search/matchesonscrollbar",["../../lib/codemirror","./searchcursor","../scroll/annotatescrollbar"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,n,i){this.cm=e,this.options=i;var o={listenForChanges:!1};for(var r in i)o[r]=i[r];o.className||(o.className="CodeMirror-search-match"),this.annotation=e.annotateScrollbar(o),this.query=t,this.caseFold=n,this.gap={from:e.firstLine(),to:e.lastLine()+1},this.matches=[],this.update=null,this.findMatches(),this.annotation.update(this.matches);var a=this;e.on("change",this.changeHandler=function(e,t){a.onChange(t)})}function n(e,t,n){return e<=t?e:Math.max(t,e+n)}e.defineExtension("showMatchesOnScrollbar",function(e,n,i){return"string"==typeof i&&(i={className:i}),i||(i={}),new t(this,e,n,i)});t.prototype.findMatches=function(){if(this.gap){for(var t=0;t=this.gap.to)break;n.to.line>=this.gap.from&&this.matches.splice(t--,1)}for(var i=this.cm.getSearchCursor(this.query,e.Pos(this.gap.from,0),this.caseFold),o=this.options&&this.options.maxMatches||1e3;i.findNext();){var n={from:i.from(),to:i.to()};if(n.from.line>=this.gap.to)break;if(this.matches.splice(t++,0,n),this.matches.length>o)break}this.gap=null}},t.prototype.onChange=function(t){var i=t.from.line,o=e.changeEnd(t).line,r=o-t.to.line;if(this.gap?(this.gap.from=Math.min(n(this.gap.from,i,r),t.from.line),this.gap.to=Math.max(n(this.gap.to,i,r),t.from.line)):this.gap={from:t.from.line,to:o+1},r)for(var a=0;a=t.options.minChars&&r(e,d,!1,t.options.style)}})}function s(e,t,n){if(null!==e.getRange(t,n).match(/^\w+$/)){if(t.ch>0){var i={line:t.line,ch:t.ch-1},o=e.getRange(i,t);if(null===o.match(/\W/))return!1}if(n.ch-1?o+t.length:o}var r=t.exec(n?e.slice(n):e);return r?r.index+n+(i?r[0].length:0):-1}var i=Array.prototype.slice.call(arguments,1);return{startState:function(){return{outer:e.startState(t),innerActive:null,inner:null}},copyState:function(n){return{outer:e.copyState(t,n.outer),innerActive:n.innerActive,inner:n.innerActive&&e.copyState(n.innerActive.mode,n.inner)}},token:function(o,r){if(r.innerActive){var a=r.innerActive,l=o.string;if(!a.close&&o.sol())return r.innerActive=r.inner=null,this.token(o,r);var s=a.close?n(l,a.close,o.pos,a.parseDelimiters):-1;if(s==o.pos&&!a.parseDelimiters)return o.match(a.close),r.innerActive=r.inner=null,a.delimStyle&&a.delimStyle+" "+a.delimStyle+"-close";s>-1&&(o.string=l.slice(0,s));var c=a.mode.token(o,r.inner);return s>-1&&(o.string=l),s==o.pos&&a.parseDelimiters&&(r.innerActive=r.inner=null),a.innerStyle&&(c=c?c+" "+a.innerStyle:a.innerStyle),c}for(var f=1/0,l=o.string,u=0;u=u.length&&-1<(g=c.lastIndexOf(u,k.ch-u.length))&&g>z)if(q(0,c)>=g)n=c.slice(0,g);else{var v,n=f.options.tabSize;g=a.countColumn(c,g,n);n=f.options.indentWithTabs?e.call("\t",v=Math.floor(g/n))+e.call(" ",g-n*v):e.call(" ",
+g)}else-1<(g=c.indexOf(b.blockCommentContinue))&&g<=k.ch&&g<=q(0,c)&&(n=c.slice(0,g));null!=n&&(n+=b.blockCommentContinue)}null==n&&d&&l(f)&&((null==c&&(c=f.getLine(k.line)),g=c.indexOf(d),k.ch||g)?-1=g&&((n=-1=n||null),n&&(n=c.slice(0,g)+d+c.slice(g+d.length).match(/^\s*/)[0])):n="");if(null==n)return a.Pass;t[m]="\n"+n}f.operation(function(){for(var d=h.length-1;0<=d;d--)f.replaceRange(t[d],h[d].from(),h[d].to(),"+insert")})}
+function q(a,e){b.lastIndex=a;var h=b.exec(e);return h?h.index:-1}function l(a){a=a.getOption("continueComments");return!a||"object"!=typeof a||!1!==a.continueLineComment}var b=/\S/g,e=String.prototype.repeat||function(a){return Array(a+1).join(this)};a.defineOption("continueComments",null,function(e,b,h){if(h&&h!=a.Init&&e.removeKeyMap("continueComment"),b)h="Enter","string"==typeof b?h=b:"object"==typeof b&&b.key&&(h=b.key),b={name:"continueComment"},b[h]=r,e.addKeyMap(b)})});
+(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/edit/closebrackets.js",["../../lib/codemirror"],a):a(CodeMirror)})(function(a){function r(d,c){return"pairs"==c&&"string"==typeof d?d:"object"==typeof d&&null!=d[c]?d[c]:t[c]}function q(d){for(var c=0;c=
+d.max))return d.ch=0,d.text=d.cm.getLine(++d.line),!0}function b(d){if(!(d.line<=d.min))return d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0}function e(d){for(;;){var c=d.text.indexOf("\x3e",d.ch);if(-1==c){if(l(d))continue;break}if(q(d,c+1)){var g=d.text.lastIndexOf("/",c),g=-1b&&(!c||c==a[2]))return{tag:a[2],from:m(k,f),to:m(d.line,d.ch)}}else g.push(a[2])}}
+function t(d,c){for(var g=[];;){var n;a:for(n=d;;){var a=n.ch?n.text.lastIndexOf("\x3e",n.ch-1):-1;if(-1==a){if(b(n))continue;n=void 0;break a}if(q(n,a+1)){var k=n.text.lastIndexOf("/",a),k=-1e&&(!c||c==k[2]))return{tag:k[2],from:m(d.line,d.ch),to:m(n,a)}}}else f(d)}}
+var m=a.Pos,k=RegExp("\x3c(/?)([A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*)","g");a.registerHelper("fold","xml",function(d,c){for(var g=new r(d,c.line,0);;){var n=
+p(g);if(!n||g.line!=c.line)break;var a=e(g);if(!a)break;if(!n[1]&&"selfClose"!=a){a=m(g.line,g.ch);if(n=g=h(g,n[2]))n=g.from,n=0<(n.line-a.line||n.ch-a.ch);return n?{from:a,to:g.from}:null}}});a.findMatchingTag=function(d,c,g){var n=new r(d,c.line,c.ch,g);if(-1!=n.text.indexOf("\x3e")||-1!=n.text.indexOf("\x3c")){var a=e(n),k=a&&m(n.line,n.ch),b=a&&f(n);if(a&&b&&!(0<(n.line-c.line||n.ch-c.ch)))return c={from:m(n.line,n.ch),to:k,tag:b[2]},"selfClose"==a?{open:c,close:null,at:"open"}:b[1]?{open:t(n,
+b[2]),close:c,at:"close"}:(n=new r(d,k.line,k.ch,g),{open:c,close:h(n,b[2]),at:"open"})}};a.findEnclosingTag=function(d,c,g,n){for(var a=new r(d,c.line,c.ch,g);;){var k=t(a,n);if(!k)break;var e=new r(d,c.line,c.ch,g);if(e=h(e,k.tag))return{open:k,close:e}}};a.scanForClosingTag=function(d,c,g,n){return h(new r(d,c.line,c.ch,n?{from:0,to:n}:null),g)}});
+(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define("addon/edit/closetag.js",["../../lib/codemirror","../fold/xml-fold"],a):a(CodeMirror)})(function(a){function r(p){if(p.getOption("disableInput"))return a.Pass;for(var h=p.listSelections(),t=[],m=p.getOption("autoCloseTags"),k=0;kd.ch&&(z=z.slice(0,z.length-c.end+d.ch));var r=z.toLowerCase();if(!z||"string"==c.type&&(c.end!=d.ch||!/[\"\']/.test(c.string.charAt(c.string.length-1))||1==c.string.length)||"tag"==c.type&&u.close||c.string.indexOf("/")==d.ch-c.start-1||q&&-1g))for(b==e.line&&(q=e.ch-(0>k?1:0));q!=r;q+=k){var E=l.charAt(q);if(c.test(E)&&(void 0===d||a.getTokenTypeAt(p(b,q+1))==d)){var x=h[E];if(x&&"\x3e"==x.charAt(1)==0document.documentMode),p=a.Pos,h={"(":")\x3e",")":"(\x3c","[":"]\x3e","]":"[\x3c",
+"{":"}\x3e","}":"{\x3c","\x3c":"\x3e\x3e","\x3e":"\x3c\x3c"};a.defineOption("matchBrackets",!1,function(f,h,k){k&&k!=a.Init&&(f.off("cursorActivity",b),f.off("focus",b),f.off("blur",e),e(f));h&&(f.state.matchBrackets="object"==typeof h?h:{},f.on("cursorActivity",b),f.on("focus",b),f.on("blur",e))});a.defineExtension("matchBrackets",function(){l(this,!0)});a.defineExtension("findMatchingBracket",function(a,e,k){return(k||"boolean"==typeof e)&&(k?(k.strict=e,e=k):e=e?{strict:!0}:null),r(this,a,e)});
+a.defineExtension("scanForBracket",function(a,e,k,d){return q(this,a,e,k,d)})});
+(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define("addon/edit/matchtags.js",["../../lib/codemirror","../fold/xml-fold"],a):a(CodeMirror)})(function(a){function r(a){a.state.tagHit&&a.state.tagHit.clear();a.state.tagOther&&a.state.tagOther.clear();a.state.tagHit=a.state.tagOther=null}function q(b){b.state.failedTagMatch=!1;b.operation(function(){if(r(b),!b.somethingSelected()){var e=
+b.getCursor(),f=b.getViewport();f.from=Math.min(f.from,e.line);f.to=Math.max(e.line+1,f.to);if(e=a.findMatchingTag(b,e,f))b.state.matchBothTags&&(f="open"==e.at?e.open:e.close)&&(b.state.tagHit=b.markText(f.from,f.to,{className:"CodeMirror-matchingtag"})),(e="close"==e.at?e.open:e.close)?b.state.tagOther=b.markText(e.from,e.to,{className:"CodeMirror-matchingtag"}):b.state.failedTagMatch=!0}})}function l(a){a.state.failedTagMatch&&q(a)}a.defineOption("matchTags",!1,function(b,e,f){f&&f!=a.Init&&(b.off("cursorActivity",
+q),b.off("viewportChange",l),r(b));e&&(b.state.matchBothTags="object"==typeof e&&e.bothTags,b.on("cursorActivity",q),b.on("viewportChange",l),q(b))});a.commands.toMatchingTag=function(b){var e=a.findMatchingTag(b,b.getCursor());e&&(e="close"==e.at?e.open:e.close)&&b.extendSelection(e.to,e.from)}});
+(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/edit/trailingspace.js",["../../lib/codemirror"],a):a(CodeMirror)})(function(a){a.defineOption("showTrailingSpace",!1,function(r,q,l){l==a.Init&&(l=!1);l&&!q?r.removeOverlay("trailingspace"):!l&&q&&r.addOverlay({token:function(a){for(var e=a.string.length,f=e;f&&/\s/.test(a.string.charAt(f-1));--f);return f>a.pos?(a.pos=f,null):(a.pos=e,"trailingspace")},
+name:"trailingspace"})})});
+(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/fold/foldcode",["../../lib/codemirror"],a):a(CodeMirror)})(function(a){function r(e,f,b,h){function t(d){var c=m(e,f);if(!c||c.to.line-c.from.linee.firstLine();)f=a.Pos(f.line-1,0),d=t(!1);if(d&&!d.cleared&&"unfold"!==h){var c=q(e,b,d);a.on(c,"mousedown",function(d){g.clear();a.e_preventDefault(d)});var g=e.markText(d.from,d.to,{replacedWith:c,clearOnEnter:l(e,b,"clearOnEnter"),__isFold:!0});g.on("clear",function(d,c){a.signal(e,"unfold",e,d,c)});a.signal(e,"fold",e,d.from,d.to)}}function q(a,f,b){a=l(a,f,"widget");("function"==typeof a&&
+(a=a(b.from,b.to)),"string"==typeof a)?(b=document.createTextNode(a),a=document.createElement("span"),a.appendChild(b),a.className="CodeMirror-foldmarker"):a&&(a=a.cloneNode(!0));return a}function l(a,f,l){return f&&void 0!==f[l]?f[l]:(a=a.options.foldOptions)&&void 0!==a[l]?a[l]:b[l]}a.newFoldFunction=function(a,b){return function(l,h){r(l,h,{rangeFinder:a,widget:b})}};a.defineExtension("foldCode",function(a,b,l){r(this,a,b,l)});a.defineExtension("isFolded",function(a){a=this.findMarksAt(a);for(var b=
+0;b=b){if(h&&p&&h.test(p.className))return;c=l(g.indicatorOpen)}}(c||p)&&a.setGutterMarker(d,g.gutter,c)})}function e(a){var d=a.getViewport(),c=a.state.foldGutter;c&&(a.operation(function(){b(a,d.from,d.to)}),c.from=d.from,c.to=d.to)}function f(a,d,c){var g=a.state.foldGutter;g&&(g=g.options,c==g.gutter&&((c=q(a,d))?c.clear():a.foldCode(m(d,0),g)))}function p(a){var d=a.state.foldGutter;if(d){var c=d.options;d.from=d.to=
+0;clearTimeout(d.changeUpdate);d.changeUpdate=setTimeout(function(){e(a)},c.foldOnChangeTimeSpan||600)}}function h(a){var d=a.state.foldGutter;if(d){var c=d.options;clearTimeout(d.changeUpdate);d.changeUpdate=setTimeout(function(){var c=a.getViewport();d.from==d.to||20d.to&&(b(a,d.to,c.to),d.to=c.to)})},c.updateViewportTimeSpan||400)}}function t(a,d){var c=a.state.foldGutter;if(c){var g=
+d.line;g>=c.from&&g=c?-1:f.lastIndexOf(d,c-1),-1!=c){if(1==g&&cz&&(z=n.length),0>v&&(v=n.length),(u=Math.min(z,v))==n.length)break;if(r.getTokenTypeAt(a.Pos(g,u+1))==b)if(u==z)++d;else if(!--d){m=g;k=u;break a}++u}if(null!=m&&e!=m)return{from:a.Pos(e,t),to:a.Pos(m,k)}}});a.registerHelper("fold","import",function(r,q){function l(b){if(br.lastLine())return null;
+var e=r.getTokenAt(a.Pos(b,1));if(/\S/.test(e.string)||(e=r.getTokenAt(a.Pos(b,e.end+1))),"keyword"!=e.type||"import"!=e.string)return null;var f=b;for(b=Math.min(r.lastLine(),b+10);f<=b;++f){var k=r.getLine(f).indexOf(";");if(-1!=k)return{startCh:e.end,end:a.Pos(f,k)}}}var b,e=q.line,f=l(e);if(!f||l(e-1)||(b=l(e-2))&&b.end.line==e-1)return null;for(b=f.end;;){var p=l(b.line+1);if(null==p)break;b=p.end}return{from:r.clipPos(a.Pos(e,f.startCh+1)),to:b}});a.registerHelper("fold","include",function(r,
+q){function l(b){if(br.lastLine())return null;var e=r.getTokenAt(a.Pos(b,1));return/\S/.test(e.string)||(e=r.getTokenAt(a.Pos(b,e.end+1))),"meta"==e.type&&"#include"==e.string.slice(0,8)?e.start+8:void 0}var b=q.line,e=l(b);if(null==e||null!=l(b-1))return null;for(var f=b;null!=l(f+1);)++f;return{from:a.Pos(b,e+1),to:r.clipPos(a.Pos(f))}})});
+(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/fold/comment-fold.js",["../../lib/codemirror"],a):a(CodeMirror)})(function(a){a.registerGlobalHelper("fold","comment",function(a){return a.blockCommentStart&&a.blockCommentEnd},function(r,q){var l=r.getModeAt(q),b=l.blockCommentStart,l=l.blockCommentEnd;if(b&&l){var e,f=q.line;e=r.getLine(f);for(var p=q.ch,h=0;;)if(p=0>=p?-1:e.lastIndexOf(b,p-1),-1!=
+p){if(1==h&&pg&&(g=d.length),0>n&&(n=d.length),(c=Math.min(g,n))==d.length)break;if(c==g)++h;else if(!--h){t=k;m=c;break a}++c}if(null!=t&&(f!=t||m!=e))return{from:a.Pos(f,
+e),to:a.Pos(t,m)}}})});
+(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/fold/indent-fold.js",["../../lib/codemirror"],a):a(CodeMirror)})(function(a){function r(q,l){var b=q.getLine(l),e=b.search(/\S/);return-1==e||/\bcomment\b/.test(q.getTokenTypeAt(a.Pos(l,e+1)))?-1:a.countColumn(b,null,q.getOption("tabSize"))}a.registerHelper("fold","indent",function(q,l){var b=r(q,l.line);if(!(0>b)){for(var e=null,f=l.line+1,p=q.lastLine();f<=
+p;++f){var h=r(q,f);if(-1!=h){if(!(h>b))break;e=f}}return e?{from:a.Pos(l.line,q.getLine(l.line).length),to:a.Pos(e,q.getLine(e).length)}:void 0}})});
+(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/hint/show-hint.js",["../../lib/codemirror"],a):a(CodeMirror)})(function(a){function r(a,c){this.cm=a;this.options=c;this.widget=null;this.tick=this.debounce=0;this.startPos=this.cm.getCursor("start");this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length;var g=this;a.on("cursorActivity",this.activityFunc=function(){g.cursorActivity()})}
+function q(a,c){function g(a,d){var g;g="string"!=typeof d?function(a){return d(a,c)}:b.hasOwnProperty(d)?b[d]:d;f[a]=g}var b={Up:function(){c.moveFocus(-1)},Down:function(){c.moveFocus(1)},PageUp:function(){c.moveFocus(1-c.menuSize(),!0)},PageDown:function(){c.moveFocus(c.menuSize()-1,!0)},Home:function(){c.setFocus(0)},End:function(){c.setFocus(c.length-1)},Enter:c.pick,Tab:c.pick,Esc:c.close};/Mac/.test(navigator.platform)&&(b["Ctrl-P"]=function(){c.moveFocus(-1)},b["Ctrl-N"]=function(){c.moveFocus(1)});
+var e=a.options.customKeys,f=e?{}:b;if(e)for(var k in e)e.hasOwnProperty(k)&&g(k,e[k]);if(e=a.options.extraKeys)for(k in e)e.hasOwnProperty(k)&&g(k,e[k]);return f}function l(a,c){for(;c&&c!=a;){if("LI"===c.nodeName.toUpperCase()&&c.parentNode==a)return c;c=c.parentNode}}function b(d,c){this.completion=d;this.data=c;this.picked=!1;var g=this,b=d.cm,e=b.getInputField().ownerDocument,f=e.defaultView||e.parentWindow,k=this.hints=e.createElement("ul");k.className="CodeMirror-hints "+d.cm.options.theme;
+this.selectedHint=c.selectedHint||0;for(var m=c.list,t=0;tk.clientHeight+1;if(setTimeout(function(){K=
+b.getScrollInfo()}),0J&&(k.style.height=J-5+"px",k.style.top=(A=t.bottom-y.top-C)+"px",C=b.getCursor(),c.from.ch!=C.ch&&(t=b.cursorCoords(C),k.style.left=(D=t.left-r)+"px",y=k.getBoundingClientRect()))}C=y.right-x;if(0x&&(k.style.width=x-5+"px",C-=y.right-y.left-x),k.style.left=(D=t.left-C-r)+"px"),I)for(t=k.firstChild;t;t=t.nextSibling)t.style.paddingRight=b.display.nativeBarWidth+
+"px";if(b.addKeyMap(this.keyMap=q(d,{moveFocus:function(a,c){g.changeActive(g.selectedHint+a,c)},setFocus:function(a){g.changeActive(a)},menuSize:function(){return g.screenAmount()},length:m.length,close:function(){d.close()},pick:function(){g.pick()},data:c})),d.options.closeOnUnfocus){var M;b.on("blur",this.onBlur=function(){M=setTimeout(function(){d.close()},100)});b.on("focus",this.onFocus=function(){clearTimeout(M)})}b.on("scroll",this.onScroll=function(){var a=b.getScrollInfo(),c=b.getWrapperElement().getBoundingClientRect(),
+g=A+K.top-a.top,h=g-(f.pageYOffset||(e.documentElement||e.body).scrollTop);if(F||(h+=k.offsetHeight),h<=c.top||h>=c.bottom)return d.close();k.style.top=g+"px";k.style.left=D+K.left-a.left+"px"});a.on(k,"dblclick",function(a){(a=l(k,a.target||a.srcElement))&&null!=a.hintId&&(g.changeActive(a.hintId),g.pick())});a.on(k,"click",function(a){(a=l(k,a.target||a.srcElement))&&null!=a.hintId&&(g.changeActive(a.hintId),d.options.completeOnSingleClick&&g.pick())});a.on(k,"mousedown",function(){setTimeout(function(){b.focus()},
+20)});t=this.getSelectedHintRange();return 0===t.from&&0===t.to||this.scrollToActive(),a.signal(c,"select",m[this.selectedHint],k.childNodes[this.selectedHint]),!0}function e(a,c){if(!a.somethingSelected())return c;for(var g=[],b=0;b=this.data.list.length?d=c?this.data.list.length-
+1:0:0>d&&(d=c?0:this.data.list.length-1),this.selectedHint!=d){var b=this.hints.childNodes[this.selectedHint];b&&(b.className=b.className.replace(" "+h,""));b=this.hints.childNodes[this.selectedHint=d];b.className+=" "+h;this.scrollToActive();a.signal(this.data,"select",this.data.list[this.selectedHint],b)}},scrollToActive:function(){var a=this.getSelectedHintRange(),c=this.hints.childNodes[a.from],a=this.hints.childNodes[a.to],b=this.hints.firstChild;c.offsetTopthis.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=a.offsetTop+a.offsetHeight-this.hints.clientHeight+b.offsetTop)},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1},getSelectedHintRange:function(){var a=this.completion.options.scrollMargin||0;return{from:Math.max(0,this.selectedHint-a),to:Math.min(this.data.list.length-1,this.selectedHint+a)}}};a.registerHelper("hint","auto",
+{resolve:function(d,c){var b,n=d.getHelpers(c,"hint");if(n.length){var k=function(a,c,d){function b(e){if(e==g.length)return c(null);f(g[e],a,d,function(a){a&&0,]/,closeOnCursorActivity:!0,closeOnPick:!0,closeOnUnfocus:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null,
+paddingForScrollbar:!0,moveOnOverlap:!0};a.defineOption("hintOptions",null)});
+(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/hint/javascript-hint.js",["../../lib/codemirror"],a):a(CodeMirror)})(function(a){function r(a,d){for(var c=0,b=a.length;cn.ch&&
+(h.end=n.ch,h.string=h.string.slice(0,n.ch-h.start)):h={start:n.ch,end:n.ch,string:"",state:h.state,type:"."==h.string?"property":null};for(m=h;"property"==m.type;){if(m=c(f,e(n.line,m.start)),"."!=m.string)return;if(m=c(f,e(n.line,m.start)),!l)var l=[];l.push(m)}return{list:b(h,l,d,g),from:e(n.line,h.start),to:e(n.line,h.end)}}}}function l(a,d){var c=a.getTokenAt(d);return d.ch==c.start+1&&"."==c.string.charAt(0)?(c.end=c.start,c.string=".",c.type="property"):/^\.[\w$_]*$/.test(c.string)&&(c.type=
+"property",c.start++,c.string=c.string.replace(/\./,"")),c}function b(a,d,c,b){function e(a){var c;if(!(c=0!=a.lastIndexOf(q,0)))a:if(Array.prototype.indexOf)c=-1!=l.indexOf(a);else{for(c=l.length;c--;)if(l[c]===a){c=!0;break a}c=!1}c||l.push(a)}function m(a){"string"==typeof a?r(f,e):a instanceof Array?r(p,e):a instanceof Function&&r(h,e);if(Object.getOwnPropertyNames&&Object.getPrototypeOf)for(;a;a=Object.getPrototypeOf(a))Object.getOwnPropertyNames(a).forEach(e);else for(var c in a)e(c)}var l=
+[],q=a.string,t=b&&b.globalScope||window;if(d&&d.length){var w;a=d.pop();for(a.type&&0===a.type.indexOf("variable")?(b&&b.additionalContext&&(w=b.additionalContext[a.string]),b&&!1===b.useGlobalScope||(w=w||t[a.string])):"string"==a.type?w="":"atom"==a.type?w=1:"function"==a.type&&(null==t.jQuery||"$"!=a.string&&"jQuery"!=a.string||"function"!=typeof t.jQuery?null!=t._&&"_"==a.string&&"function"==typeof t._&&(w=t._()):w=t.jQuery());null!=w&&d.length;)w=w[d.pop().string];null!=w&&m(w)}else{for(d=a.state.localVars;d;d=
+d.next)e(d.name);for(w=a.state.context;w;w=w.prev)for(d=w.vars;d;d=d.next)e(d.name);for(d=a.state.globalVars;d;d=d.next)e(d.name);if(b&&null!=b.additionalContext)for(var E in b.additionalContext)e(E);b&&!1===b.useGlobalScope||m(t);r(c,e)}return l}var e=a.Pos;a.registerHelper("hint","javascript",function(a,b){return q(a,t,function(a,b){return a.getTokenAt(b)},b)});a.registerHelper("hint","coffeescript",function(a,b){return q(a,m,l,b)});var f="charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight toUpperCase toLowerCase split concat match replace search".split(" "),
+p="length concat join splice push pop shift unshift slice reverse sort indexOf lastIndexOf every some filter forEach map reduce reduceRight ".split(" "),h=["prototype","apply","call","bind"],t="break case catch class const continue debugger default delete do else export extends false finally for function if in import instanceof new null return super switch this throw true try typeof var void while with yield".split(" "),m="and break catch class continue delete do else extends false finally for if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes".split(" ")});
+(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("mode/css/css",["../../lib/codemirror"],a):a(CodeMirror)})(function(a){function r(a){for(var c={},b=0;b*\/]/.test(b)?(q="select-op",null):"."==b&&a.match(/^-?[_a-z][_a-z0-9-]*/i)?(q="qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(b)?
+(q=b,null):a.match(/[\w-.]+(?=\()/)?(/^(url(-prefix)?|domain|regexp)$/.test(a.current().toLowerCase())&&(c.tokenize=g),q="variable","variable callee"):/[\w\\\-]/.test(b)?(a.eatWhile(/[\w\\\-]/),q="word","property"):(q=null,null):/[\d.]/.test(a.peek())?(a.eatWhile(/[\w.%]/),q="unit","number"):a.match(/^-[\w\\\-]*/)?(a.eatWhile(/[\w\\\-]/),a.match(/^\s*:/,!1)?(q="variable-definition","variable-2"):(q="variable","variable-2")):a.match(/^\w+-/)?(q="meta","meta"):void 0;return b}function e(a){return function(c,
+b){for(var d,e=!1;null!=(d=c.next());){if(d==a&&!e){")"==a&&c.backUp(1);break}e=!e&&"\\"==d}return(d==a||!e&&")"!=a)&&(b.tokenize=null),q="string","string"}}function g(a,c){return a.next(),a.match(/\s*[\"\')]/,!1)?c.tokenize=null:c.tokenize=e(")"),q="(",null}function f(a,c,b){this.type=a;this.indent=c;this.prev=b}function n(a,c,b,d){return a.context=new f(b,c.indentation()+(!1===d?0:t),a.context),b}function k(a){return a.context.prev&&(a.context=a.context.prev),a.context.type}function h(a,c,b,d){for(d=
+d||1;0t.ch&&(m.end=t.ch,m.string=m.string.slice(0,t.ch-m.start));var k=a.innerMode(l.getMode(),m.state);if(k.mode.xmlCurrentTag){var d,c,g=[],n=!1,u=/\btag\b/.test(m.type)&&!/>$/.test(m.string),z=u&&/^\w/.test(m.string);if(z){var v=l.getLine(t.line).slice(Math.max(0,m.start-2),m.start);(v=/<\/$/.test(v)?"close":/<$/.test(v)?"open":null)&&(c=m.start-("close"==v?2:1))}else u&&"\x3c"==m.string?v="open":u&&"\x3c/"==m.string&&(v="close");var G=k.mode.xmlCurrentTag(k.state);
+if(!u&&!G||v){z&&(d=m.string);var n=v,w=k.mode.xmlCurrentContext?k.mode.xmlCurrentContext(k.state):[],u=(k=w.length&&w[w.length-1])&&f[k];if((w=k?u&&u.children:f["!top"])&&"close"!=v)for(f=0;f\"\']+)=$/);if(!f||!k.hasOwnProperty(f[1])||!(w=k[f[1]]))return;if("function"==typeof w&&(w=w.call(this,l)),"string"==m.type){d=m.string;f=0;/['"]/.test(m.string.charAt(0))&&(p=m.string.charAt(0),d=m.string.slice(1),f++);x=m.string.length;if(/['"]/.test(m.string.charAt(x-1))&&(p=m.string.charAt(x-
+1),d=m.string.substr(f,x-2)),f)f=l.getLine(t.line),f.length>m.end&&f.charAt(m.end)==p&&m.end++;n=!0}f=function(a){if(a)for(var c=0;cl&&(f+=b(a.substring(l,e[p].start)),l=e[p].start),e[p].start<=l&&e[p].end>=l&&(f+=a.substring(l,e[p].end),l=e[p].end);l)/i),p=null!=f?f[1].toLowerCase():"",-1=="|label|li|option|textarea|title|a|b|bdi|bdo|big|center|cite|del|em|font|i|img|ins|s|small|span|strike|strong|sub|sup|u|".indexOf("|"+
+p+"|"))?(this.noBreak=!1,!0):(e=this.noBreak,this.noBreak=!1,!e)}return 0==b.indexOf("\x3c")&&(this.noBreak=!1,this.isXML&&""!=this.tagName?(this.tagName="",!1):(f=b.match(/^<\/?\s*?([\w]+?)(\s|>)/i),p=null!=f?f[1].toLowerCase():"",-1=="|label|li|option|textarea|title|a|b|bdi|bdo|big|center|cite|del|em|font|i|img|ins|s|small|span|strike|strong|sub|sup|u|".indexOf("|"+p+"|")))}});a.defineExtension("commentRange",function(q,l,b){var e=this,f=a.innerMode(e.getMode(),e.getTokenAt(l).state).mode;e.operation(function(){if(q)e.replaceRange(f.commentEnd,
+b),e.replaceRange(f.commentStart,l),e.setSelection(l,{line:b.line,ch:b.ch+f.commentStart.length+f.commentEnd.length}),l.line==b.line&&l.ch==b.ch&&e.setCursor(l.line,l.ch+f.commentStart.length);else{var a=e.getRange(l,b),h=a.indexOf(f.commentStart),t=a.lastIndexOf(f.commentEnd);-1h&&(a=a.substr(0,h)+a.substring(h+f.commentStart.length,t)+a.substr(t+f.commentEnd.length));e.replaceRange(a,l,b);e.setSelection(l,{line:b.line,ch:b.ch-f.commentStart.length-f.commentEnd.length})}})});a.defineExtension("autoIndentRange",
+function(a,l){var b=this;this.operation(function(){for(var e=a.line;e<=l.line;e++)b.indentLine(e,"smart")})});a.defineExtension("autoFormatRange",function(q,l){for(var b=this,e=b.getMode(),f=b.getRange(q,l).split("\n"),p=a.copyState(e,b.getTokenAt(q).state),h=b.getOption("tabSize"),t="",m=0,k=0==q.ch,d=0;dh);m++){var l=a.getLine(k++);e=null==e?l:e+"\n"+l}f*=2;b.lastIndex=d.ch;if(m=b.exec(e))return b=e.slice(0,m.index).split("\n"),a=m[0].split("\n"),d=d.line+b.length-1,b=b[b.length-1].length,{from:c(d,b),to:c(d+a.length-1,1==a.length?
+b+a[0].length:a[a.length-1].length),match:m}}}function b(a,b,c){for(var d,e=0;e<=a.length;){b.lastIndex=e;e=b.exec(a);if(!e)break;var f=e.index+e[0].length;if(f>a.length-c)break;(!d||f>d.index+d[0].length)&&(d=e);e=e.index+1}return d}function e(a,d,e){d=r(d,"g");var f=e.line,k=e.ch;for(e=a.firstLine();f>=e;f--,k=-1){var h=a.getLine(f);if(k=b(h,d,0>k?0:h.length-k))return{from:c(f,k.index),to:c(f,k.index+k[0].length),match:k}}}function f(a,d,f){if(!/\\s|\\n|\n|\\W|\\D|\[\^/.test(d.source))return e(a,
+d,f);d=r(d,"gm");var k,h=1,m=a.getLine(f.line).length-f.ch;f=f.line;for(var l=a.firstLine();f>=l;){for(var p=0;p=l;p++){var q=a.getLine(f--);k=null==k?q:q+"\n"+k}h*=2;if(p=b(k,d,m))return d=k.slice(0,p.index).split("\n"),a=p[0].split("\n"),f+=d.length,d=d[d.length-1].length,{from:c(f,d),to:c(f+a.length-1,1==a.length?d+a[0].length:a[a.length-1].length),match:p}}}function p(a,b,c,d){if(a.length==b.length)return c;var e=0;for(b=c+Math.max(0,a.length-b.length);;){if(e==b)return e;var f=e+b>>1,k=
+d(a.slice(0,f)).length;if(k==c)return f;k>c?b=f:e=f+1}}function h(a,b,e,f){if(!b.length)return null;f=f?k:d;b=f(b).split(/\r|\n\r?/);var h=e.line;e=e.ch;var m=a.lastLine()+1-b.length;a:for(;h<=m;h++,e=0){var l=a.getLine(h).slice(e),q=f(l);if(1==b.length){var t=q.indexOf(b[0]);if(-1==t)continue a;p(l,q,t,f);return{from:c(h,p(l,q,t,f)+e),to:c(h,p(l,q,t+b[0].length,f)+e)}}t=q.length-b[0].length;if(q.slice(t)==b[0]){for(var r=1;r=l;h--,m=-1){var q=a.getLine(h);-1h?b.charCoords(a,"local")[c?"top":"bottom"]:b.heightAtLine(m,"local")+(c?0:m.height)}!1!==a&&this.computeScale();var b=this.cm;a=this.hScale;var e=document.createDocumentFragment(),f=this.annotations,p=b.getOption("lineWrapping"),h=p&&1.5*b.defaultTextHeight(),t=null,m=null,k=b.lastLine();if(b.display.barWidth)for(var d,c=0;ck)){for(var n=d||l(g.from,!0)*a,r=l(g.to,!1)*a;ck)&&!((d=l(f[c+1].from,!0)*
+a)>r+.9);)g=f[++c],r=l(g.to,!1)*a;if(r!=n){var r=Math.max(r-n,3),z=e.appendChild(document.createElement("div"));z.style.cssText="position: absolute; right: 0px; width: "+Math.max(b.display.barWidth-1,2)+"px; top: "+(n+this.buttonHeight)+"px; height: "+r+"px";z.className=this.options.className;g.id&&z.setAttribute("annotation-id",g.id)}}}this.div.textContent="";this.div.appendChild(e)};r.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler);this.cm.off("markerAdded",this.resizeHandler);
+this.cm.off("markerCleared",this.resizeHandler);this.changeHandler&&this.cm.off("changes",this.changeHandler);this.div.parentNode.removeChild(this.div)}});
+(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("./searchcursor"),require("../scroll/annotatescrollbar")):"function"==typeof define&&define.amd?define("addon/search/matchesonscrollbar",["../../lib/codemirror","./searchcursor","../scroll/annotatescrollbar"],a):a(CodeMirror)})(function(a){function r(a,b,e,f){this.cm=a;this.options=f;var p={listenForChanges:!1},h;for(h in f)p[h]=f[h];p.className||(p.className="CodeMirror-search-match");this.annotation=
+a.annotateScrollbar(p);this.query=b;this.caseFold=e;this.gap={from:a.firstLine(),to:a.lastLine()+1};this.matches=[];this.update=null;this.findMatches();this.annotation.update(this.matches);var q=this;a.on("change",this.changeHandler=function(a,b){q.onChange(b)})}function q(a,b,e){return a<=b?a:Math.max(b,a+e)}a.defineExtension("showMatchesOnScrollbar",function(a,b,e){return"string"==typeof e&&(e={className:e}),e||(e={}),new r(this,a,b,e)});r.prototype.findMatches=function(){if(this.gap){for(var l=
+0;l=this.gap.to)break;b.to.line>=this.gap.from&&this.matches.splice(l--,1)}for(var e=this.cm.getSearchCursor(this.query,a.Pos(this.gap.from,0),{caseFold:this.caseFold,multiline:this.options.multiline}),f=this.options&&this.options.maxMatches||1E3;e.findNext();){b={from:e.from(),to:e.to()};if(b.from.line>=this.gap.to)break;if(this.matches.splice(l++,0,b),this.matches.length>f)break}this.gap=null}};r.prototype.onChange=function(l){var b=
+l.from.line,e=a.changeEnd(l).line,f=e-l.to.line;if(this.gap?(this.gap.from=Math.min(q(this.gap.from,b,f),l.from.line),this.gap.to=Math.max(q(this.gap.to,b,f),l.from.line)):this.gap={from:l.from.line,to:e+1},f)for(l=0;l=b.options.minChars&&e(a,d,!1,b.options.style))})}function h(a,b,d){return{token:function(c){var e;if(e=c.match(a))(e=!b)||(e=!(c.start&&b.test(c.string.charAt(c.start-1))||c.pos!=c.string.length&&b.test(c.string.charAt(c.pos))));if(e)return d;c.next();c.skipTo(a.charAt(0))||c.skipToEnd()}}}var t={style:"matchhighlight",minChars:2,delay:100,wordsOnly:!1,annotateScrollbar:!1,showToken:!1,trim:!0};a.defineOption("highlightSelectionMatches",!1,function(b,e,d){if(d&&d!=a.Init&&(f(b),clearTimeout(b.state.matchHighlighter.timeout),
+b.state.matchHighlighter=null,b.off("cursorActivity",q),b.off("focus",l)),e)e=b.state.matchHighlighter=new r(e),b.hasFocus()?(e.active=!0,p(b)):b.on("focus",l),b.on("cursorActivity",q)})});
+(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/mode/multiplex.js",["../../lib/codemirror"],a):a(CodeMirror)})(function(a){a.multiplexingMode=function(r){function q(a,e,f,l){return"string"==typeof e?(f=a.indexOf(e,f),l&&-1=c;r--,i=-1){var l=e.getLine(r);i>-1&&(l=l.slice(0,i));var a=s(l,n);if(a)return{from:g(r,a.index),to:g(r,a.index+a[0].length),match:a}}}function l(e,n,o){n=t(n);for(var r,i=1,c=o.line,l=e.firstLine();c>=l;){for(var a=0;a>1,c=o(e.slice(0,s)).length;if(c==t)return s;c>t?i=s:r=s+1}}function u(e,n,t,o){if(!n.length)return null;var r=o?d:p,i=r(n).split(/\r|\n\r?/);e:for(var s=t.line,c=t.ch,l=e.lastLine()+1-i.length;s<=l;s++,c=0){var u=e.getLine(s).slice(c),f=r(u);if(1==i.length){var h=f.indexOf(i[0]);if(-1==h)continue e;var t=a(u,f,h,r)+c;return{from:g(s,a(u,f,h,r)+c),to:g(s,a(u,f,h+i[0].length,r)+c)}}var m=f.length-i[0].length;if(f.slice(m)==i[0]){for(var v=1;v=l;s--,c=-1){var u=e.getLine(s);c>-1&&(u=u.slice(0,c));var f=r(u);if(1==i.length){var h=f.lastIndexOf(i[0]);if(-1==h)continue e;return{from:g(s,a(u,f,h,r)),to:g(s,a(u,f,h+i[0].length,r))}}var m=i[i.length-1];if(f.slice(0,m.length)==m){for(var v=1,t=s-i.length+1;v0);)o.push({anchor:r.from(),head:r.to()});o.length&&this.setSelections(o,0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/dialog/dialog",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function n(e,n,t){var o,r=e.getWrapperElement();return o=r.appendChild(document.createElement("div")),o.className=t?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top","string"==typeof n?o.innerHTML=n:o.appendChild(n),o}function t(e,n){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=n}e.defineExtension("openDialog",function(o,r,i){function s(e){if("string"==typeof e)f.value=e;else{if(a)return;a=!0,l.parentNode.removeChild(l),u.focus(),i.onClose&&i.onClose(l)}}i||(i={}),t(this,null);var c,l=n(this,o,i.bottom),a=!1,u=this,f=l.getElementsByTagName("input")[0];return f?(f.focus(),i.value&&(f.value=i.value,!1!==i.selectValueOnOpen&&f.select()),i.onInput&&e.on(f,"input",function(e){i.onInput(e,f.value,s)}),i.onKeyUp&&e.on(f,"keyup",function(e){i.onKeyUp(e,f.value,s)}),e.on(f,"keydown",function(n){i&&i.onKeyDown&&i.onKeyDown(n,f.value,s)||((27==n.keyCode||!1!==i.closeOnEnter&&13==n.keyCode)&&(f.blur(),e.e_stop(n),s()),13==n.keyCode&&r(f.value,n))}),!1!==i.closeOnBlur&&e.on(f,"blur",s)):(c=l.getElementsByTagName("button")[0])&&(e.on(c,"click",function(){s(),u.focus()}),!1!==i.closeOnBlur&&e.on(c,"blur",s),c.focus()),s}),e.defineExtension("openConfirm",function(o,r,i){function s(){a||(a=!0,c.parentNode.removeChild(c),u.focus())}t(this,null);var c=n(this,o,i&&i.bottom),l=c.getElementsByTagName("button"),a=!1,u=this,f=1;l[0].focus();for(var h=0;hn.cursorCoords(t,"window").top&&((u=o).style.opacity=.4)}))};s(n,v,a,h,function(t,r){var i=e.keyName(t),s=e.keyMap[n.getOption("keyMap")][i];s||(s=n.getOption("extraKeys")[i]),"findNext"==s||"findPrev"==s||"findPersistentNext"==s||"findPersistentPrev"==s?(e.e_stop(t),f(n,o(n),r),n.execCommand(s)):"find"!=s&&"findPersistent"!=s||(e.e_stop(t),h(r,t))}),i&&a&&(f(n,l,a),d(n,t))}else c(n,v,"Search for:",a,function(e){e&&!l.query&&n.operation(function(){f(n,l,e),l.posFrom=l.posTo=n.getCursor(),d(n,t)})})}function d(n,t,r){n.operation(function(){var s=o(n),c=i(n,s.query,t?s.posFrom:s.posTo);(c.find(t)||(c=i(n,s.query,t?e.Pos(n.lastLine()):e.Pos(n.firstLine(),0)),c.find(t)))&&(n.setSelection(c.from(),c.to()),n.scrollIntoView({from:c.from(),to:c.to()},20),s.posFrom=c.from(),s.posTo=c.to(),r&&r(c.from(),c.to()))})}function p(e){e.operation(function(){var n=o(e);n.lastQuery=n.query,n.query&&(n.query=n.queryText=null,e.removeOverlay(n.overlay),n.annotate&&(n.annotate.clear(),n.annotate=null))})}function g(e,n,t){e.operation(function(){for(var o=i(e,n);o.findNext();)if("string"!=typeof n){var r=e.getRange(o.from(),o.to()).match(n);o.replace(t.replace(/\$(\d)/g,function(e,n){return r[n]}))}else o.replace(t)})}function m(e,n){if(!e.getOption("readOnly")){var t=e.getSelection()||o(e).lastQuery,r=''+(n?"Replace all:":"Replace:")+" ";c(e,r+y,r,t,function(t){t&&(t=u(t),c(e,x,"Replace with:","",function(o){if(o=a(o),n)g(e,t,o);else{p(e);var r=i(e,t,e.getCursor("from")),s=function(){var n,a=r.from();!(n=r.findNext())&&(r=i(e,t),!(n=r.findNext())||a&&r.from().line==a.line&&r.from().ch==a.ch)||(e.setSelection(r.from(),r.to()),e.scrollIntoView({from:r.from(),to:r.to()}),l(e,C,"Replace?",[function(){c(n)},s,function(){g(e,t,o)}]))},c=function(e){r.replace("string"==typeof t?o:o.replace(/\$(\d)/g,function(n,t){return e[t]})),s()};s()}}))})}}var v='Search: (Use /re/ syntax for regexp search) ',y=' (Use /re/ syntax for regexp search) ',x='With: ',C='Replace? Yes No All Stop ';e.commands.find=function(e){p(e),h(e)},e.commands.findPersistent=function(e){p(e),h(e,!1,!0)},e.commands.findPersistentNext=function(e){h(e,!1,!0,!0)},e.commands.findPersistentPrev=function(e){h(e,!0,!0,!0)},e.commands.findNext=h,e.commands.findPrev=function(e){h(e,!0)},e.commands.clearSearch=p,e.commands.replace=m,e.commands.replaceAll=function(e){m(e,!0)}}),function(e){"function"==typeof e.define&&e.define("addonSearch",["addon/search/search.js"],function(){})}(this);
+!function(b){"object"==typeof exports&&"object"==typeof module?b(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/search/searchcursor",["../../lib/codemirror"],b):b(CodeMirror)}(function(b){function A(f,a){var c;c=f.flags;for(var g=c=null!=c?c:(f.ignoreCase?"i":"")+(f.global?"g":"")+(f.multiline?"m":""),d=0;dt);x++){var b=f.getLine(e++);g=null==g?b:g+"\n"+b}d*=2;a.lastIndex=c.ch;if(x=a.exec(g))return a=g.slice(0,x.index).split("\n"),f=x[0].split("\n"),c=c.line+a.length-1,a=a[a.length-1].length,{from:l(c,a),to:l(c+f.length-1,1==f.length?
+a+f[0].length:f[f.length-1].length),match:x}}}function m(f,a,c){for(var g,d=0;d<=f.length;){a.lastIndex=d;d=a.exec(f);if(!d)break;var e=d.index+d[0].length;if(e>f.length-c)break;(!g||e>g.index+g[0].length)&&(g=d);d=d.index+1}return g}function h(f,a,c){a=A(a,"g");var g=c.line,d=c.ch;for(c=f.firstLine();g>=c;g--,d=-1){var e=f.getLine(g);if(d=m(e,a,0>d?0:e.length-d))return{from:l(g,d.index),to:l(g,d.index+d[0].length),match:d}}}function q(f,a,c){if(!/\\s|\\n|\n|\\W|\\D|\[\^/.test(a.source))return h(f,
+a,c);a=A(a,"gm");var g,d=1,e=f.getLine(c.line).length-c.ch;c=c.line;for(var t=f.firstLine();c>=t;){for(var b=0;b=t;b++){var v=f.getLine(c--);g=null==g?v:v+"\n"+g}d*=2;if(b=m(g,a,e))return a=g.slice(0,b.index).split("\n"),f=b[0].split("\n"),c+=a.length,a=a[a.length-1].length,{from:l(c,a),to:l(c+f.length-1,1==f.length?a+f[0].length:f[f.length-1].length),match:b}}}function k(f,a,c,g){if(f.length==a.length)return c;var d=0;for(a=c+Math.max(0,f.length-a.length);;){if(d==a)return d;var e=d+a>>1,t=
+g(f.slice(0,e)).length;if(t==c)return e;t>c?a=e:d=e+1}}function r(f,a,c,g){if(!a.length)return null;g=g?n:w;a=g(a).split(/\r|\n\r?/);var d=c.line;c=c.ch;var e=f.lastLine()+1-a.length;a:for(;d<=e;d++,c=0){var t=f.getLine(d).slice(c),b=g(t);if(1==a.length){var v=b.indexOf(a[0]);if(-1==v)continue a;k(t,b,v,g);return{from:l(d,k(t,b,v,g)+c),to:l(d,k(t,b,v+a[0].length,g)+c)}}v=b.length-a[0].length;if(b.slice(v)==a[0]){for(var u=1;u=t;d--,e=-1){var x=f.getLine(d);-1=z&&q()},200)});b.on(n,"focus",function(){++z})}});
+b.defineExtension("openNotification",function(p,m){function h(){r||(r=!0,clearTimeout(q),b.rmClass(k.parentNode,"dialog-opened"),k.parentNode.removeChild(k))}B(this,h);var q,k=A(this,p,m&&m.bottom),r=!1,y=m&&void 0!==m.duration?m.duration:5E3;return b.on(k,"click",function(k){b.e_preventDefault(k);h()}),y&&(q=setTimeout(h,y)),h})});
+(function(b){"object"==typeof exports&&"object"==typeof module?b(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define("addon/search/search.js",["../../lib/codemirror","./searchcursor","../dialog/dialog"],b):b(CodeMirror)})(function(b){function A(e,a){return"string"==typeof e?e=new RegExp(e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$\x26"),a?"gi":"g"):e.global||(e=new RegExp(e.source,e.ignoreCase?"gi":"g")),{token:function(a){e.lastIndex=
+a.pos;var b=e.exec(a.string);if(b&&b.index==a.pos)return a.pos+=b[0].length||1,"searching";b?a.pos=b.index:a.skipToEnd()}}}function B(){this.overlay=this.posFrom=this.posTo=this.lastQuery=this.query=null}function p(e){return e.state.search||(e.state.search=new B)}function m(e){return"string"==typeof e&&e==e.toLowerCase()}function h(e,a,b){return e.getSearchCursor(a,b,{caseFold:m(a),multiline:!0})}function q(e,a,b,c,d){e.openDialog(a,c,{value:b,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){f(e)},
+onKeyDown:d,bottom:e.options.search.bottom})}function k(e,a,b,c,d){e.openDialog?e.openDialog(a,d,{value:c,selectValueOnOpen:!0,bottom:e.options.search.bottom}):d(prompt(b,c))}function r(e,a,b,c){e.openConfirm?e.openConfirm(a,c):confirm(b)&&c[0]()}function y(e){return e.replace(/\\([nrt\\])/g,function(e,a){return"n"==a?"\n":"r"==a?"\r":"t"==a?"\t":"\\"==a?"\\":e})}function z(e){var a=e.match(/^\/(.*)\/([a-z]*)$/);if(a)try{e=new RegExp(a[1],-1==a[2].indexOf("i")?"":"i")}catch(b){}else e=y(e);return("string"==
+typeof e?""==e:e.test(""))&&(e=/x^/),e}function n(e,a,b){a.queryText=b;a.query=z(b);e.removeOverlay(a.overlay,m(a.query));a.overlay=A(a.query,m(a.query));e.addOverlay(a.overlay);e.showMatchesOnScrollbar&&(a.annotate&&(a.annotate.clear(),a.annotate=null),a.annotate=e.showMatchesOnScrollbar(a.query,m(a.query)))}function w(e,c,d,f){var g=p(e);if(g.query)return l(e,c);var h=e.getSelection()||g.lastQuery;if(h instanceof RegExp&&"x^"==h.source&&(h=null),d&&e.openDialog){var m=null,r=function(a,c){b.e_stop(c);
+a&&(a!=g.queryText&&(n(e,g,a),g.posFrom=g.posTo=e.getCursor()),m&&(m.style.opacity=1),l(e,c.shiftKey,function(a,b){var c;3>b.line&&document.querySelector&&(c=e.display.wrapper.querySelector(".CodeMirror-dialog"))&&c.getBoundingClientRect().bottom-4>e.cursorCoords(b,"window").top&&((m=c).style.opacity=.4)}))};q(e,a(e),h,r,function(a,c){var d=b.keyName(a),g=e.getOption("extraKeys"),d=g&&g[d]||b.keyMap[e.getOption("keyMap")][d];"findNext"==d||"findPrev"==d||"findPersistentNext"==d||"findPersistentPrev"==
+d?(b.e_stop(a),n(e,p(e),c),e.execCommand(d)):"find"!=d&&"findPersistent"!=d||(b.e_stop(a),r(c,a))});f&&h&&(n(e,g,h),l(e,c))}else k(e,a(e),"Search for:",h,function(a){a&&!g.query&&e.operation(function(){n(e,g,a);g.posFrom=g.posTo=e.getCursor();l(e,c)})})}function l(a,c,d){a.operation(function(){var g=p(a),f=h(a,g.query,c?g.posFrom:g.posTo);(f.find(c)||(f=h(a,g.query,c?b.Pos(a.lastLine()):b.Pos(a.firstLine(),0)),f.find(c)))&&(a.setSelection(f.from(),f.to()),a.scrollIntoView({from:f.from(),to:f.to()},
+20),g.posFrom=f.from(),g.posTo=f.to(),d&&d(f.from(),f.to()))})}function f(a){a.operation(function(){var b=p(a);(b.lastQuery=b.query)&&(b.query=b.queryText=null,a.removeOverlay(b.overlay),b.annotate&&(b.annotate.clear(),b.annotate=null))})}function a(a){return'\x3cspan class\x3d"CodeMirror-search-label"\x3e'+a.phrase("Search:")+'\x3c/span\x3e \x3cinput type\x3d"text" style\x3d"width: 10em" class\x3d"CodeMirror-search-field"/\x3e \x3cspan style\x3d"color: #888" class\x3d"CodeMirror-search-hint"\x3e'+
+a.phrase("(Use /re/ syntax for regexp search)")+"\x3c/span\x3e"}function c(a){return'\x3cspan class\x3d"CodeMirror-search-label"\x3e'+a.phrase("Replace?")+"\x3c/span\x3e \x3cbutton\x3e"+a.phrase("Yes")+"\x3c/button\x3e \x3cbutton\x3e"+a.phrase("No")+"\x3c/button\x3e \x3cbutton\x3e"+a.phrase("All")+"\x3c/button\x3e \x3cbutton\x3e"+a.phrase("Stop")+"\x3c/button\x3e "}function g(a,b,c){a.operation(function(){for(var d=h(a,b);d.findNext();)if("string"!=typeof b){var g=a.getRange(d.from(),d.to()).match(b);
+d.replace(c.replace(/\$(\d)/g,function(a,b){return g[b]}))}else d.replace(c)})}function d(a,b){if(!a.getOption("readOnly")){var d=a.getSelection()||p(a).lastQuery,l='\x3cspan class\x3d"CodeMirror-search-label"\x3e'+(b?a.phrase("Replace all:"):a.phrase("Replace:"))+"\x3c/span\x3e";k(a,l+(' \x3cinput type\x3d"text" style\x3d"width: 10em" class\x3d"CodeMirror-search-field"/\x3e \x3cspan style\x3d"color: #888" class\x3d"CodeMirror-search-hint"\x3e'+a.phrase("(Use /re/ syntax for regexp search)")+"\x3c/span\x3e"),
+l,d,function(d){d&&(d=z(d),k(a,'\x3cspan class\x3d"CodeMirror-search-label"\x3e'+a.phrase("With:")+'\x3c/span\x3e \x3cinput type\x3d"text" style\x3d"width: 10em" class\x3d"CodeMirror-search-field"/\x3e',a.phrase("Replace with:"),"",function(k){if(k=y(k),b)g(a,d,k);else{f(a);var l=h(a,d,a.getCursor("from")),m=function(){var b,f=l.from();!(b=l.findNext())&&(l=h(a,d),!(b=l.findNext())||f&&l.from().line==f.line&&l.from().ch==f.ch)||(a.setSelection(l.from(),l.to()),a.scrollIntoView({from:l.from(),to:l.to()}),
+r(a,c(a),a.phrase("Replace?"),[function(){n(b)},m,function(){g(a,d,k)}]))},n=function(a){l.replace("string"==typeof d?k:k.replace(/\$(\d)/g,function(b,c){return a[c]}));m()};m()}}))})}}b.defineOption("search",{bottom:!1});b.commands.find=function(a){f(a);w(a)};b.commands.findPersistent=function(a){f(a);w(a,!1,!0)};b.commands.findPersistentNext=function(a){w(a,!1,!0,!0)};b.commands.findPersistentPrev=function(a){w(a,!0,!0,!0)};b.commands.findNext=w;b.commands.findPrev=function(a){w(a,!0)};b.commands.clearSearch=
+f;b.commands.replace=d;b.commands.replaceAll=function(a){d(a,!0)}});(function(b){"function"==typeof b.define&&b.define("addonSearch",["addon/search/search.js"],function(){})})(this);
\ No newline at end of file
diff --git a/assets/packages/ckeditor/plugins/codemirror/js/codemirror.min.js b/assets/packages/ckeditor/plugins/codemirror/js/codemirror.min.js
index e22f3851fb8..cac6c1bef0b 100644
--- a/assets/packages/ckeditor/plugins/codemirror/js/codemirror.min.js
+++ b/assets/packages/ckeditor/plugins/codemirror/js/codemirror.min.js
@@ -1,6 +1,328 @@
-!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("codemirror.js",t):e.CodeMirror=t()}(this,function(){"use strict";function e(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function t(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function r(e,r){return t(e).appendChild(r)}function n(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o=t)return l+(t-o);l+=s-o,l+=r-l%r,o=s+1}}function f(e,t){for(var r=0;r=t)return n+Math.min(l,t-i);if(i+=o-n,i+=r-i%r,n=o+1,i>=t)return n}}function p(e){for(;Bl.length<=e;)Bl.push(g(Bl)+" ");return Bl[e]}function g(e){return e[e.length-1]}function v(e,t){for(var r=[],n=0;n""&&(e.toUpperCase()!=e.toLowerCase()||Gl.test(e))}function x(e,t){return t?!!(t.source.indexOf("\\w")>-1&&w(e))||t.test(e):w(e)}function C(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function S(e){return e.charCodeAt(0)>=768&&Ul.test(e)}function L(e,t,r){for(;(r<0?t>0:t=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(t=e.first&&tr?E(r,T(e,r).text.length):V(t,T(e,t.line).text.length)}function V(e,t){var r=e.ch;return null==r||r>t?E(e.line,t):r<0?E(e.line,0):e}function K(e,t){for(var r=[],n=0;n=t:o.to>t);(n||(n=[])).push(new Y(l,o.from,a?null:o.to))}}return n}function Q(e,t,r){var n;if(e)for(var i=0;i=t:o.to>t);if(s||o.from==t&&"bookmark"==l.type&&(!r||o.marker.insertLeft)){var a=null==o.from||(l.inclusiveLeft?o.from<=t:o.from0&&s)for(var x=0;x0)){var c=[a,1],h=P(u.from,s.from),d=P(u.to,s.to);(h<0||!l.inclusiveLeft&&!h)&&c.push({from:u.from,to:s.from}),(d>0||!l.inclusiveRight&&!d)&&c.push({from:s.to,to:u.to}),i.splice.apply(i,c),a+=c.length-3}}return i}function re(e){var t=e.markedSpans;if(t){for(var r=0;r=0&&h<=0||c<=0&&h>=0)&&(c<=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?P(u.to,r)>=0:P(u.to,r)>0)||c>=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?P(u.from,n)<=0:P(u.from,n)<0)))return!0}}}function he(e){for(var t;t=ae(e);)e=t.find(-1,!0).line;return e}function fe(e){for(var t;t=ue(e);)e=t.find(1,!0).line;return e}function de(e){for(var t,r;t=ue(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function pe(e,t){var r=T(e,t),n=he(r);return r==n?t:W(n)}function ge(e,t){if(t>e.lastLine())return t;var r,n=T(e,t);if(!ve(e,n))return t;for(;r=ue(n);)n=r.find(1,!0).line;return W(n)+1}function ve(e,t){var r=Kl&&t.markedSpans;if(r)for(var n=void 0,i=0;it.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}function xe(e,t,r,n){if(!e)return n(t,r,"ltr");for(var i=!1,o=0;ot||t==r&&l.to==t)&&(n(Math.max(l.from,t),Math.min(l.to,r),1==l.level?"rtl":"ltr"),i=!0)}i||n(t,r,"ltr")}function Ce(e,t,r){var n;jl=null;for(var i=0;it)return i;o.to==t&&(o.from!=o.to&&"before"==r?n=i:jl=i),o.from==t&&(o.from!=o.to&&"before"!=r?n=i:jl=i)}return null!=n?n:jl}function Se(e,t){var r=e.order;return null==r&&(r=e.order=Xl(e.text,t)),r}function Le(e,t,r){var n=L(e.text,t+r,r);return n<0||n>e.text.length?null:n}function ke(e,t,r){var n=Le(e,t.ch,r);return null==n?null:new E(t.line,n,r<0?"after":"before")}function Me(e,t,r,n,i){if(e){var o=Se(r,t.doc.direction);if(o){var l,s=i<0?g(o):o[0],a=i<0==(1==s.level),u=a?"after":"before";if(s.level>0){var c=Zt(t,r);l=i<0?r.text.length-1:0;var h=Qt(t,c,l).top;l=k(function(e){return Qt(t,c,e).top==h},i<0==(1==s.level)?s.from:s.to-1,l),"before"==u&&(l=Le(r,l,1))}else l=i<0?s.to:s.from;return new E(n,l,u)}}return new E(n,i<0?r.text.length:0,i<0?"before":"after")}function Te(e,t,r,n){var i=Se(t,e.doc.direction);if(!i)return ke(t,r,n);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var o=Ce(i,r.ch,r.sticky),l=i[o];if("ltr"==e.doc.direction&&l.level%2==0&&(n>0?l.to>r.ch:l.from=l.from&&f>=c.begin)){var d=h?"before":"after";return new E(r.line,f,d)}}var p=function(e,t,n){for(var o=function(e,t){return t?new E(r.line,a(e,1),"before"):new E(r.line,e,"after")};e>=0&&e