2015-04-21 06:59:16 +02:00
( function ( exports , global ) { global [ "UglifyJS" ] = exports ; "use strict" ; function array _to _hash ( a ) { var ret = Object . create ( null ) ; for ( var i = 0 ; i < a . length ; ++ i ) ret [ a [ i ] ] = true ; return ret } function slice ( a , start ) { return Array . prototype . slice . call ( a , start || 0 ) } function characters ( str ) { return str . split ( "" ) } function member ( name , array ) { for ( var i = array . length ; -- i >= 0 ; ) if ( array [ i ] == name ) return true ; return false } function find _if ( func , array ) { for ( var i = 0 , n = array . length ; i < n ; ++ i ) { if ( func ( array [ i ] ) ) return array [ i ] } } function repeat _string ( str , i ) { if ( i <= 0 ) return "" ; if ( i == 1 ) return str ; var d = repeat _string ( str , i >> 1 ) ; d += d ; if ( i & 1 ) d += str ; return d } function DefaultsError ( msg , defs ) { Error . call ( this , msg ) ; this . msg = msg ; this . defs = defs } DefaultsError . prototype = Object . create ( Error . prototype ) ; DefaultsError . prototype . constructor = DefaultsError ; DefaultsError . croak = function ( msg , defs ) { throw new DefaultsError ( msg , defs ) } ; function defaults ( args , defs , croak ) { if ( args === true ) args = { } ; var ret = args || { } ; if ( croak ) for ( var i in ret ) if ( ret . hasOwnProperty ( i ) && ! defs . hasOwnProperty ( i ) ) DefaultsError . croak ( "`" + i + "` is not a supported option" , defs ) ; for ( var i in defs ) if ( defs . hasOwnProperty ( i ) ) { ret [ i ] = args && args . hasOwnProperty ( i ) ? args [ i ] : defs [ i ] } return ret } function merge ( obj , ext ) { var count = 0 ; for ( var i in ext ) if ( ext . hasOwnProperty ( i ) ) { obj [ i ] = ext [ i ] ; count ++ } return count } function noop ( ) { } var MAP = function ( ) { function MAP ( a , f , backwards ) { var ret = [ ] , top = [ ] , i ; function doit ( ) { var val = f ( a [ i ] , i ) ; var is _last = val instanceof Last ; if ( is _last ) val = val . v ; if ( val instanceof AtTop ) { val = val . v ; if ( val instanceof Splice ) { top . push . apply ( top , backwards ? val . v . slice ( ) . reverse ( ) : val . v ) } else { top . push ( val ) } } else if ( val !== skip ) { if ( val instanceof Splice ) { ret . push . apply ( ret , backwards ? val . v . slice ( ) . reverse ( ) : val . v ) } else { ret . push ( val ) } } return is _last } if ( a instanceof Array ) { if ( backwards ) { for ( i = a . length ; -- i >= 0 ; ) if ( doit ( ) ) break ; ret . reverse ( ) ; top . reverse ( ) } else { for ( i = 0 ; i < a . length ; ++ i ) if ( doit ( ) ) break } } else { for ( i in a ) if ( a . hasOwnProperty ( i ) ) if ( doit ( ) ) break } return top . concat ( ret ) } MAP . at _top = function ( val ) { return new AtTop ( val ) } ; MAP . splice = function ( val ) { return new Splice ( val ) } ; MAP . last = function ( val ) { return new Last ( val ) } ; var skip = MAP . skip = { } ; function AtTop ( val ) { this . v = val } function Splice ( val ) { this . v = val } function Last ( val ) { this . v = val } return MAP } ( ) ; function push _uniq ( array , el ) { if ( array . indexOf ( el ) < 0 ) array . push ( el ) } function string _template ( text , props ) { return text . replace ( /\{(.+?)\}/g , function ( str , p ) { return props [ p ] } ) } function remove ( array , el ) { for ( var i = array . length ; -- i >= 0 ; ) { if ( array [ i ] === el ) array . splice ( i , 1 ) } } function mergeSort ( array , cmp ) { if ( array . length < 2 ) return array . slice ( ) ; function merge ( a , b ) { var r = [ ] , ai = 0 , bi = 0 , i = 0 ; while ( ai < a . length && bi < b . length ) { cmp ( a [ ai ] , b [ bi ] ) <= 0 ? r [ i ++ ] = a [ ai ++ ] : r [ i ++ ] = b [ bi ++ ] } if ( ai < a . length ) r . push . apply ( r , a . slice ( ai ) ) ; if ( bi < b . length ) r . push . apply ( r , b . slice ( bi ) ) ; return r } function _ms ( a ) { if ( a . length <= 1 ) return a ; var m = Math . floor ( a . length / 2 ) , left = a . slice ( 0 , m ) , right = a . slice ( m ) ; left = _ms ( left ) ; right = _ms ( right ) ; return merge ( left , right ) } return _ms ( array ) } function set _difference ( a , b ) { return a . filter ( function ( el ) { return b . indexOf ( el ) < 0 } ) } function set _intersection ( a , b ) { return a . filter ( function ( el ) { return b . indexOf ( el ) >= 0 } ) } function makePredicate ( words ) { if ( ! ( words instanceof Array ) ) words = words . split ( " " ) ; var f = "" , cats = [ ] ; out : for ( var i = 0 ; i < words . length ; ++ i ) { for ( var j = 0 ; j < cats . length ; ++ j ) if ( cats [ j ] [ 0 ] . length == words [ i ] . length ) { cats [ j ] . push ( words [ i ] ) ; continue out } cats . push ( [ words [ i ] ] ) } function compareTo ( arr ) { if ( arr . length == 1 ) return f += "return str === " + JSON . stringify ( arr [ 0 ] ) + ";" ; f += "switch(str){" ; for ( var i = 0 ; i < arr . length ; ++ i ) f += "case " + JSON . stringify ( arr [ i ] ) + ":" ; f += "return true}return false;" } if ( cats . length > 3 ) { cats . sort ( function ( a , b ) { return b . length - a . length } ) ; f += "switch(str.length){" ; for ( var i = 0 ; i < cats . length ; ++ i ) { var cat = cats [ i ] ; f += "case " + cat [ 0 ] . length + ":" ; compareTo ( cat ) } f += "}" } else { compareTo ( words ) } return new Function ( "str" , f ) } function all ( array , predicate ) { for ( var i = array . length ; -- i >= 0 ; ) if ( ! predicate ( array [ i ] ) ) return false ; return true } function Dictionary ( ) { this . _values = Object . create ( null ) ; this . _size = 0 } Dictionary . prototype = { set : function ( ke
digit : new RegExp ( "[\\u0030-\\u0039\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0BE6-\\u0BEF\\u0C66-\\u0C6F\\u0CE6-\\u0CEF\\u0D66-\\u0D6F\\u0DE6-\\u0DEF\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F29\\u1040-\\u1049\\u1090-\\u1099\\u17E0-\\u17E9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19D9\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\uA620-\\uA629\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uA9F0-\\uA9F9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19]" ) , non _spacing _mark : new RegExp ( "[\\u0300-\\u036F\\u0483-\\u0487\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u065E\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0900-\\u0902\\u093C\\u0941-\\u0948\\u094D\\u0951-\\u0955\\u0962\\u0963\\u0981\\u09BC\\u09C1-\\u09C4\\u09CD\\u09E2\\u09E3\\u0A01\\u0A02\\u0A3C\\u0A41\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81\\u0A82\\u0ABC\\u0AC1-\\u0AC5\\u0AC7\\u0AC8\\u0ACD\\u0AE2\\u0AE3\\u0B01\\u0B3C\\u0B3F\\u0B41-\\u0B44\\u0B4D\\u0B56\\u0B62\\u0B63\\u0B82\\u0BC0\\u0BCD\\u0C3E-\\u0C40\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0CBC\\u0CBF\\u0CC6\\u0CCC\\u0CCD\\u0CE2\\u0CE3\\u0D41-\\u0D44\\u0D4D\\u0D62\\u0D63\\u0DCA\\u0DD2-\\u0DD4\\u0DD6\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB4-\\u0EB9\\u0EBB\\u0EBC\\u0EC8-\\u0ECD\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F71-\\u0F7E\\u0F80-\\u0F84\\u0F86\\u0F87\\u0F90-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102D-\\u1030\\u1032-\\u1037\\u1039\\u103A\\u103D\\u103E\\u1058\\u1059\\u105E-\\u1060\\u1071-\\u1074\\u1082\\u1085\\u1086\\u108D\\u109D\\u135F\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B7-\\u17BD\\u17C6\\u17C9-\\u17D3\\u17DD\\u180B-\\u180D\\u18A9\\u1920-\\u1922\\u1927\\u1928\\u1932\\u1939-\\u193B\\u1A17\\u1A18\\u1A56\\u1A58-\\u1A5E\\u1A60\\u1A62\\u1A65-\\u1A6C\\u1A73-\\u1A7C\\u1A7F\\u1B00-\\u1B03\\u1B34\\u1B36-\\u1B3A\\u1B3C\\u1B42\\u1B6B-\\u1B73\\u1B80\\u1B81\\u1BA2-\\u1BA5\\u1BA8\\u1BA9\\u1C2C-\\u1C33\\u1C36\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE0\\u1CE2-\\u1CE8\\u1CED\\u1DC0-\\u1DE6\\u1DFD-\\u1DFF\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2CEF-\\u2CF1\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA66F\\uA67C\\uA67D\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA825\\uA826\\uA8C4\\uA8E0-\\uA8F1\\uA926-\\uA92D\\uA947-\\uA951\\uA980-\\uA982\\uA9B3\\uA9B6-\\uA9B9\\uA9BC\\uAA29-\\uAA2E\\uAA31\\uAA32\\uAA35\\uAA36\\uAA43\\uAA4C\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uABE5\\uABE8\\uABED\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE26]" ) , space _combining _mark : new RegExp ( "[\\u0903\\u093E-\\u0940\\u0949-\\u094C\\u094E\\u0982\\u0983\\u09BE-\\u09C0\\u09C7\\u09C8\\u09CB\\u09CC\\u09D7\\u0A03\\u0A3E-\\u0A40\\u0A83\\u0ABE-\\u0AC0\\u0AC9\\u0ACB\\u0ACC\\u0B02\\u0B03\\u0B3E\\u0B40\\u0B47\\u0B48\\u0B4B\\u0B4C\\u0B57\\u0BBE\\u0BBF\\u0BC1\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCC\\u0BD7\\u0C01-\\u0C03\\u0C41-\\u0C44\\u0C82\\u0C83\\u0CBE\\u0CC0-\\u0CC4\\u0CC7\\u0CC8\\u0CCA\\u0CCB\\u0CD5\\u0CD6\\u0D02\\u0D03\\u0D3E-\\u0D40\\u0D46-\\u0D48\\u0D4A-\\u0D4C\\u0D57\\u0D82\\u0D83\\u0DCF-\\u0DD1\\u0DD8-\\u0DDF\\u0DF2\\u0DF3\\u0F3E\\u0F3F\\u0F7F\\u102B\\u102C\\u1031\\u1038\\u103B\\u103C\\u1056\\u1057\\u1062-\\u1064\\u1067-\\u106D\\u1083\\u1084\\u1087-\\u108C\\u108F\\u109A-\\u109C\\u17B6\\u17BE-\\u17C5\\u17C7\\u17C8\\u1923-\\u1926\\u1929-\\u192B\\u1930\\u1931\\u1933-\\u1938\\u19B0-\\u19C0\\u19C8\\u19C9\\u1A19-\\u1A1B\\u1A55\\u1A57\\u1A61\\u1A63\\u1A64\\u1A6D-\\u1A72\\u1B04\\u1B35\\u1B3B\\u1B3D-\\u1B41\\u1B43\\u1B44\\u1B82\\u1BA1\\u1BA6\\u1BA7\\u1BAA\\u1C24-\\u1C2B\\u1C34\\u1C35\\u1CE1\\u1CF2\\uA823\\uA824\\uA827\\uA880\\uA881\\uA8B4-\\uA8C3\\uA952\\uA953\\uA983\\uA9B4\\uA9B5\\uA9BA\\uA9BB\\uA9BD-\\uA9C0\\uAA2F\\uAA30\\uAA33\\uAA34\\uAA4D\\uAA7B\\uABE3\\uABE4\\uABE6\\uABE7\\uABE9\\uABEA\\uABEC]" ) , connector _punctuation : new RegExp ( "[\\u005F\\u203F\\u2040\\u2054\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFF3F]" ) } ; function is
var scope = self . parent _scope = null ; var defun = null ; var nesting = 0 ; var tw = new TreeWalker ( function ( node , descend ) { if ( options . screw _ie8 && node instanceof AST _Catch ) { var save _scope = scope ; scope = new AST _Scope ( node ) ; scope . init _scope _vars ( nesting ) ; scope . parent _scope = save _scope ; descend ( ) ; scope = save _scope ; return true } if ( node instanceof AST _Scope ) { node . init _scope _vars ( nesting ) ; var save _scope = node . parent _scope = scope ; var save _defun = defun ; defun = scope = node ; ++ nesting ; descend ( ) ; -- nesting ; scope = save _scope ; defun = save _defun ; return true } if ( node instanceof AST _Directive ) { node . scope = scope ; push _uniq ( scope . directives , node . value ) ; return true } if ( node instanceof AST _With ) { for ( var s = scope ; s ; s = s . parent _scope ) s . uses _with = true ; return } if ( node instanceof AST _Symbol ) { node . scope = scope } if ( node instanceof AST _SymbolLambda ) { defun . def _function ( node ) } else if ( node instanceof AST _SymbolDefun ) { ( node . scope = defun . parent _scope ) . def _function ( node ) } else if ( node instanceof AST _SymbolVar || node instanceof AST _SymbolConst ) { var def = defun . def _variable ( node ) ; def . constant = node instanceof AST _SymbolConst ; def . init = tw . parent ( ) . value } else if ( node instanceof AST _SymbolCatch ) { ( options . screw _ie8 ? scope : defun ) . def _variable ( node ) } } ) ; self . walk ( tw ) ; var func = null ; var globals = self . globals = new Dictionary ; var tw = new TreeWalker ( function ( node , descend ) { if ( node instanceof AST _Lambda ) { var prev _func = func ; func = node ; descend ( ) ; func = prev _func ; return true } if ( node instanceof AST _SymbolRef ) { var name = node . name ; var sym = node . scope . find _variable ( name ) ; if ( ! sym ) { var g ; if ( globals . has ( name ) ) { g = globals . get ( name ) } else { g = new SymbolDef ( self , globals . size ( ) , node ) ; g . undeclared = true ; g . global = true ; globals . set ( name , g ) } node . thedef = g ; if ( name == "eval" && tw . parent ( ) instanceof AST _Call ) { for ( var s = node . scope ; s && ! s . uses _eval ; s = s . parent _scope ) s . uses _eval = true } if ( func && name == "arguments" ) { func . uses _arguments = true } } else { node . thedef = sym } node . reference ( ) ; return true } } ) ; self . walk ( tw ) ; if ( options . cache ) { this . cname = options . cache . cname } } ) ; AST _Scope . DEFMETHOD ( "init_scope_vars" , function ( nesting ) { this . directives = [ ] ; this . variables = new Dictionary ; this . functions = new Dictionary ; this . uses _with = false ; this . uses _eval = false ; this . parent _scope = null ; this . enclosed = [ ] ; this . cname = - 1 ; this . nesting = nesting } ) ; AST _Scope . DEFMETHOD ( "strict" , function ( ) { return this . has _directive ( "use strict" ) } ) ; AST _Lambda . DEFMETHOD ( "init_scope_vars" , function ( ) { AST _Scope . prototype . init _scope _vars . apply ( this , arguments ) ; this . uses _arguments = false } ) ; AST _SymbolRef . DEFMETHOD ( "reference" , function ( ) { var def = this . definition ( ) ; def . references . push ( this ) ; var s = this . scope ; while ( s ) { push _uniq ( s . enclosed , def ) ; if ( s === def . scope ) break ; s = s . parent _scope } this . frame = this . scope . nesting - def . scope . nesting } ) ; AST _Scope . DEFMETHOD ( "find_variable" , function ( name ) { if ( name instanceof AST _Symbol ) name = name . name ; return this . variables . get ( name ) || this . parent _scope && this . parent _scope . find _variable ( name ) } ) ; AST _Scope . DEFMETHOD ( "has_directive" , function ( value ) { return this . parent _scope && this . parent _scope . has _directive ( value ) || ( this . directives . indexOf ( value ) >= 0 ? this : null ) } ) ; AST _Scope . DEFMETHOD ( "def_function" , function ( symbol ) { this . functions . set ( symbol . name , this . def _variable ( symbol ) ) } ) ; AST _Scope . DEFMETHOD ( "def_variable" , function ( symbol ) { var def ; if ( ! this . variables . has ( symbol . name ) ) { def = new SymbolDef ( this , this . variables . size ( ) , symbol ) ; this . variables . set ( symbol . name , def ) ; def . global = ! this . parent _scope } else { def = this . variables . get ( symbol . name ) ; def . orig . push ( symbol ) } return symbol . thedef = def } ) ; AST _Scope . DEFMETHOD ( "next_mangled" , function ( options ) { var ext = this . enclosed ; out : while ( true ) { var m = base54 ( ++ this . cname ) ; if ( ! is _identifier ( m ) ) continue ; if ( options . except . indexOf ( m ) >= 0 ) continue ; for ( var i = ext . length ; -- i >= 0 ; ) { var sym = ext [ i ] ; var name = sym . mangled _name || sym . unmangleable ( options ) && sym . name ; if ( m == name ) continue out } return m } } ) ; AST _Function . DEFMETHOD ( "next_mangled" , function ( options , def ) { var tricky _def = def . orig [ 0 ] instanceof AST _SymbolFunarg && this . name && this . name . definition ( ) ; while ( true ) { var name = AST _Lambda . prototype . next _mangled . call ( this , options , def ) ; if ( ! ( tricky _def && tricky _def . mangled _name == name ) ) return name } } ) ; AST _Scope . DEFMETHOD ( "references" , function (
} ) ; function force _statement ( stat , output ) { if ( output . option ( "bracketize" ) ) { if ( ! stat || stat instanceof AST _EmptyStatement ) output . print ( "{}" ) ; else if ( stat instanceof AST _BlockStatement ) stat . print ( output ) ; else output . with _block ( function ( ) { output . indent ( ) ; stat . print ( output ) ; output . newline ( ) } ) } else { if ( ! stat || stat instanceof AST _EmptyStatement ) output . force _semicolon ( ) ; else stat . print ( output ) } } function first _in _statement ( output ) { var a = output . stack ( ) , i = a . length , node = a [ -- i ] , p = a [ -- i ] ; while ( i > 0 ) { if ( p instanceof AST _Statement && p . body === node ) return true ; if ( p instanceof AST _Seq && p . car === node || p instanceof AST _Call && p . expression === node && ! ( p instanceof AST _New ) || p instanceof AST _Dot && p . expression === node || p instanceof AST _Sub && p . expression === node || p instanceof AST _Conditional && p . condition === node || p instanceof AST _Binary && p . left === node || p instanceof AST _UnaryPostfix && p . expression === node ) { node = p ; p = a [ -- i ] } else { return false } } } function no _constructor _parens ( self , output ) { return self . args . length == 0 && ! output . option ( "beautify" ) } function best _of ( a ) { var best = a [ 0 ] , len = best . length ; for ( var i = 1 ; i < a . length ; ++ i ) { if ( a [ i ] . length < len ) { best = a [ i ] ; len = best . length } } return best } function make _num ( num ) { var str = num . toString ( 10 ) , a = [ str . replace ( /^0\./ , "." ) . replace ( "e+" , "e" ) ] , m ; if ( Math . floor ( num ) === num ) { if ( num >= 0 ) { a . push ( "0x" + num . toString ( 16 ) . toLowerCase ( ) , "0" + num . toString ( 8 ) ) } else { a . push ( "-0x" + ( - num ) . toString ( 16 ) . toLowerCase ( ) , "-0" + ( - num ) . toString ( 8 ) ) } if ( m = /^(.*?)(0+)$/ . exec ( num ) ) { a . push ( m [ 1 ] + "e" + m [ 2 ] . length ) } } else if ( m = /^0?\.(0+)(.*)$/ . exec ( num ) ) { a . push ( m [ 2 ] + "e-" + ( m [ 1 ] . length + m [ 2 ] . length ) , str . substr ( str . indexOf ( "." ) ) ) } return best _of ( a ) } function make _block ( stmt , output ) { if ( stmt instanceof AST _BlockStatement ) { stmt . print ( output ) ; return } output . with _block ( function ( ) { output . indent ( ) ; stmt . print ( output ) ; output . newline ( ) } ) } function DEFMAP ( nodetype , generator ) { nodetype . DEFMETHOD ( "add_source_map" , function ( stream ) { generator ( this , stream ) } ) } DEFMAP ( AST _Node , noop ) ; function basic _sourcemap _gen ( self , output ) { output . add _mapping ( self . start ) } DEFMAP ( AST _Directive , basic _sourcemap _gen ) ; DEFMAP ( AST _Debugger , basic _sourcemap _gen ) ; DEFMAP ( AST _Symbol , basic _sourcemap _gen ) ; DEFMAP ( AST _Jump , basic _sourcemap _gen ) ; DEFMAP ( AST _StatementWithBody , basic _sourcemap _gen ) ; DEFMAP ( AST _LabeledStatement , noop ) ; DEFMAP ( AST _Lambda , basic _sourcemap _gen ) ; DEFMAP ( AST _Switch , basic _sourcemap _gen ) ; DEFMAP ( AST _SwitchBranch , basic _sourcemap _gen ) ; DEFMAP ( AST _BlockStatement , basic _sourcemap _gen ) ; DEFMAP ( AST _Toplevel , noop ) ; DEFMAP ( AST _New , basic _sourcemap _gen ) ; DEFMAP ( AST _Try , basic _sourcemap _gen ) ; DEFMAP ( AST _Catch , basic _sourcemap _gen ) ; DEFMAP ( AST _Finally , basic _sourcemap _gen ) ; DEFMAP ( AST _Definitions , basic _sourcemap _gen ) ; DEFMAP ( AST _Constant , basic _sourcemap _gen ) ; DEFMAP ( AST _ObjectProperty , function ( self , output ) { output . add _mapping ( self . start , self . key ) } ) } ) ( ) ; "use strict" ; function Compressor ( options , false _by _default ) { if ( ! ( this instanceof Compressor ) ) return new Compressor ( options , false _by _default ) ; TreeTransformer . call ( this , this . before , this . after ) ; this . options = defaults ( options , { sequences : ! false _by _default , properties : ! false _by _default , dead _code : ! false _by _default , drop _debugger : ! false _by _default , unsafe : false , unsafe _comps : false , conditionals : ! false _by _default , comparisons : ! false _by _default , evaluate : ! false _by _default , booleans : ! false _by _default , loops : ! false _by _default , unused : ! false _by _default , hoist _funs : ! false _by _default , keep _fargs : false , keep _fnames : false , hoist _vars : false , if _return : ! false _by _default , join _vars : ! false _by _default , cascade : ! false _by _default , side _effects : ! false _by _default , pure _getters : false , pure _funcs : null , negate _iife : ! false _by _default , screw _ie8 : false , drop _console : false , angular : false , warnings : true , global _defs : { } } , true ) } Compressor . prototype = new TreeTransformer ; merge ( Compressor . prototype , { option : function ( key ) { return this . options [ key ] } , warn : function ( ) { if ( this . options . warnings ) AST _Node . warn . apply ( AST _Node , arguments ) } , before : function ( node , descend , in _list ) { if ( node . _squeezed ) return node ; var was _scope = false ; if ( node instanceof AST _Scope ) { node = node . hoist _declarations ( this ) ; was _scope = true } descend ( node , this ) ; node = node . optimize ( this ) ; if ( was _scope && node instanceof AST _
} ) ; function if _break _in _loop ( self , compressor ) { function drop _it ( rest ) { rest = as _statement _array ( rest ) ; if ( self . body instanceof AST _BlockStatement ) { self . body = self . body . clone ( ) ; self . body . body = rest . concat ( self . body . body . slice ( 1 ) ) ; self . body = self . body . transform ( compressor ) } else { self . body = make _node ( AST _BlockStatement , self . body , { body : rest } ) . transform ( compressor ) } if _break _in _loop ( self , compressor ) } var first = self . body instanceof AST _BlockStatement ? self . body . body [ 0 ] : self . body ; if ( first instanceof AST _If ) { if ( first . body instanceof AST _Break && compressor . loopcontrol _target ( first . body . label ) === self ) { if ( self . condition ) { self . condition = make _node ( AST _Binary , self . condition , { left : self . condition , operator : "&&" , right : first . condition . negate ( compressor ) } ) } else { self . condition = first . condition . negate ( compressor ) } drop _it ( first . alternative ) } else if ( first . alternative instanceof AST _Break && compressor . loopcontrol _target ( first . alternative . label ) === self ) { if ( self . condition ) { self . condition = make _node ( AST _Binary , self . condition , { left : self . condition , operator : "&&" , right : first . condition } ) } else { self . condition = first . condition } drop _it ( first . body ) } } } OPT ( AST _While , function ( self , compressor ) { if ( ! compressor . option ( "loops" ) ) return self ; self = AST _DWLoop . prototype . optimize . call ( self , compressor ) ; if ( self instanceof AST _While ) { if _break _in _loop ( self , compressor ) ; self = make _node ( AST _For , self , self ) . transform ( compressor ) } return self } ) ; OPT ( AST _For , function ( self , compressor ) { var cond = self . condition ; if ( cond ) { cond = cond . evaluate ( compressor ) ; self . condition = cond [ 0 ] } if ( ! compressor . option ( "loops" ) ) return self ; if ( cond ) { if ( cond . length > 1 && ! cond [ 1 ] ) { if ( compressor . option ( "dead_code" ) ) { var a = [ ] ; if ( self . init instanceof AST _Statement ) { a . push ( self . init ) } else if ( self . init ) { a . push ( make _node ( AST _SimpleStatement , self . init , { body : self . init } ) ) } extract _declarations _from _unreachable _code ( compressor , self . body , a ) ; return make _node ( AST _BlockStatement , self , { body : a } ) } } } if _break _in _loop ( self , compressor ) ; return self } ) ; OPT ( AST _If , function ( self , compressor ) { if ( ! compressor . option ( "conditionals" ) ) return self ; var cond = self . condition . evaluate ( compressor ) ; self . condition = cond [ 0 ] ; if ( cond . length > 1 ) { if ( cond [ 1 ] ) { compressor . warn ( "Condition always true [{file}:{line},{col}]" , self . condition . start ) ; if ( compressor . option ( "dead_code" ) ) { var a = [ ] ; if ( self . alternative ) { extract _declarations _from _unreachable _code ( compressor , self . alternative , a ) } a . push ( self . body ) ; return make _node ( AST _BlockStatement , self , { body : a } ) . transform ( compressor ) } } else { compressor . warn ( "Condition always false [{file}:{line},{col}]" , self . condition . start ) ; if ( compressor . option ( "dead_code" ) ) { var a = [ ] ; extract _declarations _from _unreachable _code ( compressor , self . body , a ) ; if ( self . alternative ) a . push ( self . alternative ) ; return make _node ( AST _BlockStatement , self , { body : a } ) . transform ( compressor ) } } } if ( is _empty ( self . alternative ) ) self . alternative = null ; var negated = self . condition . negate ( compressor ) ; var negated _is _best = best _of ( self . condition , negated ) === negated ; if ( self . alternative && negated _is _best ) { negated _is _best = false ; self . condition = negated ; var tmp = self . body ; self . body = self . alternative || make _node ( AST _EmptyStatement ) ; self . alternative = tmp } if ( is _empty ( self . body ) && is _empty ( self . alternative ) ) { return make _node ( AST _SimpleStatement , self . condition , { body : self . condition } ) . transform ( compressor ) } if ( self . body instanceof AST _SimpleStatement && self . alternative instanceof AST _SimpleStatement ) { return make _node ( AST _SimpleStatement , self , { body : make _node ( AST _Conditional , self , { condition : self . condition , consequent : self . body . body , alternative : self . alternative . body } ) } ) . transform ( compressor ) } if ( is _empty ( self . alternative ) && self . body instanceof AST _SimpleStatement ) { if ( negated _is _best ) return make _node ( AST _SimpleStatement , self , { body : make _node ( AST _Binary , self , { operator : "||" , left : negated , right : self . body . body } ) } ) . transform ( compressor ) ; return make _node ( AST _SimpleStatement , self , { body : make _node ( AST _Binary , self , { operator : "&&" , left : self . condition , right : self . body . body } ) } ) . transform ( compressor ) } if ( self . body instanceof AST _EmptyStatement && self . alternative && self . alternative instanceof AST _SimpleStatement ) { return make _node ( AST _SimpleStatement , self , { bo
map ( "SwitchStatement" , AST _Switch , "discriminant>expression, cases@body" ) ; map ( "ReturnStatement" , AST _Return , "argument>value" ) ; map ( "ThrowStatement" , AST _Throw , "argument>value" ) ; map ( "WhileStatement" , AST _While , "test>condition, body>body" ) ; map ( "DoWhileStatement" , AST _Do , "test>condition, body>body" ) ; map ( "ForStatement" , AST _For , "init>init, test>condition, update>step, body>body" ) ; map ( "ForInStatement" , AST _ForIn , "left>init, right>object, body>body" ) ; map ( "DebuggerStatement" , AST _Debugger ) ; map ( "FunctionDeclaration" , AST _Defun , "id>name, params@argnames, body%body" ) ; map ( "VariableDeclarator" , AST _VarDef , "id>name, init>value" ) ; map ( "CatchClause" , AST _Catch , "param>argname, body%body" ) ; map ( "ThisExpression" , AST _This ) ; map ( "ArrayExpression" , AST _Array , "elements@elements" ) ; map ( "FunctionExpression" , AST _Function , "id>name, params@argnames, body%body" ) ; map ( "BinaryExpression" , AST _Binary , "operator=operator, left>left, right>right" ) ; map ( "LogicalExpression" , AST _Binary , "operator=operator, left>left, right>right" ) ; map ( "AssignmentExpression" , AST _Assign , "operator=operator, left>left, right>right" ) ; map ( "ConditionalExpression" , AST _Conditional , "test>condition, consequent>consequent, alternate>alternative" ) ; map ( "NewExpression" , AST _New , "callee>expression, arguments@args" ) ; map ( "CallExpression" , AST _Call , "callee>expression, arguments@args" ) ; def _to _moz ( AST _Directive , function To _Moz _Directive ( M ) { return { type : "ExpressionStatement" , expression : { type : "Literal" , value : M . value } } } ) ; def _to _moz ( AST _SimpleStatement , function To _Moz _ExpressionStatement ( M ) { return { type : "ExpressionStatement" , expression : to _moz ( M . body ) } } ) ; def _to _moz ( AST _SwitchBranch , function To _Moz _SwitchCase ( M ) { return { type : "SwitchCase" , test : to _moz ( M . expression ) , consequent : M . body . map ( to _moz ) } } ) ; def _to _moz ( AST _Try , function To _Moz _TryStatement ( M ) { return { type : "TryStatement" , block : to _moz _block ( M ) , handler : to _moz ( M . bcatch ) , guardedHandlers : [ ] , finalizer : to _moz ( M . bfinally ) } } ) ; def _to _moz ( AST _Catch , function To _Moz _CatchClause ( M ) { return { type : "CatchClause" , param : to _moz ( M . argname ) , guard : null , body : to _moz _block ( M ) } } ) ; def _to _moz ( AST _Definitions , function To _Moz _VariableDeclaration ( M ) { return { type : "VariableDeclaration" , kind : M instanceof AST _Const ? "const" : "var" , declarations : M . definitions . map ( to _moz ) } } ) ; def _to _moz ( AST _Seq , function To _Moz _SequenceExpression ( M ) { return { type : "SequenceExpression" , expressions : M . to _array ( ) . map ( to _moz ) } } ) ; def _to _moz ( AST _PropAccess , function To _Moz _MemberExpression ( M ) { var isComputed = M instanceof AST _Sub ; return { type : "MemberExpression" , object : to _moz ( M . expression ) , computed : isComputed , property : isComputed ? to _moz ( M . property ) : { type : "Identifier" , name : M . property } } } ) ; def _to _moz ( AST _Unary , function To _Moz _Unary ( M ) { return { type : M . operator == "++" || M . operator == "--" ? "UpdateExpression" : "UnaryExpression" , operator : M . operator , prefix : M instanceof AST _UnaryPrefix , argument : to _moz ( M . expression ) } } ) ; def _to _moz ( AST _Binary , function To _Moz _BinaryExpression ( M ) { return { type : M . operator == "&&" || M . operator == "||" ? "LogicalExpression" : "BinaryExpression" , left : to _moz ( M . left ) , operator : M . operator , right : to _moz ( M . right ) } } ) ; def _to _moz ( AST _Object , function To _Moz _ObjectExpression ( M ) { return { type : "ObjectExpression" , properties : M . properties . map ( to _moz ) } } ) ; def _to _moz ( AST _ObjectProperty , function To _Moz _Property ( M ) { var key = is _identifier ( M . key ) ? { type : "Identifier" , name : M . key } : { type : "Literal" , value : M . key } ; var kind ; if ( M instanceof AST _ObjectKeyVal ) { kind = "init" } else if ( M instanceof AST _ObjectGetter ) { kind = "get" } else if ( M instanceof AST _ObjectSetter ) { kind = "set" } return { type : "Property" , kind : kind , key : key , value : to _moz ( M . value ) } } ) ; def _to _moz ( AST _Symbol , function To _Moz _Identifier ( M ) { var def = M . definition ( ) ; return { type : "Identifier" , name : def ? def . mangled _name || def . name : M . name } } ) ; def _to _moz ( AST _Constant , function To _Moz _Literal ( M ) { var value = M . value ; if ( typeof value === "number" && ( value < 0 || value === 0 && 1 / value < 0 ) ) { return { type : "UnaryExpression" , operator : "-" , prefix : true , argument : { type : "Literal" , value : - value } } } return { type : "Literal" , value : value } } ) ; def _to _moz ( AST _Atom , function To _Moz _Atom ( M ) { return { type : "Identifier" , name : String ( M . value ) } } ) ; AST _Boolean . DEFMETHOD ( "to_mozilla_ast" , AST _Constant . prototype . to _mozi