"use strict";function Compressor(l,e){if(!(this instanceof Compressor))return new Compressor(l,e);TreeTransformer.call(this,this.before,this.after),this.options=defaults(l,{arrows:!e,booleans:!e,collapse_vars:!e,comparisons:!e,computed_props:!e,conditionals:!e,dead_code:!e,drop_console:!1,drop_debugger:!e,ecma:5,evaluate:!e,expression:!1,global_defs:{},hoist_funs:!1,hoist_props:!e,hoist_vars:!1,ie8:!1,if_return:!e,inline:!e,join_vars:!e,keep_classnames:!1,keep_fargs:!0,keep_fnames:!1,keep_infinity:!1,loops:!e,negate_iife:!e,passes:1,properties:!e,pure_getters:!e&&"strict",pure_funcs:null,reduce_funcs:!e,reduce_vars:!e,sequences:!e,side_effects:!e,switches:!e,top_retain:null,toplevel:!!(l&&l.top_retain),typeofs:!e,unsafe:!1,unsafe_arrows:!1,unsafe_comps:!1,unsafe_Function:!1,unsafe_math:!1,unsafe_methods:!1,unsafe_proto:!1,unsafe_regexp:!1,unsafe_undefined:!1,unused:!e,warnings:!1},!0);var t=this.options.global_defs;if("object"==typeof t)for(var o in t)/^@/.test(o)&&HOP(t,o)&&(t[o.slice(1)]=parse(t[o],{expression:!0}));!0===this.options.inline&&(this.options.inline=3);var i=this.options.pure_funcs;this.pure_funcs="function"==typeof i?i:i?function(t){return 0>i.indexOf(t.expression.print_to_string())}:return_true;var n=this.options.top_retain;n instanceof RegExp?this.top_retain=function(t){return n.test(t.name)}:"function"==typeof n?this.top_retain=n:n&&("string"==typeof n&&(n=n.split(/,/)),this.top_retain=function(t){return 0<=n.indexOf(t.name)});var r=this.options.toplevel;this.toplevel="string"==typeof r?{funcs:/funcs/.test(r),vars:/vars/.test(r)}:{funcs:r,vars:r};var a=this.options.sequences;this.sequences_limit=1==a?800:0|a,this.warnings_produced={}}Compressor.prototype=new TreeTransformer,merge(Compressor.prototype,{option:function(t){return this.options[t]},exposed:function(n){if(n.export)return!0;if(n.global)for(var e=0,t=n.orig.length;e1/o?te(AST_UnaryPrefix,e,{operator:"-",expression:te(AST_Number,e,{value:-o})}):te(AST_Number,e,{value:o}):0>o?te(AST_UnaryPrefix,e,{operator:"-",expression:te(AST_Infinity,e)}):te(AST_Infinity,e);case"boolean":return te(o?AST_True:AST_False,e);case"undefined":return te(AST_Undefined,e);default:if(null===o)return te(AST_Null,e,{value:null});if(o instanceof RegExp)return te(AST_RegExp,e,{value:o});throw new Error(string_template("Can't handle constant of type: {type}",{type:typeof o}));}}function J(n,e,t){return n instanceof AST_UnaryPrefix&&"delete"==n.operator||n instanceof AST_Call&&n.expression===e&&(t instanceof AST_PropAccess||t instanceof AST_SymbolRef&&"eval"==t.name)?W(e,[te(AST_Number,e,{value:0}),t]):t}function a(o,e){return e instanceof AST_Sequence?o.push.apply(o,e.expressions):o.push(e),o}function n(t){if(null===t)return[];if(t instanceof AST_BlockStatement)return t.body;if(t instanceof AST_EmptyStatement)return[];if(t instanceof AST_Statement)return[t];throw new Error("Can't convert thing to statement array")}function s(t){return null===t||!!(t instanceof AST_EmptyStatement)||!!(t instanceof AST_BlockStatement)&&0==t.body.length}function l(t){return!(t instanceof AST_DefClass||t instanceof AST_Defun||t instanceof AST_Let||t instanceof AST_Const||t instanceof AST_Export||t instanceof AST_Import)}function p(t){return t instanceof AST_IterationStatement?t.body instanceof AST_BlockStatement?t.body:t:t}function f(t){return"Call"==t.TYPE&&(t.expression instanceof AST_Function||f(t.expression))}function oe(t){return t instanceof AST_SymbolRef&&t.definition().undeclared}function d(t){return t instanceof AST_Infinity||t instanceof AST_NaN||t instanceof AST_Undefined}function i(o,e){function i(r,h){function n(n){if(n instanceof AST_Scope)return n;if(n instanceof AST_Switch){n.expression=n.expression.transform(E);for(var e,t=0,o=n.body.length;!V&&to)e.args.length=z(e.args.length,t.length-1);else{var i=e.args;i[o]&&(i[o]=te(AST_Number,i[o],{value:0}))}return!0}var a=!1;return r[b].transform(new TreeTransformer(function(t,e,o){return a?t:t===n||t.body===n?(a=!0,t instanceof AST_VarDef?(t.value=null,t):o?MAP.skip:null):void 0},function(t){if(t instanceof AST_Sequence)switch(t.expressions.length){case 0:return null;case 1:return t.expressions[0];}}))}function _(t){return!(t instanceof AST_Unary)&&p(t).has_side_effects(h)}function u(o){var e=o.definition();return!(1==e.orig.length&&e.orig[0]instanceof AST_SymbolDefun)&&(e.scope.get_defun_scope()!==x||!all(e.references,function(t){return t.scope.get_defun_scope()===x}))}function g(o,e){if(o instanceof AST_Assign)return g(o.left,!0);if(o instanceof AST_Unary)return g(o.expression,!0);if(o instanceof AST_VarDef)return o.value&&g(o.value);if(e){if(o instanceof AST_Dot)return g(o.expression,!0);if(o instanceof AST_Sub)return g(o.expression,!0);if(o instanceof AST_SymbolRef)return o.definition().scope!==x}return!1}if(x.uses_eval||x.uses_with)return r;for(var m,v=[],y=h.self()instanceof AST_Try,b=r.length,E=new TreeTransformer(function(r){if(V)return r;if(!S)return r===z[k]?(k++,kA)A=!1;else{V=!1,k=0,S=P;for(var B=b;!V&&Bt.indexOf(e.value)?(o++,t.push(e.value)):(w=!0,i.splice(o,1)):o++}function s(d,e){function t(i){for(var e,t=0,o=i.length;0<=--o;)if(e=i[o],e instanceof AST_If&&e.body instanceof AST_Return&&1<++t)return!0;return!1}function z(t){return!t||t instanceof AST_UnaryPrefix&&"void"==t.operator}function o(t){if(!t)return!1;for(var o,n=g+1,i=d.length;nr.length)){for(var o,s=[],l=0,p=0,n=r.length;p=e.sequences_limit&&t();var i=o.body;0e.option("ecma")&&e.has_directive("use strict")&&!all(t.value.properties,function(t){return t.key!=l&&t.key.name!=l}))break;t.value.properties.push(te(AST_ObjectKeyVal,a,{key:l,value:a.right})),o.shift(),i=!0}while(o.length);return i&&o}}}}function y(a){function e(e){a[++n]=r;var t=v(s,e);return t?(w=!0,t.length?W(e,t):e instanceof AST_Sequence?e.tail_node().left:e.left):e}for(var t,o=0,n=-1,i=a.length;oe.print_to_string().length?e:o}function g(o,e){return u(te(AST_SimpleStatement,o,{body:o}),te(AST_SimpleStatement,e,{body:e})).body}function ne(n,e,t){return(first_in_statement(n)?g:u)(e,t)}function h(o){for(var e in o)o[e]=makePredicate(o[e])}function m(t){return t&&t.aborts()}function v(r,s){function e(t){return t instanceof AST_Break&&s.loopcontrol_target(t)===s.self()}function t(e){e=n(e),r.body instanceof AST_BlockStatement?(r.body=r.body.clone(),r.body.body=e.concat(r.body.body.slice(1)),r.body=r.body.transform(s)):r.body=te(AST_BlockStatement,r.body,{body:e}).transform(s),r=v(r,s)}var o=r.body instanceof AST_BlockStatement?r.body.body[0]:r.body;if(s.option("dead_code")&&e(o)){var i=[];return r.init instanceof AST_Statement?i.push(r.init):r.init&&i.push(te(AST_SimpleStatement,r.init,{body:r.init})),r.condition&&i.push(te(AST_SimpleStatement,r.condition,{body:r.condition})),c(s,r.body,i),te(AST_BlockStatement,r,{body:i})}return o instanceof AST_If&&(e(o.body)?(r.condition=r.condition?te(AST_Binary,r.condition,{left:r.condition,operator:"&&",right:o.condition.negate(s)}):o.condition.negate(s),t(o.alternative)):e(o.alternative)&&(r.condition=r.condition?te(AST_Binary,r.condition,{left:r.condition,operator:"&&",right:o.condition}):o.condition,t(o.body))),r}function y(t){return t instanceof AST_Array||t instanceof AST_Lambda||t instanceof AST_Object||t instanceof AST_Class}function w(r,e){for(var t,o=0;t=r.parent(o);o++)if(t instanceof AST_Lambda){var n=t.name;if(n&&n.definition()===e)break}return t}function b(o,e){return o instanceof AST_SymbolRef||o.TYPE===e.TYPE}function x(a,r){var s=!1,e=new TreeWalker(function(t){return!!s||(t instanceof AST_SymbolRef&&member(t.definition(),r)?s=!0:void 0)}),o=new TreeWalker(function(n){if(s)return!0;if(n instanceof AST_Scope&&n!==a){var t=o.parent();return t instanceof AST_Call&&t.expression===n?void 0:(n.walk(e),!0)}});return a.walk(o),s}function e(o,e){return e.in_boolean_context()?ne(e,o,W(o,[o,te(AST_True,o)]).optimize(e)):o}function E(o,e){if(!e.option("computed_props"))return o;if(!(o.key instanceof AST_Constant))return o;if(o.key instanceof AST_String||o.key instanceof AST_Number){if("constructor"==o.key.value&&e.parent()instanceof AST_Class)return o;o.key=o instanceof AST_ObjectKeyVal?o.key.value:te(AST_SymbolMethod,o.key,{name:o.key.value})}return o}var z=Math.min;G(AST_Node,function(t){return t}),AST_Node.DEFMETHOD("equivalent_to",function(t){return this.TYPE==t.TYPE&&this.print_to_string()==t.print_to_string()}),AST_Scope.DEFMETHOD("process_expression",function(r,e){var t=this,o=new TreeTransformer(function(i){if(r&&i instanceof AST_SimpleStatement)return te(AST_Return,i,{value:i.body});if(!r&&i instanceof AST_Return){if(e){var n=i.value&&i.value.drop_side_effect_free(e,!0);return n?te(AST_SimpleStatement,i,{body:n}):te(AST_EmptyStatement,i)}return te(AST_SimpleStatement,i,{body:i.value||te(AST_UnaryPrefix,i,{operator:"void",expression:te(AST_Number,i,{value:0})})})}if(i instanceof AST_Class||i instanceof AST_Lambda&&i!==t)return i;if(i instanceof AST_Block){var a=i.body.length-1;0<=a&&(i.body[a]=i.body[a].transform(o))}else i instanceof AST_If?(i.body=i.body.transform(o),i.alternative&&(i.alternative=i.alternative.transform(o))):i instanceof AST_With&&(i.body=i.body.transform(o));return i});t.transform(o)}),function(s){function v(o,e){e.assignments=0,e.chained=!1,e.direct_access=!1,e.escaped=!1,e.fixed=!(e.scope.uses_eval||e.scope.uses_with)&&(e.orig[0]instanceof AST_SymbolConst||!o.exposed(e))&&e.init,e.recursive_refs=0,e.references=[],e.should_replace=void 0,e.single_use=void 0}function b(t,e,o){o.variables.each(function(o){v(e,o),null===o.fixed?(o.safe_ids=t.safe_ids,a(t,o,!0)):o.fixed&&(t.loop_ids[o.id]=t.in_loop,a(t,o,!0))})}function x(t,e){e.block_scope&&e.block_scope.variables.each(function(e){v(t,e)})}function E(t){t.safe_ids=Object.create(t.safe_ids)}function n(t){t.safe_ids=Object.getPrototypeOf(t.safe_ids)}function a(n,e,t){n.safe_ids[e.id]=t}function l(n,e){if(n.safe_ids[e.id]){if(null==e.fixed){var t=e.orig[0];if(t instanceof AST_SymbolFunarg||"arguments"==t.name)return!1;e.fixed=te(AST_Undefined,t)}return!0}return e.fixed instanceof AST_Defun}function p(n,e,t){return void 0===e.fixed||(null===e.fixed&&e.safe_ids?(e.safe_ids[e.id]=!1,delete e.safe_ids,!0):!!HOP(n.safe_ids,e.id)&&!!l(n,e)&&!1!==e.fixed&&(null==e.fixed||t&&!(e.references.length>e.assignments))&&all(e.orig,function(t){return!(t instanceof AST_SymbolConst||t instanceof AST_SymbolDefun||t instanceof AST_SymbolLambda)}))}function f(n,e,t){return e.option("unused")&&!t.scope.uses_eval&&!t.scope.uses_with&&1==t.references.length-t.recursive_refs&&n.loop_ids[t.id]===n.in_loop}function c(t){return!!t&&(t.is_constant()||t instanceof AST_Lambda||t instanceof AST_This)}function z(i,e){if(e=_(e),!(e instanceof AST_Node)){var t;if(i instanceof AST_Array){var o=i.elements;if("length"==e)return r(o.length,i);"number"==typeof e&&e in o&&(t=o[e])}else if(i instanceof AST_Object){e=""+e;for(var n,r=i.properties,a=r.length;0<=--a;){if(n=r[a],!(n instanceof AST_ObjectKeyVal))return;t||r[a].key!==e||(t=r[a].value)}}return t instanceof AST_SymbolRef&&t.fixed_value()||t}}function u(s,e,t,o,i){var n=s.parent(o);if(Z(e,n)||!i&&n instanceof AST_Call&&n.expression===e&&!(t instanceof AST_Arrow)&&!(t instanceof AST_Class)&&(!(t instanceof AST_Function)||!(n instanceof AST_New)&&t.contains_this()))return!0;if(n instanceof AST_Array)return u(s,n,n,o+1);if(n instanceof AST_ObjectKeyVal&&e===n.value){var r=s.parent(o+1);return u(s,r,r,o+2)}return n instanceof AST_PropAccess&&n.expression===e?!i&&u(s,n,z(t,n.property),o+1):void 0}function g(p,e,t,o,i,n,r){var a=p.parent(n);if(i){if(i.is_constant())return;if(i instanceof AST_ClassExpression)return}if(a instanceof AST_Assign&&"="==a.operator&&o===a.right||a instanceof AST_Call&&o!==a.expression||a instanceof AST_Exit&&o===a.value&&o.scope!==e.scope||a instanceof AST_VarDef&&o===a.value||a instanceof AST_Yield&&o===a.value&&o.scope!==e.scope)return 1r)&&(e.escaped=r));if(a instanceof AST_Array||a instanceof AST_Await||a instanceof AST_Binary&&O(a.operator)||a instanceof AST_Conditional&&o!==a.condition||a instanceof AST_Expansion||a instanceof AST_Sequence&&o===a.tail_node())g(p,e,t,a,a,n+1,r);else if(a instanceof AST_ObjectKeyVal&&o===a.value){var s=p.parent(n+1);g(p,e,t,s,s,n+2,r)}else if(a instanceof AST_PropAccess&&o===a.expression&&(i=z(i,a.property),g(p,e,t,a,i,n+1,r+1),i))return;0==n&&(e.direct_access=!0)}function e(o,e,t){this.inlined=!1;var i=o.safe_ids;return o.safe_ids=Object.create(null),b(o,t,this),e(),o.safe_ids=i,!0}function t(r,e,t){var l=this;l.inlined=!1,E(r),b(r,t,l);var i;return!l.name&&(i=r.parent())instanceof AST_Call&&i.expression===l&&l.argnames.forEach(function(e,t){if(e.definition){var o=e.definition();l.uses_arguments||void 0!==o.fixed?o.fixed=!1:(o.fixed=function(){return i.args[t]||te(AST_Undefined,i)},r.loop_ids[o.id]=r.in_loop,a(r,o,!0))}}),e(),n(r),!0}s(AST_Node,noop);var d=new TreeWalker(function(o){if(o instanceof AST_Symbol){var e=o.definition();e&&(o instanceof AST_SymbolRef&&e.references.push(o),e.fixed=!1)}});s(AST_Accessor,function(o,e,t){return E(o),b(o,t,this),e(),n(o),!0}),s(AST_Arrow,t),s(AST_Assign,function(n){var e=this;if(e.left instanceof AST_Destructuring)return void e.left.walk(d);if(e.left instanceof AST_SymbolRef){var t=e.left.definition(),o=t.fixed;if(o||"="==e.operator)return p(n,t,e.right)?(t.references.push(e.left),t.assignments++,"="!=e.operator&&(t.chained=!0),t.fixed="="==e.operator?function(){return e.right}:function(){return te(AST_Binary,e,{operator:e.operator.slice(0,-1),left:o instanceof AST_Node?o:o(),right:e.right})},a(n,t,!1),e.right.walk(n),a(n,t,!0),!0):void 0}}),s(AST_Binary,function(t){if(O(this.operator))return this.left.walk(t),E(t),this.right.walk(t),n(t),!0}),s(AST_Block,function(n,e,t){x(t,this)}),s(AST_ClassExpression,function(o,e){return this.inlined=!1,E(o),e(),n(o),!0}),s(AST_Conditional,function(t){return this.condition.walk(t),E(t),this.consequent.walk(t),n(t),E(t),this.alternative.walk(t),n(t),!0}),s(AST_DefClass,e),s(AST_Defun,e),s(AST_Do,function(i,e,t){x(t,this);var o=i.in_loop;return i.in_loop=this,E(i),this.body.walk(i),this.condition.walk(i),n(i),i.in_loop=o,!0}),s(AST_For,function(i,e,t){x(t,this),this.init&&this.init.walk(i);var o=i.in_loop;return i.in_loop=this,this.condition&&(E(i),this.condition.walk(i),n(i)),E(i),this.body.walk(i),n(i),this.step&&(E(i),this.step.walk(i),n(i)),i.in_loop=o,!0}),s(AST_ForIn,function(i,e,t){x(t,this),this.init.walk(d),this.object.walk(i);var o=i.in_loop;return i.in_loop=this,E(i),this.body.walk(i),n(i),i.in_loop=o,!0}),s(AST_Function,t),s(AST_If,function(t){return this.condition.walk(t),E(t),this.body.walk(t),n(t),this.alternative&&(E(t),this.alternative.walk(t),n(t)),!0}),s(AST_LabeledStatement,function(t){return E(t),this.body.walk(t),n(t),!0}),s(AST_SwitchBranch,function(o,e){return E(o),e(),n(o),!0}),s(AST_SymbolCatch,function(){this.definition().fixed=!1}),s(AST_SymbolRef,function(r,e,t){var o=this.definition();o.references.push(this),1==o.references.length&&!o.fixed&&o.orig[0]instanceof AST_SymbolDefun&&(r.loop_ids[o.id]=r.in_loop);var i;void 0!==o.fixed&&l(r,o)&&"m"!=o.single_use?o.fixed&&(i=this.fixed_value(),i instanceof AST_Lambda&&w(r,o)?o.recursive_refs++:i&&!t.exposed(o)&&f(r,t,o)?o.single_use=i instanceof AST_Lambda||i instanceof AST_Class||o.scope===this.scope&&i.is_constant_expression():o.single_use=!1,u(r,this,i,0,c(i))&&(o.single_use?o.single_use="m":o.fixed=!1)):o.fixed=!1,g(r,o,this.scope,this,i,0,1)}),s(AST_Toplevel,function(t,e,o){this.globals.each(function(t){v(o,t)}),b(t,o,this)}),s(AST_Try,function(i,e,t){return x(t,this),E(i),walk_body(this,i),n(i),this.bcatch&&(E(i),this.bcatch.walk(i),n(i)),this.bfinally&&this.bfinally.walk(i),!0}),s(AST_Unary,function(n){var e=this;if(("++"==e.operator||"--"==e.operator)&&e.expression instanceof AST_SymbolRef){var t=e.expression.definition(),o=t.fixed;if(o)return p(n,t,!0)?(t.references.push(e.expression),t.assignments++,t.chained=!0,t.fixed=function(){return te(AST_Binary,e,{operator:e.operator.slice(0,-1),left:te(AST_UnaryPrefix,e,{operator:"+",expression:o instanceof AST_Node?o:o()}),right:te(AST_Number,e,{value:1})})},a(n,t,!0),!0):void 0}}),s(AST_VarDef,function(n,e){var t=this;if(t.name instanceof AST_Destructuring)return void t.name.walk(d);var o=t.name.definition();if(t.value){if(p(n,o,t.value))return o.fixed=function(){return t.value},n.loop_ids[o.id]=n.in_loop,a(n,o,!1),e(),a(n,o,!0),!0;o.fixed=!1}}),s(AST_While,function(i,e,t){x(t,this);var o=i.in_loop;return i.in_loop=this,E(i),this.condition.walk(i),this.body.walk(i),n(i),i.in_loop=o,!0})}(function(o,e){o.DEFMETHOD("reduce_vars",e)}),AST_Toplevel.DEFMETHOD("reset_opt_flags",function(r){var e=r.option("reduce_vars"),t=new TreeWalker(function(o,i){if(o._squeezed=!1,o._optimized=!1,e)return o.reduce_vars(t,i,r)});t.safe_ids=Object.create(null),t.in_loop=null,t.loop_ids=Object.create(null),this.walk(t)}),AST_Symbol.DEFMETHOD("fixed_value",function(){var t=this.definition().fixed;return!t||t instanceof AST_Node?t:t()}),AST_SymbolRef.DEFMETHOD("is_immutable",function(){var t=this.definition().orig;return 1==t.length&&t[0]instanceof AST_SymbolLambda});var k=makePredicate("Array Boolean clearInterval clearTimeout console Date decodeURI decodeURIComponent encodeURI encodeURIComponent Error escape eval EvalError Function isFinite isNaN JSON Math Number parseFloat parseInt RangeError ReferenceError RegExp Object setInterval setTimeout String SyntaxError TypeError unescape URIError");AST_SymbolRef.DEFMETHOD("is_declared",function(t){return!this.definition().undeclared||t.option("unsafe")&&k(this.name)});var D=makePredicate("Infinity NaN undefined");(function(o){function n(t){return /strict/.test(t.option("pure_getters"))}AST_Node.DEFMETHOD("may_throw_on_access",function(t){return!t.option("pure_getters")||this._dot_throw(t)}),o(AST_Node,n),o(AST_Null,return_true),o(AST_Undefined,return_true),o(AST_Constant,return_false),o(AST_Array,return_false),o(AST_Object,function(t){if(!n(t))return!1;for(var e=this.properties.length;0<=--e;)if(this.properties[e]._dot_throw(t))return!0;return!1}),o(AST_ObjectProperty,return_false),o(AST_ObjectGetter,return_true),o(AST_Expansion,function(t){return this.expression._dot_throw(t)}),o(AST_Function,return_false),o(AST_Arrow,return_false),o(AST_UnaryPostfix,return_false),o(AST_UnaryPrefix,function(){return"void"==this.operator}),o(AST_Binary,function(t){return("&&"==this.operator||"||"==this.operator)&&(this.left._dot_throw(t)||this.right._dot_throw(t))}),o(AST_Assign,function(t){return"="==this.operator&&this.right._dot_throw(t)}),o(AST_Conditional,function(t){return this.consequent._dot_throw(t)||this.alternative._dot_throw(t)}),o(AST_Dot,function(t){return!!n(t)&&!(this.expression instanceof AST_Function&&"prototype"==this.property)}),o(AST_Sequence,function(t){return this.tail_node()._dot_throw(t)}),o(AST_SymbolRef,function(t){if(this.is_undefined)return!0;if(!n(t))return!1;if(oe(this)&&this.is_declared(t))return!1;if(this.is_immutable())return!1;var e=this.fixed_value();return!e||e._dot_throw(t)})})(function(o,e){o.DEFMETHOD("_dot_throw",e)}),function(n){var e=["!","delete"],t=["in","instanceof","==","!=","===","!==","<","<=",">=",">"];n(AST_Node,return_false),n(AST_UnaryPrefix,function(){return member(this.operator,e)}),n(AST_Binary,function(){return member(this.operator,t)||O(this.operator)&&this.left.is_boolean()&&this.right.is_boolean()}),n(AST_Conditional,function(){return this.consequent.is_boolean()&&this.alternative.is_boolean()}),n(AST_Assign,function(){return"="==this.operator&&this.right.is_boolean()}),n(AST_Sequence,function(){return this.tail_node().is_boolean()}),n(AST_True,return_true),n(AST_False,return_true)}(function(o,e){o.DEFMETHOD("is_boolean",e)}),function(n){n(AST_Node,return_false),n(AST_Number,return_true);var e=makePredicate("+ - ~ ++ --");n(AST_Unary,function(){return e(this.operator)});var t=makePredicate("- * / % & | ^ << >> >>>");n(AST_Binary,function(o){return t(this.operator)||"+"==this.operator&&this.left.is_number(o)&&this.right.is_number(o)}),n(AST_Assign,function(o){return t(this.operator.slice(0,-1))||"="==this.operator&&this.right.is_number(o)}),n(AST_Sequence,function(t){return this.tail_node().is_number(t)}),n(AST_Conditional,function(t){return this.consequent.is_number(t)&&this.alternative.is_number(t)})}(function(o,e){o.DEFMETHOD("is_number",e)}),function(t){t(AST_Node,return_false),t(AST_String,return_true),t(AST_TemplateString,function(){return 1===this.segments.length}),t(AST_UnaryPrefix,function(){return"typeof"==this.operator}),t(AST_Binary,function(t){return"+"==this.operator&&(this.left.is_string(t)||this.right.is_string(t))}),t(AST_Assign,function(t){return("="==this.operator||"+="==this.operator)&&this.right.is_string(t)}),t(AST_Sequence,function(t){return this.tail_node().is_string(t)}),t(AST_Conditional,function(t){return this.consequent.is_string(t)&&this.alternative.is_string(t)})}(function(o,e){o.DEFMETHOD("is_string",e)});var O=makePredicate("&& ||"),q=makePredicate("delete ++ --");(function(o){function s(t,a){if(t instanceof AST_Node)return te(t.CTOR,a,t);if(Array.isArray(t))return te(AST_Array,a,{elements:t.map(function(t){return s(t,a)})});if(t&&"object"==typeof t){var e=[];for(var o in t)HOP(t,o)&&e.push(te(AST_ObjectKeyVal,a,{key:o,value:s(t[o],a)}));return te(AST_Object,a,{properties:e})}return r(t,a)}AST_Node.DEFMETHOD("resolve_defines",function(r){if(r.option("global_defs")){var e=this._find_defs(r,"");if(e){var t,o=this,i=0;do t=o,o=r.parent(i++);while(o instanceof AST_PropAccess&&o.expression===t);if(Z(t,o))r.warn("global_defs "+this.print_to_string()+" redefined [{file}:{line},{col}]",this.start);else return e}}}),o(AST_Node,noop),o(AST_Dot,function(o,e){return this.expression._find_defs(o,"."+this.property+e)}),o(AST_SymbolRef,function(t,e){if(this.global()){var o,i=t.option("global_defs");if(i&&HOP(i,o=this.name+e)){var n=s(i[o],this),r=t.find_parent(AST_Toplevel);return n.walk(new TreeWalker(function(t){t instanceof AST_SymbolRef&&(t.scope=r,t.thedef=r.def_global(t))})),n}}})})(function(o,e){o.DEFMETHOD("_find_defs",e)});var T=["constructor","toString","valueOf"],F={Array:["indexOf","join","lastIndexOf","slice"].concat(T),Boolean:T,Number:["toExponential","toFixed","toPrecision"].concat(T),Object:T,RegExp:["test"].concat(T),String:["charAt","charCodeAt","concat","indexOf","italics","lastIndexOf","match","replace","search","slice","split","substr","substring","toLowerCase","toUpperCase","trim"].concat(T)};h(F);var M={Array:["isArray"],Math:["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan","atan2","pow","max","min"],Number:["isFinite","isNaN"],Object:["create","getOwnPropertyDescriptor","getOwnPropertyNames","getPrototypeOf","isExtensible","isFrozen","isSealed","keys"],String:["fromCharCode"]};h(M),function(n){AST_Node.DEFMETHOD("evaluate",function(o){if(!o.option("evaluate"))return this;var e=this._eval(o,1);return!e||e instanceof RegExp||"object"!=typeof e?e:this});var e=makePredicate("! ~ - + void");AST_Node.DEFMETHOD("is_constant",function(){return this instanceof AST_Constant?!(this instanceof AST_RegExp):this instanceof AST_UnaryPrefix&&this.expression instanceof AST_Constant&&e(this.operator)}),n(AST_Statement,function(){throw new Error(string_template("Cannot evaluate a statement [{file}:{line},{col}]",this.start))}),n(AST_Lambda,return_this),n(AST_Class,return_this),n(AST_Node,return_this),n(AST_Constant,function(){return this.getValue()}),n(AST_TemplateString,function(){return 1===this.segments.length?this.segments[0].value:this}),n(AST_Array,function(s,e){if(s.option("unsafe")){for(var t,o=[],n=0,r=this.elements.length;n>":i=t>>o;break;case">>>":i=t>>>o;break;case"==":i=t==o;break;case"===":i=t===o;break;case"!=":i=t!=o;break;case"!==":i=t!==o;break;case"<":i=t":i=t>o;break;case">=":i=t>=o;break;default:return this;}return isNaN(i)&&r.find_parent(AST_With)?this:i}),n(AST_Conditional,function(r,e){var t=this.condition._eval(r,e);if(t===this.condition)return this;var o=t?this.consequent:this.alternative,i=o._eval(r,e);return i===o?this:i}),n(AST_SymbolRef,function(r,e){var t=this.fixed_value();if(!t)return this;var o;if(HOP(t,"_eval"))o=t._eval();else{if(this._eval=return_this,o=t._eval(r,e),delete this._eval,o===t)return this;t._eval=function(){return o}}if(o&&"object"==typeof o){var i=this.definition().escaped;if(i&&e>i)return this}return o});var t={Array:Array,Math:Math,Number:Number,Object:Object,String:String},o={Math:["E","LN10","LN2","LOG2E","LOG10E","PI","SQRT1_2","SQRT2"],Number:["MAX_VALUE","MIN_VALUE","NaN","NEGATIVE_INFINITY","POSITIVE_INFINITY"]};h(o),n(AST_PropAccess,function(i,e){if(i.option("unsafe")){var s=this.property;if(s instanceof AST_Node&&(s=s._eval(i,e),s===this.property))return this;var n,r=this.expression;if(oe(r)){if(!(o[r.name]||return_false)(s))return this;n=t[r.name]}else if(n=r._eval(i,e+1),!n||n===r||!HOP(n,s))return this;return n[s]}return this}),n(AST_Call,function(o,c){var n=this.expression;if(o.option("unsafe")&&n instanceof AST_PropAccess){var r=n.property;if(r instanceof AST_Node&&(r=r._eval(o,c),r===n.property))return this;var a,s=n.expression;if(oe(s)){if(!(M[s.name]||return_false)(r))return this;a=t[s.name]}else if(a=s._eval(o,c+1),a===s||!(a&&F[a.constructor.name]||return_false)(r))return this;for(var l=[],e=0,p=this.args.length;e=":return o.operator="<",o;case">":return o.operator="<=",o;}return"=="===n?(o.operator="!=",o):"!="===n?(o.operator="==",o):"==="===n?(o.operator="!==",o):"!=="===n?(o.operator="===",o):"&&"===n?(o.operator="||",o.left=o.left.negate(t,e),o.right=o.right.negate(t),a(this,o,e)):"||"===n?(o.operator="&&",o.left=o.left.negate(t,e),o.right=o.right.negate(t),a(this,o,e)):s(this)})}(function(o,n){o.DEFMETHOD("negate",function(t,e){return n.call(this,t,e)})});var H=makePredicate("Boolean decodeURI decodeURIComponent Date encodeURI encodeURIComponent Error escape EvalError isFinite isNaN Number Object parseFloat parseInt RangeError ReferenceError String SyntaxError TypeError unescape URIError");AST_Call.DEFMETHOD("is_expr_pure",function(o){if(o.option("unsafe")){var e=this.expression;if(oe(e)&&H(e.name))return!0;if(e instanceof AST_Dot&&oe(e.expression)&&(M[e.expression.name]||return_false)(e.property))return!0}return this.pure||!o.pure_funcs(this)}),AST_Node.DEFMETHOD("is_call_pure",return_false),AST_Dot.DEFMETHOD("is_call_pure",function(n){if(n.option("unsafe")){var e=this.expression,t=return_false;return e instanceof AST_Array?t=F.Array:e.is_boolean()?t=F.Boolean:e.is_number(n)?t=F.Number:e instanceof AST_RegExp?t=F.RegExp:e.is_string(n)?t=F.String:!this.may_throw_on_access(n)&&(t=F.Object),t(this.property)}}),function(o){function n(n,e){for(var t=n.length;0<=--t;)if(n[t].has_side_effects(e))return!0;return!1}o(AST_Node,return_true),o(AST_EmptyStatement,return_false),o(AST_Constant,return_false),o(AST_This,return_false),o(AST_Block,function(t){return n(this.body,t)}),o(AST_Call,function(t){return!(this.is_expr_pure(t)||this.expression.is_call_pure(t)&&!this.expression.has_side_effects(t))||n(this.args,t)}),o(AST_Switch,function(t){return this.expression.has_side_effects(t)||n(this.body,t)}),o(AST_Case,function(t){return this.expression.has_side_effects(t)||n(this.body,t)}),o(AST_Try,function(t){return n(this.body,t)||this.bcatch&&this.bcatch.has_side_effects(t)||this.bfinally&&this.bfinally.has_side_effects(t)}),o(AST_If,function(t){return this.condition.has_side_effects(t)||this.body&&this.body.has_side_effects(t)||this.alternative&&this.alternative.has_side_effects(t)}),o(AST_LabeledStatement,function(t){return this.body.has_side_effects(t)}),o(AST_SimpleStatement,function(t){return this.body.has_side_effects(t)}),o(AST_Lambda,return_false),o(AST_Class,return_false),o(AST_DefClass,return_true),o(AST_Binary,function(t){return this.left.has_side_effects(t)||this.right.has_side_effects(t)}),o(AST_Assign,return_true),o(AST_Conditional,function(t){return this.condition.has_side_effects(t)||this.consequent.has_side_effects(t)||this.alternative.has_side_effects(t)}),o(AST_Unary,function(t){return q(this.operator)||this.expression.has_side_effects(t)}),o(AST_SymbolRef,function(t){return!this.is_declared(t)}),o(AST_SymbolDeclaration,return_false),o(AST_Object,function(t){return n(this.properties,t)}),o(AST_ObjectProperty,function(t){return!!(this.key instanceof AST_ObjectKeyVal&&this.key.has_side_effects(t))||this.value.has_side_effects(t)}),o(AST_Array,function(t){return n(this.elements,t)}),o(AST_Dot,function(t){return this.expression.may_throw_on_access(t)||this.expression.has_side_effects(t)}),o(AST_Sub,function(t){return this.expression.may_throw_on_access(t)||this.expression.has_side_effects(t)||this.property.has_side_effects(t)}),o(AST_Sequence,function(t){return n(this.expressions,t)}),o(AST_Definitions,function(t){return n(this.definitions,t)}),o(AST_VarDef,function(){return this.value}),o(AST_TemplateSegment,return_false),o(AST_TemplateString,function(t){return n(this.segments,t)})}(function(o,e){o.DEFMETHOD("has_side_effects",e)}),function(o){function n(n,e){for(var t=n.length;0<=--t;)if(n[t].may_throw(e))return!0;return!1}o(AST_Node,return_true),o(AST_Class,return_false),o(AST_Constant,return_false),o(AST_EmptyStatement,return_false),o(AST_Lambda,return_false),o(AST_SymbolDeclaration,return_false),o(AST_This,return_false),o(AST_Array,function(t){return n(this.elements,t)}),o(AST_Assign,function(t){return!!this.right.may_throw(t)||(t.has_directive("use strict")||"="!=this.operator||!(this.left instanceof AST_SymbolRef))&&this.left.may_throw(t)}),o(AST_Binary,function(t){return this.left.may_throw(t)||this.right.may_throw(t)}),o(AST_Block,function(t){return n(this.body,t)}),o(AST_Call,function(t){return!!n(this.args,t)||!this.is_expr_pure(t)&&(!!this.expression.may_throw(t)||!(this.expression instanceof AST_Lambda)||n(this.expression.body,t))}),o(AST_Case,function(t){return this.expression.may_throw(t)||n(this.body,t)}),o(AST_Conditional,function(t){return this.condition.may_throw(t)||this.consequent.may_throw(t)||this.alternative.may_throw(t)}),o(AST_Definitions,function(t){return n(this.definitions,t)}),o(AST_Dot,function(t){return this.expression.may_throw_on_access(t)||this.expression.may_throw(t)}),o(AST_If,function(t){return this.condition.may_throw(t)||this.body&&this.body.may_throw(t)||this.alternative&&this.alternative.may_throw(t)}),o(AST_LabeledStatement,function(t){return this.body.may_throw(t)}),o(AST_Object,function(t){return n(this.properties,t)}),o(AST_ObjectProperty,function(t){return this.value.may_throw(t)}),o(AST_Sequence,function(t){return n(this.expressions,t)}),o(AST_SimpleStatement,function(t){return this.body.may_throw(t)}),o(AST_Sub,function(t){return this.expression.may_throw_on_access(t)||this.expression.may_throw(t)||this.property.may_throw(t)}),o(AST_Switch,function(t){return this.expression.may_throw(t)||n(this.body,t)}),o(AST_SymbolRef,function(t){return!this.is_declared(t)}),o(AST_Try,function(t){return n(this.body,t)||this.bcatch&&this.bcatch.may_throw(t)||this.bfinally&&this.bfinally.may_throw(t)}),o(AST_Unary,function(t){return!("typeof"==this.operator&&this.expression instanceof AST_SymbolRef)&&this.expression.may_throw(t)}),o(AST_VarDef,function(t){return!!this.value&&this.value.may_throw(t)})}(function(o,e){o.DEFMETHOD("may_throw",e)}),function(n){function e(o){for(var e=o.length;0<=--e;)if(!o[e].is_constant_expression())return!1;return!0}function t(a){var e=this,t=!0;return e.walk(new TreeWalker(function(o){if(!t)return!0;if(o instanceof AST_SymbolRef){if(e.inlined)return t=!1,!0;var i=o.definition();if(member(i,e.enclosed)&&!e.variables.has(i.name)){if(a){var n=a.find_variable(o);if(i.undeclared?!n:n===i)return t="f",!0}t=!1}return!0}return o instanceof AST_This&&e instanceof AST_Arrow?(t=!1,!0):void 0})),t}n(AST_Node,return_false),n(AST_Constant,return_true),n(AST_Class,t),n(AST_Lambda,t),n(AST_Unary,function(){return this.expression.is_constant_expression()}),n(AST_Binary,function(){return this.left.is_constant_expression()&&this.right.is_constant_expression()}),n(AST_Array,function(){return e(this.elements)}),n(AST_Object,function(){return e(this.properties)}),n(AST_ObjectProperty,function(){return!(this.key instanceof AST_Node)&&this.value.is_constant_expression()})}(function(o,e){o.DEFMETHOD("is_constant_expression",e)}),function(o){function e(){var t=this.body.length;return 0o.eliminated)){if(r.warn("Dropping duplicated definition of variable {name} [{file}:{line},{col}]",u(t.name)),t.value){var n=te(AST_SymbolRef,t.name,t.name);o.references.push(n);var s=te(AST_Assign,t,{operator:"=",left:n,right:t.value});d[o.id]===t&&(d[o.id]=s),q.push(s.transform(y))}return remove(i,t),void o.eliminated++}}t.value?(0g.option("inline"))return 1==t&&o(n);n=null;for(var i,r=0;r=o;)t.push(u.args[n]);for(n=o;0<=--n;){var r=_.argnames[n],i=u.args[n];if(r.__unused||!r.name||B.var_names()[r.name])i&&t.push(i);else{var a=te(AST_SymbolVar,r,r);r.definition().orig.push(a),!i&&L&&(i=te(AST_Undefined,u)),k(e,t,a,i)}}e.reverse(),t.reverse()}function p(r,e){for(var t,o=e.length,n=0,a=_.body.length;n=_.argnames.length;if(z||_.argnames[b].__unused){var i=u.args[b].drop_side_effect_free(g);if(i)u.args[v++]=i;else if(!z){u.args[v++]=te(AST_Number,u.args[b],{value:0});continue}}else u.args[v++]=u.args[b];y=v}u.args.length=y}if(g.option("unsafe"))if(oe(c))switch(c.name){case"Array":if(1!=u.args.length)return te(AST_Array,u,{elements:u.args}).optimize(g);break;case"Object":if(0==u.args.length)return te(AST_Object,u,{properties:[]});break;case"String":if(0==u.args.length)return te(AST_String,u,{value:""});if(1>=u.args.length)return te(AST_Binary,u,{left:u.args[0],operator:"+",right:te(AST_String,u,{value:""})}).optimize(g);break;case"Number":if(0==u.args.length)return te(AST_Number,u,{value:0});if(1==u.args.length)return te(AST_UnaryPrefix,u,{expression:u.args[0],operator:"+"}).optimize(g);case"Boolean":if(0==u.args.length)return te(AST_False,u);if(1==u.args.length)return te(AST_UnaryPrefix,u,{expression:te(AST_UnaryPrefix,u,{expression:u.args[0],operator:"!"}),operator:"!"}).optimize(g);break;case"RegExp":var D=[];if(all(u.args,function(o){var e=o.evaluate(g);return D.unshift(e),o!==e}))try{return ne(g,u,te(AST_RegExp,u,{value:RegExp.apply(RegExp,D)}))}catch(e){g.warn("Error converting {expr} [{file}:{line},{col}]",{expr:u.print_to_string(),file:u.start.file,line:u.start.line,col:u.start.col})}break;case"Symbol":return u.args=[],u;}else if(c instanceof AST_Dot)switch(c.property){case"toString":if(0==u.args.length&&!c.expression.may_throw_on_access(g))return te(AST_Binary,u,{left:te(AST_String,u,{value:""}),operator:"+",right:c.expression}).optimize(g);break;case"join":if(c.expression instanceof AST_Array)EXIT:{var O;if(0=PRECEDENCE[a.operator])&&t(),a=a.lift_sequences(e),e.option("comparisons"))switch(a.operator){case"===":case"!==":(a.left.is_string(e)&&a.right.is_string(e)||a.left.is_number(e)&&a.right.is_number(e)||a.left.is_boolean()&&a.right.is_boolean()||a.left.equivalent_to(a.right))&&(a.operator=a.operator.substr(0,2));case"==":case"!=":if(e.option("typeofs")&&a.left instanceof AST_String&&"undefined"==a.left.value&&a.right instanceof AST_UnaryPrefix&&"typeof"==a.right.operator){var i=a.right.expression;(i instanceof AST_SymbolRef?i.is_declared(e):!(i instanceof AST_PropAccess&&e.option("ie8")))&&(a.right=i,a.left=te(AST_Undefined,a.left).optimize(e),2==a.operator.length&&(a.operator+="="))}else if(a.left instanceof AST_SymbolRef&&a.right instanceof AST_SymbolRef&&a.left.definition()===a.right.definition()&&y(a.left.fixed_value()))return te("="==a.operator[0]?AST_True:AST_False,a);break;case"&&":case"||":var n=a.left;if(n.operator==a.operator&&(n=n.right),n instanceof AST_Binary&&n.operator==("&&"==a.operator?"!==":"===")&&a.right instanceof AST_Binary&&n.operator==a.right.operator&&(o(n.left,e)&&a.right.left instanceof AST_Null||n.left instanceof AST_Null&&o(a.right.left,e))&&!n.right.has_side_effects(e)&&n.right.equivalent_to(a.right.right)){var l=te(AST_Binary,a,{operator:n.operator.slice(0,-1),left:te(AST_Null,a),right:n.right});return n!==a.left&&(l=te(AST_Binary,a,{operator:a.operator,left:a.left.left,right:l})),l}}if("+"==a.operator&&e.in_boolean_context()){var p=a.left.evaluate(e),d=a.right.evaluate(e);if(p&&"string"==typeof p)return e.warn("+ in boolean context always true [{file}:{line},{col}]",a.start),W(a,[a.right,te(AST_True,a)]).optimize(e);if(d&&"string"==typeof d)return e.warn("+ in boolean context always true [{file}:{line},{col}]",a.start),W(a,[a.left,te(AST_True,a)]).optimize(e)}if(e.option("comparisons")&&a.is_boolean()){if(!(e.parent()instanceof AST_Binary)||e.parent()instanceof AST_Assign){var f=te(AST_UnaryPrefix,a,{operator:"!",expression:a.negate(e,first_in_statement(e))});a=ne(e,a,f)}if(e.option("unsafe_comps"))switch(a.operator){case"<":t(">");break;case"<=":t(">=");}}if("+"==a.operator){if(a.right instanceof AST_String&&""==a.right.getValue()&&a.left.is_string(e))return a.left;if(a.left instanceof AST_String&&""==a.left.getValue()&&a.right.is_string(e))return a.right;if(a.left instanceof AST_Binary&&"+"==a.left.operator&&a.left.left instanceof AST_String&&""==a.left.left.getValue()&&a.right.is_string(e))return a.left=a.left.right,a.transform(e)}if(e.option("evaluate")){switch(a.operator){case"&&":var p=!!a.left.truthy||!a.left.falsy&&a.left.evaluate(e);if(!p)return e.warn("Condition left of && always false [{file}:{line},{col}]",a.start),J(e.parent(),e.self(),a.left).optimize(e);if(!(p instanceof AST_Node))return e.warn("Condition left of && always true [{file}:{line},{col}]",a.start),W(a,[a.left,a.right]).optimize(e);var d=a.right.evaluate(e);if(!d){if(e.in_boolean_context())return e.warn("Boolean && always false [{file}:{line},{col}]",a.start),W(a,[a.left,te(AST_False,a)]).optimize(e);a.falsy=!0}else if(!(d instanceof AST_Node)){var c=e.parent();if("&&"==c.operator&&c.left===e.self()||e.in_boolean_context())return e.warn("Dropping side-effect-free && [{file}:{line},{col}]",a.start),a.left.optimize(e)}if("||"==a.left.operator){var _=a.left.right.evaluate(e);if(!_)return te(AST_Conditional,a,{condition:a.left.left,consequent:a.right,alternative:a.left.right}).optimize(e)}break;case"||":var p=!!a.left.truthy||!a.left.falsy&&a.left.evaluate(e);if(!p)return e.warn("Condition left of || always false [{file}:{line},{col}]",a.start),W(a,[a.left,a.right]).optimize(e);if(!(p instanceof AST_Node))return e.warn("Condition left of || always true [{file}:{line},{col}]",a.start),J(e.parent(),e.self(),a.left).optimize(e);var d=a.right.evaluate(e);if(!d){var c=e.parent();if("||"==c.operator&&c.left===e.self()||e.in_boolean_context())return e.warn("Dropping side-effect-free || [{file}:{line},{col}]",a.start),a.left.optimize(e)}else if(!(d instanceof AST_Node)){if(e.in_boolean_context())return e.warn("Boolean || always true [{file}:{line},{col}]",a.start),W(a,[a.left,te(AST_True,a)]).optimize(e);a.truthy=!0}if("&&"==a.left.operator){var _=a.left.right.evaluate(e);if(_&&!(_ instanceof AST_Node))return te(AST_Conditional,a,{condition:a.left.left,consequent:a.left.right,alternative:a.right}).optimize(e)}}var u=!0;switch(a.operator){case"+":if(a.left instanceof AST_Constant&&a.right instanceof AST_Binary&&"+"==a.right.operator&&a.right.left instanceof AST_Constant&&a.right.is_string(e)&&(a=te(AST_Binary,a,{operator:"+",left:te(AST_String,a.left,{value:""+a.left.getValue()+a.right.left.getValue(),start:a.left.start,end:a.right.left.end}),right:a.right.right})),a.right instanceof AST_Constant&&a.left instanceof AST_Binary&&"+"==a.left.operator&&a.left.right instanceof AST_Constant&&a.left.is_string(e)&&(a=te(AST_Binary,a,{operator:"+",left:a.left.left,right:te(AST_String,a.right,{value:""+a.left.right.getValue()+a.right.getValue(),start:a.left.right.start,end:a.right.end})})),a.left instanceof AST_Binary&&"+"==a.left.operator&&a.left.is_string(e)&&a.left.right instanceof AST_Constant&&a.right instanceof AST_Binary&&"+"==a.right.operator&&a.right.left instanceof AST_Constant&&a.right.is_string(e)&&(a=te(AST_Binary,a,{operator:"+",left:te(AST_Binary,a.left,{operator:"+",left:a.left.left,right:te(AST_String,a.left.right,{value:""+a.left.right.getValue()+a.right.left.getValue(),start:a.left.right.start,end:a.right.left.end})}),right:a.right.right})),a.right instanceof AST_UnaryPrefix&&"-"==a.right.operator&&a.left.is_number(e)){a=te(AST_Binary,a,{operator:"-",left:a.left,right:a.right.expression});break}if(a.left instanceof AST_UnaryPrefix&&"-"==a.left.operator&&s()&&a.right.is_number(e)){a=te(AST_Binary,a,{operator:"-",left:a.right,right:a.left.expression});break}case"*":u=e.option("unsafe_math");case"&":case"|":case"^":if(a.left.is_number(e)&&a.right.is_number(e)&&s()&&!(a.left instanceof AST_Binary&&a.left.operator!=a.operator&&PRECEDENCE[a.left.operator]>=PRECEDENCE[a.operator])){var g=te(AST_Binary,a,{operator:a.operator,left:a.right,right:a.left});a=a.right instanceof AST_Constant&&!(a.left instanceof AST_Constant)?ne(e,g,a):ne(e,a,g)}u&&a.is_number(e)&&(a.right instanceof AST_Binary&&a.right.operator==a.operator&&(a=te(AST_Binary,a,{operator:a.operator,left:te(AST_Binary,a.left,{operator:a.operator,left:a.left,right:a.right.left,start:a.left.start,end:a.right.left.end}),right:a.right.right})),a.right instanceof AST_Constant&&a.left instanceof AST_Binary&&a.left.operator==a.operator&&(a.left.left instanceof AST_Constant?a=te(AST_Binary,a,{operator:a.operator,left:te(AST_Binary,a.left,{operator:a.operator,left:a.left.left,right:a.right,start:a.left.left.start,end:a.right.end}),right:a.left.right}):a.left.right instanceof AST_Constant&&(a=te(AST_Binary,a,{operator:a.operator,left:te(AST_Binary,a.left,{operator:a.operator,left:a.left.right,right:a.right,start:a.left.right.start,end:a.right.end}),right:a.left.left}))),a.left instanceof AST_Binary&&a.left.operator==a.operator&&a.left.right instanceof AST_Constant&&a.right instanceof AST_Binary&&a.right.operator==a.operator&&a.right.left instanceof AST_Constant&&(a=te(AST_Binary,a,{operator:a.operator,left:te(AST_Binary,a.left,{operator:a.operator,left:te(AST_Binary,a.left.left,{operator:a.operator,left:a.left.right,right:a.right.left,start:a.left.right.start,end:a.right.left.end}),right:a.left.left}),right:a.right.right})));}}if(a.right instanceof AST_Binary&&a.right.operator==a.operator&&(O(a.operator)||"+"==a.operator&&(a.right.left.is_string(e)||a.left.is_string(e)&&a.right.right.is_string(e))))return a.left=te(AST_Binary,a.left,{operator:a.operator,left:a.left,right:a.right.left}),a.right=a.right.right,a.transform(e);var h=a.evaluate(e);return h===a?a:(h=r(h,a).optimize(e),ne(e,h,a))}),G(AST_SymbolExport,function(t){return t}),G(AST_SymbolRef,function(t,s){function e(o){var n;return o.walk(new TreeWalker(function(t){if(t instanceof AST_SymbolRef&&(n=!0),n)return!0})),n}var o=t.resolve_defines(s);if(o)return o.optimize(s);if(!s.option("ie8")&&oe(t)&&(!t.scope.uses_with||!s.find_parent(AST_With)))switch(t.name){case"undefined":return te(AST_Undefined,t).optimize(s);case"NaN":return te(AST_NaN,t).optimize(s);case"Infinity":return te(AST_Infinity,t).optimize(s);}if(s.option("reduce_vars")&&Z(t,s.parent())!==t){var n=t.definition(),i=t.fixed_value(),a=n.single_use;if(a&&(i instanceof AST_Lambda||i instanceof AST_Class))if(n.scope!==t.scope&&(!s.option("reduce_funcs")&&i instanceof AST_Lambda||1==n.escaped||i.inlined))a=!1;else if(w(s,n))a=!1;else if((n.scope!==t.scope||n.orig[0]instanceof AST_SymbolFunarg)&&(a=i.is_constant_expression(t.scope),"f"==a)){var l=t.scope;do(l instanceof AST_Defun||$(l))&&(l.inlined=!0);while(l=l.parent_scope)}if(a&&i){i instanceof AST_DefClass&&(i=te(AST_ClassExpression,i,i)),i instanceof AST_Defun&&(i._squeezed=!0,i=te(AST_Function,i,i));var p;if(0>","<<",">>>","|","^","&"],I=["*","|","^","&"];G(AST_Assign,function(l,e){function t(t,o){for(var i,n=l.left.definition().scope;(i=e.parent(t++))!==n;)if(i instanceof AST_Try){if(i.bfinally)return!0;if(o&&i.bcatch)return!0}}var o;if(e.option("dead_code")&&l.left instanceof AST_SymbolRef&&(o=l.left.definition()).scope===e.find_parent(AST_Lambda)){var i,n=0,r=l;do if(i=r,r=e.parent(n++),r instanceof AST_Exit){if(t(n,r instanceof AST_Throw))break;if(x(o.scope,[o]))break;return"="==l.operator?l.right:(o.fixed=!1,te(AST_Binary,l,{operator:l.operator.slice(0,-1),left:l.left,right:l.right}).optimize(e))}while(r instanceof AST_Binary&&r.right===i||r instanceof AST_Sequence&&r.tail_node()===i)}return l=l.lift_sequences(e),"="==l.operator&&l.left instanceof AST_SymbolRef&&l.right instanceof AST_Binary&&(l.right.left instanceof AST_SymbolRef&&l.right.left.name==l.left.name&&member(l.right.operator,j)?(l.operator=l.right.operator+"=",l.right=l.right.right):l.right.right instanceof AST_SymbolRef&&l.right.right.name==l.left.name&&member(l.right.operator,I)&&!l.right.left.has_side_effects(e)&&(l.operator=l.right.operator+"=",l.right=l.right.left)),l}),G(AST_DefaultAssign,function(n,e){if(!e.option("evaluate"))return n;var t=n.right.evaluate(e);return void 0===t?n=n.left:t!==n.right&&(t=r(t,n.right),n.right=u(t,n.right)),n}),G(AST_Conditional,function(r,a){function e(t){return t.is_boolean()?t:te(AST_UnaryPrefix,t,{operator:"!",expression:t.negate(a)})}function t(t){return t instanceof AST_True||_&&t instanceof AST_Constant&&t.getValue()||t instanceof AST_UnaryPrefix&&"!"==t.operator&&t.expression instanceof AST_Constant&&!t.expression.getValue()}function o(t){return t instanceof AST_False||_&&t instanceof AST_Constant&&!t.getValue()||t instanceof AST_UnaryPrefix&&"!"==t.operator&&t.expression instanceof AST_Constant&&t.expression.getValue()}if(!a.option("conditionals"))return r;if(r.condition instanceof AST_Sequence){var n=r.condition.expressions.slice();return r.condition=n.pop(),n.push(r),W(r,n)}var i=r.condition.evaluate(a);if(i!==r.condition)return i?(a.warn("Condition always true [{file}:{line},{col}]",r.start),J(a.parent(),a.self(),r.consequent)):(a.warn("Condition always false [{file}:{line},{col}]",r.start),J(a.parent(),a.self(),r.alternative));var s=i.negate(a,first_in_statement(a));ne(a,i,s)===s&&(r=te(AST_Conditional,r,{condition:s,consequent:r.alternative,alternative:r.consequent}));var l=r.condition,p=r.consequent,d=r.alternative;if(l instanceof AST_SymbolRef&&p instanceof AST_SymbolRef&&l.definition()===p.definition())return te(AST_Binary,r,{operator:"||",left:l,right:d});if(p instanceof AST_Assign&&d instanceof AST_Assign&&p.operator==d.operator&&p.left.equivalent_to(d.left)&&(!r.condition.has_side_effects(a)||"="==p.operator&&!p.left.has_side_effects(a)))return te(AST_Assign,r,{operator:p.operator,left:p.left,right:te(AST_Conditional,r,{condition:r.condition,consequent:p.right,alternative:d.right})});var f;if(p instanceof AST_Call&&d.TYPE===p.TYPE&&0d;)s=f[u].drop_side_effect_free(e),s&&(_.unshift(s),c&&s.has_side_effects(e)&&(c=!1));var g=f[d];if(g instanceof AST_Expansion)break FLATTEN;for(g=g instanceof AST_Hole?te(AST_Undefined,g):g,c||_.unshift(g);0<=--u;){var s=f[u];if(s instanceof AST_Expansion)break FLATTEN;s=s.drop_side_effect_free(e),s?_.unshift(s):d--}return c?(_.push(g),W(a,_).optimize(e)):te(AST_Sub,a,{expression:te(AST_Array,t,{elements:_}),property:te(AST_Number,o,{value:d})})}}var i=a.evaluate(e);return i===a?a:(i=r(i,a).optimize(e),ne(e,i,a))}),AST_Lambda.DEFMETHOD("contains_this",function(){var n,e=this;return e.walk(new TreeWalker(function(t){return!!n||(t instanceof AST_This?n=!0:t!==e&&t instanceof AST_Scope&&!(t instanceof AST_Arrow)||void 0)})),n}),AST_PropAccess.DEFMETHOD("flatten_object",function(r,e){if(e.option("properties")){var t=e.option("unsafe_arrows")&&6<=e.option("ecma"),o=this.expression;if(o instanceof AST_Object)for(var n,a=o.properties,s=a.length;0<=--s;)if(n=a[s],""+(n instanceof AST_ConciseMethod?n.key.name:n.key)==r){if(!all(a,function(o){return o instanceof AST_ObjectKeyVal||t&&o instanceof AST_ConciseMethod&&!o.is_generator}))break;var l=n.value;if((l instanceof AST_Accessor||l instanceof AST_Function)&&!(e.parent()instanceof AST_New)&&l.contains_this())break;return te(AST_Sub,this,{expression:te(AST_Array,o,{elements:a.map(function(n){var e=n.value;e instanceof AST_Accessor&&(e=te(AST_Function,e,e));var t=n.key;return t instanceof AST_Node&&!(t instanceof AST_SymbolMethod)?W(n,[t,e]):e})}),property:te(AST_Number,this,{value:s})})}}}),G(AST_Dot,function(s,e){("arguments"==s.property||"caller"==s.property)&&e.warn("Function.protoype.{prop} not supported [{file}:{line},{col}]",{prop:s.property,file:s.start.file,line:s.start.line,col:s.start.col});var t=s.resolve_defines(e);if(t)return t.optimize(e);if(Z(s,e.parent()))return s;if(e.option("unsafe_proto")&&s.expression instanceof AST_Dot&&"prototype"==s.expression.property){var o=s.expression.expression;if(oe(o))switch(o.name){case"Array":s.expression=te(AST_Array,s.expression,{elements:[]});break;case"Function":s.expression=te(AST_Function,s.expression,{argnames:[],body:[]});break;case"Number":s.expression=te(AST_Number,s.expression,{value:0});break;case"Object":s.expression=te(AST_Object,s.expression,{properties:[]});break;case"RegExp":s.expression=te(AST_RegExp,s.expression,{value:/t/});break;case"String":s.expression=te(AST_String,s.expression,{value:""});}}var i=s.flatten_object(s.property,e);if(i)return i.optimize(e);var n=s.evaluate(e);return n===s?s:(n=r(n,s).optimize(e),ne(e,n,s))}),G(AST_Array,e),G(AST_Object,e),G(AST_RegExp,e),G(AST_Return,function(n,e){return n.value&&o(n.value,e)&&(n.value=null),n}),G(AST_Arrow,function(n,e){if(n.body instanceof AST_Node||i(n.body,e),e.option("arrows")&&1==n.body.length&&n.body[0]instanceof AST_Return){var t=n.body[0].value;n.body=t?t:[]}return n}),G(AST_Function,function(n,e){if(i(n.body,e),e.option("unsafe_arrows")&&6<=e.option("ecma")&&!n.name&&!n.is_generator&&!n.uses_arguments&&!n.uses_eval){var t=!1;if(n.walk(new TreeWalker(function(o){return!!t||(o instanceof AST_This?(t=!0,!0):void 0)})),!t)return te(AST_Arrow,n,n).optimize(e)}return n}),G(AST_Class,function(t){return t}),G(AST_Yield,function(n,e){return n.expression&&!n.is_star&&o(n.expression,e)&&(n.expression=null),n}),G(AST_VarDef,function(n,e){var t=e.option("global_defs");return t&&HOP(t,n.name.name)&&e.warn("global_defs "+n.name.name+" redefined [{file}:{line},{col}]",n.start),n}),G(AST_TemplateString,function(r,e){if(!e.option("evaluate")||e.parent()instanceof AST_PrefixedTemplateString)return r;for(var t,o=[],n=0;n