mirror of
https://github.com/ocogeclub/ocoge.git
synced 2024-11-22 07:39:49 +00:00
1 line
73 KiB
JavaScript
1 line
73 KiB
JavaScript
|
!function(){var u,i;function n(t){if(i[t])return i[t].exports;var e=i[t]={i:t,l:!1,exports:{}};return u[t].call(e.exports,e,e.exports,n),e.l=!0,e.exports}var t=(i={},n.m=u=[function(t,e,u){"use strict";var i=u(1).Beautifier,n=u(5).Options;t.exports=function(t,e){return new i(t,e).beautify()},t.exports.defaultOptions=function(){return new n}},function(t,e,u){"use strict";var i=u(2).Output,n=u(3).Token,o=u(4),_=u(5).Options,s=u(7).Tokenizer,p=u(7).line_starters,l=u(7).positionable_operators,f=u(7).TOKEN;function c(t,e){return-1!==e.indexOf(t)}function a(t,e){return t&&t.type===f.RESERVED&&t.text===e}function d(t,e){return t&&t.type===f.RESERVED&&c(t.text,e)}var b=["case","return","do","if","throw","else","await","break","continue","async"],g=function(t){for(var e={},u=0;u<t.length;u++)e[t[u].replace(/-/g,"_")]=t[u];return e}(["before-newline","after-newline","preserve-newline"]),k=[g.before_newline,g.preserve_newline],m="BlockStatement",w="Statement",r="ObjectLiteral",h="ArrayLiteral",y="ForInitializer",x="Conditional",v="Expression";function E(t,e){e.multiline_frame||e.mode===y||e.mode===x||t.remove_indent(e.start_line_index)}function O(t){return t===h}function R(t){return c(t,[v,y,x])}function T(t,e){e=e||{},this._source_text=t||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new _(e)}T.prototype.create_flags=function(t,e){var u=0;return t&&(u=t.indentation_level,!this._output.just_added_newline()&&t.line_indent_level>u&&(u=t.line_indent_level)),{mode:e,parent:t,last_token:t?t.last_token:new n(f.START_BLOCK,""),last_word:t?t.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:u,alignment:0,line_indent_level:t?t.line_indent_level:u,start_line_index:this._output.get_line_number(),ternary_depth:0}},T.prototype._reset=function(t){var e=t.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new i(this._options,e),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(m);var u=new s(t,this._options);return this._tokens=u.tokenize(),t},T.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var t=this._reset(this._source_text),e=this._options.eol;"auto"===this._options.eol&&(e="\n",t&&o.lineBreak.test(t||"")&&(e=t.match(o.lineBreak)[0]));for(var u=this._tokens.next();u;)this.handle_token(u),this._last_last_text=this._flags.last_token.text,this._flags.last_token=u,u=this._tokens.next();return this._output.get_code(e)},T.prototype.handle_token=function(t,e){t.type===f.START_EXPR?this.handle_start_expr(t):t.type===f.END_EXPR?this.handle_end_expr(t):t.type===f.START_BLOCK?this.handle_start_block(t):t.type===f.END_BLOCK?this.handle_end_block(t):t.type===f.WORD?this.handle_word(t):t.type===f.RESERVED?this.handle_word(t):t.type===f.SEMICOLON?this.handle_semicolon(t):t.type===f.STRING?this.handle_string(t):t.type===f.EQUALS?this.handle_equals(t):t.type===f.OPERATOR?this.handle_operator(t):t.type===f.COMMA?this.handle_comma(t):t.type===f.BLOCK_COMMENT?this.handle_block_comment(t,e):t.type===f.COMMENT?this.handle_comment(t,e):t.type===f.DOT?this.handle_dot(t):t.type===f.EOF?this.handle_eof(t):(t.type,f.UNKNOWN,this.handle_unknown(t,e))},T.prototype.handle_whitespace_and_comments=function(t,e){var u=t.newlines,i=this._options.keep_array_indentation&&O(this._flags.mode);if(t.comments_before)for(var n=t.comments_before.next();n;)this.handle_whitespace_and_comments(n,e),this.handle_token(n,e),n=t.comments_before.next();if(i)for(var _=0;_<u;_+=1)this.print_newline(0<_,e);else if(this._options.max_preserve_newlines&&u>this._options.max_preserve_newlines&&(u=this._options.max_preserve_newlines),this._options.preserve_newlines&&1<u){this.print_newline(!1,e);for(var s=1;s<u;s+=1)this.print_newline(!0,e)}};var A=["async","break","continue","return","throw","yield"];T.prototype.allow_wrap_or_preserved_newline=function(t,e){i
|