1 line
No EOL
40 KiB
JavaScript
1 line
No EOL
40 KiB
JavaScript
(function(){function n(n,t){for(var i=0;i<t.length;i+=1)if(t[i]===n)return!0;return!1}function f(n){return n.replace(/^\s+|\s+$/g,"")}function e(n){return n.replace(/^\s+/g,"")}function r(n,t){"use strict";var i=new o(n,t);return i.beautify()}function o(r,u){"use strict";function wt(n,t){var i=0;return n&&(i=n.indentation_level,!v.just_added_newline()&&n.line_indent_level>i&&(i=n.line_indent_level)),{mode:t,parent:n,last_text:n?n.last_text:"",last_word:n?n.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:i,line_indent_level:n?n.line_indent_level:i,start_line_index:v.get_line_number(),ternary_depth:0}}function bt(n){var i=n.newlines,r=a.keep_array_indentation&&nt(o.mode),t;if(r)for(t=0;t<i;t+=1)y(t>0);else if(a.max_preserve_newlines&&i>a.max_preserve_newlines&&(i=a.max_preserve_newlines),a.preserve_newlines&&n.newlines>1)for(y(),t=1;t<i;t+=1)y(!0);s=n;yt[s.type]()}function gt(n){n=n.replace(/\x0d/g,"");for(var i=[],t=n.indexOf("\n");t!==-1;)i.push(n.substring(0,t)),n=n.substring(t+1),t=n.indexOf("\n");return n.length&&i.push(n),i}function d(n){if(n=n===undefined?!1:n,!v.just_added_newline())if(a.preserve_newlines&&s.wanted_newline||n)y(!1,!0);else if(a.wrap_line_length){var t=v.current_line.get_character_count()+s.text.length+(v.space_before_token?1:0);t>=a.wrap_line_length&&y(!1,!0)}}function y(n,i){if(!i&&o.last_text!==";"&&o.last_text!==","&&o.last_text!=="="&&l!=="TK_OPERATOR")while(o.mode===t.Statement&&!o.if_block&&!o.do_block)g();v.add_new_line(n)&&(o.multiline_frame=!0)}function kt(){v.just_added_newline()&&(a.keep_array_indentation&&nt(o.mode)&&s.wanted_newline?(v.current_line.push(s.whitespace_before),v.space_before_token=!1):v.set_indent(o.indentation_level)&&(o.line_indent_level=o.indentation_level))}function p(n){if(v.raw){v.add_raw_token(s);return}a.comma_first&&l==="TK_COMMA"&&v.just_added_newline()&&v.previous_line.last()===","&&(v.previous_line.pop(),kt(),v.add_token(","),v.space_before_token=!0);n=n||s.text;kt();v.add_token(n)}function ft(){o.indentation_level+=1}function ni(){o.indentation_level>0&&(!o.parent||o.indentation_level>o.parent.indentation_level)&&(o.indentation_level-=1)}function it(n){o?(st.push(o),b=o):b=wt(null,n);o=wt(b,n)}function nt(n){return n===t.ArrayLiteral}function et(i){return n(i,[t.Expression,t.ForInitializer,t.Conditional])}function g(){st.length>0&&(b=o,o=st.pop(),b.mode===t.Statement&&v.remove_redundant_indentation(b))}function ht(){return o.parent.mode===t.ObjectLiteral&&o.mode===t.Statement&&(o.last_text===":"&&o.ternary_depth===0||l==="TK_RESERVED"&&n(o.last_text,["get","set"]))}function rt(){return l==="TK_RESERVED"&&n(o.last_text,["var","let","const"])&&s.type==="TK_WORD"||l==="TK_RESERVED"&&o.last_text==="do"||l==="TK_RESERVED"&&o.last_text==="return"&&!s.wanted_newline||l==="TK_RESERVED"&&o.last_text==="else"&&!(s.type==="TK_RESERVED"&&s.text==="if")||l==="TK_END_EXPR"&&(b.mode===t.ForInitializer||b.mode===t.Conditional)||l==="TK_WORD"&&o.mode===t.BlockStatement&&!o.in_case&&!(s.text==="--"||s.text==="++")&&k!=="function"&&s.type!=="TK_WORD"&&s.type!=="TK_RESERVED"||o.mode===t.ObjectLiteral&&(o.last_text===":"&&o.ternary_depth===0||l==="TK_RESERVED"&&n(o.last_text,["get","set"]))?(it(t.Statement),ft(),l==="TK_RESERVED"&&n(o.last_text,["var","let","const"])&&s.type==="TK_WORD"&&(o.declaration_statement=!0),ht()||d(s.type==="TK_RESERVED"&&n(s.text,["do","for","if","while"])),!0):!1}function ti(n,t){for(var r,i=0;i<n.length;i++)if(r=f(n[i]),r.charAt(0)!==t)return!1;return!0}function ii(n,t){for(var i=0,u=n.length,r;i<u;i++)if(r=n[i],r&&r.indexOf(t)!==0)return!1;return!0}function ct(t){return n(t,["case","return","do","if","throw","else"])}function lt(n){var t=vt+(n||0);return t<0||t>=at.length?null:at[t]}function ri(){rt();var i=t.Expression;if(s.text==="["){if(l==="TK_WORD"||o.last_text===")"){l==="TK_RESERVED"&&n(o.last_text,tt.line_starters)&&(v.space_before_token=!0);it(i);p();ft();a.space_in_paren&&(v.space_before_token=!0);return}i=t.ArrayLiteral;nt(o.mode)&&(o.last_text==="["||o.last_text===","&&(k==="]"||k==="}"))&&(a.keep_array_indentation||y())}else l==="TK_RESERVED"&&o.last_text==="for"?i=t.ForInitializer:l==="TK_RESERVED"&&n(o.last_text,["if","while"])&&(i=t.Conditional);o.last_text===";"||l==="TK_START_BLOCK"?y():l==="TK_END_EXPR"||l==="TK_START_EXPR"||l==="TK_END_BLOCK"||o.last_text==="."?d(s.wanted_newline):l==="TK_RESERVED"&&s.text==="("||l==="TK_WORD"||l==="TK_OPERATOR"?l==="TK_RESERVED"&&(o.last_word==="function"||o.last_word==="typeof")||o.last_text==="*"&&k==="function"?a.space_after_anon_function&&(v.space_before_token=!0):l==="TK_RESERVED"&&(n(o.last_text,tt.line_starters)||o.last_text==="catch")&&a.space_before_conditional&&(v.space_before_token=!0):v.space_before_token=!0;s.text==="("&&l==="TK_RESERVED"&&o.last_word==="await"&&(v.space_before_token=!0);s.text==="("&&(l==="TK_EQUALS"||l==="TK_OPERATOR")&&(ht()||d());it(i);p();a.space_in_paren&&(v.space_before_token=!0);ft()}function ui(){while(o.mode===t.Statement)g();o.multiline_frame&&d(s.text==="]"&&nt(o.mode)&&!a.keep_array_indentation);a.space_in_paren&&(l!=="TK_START_EXPR"||a.space_in_empty_paren?v.space_before_token=!0:(v.trim(),v.space_before_token=!1));s.text==="]"&&a.keep_array_indentation?(p(),g()):(g(),p());v.remove_redundant_indentation(b);o.do_while&&b.mode===t.Conditional&&(b.mode=t.Expression,o.do_block=!1,o.do_while=!1)}function fi(){var i=lt(1),r=lt(2),u,f;r&&(r.text===":"&&n(i.type,["TK_STRING","TK_WORD","TK_RESERVED"])||n(i.text,["get","set"])&&n(r.type,["TK_WORD","TK_RESERVED"]))?n(k,["class","interface"])?it(t.BlockStatement):it(t.ObjectLiteral):it(t.BlockStatement);u=!i.comments_before.length&&i.text==="}";f=u&&o.last_word==="function"&&l==="TK_END_EXPR";a.brace_style==="expand"||a.brace_style==="none"&&s.wanted_newline?l!=="TK_OPERATOR"&&(f||l==="TK_EQUALS"||l==="TK_RESERVED"&&ct(o.last_text)&&o.last_text!=="else")?v.space_before_token=!0:y(!1,!0):l!=="TK_OPERATOR"&&l!=="TK_START_EXPR"?l==="TK_START_BLOCK"?y():v.space_before_token=!0:nt(b.mode)&&o.last_text===","&&(k==="}"?v.space_before_token=!0:y());p();ft()}function ei(){while(o.mode===t.Statement)g();var n=l==="TK_START_BLOCK";a.brace_style==="expand"?n||y():n||(nt(o.mode)&&a.keep_array_indentation?(a.keep_array_indentation=!1,y(),a.keep_array_indentation=!0):y());g();p()}function dt(){var i,r;if(s.type==="TK_RESERVED"&&o.mode!==t.ObjectLiteral&&n(s.text,["set","get"])&&(s.type="TK_WORD"),s.type==="TK_RESERVED"&&o.mode===t.ObjectLiteral&&(i=lt(1),i.text==":"&&(s.type="TK_WORD")),rt()||!s.wanted_newline||et(o.mode)||l==="TK_OPERATOR"&&o.last_text!=="--"&&o.last_text!=="++"||l==="TK_EQUALS"||!a.preserve_newlines&&l==="TK_RESERVED"&&n(o.last_text,["var","let","const","set","get"])||y(),o.do_block&&!o.do_while){if(s.type==="TK_RESERVED"&&s.text==="while"){v.space_before_token=!0;p();v.space_before_token=!0;o.do_while=!0;return}y();o.do_block=!1}if(o.if_block)if(o.else_block||s.type!=="TK_RESERVED"||s.text!=="else"){while(o.mode===t.Statement)g();o.if_block=!1;o.else_block=!1}else o.else_block=!0;if(s.type==="TK_RESERVED"&&(s.text==="case"||s.text==="default"&&o.in_case_statement)){y();(o.case_body||a.jslint_happy)&&(ni(),o.case_body=!1);p();o.in_case=!0;o.in_case_statement=!0;return}if(s.type==="TK_RESERVED"&&s.text==="function"&&((n(o.last_text,["}",";"])||v.just_added_newline()&&!n(o.last_text,["[","{",":","=",","]))&&(v.just_added_blankline()||s.comments_before.length||(y(),y(!0))),l==="TK_RESERVED"||l==="TK_WORD"?l==="TK_RESERVED"&&n(o.last_text,["get","set","new","return","export","async"])?v.space_before_token=!0:l==="TK_RESERVED"&&o.last_text==="default"&&k==="export"?v.space_before_token=!0:y():l==="TK_OPERATOR"||o.last_text==="="?v.space_before_token=!0:!o.multiline_frame&&(et(o.mode)||nt(o.mode))||y()),(l==="TK_COMMA"||l==="TK_START_EXPR"||l==="TK_EQUALS"||l==="TK_OPERATOR")&&(ht()||d()),s.type==="TK_RESERVED"&&n(s.text,["function","get","set"])){p();o.last_word=s.text;return}w="NONE";l==="TK_END_BLOCK"?s.type==="TK_RESERVED"&&n(s.text,["else","catch","finally"])?a.brace_style==="expand"||a.brace_style==="end-expand"||a.brace_style==="none"&&s.wanted_newline?w="NEWLINE":(w="SPACE",v.space_before_token=!0):w="NEWLINE":l==="TK_SEMICOLON"&&o.mode===t.BlockStatement?w="NEWLINE":l==="TK_SEMICOLON"&&et(o.mode)?w="SPACE":l==="TK_STRING"?w="NEWLINE":l==="TK_RESERVED"||l==="TK_WORD"||o.last_text==="*"&&k==="function"?w="SPACE":l==="TK_START_BLOCK"?w="NEWLINE":l==="TK_END_EXPR"&&(v.space_before_token=!0,w="NEWLINE");s.type==="TK_RESERVED"&&n(s.text,tt.line_starters)&&o.last_text!==")"&&(w=o.last_text==="else"||o.last_text==="export"?"SPACE":"NEWLINE");s.type==="TK_RESERVED"&&n(s.text,["else","catch","finally"])?l!=="TK_END_BLOCK"||a.brace_style==="expand"||a.brace_style==="end-expand"||a.brace_style==="none"&&s.wanted_newline?y():(v.trim(!0),r=v.current_line,r.last()!=="}"&&y(),v.space_before_token=!0):w==="NEWLINE"?l==="TK_RESERVED"&&ct(o.last_text)?v.space_before_token=!0:l!=="TK_END_EXPR"?l==="TK_START_EXPR"&&s.type==="TK_RESERVED"&&n(s.text,["var","let","const"])||o.last_text===":"||(s.type==="TK_RESERVED"&&s.text==="if"&&o.last_text==="else"?v.space_before_token=!0:y()):s.type==="TK_RESERVED"&&n(s.text,tt.line_starters)&&o.last_text!==")"&&y():o.multiline_frame&&nt(o.mode)&&o.last_text===","&&k==="}"?y():w==="SPACE"&&(v.space_before_token=!0);p();o.last_word=s.text;s.type==="TK_RESERVED"&&s.text==="do"&&(o.do_block=!0);s.type==="TK_RESERVED"&&s.text==="if"&&(o.if_block=!0)}function oi(){for(rt()&&(v.space_before_token=!1);o.mode===t.Statement&&!o.if_block&&!o.do_block;)g();p()}function si(){rt()?v.space_before_token=!0:l==="TK_RESERVED"||l==="TK_WORD"?v.space_before_token=!0:l==="TK_COMMA"||l==="TK_START_EXPR"||l==="TK_EQUALS"||l==="TK_OPERATOR"?ht()||d():y();p()}function hi(){rt();o.declaration_statement&&(o.declaration_assignment=!0);v.space_before_token=!0;p();v.space_before_token=!0}function ci(){if(o.declaration_statement){et(o.parent.mode)&&(o.declaration_assignment=!1);p();o.declaration_assignment?(o.declaration_assignment=!1,y(!1,!0)):(v.space_before_token=!0,a.comma_first&&d());return}p();o.mode===t.ObjectLiteral||o.mode===t.Statement&&o.parent.mode===t.ObjectLiteral?(o.mode===t.Statement&&g(),y()):(v.space_before_token=!0,a.comma_first&&d())}function li(){if(rt(),l==="TK_RESERVED"&&ct(o.last_text)){v.space_before_token=!0;p();return}if(s.text==="*"&&l==="TK_DOT"){p();return}if(s.text===":"&&o.in_case){o.case_body=!0;ft();p();y();o.in_case=!1;return}if(s.text==="::"){p();return}l==="TK_OPERATOR"&&d();var i=!0,r=!0;n(s.text,["--","++","!","~"])||n(s.text,["-","+"])&&(n(l,["TK_START_BLOCK","TK_START_EXPR","TK_EQUALS","TK_OPERATOR"])||n(o.last_text,tt.line_starters)||o.last_text===",")?(i=!1,r=!1,s.wanted_newline&&(s.text==="--"||s.text==="++")&&y(!1,!0),o.last_text===";"&&et(o.mode)&&(i=!0),l==="TK_RESERVED"?i=!0:l==="TK_END_EXPR"?i=!(o.last_text==="]"&&(s.text==="--"||s.text==="++")):l==="TK_OPERATOR"&&(i=n(s.text,["--","-","++","+"])&&n(o.last_text,["--","-","++","+"]),n(s.text,["+","-"])&&n(o.last_text,["--","++"])&&(r=!0)),(o.mode===t.BlockStatement||o.mode===t.Statement)&&(o.last_text==="{"||o.last_text===";")&&y()):s.text===":"?o.ternary_depth===0?i=!1:o.ternary_depth-=1:s.text==="?"?o.ternary_depth+=1:s.text==="*"&&l==="TK_RESERVED"&&o.last_text==="function"&&(i=!1,r=!1);v.space_before_token=v.space_before_token||i;p();v.space_before_token=r}function ai(){if(v.raw){v.add_raw_token(s);s.directives&&s.directives.preserve==="end"&&(a.test_output_raw||(v.raw=!1));return}if(s.directives){y(!1,!0);p();s.directives.preserve==="start"&&(v.raw=!0);y(!1,!0);return}if(!i.newline.test(s.text)&&!s.wanted_newline){v.space_before_token=!0;p();v.space_before_token=!0;return}var n=gt(s.text),t,r=!1,u=!1,f=s.whitespace_before,o=f.length;for(y(!1,!0),n.length>1&&(ti(n.slice(1),"*")?r=!0:ii(n.slice(1),f)&&(u=!0)),p(n[0]),t=1;t<n.length;t++)y(!1,!0),r?p(" "+e(n[t])):u&&n[t].length>o?p(n[t].substring(o)):v.add_token(n[t]);y(!1,!0)}function vi(){s.wanted_newline?y(!1,!0):v.trim(!0);v.space_before_token=!0;p();y(!1,!0)}function yi(){rt();l==="TK_RESERVED"&&ct(o.last_text)?v.space_before_token=!0:d(o.last_text===")"&&a.break_chained_methods);p()}function pi(){p();s.text[s.text.length-1]==="\n"&&y()}function wi(){while(o.mode===t.Statement)g()}var v,at=[],vt,tt,s,l,k,ot,o,b,st,w,yt,a,pt="",ut;for(yt={TK_START_EXPR:ri,TK_END_EXPR:ui,TK_START_BLOCK:fi,TK_END_BLOCK:ei,TK_WORD:dt,TK_RESERVED:dt,TK_SEMICOLON:oi,TK_STRING:si,TK_EQUALS:hi,TK_OPERATOR:li,TK_COMMA:ci,TK_BLOCK_COMMENT:ai,TK_COMMENT:vi,TK_DOT:yi,TK_UNKNOWN:pi,TK_EOF:wi},u=u?u:{},a={},u.braces_on_own_line!==undefined&&(a.brace_style=u.braces_on_own_line?"expand":"collapse"),a.brace_style=u.brace_style?u.brace_style:a.brace_style?a.brace_style:"collapse",a.brace_style==="expand-strict"&&(a.brace_style="expand"),a.indent_size=u.indent_size?parseInt(u.indent_size,10):4,a.indent_char=u.indent_char?u.indent_char:" ",a.eol=u.eol?u.eol:"\n",a.preserve_newlines=u.preserve_newlines===undefined?!0:u.preserve_newlines,a.break_chained_methods=u.break_chained_methods===undefined?!1:u.break_chained_methods,a.max_preserve_newlines=u.max_preserve_newlines===undefined?0:parseInt(u.max_preserve_newlines,10),a.space_in_paren=u.space_in_paren===undefined?!1:u.space_in_paren,a.space_in_empty_paren=u.space_in_empty_paren===undefined?!1:u.space_in_empty_paren,a.jslint_happy=u.jslint_happy===undefined?!1:u.jslint_happy,a.space_after_anon_function=u.space_after_anon_function===undefined?!1:u.space_after_anon_function,a.keep_array_indentation=u.keep_array_indentation===undefined?!1:u.keep_array_indentation,a.space_before_conditional=u.space_before_conditional===undefined?!0:u.space_before_conditional,a.unescape_strings=u.unescape_strings===undefined?!1:u.unescape_strings,a.wrap_line_length=u.wrap_line_length===undefined?0:parseInt(u.wrap_line_length,10),a.e4x=u.e4x===undefined?!1:u.e4x,a.end_with_newline=u.end_with_newline===undefined?!1:u.end_with_newline,a.comma_first=u.comma_first===undefined?!1:u.comma_first,a.test_output_raw=u.test_output_raw===undefined?!1:u.test_output_raw,a.jslint_happy&&(a.space_after_anon_function=!0),u.indent_with_tabs&&(a.indent_char="\t",a.indent_size=1),a.eol=a.eol.replace(/\\r/,"\r").replace(/\\n/,"\n"),ot="";a.indent_size>0;)ot+=a.indent_char,a.indent_size-=1;if(ut=0,r&&r.length){while(r.charAt(ut)===" "||r.charAt(ut)==="\t")pt+=r.charAt(ut),ut+=1;r=r.substring(ut)}l="TK_START_BLOCK";k="";v=new h(ot,pt);v.raw=a.test_output_raw;st=[];it(t.BlockStatement);this.beautify=function(){var n,t,i;for(tt=new c(r,a,ot),at=tt.tokenize(),vt=0;n=lt();){for(i=0;i<n.comments_before.length;i++)bt(n.comments_before[i]);bt(n);k=o.last_text;l=n.type;o.last_text=n.text;vt+=1}return t=v.get_code(),a.end_with_newline&&(t+="\n"),a.eol!="\n"&&(t=t.replace(/[\n]/g,a.eol)),t}}function s(n){var i=0,r=-1,t=[],u=!0;this.set_indent=function(t){i=n.baseIndentLength+t*n.indent_length;r=t};this.get_character_count=function(){return i};this.is_empty=function(){return u};this.last=function(){return this._empty?null:t[t.length-1]};this.push=function(n){t.push(n);i+=n.length;u=!1};this.pop=function(){var n=null;return u||(n=t.pop(),i-=n.length,u=t.length===0),n};this.remove_indent=function(){r>0&&(r-=1,i-=n.indent_length)};this.trim=function(){while(this.last()===" "){var n=t.pop();i-=1}u=t.length===0};this.toString=function(){var i="";return this._empty||(r>=0&&(i=n.indent_cache[r]),i+=t.join("")),i}}function h(n,i){i=i||"";this.indent_cache=[i];this.baseIndentLength=i.length;this.indent_length=n.length;this.raw=!1;var r=[];this.baseIndentString=i;this.indent_string=n;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);r.push(this.current_line)};this.add_outputline();this.get_line_number=function(){return r.length};this.add_new_line=function(n){return this.get_line_number()===1&&this.just_added_newline()?!1:n||!this.just_added_newline()?(this.raw||this.add_outputline(),!0):!1};this.get_code=function(){return r.join("\n").replace(/[\r\n\t ]+$/,"")};this.set_indent=function(n){if(r.length>1){while(n>=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(n),!0}return this.current_line.set_indent(0),!1};this.add_raw_token=function(n){for(var t=0;t<n.newlines;t++)this.add_outputline();this.current_line.push(n.whitespace_before);this.current_line.push(n.text);this.space_before_token=!1};this.add_token=function(n){this.add_space_before_token();this.current_line.push(n)};this.add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&this.current_line.push(" ");this.space_before_token=!1};this.remove_redundant_indentation=function(n){if(!n.multiline_frame&&n.mode!==t.ForInitializer&&n.mode!==t.Conditional)for(var i=n.start_line_index,u=r.length;i<u;)r[i].remove_indent(),i++};this.trim=function(t){for(t=t===undefined?!1:t,this.current_line.trim(n,i);t&&r.length>1&&this.current_line.is_empty();)r.pop(),this.current_line=r[r.length-1],this.current_line.trim();this.previous_line=r.length>1?r[r.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(r.length===1)return!0;var n=r[r.length-2];return n.is_empty()}return!1}}function c(t,r){function rt(n){var i,t;if(!n.match(it))return null;for(i={},v.lastIndex=0,t=v.exec(n);t;)i[t[1]]=t[2],t=v.exec(n);return i}function d(){var d,at=[],it,v,et,yt,ot,pt,ii,wt,kt,lt,dt;if(h=0,c="",e>=o)return["","TK_EOF"];for(it=s.length?s[s.length-1]:new u("TK_START_BLOCK","{"),v=t.charAt(e),e+=1;n(v,g);){if(i.newline.test(v)?v==="\n"&&t.charAt(e-2)==="\r"||(h+=1,at=[]):at.push(v),e>=o)return["","TK_EOF"];v=t.charAt(e);e+=1}if(at.length&&(c=at.join("")),a.test(v)){var vt=!0,bt=!0,gt=a;for(v==="0"&&e<o&&/[Xx]/.test(t.charAt(e))?(vt=!1,bt=!1,v+=t.charAt(e),e+=1,gt=nt):(v="",e-=1);e<o&>.test(t.charAt(e));)v+=t.charAt(e),e+=1,vt&&e<o&&t.charAt(e)==="."&&(v+=t.charAt(e),e+=1,vt=!1),bt&&e<o&&/[Ee]/.test(t.charAt(e))&&(v+=t.charAt(e),e+=1,e<o&&/[+-]/.test(t.charAt(e))&&(v+=t.charAt(e),e+=1),bt=!1,vt=!1);return[v,"TK_WORD"]}if(i.isIdentifierStart(t.charCodeAt(e-1))){if(e<o)while(i.isIdentifierChar(t.charCodeAt(e)))if(v+=t.charAt(e),e+=1,e===o)break;return!(it.type==="TK_DOT"||it.type==="TK_RESERVED"&&n(it.text,["set","get"]))&&n(v,tt)?v==="in"?[v,"TK_OPERATOR"]:[v,"TK_RESERVED"]:[v,"TK_WORD"]}if(v==="("||v==="[")return[v,"TK_START_EXPR"];if(v===")"||v==="]")return[v,"TK_END_EXPR"];if(v==="{")return[v,"TK_START_BLOCK"];if(v==="}")return[v,"TK_END_BLOCK"];if(v===";")return[v,"TK_SEMICOLON"];if(v==="/"){if(et="",t.charAt(e)==="*")return e+=1,p.lastIndex=e,ot=p.exec(t),et="/*"+ot[0],e+=ot[0].length,yt=rt(et),yt&&yt.ignore==="start"&&(b.lastIndex=e,ot=b.exec(t),et+=ot[0],e+=ot[0].length),et=et.replace(i.lineBreak,"\n"),[et,"TK_BLOCK_COMMENT",yt];if(t.charAt(e)==="/")return e+=1,w.lastIndex=e,ot=w.exec(t),et="//"+ot[0],e+=ot[0].length,[et,"TK_COMMENT"]}if(v==="`"||v==="'"||v==='"'||(v==="/"||r.e4x&&v==="<"&&t.slice(e-1).match(/^<([-a-zA-Z:0-9_.]+|{[^{}]*}|!\[CDATA\[[\s\S]*?\]\])(\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{.*?}))*\s*(\/?)\s*>/))&&(it.type==="TK_RESERVED"&&n(it.text,["return","case","throw","else","do","typeof","yield"])||it.type==="TK_END_EXPR"&&it.text===")"&&it.parent&&it.parent.type==="TK_RESERVED"&&n(it.parent.text,["if","while","for"])||n(it.type,["TK_COMMENT","TK_START_EXPR","TK_START_BLOCK","TK_END_BLOCK","TK_OPERATOR","TK_EQUALS","TK_EOF","TK_SEMICOLON","TK_COMMA"]))){var st=v,ht=!1,ni=!1;if(d=v,st==="/")for(pt=!1;e<o&&(ht||pt||t.charAt(e)!==st)&&!i.newline.test(t.charAt(e));)d+=t.charAt(e),ht?ht=!1:(ht=t.charAt(e)==="\\",t.charAt(e)==="["?pt=!0:t.charAt(e)==="]"&&(pt=!1)),e+=1;else if(r.e4x&&st==="<"){var ti=/<(\/?)([-a-zA-Z:0-9_.]+|{[^{}]*}|!\[CDATA\[[\s\S]*?\]\])(\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{.*?}))*\s*(\/?)\s*>/g,ct=t.slice(e-1),ft=ti.exec(ct);if(ft&&ft.index===0){for(ii=ft[2],wt=0;ft;){var ui=!!ft[1],ri=ft[2],fi=!!ft[ft.length-1]||ri.slice(0,8)==="![CDATA[";if(ri!==ii||fi||(ui?--wt:++wt),wt<=0)break;ft=ti.exec(ct)}return kt=ft?ft.index+ft[0].length:ct.length,ct=ct.slice(0,kt),e+=kt-1,ct=ct.replace(i.lineBreak,"\n"),[ct,"TK_STRING"]}}else while(e<o&&(ht||t.charAt(e)!==st&&(st==="`"||!i.newline.test(t.charAt(e)))))(ht||st==="`")&&i.newline.test(t.charAt(e))?(t.charAt(e)==="\r"&&t.charAt(e+1)==="\n"&&(e+=1),d+="\n"):d+=t.charAt(e),ht?((t.charAt(e)==="x"||t.charAt(e)==="u")&&(ni=!0),ht=!1):ht=t.charAt(e)==="\\",e+=1;if(ni&&r.unescape_strings&&(d=ut(d)),e<o&&t.charAt(e)===st&&(d+=st,e+=1,st==="/"))while(e<o&&i.isIdentifierStart(t.charCodeAt(e)))d+=t.charAt(e),e+=1;return[d,"TK_STRING"]}if(v==="#"){if(s.length===0&&t.charAt(e)==="!"){for(d=v;e<o&&v!=="\n";)v=t.charAt(e),d+=v,e+=1;return[f(d)+"\n","TK_UNKNOWN"]}if(lt="#",e<o&&a.test(t.charAt(e))){do v=t.charAt(e),lt+=v,e+=1;while(e<o&&v!=="#"&&v!=="=");return v==="#"||(t.charAt(e)==="["&&t.charAt(e+1)==="]"?(lt+="[]",e+=2):t.charAt(e)==="{"&&t.charAt(e+1)==="}"&&(lt+="{}",e+=2)),[lt,"TK_WORD"]}}if(v==="<"&&(t.charAt(e)==="?"||t.charAt(e)==="%")&&(k.lastIndex=e-1,dt=k.exec(t),dt))return v=dt[0],e+=v.length-1,v=v.replace(i.lineBreak,"\n"),[v,"TK_STRING"];if(v==="<"&&t.substring(e-1,e+3)==="<!--"){for(e+=3,v="<!--";!i.newline.test(t.charAt(e))&&e<o;)v+=t.charAt(e),e++;return l=!0,[v,"TK_COMMENT"]}if(v==="-"&&l&&t.substring(e-1,e+2)==="-->")return l=!1,e+=2,["-->","TK_COMMENT"];if(v===".")return[v,"TK_DOT"];if(n(v,y)){while(e<o&&n(v+t.charAt(e),y))if(v+=t.charAt(e),e+=1,e>=o)break;return v===","?[v,"TK_COMMA"]:v==="="?[v,"TK_EQUALS"]:[v,"TK_OPERATOR"]}return[v,"TK_UNKNOWN"]}function ut(n){for(var e=!1,u="",r=0,f="",t=0,i;e||r<n.length;)if(i=n.charAt(r),r++,e){if(e=!1,i==="x")f=n.substr(r,2),r+=2;else if(i==="u")f=n.substr(r,4),r+=4;else{u+="\\"+i;continue}if(!f.match(/^[0123456789abcdefABCDEF]+$/))return n;if(t=parseInt(f,16),t>=0&&t<32){u+=i==="x"?"\\x"+f:"\\u"+f;continue}else if(t===34||t===39||t===92)u+="\\"+String.fromCharCode(t);else{if(i==="x"&&t>126&&t<=255)return n;u+=String.fromCharCode(t)}}else i==="\\"?e=!0:u+=i;return u}var g="\n\r\t ".split(""),a=/[0-9]/,nt=/[0123456789abcdefABCDEF]/,y=("+ - * / % & ++ -- = += -= *= /= %= == === != !== > < >= <= >> << >>> >>>= >>= <<= && &= | || ! ~ , : ? ^ ^= |= :: =>"+" <%= <% %> <?= <? ?>").split(" ");this.line_starters="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(",");var tt=this.line_starters.concat(["do","in","else","get","set","new","catch","finally","typeof","yield","async","await"]),p=/([\s\S]*?)((?:\*\/)|$)/g,w=/([^\n\r\u2028\u2029]*)/g,it=/\/\* beautify( \w+[:]\w+)+ \*\//g,v=/ (\w+)[:](\w+)/g,b=/([\s\S]*?)((?:\/\*\sbeautify\signore:end\s\*\/)|$)/g,k=/((<\?php|<\?=)[\s\S]*?\?>)|(<%[\s\S]*?%>)/g,h,c,l,s,e,o;this.tokenize=function(){o=t.length;e=0;l=!1;s=[];for(var n,f,r,i=null,v=[],a=[];!(f&&f.type==="TK_EOF");){for(r=d(),n=new u(r[1],r[0],h,c);n.type==="TK_COMMENT"||n.type==="TK_BLOCK_COMMENT"||n.type==="TK_UNKNOWN";)n.type==="TK_BLOCK_COMMENT"&&(n.directives=r[2]),a.push(n),r=d(),n=new u(r[1],r[0],h,c);a.length&&(n.comments_before=a,a=[]);n.type==="TK_START_BLOCK"||n.type==="TK_START_EXPR"?(n.parent=f,v.push(i),i=n):(n.type==="TK_END_BLOCK"||n.type==="TK_END_EXPR")&&i&&(n.text==="]"&&i.text==="["||n.text===")"&&i.text==="("||n.text==="}"&&i.text==="{")&&(n.parent=i.parent,i=v.pop());s.push(n);f=n}return s}}var i={},t,u;(function(n){var t="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",i=new RegExp("["+t+"]"),r=new RegExp("["+t+"̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ؚؠ-ىٲ-ۓۧ-ۨۻ-ۼܰ-݊ࠀ-ࠔࠛ-ࠣࠥ-ࠧࠩ-࠭ࡀ-ࡗࣤ-ࣾऀ-ःऺ-़ा-ॏ॑-ॗॢ-ॣ०-९ঁ-ঃ়া-ৄেৈৗয়-ৠਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢ-ૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୟ-ୠ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఁ-ఃె-ైొ-్ౕౖౢ-ౣ౦-౯ಂಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢ-ೣ೦-೯ംഃെ-ൈൗൢ-ൣ൦-൯ංඃ්ා-ුූෘ-ෟෲෳิ-ฺเ-ๅ๐-๙ິ-ູ່-ໍ໐-໙༘༙༠-༩༹༵༷ཁ-ཇཱ-྄྆-྇ྍ-ྗྙ-ྼ࿆က-ဩ၀-၉ၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟ᜎ-ᜐᜠ-ᜰᝀ-ᝐᝲᝳក-ឲ៝០-៩᠋-᠍᠐-᠙ᤠ-ᤫᤰ-᤻ᥑ-ᥭᦰ-ᧀᧈ-ᧉ᧐-᧙ᨀ-ᨕᨠ-ᩓ᩠-᩿᩼-᪉᪐-᪙ᭆ-ᭋ᭐-᭙᭫-᭳᮰-᮹᯦-᯳ᰀ-ᰢ᱀-᱉ᱛ-ᱽ᳐-᳒ᴀ-ᶾḁ-ἕ‿⁀⁔⃐-⃥⃜⃡-⃰ⶁ-ⶖⷠ-ⷿ〡-〨゙゚Ꙁ-ꙭꙴ-꙽ꚟ꛰-꛱ꟸ-ꠀ꠆ꠋꠣ-ꠧꢀ-ꢁꢴ-꣄꣐-꣙ꣳ-ꣷ꤀-꤉ꤦ-꤭ꤰ-ꥅꦀ-ꦃ꦳-꧀ꨀ-ꨧꩀ-ꩁꩌ-ꩍ꩐-꩙ꩻꫠ-ꫩꫲ-ꫳꯀ-ꯡ꯬꯭꯰-꯹ﬠ-ﬨ︀-️︠-︦︳︴﹍-﹏0-9_]"),u=n.newline=/[\n\r\u2028\u2029]/,f=n.lineBreak=/\r\n|[\n\r\u2028\u2029]/g,e=n.isIdentifierStart=function(n){return n<65?n===36:n<91?!0:n<97?n===95:n<123?!0:n>=170&&i.test(String.fromCharCode(n))},o=n.isIdentifierChar=function(n){return n<48?n===36:n<58?!0:n<65?!1:n<91?!0:n<97?n===95:n<123?!0:n>=170&&r.test(String.fromCharCode(n))}})(i);t={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};u=function(n,t,i,r){this.type=n;this.text=t;this.comments_before=[];this.newlines=i||0;this.wanted_newline=i>0;this.whitespace_before=r||"";this.parent=null;this.directives=null};typeof define=="function"&&define.amd?define([],function(){return{js_beautify:r}}):typeof exports!="undefined"?exports.js_beautify=r:typeof window!="undefined"?window.js_beautify=r:typeof global!="undefined"&&(global.js_beautify=r)})(),function(){function i(n){return n.replace(/^\s+/g,"")}function t(n){return n.replace(/\s+$/g,"")}function n(n,r,u,f){function lt(){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=tt,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:st,in_array:function(n,t){for(var i=0;i<t.length;i++)if(n===t[i])return!0;return!1}},this.is_whitespace=function(n){for(var t=0;t<n.length;n++)if(!this.Utils.in_array(n.charAt(t),this.Utils.whitespace))return!1;return!0},this.traverse_whitespace=function(){var n="";if(n=this.input.charAt(this.pos),this.Utils.in_array(n,this.Utils.whitespace)){for(this.newlines=0;this.Utils.in_array(n,this.Utils.whitespace);)b&&n==="\n"&&this.newlines<=ut&&(this.newlines+=1),this.pos++,n=this.input.charAt(this.pos);return!0}return!1},this.space_or_wrap=function(n){this.line_char_count>=this.wrap_line_length?(this.print_newline(!1,n),this.print_indentation(n)):(this.line_char_count++,n.push(" "))},this.get_content=function(){for(var i="",n=[],t;this.input.charAt(this.pos)!=="<";){if(this.pos>=this.input.length)return n.length?n.join(""):["","TK_EOF"];if(this.traverse_whitespace()){this.space_or_wrap(n);continue}if(o)if(t=this.input.substr(this.pos,3),t==="{{#"||t==="{{/")break;else{if(t==="{{!")return[this.get_tag(),"TK_TAG_HANDLEBARS_COMMENT"];if(this.input.substr(this.pos,2)==="{{"&&this.get_tag(!0)==="{{else}}")break}i=this.input.charAt(this.pos);this.pos++;this.line_char_count++;n.push(i)}return n.length?n.join(""):""},this.get_contents_to=function(n){var i,t;if(this.pos===this.input.length)return["","TK_EOF"];var r="",u=new RegExp("<\/"+n+"\\s*>","igm");return u.lastIndex=this.pos,i=u.exec(this.input),t=i?i.index:this.input.length,this.pos<t&&(r=this.input.substring(this.pos,t),this.pos=t),r},this.record_tag=function(n){this.tags[n+"count"]?(this.tags[n+"count"]++,this.tags[n+this.tags[n+"count"]]=this.indent_level):(this.tags[n+"count"]=1,this.tags[n+this.tags[n+"count"]]=this.indent_level);this.tags[n+this.tags[n+"count"]+"parent"]=this.tags.parent;this.tags.parent=n+this.tags[n+"count"]},this.retrieve_tag=function(n){if(this.tags[n+"count"]){for(var t=this.tags.parent;t;){if(n+this.tags[n+"count"]===t)break;t=this.tags[t+"parent"]}t&&(this.indent_level=this.tags[n+this.tags[n+"count"]],this.tags.parent=this.tags[t+"parent"]);delete this.tags[n+this.tags[n+"count"]+"parent"];delete this.tags[n+this.tags[n+"count"]];this.tags[n+"count"]===1?delete this.tags[n+"count"]:this.tags[n+"count"]--}},this.indent_to_tag=function(n){if(this.tags[n+"count"]){for(var t=this.tags.parent;t;){if(n+this.tags[n+"count"]===t)break;t=this.tags[t+"parent"]}t&&(this.indent_level=this.tags[n+this.tags[n+"count"]])}},this.get_tag=function(n){var i="",t=[],l="",f=!1,a=!0,s,d,e,v=this.pos,w=this.line_char_count,c,h,r,b,k,u;n=n!==undefined?n:!1;do{if(this.pos>=this.input.length)return n&&(this.pos=v,this.line_char_count=w),t.length?t.join(""):["","TK_EOF"];if(i=this.input.charAt(this.pos),this.pos++,this.Utils.in_array(i,this.Utils.whitespace)){f=!0;continue}if((i==="'"||i==='"')&&(i+=this.get_unformatted(i),f=!0),i==="="&&(f=!1),t.length&&t[t.length-1]!=="="&&i!==">"&&f){if(this.space_or_wrap(t),f=!1,!a&&ft==="force"&&i!=="/")for(this.print_newline(!0,t),this.print_indentation(t),c=0;c<et;c++)t.push(y);for(h=0;h<t.length;h++)if(t[h]===" "){a=!1;break}}if(o&&e==="<"&&i+this.input.charAt(this.pos)==="{{"&&(i+=this.get_unformatted("}}"),t.length&&t[t.length-1]!==" "&&t[t.length-1]!=="<"&&(i=" "+i),f=!0),i!=="<"||e||(s=this.pos-1,e="<"),o&&!e&&t.length>=2&&t[t.length-1]==="{"&&t[t.length-2]==="{"&&(s=i==="#"||i==="/"||i==="!"?this.pos-3:this.pos-2,e="{"),this.line_char_count++,t.push(i),t[1]&&(t[1]==="!"||t[1]==="?"||t[1]==="%")){t=[this.get_comment(s)];break}if(o&&t[1]&&t[1]==="{"&&t[2]&&t[2]==="!"){t=[this.get_comment(s)];break}if(o&&e==="{"&&t.length>2&&t[t.length-2]==="}"&&t[t.length-1]==="}")break}while(i!==">");return r=t.join(""),b=r.indexOf(" ")!==-1?r.indexOf(" "):r.charAt(0)==="{"?r.indexOf("}"):r.indexOf(">"),k=r.charAt(0)!=="<"&&o?r.charAt(2)==="#"?3:2:1,u=r.substring(k,b).toLowerCase(),r.charAt(r.length-2)==="/"||this.Utils.in_array(u,this.Utils.single_token)?n||(this.tag_type="SINGLE"):o&&r.charAt(0)==="{"&&u==="else"?n||(this.indent_to_tag("if"),this.tag_type="HANDLEBARS_ELSE",this.indent_content=!0,this.traverse_whitespace()):this.is_unformatted(u,p)?(l=this.get_unformatted("<\/"+u+">",r),t.push(l),d=this.pos-1,this.tag_type="SINGLE"):u==="script"&&(r.search("type")===-1||r.search("type")>-1&&r.search(/\b(text|application)\/(x-)?(javascript|ecmascript|jscript|livescript)/)>-1)?n||(this.record_tag(u),this.tag_type="SCRIPT"):u==="style"&&(r.search("type")===-1||r.search("type")>-1&&r.search("text/css")>-1)?n||(this.record_tag(u),this.tag_type="STYLE"):u.charAt(0)==="!"?n||(this.tag_type="SINGLE",this.traverse_whitespace()):n||(u.charAt(0)==="/"?(this.retrieve_tag(u.substring(1)),this.tag_type="END"):(this.record_tag(u),u.toLowerCase()!=="html"&&(this.indent_content=!0),this.tag_type="START"),this.traverse_whitespace()&&this.space_or_wrap(t),this.Utils.in_array(u,this.Utils.extra_liners)&&(this.print_newline(!1,this.output),this.output.length&&this.output[this.output.length-2]!=="\n"&&this.print_newline(!0,this.output))),n&&(this.pos=v,this.line_char_count=w),t.join("")},this.get_comment=function(n){var t="",i=">",r=!1;for(this.pos=n,input_char=this.input.charAt(this.pos),this.pos++;this.pos<=this.input.length;){if(t+=input_char,t.charAt(t.length-1)===i.charAt(i.length-1)&&t.indexOf(i)!==-1)break;!r&&t.length<10&&(t.indexOf("<![if")===0?(i="<![endif]>",r=!0):t.indexOf("<![cdata[")===0?(i="]\]>",r=!0):t.indexOf("<![")===0?(i="]>",r=!0):t.indexOf("<!--")===0?(i="-->",r=!0):t.indexOf("{{!")===0?(i="}}",r=!0):t.indexOf("<?")===0?(i="?>",r=!0):t.indexOf("<%")===0&&(i="%>",r=!0));input_char=this.input.charAt(this.pos);this.pos++}return t},this.get_unformatted=function(n,t){if(t&&t.toLowerCase().indexOf(n)!==-1)return"";var r="",i="",u=0,f=!0;do{if(this.pos>=this.input.length)return i;if(r=this.input.charAt(this.pos),this.pos++,this.Utils.in_array(r,this.Utils.whitespace)){if(!f){this.line_char_count--;continue}if(r==="\n"||r==="\r"){i+="\n";this.line_char_count=0;continue}}i+=r;this.line_char_count++;f=!0;o&&r==="{"&&i.length&&i.charAt(i.length-2)==="{"&&(i+=this.get_unformatted("}}"),u=i.length)}while(i.toLowerCase().indexOf(n,u)===-1);return i},this.get_token=function(){var n,t,i;return this.last_token==="TK_TAG_SCRIPT"||this.last_token==="TK_TAG_STYLE"?(t=this.last_token.substr(7),n=this.get_contents_to(t),typeof n!="string")?n:[n,"TK_"+t]:this.current_mode==="CONTENT"?(n=this.get_content(),typeof n!="string"?n:[n,"TK_CONTENT"]):this.current_mode==="TAG"?(n=this.get_tag(),typeof n!="string"?n:(i="TK_TAG_"+this.tag_type,[n,i])):void 0},this.get_full_indent=function(n){return(n=this.indent_level+n||0,n<1)?"":Array(n+1).join(this.indent_string)},this.is_unformatted=function(n,t){if(!this.Utils.in_array(n,t))return!1;if(n.toLowerCase()!=="a"||!this.Utils.in_array("a",t))return!0;var r=this.get_tag(!0),i=(r||"").match(/^\s*<\s*\/?([a-z]*)\s*[^>]*>\s*$/);return!i||this.Utils.in_array(i,t)?!0:!1},this.printer=function(n,r,u,f,e){this.input=n||"";this.input=this.input.replace(/\r\n|[\r\u2028\u2029]/g,"\n");this.output=[];this.indent_character=r;this.indent_string="";this.indent_size=u;this.brace_style=e;this.indent_level=0;this.wrap_line_length=f;this.line_char_count=0;for(var o=0;o<this.indent_size;o++)this.indent_string+=this.indent_character;this.print_newline=function(n,i){(this.line_char_count=0,i&&i.length)&&(n||i[i.length-1]!=="\n")&&(i[i.length-1]!=="\n"&&(i[i.length-1]=t(i[i.length-1])),i.push("\n"))};this.print_indentation=function(n){for(var t=0;t<this.indent_level;t++)n.push(this.indent_string),this.line_char_count+=this.indent_string.length};this.print_token=function(n){(!this.is_whitespace(n)||this.output.length)&&((n||n!=="")&&this.output.length&&this.output[this.output.length-1]==="\n"&&(this.print_indentation(this.output),n=i(n)),this.print_token_raw(n))};this.print_token_raw=function(n){this.newlines>0&&(n=t(n));n&&n!==""&&(n.length>1&&n.charAt(n.length-1)==="\n"?(this.output.push(n.slice(0,-1)),this.print_newline(!1,this.output)):this.output.push(n));for(var i=0;i<this.newlines;i++)this.print_newline(i>0,this.output);this.newlines=0};this.indent=function(){this.indent_level++};this.unindent=function(){this.indent_level>0&&this.indent_level--}},this}var e,tt,h,y,it,rt,p,b,ut,o,ft,et,ot,st,c,k,ht,l,d,s,w,a,g,nt,ct,v;for(r=r||{},(r.wrap_line_length===undefined||parseInt(r.wrap_line_length,10)===0)&&r.max_char!==undefined&&parseInt(r.max_char,10)!==0&&(r.wrap_line_length=r.max_char),tt=r.indent_inner_html===undefined?!1:r.indent_inner_html,h=r.indent_size===undefined?4:parseInt(r.indent_size,10),y=r.indent_char===undefined?" ":r.indent_char,rt=r.brace_style===undefined?"collapse":r.brace_style,it=parseInt(r.wrap_line_length,10)===0?32786:parseInt(r.wrap_line_length||250,10),p=r.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"],b=r.preserve_newlines===undefined?!0:r.preserve_newlines,ut=b?isNaN(parseInt(r.max_preserve_newlines,10))?32786:parseInt(r.max_preserve_newlines,10):0,o=r.indent_handlebars===undefined?!1:r.indent_handlebars,ft=r.wrap_attributes===undefined?"auto":r.wrap_attributes,et=r.wrap_attributes_indent_size===undefined?h:parseInt(r.wrap_attributes_indent_size,10)||h,ot=r.end_with_newline===undefined?!1:r.end_with_newline,st=typeof r.extra_liners=="object"&&r.extra_liners?r.extra_liners.concat():typeof r.extra_liners=="string"?r.extra_liners.split(","):"head,body,/html".split(","),c=r.eol?r.eol:"\n",r.indent_with_tabs&&(y="\t",h=1),c=c.replace(/\\r/,"\r").replace(/\\n/,"\n"),e=new lt,e.printer(n,y,h,it,rt);;){if(k=e.get_token(),e.token_text=k[0],e.token_type=k[1],e.token_type==="TK_EOF")break;switch(e.token_type){case"TK_TAG_START":e.print_newline(!1,e.output);e.print_token(e.token_text);e.indent_content&&(e.indent(),e.indent_content=!1);e.current_mode="CONTENT";break;case"TK_TAG_STYLE":case"TK_TAG_SCRIPT":e.print_newline(!1,e.output);e.print_token(e.token_text);e.current_mode="CONTENT";break;case"TK_TAG_END":e.last_token==="TK_CONTENT"&&e.last_text===""&&(ht=e.token_text.match(/\w+/)[0],l=null,e.output.length&&(l=e.output[e.output.length-1].match(/(?:<|{{#)\s*(\w+)/)),l!==null&&(l[1]===ht||e.Utils.in_array(l[1],p))||e.print_newline(!1,e.output));e.print_token(e.token_text);e.current_mode="CONTENT";break;case"TK_TAG_SINGLE":d=e.token_text.match(/^\s*<([a-z-]+)/i);d&&e.Utils.in_array(d[1],p)||e.print_newline(!1,e.output);e.print_token(e.token_text);e.current_mode="CONTENT";break;case"TK_TAG_HANDLEBARS_ELSE":e.print_token(e.token_text);e.indent_content&&(e.indent(),e.indent_content=!1);e.current_mode="CONTENT";break;case"TK_TAG_HANDLEBARS_COMMENT":e.print_token(e.token_text);e.current_mode="TAG";break;case"TK_CONTENT":e.print_token(e.token_text);e.current_mode="TAG";break;case"TK_STYLE":case"TK_SCRIPT":if(e.token_text!==""){if(e.print_newline(!1,e.output),s=e.token_text,a=1,e.token_type==="TK_SCRIPT"?w=typeof u=="function"&&u:e.token_type==="TK_STYLE"&&(w=typeof f=="function"&&f),r.indent_scripts==="keep"?a=0:r.indent_scripts==="separate"&&(a=-e.indent_level),g=e.get_full_indent(a),w)nt=function(){this.eol="\n"},nt.prototype=r,ct=new nt,s=w(s.replace(/^\s*/,g),ct);else{var at=s.match(/^\s*/)[0],vt=at.match(/[^\n\r]*$/)[0].split(e.indent_string).length-1,yt=e.get_full_indent(a-vt);s=s.replace(/^\s*/,g).replace(/\r\n|\r|\n/g,"\n"+yt).replace(/\s+$/,"")}s&&(e.print_token_raw(s),e.print_newline(!0,e.output))}e.current_mode="TAG";break;default:e.token_text!==""&&e.print_token(e.token_text)}e.last_token=e.token_type;e.last_text=e.token_text}return v=e.output.join("").replace(/[\r\n\t ]+$/,""),ot&&(v+="\n"),c!="\n"&&(v=v.replace(/[\n]/g,c)),v}if(typeof define=="function"&&define.amd)define(["require","./beautify","./beautify-css"],function(t){var i=t("./beautify"),r=t("./beautify-css");return{html_beautify:function(t,u){return n(t,u,i.js_beautify,r.css_beautify)}}});else if(typeof exports!="undefined"){var r=require("./beautify.js"),u=require("./beautify-css.js");exports.html_beautify=function(t,i){return n(t,i,r.js_beautify,u.css_beautify)}}else typeof window!="undefined"?window.html_beautify=function(t,i){return n(t,i,window.js_beautify,window.css_beautify)}:typeof global!="undefined"&&(global.html_beautify=function(t,i){return n(t,i,global.js_beautify,global.css_beautify)})}() |