2014-10-29 20:17:44 +01: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 ) { for ( var i in ext ) if ( ext . hasOwnProperty ( i ) ) { obj [ i ] = ext [ i ] } return obj } 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 ( key , val ) { if ( ! this . has ( ke
2015-03-16 16:57:29 +01:00
function is _letter ( code ) { return code >= 97 && code <= 122 || code >= 65 && code <= 90 || code >= 170 && UNICODE . letter . test ( String . fromCharCode ( code ) ) } function is _digit ( code ) { return code >= 48 && code <= 57 } function is _alphanumeric _char ( code ) { return is _digit ( code ) || is _letter ( code ) } function is _unicode _combining _mark ( ch ) { return UNICODE . non _spacing _mark . test ( ch ) || UNICODE . space _combining _mark . test ( ch ) } function is _unicode _connector _punctuation ( ch ) { return UNICODE . connector _punctuation . test ( ch ) } function is _identifier ( name ) { return ! RESERVED _WORDS ( name ) && /^[a-z_$][a-z0-9_$]*$/i . test ( name ) } function is _identifier _start ( code ) { return code == 36 || code == 95 || is _letter ( code ) } function is _identifier _char ( ch ) { var code = ch . charCodeAt ( 0 ) ; return is _identifier _start ( code ) || is _digit ( code ) || code == 8204 || code == 8205 || is _unicode _combining _mark ( ch ) || is _unicode _connector _punctuation ( ch ) } function is _identifier _string ( str ) { return /^[a-z_$][a-z0-9_$]*$/i . test ( str ) } function parse _js _number ( num ) { if ( RE _HEX _NUMBER . test ( num ) ) { return parseInt ( num . substr ( 2 ) , 16 ) } else if ( RE _OCT _NUMBER . test ( num ) ) { return parseInt ( num . substr ( 1 ) , 8 ) } else if ( RE _DEC _NUMBER . test ( num ) ) { return parseFloat ( num ) } } function JS _Parse _Error ( message , line , col , pos ) { this . message = message ; this . line = line ; this . col = col ; this . pos = pos ; this . stack = ( new Error ) . stack } JS _Parse _Error . prototype . toString = function ( ) { return this . message + " (line: " + this . line + ", col: " + this . col + ", pos: " + this . pos + ")" + "\n\n" + this . stack } ; function js _error ( message , filename , line , col , pos ) { throw new JS _Parse _Error ( message , line , col , pos ) } function is _token ( token , type , val ) { return token . type == type && ( val == null || token . value == val ) } var EX _EOF = { } ; function tokenizer ( $TEXT , filename , html5 _comments ) { var S = { text : $TEXT . replace ( /\r\n?|[\n\u2028\u2029]/g , "\n" ) . replace ( /\uFEFF/g , "" ) , filename : filename , pos : 0 , tokpos : 0 , line : 1 , tokline : 0 , col : 0 , tokcol : 0 , newline _before : false , regex _allowed : false , comments _before : [ ] } ; function peek ( ) { return S . text . charAt ( S . pos ) } function next ( signal _eof , in _string ) { var ch = S . text . charAt ( S . pos ++ ) ; if ( signal _eof && ! ch ) throw EX _EOF ; if ( ch == "\n" ) { S . newline _before = S . newline _before || ! in _string ; ++ S . line ; S . col = 0 } else { ++ S . col } return ch } function forward ( i ) { while ( i -- > 0 ) next ( ) } function looking _at ( str ) { return S . text . substr ( S . pos , str . length ) == str } function find ( what , signal _eof ) { var pos = S . text . indexOf ( what , S . pos ) ; if ( signal _eof && pos == - 1 ) throw EX _EOF ; return pos } function start _token ( ) { S . tokline = S . line ; S . tokcol = S . col ; S . tokpos = S . pos } var prev _was _dot = false ; function token ( type , value , is _comment ) { S . regex _allowed = type == "operator" && ! UNARY _POSTFIX ( value ) || type == "keyword" && KEYWORDS _BEFORE _EXPRESSION ( value ) || type == "punc" && PUNC _BEFORE _EXPRESSION ( value ) ; prev _was _dot = type == "punc" && value == "." ; var ret = { type : type , value : value , line : S . tokline , col : S . tokcol , pos : S . tokpos , endpos : S . pos , nlb : S . newline _before , file : filename } ; if ( ! is _comment ) { ret . comments _before = S . comments _before ; S . comments _before = [ ] ; for ( var i = 0 , len = ret . comments _before . length ; i < len ; i ++ ) { ret . nlb = ret . nlb || ret . comments _before [ i ] . nlb } } S . newline _before = false ; return new AST _Token ( ret ) } function skip _whitespace ( ) { while ( WHITESPACE _CHARS ( peek ( ) ) ) next ( ) } function read _while ( pred ) { var ret = "" , ch , i = 0 ; while ( ( ch = peek ( ) ) && pred ( ch , i ++ ) ) ret += next ( ) ; return ret } function parse _error ( err ) { js _error ( err , filename , S . tokline , S . tokcol , S . tokpos ) } function read _num ( prefix ) { var has _e = false , after _e = false , has _x = false , has _dot = prefix == "." ; var num = read _while ( function ( ch , i ) { var code = ch . charCodeAt ( 0 ) ; switch ( code ) { case 120 : case 88 : return has _x ? false : has _x = true ; case 101 : case 69 : return has _x ? true : has _e ? false : has _e = after _e = true ; case 45 : return after _e || i == 0 && ! prefix ; case 43 : return after _e ; case after _e = false , 46 : return ! has _dot && ! has _x && ! has _e ? has _dot = true : false } return is _alphanumeric _char ( code ) } ) ; if ( prefix ) num = prefix + num ; var valid = parse _js _number ( num ) ; if ( ! isNaN ( valid ) ) { return token ( "num" , valid ) } else { parse _error ( "Invalid syntax: " + num ) } } function read _escaped _char ( in _string ) { var ch = next ( true , in _string ) ; switch ( ch . charCodeAt ( 0 ) ) { case 110 : return "\n" ; case 114 : return "\r" ; case 116 : return " " ; case 98 : return "\b" ; case 118 : return " " ; case 102 : return "\f" ; case 48 : return "\x00" ; case 120 : return String . fromCharCode ( hex _bytes
} ) ; AST _Toplevel . DEFMETHOD ( "_default_mangler_options" , function ( options ) { return defaults ( options , { except : [ ] , eval : false , sort : false , toplevel : false , screw _ie8 : false } ) } ) ; AST _Toplevel . DEFMETHOD ( "mangle_names" , function ( options ) { options = this . _default _mangler _options ( options ) ; var lname = - 1 ; var to _mangle = [ ] ; var tw = new TreeWalker ( function ( node , descend ) { if ( node instanceof AST _LabeledStatement ) { var save _nesting = lname ; descend ( ) ; lname = save _nesting ; return true } if ( node instanceof AST _Scope ) { var p = tw . parent ( ) , a = [ ] ; node . variables . each ( function ( symbol ) { if ( options . except . indexOf ( symbol . name ) < 0 ) { a . push ( symbol ) } } ) ; if ( options . sort ) a . sort ( function ( a , b ) { return b . references . length - a . references . length } ) ; to _mangle . push . apply ( to _mangle , a ) ; return } if ( node instanceof AST _Label ) { var name ; do name = base54 ( ++ lname ) ; while ( ! is _identifier ( name ) ) ; node . mangled _name = name ; return true } if ( options . screw _ie8 && node instanceof AST _SymbolCatch ) { to _mangle . push ( node . definition ( ) ) ; return } } ) ; this . walk ( tw ) ; to _mangle . forEach ( function ( def ) { def . mangle ( options ) } ) } ) ; AST _Toplevel . DEFMETHOD ( "compute_char_frequency" , function ( options ) { options = this . _default _mangler _options ( options ) ; var tw = new TreeWalker ( function ( node ) { if ( node instanceof AST _Constant ) base54 . consider ( node . print _to _string ( ) ) ; else if ( node instanceof AST _Return ) base54 . consider ( "return" ) ; else if ( node instanceof AST _Throw ) base54 . consider ( "throw" ) ; else if ( node instanceof AST _Continue ) base54 . consider ( "continue" ) ; else if ( node instanceof AST _Break ) base54 . consider ( "break" ) ; else if ( node instanceof AST _Debugger ) base54 . consider ( "debugger" ) ; else if ( node instanceof AST _Directive ) base54 . consider ( node . value ) ; else if ( node instanceof AST _While ) base54 . consider ( "while" ) ; else if ( node instanceof AST _Do ) base54 . consider ( "do while" ) ; else if ( node instanceof AST _If ) { base54 . consider ( "if" ) ; if ( node . alternative ) base54 . consider ( "else" ) } else if ( node instanceof AST _Var ) base54 . consider ( "var" ) ; else if ( node instanceof AST _Const ) base54 . consider ( "const" ) ; else if ( node instanceof AST _Lambda ) base54 . consider ( "function" ) ; else if ( node instanceof AST _For ) base54 . consider ( "for" ) ; else if ( node instanceof AST _ForIn ) base54 . consider ( "for in" ) ; else if ( node instanceof AST _Switch ) base54 . consider ( "switch" ) ; else if ( node instanceof AST _Case ) base54 . consider ( "case" ) ; else if ( node instanceof AST _Default ) base54 . consider ( "default" ) ; else if ( node instanceof AST _With ) base54 . consider ( "with" ) ; else if ( node instanceof AST _ObjectSetter ) base54 . consider ( "set" + node . key ) ; else if ( node instanceof AST _ObjectGetter ) base54 . consider ( "get" + node . key ) ; else if ( node instanceof AST _ObjectKeyVal ) base54 . consider ( node . key ) ; else if ( node instanceof AST _New ) base54 . consider ( "new" ) ; else if ( node instanceof AST _This ) base54 . consider ( "this" ) ; else if ( node instanceof AST _Try ) base54 . consider ( "try" ) ; else if ( node instanceof AST _Catch ) base54 . consider ( "catch" ) ; else if ( node instanceof AST _Finally ) base54 . consider ( "finally" ) ; else if ( node instanceof AST _Symbol && node . unmangleable ( options ) ) base54 . consider ( node . name ) ; else if ( node instanceof AST _Unary || node instanceof AST _Binary ) base54 . consider ( node . operator ) ; else if ( node instanceof AST _Dot ) base54 . consider ( node . property ) } ) ; this . walk ( tw ) ; base54 . sort ( ) } ) ; var base54 = function ( ) { var string = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789" ; var chars , frequency ; function reset ( ) { frequency = Object . create ( null ) ; chars = string . split ( "" ) . map ( function ( ch ) { return ch . charCodeAt ( 0 ) } ) ; chars . forEach ( function ( ch ) { frequency [ ch ] = 0 } ) } base54 . consider = function ( str ) { for ( var i = str . length ; -- i >= 0 ; ) { var code = str . charCodeAt ( i ) ; if ( code in frequency ) ++ frequency [ code ] } } ; base54 . sort = function ( ) { chars = mergeSort ( chars , function ( a , b ) { if ( is _digit ( a ) && ! is _digit ( b ) ) return 1 ; if ( is _digit ( b ) && ! is _digit ( a ) ) return - 1 ; return frequency [ b ] - frequency [ a ] } ) } ; base54 . reset = reset ; reset ( ) ; base54 . get = function ( ) { return chars } ; base54 . freq = function ( ) { return frequency } ; function base54 ( num ) { var ret = "" , base = 54 ; do { ret += String . fromCharCode ( chars [ num % base ] ) ; num = Math . floor ( num / base ) ; base = 64 } while ( num > 0 ) ; return ret } return base54 } ( ) ; AST _Toplevel . DEFMETHOD ( "scope_warnings" , function ( options ) { options = defaults ( options , { undeclared : false , unreferenced :
if ( thing instanceof AST _BlockStatement ) return thing . body ; if ( thing instanceof AST _EmptyStatement ) return [ ] ; if ( thing instanceof AST _Statement ) return [ thing ] ; throw new Error ( "Can't convert thing to statement array" ) } function is _empty ( thing ) { if ( thing === null ) return true ; if ( thing instanceof AST _EmptyStatement ) return true ; if ( thing instanceof AST _BlockStatement ) return thing . body . length == 0 ; return false } function loop _body ( x ) { if ( x instanceof AST _Switch ) return x ; if ( x instanceof AST _For || x instanceof AST _ForIn || x instanceof AST _DWLoop ) { return x . body instanceof AST _BlockStatement ? x . body : x } return x } function tighten _body ( statements , compressor ) { var CHANGED ; do { CHANGED = false ; if ( compressor . option ( "angular" ) ) { statements = process _for _angular ( statements ) } statements = eliminate _spurious _blocks ( statements ) ; if ( compressor . option ( "dead_code" ) ) { statements = eliminate _dead _code ( statements , compressor ) } if ( compressor . option ( "if_return" ) ) { statements = handle _if _return ( statements , compressor ) } if ( compressor . option ( "sequences" ) ) { statements = sequencesize ( statements , compressor ) } if ( compressor . option ( "join_vars" ) ) { statements = join _consecutive _vars ( statements , compressor ) } } while ( CHANGED ) ; if ( compressor . option ( "negate_iife" ) ) { negate _iifes ( statements , compressor ) } return statements ; function process _for _angular ( statements ) { function make _injector ( func , name ) { return make _node ( AST _SimpleStatement , func , { body : make _node ( AST _Assign , func , { operator : "=" , left : make _node ( AST _Dot , name , { expression : make _node ( AST _SymbolRef , name , name ) , property : "$inject" } ) , right : make _node ( AST _Array , func , { elements : func . argnames . map ( function ( sym ) { return make _node ( AST _String , sym , { value : sym . name } ) } ) } ) } ) } ) } return statements . reduce ( function ( a , stat ) { a . push ( stat ) ; var token = stat . start ; var comments = token . comments _before ; if ( comments && comments . length > 0 ) { var last = comments . pop ( ) ; if ( /@ngInject/ . test ( last . value ) ) { if ( stat instanceof AST _Defun ) { a . push ( make _injector ( stat , stat . name ) ) } else if ( stat instanceof AST _Definitions ) { stat . definitions . forEach ( function ( def ) { if ( def . value && def . value instanceof AST _Lambda ) { a . push ( make _injector ( def . value , def . name ) ) } } ) } else { compressor . warn ( "Unknown statement marked with @ngInject [{file}:{line},{col}]" , token ) } } } return a } , [ ] ) } function eliminate _spurious _blocks ( statements ) { var seen _dirs = [ ] ; return statements . reduce ( function ( a , stat ) { if ( stat instanceof AST _BlockStatement ) { CHANGED = true ; a . push . apply ( a , eliminate _spurious _blocks ( stat . body ) ) } else if ( stat instanceof AST _EmptyStatement ) { CHANGED = true } else if ( stat instanceof AST _Directive ) { if ( seen _dirs . indexOf ( stat . value ) < 0 ) { a . push ( stat ) ; seen _dirs . push ( stat . value ) } else { CHANGED = true } } else { a . push ( stat ) } return a } , [ ] ) } function handle _if _return ( statements , compressor ) { var self = compressor . self ( ) ; var in _lambda = self instanceof AST _Lambda ; var ret = [ ] ; loop : for ( var i = statements . length ; -- i >= 0 ; ) { var stat = statements [ i ] ; switch ( true ) { case in _lambda && stat instanceof AST _Return && ! stat . value && ret . length == 0 : CHANGED = true ; continue loop ; case stat instanceof AST _If : if ( stat . body instanceof AST _Return ) { if ( ( in _lambda && ret . length == 0 || ret [ 0 ] instanceof AST _Return && ! ret [ 0 ] . value ) && ! stat . body . value && ! stat . alternative ) { CHANGED = true ; var cond = make _node ( AST _SimpleStatement , stat . condition , { body : stat . condition } ) ; ret . unshift ( cond ) ; continue loop } if ( ret [ 0 ] instanceof AST _Return && stat . body . value && ret [ 0 ] . value && ! stat . alternative ) { CHANGED = true ; stat = stat . clone ( ) ; stat . alternative = ret [ 0 ] ; ret [ 0 ] = stat . transform ( compressor ) ; continue loop } if ( ( ret . length == 0 || ret [ 0 ] instanceof AST _Return ) && stat . body . value && ! stat . alternative && in _lambda ) { CHANGED = true ; stat = stat . clone ( ) ; stat . alternative = ret [ 0 ] || make _node ( AST _Return , stat , { value : make _node ( AST _Undefined , stat ) } ) ; ret [ 0 ] = stat . transform ( compressor ) ; continue loop } if ( ! stat . body . value && in _lambda ) { CHANGED = true ; stat = stat . clone ( ) ; stat . condition = stat . condition . negate ( compressor ) ; stat . body = make _node ( AST _BlockStatement , stat , { body : as _statement _array ( stat . alternative ) . concat ( ret ) } ) ; stat . alternative = null ; ret = [ stat . transform ( compressor ) ] ; continue loop } if ( ret . length == 1 && in _lambda && ret [ 0 ] instanceof AST _SimpleStatement && ( ! stat . alternative || stat . alternative instanceof AST _SimpleStatement ) ) { CHANGED = t
descend ( node , this ) ; return ruined ? node : make _node ( AST _BlockStatement , node , { body : node . body . reduce ( function ( a , branch ) { return a . concat ( branch . body ) } , [ ] ) } ) . transform ( compressor ) } else if ( node instanceof AST _If || node instanceof AST _Try ) { var save = in _if ; in _if = ! in _block ; descend ( node , this ) ; in _if = save ; return node } else if ( node instanceof AST _StatementWithBody || node instanceof AST _Switch ) { var save = in _block ; in _block = true ; descend ( node , this ) ; in _block = save ; return node } else if ( node instanceof AST _Break && this . loopcontrol _target ( node . label ) === self ) { if ( in _if ) { ruined = true ; return node } if ( in _block ) return node ; stopped = true ; return in _list ? MAP . skip : make _node ( AST _EmptyStatement , node ) } else if ( node instanceof AST _SwitchBranch && this . parent ( ) === self ) { if ( stopped ) return MAP . skip ; if ( node instanceof AST _Case ) { var exp = node . expression . evaluate ( compressor ) ; if ( exp . length < 2 ) { throw self } if ( exp [ 1 ] === value || started ) { started = true ; if ( aborts ( node ) ) stopped = true ; descend ( node , this ) ; return node } return MAP . skip } descend ( node , this ) ; return node } } ) ; tt . stack = compressor . stack . slice ( ) ; self = self . transform ( tt ) } catch ( ex ) { if ( ex !== self ) throw ex } return self } ) ; OPT ( AST _Case , function ( self , compressor ) { self . body = tighten _body ( self . body , compressor ) ; return self } ) ; OPT ( AST _Try , function ( self , compressor ) { self . body = tighten _body ( self . body , compressor ) ; return self } ) ; AST _Definitions . DEFMETHOD ( "remove_initializers" , function ( ) { this . definitions . forEach ( function ( def ) { def . value = null } ) } ) ; AST _Definitions . DEFMETHOD ( "to_assignments" , function ( ) { var assignments = this . definitions . reduce ( function ( a , def ) { if ( def . value ) { var name = make _node ( AST _SymbolRef , def . name , def . name ) ; a . push ( make _node ( AST _Assign , def , { operator : "=" , left : name , right : def . value } ) ) } return a } , [ ] ) ; if ( assignments . length == 0 ) return null ; return AST _Seq . from _array ( assignments ) } ) ; OPT ( AST _Definitions , function ( self , compressor ) { if ( self . definitions . length == 0 ) return make _node ( AST _EmptyStatement , self ) ; return self } ) ; OPT ( AST _Function , function ( self , compressor ) { self = AST _Lambda . prototype . optimize . call ( self , compressor ) ; if ( compressor . option ( "unused" ) ) { if ( self . name && self . name . unreferenced ( ) ) { self . name = null } } return self } ) ; OPT ( AST _Call , function ( self , compressor ) { if ( compressor . option ( "unsafe" ) ) { var exp = self . expression ; if ( exp instanceof AST _SymbolRef && exp . undeclared ( ) ) { switch ( exp . name ) { case "Array" : if ( self . args . length != 1 ) { return make _node ( AST _Array , self , { elements : self . args } ) . transform ( compressor ) } break ; case "Object" : if ( self . args . length == 0 ) { return make _node ( AST _Object , self , { properties : [ ] } ) } break ; case "String" : if ( self . args . length == 0 ) return make _node ( AST _String , self , { value : "" } ) ; if ( self . args . length <= 1 ) return make _node ( AST _Binary , self , { left : self . args [ 0 ] , operator : "+" , right : make _node ( AST _String , self , { value : "" } ) } ) . transform ( compressor ) ; break ; case "Number" : if ( self . args . length == 0 ) return make _node ( AST _Number , self , { value : 0 } ) ; if ( self . args . length == 1 ) return make _node ( AST _UnaryPrefix , self , { expression : self . args [ 0 ] , operator : "+" } ) . transform ( compressor ) ; case "Boolean" : if ( self . args . length == 0 ) return make _node ( AST _False , self ) ; if ( self . args . length == 1 ) return make _node ( AST _UnaryPrefix , self , { expression : make _node ( AST _UnaryPrefix , null , { expression : self . args [ 0 ] , operator : "!" } ) , operator : "!" } ) . transform ( compressor ) ; break ; case "Function" : if ( all ( self . args , function ( x ) { return x instanceof AST _String } ) ) { try { var code = "(function(" + self . args . slice ( 0 , - 1 ) . map ( function ( arg ) { return arg . value } ) . join ( "," ) + "){" + self . args [ self . args . length - 1 ] . value + "})()" ; var ast = parse ( code ) ; ast . figure _out _scope ( { screw _ie8 : compressor . option ( "screw_ie8" ) } ) ; var comp = new Compressor ( compressor . options ) ; ast = ast . transform ( comp ) ; ast . figure _out _scope ( { screw _ie8 : compressor . option ( "screw_ie8" ) } ) ; ast . mangle _names ( ) ; var fun ; try { ast . walk ( new TreeWalker ( function ( node ) { if ( node instanceof AST _Lambda ) { fun = node ; throw ast } } ) ) } catch ( ex ) { if ( ex !== ast ) throw ex } if ( ! fun ) return self ; var args = fun . argnames . map ( function ( arg , i ) { return make _node ( AST _String , self . args [ i ] , { value : arg . print _to _string ( ) } ) } ) ; var code = OutputStream ( ) ; AST _BlockStatement . prototype . _codegen . call ( fun , fun , code ) ; code = code . toString ( ) . replace ( /^\{|\}$/g , "" ) ; args . push ( make _node ( AST _String , self . args [ self . args . length - 1 ] , { v
exports [ "makePredicate" ] = makePredicate ; exports [ "all" ] = all ; exports [ "Dictionary" ] = Dictionary ; exports [ "DEFNODE" ] = DEFNODE ; exports [ "AST_Token" ] = AST _Token ; exports [ "AST_Node" ] = AST _Node ; exports [ "AST_Statement" ] = AST _Statement ; exports [ "AST_Debugger" ] = AST _Debugger ; exports [ "AST_Directive" ] = AST _Directive ; exports [ "AST_SimpleStatement" ] = AST _SimpleStatement ; exports [ "walk_body" ] = walk _body ; exports [ "AST_Block" ] = AST _Block ; exports [ "AST_BlockStatement" ] = AST _BlockStatement ; exports [ "AST_EmptyStatement" ] = AST _EmptyStatement ; exports [ "AST_StatementWithBody" ] = AST _StatementWithBody ; exports [ "AST_LabeledStatement" ] = AST _LabeledStatement ; exports [ "AST_IterationStatement" ] = AST _IterationStatement ; exports [ "AST_DWLoop" ] = AST _DWLoop ; exports [ "AST_Do" ] = AST _Do ; exports [ "AST_While" ] = AST _While ; exports [ "AST_For" ] = AST _For ; exports [ "AST_ForIn" ] = AST _ForIn ; exports [ "AST_With" ] = AST _With ; exports [ "AST_Scope" ] = AST _Scope ; exports [ "AST_Toplevel" ] = AST _Toplevel ; exports [ "AST_Lambda" ] = AST _Lambda ; exports [ "AST_Accessor" ] = AST _Accessor ; exports [ "AST_Function" ] = AST _Function ; exports [ "AST_Defun" ] = AST _Defun ; exports [ "AST_Jump" ] = AST _Jump ; exports [ "AST_Exit" ] = AST _Exit ; exports [ "AST_Return" ] = AST _Return ; exports [ "AST_Throw" ] = AST _Throw ; exports [ "AST_LoopControl" ] = AST _LoopControl ; exports [ "AST_Break" ] = AST _Break ; exports [ "AST_Continue" ] = AST _Continue ; exports [ "AST_If" ] = AST _If ; exports [ "AST_Switch" ] = AST _Switch ; exports [ "AST_SwitchBranch" ] = AST _SwitchBranch ; exports [ "AST_Default" ] = AST _Default ; exports [ "AST_Case" ] = AST _Case ; exports [ "AST_Try" ] = AST _Try ; exports [ "AST_Catch" ] = AST _Catch ; exports [ "AST_Finally" ] = AST _Finally ; exports [ "AST_Definitions" ] = AST _Definitions ; exports [ "AST_Var" ] = AST _Var ; exports [ "AST_Const" ] = AST _Const ; exports [ "AST_VarDef" ] = AST _VarDef ; exports [ "AST_Call" ] = AST _Call ; exports [ "AST_New" ] = AST _New ; exports [ "AST_Seq" ] = AST _Seq ; exports [ "AST_PropAccess" ] = AST _PropAccess ; exports [ "AST_Dot" ] = AST _Dot ; exports [ "AST_Sub" ] = AST _Sub ; exports [ "AST_Unary" ] = AST _Unary ; exports [ "AST_UnaryPrefix" ] = AST _UnaryPrefix ; exports [ "AST_UnaryPostfix" ] = AST _UnaryPostfix ; exports [ "AST_Binary" ] = AST _Binary ; exports [ "AST_Conditional" ] = AST _Conditional ; exports [ "AST_Assign" ] = AST _Assign ; exports [ "AST_Array" ] = AST _Array ; exports [ "AST_Object" ] = AST _Object ; exports [ "AST_ObjectProperty" ] = AST _ObjectProperty ; exports [ "AST_ObjectKeyVal" ] = AST _ObjectKeyVal ; exports [ "AST_ObjectSetter" ] = AST _ObjectSetter ; exports [ "AST_ObjectGetter" ] = AST _ObjectGetter ; exports [ "AST_Symbol" ] = AST _Symbol ; exports [ "AST_SymbolAccessor" ] = AST _SymbolAccessor ; exports [ "AST_SymbolDeclaration" ] = AST _SymbolDeclaration ; exports [ "AST_SymbolVar" ] = AST _SymbolVar ; exports [ "AST_SymbolConst" ] = AST _SymbolConst ; exports [ "AST_SymbolFunarg" ] = AST _SymbolFunarg ; exports [ "AST_SymbolDefun" ] = AST _SymbolDefun ; exports [ "AST_SymbolLambda" ] = AST _SymbolLambda ; exports [ "AST_SymbolCatch" ] = AST _SymbolCatch ; exports [ "AST_Label" ] = AST _Label ; exports [ "AST_SymbolRef" ] = AST _SymbolRef ; exports [ "AST_LabelRef" ] = AST _LabelRef ; exports [ "AST_This" ] = AST _This ; exports [ "AST_Constant" ] = AST _Constant ; exports [ "AST_String" ] = AST _String ; exports [ "AST_Number" ] = AST _Number ; exports [ "AST_RegExp" ] = AST _RegExp ; exports [ "AST_Atom" ] = AST _Atom ; exports [ "AST_Null" ] = AST _Null ; exports [ "AST_NaN" ] = AST _NaN ; exports [ "AST_Undefined" ] = AST _Undefined ; exports [ "AST_Hole" ] = AST _Hole ; exports [ "AST_Infinity" ] = AST _Infinity ; exports [ "AST_Boolean" ] = AST _Boolean ; exports [ "AST_False" ] = AST _False ; exports [ "AST_True" ] = AST _True ; exports [ "TreeWalker" ] = TreeWalker ; exports [ "KEYWORDS" ] = KEYWORDS ; exports [ "KEYWORDS_ATOM" ] = KEYWORDS _ATOM ; exports [ "RESERVED_WORDS" ] = RESERVED _WORDS ; exports [ "KEYWORDS_BEFORE_EXPRESSION" ] = KEYWORDS _BEFORE _EXPRESSION ; exports [ "OPERATOR_CHARS" ] = OPERATOR _CHARS ; exports [ "RE_HEX_NUMBER" ] = RE _HEX _NUMBER ; exports [ "RE_OCT_NUMBER" ] = RE _OCT _NUMBER ; exports [ "RE_DEC_NUMBER" ] = RE _DEC _NUMBER ; exports [ "OPERATORS" ] = OPERATORS ; exports [ "WHITESPACE_CHARS" ] = WHITESPACE _CHARS ; exports [ "PUNC_BEFORE_EXPRESSION" ] = PUNC _BEFORE _EXPRESSION ; exports [ "PUNC_CHARS" ] = PUNC _CHARS ; exports [ "REGEXP_MODIFIERS" ] = REGEXP _MODIFIERS ; exports [ "UNICODE" ] = UNICODE ; exports [ "is_letter" ] = is _letter ; exports [ "is_digit" ] = is _digit ; exports [ "is_alphanumeric_char" ] = is _alphanumeric _char ; exports [ "is_unicode_combining_mark" ] = is _unicode _combining _mark ; exports [ " is _unicode _connector _pu