UNPKG

707 kBJavaScriptView Raw
1(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
2(function (global){
3"use strict";
4
5_dereq_(295);
6
7_dereq_(296);
8
9_dereq_(2);
10
11/* eslint max-len: 0 */
12
13if (global._babelPolyfill) {
14 throw new Error("only one instance of babel-polyfill is allowed");
15}
16global._babelPolyfill = true;
17
18// Should be removed in the next major release:
19
20var DEFINE_PROPERTY = "defineProperty";
21function define(O, key, value) {
22 O[key] || Object[DEFINE_PROPERTY](O, key, {
23 writable: true,
24 configurable: true,
25 value: value
26 });
27}
28
29define(String.prototype, "padLeft", "".padStart);
30define(String.prototype, "padRight", "".padEnd);
31
32"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function (key) {
33 [][key] && define(Array, key, Function.call.bind([][key]));
34});
35}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
36},{"2":2,"295":295,"296":296}],2:[function(_dereq_,module,exports){
37_dereq_(119);
38module.exports = _dereq_(23).RegExp.escape;
39},{"119":119,"23":23}],3:[function(_dereq_,module,exports){
40module.exports = function(it){
41 if(typeof it != 'function')throw TypeError(it + ' is not a function!');
42 return it;
43};
44},{}],4:[function(_dereq_,module,exports){
45var cof = _dereq_(18);
46module.exports = function(it, msg){
47 if(typeof it != 'number' && cof(it) != 'Number')throw TypeError(msg);
48 return +it;
49};
50},{"18":18}],5:[function(_dereq_,module,exports){
51// 22.1.3.31 Array.prototype[@@unscopables]
52var UNSCOPABLES = _dereq_(117)('unscopables')
53 , ArrayProto = Array.prototype;
54if(ArrayProto[UNSCOPABLES] == undefined)_dereq_(40)(ArrayProto, UNSCOPABLES, {});
55module.exports = function(key){
56 ArrayProto[UNSCOPABLES][key] = true;
57};
58},{"117":117,"40":40}],6:[function(_dereq_,module,exports){
59module.exports = function(it, Constructor, name, forbiddenField){
60 if(!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)){
61 throw TypeError(name + ': incorrect invocation!');
62 } return it;
63};
64},{}],7:[function(_dereq_,module,exports){
65var isObject = _dereq_(49);
66module.exports = function(it){
67 if(!isObject(it))throw TypeError(it + ' is not an object!');
68 return it;
69};
70},{"49":49}],8:[function(_dereq_,module,exports){
71// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
72'use strict';
73var toObject = _dereq_(109)
74 , toIndex = _dereq_(105)
75 , toLength = _dereq_(108);
76
77module.exports = [].copyWithin || function copyWithin(target/*= 0*/, start/*= 0, end = @length*/){
78 var O = toObject(this)
79 , len = toLength(O.length)
80 , to = toIndex(target, len)
81 , from = toIndex(start, len)
82 , end = arguments.length > 2 ? arguments[2] : undefined
83 , count = Math.min((end === undefined ? len : toIndex(end, len)) - from, len - to)
84 , inc = 1;
85 if(from < to && to < from + count){
86 inc = -1;
87 from += count - 1;
88 to += count - 1;
89 }
90 while(count-- > 0){
91 if(from in O)O[to] = O[from];
92 else delete O[to];
93 to += inc;
94 from += inc;
95 } return O;
96};
97},{"105":105,"108":108,"109":109}],9:[function(_dereq_,module,exports){
98// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
99'use strict';
100var toObject = _dereq_(109)
101 , toIndex = _dereq_(105)
102 , toLength = _dereq_(108);
103module.exports = function fill(value /*, start = 0, end = @length */){
104 var O = toObject(this)
105 , length = toLength(O.length)
106 , aLen = arguments.length
107 , index = toIndex(aLen > 1 ? arguments[1] : undefined, length)
108 , end = aLen > 2 ? arguments[2] : undefined
109 , endPos = end === undefined ? length : toIndex(end, length);
110 while(endPos > index)O[index++] = value;
111 return O;
112};
113},{"105":105,"108":108,"109":109}],10:[function(_dereq_,module,exports){
114var forOf = _dereq_(37);
115
116module.exports = function(iter, ITERATOR){
117 var result = [];
118 forOf(iter, false, result.push, result, ITERATOR);
119 return result;
120};
121
122},{"37":37}],11:[function(_dereq_,module,exports){
123// false -> Array#indexOf
124// true -> Array#includes
125var toIObject = _dereq_(107)
126 , toLength = _dereq_(108)
127 , toIndex = _dereq_(105);
128module.exports = function(IS_INCLUDES){
129 return function($this, el, fromIndex){
130 var O = toIObject($this)
131 , length = toLength(O.length)
132 , index = toIndex(fromIndex, length)
133 , value;
134 // Array#includes uses SameValueZero equality algorithm
135 if(IS_INCLUDES && el != el)while(length > index){
136 value = O[index++];
137 if(value != value)return true;
138 // Array#toIndex ignores holes, Array#includes - not
139 } else for(;length > index; index++)if(IS_INCLUDES || index in O){
140 if(O[index] === el)return IS_INCLUDES || index || 0;
141 } return !IS_INCLUDES && -1;
142 };
143};
144},{"105":105,"107":107,"108":108}],12:[function(_dereq_,module,exports){
145// 0 -> Array#forEach
146// 1 -> Array#map
147// 2 -> Array#filter
148// 3 -> Array#some
149// 4 -> Array#every
150// 5 -> Array#find
151// 6 -> Array#findIndex
152var ctx = _dereq_(25)
153 , IObject = _dereq_(45)
154 , toObject = _dereq_(109)
155 , toLength = _dereq_(108)
156 , asc = _dereq_(15);
157module.exports = function(TYPE, $create){
158 var IS_MAP = TYPE == 1
159 , IS_FILTER = TYPE == 2
160 , IS_SOME = TYPE == 3
161 , IS_EVERY = TYPE == 4
162 , IS_FIND_INDEX = TYPE == 6
163 , NO_HOLES = TYPE == 5 || IS_FIND_INDEX
164 , create = $create || asc;
165 return function($this, callbackfn, that){
166 var O = toObject($this)
167 , self = IObject(O)
168 , f = ctx(callbackfn, that, 3)
169 , length = toLength(self.length)
170 , index = 0
171 , result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined
172 , val, res;
173 for(;length > index; index++)if(NO_HOLES || index in self){
174 val = self[index];
175 res = f(val, index, O);
176 if(TYPE){
177 if(IS_MAP)result[index] = res; // map
178 else if(res)switch(TYPE){
179 case 3: return true; // some
180 case 5: return val; // find
181 case 6: return index; // findIndex
182 case 2: result.push(val); // filter
183 } else if(IS_EVERY)return false; // every
184 }
185 }
186 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
187 };
188};
189},{"108":108,"109":109,"15":15,"25":25,"45":45}],13:[function(_dereq_,module,exports){
190var aFunction = _dereq_(3)
191 , toObject = _dereq_(109)
192 , IObject = _dereq_(45)
193 , toLength = _dereq_(108);
194
195module.exports = function(that, callbackfn, aLen, memo, isRight){
196 aFunction(callbackfn);
197 var O = toObject(that)
198 , self = IObject(O)
199 , length = toLength(O.length)
200 , index = isRight ? length - 1 : 0
201 , i = isRight ? -1 : 1;
202 if(aLen < 2)for(;;){
203 if(index in self){
204 memo = self[index];
205 index += i;
206 break;
207 }
208 index += i;
209 if(isRight ? index < 0 : length <= index){
210 throw TypeError('Reduce of empty array with no initial value');
211 }
212 }
213 for(;isRight ? index >= 0 : length > index; index += i)if(index in self){
214 memo = callbackfn(memo, self[index], index, O);
215 }
216 return memo;
217};
218},{"108":108,"109":109,"3":3,"45":45}],14:[function(_dereq_,module,exports){
219var isObject = _dereq_(49)
220 , isArray = _dereq_(47)
221 , SPECIES = _dereq_(117)('species');
222
223module.exports = function(original){
224 var C;
225 if(isArray(original)){
226 C = original.constructor;
227 // cross-realm fallback
228 if(typeof C == 'function' && (C === Array || isArray(C.prototype)))C = undefined;
229 if(isObject(C)){
230 C = C[SPECIES];
231 if(C === null)C = undefined;
232 }
233 } return C === undefined ? Array : C;
234};
235},{"117":117,"47":47,"49":49}],15:[function(_dereq_,module,exports){
236// 9.4.2.3 ArraySpeciesCreate(originalArray, length)
237var speciesConstructor = _dereq_(14);
238
239module.exports = function(original, length){
240 return new (speciesConstructor(original))(length);
241};
242},{"14":14}],16:[function(_dereq_,module,exports){
243'use strict';
244var aFunction = _dereq_(3)
245 , isObject = _dereq_(49)
246 , invoke = _dereq_(44)
247 , arraySlice = [].slice
248 , factories = {};
249
250var construct = function(F, len, args){
251 if(!(len in factories)){
252 for(var n = [], i = 0; i < len; i++)n[i] = 'a[' + i + ']';
253 factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')');
254 } return factories[len](F, args);
255};
256
257module.exports = Function.bind || function bind(that /*, args... */){
258 var fn = aFunction(this)
259 , partArgs = arraySlice.call(arguments, 1);
260 var bound = function(/* args... */){
261 var args = partArgs.concat(arraySlice.call(arguments));
262 return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that);
263 };
264 if(isObject(fn.prototype))bound.prototype = fn.prototype;
265 return bound;
266};
267},{"3":3,"44":44,"49":49}],17:[function(_dereq_,module,exports){
268// getting tag from 19.1.3.6 Object.prototype.toString()
269var cof = _dereq_(18)
270 , TAG = _dereq_(117)('toStringTag')
271 // ES3 wrong here
272 , ARG = cof(function(){ return arguments; }()) == 'Arguments';
273
274// fallback for IE11 Script Access Denied error
275var tryGet = function(it, key){
276 try {
277 return it[key];
278 } catch(e){ /* empty */ }
279};
280
281module.exports = function(it){
282 var O, T, B;
283 return it === undefined ? 'Undefined' : it === null ? 'Null'
284 // @@toStringTag case
285 : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
286 // builtinTag case
287 : ARG ? cof(O)
288 // ES3 arguments fallback
289 : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
290};
291},{"117":117,"18":18}],18:[function(_dereq_,module,exports){
292var toString = {}.toString;
293
294module.exports = function(it){
295 return toString.call(it).slice(8, -1);
296};
297},{}],19:[function(_dereq_,module,exports){
298'use strict';
299var dP = _dereq_(67).f
300 , create = _dereq_(66)
301 , redefineAll = _dereq_(86)
302 , ctx = _dereq_(25)
303 , anInstance = _dereq_(6)
304 , defined = _dereq_(27)
305 , forOf = _dereq_(37)
306 , $iterDefine = _dereq_(53)
307 , step = _dereq_(55)
308 , setSpecies = _dereq_(91)
309 , DESCRIPTORS = _dereq_(28)
310 , fastKey = _dereq_(62).fastKey
311 , SIZE = DESCRIPTORS ? '_s' : 'size';
312
313var getEntry = function(that, key){
314 // fast case
315 var index = fastKey(key), entry;
316 if(index !== 'F')return that._i[index];
317 // frozen object case
318 for(entry = that._f; entry; entry = entry.n){
319 if(entry.k == key)return entry;
320 }
321};
322
323module.exports = {
324 getConstructor: function(wrapper, NAME, IS_MAP, ADDER){
325 var C = wrapper(function(that, iterable){
326 anInstance(that, C, NAME, '_i');
327 that._i = create(null); // index
328 that._f = undefined; // first entry
329 that._l = undefined; // last entry
330 that[SIZE] = 0; // size
331 if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
332 });
333 redefineAll(C.prototype, {
334 // 23.1.3.1 Map.prototype.clear()
335 // 23.2.3.2 Set.prototype.clear()
336 clear: function clear(){
337 for(var that = this, data = that._i, entry = that._f; entry; entry = entry.n){
338 entry.r = true;
339 if(entry.p)entry.p = entry.p.n = undefined;
340 delete data[entry.i];
341 }
342 that._f = that._l = undefined;
343 that[SIZE] = 0;
344 },
345 // 23.1.3.3 Map.prototype.delete(key)
346 // 23.2.3.4 Set.prototype.delete(value)
347 'delete': function(key){
348 var that = this
349 , entry = getEntry(that, key);
350 if(entry){
351 var next = entry.n
352 , prev = entry.p;
353 delete that._i[entry.i];
354 entry.r = true;
355 if(prev)prev.n = next;
356 if(next)next.p = prev;
357 if(that._f == entry)that._f = next;
358 if(that._l == entry)that._l = prev;
359 that[SIZE]--;
360 } return !!entry;
361 },
362 // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
363 // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
364 forEach: function forEach(callbackfn /*, that = undefined */){
365 anInstance(this, C, 'forEach');
366 var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3)
367 , entry;
368 while(entry = entry ? entry.n : this._f){
369 f(entry.v, entry.k, this);
370 // revert to the last existing entry
371 while(entry && entry.r)entry = entry.p;
372 }
373 },
374 // 23.1.3.7 Map.prototype.has(key)
375 // 23.2.3.7 Set.prototype.has(value)
376 has: function has(key){
377 return !!getEntry(this, key);
378 }
379 });
380 if(DESCRIPTORS)dP(C.prototype, 'size', {
381 get: function(){
382 return defined(this[SIZE]);
383 }
384 });
385 return C;
386 },
387 def: function(that, key, value){
388 var entry = getEntry(that, key)
389 , prev, index;
390 // change existing entry
391 if(entry){
392 entry.v = value;
393 // create new entry
394 } else {
395 that._l = entry = {
396 i: index = fastKey(key, true), // <- index
397 k: key, // <- key
398 v: value, // <- value
399 p: prev = that._l, // <- previous entry
400 n: undefined, // <- next entry
401 r: false // <- removed
402 };
403 if(!that._f)that._f = entry;
404 if(prev)prev.n = entry;
405 that[SIZE]++;
406 // add to index
407 if(index !== 'F')that._i[index] = entry;
408 } return that;
409 },
410 getEntry: getEntry,
411 setStrong: function(C, NAME, IS_MAP){
412 // add .keys, .values, .entries, [@@iterator]
413 // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
414 $iterDefine(C, NAME, function(iterated, kind){
415 this._t = iterated; // target
416 this._k = kind; // kind
417 this._l = undefined; // previous
418 }, function(){
419 var that = this
420 , kind = that._k
421 , entry = that._l;
422 // revert to the last existing entry
423 while(entry && entry.r)entry = entry.p;
424 // get next entry
425 if(!that._t || !(that._l = entry = entry ? entry.n : that._t._f)){
426 // or finish the iteration
427 that._t = undefined;
428 return step(1);
429 }
430 // return step by kind
431 if(kind == 'keys' )return step(0, entry.k);
432 if(kind == 'values')return step(0, entry.v);
433 return step(0, [entry.k, entry.v]);
434 }, IS_MAP ? 'entries' : 'values' , !IS_MAP, true);
435
436 // add [@@species], 23.1.2.2, 23.2.2.2
437 setSpecies(NAME);
438 }
439};
440},{"25":25,"27":27,"28":28,"37":37,"53":53,"55":55,"6":6,"62":62,"66":66,"67":67,"86":86,"91":91}],20:[function(_dereq_,module,exports){
441// https://github.com/DavidBruant/Map-Set.prototype.toJSON
442var classof = _dereq_(17)
443 , from = _dereq_(10);
444module.exports = function(NAME){
445 return function toJSON(){
446 if(classof(this) != NAME)throw TypeError(NAME + "#toJSON isn't generic");
447 return from(this);
448 };
449};
450},{"10":10,"17":17}],21:[function(_dereq_,module,exports){
451'use strict';
452var redefineAll = _dereq_(86)
453 , getWeak = _dereq_(62).getWeak
454 , anObject = _dereq_(7)
455 , isObject = _dereq_(49)
456 , anInstance = _dereq_(6)
457 , forOf = _dereq_(37)
458 , createArrayMethod = _dereq_(12)
459 , $has = _dereq_(39)
460 , arrayFind = createArrayMethod(5)
461 , arrayFindIndex = createArrayMethod(6)
462 , id = 0;
463
464// fallback for uncaught frozen keys
465var uncaughtFrozenStore = function(that){
466 return that._l || (that._l = new UncaughtFrozenStore);
467};
468var UncaughtFrozenStore = function(){
469 this.a = [];
470};
471var findUncaughtFrozen = function(store, key){
472 return arrayFind(store.a, function(it){
473 return it[0] === key;
474 });
475};
476UncaughtFrozenStore.prototype = {
477 get: function(key){
478 var entry = findUncaughtFrozen(this, key);
479 if(entry)return entry[1];
480 },
481 has: function(key){
482 return !!findUncaughtFrozen(this, key);
483 },
484 set: function(key, value){
485 var entry = findUncaughtFrozen(this, key);
486 if(entry)entry[1] = value;
487 else this.a.push([key, value]);
488 },
489 'delete': function(key){
490 var index = arrayFindIndex(this.a, function(it){
491 return it[0] === key;
492 });
493 if(~index)this.a.splice(index, 1);
494 return !!~index;
495 }
496};
497
498module.exports = {
499 getConstructor: function(wrapper, NAME, IS_MAP, ADDER){
500 var C = wrapper(function(that, iterable){
501 anInstance(that, C, NAME, '_i');
502 that._i = id++; // collection id
503 that._l = undefined; // leak store for uncaught frozen objects
504 if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
505 });
506 redefineAll(C.prototype, {
507 // 23.3.3.2 WeakMap.prototype.delete(key)
508 // 23.4.3.3 WeakSet.prototype.delete(value)
509 'delete': function(key){
510 if(!isObject(key))return false;
511 var data = getWeak(key);
512 if(data === true)return uncaughtFrozenStore(this)['delete'](key);
513 return data && $has(data, this._i) && delete data[this._i];
514 },
515 // 23.3.3.4 WeakMap.prototype.has(key)
516 // 23.4.3.4 WeakSet.prototype.has(value)
517 has: function has(key){
518 if(!isObject(key))return false;
519 var data = getWeak(key);
520 if(data === true)return uncaughtFrozenStore(this).has(key);
521 return data && $has(data, this._i);
522 }
523 });
524 return C;
525 },
526 def: function(that, key, value){
527 var data = getWeak(anObject(key), true);
528 if(data === true)uncaughtFrozenStore(that).set(key, value);
529 else data[that._i] = value;
530 return that;
531 },
532 ufstore: uncaughtFrozenStore
533};
534},{"12":12,"37":37,"39":39,"49":49,"6":6,"62":62,"7":7,"86":86}],22:[function(_dereq_,module,exports){
535'use strict';
536var global = _dereq_(38)
537 , $export = _dereq_(32)
538 , redefine = _dereq_(87)
539 , redefineAll = _dereq_(86)
540 , meta = _dereq_(62)
541 , forOf = _dereq_(37)
542 , anInstance = _dereq_(6)
543 , isObject = _dereq_(49)
544 , fails = _dereq_(34)
545 , $iterDetect = _dereq_(54)
546 , setToStringTag = _dereq_(92)
547 , inheritIfRequired = _dereq_(43);
548
549module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){
550 var Base = global[NAME]
551 , C = Base
552 , ADDER = IS_MAP ? 'set' : 'add'
553 , proto = C && C.prototype
554 , O = {};
555 var fixMethod = function(KEY){
556 var fn = proto[KEY];
557 redefine(proto, KEY,
558 KEY == 'delete' ? function(a){
559 return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
560 } : KEY == 'has' ? function has(a){
561 return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
562 } : KEY == 'get' ? function get(a){
563 return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a);
564 } : KEY == 'add' ? function add(a){ fn.call(this, a === 0 ? 0 : a); return this; }
565 : function set(a, b){ fn.call(this, a === 0 ? 0 : a, b); return this; }
566 );
567 };
568 if(typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function(){
569 new C().entries().next();
570 }))){
571 // create collection constructor
572 C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
573 redefineAll(C.prototype, methods);
574 meta.NEED = true;
575 } else {
576 var instance = new C
577 // early implementations not supports chaining
578 , HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance
579 // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false
580 , THROWS_ON_PRIMITIVES = fails(function(){ instance.has(1); })
581 // most early implementations doesn't supports iterables, most modern - not close it correctly
582 , ACCEPT_ITERABLES = $iterDetect(function(iter){ new C(iter); }) // eslint-disable-line no-new
583 // for early implementations -0 and +0 not the same
584 , BUGGY_ZERO = !IS_WEAK && fails(function(){
585 // V8 ~ Chromium 42- fails only with 5+ elements
586 var $instance = new C()
587 , index = 5;
588 while(index--)$instance[ADDER](index, index);
589 return !$instance.has(-0);
590 });
591 if(!ACCEPT_ITERABLES){
592 C = wrapper(function(target, iterable){
593 anInstance(target, C, NAME);
594 var that = inheritIfRequired(new Base, target, C);
595 if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
596 return that;
597 });
598 C.prototype = proto;
599 proto.constructor = C;
600 }
601 if(THROWS_ON_PRIMITIVES || BUGGY_ZERO){
602 fixMethod('delete');
603 fixMethod('has');
604 IS_MAP && fixMethod('get');
605 }
606 if(BUGGY_ZERO || HASNT_CHAINING)fixMethod(ADDER);
607 // weak collections should not contains .clear method
608 if(IS_WEAK && proto.clear)delete proto.clear;
609 }
610
611 setToStringTag(C, NAME);
612
613 O[NAME] = C;
614 $export($export.G + $export.W + $export.F * (C != Base), O);
615
616 if(!IS_WEAK)common.setStrong(C, NAME, IS_MAP);
617
618 return C;
619};
620},{"32":32,"34":34,"37":37,"38":38,"43":43,"49":49,"54":54,"6":6,"62":62,"86":86,"87":87,"92":92}],23:[function(_dereq_,module,exports){
621var core = module.exports = {version: '2.4.0'};
622if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
623},{}],24:[function(_dereq_,module,exports){
624'use strict';
625var $defineProperty = _dereq_(67)
626 , createDesc = _dereq_(85);
627
628module.exports = function(object, index, value){
629 if(index in object)$defineProperty.f(object, index, createDesc(0, value));
630 else object[index] = value;
631};
632},{"67":67,"85":85}],25:[function(_dereq_,module,exports){
633// optional / simple context binding
634var aFunction = _dereq_(3);
635module.exports = function(fn, that, length){
636 aFunction(fn);
637 if(that === undefined)return fn;
638 switch(length){
639 case 1: return function(a){
640 return fn.call(that, a);
641 };
642 case 2: return function(a, b){
643 return fn.call(that, a, b);
644 };
645 case 3: return function(a, b, c){
646 return fn.call(that, a, b, c);
647 };
648 }
649 return function(/* ...args */){
650 return fn.apply(that, arguments);
651 };
652};
653},{"3":3}],26:[function(_dereq_,module,exports){
654'use strict';
655var anObject = _dereq_(7)
656 , toPrimitive = _dereq_(110)
657 , NUMBER = 'number';
658
659module.exports = function(hint){
660 if(hint !== 'string' && hint !== NUMBER && hint !== 'default')throw TypeError('Incorrect hint');
661 return toPrimitive(anObject(this), hint != NUMBER);
662};
663},{"110":110,"7":7}],27:[function(_dereq_,module,exports){
664// 7.2.1 RequireObjectCoercible(argument)
665module.exports = function(it){
666 if(it == undefined)throw TypeError("Can't call method on " + it);
667 return it;
668};
669},{}],28:[function(_dereq_,module,exports){
670// Thank's IE8 for his funny defineProperty
671module.exports = !_dereq_(34)(function(){
672 return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
673});
674},{"34":34}],29:[function(_dereq_,module,exports){
675var isObject = _dereq_(49)
676 , document = _dereq_(38).document
677 // in old IE typeof document.createElement is 'object'
678 , is = isObject(document) && isObject(document.createElement);
679module.exports = function(it){
680 return is ? document.createElement(it) : {};
681};
682},{"38":38,"49":49}],30:[function(_dereq_,module,exports){
683// IE 8- don't enum bug keys
684module.exports = (
685 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
686).split(',');
687},{}],31:[function(_dereq_,module,exports){
688// all enumerable object keys, includes symbols
689var getKeys = _dereq_(76)
690 , gOPS = _dereq_(73)
691 , pIE = _dereq_(77);
692module.exports = function(it){
693 var result = getKeys(it)
694 , getSymbols = gOPS.f;
695 if(getSymbols){
696 var symbols = getSymbols(it)
697 , isEnum = pIE.f
698 , i = 0
699 , key;
700 while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))result.push(key);
701 } return result;
702};
703},{"73":73,"76":76,"77":77}],32:[function(_dereq_,module,exports){
704var global = _dereq_(38)
705 , core = _dereq_(23)
706 , hide = _dereq_(40)
707 , redefine = _dereq_(87)
708 , ctx = _dereq_(25)
709 , PROTOTYPE = 'prototype';
710
711var $export = function(type, name, source){
712 var IS_FORCED = type & $export.F
713 , IS_GLOBAL = type & $export.G
714 , IS_STATIC = type & $export.S
715 , IS_PROTO = type & $export.P
716 , IS_BIND = type & $export.B
717 , target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]
718 , exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
719 , expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {})
720 , key, own, out, exp;
721 if(IS_GLOBAL)source = name;
722 for(key in source){
723 // contains in native
724 own = !IS_FORCED && target && target[key] !== undefined;
725 // export native or passed
726 out = (own ? target : source)[key];
727 // bind timers to global for call from export context
728 exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
729 // extend global
730 if(target)redefine(target, key, out, type & $export.U);
731 // export
732 if(exports[key] != out)hide(exports, key, exp);
733 if(IS_PROTO && expProto[key] != out)expProto[key] = out;
734 }
735};
736global.core = core;
737// type bitmap
738$export.F = 1; // forced
739$export.G = 2; // global
740$export.S = 4; // static
741$export.P = 8; // proto
742$export.B = 16; // bind
743$export.W = 32; // wrap
744$export.U = 64; // safe
745$export.R = 128; // real proto method for `library`
746module.exports = $export;
747},{"23":23,"25":25,"38":38,"40":40,"87":87}],33:[function(_dereq_,module,exports){
748var MATCH = _dereq_(117)('match');
749module.exports = function(KEY){
750 var re = /./;
751 try {
752 '/./'[KEY](re);
753 } catch(e){
754 try {
755 re[MATCH] = false;
756 return !'/./'[KEY](re);
757 } catch(f){ /* empty */ }
758 } return true;
759};
760},{"117":117}],34:[function(_dereq_,module,exports){
761module.exports = function(exec){
762 try {
763 return !!exec();
764 } catch(e){
765 return true;
766 }
767};
768},{}],35:[function(_dereq_,module,exports){
769'use strict';
770var hide = _dereq_(40)
771 , redefine = _dereq_(87)
772 , fails = _dereq_(34)
773 , defined = _dereq_(27)
774 , wks = _dereq_(117);
775
776module.exports = function(KEY, length, exec){
777 var SYMBOL = wks(KEY)
778 , fns = exec(defined, SYMBOL, ''[KEY])
779 , strfn = fns[0]
780 , rxfn = fns[1];
781 if(fails(function(){
782 var O = {};
783 O[SYMBOL] = function(){ return 7; };
784 return ''[KEY](O) != 7;
785 })){
786 redefine(String.prototype, KEY, strfn);
787 hide(RegExp.prototype, SYMBOL, length == 2
788 // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
789 // 21.2.5.11 RegExp.prototype[@@split](string, limit)
790 ? function(string, arg){ return rxfn.call(string, this, arg); }
791 // 21.2.5.6 RegExp.prototype[@@match](string)
792 // 21.2.5.9 RegExp.prototype[@@search](string)
793 : function(string){ return rxfn.call(string, this); }
794 );
795 }
796};
797},{"117":117,"27":27,"34":34,"40":40,"87":87}],36:[function(_dereq_,module,exports){
798'use strict';
799// 21.2.5.3 get RegExp.prototype.flags
800var anObject = _dereq_(7);
801module.exports = function(){
802 var that = anObject(this)
803 , result = '';
804 if(that.global) result += 'g';
805 if(that.ignoreCase) result += 'i';
806 if(that.multiline) result += 'm';
807 if(that.unicode) result += 'u';
808 if(that.sticky) result += 'y';
809 return result;
810};
811},{"7":7}],37:[function(_dereq_,module,exports){
812var ctx = _dereq_(25)
813 , call = _dereq_(51)
814 , isArrayIter = _dereq_(46)
815 , anObject = _dereq_(7)
816 , toLength = _dereq_(108)
817 , getIterFn = _dereq_(118)
818 , BREAK = {}
819 , RETURN = {};
820var exports = module.exports = function(iterable, entries, fn, that, ITERATOR){
821 var iterFn = ITERATOR ? function(){ return iterable; } : getIterFn(iterable)
822 , f = ctx(fn, that, entries ? 2 : 1)
823 , index = 0
824 , length, step, iterator, result;
825 if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!');
826 // fast case for arrays with default iterator
827 if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){
828 result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
829 if(result === BREAK || result === RETURN)return result;
830 } else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){
831 result = call(iterator, f, step.value, entries);
832 if(result === BREAK || result === RETURN)return result;
833 }
834};
835exports.BREAK = BREAK;
836exports.RETURN = RETURN;
837},{"108":108,"118":118,"25":25,"46":46,"51":51,"7":7}],38:[function(_dereq_,module,exports){
838// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
839var global = module.exports = typeof window != 'undefined' && window.Math == Math
840 ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
841if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
842},{}],39:[function(_dereq_,module,exports){
843var hasOwnProperty = {}.hasOwnProperty;
844module.exports = function(it, key){
845 return hasOwnProperty.call(it, key);
846};
847},{}],40:[function(_dereq_,module,exports){
848var dP = _dereq_(67)
849 , createDesc = _dereq_(85);
850module.exports = _dereq_(28) ? function(object, key, value){
851 return dP.f(object, key, createDesc(1, value));
852} : function(object, key, value){
853 object[key] = value;
854 return object;
855};
856},{"28":28,"67":67,"85":85}],41:[function(_dereq_,module,exports){
857module.exports = _dereq_(38).document && document.documentElement;
858},{"38":38}],42:[function(_dereq_,module,exports){
859module.exports = !_dereq_(28) && !_dereq_(34)(function(){
860 return Object.defineProperty(_dereq_(29)('div'), 'a', {get: function(){ return 7; }}).a != 7;
861});
862},{"28":28,"29":29,"34":34}],43:[function(_dereq_,module,exports){
863var isObject = _dereq_(49)
864 , setPrototypeOf = _dereq_(90).set;
865module.exports = function(that, target, C){
866 var P, S = target.constructor;
867 if(S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf){
868 setPrototypeOf(that, P);
869 } return that;
870};
871},{"49":49,"90":90}],44:[function(_dereq_,module,exports){
872// fast apply, http://jsperf.lnkit.com/fast-apply/5
873module.exports = function(fn, args, that){
874 var un = that === undefined;
875 switch(args.length){
876 case 0: return un ? fn()
877 : fn.call(that);
878 case 1: return un ? fn(args[0])
879 : fn.call(that, args[0]);
880 case 2: return un ? fn(args[0], args[1])
881 : fn.call(that, args[0], args[1]);
882 case 3: return un ? fn(args[0], args[1], args[2])
883 : fn.call(that, args[0], args[1], args[2]);
884 case 4: return un ? fn(args[0], args[1], args[2], args[3])
885 : fn.call(that, args[0], args[1], args[2], args[3]);
886 } return fn.apply(that, args);
887};
888},{}],45:[function(_dereq_,module,exports){
889// fallback for non-array-like ES3 and non-enumerable old V8 strings
890var cof = _dereq_(18);
891module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){
892 return cof(it) == 'String' ? it.split('') : Object(it);
893};
894},{"18":18}],46:[function(_dereq_,module,exports){
895// check on default Array iterator
896var Iterators = _dereq_(56)
897 , ITERATOR = _dereq_(117)('iterator')
898 , ArrayProto = Array.prototype;
899
900module.exports = function(it){
901 return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
902};
903},{"117":117,"56":56}],47:[function(_dereq_,module,exports){
904// 7.2.2 IsArray(argument)
905var cof = _dereq_(18);
906module.exports = Array.isArray || function isArray(arg){
907 return cof(arg) == 'Array';
908};
909},{"18":18}],48:[function(_dereq_,module,exports){
910// 20.1.2.3 Number.isInteger(number)
911var isObject = _dereq_(49)
912 , floor = Math.floor;
913module.exports = function isInteger(it){
914 return !isObject(it) && isFinite(it) && floor(it) === it;
915};
916},{"49":49}],49:[function(_dereq_,module,exports){
917module.exports = function(it){
918 return typeof it === 'object' ? it !== null : typeof it === 'function';
919};
920},{}],50:[function(_dereq_,module,exports){
921// 7.2.8 IsRegExp(argument)
922var isObject = _dereq_(49)
923 , cof = _dereq_(18)
924 , MATCH = _dereq_(117)('match');
925module.exports = function(it){
926 var isRegExp;
927 return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');
928};
929},{"117":117,"18":18,"49":49}],51:[function(_dereq_,module,exports){
930// call something on iterator step with safe closing on error
931var anObject = _dereq_(7);
932module.exports = function(iterator, fn, value, entries){
933 try {
934 return entries ? fn(anObject(value)[0], value[1]) : fn(value);
935 // 7.4.6 IteratorClose(iterator, completion)
936 } catch(e){
937 var ret = iterator['return'];
938 if(ret !== undefined)anObject(ret.call(iterator));
939 throw e;
940 }
941};
942},{"7":7}],52:[function(_dereq_,module,exports){
943'use strict';
944var create = _dereq_(66)
945 , descriptor = _dereq_(85)
946 , setToStringTag = _dereq_(92)
947 , IteratorPrototype = {};
948
949// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
950_dereq_(40)(IteratorPrototype, _dereq_(117)('iterator'), function(){ return this; });
951
952module.exports = function(Constructor, NAME, next){
953 Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)});
954 setToStringTag(Constructor, NAME + ' Iterator');
955};
956},{"117":117,"40":40,"66":66,"85":85,"92":92}],53:[function(_dereq_,module,exports){
957'use strict';
958var LIBRARY = _dereq_(58)
959 , $export = _dereq_(32)
960 , redefine = _dereq_(87)
961 , hide = _dereq_(40)
962 , has = _dereq_(39)
963 , Iterators = _dereq_(56)
964 , $iterCreate = _dereq_(52)
965 , setToStringTag = _dereq_(92)
966 , getPrototypeOf = _dereq_(74)
967 , ITERATOR = _dereq_(117)('iterator')
968 , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next`
969 , FF_ITERATOR = '@@iterator'
970 , KEYS = 'keys'
971 , VALUES = 'values';
972
973var returnThis = function(){ return this; };
974
975module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){
976 $iterCreate(Constructor, NAME, next);
977 var getMethod = function(kind){
978 if(!BUGGY && kind in proto)return proto[kind];
979 switch(kind){
980 case KEYS: return function keys(){ return new Constructor(this, kind); };
981 case VALUES: return function values(){ return new Constructor(this, kind); };
982 } return function entries(){ return new Constructor(this, kind); };
983 };
984 var TAG = NAME + ' Iterator'
985 , DEF_VALUES = DEFAULT == VALUES
986 , VALUES_BUG = false
987 , proto = Base.prototype
988 , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]
989 , $default = $native || getMethod(DEFAULT)
990 , $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined
991 , $anyNative = NAME == 'Array' ? proto.entries || $native : $native
992 , methods, key, IteratorPrototype;
993 // Fix native
994 if($anyNative){
995 IteratorPrototype = getPrototypeOf($anyNative.call(new Base));
996 if(IteratorPrototype !== Object.prototype){
997 // Set @@toStringTag to native iterators
998 setToStringTag(IteratorPrototype, TAG, true);
999 // fix for some old engines
1000 if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis);
1001 }
1002 }
1003 // fix Array#{values, @@iterator}.name in V8 / FF
1004 if(DEF_VALUES && $native && $native.name !== VALUES){
1005 VALUES_BUG = true;
1006 $default = function values(){ return $native.call(this); };
1007 }
1008 // Define iterator
1009 if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){
1010 hide(proto, ITERATOR, $default);
1011 }
1012 // Plug for library
1013 Iterators[NAME] = $default;
1014 Iterators[TAG] = returnThis;
1015 if(DEFAULT){
1016 methods = {
1017 values: DEF_VALUES ? $default : getMethod(VALUES),
1018 keys: IS_SET ? $default : getMethod(KEYS),
1019 entries: $entries
1020 };
1021 if(FORCED)for(key in methods){
1022 if(!(key in proto))redefine(proto, key, methods[key]);
1023 } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
1024 }
1025 return methods;
1026};
1027},{"117":117,"32":32,"39":39,"40":40,"52":52,"56":56,"58":58,"74":74,"87":87,"92":92}],54:[function(_dereq_,module,exports){
1028var ITERATOR = _dereq_(117)('iterator')
1029 , SAFE_CLOSING = false;
1030
1031try {
1032 var riter = [7][ITERATOR]();
1033 riter['return'] = function(){ SAFE_CLOSING = true; };
1034 Array.from(riter, function(){ throw 2; });
1035} catch(e){ /* empty */ }
1036
1037module.exports = function(exec, skipClosing){
1038 if(!skipClosing && !SAFE_CLOSING)return false;
1039 var safe = false;
1040 try {
1041 var arr = [7]
1042 , iter = arr[ITERATOR]();
1043 iter.next = function(){ return {done: safe = true}; };
1044 arr[ITERATOR] = function(){ return iter; };
1045 exec(arr);
1046 } catch(e){ /* empty */ }
1047 return safe;
1048};
1049},{"117":117}],55:[function(_dereq_,module,exports){
1050module.exports = function(done, value){
1051 return {value: value, done: !!done};
1052};
1053},{}],56:[function(_dereq_,module,exports){
1054module.exports = {};
1055},{}],57:[function(_dereq_,module,exports){
1056var getKeys = _dereq_(76)
1057 , toIObject = _dereq_(107);
1058module.exports = function(object, el){
1059 var O = toIObject(object)
1060 , keys = getKeys(O)
1061 , length = keys.length
1062 , index = 0
1063 , key;
1064 while(length > index)if(O[key = keys[index++]] === el)return key;
1065};
1066},{"107":107,"76":76}],58:[function(_dereq_,module,exports){
1067module.exports = false;
1068},{}],59:[function(_dereq_,module,exports){
1069// 20.2.2.14 Math.expm1(x)
1070var $expm1 = Math.expm1;
1071module.exports = (!$expm1
1072 // Old FF bug
1073 || $expm1(10) > 22025.465794806719 || $expm1(10) < 22025.4657948067165168
1074 // Tor Browser bug
1075 || $expm1(-2e-17) != -2e-17
1076) ? function expm1(x){
1077 return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1;
1078} : $expm1;
1079},{}],60:[function(_dereq_,module,exports){
1080// 20.2.2.20 Math.log1p(x)
1081module.exports = Math.log1p || function log1p(x){
1082 return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x);
1083};
1084},{}],61:[function(_dereq_,module,exports){
1085// 20.2.2.28 Math.sign(x)
1086module.exports = Math.sign || function sign(x){
1087 return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
1088};
1089},{}],62:[function(_dereq_,module,exports){
1090var META = _dereq_(114)('meta')
1091 , isObject = _dereq_(49)
1092 , has = _dereq_(39)
1093 , setDesc = _dereq_(67).f
1094 , id = 0;
1095var isExtensible = Object.isExtensible || function(){
1096 return true;
1097};
1098var FREEZE = !_dereq_(34)(function(){
1099 return isExtensible(Object.preventExtensions({}));
1100});
1101var setMeta = function(it){
1102 setDesc(it, META, {value: {
1103 i: 'O' + ++id, // object ID
1104 w: {} // weak collections IDs
1105 }});
1106};
1107var fastKey = function(it, create){
1108 // return primitive with prefix
1109 if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
1110 if(!has(it, META)){
1111 // can't set metadata to uncaught frozen object
1112 if(!isExtensible(it))return 'F';
1113 // not necessary to add metadata
1114 if(!create)return 'E';
1115 // add missing metadata
1116 setMeta(it);
1117 // return object ID
1118 } return it[META].i;
1119};
1120var getWeak = function(it, create){
1121 if(!has(it, META)){
1122 // can't set metadata to uncaught frozen object
1123 if(!isExtensible(it))return true;
1124 // not necessary to add metadata
1125 if(!create)return false;
1126 // add missing metadata
1127 setMeta(it);
1128 // return hash weak collections IDs
1129 } return it[META].w;
1130};
1131// add metadata on freeze-family methods calling
1132var onFreeze = function(it){
1133 if(FREEZE && meta.NEED && isExtensible(it) && !has(it, META))setMeta(it);
1134 return it;
1135};
1136var meta = module.exports = {
1137 KEY: META,
1138 NEED: false,
1139 fastKey: fastKey,
1140 getWeak: getWeak,
1141 onFreeze: onFreeze
1142};
1143},{"114":114,"34":34,"39":39,"49":49,"67":67}],63:[function(_dereq_,module,exports){
1144var Map = _dereq_(149)
1145 , $export = _dereq_(32)
1146 , shared = _dereq_(94)('metadata')
1147 , store = shared.store || (shared.store = new (_dereq_(255)));
1148
1149var getOrCreateMetadataMap = function(target, targetKey, create){
1150 var targetMetadata = store.get(target);
1151 if(!targetMetadata){
1152 if(!create)return undefined;
1153 store.set(target, targetMetadata = new Map);
1154 }
1155 var keyMetadata = targetMetadata.get(targetKey);
1156 if(!keyMetadata){
1157 if(!create)return undefined;
1158 targetMetadata.set(targetKey, keyMetadata = new Map);
1159 } return keyMetadata;
1160};
1161var ordinaryHasOwnMetadata = function(MetadataKey, O, P){
1162 var metadataMap = getOrCreateMetadataMap(O, P, false);
1163 return metadataMap === undefined ? false : metadataMap.has(MetadataKey);
1164};
1165var ordinaryGetOwnMetadata = function(MetadataKey, O, P){
1166 var metadataMap = getOrCreateMetadataMap(O, P, false);
1167 return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey);
1168};
1169var ordinaryDefineOwnMetadata = function(MetadataKey, MetadataValue, O, P){
1170 getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue);
1171};
1172var ordinaryOwnMetadataKeys = function(target, targetKey){
1173 var metadataMap = getOrCreateMetadataMap(target, targetKey, false)
1174 , keys = [];
1175 if(metadataMap)metadataMap.forEach(function(_, key){ keys.push(key); });
1176 return keys;
1177};
1178var toMetaKey = function(it){
1179 return it === undefined || typeof it == 'symbol' ? it : String(it);
1180};
1181var exp = function(O){
1182 $export($export.S, 'Reflect', O);
1183};
1184
1185module.exports = {
1186 store: store,
1187 map: getOrCreateMetadataMap,
1188 has: ordinaryHasOwnMetadata,
1189 get: ordinaryGetOwnMetadata,
1190 set: ordinaryDefineOwnMetadata,
1191 keys: ordinaryOwnMetadataKeys,
1192 key: toMetaKey,
1193 exp: exp
1194};
1195},{"149":149,"255":255,"32":32,"94":94}],64:[function(_dereq_,module,exports){
1196var global = _dereq_(38)
1197 , macrotask = _dereq_(104).set
1198 , Observer = global.MutationObserver || global.WebKitMutationObserver
1199 , process = global.process
1200 , Promise = global.Promise
1201 , isNode = _dereq_(18)(process) == 'process';
1202
1203module.exports = function(){
1204 var head, last, notify;
1205
1206 var flush = function(){
1207 var parent, fn;
1208 if(isNode && (parent = process.domain))parent.exit();
1209 while(head){
1210 fn = head.fn;
1211 head = head.next;
1212 try {
1213 fn();
1214 } catch(e){
1215 if(head)notify();
1216 else last = undefined;
1217 throw e;
1218 }
1219 } last = undefined;
1220 if(parent)parent.enter();
1221 };
1222
1223 // Node.js
1224 if(isNode){
1225 notify = function(){
1226 process.nextTick(flush);
1227 };
1228 // browsers with MutationObserver
1229 } else if(Observer){
1230 var toggle = true
1231 , node = document.createTextNode('');
1232 new Observer(flush).observe(node, {characterData: true}); // eslint-disable-line no-new
1233 notify = function(){
1234 node.data = toggle = !toggle;
1235 };
1236 // environments with maybe non-completely correct, but existent Promise
1237 } else if(Promise && Promise.resolve){
1238 var promise = Promise.resolve();
1239 notify = function(){
1240 promise.then(flush);
1241 };
1242 // for other environments - macrotask based on:
1243 // - setImmediate
1244 // - MessageChannel
1245 // - window.postMessag
1246 // - onreadystatechange
1247 // - setTimeout
1248 } else {
1249 notify = function(){
1250 // strange IE + webpack dev server bug - use .call(global)
1251 macrotask.call(global, flush);
1252 };
1253 }
1254
1255 return function(fn){
1256 var task = {fn: fn, next: undefined};
1257 if(last)last.next = task;
1258 if(!head){
1259 head = task;
1260 notify();
1261 } last = task;
1262 };
1263};
1264},{"104":104,"18":18,"38":38}],65:[function(_dereq_,module,exports){
1265'use strict';
1266// 19.1.2.1 Object.assign(target, source, ...)
1267var getKeys = _dereq_(76)
1268 , gOPS = _dereq_(73)
1269 , pIE = _dereq_(77)
1270 , toObject = _dereq_(109)
1271 , IObject = _dereq_(45)
1272 , $assign = Object.assign;
1273
1274// should work with symbols and should have deterministic property order (V8 bug)
1275module.exports = !$assign || _dereq_(34)(function(){
1276 var A = {}
1277 , B = {}
1278 , S = Symbol()
1279 , K = 'abcdefghijklmnopqrst';
1280 A[S] = 7;
1281 K.split('').forEach(function(k){ B[k] = k; });
1282 return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
1283}) ? function assign(target, source){ // eslint-disable-line no-unused-vars
1284 var T = toObject(target)
1285 , aLen = arguments.length
1286 , index = 1
1287 , getSymbols = gOPS.f
1288 , isEnum = pIE.f;
1289 while(aLen > index){
1290 var S = IObject(arguments[index++])
1291 , keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S)
1292 , length = keys.length
1293 , j = 0
1294 , key;
1295 while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key];
1296 } return T;
1297} : $assign;
1298},{"109":109,"34":34,"45":45,"73":73,"76":76,"77":77}],66:[function(_dereq_,module,exports){
1299// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
1300var anObject = _dereq_(7)
1301 , dPs = _dereq_(68)
1302 , enumBugKeys = _dereq_(30)
1303 , IE_PROTO = _dereq_(93)('IE_PROTO')
1304 , Empty = function(){ /* empty */ }
1305 , PROTOTYPE = 'prototype';
1306
1307// Create object with fake `null` prototype: use iframe Object with cleared prototype
1308var createDict = function(){
1309 // Thrash, waste and sodomy: IE GC bug
1310 var iframe = _dereq_(29)('iframe')
1311 , i = enumBugKeys.length
1312 , lt = '<'
1313 , gt = '>'
1314 , iframeDocument;
1315 iframe.style.display = 'none';
1316 _dereq_(41).appendChild(iframe);
1317 iframe.src = 'javascript:'; // eslint-disable-line no-script-url
1318 // createDict = iframe.contentWindow.Object;
1319 // html.removeChild(iframe);
1320 iframeDocument = iframe.contentWindow.document;
1321 iframeDocument.open();
1322 iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
1323 iframeDocument.close();
1324 createDict = iframeDocument.F;
1325 while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]];
1326 return createDict();
1327};
1328
1329module.exports = Object.create || function create(O, Properties){
1330 var result;
1331 if(O !== null){
1332 Empty[PROTOTYPE] = anObject(O);
1333 result = new Empty;
1334 Empty[PROTOTYPE] = null;
1335 // add "__proto__" for Object.getPrototypeOf polyfill
1336 result[IE_PROTO] = O;
1337 } else result = createDict();
1338 return Properties === undefined ? result : dPs(result, Properties);
1339};
1340
1341},{"29":29,"30":30,"41":41,"68":68,"7":7,"93":93}],67:[function(_dereq_,module,exports){
1342var anObject = _dereq_(7)
1343 , IE8_DOM_DEFINE = _dereq_(42)
1344 , toPrimitive = _dereq_(110)
1345 , dP = Object.defineProperty;
1346
1347exports.f = _dereq_(28) ? Object.defineProperty : function defineProperty(O, P, Attributes){
1348 anObject(O);
1349 P = toPrimitive(P, true);
1350 anObject(Attributes);
1351 if(IE8_DOM_DEFINE)try {
1352 return dP(O, P, Attributes);
1353 } catch(e){ /* empty */ }
1354 if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
1355 if('value' in Attributes)O[P] = Attributes.value;
1356 return O;
1357};
1358},{"110":110,"28":28,"42":42,"7":7}],68:[function(_dereq_,module,exports){
1359var dP = _dereq_(67)
1360 , anObject = _dereq_(7)
1361 , getKeys = _dereq_(76);
1362
1363module.exports = _dereq_(28) ? Object.defineProperties : function defineProperties(O, Properties){
1364 anObject(O);
1365 var keys = getKeys(Properties)
1366 , length = keys.length
1367 , i = 0
1368 , P;
1369 while(length > i)dP.f(O, P = keys[i++], Properties[P]);
1370 return O;
1371};
1372},{"28":28,"67":67,"7":7,"76":76}],69:[function(_dereq_,module,exports){
1373// Forced replacement prototype accessors methods
1374module.exports = _dereq_(58)|| !_dereq_(34)(function(){
1375 var K = Math.random();
1376 // In FF throws only define methods
1377 __defineSetter__.call(null, K, function(){ /* empty */});
1378 delete _dereq_(38)[K];
1379});
1380},{"34":34,"38":38,"58":58}],70:[function(_dereq_,module,exports){
1381var pIE = _dereq_(77)
1382 , createDesc = _dereq_(85)
1383 , toIObject = _dereq_(107)
1384 , toPrimitive = _dereq_(110)
1385 , has = _dereq_(39)
1386 , IE8_DOM_DEFINE = _dereq_(42)
1387 , gOPD = Object.getOwnPropertyDescriptor;
1388
1389exports.f = _dereq_(28) ? gOPD : function getOwnPropertyDescriptor(O, P){
1390 O = toIObject(O);
1391 P = toPrimitive(P, true);
1392 if(IE8_DOM_DEFINE)try {
1393 return gOPD(O, P);
1394 } catch(e){ /* empty */ }
1395 if(has(O, P))return createDesc(!pIE.f.call(O, P), O[P]);
1396};
1397},{"107":107,"110":110,"28":28,"39":39,"42":42,"77":77,"85":85}],71:[function(_dereq_,module,exports){
1398// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
1399var toIObject = _dereq_(107)
1400 , gOPN = _dereq_(72).f
1401 , toString = {}.toString;
1402
1403var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
1404 ? Object.getOwnPropertyNames(window) : [];
1405
1406var getWindowNames = function(it){
1407 try {
1408 return gOPN(it);
1409 } catch(e){
1410 return windowNames.slice();
1411 }
1412};
1413
1414module.exports.f = function getOwnPropertyNames(it){
1415 return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
1416};
1417
1418},{"107":107,"72":72}],72:[function(_dereq_,module,exports){
1419// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
1420var $keys = _dereq_(75)
1421 , hiddenKeys = _dereq_(30).concat('length', 'prototype');
1422
1423exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O){
1424 return $keys(O, hiddenKeys);
1425};
1426},{"30":30,"75":75}],73:[function(_dereq_,module,exports){
1427exports.f = Object.getOwnPropertySymbols;
1428},{}],74:[function(_dereq_,module,exports){
1429// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
1430var has = _dereq_(39)
1431 , toObject = _dereq_(109)
1432 , IE_PROTO = _dereq_(93)('IE_PROTO')
1433 , ObjectProto = Object.prototype;
1434
1435module.exports = Object.getPrototypeOf || function(O){
1436 O = toObject(O);
1437 if(has(O, IE_PROTO))return O[IE_PROTO];
1438 if(typeof O.constructor == 'function' && O instanceof O.constructor){
1439 return O.constructor.prototype;
1440 } return O instanceof Object ? ObjectProto : null;
1441};
1442},{"109":109,"39":39,"93":93}],75:[function(_dereq_,module,exports){
1443var has = _dereq_(39)
1444 , toIObject = _dereq_(107)
1445 , arrayIndexOf = _dereq_(11)(false)
1446 , IE_PROTO = _dereq_(93)('IE_PROTO');
1447
1448module.exports = function(object, names){
1449 var O = toIObject(object)
1450 , i = 0
1451 , result = []
1452 , key;
1453 for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);
1454 // Don't enum bug & hidden keys
1455 while(names.length > i)if(has(O, key = names[i++])){
1456 ~arrayIndexOf(result, key) || result.push(key);
1457 }
1458 return result;
1459};
1460},{"107":107,"11":11,"39":39,"93":93}],76:[function(_dereq_,module,exports){
1461// 19.1.2.14 / 15.2.3.14 Object.keys(O)
1462var $keys = _dereq_(75)
1463 , enumBugKeys = _dereq_(30);
1464
1465module.exports = Object.keys || function keys(O){
1466 return $keys(O, enumBugKeys);
1467};
1468},{"30":30,"75":75}],77:[function(_dereq_,module,exports){
1469exports.f = {}.propertyIsEnumerable;
1470},{}],78:[function(_dereq_,module,exports){
1471// most Object methods by ES6 should accept primitives
1472var $export = _dereq_(32)
1473 , core = _dereq_(23)
1474 , fails = _dereq_(34);
1475module.exports = function(KEY, exec){
1476 var fn = (core.Object || {})[KEY] || Object[KEY]
1477 , exp = {};
1478 exp[KEY] = exec(fn);
1479 $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp);
1480};
1481},{"23":23,"32":32,"34":34}],79:[function(_dereq_,module,exports){
1482var getKeys = _dereq_(76)
1483 , toIObject = _dereq_(107)
1484 , isEnum = _dereq_(77).f;
1485module.exports = function(isEntries){
1486 return function(it){
1487 var O = toIObject(it)
1488 , keys = getKeys(O)
1489 , length = keys.length
1490 , i = 0
1491 , result = []
1492 , key;
1493 while(length > i)if(isEnum.call(O, key = keys[i++])){
1494 result.push(isEntries ? [key, O[key]] : O[key]);
1495 } return result;
1496 };
1497};
1498},{"107":107,"76":76,"77":77}],80:[function(_dereq_,module,exports){
1499// all object keys, includes non-enumerable and symbols
1500var gOPN = _dereq_(72)
1501 , gOPS = _dereq_(73)
1502 , anObject = _dereq_(7)
1503 , Reflect = _dereq_(38).Reflect;
1504module.exports = Reflect && Reflect.ownKeys || function ownKeys(it){
1505 var keys = gOPN.f(anObject(it))
1506 , getSymbols = gOPS.f;
1507 return getSymbols ? keys.concat(getSymbols(it)) : keys;
1508};
1509},{"38":38,"7":7,"72":72,"73":73}],81:[function(_dereq_,module,exports){
1510var $parseFloat = _dereq_(38).parseFloat
1511 , $trim = _dereq_(102).trim;
1512
1513module.exports = 1 / $parseFloat(_dereq_(103) + '-0') !== -Infinity ? function parseFloat(str){
1514 var string = $trim(String(str), 3)
1515 , result = $parseFloat(string);
1516 return result === 0 && string.charAt(0) == '-' ? -0 : result;
1517} : $parseFloat;
1518},{"102":102,"103":103,"38":38}],82:[function(_dereq_,module,exports){
1519var $parseInt = _dereq_(38).parseInt
1520 , $trim = _dereq_(102).trim
1521 , ws = _dereq_(103)
1522 , hex = /^[\-+]?0[xX]/;
1523
1524module.exports = $parseInt(ws + '08') !== 8 || $parseInt(ws + '0x16') !== 22 ? function parseInt(str, radix){
1525 var string = $trim(String(str), 3);
1526 return $parseInt(string, (radix >>> 0) || (hex.test(string) ? 16 : 10));
1527} : $parseInt;
1528},{"102":102,"103":103,"38":38}],83:[function(_dereq_,module,exports){
1529'use strict';
1530var path = _dereq_(84)
1531 , invoke = _dereq_(44)
1532 , aFunction = _dereq_(3);
1533module.exports = function(/* ...pargs */){
1534 var fn = aFunction(this)
1535 , length = arguments.length
1536 , pargs = Array(length)
1537 , i = 0
1538 , _ = path._
1539 , holder = false;
1540 while(length > i)if((pargs[i] = arguments[i++]) === _)holder = true;
1541 return function(/* ...args */){
1542 var that = this
1543 , aLen = arguments.length
1544 , j = 0, k = 0, args;
1545 if(!holder && !aLen)return invoke(fn, pargs, that);
1546 args = pargs.slice();
1547 if(holder)for(;length > j; j++)if(args[j] === _)args[j] = arguments[k++];
1548 while(aLen > k)args.push(arguments[k++]);
1549 return invoke(fn, args, that);
1550 };
1551};
1552},{"3":3,"44":44,"84":84}],84:[function(_dereq_,module,exports){
1553module.exports = _dereq_(38);
1554},{"38":38}],85:[function(_dereq_,module,exports){
1555module.exports = function(bitmap, value){
1556 return {
1557 enumerable : !(bitmap & 1),
1558 configurable: !(bitmap & 2),
1559 writable : !(bitmap & 4),
1560 value : value
1561 };
1562};
1563},{}],86:[function(_dereq_,module,exports){
1564var redefine = _dereq_(87);
1565module.exports = function(target, src, safe){
1566 for(var key in src)redefine(target, key, src[key], safe);
1567 return target;
1568};
1569},{"87":87}],87:[function(_dereq_,module,exports){
1570var global = _dereq_(38)
1571 , hide = _dereq_(40)
1572 , has = _dereq_(39)
1573 , SRC = _dereq_(114)('src')
1574 , TO_STRING = 'toString'
1575 , $toString = Function[TO_STRING]
1576 , TPL = ('' + $toString).split(TO_STRING);
1577
1578_dereq_(23).inspectSource = function(it){
1579 return $toString.call(it);
1580};
1581
1582(module.exports = function(O, key, val, safe){
1583 var isFunction = typeof val == 'function';
1584 if(isFunction)has(val, 'name') || hide(val, 'name', key);
1585 if(O[key] === val)return;
1586 if(isFunction)has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
1587 if(O === global){
1588 O[key] = val;
1589 } else {
1590 if(!safe){
1591 delete O[key];
1592 hide(O, key, val);
1593 } else {
1594 if(O[key])O[key] = val;
1595 else hide(O, key, val);
1596 }
1597 }
1598// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
1599})(Function.prototype, TO_STRING, function toString(){
1600 return typeof this == 'function' && this[SRC] || $toString.call(this);
1601});
1602},{"114":114,"23":23,"38":38,"39":39,"40":40}],88:[function(_dereq_,module,exports){
1603module.exports = function(regExp, replace){
1604 var replacer = replace === Object(replace) ? function(part){
1605 return replace[part];
1606 } : replace;
1607 return function(it){
1608 return String(it).replace(regExp, replacer);
1609 };
1610};
1611},{}],89:[function(_dereq_,module,exports){
1612// 7.2.9 SameValue(x, y)
1613module.exports = Object.is || function is(x, y){
1614 return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
1615};
1616},{}],90:[function(_dereq_,module,exports){
1617// Works with __proto__ only. Old v8 can't work with null proto objects.
1618/* eslint-disable no-proto */
1619var isObject = _dereq_(49)
1620 , anObject = _dereq_(7);
1621var check = function(O, proto){
1622 anObject(O);
1623 if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!");
1624};
1625module.exports = {
1626 set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
1627 function(test, buggy, set){
1628 try {
1629 set = _dereq_(25)(Function.call, _dereq_(70).f(Object.prototype, '__proto__').set, 2);
1630 set(test, []);
1631 buggy = !(test instanceof Array);
1632 } catch(e){ buggy = true; }
1633 return function setPrototypeOf(O, proto){
1634 check(O, proto);
1635 if(buggy)O.__proto__ = proto;
1636 else set(O, proto);
1637 return O;
1638 };
1639 }({}, false) : undefined),
1640 check: check
1641};
1642},{"25":25,"49":49,"7":7,"70":70}],91:[function(_dereq_,module,exports){
1643'use strict';
1644var global = _dereq_(38)
1645 , dP = _dereq_(67)
1646 , DESCRIPTORS = _dereq_(28)
1647 , SPECIES = _dereq_(117)('species');
1648
1649module.exports = function(KEY){
1650 var C = global[KEY];
1651 if(DESCRIPTORS && C && !C[SPECIES])dP.f(C, SPECIES, {
1652 configurable: true,
1653 get: function(){ return this; }
1654 });
1655};
1656},{"117":117,"28":28,"38":38,"67":67}],92:[function(_dereq_,module,exports){
1657var def = _dereq_(67).f
1658 , has = _dereq_(39)
1659 , TAG = _dereq_(117)('toStringTag');
1660
1661module.exports = function(it, tag, stat){
1662 if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});
1663};
1664},{"117":117,"39":39,"67":67}],93:[function(_dereq_,module,exports){
1665var shared = _dereq_(94)('keys')
1666 , uid = _dereq_(114);
1667module.exports = function(key){
1668 return shared[key] || (shared[key] = uid(key));
1669};
1670},{"114":114,"94":94}],94:[function(_dereq_,module,exports){
1671var global = _dereq_(38)
1672 , SHARED = '__core-js_shared__'
1673 , store = global[SHARED] || (global[SHARED] = {});
1674module.exports = function(key){
1675 return store[key] || (store[key] = {});
1676};
1677},{"38":38}],95:[function(_dereq_,module,exports){
1678// 7.3.20 SpeciesConstructor(O, defaultConstructor)
1679var anObject = _dereq_(7)
1680 , aFunction = _dereq_(3)
1681 , SPECIES = _dereq_(117)('species');
1682module.exports = function(O, D){
1683 var C = anObject(O).constructor, S;
1684 return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
1685};
1686},{"117":117,"3":3,"7":7}],96:[function(_dereq_,module,exports){
1687var fails = _dereq_(34);
1688
1689module.exports = function(method, arg){
1690 return !!method && fails(function(){
1691 arg ? method.call(null, function(){}, 1) : method.call(null);
1692 });
1693};
1694},{"34":34}],97:[function(_dereq_,module,exports){
1695var toInteger = _dereq_(106)
1696 , defined = _dereq_(27);
1697// true -> String#at
1698// false -> String#codePointAt
1699module.exports = function(TO_STRING){
1700 return function(that, pos){
1701 var s = String(defined(that))
1702 , i = toInteger(pos)
1703 , l = s.length
1704 , a, b;
1705 if(i < 0 || i >= l)return TO_STRING ? '' : undefined;
1706 a = s.charCodeAt(i);
1707 return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
1708 ? TO_STRING ? s.charAt(i) : a
1709 : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
1710 };
1711};
1712},{"106":106,"27":27}],98:[function(_dereq_,module,exports){
1713// helper for String#{startsWith, endsWith, includes}
1714var isRegExp = _dereq_(50)
1715 , defined = _dereq_(27);
1716
1717module.exports = function(that, searchString, NAME){
1718 if(isRegExp(searchString))throw TypeError('String#' + NAME + " doesn't accept regex!");
1719 return String(defined(that));
1720};
1721},{"27":27,"50":50}],99:[function(_dereq_,module,exports){
1722var $export = _dereq_(32)
1723 , fails = _dereq_(34)
1724 , defined = _dereq_(27)
1725 , quot = /"/g;
1726// B.2.3.2.1 CreateHTML(string, tag, attribute, value)
1727var createHTML = function(string, tag, attribute, value) {
1728 var S = String(defined(string))
1729 , p1 = '<' + tag;
1730 if(attribute !== '')p1 += ' ' + attribute + '="' + String(value).replace(quot, '&quot;') + '"';
1731 return p1 + '>' + S + '</' + tag + '>';
1732};
1733module.exports = function(NAME, exec){
1734 var O = {};
1735 O[NAME] = exec(createHTML);
1736 $export($export.P + $export.F * fails(function(){
1737 var test = ''[NAME]('"');
1738 return test !== test.toLowerCase() || test.split('"').length > 3;
1739 }), 'String', O);
1740};
1741},{"27":27,"32":32,"34":34}],100:[function(_dereq_,module,exports){
1742// https://github.com/tc39/proposal-string-pad-start-end
1743var toLength = _dereq_(108)
1744 , repeat = _dereq_(101)
1745 , defined = _dereq_(27);
1746
1747module.exports = function(that, maxLength, fillString, left){
1748 var S = String(defined(that))
1749 , stringLength = S.length
1750 , fillStr = fillString === undefined ? ' ' : String(fillString)
1751 , intMaxLength = toLength(maxLength);
1752 if(intMaxLength <= stringLength || fillStr == '')return S;
1753 var fillLen = intMaxLength - stringLength
1754 , stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length));
1755 if(stringFiller.length > fillLen)stringFiller = stringFiller.slice(0, fillLen);
1756 return left ? stringFiller + S : S + stringFiller;
1757};
1758
1759},{"101":101,"108":108,"27":27}],101:[function(_dereq_,module,exports){
1760'use strict';
1761var toInteger = _dereq_(106)
1762 , defined = _dereq_(27);
1763
1764module.exports = function repeat(count){
1765 var str = String(defined(this))
1766 , res = ''
1767 , n = toInteger(count);
1768 if(n < 0 || n == Infinity)throw RangeError("Count can't be negative");
1769 for(;n > 0; (n >>>= 1) && (str += str))if(n & 1)res += str;
1770 return res;
1771};
1772},{"106":106,"27":27}],102:[function(_dereq_,module,exports){
1773var $export = _dereq_(32)
1774 , defined = _dereq_(27)
1775 , fails = _dereq_(34)
1776 , spaces = _dereq_(103)
1777 , space = '[' + spaces + ']'
1778 , non = '\u200b\u0085'
1779 , ltrim = RegExp('^' + space + space + '*')
1780 , rtrim = RegExp(space + space + '*$');
1781
1782var exporter = function(KEY, exec, ALIAS){
1783 var exp = {};
1784 var FORCE = fails(function(){
1785 return !!spaces[KEY]() || non[KEY]() != non;
1786 });
1787 var fn = exp[KEY] = FORCE ? exec(trim) : spaces[KEY];
1788 if(ALIAS)exp[ALIAS] = fn;
1789 $export($export.P + $export.F * FORCE, 'String', exp);
1790};
1791
1792// 1 -> String#trimLeft
1793// 2 -> String#trimRight
1794// 3 -> String#trim
1795var trim = exporter.trim = function(string, TYPE){
1796 string = String(defined(string));
1797 if(TYPE & 1)string = string.replace(ltrim, '');
1798 if(TYPE & 2)string = string.replace(rtrim, '');
1799 return string;
1800};
1801
1802module.exports = exporter;
1803},{"103":103,"27":27,"32":32,"34":34}],103:[function(_dereq_,module,exports){
1804module.exports = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' +
1805 '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
1806},{}],104:[function(_dereq_,module,exports){
1807var ctx = _dereq_(25)
1808 , invoke = _dereq_(44)
1809 , html = _dereq_(41)
1810 , cel = _dereq_(29)
1811 , global = _dereq_(38)
1812 , process = global.process
1813 , setTask = global.setImmediate
1814 , clearTask = global.clearImmediate
1815 , MessageChannel = global.MessageChannel
1816 , counter = 0
1817 , queue = {}
1818 , ONREADYSTATECHANGE = 'onreadystatechange'
1819 , defer, channel, port;
1820var run = function(){
1821 var id = +this;
1822 if(queue.hasOwnProperty(id)){
1823 var fn = queue[id];
1824 delete queue[id];
1825 fn();
1826 }
1827};
1828var listener = function(event){
1829 run.call(event.data);
1830};
1831// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
1832if(!setTask || !clearTask){
1833 setTask = function setImmediate(fn){
1834 var args = [], i = 1;
1835 while(arguments.length > i)args.push(arguments[i++]);
1836 queue[++counter] = function(){
1837 invoke(typeof fn == 'function' ? fn : Function(fn), args);
1838 };
1839 defer(counter);
1840 return counter;
1841 };
1842 clearTask = function clearImmediate(id){
1843 delete queue[id];
1844 };
1845 // Node.js 0.8-
1846 if(_dereq_(18)(process) == 'process'){
1847 defer = function(id){
1848 process.nextTick(ctx(run, id, 1));
1849 };
1850 // Browsers with MessageChannel, includes WebWorkers
1851 } else if(MessageChannel){
1852 channel = new MessageChannel;
1853 port = channel.port2;
1854 channel.port1.onmessage = listener;
1855 defer = ctx(port.postMessage, port, 1);
1856 // Browsers with postMessage, skip WebWorkers
1857 // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
1858 } else if(global.addEventListener && typeof postMessage == 'function' && !global.importScripts){
1859 defer = function(id){
1860 global.postMessage(id + '', '*');
1861 };
1862 global.addEventListener('message', listener, false);
1863 // IE8-
1864 } else if(ONREADYSTATECHANGE in cel('script')){
1865 defer = function(id){
1866 html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function(){
1867 html.removeChild(this);
1868 run.call(id);
1869 };
1870 };
1871 // Rest old browsers
1872 } else {
1873 defer = function(id){
1874 setTimeout(ctx(run, id, 1), 0);
1875 };
1876 }
1877}
1878module.exports = {
1879 set: setTask,
1880 clear: clearTask
1881};
1882},{"18":18,"25":25,"29":29,"38":38,"41":41,"44":44}],105:[function(_dereq_,module,exports){
1883var toInteger = _dereq_(106)
1884 , max = Math.max
1885 , min = Math.min;
1886module.exports = function(index, length){
1887 index = toInteger(index);
1888 return index < 0 ? max(index + length, 0) : min(index, length);
1889};
1890},{"106":106}],106:[function(_dereq_,module,exports){
1891// 7.1.4 ToInteger
1892var ceil = Math.ceil
1893 , floor = Math.floor;
1894module.exports = function(it){
1895 return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
1896};
1897},{}],107:[function(_dereq_,module,exports){
1898// to indexed object, toObject with fallback for non-array-like ES3 strings
1899var IObject = _dereq_(45)
1900 , defined = _dereq_(27);
1901module.exports = function(it){
1902 return IObject(defined(it));
1903};
1904},{"27":27,"45":45}],108:[function(_dereq_,module,exports){
1905// 7.1.15 ToLength
1906var toInteger = _dereq_(106)
1907 , min = Math.min;
1908module.exports = function(it){
1909 return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
1910};
1911},{"106":106}],109:[function(_dereq_,module,exports){
1912// 7.1.13 ToObject(argument)
1913var defined = _dereq_(27);
1914module.exports = function(it){
1915 return Object(defined(it));
1916};
1917},{"27":27}],110:[function(_dereq_,module,exports){
1918// 7.1.1 ToPrimitive(input [, PreferredType])
1919var isObject = _dereq_(49);
1920// instead of the ES6 spec version, we didn't implement @@toPrimitive case
1921// and the second argument - flag - preferred type is a string
1922module.exports = function(it, S){
1923 if(!isObject(it))return it;
1924 var fn, val;
1925 if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
1926 if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;
1927 if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
1928 throw TypeError("Can't convert object to primitive value");
1929};
1930},{"49":49}],111:[function(_dereq_,module,exports){
1931'use strict';
1932if(_dereq_(28)){
1933 var LIBRARY = _dereq_(58)
1934 , global = _dereq_(38)
1935 , fails = _dereq_(34)
1936 , $export = _dereq_(32)
1937 , $typed = _dereq_(113)
1938 , $buffer = _dereq_(112)
1939 , ctx = _dereq_(25)
1940 , anInstance = _dereq_(6)
1941 , propertyDesc = _dereq_(85)
1942 , hide = _dereq_(40)
1943 , redefineAll = _dereq_(86)
1944 , toInteger = _dereq_(106)
1945 , toLength = _dereq_(108)
1946 , toIndex = _dereq_(105)
1947 , toPrimitive = _dereq_(110)
1948 , has = _dereq_(39)
1949 , same = _dereq_(89)
1950 , classof = _dereq_(17)
1951 , isObject = _dereq_(49)
1952 , toObject = _dereq_(109)
1953 , isArrayIter = _dereq_(46)
1954 , create = _dereq_(66)
1955 , getPrototypeOf = _dereq_(74)
1956 , gOPN = _dereq_(72).f
1957 , getIterFn = _dereq_(118)
1958 , uid = _dereq_(114)
1959 , wks = _dereq_(117)
1960 , createArrayMethod = _dereq_(12)
1961 , createArrayIncludes = _dereq_(11)
1962 , speciesConstructor = _dereq_(95)
1963 , ArrayIterators = _dereq_(130)
1964 , Iterators = _dereq_(56)
1965 , $iterDetect = _dereq_(54)
1966 , setSpecies = _dereq_(91)
1967 , arrayFill = _dereq_(9)
1968 , arrayCopyWithin = _dereq_(8)
1969 , $DP = _dereq_(67)
1970 , $GOPD = _dereq_(70)
1971 , dP = $DP.f
1972 , gOPD = $GOPD.f
1973 , RangeError = global.RangeError
1974 , TypeError = global.TypeError
1975 , Uint8Array = global.Uint8Array
1976 , ARRAY_BUFFER = 'ArrayBuffer'
1977 , SHARED_BUFFER = 'Shared' + ARRAY_BUFFER
1978 , BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT'
1979 , PROTOTYPE = 'prototype'
1980 , ArrayProto = Array[PROTOTYPE]
1981 , $ArrayBuffer = $buffer.ArrayBuffer
1982 , $DataView = $buffer.DataView
1983 , arrayForEach = createArrayMethod(0)
1984 , arrayFilter = createArrayMethod(2)
1985 , arraySome = createArrayMethod(3)
1986 , arrayEvery = createArrayMethod(4)
1987 , arrayFind = createArrayMethod(5)
1988 , arrayFindIndex = createArrayMethod(6)
1989 , arrayIncludes = createArrayIncludes(true)
1990 , arrayIndexOf = createArrayIncludes(false)
1991 , arrayValues = ArrayIterators.values
1992 , arrayKeys = ArrayIterators.keys
1993 , arrayEntries = ArrayIterators.entries
1994 , arrayLastIndexOf = ArrayProto.lastIndexOf
1995 , arrayReduce = ArrayProto.reduce
1996 , arrayReduceRight = ArrayProto.reduceRight
1997 , arrayJoin = ArrayProto.join
1998 , arraySort = ArrayProto.sort
1999 , arraySlice = ArrayProto.slice
2000 , arrayToString = ArrayProto.toString
2001 , arrayToLocaleString = ArrayProto.toLocaleString
2002 , ITERATOR = wks('iterator')
2003 , TAG = wks('toStringTag')
2004 , TYPED_CONSTRUCTOR = uid('typed_constructor')
2005 , DEF_CONSTRUCTOR = uid('def_constructor')
2006 , ALL_CONSTRUCTORS = $typed.CONSTR
2007 , TYPED_ARRAY = $typed.TYPED
2008 , VIEW = $typed.VIEW
2009 , WRONG_LENGTH = 'Wrong length!';
2010
2011 var $map = createArrayMethod(1, function(O, length){
2012 return allocate(speciesConstructor(O, O[DEF_CONSTRUCTOR]), length);
2013 });
2014
2015 var LITTLE_ENDIAN = fails(function(){
2016 return new Uint8Array(new Uint16Array([1]).buffer)[0] === 1;
2017 });
2018
2019 var FORCED_SET = !!Uint8Array && !!Uint8Array[PROTOTYPE].set && fails(function(){
2020 new Uint8Array(1).set({});
2021 });
2022
2023 var strictToLength = function(it, SAME){
2024 if(it === undefined)throw TypeError(WRONG_LENGTH);
2025 var number = +it
2026 , length = toLength(it);
2027 if(SAME && !same(number, length))throw RangeError(WRONG_LENGTH);
2028 return length;
2029 };
2030
2031 var toOffset = function(it, BYTES){
2032 var offset = toInteger(it);
2033 if(offset < 0 || offset % BYTES)throw RangeError('Wrong offset!');
2034 return offset;
2035 };
2036
2037 var validate = function(it){
2038 if(isObject(it) && TYPED_ARRAY in it)return it;
2039 throw TypeError(it + ' is not a typed array!');
2040 };
2041
2042 var allocate = function(C, length){
2043 if(!(isObject(C) && TYPED_CONSTRUCTOR in C)){
2044 throw TypeError('It is not a typed array constructor!');
2045 } return new C(length);
2046 };
2047
2048 var speciesFromList = function(O, list){
2049 return fromList(speciesConstructor(O, O[DEF_CONSTRUCTOR]), list);
2050 };
2051
2052 var fromList = function(C, list){
2053 var index = 0
2054 , length = list.length
2055 , result = allocate(C, length);
2056 while(length > index)result[index] = list[index++];
2057 return result;
2058 };
2059
2060 var addGetter = function(it, key, internal){
2061 dP(it, key, {get: function(){ return this._d[internal]; }});
2062 };
2063
2064 var $from = function from(source /*, mapfn, thisArg */){
2065 var O = toObject(source)
2066 , aLen = arguments.length
2067 , mapfn = aLen > 1 ? arguments[1] : undefined
2068 , mapping = mapfn !== undefined
2069 , iterFn = getIterFn(O)
2070 , i, length, values, result, step, iterator;
2071 if(iterFn != undefined && !isArrayIter(iterFn)){
2072 for(iterator = iterFn.call(O), values = [], i = 0; !(step = iterator.next()).done; i++){
2073 values.push(step.value);
2074 } O = values;
2075 }
2076 if(mapping && aLen > 2)mapfn = ctx(mapfn, arguments[2], 2);
2077 for(i = 0, length = toLength(O.length), result = allocate(this, length); length > i; i++){
2078 result[i] = mapping ? mapfn(O[i], i) : O[i];
2079 }
2080 return result;
2081 };
2082
2083 var $of = function of(/*...items*/){
2084 var index = 0
2085 , length = arguments.length
2086 , result = allocate(this, length);
2087 while(length > index)result[index] = arguments[index++];
2088 return result;
2089 };
2090
2091 // iOS Safari 6.x fails here
2092 var TO_LOCALE_BUG = !!Uint8Array && fails(function(){ arrayToLocaleString.call(new Uint8Array(1)); });
2093
2094 var $toLocaleString = function toLocaleString(){
2095 return arrayToLocaleString.apply(TO_LOCALE_BUG ? arraySlice.call(validate(this)) : validate(this), arguments);
2096 };
2097
2098 var proto = {
2099 copyWithin: function copyWithin(target, start /*, end */){
2100 return arrayCopyWithin.call(validate(this), target, start, arguments.length > 2 ? arguments[2] : undefined);
2101 },
2102 every: function every(callbackfn /*, thisArg */){
2103 return arrayEvery(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2104 },
2105 fill: function fill(value /*, start, end */){ // eslint-disable-line no-unused-vars
2106 return arrayFill.apply(validate(this), arguments);
2107 },
2108 filter: function filter(callbackfn /*, thisArg */){
2109 return speciesFromList(this, arrayFilter(validate(this), callbackfn,
2110 arguments.length > 1 ? arguments[1] : undefined));
2111 },
2112 find: function find(predicate /*, thisArg */){
2113 return arrayFind(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
2114 },
2115 findIndex: function findIndex(predicate /*, thisArg */){
2116 return arrayFindIndex(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
2117 },
2118 forEach: function forEach(callbackfn /*, thisArg */){
2119 arrayForEach(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2120 },
2121 indexOf: function indexOf(searchElement /*, fromIndex */){
2122 return arrayIndexOf(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
2123 },
2124 includes: function includes(searchElement /*, fromIndex */){
2125 return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
2126 },
2127 join: function join(separator){ // eslint-disable-line no-unused-vars
2128 return arrayJoin.apply(validate(this), arguments);
2129 },
2130 lastIndexOf: function lastIndexOf(searchElement /*, fromIndex */){ // eslint-disable-line no-unused-vars
2131 return arrayLastIndexOf.apply(validate(this), arguments);
2132 },
2133 map: function map(mapfn /*, thisArg */){
2134 return $map(validate(this), mapfn, arguments.length > 1 ? arguments[1] : undefined);
2135 },
2136 reduce: function reduce(callbackfn /*, initialValue */){ // eslint-disable-line no-unused-vars
2137 return arrayReduce.apply(validate(this), arguments);
2138 },
2139 reduceRight: function reduceRight(callbackfn /*, initialValue */){ // eslint-disable-line no-unused-vars
2140 return arrayReduceRight.apply(validate(this), arguments);
2141 },
2142 reverse: function reverse(){
2143 var that = this
2144 , length = validate(that).length
2145 , middle = Math.floor(length / 2)
2146 , index = 0
2147 , value;
2148 while(index < middle){
2149 value = that[index];
2150 that[index++] = that[--length];
2151 that[length] = value;
2152 } return that;
2153 },
2154 some: function some(callbackfn /*, thisArg */){
2155 return arraySome(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2156 },
2157 sort: function sort(comparefn){
2158 return arraySort.call(validate(this), comparefn);
2159 },
2160 subarray: function subarray(begin, end){
2161 var O = validate(this)
2162 , length = O.length
2163 , $begin = toIndex(begin, length);
2164 return new (speciesConstructor(O, O[DEF_CONSTRUCTOR]))(
2165 O.buffer,
2166 O.byteOffset + $begin * O.BYTES_PER_ELEMENT,
2167 toLength((end === undefined ? length : toIndex(end, length)) - $begin)
2168 );
2169 }
2170 };
2171
2172 var $slice = function slice(start, end){
2173 return speciesFromList(this, arraySlice.call(validate(this), start, end));
2174 };
2175
2176 var $set = function set(arrayLike /*, offset */){
2177 validate(this);
2178 var offset = toOffset(arguments[1], 1)
2179 , length = this.length
2180 , src = toObject(arrayLike)
2181 , len = toLength(src.length)
2182 , index = 0;
2183 if(len + offset > length)throw RangeError(WRONG_LENGTH);
2184 while(index < len)this[offset + index] = src[index++];
2185 };
2186
2187 var $iterators = {
2188 entries: function entries(){
2189 return arrayEntries.call(validate(this));
2190 },
2191 keys: function keys(){
2192 return arrayKeys.call(validate(this));
2193 },
2194 values: function values(){
2195 return arrayValues.call(validate(this));
2196 }
2197 };
2198
2199 var isTAIndex = function(target, key){
2200 return isObject(target)
2201 && target[TYPED_ARRAY]
2202 && typeof key != 'symbol'
2203 && key in target
2204 && String(+key) == String(key);
2205 };
2206 var $getDesc = function getOwnPropertyDescriptor(target, key){
2207 return isTAIndex(target, key = toPrimitive(key, true))
2208 ? propertyDesc(2, target[key])
2209 : gOPD(target, key);
2210 };
2211 var $setDesc = function defineProperty(target, key, desc){
2212 if(isTAIndex(target, key = toPrimitive(key, true))
2213 && isObject(desc)
2214 && has(desc, 'value')
2215 && !has(desc, 'get')
2216 && !has(desc, 'set')
2217 // TODO: add validation descriptor w/o calling accessors
2218 && !desc.configurable
2219 && (!has(desc, 'writable') || desc.writable)
2220 && (!has(desc, 'enumerable') || desc.enumerable)
2221 ){
2222 target[key] = desc.value;
2223 return target;
2224 } else return dP(target, key, desc);
2225 };
2226
2227 if(!ALL_CONSTRUCTORS){
2228 $GOPD.f = $getDesc;
2229 $DP.f = $setDesc;
2230 }
2231
2232 $export($export.S + $export.F * !ALL_CONSTRUCTORS, 'Object', {
2233 getOwnPropertyDescriptor: $getDesc,
2234 defineProperty: $setDesc
2235 });
2236
2237 if(fails(function(){ arrayToString.call({}); })){
2238 arrayToString = arrayToLocaleString = function toString(){
2239 return arrayJoin.call(this);
2240 }
2241 }
2242
2243 var $TypedArrayPrototype$ = redefineAll({}, proto);
2244 redefineAll($TypedArrayPrototype$, $iterators);
2245 hide($TypedArrayPrototype$, ITERATOR, $iterators.values);
2246 redefineAll($TypedArrayPrototype$, {
2247 slice: $slice,
2248 set: $set,
2249 constructor: function(){ /* noop */ },
2250 toString: arrayToString,
2251 toLocaleString: $toLocaleString
2252 });
2253 addGetter($TypedArrayPrototype$, 'buffer', 'b');
2254 addGetter($TypedArrayPrototype$, 'byteOffset', 'o');
2255 addGetter($TypedArrayPrototype$, 'byteLength', 'l');
2256 addGetter($TypedArrayPrototype$, 'length', 'e');
2257 dP($TypedArrayPrototype$, TAG, {
2258 get: function(){ return this[TYPED_ARRAY]; }
2259 });
2260
2261 module.exports = function(KEY, BYTES, wrapper, CLAMPED){
2262 CLAMPED = !!CLAMPED;
2263 var NAME = KEY + (CLAMPED ? 'Clamped' : '') + 'Array'
2264 , ISNT_UINT8 = NAME != 'Uint8Array'
2265 , GETTER = 'get' + KEY
2266 , SETTER = 'set' + KEY
2267 , TypedArray = global[NAME]
2268 , Base = TypedArray || {}
2269 , TAC = TypedArray && getPrototypeOf(TypedArray)
2270 , FORCED = !TypedArray || !$typed.ABV
2271 , O = {}
2272 , TypedArrayPrototype = TypedArray && TypedArray[PROTOTYPE];
2273 var getter = function(that, index){
2274 var data = that._d;
2275 return data.v[GETTER](index * BYTES + data.o, LITTLE_ENDIAN);
2276 };
2277 var setter = function(that, index, value){
2278 var data = that._d;
2279 if(CLAMPED)value = (value = Math.round(value)) < 0 ? 0 : value > 0xff ? 0xff : value & 0xff;
2280 data.v[SETTER](index * BYTES + data.o, value, LITTLE_ENDIAN);
2281 };
2282 var addElement = function(that, index){
2283 dP(that, index, {
2284 get: function(){
2285 return getter(this, index);
2286 },
2287 set: function(value){
2288 return setter(this, index, value);
2289 },
2290 enumerable: true
2291 });
2292 };
2293 if(FORCED){
2294 TypedArray = wrapper(function(that, data, $offset, $length){
2295 anInstance(that, TypedArray, NAME, '_d');
2296 var index = 0
2297 , offset = 0
2298 , buffer, byteLength, length, klass;
2299 if(!isObject(data)){
2300 length = strictToLength(data, true)
2301 byteLength = length * BYTES;
2302 buffer = new $ArrayBuffer(byteLength);
2303 } else if(data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER){
2304 buffer = data;
2305 offset = toOffset($offset, BYTES);
2306 var $len = data.byteLength;
2307 if($length === undefined){
2308 if($len % BYTES)throw RangeError(WRONG_LENGTH);
2309 byteLength = $len - offset;
2310 if(byteLength < 0)throw RangeError(WRONG_LENGTH);
2311 } else {
2312 byteLength = toLength($length) * BYTES;
2313 if(byteLength + offset > $len)throw RangeError(WRONG_LENGTH);
2314 }
2315 length = byteLength / BYTES;
2316 } else if(TYPED_ARRAY in data){
2317 return fromList(TypedArray, data);
2318 } else {
2319 return $from.call(TypedArray, data);
2320 }
2321 hide(that, '_d', {
2322 b: buffer,
2323 o: offset,
2324 l: byteLength,
2325 e: length,
2326 v: new $DataView(buffer)
2327 });
2328 while(index < length)addElement(that, index++);
2329 });
2330 TypedArrayPrototype = TypedArray[PROTOTYPE] = create($TypedArrayPrototype$);
2331 hide(TypedArrayPrototype, 'constructor', TypedArray);
2332 } else if(!$iterDetect(function(iter){
2333 // V8 works with iterators, but fails in many other cases
2334 // https://code.google.com/p/v8/issues/detail?id=4552
2335 new TypedArray(null); // eslint-disable-line no-new
2336 new TypedArray(iter); // eslint-disable-line no-new
2337 }, true)){
2338 TypedArray = wrapper(function(that, data, $offset, $length){
2339 anInstance(that, TypedArray, NAME);
2340 var klass;
2341 // `ws` module bug, temporarily remove validation length for Uint8Array
2342 // https://github.com/websockets/ws/pull/645
2343 if(!isObject(data))return new Base(strictToLength(data, ISNT_UINT8));
2344 if(data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER){
2345 return $length !== undefined
2346 ? new Base(data, toOffset($offset, BYTES), $length)
2347 : $offset !== undefined
2348 ? new Base(data, toOffset($offset, BYTES))
2349 : new Base(data);
2350 }
2351 if(TYPED_ARRAY in data)return fromList(TypedArray, data);
2352 return $from.call(TypedArray, data);
2353 });
2354 arrayForEach(TAC !== Function.prototype ? gOPN(Base).concat(gOPN(TAC)) : gOPN(Base), function(key){
2355 if(!(key in TypedArray))hide(TypedArray, key, Base[key]);
2356 });
2357 TypedArray[PROTOTYPE] = TypedArrayPrototype;
2358 if(!LIBRARY)TypedArrayPrototype.constructor = TypedArray;
2359 }
2360 var $nativeIterator = TypedArrayPrototype[ITERATOR]
2361 , CORRECT_ITER_NAME = !!$nativeIterator && ($nativeIterator.name == 'values' || $nativeIterator.name == undefined)
2362 , $iterator = $iterators.values;
2363 hide(TypedArray, TYPED_CONSTRUCTOR, true);
2364 hide(TypedArrayPrototype, TYPED_ARRAY, NAME);
2365 hide(TypedArrayPrototype, VIEW, true);
2366 hide(TypedArrayPrototype, DEF_CONSTRUCTOR, TypedArray);
2367
2368 if(CLAMPED ? new TypedArray(1)[TAG] != NAME : !(TAG in TypedArrayPrototype)){
2369 dP(TypedArrayPrototype, TAG, {
2370 get: function(){ return NAME; }
2371 });
2372 }
2373
2374 O[NAME] = TypedArray;
2375
2376 $export($export.G + $export.W + $export.F * (TypedArray != Base), O);
2377
2378 $export($export.S, NAME, {
2379 BYTES_PER_ELEMENT: BYTES,
2380 from: $from,
2381 of: $of
2382 });
2383
2384 if(!(BYTES_PER_ELEMENT in TypedArrayPrototype))hide(TypedArrayPrototype, BYTES_PER_ELEMENT, BYTES);
2385
2386 $export($export.P, NAME, proto);
2387
2388 setSpecies(NAME);
2389
2390 $export($export.P + $export.F * FORCED_SET, NAME, {set: $set});
2391
2392 $export($export.P + $export.F * !CORRECT_ITER_NAME, NAME, $iterators);
2393
2394 $export($export.P + $export.F * (TypedArrayPrototype.toString != arrayToString), NAME, {toString: arrayToString});
2395
2396 $export($export.P + $export.F * fails(function(){
2397 new TypedArray(1).slice();
2398 }), NAME, {slice: $slice});
2399
2400 $export($export.P + $export.F * (fails(function(){
2401 return [1, 2].toLocaleString() != new TypedArray([1, 2]).toLocaleString()
2402 }) || !fails(function(){
2403 TypedArrayPrototype.toLocaleString.call([1, 2]);
2404 })), NAME, {toLocaleString: $toLocaleString});
2405
2406 Iterators[NAME] = CORRECT_ITER_NAME ? $nativeIterator : $iterator;
2407 if(!LIBRARY && !CORRECT_ITER_NAME)hide(TypedArrayPrototype, ITERATOR, $iterator);
2408 };
2409} else module.exports = function(){ /* empty */ };
2410},{"105":105,"106":106,"108":108,"109":109,"11":11,"110":110,"112":112,"113":113,"114":114,"117":117,"118":118,"12":12,"130":130,"17":17,"25":25,"28":28,"32":32,"34":34,"38":38,"39":39,"40":40,"46":46,"49":49,"54":54,"56":56,"58":58,"6":6,"66":66,"67":67,"70":70,"72":72,"74":74,"8":8,"85":85,"86":86,"89":89,"9":9,"91":91,"95":95}],112:[function(_dereq_,module,exports){
2411'use strict';
2412var global = _dereq_(38)
2413 , DESCRIPTORS = _dereq_(28)
2414 , LIBRARY = _dereq_(58)
2415 , $typed = _dereq_(113)
2416 , hide = _dereq_(40)
2417 , redefineAll = _dereq_(86)
2418 , fails = _dereq_(34)
2419 , anInstance = _dereq_(6)
2420 , toInteger = _dereq_(106)
2421 , toLength = _dereq_(108)
2422 , gOPN = _dereq_(72).f
2423 , dP = _dereq_(67).f
2424 , arrayFill = _dereq_(9)
2425 , setToStringTag = _dereq_(92)
2426 , ARRAY_BUFFER = 'ArrayBuffer'
2427 , DATA_VIEW = 'DataView'
2428 , PROTOTYPE = 'prototype'
2429 , WRONG_LENGTH = 'Wrong length!'
2430 , WRONG_INDEX = 'Wrong index!'
2431 , $ArrayBuffer = global[ARRAY_BUFFER]
2432 , $DataView = global[DATA_VIEW]
2433 , Math = global.Math
2434 , RangeError = global.RangeError
2435 , Infinity = global.Infinity
2436 , BaseBuffer = $ArrayBuffer
2437 , abs = Math.abs
2438 , pow = Math.pow
2439 , floor = Math.floor
2440 , log = Math.log
2441 , LN2 = Math.LN2
2442 , BUFFER = 'buffer'
2443 , BYTE_LENGTH = 'byteLength'
2444 , BYTE_OFFSET = 'byteOffset'
2445 , $BUFFER = DESCRIPTORS ? '_b' : BUFFER
2446 , $LENGTH = DESCRIPTORS ? '_l' : BYTE_LENGTH
2447 , $OFFSET = DESCRIPTORS ? '_o' : BYTE_OFFSET;
2448
2449// IEEE754 conversions based on https://github.com/feross/ieee754
2450var packIEEE754 = function(value, mLen, nBytes){
2451 var buffer = Array(nBytes)
2452 , eLen = nBytes * 8 - mLen - 1
2453 , eMax = (1 << eLen) - 1
2454 , eBias = eMax >> 1
2455 , rt = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0
2456 , i = 0
2457 , s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0
2458 , e, m, c;
2459 value = abs(value)
2460 if(value != value || value === Infinity){
2461 m = value != value ? 1 : 0;
2462 e = eMax;
2463 } else {
2464 e = floor(log(value) / LN2);
2465 if(value * (c = pow(2, -e)) < 1){
2466 e--;
2467 c *= 2;
2468 }
2469 if(e + eBias >= 1){
2470 value += rt / c;
2471 } else {
2472 value += rt * pow(2, 1 - eBias);
2473 }
2474 if(value * c >= 2){
2475 e++;
2476 c /= 2;
2477 }
2478 if(e + eBias >= eMax){
2479 m = 0;
2480 e = eMax;
2481 } else if(e + eBias >= 1){
2482 m = (value * c - 1) * pow(2, mLen);
2483 e = e + eBias;
2484 } else {
2485 m = value * pow(2, eBias - 1) * pow(2, mLen);
2486 e = 0;
2487 }
2488 }
2489 for(; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8);
2490 e = e << mLen | m;
2491 eLen += mLen;
2492 for(; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8);
2493 buffer[--i] |= s * 128;
2494 return buffer;
2495};
2496var unpackIEEE754 = function(buffer, mLen, nBytes){
2497 var eLen = nBytes * 8 - mLen - 1
2498 , eMax = (1 << eLen) - 1
2499 , eBias = eMax >> 1
2500 , nBits = eLen - 7
2501 , i = nBytes - 1
2502 , s = buffer[i--]
2503 , e = s & 127
2504 , m;
2505 s >>= 7;
2506 for(; nBits > 0; e = e * 256 + buffer[i], i--, nBits -= 8);
2507 m = e & (1 << -nBits) - 1;
2508 e >>= -nBits;
2509 nBits += mLen;
2510 for(; nBits > 0; m = m * 256 + buffer[i], i--, nBits -= 8);
2511 if(e === 0){
2512 e = 1 - eBias;
2513 } else if(e === eMax){
2514 return m ? NaN : s ? -Infinity : Infinity;
2515 } else {
2516 m = m + pow(2, mLen);
2517 e = e - eBias;
2518 } return (s ? -1 : 1) * m * pow(2, e - mLen);
2519};
2520
2521var unpackI32 = function(bytes){
2522 return bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0];
2523};
2524var packI8 = function(it){
2525 return [it & 0xff];
2526};
2527var packI16 = function(it){
2528 return [it & 0xff, it >> 8 & 0xff];
2529};
2530var packI32 = function(it){
2531 return [it & 0xff, it >> 8 & 0xff, it >> 16 & 0xff, it >> 24 & 0xff];
2532};
2533var packF64 = function(it){
2534 return packIEEE754(it, 52, 8);
2535};
2536var packF32 = function(it){
2537 return packIEEE754(it, 23, 4);
2538};
2539
2540var addGetter = function(C, key, internal){
2541 dP(C[PROTOTYPE], key, {get: function(){ return this[internal]; }});
2542};
2543
2544var get = function(view, bytes, index, isLittleEndian){
2545 var numIndex = +index
2546 , intIndex = toInteger(numIndex);
2547 if(numIndex != intIndex || intIndex < 0 || intIndex + bytes > view[$LENGTH])throw RangeError(WRONG_INDEX);
2548 var store = view[$BUFFER]._b
2549 , start = intIndex + view[$OFFSET]
2550 , pack = store.slice(start, start + bytes);
2551 return isLittleEndian ? pack : pack.reverse();
2552};
2553var set = function(view, bytes, index, conversion, value, isLittleEndian){
2554 var numIndex = +index
2555 , intIndex = toInteger(numIndex);
2556 if(numIndex != intIndex || intIndex < 0 || intIndex + bytes > view[$LENGTH])throw RangeError(WRONG_INDEX);
2557 var store = view[$BUFFER]._b
2558 , start = intIndex + view[$OFFSET]
2559 , pack = conversion(+value);
2560 for(var i = 0; i < bytes; i++)store[start + i] = pack[isLittleEndian ? i : bytes - i - 1];
2561};
2562
2563var validateArrayBufferArguments = function(that, length){
2564 anInstance(that, $ArrayBuffer, ARRAY_BUFFER);
2565 var numberLength = +length
2566 , byteLength = toLength(numberLength);
2567 if(numberLength != byteLength)throw RangeError(WRONG_LENGTH);
2568 return byteLength;
2569};
2570
2571if(!$typed.ABV){
2572 $ArrayBuffer = function ArrayBuffer(length){
2573 var byteLength = validateArrayBufferArguments(this, length);
2574 this._b = arrayFill.call(Array(byteLength), 0);
2575 this[$LENGTH] = byteLength;
2576 };
2577
2578 $DataView = function DataView(buffer, byteOffset, byteLength){
2579 anInstance(this, $DataView, DATA_VIEW);
2580 anInstance(buffer, $ArrayBuffer, DATA_VIEW);
2581 var bufferLength = buffer[$LENGTH]
2582 , offset = toInteger(byteOffset);
2583 if(offset < 0 || offset > bufferLength)throw RangeError('Wrong offset!');
2584 byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength);
2585 if(offset + byteLength > bufferLength)throw RangeError(WRONG_LENGTH);
2586 this[$BUFFER] = buffer;
2587 this[$OFFSET] = offset;
2588 this[$LENGTH] = byteLength;
2589 };
2590
2591 if(DESCRIPTORS){
2592 addGetter($ArrayBuffer, BYTE_LENGTH, '_l');
2593 addGetter($DataView, BUFFER, '_b');
2594 addGetter($DataView, BYTE_LENGTH, '_l');
2595 addGetter($DataView, BYTE_OFFSET, '_o');
2596 }
2597
2598 redefineAll($DataView[PROTOTYPE], {
2599 getInt8: function getInt8(byteOffset){
2600 return get(this, 1, byteOffset)[0] << 24 >> 24;
2601 },
2602 getUint8: function getUint8(byteOffset){
2603 return get(this, 1, byteOffset)[0];
2604 },
2605 getInt16: function getInt16(byteOffset /*, littleEndian */){
2606 var bytes = get(this, 2, byteOffset, arguments[1]);
2607 return (bytes[1] << 8 | bytes[0]) << 16 >> 16;
2608 },
2609 getUint16: function getUint16(byteOffset /*, littleEndian */){
2610 var bytes = get(this, 2, byteOffset, arguments[1]);
2611 return bytes[1] << 8 | bytes[0];
2612 },
2613 getInt32: function getInt32(byteOffset /*, littleEndian */){
2614 return unpackI32(get(this, 4, byteOffset, arguments[1]));
2615 },
2616 getUint32: function getUint32(byteOffset /*, littleEndian */){
2617 return unpackI32(get(this, 4, byteOffset, arguments[1])) >>> 0;
2618 },
2619 getFloat32: function getFloat32(byteOffset /*, littleEndian */){
2620 return unpackIEEE754(get(this, 4, byteOffset, arguments[1]), 23, 4);
2621 },
2622 getFloat64: function getFloat64(byteOffset /*, littleEndian */){
2623 return unpackIEEE754(get(this, 8, byteOffset, arguments[1]), 52, 8);
2624 },
2625 setInt8: function setInt8(byteOffset, value){
2626 set(this, 1, byteOffset, packI8, value);
2627 },
2628 setUint8: function setUint8(byteOffset, value){
2629 set(this, 1, byteOffset, packI8, value);
2630 },
2631 setInt16: function setInt16(byteOffset, value /*, littleEndian */){
2632 set(this, 2, byteOffset, packI16, value, arguments[2]);
2633 },
2634 setUint16: function setUint16(byteOffset, value /*, littleEndian */){
2635 set(this, 2, byteOffset, packI16, value, arguments[2]);
2636 },
2637 setInt32: function setInt32(byteOffset, value /*, littleEndian */){
2638 set(this, 4, byteOffset, packI32, value, arguments[2]);
2639 },
2640 setUint32: function setUint32(byteOffset, value /*, littleEndian */){
2641 set(this, 4, byteOffset, packI32, value, arguments[2]);
2642 },
2643 setFloat32: function setFloat32(byteOffset, value /*, littleEndian */){
2644 set(this, 4, byteOffset, packF32, value, arguments[2]);
2645 },
2646 setFloat64: function setFloat64(byteOffset, value /*, littleEndian */){
2647 set(this, 8, byteOffset, packF64, value, arguments[2]);
2648 }
2649 });
2650} else {
2651 if(!fails(function(){
2652 new $ArrayBuffer; // eslint-disable-line no-new
2653 }) || !fails(function(){
2654 new $ArrayBuffer(.5); // eslint-disable-line no-new
2655 })){
2656 $ArrayBuffer = function ArrayBuffer(length){
2657 return new BaseBuffer(validateArrayBufferArguments(this, length));
2658 };
2659 var ArrayBufferProto = $ArrayBuffer[PROTOTYPE] = BaseBuffer[PROTOTYPE];
2660 for(var keys = gOPN(BaseBuffer), j = 0, key; keys.length > j; ){
2661 if(!((key = keys[j++]) in $ArrayBuffer))hide($ArrayBuffer, key, BaseBuffer[key]);
2662 };
2663 if(!LIBRARY)ArrayBufferProto.constructor = $ArrayBuffer;
2664 }
2665 // iOS Safari 7.x bug
2666 var view = new $DataView(new $ArrayBuffer(2))
2667 , $setInt8 = $DataView[PROTOTYPE].setInt8;
2668 view.setInt8(0, 2147483648);
2669 view.setInt8(1, 2147483649);
2670 if(view.getInt8(0) || !view.getInt8(1))redefineAll($DataView[PROTOTYPE], {
2671 setInt8: function setInt8(byteOffset, value){
2672 $setInt8.call(this, byteOffset, value << 24 >> 24);
2673 },
2674 setUint8: function setUint8(byteOffset, value){
2675 $setInt8.call(this, byteOffset, value << 24 >> 24);
2676 }
2677 }, true);
2678}
2679setToStringTag($ArrayBuffer, ARRAY_BUFFER);
2680setToStringTag($DataView, DATA_VIEW);
2681hide($DataView[PROTOTYPE], $typed.VIEW, true);
2682exports[ARRAY_BUFFER] = $ArrayBuffer;
2683exports[DATA_VIEW] = $DataView;
2684},{"106":106,"108":108,"113":113,"28":28,"34":34,"38":38,"40":40,"58":58,"6":6,"67":67,"72":72,"86":86,"9":9,"92":92}],113:[function(_dereq_,module,exports){
2685var global = _dereq_(38)
2686 , hide = _dereq_(40)
2687 , uid = _dereq_(114)
2688 , TYPED = uid('typed_array')
2689 , VIEW = uid('view')
2690 , ABV = !!(global.ArrayBuffer && global.DataView)
2691 , CONSTR = ABV
2692 , i = 0, l = 9, Typed;
2693
2694var TypedArrayConstructors = (
2695 'Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array'
2696).split(',');
2697
2698while(i < l){
2699 if(Typed = global[TypedArrayConstructors[i++]]){
2700 hide(Typed.prototype, TYPED, true);
2701 hide(Typed.prototype, VIEW, true);
2702 } else CONSTR = false;
2703}
2704
2705module.exports = {
2706 ABV: ABV,
2707 CONSTR: CONSTR,
2708 TYPED: TYPED,
2709 VIEW: VIEW
2710};
2711},{"114":114,"38":38,"40":40}],114:[function(_dereq_,module,exports){
2712var id = 0
2713 , px = Math.random();
2714module.exports = function(key){
2715 return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
2716};
2717},{}],115:[function(_dereq_,module,exports){
2718var global = _dereq_(38)
2719 , core = _dereq_(23)
2720 , LIBRARY = _dereq_(58)
2721 , wksExt = _dereq_(116)
2722 , defineProperty = _dereq_(67).f;
2723module.exports = function(name){
2724 var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
2725 if(name.charAt(0) != '_' && !(name in $Symbol))defineProperty($Symbol, name, {value: wksExt.f(name)});
2726};
2727},{"116":116,"23":23,"38":38,"58":58,"67":67}],116:[function(_dereq_,module,exports){
2728exports.f = _dereq_(117);
2729},{"117":117}],117:[function(_dereq_,module,exports){
2730var store = _dereq_(94)('wks')
2731 , uid = _dereq_(114)
2732 , Symbol = _dereq_(38).Symbol
2733 , USE_SYMBOL = typeof Symbol == 'function';
2734
2735var $exports = module.exports = function(name){
2736 return store[name] || (store[name] =
2737 USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
2738};
2739
2740$exports.store = store;
2741},{"114":114,"38":38,"94":94}],118:[function(_dereq_,module,exports){
2742var classof = _dereq_(17)
2743 , ITERATOR = _dereq_(117)('iterator')
2744 , Iterators = _dereq_(56);
2745module.exports = _dereq_(23).getIteratorMethod = function(it){
2746 if(it != undefined)return it[ITERATOR]
2747 || it['@@iterator']
2748 || Iterators[classof(it)];
2749};
2750},{"117":117,"17":17,"23":23,"56":56}],119:[function(_dereq_,module,exports){
2751// https://github.com/benjamingr/RexExp.escape
2752var $export = _dereq_(32)
2753 , $re = _dereq_(88)(/[\\^$*+?.()|[\]{}]/g, '\\$&');
2754
2755$export($export.S, 'RegExp', {escape: function escape(it){ return $re(it); }});
2756
2757},{"32":32,"88":88}],120:[function(_dereq_,module,exports){
2758// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
2759var $export = _dereq_(32);
2760
2761$export($export.P, 'Array', {copyWithin: _dereq_(8)});
2762
2763_dereq_(5)('copyWithin');
2764},{"32":32,"5":5,"8":8}],121:[function(_dereq_,module,exports){
2765'use strict';
2766var $export = _dereq_(32)
2767 , $every = _dereq_(12)(4);
2768
2769$export($export.P + $export.F * !_dereq_(96)([].every, true), 'Array', {
2770 // 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg])
2771 every: function every(callbackfn /* , thisArg */){
2772 return $every(this, callbackfn, arguments[1]);
2773 }
2774});
2775},{"12":12,"32":32,"96":96}],122:[function(_dereq_,module,exports){
2776// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
2777var $export = _dereq_(32);
2778
2779$export($export.P, 'Array', {fill: _dereq_(9)});
2780
2781_dereq_(5)('fill');
2782},{"32":32,"5":5,"9":9}],123:[function(_dereq_,module,exports){
2783'use strict';
2784var $export = _dereq_(32)
2785 , $filter = _dereq_(12)(2);
2786
2787$export($export.P + $export.F * !_dereq_(96)([].filter, true), 'Array', {
2788 // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg])
2789 filter: function filter(callbackfn /* , thisArg */){
2790 return $filter(this, callbackfn, arguments[1]);
2791 }
2792});
2793},{"12":12,"32":32,"96":96}],124:[function(_dereq_,module,exports){
2794'use strict';
2795// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined)
2796var $export = _dereq_(32)
2797 , $find = _dereq_(12)(6)
2798 , KEY = 'findIndex'
2799 , forced = true;
2800// Shouldn't skip holes
2801if(KEY in [])Array(1)[KEY](function(){ forced = false; });
2802$export($export.P + $export.F * forced, 'Array', {
2803 findIndex: function findIndex(callbackfn/*, that = undefined */){
2804 return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2805 }
2806});
2807_dereq_(5)(KEY);
2808},{"12":12,"32":32,"5":5}],125:[function(_dereq_,module,exports){
2809'use strict';
2810// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined)
2811var $export = _dereq_(32)
2812 , $find = _dereq_(12)(5)
2813 , KEY = 'find'
2814 , forced = true;
2815// Shouldn't skip holes
2816if(KEY in [])Array(1)[KEY](function(){ forced = false; });
2817$export($export.P + $export.F * forced, 'Array', {
2818 find: function find(callbackfn/*, that = undefined */){
2819 return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2820 }
2821});
2822_dereq_(5)(KEY);
2823},{"12":12,"32":32,"5":5}],126:[function(_dereq_,module,exports){
2824'use strict';
2825var $export = _dereq_(32)
2826 , $forEach = _dereq_(12)(0)
2827 , STRICT = _dereq_(96)([].forEach, true);
2828
2829$export($export.P + $export.F * !STRICT, 'Array', {
2830 // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg])
2831 forEach: function forEach(callbackfn /* , thisArg */){
2832 return $forEach(this, callbackfn, arguments[1]);
2833 }
2834});
2835},{"12":12,"32":32,"96":96}],127:[function(_dereq_,module,exports){
2836'use strict';
2837var ctx = _dereq_(25)
2838 , $export = _dereq_(32)
2839 , toObject = _dereq_(109)
2840 , call = _dereq_(51)
2841 , isArrayIter = _dereq_(46)
2842 , toLength = _dereq_(108)
2843 , createProperty = _dereq_(24)
2844 , getIterFn = _dereq_(118);
2845
2846$export($export.S + $export.F * !_dereq_(54)(function(iter){ Array.from(iter); }), 'Array', {
2847 // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
2848 from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){
2849 var O = toObject(arrayLike)
2850 , C = typeof this == 'function' ? this : Array
2851 , aLen = arguments.length
2852 , mapfn = aLen > 1 ? arguments[1] : undefined
2853 , mapping = mapfn !== undefined
2854 , index = 0
2855 , iterFn = getIterFn(O)
2856 , length, result, step, iterator;
2857 if(mapping)mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);
2858 // if object isn't iterable or it's array with default iterator - use simple case
2859 if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){
2860 for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){
2861 createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);
2862 }
2863 } else {
2864 length = toLength(O.length);
2865 for(result = new C(length); length > index; index++){
2866 createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
2867 }
2868 }
2869 result.length = index;
2870 return result;
2871 }
2872});
2873
2874},{"108":108,"109":109,"118":118,"24":24,"25":25,"32":32,"46":46,"51":51,"54":54}],128:[function(_dereq_,module,exports){
2875'use strict';
2876var $export = _dereq_(32)
2877 , $indexOf = _dereq_(11)(false)
2878 , $native = [].indexOf
2879 , NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0;
2880
2881$export($export.P + $export.F * (NEGATIVE_ZERO || !_dereq_(96)($native)), 'Array', {
2882 // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex])
2883 indexOf: function indexOf(searchElement /*, fromIndex = 0 */){
2884 return NEGATIVE_ZERO
2885 // convert -0 to +0
2886 ? $native.apply(this, arguments) || 0
2887 : $indexOf(this, searchElement, arguments[1]);
2888 }
2889});
2890},{"11":11,"32":32,"96":96}],129:[function(_dereq_,module,exports){
2891// 22.1.2.2 / 15.4.3.2 Array.isArray(arg)
2892var $export = _dereq_(32);
2893
2894$export($export.S, 'Array', {isArray: _dereq_(47)});
2895},{"32":32,"47":47}],130:[function(_dereq_,module,exports){
2896'use strict';
2897var addToUnscopables = _dereq_(5)
2898 , step = _dereq_(55)
2899 , Iterators = _dereq_(56)
2900 , toIObject = _dereq_(107);
2901
2902// 22.1.3.4 Array.prototype.entries()
2903// 22.1.3.13 Array.prototype.keys()
2904// 22.1.3.29 Array.prototype.values()
2905// 22.1.3.30 Array.prototype[@@iterator]()
2906module.exports = _dereq_(53)(Array, 'Array', function(iterated, kind){
2907 this._t = toIObject(iterated); // target
2908 this._i = 0; // next index
2909 this._k = kind; // kind
2910// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
2911}, function(){
2912 var O = this._t
2913 , kind = this._k
2914 , index = this._i++;
2915 if(!O || index >= O.length){
2916 this._t = undefined;
2917 return step(1);
2918 }
2919 if(kind == 'keys' )return step(0, index);
2920 if(kind == 'values')return step(0, O[index]);
2921 return step(0, [index, O[index]]);
2922}, 'values');
2923
2924// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
2925Iterators.Arguments = Iterators.Array;
2926
2927addToUnscopables('keys');
2928addToUnscopables('values');
2929addToUnscopables('entries');
2930},{"107":107,"5":5,"53":53,"55":55,"56":56}],131:[function(_dereq_,module,exports){
2931'use strict';
2932// 22.1.3.13 Array.prototype.join(separator)
2933var $export = _dereq_(32)
2934 , toIObject = _dereq_(107)
2935 , arrayJoin = [].join;
2936
2937// fallback for not array-like strings
2938$export($export.P + $export.F * (_dereq_(45) != Object || !_dereq_(96)(arrayJoin)), 'Array', {
2939 join: function join(separator){
2940 return arrayJoin.call(toIObject(this), separator === undefined ? ',' : separator);
2941 }
2942});
2943},{"107":107,"32":32,"45":45,"96":96}],132:[function(_dereq_,module,exports){
2944'use strict';
2945var $export = _dereq_(32)
2946 , toIObject = _dereq_(107)
2947 , toInteger = _dereq_(106)
2948 , toLength = _dereq_(108)
2949 , $native = [].lastIndexOf
2950 , NEGATIVE_ZERO = !!$native && 1 / [1].lastIndexOf(1, -0) < 0;
2951
2952$export($export.P + $export.F * (NEGATIVE_ZERO || !_dereq_(96)($native)), 'Array', {
2953 // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex])
2954 lastIndexOf: function lastIndexOf(searchElement /*, fromIndex = @[*-1] */){
2955 // convert -0 to +0
2956 if(NEGATIVE_ZERO)return $native.apply(this, arguments) || 0;
2957 var O = toIObject(this)
2958 , length = toLength(O.length)
2959 , index = length - 1;
2960 if(arguments.length > 1)index = Math.min(index, toInteger(arguments[1]));
2961 if(index < 0)index = length + index;
2962 for(;index >= 0; index--)if(index in O)if(O[index] === searchElement)return index || 0;
2963 return -1;
2964 }
2965});
2966},{"106":106,"107":107,"108":108,"32":32,"96":96}],133:[function(_dereq_,module,exports){
2967'use strict';
2968var $export = _dereq_(32)
2969 , $map = _dereq_(12)(1);
2970
2971$export($export.P + $export.F * !_dereq_(96)([].map, true), 'Array', {
2972 // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg])
2973 map: function map(callbackfn /* , thisArg */){
2974 return $map(this, callbackfn, arguments[1]);
2975 }
2976});
2977},{"12":12,"32":32,"96":96}],134:[function(_dereq_,module,exports){
2978'use strict';
2979var $export = _dereq_(32)
2980 , createProperty = _dereq_(24);
2981
2982// WebKit Array.of isn't generic
2983$export($export.S + $export.F * _dereq_(34)(function(){
2984 function F(){}
2985 return !(Array.of.call(F) instanceof F);
2986}), 'Array', {
2987 // 22.1.2.3 Array.of( ...items)
2988 of: function of(/* ...args */){
2989 var index = 0
2990 , aLen = arguments.length
2991 , result = new (typeof this == 'function' ? this : Array)(aLen);
2992 while(aLen > index)createProperty(result, index, arguments[index++]);
2993 result.length = aLen;
2994 return result;
2995 }
2996});
2997},{"24":24,"32":32,"34":34}],135:[function(_dereq_,module,exports){
2998'use strict';
2999var $export = _dereq_(32)
3000 , $reduce = _dereq_(13);
3001
3002$export($export.P + $export.F * !_dereq_(96)([].reduceRight, true), 'Array', {
3003 // 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue])
3004 reduceRight: function reduceRight(callbackfn /* , initialValue */){
3005 return $reduce(this, callbackfn, arguments.length, arguments[1], true);
3006 }
3007});
3008},{"13":13,"32":32,"96":96}],136:[function(_dereq_,module,exports){
3009'use strict';
3010var $export = _dereq_(32)
3011 , $reduce = _dereq_(13);
3012
3013$export($export.P + $export.F * !_dereq_(96)([].reduce, true), 'Array', {
3014 // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue])
3015 reduce: function reduce(callbackfn /* , initialValue */){
3016 return $reduce(this, callbackfn, arguments.length, arguments[1], false);
3017 }
3018});
3019},{"13":13,"32":32,"96":96}],137:[function(_dereq_,module,exports){
3020'use strict';
3021var $export = _dereq_(32)
3022 , html = _dereq_(41)
3023 , cof = _dereq_(18)
3024 , toIndex = _dereq_(105)
3025 , toLength = _dereq_(108)
3026 , arraySlice = [].slice;
3027
3028// fallback for not array-like ES3 strings and DOM objects
3029$export($export.P + $export.F * _dereq_(34)(function(){
3030 if(html)arraySlice.call(html);
3031}), 'Array', {
3032 slice: function slice(begin, end){
3033 var len = toLength(this.length)
3034 , klass = cof(this);
3035 end = end === undefined ? len : end;
3036 if(klass == 'Array')return arraySlice.call(this, begin, end);
3037 var start = toIndex(begin, len)
3038 , upTo = toIndex(end, len)
3039 , size = toLength(upTo - start)
3040 , cloned = Array(size)
3041 , i = 0;
3042 for(; i < size; i++)cloned[i] = klass == 'String'
3043 ? this.charAt(start + i)
3044 : this[start + i];
3045 return cloned;
3046 }
3047});
3048},{"105":105,"108":108,"18":18,"32":32,"34":34,"41":41}],138:[function(_dereq_,module,exports){
3049'use strict';
3050var $export = _dereq_(32)
3051 , $some = _dereq_(12)(3);
3052
3053$export($export.P + $export.F * !_dereq_(96)([].some, true), 'Array', {
3054 // 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg])
3055 some: function some(callbackfn /* , thisArg */){
3056 return $some(this, callbackfn, arguments[1]);
3057 }
3058});
3059},{"12":12,"32":32,"96":96}],139:[function(_dereq_,module,exports){
3060'use strict';
3061var $export = _dereq_(32)
3062 , aFunction = _dereq_(3)
3063 , toObject = _dereq_(109)
3064 , fails = _dereq_(34)
3065 , $sort = [].sort
3066 , test = [1, 2, 3];
3067
3068$export($export.P + $export.F * (fails(function(){
3069 // IE8-
3070 test.sort(undefined);
3071}) || !fails(function(){
3072 // V8 bug
3073 test.sort(null);
3074 // Old WebKit
3075}) || !_dereq_(96)($sort)), 'Array', {
3076 // 22.1.3.25 Array.prototype.sort(comparefn)
3077 sort: function sort(comparefn){
3078 return comparefn === undefined
3079 ? $sort.call(toObject(this))
3080 : $sort.call(toObject(this), aFunction(comparefn));
3081 }
3082});
3083},{"109":109,"3":3,"32":32,"34":34,"96":96}],140:[function(_dereq_,module,exports){
3084_dereq_(91)('Array');
3085},{"91":91}],141:[function(_dereq_,module,exports){
3086// 20.3.3.1 / 15.9.4.4 Date.now()
3087var $export = _dereq_(32);
3088
3089$export($export.S, 'Date', {now: function(){ return new Date().getTime(); }});
3090},{"32":32}],142:[function(_dereq_,module,exports){
3091'use strict';
3092// 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString()
3093var $export = _dereq_(32)
3094 , fails = _dereq_(34)
3095 , getTime = Date.prototype.getTime;
3096
3097var lz = function(num){
3098 return num > 9 ? num : '0' + num;
3099};
3100
3101// PhantomJS / old WebKit has a broken implementations
3102$export($export.P + $export.F * (fails(function(){
3103 return new Date(-5e13 - 1).toISOString() != '0385-07-25T07:06:39.999Z';
3104}) || !fails(function(){
3105 new Date(NaN).toISOString();
3106})), 'Date', {
3107 toISOString: function toISOString(){
3108 if(!isFinite(getTime.call(this)))throw RangeError('Invalid time value');
3109 var d = this
3110 , y = d.getUTCFullYear()
3111 , m = d.getUTCMilliseconds()
3112 , s = y < 0 ? '-' : y > 9999 ? '+' : '';
3113 return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) +
3114 '-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) +
3115 'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) +
3116 ':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z';
3117 }
3118});
3119},{"32":32,"34":34}],143:[function(_dereq_,module,exports){
3120'use strict';
3121var $export = _dereq_(32)
3122 , toObject = _dereq_(109)
3123 , toPrimitive = _dereq_(110);
3124
3125$export($export.P + $export.F * _dereq_(34)(function(){
3126 return new Date(NaN).toJSON() !== null || Date.prototype.toJSON.call({toISOString: function(){ return 1; }}) !== 1;
3127}), 'Date', {
3128 toJSON: function toJSON(key){
3129 var O = toObject(this)
3130 , pv = toPrimitive(O);
3131 return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString();
3132 }
3133});
3134},{"109":109,"110":110,"32":32,"34":34}],144:[function(_dereq_,module,exports){
3135var TO_PRIMITIVE = _dereq_(117)('toPrimitive')
3136 , proto = Date.prototype;
3137
3138if(!(TO_PRIMITIVE in proto))_dereq_(40)(proto, TO_PRIMITIVE, _dereq_(26));
3139},{"117":117,"26":26,"40":40}],145:[function(_dereq_,module,exports){
3140var DateProto = Date.prototype
3141 , INVALID_DATE = 'Invalid Date'
3142 , TO_STRING = 'toString'
3143 , $toString = DateProto[TO_STRING]
3144 , getTime = DateProto.getTime;
3145if(new Date(NaN) + '' != INVALID_DATE){
3146 _dereq_(87)(DateProto, TO_STRING, function toString(){
3147 var value = getTime.call(this);
3148 return value === value ? $toString.call(this) : INVALID_DATE;
3149 });
3150}
3151},{"87":87}],146:[function(_dereq_,module,exports){
3152// 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...)
3153var $export = _dereq_(32);
3154
3155$export($export.P, 'Function', {bind: _dereq_(16)});
3156},{"16":16,"32":32}],147:[function(_dereq_,module,exports){
3157'use strict';
3158var isObject = _dereq_(49)
3159 , getPrototypeOf = _dereq_(74)
3160 , HAS_INSTANCE = _dereq_(117)('hasInstance')
3161 , FunctionProto = Function.prototype;
3162// 19.2.3.6 Function.prototype[@@hasInstance](V)
3163if(!(HAS_INSTANCE in FunctionProto))_dereq_(67).f(FunctionProto, HAS_INSTANCE, {value: function(O){
3164 if(typeof this != 'function' || !isObject(O))return false;
3165 if(!isObject(this.prototype))return O instanceof this;
3166 // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this:
3167 while(O = getPrototypeOf(O))if(this.prototype === O)return true;
3168 return false;
3169}});
3170},{"117":117,"49":49,"67":67,"74":74}],148:[function(_dereq_,module,exports){
3171var dP = _dereq_(67).f
3172 , createDesc = _dereq_(85)
3173 , has = _dereq_(39)
3174 , FProto = Function.prototype
3175 , nameRE = /^\s*function ([^ (]*)/
3176 , NAME = 'name';
3177
3178var isExtensible = Object.isExtensible || function(){
3179 return true;
3180};
3181
3182// 19.2.4.2 name
3183NAME in FProto || _dereq_(28) && dP(FProto, NAME, {
3184 configurable: true,
3185 get: function(){
3186 try {
3187 var that = this
3188 , name = ('' + that).match(nameRE)[1];
3189 has(that, NAME) || !isExtensible(that) || dP(that, NAME, createDesc(5, name));
3190 return name;
3191 } catch(e){
3192 return '';
3193 }
3194 }
3195});
3196},{"28":28,"39":39,"67":67,"85":85}],149:[function(_dereq_,module,exports){
3197'use strict';
3198var strong = _dereq_(19);
3199
3200// 23.1 Map Objects
3201module.exports = _dereq_(22)('Map', function(get){
3202 return function Map(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
3203}, {
3204 // 23.1.3.6 Map.prototype.get(key)
3205 get: function get(key){
3206 var entry = strong.getEntry(this, key);
3207 return entry && entry.v;
3208 },
3209 // 23.1.3.9 Map.prototype.set(key, value)
3210 set: function set(key, value){
3211 return strong.def(this, key === 0 ? 0 : key, value);
3212 }
3213}, strong, true);
3214},{"19":19,"22":22}],150:[function(_dereq_,module,exports){
3215// 20.2.2.3 Math.acosh(x)
3216var $export = _dereq_(32)
3217 , log1p = _dereq_(60)
3218 , sqrt = Math.sqrt
3219 , $acosh = Math.acosh;
3220
3221$export($export.S + $export.F * !($acosh
3222 // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509
3223 && Math.floor($acosh(Number.MAX_VALUE)) == 710
3224 // Tor Browser bug: Math.acosh(Infinity) -> NaN
3225 && $acosh(Infinity) == Infinity
3226), 'Math', {
3227 acosh: function acosh(x){
3228 return (x = +x) < 1 ? NaN : x > 94906265.62425156
3229 ? Math.log(x) + Math.LN2
3230 : log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1));
3231 }
3232});
3233},{"32":32,"60":60}],151:[function(_dereq_,module,exports){
3234// 20.2.2.5 Math.asinh(x)
3235var $export = _dereq_(32)
3236 , $asinh = Math.asinh;
3237
3238function asinh(x){
3239 return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : Math.log(x + Math.sqrt(x * x + 1));
3240}
3241
3242// Tor Browser bug: Math.asinh(0) -> -0
3243$export($export.S + $export.F * !($asinh && 1 / $asinh(0) > 0), 'Math', {asinh: asinh});
3244},{"32":32}],152:[function(_dereq_,module,exports){
3245// 20.2.2.7 Math.atanh(x)
3246var $export = _dereq_(32)
3247 , $atanh = Math.atanh;
3248
3249// Tor Browser bug: Math.atanh(-0) -> 0
3250$export($export.S + $export.F * !($atanh && 1 / $atanh(-0) < 0), 'Math', {
3251 atanh: function atanh(x){
3252 return (x = +x) == 0 ? x : Math.log((1 + x) / (1 - x)) / 2;
3253 }
3254});
3255},{"32":32}],153:[function(_dereq_,module,exports){
3256// 20.2.2.9 Math.cbrt(x)
3257var $export = _dereq_(32)
3258 , sign = _dereq_(61);
3259
3260$export($export.S, 'Math', {
3261 cbrt: function cbrt(x){
3262 return sign(x = +x) * Math.pow(Math.abs(x), 1 / 3);
3263 }
3264});
3265},{"32":32,"61":61}],154:[function(_dereq_,module,exports){
3266// 20.2.2.11 Math.clz32(x)
3267var $export = _dereq_(32);
3268
3269$export($export.S, 'Math', {
3270 clz32: function clz32(x){
3271 return (x >>>= 0) ? 31 - Math.floor(Math.log(x + 0.5) * Math.LOG2E) : 32;
3272 }
3273});
3274},{"32":32}],155:[function(_dereq_,module,exports){
3275// 20.2.2.12 Math.cosh(x)
3276var $export = _dereq_(32)
3277 , exp = Math.exp;
3278
3279$export($export.S, 'Math', {
3280 cosh: function cosh(x){
3281 return (exp(x = +x) + exp(-x)) / 2;
3282 }
3283});
3284},{"32":32}],156:[function(_dereq_,module,exports){
3285// 20.2.2.14 Math.expm1(x)
3286var $export = _dereq_(32)
3287 , $expm1 = _dereq_(59);
3288
3289$export($export.S + $export.F * ($expm1 != Math.expm1), 'Math', {expm1: $expm1});
3290},{"32":32,"59":59}],157:[function(_dereq_,module,exports){
3291// 20.2.2.16 Math.fround(x)
3292var $export = _dereq_(32)
3293 , sign = _dereq_(61)
3294 , pow = Math.pow
3295 , EPSILON = pow(2, -52)
3296 , EPSILON32 = pow(2, -23)
3297 , MAX32 = pow(2, 127) * (2 - EPSILON32)
3298 , MIN32 = pow(2, -126);
3299
3300var roundTiesToEven = function(n){
3301 return n + 1 / EPSILON - 1 / EPSILON;
3302};
3303
3304
3305$export($export.S, 'Math', {
3306 fround: function fround(x){
3307 var $abs = Math.abs(x)
3308 , $sign = sign(x)
3309 , a, result;
3310 if($abs < MIN32)return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32;
3311 a = (1 + EPSILON32 / EPSILON) * $abs;
3312 result = a - (a - $abs);
3313 if(result > MAX32 || result != result)return $sign * Infinity;
3314 return $sign * result;
3315 }
3316});
3317},{"32":32,"61":61}],158:[function(_dereq_,module,exports){
3318// 20.2.2.17 Math.hypot([value1[, value2[, … ]]])
3319var $export = _dereq_(32)
3320 , abs = Math.abs;
3321
3322$export($export.S, 'Math', {
3323 hypot: function hypot(value1, value2){ // eslint-disable-line no-unused-vars
3324 var sum = 0
3325 , i = 0
3326 , aLen = arguments.length
3327 , larg = 0
3328 , arg, div;
3329 while(i < aLen){
3330 arg = abs(arguments[i++]);
3331 if(larg < arg){
3332 div = larg / arg;
3333 sum = sum * div * div + 1;
3334 larg = arg;
3335 } else if(arg > 0){
3336 div = arg / larg;
3337 sum += div * div;
3338 } else sum += arg;
3339 }
3340 return larg === Infinity ? Infinity : larg * Math.sqrt(sum);
3341 }
3342});
3343},{"32":32}],159:[function(_dereq_,module,exports){
3344// 20.2.2.18 Math.imul(x, y)
3345var $export = _dereq_(32)
3346 , $imul = Math.imul;
3347
3348// some WebKit versions fails with big numbers, some has wrong arity
3349$export($export.S + $export.F * _dereq_(34)(function(){
3350 return $imul(0xffffffff, 5) != -5 || $imul.length != 2;
3351}), 'Math', {
3352 imul: function imul(x, y){
3353 var UINT16 = 0xffff
3354 , xn = +x
3355 , yn = +y
3356 , xl = UINT16 & xn
3357 , yl = UINT16 & yn;
3358 return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0);
3359 }
3360});
3361},{"32":32,"34":34}],160:[function(_dereq_,module,exports){
3362// 20.2.2.21 Math.log10(x)
3363var $export = _dereq_(32);
3364
3365$export($export.S, 'Math', {
3366 log10: function log10(x){
3367 return Math.log(x) / Math.LN10;
3368 }
3369});
3370},{"32":32}],161:[function(_dereq_,module,exports){
3371// 20.2.2.20 Math.log1p(x)
3372var $export = _dereq_(32);
3373
3374$export($export.S, 'Math', {log1p: _dereq_(60)});
3375},{"32":32,"60":60}],162:[function(_dereq_,module,exports){
3376// 20.2.2.22 Math.log2(x)
3377var $export = _dereq_(32);
3378
3379$export($export.S, 'Math', {
3380 log2: function log2(x){
3381 return Math.log(x) / Math.LN2;
3382 }
3383});
3384},{"32":32}],163:[function(_dereq_,module,exports){
3385// 20.2.2.28 Math.sign(x)
3386var $export = _dereq_(32);
3387
3388$export($export.S, 'Math', {sign: _dereq_(61)});
3389},{"32":32,"61":61}],164:[function(_dereq_,module,exports){
3390// 20.2.2.30 Math.sinh(x)
3391var $export = _dereq_(32)
3392 , expm1 = _dereq_(59)
3393 , exp = Math.exp;
3394
3395// V8 near Chromium 38 has a problem with very small numbers
3396$export($export.S + $export.F * _dereq_(34)(function(){
3397 return !Math.sinh(-2e-17) != -2e-17;
3398}), 'Math', {
3399 sinh: function sinh(x){
3400 return Math.abs(x = +x) < 1
3401 ? (expm1(x) - expm1(-x)) / 2
3402 : (exp(x - 1) - exp(-x - 1)) * (Math.E / 2);
3403 }
3404});
3405},{"32":32,"34":34,"59":59}],165:[function(_dereq_,module,exports){
3406// 20.2.2.33 Math.tanh(x)
3407var $export = _dereq_(32)
3408 , expm1 = _dereq_(59)
3409 , exp = Math.exp;
3410
3411$export($export.S, 'Math', {
3412 tanh: function tanh(x){
3413 var a = expm1(x = +x)
3414 , b = expm1(-x);
3415 return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x));
3416 }
3417});
3418},{"32":32,"59":59}],166:[function(_dereq_,module,exports){
3419// 20.2.2.34 Math.trunc(x)
3420var $export = _dereq_(32);
3421
3422$export($export.S, 'Math', {
3423 trunc: function trunc(it){
3424 return (it > 0 ? Math.floor : Math.ceil)(it);
3425 }
3426});
3427},{"32":32}],167:[function(_dereq_,module,exports){
3428'use strict';
3429var global = _dereq_(38)
3430 , has = _dereq_(39)
3431 , cof = _dereq_(18)
3432 , inheritIfRequired = _dereq_(43)
3433 , toPrimitive = _dereq_(110)
3434 , fails = _dereq_(34)
3435 , gOPN = _dereq_(72).f
3436 , gOPD = _dereq_(70).f
3437 , dP = _dereq_(67).f
3438 , $trim = _dereq_(102).trim
3439 , NUMBER = 'Number'
3440 , $Number = global[NUMBER]
3441 , Base = $Number
3442 , proto = $Number.prototype
3443 // Opera ~12 has broken Object#toString
3444 , BROKEN_COF = cof(_dereq_(66)(proto)) == NUMBER
3445 , TRIM = 'trim' in String.prototype;
3446
3447// 7.1.3 ToNumber(argument)
3448var toNumber = function(argument){
3449 var it = toPrimitive(argument, false);
3450 if(typeof it == 'string' && it.length > 2){
3451 it = TRIM ? it.trim() : $trim(it, 3);
3452 var first = it.charCodeAt(0)
3453 , third, radix, maxCode;
3454 if(first === 43 || first === 45){
3455 third = it.charCodeAt(2);
3456 if(third === 88 || third === 120)return NaN; // Number('+0x1') should be NaN, old V8 fix
3457 } else if(first === 48){
3458 switch(it.charCodeAt(1)){
3459 case 66 : case 98 : radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i
3460 case 79 : case 111 : radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i
3461 default : return +it;
3462 }
3463 for(var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++){
3464 code = digits.charCodeAt(i);
3465 // parseInt parses a string to a first unavailable symbol
3466 // but ToNumber should return NaN if a string contains unavailable symbols
3467 if(code < 48 || code > maxCode)return NaN;
3468 } return parseInt(digits, radix);
3469 }
3470 } return +it;
3471};
3472
3473if(!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')){
3474 $Number = function Number(value){
3475 var it = arguments.length < 1 ? 0 : value
3476 , that = this;
3477 return that instanceof $Number
3478 // check on 1..constructor(foo) case
3479 && (BROKEN_COF ? fails(function(){ proto.valueOf.call(that); }) : cof(that) != NUMBER)
3480 ? inheritIfRequired(new Base(toNumber(it)), that, $Number) : toNumber(it);
3481 };
3482 for(var keys = _dereq_(28) ? gOPN(Base) : (
3483 // ES3:
3484 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
3485 // ES6 (in case, if modules with ES6 Number statics required before):
3486 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
3487 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'
3488 ).split(','), j = 0, key; keys.length > j; j++){
3489 if(has(Base, key = keys[j]) && !has($Number, key)){
3490 dP($Number, key, gOPD(Base, key));
3491 }
3492 }
3493 $Number.prototype = proto;
3494 proto.constructor = $Number;
3495 _dereq_(87)(global, NUMBER, $Number);
3496}
3497},{"102":102,"110":110,"18":18,"28":28,"34":34,"38":38,"39":39,"43":43,"66":66,"67":67,"70":70,"72":72,"87":87}],168:[function(_dereq_,module,exports){
3498// 20.1.2.1 Number.EPSILON
3499var $export = _dereq_(32);
3500
3501$export($export.S, 'Number', {EPSILON: Math.pow(2, -52)});
3502},{"32":32}],169:[function(_dereq_,module,exports){
3503// 20.1.2.2 Number.isFinite(number)
3504var $export = _dereq_(32)
3505 , _isFinite = _dereq_(38).isFinite;
3506
3507$export($export.S, 'Number', {
3508 isFinite: function isFinite(it){
3509 return typeof it == 'number' && _isFinite(it);
3510 }
3511});
3512},{"32":32,"38":38}],170:[function(_dereq_,module,exports){
3513// 20.1.2.3 Number.isInteger(number)
3514var $export = _dereq_(32);
3515
3516$export($export.S, 'Number', {isInteger: _dereq_(48)});
3517},{"32":32,"48":48}],171:[function(_dereq_,module,exports){
3518// 20.1.2.4 Number.isNaN(number)
3519var $export = _dereq_(32);
3520
3521$export($export.S, 'Number', {
3522 isNaN: function isNaN(number){
3523 return number != number;
3524 }
3525});
3526},{"32":32}],172:[function(_dereq_,module,exports){
3527// 20.1.2.5 Number.isSafeInteger(number)
3528var $export = _dereq_(32)
3529 , isInteger = _dereq_(48)
3530 , abs = Math.abs;
3531
3532$export($export.S, 'Number', {
3533 isSafeInteger: function isSafeInteger(number){
3534 return isInteger(number) && abs(number) <= 0x1fffffffffffff;
3535 }
3536});
3537},{"32":32,"48":48}],173:[function(_dereq_,module,exports){
3538// 20.1.2.6 Number.MAX_SAFE_INTEGER
3539var $export = _dereq_(32);
3540
3541$export($export.S, 'Number', {MAX_SAFE_INTEGER: 0x1fffffffffffff});
3542},{"32":32}],174:[function(_dereq_,module,exports){
3543// 20.1.2.10 Number.MIN_SAFE_INTEGER
3544var $export = _dereq_(32);
3545
3546$export($export.S, 'Number', {MIN_SAFE_INTEGER: -0x1fffffffffffff});
3547},{"32":32}],175:[function(_dereq_,module,exports){
3548var $export = _dereq_(32)
3549 , $parseFloat = _dereq_(81);
3550// 20.1.2.12 Number.parseFloat(string)
3551$export($export.S + $export.F * (Number.parseFloat != $parseFloat), 'Number', {parseFloat: $parseFloat});
3552},{"32":32,"81":81}],176:[function(_dereq_,module,exports){
3553var $export = _dereq_(32)
3554 , $parseInt = _dereq_(82);
3555// 20.1.2.13 Number.parseInt(string, radix)
3556$export($export.S + $export.F * (Number.parseInt != $parseInt), 'Number', {parseInt: $parseInt});
3557},{"32":32,"82":82}],177:[function(_dereq_,module,exports){
3558'use strict';
3559var $export = _dereq_(32)
3560 , toInteger = _dereq_(106)
3561 , aNumberValue = _dereq_(4)
3562 , repeat = _dereq_(101)
3563 , $toFixed = 1..toFixed
3564 , floor = Math.floor
3565 , data = [0, 0, 0, 0, 0, 0]
3566 , ERROR = 'Number.toFixed: incorrect invocation!'
3567 , ZERO = '0';
3568
3569var multiply = function(n, c){
3570 var i = -1
3571 , c2 = c;
3572 while(++i < 6){
3573 c2 += n * data[i];
3574 data[i] = c2 % 1e7;
3575 c2 = floor(c2 / 1e7);
3576 }
3577};
3578var divide = function(n){
3579 var i = 6
3580 , c = 0;
3581 while(--i >= 0){
3582 c += data[i];
3583 data[i] = floor(c / n);
3584 c = (c % n) * 1e7;
3585 }
3586};
3587var numToString = function(){
3588 var i = 6
3589 , s = '';
3590 while(--i >= 0){
3591 if(s !== '' || i === 0 || data[i] !== 0){
3592 var t = String(data[i]);
3593 s = s === '' ? t : s + repeat.call(ZERO, 7 - t.length) + t;
3594 }
3595 } return s;
3596};
3597var pow = function(x, n, acc){
3598 return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc);
3599};
3600var log = function(x){
3601 var n = 0
3602 , x2 = x;
3603 while(x2 >= 4096){
3604 n += 12;
3605 x2 /= 4096;
3606 }
3607 while(x2 >= 2){
3608 n += 1;
3609 x2 /= 2;
3610 } return n;
3611};
3612
3613$export($export.P + $export.F * (!!$toFixed && (
3614 0.00008.toFixed(3) !== '0.000' ||
3615 0.9.toFixed(0) !== '1' ||
3616 1.255.toFixed(2) !== '1.25' ||
3617 1000000000000000128..toFixed(0) !== '1000000000000000128'
3618) || !_dereq_(34)(function(){
3619 // V8 ~ Android 4.3-
3620 $toFixed.call({});
3621})), 'Number', {
3622 toFixed: function toFixed(fractionDigits){
3623 var x = aNumberValue(this, ERROR)
3624 , f = toInteger(fractionDigits)
3625 , s = ''
3626 , m = ZERO
3627 , e, z, j, k;
3628 if(f < 0 || f > 20)throw RangeError(ERROR);
3629 if(x != x)return 'NaN';
3630 if(x <= -1e21 || x >= 1e21)return String(x);
3631 if(x < 0){
3632 s = '-';
3633 x = -x;
3634 }
3635 if(x > 1e-21){
3636 e = log(x * pow(2, 69, 1)) - 69;
3637 z = e < 0 ? x * pow(2, -e, 1) : x / pow(2, e, 1);
3638 z *= 0x10000000000000;
3639 e = 52 - e;
3640 if(e > 0){
3641 multiply(0, z);
3642 j = f;
3643 while(j >= 7){
3644 multiply(1e7, 0);
3645 j -= 7;
3646 }
3647 multiply(pow(10, j, 1), 0);
3648 j = e - 1;
3649 while(j >= 23){
3650 divide(1 << 23);
3651 j -= 23;
3652 }
3653 divide(1 << j);
3654 multiply(1, 1);
3655 divide(2);
3656 m = numToString();
3657 } else {
3658 multiply(0, z);
3659 multiply(1 << -e, 0);
3660 m = numToString() + repeat.call(ZERO, f);
3661 }
3662 }
3663 if(f > 0){
3664 k = m.length;
3665 m = s + (k <= f ? '0.' + repeat.call(ZERO, f - k) + m : m.slice(0, k - f) + '.' + m.slice(k - f));
3666 } else {
3667 m = s + m;
3668 } return m;
3669 }
3670});
3671},{"101":101,"106":106,"32":32,"34":34,"4":4}],178:[function(_dereq_,module,exports){
3672'use strict';
3673var $export = _dereq_(32)
3674 , $fails = _dereq_(34)
3675 , aNumberValue = _dereq_(4)
3676 , $toPrecision = 1..toPrecision;
3677
3678$export($export.P + $export.F * ($fails(function(){
3679 // IE7-
3680 return $toPrecision.call(1, undefined) !== '1';
3681}) || !$fails(function(){
3682 // V8 ~ Android 4.3-
3683 $toPrecision.call({});
3684})), 'Number', {
3685 toPrecision: function toPrecision(precision){
3686 var that = aNumberValue(this, 'Number#toPrecision: incorrect invocation!');
3687 return precision === undefined ? $toPrecision.call(that) : $toPrecision.call(that, precision);
3688 }
3689});
3690},{"32":32,"34":34,"4":4}],179:[function(_dereq_,module,exports){
3691// 19.1.3.1 Object.assign(target, source)
3692var $export = _dereq_(32);
3693
3694$export($export.S + $export.F, 'Object', {assign: _dereq_(65)});
3695},{"32":32,"65":65}],180:[function(_dereq_,module,exports){
3696var $export = _dereq_(32)
3697// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
3698$export($export.S, 'Object', {create: _dereq_(66)});
3699},{"32":32,"66":66}],181:[function(_dereq_,module,exports){
3700var $export = _dereq_(32);
3701// 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties)
3702$export($export.S + $export.F * !_dereq_(28), 'Object', {defineProperties: _dereq_(68)});
3703},{"28":28,"32":32,"68":68}],182:[function(_dereq_,module,exports){
3704var $export = _dereq_(32);
3705// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
3706$export($export.S + $export.F * !_dereq_(28), 'Object', {defineProperty: _dereq_(67).f});
3707},{"28":28,"32":32,"67":67}],183:[function(_dereq_,module,exports){
3708// 19.1.2.5 Object.freeze(O)
3709var isObject = _dereq_(49)
3710 , meta = _dereq_(62).onFreeze;
3711
3712_dereq_(78)('freeze', function($freeze){
3713 return function freeze(it){
3714 return $freeze && isObject(it) ? $freeze(meta(it)) : it;
3715 };
3716});
3717},{"49":49,"62":62,"78":78}],184:[function(_dereq_,module,exports){
3718// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
3719var toIObject = _dereq_(107)
3720 , $getOwnPropertyDescriptor = _dereq_(70).f;
3721
3722_dereq_(78)('getOwnPropertyDescriptor', function(){
3723 return function getOwnPropertyDescriptor(it, key){
3724 return $getOwnPropertyDescriptor(toIObject(it), key);
3725 };
3726});
3727},{"107":107,"70":70,"78":78}],185:[function(_dereq_,module,exports){
3728// 19.1.2.7 Object.getOwnPropertyNames(O)
3729_dereq_(78)('getOwnPropertyNames', function(){
3730 return _dereq_(71).f;
3731});
3732},{"71":71,"78":78}],186:[function(_dereq_,module,exports){
3733// 19.1.2.9 Object.getPrototypeOf(O)
3734var toObject = _dereq_(109)
3735 , $getPrototypeOf = _dereq_(74);
3736
3737_dereq_(78)('getPrototypeOf', function(){
3738 return function getPrototypeOf(it){
3739 return $getPrototypeOf(toObject(it));
3740 };
3741});
3742},{"109":109,"74":74,"78":78}],187:[function(_dereq_,module,exports){
3743// 19.1.2.11 Object.isExtensible(O)
3744var isObject = _dereq_(49);
3745
3746_dereq_(78)('isExtensible', function($isExtensible){
3747 return function isExtensible(it){
3748 return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false;
3749 };
3750});
3751},{"49":49,"78":78}],188:[function(_dereq_,module,exports){
3752// 19.1.2.12 Object.isFrozen(O)
3753var isObject = _dereq_(49);
3754
3755_dereq_(78)('isFrozen', function($isFrozen){
3756 return function isFrozen(it){
3757 return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true;
3758 };
3759});
3760},{"49":49,"78":78}],189:[function(_dereq_,module,exports){
3761// 19.1.2.13 Object.isSealed(O)
3762var isObject = _dereq_(49);
3763
3764_dereq_(78)('isSealed', function($isSealed){
3765 return function isSealed(it){
3766 return isObject(it) ? $isSealed ? $isSealed(it) : false : true;
3767 };
3768});
3769},{"49":49,"78":78}],190:[function(_dereq_,module,exports){
3770// 19.1.3.10 Object.is(value1, value2)
3771var $export = _dereq_(32);
3772$export($export.S, 'Object', {is: _dereq_(89)});
3773},{"32":32,"89":89}],191:[function(_dereq_,module,exports){
3774// 19.1.2.14 Object.keys(O)
3775var toObject = _dereq_(109)
3776 , $keys = _dereq_(76);
3777
3778_dereq_(78)('keys', function(){
3779 return function keys(it){
3780 return $keys(toObject(it));
3781 };
3782});
3783},{"109":109,"76":76,"78":78}],192:[function(_dereq_,module,exports){
3784// 19.1.2.15 Object.preventExtensions(O)
3785var isObject = _dereq_(49)
3786 , meta = _dereq_(62).onFreeze;
3787
3788_dereq_(78)('preventExtensions', function($preventExtensions){
3789 return function preventExtensions(it){
3790 return $preventExtensions && isObject(it) ? $preventExtensions(meta(it)) : it;
3791 };
3792});
3793},{"49":49,"62":62,"78":78}],193:[function(_dereq_,module,exports){
3794// 19.1.2.17 Object.seal(O)
3795var isObject = _dereq_(49)
3796 , meta = _dereq_(62).onFreeze;
3797
3798_dereq_(78)('seal', function($seal){
3799 return function seal(it){
3800 return $seal && isObject(it) ? $seal(meta(it)) : it;
3801 };
3802});
3803},{"49":49,"62":62,"78":78}],194:[function(_dereq_,module,exports){
3804// 19.1.3.19 Object.setPrototypeOf(O, proto)
3805var $export = _dereq_(32);
3806$export($export.S, 'Object', {setPrototypeOf: _dereq_(90).set});
3807},{"32":32,"90":90}],195:[function(_dereq_,module,exports){
3808'use strict';
3809// 19.1.3.6 Object.prototype.toString()
3810var classof = _dereq_(17)
3811 , test = {};
3812test[_dereq_(117)('toStringTag')] = 'z';
3813if(test + '' != '[object z]'){
3814 _dereq_(87)(Object.prototype, 'toString', function toString(){
3815 return '[object ' + classof(this) + ']';
3816 }, true);
3817}
3818},{"117":117,"17":17,"87":87}],196:[function(_dereq_,module,exports){
3819var $export = _dereq_(32)
3820 , $parseFloat = _dereq_(81);
3821// 18.2.4 parseFloat(string)
3822$export($export.G + $export.F * (parseFloat != $parseFloat), {parseFloat: $parseFloat});
3823},{"32":32,"81":81}],197:[function(_dereq_,module,exports){
3824var $export = _dereq_(32)
3825 , $parseInt = _dereq_(82);
3826// 18.2.5 parseInt(string, radix)
3827$export($export.G + $export.F * (parseInt != $parseInt), {parseInt: $parseInt});
3828},{"32":32,"82":82}],198:[function(_dereq_,module,exports){
3829'use strict';
3830var LIBRARY = _dereq_(58)
3831 , global = _dereq_(38)
3832 , ctx = _dereq_(25)
3833 , classof = _dereq_(17)
3834 , $export = _dereq_(32)
3835 , isObject = _dereq_(49)
3836 , aFunction = _dereq_(3)
3837 , anInstance = _dereq_(6)
3838 , forOf = _dereq_(37)
3839 , speciesConstructor = _dereq_(95)
3840 , task = _dereq_(104).set
3841 , microtask = _dereq_(64)()
3842 , PROMISE = 'Promise'
3843 , TypeError = global.TypeError
3844 , process = global.process
3845 , $Promise = global[PROMISE]
3846 , process = global.process
3847 , isNode = classof(process) == 'process'
3848 , empty = function(){ /* empty */ }
3849 , Internal, GenericPromiseCapability, Wrapper;
3850
3851var USE_NATIVE = !!function(){
3852 try {
3853 // correct subclassing with @@species support
3854 var promise = $Promise.resolve(1)
3855 , FakePromise = (promise.constructor = {})[_dereq_(117)('species')] = function(exec){ exec(empty, empty); };
3856 // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
3857 return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise;
3858 } catch(e){ /* empty */ }
3859}();
3860
3861// helpers
3862var sameConstructor = function(a, b){
3863 // with library wrapper special case
3864 return a === b || a === $Promise && b === Wrapper;
3865};
3866var isThenable = function(it){
3867 var then;
3868 return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
3869};
3870var newPromiseCapability = function(C){
3871 return sameConstructor($Promise, C)
3872 ? new PromiseCapability(C)
3873 : new GenericPromiseCapability(C);
3874};
3875var PromiseCapability = GenericPromiseCapability = function(C){
3876 var resolve, reject;
3877 this.promise = new C(function($$resolve, $$reject){
3878 if(resolve !== undefined || reject !== undefined)throw TypeError('Bad Promise constructor');
3879 resolve = $$resolve;
3880 reject = $$reject;
3881 });
3882 this.resolve = aFunction(resolve);
3883 this.reject = aFunction(reject);
3884};
3885var perform = function(exec){
3886 try {
3887 exec();
3888 } catch(e){
3889 return {error: e};
3890 }
3891};
3892var notify = function(promise, isReject){
3893 if(promise._n)return;
3894 promise._n = true;
3895 var chain = promise._c;
3896 microtask(function(){
3897 var value = promise._v
3898 , ok = promise._s == 1
3899 , i = 0;
3900 var run = function(reaction){
3901 var handler = ok ? reaction.ok : reaction.fail
3902 , resolve = reaction.resolve
3903 , reject = reaction.reject
3904 , domain = reaction.domain
3905 , result, then;
3906 try {
3907 if(handler){
3908 if(!ok){
3909 if(promise._h == 2)onHandleUnhandled(promise);
3910 promise._h = 1;
3911 }
3912 if(handler === true)result = value;
3913 else {
3914 if(domain)domain.enter();
3915 result = handler(value);
3916 if(domain)domain.exit();
3917 }
3918 if(result === reaction.promise){
3919 reject(TypeError('Promise-chain cycle'));
3920 } else if(then = isThenable(result)){
3921 then.call(result, resolve, reject);
3922 } else resolve(result);
3923 } else reject(value);
3924 } catch(e){
3925 reject(e);
3926 }
3927 };
3928 while(chain.length > i)run(chain[i++]); // variable length - can't use forEach
3929 promise._c = [];
3930 promise._n = false;
3931 if(isReject && !promise._h)onUnhandled(promise);
3932 });
3933};
3934var onUnhandled = function(promise){
3935 task.call(global, function(){
3936 var value = promise._v
3937 , abrupt, handler, console;
3938 if(isUnhandled(promise)){
3939 abrupt = perform(function(){
3940 if(isNode){
3941 process.emit('unhandledRejection', value, promise);
3942 } else if(handler = global.onunhandledrejection){
3943 handler({promise: promise, reason: value});
3944 } else if((console = global.console) && console.error){
3945 console.error('Unhandled promise rejection', value);
3946 }
3947 });
3948 // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
3949 promise._h = isNode || isUnhandled(promise) ? 2 : 1;
3950 } promise._a = undefined;
3951 if(abrupt)throw abrupt.error;
3952 });
3953};
3954var isUnhandled = function(promise){
3955 if(promise._h == 1)return false;
3956 var chain = promise._a || promise._c
3957 , i = 0
3958 , reaction;
3959 while(chain.length > i){
3960 reaction = chain[i++];
3961 if(reaction.fail || !isUnhandled(reaction.promise))return false;
3962 } return true;
3963};
3964var onHandleUnhandled = function(promise){
3965 task.call(global, function(){
3966 var handler;
3967 if(isNode){
3968 process.emit('rejectionHandled', promise);
3969 } else if(handler = global.onrejectionhandled){
3970 handler({promise: promise, reason: promise._v});
3971 }
3972 });
3973};
3974var $reject = function(value){
3975 var promise = this;
3976 if(promise._d)return;
3977 promise._d = true;
3978 promise = promise._w || promise; // unwrap
3979 promise._v = value;
3980 promise._s = 2;
3981 if(!promise._a)promise._a = promise._c.slice();
3982 notify(promise, true);
3983};
3984var $resolve = function(value){
3985 var promise = this
3986 , then;
3987 if(promise._d)return;
3988 promise._d = true;
3989 promise = promise._w || promise; // unwrap
3990 try {
3991 if(promise === value)throw TypeError("Promise can't be resolved itself");
3992 if(then = isThenable(value)){
3993 microtask(function(){
3994 var wrapper = {_w: promise, _d: false}; // wrap
3995 try {
3996 then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
3997 } catch(e){
3998 $reject.call(wrapper, e);
3999 }
4000 });
4001 } else {
4002 promise._v = value;
4003 promise._s = 1;
4004 notify(promise, false);
4005 }
4006 } catch(e){
4007 $reject.call({_w: promise, _d: false}, e); // wrap
4008 }
4009};
4010
4011// constructor polyfill
4012if(!USE_NATIVE){
4013 // 25.4.3.1 Promise(executor)
4014 $Promise = function Promise(executor){
4015 anInstance(this, $Promise, PROMISE, '_h');
4016 aFunction(executor);
4017 Internal.call(this);
4018 try {
4019 executor(ctx($resolve, this, 1), ctx($reject, this, 1));
4020 } catch(err){
4021 $reject.call(this, err);
4022 }
4023 };
4024 Internal = function Promise(executor){
4025 this._c = []; // <- awaiting reactions
4026 this._a = undefined; // <- checked in isUnhandled reactions
4027 this._s = 0; // <- state
4028 this._d = false; // <- done
4029 this._v = undefined; // <- value
4030 this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
4031 this._n = false; // <- notify
4032 };
4033 Internal.prototype = _dereq_(86)($Promise.prototype, {
4034 // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
4035 then: function then(onFulfilled, onRejected){
4036 var reaction = newPromiseCapability(speciesConstructor(this, $Promise));
4037 reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
4038 reaction.fail = typeof onRejected == 'function' && onRejected;
4039 reaction.domain = isNode ? process.domain : undefined;
4040 this._c.push(reaction);
4041 if(this._a)this._a.push(reaction);
4042 if(this._s)notify(this, false);
4043 return reaction.promise;
4044 },
4045 // 25.4.5.1 Promise.prototype.catch(onRejected)
4046 'catch': function(onRejected){
4047 return this.then(undefined, onRejected);
4048 }
4049 });
4050 PromiseCapability = function(){
4051 var promise = new Internal;
4052 this.promise = promise;
4053 this.resolve = ctx($resolve, promise, 1);
4054 this.reject = ctx($reject, promise, 1);
4055 };
4056}
4057
4058$export($export.G + $export.W + $export.F * !USE_NATIVE, {Promise: $Promise});
4059_dereq_(92)($Promise, PROMISE);
4060_dereq_(91)(PROMISE);
4061Wrapper = _dereq_(23)[PROMISE];
4062
4063// statics
4064$export($export.S + $export.F * !USE_NATIVE, PROMISE, {
4065 // 25.4.4.5 Promise.reject(r)
4066 reject: function reject(r){
4067 var capability = newPromiseCapability(this)
4068 , $$reject = capability.reject;
4069 $$reject(r);
4070 return capability.promise;
4071 }
4072});
4073$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
4074 // 25.4.4.6 Promise.resolve(x)
4075 resolve: function resolve(x){
4076 // instanceof instead of internal slot check because we should fix it without replacement native Promise core
4077 if(x instanceof $Promise && sameConstructor(x.constructor, this))return x;
4078 var capability = newPromiseCapability(this)
4079 , $$resolve = capability.resolve;
4080 $$resolve(x);
4081 return capability.promise;
4082 }
4083});
4084$export($export.S + $export.F * !(USE_NATIVE && _dereq_(54)(function(iter){
4085 $Promise.all(iter)['catch'](empty);
4086})), PROMISE, {
4087 // 25.4.4.1 Promise.all(iterable)
4088 all: function all(iterable){
4089 var C = this
4090 , capability = newPromiseCapability(C)
4091 , resolve = capability.resolve
4092 , reject = capability.reject;
4093 var abrupt = perform(function(){
4094 var values = []
4095 , index = 0
4096 , remaining = 1;
4097 forOf(iterable, false, function(promise){
4098 var $index = index++
4099 , alreadyCalled = false;
4100 values.push(undefined);
4101 remaining++;
4102 C.resolve(promise).then(function(value){
4103 if(alreadyCalled)return;
4104 alreadyCalled = true;
4105 values[$index] = value;
4106 --remaining || resolve(values);
4107 }, reject);
4108 });
4109 --remaining || resolve(values);
4110 });
4111 if(abrupt)reject(abrupt.error);
4112 return capability.promise;
4113 },
4114 // 25.4.4.4 Promise.race(iterable)
4115 race: function race(iterable){
4116 var C = this
4117 , capability = newPromiseCapability(C)
4118 , reject = capability.reject;
4119 var abrupt = perform(function(){
4120 forOf(iterable, false, function(promise){
4121 C.resolve(promise).then(capability.resolve, reject);
4122 });
4123 });
4124 if(abrupt)reject(abrupt.error);
4125 return capability.promise;
4126 }
4127});
4128},{"104":104,"117":117,"17":17,"23":23,"25":25,"3":3,"32":32,"37":37,"38":38,"49":49,"54":54,"58":58,"6":6,"64":64,"86":86,"91":91,"92":92,"95":95}],199:[function(_dereq_,module,exports){
4129// 26.1.1 Reflect.apply(target, thisArgument, argumentsList)
4130var $export = _dereq_(32)
4131 , aFunction = _dereq_(3)
4132 , anObject = _dereq_(7)
4133 , rApply = (_dereq_(38).Reflect || {}).apply
4134 , fApply = Function.apply;
4135// MS Edge argumentsList argument is optional
4136$export($export.S + $export.F * !_dereq_(34)(function(){
4137 rApply(function(){});
4138}), 'Reflect', {
4139 apply: function apply(target, thisArgument, argumentsList){
4140 var T = aFunction(target)
4141 , L = anObject(argumentsList);
4142 return rApply ? rApply(T, thisArgument, L) : fApply.call(T, thisArgument, L);
4143 }
4144});
4145},{"3":3,"32":32,"34":34,"38":38,"7":7}],200:[function(_dereq_,module,exports){
4146// 26.1.2 Reflect.construct(target, argumentsList [, newTarget])
4147var $export = _dereq_(32)
4148 , create = _dereq_(66)
4149 , aFunction = _dereq_(3)
4150 , anObject = _dereq_(7)
4151 , isObject = _dereq_(49)
4152 , fails = _dereq_(34)
4153 , bind = _dereq_(16)
4154 , rConstruct = (_dereq_(38).Reflect || {}).construct;
4155
4156// MS Edge supports only 2 arguments and argumentsList argument is optional
4157// FF Nightly sets third argument as `new.target`, but does not create `this` from it
4158var NEW_TARGET_BUG = fails(function(){
4159 function F(){}
4160 return !(rConstruct(function(){}, [], F) instanceof F);
4161});
4162var ARGS_BUG = !fails(function(){
4163 rConstruct(function(){});
4164});
4165
4166$export($export.S + $export.F * (NEW_TARGET_BUG || ARGS_BUG), 'Reflect', {
4167 construct: function construct(Target, args /*, newTarget*/){
4168 aFunction(Target);
4169 anObject(args);
4170 var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]);
4171 if(ARGS_BUG && !NEW_TARGET_BUG)return rConstruct(Target, args, newTarget);
4172 if(Target == newTarget){
4173 // w/o altered newTarget, optimization for 0-4 arguments
4174 switch(args.length){
4175 case 0: return new Target;
4176 case 1: return new Target(args[0]);
4177 case 2: return new Target(args[0], args[1]);
4178 case 3: return new Target(args[0], args[1], args[2]);
4179 case 4: return new Target(args[0], args[1], args[2], args[3]);
4180 }
4181 // w/o altered newTarget, lot of arguments case
4182 var $args = [null];
4183 $args.push.apply($args, args);
4184 return new (bind.apply(Target, $args));
4185 }
4186 // with altered newTarget, not support built-in constructors
4187 var proto = newTarget.prototype
4188 , instance = create(isObject(proto) ? proto : Object.prototype)
4189 , result = Function.apply.call(Target, instance, args);
4190 return isObject(result) ? result : instance;
4191 }
4192});
4193},{"16":16,"3":3,"32":32,"34":34,"38":38,"49":49,"66":66,"7":7}],201:[function(_dereq_,module,exports){
4194// 26.1.3 Reflect.defineProperty(target, propertyKey, attributes)
4195var dP = _dereq_(67)
4196 , $export = _dereq_(32)
4197 , anObject = _dereq_(7)
4198 , toPrimitive = _dereq_(110);
4199
4200// MS Edge has broken Reflect.defineProperty - throwing instead of returning false
4201$export($export.S + $export.F * _dereq_(34)(function(){
4202 Reflect.defineProperty(dP.f({}, 1, {value: 1}), 1, {value: 2});
4203}), 'Reflect', {
4204 defineProperty: function defineProperty(target, propertyKey, attributes){
4205 anObject(target);
4206 propertyKey = toPrimitive(propertyKey, true);
4207 anObject(attributes);
4208 try {
4209 dP.f(target, propertyKey, attributes);
4210 return true;
4211 } catch(e){
4212 return false;
4213 }
4214 }
4215});
4216},{"110":110,"32":32,"34":34,"67":67,"7":7}],202:[function(_dereq_,module,exports){
4217// 26.1.4 Reflect.deleteProperty(target, propertyKey)
4218var $export = _dereq_(32)
4219 , gOPD = _dereq_(70).f
4220 , anObject = _dereq_(7);
4221
4222$export($export.S, 'Reflect', {
4223 deleteProperty: function deleteProperty(target, propertyKey){
4224 var desc = gOPD(anObject(target), propertyKey);
4225 return desc && !desc.configurable ? false : delete target[propertyKey];
4226 }
4227});
4228},{"32":32,"7":7,"70":70}],203:[function(_dereq_,module,exports){
4229'use strict';
4230// 26.1.5 Reflect.enumerate(target)
4231var $export = _dereq_(32)
4232 , anObject = _dereq_(7);
4233var Enumerate = function(iterated){
4234 this._t = anObject(iterated); // target
4235 this._i = 0; // next index
4236 var keys = this._k = [] // keys
4237 , key;
4238 for(key in iterated)keys.push(key);
4239};
4240_dereq_(52)(Enumerate, 'Object', function(){
4241 var that = this
4242 , keys = that._k
4243 , key;
4244 do {
4245 if(that._i >= keys.length)return {value: undefined, done: true};
4246 } while(!((key = keys[that._i++]) in that._t));
4247 return {value: key, done: false};
4248});
4249
4250$export($export.S, 'Reflect', {
4251 enumerate: function enumerate(target){
4252 return new Enumerate(target);
4253 }
4254});
4255},{"32":32,"52":52,"7":7}],204:[function(_dereq_,module,exports){
4256// 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey)
4257var gOPD = _dereq_(70)
4258 , $export = _dereq_(32)
4259 , anObject = _dereq_(7);
4260
4261$export($export.S, 'Reflect', {
4262 getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey){
4263 return gOPD.f(anObject(target), propertyKey);
4264 }
4265});
4266},{"32":32,"7":7,"70":70}],205:[function(_dereq_,module,exports){
4267// 26.1.8 Reflect.getPrototypeOf(target)
4268var $export = _dereq_(32)
4269 , getProto = _dereq_(74)
4270 , anObject = _dereq_(7);
4271
4272$export($export.S, 'Reflect', {
4273 getPrototypeOf: function getPrototypeOf(target){
4274 return getProto(anObject(target));
4275 }
4276});
4277},{"32":32,"7":7,"74":74}],206:[function(_dereq_,module,exports){
4278// 26.1.6 Reflect.get(target, propertyKey [, receiver])
4279var gOPD = _dereq_(70)
4280 , getPrototypeOf = _dereq_(74)
4281 , has = _dereq_(39)
4282 , $export = _dereq_(32)
4283 , isObject = _dereq_(49)
4284 , anObject = _dereq_(7);
4285
4286function get(target, propertyKey/*, receiver*/){
4287 var receiver = arguments.length < 3 ? target : arguments[2]
4288 , desc, proto;
4289 if(anObject(target) === receiver)return target[propertyKey];
4290 if(desc = gOPD.f(target, propertyKey))return has(desc, 'value')
4291 ? desc.value
4292 : desc.get !== undefined
4293 ? desc.get.call(receiver)
4294 : undefined;
4295 if(isObject(proto = getPrototypeOf(target)))return get(proto, propertyKey, receiver);
4296}
4297
4298$export($export.S, 'Reflect', {get: get});
4299},{"32":32,"39":39,"49":49,"7":7,"70":70,"74":74}],207:[function(_dereq_,module,exports){
4300// 26.1.9 Reflect.has(target, propertyKey)
4301var $export = _dereq_(32);
4302
4303$export($export.S, 'Reflect', {
4304 has: function has(target, propertyKey){
4305 return propertyKey in target;
4306 }
4307});
4308},{"32":32}],208:[function(_dereq_,module,exports){
4309// 26.1.10 Reflect.isExtensible(target)
4310var $export = _dereq_(32)
4311 , anObject = _dereq_(7)
4312 , $isExtensible = Object.isExtensible;
4313
4314$export($export.S, 'Reflect', {
4315 isExtensible: function isExtensible(target){
4316 anObject(target);
4317 return $isExtensible ? $isExtensible(target) : true;
4318 }
4319});
4320},{"32":32,"7":7}],209:[function(_dereq_,module,exports){
4321// 26.1.11 Reflect.ownKeys(target)
4322var $export = _dereq_(32);
4323
4324$export($export.S, 'Reflect', {ownKeys: _dereq_(80)});
4325},{"32":32,"80":80}],210:[function(_dereq_,module,exports){
4326// 26.1.12 Reflect.preventExtensions(target)
4327var $export = _dereq_(32)
4328 , anObject = _dereq_(7)
4329 , $preventExtensions = Object.preventExtensions;
4330
4331$export($export.S, 'Reflect', {
4332 preventExtensions: function preventExtensions(target){
4333 anObject(target);
4334 try {
4335 if($preventExtensions)$preventExtensions(target);
4336 return true;
4337 } catch(e){
4338 return false;
4339 }
4340 }
4341});
4342},{"32":32,"7":7}],211:[function(_dereq_,module,exports){
4343// 26.1.14 Reflect.setPrototypeOf(target, proto)
4344var $export = _dereq_(32)
4345 , setProto = _dereq_(90);
4346
4347if(setProto)$export($export.S, 'Reflect', {
4348 setPrototypeOf: function setPrototypeOf(target, proto){
4349 setProto.check(target, proto);
4350 try {
4351 setProto.set(target, proto);
4352 return true;
4353 } catch(e){
4354 return false;
4355 }
4356 }
4357});
4358},{"32":32,"90":90}],212:[function(_dereq_,module,exports){
4359// 26.1.13 Reflect.set(target, propertyKey, V [, receiver])
4360var dP = _dereq_(67)
4361 , gOPD = _dereq_(70)
4362 , getPrototypeOf = _dereq_(74)
4363 , has = _dereq_(39)
4364 , $export = _dereq_(32)
4365 , createDesc = _dereq_(85)
4366 , anObject = _dereq_(7)
4367 , isObject = _dereq_(49);
4368
4369function set(target, propertyKey, V/*, receiver*/){
4370 var receiver = arguments.length < 4 ? target : arguments[3]
4371 , ownDesc = gOPD.f(anObject(target), propertyKey)
4372 , existingDescriptor, proto;
4373 if(!ownDesc){
4374 if(isObject(proto = getPrototypeOf(target))){
4375 return set(proto, propertyKey, V, receiver);
4376 }
4377 ownDesc = createDesc(0);
4378 }
4379 if(has(ownDesc, 'value')){
4380 if(ownDesc.writable === false || !isObject(receiver))return false;
4381 existingDescriptor = gOPD.f(receiver, propertyKey) || createDesc(0);
4382 existingDescriptor.value = V;
4383 dP.f(receiver, propertyKey, existingDescriptor);
4384 return true;
4385 }
4386 return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true);
4387}
4388
4389$export($export.S, 'Reflect', {set: set});
4390},{"32":32,"39":39,"49":49,"67":67,"7":7,"70":70,"74":74,"85":85}],213:[function(_dereq_,module,exports){
4391var global = _dereq_(38)
4392 , inheritIfRequired = _dereq_(43)
4393 , dP = _dereq_(67).f
4394 , gOPN = _dereq_(72).f
4395 , isRegExp = _dereq_(50)
4396 , $flags = _dereq_(36)
4397 , $RegExp = global.RegExp
4398 , Base = $RegExp
4399 , proto = $RegExp.prototype
4400 , re1 = /a/g
4401 , re2 = /a/g
4402 // "new" creates a new object, old webkit buggy here
4403 , CORRECT_NEW = new $RegExp(re1) !== re1;
4404
4405if(_dereq_(28) && (!CORRECT_NEW || _dereq_(34)(function(){
4406 re2[_dereq_(117)('match')] = false;
4407 // RegExp constructor can alter flags and IsRegExp works correct with @@match
4408 return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i';
4409}))){
4410 $RegExp = function RegExp(p, f){
4411 var tiRE = this instanceof $RegExp
4412 , piRE = isRegExp(p)
4413 , fiU = f === undefined;
4414 return !tiRE && piRE && p.constructor === $RegExp && fiU ? p
4415 : inheritIfRequired(CORRECT_NEW
4416 ? new Base(piRE && !fiU ? p.source : p, f)
4417 : Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f)
4418 , tiRE ? this : proto, $RegExp);
4419 };
4420 var proxy = function(key){
4421 key in $RegExp || dP($RegExp, key, {
4422 configurable: true,
4423 get: function(){ return Base[key]; },
4424 set: function(it){ Base[key] = it; }
4425 });
4426 };
4427 for(var keys = gOPN(Base), i = 0; keys.length > i; )proxy(keys[i++]);
4428 proto.constructor = $RegExp;
4429 $RegExp.prototype = proto;
4430 _dereq_(87)(global, 'RegExp', $RegExp);
4431}
4432
4433_dereq_(91)('RegExp');
4434},{"117":117,"28":28,"34":34,"36":36,"38":38,"43":43,"50":50,"67":67,"72":72,"87":87,"91":91}],214:[function(_dereq_,module,exports){
4435// 21.2.5.3 get RegExp.prototype.flags()
4436if(_dereq_(28) && /./g.flags != 'g')_dereq_(67).f(RegExp.prototype, 'flags', {
4437 configurable: true,
4438 get: _dereq_(36)
4439});
4440},{"28":28,"36":36,"67":67}],215:[function(_dereq_,module,exports){
4441// @@match logic
4442_dereq_(35)('match', 1, function(defined, MATCH, $match){
4443 // 21.1.3.11 String.prototype.match(regexp)
4444 return [function match(regexp){
4445 'use strict';
4446 var O = defined(this)
4447 , fn = regexp == undefined ? undefined : regexp[MATCH];
4448 return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
4449 }, $match];
4450});
4451},{"35":35}],216:[function(_dereq_,module,exports){
4452// @@replace logic
4453_dereq_(35)('replace', 2, function(defined, REPLACE, $replace){
4454 // 21.1.3.14 String.prototype.replace(searchValue, replaceValue)
4455 return [function replace(searchValue, replaceValue){
4456 'use strict';
4457 var O = defined(this)
4458 , fn = searchValue == undefined ? undefined : searchValue[REPLACE];
4459 return fn !== undefined
4460 ? fn.call(searchValue, O, replaceValue)
4461 : $replace.call(String(O), searchValue, replaceValue);
4462 }, $replace];
4463});
4464},{"35":35}],217:[function(_dereq_,module,exports){
4465// @@search logic
4466_dereq_(35)('search', 1, function(defined, SEARCH, $search){
4467 // 21.1.3.15 String.prototype.search(regexp)
4468 return [function search(regexp){
4469 'use strict';
4470 var O = defined(this)
4471 , fn = regexp == undefined ? undefined : regexp[SEARCH];
4472 return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
4473 }, $search];
4474});
4475},{"35":35}],218:[function(_dereq_,module,exports){
4476// @@split logic
4477_dereq_(35)('split', 2, function(defined, SPLIT, $split){
4478 'use strict';
4479 var isRegExp = _dereq_(50)
4480 , _split = $split
4481 , $push = [].push
4482 , $SPLIT = 'split'
4483 , LENGTH = 'length'
4484 , LAST_INDEX = 'lastIndex';
4485 if(
4486 'abbc'[$SPLIT](/(b)*/)[1] == 'c' ||
4487 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 ||
4488 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 ||
4489 '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 ||
4490 '.'[$SPLIT](/()()/)[LENGTH] > 1 ||
4491 ''[$SPLIT](/.?/)[LENGTH]
4492 ){
4493 var NPCG = /()??/.exec('')[1] === undefined; // nonparticipating capturing group
4494 // based on es5-shim implementation, need to rework it
4495 $split = function(separator, limit){
4496 var string = String(this);
4497 if(separator === undefined && limit === 0)return [];
4498 // If `separator` is not a regex, use native split
4499 if(!isRegExp(separator))return _split.call(string, separator, limit);
4500 var output = [];
4501 var flags = (separator.ignoreCase ? 'i' : '') +
4502 (separator.multiline ? 'm' : '') +
4503 (separator.unicode ? 'u' : '') +
4504 (separator.sticky ? 'y' : '');
4505 var lastLastIndex = 0;
4506 var splitLimit = limit === undefined ? 4294967295 : limit >>> 0;
4507 // Make `global` and avoid `lastIndex` issues by working with a copy
4508 var separatorCopy = new RegExp(separator.source, flags + 'g');
4509 var separator2, match, lastIndex, lastLength, i;
4510 // Doesn't need flags gy, but they don't hurt
4511 if(!NPCG)separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\s)', flags);
4512 while(match = separatorCopy.exec(string)){
4513 // `separatorCopy.lastIndex` is not reliable cross-browser
4514 lastIndex = match.index + match[0][LENGTH];
4515 if(lastIndex > lastLastIndex){
4516 output.push(string.slice(lastLastIndex, match.index));
4517 // Fix browsers whose `exec` methods don't consistently return `undefined` for NPCG
4518 if(!NPCG && match[LENGTH] > 1)match[0].replace(separator2, function(){
4519 for(i = 1; i < arguments[LENGTH] - 2; i++)if(arguments[i] === undefined)match[i] = undefined;
4520 });
4521 if(match[LENGTH] > 1 && match.index < string[LENGTH])$push.apply(output, match.slice(1));
4522 lastLength = match[0][LENGTH];
4523 lastLastIndex = lastIndex;
4524 if(output[LENGTH] >= splitLimit)break;
4525 }
4526 if(separatorCopy[LAST_INDEX] === match.index)separatorCopy[LAST_INDEX]++; // Avoid an infinite loop
4527 }
4528 if(lastLastIndex === string[LENGTH]){
4529 if(lastLength || !separatorCopy.test(''))output.push('');
4530 } else output.push(string.slice(lastLastIndex));
4531 return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output;
4532 };
4533 // Chakra, V8
4534 } else if('0'[$SPLIT](undefined, 0)[LENGTH]){
4535 $split = function(separator, limit){
4536 return separator === undefined && limit === 0 ? [] : _split.call(this, separator, limit);
4537 };
4538 }
4539 // 21.1.3.17 String.prototype.split(separator, limit)
4540 return [function split(separator, limit){
4541 var O = defined(this)
4542 , fn = separator == undefined ? undefined : separator[SPLIT];
4543 return fn !== undefined ? fn.call(separator, O, limit) : $split.call(String(O), separator, limit);
4544 }, $split];
4545});
4546},{"35":35,"50":50}],219:[function(_dereq_,module,exports){
4547'use strict';
4548_dereq_(214);
4549var anObject = _dereq_(7)
4550 , $flags = _dereq_(36)
4551 , DESCRIPTORS = _dereq_(28)
4552 , TO_STRING = 'toString'
4553 , $toString = /./[TO_STRING];
4554
4555var define = function(fn){
4556 _dereq_(87)(RegExp.prototype, TO_STRING, fn, true);
4557};
4558
4559// 21.2.5.14 RegExp.prototype.toString()
4560if(_dereq_(34)(function(){ return $toString.call({source: 'a', flags: 'b'}) != '/a/b'; })){
4561 define(function toString(){
4562 var R = anObject(this);
4563 return '/'.concat(R.source, '/',
4564 'flags' in R ? R.flags : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined);
4565 });
4566// FF44- RegExp#toString has a wrong name
4567} else if($toString.name != TO_STRING){
4568 define(function toString(){
4569 return $toString.call(this);
4570 });
4571}
4572},{"214":214,"28":28,"34":34,"36":36,"7":7,"87":87}],220:[function(_dereq_,module,exports){
4573'use strict';
4574var strong = _dereq_(19);
4575
4576// 23.2 Set Objects
4577module.exports = _dereq_(22)('Set', function(get){
4578 return function Set(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
4579}, {
4580 // 23.2.3.1 Set.prototype.add(value)
4581 add: function add(value){
4582 return strong.def(this, value = value === 0 ? 0 : value, value);
4583 }
4584}, strong);
4585},{"19":19,"22":22}],221:[function(_dereq_,module,exports){
4586'use strict';
4587// B.2.3.2 String.prototype.anchor(name)
4588_dereq_(99)('anchor', function(createHTML){
4589 return function anchor(name){
4590 return createHTML(this, 'a', 'name', name);
4591 }
4592});
4593},{"99":99}],222:[function(_dereq_,module,exports){
4594'use strict';
4595// B.2.3.3 String.prototype.big()
4596_dereq_(99)('big', function(createHTML){
4597 return function big(){
4598 return createHTML(this, 'big', '', '');
4599 }
4600});
4601},{"99":99}],223:[function(_dereq_,module,exports){
4602'use strict';
4603// B.2.3.4 String.prototype.blink()
4604_dereq_(99)('blink', function(createHTML){
4605 return function blink(){
4606 return createHTML(this, 'blink', '', '');
4607 }
4608});
4609},{"99":99}],224:[function(_dereq_,module,exports){
4610'use strict';
4611// B.2.3.5 String.prototype.bold()
4612_dereq_(99)('bold', function(createHTML){
4613 return function bold(){
4614 return createHTML(this, 'b', '', '');
4615 }
4616});
4617},{"99":99}],225:[function(_dereq_,module,exports){
4618'use strict';
4619var $export = _dereq_(32)
4620 , $at = _dereq_(97)(false);
4621$export($export.P, 'String', {
4622 // 21.1.3.3 String.prototype.codePointAt(pos)
4623 codePointAt: function codePointAt(pos){
4624 return $at(this, pos);
4625 }
4626});
4627},{"32":32,"97":97}],226:[function(_dereq_,module,exports){
4628// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition])
4629'use strict';
4630var $export = _dereq_(32)
4631 , toLength = _dereq_(108)
4632 , context = _dereq_(98)
4633 , ENDS_WITH = 'endsWith'
4634 , $endsWith = ''[ENDS_WITH];
4635
4636$export($export.P + $export.F * _dereq_(33)(ENDS_WITH), 'String', {
4637 endsWith: function endsWith(searchString /*, endPosition = @length */){
4638 var that = context(this, searchString, ENDS_WITH)
4639 , endPosition = arguments.length > 1 ? arguments[1] : undefined
4640 , len = toLength(that.length)
4641 , end = endPosition === undefined ? len : Math.min(toLength(endPosition), len)
4642 , search = String(searchString);
4643 return $endsWith
4644 ? $endsWith.call(that, search, end)
4645 : that.slice(end - search.length, end) === search;
4646 }
4647});
4648},{"108":108,"32":32,"33":33,"98":98}],227:[function(_dereq_,module,exports){
4649'use strict';
4650// B.2.3.6 String.prototype.fixed()
4651_dereq_(99)('fixed', function(createHTML){
4652 return function fixed(){
4653 return createHTML(this, 'tt', '', '');
4654 }
4655});
4656},{"99":99}],228:[function(_dereq_,module,exports){
4657'use strict';
4658// B.2.3.7 String.prototype.fontcolor(color)
4659_dereq_(99)('fontcolor', function(createHTML){
4660 return function fontcolor(color){
4661 return createHTML(this, 'font', 'color', color);
4662 }
4663});
4664},{"99":99}],229:[function(_dereq_,module,exports){
4665'use strict';
4666// B.2.3.8 String.prototype.fontsize(size)
4667_dereq_(99)('fontsize', function(createHTML){
4668 return function fontsize(size){
4669 return createHTML(this, 'font', 'size', size);
4670 }
4671});
4672},{"99":99}],230:[function(_dereq_,module,exports){
4673var $export = _dereq_(32)
4674 , toIndex = _dereq_(105)
4675 , fromCharCode = String.fromCharCode
4676 , $fromCodePoint = String.fromCodePoint;
4677
4678// length should be 1, old FF problem
4679$export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
4680 // 21.1.2.2 String.fromCodePoint(...codePoints)
4681 fromCodePoint: function fromCodePoint(x){ // eslint-disable-line no-unused-vars
4682 var res = []
4683 , aLen = arguments.length
4684 , i = 0
4685 , code;
4686 while(aLen > i){
4687 code = +arguments[i++];
4688 if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point');
4689 res.push(code < 0x10000
4690 ? fromCharCode(code)
4691 : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
4692 );
4693 } return res.join('');
4694 }
4695});
4696},{"105":105,"32":32}],231:[function(_dereq_,module,exports){
4697// 21.1.3.7 String.prototype.includes(searchString, position = 0)
4698'use strict';
4699var $export = _dereq_(32)
4700 , context = _dereq_(98)
4701 , INCLUDES = 'includes';
4702
4703$export($export.P + $export.F * _dereq_(33)(INCLUDES), 'String', {
4704 includes: function includes(searchString /*, position = 0 */){
4705 return !!~context(this, searchString, INCLUDES)
4706 .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined);
4707 }
4708});
4709},{"32":32,"33":33,"98":98}],232:[function(_dereq_,module,exports){
4710'use strict';
4711// B.2.3.9 String.prototype.italics()
4712_dereq_(99)('italics', function(createHTML){
4713 return function italics(){
4714 return createHTML(this, 'i', '', '');
4715 }
4716});
4717},{"99":99}],233:[function(_dereq_,module,exports){
4718'use strict';
4719var $at = _dereq_(97)(true);
4720
4721// 21.1.3.27 String.prototype[@@iterator]()
4722_dereq_(53)(String, 'String', function(iterated){
4723 this._t = String(iterated); // target
4724 this._i = 0; // next index
4725// 21.1.5.2.1 %StringIteratorPrototype%.next()
4726}, function(){
4727 var O = this._t
4728 , index = this._i
4729 , point;
4730 if(index >= O.length)return {value: undefined, done: true};
4731 point = $at(O, index);
4732 this._i += point.length;
4733 return {value: point, done: false};
4734});
4735},{"53":53,"97":97}],234:[function(_dereq_,module,exports){
4736'use strict';
4737// B.2.3.10 String.prototype.link(url)
4738_dereq_(99)('link', function(createHTML){
4739 return function link(url){
4740 return createHTML(this, 'a', 'href', url);
4741 }
4742});
4743},{"99":99}],235:[function(_dereq_,module,exports){
4744var $export = _dereq_(32)
4745 , toIObject = _dereq_(107)
4746 , toLength = _dereq_(108);
4747
4748$export($export.S, 'String', {
4749 // 21.1.2.4 String.raw(callSite, ...substitutions)
4750 raw: function raw(callSite){
4751 var tpl = toIObject(callSite.raw)
4752 , len = toLength(tpl.length)
4753 , aLen = arguments.length
4754 , res = []
4755 , i = 0;
4756 while(len > i){
4757 res.push(String(tpl[i++]));
4758 if(i < aLen)res.push(String(arguments[i]));
4759 } return res.join('');
4760 }
4761});
4762},{"107":107,"108":108,"32":32}],236:[function(_dereq_,module,exports){
4763var $export = _dereq_(32);
4764
4765$export($export.P, 'String', {
4766 // 21.1.3.13 String.prototype.repeat(count)
4767 repeat: _dereq_(101)
4768});
4769},{"101":101,"32":32}],237:[function(_dereq_,module,exports){
4770'use strict';
4771// B.2.3.11 String.prototype.small()
4772_dereq_(99)('small', function(createHTML){
4773 return function small(){
4774 return createHTML(this, 'small', '', '');
4775 }
4776});
4777},{"99":99}],238:[function(_dereq_,module,exports){
4778// 21.1.3.18 String.prototype.startsWith(searchString [, position ])
4779'use strict';
4780var $export = _dereq_(32)
4781 , toLength = _dereq_(108)
4782 , context = _dereq_(98)
4783 , STARTS_WITH = 'startsWith'
4784 , $startsWith = ''[STARTS_WITH];
4785
4786$export($export.P + $export.F * _dereq_(33)(STARTS_WITH), 'String', {
4787 startsWith: function startsWith(searchString /*, position = 0 */){
4788 var that = context(this, searchString, STARTS_WITH)
4789 , index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length))
4790 , search = String(searchString);
4791 return $startsWith
4792 ? $startsWith.call(that, search, index)
4793 : that.slice(index, index + search.length) === search;
4794 }
4795});
4796},{"108":108,"32":32,"33":33,"98":98}],239:[function(_dereq_,module,exports){
4797'use strict';
4798// B.2.3.12 String.prototype.strike()
4799_dereq_(99)('strike', function(createHTML){
4800 return function strike(){
4801 return createHTML(this, 'strike', '', '');
4802 }
4803});
4804},{"99":99}],240:[function(_dereq_,module,exports){
4805'use strict';
4806// B.2.3.13 String.prototype.sub()
4807_dereq_(99)('sub', function(createHTML){
4808 return function sub(){
4809 return createHTML(this, 'sub', '', '');
4810 }
4811});
4812},{"99":99}],241:[function(_dereq_,module,exports){
4813'use strict';
4814// B.2.3.14 String.prototype.sup()
4815_dereq_(99)('sup', function(createHTML){
4816 return function sup(){
4817 return createHTML(this, 'sup', '', '');
4818 }
4819});
4820},{"99":99}],242:[function(_dereq_,module,exports){
4821'use strict';
4822// 21.1.3.25 String.prototype.trim()
4823_dereq_(102)('trim', function($trim){
4824 return function trim(){
4825 return $trim(this, 3);
4826 };
4827});
4828},{"102":102}],243:[function(_dereq_,module,exports){
4829'use strict';
4830// ECMAScript 6 symbols shim
4831var global = _dereq_(38)
4832 , has = _dereq_(39)
4833 , DESCRIPTORS = _dereq_(28)
4834 , $export = _dereq_(32)
4835 , redefine = _dereq_(87)
4836 , META = _dereq_(62).KEY
4837 , $fails = _dereq_(34)
4838 , shared = _dereq_(94)
4839 , setToStringTag = _dereq_(92)
4840 , uid = _dereq_(114)
4841 , wks = _dereq_(117)
4842 , wksExt = _dereq_(116)
4843 , wksDefine = _dereq_(115)
4844 , keyOf = _dereq_(57)
4845 , enumKeys = _dereq_(31)
4846 , isArray = _dereq_(47)
4847 , anObject = _dereq_(7)
4848 , toIObject = _dereq_(107)
4849 , toPrimitive = _dereq_(110)
4850 , createDesc = _dereq_(85)
4851 , _create = _dereq_(66)
4852 , gOPNExt = _dereq_(71)
4853 , $GOPD = _dereq_(70)
4854 , $DP = _dereq_(67)
4855 , $keys = _dereq_(76)
4856 , gOPD = $GOPD.f
4857 , dP = $DP.f
4858 , gOPN = gOPNExt.f
4859 , $Symbol = global.Symbol
4860 , $JSON = global.JSON
4861 , _stringify = $JSON && $JSON.stringify
4862 , PROTOTYPE = 'prototype'
4863 , HIDDEN = wks('_hidden')
4864 , TO_PRIMITIVE = wks('toPrimitive')
4865 , isEnum = {}.propertyIsEnumerable
4866 , SymbolRegistry = shared('symbol-registry')
4867 , AllSymbols = shared('symbols')
4868 , OPSymbols = shared('op-symbols')
4869 , ObjectProto = Object[PROTOTYPE]
4870 , USE_NATIVE = typeof $Symbol == 'function'
4871 , QObject = global.QObject;
4872// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
4873var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
4874
4875// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
4876var setSymbolDesc = DESCRIPTORS && $fails(function(){
4877 return _create(dP({}, 'a', {
4878 get: function(){ return dP(this, 'a', {value: 7}).a; }
4879 })).a != 7;
4880}) ? function(it, key, D){
4881 var protoDesc = gOPD(ObjectProto, key);
4882 if(protoDesc)delete ObjectProto[key];
4883 dP(it, key, D);
4884 if(protoDesc && it !== ObjectProto)dP(ObjectProto, key, protoDesc);
4885} : dP;
4886
4887var wrap = function(tag){
4888 var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
4889 sym._k = tag;
4890 return sym;
4891};
4892
4893var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function(it){
4894 return typeof it == 'symbol';
4895} : function(it){
4896 return it instanceof $Symbol;
4897};
4898
4899var $defineProperty = function defineProperty(it, key, D){
4900 if(it === ObjectProto)$defineProperty(OPSymbols, key, D);
4901 anObject(it);
4902 key = toPrimitive(key, true);
4903 anObject(D);
4904 if(has(AllSymbols, key)){
4905 if(!D.enumerable){
4906 if(!has(it, HIDDEN))dP(it, HIDDEN, createDesc(1, {}));
4907 it[HIDDEN][key] = true;
4908 } else {
4909 if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false;
4910 D = _create(D, {enumerable: createDesc(0, false)});
4911 } return setSymbolDesc(it, key, D);
4912 } return dP(it, key, D);
4913};
4914var $defineProperties = function defineProperties(it, P){
4915 anObject(it);
4916 var keys = enumKeys(P = toIObject(P))
4917 , i = 0
4918 , l = keys.length
4919 , key;
4920 while(l > i)$defineProperty(it, key = keys[i++], P[key]);
4921 return it;
4922};
4923var $create = function create(it, P){
4924 return P === undefined ? _create(it) : $defineProperties(_create(it), P);
4925};
4926var $propertyIsEnumerable = function propertyIsEnumerable(key){
4927 var E = isEnum.call(this, key = toPrimitive(key, true));
4928 if(this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return false;
4929 return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
4930};
4931var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){
4932 it = toIObject(it);
4933 key = toPrimitive(key, true);
4934 if(it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return;
4935 var D = gOPD(it, key);
4936 if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true;
4937 return D;
4938};
4939var $getOwnPropertyNames = function getOwnPropertyNames(it){
4940 var names = gOPN(toIObject(it))
4941 , result = []
4942 , i = 0
4943 , key;
4944 while(names.length > i){
4945 if(!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META)result.push(key);
4946 } return result;
4947};
4948var $getOwnPropertySymbols = function getOwnPropertySymbols(it){
4949 var IS_OP = it === ObjectProto
4950 , names = gOPN(IS_OP ? OPSymbols : toIObject(it))
4951 , result = []
4952 , i = 0
4953 , key;
4954 while(names.length > i){
4955 if(has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true))result.push(AllSymbols[key]);
4956 } return result;
4957};
4958
4959// 19.4.1.1 Symbol([description])
4960if(!USE_NATIVE){
4961 $Symbol = function Symbol(){
4962 if(this instanceof $Symbol)throw TypeError('Symbol is not a constructor!');
4963 var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
4964 var $set = function(value){
4965 if(this === ObjectProto)$set.call(OPSymbols, value);
4966 if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false;
4967 setSymbolDesc(this, tag, createDesc(1, value));
4968 };
4969 if(DESCRIPTORS && setter)setSymbolDesc(ObjectProto, tag, {configurable: true, set: $set});
4970 return wrap(tag);
4971 };
4972 redefine($Symbol[PROTOTYPE], 'toString', function toString(){
4973 return this._k;
4974 });
4975
4976 $GOPD.f = $getOwnPropertyDescriptor;
4977 $DP.f = $defineProperty;
4978 _dereq_(72).f = gOPNExt.f = $getOwnPropertyNames;
4979 _dereq_(77).f = $propertyIsEnumerable;
4980 _dereq_(73).f = $getOwnPropertySymbols;
4981
4982 if(DESCRIPTORS && !_dereq_(58)){
4983 redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
4984 }
4985
4986 wksExt.f = function(name){
4987 return wrap(wks(name));
4988 }
4989}
4990
4991$export($export.G + $export.W + $export.F * !USE_NATIVE, {Symbol: $Symbol});
4992
4993for(var symbols = (
4994 // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
4995 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
4996).split(','), i = 0; symbols.length > i; )wks(symbols[i++]);
4997
4998for(var symbols = $keys(wks.store), i = 0; symbols.length > i; )wksDefine(symbols[i++]);
4999
5000$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
5001 // 19.4.2.1 Symbol.for(key)
5002 'for': function(key){
5003 return has(SymbolRegistry, key += '')
5004 ? SymbolRegistry[key]
5005 : SymbolRegistry[key] = $Symbol(key);
5006 },
5007 // 19.4.2.5 Symbol.keyFor(sym)
5008 keyFor: function keyFor(key){
5009 if(isSymbol(key))return keyOf(SymbolRegistry, key);
5010 throw TypeError(key + ' is not a symbol!');
5011 },
5012 useSetter: function(){ setter = true; },
5013 useSimple: function(){ setter = false; }
5014});
5015
5016$export($export.S + $export.F * !USE_NATIVE, 'Object', {
5017 // 19.1.2.2 Object.create(O [, Properties])
5018 create: $create,
5019 // 19.1.2.4 Object.defineProperty(O, P, Attributes)
5020 defineProperty: $defineProperty,
5021 // 19.1.2.3 Object.defineProperties(O, Properties)
5022 defineProperties: $defineProperties,
5023 // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
5024 getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
5025 // 19.1.2.7 Object.getOwnPropertyNames(O)
5026 getOwnPropertyNames: $getOwnPropertyNames,
5027 // 19.1.2.8 Object.getOwnPropertySymbols(O)
5028 getOwnPropertySymbols: $getOwnPropertySymbols
5029});
5030
5031// 24.3.2 JSON.stringify(value [, replacer [, space]])
5032$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function(){
5033 var S = $Symbol();
5034 // MS Edge converts symbol values to JSON as {}
5035 // WebKit converts symbol values to JSON as null
5036 // V8 throws on boxed symbols
5037 return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}';
5038})), 'JSON', {
5039 stringify: function stringify(it){
5040 if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined
5041 var args = [it]
5042 , i = 1
5043 , replacer, $replacer;
5044 while(arguments.length > i)args.push(arguments[i++]);
5045 replacer = args[1];
5046 if(typeof replacer == 'function')$replacer = replacer;
5047 if($replacer || !isArray(replacer))replacer = function(key, value){
5048 if($replacer)value = $replacer.call(this, key, value);
5049 if(!isSymbol(value))return value;
5050 };
5051 args[1] = replacer;
5052 return _stringify.apply($JSON, args);
5053 }
5054});
5055
5056// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
5057$Symbol[PROTOTYPE][TO_PRIMITIVE] || _dereq_(40)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
5058// 19.4.3.5 Symbol.prototype[@@toStringTag]
5059setToStringTag($Symbol, 'Symbol');
5060// 20.2.1.9 Math[@@toStringTag]
5061setToStringTag(Math, 'Math', true);
5062// 24.3.3 JSON[@@toStringTag]
5063setToStringTag(global.JSON, 'JSON', true);
5064},{"107":107,"110":110,"114":114,"115":115,"116":116,"117":117,"28":28,"31":31,"32":32,"34":34,"38":38,"39":39,"40":40,"47":47,"57":57,"58":58,"62":62,"66":66,"67":67,"7":7,"70":70,"71":71,"72":72,"73":73,"76":76,"77":77,"85":85,"87":87,"92":92,"94":94}],244:[function(_dereq_,module,exports){
5065'use strict';
5066var $export = _dereq_(32)
5067 , $typed = _dereq_(113)
5068 , buffer = _dereq_(112)
5069 , anObject = _dereq_(7)
5070 , toIndex = _dereq_(105)
5071 , toLength = _dereq_(108)
5072 , isObject = _dereq_(49)
5073 , ArrayBuffer = _dereq_(38).ArrayBuffer
5074 , speciesConstructor = _dereq_(95)
5075 , $ArrayBuffer = buffer.ArrayBuffer
5076 , $DataView = buffer.DataView
5077 , $isView = $typed.ABV && ArrayBuffer.isView
5078 , $slice = $ArrayBuffer.prototype.slice
5079 , VIEW = $typed.VIEW
5080 , ARRAY_BUFFER = 'ArrayBuffer';
5081
5082$export($export.G + $export.W + $export.F * (ArrayBuffer !== $ArrayBuffer), {ArrayBuffer: $ArrayBuffer});
5083
5084$export($export.S + $export.F * !$typed.CONSTR, ARRAY_BUFFER, {
5085 // 24.1.3.1 ArrayBuffer.isView(arg)
5086 isView: function isView(it){
5087 return $isView && $isView(it) || isObject(it) && VIEW in it;
5088 }
5089});
5090
5091$export($export.P + $export.U + $export.F * _dereq_(34)(function(){
5092 return !new $ArrayBuffer(2).slice(1, undefined).byteLength;
5093}), ARRAY_BUFFER, {
5094 // 24.1.4.3 ArrayBuffer.prototype.slice(start, end)
5095 slice: function slice(start, end){
5096 if($slice !== undefined && end === undefined)return $slice.call(anObject(this), start); // FF fix
5097 var len = anObject(this).byteLength
5098 , first = toIndex(start, len)
5099 , final = toIndex(end === undefined ? len : end, len)
5100 , result = new (speciesConstructor(this, $ArrayBuffer))(toLength(final - first))
5101 , viewS = new $DataView(this)
5102 , viewT = new $DataView(result)
5103 , index = 0;
5104 while(first < final){
5105 viewT.setUint8(index++, viewS.getUint8(first++));
5106 } return result;
5107 }
5108});
5109
5110_dereq_(91)(ARRAY_BUFFER);
5111},{"105":105,"108":108,"112":112,"113":113,"32":32,"34":34,"38":38,"49":49,"7":7,"91":91,"95":95}],245:[function(_dereq_,module,exports){
5112var $export = _dereq_(32);
5113$export($export.G + $export.W + $export.F * !_dereq_(113).ABV, {
5114 DataView: _dereq_(112).DataView
5115});
5116},{"112":112,"113":113,"32":32}],246:[function(_dereq_,module,exports){
5117_dereq_(111)('Float32', 4, function(init){
5118 return function Float32Array(data, byteOffset, length){
5119 return init(this, data, byteOffset, length);
5120 };
5121});
5122},{"111":111}],247:[function(_dereq_,module,exports){
5123_dereq_(111)('Float64', 8, function(init){
5124 return function Float64Array(data, byteOffset, length){
5125 return init(this, data, byteOffset, length);
5126 };
5127});
5128},{"111":111}],248:[function(_dereq_,module,exports){
5129_dereq_(111)('Int16', 2, function(init){
5130 return function Int16Array(data, byteOffset, length){
5131 return init(this, data, byteOffset, length);
5132 };
5133});
5134},{"111":111}],249:[function(_dereq_,module,exports){
5135_dereq_(111)('Int32', 4, function(init){
5136 return function Int32Array(data, byteOffset, length){
5137 return init(this, data, byteOffset, length);
5138 };
5139});
5140},{"111":111}],250:[function(_dereq_,module,exports){
5141_dereq_(111)('Int8', 1, function(init){
5142 return function Int8Array(data, byteOffset, length){
5143 return init(this, data, byteOffset, length);
5144 };
5145});
5146},{"111":111}],251:[function(_dereq_,module,exports){
5147_dereq_(111)('Uint16', 2, function(init){
5148 return function Uint16Array(data, byteOffset, length){
5149 return init(this, data, byteOffset, length);
5150 };
5151});
5152},{"111":111}],252:[function(_dereq_,module,exports){
5153_dereq_(111)('Uint32', 4, function(init){
5154 return function Uint32Array(data, byteOffset, length){
5155 return init(this, data, byteOffset, length);
5156 };
5157});
5158},{"111":111}],253:[function(_dereq_,module,exports){
5159_dereq_(111)('Uint8', 1, function(init){
5160 return function Uint8Array(data, byteOffset, length){
5161 return init(this, data, byteOffset, length);
5162 };
5163});
5164},{"111":111}],254:[function(_dereq_,module,exports){
5165_dereq_(111)('Uint8', 1, function(init){
5166 return function Uint8ClampedArray(data, byteOffset, length){
5167 return init(this, data, byteOffset, length);
5168 };
5169}, true);
5170},{"111":111}],255:[function(_dereq_,module,exports){
5171'use strict';
5172var each = _dereq_(12)(0)
5173 , redefine = _dereq_(87)
5174 , meta = _dereq_(62)
5175 , assign = _dereq_(65)
5176 , weak = _dereq_(21)
5177 , isObject = _dereq_(49)
5178 , getWeak = meta.getWeak
5179 , isExtensible = Object.isExtensible
5180 , uncaughtFrozenStore = weak.ufstore
5181 , tmp = {}
5182 , InternalMap;
5183
5184var wrapper = function(get){
5185 return function WeakMap(){
5186 return get(this, arguments.length > 0 ? arguments[0] : undefined);
5187 };
5188};
5189
5190var methods = {
5191 // 23.3.3.3 WeakMap.prototype.get(key)
5192 get: function get(key){
5193 if(isObject(key)){
5194 var data = getWeak(key);
5195 if(data === true)return uncaughtFrozenStore(this).get(key);
5196 return data ? data[this._i] : undefined;
5197 }
5198 },
5199 // 23.3.3.5 WeakMap.prototype.set(key, value)
5200 set: function set(key, value){
5201 return weak.def(this, key, value);
5202 }
5203};
5204
5205// 23.3 WeakMap Objects
5206var $WeakMap = module.exports = _dereq_(22)('WeakMap', wrapper, methods, weak, true, true);
5207
5208// IE11 WeakMap frozen keys fix
5209if(new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7){
5210 InternalMap = weak.getConstructor(wrapper);
5211 assign(InternalMap.prototype, methods);
5212 meta.NEED = true;
5213 each(['delete', 'has', 'get', 'set'], function(key){
5214 var proto = $WeakMap.prototype
5215 , method = proto[key];
5216 redefine(proto, key, function(a, b){
5217 // store frozen objects on internal weakmap shim
5218 if(isObject(a) && !isExtensible(a)){
5219 if(!this._f)this._f = new InternalMap;
5220 var result = this._f[key](a, b);
5221 return key == 'set' ? this : result;
5222 // store all the rest on native weakmap
5223 } return method.call(this, a, b);
5224 });
5225 });
5226}
5227},{"12":12,"21":21,"22":22,"49":49,"62":62,"65":65,"87":87}],256:[function(_dereq_,module,exports){
5228'use strict';
5229var weak = _dereq_(21);
5230
5231// 23.4 WeakSet Objects
5232_dereq_(22)('WeakSet', function(get){
5233 return function WeakSet(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
5234}, {
5235 // 23.4.3.1 WeakSet.prototype.add(value)
5236 add: function add(value){
5237 return weak.def(this, value, true);
5238 }
5239}, weak, false, true);
5240},{"21":21,"22":22}],257:[function(_dereq_,module,exports){
5241'use strict';
5242// https://github.com/tc39/Array.prototype.includes
5243var $export = _dereq_(32)
5244 , $includes = _dereq_(11)(true);
5245
5246$export($export.P, 'Array', {
5247 includes: function includes(el /*, fromIndex = 0 */){
5248 return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
5249 }
5250});
5251
5252_dereq_(5)('includes');
5253},{"11":11,"32":32,"5":5}],258:[function(_dereq_,module,exports){
5254// https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-09/sept-25.md#510-globalasap-for-enqueuing-a-microtask
5255var $export = _dereq_(32)
5256 , microtask = _dereq_(64)()
5257 , process = _dereq_(38).process
5258 , isNode = _dereq_(18)(process) == 'process';
5259
5260$export($export.G, {
5261 asap: function asap(fn){
5262 var domain = isNode && process.domain;
5263 microtask(domain ? domain.bind(fn) : fn);
5264 }
5265});
5266},{"18":18,"32":32,"38":38,"64":64}],259:[function(_dereq_,module,exports){
5267// https://github.com/ljharb/proposal-is-error
5268var $export = _dereq_(32)
5269 , cof = _dereq_(18);
5270
5271$export($export.S, 'Error', {
5272 isError: function isError(it){
5273 return cof(it) === 'Error';
5274 }
5275});
5276},{"18":18,"32":32}],260:[function(_dereq_,module,exports){
5277// https://github.com/DavidBruant/Map-Set.prototype.toJSON
5278var $export = _dereq_(32);
5279
5280$export($export.P + $export.R, 'Map', {toJSON: _dereq_(20)('Map')});
5281},{"20":20,"32":32}],261:[function(_dereq_,module,exports){
5282// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
5283var $export = _dereq_(32);
5284
5285$export($export.S, 'Math', {
5286 iaddh: function iaddh(x0, x1, y0, y1){
5287 var $x0 = x0 >>> 0
5288 , $x1 = x1 >>> 0
5289 , $y0 = y0 >>> 0;
5290 return $x1 + (y1 >>> 0) + (($x0 & $y0 | ($x0 | $y0) & ~($x0 + $y0 >>> 0)) >>> 31) | 0;
5291 }
5292});
5293},{"32":32}],262:[function(_dereq_,module,exports){
5294// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
5295var $export = _dereq_(32);
5296
5297$export($export.S, 'Math', {
5298 imulh: function imulh(u, v){
5299 var UINT16 = 0xffff
5300 , $u = +u
5301 , $v = +v
5302 , u0 = $u & UINT16
5303 , v0 = $v & UINT16
5304 , u1 = $u >> 16
5305 , v1 = $v >> 16
5306 , t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16);
5307 return u1 * v1 + (t >> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >> 16);
5308 }
5309});
5310},{"32":32}],263:[function(_dereq_,module,exports){
5311// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
5312var $export = _dereq_(32);
5313
5314$export($export.S, 'Math', {
5315 isubh: function isubh(x0, x1, y0, y1){
5316 var $x0 = x0 >>> 0
5317 , $x1 = x1 >>> 0
5318 , $y0 = y0 >>> 0;
5319 return $x1 - (y1 >>> 0) - ((~$x0 & $y0 | ~($x0 ^ $y0) & $x0 - $y0 >>> 0) >>> 31) | 0;
5320 }
5321});
5322},{"32":32}],264:[function(_dereq_,module,exports){
5323// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
5324var $export = _dereq_(32);
5325
5326$export($export.S, 'Math', {
5327 umulh: function umulh(u, v){
5328 var UINT16 = 0xffff
5329 , $u = +u
5330 , $v = +v
5331 , u0 = $u & UINT16
5332 , v0 = $v & UINT16
5333 , u1 = $u >>> 16
5334 , v1 = $v >>> 16
5335 , t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16);
5336 return u1 * v1 + (t >>> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >>> 16);
5337 }
5338});
5339},{"32":32}],265:[function(_dereq_,module,exports){
5340'use strict';
5341var $export = _dereq_(32)
5342 , toObject = _dereq_(109)
5343 , aFunction = _dereq_(3)
5344 , $defineProperty = _dereq_(67);
5345
5346// B.2.2.2 Object.prototype.__defineGetter__(P, getter)
5347_dereq_(28) && $export($export.P + _dereq_(69), 'Object', {
5348 __defineGetter__: function __defineGetter__(P, getter){
5349 $defineProperty.f(toObject(this), P, {get: aFunction(getter), enumerable: true, configurable: true});
5350 }
5351});
5352},{"109":109,"28":28,"3":3,"32":32,"67":67,"69":69}],266:[function(_dereq_,module,exports){
5353'use strict';
5354var $export = _dereq_(32)
5355 , toObject = _dereq_(109)
5356 , aFunction = _dereq_(3)
5357 , $defineProperty = _dereq_(67);
5358
5359// B.2.2.3 Object.prototype.__defineSetter__(P, setter)
5360_dereq_(28) && $export($export.P + _dereq_(69), 'Object', {
5361 __defineSetter__: function __defineSetter__(P, setter){
5362 $defineProperty.f(toObject(this), P, {set: aFunction(setter), enumerable: true, configurable: true});
5363 }
5364});
5365},{"109":109,"28":28,"3":3,"32":32,"67":67,"69":69}],267:[function(_dereq_,module,exports){
5366// https://github.com/tc39/proposal-object-values-entries
5367var $export = _dereq_(32)
5368 , $entries = _dereq_(79)(true);
5369
5370$export($export.S, 'Object', {
5371 entries: function entries(it){
5372 return $entries(it);
5373 }
5374});
5375},{"32":32,"79":79}],268:[function(_dereq_,module,exports){
5376// https://github.com/tc39/proposal-object-getownpropertydescriptors
5377var $export = _dereq_(32)
5378 , ownKeys = _dereq_(80)
5379 , toIObject = _dereq_(107)
5380 , gOPD = _dereq_(70)
5381 , createProperty = _dereq_(24);
5382
5383$export($export.S, 'Object', {
5384 getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object){
5385 var O = toIObject(object)
5386 , getDesc = gOPD.f
5387 , keys = ownKeys(O)
5388 , result = {}
5389 , i = 0
5390 , key;
5391 while(keys.length > i)createProperty(result, key = keys[i++], getDesc(O, key));
5392 return result;
5393 }
5394});
5395},{"107":107,"24":24,"32":32,"70":70,"80":80}],269:[function(_dereq_,module,exports){
5396'use strict';
5397var $export = _dereq_(32)
5398 , toObject = _dereq_(109)
5399 , toPrimitive = _dereq_(110)
5400 , getPrototypeOf = _dereq_(74)
5401 , getOwnPropertyDescriptor = _dereq_(70).f;
5402
5403// B.2.2.4 Object.prototype.__lookupGetter__(P)
5404_dereq_(28) && $export($export.P + _dereq_(69), 'Object', {
5405 __lookupGetter__: function __lookupGetter__(P){
5406 var O = toObject(this)
5407 , K = toPrimitive(P, true)
5408 , D;
5409 do {
5410 if(D = getOwnPropertyDescriptor(O, K))return D.get;
5411 } while(O = getPrototypeOf(O));
5412 }
5413});
5414},{"109":109,"110":110,"28":28,"32":32,"69":69,"70":70,"74":74}],270:[function(_dereq_,module,exports){
5415'use strict';
5416var $export = _dereq_(32)
5417 , toObject = _dereq_(109)
5418 , toPrimitive = _dereq_(110)
5419 , getPrototypeOf = _dereq_(74)
5420 , getOwnPropertyDescriptor = _dereq_(70).f;
5421
5422// B.2.2.5 Object.prototype.__lookupSetter__(P)
5423_dereq_(28) && $export($export.P + _dereq_(69), 'Object', {
5424 __lookupSetter__: function __lookupSetter__(P){
5425 var O = toObject(this)
5426 , K = toPrimitive(P, true)
5427 , D;
5428 do {
5429 if(D = getOwnPropertyDescriptor(O, K))return D.set;
5430 } while(O = getPrototypeOf(O));
5431 }
5432});
5433},{"109":109,"110":110,"28":28,"32":32,"69":69,"70":70,"74":74}],271:[function(_dereq_,module,exports){
5434// https://github.com/tc39/proposal-object-values-entries
5435var $export = _dereq_(32)
5436 , $values = _dereq_(79)(false);
5437
5438$export($export.S, 'Object', {
5439 values: function values(it){
5440 return $values(it);
5441 }
5442});
5443},{"32":32,"79":79}],272:[function(_dereq_,module,exports){
5444'use strict';
5445// https://github.com/zenparsing/es-observable
5446var $export = _dereq_(32)
5447 , global = _dereq_(38)
5448 , core = _dereq_(23)
5449 , microtask = _dereq_(64)()
5450 , OBSERVABLE = _dereq_(117)('observable')
5451 , aFunction = _dereq_(3)
5452 , anObject = _dereq_(7)
5453 , anInstance = _dereq_(6)
5454 , redefineAll = _dereq_(86)
5455 , hide = _dereq_(40)
5456 , forOf = _dereq_(37)
5457 , RETURN = forOf.RETURN;
5458
5459var getMethod = function(fn){
5460 return fn == null ? undefined : aFunction(fn);
5461};
5462
5463var cleanupSubscription = function(subscription){
5464 var cleanup = subscription._c;
5465 if(cleanup){
5466 subscription._c = undefined;
5467 cleanup();
5468 }
5469};
5470
5471var subscriptionClosed = function(subscription){
5472 return subscription._o === undefined;
5473};
5474
5475var closeSubscription = function(subscription){
5476 if(!subscriptionClosed(subscription)){
5477 subscription._o = undefined;
5478 cleanupSubscription(subscription);
5479 }
5480};
5481
5482var Subscription = function(observer, subscriber){
5483 anObject(observer);
5484 this._c = undefined;
5485 this._o = observer;
5486 observer = new SubscriptionObserver(this);
5487 try {
5488 var cleanup = subscriber(observer)
5489 , subscription = cleanup;
5490 if(cleanup != null){
5491 if(typeof cleanup.unsubscribe === 'function')cleanup = function(){ subscription.unsubscribe(); };
5492 else aFunction(cleanup);
5493 this._c = cleanup;
5494 }
5495 } catch(e){
5496 observer.error(e);
5497 return;
5498 } if(subscriptionClosed(this))cleanupSubscription(this);
5499};
5500
5501Subscription.prototype = redefineAll({}, {
5502 unsubscribe: function unsubscribe(){ closeSubscription(this); }
5503});
5504
5505var SubscriptionObserver = function(subscription){
5506 this._s = subscription;
5507};
5508
5509SubscriptionObserver.prototype = redefineAll({}, {
5510 next: function next(value){
5511 var subscription = this._s;
5512 if(!subscriptionClosed(subscription)){
5513 var observer = subscription._o;
5514 try {
5515 var m = getMethod(observer.next);
5516 if(m)return m.call(observer, value);
5517 } catch(e){
5518 try {
5519 closeSubscription(subscription);
5520 } finally {
5521 throw e;
5522 }
5523 }
5524 }
5525 },
5526 error: function error(value){
5527 var subscription = this._s;
5528 if(subscriptionClosed(subscription))throw value;
5529 var observer = subscription._o;
5530 subscription._o = undefined;
5531 try {
5532 var m = getMethod(observer.error);
5533 if(!m)throw value;
5534 value = m.call(observer, value);
5535 } catch(e){
5536 try {
5537 cleanupSubscription(subscription);
5538 } finally {
5539 throw e;
5540 }
5541 } cleanupSubscription(subscription);
5542 return value;
5543 },
5544 complete: function complete(value){
5545 var subscription = this._s;
5546 if(!subscriptionClosed(subscription)){
5547 var observer = subscription._o;
5548 subscription._o = undefined;
5549 try {
5550 var m = getMethod(observer.complete);
5551 value = m ? m.call(observer, value) : undefined;
5552 } catch(e){
5553 try {
5554 cleanupSubscription(subscription);
5555 } finally {
5556 throw e;
5557 }
5558 } cleanupSubscription(subscription);
5559 return value;
5560 }
5561 }
5562});
5563
5564var $Observable = function Observable(subscriber){
5565 anInstance(this, $Observable, 'Observable', '_f')._f = aFunction(subscriber);
5566};
5567
5568redefineAll($Observable.prototype, {
5569 subscribe: function subscribe(observer){
5570 return new Subscription(observer, this._f);
5571 },
5572 forEach: function forEach(fn){
5573 var that = this;
5574 return new (core.Promise || global.Promise)(function(resolve, reject){
5575 aFunction(fn);
5576 var subscription = that.subscribe({
5577 next : function(value){
5578 try {
5579 return fn(value);
5580 } catch(e){
5581 reject(e);
5582 subscription.unsubscribe();
5583 }
5584 },
5585 error: reject,
5586 complete: resolve
5587 });
5588 });
5589 }
5590});
5591
5592redefineAll($Observable, {
5593 from: function from(x){
5594 var C = typeof this === 'function' ? this : $Observable;
5595 var method = getMethod(anObject(x)[OBSERVABLE]);
5596 if(method){
5597 var observable = anObject(method.call(x));
5598 return observable.constructor === C ? observable : new C(function(observer){
5599 return observable.subscribe(observer);
5600 });
5601 }
5602 return new C(function(observer){
5603 var done = false;
5604 microtask(function(){
5605 if(!done){
5606 try {
5607 if(forOf(x, false, function(it){
5608 observer.next(it);
5609 if(done)return RETURN;
5610 }) === RETURN)return;
5611 } catch(e){
5612 if(done)throw e;
5613 observer.error(e);
5614 return;
5615 } observer.complete();
5616 }
5617 });
5618 return function(){ done = true; };
5619 });
5620 },
5621 of: function of(){
5622 for(var i = 0, l = arguments.length, items = Array(l); i < l;)items[i] = arguments[i++];
5623 return new (typeof this === 'function' ? this : $Observable)(function(observer){
5624 var done = false;
5625 microtask(function(){
5626 if(!done){
5627 for(var i = 0; i < items.length; ++i){
5628 observer.next(items[i]);
5629 if(done)return;
5630 } observer.complete();
5631 }
5632 });
5633 return function(){ done = true; };
5634 });
5635 }
5636});
5637
5638hide($Observable.prototype, OBSERVABLE, function(){ return this; });
5639
5640$export($export.G, {Observable: $Observable});
5641
5642_dereq_(91)('Observable');
5643},{"117":117,"23":23,"3":3,"32":32,"37":37,"38":38,"40":40,"6":6,"64":64,"7":7,"86":86,"91":91}],273:[function(_dereq_,module,exports){
5644var metadata = _dereq_(63)
5645 , anObject = _dereq_(7)
5646 , toMetaKey = metadata.key
5647 , ordinaryDefineOwnMetadata = metadata.set;
5648
5649metadata.exp({defineMetadata: function defineMetadata(metadataKey, metadataValue, target, targetKey){
5650 ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), toMetaKey(targetKey));
5651}});
5652},{"63":63,"7":7}],274:[function(_dereq_,module,exports){
5653var metadata = _dereq_(63)
5654 , anObject = _dereq_(7)
5655 , toMetaKey = metadata.key
5656 , getOrCreateMetadataMap = metadata.map
5657 , store = metadata.store;
5658
5659metadata.exp({deleteMetadata: function deleteMetadata(metadataKey, target /*, targetKey */){
5660 var targetKey = arguments.length < 3 ? undefined : toMetaKey(arguments[2])
5661 , metadataMap = getOrCreateMetadataMap(anObject(target), targetKey, false);
5662 if(metadataMap === undefined || !metadataMap['delete'](metadataKey))return false;
5663 if(metadataMap.size)return true;
5664 var targetMetadata = store.get(target);
5665 targetMetadata['delete'](targetKey);
5666 return !!targetMetadata.size || store['delete'](target);
5667}});
5668},{"63":63,"7":7}],275:[function(_dereq_,module,exports){
5669var Set = _dereq_(220)
5670 , from = _dereq_(10)
5671 , metadata = _dereq_(63)
5672 , anObject = _dereq_(7)
5673 , getPrototypeOf = _dereq_(74)
5674 , ordinaryOwnMetadataKeys = metadata.keys
5675 , toMetaKey = metadata.key;
5676
5677var ordinaryMetadataKeys = function(O, P){
5678 var oKeys = ordinaryOwnMetadataKeys(O, P)
5679 , parent = getPrototypeOf(O);
5680 if(parent === null)return oKeys;
5681 var pKeys = ordinaryMetadataKeys(parent, P);
5682 return pKeys.length ? oKeys.length ? from(new Set(oKeys.concat(pKeys))) : pKeys : oKeys;
5683};
5684
5685metadata.exp({getMetadataKeys: function getMetadataKeys(target /*, targetKey */){
5686 return ordinaryMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1]));
5687}});
5688},{"10":10,"220":220,"63":63,"7":7,"74":74}],276:[function(_dereq_,module,exports){
5689var metadata = _dereq_(63)
5690 , anObject = _dereq_(7)
5691 , getPrototypeOf = _dereq_(74)
5692 , ordinaryHasOwnMetadata = metadata.has
5693 , ordinaryGetOwnMetadata = metadata.get
5694 , toMetaKey = metadata.key;
5695
5696var ordinaryGetMetadata = function(MetadataKey, O, P){
5697 var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P);
5698 if(hasOwn)return ordinaryGetOwnMetadata(MetadataKey, O, P);
5699 var parent = getPrototypeOf(O);
5700 return parent !== null ? ordinaryGetMetadata(MetadataKey, parent, P) : undefined;
5701};
5702
5703metadata.exp({getMetadata: function getMetadata(metadataKey, target /*, targetKey */){
5704 return ordinaryGetMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
5705}});
5706},{"63":63,"7":7,"74":74}],277:[function(_dereq_,module,exports){
5707var metadata = _dereq_(63)
5708 , anObject = _dereq_(7)
5709 , ordinaryOwnMetadataKeys = metadata.keys
5710 , toMetaKey = metadata.key;
5711
5712metadata.exp({getOwnMetadataKeys: function getOwnMetadataKeys(target /*, targetKey */){
5713 return ordinaryOwnMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1]));
5714}});
5715},{"63":63,"7":7}],278:[function(_dereq_,module,exports){
5716var metadata = _dereq_(63)
5717 , anObject = _dereq_(7)
5718 , ordinaryGetOwnMetadata = metadata.get
5719 , toMetaKey = metadata.key;
5720
5721metadata.exp({getOwnMetadata: function getOwnMetadata(metadataKey, target /*, targetKey */){
5722 return ordinaryGetOwnMetadata(metadataKey, anObject(target)
5723 , arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
5724}});
5725},{"63":63,"7":7}],279:[function(_dereq_,module,exports){
5726var metadata = _dereq_(63)
5727 , anObject = _dereq_(7)
5728 , getPrototypeOf = _dereq_(74)
5729 , ordinaryHasOwnMetadata = metadata.has
5730 , toMetaKey = metadata.key;
5731
5732var ordinaryHasMetadata = function(MetadataKey, O, P){
5733 var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P);
5734 if(hasOwn)return true;
5735 var parent = getPrototypeOf(O);
5736 return parent !== null ? ordinaryHasMetadata(MetadataKey, parent, P) : false;
5737};
5738
5739metadata.exp({hasMetadata: function hasMetadata(metadataKey, target /*, targetKey */){
5740 return ordinaryHasMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
5741}});
5742},{"63":63,"7":7,"74":74}],280:[function(_dereq_,module,exports){
5743var metadata = _dereq_(63)
5744 , anObject = _dereq_(7)
5745 , ordinaryHasOwnMetadata = metadata.has
5746 , toMetaKey = metadata.key;
5747
5748metadata.exp({hasOwnMetadata: function hasOwnMetadata(metadataKey, target /*, targetKey */){
5749 return ordinaryHasOwnMetadata(metadataKey, anObject(target)
5750 , arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
5751}});
5752},{"63":63,"7":7}],281:[function(_dereq_,module,exports){
5753var metadata = _dereq_(63)
5754 , anObject = _dereq_(7)
5755 , aFunction = _dereq_(3)
5756 , toMetaKey = metadata.key
5757 , ordinaryDefineOwnMetadata = metadata.set;
5758
5759metadata.exp({metadata: function metadata(metadataKey, metadataValue){
5760 return function decorator(target, targetKey){
5761 ordinaryDefineOwnMetadata(
5762 metadataKey, metadataValue,
5763 (targetKey !== undefined ? anObject : aFunction)(target),
5764 toMetaKey(targetKey)
5765 );
5766 };
5767}});
5768},{"3":3,"63":63,"7":7}],282:[function(_dereq_,module,exports){
5769// https://github.com/DavidBruant/Map-Set.prototype.toJSON
5770var $export = _dereq_(32);
5771
5772$export($export.P + $export.R, 'Set', {toJSON: _dereq_(20)('Set')});
5773},{"20":20,"32":32}],283:[function(_dereq_,module,exports){
5774'use strict';
5775// https://github.com/mathiasbynens/String.prototype.at
5776var $export = _dereq_(32)
5777 , $at = _dereq_(97)(true);
5778
5779$export($export.P, 'String', {
5780 at: function at(pos){
5781 return $at(this, pos);
5782 }
5783});
5784},{"32":32,"97":97}],284:[function(_dereq_,module,exports){
5785'use strict';
5786// https://tc39.github.io/String.prototype.matchAll/
5787var $export = _dereq_(32)
5788 , defined = _dereq_(27)
5789 , toLength = _dereq_(108)
5790 , isRegExp = _dereq_(50)
5791 , getFlags = _dereq_(36)
5792 , RegExpProto = RegExp.prototype;
5793
5794var $RegExpStringIterator = function(regexp, string){
5795 this._r = regexp;
5796 this._s = string;
5797};
5798
5799_dereq_(52)($RegExpStringIterator, 'RegExp String', function next(){
5800 var match = this._r.exec(this._s);
5801 return {value: match, done: match === null};
5802});
5803
5804$export($export.P, 'String', {
5805 matchAll: function matchAll(regexp){
5806 defined(this);
5807 if(!isRegExp(regexp))throw TypeError(regexp + ' is not a regexp!');
5808 var S = String(this)
5809 , flags = 'flags' in RegExpProto ? String(regexp.flags) : getFlags.call(regexp)
5810 , rx = new RegExp(regexp.source, ~flags.indexOf('g') ? flags : 'g' + flags);
5811 rx.lastIndex = toLength(regexp.lastIndex);
5812 return new $RegExpStringIterator(rx, S);
5813 }
5814});
5815},{"108":108,"27":27,"32":32,"36":36,"50":50,"52":52}],285:[function(_dereq_,module,exports){
5816'use strict';
5817// https://github.com/tc39/proposal-string-pad-start-end
5818var $export = _dereq_(32)
5819 , $pad = _dereq_(100);
5820
5821$export($export.P, 'String', {
5822 padEnd: function padEnd(maxLength /*, fillString = ' ' */){
5823 return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false);
5824 }
5825});
5826},{"100":100,"32":32}],286:[function(_dereq_,module,exports){
5827'use strict';
5828// https://github.com/tc39/proposal-string-pad-start-end
5829var $export = _dereq_(32)
5830 , $pad = _dereq_(100);
5831
5832$export($export.P, 'String', {
5833 padStart: function padStart(maxLength /*, fillString = ' ' */){
5834 return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true);
5835 }
5836});
5837},{"100":100,"32":32}],287:[function(_dereq_,module,exports){
5838'use strict';
5839// https://github.com/sebmarkbage/ecmascript-string-left-right-trim
5840_dereq_(102)('trimLeft', function($trim){
5841 return function trimLeft(){
5842 return $trim(this, 1);
5843 };
5844}, 'trimStart');
5845},{"102":102}],288:[function(_dereq_,module,exports){
5846'use strict';
5847// https://github.com/sebmarkbage/ecmascript-string-left-right-trim
5848_dereq_(102)('trimRight', function($trim){
5849 return function trimRight(){
5850 return $trim(this, 2);
5851 };
5852}, 'trimEnd');
5853},{"102":102}],289:[function(_dereq_,module,exports){
5854_dereq_(115)('asyncIterator');
5855},{"115":115}],290:[function(_dereq_,module,exports){
5856_dereq_(115)('observable');
5857},{"115":115}],291:[function(_dereq_,module,exports){
5858// https://github.com/ljharb/proposal-global
5859var $export = _dereq_(32);
5860
5861$export($export.S, 'System', {global: _dereq_(38)});
5862},{"32":32,"38":38}],292:[function(_dereq_,module,exports){
5863var $iterators = _dereq_(130)
5864 , redefine = _dereq_(87)
5865 , global = _dereq_(38)
5866 , hide = _dereq_(40)
5867 , Iterators = _dereq_(56)
5868 , wks = _dereq_(117)
5869 , ITERATOR = wks('iterator')
5870 , TO_STRING_TAG = wks('toStringTag')
5871 , ArrayValues = Iterators.Array;
5872
5873for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){
5874 var NAME = collections[i]
5875 , Collection = global[NAME]
5876 , proto = Collection && Collection.prototype
5877 , key;
5878 if(proto){
5879 if(!proto[ITERATOR])hide(proto, ITERATOR, ArrayValues);
5880 if(!proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME);
5881 Iterators[NAME] = ArrayValues;
5882 for(key in $iterators)if(!proto[key])redefine(proto, key, $iterators[key], true);
5883 }
5884}
5885},{"117":117,"130":130,"38":38,"40":40,"56":56,"87":87}],293:[function(_dereq_,module,exports){
5886var $export = _dereq_(32)
5887 , $task = _dereq_(104);
5888$export($export.G + $export.B, {
5889 setImmediate: $task.set,
5890 clearImmediate: $task.clear
5891});
5892},{"104":104,"32":32}],294:[function(_dereq_,module,exports){
5893// ie9- setTimeout & setInterval additional parameters fix
5894var global = _dereq_(38)
5895 , $export = _dereq_(32)
5896 , invoke = _dereq_(44)
5897 , partial = _dereq_(83)
5898 , navigator = global.navigator
5899 , MSIE = !!navigator && /MSIE .\./.test(navigator.userAgent); // <- dirty ie9- check
5900var wrap = function(set){
5901 return MSIE ? function(fn, time /*, ...args */){
5902 return set(invoke(
5903 partial,
5904 [].slice.call(arguments, 2),
5905 typeof fn == 'function' ? fn : Function(fn)
5906 ), time);
5907 } : set;
5908};
5909$export($export.G + $export.B + $export.F * MSIE, {
5910 setTimeout: wrap(global.setTimeout),
5911 setInterval: wrap(global.setInterval)
5912});
5913},{"32":32,"38":38,"44":44,"83":83}],295:[function(_dereq_,module,exports){
5914_dereq_(243);
5915_dereq_(180);
5916_dereq_(182);
5917_dereq_(181);
5918_dereq_(184);
5919_dereq_(186);
5920_dereq_(191);
5921_dereq_(185);
5922_dereq_(183);
5923_dereq_(193);
5924_dereq_(192);
5925_dereq_(188);
5926_dereq_(189);
5927_dereq_(187);
5928_dereq_(179);
5929_dereq_(190);
5930_dereq_(194);
5931_dereq_(195);
5932_dereq_(146);
5933_dereq_(148);
5934_dereq_(147);
5935_dereq_(197);
5936_dereq_(196);
5937_dereq_(167);
5938_dereq_(177);
5939_dereq_(178);
5940_dereq_(168);
5941_dereq_(169);
5942_dereq_(170);
5943_dereq_(171);
5944_dereq_(172);
5945_dereq_(173);
5946_dereq_(174);
5947_dereq_(175);
5948_dereq_(176);
5949_dereq_(150);
5950_dereq_(151);
5951_dereq_(152);
5952_dereq_(153);
5953_dereq_(154);
5954_dereq_(155);
5955_dereq_(156);
5956_dereq_(157);
5957_dereq_(158);
5958_dereq_(159);
5959_dereq_(160);
5960_dereq_(161);
5961_dereq_(162);
5962_dereq_(163);
5963_dereq_(164);
5964_dereq_(165);
5965_dereq_(166);
5966_dereq_(230);
5967_dereq_(235);
5968_dereq_(242);
5969_dereq_(233);
5970_dereq_(225);
5971_dereq_(226);
5972_dereq_(231);
5973_dereq_(236);
5974_dereq_(238);
5975_dereq_(221);
5976_dereq_(222);
5977_dereq_(223);
5978_dereq_(224);
5979_dereq_(227);
5980_dereq_(228);
5981_dereq_(229);
5982_dereq_(232);
5983_dereq_(234);
5984_dereq_(237);
5985_dereq_(239);
5986_dereq_(240);
5987_dereq_(241);
5988_dereq_(141);
5989_dereq_(143);
5990_dereq_(142);
5991_dereq_(145);
5992_dereq_(144);
5993_dereq_(129);
5994_dereq_(127);
5995_dereq_(134);
5996_dereq_(131);
5997_dereq_(137);
5998_dereq_(139);
5999_dereq_(126);
6000_dereq_(133);
6001_dereq_(123);
6002_dereq_(138);
6003_dereq_(121);
6004_dereq_(136);
6005_dereq_(135);
6006_dereq_(128);
6007_dereq_(132);
6008_dereq_(120);
6009_dereq_(122);
6010_dereq_(125);
6011_dereq_(124);
6012_dereq_(140);
6013_dereq_(130);
6014_dereq_(213);
6015_dereq_(219);
6016_dereq_(214);
6017_dereq_(215);
6018_dereq_(216);
6019_dereq_(217);
6020_dereq_(218);
6021_dereq_(198);
6022_dereq_(149);
6023_dereq_(220);
6024_dereq_(255);
6025_dereq_(256);
6026_dereq_(244);
6027_dereq_(245);
6028_dereq_(250);
6029_dereq_(253);
6030_dereq_(254);
6031_dereq_(248);
6032_dereq_(251);
6033_dereq_(249);
6034_dereq_(252);
6035_dereq_(246);
6036_dereq_(247);
6037_dereq_(199);
6038_dereq_(200);
6039_dereq_(201);
6040_dereq_(202);
6041_dereq_(203);
6042_dereq_(206);
6043_dereq_(204);
6044_dereq_(205);
6045_dereq_(207);
6046_dereq_(208);
6047_dereq_(209);
6048_dereq_(210);
6049_dereq_(212);
6050_dereq_(211);
6051_dereq_(257);
6052_dereq_(283);
6053_dereq_(286);
6054_dereq_(285);
6055_dereq_(287);
6056_dereq_(288);
6057_dereq_(284);
6058_dereq_(289);
6059_dereq_(290);
6060_dereq_(268);
6061_dereq_(271);
6062_dereq_(267);
6063_dereq_(265);
6064_dereq_(266);
6065_dereq_(269);
6066_dereq_(270);
6067_dereq_(260);
6068_dereq_(282);
6069_dereq_(291);
6070_dereq_(259);
6071_dereq_(261);
6072_dereq_(263);
6073_dereq_(262);
6074_dereq_(264);
6075_dereq_(273);
6076_dereq_(274);
6077_dereq_(276);
6078_dereq_(275);
6079_dereq_(278);
6080_dereq_(277);
6081_dereq_(279);
6082_dereq_(280);
6083_dereq_(281);
6084_dereq_(258);
6085_dereq_(272);
6086_dereq_(294);
6087_dereq_(293);
6088_dereq_(292);
6089module.exports = _dereq_(23);
6090},{"120":120,"121":121,"122":122,"123":123,"124":124,"125":125,"126":126,"127":127,"128":128,"129":129,"130":130,"131":131,"132":132,"133":133,"134":134,"135":135,"136":136,"137":137,"138":138,"139":139,"140":140,"141":141,"142":142,"143":143,"144":144,"145":145,"146":146,"147":147,"148":148,"149":149,"150":150,"151":151,"152":152,"153":153,"154":154,"155":155,"156":156,"157":157,"158":158,"159":159,"160":160,"161":161,"162":162,"163":163,"164":164,"165":165,"166":166,"167":167,"168":168,"169":169,"170":170,"171":171,"172":172,"173":173,"174":174,"175":175,"176":176,"177":177,"178":178,"179":179,"180":180,"181":181,"182":182,"183":183,"184":184,"185":185,"186":186,"187":187,"188":188,"189":189,"190":190,"191":191,"192":192,"193":193,"194":194,"195":195,"196":196,"197":197,"198":198,"199":199,"200":200,"201":201,"202":202,"203":203,"204":204,"205":205,"206":206,"207":207,"208":208,"209":209,"210":210,"211":211,"212":212,"213":213,"214":214,"215":215,"216":216,"217":217,"218":218,"219":219,"220":220,"221":221,"222":222,"223":223,"224":224,"225":225,"226":226,"227":227,"228":228,"229":229,"23":23,"230":230,"231":231,"232":232,"233":233,"234":234,"235":235,"236":236,"237":237,"238":238,"239":239,"240":240,"241":241,"242":242,"243":243,"244":244,"245":245,"246":246,"247":247,"248":248,"249":249,"250":250,"251":251,"252":252,"253":253,"254":254,"255":255,"256":256,"257":257,"258":258,"259":259,"260":260,"261":261,"262":262,"263":263,"264":264,"265":265,"266":266,"267":267,"268":268,"269":269,"270":270,"271":271,"272":272,"273":273,"274":274,"275":275,"276":276,"277":277,"278":278,"279":279,"280":280,"281":281,"282":282,"283":283,"284":284,"285":285,"286":286,"287":287,"288":288,"289":289,"290":290,"291":291,"292":292,"293":293,"294":294}],296:[function(_dereq_,module,exports){
6091(function (global){
6092/**
6093 * Copyright (c) 2014, Facebook, Inc.
6094 * All rights reserved.
6095 *
6096 * This source code is licensed under the BSD-style license found in the
6097 * https://raw.github.com/facebook/regenerator/master/LICENSE file. An
6098 * additional grant of patent rights can be found in the PATENTS file in
6099 * the same directory.
6100 */
6101
6102!(function(global) {
6103 "use strict";
6104
6105 var hasOwn = Object.prototype.hasOwnProperty;
6106 var undefined; // More compressible than void 0.
6107 var $Symbol = typeof Symbol === "function" ? Symbol : {};
6108 var iteratorSymbol = $Symbol.iterator || "@@iterator";
6109 var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
6110
6111 var inModule = typeof module === "object";
6112 var runtime = global.regeneratorRuntime;
6113 if (runtime) {
6114 if (inModule) {
6115 // If regeneratorRuntime is defined globally and we're in a module,
6116 // make the exports object identical to regeneratorRuntime.
6117 module.exports = runtime;
6118 }
6119 // Don't bother evaluating the rest of this file if the runtime was
6120 // already defined globally.
6121 return;
6122 }
6123
6124 // Define the runtime globally (as expected by generated code) as either
6125 // module.exports (if we're in a module) or a new, empty object.
6126 runtime = global.regeneratorRuntime = inModule ? module.exports : {};
6127
6128 function wrap(innerFn, outerFn, self, tryLocsList) {
6129 // If outerFn provided, then outerFn.prototype instanceof Generator.
6130 var generator = Object.create((outerFn || Generator).prototype);
6131 var context = new Context(tryLocsList || []);
6132
6133 // The ._invoke method unifies the implementations of the .next,
6134 // .throw, and .return methods.
6135 generator._invoke = makeInvokeMethod(innerFn, self, context);
6136
6137 return generator;
6138 }
6139 runtime.wrap = wrap;
6140
6141 // Try/catch helper to minimize deoptimizations. Returns a completion
6142 // record like context.tryEntries[i].completion. This interface could
6143 // have been (and was previously) designed to take a closure to be
6144 // invoked without arguments, but in all the cases we care about we
6145 // already have an existing method we want to call, so there's no need
6146 // to create a new function object. We can even get away with assuming
6147 // the method takes exactly one argument, since that happens to be true
6148 // in every case, so we don't have to touch the arguments object. The
6149 // only additional allocation required is the completion record, which
6150 // has a stable shape and so hopefully should be cheap to allocate.
6151 function tryCatch(fn, obj, arg) {
6152 try {
6153 return { type: "normal", arg: fn.call(obj, arg) };
6154 } catch (err) {
6155 return { type: "throw", arg: err };
6156 }
6157 }
6158
6159 var GenStateSuspendedStart = "suspendedStart";
6160 var GenStateSuspendedYield = "suspendedYield";
6161 var GenStateExecuting = "executing";
6162 var GenStateCompleted = "completed";
6163
6164 // Returning this object from the innerFn has the same effect as
6165 // breaking out of the dispatch switch statement.
6166 var ContinueSentinel = {};
6167
6168 // Dummy constructor functions that we use as the .constructor and
6169 // .constructor.prototype properties for functions that return Generator
6170 // objects. For full spec compliance, you may wish to configure your
6171 // minifier not to mangle the names of these two functions.
6172 function Generator() {}
6173 function GeneratorFunction() {}
6174 function GeneratorFunctionPrototype() {}
6175
6176 var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype;
6177 GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
6178 GeneratorFunctionPrototype.constructor = GeneratorFunction;
6179 GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction";
6180
6181 // Helper for defining the .next, .throw, and .return methods of the
6182 // Iterator interface in terms of a single ._invoke method.
6183 function defineIteratorMethods(prototype) {
6184 ["next", "throw", "return"].forEach(function(method) {
6185 prototype[method] = function(arg) {
6186 return this._invoke(method, arg);
6187 };
6188 });
6189 }
6190
6191 runtime.isGeneratorFunction = function(genFun) {
6192 var ctor = typeof genFun === "function" && genFun.constructor;
6193 return ctor
6194 ? ctor === GeneratorFunction ||
6195 // For the native GeneratorFunction constructor, the best we can
6196 // do is to check its .name property.
6197 (ctor.displayName || ctor.name) === "GeneratorFunction"
6198 : false;
6199 };
6200
6201 runtime.mark = function(genFun) {
6202 if (Object.setPrototypeOf) {
6203 Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
6204 } else {
6205 genFun.__proto__ = GeneratorFunctionPrototype;
6206 if (!(toStringTagSymbol in genFun)) {
6207 genFun[toStringTagSymbol] = "GeneratorFunction";
6208 }
6209 }
6210 genFun.prototype = Object.create(Gp);
6211 return genFun;
6212 };
6213
6214 // Within the body of any async function, `await x` is transformed to
6215 // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
6216 // `value instanceof AwaitArgument` to determine if the yielded value is
6217 // meant to be awaited. Some may consider the name of this method too
6218 // cutesy, but they are curmudgeons.
6219 runtime.awrap = function(arg) {
6220 return new AwaitArgument(arg);
6221 };
6222
6223 function AwaitArgument(arg) {
6224 this.arg = arg;
6225 }
6226
6227 function AsyncIterator(generator) {
6228 function invoke(method, arg, resolve, reject) {
6229 var record = tryCatch(generator[method], generator, arg);
6230 if (record.type === "throw") {
6231 reject(record.arg);
6232 } else {
6233 var result = record.arg;
6234 var value = result.value;
6235 if (value instanceof AwaitArgument) {
6236 return Promise.resolve(value.arg).then(function(value) {
6237 invoke("next", value, resolve, reject);
6238 }, function(err) {
6239 invoke("throw", err, resolve, reject);
6240 });
6241 }
6242
6243 return Promise.resolve(value).then(function(unwrapped) {
6244 // When a yielded Promise is resolved, its final value becomes
6245 // the .value of the Promise<{value,done}> result for the
6246 // current iteration. If the Promise is rejected, however, the
6247 // result for this iteration will be rejected with the same
6248 // reason. Note that rejections of yielded Promises are not
6249 // thrown back into the generator function, as is the case
6250 // when an awaited Promise is rejected. This difference in
6251 // behavior between yield and await is important, because it
6252 // allows the consumer to decide what to do with the yielded
6253 // rejection (swallow it and continue, manually .throw it back
6254 // into the generator, abandon iteration, whatever). With
6255 // await, by contrast, there is no opportunity to examine the
6256 // rejection reason outside the generator function, so the
6257 // only option is to throw it from the await expression, and
6258 // let the generator function handle the exception.
6259 result.value = unwrapped;
6260 resolve(result);
6261 }, reject);
6262 }
6263 }
6264
6265 if (typeof process === "object" && process.domain) {
6266 invoke = process.domain.bind(invoke);
6267 }
6268
6269 var previousPromise;
6270
6271 function enqueue(method, arg) {
6272 function callInvokeWithMethodAndArg() {
6273 return new Promise(function(resolve, reject) {
6274 invoke(method, arg, resolve, reject);
6275 });
6276 }
6277
6278 return previousPromise =
6279 // If enqueue has been called before, then we want to wait until
6280 // all previous Promises have been resolved before calling invoke,
6281 // so that results are always delivered in the correct order. If
6282 // enqueue has not been called before, then it is important to
6283 // call invoke immediately, without waiting on a callback to fire,
6284 // so that the async generator function has the opportunity to do
6285 // any necessary setup in a predictable way. This predictability
6286 // is why the Promise constructor synchronously invokes its
6287 // executor callback, and why async functions synchronously
6288 // execute code before the first await. Since we implement simple
6289 // async functions in terms of async generators, it is especially
6290 // important to get this right, even though it requires care.
6291 previousPromise ? previousPromise.then(
6292 callInvokeWithMethodAndArg,
6293 // Avoid propagating failures to Promises returned by later
6294 // invocations of the iterator.
6295 callInvokeWithMethodAndArg
6296 ) : callInvokeWithMethodAndArg();
6297 }
6298
6299 // Define the unified helper method that is used to implement .next,
6300 // .throw, and .return (see defineIteratorMethods).
6301 this._invoke = enqueue;
6302 }
6303
6304 defineIteratorMethods(AsyncIterator.prototype);
6305
6306 // Note that simple async functions are implemented on top of
6307 // AsyncIterator objects; they just return a Promise for the value of
6308 // the final result produced by the iterator.
6309 runtime.async = function(innerFn, outerFn, self, tryLocsList) {
6310 var iter = new AsyncIterator(
6311 wrap(innerFn, outerFn, self, tryLocsList)
6312 );
6313
6314 return runtime.isGeneratorFunction(outerFn)
6315 ? iter // If outerFn is a generator, return the full iterator.
6316 : iter.next().then(function(result) {
6317 return result.done ? result.value : iter.next();
6318 });
6319 };
6320
6321 function makeInvokeMethod(innerFn, self, context) {
6322 var state = GenStateSuspendedStart;
6323
6324 return function invoke(method, arg) {
6325 if (state === GenStateExecuting) {
6326 throw new Error("Generator is already running");
6327 }
6328
6329 if (state === GenStateCompleted) {
6330 if (method === "throw") {
6331 throw arg;
6332 }
6333
6334 // Be forgiving, per 25.3.3.3.3 of the spec:
6335 // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
6336 return doneResult();
6337 }
6338
6339 while (true) {
6340 var delegate = context.delegate;
6341 if (delegate) {
6342 if (method === "return" ||
6343 (method === "throw" && delegate.iterator[method] === undefined)) {
6344 // A return or throw (when the delegate iterator has no throw
6345 // method) always terminates the yield* loop.
6346 context.delegate = null;
6347
6348 // If the delegate iterator has a return method, give it a
6349 // chance to clean up.
6350 var returnMethod = delegate.iterator["return"];
6351 if (returnMethod) {
6352 var record = tryCatch(returnMethod, delegate.iterator, arg);
6353 if (record.type === "throw") {
6354 // If the return method threw an exception, let that
6355 // exception prevail over the original return or throw.
6356 method = "throw";
6357 arg = record.arg;
6358 continue;
6359 }
6360 }
6361
6362 if (method === "return") {
6363 // Continue with the outer return, now that the delegate
6364 // iterator has been terminated.
6365 continue;
6366 }
6367 }
6368
6369 var record = tryCatch(
6370 delegate.iterator[method],
6371 delegate.iterator,
6372 arg
6373 );
6374
6375 if (record.type === "throw") {
6376 context.delegate = null;
6377
6378 // Like returning generator.throw(uncaught), but without the
6379 // overhead of an extra function call.
6380 method = "throw";
6381 arg = record.arg;
6382 continue;
6383 }
6384
6385 // Delegate generator ran and handled its own exceptions so
6386 // regardless of what the method was, we continue as if it is
6387 // "next" with an undefined arg.
6388 method = "next";
6389 arg = undefined;
6390
6391 var info = record.arg;
6392 if (info.done) {
6393 context[delegate.resultName] = info.value;
6394 context.next = delegate.nextLoc;
6395 } else {
6396 state = GenStateSuspendedYield;
6397 return info;
6398 }
6399
6400 context.delegate = null;
6401 }
6402
6403 if (method === "next") {
6404 // Setting context._sent for legacy support of Babel's
6405 // function.sent implementation.
6406 context.sent = context._sent = arg;
6407
6408 } else if (method === "throw") {
6409 if (state === GenStateSuspendedStart) {
6410 state = GenStateCompleted;
6411 throw arg;
6412 }
6413
6414 if (context.dispatchException(arg)) {
6415 // If the dispatched exception was caught by a catch block,
6416 // then let that catch block handle the exception normally.
6417 method = "next";
6418 arg = undefined;
6419 }
6420
6421 } else if (method === "return") {
6422 context.abrupt("return", arg);
6423 }
6424
6425 state = GenStateExecuting;
6426
6427 var record = tryCatch(innerFn, self, context);
6428 if (record.type === "normal") {
6429 // If an exception is thrown from innerFn, we leave state ===
6430 // GenStateExecuting and loop back for another invocation.
6431 state = context.done
6432 ? GenStateCompleted
6433 : GenStateSuspendedYield;
6434
6435 var info = {
6436 value: record.arg,
6437 done: context.done
6438 };
6439
6440 if (record.arg === ContinueSentinel) {
6441 if (context.delegate && method === "next") {
6442 // Deliberately forget the last sent value so that we don't
6443 // accidentally pass it on to the delegate.
6444 arg = undefined;
6445 }
6446 } else {
6447 return info;
6448 }
6449
6450 } else if (record.type === "throw") {
6451 state = GenStateCompleted;
6452 // Dispatch the exception by looping back around to the
6453 // context.dispatchException(arg) call above.
6454 method = "throw";
6455 arg = record.arg;
6456 }
6457 }
6458 };
6459 }
6460
6461 // Define Generator.prototype.{next,throw,return} in terms of the
6462 // unified ._invoke helper method.
6463 defineIteratorMethods(Gp);
6464
6465 Gp[iteratorSymbol] = function() {
6466 return this;
6467 };
6468
6469 Gp[toStringTagSymbol] = "Generator";
6470
6471 Gp.toString = function() {
6472 return "[object Generator]";
6473 };
6474
6475 function pushTryEntry(locs) {
6476 var entry = { tryLoc: locs[0] };
6477
6478 if (1 in locs) {
6479 entry.catchLoc = locs[1];
6480 }
6481
6482 if (2 in locs) {
6483 entry.finallyLoc = locs[2];
6484 entry.afterLoc = locs[3];
6485 }
6486
6487 this.tryEntries.push(entry);
6488 }
6489
6490 function resetTryEntry(entry) {
6491 var record = entry.completion || {};
6492 record.type = "normal";
6493 delete record.arg;
6494 entry.completion = record;
6495 }
6496
6497 function Context(tryLocsList) {
6498 // The root entry object (effectively a try statement without a catch
6499 // or a finally block) gives us a place to store values thrown from
6500 // locations where there is no enclosing try statement.
6501 this.tryEntries = [{ tryLoc: "root" }];
6502 tryLocsList.forEach(pushTryEntry, this);
6503 this.reset(true);
6504 }
6505
6506 runtime.keys = function(object) {
6507 var keys = [];
6508 for (var key in object) {
6509 keys.push(key);
6510 }
6511 keys.reverse();
6512
6513 // Rather than returning an object with a next method, we keep
6514 // things simple and return the next function itself.
6515 return function next() {
6516 while (keys.length) {
6517 var key = keys.pop();
6518 if (key in object) {
6519 next.value = key;
6520 next.done = false;
6521 return next;
6522 }
6523 }
6524
6525 // To avoid creating an additional object, we just hang the .value
6526 // and .done properties off the next function object itself. This
6527 // also ensures that the minifier will not anonymize the function.
6528 next.done = true;
6529 return next;
6530 };
6531 };
6532
6533 function values(iterable) {
6534 if (iterable) {
6535 var iteratorMethod = iterable[iteratorSymbol];
6536 if (iteratorMethod) {
6537 return iteratorMethod.call(iterable);
6538 }
6539
6540 if (typeof iterable.next === "function") {
6541 return iterable;
6542 }
6543
6544 if (!isNaN(iterable.length)) {
6545 var i = -1, next = function next() {
6546 while (++i < iterable.length) {
6547 if (hasOwn.call(iterable, i)) {
6548 next.value = iterable[i];
6549 next.done = false;
6550 return next;
6551 }
6552 }
6553
6554 next.value = undefined;
6555 next.done = true;
6556
6557 return next;
6558 };
6559
6560 return next.next = next;
6561 }
6562 }
6563
6564 // Return an iterator with no values.
6565 return { next: doneResult };
6566 }
6567 runtime.values = values;
6568
6569 function doneResult() {
6570 return { value: undefined, done: true };
6571 }
6572
6573 Context.prototype = {
6574 constructor: Context,
6575
6576 reset: function(skipTempReset) {
6577 this.prev = 0;
6578 this.next = 0;
6579 // Resetting context._sent for legacy support of Babel's
6580 // function.sent implementation.
6581 this.sent = this._sent = undefined;
6582 this.done = false;
6583 this.delegate = null;
6584
6585 this.tryEntries.forEach(resetTryEntry);
6586
6587 if (!skipTempReset) {
6588 for (var name in this) {
6589 // Not sure about the optimal order of these conditions:
6590 if (name.charAt(0) === "t" &&
6591 hasOwn.call(this, name) &&
6592 !isNaN(+name.slice(1))) {
6593 this[name] = undefined;
6594 }
6595 }
6596 }
6597 },
6598
6599 stop: function() {
6600 this.done = true;
6601
6602 var rootEntry = this.tryEntries[0];
6603 var rootRecord = rootEntry.completion;
6604 if (rootRecord.type === "throw") {
6605 throw rootRecord.arg;
6606 }
6607
6608 return this.rval;
6609 },
6610
6611 dispatchException: function(exception) {
6612 if (this.done) {
6613 throw exception;
6614 }
6615
6616 var context = this;
6617 function handle(loc, caught) {
6618 record.type = "throw";
6619 record.arg = exception;
6620 context.next = loc;
6621 return !!caught;
6622 }
6623
6624 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
6625 var entry = this.tryEntries[i];
6626 var record = entry.completion;
6627
6628 if (entry.tryLoc === "root") {
6629 // Exception thrown outside of any try block that could handle
6630 // it, so set the completion value of the entire function to
6631 // throw the exception.
6632 return handle("end");
6633 }
6634
6635 if (entry.tryLoc <= this.prev) {
6636 var hasCatch = hasOwn.call(entry, "catchLoc");
6637 var hasFinally = hasOwn.call(entry, "finallyLoc");
6638
6639 if (hasCatch && hasFinally) {
6640 if (this.prev < entry.catchLoc) {
6641 return handle(entry.catchLoc, true);
6642 } else if (this.prev < entry.finallyLoc) {
6643 return handle(entry.finallyLoc);
6644 }
6645
6646 } else if (hasCatch) {
6647 if (this.prev < entry.catchLoc) {
6648 return handle(entry.catchLoc, true);
6649 }
6650
6651 } else if (hasFinally) {
6652 if (this.prev < entry.finallyLoc) {
6653 return handle(entry.finallyLoc);
6654 }
6655
6656 } else {
6657 throw new Error("try statement without catch or finally");
6658 }
6659 }
6660 }
6661 },
6662
6663 abrupt: function(type, arg) {
6664 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
6665 var entry = this.tryEntries[i];
6666 if (entry.tryLoc <= this.prev &&
6667 hasOwn.call(entry, "finallyLoc") &&
6668 this.prev < entry.finallyLoc) {
6669 var finallyEntry = entry;
6670 break;
6671 }
6672 }
6673
6674 if (finallyEntry &&
6675 (type === "break" ||
6676 type === "continue") &&
6677 finallyEntry.tryLoc <= arg &&
6678 arg <= finallyEntry.finallyLoc) {
6679 // Ignore the finally entry if control is not jumping to a
6680 // location outside the try/catch block.
6681 finallyEntry = null;
6682 }
6683
6684 var record = finallyEntry ? finallyEntry.completion : {};
6685 record.type = type;
6686 record.arg = arg;
6687
6688 if (finallyEntry) {
6689 this.next = finallyEntry.finallyLoc;
6690 } else {
6691 this.complete(record);
6692 }
6693
6694 return ContinueSentinel;
6695 },
6696
6697 complete: function(record, afterLoc) {
6698 if (record.type === "throw") {
6699 throw record.arg;
6700 }
6701
6702 if (record.type === "break" ||
6703 record.type === "continue") {
6704 this.next = record.arg;
6705 } else if (record.type === "return") {
6706 this.rval = record.arg;
6707 this.next = "end";
6708 } else if (record.type === "normal" && afterLoc) {
6709 this.next = afterLoc;
6710 }
6711 },
6712
6713 finish: function(finallyLoc) {
6714 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
6715 var entry = this.tryEntries[i];
6716 if (entry.finallyLoc === finallyLoc) {
6717 this.complete(entry.completion, entry.afterLoc);
6718 resetTryEntry(entry);
6719 return ContinueSentinel;
6720 }
6721 }
6722 },
6723
6724 "catch": function(tryLoc) {
6725 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
6726 var entry = this.tryEntries[i];
6727 if (entry.tryLoc === tryLoc) {
6728 var record = entry.completion;
6729 if (record.type === "throw") {
6730 var thrown = record.arg;
6731 resetTryEntry(entry);
6732 }
6733 return thrown;
6734 }
6735 }
6736
6737 // The context.catch method must only be called with a location
6738 // argument that corresponds to a known catch block.
6739 throw new Error("illegal catch attempt");
6740 },
6741
6742 delegateYield: function(iterable, resultName, nextLoc) {
6743 this.delegate = {
6744 iterator: values(iterable),
6745 resultName: resultName,
6746 nextLoc: nextLoc
6747 };
6748
6749 return ContinueSentinel;
6750 }
6751 };
6752})(
6753 // Among the various tricks for obtaining a reference to the global
6754 // object, this seems to be the most reliable technique that does not
6755 // use indirect eval (which violates Content Security Policy).
6756 typeof global === "object" ? global :
6757 typeof window === "object" ? window :
6758 typeof self === "object" ? self : this
6759);
6760
6761}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
6762},{}]},{},[1]);
6763;(function(global,factory){if(typeof define==="function"&&define.amd){define(["module","exports"],factory);}else if(typeof exports!=="undefined"){factory(module,exports);}else{var mod={exports:{}};factory(mod,mod.exports);global.scxml=mod.exports;}})(this,function(module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj;};(function(f){if((typeof exports==="undefined"?"undefined":_typeof(exports))==="object"&&typeof module!=="undefined"){module.exports=f();}else if(typeof define==="function"&&define.amd){define([],f);}else{var g;if(typeof window!=="undefined"){g=window;}else if(typeof global!=="undefined"){g=global;}else if(typeof self!=="undefined"){g=self;}else{g=this;}g.scxml=f();}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f;}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e);},l,l.exports,e,t,n,r);}return n[o].exports;}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++){s(r[o]);}return s;}({1:[function(require,module,exports){(function(process){var _marked=[genStates].map(regeneratorRuntime.mark);/**
6764 * Accept a scjson document as input, either from a file or via stdin.
6765 * Generate a JavaScript module as output.
6766 * This module should be customizable:
6767 * plain object literal if appropriate
6768 * simple self-invoking function (for use in scion-scxml)
6769 * UMD in probably all other cases. although we could make it CommonJS/AMD/etc.
6770 */var to_js_identifier=require("text-to-js-identifier");//TODO: optimization: if the scjson does not contain a datamodel or any actions, then just dump out the object literal as the module
6771//TODO: we should also encode the document name. accept as command-line argument, or embed it in the scjson itself, maybe?
6772var printTrace=false;function generateFnName(actionType,action){return'$'+actionType+'_l'+action.$line+'_c'+action.$column;}var FN_ARGS='(_event)';var SCRIPT_SRC_FN_PREFIX='script_src';var stripNsPrefixRe=/^(?:{(?:[^}]*)})?(.*)$/;function stripAttrNsPrefix(attrName){var m=attrName.match(stripNsPrefixRe);return m[1];}function generateFnDeclaration(fnName,fnBody,action){if(printTrace)console.log('generateFnDeclaration',fnName,fnBody);return'function '+fnName+FN_ARGS+'{\n'+fnBody+'\n'+'};\n'+fnName+'.tagname=\''+action.$type+'\';\n'+fnName+'.line='+action.$line+';\n'+fnName+'.column='+action.$column+';\n';}function generateFnCall(fnName){if(printTrace)console.log('generateFnCall',fnName);return fnName+'.apply(this, arguments)';}ModuleBuilder.prototype.generateActionFunction=function(action){if(printTrace)console.log('generateActionFunction',action);var fnName=generateFnName(action.$type,action);var fnBody=actionTags[action.$type]?actionTags[action.$type](action,this):actionTags['custom'](action,this);var fnDec=generateFnDeclaration(fnName,fnBody,action);this.fnDecAccumulator.push(fnDec);return fnName;};ModuleBuilder.prototype.generateExpressionFunction=function(expressionType,exprObj){if(printTrace)console.log('generateExpressionFunction',expressionType,exprObj);var fnName=generateFnName(expressionType,exprObj);var fnBody='return '+exprObj.expr+';';var fnDec=generateFnDeclaration(fnName,fnBody,exprObj);this.fnDecAccumulator.push(fnDec);return fnName;};ModuleBuilder.prototype.generateAttributeExpression=function(attrContainer,attrName){if(printTrace)console.log('generateAttributeExpression',attrContainer,attrName);return this.generateExpressionFunction(stripAttrNsPrefix(attrName),attrContainer[attrName]);};var REFERENCE_MARKER='__UNQUOTE__',REFERENCE_MARKER_RE=new RegExp('"'+REFERENCE_MARKER+'(.*)'+REFERENCE_MARKER+'"','g');//TODO: need to split this into two parts: one that declares the variables in the datamodel at the top of the module scope,
6773//and another single function that inits the model needs to contain a reference to this init function,
6774//and the interpreter must know about it. should be optional.
6775//call it $scion_init_datamodel.
6776function generateDatamodelDeclaration(datamodelAccumulator){if(!datamodelAccumulator.length){return undefined;}return'var '+datamodelAccumulator.map(function(data){return data.id;}).join(", ")+";";}var SERIALIZE_DATAMODEL_FN_NAME='$serializeDatamodel';function generateDatamodelSerializerFn(datamodelAccumulator){return'function '+SERIALIZE_DATAMODEL_FN_NAME+'(){\n'+' return {\n'+datamodelAccumulator.map(function(data){return' "'+data.id+'" : '+data.id;}).join(',\n')+'\n'+' };\n'+'}';}var DESERIALIZE_DATAMODEL_FN_NAME='$deserializeDatamodel',DESERIALIZE_DATAMODEL_FN_ARG='$serializedDatamodel';function generateDatamodelDeserializerFn(datamodelAccumulator){return'function '+DESERIALIZE_DATAMODEL_FN_NAME+'('+DESERIALIZE_DATAMODEL_FN_ARG+'){\n'+datamodelAccumulator.map(function(data){return' '+data.id+' = '+DESERIALIZE_DATAMODEL_FN_ARG+'["'+data.id+'"];';}).join('\n')+'\n'+' '+EARLY_BINDING_DATAMODEL_GUARD+' = true;\n'+//set the guard condition to true
6777'}';}var EARLY_BINDING_DATAMODEL_FN_NAME='$initEarlyBindingDatamodel';var EARLY_BINDING_DATAMODEL_GUARD='$scion_early_binding_datamodel_has_fired';//TODO: make this function more clever and accept the datamodel as an action
6778function generateEarlyBindingDatamodelInitFn(builder){//this guard guarantees it will only fire once
6779return'var '+EARLY_BINDING_DATAMODEL_GUARD+' = false;\n'+(builder.datamodelAccumulator.length?'function '+EARLY_BINDING_DATAMODEL_FN_NAME+FN_ARGS+'{\n'+' if(!'+EARLY_BINDING_DATAMODEL_GUARD+'){\n'+//invoke all datamodel expresions
6780builder.datamodelAccumulator.filter(function(data){return data.expr;}).map(function(data){return' '+data.id+' = '+generateFnCall(builder.generateExpressionFunction('data',data.expr))+';\n';},builder).join('')+' '+EARLY_BINDING_DATAMODEL_GUARD+' = true; '+'\n'+' }\n'+'}':'');}function generateSmObjectLiteral(rootState){//pretty simple
6781return JSON.stringify(rootState,undefined,1).replace(REFERENCE_MARKER_RE,'$1');}function dumpFunctionDeclarations(fnDecAccumulator){//simple
6782return fnDecAccumulator.join('\n');}function dumpHeader(strict){var d=new Date();var strictStr=strict?"'use strict';\n":"";return strictStr+'//Generated on '+d.toLocaleDateString()+' '+d.toLocaleTimeString()+' by the SCION SCXML compiler';}function generateFactoryFunctionWrapper(o,name,options){var parts=[o.sendString,o.sendIdLocationString,o.earlyBindingFnDeclaration,o.datamodelDeserializerFnDeclaration,o.datamodelSerializerFnDeclaration,o.actionFunctionDeclarations,'return '+o.objectLiteralString+';'];var program;if(options.debug){program=parts.join('\n\n').split('\n').map(function(line){return' '+line;}).join('\n');}else{program=parts.join('\n');}return'(function (_x,_sessionid,_ioprocessors,In){\n'+' var _name = \''+name+'\';'+//'console.log(_x,_sessionid,_name,_ioprocessors,In);\n' +
6783program+'})';}ModuleBuilder.prototype.generateModule=function(){var rootState=this.rootState;var options=this.options;//TODO: enumerate these module types
6784if(this.datamodelAccumulator.length){//generalize him as an entry action on the root state
6785rootState.onEntry=rootState.onEntry||[];//make sure that datamodel initialization fn comes before all other entry actions
6786rootState.onEntry=[markAsReference(EARLY_BINDING_DATAMODEL_FN_NAME)].concat(rootState.onEntry);}//attach datamodel serialization functions
6787rootState[DESERIALIZE_DATAMODEL_FN_NAME]=markAsReference(DESERIALIZE_DATAMODEL_FN_NAME);rootState[SERIALIZE_DATAMODEL_FN_NAME]=markAsReference(SERIALIZE_DATAMODEL_FN_NAME);//console.log('rootState.rootScripts',rootState.rootScripts);
6788//TODO: support other module formats (AMD, UMD, module pattern)
6789var o={headerString:dumpHeader(options.strict),sendString:this.documentHasSendAction?getDelayInMs.toString():'',sendIdLocationString:this.documentHasSendActionWithIdlocationAttribute?generateIdlocationGenerator(this.sendIdAccumulator):'',earlyBindingFnDeclaration:generateEarlyBindingDatamodelInitFn(this),datamodelDeserializerFnDeclaration:generateDatamodelDeserializerFn(this.datamodelAccumulator),datamodelSerializerFnDeclaration:generateDatamodelSerializerFn(this.datamodelAccumulator),actionFunctionDeclarations:dumpFunctionDeclarations(this.fnDecAccumulator)};delete rootState.rootScripts;//this doesn't need to be in there
6790o.objectLiteralString=generateSmObjectLiteral(rootState);var s=o.headerString+'\n'+generateFactoryFunctionWrapper(o,rootState.name,options);return s;};function markAsReference(fnName){return REFERENCE_MARKER+fnName+REFERENCE_MARKER;}ModuleBuilder.prototype.replaceActions=function(actionContainer,actionPropertyName){if(actionContainer[actionPropertyName]){var actions=Array.isArray(actionContainer[actionPropertyName])?actionContainer[actionPropertyName]:[actionContainer[actionPropertyName]];actionContainer[actionPropertyName]=actions.map(this.generateActionFunction,this).map(markAsReference);if(actionContainer[actionPropertyName].length===1){actionContainer[actionPropertyName]=actionContainer[actionPropertyName][0];}}};ModuleBuilder.prototype.visitState=function(){var genValue=this.stateGen.next();if(genValue.done){this._finish();return;}var state=genValue.value;//accumulate datamodels
6791if(state.datamodel){this.datamodelAccumulator.push.apply(this.datamodelAccumulator,state.datamodel);}if(state.onExit)this.replaceActions(state,'onExit');if(state.onEntry)this.replaceActions(state,'onEntry');if(state.transitions){for(var i=0,len=state.transitions.length;i<len;i++){var transition=state.transitions[i];this.replaceActions(transition,'onTransition');if(transition.cond){transition.cond=markAsReference(this.generateAttributeExpression(transition,'cond'));}}}//clean up as we go
6792delete state.datamodel;setImmediate(function(self){self.visitState();},this);};/**
6793 * The uncooked SCION module
6794 * @param {string} [name] The name of the module derived from the scxml root element's name attribute
6795 * @param {string} datamodel The raw datamodel declarations
6796 * @param {Array<ScriptNode>} rootScripts A collection of 0 or more script nodes
6797 * Each node contains a src property which references an external js resource
6798 * or a content property which references a string containing the uncooked js
6799 * @param {string} scxmlModule A massive string containing the generated scxml program
6800 * less the parts enumerated above
6801 */function SCJsonRawModule(name,datamodel,rootScripts,scxmlModule){this.name=name;this.datamodel=datamodel;this.rootScripts=rootScripts;this.module=scxmlModule;}function genStates(state){var j,len;return regeneratorRuntime.wrap(function genStates$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return state;case 2:if(!state.states){_context.next=9;break;}j=0,len=state.states.length;case 4:if(!(j<len)){_context.next=9;break;}return _context.delegateYield(genStates(state.states[j]),"t0",6);case 6:j++;_context.next=4;break;case 9:case"end":return _context.stop();}}},_marked[0],this);}function ModuleBuilder(docUrl,rootState,options){this.docUrl=docUrl;this.rootState=rootState;if(!rootState.rootScripts){rootState.rootScripts=[];}this.externalActionScripts=new Set();this.options=options;this.datamodelAccumulator=[];this.fnDecAccumulator=[];this.sendIdAccumulator=[];this.documentHasSendAction=false;this.documentHasSendActionWithIdlocationAttribute=false;this.resolve=undefined;this.reject=undefined;this.stateGen=genStates(this.rootState);}ModuleBuilder.prototype.build=function(){var self=this;return new Promise(function(resolve,reject){self.resolve=resolve;self.reject=reject;self.visitState();});};ModuleBuilder.prototype._finish=function(){// grab the root scripts before generateDatamodelDeclaration hackily deletes them
6802var rootScripts=this.rootState.rootScripts;var dataModel=generateDatamodelDeclaration(this.datamodelAccumulator);var scxmlModule=this.generateModule();var jsModule=new SCJsonRawModule(this.rootState.name,dataModel,rootScripts,scxmlModule);this.resolve(jsModule);};function startTraversal(docUrl,rootState,options){if(!options){options={};}var moduleBuilder=new ModuleBuilder(docUrl,rootState,options);return moduleBuilder.build();}ModuleBuilder.prototype.safelyAddVariableToDatamodelAccumulator=function(variableName,lineNum,colNum){if(!this.datamodelAccumulator.some(function(data){return data.id===variableName;})){// add datamodel declaration to the accumulator
6803this.datamodelAccumulator.push({$line:lineNum,$col:colNum,id:variableName});}};/**
6804 * Handles an externally referenced script within an executable content block
6805 * @param {object} action The script action
6806 * @return {string} A call to the named function that will be injected at model preparation time
6807 * @see document-string-to-model#prepare
6808 */ModuleBuilder.prototype.handleExternalActionScript=function(action){// base the generated function name on the fully-qualified url, NOT on its position in the file
6809var fnName=to_js_identifier(action.src);// Only load the script once. It will be evaluated as many times as it is referenced.
6810if(!this.externalActionScripts.has(action.src)){this.externalActionScripts.add(action.src);action.$wrap=function(body){return generateFnDeclaration(fnName,body,action);};this.rootState.rootScripts.push(action);}return generateFnCall(fnName);};function getVariableNameForShallowCopy(builder){//Assign a number higher than current total number of variables in accumulator
6811return'$scionArray_'+builder.datamodelAccumulator.length+1;}var actionTags={"script":function script(action,builder){if(action.src){return builder.handleExternalActionScript(action);}else{return action.content;}},"assign":function assign(action,builder){return action.location.expr+" = "+generateFnCall(builder.generateAttributeExpression(action,'expr'))+";";},"log":function log(action,builder){var params=[];if(action.label){params.push(JSON.stringify(action.label));}else if(action.labelexpr){// extends SCXML 1.0
6812params.push(generateFnCall(builder.generateAttributeExpression(action,'labelexpr')));}else{// always push *something* so the interpreter context
6813// can differentiate between label and message
6814params.push('null');}if(action.expr){params.push(generateFnCall(builder.generateAttributeExpression(action,'expr')));}return"this.log("+params.join(",")+");";},"if":function _if(action,builder){var s="";var ifCondExprName=builder.generateAttributeExpression(action,'cond');s+="if("+generateFnCall(ifCondExprName)+"){\n";var childNodes=action.actions;for(var i=0;i<childNodes.length;i++){var child=childNodes[i];if(child.$type==="elseif"||child.$type==="else"){break;}else{s+=' '+generateFnCall(builder.generateActionFunction(child))+';\n';}}//process if/else-if, and recurse
6815for(;i<childNodes.length;i++){child=childNodes[i];if(child.$type==="elseif"){s+="}else if("+generateFnCall(builder.generateAttributeExpression(child,'cond'))+"){\n";}else if(child.$type==="else"){s+="}";break;}else{s+=' '+generateFnCall(builder.generateActionFunction(child))+';\n';}}for(;i<childNodes.length;i++){child=childNodes[i];//this should get encountered first
6816if(child.$type==="else"){s+="else{\n";}else{s+=' '+generateFnCall(builder.generateActionFunction(child))+';\n';}}s+="}";return s;},"elseif":function elseif(){throw new Error("Encountered unexpected elseif tag.");},"else":function _else(){throw new Error("Encountered unexpected else tag.");},"raise":function raise(action){return"this.raise({ name:"+JSON.stringify(action.event)+", data : {}});";},"cancel":function cancel(action){return"this.cancel("+JSON.stringify(action.sendid)+");";},"send":function send(action,builder){builder.documentHasSendAction=true;//set the global flag
6817function processAttr(container,attr){if(attr==='id'){builder.sendIdAccumulator.push(container[attr]);}var exprName=attr+'expr';if(attr==='idlocation'){builder.documentHasSendActionWithIdlocationAttribute=true;var fakeExpr=JSON.parse(JSON.stringify(container));//FIXME: overwriting this variable is a bit ugly.
6818//if we're going to generate this expr on the fly, it would be better to clone the container.
6819container[attr].expr=container[attr].expr+'='+generateFnCall(GENERATE_SENDID_FN_NAME);var fnName=builder.generateAttributeExpression(container,attr);return generateFnCall(fnName);}else if(container[exprName]){var fnName=builder.generateAttributeExpression(container,exprName);return generateFnCall(fnName);}else if(container[attr]){return JSON.stringify(container[attr]);}else{return null;}}function constructSendEventData(action){//content and @contentexpr has priority over namelist and params
6820if(action.content){return' '+JSON.stringify(action.content);//TODO: inline it if content is pure JSON. call custom attribute 'contentType'?
6821}else if(action.contentexpr){return generateFnCall(builder.generateAttributeExpression(action,'contentexpr'));}else{var props=[];//namelist
6822if(action.namelist){action.namelist.expr.trim().split(/ +/).forEach(function(name){props.push('"'+name+'"'+":"+name);//FIXME: should add some kind of stack trace here. this is hard, though, because it aggregates multiple expressions to a single line/column
6823});}//params
6824if(action.params&&action.params.length){action.params.forEach(function(param){if(param.expr){props.push('"'+param.name+'"'+":"+generateFnCall(builder.generateAttributeExpression(param,'expr')));}else if(param.location){props.push('"'+param.name+'"'+":"+generateFnCall(builder.generateAttributeExpression(param,'location')));}});}return"{\n"+props.join(',\n')+"}\n";}}var target=processAttr(action,'target'),targetVariableName='_scionTargetRef',targetDeclaration='var '+targetVariableName+' = '+target+';\n';var event="{\n"+" target: "+targetVariableName+",\n"+" name: "+processAttr(action,'event')+",\n"+" type: "+processAttr(action,'type')+",\n"+" data: \n"+constructSendEventData(action)+",\n"+" origin: _sessionid\n"+"}";var sendId;if(action.id){sendId=processAttr(action,'id');}else if(action.idlocation){sendId=processAttr(action,'idlocation');}else{sendId='null';}var send=targetDeclaration+"if("+targetVariableName+" === '#_internal'){\n"+" this.raise(\n"+event+");\n"+"}else{\n"+" this.send(\n"+event+", \n"+" {\n"+" delay: getDelayInMs("+processAttr(action,'delay')+"),\n"+//TODO: delay needs to be parsed at runtime
6825" sendid: "+sendId+"\n"+" });\n"+"}";return send;},"foreach":function foreach(action,builder){//FIXME: the index variable could shadow the datamodel. We should pick a unique temperorary variable name
6826var index=action.index||"$i",item=action.item,arr=action.array.expr,foreachFnNames=action.actions?action.actions.map(builder.generateActionFunction,builder):[];[action.item,action.index,action.array.expr].forEach(function(variableNameToDeclare){if(variableNameToDeclare){builder.safelyAddVariableToDatamodelAccumulator(variableNameToDeclare,action.$line,action.$column);}});var shallowArrayName=getVariableNameForShallowCopy(builder);var forEachContents='var '+shallowArrayName+' = '+arr+';\n'+'if(Array.isArray('+shallowArrayName+')){\n'+' for('+index+' = 0; '+index+' < '+shallowArrayName+'.length;'+index+'++){\n'+' '+item+' = '+shallowArrayName+'['+index+'];\n'+foreachFnNames.map(function(fnName){return' '+generateFnCall(fnName)+';';}).join('\n')+'\n'+' }\n'+'} else{\n'+' for('+index+' in '+shallowArrayName+'){\n'+' if('+shallowArrayName+'.hasOwnProperty('+index+')){\n'+' '+item+' = '+shallowArrayName+'['+index+'];\n'+foreachFnNames.map(function(fnName){return' '+generateFnCall(fnName)+';';}).join('\n')+'\n'+' }\n'+' }\n'+'}';return forEachContents;},"custom":function custom(action){var customTagConfig={name:'Sandbox.action',data:action};return"postMessage("+JSON.stringify(customTagConfig,null,4)+");";}};function getDelayInMs(delayString){if(typeof delayString==='string'){if(delayString.slice(-2)==="ms"){return parseFloat(delayString.slice(0,-2));}else if(delayString.slice(-1)==="s"){return parseFloat(delayString.slice(0,-1))*1000;}else if(delayString.slice(-1)==="m"){return parseFloat(delayString.slice(0,-1))*1000*60;}else{return parseFloat(delayString);}}else if(typeof delayString==='number'){return delayString;}else{return 0;}}//flow through the code and
6827//generate idlocationGenerator if we find
6828var GENERATE_SENDID_FN_NAME='$generateSendId';function generateIdlocationGenerator(sendIdAccumulator){return'var $sendIdCounter = 0;\n'+'var $sendIdAccumulator = '+JSON.stringify(sendIdAccumulator)+';\n'+'function '+GENERATE_SENDID_FN_NAME+'(){\n'+' var sendid;\n'+' do{\n'+' sendid = "$scion.sendid" + $sendIdCounter++;\n'+//make sure we don't clobber an existing sendid
6829' } while($sendIdAccumulator.indexOf(sendid) > -1)\n'+' return sendid;\n'+'}';}module.exports=startTraversal;//for executing directly under node.js
6830if(require.main===module){//TODO: clean up command-line interface so that we do not expose unnecessary cruft
6831var usage='Usage: $0 [ FILE | - ]';var argv=require('optimist').usage(usage).argv;var input=argv._[0];if(!input){console.error(usage);process.exit(1);}else if(input==='-'){//read from stdin or file
6832process.stdin.setEncoding('utf8');process.stdin.resume();var jsonString='';process.stdin.on('data',function(s){jsonString+=s;});process.stdin.on('end',go);}else{var fs=require('fs');jsonString=fs.readFileSync(input,'utf8');go(input);}}function go(docUrl){if(!docUrl){docUrl='';}startTraversal(docUrl,JSON.parse(jsonString),{debug:true}).then(function resolved(jsModule){console.log(jsModule.module);},function rejected(err){console.error(err);});}}).call(this,require('_process'));},{"_process":23,"fs":12,"optimist":56,"text-to-js-identifier":61}],2:[function(require,module,exports){(function(process){//TODO: resolve data/@src and script/@src. either here, or in a separate module.
6833//TODO: remove nodejs dependencies
6834//TODO: decide on a friendly, portable interface to this module. streaming is possible, but maybe not very portable.
6835var sax=require("sax"),strict=true,// set to false for html-mode
6836parser;function merge(o1,o2){Object.keys(o2).forEach(function(k){o1[k]=o2[k];});return o1;}function getNormalizedAttributeName(attr){return attr.uri?'{'+attr.uri+'}'+attr.local:attr.local;}function copyNsAttrObj(o){var r={};Object.keys(o).forEach(function(k){var attr=o[k];r[getNormalizedAttributeName(attr)]=attr.value;});return r;}function transform(xmlString){parser=sax.parser(strict,{trim:true,xmlns:true});var rootJson,currentJson,expressionAttributeCache,//we cache them because in sax-js attributes get processed before the nodes they're attached to,
6837//and this is the only way we can capture their row/col numbers.
6838//so when we finally find one, it gets popped off the stack.
6839jsonStack=[],allTransitions=[];//we keep a reference to these so we can clean up the onTransition property later
6840function createActionJson(node){var action=merge({$line:parser.line,$column:parser.column,$type:node.local},copyNsAttrObj(node.attributes));//console.log('action node',node);
6841var actionContainer;if(Array.isArray(currentJson)){//this will be onExit and onEntry
6842currentJson.push(action);}else if(currentJson.$type==='scxml'&&action.$type==='script'){//top-level script
6843currentJson.rootScripts=currentJson.rootScripts||[];currentJson.rootScripts.push(action);}else{//if it's any other action
6844currentJson.actions=currentJson.actions||[];currentJson.actions.push(action);}return currentJson=action;}function createDataJson(node){currentJson=merge({$line:parser.line,$column:parser.column,$type:'data'},copyNsAttrObj(node.attributes));return currentJson;}function createStateJson(node){var state=copyNsAttrObj(node.attributes);if(state.type){state.isDeep=state.type==='deep'?true:false;}//"state" is the default, so you don't need to explicitly write it
6845if(node.local!=='state'&&node.local!=='schema')state.$type=node.local;if(currentJson){if(!currentJson.states){currentJson.states=[];}currentJson.states.push(state);}return currentJson=state;}function createTransitionJson(node){var transition=copyNsAttrObj(node.attributes);//target can either be a string, an array (for multiple targets, e.g. targeting, or undefined
6846if(transition.target){//console.log('transition',transition);
6847transition.target=transition.target.trim().split(/\s+/);if(transition.target.length===1){transition.target=transition.target[0];}}if(currentJson){if(!currentJson.transitions){currentJson.transitions=[];}currentJson.transitions.push(transition);}allTransitions.push(transition);return currentJson=transition;}function createExpression(value){return{$line:parser.line,$column:parser.column,expr:value};}var tagActions={"scxml":function scxml(node){return rootJson=createStateJson(node);},"initial":createStateJson,"history":createStateJson,"state":createStateJson,"parallel":createStateJson,"final":createStateJson,//transitions/action containers
6848"transition":createTransitionJson,"onentry":function onentry(node){currentJson=currentJson.onEntry=currentJson.onEntry||[];},"onexit":function onexit(node){currentJson=currentJson.onExit=currentJson.onExit||[];},//actions
6849"foreach":createActionJson,"raise":createActionJson,"log":createActionJson,"assign":createActionJson,"validate":createActionJson,"script":createActionJson,"cancel":createActionJson,//TODO: deal with namelist
6850//TODO: decide how to deal with location expressions, as opposed to regular expressions
6851"send":createActionJson,//children of send
6852"param":function param(node){//TODO: figure out how to deal with param and param/@expr and param/@location
6853currentJson.params=currentJson.params||[];var attr=copyNsAttrObj(node.attributes);currentJson.params.push(attr);currentJson=attr;},"content":function content(){if(expressionAttributeCache.expr){currentJson.contentexpr=merge({},expressionAttributeCache.expr);}},//these are treated a bit special - TODO: normalize/decide on a representation
6854"if":createActionJson,"elseif":createActionJson,"else":createActionJson,//data
6855"datamodel":function datamodel(node){//console.log('datamodel currentJson',currentJson);
6856currentJson=currentJson.datamodel=[];},"data":function data(node){//console.log('data currentJson',currentJson);
6857currentJson.push(createDataJson(node));}//TODO: these
6858//"invoke":,
6859//"finalize":,
6860//"donedata":
6861};expressionAttributeCache={};//TODO: put in onstart or something like that
6862parser.onopentag=function(node){//console.log("open tag",node.local);
6863if(tagActions[node.local]){tagActions[node.local](node);jsonStack.push(currentJson);//console.log('current json now',currentJson,jsonStack.length);
6864//merge in the current expression attribute cache
6865merge(currentJson,expressionAttributeCache);expressionAttributeCache={};//clear the expression attribute cache
6866}else{createActionJson(node);jsonStack.push(currentJson);merge(currentJson,expressionAttributeCache);expressionAttributeCache={};}};var EXPRESSION_ATTRS=['cond','array','location','namelist','idlocation'];parser.onclosetag=function(tag){//console.log("close tag",tag);
6867var localName=tag.split(':').pop();// if(tagActions[localName]){
6868jsonStack.pop();currentJson=jsonStack[jsonStack.length-1];//console.log('current json now',currentJson,jsonStack.length);
6869// }
6870};parser.onattribute=function(attr){//if attribute name ends with 'expr' or is one of the other ones enumerated above
6871//then cache him and his position
6872if(attr.name.match(/^.*expr$/)||EXPRESSION_ATTRS.indexOf(attr.name)>-1){expressionAttributeCache[getNormalizedAttributeName(attr)]=createExpression(attr.value);}};parser.onerror=function(e){// an error happened.
6873throw e;};parser.ontext=function(t){//the only text we care about is that inside of <script> and <content>
6874if(currentJson&&currentJson.$type){if(currentJson.$type==='script'){currentJson.content=t;//I don't think we need a separate expression for this w/ line/col mapping
6875}else if(currentJson.$type==='send'){currentJson.content=t;}else if(currentJson.$type==='data'){currentJson.content={$line:currentJson.$line,$column:currentJson.$column,expr:t};}else{currentJson.content=t;}}};parser.oncdata=function(t){currentJson.content=t;};parser.onend=function(){//do some scrubbing of root attributes
6876delete rootJson.xmlns;//delete rootJson.type; //it can be useful to leave in 'type' === 'scxml'
6877delete rootJson.version;if(typeof rootJson.datamodel==='string')delete rootJson.datamodel;//this would happen if we have, e.g. state.datamodel === 'ecmascript'
6878//change the property name of transition event to something nicer
6879allTransitions.forEach(function(transition){transition.onTransition=transition.actions;delete transition.actions;});};parser.write(xmlString).close();return rootJson;}module.exports=transform;//for executing diretly under node.js
6880if(require.main===module){//TODO: allow reading from stdin directly
6881//TODO: use saxjs's support for streaming API.
6882console.log(JSON.stringify(transform(require('fs').readFileSync(process.argv[2],'utf8')),4,4));}}).call(this,require('_process'));},{"_process":23,"fs":12,"sax":59}],3:[function(require,module,exports){var platform=require('../../runtime/platform-bootstrap/node/platform');var fileUtils={read:function read(filePath,docUrl,context,cb){var result={error:null,content:''};if(docUrl){filePath=platform.url.resolve(docUrl,filePath);}platform.getResourceFromUrl(filePath,function(err,text,mimeType){if(err){result.error="Error downloading document \""+filePath+"\", "+(err.message||err);//TODO kill the process if file is not present
6883}else{result.content=text;}cb(result);},context);}};module.exports=fileUtils;},{"../../runtime/platform-bootstrap/node/platform":9}],4:[function(require,module,exports){'use strict';var esprima=require('esprima');var fileUtils=require('./file-utils');var systemVariables=["_event","_sessionid","_name","_ioprocessors","_x"];var scJsonAnalyzer={analyze:function analyze(scJson,docUrl,context,done){var changes=[],syntaxErrors=[],asyncCount=0,waitingForAsync=false,reportCompileErrors=context.reportAllErrors===true;function processState(state){if(state.datamodel)processActions(state,'datamodel');if(state.onExit)processActions(state,'onExit');if(state.onEntry)processActions(state,'onEntry');if(state.transitions){processActions(state,'transitions',state);state.transitions.forEach(function(transition,i){if(transition.onTransition){processActions(transition,'onTransition');}});}if(state.rootScripts){processActions(state,'rootScripts');}if(state.states)state.states.forEach(function(substate,i){processState(substate);});}function processActions(actionContainer,name,state){if(Array.isArray(actionContainer[name])){Object.keys(actionContainer[name]).forEach(function(i){checkAction(actionContainer[name],i,actionContainer[name][i].$type||name,state);if(actionContainer[name][i].actions)processActions(actionContainer[name][i],'actions');});}else{checkAction(actionContainer,name,name,state);}}function checkAction(action,propertyName,$type,state){if(actionTags[$type]){var errors=actionTags[$type](action[propertyName],function(errors,override){if(override){handleError(action,propertyName,errors,$type,state,override);}else if(errors.length>0){handleError(action,propertyName,errors,$type,state);}asyncDone();});if(errors){if(errors.override){handleError(action,propertyName,errors.errors,$type,state,errors.override);}else if(errors.length>0){handleError(action,propertyName,errors,$type,state);}}}}var actionTags={'data':function data(node,done){//If there is an external file and
6884//src attribute starting exactly with "file:"
6885if(node.src&&node.src.indexOf('file:')===0){asyncStarted();getFileContents(node.src.substring(5),function(error,content){if(error){done([error]);}else{delete node.src;node.expr={$column:node.$column,$line:node.$line,expr:normalizeWhitespace(content)};done(null,node);}});}else if(node.content){var errors=validateJavascriptAssignment(node.id,node.content);if(errors.length>0){node.content.expr=normalizeWhitespace(node.content.expr);}node.expr=node.content;delete node.content;return{override:node,errors:errors};}else{return validateJavascriptAssignment(node.id,node.expr);}},'assign':function assign(node){if(node.location&&node.expr){return validateJavascriptAssignment(node.location,node.expr);}return[];},'transitions':function transitions(node){if(node.cond){// return validateJavascriptCondition(node.cond);
6886var errors=validateJavascriptCondition(node.cond);if(errors.length){//Assume illegal booleans as false, send override
6887//https://github.com/jbeard4/scxml-test-framework/blob/2.0.0/test/w3c-ecma/test309.txml.scxml
6888node.cond.expr='false';return{override:node,errors:errors};}}return[];},'if':function _if(node){return validateJavascriptCondition(node.cond);},'ifelse':function ifelse(node){return validateJavascriptCondition(node.cond);},'script':function script(node,done){if(node.src){// DO NOT inline the external script here. that MUST be done
6889// each time the parent document is requested
6890}else if(node.content){return validateArbitraryJavascript(node.content);}},'log':function log(node){if(node.expr){return validateJavascriptExpression(node.expr,true);}return[];},'send':function send(node){if(node.$type){return validateJavascriptExpression(node.expr);}return[];},'foreach':function foreach(node){var errors=[];if(node.item){var results=validateJavascriptIdentifier(node.item);if(results&&results.length>0){errors=errors.concat(results);}}if(node.index){var results=validateJavascriptIdentifier(node.index);if(results&&results.length>0){errors=errors.concat(results);}}if(node.array){var results=validateJavascriptExpression(node.array);if(results&&results.length>0){errors=errors.concat(results);}}return errors;}};function validateJavascriptAssignment(leftHand,rightHand){var errors=[];var leftHandCheck=validateArbitraryJavascript(leftHand);var rightHandCheck=validateArbitraryJavascript(extractJavascript(leftHand)+' = '+extractJavascript(rightHand));if(leftHandCheck.length){errors.push(leftHandCheck);}else if(rightHandCheck.length){errors.push(rightHandCheck);}else if(systemVariables.indexOf(extractJavascript(leftHand))!==-1){errors.push('You can\'t change system variables: '+leftHand);}return errors;}function validateJavascriptCondition(condition){return validateArbitraryJavascript(condition);}function validateJavascriptExpression(js,allowLiteral){return validateArbitraryJavascript(js,allowLiteral);}function validateJavascriptIdentifier(js){js=extractJavascript(js);var errors=validateArbitraryJavascript(js);if(errors.length)return errors;var syntaxTree=esprima.parse(js,{});if(syntaxTree.body[0].expression.type!=='Identifier'){return['Illegal identifier: '+js];}}function validateArbitraryJavascript(js,allowLiteral){js=extractJavascript(js);if(allowLiteral){js='_lhs = '+js;}var errors=[];try{var syntaxTree=esprima.parse(js,{});traverseSyntaxTree(syntaxTree,errors);}catch(e){errors.push(e.message);}return errors;}var treeTypes={"AssignmentExpression":function AssignmentExpression(tree,errors){//Check if assignee is a system variable in for statement
6891if(tree.init&&tree.init.left&&systemVariables.indexOf(tree.init.left.name)!==-1){errors.push('You can\'t change system variables: '+tree.init.left.name);}//Check if assignee is a system variable in expressions
6892if(tree.expression&&tree.expression.left&&systemVariables.indexOf(tree.expression.left.name)!==-1){errors.push('You can\'t change system variables: '+tree.expression.left.name);}}};function traverseSyntaxTree(tree,errors){Object.keys(tree).forEach(function(i){if(tree[i]&&_typeof(tree[i])==='object'){if(tree[i].type&&treeTypes[tree[i].type]){treeTypes[tree[i].type](tree,errors);}//Go deeper into the child nodes
6893traverseSyntaxTree(tree[i],errors);}});}function getFileContents(filePath,done){//docUrl and context are coming from top function.
6894fileUtils.read(filePath,docUrl,context,function(fileContent){done(fileContent.error,fileContent.content);});}function handleError(node,property,errors,$type,state,override){if(reportCompileErrors&&errors&&errors.length){var n=node[property];syntaxErrors.push({tagname:n.$type,line:n.$line,column:n.$column,reason:errors.join('; ')});}var errorNode={$line:node[property].$line,$column:node[property].$column,$type:'raise',event:'error.execution',data:{message:errors?errors.join(', '):''}};changes.push({old:node,prop:property,$type:$type,new:override,state:state,error:errorNode});}function extractJavascript(attribute){//Just a workaround for esprima parsing.
6895if((typeof attribute==="undefined"?"undefined":_typeof(attribute))==='object'){attribute=attribute.expr;}return attribute;}function normalizeWhitespace(str){return JSON.stringify(str.replace(/^\s+|\s+$|\s+(?=\s)/g,'').replace(/\s/g," "));}function commitChanges(scJson,errors){changes.forEach(function(change){if(change.$type==='data'&&!change.new){delete scJson.datamodel;scJson.onEntry=[change.new||change.error];}else if(change.$type==='script'&&!change.new&&scJson.rootScripts){delete scJson.rootScripts;scJson.onEntry=[change.error];}else if(change.$type==='transitions'){if(!change.state.onEntry)change.state.onEntry=[];change.state.onEntry.push(change.error);change.old[change.prop]=change.new;}else{change.old[change.prop]=change.new||change.error;}});}function asyncStarted(){asyncCount++;}function asyncDone(){asyncCount--;//If we are only waiting for async processes
6896if(waitingForAsync&&asyncCount===0){completeAnalysis();}}function completeAnalysis(){if(syntaxErrors.length){scJson=undefined;}else{commitChanges(scJson);}done({scJson:scJson,errors:syntaxErrors});}processState(scJson,'scJson');if(asyncCount===0){completeAnalysis();}else{//Wait for async processes to end
6897waitingForAsync=true;}}};module.exports=scJsonAnalyzer;},{"./file-utils":3,"esprima":11}],5:[function(require,module,exports){module.exports={scxmlToScjson:require('../compiler/scxml-to-scjson'),scjsonToModule:require('../compiler/scjson-to-module'),scJsonAnalyzer:require('../compiler/static-analysis/scjson-analyzer')};},{"../compiler/scjson-to-module":1,"../compiler/scxml-to-scjson":2,"../compiler/static-analysis/scjson-analyzer":4}],6:[function(require,module,exports){/*
6898 Copyright 2011-2012 Jacob Beard, INFICON, and other SCION contributors
6899
6900 Licensed under the Apache License, Version 2.0 (the "License");
6901 you may not use this file except in compliance with the License.
6902 You may obtain a copy of the License at
6903
6904 http://www.apache.org/licenses/LICENSE-2.0
6905
6906 Unless required by applicable law or agreed to in writing, software
6907 distributed under the License is distributed on an "AS IS" BASIS,
6908 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6909 See the License for the specific language governing permissions and
6910 limitations under the License.
6911*/"use strict";var compilerInternals=require('./compiler-internals'),platform=require('./platform-bootstrap/node/platform'),fs=require('fs'),vm=require('vm'),assert=require('assert');var scxmlToScjson=compilerInternals.scxmlToScjson,scjsonToModule=compilerInternals.scjsonToModule,scJsonAnalyzer=compilerInternals.scJsonAnalyzer;/**
6912 * Compile the raw scxml document into a compiled JS module
6913 * Top-level scripts are extracted so that they can be compiled and executed independently
6914 * @param {string} url The url of the scxml document
6915 * @param {string} docString The raw scxml document to be parsed
6916 * @param {Function} cb The callback to invoke once the document has been parsed
6917 * @param {object} [hostContext] Context provided by the interpreter host
6918 */function documentStringToModel(url,docString,cb,hostContext){if((typeof hostContext==="undefined"?"undefined":_typeof(hostContext))!=='object'||hostContext===null){hostContext={};}var scJson=scxmlToScjson(docString);scJsonAnalyzer.analyze(scJson,url,hostContext,function(result){if(result.errors.length){cb(result.errors);return;};createModule(url,result.scJson,hostContext,cb);});}function fetchScript(scriptInfo,hostContext){return new Promise(function(resolve,reject){platform.getScriptFromUrl(scriptInfo.src,function(err,compiledScript,mimeType){if(err){reject(err);}else{scriptInfo.compiled=compiledScript;resolve(scriptInfo);}},hostContext,{lineOffset:scriptInfo.$line,columnOffset:scriptInfo.$column,$wrap:scriptInfo.$wrap});});}/**
6919 * Compile the generated scxml module and any embedded or external scripts
6920 * @param {string} docUrl The scxml document url
6921 * @param {SCJsonRawModule} rawModule The raw SCION module created by scjson-to-module
6922 * @param {object} [hostContext] Context provided by the interpreter host
6923 * @param {Function} cb Callback to invoke with the compiled module or an error
6924 */function compileModule(docUrl,rawModule,hostContext,cb){var promiseOffset=2;var rootScripts=rawModule.rootScripts;var scriptCount=rootScripts.length;var promises=new Array(scriptCount+promiseOffset);for(var i=0;i<scriptCount;i++){var curScript=rootScripts[i];if(curScript.src){curScript.src=platform.url.resolve(docUrl,curScript.src);// defer the fetch until SCModel.prepare
6925promises[i+promiseOffset]=Promise.resolve(curScript);}else{promises[i+promiseOffset]=new Promise(function(resolve,reject){try{var content=curScript.content;delete curScript.content;var compiledScript=platform.module.compileScript(content,{filename:docUrl,lineOffset:curScript.$line,columnOffset:curScript.$column});curScript.compiled=compiledScript;resolve(curScript);}catch(e){reject(e);}});}}promises[0]=new Promise(function(resolve,reject){try{var compiledModule=platform.module.compileScript(rawModule.module,{filename:docUrl});resolve(compiledModule);}catch(e){reject(e);}});promises[1]=new Promise(function(resolve,reject){if(!rawModule.datamodel){resolve(undefined);}else{try{var compiledDatamodel=platform.module.compileScript(rawModule.datamodel,{filename:docUrl});resolve(compiledDatamodel);}catch(e){reject(e);}}});Promise.all(promises).then(function compileSuccess(scripts){var compiledModule=scripts.shift();var datamodelDecl=scripts.shift();var model=new SCModel(rawModule.name,datamodelDecl,rootScripts,compiledModule);cb(null,model);},function compileError(err){cb(err);});}function SCModel(name,datamodel,rootScripts,scxmlModule){this.name=name;this.datamodel=datamodel;this.rootScripts=rootScripts;this.module=scxmlModule;}/**
6926 * Prepares an scxml model for execution by binding it to an execution context
6927 * @param {object} [executionContext] The execution context (e.g. v8 VM sandbox).
6928 * If not provided, a bare bones context is constructed
6929 * @param {Function} cb Callback to execute with the prepared model or an error
6930 * The prepared model is a function to be passed into a SCION StateChart object
6931 * @param {object} [hostContext] Context provided by the interpreter host
6932 */SCModel.prototype.prepare=function(cb,executionContext,hostContext){if(!executionContext){executionContext=platform.module.createExecutionContext();}if(!vm.isContext(executionContext)){executionContext=vm.createContext(executionContext);}if((typeof hostContext==="undefined"?"undefined":_typeof(hostContext))!=='object'||hostContext===null){hostContext={};}var scriptCount=this.rootScripts.length;var scriptPromises=new Array(scriptCount);for(var i=0;i<scriptCount;i++){var curScript=this.rootScripts[i];if(curScript.src){// script url already resolved in compileModule
6933scriptPromises[i]=fetchScript(curScript,hostContext);}else{assert(curScript.compiled);scriptPromises[i]=Promise.resolve(curScript);}}var self=this;Promise.all(scriptPromises).then(function resolved(scripts){try{if(self.datamodel){self.datamodel.runInContext(executionContext);}for(var _i2=0;_i2<scriptCount;_i2++){self.rootScripts[_i2].compiled.runInContext(executionContext);}var modelFn=self.module.runInContext(executionContext);cb(undefined,modelFn);}catch(e){cb(e);}},function rejected(err){cb(err);});};function createModule(url,scJson,hostContext,cb){if(platform.debug){console.log('scjson',JSON.stringify(scJson,undefined,2));if(!hostContext.hasOwnProperty('debug')){hostContext.debug=true;}}scjsonToModule(url,scJson,hostContext).then(function resolved(rawModule){if(platform.debug&&rawModule.name){fs.writeFileSync('/var/tmp/'+rawModule.name+'.scion',rawModule.module);}compileModule(url,rawModule,hostContext,cb);},function rejected(err){cb(err);});}module.exports=documentStringToModel;},{"./compiler-internals":5,"./platform-bootstrap/node/platform":9,"assert":13,"fs":12,"vm":62}],7:[function(require,module,exports){/*
6934 Copyright 2011-2012 Jacob Beard, INFICON, and other SCION contributors
6935
6936 Licensed under the Apache License, Version 2.0 (the "License");
6937 you may not use this file except in compliance with the License.
6938 You may obtain a copy of the License at
6939
6940 http://www.apache.org/licenses/LICENSE-2.0
6941
6942 Unless required by applicable law or agreed to in writing, software
6943 distributed under the License is distributed on an "AS IS" BASIS,
6944 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6945 See the License for the specific language governing permissions and
6946 limitations under the License.
6947*/"use strict";var platform=require('./platform-bootstrap/node/platform'),documentStringToModel=require('./document-string-to-model');/**
6948 * Includes options passed to the model compiler as well as
6949 * data passed along to the platform-specific resource-fetching API.
6950 * @typedef {object} ModelContext
6951 * @property {boolean} [reportAllErrors=false] Indicates whether or not data model (aka JavaScript)
6952 * compilation errors cause the callback to be invoked with errors. By default these errors
6953 * are raised to the offending document as error.execution events.
6954 *//**
6955 * @param {string} url URL of the SCXML document to retrieve and convert to a model
6956 * @param {function} cb callback to invoke with an error or the model
6957 * @param {ModelContext} [context] The model compiler context
6958 */function urlToModel(url,cb,context){platform.http.get(url,function(err,doc){if(err){cb(err,null);}else{documentStringToModel(url,doc,cb,context);}},context);}/**
6959 * @param {string} url file system path of the SCXML document to retrieve and convert to a model
6960 * @param {function} cb callback to invoke with an error or the model
6961 * @param {ModelContext} [context] The model compiler context
6962 */function pathToModel(url,cb,context){context=context||{};context.isLoadedFromFile=true;//this is useful later on for setting up require() when eval'ing the generated code
6963platform.fs.get(url,function(err,doc){if(err){cb(err,null);}else{documentStringToModel(url,doc,cb,context);}},context);}/**
6964 * @param document SCXML document to convert to a model
6965 * @param {function} cb callback to invoke with an error or the model
6966 * @param {ModelContext} [context] The model compiler context
6967 */function documentToModel(doc,cb,context){var s=platform.dom.serializeToString(doc);documentStringToModel(null,s,cb,context);}//export standard interface
6968module.exports={pathToModel:pathToModel,urlToModel:urlToModel,documentStringToModel:documentStringToModel,documentToModel:documentToModel,ext:{platform:platform,compilerInternals:require('./compiler-internals')//expose
6969},scion:require('scion-core')};},{"./compiler-internals":5,"./document-string-to-model":6,"./platform-bootstrap/node/platform":9,"scion-core":60}],8:[function(require,module,exports){/*
6970 Copyright 2011-2012 Jacob Beard, INFICON, and other SCION contributors
6971
6972 Licensed under the Apache License, Version 2.0 (the "License");
6973 you may not use this file except in compliance with the License.
6974 You may obtain a copy of the License at
6975
6976 http://www.apache.org/licenses/LICENSE-2.0
6977
6978 Unless required by applicable law or agreed to in writing, software
6979 distributed under the License is distributed on an "AS IS" BASIS,
6980 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6981 See the License for the specific language governing permissions and
6982 limitations under the License.
6983*/"use strict";/**
6984 * This module contains some utility functions for getting stuff in node.js.
6985 */var http=require('http'),urlM=require('url'),fs=require('fs');function httpGet(url,cb){var options=urlM.parse(url);http.get(options,function(res){var s="";res.on('data',function(d){s+=d;});res.on('end',function(){if(res.statusCode===200){cb(null,s);}else{cb(new Error('HTTP code '+res.statusCode+' : '+s));}});}).on('error',function(e){cb(e);});}function getResource(url,cb,context){var urlObj=urlM.parse(url);if(urlObj.protocol==='http:'||url.protocol==='https:'||typeof window!=='undefined'//are we actually in the browser?
6986){httpGet(url,cb);}else if(!urlObj.protocol){//assume filesystem
6987fs.readFile(url,'utf8',cb);}else{//pass in error for unrecognized protocol
6988cb(new Error("Unrecognized protocol"));}}module.exports={getResource:getResource,httpGet:httpGet};},{"fs":12,"http":44,"url":51}],9:[function(require,module,exports){(function(process){/*
6989 Copyright 2011-2012 Jacob Beard, INFICON, and other SCION contributors
6990
6991 Licensed under the Apache License, Version 2.0 (the "License");
6992 you may not use this file except in compliance with the License.
6993 You may obtain a copy of the License at
6994
6995 http://www.apache.org/licenses/LICENSE-2.0
6996
6997 Unless required by applicable law or agreed to in writing, software
6998 distributed under the License is distributed on an "AS IS" BASIS,
6999 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7000 See the License for the specific language governing permissions and
7001 limitations under the License.
7002*/"use strict";var fs=require('fs'),_get=require('./get'),pathModule=require('path'),vm=require('vm'),url=require('./url'),Module=require('module');module.exports={//used in parsing
7003http:{get:function get(url,cb){_get.httpGet(url,cb);}},fs:{get:function get(path,cb,context){fs.readFile(path,'utf8',cb);}},getResourceFromUrl:_get.getResource,getScriptFromUrl:function getScriptFromUrl(url,cb,context,scriptInfo){_get.getResource(url,function(err,content){if(err){cb(err);return;}if(typeof scriptInfo.$wrap==='function'){content=scriptInfo.$wrap(content);}var options=Object.assign({filename:url},scriptInfo);try{var script=new vm.Script(content,options);cb(undefined,script);}catch(e){cb(e);}},context);},path:require('path'),//same API
7004url:{resolve:url.resolve},module:{createLocalExecutionContext:function createLocalExecutionContext(docPath,sandbox){if(!sandbox){sandbox={console:console};sandbox.global=sandbox;}var ctx=vm.createContext(sandbox);ctx.__filename=docPath;ctx.__dirname=pathModule.dirname(ctx.__filename);//set it up so that require is relative to file
7005var _module=ctx.module=new Module(docPath);var _require=ctx.require=function(path){return Module._load(path,_module,true);};_module.filename=ctx.__filename;_require.paths=_module.paths=Module._nodeModulePaths(process.cwd());_require.resolve=function(request){return Module._resolveFilename(request,_module);};return ctx;},/**
7006 * create a context in which to execute javascript
7007 * @param {object} [sandbox] An object to contextify
7008 * @return {object} An execution context
7009 * @see {@link https://nodejs.org/dist/latest-v4.x/docs/api/vm.html#vm_vm_createcontext_sandbox}
7010 */createExecutionContext:function createExecutionContext(sandbox,hostContext){return vm.createContext(sandbox);},/**
7011 * Create a compiled script object
7012 * @param {string} src The js source to compile
7013 * @param {object} options compilation options
7014 * @param {string} options.filename The path to the file associated with the source
7015 * @param {number} options.lineOffset The offset to the line number in the scxml document
7016 * @param {number} options.columnOffset The offset to the column number in the scxml document
7017 * @return {Script} A Script object which implements a runInContext method
7018 * @see {@link https://nodejs.org/dist/latest-v4.x/docs/api/vm.html#vm_class_script}
7019 */compileScript:function compileScript(src,options){return new vm.Script(src,options);},eval:function _eval(s,fileName,context){context=context||{};fileName=fileName||'';//TODO: if filename starts with 'http', substitute a default require
7020// https://247inc.atlassian.net/browse/OMNI-3
7021// create an isolated sandbox per session
7022var sandbox={};sandbox.global=sandbox;var ctx=vm.createContext(sandbox);if(context.isLoadedFromFile){ctx.__filename=fileName;ctx.__dirname=pathModule.dirname(ctx.__filename);//set it up so that require is relative to file
7023var _module=ctx.module=new Module(fileName);var _require=ctx.require=function(path){return Module._load(path,_module,true);};_module.filename=ctx.__filename;_require.paths=_module.paths=Module._nodeModulePaths(process.cwd());_require.resolve=function(request){return Module._resolveFilename(request,_module);};}else{//otherwise (e.g., loaded via http, or from document string), choose a sensible default
7024ctx.require=context.require||//user-specified require
7025require.main&&//main module's require
7026require.main.require&&require.main.require.bind(require.main)||require;//this module's require
7027}//set up default require and module.exports
7028return vm.runInContext(s,ctx,fileName);}},dom:{serializeToString:function serializeToString(node){throw new Error('Platform method dom.serializeToString is not supported.');//return (new xmldom.XMLSerializer()).serializeToString(node);
7029}},log:console.log};}).call(this,require('_process'));},{"./get":8,"./url":10,"_process":23,"fs":12,"module":12,"path":22,"vm":62}],10:[function(require,module,exports){/*
7030 Copyright 2011-2012 Jacob Beard, INFICON, and other SCION contributors
7031
7032 Licensed under the Apache License, Version 2.0 (the "License");
7033 you may not use this file except in compliance with the License.
7034 You may obtain a copy of the License at
7035
7036 http://www.apache.org/licenses/LICENSE-2.0
7037
7038 Unless required by applicable law or agreed to in writing, software
7039 distributed under the License is distributed on an "AS IS" BASIS,
7040 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7041 See the License for the specific language governing permissions and
7042 limitations under the License.
7043*/"use strict";var urlModule=require('url');module.exports={getPathFromUrl:function getPathFromUrl(url){var oUrl=urlModule.parse(url);return oUrl.pathname;},changeUrlPath:function changeUrlPath(url,newPath){var oUrl=urlModule.parse(url);oUrl.path=oUrl.pathname=newPath;return urlModule.format(oUrl);},resolve:function resolve(base,target){return urlModule.resolve(base,target);}};},{"url":51}],11:[function(require,module,exports){/*
7044 Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved.
7045
7046 Redistribution and use in source and binary forms, with or without
7047 modification, are permitted provided that the following conditions are met:
7048
7049 * Redistributions of source code must retain the above copyright
7050 notice, this list of conditions and the following disclaimer.
7051 * Redistributions in binary form must reproduce the above copyright
7052 notice, this list of conditions and the following disclaimer in the
7053 documentation and/or other materials provided with the distribution.
7054
7055 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
7056 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
7057 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
7058 ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
7059 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
7060 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
7061 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
7062 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
7063 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
7064 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7065*/(function(root,factory){'use strict';// Universal Module Definition (UMD) to support AMD, CommonJS/Node.js,
7066// Rhino, and plain browser loading.
7067/* istanbul ignore next */if(typeof define==='function'&&define.amd){define(['exports'],factory);}else if(typeof exports!=='undefined'){factory(exports);}else{factory(root.esprima={});}})(this,function(exports){'use strict';var Token,TokenName,FnExprTokens,Syntax,PlaceHolders,Messages,Regex,source,strict,index,lineNumber,lineStart,hasLineTerminator,lastIndex,lastLineNumber,lastLineStart,startIndex,startLineNumber,startLineStart,scanning,length,lookahead,state,extra,isBindingElement,isAssignmentTarget,firstCoverInitializedNameError;Token={BooleanLiteral:1,EOF:2,Identifier:3,Keyword:4,NullLiteral:5,NumericLiteral:6,Punctuator:7,StringLiteral:8,RegularExpression:9,Template:10};TokenName={};TokenName[Token.BooleanLiteral]='Boolean';TokenName[Token.EOF]='<end>';TokenName[Token.Identifier]='Identifier';TokenName[Token.Keyword]='Keyword';TokenName[Token.NullLiteral]='Null';TokenName[Token.NumericLiteral]='Numeric';TokenName[Token.Punctuator]='Punctuator';TokenName[Token.StringLiteral]='String';TokenName[Token.RegularExpression]='RegularExpression';TokenName[Token.Template]='Template';// A function following one of those tokens is an expression.
7068FnExprTokens=['(','{','[','in','typeof','instanceof','new','return','case','delete','throw','void',// assignment operators
7069'=','+=','-=','*=','/=','%=','<<=','>>=','>>>=','&=','|=','^=',',',// binary/unary operators
7070'+','-','*','/','%','++','--','<<','>>','>>>','&','|','^','!','~','&&','||','?',':','===','==','>=','<=','<','>','!=','!=='];Syntax={AssignmentExpression:'AssignmentExpression',AssignmentPattern:'AssignmentPattern',ArrayExpression:'ArrayExpression',ArrayPattern:'ArrayPattern',ArrowFunctionExpression:'ArrowFunctionExpression',BlockStatement:'BlockStatement',BinaryExpression:'BinaryExpression',BreakStatement:'BreakStatement',CallExpression:'CallExpression',CatchClause:'CatchClause',ClassBody:'ClassBody',ClassDeclaration:'ClassDeclaration',ClassExpression:'ClassExpression',ConditionalExpression:'ConditionalExpression',ContinueStatement:'ContinueStatement',DoWhileStatement:'DoWhileStatement',DebuggerStatement:'DebuggerStatement',EmptyStatement:'EmptyStatement',ExportAllDeclaration:'ExportAllDeclaration',ExportDefaultDeclaration:'ExportDefaultDeclaration',ExportNamedDeclaration:'ExportNamedDeclaration',ExportSpecifier:'ExportSpecifier',ExpressionStatement:'ExpressionStatement',ForStatement:'ForStatement',ForOfStatement:'ForOfStatement',ForInStatement:'ForInStatement',FunctionDeclaration:'FunctionDeclaration',FunctionExpression:'FunctionExpression',Identifier:'Identifier',IfStatement:'IfStatement',ImportDeclaration:'ImportDeclaration',ImportDefaultSpecifier:'ImportDefaultSpecifier',ImportNamespaceSpecifier:'ImportNamespaceSpecifier',ImportSpecifier:'ImportSpecifier',Literal:'Literal',LabeledStatement:'LabeledStatement',LogicalExpression:'LogicalExpression',MemberExpression:'MemberExpression',MetaProperty:'MetaProperty',MethodDefinition:'MethodDefinition',NewExpression:'NewExpression',ObjectExpression:'ObjectExpression',ObjectPattern:'ObjectPattern',Program:'Program',Property:'Property',RestElement:'RestElement',ReturnStatement:'ReturnStatement',SequenceExpression:'SequenceExpression',SpreadElement:'SpreadElement',Super:'Super',SwitchCase:'SwitchCase',SwitchStatement:'SwitchStatement',TaggedTemplateExpression:'TaggedTemplateExpression',TemplateElement:'TemplateElement',TemplateLiteral:'TemplateLiteral',ThisExpression:'ThisExpression',ThrowStatement:'ThrowStatement',TryStatement:'TryStatement',UnaryExpression:'UnaryExpression',UpdateExpression:'UpdateExpression',VariableDeclaration:'VariableDeclaration',VariableDeclarator:'VariableDeclarator',WhileStatement:'WhileStatement',WithStatement:'WithStatement',YieldExpression:'YieldExpression'};PlaceHolders={ArrowParameterPlaceHolder:'ArrowParameterPlaceHolder'};// Error messages should be identical to V8.
7071Messages={UnexpectedToken:'Unexpected token %0',UnexpectedNumber:'Unexpected number',UnexpectedString:'Unexpected string',UnexpectedIdentifier:'Unexpected identifier',UnexpectedReserved:'Unexpected reserved word',UnexpectedTemplate:'Unexpected quasi %0',UnexpectedEOS:'Unexpected end of input',NewlineAfterThrow:'Illegal newline after throw',InvalidRegExp:'Invalid regular expression',UnterminatedRegExp:'Invalid regular expression: missing /',InvalidLHSInAssignment:'Invalid left-hand side in assignment',InvalidLHSInForIn:'Invalid left-hand side in for-in',InvalidLHSInForLoop:'Invalid left-hand side in for-loop',MultipleDefaultsInSwitch:'More than one default clause in switch statement',NoCatchOrFinally:'Missing catch or finally after try',UnknownLabel:'Undefined label \'%0\'',Redeclaration:'%0 \'%1\' has already been declared',IllegalContinue:'Illegal continue statement',IllegalBreak:'Illegal break statement',IllegalReturn:'Illegal return statement',StrictModeWith:'Strict mode code may not include a with statement',StrictCatchVariable:'Catch variable may not be eval or arguments in strict mode',StrictVarName:'Variable name may not be eval or arguments in strict mode',StrictParamName:'Parameter name eval or arguments is not allowed in strict mode',StrictParamDupe:'Strict mode function may not have duplicate parameter names',StrictFunctionName:'Function name may not be eval or arguments in strict mode',StrictOctalLiteral:'Octal literals are not allowed in strict mode.',StrictDelete:'Delete of an unqualified identifier in strict mode.',StrictLHSAssignment:'Assignment to eval or arguments is not allowed in strict mode',StrictLHSPostfix:'Postfix increment/decrement may not have eval or arguments operand in strict mode',StrictLHSPrefix:'Prefix increment/decrement may not have eval or arguments operand in strict mode',StrictReservedWord:'Use of future reserved word in strict mode',TemplateOctalLiteral:'Octal literals are not allowed in template strings.',ParameterAfterRestParameter:'Rest parameter must be last formal parameter',DefaultRestParameter:'Unexpected token =',ObjectPatternAsRestParameter:'Unexpected token {',DuplicateProtoProperty:'Duplicate __proto__ fields are not allowed in object literals',ConstructorSpecialMethod:'Class constructor may not be an accessor',DuplicateConstructor:'A class may only have one constructor',StaticPrototype:'Classes may not have static property named prototype',MissingFromClause:'Unexpected token',NoAsAfterImportNamespace:'Unexpected token',InvalidModuleSpecifier:'Unexpected token',IllegalImportDeclaration:'Unexpected token',IllegalExportDeclaration:'Unexpected token',DuplicateBinding:'Duplicate binding %0'};// See also tools/generate-unicode-regex.js.
7072Regex={// ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierStart:
7073NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDE00-\uDE11\uDE13-\uDE2B\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDE00-\uDE2F\uDE44\uDE80-\uDEAA]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]/,// ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierPart:
7074NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDD0-\uDDDA\uDE00-\uDE11\uDE13-\uDE37\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF01-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/};// Ensure the condition is true, otherwise throw an error.
7075// This is only to have a better contract semantic, i.e. another safety net
7076// to catch a logic error. The condition shall be fulfilled in normal case.
7077// Do NOT use this to enforce a certain condition on any user input.
7078function assert(condition,message){/* istanbul ignore if */if(!condition){throw new Error('ASSERT: '+message);}}function isDecimalDigit(ch){return ch>=0x30&&ch<=0x39;// 0..9
7079}function isHexDigit(ch){return'0123456789abcdefABCDEF'.indexOf(ch)>=0;}function isOctalDigit(ch){return'01234567'.indexOf(ch)>=0;}function octalToDecimal(ch){// \0 is not octal escape sequence
7080var octal=ch!=='0',code='01234567'.indexOf(ch);if(index<length&&isOctalDigit(source[index])){octal=true;code=code*8+'01234567'.indexOf(source[index++]);// 3 digits are only allowed when string starts
7081// with 0, 1, 2, 3
7082if('0123'.indexOf(ch)>=0&&index<length&&isOctalDigit(source[index])){code=code*8+'01234567'.indexOf(source[index++]);}}return{code:code,octal:octal};}// ECMA-262 11.2 White Space
7083function isWhiteSpace(ch){return ch===0x20||ch===0x09||ch===0x0B||ch===0x0C||ch===0xA0||ch>=0x1680&&[0x1680,0x180E,0x2000,0x2001,0x2002,0x2003,0x2004,0x2005,0x2006,0x2007,0x2008,0x2009,0x200A,0x202F,0x205F,0x3000,0xFEFF].indexOf(ch)>=0;}// ECMA-262 11.3 Line Terminators
7084function isLineTerminator(ch){return ch===0x0A||ch===0x0D||ch===0x2028||ch===0x2029;}// ECMA-262 11.6 Identifier Names and Identifiers
7085function fromCodePoint(cp){return cp<0x10000?String.fromCharCode(cp):String.fromCharCode(0xD800+(cp-0x10000>>10))+String.fromCharCode(0xDC00+(cp-0x10000&1023));}function isIdentifierStart(ch){return ch===0x24||ch===0x5F||// $ (dollar) and _ (underscore)
7086ch>=0x41&&ch<=0x5A||// A..Z
7087ch>=0x61&&ch<=0x7A||// a..z
7088ch===0x5C||// \ (backslash)
7089ch>=0x80&&Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));}function isIdentifierPart(ch){return ch===0x24||ch===0x5F||// $ (dollar) and _ (underscore)
7090ch>=0x41&&ch<=0x5A||// A..Z
7091ch>=0x61&&ch<=0x7A||// a..z
7092ch>=0x30&&ch<=0x39||// 0..9
7093ch===0x5C||// \ (backslash)
7094ch>=0x80&&Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));}// ECMA-262 11.6.2.2 Future Reserved Words
7095function isFutureReservedWord(id){switch(id){case'enum':case'export':case'import':case'super':return true;default:return false;}}function isStrictModeReservedWord(id){switch(id){case'implements':case'interface':case'package':case'private':case'protected':case'public':case'static':case'yield':case'let':return true;default:return false;}}function isRestrictedWord(id){return id==='eval'||id==='arguments';}// ECMA-262 11.6.2.1 Keywords
7096function isKeyword(id){switch(id.length){case 2:return id==='if'||id==='in'||id==='do';case 3:return id==='var'||id==='for'||id==='new'||id==='try'||id==='let';case 4:return id==='this'||id==='else'||id==='case'||id==='void'||id==='with'||id==='enum';case 5:return id==='while'||id==='break'||id==='catch'||id==='throw'||id==='const'||id==='yield'||id==='class'||id==='super';case 6:return id==='return'||id==='typeof'||id==='delete'||id==='switch'||id==='export'||id==='import';case 7:return id==='default'||id==='finally'||id==='extends';case 8:return id==='function'||id==='continue'||id==='debugger';case 10:return id==='instanceof';default:return false;}}// ECMA-262 11.4 Comments
7097function addComment(type,value,start,end,loc){var comment;assert(typeof start==='number','Comment must have valid position');state.lastCommentStart=start;comment={type:type,value:value};if(extra.range){comment.range=[start,end];}if(extra.loc){comment.loc=loc;}extra.comments.push(comment);if(extra.attachComment){extra.leadingComments.push(comment);extra.trailingComments.push(comment);}if(extra.tokenize){comment.type=comment.type+'Comment';if(extra.delegate){comment=extra.delegate(comment);}extra.tokens.push(comment);}}function skipSingleLineComment(offset){var start,loc,ch,comment;start=index-offset;loc={start:{line:lineNumber,column:index-lineStart-offset}};while(index<length){ch=source.charCodeAt(index);++index;if(isLineTerminator(ch)){hasLineTerminator=true;if(extra.comments){comment=source.slice(start+offset,index-1);loc.end={line:lineNumber,column:index-lineStart-1};addComment('Line',comment,start,index-1,loc);}if(ch===13&&source.charCodeAt(index)===10){++index;}++lineNumber;lineStart=index;return;}}if(extra.comments){comment=source.slice(start+offset,index);loc.end={line:lineNumber,column:index-lineStart};addComment('Line',comment,start,index,loc);}}function skipMultiLineComment(){var start,loc,ch,comment;if(extra.comments){start=index-2;loc={start:{line:lineNumber,column:index-lineStart-2}};}while(index<length){ch=source.charCodeAt(index);if(isLineTerminator(ch)){if(ch===0x0D&&source.charCodeAt(index+1)===0x0A){++index;}hasLineTerminator=true;++lineNumber;++index;lineStart=index;}else if(ch===0x2A){// Block comment ends with '*/'.
7098if(source.charCodeAt(index+1)===0x2F){++index;++index;if(extra.comments){comment=source.slice(start+2,index-2);loc.end={line:lineNumber,column:index-lineStart};addComment('Block',comment,start,index,loc);}return;}++index;}else{++index;}}// Ran off the end of the file - the whole thing is a comment
7099if(extra.comments){loc.end={line:lineNumber,column:index-lineStart};comment=source.slice(start+2,index);addComment('Block',comment,start,index,loc);}tolerateUnexpectedToken();}function skipComment(){var ch,start;hasLineTerminator=false;start=index===0;while(index<length){ch=source.charCodeAt(index);if(isWhiteSpace(ch)){++index;}else if(isLineTerminator(ch)){hasLineTerminator=true;++index;if(ch===0x0D&&source.charCodeAt(index)===0x0A){++index;}++lineNumber;lineStart=index;start=true;}else if(ch===0x2F){// U+002F is '/'
7100ch=source.charCodeAt(index+1);if(ch===0x2F){++index;++index;skipSingleLineComment(2);start=true;}else if(ch===0x2A){// U+002A is '*'
7101++index;++index;skipMultiLineComment();}else{break;}}else if(start&&ch===0x2D){// U+002D is '-'
7102// U+003E is '>'
7103if(source.charCodeAt(index+1)===0x2D&&source.charCodeAt(index+2)===0x3E){// '-->' is a single-line comment
7104index+=3;skipSingleLineComment(3);}else{break;}}else if(ch===0x3C){// U+003C is '<'
7105if(source.slice(index+1,index+4)==='!--'){++index;// `<`
7106++index;// `!`
7107++index;// `-`
7108++index;// `-`
7109skipSingleLineComment(4);}else{break;}}else{break;}}}function scanHexEscape(prefix){var i,len,ch,code=0;len=prefix==='u'?4:2;for(i=0;i<len;++i){if(index<length&&isHexDigit(source[index])){ch=source[index++];code=code*16+'0123456789abcdef'.indexOf(ch.toLowerCase());}else{return'';}}return String.fromCharCode(code);}function scanUnicodeCodePointEscape(){var ch,code;ch=source[index];code=0;// At least, one hex digit is required.
7110if(ch==='}'){throwUnexpectedToken();}while(index<length){ch=source[index++];if(!isHexDigit(ch)){break;}code=code*16+'0123456789abcdef'.indexOf(ch.toLowerCase());}if(code>0x10FFFF||ch!=='}'){throwUnexpectedToken();}return fromCodePoint(code);}function codePointAt(i){var cp,first,second;cp=source.charCodeAt(i);if(cp>=0xD800&&cp<=0xDBFF){second=source.charCodeAt(i+1);if(second>=0xDC00&&second<=0xDFFF){first=cp;cp=(first-0xD800)*0x400+second-0xDC00+0x10000;}}return cp;}function getComplexIdentifier(){var cp,ch,id;cp=codePointAt(index);id=fromCodePoint(cp);index+=id.length;// '\u' (U+005C, U+0075) denotes an escaped character.
7111if(cp===0x5C){if(source.charCodeAt(index)!==0x75){throwUnexpectedToken();}++index;if(source[index]==='{'){++index;ch=scanUnicodeCodePointEscape();}else{ch=scanHexEscape('u');cp=ch.charCodeAt(0);if(!ch||ch==='\\'||!isIdentifierStart(cp)){throwUnexpectedToken();}}id=ch;}while(index<length){cp=codePointAt(index);if(!isIdentifierPart(cp)){break;}ch=fromCodePoint(cp);id+=ch;index+=ch.length;// '\u' (U+005C, U+0075) denotes an escaped character.
7112if(cp===0x5C){id=id.substr(0,id.length-1);if(source.charCodeAt(index)!==0x75){throwUnexpectedToken();}++index;if(source[index]==='{'){++index;ch=scanUnicodeCodePointEscape();}else{ch=scanHexEscape('u');cp=ch.charCodeAt(0);if(!ch||ch==='\\'||!isIdentifierPart(cp)){throwUnexpectedToken();}}id+=ch;}}return id;}function getIdentifier(){var start,ch;start=index++;while(index<length){ch=source.charCodeAt(index);if(ch===0x5C){// Blackslash (U+005C) marks Unicode escape sequence.
7113index=start;return getComplexIdentifier();}else if(ch>=0xD800&&ch<0xDFFF){// Need to handle surrogate pairs.
7114index=start;return getComplexIdentifier();}if(isIdentifierPart(ch)){++index;}else{break;}}return source.slice(start,index);}function scanIdentifier(){var start,id,type;start=index;// Backslash (U+005C) starts an escaped character.
7115id=source.charCodeAt(index)===0x5C?getComplexIdentifier():getIdentifier();// There is no keyword or literal with only one character.
7116// Thus, it must be an identifier.
7117if(id.length===1){type=Token.Identifier;}else if(isKeyword(id)){type=Token.Keyword;}else if(id==='null'){type=Token.NullLiteral;}else if(id==='true'||id==='false'){type=Token.BooleanLiteral;}else{type=Token.Identifier;}return{type:type,value:id,lineNumber:lineNumber,lineStart:lineStart,start:start,end:index};}// ECMA-262 11.7 Punctuators
7118function scanPunctuator(){var token,str;token={type:Token.Punctuator,value:'',lineNumber:lineNumber,lineStart:lineStart,start:index,end:index};// Check for most common single-character punctuators.
7119str=source[index];switch(str){case'(':if(extra.tokenize){extra.openParenToken=extra.tokenValues.length;}++index;break;case'{':if(extra.tokenize){extra.openCurlyToken=extra.tokenValues.length;}state.curlyStack.push('{');++index;break;case'.':++index;if(source[index]==='.'&&source[index+1]==='.'){// Spread operator: ...
7120index+=2;str='...';}break;case'}':++index;state.curlyStack.pop();break;case')':case';':case',':case'[':case']':case':':case'?':case'~':++index;break;default:// 4-character punctuator.
7121str=source.substr(index,4);if(str==='>>>='){index+=4;}else{// 3-character punctuators.
7122str=str.substr(0,3);if(str==='==='||str==='!=='||str==='>>>'||str==='<<='||str==='>>='){index+=3;}else{// 2-character punctuators.
7123str=str.substr(0,2);if(str==='&&'||str==='||'||str==='=='||str==='!='||str==='+='||str==='-='||str==='*='||str==='/='||str==='++'||str==='--'||str==='<<'||str==='>>'||str==='&='||str==='|='||str==='^='||str==='%='||str==='<='||str==='>='||str==='=>'){index+=2;}else{// 1-character punctuators.
7124str=source[index];if('<>=!+-*%&|^/'.indexOf(str)>=0){++index;}}}}}if(index===token.start){throwUnexpectedToken();}token.end=index;token.value=str;return token;}// ECMA-262 11.8.3 Numeric Literals
7125function scanHexLiteral(start){var number='';while(index<length){if(!isHexDigit(source[index])){break;}number+=source[index++];}if(number.length===0){throwUnexpectedToken();}if(isIdentifierStart(source.charCodeAt(index))){throwUnexpectedToken();}return{type:Token.NumericLiteral,value:parseInt('0x'+number,16),lineNumber:lineNumber,lineStart:lineStart,start:start,end:index};}function scanBinaryLiteral(start){var ch,number;number='';while(index<length){ch=source[index];if(ch!=='0'&&ch!=='1'){break;}number+=source[index++];}if(number.length===0){// only 0b or 0B
7126throwUnexpectedToken();}if(index<length){ch=source.charCodeAt(index);/* istanbul ignore else */if(isIdentifierStart(ch)||isDecimalDigit(ch)){throwUnexpectedToken();}}return{type:Token.NumericLiteral,value:parseInt(number,2),lineNumber:lineNumber,lineStart:lineStart,start:start,end:index};}function scanOctalLiteral(prefix,start){var number,octal;if(isOctalDigit(prefix)){octal=true;number='0'+source[index++];}else{octal=false;++index;number='';}while(index<length){if(!isOctalDigit(source[index])){break;}number+=source[index++];}if(!octal&&number.length===0){// only 0o or 0O
7127throwUnexpectedToken();}if(isIdentifierStart(source.charCodeAt(index))||isDecimalDigit(source.charCodeAt(index))){throwUnexpectedToken();}return{type:Token.NumericLiteral,value:parseInt(number,8),octal:octal,lineNumber:lineNumber,lineStart:lineStart,start:start,end:index};}function isImplicitOctalLiteral(){var i,ch;// Implicit octal, unless there is a non-octal digit.
7128// (Annex B.1.1 on Numeric Literals)
7129for(i=index+1;i<length;++i){ch=source[i];if(ch==='8'||ch==='9'){return false;}if(!isOctalDigit(ch)){return true;}}return true;}function scanNumericLiteral(){var number,start,ch;ch=source[index];assert(isDecimalDigit(ch.charCodeAt(0))||ch==='.','Numeric literal must start with a decimal digit or a decimal point');start=index;number='';if(ch!=='.'){number=source[index++];ch=source[index];// Hex number starts with '0x'.
7130// Octal number starts with '0'.
7131// Octal number in ES6 starts with '0o'.
7132// Binary number in ES6 starts with '0b'.
7133if(number==='0'){if(ch==='x'||ch==='X'){++index;return scanHexLiteral(start);}if(ch==='b'||ch==='B'){++index;return scanBinaryLiteral(start);}if(ch==='o'||ch==='O'){return scanOctalLiteral(ch,start);}if(isOctalDigit(ch)){if(isImplicitOctalLiteral()){return scanOctalLiteral(ch,start);}}}while(isDecimalDigit(source.charCodeAt(index))){number+=source[index++];}ch=source[index];}if(ch==='.'){number+=source[index++];while(isDecimalDigit(source.charCodeAt(index))){number+=source[index++];}ch=source[index];}if(ch==='e'||ch==='E'){number+=source[index++];ch=source[index];if(ch==='+'||ch==='-'){number+=source[index++];}if(isDecimalDigit(source.charCodeAt(index))){while(isDecimalDigit(source.charCodeAt(index))){number+=source[index++];}}else{throwUnexpectedToken();}}if(isIdentifierStart(source.charCodeAt(index))){throwUnexpectedToken();}return{type:Token.NumericLiteral,value:parseFloat(number),lineNumber:lineNumber,lineStart:lineStart,start:start,end:index};}// ECMA-262 11.8.4 String Literals
7134function scanStringLiteral(){var str='',quote,start,ch,unescaped,octToDec,octal=false;quote=source[index];assert(quote==='\''||quote==='"','String literal must starts with a quote');start=index;++index;while(index<length){ch=source[index++];if(ch===quote){quote='';break;}else if(ch==='\\'){ch=source[index++];if(!ch||!isLineTerminator(ch.charCodeAt(0))){switch(ch){case'u':case'x':if(source[index]==='{'){++index;str+=scanUnicodeCodePointEscape();}else{unescaped=scanHexEscape(ch);if(!unescaped){throw throwUnexpectedToken();}str+=unescaped;}break;case'n':str+='\n';break;case'r':str+='\r';break;case't':str+='\t';break;case'b':str+='\b';break;case'f':str+='\f';break;case'v':str+='\x0B';break;case'8':case'9':str+=ch;tolerateUnexpectedToken();break;default:if(isOctalDigit(ch)){octToDec=octalToDecimal(ch);octal=octToDec.octal||octal;str+=String.fromCharCode(octToDec.code);}else{str+=ch;}break;}}else{++lineNumber;if(ch==='\r'&&source[index]==='\n'){++index;}lineStart=index;}}else if(isLineTerminator(ch.charCodeAt(0))){break;}else{str+=ch;}}if(quote!==''){index=start;throwUnexpectedToken();}return{type:Token.StringLiteral,value:str,octal:octal,lineNumber:startLineNumber,lineStart:startLineStart,start:start,end:index};}// ECMA-262 11.8.6 Template Literal Lexical Components
7135function scanTemplate(){var cooked='',ch,start,rawOffset,terminated,head,tail,restore,unescaped;terminated=false;tail=false;start=index;head=source[index]==='`';rawOffset=2;++index;while(index<length){ch=source[index++];if(ch==='`'){rawOffset=1;tail=true;terminated=true;break;}else if(ch==='$'){if(source[index]==='{'){state.curlyStack.push('${');++index;terminated=true;break;}cooked+=ch;}else if(ch==='\\'){ch=source[index++];if(!isLineTerminator(ch.charCodeAt(0))){switch(ch){case'n':cooked+='\n';break;case'r':cooked+='\r';break;case't':cooked+='\t';break;case'u':case'x':if(source[index]==='{'){++index;cooked+=scanUnicodeCodePointEscape();}else{restore=index;unescaped=scanHexEscape(ch);if(unescaped){cooked+=unescaped;}else{index=restore;cooked+=ch;}}break;case'b':cooked+='\b';break;case'f':cooked+='\f';break;case'v':cooked+='\v';break;default:if(ch==='0'){if(isDecimalDigit(source.charCodeAt(index))){// Illegal: \01 \02 and so on
7136throwError(Messages.TemplateOctalLiteral);}cooked+='\0';}else if(isOctalDigit(ch)){// Illegal: \1 \2
7137throwError(Messages.TemplateOctalLiteral);}else{cooked+=ch;}break;}}else{++lineNumber;if(ch==='\r'&&source[index]==='\n'){++index;}lineStart=index;}}else if(isLineTerminator(ch.charCodeAt(0))){++lineNumber;if(ch==='\r'&&source[index]==='\n'){++index;}lineStart=index;cooked+='\n';}else{cooked+=ch;}}if(!terminated){throwUnexpectedToken();}if(!head){state.curlyStack.pop();}return{type:Token.Template,value:{cooked:cooked,raw:source.slice(start+1,index-rawOffset)},head:head,tail:tail,lineNumber:lineNumber,lineStart:lineStart,start:start,end:index};}// ECMA-262 11.8.5 Regular Expression Literals
7138function testRegExp(pattern,flags){// The BMP character to use as a replacement for astral symbols when
7139// translating an ES6 "u"-flagged pattern to an ES5-compatible
7140// approximation.
7141// Note: replacing with '\uFFFF' enables false positives in unlikely
7142// scenarios. For example, `[\u{1044f}-\u{10440}]` is an invalid
7143// pattern that would not be detected by this substitution.
7144var astralSubstitute="￿",tmp=pattern;if(flags.indexOf('u')>=0){tmp=tmp// Replace every Unicode escape sequence with the equivalent
7145// BMP character or a constant ASCII code point in the case of
7146// astral symbols. (See the above note on `astralSubstitute`
7147// for more information.)
7148.replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g,function($0,$1,$2){var codePoint=parseInt($1||$2,16);if(codePoint>0x10FFFF){throwUnexpectedToken(null,Messages.InvalidRegExp);}if(codePoint<=0xFFFF){return String.fromCharCode(codePoint);}return astralSubstitute;})// Replace each paired surrogate with a single ASCII symbol to
7149// avoid throwing on regular expressions that are only valid in
7150// combination with the "u" flag.
7151.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,astralSubstitute);}// First, detect invalid regular expressions.
7152try{RegExp(tmp);}catch(e){throwUnexpectedToken(null,Messages.InvalidRegExp);}// Return a regular expression object for this pattern-flag pair, or
7153// `null` in case the current environment doesn't support the flags it
7154// uses.
7155try{return new RegExp(pattern,flags);}catch(exception){return null;}}function scanRegExpBody(){var ch,str,classMarker,terminated,body;ch=source[index];assert(ch==='/','Regular expression literal must start with a slash');str=source[index++];classMarker=false;terminated=false;while(index<length){ch=source[index++];str+=ch;if(ch==='\\'){ch=source[index++];// ECMA-262 7.8.5
7156if(isLineTerminator(ch.charCodeAt(0))){throwUnexpectedToken(null,Messages.UnterminatedRegExp);}str+=ch;}else if(isLineTerminator(ch.charCodeAt(0))){throwUnexpectedToken(null,Messages.UnterminatedRegExp);}else if(classMarker){if(ch===']'){classMarker=false;}}else{if(ch==='/'){terminated=true;break;}else if(ch==='['){classMarker=true;}}}if(!terminated){throwUnexpectedToken(null,Messages.UnterminatedRegExp);}// Exclude leading and trailing slash.
7157body=str.substr(1,str.length-2);return{value:body,literal:str};}function scanRegExpFlags(){var ch,str,flags,restore;str='';flags='';while(index<length){ch=source[index];if(!isIdentifierPart(ch.charCodeAt(0))){break;}++index;if(ch==='\\'&&index<length){ch=source[index];if(ch==='u'){++index;restore=index;ch=scanHexEscape('u');if(ch){flags+=ch;for(str+="\\u";restore<index;++restore){str+=source[restore];}}else{index=restore;flags+='u';str+="\\u";}tolerateUnexpectedToken();}else{str+='\\';tolerateUnexpectedToken();}}else{flags+=ch;str+=ch;}}return{value:flags,literal:str};}function scanRegExp(){var start,body,flags,value;scanning=true;lookahead=null;skipComment();start=index;body=scanRegExpBody();flags=scanRegExpFlags();value=testRegExp(body.value,flags.value);scanning=false;if(extra.tokenize){return{type:Token.RegularExpression,value:value,regex:{pattern:body.value,flags:flags.value},lineNumber:lineNumber,lineStart:lineStart,start:start,end:index};}return{literal:body.literal+flags.literal,value:value,regex:{pattern:body.value,flags:flags.value},start:start,end:index};}function collectRegex(){var pos,loc,regex,token;skipComment();pos=index;loc={start:{line:lineNumber,column:index-lineStart}};regex=scanRegExp();loc.end={line:lineNumber,column:index-lineStart};/* istanbul ignore next */if(!extra.tokenize){// Pop the previous token, which is likely '/' or '/='
7158if(extra.tokens.length>0){token=extra.tokens[extra.tokens.length-1];if(token.range[0]===pos&&token.type==='Punctuator'){if(token.value==='/'||token.value==='/='){extra.tokens.pop();}}}extra.tokens.push({type:'RegularExpression',value:regex.literal,regex:regex.regex,range:[pos,index],loc:loc});}return regex;}function isIdentifierName(token){return token.type===Token.Identifier||token.type===Token.Keyword||token.type===Token.BooleanLiteral||token.type===Token.NullLiteral;}// Using the following algorithm:
7159// https://github.com/mozilla/sweet.js/wiki/design
7160function advanceSlash(){var regex,previous,check;function testKeyword(value){return value&&value.length>1&&value[0]>='a'&&value[0]<='z';}previous=extra.tokenValues[extra.tokens.length-1];regex=previous!==null;switch(previous){case'this':case']':regex=false;break;case')':check=extra.tokenValues[extra.openParenToken-1];regex=check==='if'||check==='while'||check==='for'||check==='with';break;case'}':// Dividing a function by anything makes little sense,
7161// but we have to check for that.
7162regex=false;if(testKeyword(extra.tokenValues[extra.openCurlyToken-3])){// Anonymous function, e.g. function(){} /42
7163check=extra.tokenValues[extra.openCurlyToken-4];regex=check?FnExprTokens.indexOf(check)<0:false;}else if(testKeyword(extra.tokenValues[extra.openCurlyToken-4])){// Named function, e.g. function f(){} /42/
7164check=extra.tokenValues[extra.openCurlyToken-5];regex=check?FnExprTokens.indexOf(check)<0:true;}}return regex?collectRegex():scanPunctuator();}function advance(){var cp,token;if(index>=length){return{type:Token.EOF,lineNumber:lineNumber,lineStart:lineStart,start:index,end:index};}cp=source.charCodeAt(index);if(isIdentifierStart(cp)){token=scanIdentifier();if(strict&&isStrictModeReservedWord(token.value)){token.type=Token.Keyword;}return token;}// Very common: ( and ) and ;
7165if(cp===0x28||cp===0x29||cp===0x3B){return scanPunctuator();}// String literal starts with single quote (U+0027) or double quote (U+0022).
7166if(cp===0x27||cp===0x22){return scanStringLiteral();}// Dot (.) U+002E can also start a floating-point number, hence the need
7167// to check the next character.
7168if(cp===0x2E){if(isDecimalDigit(source.charCodeAt(index+1))){return scanNumericLiteral();}return scanPunctuator();}if(isDecimalDigit(cp)){return scanNumericLiteral();}// Slash (/) U+002F can also start a regex.
7169if(extra.tokenize&&cp===0x2F){return advanceSlash();}// Template literals start with ` (U+0060) for template head
7170// or } (U+007D) for template middle or template tail.
7171if(cp===0x60||cp===0x7D&&state.curlyStack[state.curlyStack.length-1]==='${'){return scanTemplate();}// Possible identifier start in a surrogate pair.
7172if(cp>=0xD800&&cp<0xDFFF){cp=codePointAt(index);if(isIdentifierStart(cp)){return scanIdentifier();}}return scanPunctuator();}function collectToken(){var loc,token,value,entry;loc={start:{line:lineNumber,column:index-lineStart}};token=advance();loc.end={line:lineNumber,column:index-lineStart};if(token.type!==Token.EOF){value=source.slice(token.start,token.end);entry={type:TokenName[token.type],value:value,range:[token.start,token.end],loc:loc};if(token.regex){entry.regex={pattern:token.regex.pattern,flags:token.regex.flags};}if(extra.tokenValues){extra.tokenValues.push(entry.type==='Punctuator'||entry.type==='Keyword'?entry.value:null);}if(extra.tokenize){if(!extra.range){delete entry.range;}if(!extra.loc){delete entry.loc;}if(extra.delegate){entry=extra.delegate(entry);}}extra.tokens.push(entry);}return token;}function lex(){var token;scanning=true;lastIndex=index;lastLineNumber=lineNumber;lastLineStart=lineStart;skipComment();token=lookahead;startIndex=index;startLineNumber=lineNumber;startLineStart=lineStart;lookahead=typeof extra.tokens!=='undefined'?collectToken():advance();scanning=false;return token;}function peek(){scanning=true;skipComment();lastIndex=index;lastLineNumber=lineNumber;lastLineStart=lineStart;startIndex=index;startLineNumber=lineNumber;startLineStart=lineStart;lookahead=typeof extra.tokens!=='undefined'?collectToken():advance();scanning=false;}function Position(){this.line=startLineNumber;this.column=startIndex-startLineStart;}function SourceLocation(){this.start=new Position();this.end=null;}function WrappingSourceLocation(startToken){this.start={line:startToken.lineNumber,column:startToken.start-startToken.lineStart};this.end=null;}function Node(){if(extra.range){this.range=[startIndex,0];}if(extra.loc){this.loc=new SourceLocation();}}function WrappingNode(startToken){if(extra.range){this.range=[startToken.start,0];}if(extra.loc){this.loc=new WrappingSourceLocation(startToken);}}WrappingNode.prototype=Node.prototype={processComment:function processComment(){var lastChild,innerComments,leadingComments,trailingComments,bottomRight=extra.bottomRightStack,i,comment,last=bottomRight[bottomRight.length-1];if(this.type===Syntax.Program){if(this.body.length>0){return;}}/**
7173 * patch innnerComments for properties empty block
7174 * `function a() {/** comments **\/}`
7175 */if(this.type===Syntax.BlockStatement&&this.body.length===0){innerComments=[];for(i=extra.leadingComments.length-1;i>=0;--i){comment=extra.leadingComments[i];if(this.range[1]>=comment.range[1]){innerComments.unshift(comment);extra.leadingComments.splice(i,1);extra.trailingComments.splice(i,1);}}if(innerComments.length){this.innerComments=innerComments;//bottomRight.push(this);
7176return;}}if(extra.trailingComments.length>0){trailingComments=[];for(i=extra.trailingComments.length-1;i>=0;--i){comment=extra.trailingComments[i];if(comment.range[0]>=this.range[1]){trailingComments.unshift(comment);extra.trailingComments.splice(i,1);}}extra.trailingComments=[];}else{if(last&&last.trailingComments&&last.trailingComments[0].range[0]>=this.range[1]){trailingComments=last.trailingComments;delete last.trailingComments;}}// Eating the stack.
7177while(last&&last.range[0]>=this.range[0]){lastChild=bottomRight.pop();last=bottomRight[bottomRight.length-1];}if(lastChild){if(lastChild.leadingComments){leadingComments=[];for(i=lastChild.leadingComments.length-1;i>=0;--i){comment=lastChild.leadingComments[i];if(comment.range[1]<=this.range[0]){leadingComments.unshift(comment);lastChild.leadingComments.splice(i,1);}}if(!lastChild.leadingComments.length){lastChild.leadingComments=undefined;}}}else if(extra.leadingComments.length>0){leadingComments=[];for(i=extra.leadingComments.length-1;i>=0;--i){comment=extra.leadingComments[i];if(comment.range[1]<=this.range[0]){leadingComments.unshift(comment);extra.leadingComments.splice(i,1);}}}if(leadingComments&&leadingComments.length>0){this.leadingComments=leadingComments;}if(trailingComments&&trailingComments.length>0){this.trailingComments=trailingComments;}bottomRight.push(this);},finish:function finish(){if(extra.range){this.range[1]=lastIndex;}if(extra.loc){this.loc.end={line:lastLineNumber,column:lastIndex-lastLineStart};if(extra.source){this.loc.source=extra.source;}}if(extra.attachComment){this.processComment();}},finishArrayExpression:function finishArrayExpression(elements){this.type=Syntax.ArrayExpression;this.elements=elements;this.finish();return this;},finishArrayPattern:function finishArrayPattern(elements){this.type=Syntax.ArrayPattern;this.elements=elements;this.finish();return this;},finishArrowFunctionExpression:function finishArrowFunctionExpression(params,defaults,body,expression){this.type=Syntax.ArrowFunctionExpression;this.id=null;this.params=params;this.defaults=defaults;this.body=body;this.generator=false;this.expression=expression;this.finish();return this;},finishAssignmentExpression:function finishAssignmentExpression(operator,left,right){this.type=Syntax.AssignmentExpression;this.operator=operator;this.left=left;this.right=right;this.finish();return this;},finishAssignmentPattern:function finishAssignmentPattern(left,right){this.type=Syntax.AssignmentPattern;this.left=left;this.right=right;this.finish();return this;},finishBinaryExpression:function finishBinaryExpression(operator,left,right){this.type=operator==='||'||operator==='&&'?Syntax.LogicalExpression:Syntax.BinaryExpression;this.operator=operator;this.left=left;this.right=right;this.finish();return this;},finishBlockStatement:function finishBlockStatement(body){this.type=Syntax.BlockStatement;this.body=body;this.finish();return this;},finishBreakStatement:function finishBreakStatement(label){this.type=Syntax.BreakStatement;this.label=label;this.finish();return this;},finishCallExpression:function finishCallExpression(callee,args){this.type=Syntax.CallExpression;this.callee=callee;this.arguments=args;this.finish();return this;},finishCatchClause:function finishCatchClause(param,body){this.type=Syntax.CatchClause;this.param=param;this.body=body;this.finish();return this;},finishClassBody:function finishClassBody(body){this.type=Syntax.ClassBody;this.body=body;this.finish();return this;},finishClassDeclaration:function finishClassDeclaration(id,superClass,body){this.type=Syntax.ClassDeclaration;this.id=id;this.superClass=superClass;this.body=body;this.finish();return this;},finishClassExpression:function finishClassExpression(id,superClass,body){this.type=Syntax.ClassExpression;this.id=id;this.superClass=superClass;this.body=body;this.finish();return this;},finishConditionalExpression:function finishConditionalExpression(test,consequent,alternate){this.type=Syntax.ConditionalExpression;this.test=test;this.consequent=consequent;this.alternate=alternate;this.finish();return this;},finishContinueStatement:function finishContinueStatement(label){this.type=Syntax.ContinueStatement;this.label=label;this.finish();return this;},finishDebuggerStatement:function finishDebuggerStatement(){this.type=Syntax.DebuggerStatement;this.finish();return this;},finishDoWhileStatement:function finishDoWhileStatement(body,test){this.type=Syntax.DoWhileStatement;this.body=body;this.test=test;this.finish();return this;},finishEmptyStatement:function finishEmptyStatement(){this.type=Syntax.EmptyStatement;this.finish();return this;},finishExpressionStatement:function finishExpressionStatement(expression){this.type=Syntax.ExpressionStatement;this.expression=expression;this.finish();return this;},finishForStatement:function finishForStatement(init,test,update,body){this.type=Syntax.ForStatement;this.init=init;this.test=test;this.update=update;this.body=body;this.finish();return this;},finishForOfStatement:function finishForOfStatement(left,right,body){this.type=Syntax.ForOfStatement;this.left=left;this.right=right;this.body=body;this.finish();return this;},finishForInStatement:function finishForInStatement(left,right,body){this.type=Syntax.ForInStatement;this.left=left;this.right=right;this.body=body;this.each=false;this.finish();return this;},finishFunctionDeclaration:function finishFunctionDeclaration(id,params,defaults,body,generator){this.type=Syntax.FunctionDeclaration;this.id=id;this.params=params;this.defaults=defaults;this.body=body;this.generator=generator;this.expression=false;this.finish();return this;},finishFunctionExpression:function finishFunctionExpression(id,params,defaults,body,generator){this.type=Syntax.FunctionExpression;this.id=id;this.params=params;this.defaults=defaults;this.body=body;this.generator=generator;this.expression=false;this.finish();return this;},finishIdentifier:function finishIdentifier(name){this.type=Syntax.Identifier;this.name=name;this.finish();return this;},finishIfStatement:function finishIfStatement(test,consequent,alternate){this.type=Syntax.IfStatement;this.test=test;this.consequent=consequent;this.alternate=alternate;this.finish();return this;},finishLabeledStatement:function finishLabeledStatement(label,body){this.type=Syntax.LabeledStatement;this.label=label;this.body=body;this.finish();return this;},finishLiteral:function finishLiteral(token){this.type=Syntax.Literal;this.value=token.value;this.raw=source.slice(token.start,token.end);if(token.regex){this.regex=token.regex;}this.finish();return this;},finishMemberExpression:function finishMemberExpression(accessor,object,property){this.type=Syntax.MemberExpression;this.computed=accessor==='[';this.object=object;this.property=property;this.finish();return this;},finishMetaProperty:function finishMetaProperty(meta,property){this.type=Syntax.MetaProperty;this.meta=meta;this.property=property;this.finish();return this;},finishNewExpression:function finishNewExpression(callee,args){this.type=Syntax.NewExpression;this.callee=callee;this.arguments=args;this.finish();return this;},finishObjectExpression:function finishObjectExpression(properties){this.type=Syntax.ObjectExpression;this.properties=properties;this.finish();return this;},finishObjectPattern:function finishObjectPattern(properties){this.type=Syntax.ObjectPattern;this.properties=properties;this.finish();return this;},finishPostfixExpression:function finishPostfixExpression(operator,argument){this.type=Syntax.UpdateExpression;this.operator=operator;this.argument=argument;this.prefix=false;this.finish();return this;},finishProgram:function finishProgram(body,sourceType){this.type=Syntax.Program;this.body=body;this.sourceType=sourceType;this.finish();return this;},finishProperty:function finishProperty(kind,key,computed,value,method,shorthand){this.type=Syntax.Property;this.key=key;this.computed=computed;this.value=value;this.kind=kind;this.method=method;this.shorthand=shorthand;this.finish();return this;},finishRestElement:function finishRestElement(argument){this.type=Syntax.RestElement;this.argument=argument;this.finish();return this;},finishReturnStatement:function finishReturnStatement(argument){this.type=Syntax.ReturnStatement;this.argument=argument;this.finish();return this;},finishSequenceExpression:function finishSequenceExpression(expressions){this.type=Syntax.SequenceExpression;this.expressions=expressions;this.finish();return this;},finishSpreadElement:function finishSpreadElement(argument){this.type=Syntax.SpreadElement;this.argument=argument;this.finish();return this;},finishSwitchCase:function finishSwitchCase(test,consequent){this.type=Syntax.SwitchCase;this.test=test;this.consequent=consequent;this.finish();return this;},finishSuper:function finishSuper(){this.type=Syntax.Super;this.finish();return this;},finishSwitchStatement:function finishSwitchStatement(discriminant,cases){this.type=Syntax.SwitchStatement;this.discriminant=discriminant;this.cases=cases;this.finish();return this;},finishTaggedTemplateExpression:function finishTaggedTemplateExpression(tag,quasi){this.type=Syntax.TaggedTemplateExpression;this.tag=tag;this.quasi=quasi;this.finish();return this;},finishTemplateElement:function finishTemplateElement(value,tail){this.type=Syntax.TemplateElement;this.value=value;this.tail=tail;this.finish();return this;},finishTemplateLiteral:function finishTemplateLiteral(quasis,expressions){this.type=Syntax.TemplateLiteral;this.quasis=quasis;this.expressions=expressions;this.finish();return this;},finishThisExpression:function finishThisExpression(){this.type=Syntax.ThisExpression;this.finish();return this;},finishThrowStatement:function finishThrowStatement(argument){this.type=Syntax.ThrowStatement;this.argument=argument;this.finish();return this;},finishTryStatement:function finishTryStatement(block,handler,finalizer){this.type=Syntax.TryStatement;this.block=block;this.guardedHandlers=[];this.handlers=handler?[handler]:[];this.handler=handler;this.finalizer=finalizer;this.finish();return this;},finishUnaryExpression:function finishUnaryExpression(operator,argument){this.type=operator==='++'||operator==='--'?Syntax.UpdateExpression:Syntax.UnaryExpression;this.operator=operator;this.argument=argument;this.prefix=true;this.finish();return this;},finishVariableDeclaration:function finishVariableDeclaration(declarations){this.type=Syntax.VariableDeclaration;this.declarations=declarations;this.kind='var';this.finish();return this;},finishLexicalDeclaration:function finishLexicalDeclaration(declarations,kind){this.type=Syntax.VariableDeclaration;this.declarations=declarations;this.kind=kind;this.finish();return this;},finishVariableDeclarator:function finishVariableDeclarator(id,init){this.type=Syntax.VariableDeclarator;this.id=id;this.init=init;this.finish();return this;},finishWhileStatement:function finishWhileStatement(test,body){this.type=Syntax.WhileStatement;this.test=test;this.body=body;this.finish();return this;},finishWithStatement:function finishWithStatement(object,body){this.type=Syntax.WithStatement;this.object=object;this.body=body;this.finish();return this;},finishExportSpecifier:function finishExportSpecifier(local,exported){this.type=Syntax.ExportSpecifier;this.exported=exported||local;this.local=local;this.finish();return this;},finishImportDefaultSpecifier:function finishImportDefaultSpecifier(local){this.type=Syntax.ImportDefaultSpecifier;this.local=local;this.finish();return this;},finishImportNamespaceSpecifier:function finishImportNamespaceSpecifier(local){this.type=Syntax.ImportNamespaceSpecifier;this.local=local;this.finish();return this;},finishExportNamedDeclaration:function finishExportNamedDeclaration(declaration,specifiers,src){this.type=Syntax.ExportNamedDeclaration;this.declaration=declaration;this.specifiers=specifiers;this.source=src;this.finish();return this;},finishExportDefaultDeclaration:function finishExportDefaultDeclaration(declaration){this.type=Syntax.ExportDefaultDeclaration;this.declaration=declaration;this.finish();return this;},finishExportAllDeclaration:function finishExportAllDeclaration(src){this.type=Syntax.ExportAllDeclaration;this.source=src;this.finish();return this;},finishImportSpecifier:function finishImportSpecifier(local,imported){this.type=Syntax.ImportSpecifier;this.local=local||imported;this.imported=imported;this.finish();return this;},finishImportDeclaration:function finishImportDeclaration(specifiers,src){this.type=Syntax.ImportDeclaration;this.specifiers=specifiers;this.source=src;this.finish();return this;},finishYieldExpression:function finishYieldExpression(argument,delegate){this.type=Syntax.YieldExpression;this.argument=argument;this.delegate=delegate;this.finish();return this;}};function recordError(error){var e,existing;for(e=0;e<extra.errors.length;e++){existing=extra.errors[e];// Prevent duplicated error.
7178/* istanbul ignore next */if(existing.index===error.index&&existing.message===error.message){return;}}extra.errors.push(error);}function constructError(msg,column){var error=new Error(msg);try{throw error;}catch(base){/* istanbul ignore else */if(Object.create&&Object.defineProperty){error=Object.create(base);Object.defineProperty(error,'column',{value:column});}}finally{return error;}}function createError(line,pos,description){var msg,column,error;msg='Line '+line+': '+description;column=pos-(scanning?lineStart:lastLineStart)+1;error=constructError(msg,column);error.lineNumber=line;error.description=description;error.index=pos;return error;}// Throw an exception
7179function throwError(messageFormat){var args,msg;args=Array.prototype.slice.call(arguments,1);msg=messageFormat.replace(/%(\d)/g,function(whole,idx){assert(idx<args.length,'Message reference must be in range');return args[idx];});throw createError(lastLineNumber,lastIndex,msg);}function tolerateError(messageFormat){var args,msg,error;args=Array.prototype.slice.call(arguments,1);/* istanbul ignore next */msg=messageFormat.replace(/%(\d)/g,function(whole,idx){assert(idx<args.length,'Message reference must be in range');return args[idx];});error=createError(lineNumber,lastIndex,msg);if(extra.errors){recordError(error);}else{throw error;}}// Throw an exception because of the token.
7180function unexpectedTokenError(token,message){var value,msg=message||Messages.UnexpectedToken;if(token){if(!message){msg=token.type===Token.EOF?Messages.UnexpectedEOS:token.type===Token.Identifier?Messages.UnexpectedIdentifier:token.type===Token.NumericLiteral?Messages.UnexpectedNumber:token.type===Token.StringLiteral?Messages.UnexpectedString:token.type===Token.Template?Messages.UnexpectedTemplate:Messages.UnexpectedToken;if(token.type===Token.Keyword){if(isFutureReservedWord(token.value)){msg=Messages.UnexpectedReserved;}else if(strict&&isStrictModeReservedWord(token.value)){msg=Messages.StrictReservedWord;}}}value=token.type===Token.Template?token.value.raw:token.value;}else{value='ILLEGAL';}msg=msg.replace('%0',value);return token&&typeof token.lineNumber==='number'?createError(token.lineNumber,token.start,msg):createError(scanning?lineNumber:lastLineNumber,scanning?index:lastIndex,msg);}function throwUnexpectedToken(token,message){throw unexpectedTokenError(token,message);}function tolerateUnexpectedToken(token,message){var error=unexpectedTokenError(token,message);if(extra.errors){recordError(error);}else{throw error;}}// Expect the next token to match the specified punctuator.
7181// If not, an exception will be thrown.
7182function expect(value){var token=lex();if(token.type!==Token.Punctuator||token.value!==value){throwUnexpectedToken(token);}}/**
7183 * @name expectCommaSeparator
7184 * @description Quietly expect a comma when in tolerant mode, otherwise delegates
7185 * to <code>expect(value)</code>
7186 * @since 2.0
7187 */function expectCommaSeparator(){var token;if(extra.errors){token=lookahead;if(token.type===Token.Punctuator&&token.value===','){lex();}else if(token.type===Token.Punctuator&&token.value===';'){lex();tolerateUnexpectedToken(token);}else{tolerateUnexpectedToken(token,Messages.UnexpectedToken);}}else{expect(',');}}// Expect the next token to match the specified keyword.
7188// If not, an exception will be thrown.
7189function expectKeyword(keyword){var token=lex();if(token.type!==Token.Keyword||token.value!==keyword){throwUnexpectedToken(token);}}// Return true if the next token matches the specified punctuator.
7190function match(value){return lookahead.type===Token.Punctuator&&lookahead.value===value;}// Return true if the next token matches the specified keyword
7191function matchKeyword(keyword){return lookahead.type===Token.Keyword&&lookahead.value===keyword;}// Return true if the next token matches the specified contextual keyword
7192// (where an identifier is sometimes a keyword depending on the context)
7193function matchContextualKeyword(keyword){return lookahead.type===Token.Identifier&&lookahead.value===keyword;}// Return true if the next token is an assignment operator
7194function matchAssign(){var op;if(lookahead.type!==Token.Punctuator){return false;}op=lookahead.value;return op==='='||op==='*='||op==='/='||op==='%='||op==='+='||op==='-='||op==='<<='||op==='>>='||op==='>>>='||op==='&='||op==='^='||op==='|=';}function consumeSemicolon(){// Catch the very common case first: immediately a semicolon (U+003B).
7195if(source.charCodeAt(startIndex)===0x3B||match(';')){lex();return;}if(hasLineTerminator){return;}// FIXME(ikarienator): this is seemingly an issue in the previous location info convention.
7196lastIndex=startIndex;lastLineNumber=startLineNumber;lastLineStart=startLineStart;if(lookahead.type!==Token.EOF&&!match('}')){throwUnexpectedToken(lookahead);}}// Cover grammar support.
7197//
7198// When an assignment expression position starts with an left parenthesis, the determination of the type
7199// of the syntax is to be deferred arbitrarily long until the end of the parentheses pair (plus a lookahead)
7200// or the first comma. This situation also defers the determination of all the expressions nested in the pair.
7201//
7202// There are three productions that can be parsed in a parentheses pair that needs to be determined
7203// after the outermost pair is closed. They are:
7204//
7205// 1. AssignmentExpression
7206// 2. BindingElements
7207// 3. AssignmentTargets
7208//
7209// In order to avoid exponential backtracking, we use two flags to denote if the production can be
7210// binding element or assignment target.
7211//
7212// The three productions have the relationship:
7213//
7214// BindingElements ⊆ AssignmentTargets ⊆ AssignmentExpression
7215//
7216// with a single exception that CoverInitializedName when used directly in an Expression, generates
7217// an early error. Therefore, we need the third state, firstCoverInitializedNameError, to track the
7218// first usage of CoverInitializedName and report it when we reached the end of the parentheses pair.
7219//
7220// isolateCoverGrammar function runs the given parser function with a new cover grammar context, and it does not
7221// effect the current flags. This means the production the parser parses is only used as an expression. Therefore
7222// the CoverInitializedName check is conducted.
7223//
7224// inheritCoverGrammar function runs the given parse function with a new cover grammar context, and it propagates
7225// the flags outside of the parser. This means the production the parser parses is used as a part of a potential
7226// pattern. The CoverInitializedName check is deferred.
7227function isolateCoverGrammar(parser){var oldIsBindingElement=isBindingElement,oldIsAssignmentTarget=isAssignmentTarget,oldFirstCoverInitializedNameError=firstCoverInitializedNameError,result;isBindingElement=true;isAssignmentTarget=true;firstCoverInitializedNameError=null;result=parser();if(firstCoverInitializedNameError!==null){throwUnexpectedToken(firstCoverInitializedNameError);}isBindingElement=oldIsBindingElement;isAssignmentTarget=oldIsAssignmentTarget;firstCoverInitializedNameError=oldFirstCoverInitializedNameError;return result;}function inheritCoverGrammar(parser){var oldIsBindingElement=isBindingElement,oldIsAssignmentTarget=isAssignmentTarget,oldFirstCoverInitializedNameError=firstCoverInitializedNameError,result;isBindingElement=true;isAssignmentTarget=true;firstCoverInitializedNameError=null;result=parser();isBindingElement=isBindingElement&&oldIsBindingElement;isAssignmentTarget=isAssignmentTarget&&oldIsAssignmentTarget;firstCoverInitializedNameError=oldFirstCoverInitializedNameError||firstCoverInitializedNameError;return result;}// ECMA-262 13.3.3 Destructuring Binding Patterns
7228function parseArrayPattern(params,kind){var node=new Node(),elements=[],rest,restNode;expect('[');while(!match(']')){if(match(',')){lex();elements.push(null);}else{if(match('...')){restNode=new Node();lex();params.push(lookahead);rest=parseVariableIdentifier(kind);elements.push(restNode.finishRestElement(rest));break;}else{elements.push(parsePatternWithDefault(params,kind));}if(!match(']')){expect(',');}}}expect(']');return node.finishArrayPattern(elements);}function parsePropertyPattern(params,kind){var node=new Node(),key,keyToken,computed=match('['),init;if(lookahead.type===Token.Identifier){keyToken=lookahead;key=parseVariableIdentifier();if(match('=')){params.push(keyToken);lex();init=parseAssignmentExpression();return node.finishProperty('init',key,false,new WrappingNode(keyToken).finishAssignmentPattern(key,init),false,true);}else if(!match(':')){params.push(keyToken);return node.finishProperty('init',key,false,key,false,true);}}else{key=parseObjectPropertyKey();}expect(':');init=parsePatternWithDefault(params,kind);return node.finishProperty('init',key,computed,init,false,false);}function parseObjectPattern(params,kind){var node=new Node(),properties=[];expect('{');while(!match('}')){properties.push(parsePropertyPattern(params,kind));if(!match('}')){expect(',');}}lex();return node.finishObjectPattern(properties);}function parsePattern(params,kind){if(match('[')){return parseArrayPattern(params,kind);}else if(match('{')){return parseObjectPattern(params,kind);}else if(matchKeyword('let')){if(kind==='const'||kind==='let'){tolerateUnexpectedToken(lookahead,Messages.UnexpectedToken);}}params.push(lookahead);return parseVariableIdentifier(kind);}function parsePatternWithDefault(params,kind){var startToken=lookahead,pattern,previousAllowYield,right;pattern=parsePattern(params,kind);if(match('=')){lex();previousAllowYield=state.allowYield;state.allowYield=true;right=isolateCoverGrammar(parseAssignmentExpression);state.allowYield=previousAllowYield;pattern=new WrappingNode(startToken).finishAssignmentPattern(pattern,right);}return pattern;}// ECMA-262 12.2.5 Array Initializer
7229function parseArrayInitializer(){var elements=[],node=new Node(),restSpread;expect('[');while(!match(']')){if(match(',')){lex();elements.push(null);}else if(match('...')){restSpread=new Node();lex();restSpread.finishSpreadElement(inheritCoverGrammar(parseAssignmentExpression));if(!match(']')){isAssignmentTarget=isBindingElement=false;expect(',');}elements.push(restSpread);}else{elements.push(inheritCoverGrammar(parseAssignmentExpression));if(!match(']')){expect(',');}}}lex();return node.finishArrayExpression(elements);}// ECMA-262 12.2.6 Object Initializer
7230function parsePropertyFunction(node,paramInfo,isGenerator){var previousStrict,body;isAssignmentTarget=isBindingElement=false;previousStrict=strict;body=isolateCoverGrammar(parseFunctionSourceElements);if(strict&&paramInfo.firstRestricted){tolerateUnexpectedToken(paramInfo.firstRestricted,paramInfo.message);}if(strict&&paramInfo.stricted){tolerateUnexpectedToken(paramInfo.stricted,paramInfo.message);}strict=previousStrict;return node.finishFunctionExpression(null,paramInfo.params,paramInfo.defaults,body,isGenerator);}function parsePropertyMethodFunction(){var params,method,node=new Node(),previousAllowYield=state.allowYield;state.allowYield=false;params=parseParams();state.allowYield=previousAllowYield;state.allowYield=false;method=parsePropertyFunction(node,params,false);state.allowYield=previousAllowYield;return method;}function parseObjectPropertyKey(){var token,node=new Node(),expr;token=lex();// Note: This function is called only from parseObjectProperty(), where
7231// EOF and Punctuator tokens are already filtered out.
7232switch(token.type){case Token.StringLiteral:case Token.NumericLiteral:if(strict&&token.octal){tolerateUnexpectedToken(token,Messages.StrictOctalLiteral);}return node.finishLiteral(token);case Token.Identifier:case Token.BooleanLiteral:case Token.NullLiteral:case Token.Keyword:return node.finishIdentifier(token.value);case Token.Punctuator:if(token.value==='['){expr=isolateCoverGrammar(parseAssignmentExpression);expect(']');return expr;}break;}throwUnexpectedToken(token);}function lookaheadPropertyName(){switch(lookahead.type){case Token.Identifier:case Token.StringLiteral:case Token.BooleanLiteral:case Token.NullLiteral:case Token.NumericLiteral:case Token.Keyword:return true;case Token.Punctuator:return lookahead.value==='[';}return false;}// This function is to try to parse a MethodDefinition as defined in 14.3. But in the case of object literals,
7233// it might be called at a position where there is in fact a short hand identifier pattern or a data property.
7234// This can only be determined after we consumed up to the left parentheses.
7235//
7236// In order to avoid back tracking, it returns `null` if the position is not a MethodDefinition and the caller
7237// is responsible to visit other options.
7238function tryParseMethodDefinition(token,key,computed,node){var value,options,methodNode,params,previousAllowYield=state.allowYield;if(token.type===Token.Identifier){// check for `get` and `set`;
7239if(token.value==='get'&&lookaheadPropertyName()){computed=match('[');key=parseObjectPropertyKey();methodNode=new Node();expect('(');expect(')');state.allowYield=false;value=parsePropertyFunction(methodNode,{params:[],defaults:[],stricted:null,firstRestricted:null,message:null},false);state.allowYield=previousAllowYield;return node.finishProperty('get',key,computed,value,false,false);}else if(token.value==='set'&&lookaheadPropertyName()){computed=match('[');key=parseObjectPropertyKey();methodNode=new Node();expect('(');options={params:[],defaultCount:0,defaults:[],firstRestricted:null,paramSet:{}};if(match(')')){tolerateUnexpectedToken(lookahead);}else{state.allowYield=false;parseParam(options);state.allowYield=previousAllowYield;if(options.defaultCount===0){options.defaults=[];}}expect(')');state.allowYield=false;value=parsePropertyFunction(methodNode,options,false);state.allowYield=previousAllowYield;return node.finishProperty('set',key,computed,value,false,false);}}else if(token.type===Token.Punctuator&&token.value==='*'&&lookaheadPropertyName()){computed=match('[');key=parseObjectPropertyKey();methodNode=new Node();state.allowYield=true;params=parseParams();state.allowYield=previousAllowYield;state.allowYield=false;value=parsePropertyFunction(methodNode,params,true);state.allowYield=previousAllowYield;return node.finishProperty('init',key,computed,value,true,false);}if(key&&match('(')){value=parsePropertyMethodFunction();return node.finishProperty('init',key,computed,value,true,false);}// Not a MethodDefinition.
7240return null;}function parseObjectProperty(hasProto){var token=lookahead,node=new Node(),computed,key,maybeMethod,proto,value;computed=match('[');if(match('*')){lex();}else{key=parseObjectPropertyKey();}maybeMethod=tryParseMethodDefinition(token,key,computed,node);if(maybeMethod){return maybeMethod;}if(!key){throwUnexpectedToken(lookahead);}// Check for duplicated __proto__
7241if(!computed){proto=key.type===Syntax.Identifier&&key.name==='__proto__'||key.type===Syntax.Literal&&key.value==='__proto__';if(hasProto.value&&proto){tolerateError(Messages.DuplicateProtoProperty);}hasProto.value|=proto;}if(match(':')){lex();value=inheritCoverGrammar(parseAssignmentExpression);return node.finishProperty('init',key,computed,value,false,false);}if(token.type===Token.Identifier){if(match('=')){firstCoverInitializedNameError=lookahead;lex();value=isolateCoverGrammar(parseAssignmentExpression);return node.finishProperty('init',key,computed,new WrappingNode(token).finishAssignmentPattern(key,value),false,true);}return node.finishProperty('init',key,computed,key,false,true);}throwUnexpectedToken(lookahead);}function parseObjectInitializer(){var properties=[],hasProto={value:false},node=new Node();expect('{');while(!match('}')){properties.push(parseObjectProperty(hasProto));if(!match('}')){expectCommaSeparator();}}expect('}');return node.finishObjectExpression(properties);}function reinterpretExpressionAsPattern(expr){var i;switch(expr.type){case Syntax.Identifier:case Syntax.MemberExpression:case Syntax.RestElement:case Syntax.AssignmentPattern:break;case Syntax.SpreadElement:expr.type=Syntax.RestElement;reinterpretExpressionAsPattern(expr.argument);break;case Syntax.ArrayExpression:expr.type=Syntax.ArrayPattern;for(i=0;i<expr.elements.length;i++){if(expr.elements[i]!==null){reinterpretExpressionAsPattern(expr.elements[i]);}}break;case Syntax.ObjectExpression:expr.type=Syntax.ObjectPattern;for(i=0;i<expr.properties.length;i++){reinterpretExpressionAsPattern(expr.properties[i].value);}break;case Syntax.AssignmentExpression:expr.type=Syntax.AssignmentPattern;reinterpretExpressionAsPattern(expr.left);break;default:// Allow other node type for tolerant parsing.
7242break;}}// ECMA-262 12.2.9 Template Literals
7243function parseTemplateElement(option){var node,token;if(lookahead.type!==Token.Template||option.head&&!lookahead.head){throwUnexpectedToken();}node=new Node();token=lex();return node.finishTemplateElement({raw:token.value.raw,cooked:token.value.cooked},token.tail);}function parseTemplateLiteral(){var quasi,quasis,expressions,node=new Node();quasi=parseTemplateElement({head:true});quasis=[quasi];expressions=[];while(!quasi.tail){expressions.push(parseExpression());quasi=parseTemplateElement({head:false});quasis.push(quasi);}return node.finishTemplateLiteral(quasis,expressions);}// ECMA-262 12.2.10 The Grouping Operator
7244function parseGroupExpression(){var expr,expressions,startToken,i,params=[];expect('(');if(match(')')){lex();if(!match('=>')){expect('=>');}return{type:PlaceHolders.ArrowParameterPlaceHolder,params:[],rawParams:[]};}startToken=lookahead;if(match('...')){expr=parseRestElement(params);expect(')');if(!match('=>')){expect('=>');}return{type:PlaceHolders.ArrowParameterPlaceHolder,params:[expr]};}isBindingElement=true;expr=inheritCoverGrammar(parseAssignmentExpression);if(match(',')){isAssignmentTarget=false;expressions=[expr];while(startIndex<length){if(!match(',')){break;}lex();if(match('...')){if(!isBindingElement){throwUnexpectedToken(lookahead);}expressions.push(parseRestElement(params));expect(')');if(!match('=>')){expect('=>');}isBindingElement=false;for(i=0;i<expressions.length;i++){reinterpretExpressionAsPattern(expressions[i]);}return{type:PlaceHolders.ArrowParameterPlaceHolder,params:expressions};}expressions.push(inheritCoverGrammar(parseAssignmentExpression));}expr=new WrappingNode(startToken).finishSequenceExpression(expressions);}expect(')');if(match('=>')){if(expr.type===Syntax.Identifier&&expr.name==='yield'){return{type:PlaceHolders.ArrowParameterPlaceHolder,params:[expr]};}if(!isBindingElement){throwUnexpectedToken(lookahead);}if(expr.type===Syntax.SequenceExpression){for(i=0;i<expr.expressions.length;i++){reinterpretExpressionAsPattern(expr.expressions[i]);}}else{reinterpretExpressionAsPattern(expr);}expr={type:PlaceHolders.ArrowParameterPlaceHolder,params:expr.type===Syntax.SequenceExpression?expr.expressions:[expr]};}isBindingElement=false;return expr;}// ECMA-262 12.2 Primary Expressions
7245function parsePrimaryExpression(){var type,token,expr,node;if(match('(')){isBindingElement=false;return inheritCoverGrammar(parseGroupExpression);}if(match('[')){return inheritCoverGrammar(parseArrayInitializer);}if(match('{')){return inheritCoverGrammar(parseObjectInitializer);}type=lookahead.type;node=new Node();if(type===Token.Identifier){if(state.sourceType==='module'&&lookahead.value==='await'){tolerateUnexpectedToken(lookahead);}expr=node.finishIdentifier(lex().value);}else if(type===Token.StringLiteral||type===Token.NumericLiteral){isAssignmentTarget=isBindingElement=false;if(strict&&lookahead.octal){tolerateUnexpectedToken(lookahead,Messages.StrictOctalLiteral);}expr=node.finishLiteral(lex());}else if(type===Token.Keyword){if(!strict&&state.allowYield&&matchKeyword('yield')){return parseNonComputedProperty();}if(!strict&&matchKeyword('let')){return node.finishIdentifier(lex().value);}isAssignmentTarget=isBindingElement=false;if(matchKeyword('function')){return parseFunctionExpression();}if(matchKeyword('this')){lex();return node.finishThisExpression();}if(matchKeyword('class')){return parseClassExpression();}throwUnexpectedToken(lex());}else if(type===Token.BooleanLiteral){isAssignmentTarget=isBindingElement=false;token=lex();token.value=token.value==='true';expr=node.finishLiteral(token);}else if(type===Token.NullLiteral){isAssignmentTarget=isBindingElement=false;token=lex();token.value=null;expr=node.finishLiteral(token);}else if(match('/')||match('/=')){isAssignmentTarget=isBindingElement=false;index=startIndex;if(typeof extra.tokens!=='undefined'){token=collectRegex();}else{token=scanRegExp();}lex();expr=node.finishLiteral(token);}else if(type===Token.Template){expr=parseTemplateLiteral();}else{throwUnexpectedToken(lex());}return expr;}// ECMA-262 12.3 Left-Hand-Side Expressions
7246function parseArguments(){var args=[],expr;expect('(');if(!match(')')){while(startIndex<length){if(match('...')){expr=new Node();lex();expr.finishSpreadElement(isolateCoverGrammar(parseAssignmentExpression));}else{expr=isolateCoverGrammar(parseAssignmentExpression);}args.push(expr);if(match(')')){break;}expectCommaSeparator();}}expect(')');return args;}function parseNonComputedProperty(){var token,node=new Node();token=lex();if(!isIdentifierName(token)){throwUnexpectedToken(token);}return node.finishIdentifier(token.value);}function parseNonComputedMember(){expect('.');return parseNonComputedProperty();}function parseComputedMember(){var expr;expect('[');expr=isolateCoverGrammar(parseExpression);expect(']');return expr;}// ECMA-262 12.3.3 The new Operator
7247function parseNewExpression(){var callee,args,node=new Node();expectKeyword('new');if(match('.')){lex();if(lookahead.type===Token.Identifier&&lookahead.value==='target'){if(state.inFunctionBody){lex();return node.finishMetaProperty('new','target');}}throwUnexpectedToken(lookahead);}callee=isolateCoverGrammar(parseLeftHandSideExpression);args=match('(')?parseArguments():[];isAssignmentTarget=isBindingElement=false;return node.finishNewExpression(callee,args);}// ECMA-262 12.3.4 Function Calls
7248function parseLeftHandSideExpressionAllowCall(){var quasi,expr,args,property,startToken,previousAllowIn=state.allowIn;startToken=lookahead;state.allowIn=true;if(matchKeyword('super')&&state.inFunctionBody){expr=new Node();lex();expr=expr.finishSuper();if(!match('(')&&!match('.')&&!match('[')){throwUnexpectedToken(lookahead);}}else{expr=inheritCoverGrammar(matchKeyword('new')?parseNewExpression:parsePrimaryExpression);}for(;;){if(match('.')){isBindingElement=false;isAssignmentTarget=true;property=parseNonComputedMember();expr=new WrappingNode(startToken).finishMemberExpression('.',expr,property);}else if(match('(')){isBindingElement=false;isAssignmentTarget=false;args=parseArguments();expr=new WrappingNode(startToken).finishCallExpression(expr,args);}else if(match('[')){isBindingElement=false;isAssignmentTarget=true;property=parseComputedMember();expr=new WrappingNode(startToken).finishMemberExpression('[',expr,property);}else if(lookahead.type===Token.Template&&lookahead.head){quasi=parseTemplateLiteral();expr=new WrappingNode(startToken).finishTaggedTemplateExpression(expr,quasi);}else{break;}}state.allowIn=previousAllowIn;return expr;}// ECMA-262 12.3 Left-Hand-Side Expressions
7249function parseLeftHandSideExpression(){var quasi,expr,property,startToken;assert(state.allowIn,'callee of new expression always allow in keyword.');startToken=lookahead;if(matchKeyword('super')&&state.inFunctionBody){expr=new Node();lex();expr=expr.finishSuper();if(!match('[')&&!match('.')){throwUnexpectedToken(lookahead);}}else{expr=inheritCoverGrammar(matchKeyword('new')?parseNewExpression:parsePrimaryExpression);}for(;;){if(match('[')){isBindingElement=false;isAssignmentTarget=true;property=parseComputedMember();expr=new WrappingNode(startToken).finishMemberExpression('[',expr,property);}else if(match('.')){isBindingElement=false;isAssignmentTarget=true;property=parseNonComputedMember();expr=new WrappingNode(startToken).finishMemberExpression('.',expr,property);}else if(lookahead.type===Token.Template&&lookahead.head){quasi=parseTemplateLiteral();expr=new WrappingNode(startToken).finishTaggedTemplateExpression(expr,quasi);}else{break;}}return expr;}// ECMA-262 12.4 Postfix Expressions
7250function parsePostfixExpression(){var expr,token,startToken=lookahead;expr=inheritCoverGrammar(parseLeftHandSideExpressionAllowCall);if(!hasLineTerminator&&lookahead.type===Token.Punctuator){if(match('++')||match('--')){// ECMA-262 11.3.1, 11.3.2
7251if(strict&&expr.type===Syntax.Identifier&&isRestrictedWord(expr.name)){tolerateError(Messages.StrictLHSPostfix);}if(!isAssignmentTarget){tolerateError(Messages.InvalidLHSInAssignment);}isAssignmentTarget=isBindingElement=false;token=lex();expr=new WrappingNode(startToken).finishPostfixExpression(token.value,expr);}}return expr;}// ECMA-262 12.5 Unary Operators
7252function parseUnaryExpression(){var token,expr,startToken;if(lookahead.type!==Token.Punctuator&&lookahead.type!==Token.Keyword){expr=parsePostfixExpression();}else if(match('++')||match('--')){startToken=lookahead;token=lex();expr=inheritCoverGrammar(parseUnaryExpression);// ECMA-262 11.4.4, 11.4.5
7253if(strict&&expr.type===Syntax.Identifier&&isRestrictedWord(expr.name)){tolerateError(Messages.StrictLHSPrefix);}if(!isAssignmentTarget){tolerateError(Messages.InvalidLHSInAssignment);}expr=new WrappingNode(startToken).finishUnaryExpression(token.value,expr);isAssignmentTarget=isBindingElement=false;}else if(match('+')||match('-')||match('~')||match('!')){startToken=lookahead;token=lex();expr=inheritCoverGrammar(parseUnaryExpression);expr=new WrappingNode(startToken).finishUnaryExpression(token.value,expr);isAssignmentTarget=isBindingElement=false;}else if(matchKeyword('delete')||matchKeyword('void')||matchKeyword('typeof')){startToken=lookahead;token=lex();expr=inheritCoverGrammar(parseUnaryExpression);expr=new WrappingNode(startToken).finishUnaryExpression(token.value,expr);if(strict&&expr.operator==='delete'&&expr.argument.type===Syntax.Identifier){tolerateError(Messages.StrictDelete);}isAssignmentTarget=isBindingElement=false;}else{expr=parsePostfixExpression();}return expr;}function binaryPrecedence(token,allowIn){var prec=0;if(token.type!==Token.Punctuator&&token.type!==Token.Keyword){return 0;}switch(token.value){case'||':prec=1;break;case'&&':prec=2;break;case'|':prec=3;break;case'^':prec=4;break;case'&':prec=5;break;case'==':case'!=':case'===':case'!==':prec=6;break;case'<':case'>':case'<=':case'>=':case'instanceof':prec=7;break;case'in':prec=allowIn?7:0;break;case'<<':case'>>':case'>>>':prec=8;break;case'+':case'-':prec=9;break;case'*':case'/':case'%':prec=11;break;default:break;}return prec;}// ECMA-262 12.6 Multiplicative Operators
7254// ECMA-262 12.7 Additive Operators
7255// ECMA-262 12.8 Bitwise Shift Operators
7256// ECMA-262 12.9 Relational Operators
7257// ECMA-262 12.10 Equality Operators
7258// ECMA-262 12.11 Binary Bitwise Operators
7259// ECMA-262 12.12 Binary Logical Operators
7260function parseBinaryExpression(){var marker,markers,expr,token,prec,stack,right,operator,left,i;marker=lookahead;left=inheritCoverGrammar(parseUnaryExpression);token=lookahead;prec=binaryPrecedence(token,state.allowIn);if(prec===0){return left;}isAssignmentTarget=isBindingElement=false;token.prec=prec;lex();markers=[marker,lookahead];right=isolateCoverGrammar(parseUnaryExpression);stack=[left,token,right];while((prec=binaryPrecedence(lookahead,state.allowIn))>0){// Reduce: make a binary expression from the three topmost entries.
7261while(stack.length>2&&prec<=stack[stack.length-2].prec){right=stack.pop();operator=stack.pop().value;left=stack.pop();markers.pop();expr=new WrappingNode(markers[markers.length-1]).finishBinaryExpression(operator,left,right);stack.push(expr);}// Shift.
7262token=lex();token.prec=prec;stack.push(token);markers.push(lookahead);expr=isolateCoverGrammar(parseUnaryExpression);stack.push(expr);}// Final reduce to clean-up the stack.
7263i=stack.length-1;expr=stack[i];markers.pop();while(i>1){expr=new WrappingNode(markers.pop()).finishBinaryExpression(stack[i-1].value,stack[i-2],expr);i-=2;}return expr;}// ECMA-262 12.13 Conditional Operator
7264function parseConditionalExpression(){var expr,previousAllowIn,consequent,alternate,startToken;startToken=lookahead;expr=inheritCoverGrammar(parseBinaryExpression);if(match('?')){lex();previousAllowIn=state.allowIn;state.allowIn=true;consequent=isolateCoverGrammar(parseAssignmentExpression);state.allowIn=previousAllowIn;expect(':');alternate=isolateCoverGrammar(parseAssignmentExpression);expr=new WrappingNode(startToken).finishConditionalExpression(expr,consequent,alternate);isAssignmentTarget=isBindingElement=false;}return expr;}// ECMA-262 14.2 Arrow Function Definitions
7265function parseConciseBody(){if(match('{')){return parseFunctionSourceElements();}return isolateCoverGrammar(parseAssignmentExpression);}function checkPatternParam(options,param){var i;switch(param.type){case Syntax.Identifier:validateParam(options,param,param.name);break;case Syntax.RestElement:checkPatternParam(options,param.argument);break;case Syntax.AssignmentPattern:checkPatternParam(options,param.left);break;case Syntax.ArrayPattern:for(i=0;i<param.elements.length;i++){if(param.elements[i]!==null){checkPatternParam(options,param.elements[i]);}}break;case Syntax.YieldExpression:break;default:assert(param.type===Syntax.ObjectPattern,'Invalid type');for(i=0;i<param.properties.length;i++){checkPatternParam(options,param.properties[i].value);}break;}}function reinterpretAsCoverFormalsList(expr){var i,len,param,params,defaults,defaultCount,options,token;defaults=[];defaultCount=0;params=[expr];switch(expr.type){case Syntax.Identifier:break;case PlaceHolders.ArrowParameterPlaceHolder:params=expr.params;break;default:return null;}options={paramSet:{}};for(i=0,len=params.length;i<len;i+=1){param=params[i];switch(param.type){case Syntax.AssignmentPattern:params[i]=param.left;if(param.right.type===Syntax.YieldExpression){if(param.right.argument){throwUnexpectedToken(lookahead);}param.right.type=Syntax.Identifier;param.right.name='yield';delete param.right.argument;delete param.right.delegate;}defaults.push(param.right);++defaultCount;checkPatternParam(options,param.left);break;default:checkPatternParam(options,param);params[i]=param;defaults.push(null);break;}}if(strict||!state.allowYield){for(i=0,len=params.length;i<len;i+=1){param=params[i];if(param.type===Syntax.YieldExpression){throwUnexpectedToken(lookahead);}}}if(options.message===Messages.StrictParamDupe){token=strict?options.stricted:options.firstRestricted;throwUnexpectedToken(token,options.message);}if(defaultCount===0){defaults=[];}return{params:params,defaults:defaults,stricted:options.stricted,firstRestricted:options.firstRestricted,message:options.message};}function parseArrowFunctionExpression(options,node){var previousStrict,previousAllowYield,body;if(hasLineTerminator){tolerateUnexpectedToken(lookahead);}expect('=>');previousStrict=strict;previousAllowYield=state.allowYield;state.allowYield=true;body=parseConciseBody();if(strict&&options.firstRestricted){throwUnexpectedToken(options.firstRestricted,options.message);}if(strict&&options.stricted){tolerateUnexpectedToken(options.stricted,options.message);}strict=previousStrict;state.allowYield=previousAllowYield;return node.finishArrowFunctionExpression(options.params,options.defaults,body,body.type!==Syntax.BlockStatement);}// ECMA-262 14.4 Yield expression
7266function parseYieldExpression(){var argument,expr,delegate,previousAllowYield;argument=null;expr=new Node();delegate=false;expectKeyword('yield');if(!hasLineTerminator){previousAllowYield=state.allowYield;state.allowYield=false;delegate=match('*');if(delegate){lex();argument=parseAssignmentExpression();}else{if(!match(';')&&!match('}')&&!match(')')&&lookahead.type!==Token.EOF){argument=parseAssignmentExpression();}}state.allowYield=previousAllowYield;}return expr.finishYieldExpression(argument,delegate);}// ECMA-262 12.14 Assignment Operators
7267function parseAssignmentExpression(){var token,expr,right,list,startToken;startToken=lookahead;token=lookahead;if(!state.allowYield&&matchKeyword('yield')){return parseYieldExpression();}expr=parseConditionalExpression();if(expr.type===PlaceHolders.ArrowParameterPlaceHolder||match('=>')){isAssignmentTarget=isBindingElement=false;list=reinterpretAsCoverFormalsList(expr);if(list){firstCoverInitializedNameError=null;return parseArrowFunctionExpression(list,new WrappingNode(startToken));}return expr;}if(matchAssign()){if(!isAssignmentTarget){tolerateError(Messages.InvalidLHSInAssignment);}// ECMA-262 12.1.1
7268if(strict&&expr.type===Syntax.Identifier){if(isRestrictedWord(expr.name)){tolerateUnexpectedToken(token,Messages.StrictLHSAssignment);}if(isStrictModeReservedWord(expr.name)){tolerateUnexpectedToken(token,Messages.StrictReservedWord);}}if(!match('=')){isAssignmentTarget=isBindingElement=false;}else{reinterpretExpressionAsPattern(expr);}token=lex();right=isolateCoverGrammar(parseAssignmentExpression);expr=new WrappingNode(startToken).finishAssignmentExpression(token.value,expr,right);firstCoverInitializedNameError=null;}return expr;}// ECMA-262 12.15 Comma Operator
7269function parseExpression(){var expr,startToken=lookahead,expressions;expr=isolateCoverGrammar(parseAssignmentExpression);if(match(',')){expressions=[expr];while(startIndex<length){if(!match(',')){break;}lex();expressions.push(isolateCoverGrammar(parseAssignmentExpression));}expr=new WrappingNode(startToken).finishSequenceExpression(expressions);}return expr;}// ECMA-262 13.2 Block
7270function parseStatementListItem(){if(lookahead.type===Token.Keyword){switch(lookahead.value){case'export':if(state.sourceType!=='module'){tolerateUnexpectedToken(lookahead,Messages.IllegalExportDeclaration);}return parseExportDeclaration();case'import':if(state.sourceType!=='module'){tolerateUnexpectedToken(lookahead,Messages.IllegalImportDeclaration);}return parseImportDeclaration();case'const':return parseLexicalDeclaration({inFor:false});case'function':return parseFunctionDeclaration(new Node());case'class':return parseClassDeclaration();}}if(matchKeyword('let')&&isLexicalDeclaration()){return parseLexicalDeclaration({inFor:false});}return parseStatement();}function parseStatementList(){var list=[];while(startIndex<length){if(match('}')){break;}list.push(parseStatementListItem());}return list;}function parseBlock(){var block,node=new Node();expect('{');block=parseStatementList();expect('}');return node.finishBlockStatement(block);}// ECMA-262 13.3.2 Variable Statement
7271function parseVariableIdentifier(kind){var token,node=new Node();token=lex();if(token.type===Token.Keyword&&token.value==='yield'){if(strict){tolerateUnexpectedToken(token,Messages.StrictReservedWord);}if(!state.allowYield){throwUnexpectedToken(token);}}else if(token.type!==Token.Identifier){if(strict&&token.type===Token.Keyword&&isStrictModeReservedWord(token.value)){tolerateUnexpectedToken(token,Messages.StrictReservedWord);}else{if(strict||token.value!=='let'||kind!=='var'){throwUnexpectedToken(token);}}}else if(state.sourceType==='module'&&token.type===Token.Identifier&&token.value==='await'){tolerateUnexpectedToken(token);}return node.finishIdentifier(token.value);}function parseVariableDeclaration(options){var init=null,id,node=new Node(),params=[];id=parsePattern(params,'var');// ECMA-262 12.2.1
7272if(strict&&isRestrictedWord(id.name)){tolerateError(Messages.StrictVarName);}if(match('=')){lex();init=isolateCoverGrammar(parseAssignmentExpression);}else if(id.type!==Syntax.Identifier&&!options.inFor){expect('=');}return node.finishVariableDeclarator(id,init);}function parseVariableDeclarationList(options){var opt,list;opt={inFor:options.inFor};list=[parseVariableDeclaration(opt)];while(match(',')){lex();list.push(parseVariableDeclaration(opt));}return list;}function parseVariableStatement(node){var declarations;expectKeyword('var');declarations=parseVariableDeclarationList({inFor:false});consumeSemicolon();return node.finishVariableDeclaration(declarations);}// ECMA-262 13.3.1 Let and Const Declarations
7273function parseLexicalBinding(kind,options){var init=null,id,node=new Node(),params=[];id=parsePattern(params,kind);// ECMA-262 12.2.1
7274if(strict&&id.type===Syntax.Identifier&&isRestrictedWord(id.name)){tolerateError(Messages.StrictVarName);}if(kind==='const'){if(!matchKeyword('in')&&!matchContextualKeyword('of')){expect('=');init=isolateCoverGrammar(parseAssignmentExpression);}}else if(!options.inFor&&id.type!==Syntax.Identifier||match('=')){expect('=');init=isolateCoverGrammar(parseAssignmentExpression);}return node.finishVariableDeclarator(id,init);}function parseBindingList(kind,options){var list=[parseLexicalBinding(kind,options)];while(match(',')){lex();list.push(parseLexicalBinding(kind,options));}return list;}function tokenizerState(){return{index:index,lineNumber:lineNumber,lineStart:lineStart,hasLineTerminator:hasLineTerminator,lastIndex:lastIndex,lastLineNumber:lastLineNumber,lastLineStart:lastLineStart,startIndex:startIndex,startLineNumber:startLineNumber,startLineStart:startLineStart,lookahead:lookahead,tokenCount:extra.tokens?extra.tokens.length:0};}function resetTokenizerState(ts){index=ts.index;lineNumber=ts.lineNumber;lineStart=ts.lineStart;hasLineTerminator=ts.hasLineTerminator;lastIndex=ts.lastIndex;lastLineNumber=ts.lastLineNumber;lastLineStart=ts.lastLineStart;startIndex=ts.startIndex;startLineNumber=ts.startLineNumber;startLineStart=ts.startLineStart;lookahead=ts.lookahead;if(extra.tokens){extra.tokens.splice(ts.tokenCount,extra.tokens.length);}}function isLexicalDeclaration(){var lexical,ts;ts=tokenizerState();lex();lexical=lookahead.type===Token.Identifier||match('[')||match('{')||matchKeyword('let')||matchKeyword('yield');resetTokenizerState(ts);return lexical;}function parseLexicalDeclaration(options){var kind,declarations,node=new Node();kind=lex().value;assert(kind==='let'||kind==='const','Lexical declaration must be either let or const');declarations=parseBindingList(kind,options);consumeSemicolon();return node.finishLexicalDeclaration(declarations,kind);}function parseRestElement(params){var param,node=new Node();lex();if(match('{')){throwError(Messages.ObjectPatternAsRestParameter);}params.push(lookahead);param=parseVariableIdentifier();if(match('=')){throwError(Messages.DefaultRestParameter);}if(!match(')')){throwError(Messages.ParameterAfterRestParameter);}return node.finishRestElement(param);}// ECMA-262 13.4 Empty Statement
7275function parseEmptyStatement(node){expect(';');return node.finishEmptyStatement();}// ECMA-262 12.4 Expression Statement
7276function parseExpressionStatement(node){var expr=parseExpression();consumeSemicolon();return node.finishExpressionStatement(expr);}// ECMA-262 13.6 If statement
7277function parseIfStatement(node){var test,consequent,alternate;expectKeyword('if');expect('(');test=parseExpression();expect(')');consequent=parseStatement();if(matchKeyword('else')){lex();alternate=parseStatement();}else{alternate=null;}return node.finishIfStatement(test,consequent,alternate);}// ECMA-262 13.7 Iteration Statements
7278function parseDoWhileStatement(node){var body,test,oldInIteration;expectKeyword('do');oldInIteration=state.inIteration;state.inIteration=true;body=parseStatement();state.inIteration=oldInIteration;expectKeyword('while');expect('(');test=parseExpression();expect(')');if(match(';')){lex();}return node.finishDoWhileStatement(body,test);}function parseWhileStatement(node){var test,body,oldInIteration;expectKeyword('while');expect('(');test=parseExpression();expect(')');oldInIteration=state.inIteration;state.inIteration=true;body=parseStatement();state.inIteration=oldInIteration;return node.finishWhileStatement(test,body);}function parseForStatement(node){var init,forIn,initSeq,initStartToken,test,update,left,right,kind,declarations,body,oldInIteration,previousAllowIn=state.allowIn;init=test=update=null;forIn=true;expectKeyword('for');expect('(');if(match(';')){lex();}else{if(matchKeyword('var')){init=new Node();lex();state.allowIn=false;declarations=parseVariableDeclarationList({inFor:true});state.allowIn=previousAllowIn;if(declarations.length===1&&matchKeyword('in')){init=init.finishVariableDeclaration(declarations);lex();left=init;right=parseExpression();init=null;}else if(declarations.length===1&&declarations[0].init===null&&matchContextualKeyword('of')){init=init.finishVariableDeclaration(declarations);lex();left=init;right=parseAssignmentExpression();init=null;forIn=false;}else{init=init.finishVariableDeclaration(declarations);expect(';');}}else if(matchKeyword('const')||matchKeyword('let')){init=new Node();kind=lex().value;if(!strict&&lookahead.value==='in'){init=init.finishIdentifier(kind);lex();left=init;right=parseExpression();init=null;}else{state.allowIn=false;declarations=parseBindingList(kind,{inFor:true});state.allowIn=previousAllowIn;if(declarations.length===1&&declarations[0].init===null&&matchKeyword('in')){init=init.finishLexicalDeclaration(declarations,kind);lex();left=init;right=parseExpression();init=null;}else if(declarations.length===1&&declarations[0].init===null&&matchContextualKeyword('of')){init=init.finishLexicalDeclaration(declarations,kind);lex();left=init;right=parseAssignmentExpression();init=null;forIn=false;}else{consumeSemicolon();init=init.finishLexicalDeclaration(declarations,kind);}}}else{initStartToken=lookahead;state.allowIn=false;init=inheritCoverGrammar(parseAssignmentExpression);state.allowIn=previousAllowIn;if(matchKeyword('in')){if(!isAssignmentTarget){tolerateError(Messages.InvalidLHSInForIn);}lex();reinterpretExpressionAsPattern(init);left=init;right=parseExpression();init=null;}else if(matchContextualKeyword('of')){if(!isAssignmentTarget){tolerateError(Messages.InvalidLHSInForLoop);}lex();reinterpretExpressionAsPattern(init);left=init;right=parseAssignmentExpression();init=null;forIn=false;}else{if(match(',')){initSeq=[init];while(match(',')){lex();initSeq.push(isolateCoverGrammar(parseAssignmentExpression));}init=new WrappingNode(initStartToken).finishSequenceExpression(initSeq);}expect(';');}}}if(typeof left==='undefined'){if(!match(';')){test=parseExpression();}expect(';');if(!match(')')){update=parseExpression();}}expect(')');oldInIteration=state.inIteration;state.inIteration=true;body=isolateCoverGrammar(parseStatement);state.inIteration=oldInIteration;return typeof left==='undefined'?node.finishForStatement(init,test,update,body):forIn?node.finishForInStatement(left,right,body):node.finishForOfStatement(left,right,body);}// ECMA-262 13.8 The continue statement
7279function parseContinueStatement(node){var label=null,key;expectKeyword('continue');// Optimize the most common form: 'continue;'.
7280if(source.charCodeAt(startIndex)===0x3B){lex();if(!state.inIteration){throwError(Messages.IllegalContinue);}return node.finishContinueStatement(null);}if(hasLineTerminator){if(!state.inIteration){throwError(Messages.IllegalContinue);}return node.finishContinueStatement(null);}if(lookahead.type===Token.Identifier){label=parseVariableIdentifier();key='$'+label.name;if(!Object.prototype.hasOwnProperty.call(state.labelSet,key)){throwError(Messages.UnknownLabel,label.name);}}consumeSemicolon();if(label===null&&!state.inIteration){throwError(Messages.IllegalContinue);}return node.finishContinueStatement(label);}// ECMA-262 13.9 The break statement
7281function parseBreakStatement(node){var label=null,key;expectKeyword('break');// Catch the very common case first: immediately a semicolon (U+003B).
7282if(source.charCodeAt(lastIndex)===0x3B){lex();if(!(state.inIteration||state.inSwitch)){throwError(Messages.IllegalBreak);}return node.finishBreakStatement(null);}if(hasLineTerminator){if(!(state.inIteration||state.inSwitch)){throwError(Messages.IllegalBreak);}}else if(lookahead.type===Token.Identifier){label=parseVariableIdentifier();key='$'+label.name;if(!Object.prototype.hasOwnProperty.call(state.labelSet,key)){throwError(Messages.UnknownLabel,label.name);}}consumeSemicolon();if(label===null&&!(state.inIteration||state.inSwitch)){throwError(Messages.IllegalBreak);}return node.finishBreakStatement(label);}// ECMA-262 13.10 The return statement
7283function parseReturnStatement(node){var argument=null;expectKeyword('return');if(!state.inFunctionBody){tolerateError(Messages.IllegalReturn);}// 'return' followed by a space and an identifier is very common.
7284if(source.charCodeAt(lastIndex)===0x20){if(isIdentifierStart(source.charCodeAt(lastIndex+1))){argument=parseExpression();consumeSemicolon();return node.finishReturnStatement(argument);}}if(hasLineTerminator){// HACK
7285return node.finishReturnStatement(null);}if(!match(';')){if(!match('}')&&lookahead.type!==Token.EOF){argument=parseExpression();}}consumeSemicolon();return node.finishReturnStatement(argument);}// ECMA-262 13.11 The with statement
7286function parseWithStatement(node){var object,body;if(strict){tolerateError(Messages.StrictModeWith);}expectKeyword('with');expect('(');object=parseExpression();expect(')');body=parseStatement();return node.finishWithStatement(object,body);}// ECMA-262 13.12 The switch statement
7287function parseSwitchCase(){var test,consequent=[],statement,node=new Node();if(matchKeyword('default')){lex();test=null;}else{expectKeyword('case');test=parseExpression();}expect(':');while(startIndex<length){if(match('}')||matchKeyword('default')||matchKeyword('case')){break;}statement=parseStatementListItem();consequent.push(statement);}return node.finishSwitchCase(test,consequent);}function parseSwitchStatement(node){var discriminant,cases,clause,oldInSwitch,defaultFound;expectKeyword('switch');expect('(');discriminant=parseExpression();expect(')');expect('{');cases=[];if(match('}')){lex();return node.finishSwitchStatement(discriminant,cases);}oldInSwitch=state.inSwitch;state.inSwitch=true;defaultFound=false;while(startIndex<length){if(match('}')){break;}clause=parseSwitchCase();if(clause.test===null){if(defaultFound){throwError(Messages.MultipleDefaultsInSwitch);}defaultFound=true;}cases.push(clause);}state.inSwitch=oldInSwitch;expect('}');return node.finishSwitchStatement(discriminant,cases);}// ECMA-262 13.14 The throw statement
7288function parseThrowStatement(node){var argument;expectKeyword('throw');if(hasLineTerminator){throwError(Messages.NewlineAfterThrow);}argument=parseExpression();consumeSemicolon();return node.finishThrowStatement(argument);}// ECMA-262 13.15 The try statement
7289function parseCatchClause(){var param,params=[],paramMap={},key,i,body,node=new Node();expectKeyword('catch');expect('(');if(match(')')){throwUnexpectedToken(lookahead);}param=parsePattern(params);for(i=0;i<params.length;i++){key='$'+params[i].value;if(Object.prototype.hasOwnProperty.call(paramMap,key)){tolerateError(Messages.DuplicateBinding,params[i].value);}paramMap[key]=true;}// ECMA-262 12.14.1
7290if(strict&&isRestrictedWord(param.name)){tolerateError(Messages.StrictCatchVariable);}expect(')');body=parseBlock();return node.finishCatchClause(param,body);}function parseTryStatement(node){var block,handler=null,finalizer=null;expectKeyword('try');block=parseBlock();if(matchKeyword('catch')){handler=parseCatchClause();}if(matchKeyword('finally')){lex();finalizer=parseBlock();}if(!handler&&!finalizer){throwError(Messages.NoCatchOrFinally);}return node.finishTryStatement(block,handler,finalizer);}// ECMA-262 13.16 The debugger statement
7291function parseDebuggerStatement(node){expectKeyword('debugger');consumeSemicolon();return node.finishDebuggerStatement();}// 13 Statements
7292function parseStatement(){var type=lookahead.type,expr,labeledBody,key,node;if(type===Token.EOF){throwUnexpectedToken(lookahead);}if(type===Token.Punctuator&&lookahead.value==='{'){return parseBlock();}isAssignmentTarget=isBindingElement=true;node=new Node();if(type===Token.Punctuator){switch(lookahead.value){case';':return parseEmptyStatement(node);case'(':return parseExpressionStatement(node);default:break;}}else if(type===Token.Keyword){switch(lookahead.value){case'break':return parseBreakStatement(node);case'continue':return parseContinueStatement(node);case'debugger':return parseDebuggerStatement(node);case'do':return parseDoWhileStatement(node);case'for':return parseForStatement(node);case'function':return parseFunctionDeclaration(node);case'if':return parseIfStatement(node);case'return':return parseReturnStatement(node);case'switch':return parseSwitchStatement(node);case'throw':return parseThrowStatement(node);case'try':return parseTryStatement(node);case'var':return parseVariableStatement(node);case'while':return parseWhileStatement(node);case'with':return parseWithStatement(node);default:break;}}expr=parseExpression();// ECMA-262 12.12 Labelled Statements
7293if(expr.type===Syntax.Identifier&&match(':')){lex();key='$'+expr.name;if(Object.prototype.hasOwnProperty.call(state.labelSet,key)){throwError(Messages.Redeclaration,'Label',expr.name);}state.labelSet[key]=true;labeledBody=parseStatement();delete state.labelSet[key];return node.finishLabeledStatement(expr,labeledBody);}consumeSemicolon();return node.finishExpressionStatement(expr);}// ECMA-262 14.1 Function Definition
7294function parseFunctionSourceElements(){var statement,body=[],token,directive,firstRestricted,oldLabelSet,oldInIteration,oldInSwitch,oldInFunctionBody,node=new Node();expect('{');while(startIndex<length){if(lookahead.type!==Token.StringLiteral){break;}token=lookahead;statement=parseStatementListItem();body.push(statement);if(statement.expression.type!==Syntax.Literal){// this is not directive
7295break;}directive=source.slice(token.start+1,token.end-1);if(directive==='use strict'){strict=true;if(firstRestricted){tolerateUnexpectedToken(firstRestricted,Messages.StrictOctalLiteral);}}else{if(!firstRestricted&&token.octal){firstRestricted=token;}}}oldLabelSet=state.labelSet;oldInIteration=state.inIteration;oldInSwitch=state.inSwitch;oldInFunctionBody=state.inFunctionBody;state.labelSet={};state.inIteration=false;state.inSwitch=false;state.inFunctionBody=true;while(startIndex<length){if(match('}')){break;}body.push(parseStatementListItem());}expect('}');state.labelSet=oldLabelSet;state.inIteration=oldInIteration;state.inSwitch=oldInSwitch;state.inFunctionBody=oldInFunctionBody;return node.finishBlockStatement(body);}function validateParam(options,param,name){var key='$'+name;if(strict){if(isRestrictedWord(name)){options.stricted=param;options.message=Messages.StrictParamName;}if(Object.prototype.hasOwnProperty.call(options.paramSet,key)){options.stricted=param;options.message=Messages.StrictParamDupe;}}else if(!options.firstRestricted){if(isRestrictedWord(name)){options.firstRestricted=param;options.message=Messages.StrictParamName;}else if(isStrictModeReservedWord(name)){options.firstRestricted=param;options.message=Messages.StrictReservedWord;}else if(Object.prototype.hasOwnProperty.call(options.paramSet,key)){options.stricted=param;options.message=Messages.StrictParamDupe;}}options.paramSet[key]=true;}function parseParam(options){var token,param,params=[],i,def;token=lookahead;if(token.value==='...'){param=parseRestElement(params);validateParam(options,param.argument,param.argument.name);options.params.push(param);options.defaults.push(null);return false;}param=parsePatternWithDefault(params);for(i=0;i<params.length;i++){validateParam(options,params[i],params[i].value);}if(param.type===Syntax.AssignmentPattern){def=param.right;param=param.left;++options.defaultCount;}options.params.push(param);options.defaults.push(def);return!match(')');}function parseParams(firstRestricted){var options;options={params:[],defaultCount:0,defaults:[],firstRestricted:firstRestricted};expect('(');if(!match(')')){options.paramSet={};while(startIndex<length){if(!parseParam(options)){break;}expect(',');}}expect(')');if(options.defaultCount===0){options.defaults=[];}return{params:options.params,defaults:options.defaults,stricted:options.stricted,firstRestricted:options.firstRestricted,message:options.message};}function parseFunctionDeclaration(node,identifierIsOptional){var id=null,params=[],defaults=[],body,token,stricted,tmp,firstRestricted,message,previousStrict,isGenerator,previousAllowYield;previousAllowYield=state.allowYield;expectKeyword('function');isGenerator=match('*');if(isGenerator){lex();}if(!identifierIsOptional||!match('(')){token=lookahead;id=parseVariableIdentifier();if(strict){if(isRestrictedWord(token.value)){tolerateUnexpectedToken(token,Messages.StrictFunctionName);}}else{if(isRestrictedWord(token.value)){firstRestricted=token;message=Messages.StrictFunctionName;}else if(isStrictModeReservedWord(token.value)){firstRestricted=token;message=Messages.StrictReservedWord;}}}state.allowYield=!isGenerator;tmp=parseParams(firstRestricted);params=tmp.params;defaults=tmp.defaults;stricted=tmp.stricted;firstRestricted=tmp.firstRestricted;if(tmp.message){message=tmp.message;}previousStrict=strict;body=parseFunctionSourceElements();if(strict&&firstRestricted){throwUnexpectedToken(firstRestricted,message);}if(strict&&stricted){tolerateUnexpectedToken(stricted,message);}strict=previousStrict;state.allowYield=previousAllowYield;return node.finishFunctionDeclaration(id,params,defaults,body,isGenerator);}function parseFunctionExpression(){var token,id=null,stricted,firstRestricted,message,tmp,params=[],defaults=[],body,previousStrict,node=new Node(),isGenerator,previousAllowYield;previousAllowYield=state.allowYield;expectKeyword('function');isGenerator=match('*');if(isGenerator){lex();}state.allowYield=!isGenerator;if(!match('(')){token=lookahead;id=!strict&&!isGenerator&&matchKeyword('yield')?parseNonComputedProperty():parseVariableIdentifier();if(strict){if(isRestrictedWord(token.value)){tolerateUnexpectedToken(token,Messages.StrictFunctionName);}}else{if(isRestrictedWord(token.value)){firstRestricted=token;message=Messages.StrictFunctionName;}else if(isStrictModeReservedWord(token.value)){firstRestricted=token;message=Messages.StrictReservedWord;}}}tmp=parseParams(firstRestricted);params=tmp.params;defaults=tmp.defaults;stricted=tmp.stricted;firstRestricted=tmp.firstRestricted;if(tmp.message){message=tmp.message;}previousStrict=strict;body=parseFunctionSourceElements();if(strict&&firstRestricted){throwUnexpectedToken(firstRestricted,message);}if(strict&&stricted){tolerateUnexpectedToken(stricted,message);}strict=previousStrict;state.allowYield=previousAllowYield;return node.finishFunctionExpression(id,params,defaults,body,isGenerator);}// ECMA-262 14.5 Class Definitions
7296function parseClassBody(){var classBody,token,isStatic,hasConstructor=false,body,method,computed,key;classBody=new Node();expect('{');body=[];while(!match('}')){if(match(';')){lex();}else{method=new Node();token=lookahead;isStatic=false;computed=match('[');if(match('*')){lex();}else{key=parseObjectPropertyKey();if(key.name==='static'&&(lookaheadPropertyName()||match('*'))){token=lookahead;isStatic=true;computed=match('[');if(match('*')){lex();}else{key=parseObjectPropertyKey();}}}method=tryParseMethodDefinition(token,key,computed,method);if(method){method['static']=isStatic;// jscs:ignore requireDotNotation
7297if(method.kind==='init'){method.kind='method';}if(!isStatic){if(!method.computed&&(method.key.name||method.key.value.toString())==='constructor'){if(method.kind!=='method'||!method.method||method.value.generator){throwUnexpectedToken(token,Messages.ConstructorSpecialMethod);}if(hasConstructor){throwUnexpectedToken(token,Messages.DuplicateConstructor);}else{hasConstructor=true;}method.kind='constructor';}}else{if(!method.computed&&(method.key.name||method.key.value.toString())==='prototype'){throwUnexpectedToken(token,Messages.StaticPrototype);}}method.type=Syntax.MethodDefinition;delete method.method;delete method.shorthand;body.push(method);}else{throwUnexpectedToken(lookahead);}}}lex();return classBody.finishClassBody(body);}function parseClassDeclaration(identifierIsOptional){var id=null,superClass=null,classNode=new Node(),classBody,previousStrict=strict;strict=true;expectKeyword('class');if(!identifierIsOptional||lookahead.type===Token.Identifier){id=parseVariableIdentifier();}if(matchKeyword('extends')){lex();superClass=isolateCoverGrammar(parseLeftHandSideExpressionAllowCall);}classBody=parseClassBody();strict=previousStrict;return classNode.finishClassDeclaration(id,superClass,classBody);}function parseClassExpression(){var id=null,superClass=null,classNode=new Node(),classBody,previousStrict=strict;strict=true;expectKeyword('class');if(lookahead.type===Token.Identifier){id=parseVariableIdentifier();}if(matchKeyword('extends')){lex();superClass=isolateCoverGrammar(parseLeftHandSideExpressionAllowCall);}classBody=parseClassBody();strict=previousStrict;return classNode.finishClassExpression(id,superClass,classBody);}// ECMA-262 15.2 Modules
7298function parseModuleSpecifier(){var node=new Node();if(lookahead.type!==Token.StringLiteral){throwError(Messages.InvalidModuleSpecifier);}return node.finishLiteral(lex());}// ECMA-262 15.2.3 Exports
7299function parseExportSpecifier(){var exported,local,node=new Node(),def;if(matchKeyword('default')){// export {default} from 'something';
7300def=new Node();lex();local=def.finishIdentifier('default');}else{local=parseVariableIdentifier();}if(matchContextualKeyword('as')){lex();exported=parseNonComputedProperty();}return node.finishExportSpecifier(local,exported);}function parseExportNamedDeclaration(node){var declaration=null,isExportFromIdentifier,src=null,specifiers=[];// non-default export
7301if(lookahead.type===Token.Keyword){// covers:
7302// export var f = 1;
7303switch(lookahead.value){case'let':case'const':declaration=parseLexicalDeclaration({inFor:false});return node.finishExportNamedDeclaration(declaration,specifiers,null);case'var':case'class':case'function':declaration=parseStatementListItem();return node.finishExportNamedDeclaration(declaration,specifiers,null);}}expect('{');while(!match('}')){isExportFromIdentifier=isExportFromIdentifier||matchKeyword('default');specifiers.push(parseExportSpecifier());if(!match('}')){expect(',');if(match('}')){break;}}}expect('}');if(matchContextualKeyword('from')){// covering:
7304// export {default} from 'foo';
7305// export {foo} from 'foo';
7306lex();src=parseModuleSpecifier();consumeSemicolon();}else if(isExportFromIdentifier){// covering:
7307// export {default}; // missing fromClause
7308throwError(lookahead.value?Messages.UnexpectedToken:Messages.MissingFromClause,lookahead.value);}else{// cover
7309// export {foo};
7310consumeSemicolon();}return node.finishExportNamedDeclaration(declaration,specifiers,src);}function parseExportDefaultDeclaration(node){var declaration=null,expression=null;// covers:
7311// export default ...
7312expectKeyword('default');if(matchKeyword('function')){// covers:
7313// export default function foo () {}
7314// export default function () {}
7315declaration=parseFunctionDeclaration(new Node(),true);return node.finishExportDefaultDeclaration(declaration);}if(matchKeyword('class')){declaration=parseClassDeclaration(true);return node.finishExportDefaultDeclaration(declaration);}if(matchContextualKeyword('from')){throwError(Messages.UnexpectedToken,lookahead.value);}// covers:
7316// export default {};
7317// export default [];
7318// export default (1 + 2);
7319if(match('{')){expression=parseObjectInitializer();}else if(match('[')){expression=parseArrayInitializer();}else{expression=parseAssignmentExpression();}consumeSemicolon();return node.finishExportDefaultDeclaration(expression);}function parseExportAllDeclaration(node){var src;// covers:
7320// export * from 'foo';
7321expect('*');if(!matchContextualKeyword('from')){throwError(lookahead.value?Messages.UnexpectedToken:Messages.MissingFromClause,lookahead.value);}lex();src=parseModuleSpecifier();consumeSemicolon();return node.finishExportAllDeclaration(src);}function parseExportDeclaration(){var node=new Node();if(state.inFunctionBody){throwError(Messages.IllegalExportDeclaration);}expectKeyword('export');if(matchKeyword('default')){return parseExportDefaultDeclaration(node);}if(match('*')){return parseExportAllDeclaration(node);}return parseExportNamedDeclaration(node);}// ECMA-262 15.2.2 Imports
7322function parseImportSpecifier(){// import {<foo as bar>} ...;
7323var local,imported,node=new Node();imported=parseNonComputedProperty();if(matchContextualKeyword('as')){lex();local=parseVariableIdentifier();}return node.finishImportSpecifier(local,imported);}function parseNamedImports(){var specifiers=[];// {foo, bar as bas}
7324expect('{');while(!match('}')){specifiers.push(parseImportSpecifier());if(!match('}')){expect(',');if(match('}')){break;}}}expect('}');return specifiers;}function parseImportDefaultSpecifier(){// import <foo> ...;
7325var local,node=new Node();local=parseNonComputedProperty();return node.finishImportDefaultSpecifier(local);}function parseImportNamespaceSpecifier(){// import <* as foo> ...;
7326var local,node=new Node();expect('*');if(!matchContextualKeyword('as')){throwError(Messages.NoAsAfterImportNamespace);}lex();local=parseNonComputedProperty();return node.finishImportNamespaceSpecifier(local);}function parseImportDeclaration(){var specifiers=[],src,node=new Node();if(state.inFunctionBody){throwError(Messages.IllegalImportDeclaration);}expectKeyword('import');if(lookahead.type===Token.StringLiteral){// import 'foo';
7327src=parseModuleSpecifier();}else{if(match('{')){// import {bar}
7328specifiers=specifiers.concat(parseNamedImports());}else if(match('*')){// import * as foo
7329specifiers.push(parseImportNamespaceSpecifier());}else if(isIdentifierName(lookahead)&&!matchKeyword('default')){// import foo
7330specifiers.push(parseImportDefaultSpecifier());if(match(',')){lex();if(match('*')){// import foo, * as foo
7331specifiers.push(parseImportNamespaceSpecifier());}else if(match('{')){// import foo, {bar}
7332specifiers=specifiers.concat(parseNamedImports());}else{throwUnexpectedToken(lookahead);}}}else{throwUnexpectedToken(lex());}if(!matchContextualKeyword('from')){throwError(lookahead.value?Messages.UnexpectedToken:Messages.MissingFromClause,lookahead.value);}lex();src=parseModuleSpecifier();}consumeSemicolon();return node.finishImportDeclaration(specifiers,src);}// ECMA-262 15.1 Scripts
7333function parseScriptBody(){var statement,body=[],token,directive,firstRestricted;while(startIndex<length){token=lookahead;if(token.type!==Token.StringLiteral){break;}statement=parseStatementListItem();body.push(statement);if(statement.expression.type!==Syntax.Literal){// this is not directive
7334break;}directive=source.slice(token.start+1,token.end-1);if(directive==='use strict'){strict=true;if(firstRestricted){tolerateUnexpectedToken(firstRestricted,Messages.StrictOctalLiteral);}}else{if(!firstRestricted&&token.octal){firstRestricted=token;}}}while(startIndex<length){statement=parseStatementListItem();/* istanbul ignore if */if(typeof statement==='undefined'){break;}body.push(statement);}return body;}function parseProgram(){var body,node;peek();node=new Node();body=parseScriptBody();return node.finishProgram(body,state.sourceType);}function filterTokenLocation(){var i,entry,token,tokens=[];for(i=0;i<extra.tokens.length;++i){entry=extra.tokens[i];token={type:entry.type,value:entry.value};if(entry.regex){token.regex={pattern:entry.regex.pattern,flags:entry.regex.flags};}if(extra.range){token.range=entry.range;}if(extra.loc){token.loc=entry.loc;}tokens.push(token);}extra.tokens=tokens;}function tokenize(code,options,delegate){var toString,tokens;toString=String;if(typeof code!=='string'&&!(code instanceof String)){code=toString(code);}source=code;index=0;lineNumber=source.length>0?1:0;lineStart=0;startIndex=index;startLineNumber=lineNumber;startLineStart=lineStart;length=source.length;lookahead=null;state={allowIn:true,allowYield:true,labelSet:{},inFunctionBody:false,inIteration:false,inSwitch:false,lastCommentStart:-1,curlyStack:[]};extra={};// Options matching.
7335options=options||{};// Of course we collect tokens here.
7336options.tokens=true;extra.tokens=[];extra.tokenValues=[];extra.tokenize=true;extra.delegate=delegate;// The following two fields are necessary to compute the Regex tokens.
7337extra.openParenToken=-1;extra.openCurlyToken=-1;extra.range=typeof options.range==='boolean'&&options.range;extra.loc=typeof options.loc==='boolean'&&options.loc;if(typeof options.comment==='boolean'&&options.comment){extra.comments=[];}if(typeof options.tolerant==='boolean'&&options.tolerant){extra.errors=[];}try{peek();if(lookahead.type===Token.EOF){return extra.tokens;}lex();while(lookahead.type!==Token.EOF){try{lex();}catch(lexError){if(extra.errors){recordError(lexError);// We have to break on the first error
7338// to avoid infinite loops.
7339break;}else{throw lexError;}}}tokens=extra.tokens;if(typeof extra.errors!=='undefined'){tokens.errors=extra.errors;}}catch(e){throw e;}finally{extra={};}return tokens;}function parse(code,options){var program,toString;toString=String;if(typeof code!=='string'&&!(code instanceof String)){code=toString(code);}source=code;index=0;lineNumber=source.length>0?1:0;lineStart=0;startIndex=index;startLineNumber=lineNumber;startLineStart=lineStart;length=source.length;lookahead=null;state={allowIn:true,allowYield:true,labelSet:{},inFunctionBody:false,inIteration:false,inSwitch:false,lastCommentStart:-1,curlyStack:[],sourceType:'script'};strict=false;extra={};if(typeof options!=='undefined'){extra.range=typeof options.range==='boolean'&&options.range;extra.loc=typeof options.loc==='boolean'&&options.loc;extra.attachComment=typeof options.attachComment==='boolean'&&options.attachComment;if(extra.loc&&options.source!==null&&options.source!==undefined){extra.source=toString(options.source);}if(typeof options.tokens==='boolean'&&options.tokens){extra.tokens=[];}if(typeof options.comment==='boolean'&&options.comment){extra.comments=[];}if(typeof options.tolerant==='boolean'&&options.tolerant){extra.errors=[];}if(extra.attachComment){extra.range=true;extra.comments=[];extra.bottomRightStack=[];extra.trailingComments=[];extra.leadingComments=[];}if(options.sourceType==='module'){// very restrictive condition for now
7340state.sourceType=options.sourceType;strict=true;}}try{program=parseProgram();if(typeof extra.comments!=='undefined'){program.comments=extra.comments;}if(typeof extra.tokens!=='undefined'){filterTokenLocation();program.tokens=extra.tokens;}if(typeof extra.errors!=='undefined'){program.errors=extra.errors;}}catch(e){throw e;}finally{extra={};}return program;}// Sync with *.json manifests.
7341exports.version='2.7.2';exports.tokenize=tokenize;exports.parse=parse;// Deep copy.
7342/* istanbul ignore next */exports.Syntax=function(){var name,types={};if(typeof Object.create==='function'){types=Object.create(null);}for(name in Syntax){if(Syntax.hasOwnProperty(name)){types[name]=Syntax[name];}}if(typeof Object.freeze==='function'){Object.freeze(types);}return types;}();});/* vim: set sw=4 ts=4 et tw=80 : */},{}],12:[function(require,module,exports){},{}],13:[function(require,module,exports){// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
7343//
7344// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
7345//
7346// Originally from narwhal.js (http://narwhaljs.org)
7347// Copyright (c) 2009 Thomas Robinson <280north.com>
7348//
7349// Permission is hereby granted, free of charge, to any person obtaining a copy
7350// of this software and associated documentation files (the 'Software'), to
7351// deal in the Software without restriction, including without limitation the
7352// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7353// sell copies of the Software, and to permit persons to whom the Software is
7354// furnished to do so, subject to the following conditions:
7355//
7356// The above copyright notice and this permission notice shall be included in
7357// all copies or substantial portions of the Software.
7358//
7359// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
7360// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
7361// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
7362// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
7363// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
7364// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7365// when used in node, this will actually load the util module we depend on
7366// versus loading the builtin util module as happens otherwise
7367// this is a bug in node module loading as far as I am concerned
7368var util=require('util/');var pSlice=Array.prototype.slice;var hasOwn=Object.prototype.hasOwnProperty;// 1. The assert module provides functions that throw
7369// AssertionError's when particular conditions are not met. The
7370// assert module must conform to the following interface.
7371var assert=module.exports=ok;// 2. The AssertionError is defined in assert.
7372// new assert.AssertionError({ message: message,
7373// actual: actual,
7374// expected: expected })
7375assert.AssertionError=function AssertionError(options){this.name='AssertionError';this.actual=options.actual;this.expected=options.expected;this.operator=options.operator;if(options.message){this.message=options.message;this.generatedMessage=false;}else{this.message=getMessage(this);this.generatedMessage=true;}var stackStartFunction=options.stackStartFunction||fail;if(Error.captureStackTrace){Error.captureStackTrace(this,stackStartFunction);}else{// non v8 browsers so we can have a stacktrace
7376var err=new Error();if(err.stack){var out=err.stack;// try to strip useless frames
7377var fn_name=stackStartFunction.name;var idx=out.indexOf('\n'+fn_name);if(idx>=0){// once we have located the function frame
7378// we need to strip out everything before it (and its line)
7379var next_line=out.indexOf('\n',idx+1);out=out.substring(next_line+1);}this.stack=out;}}};// assert.AssertionError instanceof Error
7380util.inherits(assert.AssertionError,Error);function replacer(key,value){if(util.isUndefined(value)){return''+value;}if(util.isNumber(value)&&!isFinite(value)){return value.toString();}if(util.isFunction(value)||util.isRegExp(value)){return value.toString();}return value;}function truncate(s,n){if(util.isString(s)){return s.length<n?s:s.slice(0,n);}else{return s;}}function getMessage(self){return truncate(JSON.stringify(self.actual,replacer),128)+' '+self.operator+' '+truncate(JSON.stringify(self.expected,replacer),128);}// At present only the three keys mentioned above are used and
7381// understood by the spec. Implementations or sub modules can pass
7382// other keys to the AssertionError's constructor - they will be
7383// ignored.
7384// 3. All of the following functions must throw an AssertionError
7385// when a corresponding condition is not met, with a message that
7386// may be undefined if not provided. All assertion methods provide
7387// both the actual and expected values to the assertion error for
7388// display purposes.
7389function fail(actual,expected,message,operator,stackStartFunction){throw new assert.AssertionError({message:message,actual:actual,expected:expected,operator:operator,stackStartFunction:stackStartFunction});}// EXTENSION! allows for well behaved errors defined elsewhere.
7390assert.fail=fail;// 4. Pure assertion tests whether a value is truthy, as determined
7391// by !!guard.
7392// assert.ok(guard, message_opt);
7393// This statement is equivalent to assert.equal(true, !!guard,
7394// message_opt);. To test strictly for the value true, use
7395// assert.strictEqual(true, guard, message_opt);.
7396function ok(value,message){if(!value)fail(value,true,message,'==',assert.ok);}assert.ok=ok;// 5. The equality assertion tests shallow, coercive equality with
7397// ==.
7398// assert.equal(actual, expected, message_opt);
7399assert.equal=function equal(actual,expected,message){if(actual!=expected)fail(actual,expected,message,'==',assert.equal);};// 6. The non-equality assertion tests for whether two objects are not equal
7400// with != assert.notEqual(actual, expected, message_opt);
7401assert.notEqual=function notEqual(actual,expected,message){if(actual==expected){fail(actual,expected,message,'!=',assert.notEqual);}};// 7. The equivalence assertion tests a deep equality relation.
7402// assert.deepEqual(actual, expected, message_opt);
7403assert.deepEqual=function deepEqual(actual,expected,message){if(!_deepEqual(actual,expected)){fail(actual,expected,message,'deepEqual',assert.deepEqual);}};function _deepEqual(actual,expected){// 7.1. All identical values are equivalent, as determined by ===.
7404if(actual===expected){return true;}else if(util.isBuffer(actual)&&util.isBuffer(expected)){if(actual.length!=expected.length)return false;for(var i=0;i<actual.length;i++){if(actual[i]!==expected[i])return false;}return true;// 7.2. If the expected value is a Date object, the actual value is
7405// equivalent if it is also a Date object that refers to the same time.
7406}else if(util.isDate(actual)&&util.isDate(expected)){return actual.getTime()===expected.getTime();// 7.3 If the expected value is a RegExp object, the actual value is
7407// equivalent if it is also a RegExp object with the same source and
7408// properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
7409}else if(util.isRegExp(actual)&&util.isRegExp(expected)){return actual.source===expected.source&&actual.global===expected.global&&actual.multiline===expected.multiline&&actual.lastIndex===expected.lastIndex&&actual.ignoreCase===expected.ignoreCase;// 7.4. Other pairs that do not both pass typeof value == 'object',
7410// equivalence is determined by ==.
7411}else if(!util.isObject(actual)&&!util.isObject(expected)){return actual==expected;// 7.5 For all other Object pairs, including Array objects, equivalence is
7412// determined by having the same number of owned properties (as verified
7413// with Object.prototype.hasOwnProperty.call), the same set of keys
7414// (although not necessarily the same order), equivalent values for every
7415// corresponding key, and an identical 'prototype' property. Note: this
7416// accounts for both named and indexed properties on Arrays.
7417}else{return objEquiv(actual,expected);}}function isArguments(object){return Object.prototype.toString.call(object)=='[object Arguments]';}function objEquiv(a,b){if(util.isNullOrUndefined(a)||util.isNullOrUndefined(b))return false;// an identical 'prototype' property.
7418if(a.prototype!==b.prototype)return false;// if one is a primitive, the other must be same
7419if(util.isPrimitive(a)||util.isPrimitive(b)){return a===b;}var aIsArgs=isArguments(a),bIsArgs=isArguments(b);if(aIsArgs&&!bIsArgs||!aIsArgs&&bIsArgs)return false;if(aIsArgs){a=pSlice.call(a);b=pSlice.call(b);return _deepEqual(a,b);}var ka=objectKeys(a),kb=objectKeys(b),key,i;// having the same number of owned properties (keys incorporates
7420// hasOwnProperty)
7421if(ka.length!=kb.length)return false;//the same set of keys (although not necessarily the same order),
7422ka.sort();kb.sort();//~~~cheap key test
7423for(i=ka.length-1;i>=0;i--){if(ka[i]!=kb[i])return false;}//equivalent values for every corresponding key, and
7424//~~~possibly expensive deep test
7425for(i=ka.length-1;i>=0;i--){key=ka[i];if(!_deepEqual(a[key],b[key]))return false;}return true;}// 8. The non-equivalence assertion tests for any deep inequality.
7426// assert.notDeepEqual(actual, expected, message_opt);
7427assert.notDeepEqual=function notDeepEqual(actual,expected,message){if(_deepEqual(actual,expected)){fail(actual,expected,message,'notDeepEqual',assert.notDeepEqual);}};// 9. The strict equality assertion tests strict equality, as determined by ===.
7428// assert.strictEqual(actual, expected, message_opt);
7429assert.strictEqual=function strictEqual(actual,expected,message){if(actual!==expected){fail(actual,expected,message,'===',assert.strictEqual);}};// 10. The strict non-equality assertion tests for strict inequality, as
7430// determined by !==. assert.notStrictEqual(actual, expected, message_opt);
7431assert.notStrictEqual=function notStrictEqual(actual,expected,message){if(actual===expected){fail(actual,expected,message,'!==',assert.notStrictEqual);}};function expectedException(actual,expected){if(!actual||!expected){return false;}if(Object.prototype.toString.call(expected)=='[object RegExp]'){return expected.test(actual);}else if(actual instanceof expected){return true;}else if(expected.call({},actual)===true){return true;}return false;}function _throws(shouldThrow,block,expected,message){var actual;if(util.isString(expected)){message=expected;expected=null;}try{block();}catch(e){actual=e;}message=(expected&&expected.name?' ('+expected.name+').':'.')+(message?' '+message:'.');if(shouldThrow&&!actual){fail(actual,expected,'Missing expected exception'+message);}if(!shouldThrow&&expectedException(actual,expected)){fail(actual,expected,'Got unwanted exception'+message);}if(shouldThrow&&actual&&expected&&!expectedException(actual,expected)||!shouldThrow&&actual){throw actual;}}// 11. Expected to throw an error:
7432// assert.throws(block, Error_opt, message_opt);
7433assert.throws=function(block,/*optional*/error,/*optional*/message){_throws.apply(this,[true].concat(pSlice.call(arguments)));};// EXTENSION! This is annoying to write outside this module.
7434assert.doesNotThrow=function(block,/*optional*/message){_throws.apply(this,[false].concat(pSlice.call(arguments)));};assert.ifError=function(err){if(err){throw err;}};var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj){if(hasOwn.call(obj,key))keys.push(key);}return keys;};},{"util/":54}],14:[function(require,module,exports){arguments[4][12][0].apply(exports,arguments);},{"dup":12}],15:[function(require,module,exports){(function(global){/*!
7435 * The buffer module from node.js, for the browser.
7436 *
7437 * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
7438 * @license MIT
7439 *//* eslint-disable no-proto */'use strict';var base64=require('base64-js');var ieee754=require('ieee754');var isArray=require('isarray');exports.Buffer=Buffer;exports.SlowBuffer=SlowBuffer;exports.INSPECT_MAX_BYTES=50;/**
7440 * If `Buffer.TYPED_ARRAY_SUPPORT`:
7441 * === true Use Uint8Array implementation (fastest)
7442 * === false Use Object implementation (most compatible, even IE6)
7443 *
7444 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
7445 * Opera 11.6+, iOS 4.2+.
7446 *
7447 * Due to various browser bugs, sometimes the Object implementation will be used even
7448 * when the browser supports typed arrays.
7449 *
7450 * Note:
7451 *
7452 * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
7453 * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
7454 *
7455 * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
7456 *
7457 * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
7458 * incorrect length in some situations.
7459
7460 * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
7461 * get the Object implementation, which is slower but behaves correctly.
7462 */Buffer.TYPED_ARRAY_SUPPORT=global.TYPED_ARRAY_SUPPORT!==undefined?global.TYPED_ARRAY_SUPPORT:typedArraySupport();/*
7463 * Export kMaxLength after typed array support is determined.
7464 */exports.kMaxLength=kMaxLength();function typedArraySupport(){try{var arr=new Uint8Array(1);arr.__proto__={__proto__:Uint8Array.prototype,foo:function foo(){return 42;}};return arr.foo()===42&&// typed array instances can be augmented
7465typeof arr.subarray==='function'&&// chrome 9-10 lack `subarray`
7466arr.subarray(1,1).byteLength===0;// ie10 has broken `subarray`
7467}catch(e){return false;}}function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?0x7fffffff:0x3fffffff;}function createBuffer(that,length){if(kMaxLength()<length){throw new RangeError('Invalid typed array length');}if(Buffer.TYPED_ARRAY_SUPPORT){// Return an augmented `Uint8Array` instance, for best performance
7468that=new Uint8Array(length);that.__proto__=Buffer.prototype;}else{// Fallback: Return an object instance of the Buffer class
7469if(that===null){that=new Buffer(length);}that.length=length;}return that;}/**
7470 * The Buffer constructor returns instances of `Uint8Array` that have their
7471 * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
7472 * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
7473 * and the `Uint8Array` methods. Square bracket notation works as expected -- it
7474 * returns a single octet.
7475 *
7476 * The `Uint8Array` prototype remains unmodified.
7477 */function Buffer(arg,encodingOrOffset,length){if(!Buffer.TYPED_ARRAY_SUPPORT&&!(this instanceof Buffer)){return new Buffer(arg,encodingOrOffset,length);}// Common case.
7478if(typeof arg==='number'){if(typeof encodingOrOffset==='string'){throw new Error('If encoding is specified then the first argument must be a string');}return allocUnsafe(this,arg);}return from(this,arg,encodingOrOffset,length);}Buffer.poolSize=8192;// not used by this implementation
7479// TODO: Legacy, not needed anymore. Remove in next major version.
7480Buffer._augment=function(arr){arr.__proto__=Buffer.prototype;return arr;};function from(that,value,encodingOrOffset,length){if(typeof value==='number'){throw new TypeError('"value" argument must not be a number');}if(typeof ArrayBuffer!=='undefined'&&value instanceof ArrayBuffer){return fromArrayBuffer(that,value,encodingOrOffset,length);}if(typeof value==='string'){return fromString(that,value,encodingOrOffset);}return fromObject(that,value);}/**
7481 * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
7482 * if value is a number.
7483 * Buffer.from(str[, encoding])
7484 * Buffer.from(array)
7485 * Buffer.from(buffer)
7486 * Buffer.from(arrayBuffer[, byteOffset[, length]])
7487 **/Buffer.from=function(value,encodingOrOffset,length){return from(null,value,encodingOrOffset,length);};if(Buffer.TYPED_ARRAY_SUPPORT){Buffer.prototype.__proto__=Uint8Array.prototype;Buffer.__proto__=Uint8Array;if(typeof Symbol!=='undefined'&&Symbol.species&&Buffer[Symbol.species]===Buffer){// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
7488Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:true});}}function assertSize(size){if(typeof size!=='number'){throw new TypeError('"size" argument must be a number');}}function alloc(that,size,fill,encoding){assertSize(size);if(size<=0){return createBuffer(that,size);}if(fill!==undefined){// Only pay attention to encoding if it's a string. This
7489// prevents accidentally sending in a number that would
7490// be interpretted as a start offset.
7491return typeof encoding==='string'?createBuffer(that,size).fill(fill,encoding):createBuffer(that,size).fill(fill);}return createBuffer(that,size);}/**
7492 * Creates a new filled Buffer instance.
7493 * alloc(size[, fill[, encoding]])
7494 **/Buffer.alloc=function(size,fill,encoding){return alloc(null,size,fill,encoding);};function allocUnsafe(that,size){assertSize(size);that=createBuffer(that,size<0?0:checked(size)|0);if(!Buffer.TYPED_ARRAY_SUPPORT){for(var i=0;i<size;++i){that[i]=0;}}return that;}/**
7495 * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
7496 * */Buffer.allocUnsafe=function(size){return allocUnsafe(null,size);};/**
7497 * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
7498 */Buffer.allocUnsafeSlow=function(size){return allocUnsafe(null,size);};function fromString(that,string,encoding){if(typeof encoding!=='string'||encoding===''){encoding='utf8';}if(!Buffer.isEncoding(encoding)){throw new TypeError('"encoding" must be a valid string encoding');}var length=byteLength(string,encoding)|0;that=createBuffer(that,length);var actual=that.write(string,encoding);if(actual!==length){// Writing a hex string, for example, that contains invalid characters will
7499// cause everything after the first invalid character to be ignored. (e.g.
7500// 'abxxcd' will be treated as 'ab')
7501that=that.slice(0,actual);}return that;}function fromArrayLike(that,array){var length=checked(array.length)|0;that=createBuffer(that,length);for(var i=0;i<length;i+=1){that[i]=array[i]&255;}return that;}function fromArrayBuffer(that,array,byteOffset,length){array.byteLength;// this throws if `array` is not a valid ArrayBuffer
7502if(byteOffset<0||array.byteLength<byteOffset){throw new RangeError('\'offset\' is out of bounds');}if(array.byteLength<byteOffset+(length||0)){throw new RangeError('\'length\' is out of bounds');}if(byteOffset===undefined&&length===undefined){array=new Uint8Array(array);}else if(length===undefined){array=new Uint8Array(array,byteOffset);}else{array=new Uint8Array(array,byteOffset,length);}if(Buffer.TYPED_ARRAY_SUPPORT){// Return an augmented `Uint8Array` instance, for best performance
7503that=array;that.__proto__=Buffer.prototype;}else{// Fallback: Return an object instance of the Buffer class
7504that=fromArrayLike(that,array);}return that;}function fromObject(that,obj){if(Buffer.isBuffer(obj)){var len=checked(obj.length)|0;that=createBuffer(that,len);if(that.length===0){return that;}obj.copy(that,0,0,len);return that;}if(obj){if(typeof ArrayBuffer!=='undefined'&&obj.buffer instanceof ArrayBuffer||'length'in obj){if(typeof obj.length!=='number'||isnan(obj.length)){return createBuffer(that,0);}return fromArrayLike(that,obj);}if(obj.type==='Buffer'&&isArray(obj.data)){return fromArrayLike(that,obj.data);}}throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.');}function checked(length){// Note: cannot use `length < kMaxLength` here because that fails when
7505// length is NaN (which is otherwise coerced to zero.)
7506if(length>=kMaxLength()){throw new RangeError('Attempt to allocate Buffer larger than maximum '+'size: 0x'+kMaxLength().toString(16)+' bytes');}return length|0;}function SlowBuffer(length){if(+length!=length){// eslint-disable-line eqeqeq
7507length=0;}return Buffer.alloc(+length);}Buffer.isBuffer=function isBuffer(b){return!!(b!=null&&b._isBuffer);};Buffer.compare=function compare(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b)){throw new TypeError('Arguments must be Buffers');}if(a===b)return 0;var x=a.length;var y=b.length;for(var i=0,len=Math.min(x,y);i<len;++i){if(a[i]!==b[i]){x=a[i];y=b[i];break;}}if(x<y)return-1;if(y<x)return 1;return 0;};Buffer.isEncoding=function isEncoding(encoding){switch(String(encoding).toLowerCase()){case'hex':case'utf8':case'utf-8':case'ascii':case'latin1':case'binary':case'base64':case'ucs2':case'ucs-2':case'utf16le':case'utf-16le':return true;default:return false;}};Buffer.concat=function concat(list,length){if(!isArray(list)){throw new TypeError('"list" argument must be an Array of Buffers');}if(list.length===0){return Buffer.alloc(0);}var i;if(length===undefined){length=0;for(i=0;i<list.length;++i){length+=list[i].length;}}var buffer=Buffer.allocUnsafe(length);var pos=0;for(i=0;i<list.length;++i){var buf=list[i];if(!Buffer.isBuffer(buf)){throw new TypeError('"list" argument must be an Array of Buffers');}buf.copy(buffer,pos);pos+=buf.length;}return buffer;};function byteLength(string,encoding){if(Buffer.isBuffer(string)){return string.length;}if(typeof ArrayBuffer!=='undefined'&&typeof ArrayBuffer.isView==='function'&&(ArrayBuffer.isView(string)||string instanceof ArrayBuffer)){return string.byteLength;}if(typeof string!=='string'){string=''+string;}var len=string.length;if(len===0)return 0;// Use a for loop to avoid recursion
7508var loweredCase=false;for(;;){switch(encoding){case'ascii':case'latin1':case'binary':return len;case'utf8':case'utf-8':case undefined:return utf8ToBytes(string).length;case'ucs2':case'ucs-2':case'utf16le':case'utf-16le':return len*2;case'hex':return len>>>1;case'base64':return base64ToBytes(string).length;default:if(loweredCase)return utf8ToBytes(string).length;// assume utf8
7509encoding=(''+encoding).toLowerCase();loweredCase=true;}}}Buffer.byteLength=byteLength;function slowToString(encoding,start,end){var loweredCase=false;// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
7510// property of a typed array.
7511// This behaves neither like String nor Uint8Array in that we set start/end
7512// to their upper/lower bounds if the value passed is out of range.
7513// undefined is handled specially as per ECMA-262 6th Edition,
7514// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
7515if(start===undefined||start<0){start=0;}// Return early if start > this.length. Done here to prevent potential uint32
7516// coercion fail below.
7517if(start>this.length){return'';}if(end===undefined||end>this.length){end=this.length;}if(end<=0){return'';}// Force coersion to uint32. This will also coerce falsey/NaN values to 0.
7518end>>>=0;start>>>=0;if(end<=start){return'';}if(!encoding)encoding='utf8';while(true){switch(encoding){case'hex':return hexSlice(this,start,end);case'utf8':case'utf-8':return utf8Slice(this,start,end);case'ascii':return asciiSlice(this,start,end);case'latin1':case'binary':return latin1Slice(this,start,end);case'base64':return base64Slice(this,start,end);case'ucs2':case'ucs-2':case'utf16le':case'utf-16le':return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError('Unknown encoding: '+encoding);encoding=(encoding+'').toLowerCase();loweredCase=true;}}}// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
7519// Buffer instances.
7520Buffer.prototype._isBuffer=true;function swap(b,n,m){var i=b[n];b[n]=b[m];b[m]=i;}Buffer.prototype.swap16=function swap16(){var len=this.length;if(len%2!==0){throw new RangeError('Buffer size must be a multiple of 16-bits');}for(var i=0;i<len;i+=2){swap(this,i,i+1);}return this;};Buffer.prototype.swap32=function swap32(){var len=this.length;if(len%4!==0){throw new RangeError('Buffer size must be a multiple of 32-bits');}for(var i=0;i<len;i+=4){swap(this,i,i+3);swap(this,i+1,i+2);}return this;};Buffer.prototype.swap64=function swap64(){var len=this.length;if(len%8!==0){throw new RangeError('Buffer size must be a multiple of 64-bits');}for(var i=0;i<len;i+=8){swap(this,i,i+7);swap(this,i+1,i+6);swap(this,i+2,i+5);swap(this,i+3,i+4);}return this;};Buffer.prototype.toString=function toString(){var length=this.length|0;if(length===0)return'';if(arguments.length===0)return utf8Slice(this,0,length);return slowToString.apply(this,arguments);};Buffer.prototype.equals=function equals(b){if(!Buffer.isBuffer(b))throw new TypeError('Argument must be a Buffer');if(this===b)return true;return Buffer.compare(this,b)===0;};Buffer.prototype.inspect=function inspect(){var str='';var max=exports.INSPECT_MAX_BYTES;if(this.length>0){str=this.toString('hex',0,max).match(/.{2}/g).join(' ');if(this.length>max)str+=' ... ';}return'<Buffer '+str+'>';};Buffer.prototype.compare=function compare(target,start,end,thisStart,thisEnd){if(!Buffer.isBuffer(target)){throw new TypeError('Argument must be a Buffer');}if(start===undefined){start=0;}if(end===undefined){end=target?target.length:0;}if(thisStart===undefined){thisStart=0;}if(thisEnd===undefined){thisEnd=this.length;}if(start<0||end>target.length||thisStart<0||thisEnd>this.length){throw new RangeError('out of range index');}if(thisStart>=thisEnd&&start>=end){return 0;}if(thisStart>=thisEnd){return-1;}if(start>=end){return 1;}start>>>=0;end>>>=0;thisStart>>>=0;thisEnd>>>=0;if(this===target)return 0;var x=thisEnd-thisStart;var y=end-start;var len=Math.min(x,y);var thisCopy=this.slice(thisStart,thisEnd);var targetCopy=target.slice(start,end);for(var i=0;i<len;++i){if(thisCopy[i]!==targetCopy[i]){x=thisCopy[i];y=targetCopy[i];break;}}if(x<y)return-1;if(y<x)return 1;return 0;};// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
7521// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
7522//
7523// Arguments:
7524// - buffer - a Buffer to search
7525// - val - a string, Buffer, or number
7526// - byteOffset - an index into `buffer`; will be clamped to an int32
7527// - encoding - an optional encoding, relevant is val is a string
7528// - dir - true for indexOf, false for lastIndexOf
7529function bidirectionalIndexOf(buffer,val,byteOffset,encoding,dir){// Empty buffer means no match
7530if(buffer.length===0)return-1;// Normalize byteOffset
7531if(typeof byteOffset==='string'){encoding=byteOffset;byteOffset=0;}else if(byteOffset>0x7fffffff){byteOffset=0x7fffffff;}else if(byteOffset<-0x80000000){byteOffset=-0x80000000;}byteOffset=+byteOffset;// Coerce to Number.
7532if(isNaN(byteOffset)){// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
7533byteOffset=dir?0:buffer.length-1;}// Normalize byteOffset: negative offsets start from the end of the buffer
7534if(byteOffset<0)byteOffset=buffer.length+byteOffset;if(byteOffset>=buffer.length){if(dir)return-1;else byteOffset=buffer.length-1;}else if(byteOffset<0){if(dir)byteOffset=0;else return-1;}// Normalize val
7535if(typeof val==='string'){val=Buffer.from(val,encoding);}// Finally, search either indexOf (if dir is true) or lastIndexOf
7536if(Buffer.isBuffer(val)){// Special case: looking for empty string/buffer always fails
7537if(val.length===0){return-1;}return arrayIndexOf(buffer,val,byteOffset,encoding,dir);}else if(typeof val==='number'){val=val&0xFF;// Search for a byte value [0-255]
7538if(Buffer.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf==='function'){if(dir){return Uint8Array.prototype.indexOf.call(buffer,val,byteOffset);}else{return Uint8Array.prototype.lastIndexOf.call(buffer,val,byteOffset);}}return arrayIndexOf(buffer,[val],byteOffset,encoding,dir);}throw new TypeError('val must be string, number or Buffer');}function arrayIndexOf(arr,val,byteOffset,encoding,dir){var indexSize=1;var arrLength=arr.length;var valLength=val.length;if(encoding!==undefined){encoding=String(encoding).toLowerCase();if(encoding==='ucs2'||encoding==='ucs-2'||encoding==='utf16le'||encoding==='utf-16le'){if(arr.length<2||val.length<2){return-1;}indexSize=2;arrLength/=2;valLength/=2;byteOffset/=2;}}function read(buf,i){if(indexSize===1){return buf[i];}else{return buf.readUInt16BE(i*indexSize);}}var i;if(dir){var foundIndex=-1;for(i=byteOffset;i<arrLength;i++){if(read(arr,i)===read(val,foundIndex===-1?0:i-foundIndex)){if(foundIndex===-1)foundIndex=i;if(i-foundIndex+1===valLength)return foundIndex*indexSize;}else{if(foundIndex!==-1)i-=i-foundIndex;foundIndex=-1;}}}else{if(byteOffset+valLength>arrLength)byteOffset=arrLength-valLength;for(i=byteOffset;i>=0;i--){var found=true;for(var j=0;j<valLength;j++){if(read(arr,i+j)!==read(val,j)){found=false;break;}}if(found)return i;}}return-1;}Buffer.prototype.includes=function includes(val,byteOffset,encoding){return this.indexOf(val,byteOffset,encoding)!==-1;};Buffer.prototype.indexOf=function indexOf(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,true);};Buffer.prototype.lastIndexOf=function lastIndexOf(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,false);};function hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;if(!length){length=remaining;}else{length=Number(length);if(length>remaining){length=remaining;}}// must be an even number of digits
7539var strLen=string.length;if(strLen%2!==0)throw new TypeError('Invalid hex string');if(length>strLen/2){length=strLen/2;}for(var i=0;i<length;++i){var parsed=parseInt(string.substr(i*2,2),16);if(isNaN(parsed))return i;buf[offset+i]=parsed;}return i;}function utf8Write(buf,string,offset,length){return blitBuffer(utf8ToBytes(string,buf.length-offset),buf,offset,length);}function asciiWrite(buf,string,offset,length){return blitBuffer(asciiToBytes(string),buf,offset,length);}function latin1Write(buf,string,offset,length){return asciiWrite(buf,string,offset,length);}function base64Write(buf,string,offset,length){return blitBuffer(base64ToBytes(string),buf,offset,length);}function ucs2Write(buf,string,offset,length){return blitBuffer(utf16leToBytes(string,buf.length-offset),buf,offset,length);}Buffer.prototype.write=function write(string,offset,length,encoding){// Buffer#write(string)
7540if(offset===undefined){encoding='utf8';length=this.length;offset=0;// Buffer#write(string, encoding)
7541}else if(length===undefined&&typeof offset==='string'){encoding=offset;length=this.length;offset=0;// Buffer#write(string, offset[, length][, encoding])
7542}else if(isFinite(offset)){offset=offset|0;if(isFinite(length)){length=length|0;if(encoding===undefined)encoding='utf8';}else{encoding=length;length=undefined;}// legacy write(string, encoding, offset, length) - remove in v0.13
7543}else{throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported');}var remaining=this.length-offset;if(length===undefined||length>remaining)length=remaining;if(string.length>0&&(length<0||offset<0)||offset>this.length){throw new RangeError('Attempt to write outside buffer bounds');}if(!encoding)encoding='utf8';var loweredCase=false;for(;;){switch(encoding){case'hex':return hexWrite(this,string,offset,length);case'utf8':case'utf-8':return utf8Write(this,string,offset,length);case'ascii':return asciiWrite(this,string,offset,length);case'latin1':case'binary':return latin1Write(this,string,offset,length);case'base64':// Warning: maxLength not taken into account in base64Write
7544return base64Write(this,string,offset,length);case'ucs2':case'ucs-2':case'utf16le':case'utf-16le':return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError('Unknown encoding: '+encoding);encoding=(''+encoding).toLowerCase();loweredCase=true;}}};Buffer.prototype.toJSON=function toJSON(){return{type:'Buffer',data:Array.prototype.slice.call(this._arr||this,0)};};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf);}else{return base64.fromByteArray(buf.slice(start,end));}}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);var res=[];var i=start;while(i<end){var firstByte=buf[i];var codePoint=null;var bytesPerSequence=firstByte>0xEF?4:firstByte>0xDF?3:firstByte>0xBF?2:1;if(i+bytesPerSequence<=end){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:if(firstByte<0x80){codePoint=firstByte;}break;case 2:secondByte=buf[i+1];if((secondByte&0xC0)===0x80){tempCodePoint=(firstByte&0x1F)<<0x6|secondByte&0x3F;if(tempCodePoint>0x7F){codePoint=tempCodePoint;}}break;case 3:secondByte=buf[i+1];thirdByte=buf[i+2];if((secondByte&0xC0)===0x80&&(thirdByte&0xC0)===0x80){tempCodePoint=(firstByte&0xF)<<0xC|(secondByte&0x3F)<<0x6|thirdByte&0x3F;if(tempCodePoint>0x7FF&&(tempCodePoint<0xD800||tempCodePoint>0xDFFF)){codePoint=tempCodePoint;}}break;case 4:secondByte=buf[i+1];thirdByte=buf[i+2];fourthByte=buf[i+3];if((secondByte&0xC0)===0x80&&(thirdByte&0xC0)===0x80&&(fourthByte&0xC0)===0x80){tempCodePoint=(firstByte&0xF)<<0x12|(secondByte&0x3F)<<0xC|(thirdByte&0x3F)<<0x6|fourthByte&0x3F;if(tempCodePoint>0xFFFF&&tempCodePoint<0x110000){codePoint=tempCodePoint;}}}}if(codePoint===null){// we did not generate a valid codePoint so insert a
7545// replacement char (U+FFFD) and advance only 1 byte
7546codePoint=0xFFFD;bytesPerSequence=1;}else if(codePoint>0xFFFF){// encode to utf16 (surrogate pair dance)
7547codePoint-=0x10000;res.push(codePoint>>>10&0x3FF|0xD800);codePoint=0xDC00|codePoint&0x3FF;}res.push(codePoint);i+=bytesPerSequence;}return decodeCodePointsArray(res);}// Based on http://stackoverflow.com/a/22747272/680742, the browser with
7548// the lowest limit is Chrome, with 0x10000 args.
7549// We go 1 magnitude less, for safety
7550var MAX_ARGUMENTS_LENGTH=0x1000;function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH){return String.fromCharCode.apply(String,codePoints);// avoid extra slice()
7551}// Decode in chunks to avoid "call stack size exceeded".
7552var res='';var i=0;while(i<len){res+=String.fromCharCode.apply(String,codePoints.slice(i,i+=MAX_ARGUMENTS_LENGTH));}return res;}function asciiSlice(buf,start,end){var ret='';end=Math.min(buf.length,end);for(var i=start;i<end;++i){ret+=String.fromCharCode(buf[i]&0x7F);}return ret;}function latin1Slice(buf,start,end){var ret='';end=Math.min(buf.length,end);for(var i=start;i<end;++i){ret+=String.fromCharCode(buf[i]);}return ret;}function hexSlice(buf,start,end){var len=buf.length;if(!start||start<0)start=0;if(!end||end<0||end>len)end=len;var out='';for(var i=start;i<end;++i){out+=toHex(buf[i]);}return out;}function utf16leSlice(buf,start,end){var bytes=buf.slice(start,end);var res='';for(var i=0;i<bytes.length;i+=2){res+=String.fromCharCode(bytes[i]+bytes[i+1]*256);}return res;}Buffer.prototype.slice=function slice(start,end){var len=this.length;start=~~start;end=end===undefined?len:~~end;if(start<0){start+=len;if(start<0)start=0;}else if(start>len){start=len;}if(end<0){end+=len;if(end<0)end=0;}else if(end>len){end=len;}if(end<start)end=start;var newBuf;if(Buffer.TYPED_ARRAY_SUPPORT){newBuf=this.subarray(start,end);newBuf.__proto__=Buffer.prototype;}else{var sliceLen=end-start;newBuf=new Buffer(sliceLen,undefined);for(var i=0;i<sliceLen;++i){newBuf[i]=this[i+start];}}return newBuf;};/*
7553 * Need to make sure that buffer isn't trying to write out of bounds.
7554 */function checkOffset(offset,ext,length){if(offset%1!==0||offset<0)throw new RangeError('offset is not uint');if(offset+ext>length)throw new RangeError('Trying to access beyond buffer length');}Buffer.prototype.readUIntLE=function readUIntLE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=0x100)){val+=this[offset+i]*mul;}return val;};Buffer.prototype.readUIntBE=function readUIntBE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert){checkOffset(offset,byteLength,this.length);}var val=this[offset+--byteLength];var mul=1;while(byteLength>0&&(mul*=0x100)){val+=this[offset+--byteLength]*mul;}return val;};Buffer.prototype.readUInt8=function readUInt8(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);return this[offset];};Buffer.prototype.readUInt16LE=function readUInt16LE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8;};Buffer.prototype.readUInt16BE=function readUInt16BE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1];};Buffer.prototype.readUInt32LE=function readUInt32LE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*0x1000000;};Buffer.prototype.readUInt32BE=function readUInt32BE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*0x1000000+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3]);};Buffer.prototype.readIntLE=function readIntLE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=0x100)){val+=this[offset+i]*mul;}mul*=0x80;if(val>=mul)val-=Math.pow(2,8*byteLength);return val;};Buffer.prototype.readIntBE=function readIntBE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var i=byteLength;var mul=1;var val=this[offset+--i];while(i>0&&(mul*=0x100)){val+=this[offset+--i]*mul;}mul*=0x80;if(val>=mul)val-=Math.pow(2,8*byteLength);return val;};Buffer.prototype.readInt8=function readInt8(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&0x80))return this[offset];return(0xff-this[offset]+1)*-1;};Buffer.prototype.readInt16LE=function readInt16LE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&0x8000?val|0xFFFF0000:val;};Buffer.prototype.readInt16BE=function readInt16BE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&0x8000?val|0xFFFF0000:val;};Buffer.prototype.readInt32LE=function readInt32LE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24;};Buffer.prototype.readInt32BE=function readInt32BE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3];};Buffer.prototype.readFloatLE=function readFloatLE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4);};Buffer.prototype.readFloatBE=function readFloatBE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4);};Buffer.prototype.readDoubleLE=function readDoubleLE(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8);};Buffer.prototype.readDoubleBE=function readDoubleBE(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8);};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(value>max||value<min)throw new RangeError('"value" argument is out of bounds');if(offset+ext>buf.length)throw new RangeError('Index out of range');}Buffer.prototype.writeUIntLE=function writeUIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;byteLength=byteLength|0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0);}var mul=1;var i=0;this[offset]=value&0xFF;while(++i<byteLength&&(mul*=0x100)){this[offset+i]=value/mul&0xFF;}return offset+byteLength;};Buffer.prototype.writeUIntBE=function writeUIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;byteLength=byteLength|0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0);}var i=byteLength-1;var mul=1;this[offset+i]=value&0xFF;while(--i>=0&&(mul*=0x100)){this[offset+i]=value/mul&0xFF;}return offset+byteLength;};Buffer.prototype.writeUInt8=function writeUInt8(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,1,0xff,0);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);this[offset]=value&0xff;return offset+1;};function objectWriteUInt16(buf,value,offset,littleEndian){if(value<0)value=0xffff+value+1;for(var i=0,j=Math.min(buf.length-offset,2);i<j;++i){buf[offset+i]=(value&0xff<<8*(littleEndian?i:1-i))>>>(littleEndian?i:1-i)*8;}}Buffer.prototype.writeUInt16LE=function writeUInt16LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,0xffff,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&0xff;this[offset+1]=value>>>8;}else{objectWriteUInt16(this,value,offset,true);}return offset+2;};Buffer.prototype.writeUInt16BE=function writeUInt16BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,0xffff,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value&0xff;}else{objectWriteUInt16(this,value,offset,false);}return offset+2;};function objectWriteUInt32(buf,value,offset,littleEndian){if(value<0)value=0xffffffff+value+1;for(var i=0,j=Math.min(buf.length-offset,4);i<j;++i){buf[offset+i]=value>>>(littleEndian?i:3-i)*8&0xff;}}Buffer.prototype.writeUInt32LE=function writeUInt32LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,0xffffffff,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value&0xff;}else{objectWriteUInt32(this,value,offset,true);}return offset+4;};Buffer.prototype.writeUInt32BE=function writeUInt32BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,0xffffffff,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&0xff;}else{objectWriteUInt32(this,value,offset,false);}return offset+4;};Buffer.prototype.writeIntLE=function writeIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit);}var i=0;var mul=1;var sub=0;this[offset]=value&0xFF;while(++i<byteLength&&(mul*=0x100)){if(value<0&&sub===0&&this[offset+i-1]!==0){sub=1;}this[offset+i]=(value/mul>>0)-sub&0xFF;}return offset+byteLength;};Buffer.prototype.writeIntBE=function writeIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit);}var i=byteLength-1;var mul=1;var sub=0;this[offset+i]=value&0xFF;while(--i>=0&&(mul*=0x100)){if(value<0&&sub===0&&this[offset+i+1]!==0){sub=1;}this[offset+i]=(value/mul>>0)-sub&0xFF;}return offset+byteLength;};Buffer.prototype.writeInt8=function writeInt8(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,1,0x7f,-0x80);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);if(value<0)value=0xff+value+1;this[offset]=value&0xff;return offset+1;};Buffer.prototype.writeInt16LE=function writeInt16LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,0x7fff,-0x8000);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&0xff;this[offset+1]=value>>>8;}else{objectWriteUInt16(this,value,offset,true);}return offset+2;};Buffer.prototype.writeInt16BE=function writeInt16BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,0x7fff,-0x8000);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value&0xff;}else{objectWriteUInt16(this,value,offset,false);}return offset+2;};Buffer.prototype.writeInt32LE=function writeInt32LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,0x7fffffff,-0x80000000);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&0xff;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24;}else{objectWriteUInt32(this,value,offset,true);}return offset+4;};Buffer.prototype.writeInt32BE=function writeInt32BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,0x7fffffff,-0x80000000);if(value<0)value=0xffffffff+value+1;if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&0xff;}else{objectWriteUInt32(this,value,offset,false);}return offset+4;};function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError('Index out of range');if(offset<0)throw new RangeError('Index out of range');}function writeFloat(buf,value,offset,littleEndian,noAssert){if(!noAssert){checkIEEE754(buf,value,offset,4,3.4028234663852886e+38,-3.4028234663852886e+38);}ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4;}Buffer.prototype.writeFloatLE=function writeFloatLE(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert);};Buffer.prototype.writeFloatBE=function writeFloatBE(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert);};function writeDouble(buf,value,offset,littleEndian,noAssert){if(!noAssert){checkIEEE754(buf,value,offset,8,1.7976931348623157E+308,-1.7976931348623157E+308);}ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8;}Buffer.prototype.writeDoubleLE=function writeDoubleLE(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert);};Buffer.prototype.writeDoubleBE=function writeDoubleBE(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert);};// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
7555Buffer.prototype.copy=function copy(target,targetStart,start,end){if(!start)start=0;if(!end&&end!==0)end=this.length;if(targetStart>=target.length)targetStart=target.length;if(!targetStart)targetStart=0;if(end>0&&end<start)end=start;// Copy 0 bytes; we're done
7556if(end===start)return 0;if(target.length===0||this.length===0)return 0;// Fatal error conditions
7557if(targetStart<0){throw new RangeError('targetStart out of bounds');}if(start<0||start>=this.length)throw new RangeError('sourceStart out of bounds');if(end<0)throw new RangeError('sourceEnd out of bounds');// Are we oob?
7558if(end>this.length)end=this.length;if(target.length-targetStart<end-start){end=target.length-targetStart+start;}var len=end-start;var i;if(this===target&&start<targetStart&&targetStart<end){// descending copy from end
7559for(i=len-1;i>=0;--i){target[i+targetStart]=this[i+start];}}else if(len<1000||!Buffer.TYPED_ARRAY_SUPPORT){// ascending copy from start
7560for(i=0;i<len;++i){target[i+targetStart]=this[i+start];}}else{Uint8Array.prototype.set.call(target,this.subarray(start,start+len),targetStart);}return len;};// Usage:
7561// buffer.fill(number[, offset[, end]])
7562// buffer.fill(buffer[, offset[, end]])
7563// buffer.fill(string[, offset[, end]][, encoding])
7564Buffer.prototype.fill=function fill(val,start,end,encoding){// Handle string cases:
7565if(typeof val==='string'){if(typeof start==='string'){encoding=start;start=0;end=this.length;}else if(typeof end==='string'){encoding=end;end=this.length;}if(val.length===1){var code=val.charCodeAt(0);if(code<256){val=code;}}if(encoding!==undefined&&typeof encoding!=='string'){throw new TypeError('encoding must be a string');}if(typeof encoding==='string'&&!Buffer.isEncoding(encoding)){throw new TypeError('Unknown encoding: '+encoding);}}else if(typeof val==='number'){val=val&255;}// Invalid ranges are not set to a default, so can range check early.
7566if(start<0||this.length<start||this.length<end){throw new RangeError('Out of range index');}if(end<=start){return this;}start=start>>>0;end=end===undefined?this.length:end>>>0;if(!val)val=0;var i;if(typeof val==='number'){for(i=start;i<end;++i){this[i]=val;}}else{var bytes=Buffer.isBuffer(val)?val:utf8ToBytes(new Buffer(val,encoding).toString());var len=bytes.length;for(i=0;i<end-start;++i){this[i+start]=bytes[i%len];}}return this;};// HELPER FUNCTIONS
7567// ================
7568var INVALID_BASE64_RE=/[^+\/0-9A-Za-z-_]/g;function base64clean(str){// Node strips out invalid characters like \n and \t from the string, base64-js does not
7569str=stringtrim(str).replace(INVALID_BASE64_RE,'');// Node converts strings with length < 2 to ''
7570if(str.length<2)return'';// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
7571while(str.length%4!==0){str=str+'=';}return str;}function stringtrim(str){if(str.trim)return str.trim();return str.replace(/^\s+|\s+$/g,'');}function toHex(n){if(n<16)return'0'+n.toString(16);return n.toString(16);}function utf8ToBytes(string,units){units=units||Infinity;var codePoint;var length=string.length;var leadSurrogate=null;var bytes=[];for(var i=0;i<length;++i){codePoint=string.charCodeAt(i);// is surrogate component
7572if(codePoint>0xD7FF&&codePoint<0xE000){// last char was a lead
7573if(!leadSurrogate){// no lead yet
7574if(codePoint>0xDBFF){// unexpected trail
7575if((units-=3)>-1)bytes.push(0xEF,0xBF,0xBD);continue;}else if(i+1===length){// unpaired lead
7576if((units-=3)>-1)bytes.push(0xEF,0xBF,0xBD);continue;}// valid lead
7577leadSurrogate=codePoint;continue;}// 2 leads in a row
7578if(codePoint<0xDC00){if((units-=3)>-1)bytes.push(0xEF,0xBF,0xBD);leadSurrogate=codePoint;continue;}// valid surrogate pair
7579codePoint=(leadSurrogate-0xD800<<10|codePoint-0xDC00)+0x10000;}else if(leadSurrogate){// valid bmp char, but last char was a lead
7580if((units-=3)>-1)bytes.push(0xEF,0xBF,0xBD);}leadSurrogate=null;// encode utf8
7581if(codePoint<0x80){if((units-=1)<0)break;bytes.push(codePoint);}else if(codePoint<0x800){if((units-=2)<0)break;bytes.push(codePoint>>0x6|0xC0,codePoint&0x3F|0x80);}else if(codePoint<0x10000){if((units-=3)<0)break;bytes.push(codePoint>>0xC|0xE0,codePoint>>0x6&0x3F|0x80,codePoint&0x3F|0x80);}else if(codePoint<0x110000){if((units-=4)<0)break;bytes.push(codePoint>>0x12|0xF0,codePoint>>0xC&0x3F|0x80,codePoint>>0x6&0x3F|0x80,codePoint&0x3F|0x80);}else{throw new Error('Invalid code point');}}return bytes;}function asciiToBytes(str){var byteArray=[];for(var i=0;i<str.length;++i){// Node's code seems to be doing this and not & 0x7F..
7582byteArray.push(str.charCodeAt(i)&0xFF);}return byteArray;}function utf16leToBytes(str,units){var c,hi,lo;var byteArray=[];for(var i=0;i<str.length;++i){if((units-=2)<0)break;c=str.charCodeAt(i);hi=c>>8;lo=c%256;byteArray.push(lo);byteArray.push(hi);}return byteArray;}function base64ToBytes(str){return base64.toByteArray(base64clean(str));}function blitBuffer(src,dst,offset,length){for(var i=0;i<length;++i){if(i+offset>=dst.length||i>=src.length)break;dst[i+offset]=src[i];}return i;}function isnan(val){return val!==val;// eslint-disable-line no-self-compare
7583}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"base64-js":16,"ieee754":17,"isarray":18}],16:[function(require,module,exports){'use strict';exports.toByteArray=toByteArray;exports.fromByteArray=fromByteArray;var lookup=[];var revLookup=[];var Arr=typeof Uint8Array!=='undefined'?Uint8Array:Array;function init(){var code='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';for(var i=0,len=code.length;i<len;++i){lookup[i]=code[i];revLookup[code.charCodeAt(i)]=i;}revLookup['-'.charCodeAt(0)]=62;revLookup['_'.charCodeAt(0)]=63;}init();function toByteArray(b64){var i,j,l,tmp,placeHolders,arr;var len=b64.length;if(len%4>0){throw new Error('Invalid string. Length must be a multiple of 4');}// the number of equal signs (place holders)
7584// if there are two placeholders, than the two characters before it
7585// represent one byte
7586// if there is only one, then the three characters before it represent 2 bytes
7587// this is just a cheap hack to not do indexOf twice
7588placeHolders=b64[len-2]==='='?2:b64[len-1]==='='?1:0;// base64 is 4/3 + up to two characters of the original data
7589arr=new Arr(len*3/4-placeHolders);// if there are placeholders, only get up to the last complete 4 chars
7590l=placeHolders>0?len-4:len;var L=0;for(i=0,j=0;i<l;i+=4,j+=3){tmp=revLookup[b64.charCodeAt(i)]<<18|revLookup[b64.charCodeAt(i+1)]<<12|revLookup[b64.charCodeAt(i+2)]<<6|revLookup[b64.charCodeAt(i+3)];arr[L++]=tmp>>16&0xFF;arr[L++]=tmp>>8&0xFF;arr[L++]=tmp&0xFF;}if(placeHolders===2){tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4;arr[L++]=tmp&0xFF;}else if(placeHolders===1){tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2;arr[L++]=tmp>>8&0xFF;arr[L++]=tmp&0xFF;}return arr;}function tripletToBase64(num){return lookup[num>>18&0x3F]+lookup[num>>12&0x3F]+lookup[num>>6&0x3F]+lookup[num&0x3F];}function encodeChunk(uint8,start,end){var tmp;var output=[];for(var i=start;i<end;i+=3){tmp=(uint8[i]<<16)+(uint8[i+1]<<8)+uint8[i+2];output.push(tripletToBase64(tmp));}return output.join('');}function fromByteArray(uint8){var tmp;var len=uint8.length;var extraBytes=len%3;// if we have 1 byte left, pad 2 bytes
7591var output='';var parts=[];var maxChunkLength=16383;// must be multiple of 3
7592// go through the array every three bytes, we'll deal with trailing stuff later
7593for(var i=0,len2=len-extraBytes;i<len2;i+=maxChunkLength){parts.push(encodeChunk(uint8,i,i+maxChunkLength>len2?len2:i+maxChunkLength));}// pad the end with zeros, but make sure to not forget the extra bytes
7594if(extraBytes===1){tmp=uint8[len-1];output+=lookup[tmp>>2];output+=lookup[tmp<<4&0x3F];output+='==';}else if(extraBytes===2){tmp=(uint8[len-2]<<8)+uint8[len-1];output+=lookup[tmp>>10];output+=lookup[tmp>>4&0x3F];output+=lookup[tmp<<2&0x3F];output+='=';}parts.push(output);return parts.join('');}},{}],17:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var nBits=-7;var i=isLE?nBytes-1:0;var d=isLE?-1:1;var s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias;}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity;}else{m=m+Math.pow(2,mLen);e=e-eBias;}return(s?-1:1)*m*Math.pow(2,e-mLen);};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;var i=isLE?0:nBytes-1;var d=isLE?1:-1;var s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax;}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2;}if(e+eBias>=1){value+=rt/c;}else{value+=rt*Math.pow(2,1-eBias);}if(value*c>=2){e++;c/=2;}if(e+eBias>=eMax){m=0;e=eMax;}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias;}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0;}}for(;mLen>=8;buffer[offset+i]=m&0xff,i+=d,m/=256,mLen-=8){}e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&0xff,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128;};},{}],18:[function(require,module,exports){var toString={}.toString;module.exports=Array.isArray||function(arr){return toString.call(arr)=='[object Array]';};},{}],19:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
7595//
7596// Permission is hereby granted, free of charge, to any person obtaining a
7597// copy of this software and associated documentation files (the
7598// "Software"), to deal in the Software without restriction, including
7599// without limitation the rights to use, copy, modify, merge, publish,
7600// distribute, sublicense, and/or sell copies of the Software, and to permit
7601// persons to whom the Software is furnished to do so, subject to the
7602// following conditions:
7603//
7604// The above copyright notice and this permission notice shall be included
7605// in all copies or substantial portions of the Software.
7606//
7607// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
7608// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
7609// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
7610// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
7611// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
7612// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
7613// USE OR OTHER DEALINGS IN THE SOFTWARE.
7614function EventEmitter(){this._events=this._events||{};this._maxListeners=this._maxListeners||undefined;}module.exports=EventEmitter;// Backwards-compat with node 0.10.x
7615EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=undefined;EventEmitter.prototype._maxListeners=undefined;// By default EventEmitters will print a warning if more than 10 listeners are
7616// added to it. This is a useful default which helps finding memory leaks.
7617EventEmitter.defaultMaxListeners=10;// Obviously not all Emitters should be limited to 10. This function allows
7618// that to be increased. Set to zero for unlimited.
7619EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||n<0||isNaN(n))throw TypeError('n must be a positive number');this._maxListeners=n;return this;};EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(!this._events)this._events={};// If there is no 'error' event listener then throw.
7620if(type==='error'){if(!this._events.error||isObject(this._events.error)&&!this._events.error.length){er=arguments[1];if(er instanceof Error){throw er;// Unhandled 'error' event
7621}else{// At least give some kind of context to the user
7622var err=new Error('Uncaught, unspecified "error" event. ('+er+')');err.context=er;throw err;}}}handler=this._events[type];if(isUndefined(handler))return false;if(isFunction(handler)){switch(arguments.length){// fast cases
7623case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;// slower
7624default:args=Array.prototype.slice.call(arguments,1);handler.apply(this,args);}}else if(isObject(handler)){args=Array.prototype.slice.call(arguments,1);listeners=handler.slice();len=listeners.length;for(i=0;i<len;i++){listeners[i].apply(this,args);}}return true;};EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError('listener must be a function');if(!this._events)this._events={};// To avoid recursion in the case that type === "newListener"! Before
7625// adding it to the listeners, first emit "newListener".
7626if(this._events.newListener)this.emit('newListener',type,isFunction(listener.listener)?listener.listener:listener);if(!this._events[type])// Optimize the case of one listener. Don't need the extra array object.
7627this._events[type]=listener;else if(isObject(this._events[type]))// If we've already got an array, just append.
7628this._events[type].push(listener);else// Adding the second element, need to change to array.
7629this._events[type]=[this._events[type],listener];// Check for listener leak
7630if(isObject(this._events[type])&&!this._events[type].warned){if(!isUndefined(this._maxListeners)){m=this._maxListeners;}else{m=EventEmitter.defaultMaxListeners;}if(m&&m>0&&this._events[type].length>m){this._events[type].warned=true;console.error('(node) warning: possible EventEmitter memory '+'leak detected. %d listeners added. '+'Use emitter.setMaxListeners() to increase limit.',this._events[type].length);if(typeof console.trace==='function'){// not supported in IE 10
7631console.trace();}}}return this;};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.once=function(type,listener){if(!isFunction(listener))throw TypeError('listener must be a function');var fired=false;function g(){this.removeListener(type,g);if(!fired){fired=true;listener.apply(this,arguments);}}g.listener=listener;this.on(type,g);return this;};// emits a 'removeListener' event iff the listener was removed
7632EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError('listener must be a function');if(!this._events||!this._events[type])return this;list=this._events[type];length=list.length;position=-1;if(list===listener||isFunction(list.listener)&&list.listener===listener){delete this._events[type];if(this._events.removeListener)this.emit('removeListener',type,listener);}else if(isObject(list)){for(i=length;i-->0;){if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break;}}if(position<0)return this;if(list.length===1){list.length=0;delete this._events[type];}else{list.splice(position,1);}if(this._events.removeListener)this.emit('removeListener',type,listener);}return this;};EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;// not listening for removeListener, no need to emit
7633if(!this._events.removeListener){if(arguments.length===0)this._events={};else if(this._events[type])delete this._events[type];return this;}// emit removeListener for all listeners on all events
7634if(arguments.length===0){for(key in this._events){if(key==='removeListener')continue;this.removeAllListeners(key);}this.removeAllListeners('removeListener');this._events={};return this;}listeners=this._events[type];if(isFunction(listeners)){this.removeListener(type,listeners);}else if(listeners){// LIFO order
7635while(listeners.length){this.removeListener(type,listeners[listeners.length-1]);}}delete this._events[type];return this;};EventEmitter.prototype.listeners=function(type){var ret;if(!this._events||!this._events[type])ret=[];else if(isFunction(this._events[type]))ret=[this._events[type]];else ret=this._events[type].slice();return ret;};EventEmitter.prototype.listenerCount=function(type){if(this._events){var evlistener=this._events[type];if(isFunction(evlistener))return 1;else if(evlistener)return evlistener.length;}return 0;};EventEmitter.listenerCount=function(emitter,type){return emitter.listenerCount(type);};function isFunction(arg){return typeof arg==='function';}function isNumber(arg){return typeof arg==='number';}function isObject(arg){return(typeof arg==="undefined"?"undefined":_typeof(arg))==='object'&&arg!==null;}function isUndefined(arg){return arg===void 0;}},{}],20:[function(require,module,exports){if(typeof Object.create==='function'){// implementation from standard node.js 'util' module
7636module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}});};}else{// old school shim for old browsers
7637module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function TempCtor(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor();ctor.prototype.constructor=ctor;};}},{}],21:[function(require,module,exports){/*!
7638 * Determine if an object is a Buffer
7639 *
7640 * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
7641 * @license MIT
7642 */// The _isBuffer check is for Safari 5-7 support, because it's missing
7643// Object.prototype.constructor. Remove this eventually
7644module.exports=function(obj){return obj!=null&&(isBuffer(obj)||isSlowBuffer(obj)||!!obj._isBuffer);};function isBuffer(obj){return!!obj.constructor&&typeof obj.constructor.isBuffer==='function'&&obj.constructor.isBuffer(obj);}// For Node v0.10 support. Remove this eventually.
7645function isSlowBuffer(obj){return typeof obj.readFloatLE==='function'&&typeof obj.slice==='function'&&isBuffer(obj.slice(0,0));}},{}],22:[function(require,module,exports){(function(process){// Copyright Joyent, Inc. and other Node contributors.
7646//
7647// Permission is hereby granted, free of charge, to any person obtaining a
7648// copy of this software and associated documentation files (the
7649// "Software"), to deal in the Software without restriction, including
7650// without limitation the rights to use, copy, modify, merge, publish,
7651// distribute, sublicense, and/or sell copies of the Software, and to permit
7652// persons to whom the Software is furnished to do so, subject to the
7653// following conditions:
7654//
7655// The above copyright notice and this permission notice shall be included
7656// in all copies or substantial portions of the Software.
7657//
7658// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
7659// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
7660// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
7661// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
7662// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
7663// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
7664// USE OR OTHER DEALINGS IN THE SOFTWARE.
7665// resolves . and .. elements in a path array with directory names there
7666// must be no slashes, empty elements, or device names (c:\) in the array
7667// (so also no leading and trailing slashes - it does not distinguish
7668// relative and absolute paths)
7669function normalizeArray(parts,allowAboveRoot){// if the path tries to go above the root, `up` ends up > 0
7670var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==='.'){parts.splice(i,1);}else if(last==='..'){parts.splice(i,1);up++;}else if(up){parts.splice(i,1);up--;}}// if the path is allowed to go above the root, restore leading ..s
7671if(allowAboveRoot){for(;up--;up){parts.unshift('..');}}return parts;}// Split a filename into [root, dir, basename, ext], unix version
7672// 'root' is just a slash, or nothing.
7673var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var splitPath=function splitPath(filename){return splitPathRe.exec(filename).slice(1);};// path.resolve([from ...], to)
7674// posix version
7675exports.resolve=function(){var resolvedPath='',resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();// Skip empty and invalid entries
7676if(typeof path!=='string'){throw new TypeError('Arguments to path.resolve must be strings');}else if(!path){continue;}resolvedPath=path+'/'+resolvedPath;resolvedAbsolute=path.charAt(0)==='/';}// At this point the path should be resolved to a full absolute path, but
7677// handle relative paths to be safe (might happen when process.cwd() fails)
7678// Normalize the path
7679resolvedPath=normalizeArray(filter(resolvedPath.split('/'),function(p){return!!p;}),!resolvedAbsolute).join('/');return(resolvedAbsolute?'/':'')+resolvedPath||'.';};// path.normalize(path)
7680// posix version
7681exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==='/';// Normalize the path
7682path=normalizeArray(filter(path.split('/'),function(p){return!!p;}),!isAbsolute).join('/');if(!path&&!isAbsolute){path='.';}if(path&&trailingSlash){path+='/';}return(isAbsolute?'/':'')+path;};// posix version
7683exports.isAbsolute=function(path){return path.charAt(0)==='/';};// posix version
7684exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if(typeof p!=='string'){throw new TypeError('Arguments to path.join must be strings');}return p;}).join('/'));};// path.relative(from, to)
7685// posix version
7686exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=='')break;}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=='')break;}if(start>end)return[];return arr.slice(start,end-start+1);}var fromParts=trim(from.split('/'));var toParts=trim(to.split('/'));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break;}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push('..');}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join('/');};exports.sep='/';exports.delimiter=':';exports.dirname=function(path){var result=splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){// No dirname whatsoever
7687return'.';}if(dir){// It has a dirname, strip trailing slash
7688dir=dir.substr(0,dir.length-1);}return root+dir;};exports.basename=function(path,ext){var f=splitPath(path)[2];// TODO: make this comparison case-insensitive on windows?
7689if(ext&&f.substr(-1*ext.length)===ext){f=f.substr(0,f.length-ext.length);}return f;};exports.extname=function(path){return splitPath(path)[3];};function filter(xs,f){if(xs.filter)return xs.filter(f);var res=[];for(var i=0;i<xs.length;i++){if(f(xs[i],i,xs))res.push(xs[i]);}return res;}// String.prototype.substr - negative index don't work in IE8
7690var substr='ab'.substr(-1)==='b'?function(str,start,len){return str.substr(start,len);}:function(str,start,len){if(start<0)start=str.length+start;return str.substr(start,len);};}).call(this,require('_process'));},{"_process":23}],23:[function(require,module,exports){// shim for using process in browser
7691var process=module.exports={};// cached from whatever global is present so that test runners that stub it
7692// don't break things. But we need to wrap it in a try catch in case it is
7693// wrapped in strict mode code which doesn't define any globals. It's inside a
7694// function because try/catches deoptimize in certain engines.
7695var cachedSetTimeout;var cachedClearTimeout;(function(){try{cachedSetTimeout=setTimeout;}catch(e){cachedSetTimeout=function cachedSetTimeout(){throw new Error('setTimeout is not defined');};}try{cachedClearTimeout=clearTimeout;}catch(e){cachedClearTimeout=function cachedClearTimeout(){throw new Error('clearTimeout is not defined');};}})();function runTimeout(fun){if(cachedSetTimeout===setTimeout){//normal enviroments in sane situations
7696return setTimeout(fun,0);}try{// when when somebody has screwed with setTimeout but no I.E. maddness
7697return cachedSetTimeout(fun,0);}catch(e){try{// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
7698return cachedSetTimeout.call(null,fun,0);}catch(e){// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
7699return cachedSetTimeout.call(this,fun,0);}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout){//normal enviroments in sane situations
7700return clearTimeout(marker);}try{// when when somebody has screwed with setTimeout but no I.E. maddness
7701return cachedClearTimeout(marker);}catch(e){try{// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
7702return cachedClearTimeout.call(null,marker);}catch(e){// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
7703// Some versions of I.E. have different rules for clearTimeout vs setTimeout
7704return cachedClearTimeout.call(this,marker);}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return;}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue);}else{queueIndex=-1;}if(queue.length){drainQueue();}}function drainQueue(){if(draining){return;}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex<len){if(currentQueue){currentQueue[queueIndex].run();}}queueIndex=-1;len=queue.length;}currentQueue=null;draining=false;runClearTimeout(timeout);}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1){for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i];}}queue.push(new Item(fun,args));if(queue.length===1&&!draining){runTimeout(drainQueue);}};// v8 likes predictible objects
7705function Item(fun,array){this.fun=fun;this.array=array;}Item.prototype.run=function(){this.fun.apply(null,this.array);};process.title='browser';process.browser=true;process.env={};process.argv=[];process.version='';// empty string to avoid regexp issues
7706process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.binding=function(name){throw new Error('process.binding is not supported');};process.cwd=function(){return'/';};process.chdir=function(dir){throw new Error('process.chdir is not supported');};process.umask=function(){return 0;};},{}],24:[function(require,module,exports){(function(global){/*! https://mths.be/punycode v1.4.1 by @mathias */;(function(root){/** Detect free variables */var freeExports=(typeof exports==="undefined"?"undefined":_typeof(exports))=='object'&&exports&&!exports.nodeType&&exports;var freeModule=(typeof module==="undefined"?"undefined":_typeof(module))=='object'&&module&&!module.nodeType&&module;var freeGlobal=(typeof global==="undefined"?"undefined":_typeof(global))=='object'&&global;if(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal||freeGlobal.self===freeGlobal){root=freeGlobal;}/**
7707 * The `punycode` object.
7708 * @name punycode
7709 * @type Object
7710 */var punycode,/** Highest positive signed 32-bit float value */maxInt=2147483647,// aka. 0x7FFFFFFF or 2^31-1
7711/** Bootstring parameters */base=36,tMin=1,tMax=26,skew=38,damp=700,initialBias=72,initialN=128,// 0x80
7712delimiter='-',// '\x2D'
7713/** Regular expressions */regexPunycode=/^xn--/,regexNonASCII=/[^\x20-\x7E]/,// unprintable ASCII chars + non-ASCII chars
7714regexSeparators=/[\x2E\u3002\uFF0E\uFF61]/g,// RFC 3490 separators
7715/** Error messages */errors={'overflow':'Overflow: input needs wider integers to process','not-basic':'Illegal input >= 0x80 (not a basic code point)','invalid-input':'Invalid input'},/** Convenience shortcuts */baseMinusTMin=base-tMin,floor=Math.floor,stringFromCharCode=String.fromCharCode,/** Temporary variable */key;/*--------------------------------------------------------------------------*//**
7716 * A generic error utility function.
7717 * @private
7718 * @param {String} type The error type.
7719 * @returns {Error} Throws a `RangeError` with the applicable error message.
7720 */function error(type){throw new RangeError(errors[type]);}/**
7721 * A generic `Array#map` utility function.
7722 * @private
7723 * @param {Array} array The array to iterate over.
7724 * @param {Function} callback The function that gets called for every array
7725 * item.
7726 * @returns {Array} A new array of values returned by the callback function.
7727 */function map(array,fn){var length=array.length;var result=[];while(length--){result[length]=fn(array[length]);}return result;}/**
7728 * A simple `Array#map`-like wrapper to work with domain name strings or email
7729 * addresses.
7730 * @private
7731 * @param {String} domain The domain name or email address.
7732 * @param {Function} callback The function that gets called for every
7733 * character.
7734 * @returns {Array} A new string of characters returned by the callback
7735 * function.
7736 */function mapDomain(string,fn){var parts=string.split('@');var result='';if(parts.length>1){// In email addresses, only the domain name should be punycoded. Leave
7737// the local part (i.e. everything up to `@`) intact.
7738result=parts[0]+'@';string=parts[1];}// Avoid `split(regex)` for IE8 compatibility. See #17.
7739string=string.replace(regexSeparators,'\x2E');var labels=string.split('.');var encoded=map(labels,fn).join('.');return result+encoded;}/**
7740 * Creates an array containing the numeric code points of each Unicode
7741 * character in the string. While JavaScript uses UCS-2 internally,
7742 * this function will convert a pair of surrogate halves (each of which
7743 * UCS-2 exposes as separate characters) into a single code point,
7744 * matching UTF-16.
7745 * @see `punycode.ucs2.encode`
7746 * @see <https://mathiasbynens.be/notes/javascript-encoding>
7747 * @memberOf punycode.ucs2
7748 * @name decode
7749 * @param {String} string The Unicode input string (UCS-2).
7750 * @returns {Array} The new array of code points.
7751 */function ucs2decode(string){var output=[],counter=0,length=string.length,value,extra;while(counter<length){value=string.charCodeAt(counter++);if(value>=0xD800&&value<=0xDBFF&&counter<length){// high surrogate, and there is a next character
7752extra=string.charCodeAt(counter++);if((extra&0xFC00)==0xDC00){// low surrogate
7753output.push(((value&0x3FF)<<10)+(extra&0x3FF)+0x10000);}else{// unmatched surrogate; only append this code unit, in case the next
7754// code unit is the high surrogate of a surrogate pair
7755output.push(value);counter--;}}else{output.push(value);}}return output;}/**
7756 * Creates a string based on an array of numeric code points.
7757 * @see `punycode.ucs2.decode`
7758 * @memberOf punycode.ucs2
7759 * @name encode
7760 * @param {Array} codePoints The array of numeric code points.
7761 * @returns {String} The new Unicode string (UCS-2).
7762 */function ucs2encode(array){return map(array,function(value){var output='';if(value>0xFFFF){value-=0x10000;output+=stringFromCharCode(value>>>10&0x3FF|0xD800);value=0xDC00|value&0x3FF;}output+=stringFromCharCode(value);return output;}).join('');}/**
7763 * Converts a basic code point into a digit/integer.
7764 * @see `digitToBasic()`
7765 * @private
7766 * @param {Number} codePoint The basic numeric code point value.
7767 * @returns {Number} The numeric value of a basic code point (for use in
7768 * representing integers) in the range `0` to `base - 1`, or `base` if
7769 * the code point does not represent a value.
7770 */function basicToDigit(codePoint){if(codePoint-48<10){return codePoint-22;}if(codePoint-65<26){return codePoint-65;}if(codePoint-97<26){return codePoint-97;}return base;}/**
7771 * Converts a digit/integer into a basic code point.
7772 * @see `basicToDigit()`
7773 * @private
7774 * @param {Number} digit The numeric value of a basic code point.
7775 * @returns {Number} The basic code point whose value (when used for
7776 * representing integers) is `digit`, which needs to be in the range
7777 * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
7778 * used; else, the lowercase form is used. The behavior is undefined
7779 * if `flag` is non-zero and `digit` has no uppercase form.
7780 */function digitToBasic(digit,flag){// 0..25 map to ASCII a..z or A..Z
7781// 26..35 map to ASCII 0..9
7782return digit+22+75*(digit<26)-((flag!=0)<<5);}/**
7783 * Bias adaptation function as per section 3.4 of RFC 3492.
7784 * https://tools.ietf.org/html/rfc3492#section-3.4
7785 * @private
7786 */function adapt(delta,numPoints,firstTime){var k=0;delta=firstTime?floor(delta/damp):delta>>1;delta+=floor(delta/numPoints);for(;/* no initialization */delta>baseMinusTMin*tMax>>1;k+=base){delta=floor(delta/baseMinusTMin);}return floor(k+(baseMinusTMin+1)*delta/(delta+skew));}/**
7787 * Converts a Punycode string of ASCII-only symbols to a string of Unicode
7788 * symbols.
7789 * @memberOf punycode
7790 * @param {String} input The Punycode string of ASCII-only symbols.
7791 * @returns {String} The resulting string of Unicode symbols.
7792 */function decode(input){// Don't use UCS-2
7793var output=[],inputLength=input.length,out,i=0,n=initialN,bias=initialBias,basic,j,index,oldi,w,k,digit,t,/** Cached calculation results */baseMinusT;// Handle the basic code points: let `basic` be the number of input code
7794// points before the last delimiter, or `0` if there is none, then copy
7795// the first basic code points to the output.
7796basic=input.lastIndexOf(delimiter);if(basic<0){basic=0;}for(j=0;j<basic;++j){// if it's not a basic code point
7797if(input.charCodeAt(j)>=0x80){error('not-basic');}output.push(input.charCodeAt(j));}// Main decoding loop: start just after the last delimiter if any basic code
7798// points were copied; start at the beginning otherwise.
7799for(index=basic>0?basic+1:0;index<inputLength;)/* no final expression */{// `index` is the index of the next character to be consumed.
7800// Decode a generalized variable-length integer into `delta`,
7801// which gets added to `i`. The overflow checking is easier
7802// if we increase `i` as we go, then subtract off its starting
7803// value at the end to obtain `delta`.
7804for(oldi=i,w=1,k=base;;/* no condition */k+=base){if(index>=inputLength){error('invalid-input');}digit=basicToDigit(input.charCodeAt(index++));if(digit>=base||digit>floor((maxInt-i)/w)){error('overflow');}i+=digit*w;t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias;if(digit<t){break;}baseMinusT=base-t;if(w>floor(maxInt/baseMinusT)){error('overflow');}w*=baseMinusT;}out=output.length+1;bias=adapt(i-oldi,out,oldi==0);// `i` was supposed to wrap around from `out` to `0`,
7805// incrementing `n` each time, so we'll fix that now:
7806if(floor(i/out)>maxInt-n){error('overflow');}n+=floor(i/out);i%=out;// Insert `n` at position `i` of the output
7807output.splice(i++,0,n);}return ucs2encode(output);}/**
7808 * Converts a string of Unicode symbols (e.g. a domain name label) to a
7809 * Punycode string of ASCII-only symbols.
7810 * @memberOf punycode
7811 * @param {String} input The string of Unicode symbols.
7812 * @returns {String} The resulting Punycode string of ASCII-only symbols.
7813 */function encode(input){var n,delta,handledCPCount,basicLength,bias,j,m,q,k,t,currentValue,output=[],/** `inputLength` will hold the number of code points in `input`. */inputLength,/** Cached calculation results */handledCPCountPlusOne,baseMinusT,qMinusT;// Convert the input in UCS-2 to Unicode
7814input=ucs2decode(input);// Cache the length
7815inputLength=input.length;// Initialize the state
7816n=initialN;delta=0;bias=initialBias;// Handle the basic code points
7817for(j=0;j<inputLength;++j){currentValue=input[j];if(currentValue<0x80){output.push(stringFromCharCode(currentValue));}}handledCPCount=basicLength=output.length;// `handledCPCount` is the number of code points that have been handled;
7818// `basicLength` is the number of basic code points.
7819// Finish the basic string - if it is not empty - with a delimiter
7820if(basicLength){output.push(delimiter);}// Main encoding loop:
7821while(handledCPCount<inputLength){// All non-basic code points < n have been handled already. Find the next
7822// larger one:
7823for(m=maxInt,j=0;j<inputLength;++j){currentValue=input[j];if(currentValue>=n&&currentValue<m){m=currentValue;}}// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
7824// but guard against overflow
7825handledCPCountPlusOne=handledCPCount+1;if(m-n>floor((maxInt-delta)/handledCPCountPlusOne)){error('overflow');}delta+=(m-n)*handledCPCountPlusOne;n=m;for(j=0;j<inputLength;++j){currentValue=input[j];if(currentValue<n&&++delta>maxInt){error('overflow');}if(currentValue==n){// Represent delta as a generalized variable-length integer
7826for(q=delta,k=base;;/* no condition */k+=base){t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias;if(q<t){break;}qMinusT=q-t;baseMinusT=base-t;output.push(stringFromCharCode(digitToBasic(t+qMinusT%baseMinusT,0)));q=floor(qMinusT/baseMinusT);}output.push(stringFromCharCode(digitToBasic(q,0)));bias=adapt(delta,handledCPCountPlusOne,handledCPCount==basicLength);delta=0;++handledCPCount;}}++delta;++n;}return output.join('');}/**
7827 * Converts a Punycode string representing a domain name or an email address
7828 * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
7829 * it doesn't matter if you call it on a string that has already been
7830 * converted to Unicode.
7831 * @memberOf punycode
7832 * @param {String} input The Punycoded domain name or email address to
7833 * convert to Unicode.
7834 * @returns {String} The Unicode representation of the given Punycode
7835 * string.
7836 */function toUnicode(input){return mapDomain(input,function(string){return regexPunycode.test(string)?decode(string.slice(4).toLowerCase()):string;});}/**
7837 * Converts a Unicode string representing a domain name or an email address to
7838 * Punycode. Only the non-ASCII parts of the domain name will be converted,
7839 * i.e. it doesn't matter if you call it with a domain that's already in
7840 * ASCII.
7841 * @memberOf punycode
7842 * @param {String} input The domain name or email address to convert, as a
7843 * Unicode string.
7844 * @returns {String} The Punycode representation of the given domain name or
7845 * email address.
7846 */function toASCII(input){return mapDomain(input,function(string){return regexNonASCII.test(string)?'xn--'+encode(string):string;});}/*--------------------------------------------------------------------------*//** Define the public API */punycode={/**
7847 * A string representing the current Punycode.js version number.
7848 * @memberOf punycode
7849 * @type String
7850 */'version':'1.4.1',/**
7851 * An object of methods to convert from JavaScript's internal character
7852 * representation (UCS-2) to Unicode code points, and back.
7853 * @see <https://mathiasbynens.be/notes/javascript-encoding>
7854 * @memberOf punycode
7855 * @type Object
7856 */'ucs2':{'decode':ucs2decode,'encode':ucs2encode},'decode':decode,'encode':encode,'toASCII':toASCII,'toUnicode':toUnicode};/** Expose `punycode` */// Some AMD build optimizers, like r.js, check for specific condition patterns
7857// like the following:
7858if(typeof define=='function'&&_typeof(define.amd)=='object'&&define.amd){define('punycode',function(){return punycode;});}else if(freeExports&&freeModule){if(module.exports==freeExports){// in Node.js, io.js, or RingoJS v0.8.0+
7859freeModule.exports=punycode;}else{// in Narwhal or RingoJS v0.7.0-
7860for(key in punycode){punycode.hasOwnProperty(key)&&(freeExports[key]=punycode[key]);}}}else{// in Rhino or a web browser
7861root.punycode=punycode;}})(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],25:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
7862//
7863// Permission is hereby granted, free of charge, to any person obtaining a
7864// copy of this software and associated documentation files (the
7865// "Software"), to deal in the Software without restriction, including
7866// without limitation the rights to use, copy, modify, merge, publish,
7867// distribute, sublicense, and/or sell copies of the Software, and to permit
7868// persons to whom the Software is furnished to do so, subject to the
7869// following conditions:
7870//
7871// The above copyright notice and this permission notice shall be included
7872// in all copies or substantial portions of the Software.
7873//
7874// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
7875// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
7876// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
7877// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
7878// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
7879// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
7880// USE OR OTHER DEALINGS IN THE SOFTWARE.
7881'use strict';// If obj.hasOwnProperty has been overridden, then calling
7882// obj.hasOwnProperty(prop) will break.
7883// See: https://github.com/joyent/node/issues/1707
7884function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop);}module.exports=function(qs,sep,eq,options){sep=sep||'&';eq=eq||'=';var obj={};if(typeof qs!=='string'||qs.length===0){return obj;}var regexp=/\+/g;qs=qs.split(sep);var maxKeys=1000;if(options&&typeof options.maxKeys==='number'){maxKeys=options.maxKeys;}var len=qs.length;// maxKeys <= 0 means that we should not limit keys count
7885if(maxKeys>0&&len>maxKeys){len=maxKeys;}for(var i=0;i<len;++i){var x=qs[i].replace(regexp,'%20'),idx=x.indexOf(eq),kstr,vstr,k,v;if(idx>=0){kstr=x.substr(0,idx);vstr=x.substr(idx+1);}else{kstr=x;vstr='';}k=decodeURIComponent(kstr);v=decodeURIComponent(vstr);if(!hasOwnProperty(obj,k)){obj[k]=v;}else if(isArray(obj[k])){obj[k].push(v);}else{obj[k]=[obj[k],v];}}return obj;};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==='[object Array]';};},{}],26:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
7886//
7887// Permission is hereby granted, free of charge, to any person obtaining a
7888// copy of this software and associated documentation files (the
7889// "Software"), to deal in the Software without restriction, including
7890// without limitation the rights to use, copy, modify, merge, publish,
7891// distribute, sublicense, and/or sell copies of the Software, and to permit
7892// persons to whom the Software is furnished to do so, subject to the
7893// following conditions:
7894//
7895// The above copyright notice and this permission notice shall be included
7896// in all copies or substantial portions of the Software.
7897//
7898// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
7899// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
7900// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
7901// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
7902// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
7903// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
7904// USE OR OTHER DEALINGS IN THE SOFTWARE.
7905'use strict';var stringifyPrimitive=function stringifyPrimitive(v){switch(typeof v==="undefined"?"undefined":_typeof(v)){case'string':return v;case'boolean':return v?'true':'false';case'number':return isFinite(v)?v:'';default:return'';}};module.exports=function(obj,sep,eq,name){sep=sep||'&';eq=eq||'=';if(obj===null){obj=undefined;}if((typeof obj==="undefined"?"undefined":_typeof(obj))==='object'){return map(objectKeys(obj),function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;if(isArray(obj[k])){return map(obj[k],function(v){return ks+encodeURIComponent(stringifyPrimitive(v));}).join(sep);}else{return ks+encodeURIComponent(stringifyPrimitive(obj[k]));}}).join(sep);}if(!name)return'';return encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj));};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==='[object Array]';};function map(xs,f){if(xs.map)return xs.map(f);var res=[];for(var i=0;i<xs.length;i++){res.push(f(xs[i],i));}return res;}var objectKeys=Object.keys||function(obj){var res=[];for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))res.push(key);}return res;};},{}],27:[function(require,module,exports){'use strict';exports.decode=exports.parse=require('./decode');exports.encode=exports.stringify=require('./encode');},{"./decode":25,"./encode":26}],28:[function(require,module,exports){module.exports=require("./lib/_stream_duplex.js");},{"./lib/_stream_duplex.js":29}],29:[function(require,module,exports){// a duplex stream is just a stream that is both readable and writable.
7906// Since JS doesn't have multiple prototypal inheritance, this class
7907// prototypally inherits from Readable, and then parasitically from
7908// Writable.
7909'use strict';/*<replacement>*/var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj){keys.push(key);}return keys;};/*</replacement>*/module.exports=Duplex;/*<replacement>*/var processNextTick=require('process-nextick-args');/*</replacement>*//*<replacement>*/var util=require('core-util-is');util.inherits=require('inherits');/*</replacement>*/var Readable=require('./_stream_readable');var Writable=require('./_stream_writable');util.inherits(Duplex,Readable);var keys=objectKeys(Writable.prototype);for(var v=0;v<keys.length;v++){var method=keys[v];if(!Duplex.prototype[method])Duplex.prototype[method]=Writable.prototype[method];}function Duplex(options){if(!(this instanceof Duplex))return new Duplex(options);Readable.call(this,options);Writable.call(this,options);if(options&&options.readable===false)this.readable=false;if(options&&options.writable===false)this.writable=false;this.allowHalfOpen=true;if(options&&options.allowHalfOpen===false)this.allowHalfOpen=false;this.once('end',onend);}// the no-half-open enforcer
7910function onend(){// if we allow half-open state, or if the writable side ended,
7911// then we're ok.
7912if(this.allowHalfOpen||this._writableState.ended)return;// no more data can be written.
7913// But allow more writes to happen in this tick.
7914processNextTick(onEndNT,this);}function onEndNT(self){self.end();}function forEach(xs,f){for(var i=0,l=xs.length;i<l;i++){f(xs[i],i);}}},{"./_stream_readable":31,"./_stream_writable":33,"core-util-is":35,"inherits":20,"process-nextick-args":37}],30:[function(require,module,exports){// a passthrough stream.
7915// basically just the most minimal sort of Transform stream.
7916// Every written chunk gets output as-is.
7917'use strict';module.exports=PassThrough;var Transform=require('./_stream_transform');/*<replacement>*/var util=require('core-util-is');util.inherits=require('inherits');/*</replacement>*/util.inherits(PassThrough,Transform);function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options);}PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk);};},{"./_stream_transform":32,"core-util-is":35,"inherits":20}],31:[function(require,module,exports){(function(process){'use strict';module.exports=Readable;/*<replacement>*/var processNextTick=require('process-nextick-args');/*</replacement>*//*<replacement>*/var isArray=require('isarray');/*</replacement>*/Readable.ReadableState=ReadableState;/*<replacement>*/var EE=require('events').EventEmitter;var EElistenerCount=function EElistenerCount(emitter,type){return emitter.listeners(type).length;};/*</replacement>*//*<replacement>*/var Stream;(function(){try{Stream=require('st'+'ream');}catch(_){}finally{if(!Stream)Stream=require('events').EventEmitter;}})();/*</replacement>*/var Buffer=require('buffer').Buffer;/*<replacement>*/var bufferShim=require('buffer-shims');/*</replacement>*//*<replacement>*/var util=require('core-util-is');util.inherits=require('inherits');/*</replacement>*//*<replacement>*/var debugUtil=require('util');var debug=void 0;if(debugUtil&&debugUtil.debuglog){debug=debugUtil.debuglog('stream');}else{debug=function debug(){};}/*</replacement>*/var StringDecoder;util.inherits(Readable,Stream);var hasPrependListener=typeof EE.prototype.prependListener==='function';function prependListener(emitter,event,fn){if(hasPrependListener)return emitter.prependListener(event,fn);// This is a brutally ugly hack to make sure that our error handler
7918// is attached before any userland ones. NEVER DO THIS. This is here
7919// only because this code needs to continue to work with older versions
7920// of Node.js that do not include the prependListener() method. The goal
7921// is to eventually remove this hack.
7922if(!emitter._events||!emitter._events[event])emitter.on(event,fn);else if(isArray(emitter._events[event]))emitter._events[event].unshift(fn);else emitter._events[event]=[fn,emitter._events[event]];}var Duplex;function ReadableState(options,stream){Duplex=Duplex||require('./_stream_duplex');options=options||{};// object stream flag. Used to make read(n) ignore n and to
7923// make all the buffer merging and length checks go away
7924this.objectMode=!!options.objectMode;if(stream instanceof Duplex)this.objectMode=this.objectMode||!!options.readableObjectMode;// the point at which it stops calling _read() to fill the buffer
7925// Note: 0 is a valid value, means "don't call _read preemptively ever"
7926var hwm=options.highWaterMark;var defaultHwm=this.objectMode?16:16*1024;this.highWaterMark=hwm||hwm===0?hwm:defaultHwm;// cast to ints.
7927this.highWaterMark=~~this.highWaterMark;this.buffer=[];this.length=0;this.pipes=null;this.pipesCount=0;this.flowing=null;this.ended=false;this.endEmitted=false;this.reading=false;// a flag to be able to tell if the onwrite cb is called immediately,
7928// or on a later tick. We set this to true at first, because any
7929// actions that shouldn't happen until "later" should generally also
7930// not happen before the first write call.
7931this.sync=true;// whenever we return null, then we set a flag to say
7932// that we're awaiting a 'readable' event emission.
7933this.needReadable=false;this.emittedReadable=false;this.readableListening=false;this.resumeScheduled=false;// Crypto is kind of old and crusty. Historically, its default string
7934// encoding is 'binary' so we have to make this configurable.
7935// Everything else in the universe uses 'utf8', though.
7936this.defaultEncoding=options.defaultEncoding||'utf8';// when piping, we only care about 'readable' events that happen
7937// after read()ing all the bytes and not getting any pushback.
7938this.ranOut=false;// the number of writers that are awaiting a drain event in .pipe()s
7939this.awaitDrain=0;// if true, a maybeReadMore has been scheduled
7940this.readingMore=false;this.decoder=null;this.encoding=null;if(options.encoding){if(!StringDecoder)StringDecoder=require('string_decoder/').StringDecoder;this.decoder=new StringDecoder(options.encoding);this.encoding=options.encoding;}}var Duplex;function Readable(options){Duplex=Duplex||require('./_stream_duplex');if(!(this instanceof Readable))return new Readable(options);this._readableState=new ReadableState(options,this);// legacy
7941this.readable=true;if(options&&typeof options.read==='function')this._read=options.read;Stream.call(this);}// Manually shove something into the read() buffer.
7942// This returns true if the highWaterMark has not been hit yet,
7943// similar to how Writable.write() returns true if you should
7944// write() some more.
7945Readable.prototype.push=function(chunk,encoding){var state=this._readableState;if(!state.objectMode&&typeof chunk==='string'){encoding=encoding||state.defaultEncoding;if(encoding!==state.encoding){chunk=bufferShim.from(chunk,encoding);encoding='';}}return readableAddChunk(this,state,chunk,encoding,false);};// Unshift should *always* be something directly out of read()
7946Readable.prototype.unshift=function(chunk){var state=this._readableState;return readableAddChunk(this,state,chunk,'',true);};Readable.prototype.isPaused=function(){return this._readableState.flowing===false;};function readableAddChunk(stream,state,chunk,encoding,addToFront){var er=chunkInvalid(state,chunk);if(er){stream.emit('error',er);}else if(chunk===null){state.reading=false;onEofChunk(stream,state);}else if(state.objectMode||chunk&&chunk.length>0){if(state.ended&&!addToFront){var e=new Error('stream.push() after EOF');stream.emit('error',e);}else if(state.endEmitted&&addToFront){var _e=new Error('stream.unshift() after end event');stream.emit('error',_e);}else{var skipAdd;if(state.decoder&&!addToFront&&!encoding){chunk=state.decoder.write(chunk);skipAdd=!state.objectMode&&chunk.length===0;}if(!addToFront)state.reading=false;// Don't add to the buffer if we've decoded to an empty string chunk and
7947// we're not in object mode
7948if(!skipAdd){// if we want the data now, just emit it.
7949if(state.flowing&&state.length===0&&!state.sync){stream.emit('data',chunk);stream.read(0);}else{// update the buffer info.
7950state.length+=state.objectMode?1:chunk.length;if(addToFront)state.buffer.unshift(chunk);else state.buffer.push(chunk);if(state.needReadable)emitReadable(stream);}}maybeReadMore(stream,state);}}else if(!addToFront){state.reading=false;}return needMoreData(state);}// if it's past the high water mark, we can push in some more.
7951// Also, if we have no data yet, we can stand some
7952// more bytes. This is to work around cases where hwm=0,
7953// such as the repl. Also, if the push() triggered a
7954// readable event, and the user called read(largeNumber) such that
7955// needReadable was set, then we ought to push more, so that another
7956// 'readable' event will be triggered.
7957function needMoreData(state){return!state.ended&&(state.needReadable||state.length<state.highWaterMark||state.length===0);}// backwards compatibility.
7958Readable.prototype.setEncoding=function(enc){if(!StringDecoder)StringDecoder=require('string_decoder/').StringDecoder;this._readableState.decoder=new StringDecoder(enc);this._readableState.encoding=enc;return this;};// Don't raise the hwm > 8MB
7959var MAX_HWM=0x800000;function computeNewHighWaterMark(n){if(n>=MAX_HWM){n=MAX_HWM;}else{// Get the next highest power of 2
7960n--;n|=n>>>1;n|=n>>>2;n|=n>>>4;n|=n>>>8;n|=n>>>16;n++;}return n;}function howMuchToRead(n,state){if(state.length===0&&state.ended)return 0;if(state.objectMode)return n===0?0:1;if(n===null||isNaN(n)){// only flow one buffer at a time
7961if(state.flowing&&state.buffer.length)return state.buffer[0].length;else return state.length;}if(n<=0)return 0;// If we're asking for more than the target buffer level,
7962// then raise the water mark. Bump up to the next highest
7963// power of 2, to prevent increasing it excessively in tiny
7964// amounts.
7965if(n>state.highWaterMark)state.highWaterMark=computeNewHighWaterMark(n);// don't have that much. return null, unless we've ended.
7966if(n>state.length){if(!state.ended){state.needReadable=true;return 0;}else{return state.length;}}return n;}// you can override either this method, or the async _read(n) below.
7967Readable.prototype.read=function(n){debug('read',n);var state=this._readableState;var nOrig=n;if(typeof n!=='number'||n>0)state.emittedReadable=false;// if we're doing read(0) to trigger a readable event, but we
7968// already have a bunch of data in the buffer, then just trigger
7969// the 'readable' event and move on.
7970if(n===0&&state.needReadable&&(state.length>=state.highWaterMark||state.ended)){debug('read: emitReadable',state.length,state.ended);if(state.length===0&&state.ended)endReadable(this);else emitReadable(this);return null;}n=howMuchToRead(n,state);// if we've ended, and we're now clear, then finish it up.
7971if(n===0&&state.ended){if(state.length===0)endReadable(this);return null;}// All the actual chunk generation logic needs to be
7972// *below* the call to _read. The reason is that in certain
7973// synthetic stream cases, such as passthrough streams, _read
7974// may be a completely synchronous operation which may change
7975// the state of the read buffer, providing enough data when
7976// before there was *not* enough.
7977//
7978// So, the steps are:
7979// 1. Figure out what the state of things will be after we do
7980// a read from the buffer.
7981//
7982// 2. If that resulting state will trigger a _read, then call _read.
7983// Note that this may be asynchronous, or synchronous. Yes, it is
7984// deeply ugly to write APIs this way, but that still doesn't mean
7985// that the Readable class should behave improperly, as streams are
7986// designed to be sync/async agnostic.
7987// Take note if the _read call is sync or async (ie, if the read call
7988// has returned yet), so that we know whether or not it's safe to emit
7989// 'readable' etc.
7990//
7991// 3. Actually pull the requested chunks out of the buffer and return.
7992// if we need a readable event, then we need to do some reading.
7993var doRead=state.needReadable;debug('need readable',doRead);// if we currently have less than the highWaterMark, then also read some
7994if(state.length===0||state.length-n<state.highWaterMark){doRead=true;debug('length less than watermark',doRead);}// however, if we've ended, then there's no point, and if we're already
7995// reading, then it's unnecessary.
7996if(state.ended||state.reading){doRead=false;debug('reading or ended',doRead);}if(doRead){debug('do read');state.reading=true;state.sync=true;// if the length is currently zero, then we *need* a readable event.
7997if(state.length===0)state.needReadable=true;// call internal read method
7998this._read(state.highWaterMark);state.sync=false;}// If _read pushed data synchronously, then `reading` will be false,
7999// and we need to re-evaluate how much data we can return to the user.
8000if(doRead&&!state.reading)n=howMuchToRead(nOrig,state);var ret;if(n>0)ret=fromList(n,state);else ret=null;if(ret===null){state.needReadable=true;n=0;}state.length-=n;// If we have nothing in the buffer, then we want to know
8001// as soon as we *do* get something into the buffer.
8002if(state.length===0&&!state.ended)state.needReadable=true;// If we tried to read() past the EOF, then emit end on the next tick.
8003if(nOrig!==n&&state.ended&&state.length===0)endReadable(this);if(ret!==null)this.emit('data',ret);return ret;};function chunkInvalid(state,chunk){var er=null;if(!Buffer.isBuffer(chunk)&&typeof chunk!=='string'&&chunk!==null&&chunk!==undefined&&!state.objectMode){er=new TypeError('Invalid non-string/buffer chunk');}return er;}function onEofChunk(stream,state){if(state.ended)return;if(state.decoder){var chunk=state.decoder.end();if(chunk&&chunk.length){state.buffer.push(chunk);state.length+=state.objectMode?1:chunk.length;}}state.ended=true;// emit 'readable' now to make sure it gets picked up.
8004emitReadable(stream);}// Don't emit readable right away in sync mode, because this can trigger
8005// another read() call => stack overflow. This way, it might trigger
8006// a nextTick recursion warning, but that's not so bad.
8007function emitReadable(stream){var state=stream._readableState;state.needReadable=false;if(!state.emittedReadable){debug('emitReadable',state.flowing);state.emittedReadable=true;if(state.sync)processNextTick(emitReadable_,stream);else emitReadable_(stream);}}function emitReadable_(stream){debug('emit readable');stream.emit('readable');flow(stream);}// at this point, the user has presumably seen the 'readable' event,
8008// and called read() to consume some data. that may have triggered
8009// in turn another _read(n) call, in which case reading = true if
8010// it's in progress.
8011// However, if we're not ended, or reading, and the length < hwm,
8012// then go ahead and try to read some more preemptively.
8013function maybeReadMore(stream,state){if(!state.readingMore){state.readingMore=true;processNextTick(maybeReadMore_,stream,state);}}function maybeReadMore_(stream,state){var len=state.length;while(!state.reading&&!state.flowing&&!state.ended&&state.length<state.highWaterMark){debug('maybeReadMore read 0');stream.read(0);if(len===state.length)// didn't get any data, stop spinning.
8014break;else len=state.length;}state.readingMore=false;}// abstract method. to be overridden in specific implementation classes.
8015// call cb(er, data) where data is <= n in length.
8016// for virtual (non-string, non-buffer) streams, "length" is somewhat
8017// arbitrary, and perhaps not very meaningful.
8018Readable.prototype._read=function(n){this.emit('error',new Error('not implemented'));};Readable.prototype.pipe=function(dest,pipeOpts){var src=this;var state=this._readableState;switch(state.pipesCount){case 0:state.pipes=dest;break;case 1:state.pipes=[state.pipes,dest];break;default:state.pipes.push(dest);break;}state.pipesCount+=1;debug('pipe count=%d opts=%j',state.pipesCount,pipeOpts);var doEnd=(!pipeOpts||pipeOpts.end!==false)&&dest!==process.stdout&&dest!==process.stderr;var endFn=doEnd?onend:cleanup;if(state.endEmitted)processNextTick(endFn);else src.once('end',endFn);dest.on('unpipe',onunpipe);function onunpipe(readable){debug('onunpipe');if(readable===src){cleanup();}}function onend(){debug('onend');dest.end();}// when the dest drains, it reduces the awaitDrain counter
8019// on the source. This would be more elegant with a .once()
8020// handler in flow(), but adding and removing repeatedly is
8021// too slow.
8022var ondrain=pipeOnDrain(src);dest.on('drain',ondrain);var cleanedUp=false;function cleanup(){debug('cleanup');// cleanup event handlers once the pipe is broken
8023dest.removeListener('close',onclose);dest.removeListener('finish',onfinish);dest.removeListener('drain',ondrain);dest.removeListener('error',onerror);dest.removeListener('unpipe',onunpipe);src.removeListener('end',onend);src.removeListener('end',cleanup);src.removeListener('data',ondata);cleanedUp=true;// if the reader is waiting for a drain event from this
8024// specific writer, then it would cause it to never start
8025// flowing again.
8026// So, if this is awaiting a drain, then we just call it now.
8027// If we don't know, then assume that we are waiting for one.
8028if(state.awaitDrain&&(!dest._writableState||dest._writableState.needDrain))ondrain();}src.on('data',ondata);function ondata(chunk){debug('ondata');var ret=dest.write(chunk);if(false===ret){// If the user unpiped during `dest.write()`, it is possible
8029// to get stuck in a permanently paused state if that write
8030// also returned false.
8031// => Check whether `dest` is still a piping destination.
8032if((state.pipesCount===1&&state.pipes===dest||state.pipesCount>1&&indexOf(state.pipes,dest)!==-1)&&!cleanedUp){debug('false write response, pause',src._readableState.awaitDrain);src._readableState.awaitDrain++;}src.pause();}}// if the dest has an error, then stop piping into it.
8033// however, don't suppress the throwing behavior for this.
8034function onerror(er){debug('onerror',er);unpipe();dest.removeListener('error',onerror);if(EElistenerCount(dest,'error')===0)dest.emit('error',er);}// Make sure our error handler is attached before userland ones.
8035prependListener(dest,'error',onerror);// Both close and finish should trigger unpipe, but only once.
8036function onclose(){dest.removeListener('finish',onfinish);unpipe();}dest.once('close',onclose);function onfinish(){debug('onfinish');dest.removeListener('close',onclose);unpipe();}dest.once('finish',onfinish);function unpipe(){debug('unpipe');src.unpipe(dest);}// tell the dest that it's being piped to
8037dest.emit('pipe',src);// start the flow if it hasn't been started already.
8038if(!state.flowing){debug('pipe resume');src.resume();}return dest;};function pipeOnDrain(src){return function(){var state=src._readableState;debug('pipeOnDrain',state.awaitDrain);if(state.awaitDrain)state.awaitDrain--;if(state.awaitDrain===0&&EElistenerCount(src,'data')){state.flowing=true;flow(src);}};}Readable.prototype.unpipe=function(dest){var state=this._readableState;// if we're not piping anywhere, then do nothing.
8039if(state.pipesCount===0)return this;// just one destination. most common case.
8040if(state.pipesCount===1){// passed in one, but it's not the right one.
8041if(dest&&dest!==state.pipes)return this;if(!dest)dest=state.pipes;// got a match.
8042state.pipes=null;state.pipesCount=0;state.flowing=false;if(dest)dest.emit('unpipe',this);return this;}// slow case. multiple pipe destinations.
8043if(!dest){// remove all.
8044var dests=state.pipes;var len=state.pipesCount;state.pipes=null;state.pipesCount=0;state.flowing=false;for(var _i=0;_i<len;_i++){dests[_i].emit('unpipe',this);}return this;}// try to find the right one.
8045var i=indexOf(state.pipes,dest);if(i===-1)return this;state.pipes.splice(i,1);state.pipesCount-=1;if(state.pipesCount===1)state.pipes=state.pipes[0];dest.emit('unpipe',this);return this;};// set up data events if they are asked for
8046// Ensure readable listeners eventually get something
8047Readable.prototype.on=function(ev,fn){var res=Stream.prototype.on.call(this,ev,fn);// If listening to data, and it has not explicitly been paused,
8048// then call resume to start the flow of data on the next tick.
8049if(ev==='data'&&false!==this._readableState.flowing){this.resume();}if(ev==='readable'&&!this._readableState.endEmitted){var state=this._readableState;if(!state.readableListening){state.readableListening=true;state.emittedReadable=false;state.needReadable=true;if(!state.reading){processNextTick(nReadingNextTick,this);}else if(state.length){emitReadable(this,state);}}}return res;};Readable.prototype.addListener=Readable.prototype.on;function nReadingNextTick(self){debug('readable nexttick read 0');self.read(0);}// pause() and resume() are remnants of the legacy readable stream API
8050// If the user uses them, then switch into old mode.
8051Readable.prototype.resume=function(){var state=this._readableState;if(!state.flowing){debug('resume');state.flowing=true;resume(this,state);}return this;};function resume(stream,state){if(!state.resumeScheduled){state.resumeScheduled=true;processNextTick(resume_,stream,state);}}function resume_(stream,state){if(!state.reading){debug('resume read 0');stream.read(0);}state.resumeScheduled=false;stream.emit('resume');flow(stream);if(state.flowing&&!state.reading)stream.read(0);}Readable.prototype.pause=function(){debug('call pause flowing=%j',this._readableState.flowing);if(false!==this._readableState.flowing){debug('pause');this._readableState.flowing=false;this.emit('pause');}return this;};function flow(stream){var state=stream._readableState;debug('flow',state.flowing);if(state.flowing){do{var chunk=stream.read();}while(null!==chunk&&state.flowing);}}// wrap an old-style stream as the async data source.
8052// This is *not* part of the readable stream interface.
8053// It is an ugly unfortunate mess of history.
8054Readable.prototype.wrap=function(stream){var state=this._readableState;var paused=false;var self=this;stream.on('end',function(){debug('wrapped end');if(state.decoder&&!state.ended){var chunk=state.decoder.end();if(chunk&&chunk.length)self.push(chunk);}self.push(null);});stream.on('data',function(chunk){debug('wrapped data');if(state.decoder)chunk=state.decoder.write(chunk);// don't skip over falsy values in objectMode
8055if(state.objectMode&&(chunk===null||chunk===undefined))return;else if(!state.objectMode&&(!chunk||!chunk.length))return;var ret=self.push(chunk);if(!ret){paused=true;stream.pause();}});// proxy all the other methods.
8056// important when wrapping filters and duplexes.
8057for(var i in stream){if(this[i]===undefined&&typeof stream[i]==='function'){this[i]=function(method){return function(){return stream[method].apply(stream,arguments);};}(i);}}// proxy certain important events.
8058var events=['error','close','destroy','pause','resume'];forEach(events,function(ev){stream.on(ev,self.emit.bind(self,ev));});// when we try to consume some more bytes, simply unpause the
8059// underlying stream.
8060self._read=function(n){debug('wrapped _read',n);if(paused){paused=false;stream.resume();}};return self;};// exposed for testing purposes only.
8061Readable._fromList=fromList;// Pluck off n bytes from an array of buffers.
8062// Length is the combined lengths of all the buffers in the list.
8063function fromList(n,state){var list=state.buffer;var length=state.length;var stringMode=!!state.decoder;var objectMode=!!state.objectMode;var ret;// nothing in the list, definitely empty.
8064if(list.length===0)return null;if(length===0)ret=null;else if(objectMode)ret=list.shift();else if(!n||n>=length){// read it all, truncate the array.
8065if(stringMode)ret=list.join('');else if(list.length===1)ret=list[0];else ret=Buffer.concat(list,length);list.length=0;}else{// read just some of it.
8066if(n<list[0].length){// just take a part of the first list item.
8067// slice is the same for buffers and strings.
8068var buf=list[0];ret=buf.slice(0,n);list[0]=buf.slice(n);}else if(n===list[0].length){// first list is a perfect match
8069ret=list.shift();}else{// complex case.
8070// we have enough to cover it, but it spans past the first buffer.
8071if(stringMode)ret='';else ret=bufferShim.allocUnsafe(n);var c=0;for(var i=0,l=list.length;i<l&&c<n;i++){var _buf=list[0];var cpy=Math.min(n-c,_buf.length);if(stringMode)ret+=_buf.slice(0,cpy);else _buf.copy(ret,c,0,cpy);if(cpy<_buf.length)list[0]=_buf.slice(cpy);else list.shift();c+=cpy;}}}return ret;}function endReadable(stream){var state=stream._readableState;// If we get here before consuming all the bytes, then that is a
8072// bug in node. Should never happen.
8073if(state.length>0)throw new Error('"endReadable()" called on non-empty stream');if(!state.endEmitted){state.ended=true;processNextTick(endReadableNT,state,stream);}}function endReadableNT(state,stream){// Check that we didn't get one last unshift.
8074if(!state.endEmitted&&state.length===0){state.endEmitted=true;stream.readable=false;stream.emit('end');}}function forEach(xs,f){for(var i=0,l=xs.length;i<l;i++){f(xs[i],i);}}function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++){if(xs[i]===x)return i;}return-1;}}).call(this,require('_process'));},{"./_stream_duplex":29,"_process":23,"buffer":15,"buffer-shims":34,"core-util-is":35,"events":19,"inherits":20,"isarray":36,"process-nextick-args":37,"string_decoder/":50,"util":14}],32:[function(require,module,exports){// a transform stream is a readable/writable stream where you do
8075// something with the data. Sometimes it's called a "filter",
8076// but that's not a great name for it, since that implies a thing where
8077// some bits pass through, and others are simply ignored. (That would
8078// be a valid example of a transform, of course.)
8079//
8080// While the output is causally related to the input, it's not a
8081// necessarily symmetric or synchronous transformation. For example,
8082// a zlib stream might take multiple plain-text writes(), and then
8083// emit a single compressed chunk some time in the future.
8084//
8085// Here's how this works:
8086//
8087// The Transform stream has all the aspects of the readable and writable
8088// stream classes. When you write(chunk), that calls _write(chunk,cb)
8089// internally, and returns false if there's a lot of pending writes
8090// buffered up. When you call read(), that calls _read(n) until
8091// there's enough pending readable data buffered up.
8092//
8093// In a transform stream, the written data is placed in a buffer. When
8094// _read(n) is called, it transforms the queued up data, calling the
8095// buffered _write cb's as it consumes chunks. If consuming a single
8096// written chunk would result in multiple output chunks, then the first
8097// outputted bit calls the readcb, and subsequent chunks just go into
8098// the read buffer, and will cause it to emit 'readable' if necessary.
8099//
8100// This way, back-pressure is actually determined by the reading side,
8101// since _read has to be called to start processing a new chunk. However,
8102// a pathological inflate type of transform can cause excessive buffering
8103// here. For example, imagine a stream where every byte of input is
8104// interpreted as an integer from 0-255, and then results in that many
8105// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
8106// 1kb of data being output. In this case, you could write a very small
8107// amount of input, and end up with a very large amount of output. In
8108// such a pathological inflating mechanism, there'd be no way to tell
8109// the system to stop doing the transform. A single 4MB write could
8110// cause the system to run out of memory.
8111//
8112// However, even in such a pathological case, only a single written chunk
8113// would be consumed, and then the rest would wait (un-transformed) until
8114// the results of the previous transformed chunk were consumed.
8115'use strict';module.exports=Transform;var Duplex=require('./_stream_duplex');/*<replacement>*/var util=require('core-util-is');util.inherits=require('inherits');/*</replacement>*/util.inherits(Transform,Duplex);function TransformState(stream){this.afterTransform=function(er,data){return afterTransform(stream,er,data);};this.needTransform=false;this.transforming=false;this.writecb=null;this.writechunk=null;this.writeencoding=null;}function afterTransform(stream,er,data){var ts=stream._transformState;ts.transforming=false;var cb=ts.writecb;if(!cb)return stream.emit('error',new Error('no writecb in Transform class'));ts.writechunk=null;ts.writecb=null;if(data!==null&&data!==undefined)stream.push(data);cb(er);var rs=stream._readableState;rs.reading=false;if(rs.needReadable||rs.length<rs.highWaterMark){stream._read(rs.highWaterMark);}}function Transform(options){if(!(this instanceof Transform))return new Transform(options);Duplex.call(this,options);this._transformState=new TransformState(this);// when the writable side finishes, then flush out anything remaining.
8116var stream=this;// start out asking for a readable event once data is transformed.
8117this._readableState.needReadable=true;// we have implemented the _read method, and done the other things
8118// that Readable wants before the first _read call, so unset the
8119// sync guard flag.
8120this._readableState.sync=false;if(options){if(typeof options.transform==='function')this._transform=options.transform;if(typeof options.flush==='function')this._flush=options.flush;}this.once('prefinish',function(){if(typeof this._flush==='function')this._flush(function(er){done(stream,er);});else done(stream);});}Transform.prototype.push=function(chunk,encoding){this._transformState.needTransform=false;return Duplex.prototype.push.call(this,chunk,encoding);};// This is the part where you do stuff!
8121// override this function in implementation classes.
8122// 'chunk' is an input chunk.
8123//
8124// Call `push(newChunk)` to pass along transformed output
8125// to the readable side. You may call 'push' zero or more times.
8126//
8127// Call `cb(err)` when you are done with this chunk. If you pass
8128// an error, then that'll put the hurt on the whole operation. If you
8129// never call cb(), then you'll never get another chunk.
8130Transform.prototype._transform=function(chunk,encoding,cb){throw new Error('Not implemented');};Transform.prototype._write=function(chunk,encoding,cb){var ts=this._transformState;ts.writecb=cb;ts.writechunk=chunk;ts.writeencoding=encoding;if(!ts.transforming){var rs=this._readableState;if(ts.needTransform||rs.needReadable||rs.length<rs.highWaterMark)this._read(rs.highWaterMark);}};// Doesn't matter what the args are here.
8131// _transform does all the work.
8132// That we got here means that the readable side wants more data.
8133Transform.prototype._read=function(n){var ts=this._transformState;if(ts.writechunk!==null&&ts.writecb&&!ts.transforming){ts.transforming=true;this._transform(ts.writechunk,ts.writeencoding,ts.afterTransform);}else{// mark that we need a transform, so that any data that comes in
8134// will get processed, now that we've asked for it.
8135ts.needTransform=true;}};function done(stream,er){if(er)return stream.emit('error',er);// if there's nothing in the write buffer, then that means
8136// that nothing more will ever be provided
8137var ws=stream._writableState;var ts=stream._transformState;if(ws.length)throw new Error('Calling transform done when ws.length != 0');if(ts.transforming)throw new Error('Calling transform done when still transforming');return stream.push(null);}},{"./_stream_duplex":29,"core-util-is":35,"inherits":20}],33:[function(require,module,exports){(function(process){// A bit simpler than readable streams.
8138// Implement an async ._write(chunk, encoding, cb), and it'll handle all
8139// the drain event emission and buffering.
8140'use strict';module.exports=Writable;/*<replacement>*/var processNextTick=require('process-nextick-args');/*</replacement>*//*<replacement>*/var asyncWrite=!process.browser&&['v0.10','v0.9.'].indexOf(process.version.slice(0,5))>-1?setImmediate:processNextTick;/*</replacement>*/Writable.WritableState=WritableState;/*<replacement>*/var util=require('core-util-is');util.inherits=require('inherits');/*</replacement>*//*<replacement>*/var internalUtil={deprecate:require('util-deprecate')};/*</replacement>*//*<replacement>*/var Stream;(function(){try{Stream=require('st'+'ream');}catch(_){}finally{if(!Stream)Stream=require('events').EventEmitter;}})();/*</replacement>*/var Buffer=require('buffer').Buffer;/*<replacement>*/var bufferShim=require('buffer-shims');/*</replacement>*/util.inherits(Writable,Stream);function nop(){}function WriteReq(chunk,encoding,cb){this.chunk=chunk;this.encoding=encoding;this.callback=cb;this.next=null;}var Duplex;function WritableState(options,stream){Duplex=Duplex||require('./_stream_duplex');options=options||{};// object stream flag to indicate whether or not this stream
8141// contains buffers or objects.
8142this.objectMode=!!options.objectMode;if(stream instanceof Duplex)this.objectMode=this.objectMode||!!options.writableObjectMode;// the point at which write() starts returning false
8143// Note: 0 is a valid value, means that we always return false if
8144// the entire buffer is not flushed immediately on write()
8145var hwm=options.highWaterMark;var defaultHwm=this.objectMode?16:16*1024;this.highWaterMark=hwm||hwm===0?hwm:defaultHwm;// cast to ints.
8146this.highWaterMark=~~this.highWaterMark;this.needDrain=false;// at the start of calling end()
8147this.ending=false;// when end() has been called, and returned
8148this.ended=false;// when 'finish' is emitted
8149this.finished=false;// should we decode strings into buffers before passing to _write?
8150// this is here so that some node-core streams can optimize string
8151// handling at a lower level.
8152var noDecode=options.decodeStrings===false;this.decodeStrings=!noDecode;// Crypto is kind of old and crusty. Historically, its default string
8153// encoding is 'binary' so we have to make this configurable.
8154// Everything else in the universe uses 'utf8', though.
8155this.defaultEncoding=options.defaultEncoding||'utf8';// not an actual buffer we keep track of, but a measurement
8156// of how much we're waiting to get pushed to some underlying
8157// socket or file.
8158this.length=0;// a flag to see when we're in the middle of a write.
8159this.writing=false;// when true all writes will be buffered until .uncork() call
8160this.corked=0;// a flag to be able to tell if the onwrite cb is called immediately,
8161// or on a later tick. We set this to true at first, because any
8162// actions that shouldn't happen until "later" should generally also
8163// not happen before the first write call.
8164this.sync=true;// a flag to know if we're processing previously buffered items, which
8165// may call the _write() callback in the same tick, so that we don't
8166// end up in an overlapped onwrite situation.
8167this.bufferProcessing=false;// the callback that's passed to _write(chunk,cb)
8168this.onwrite=function(er){onwrite(stream,er);};// the callback that the user supplies to write(chunk,encoding,cb)
8169this.writecb=null;// the amount that is being written when _write is called.
8170this.writelen=0;this.bufferedRequest=null;this.lastBufferedRequest=null;// number of pending user-supplied write callbacks
8171// this must be 0 before 'finish' can be emitted
8172this.pendingcb=0;// emit prefinish if the only thing we're waiting for is _write cbs
8173// This is relevant for synchronous Transform streams
8174this.prefinished=false;// True if the error was already emitted and should not be thrown again
8175this.errorEmitted=false;// count buffered requests
8176this.bufferedRequestCount=0;// allocate the first CorkedRequest, there is always
8177// one allocated and free to use, and we maintain at most two
8178this.corkedRequestsFree=new CorkedRequest(this);}WritableState.prototype.getBuffer=function writableStateGetBuffer(){var current=this.bufferedRequest;var out=[];while(current){out.push(current);current=current.next;}return out;};(function(){try{Object.defineProperty(WritableState.prototype,'buffer',{get:internalUtil.deprecate(function(){return this.getBuffer();},'_writableState.buffer is deprecated. Use _writableState.getBuffer '+'instead.')});}catch(_){}})();var Duplex;function Writable(options){Duplex=Duplex||require('./_stream_duplex');// Writable ctor is applied to Duplexes, though they're not
8179// instanceof Writable, they're instanceof Readable.
8180if(!(this instanceof Writable)&&!(this instanceof Duplex))return new Writable(options);this._writableState=new WritableState(options,this);// legacy.
8181this.writable=true;if(options){if(typeof options.write==='function')this._write=options.write;if(typeof options.writev==='function')this._writev=options.writev;}Stream.call(this);}// Otherwise people can pipe Writable streams, which is just wrong.
8182Writable.prototype.pipe=function(){this.emit('error',new Error('Cannot pipe, not readable'));};function writeAfterEnd(stream,cb){var er=new Error('write after end');// TODO: defer error events consistently everywhere, not just the cb
8183stream.emit('error',er);processNextTick(cb,er);}// If we get something that is not a buffer, string, null, or undefined,
8184// and we're not in objectMode, then that's an error.
8185// Otherwise stream chunks are all considered to be of length=1, and the
8186// watermarks determine how many objects to keep in the buffer, rather than
8187// how many bytes or characters.
8188function validChunk(stream,state,chunk,cb){var valid=true;var er=false;// Always throw error if a null is written
8189// if we are not in object mode then throw
8190// if it is not a buffer, string, or undefined.
8191if(chunk===null){er=new TypeError('May not write null values to stream');}else if(!Buffer.isBuffer(chunk)&&typeof chunk!=='string'&&chunk!==undefined&&!state.objectMode){er=new TypeError('Invalid non-string/buffer chunk');}if(er){stream.emit('error',er);processNextTick(cb,er);valid=false;}return valid;}Writable.prototype.write=function(chunk,encoding,cb){var state=this._writableState;var ret=false;if(typeof encoding==='function'){cb=encoding;encoding=null;}if(Buffer.isBuffer(chunk))encoding='buffer';else if(!encoding)encoding=state.defaultEncoding;if(typeof cb!=='function')cb=nop;if(state.ended)writeAfterEnd(this,cb);else if(validChunk(this,state,chunk,cb)){state.pendingcb++;ret=writeOrBuffer(this,state,chunk,encoding,cb);}return ret;};Writable.prototype.cork=function(){var state=this._writableState;state.corked++;};Writable.prototype.uncork=function(){var state=this._writableState;if(state.corked){state.corked--;if(!state.writing&&!state.corked&&!state.finished&&!state.bufferProcessing&&state.bufferedRequest)clearBuffer(this,state);}};Writable.prototype.setDefaultEncoding=function setDefaultEncoding(encoding){// node::ParseEncoding() requires lower case.
8192if(typeof encoding==='string')encoding=encoding.toLowerCase();if(!(['hex','utf8','utf-8','ascii','binary','base64','ucs2','ucs-2','utf16le','utf-16le','raw'].indexOf((encoding+'').toLowerCase())>-1))throw new TypeError('Unknown encoding: '+encoding);this._writableState.defaultEncoding=encoding;return this;};function decodeChunk(state,chunk,encoding){if(!state.objectMode&&state.decodeStrings!==false&&typeof chunk==='string'){chunk=bufferShim.from(chunk,encoding);}return chunk;}// if we're already writing something, then just put this
8193// in the queue, and wait our turn. Otherwise, call _write
8194// If we return false, then we need a drain event, so set that flag.
8195function writeOrBuffer(stream,state,chunk,encoding,cb){chunk=decodeChunk(state,chunk,encoding);if(Buffer.isBuffer(chunk))encoding='buffer';var len=state.objectMode?1:chunk.length;state.length+=len;var ret=state.length<state.highWaterMark;// we must ensure that previous needDrain will not be reset to false.
8196if(!ret)state.needDrain=true;if(state.writing||state.corked){var last=state.lastBufferedRequest;state.lastBufferedRequest=new WriteReq(chunk,encoding,cb);if(last){last.next=state.lastBufferedRequest;}else{state.bufferedRequest=state.lastBufferedRequest;}state.bufferedRequestCount+=1;}else{doWrite(stream,state,false,len,chunk,encoding,cb);}return ret;}function doWrite(stream,state,writev,len,chunk,encoding,cb){state.writelen=len;state.writecb=cb;state.writing=true;state.sync=true;if(writev)stream._writev(chunk,state.onwrite);else stream._write(chunk,encoding,state.onwrite);state.sync=false;}function onwriteError(stream,state,sync,er,cb){--state.pendingcb;if(sync)processNextTick(cb,er);else cb(er);stream._writableState.errorEmitted=true;stream.emit('error',er);}function onwriteStateUpdate(state){state.writing=false;state.writecb=null;state.length-=state.writelen;state.writelen=0;}function onwrite(stream,er){var state=stream._writableState;var sync=state.sync;var cb=state.writecb;onwriteStateUpdate(state);if(er)onwriteError(stream,state,sync,er,cb);else{// Check if we're actually ready to finish, but don't emit yet
8197var finished=needFinish(state);if(!finished&&!state.corked&&!state.bufferProcessing&&state.bufferedRequest){clearBuffer(stream,state);}if(sync){/*<replacement>*/asyncWrite(afterWrite,stream,state,finished,cb);/*</replacement>*/}else{afterWrite(stream,state,finished,cb);}}}function afterWrite(stream,state,finished,cb){if(!finished)onwriteDrain(stream,state);state.pendingcb--;cb();finishMaybe(stream,state);}// Must force callback to be called on nextTick, so that we don't
8198// emit 'drain' before the write() consumer gets the 'false' return
8199// value, and has a chance to attach a 'drain' listener.
8200function onwriteDrain(stream,state){if(state.length===0&&state.needDrain){state.needDrain=false;stream.emit('drain');}}// if there's something in the buffer waiting, then process it
8201function clearBuffer(stream,state){state.bufferProcessing=true;var entry=state.bufferedRequest;if(stream._writev&&entry&&entry.next){// Fast case, write everything using _writev()
8202var l=state.bufferedRequestCount;var buffer=new Array(l);var holder=state.corkedRequestsFree;holder.entry=entry;var count=0;while(entry){buffer[count]=entry;entry=entry.next;count+=1;}doWrite(stream,state,true,state.length,buffer,'',holder.finish);// doWrite is almost always async, defer these to save a bit of time
8203// as the hot path ends with doWrite
8204state.pendingcb++;state.lastBufferedRequest=null;if(holder.next){state.corkedRequestsFree=holder.next;holder.next=null;}else{state.corkedRequestsFree=new CorkedRequest(state);}}else{// Slow case, write chunks one-by-one
8205while(entry){var chunk=entry.chunk;var encoding=entry.encoding;var cb=entry.callback;var len=state.objectMode?1:chunk.length;doWrite(stream,state,false,len,chunk,encoding,cb);entry=entry.next;// if we didn't call the onwrite immediately, then
8206// it means that we need to wait until it does.
8207// also, that means that the chunk and cb are currently
8208// being processed, so move the buffer counter past them.
8209if(state.writing){break;}}if(entry===null)state.lastBufferedRequest=null;}state.bufferedRequestCount=0;state.bufferedRequest=entry;state.bufferProcessing=false;}Writable.prototype._write=function(chunk,encoding,cb){cb(new Error('not implemented'));};Writable.prototype._writev=null;Writable.prototype.end=function(chunk,encoding,cb){var state=this._writableState;if(typeof chunk==='function'){cb=chunk;chunk=null;encoding=null;}else if(typeof encoding==='function'){cb=encoding;encoding=null;}if(chunk!==null&&chunk!==undefined)this.write(chunk,encoding);// .end() fully uncorks
8210if(state.corked){state.corked=1;this.uncork();}// ignore unnecessary end() calls.
8211if(!state.ending&&!state.finished)endWritable(this,state,cb);};function needFinish(state){return state.ending&&state.length===0&&state.bufferedRequest===null&&!state.finished&&!state.writing;}function prefinish(stream,state){if(!state.prefinished){state.prefinished=true;stream.emit('prefinish');}}function finishMaybe(stream,state){var need=needFinish(state);if(need){if(state.pendingcb===0){prefinish(stream,state);state.finished=true;stream.emit('finish');}else{prefinish(stream,state);}}return need;}function endWritable(stream,state,cb){state.ending=true;finishMaybe(stream,state);if(cb){if(state.finished)processNextTick(cb);else stream.once('finish',cb);}state.ended=true;stream.writable=false;}// It seems a linked list but it is not
8212// there will be only 2 of these for each stream
8213function CorkedRequest(state){var _this=this;this.next=null;this.entry=null;this.finish=function(err){var entry=_this.entry;_this.entry=null;while(entry){var cb=entry.callback;state.pendingcb--;cb(err);entry=entry.next;}if(state.corkedRequestsFree){state.corkedRequestsFree.next=_this;}else{state.corkedRequestsFree=_this;}};}}).call(this,require('_process'));},{"./_stream_duplex":29,"_process":23,"buffer":15,"buffer-shims":34,"core-util-is":35,"events":19,"inherits":20,"process-nextick-args":37,"util-deprecate":38}],34:[function(require,module,exports){(function(global){'use strict';var buffer=require('buffer');var Buffer=buffer.Buffer;var SlowBuffer=buffer.SlowBuffer;var MAX_LEN=buffer.kMaxLength||2147483647;exports.alloc=function alloc(size,fill,encoding){if(typeof Buffer.alloc==='function'){return Buffer.alloc(size,fill,encoding);}if(typeof encoding==='number'){throw new TypeError('encoding must not be number');}if(typeof size!=='number'){throw new TypeError('size must be a number');}if(size>MAX_LEN){throw new RangeError('size is too large');}var enc=encoding;var _fill=fill;if(_fill===undefined){enc=undefined;_fill=0;}var buf=new Buffer(size);if(typeof _fill==='string'){var fillBuf=new Buffer(_fill,enc);var flen=fillBuf.length;var i=-1;while(++i<size){buf[i]=fillBuf[i%flen];}}else{buf.fill(_fill);}return buf;};exports.allocUnsafe=function allocUnsafe(size){if(typeof Buffer.allocUnsafe==='function'){return Buffer.allocUnsafe(size);}if(typeof size!=='number'){throw new TypeError('size must be a number');}if(size>MAX_LEN){throw new RangeError('size is too large');}return new Buffer(size);};exports.from=function from(value,encodingOrOffset,length){if(typeof Buffer.from==='function'&&(!global.Uint8Array||Uint8Array.from!==Buffer.from)){return Buffer.from(value,encodingOrOffset,length);}if(typeof value==='number'){throw new TypeError('"value" argument must not be a number');}if(typeof value==='string'){return new Buffer(value,encodingOrOffset);}if(typeof ArrayBuffer!=='undefined'&&value instanceof ArrayBuffer){var offset=encodingOrOffset;if(arguments.length===1){return new Buffer(value);}if(typeof offset==='undefined'){offset=0;}var len=length;if(typeof len==='undefined'){len=value.byteLength-offset;}if(offset>=value.byteLength){throw new RangeError('\'offset\' is out of bounds');}if(len>value.byteLength-offset){throw new RangeError('\'length\' is out of bounds');}return new Buffer(value.slice(offset,offset+len));}if(Buffer.isBuffer(value)){var out=new Buffer(value.length);value.copy(out,0,0,value.length);return out;}if(value){if(Array.isArray(value)||typeof ArrayBuffer!=='undefined'&&value.buffer instanceof ArrayBuffer||'length'in value){return new Buffer(value);}if(value.type==='Buffer'&&Array.isArray(value.data)){return new Buffer(value.data);}}throw new TypeError('First argument must be a string, Buffer, '+'ArrayBuffer, Array, or array-like object.');};exports.allocUnsafeSlow=function allocUnsafeSlow(size){if(typeof Buffer.allocUnsafeSlow==='function'){return Buffer.allocUnsafeSlow(size);}if(typeof size!=='number'){throw new TypeError('size must be a number');}if(size>=MAX_LEN){throw new RangeError('size is too large');}return new SlowBuffer(size);};}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"buffer":15}],35:[function(require,module,exports){(function(Buffer){// Copyright Joyent, Inc. and other Node contributors.
8214//
8215// Permission is hereby granted, free of charge, to any person obtaining a
8216// copy of this software and associated documentation files (the
8217// "Software"), to deal in the Software without restriction, including
8218// without limitation the rights to use, copy, modify, merge, publish,
8219// distribute, sublicense, and/or sell copies of the Software, and to permit
8220// persons to whom the Software is furnished to do so, subject to the
8221// following conditions:
8222//
8223// The above copyright notice and this permission notice shall be included
8224// in all copies or substantial portions of the Software.
8225//
8226// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8227// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
8228// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
8229// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
8230// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
8231// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
8232// USE OR OTHER DEALINGS IN THE SOFTWARE.
8233// NOTE: These type checking functions intentionally don't use `instanceof`
8234// because it is fragile and can be easily faked with `Object.create()`.
8235function isArray(arg){if(Array.isArray){return Array.isArray(arg);}return objectToString(arg)==='[object Array]';}exports.isArray=isArray;function isBoolean(arg){return typeof arg==='boolean';}exports.isBoolean=isBoolean;function isNull(arg){return arg===null;}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null;}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==='number';}exports.isNumber=isNumber;function isString(arg){return typeof arg==='string';}exports.isString=isString;function isSymbol(arg){return(typeof arg==="undefined"?"undefined":_typeof(arg))==='symbol';}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0;}exports.isUndefined=isUndefined;function isRegExp(re){return objectToString(re)==='[object RegExp]';}exports.isRegExp=isRegExp;function isObject(arg){return(typeof arg==="undefined"?"undefined":_typeof(arg))==='object'&&arg!==null;}exports.isObject=isObject;function isDate(d){return objectToString(d)==='[object Date]';}exports.isDate=isDate;function isError(e){return objectToString(e)==='[object Error]'||e instanceof Error;}exports.isError=isError;function isFunction(arg){return typeof arg==='function';}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==='boolean'||typeof arg==='number'||typeof arg==='string'||(typeof arg==="undefined"?"undefined":_typeof(arg))==='symbol'||// ES6 symbol
8236typeof arg==='undefined';}exports.isPrimitive=isPrimitive;exports.isBuffer=Buffer.isBuffer;function objectToString(o){return Object.prototype.toString.call(o);}}).call(this,{"isBuffer":require("../../../../insert-module-globals/node_modules/is-buffer/index.js")});},{"../../../../insert-module-globals/node_modules/is-buffer/index.js":21}],36:[function(require,module,exports){arguments[4][18][0].apply(exports,arguments);},{"dup":18}],37:[function(require,module,exports){(function(process){'use strict';if(!process.version||process.version.indexOf('v0.')===0||process.version.indexOf('v1.')===0&&process.version.indexOf('v1.8.')!==0){module.exports=nextTick;}else{module.exports=process.nextTick;}function nextTick(fn,arg1,arg2,arg3){if(typeof fn!=='function'){throw new TypeError('"callback" argument must be a function');}var len=arguments.length;var args,i;switch(len){case 0:case 1:return process.nextTick(fn);case 2:return process.nextTick(function afterTickOne(){fn.call(null,arg1);});case 3:return process.nextTick(function afterTickTwo(){fn.call(null,arg1,arg2);});case 4:return process.nextTick(function afterTickThree(){fn.call(null,arg1,arg2,arg3);});default:args=new Array(len-1);i=0;while(i<args.length){args[i++]=arguments[i];}return process.nextTick(function afterTick(){fn.apply(null,args);});}}}).call(this,require('_process'));},{"_process":23}],38:[function(require,module,exports){(function(global){/**
8237 * Module exports.
8238 */module.exports=deprecate;/**
8239 * Mark that a method should not be used.
8240 * Returns a modified function which warns once by default.
8241 *
8242 * If `localStorage.noDeprecation = true` is set, then it is a no-op.
8243 *
8244 * If `localStorage.throwDeprecation = true` is set, then deprecated functions
8245 * will throw an Error when invoked.
8246 *
8247 * If `localStorage.traceDeprecation = true` is set, then deprecated functions
8248 * will invoke `console.trace()` instead of `console.error()`.
8249 *
8250 * @param {Function} fn - the function to deprecate
8251 * @param {String} msg - the string to print to the console when `fn` is invoked
8252 * @returns {Function} a new "deprecated" version of `fn`
8253 * @api public
8254 */function deprecate(fn,msg){if(config('noDeprecation')){return fn;}var warned=false;function deprecated(){if(!warned){if(config('throwDeprecation')){throw new Error(msg);}else if(config('traceDeprecation')){console.trace(msg);}else{console.warn(msg);}warned=true;}return fn.apply(this,arguments);}return deprecated;}/**
8255 * Checks `localStorage` for boolean values for the given `name`.
8256 *
8257 * @param {String} name
8258 * @returns {Boolean}
8259 * @api private
8260 */function config(name){// accessing global.localStorage can trigger a DOMException in sandboxed iframes
8261try{if(!global.localStorage)return false;}catch(_){return false;}var val=global.localStorage[name];if(null==val)return false;return String(val).toLowerCase()==='true';}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],39:[function(require,module,exports){module.exports=require("./lib/_stream_passthrough.js");},{"./lib/_stream_passthrough.js":30}],40:[function(require,module,exports){(function(process){var Stream=function(){try{return require('st'+'ream');// hack to fix a circular dependency issue when used with browserify
8262}catch(_){}}();exports=module.exports=require('./lib/_stream_readable.js');exports.Stream=Stream||exports;exports.Readable=exports;exports.Writable=require('./lib/_stream_writable.js');exports.Duplex=require('./lib/_stream_duplex.js');exports.Transform=require('./lib/_stream_transform.js');exports.PassThrough=require('./lib/_stream_passthrough.js');if(!process.browser&&process.env.READABLE_STREAM==='disable'&&Stream){module.exports=Stream;}}).call(this,require('_process'));},{"./lib/_stream_duplex.js":29,"./lib/_stream_passthrough.js":30,"./lib/_stream_readable.js":31,"./lib/_stream_transform.js":32,"./lib/_stream_writable.js":33,"_process":23}],41:[function(require,module,exports){module.exports=require("./lib/_stream_transform.js");},{"./lib/_stream_transform.js":32}],42:[function(require,module,exports){module.exports=require("./lib/_stream_writable.js");},{"./lib/_stream_writable.js":33}],43:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
8263//
8264// Permission is hereby granted, free of charge, to any person obtaining a
8265// copy of this software and associated documentation files (the
8266// "Software"), to deal in the Software without restriction, including
8267// without limitation the rights to use, copy, modify, merge, publish,
8268// distribute, sublicense, and/or sell copies of the Software, and to permit
8269// persons to whom the Software is furnished to do so, subject to the
8270// following conditions:
8271//
8272// The above copyright notice and this permission notice shall be included
8273// in all copies or substantial portions of the Software.
8274//
8275// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8276// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
8277// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
8278// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
8279// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
8280// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
8281// USE OR OTHER DEALINGS IN THE SOFTWARE.
8282module.exports=Stream;var EE=require('events').EventEmitter;var inherits=require('inherits');inherits(Stream,EE);Stream.Readable=require('readable-stream/readable.js');Stream.Writable=require('readable-stream/writable.js');Stream.Duplex=require('readable-stream/duplex.js');Stream.Transform=require('readable-stream/transform.js');Stream.PassThrough=require('readable-stream/passthrough.js');// Backwards-compat with node 0.4.x
8283Stream.Stream=Stream;// old-style streams. Note that the pipe method (the only relevant
8284// part of this class) is overridden in the Readable class.
8285function Stream(){EE.call(this);}Stream.prototype.pipe=function(dest,options){var source=this;function ondata(chunk){if(dest.writable){if(false===dest.write(chunk)&&source.pause){source.pause();}}}source.on('data',ondata);function ondrain(){if(source.readable&&source.resume){source.resume();}}dest.on('drain',ondrain);// If the 'end' option is not supplied, dest.end() will be called when
8286// source gets the 'end' or 'close' events. Only dest.end() once.
8287if(!dest._isStdio&&(!options||options.end!==false)){source.on('end',onend);source.on('close',onclose);}var didOnEnd=false;function onend(){if(didOnEnd)return;didOnEnd=true;dest.end();}function onclose(){if(didOnEnd)return;didOnEnd=true;if(typeof dest.destroy==='function')dest.destroy();}// don't leave dangling pipes when there are errors.
8288function onerror(er){cleanup();if(EE.listenerCount(this,'error')===0){throw er;// Unhandled stream error in pipe.
8289}}source.on('error',onerror);dest.on('error',onerror);// remove all the event listeners that were added.
8290function cleanup(){source.removeListener('data',ondata);dest.removeListener('drain',ondrain);source.removeListener('end',onend);source.removeListener('close',onclose);source.removeListener('error',onerror);dest.removeListener('error',onerror);source.removeListener('end',cleanup);source.removeListener('close',cleanup);dest.removeListener('close',cleanup);}source.on('end',cleanup);source.on('close',cleanup);dest.on('close',cleanup);dest.emit('pipe',source);// Allow for unix-like usage: A.pipe(B).pipe(C)
8291return dest;};},{"events":19,"inherits":20,"readable-stream/duplex.js":28,"readable-stream/passthrough.js":39,"readable-stream/readable.js":40,"readable-stream/transform.js":41,"readable-stream/writable.js":42}],44:[function(require,module,exports){(function(global){var ClientRequest=require('./lib/request');var extend=require('xtend');var statusCodes=require('builtin-status-codes');var url=require('url');var http=exports;http.request=function(opts,cb){if(typeof opts==='string')opts=url.parse(opts);else opts=extend(opts);// Normally, the page is loaded from http or https, so not specifying a protocol
8292// will result in a (valid) protocol-relative url. However, this won't work if
8293// the protocol is something else, like 'file:'
8294var defaultProtocol=global.location.protocol.search(/^https?:$/)===-1?'http:':'';var protocol=opts.protocol||defaultProtocol;var host=opts.hostname||opts.host;var port=opts.port;var path=opts.path||'/';// Necessary for IPv6 addresses
8295if(host&&host.indexOf(':')!==-1)host='['+host+']';// This may be a relative url. The browser should always be able to interpret it correctly.
8296opts.url=(host?protocol+'//'+host:'')+(port?':'+port:'')+path;opts.method=(opts.method||'GET').toUpperCase();opts.headers=opts.headers||{};// Also valid opts.auth, opts.mode
8297var req=new ClientRequest(opts);if(cb)req.on('response',cb);return req;};http.get=function get(opts,cb){var req=http.request(opts,cb);req.end();return req;};http.Agent=function(){};http.Agent.defaultMaxSockets=4;http.STATUS_CODES=statusCodes;http.METHODS=['CHECKOUT','CONNECT','COPY','DELETE','GET','HEAD','LOCK','M-SEARCH','MERGE','MKACTIVITY','MKCOL','MOVE','NOTIFY','OPTIONS','PATCH','POST','PROPFIND','PROPPATCH','PURGE','PUT','REPORT','SEARCH','SUBSCRIBE','TRACE','UNLOCK','UNSUBSCRIBE'];}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"./lib/request":46,"builtin-status-codes":48,"url":51,"xtend":55}],45:[function(require,module,exports){(function(global){exports.fetch=isFunction(global.fetch)&&isFunction(global.ReadableStream);exports.blobConstructor=false;try{new Blob([new ArrayBuffer(1)]);exports.blobConstructor=true;}catch(e){}var xhr=new global.XMLHttpRequest();// If location.host is empty, e.g. if this page/worker was loaded
8298// from a Blob, then use example.com to avoid an error
8299xhr.open('GET',global.location.host?'/':'https://example.com');function checkTypeSupport(type){try{xhr.responseType=type;return xhr.responseType===type;}catch(e){}return false;}// For some strange reason, Safari 7.0 reports typeof global.ArrayBuffer === 'object'.
8300// Safari 7.1 appears to have fixed this bug.
8301var haveArrayBuffer=typeof global.ArrayBuffer!=='undefined';var haveSlice=haveArrayBuffer&&isFunction(global.ArrayBuffer.prototype.slice);exports.arraybuffer=haveArrayBuffer&&checkTypeSupport('arraybuffer');// These next two tests unavoidably show warnings in Chrome. Since fetch will always
8302// be used if it's available, just return false for these to avoid the warnings.
8303exports.msstream=!exports.fetch&&haveSlice&&checkTypeSupport('ms-stream');exports.mozchunkedarraybuffer=!exports.fetch&&haveArrayBuffer&&checkTypeSupport('moz-chunked-arraybuffer');exports.overrideMimeType=isFunction(xhr.overrideMimeType);exports.vbArray=isFunction(global.VBArray);function isFunction(value){return typeof value==='function';}xhr=null;// Help gc
8304}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],46:[function(require,module,exports){(function(process,global,Buffer){var capability=require('./capability');var inherits=require('inherits');var response=require('./response');var stream=require('readable-stream');var toArrayBuffer=require('to-arraybuffer');var IncomingMessage=response.IncomingMessage;var rStates=response.readyStates;function decideMode(preferBinary){if(capability.fetch){return'fetch';}else if(capability.mozchunkedarraybuffer){return'moz-chunked-arraybuffer';}else if(capability.msstream){return'ms-stream';}else if(capability.arraybuffer&&preferBinary){return'arraybuffer';}else if(capability.vbArray&&preferBinary){return'text:vbarray';}else{return'text';}}var ClientRequest=module.exports=function(opts){var self=this;stream.Writable.call(self);self._opts=opts;self._body=[];self._headers={};if(opts.auth)self.setHeader('Authorization','Basic '+new Buffer(opts.auth).toString('base64'));Object.keys(opts.headers).forEach(function(name){self.setHeader(name,opts.headers[name]);});var preferBinary;if(opts.mode==='prefer-streaming'){// If streaming is a high priority but binary compatibility and
8305// the accuracy of the 'content-type' header aren't
8306preferBinary=false;}else if(opts.mode==='allow-wrong-content-type'){// If streaming is more important than preserving the 'content-type' header
8307preferBinary=!capability.overrideMimeType;}else if(!opts.mode||opts.mode==='default'||opts.mode==='prefer-fast'){// Use binary if text streaming may corrupt data or the content-type header, or for speed
8308preferBinary=true;}else{throw new Error('Invalid value for opts.mode');}self._mode=decideMode(preferBinary);self.on('finish',function(){self._onFinish();});};inherits(ClientRequest,stream.Writable);ClientRequest.prototype.setHeader=function(name,value){var self=this;var lowerName=name.toLowerCase();// This check is not necessary, but it prevents warnings from browsers about setting unsafe
8309// headers. To be honest I'm not entirely sure hiding these warnings is a good thing, but
8310// http-browserify did it, so I will too.
8311if(unsafeHeaders.indexOf(lowerName)!==-1)return;self._headers[lowerName]={name:name,value:value};};ClientRequest.prototype.getHeader=function(name){var self=this;return self._headers[name.toLowerCase()].value;};ClientRequest.prototype.removeHeader=function(name){var self=this;delete self._headers[name.toLowerCase()];};ClientRequest.prototype._onFinish=function(){var self=this;if(self._destroyed)return;var opts=self._opts;var headersObj=self._headers;var body;if(opts.method==='POST'||opts.method==='PUT'||opts.method==='PATCH'){if(capability.blobConstructor){body=new global.Blob(self._body.map(function(buffer){return toArrayBuffer(buffer);}),{type:(headersObj['content-type']||{}).value||''});}else{// get utf8 string
8312body=Buffer.concat(self._body).toString();}}if(self._mode==='fetch'){var headers=Object.keys(headersObj).map(function(name){return[headersObj[name].name,headersObj[name].value];});global.fetch(self._opts.url,{method:self._opts.method,headers:headers,body:body,mode:'cors',credentials:opts.withCredentials?'include':'same-origin'}).then(function(response){self._fetchResponse=response;self._connect();},function(reason){self.emit('error',reason);});}else{var xhr=self._xhr=new global.XMLHttpRequest();try{xhr.open(self._opts.method,self._opts.url,true);}catch(err){process.nextTick(function(){self.emit('error',err);});return;}// Can't set responseType on really old browsers
8313if('responseType'in xhr)xhr.responseType=self._mode.split(':')[0];if('withCredentials'in xhr)xhr.withCredentials=!!opts.withCredentials;if(self._mode==='text'&&'overrideMimeType'in xhr)xhr.overrideMimeType('text/plain; charset=x-user-defined');Object.keys(headersObj).forEach(function(name){xhr.setRequestHeader(headersObj[name].name,headersObj[name].value);});self._response=null;xhr.onreadystatechange=function(){switch(xhr.readyState){case rStates.LOADING:case rStates.DONE:self._onXHRProgress();break;}};// Necessary for streaming in Firefox, since xhr.response is ONLY defined
8314// in onprogress, not in onreadystatechange with xhr.readyState = 3
8315if(self._mode==='moz-chunked-arraybuffer'){xhr.onprogress=function(){self._onXHRProgress();};}xhr.onerror=function(){if(self._destroyed)return;self.emit('error',new Error('XHR error'));};try{xhr.send(body);}catch(err){process.nextTick(function(){self.emit('error',err);});return;}}};/**
8316 * Checks if xhr.status is readable and non-zero, indicating no error.
8317 * Even though the spec says it should be available in readyState 3,
8318 * accessing it throws an exception in IE8
8319 */function statusValid(xhr){try{var status=xhr.status;return status!==null&&status!==0;}catch(e){return false;}}ClientRequest.prototype._onXHRProgress=function(){var self=this;if(!statusValid(self._xhr)||self._destroyed)return;if(!self._response)self._connect();self._response._onXHRProgress();};ClientRequest.prototype._connect=function(){var self=this;if(self._destroyed)return;self._response=new IncomingMessage(self._xhr,self._fetchResponse,self._mode);self.emit('response',self._response);};ClientRequest.prototype._write=function(chunk,encoding,cb){var self=this;self._body.push(chunk);cb();};ClientRequest.prototype.abort=ClientRequest.prototype.destroy=function(){var self=this;self._destroyed=true;if(self._response)self._response._destroyed=true;if(self._xhr)self._xhr.abort();// Currently, there isn't a way to truly abort a fetch.
8320// If you like bikeshedding, see https://github.com/whatwg/fetch/issues/27
8321};ClientRequest.prototype.end=function(data,encoding,cb){var self=this;if(typeof data==='function'){cb=data;data=undefined;}stream.Writable.prototype.end.call(self,data,encoding,cb);};ClientRequest.prototype.flushHeaders=function(){};ClientRequest.prototype.setTimeout=function(){};ClientRequest.prototype.setNoDelay=function(){};ClientRequest.prototype.setSocketKeepAlive=function(){};// Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method
8322var unsafeHeaders=['accept-charset','accept-encoding','access-control-request-headers','access-control-request-method','connection','content-length','cookie','cookie2','date','dnt','expect','host','keep-alive','origin','referer','te','trailer','transfer-encoding','upgrade','user-agent','via'];}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer);},{"./capability":45,"./response":47,"_process":23,"buffer":15,"inherits":20,"readable-stream":40,"to-arraybuffer":49}],47:[function(require,module,exports){(function(process,global,Buffer){var capability=require('./capability');var inherits=require('inherits');var stream=require('readable-stream');var rStates=exports.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4};var IncomingMessage=exports.IncomingMessage=function(xhr,response,mode){var self=this;stream.Readable.call(self);self._mode=mode;self.headers={};self.rawHeaders=[];self.trailers={};self.rawTrailers=[];// Fake the 'close' event, but only once 'end' fires
8323self.on('end',function(){// The nextTick is necessary to prevent the 'request' module from causing an infinite loop
8324process.nextTick(function(){self.emit('close');});});if(mode==='fetch'){var header,_i,_it;var reader;(function(){var read=function read(){reader.read().then(function(result){if(self._destroyed)return;if(result.done){self.push(null);return;}self.push(new Buffer(result.value));read();});};self._fetchResponse=response;self.url=response.url;self.statusCode=response.status;self.statusMessage=response.statusText;// backwards compatible version of for (<item> of <iterable>):
8325// for (var <item>,_i,_it = <iterable>[Symbol.iterator](); <item> = (_i = _it.next()).value,!_i.done;)
8326for(_it=response.headers[Symbol.iterator]();header=(_i=_it.next()).value,!_i.done;){self.headers[header[0].toLowerCase()]=header[1];self.rawHeaders.push(header[0],header[1]);}// TODO: this doesn't respect backpressure. Once WritableStream is available, this can be fixed
8327reader=response.body.getReader();read();})();}else{self._xhr=xhr;self._pos=0;self.url=xhr.responseURL;self.statusCode=xhr.status;self.statusMessage=xhr.statusText;var headers=xhr.getAllResponseHeaders().split(/\r?\n/);headers.forEach(function(header){var matches=header.match(/^([^:]+):\s*(.*)/);if(matches){var key=matches[1].toLowerCase();if(key==='set-cookie'){if(self.headers[key]===undefined){self.headers[key]=[];}self.headers[key].push(matches[2]);}else if(self.headers[key]!==undefined){self.headers[key]+=', '+matches[2];}else{self.headers[key]=matches[2];}self.rawHeaders.push(matches[1],matches[2]);}});self._charset='x-user-defined';if(!capability.overrideMimeType){var mimeType=self.rawHeaders['mime-type'];if(mimeType){var charsetMatch=mimeType.match(/;\s*charset=([^;])(;|$)/);if(charsetMatch){self._charset=charsetMatch[1].toLowerCase();}}if(!self._charset)self._charset='utf-8';// best guess
8328}}};inherits(IncomingMessage,stream.Readable);IncomingMessage.prototype._read=function(){};IncomingMessage.prototype._onXHRProgress=function(){var self=this;var xhr=self._xhr;var response=null;switch(self._mode){case'text:vbarray':// For IE9
8329if(xhr.readyState!==rStates.DONE)break;try{// This fails in IE8
8330response=new global.VBArray(xhr.responseBody).toArray();}catch(e){}if(response!==null){self.push(new Buffer(response));break;}// Falls through in IE8
8331case'text':try{// This will fail when readyState = 3 in IE9. Switch mode and wait for readyState = 4
8332response=xhr.responseText;}catch(e){self._mode='text:vbarray';break;}if(response.length>self._pos){var newData=response.substr(self._pos);if(self._charset==='x-user-defined'){var buffer=new Buffer(newData.length);for(var i=0;i<newData.length;i++){buffer[i]=newData.charCodeAt(i)&0xff;}self.push(buffer);}else{self.push(newData,self._charset);}self._pos=response.length;}break;case'arraybuffer':if(xhr.readyState!==rStates.DONE)break;response=xhr.response;self.push(new Buffer(new Uint8Array(response)));break;case'moz-chunked-arraybuffer':// take whole
8333response=xhr.response;if(xhr.readyState!==rStates.LOADING||!response)break;self.push(new Buffer(new Uint8Array(response)));break;case'ms-stream':response=xhr.response;if(xhr.readyState!==rStates.LOADING)break;var reader=new global.MSStreamReader();reader.onprogress=function(){if(reader.result.byteLength>self._pos){self.push(new Buffer(new Uint8Array(reader.result.slice(self._pos))));self._pos=reader.result.byteLength;}};reader.onload=function(){self.push(null);};// reader.onerror = ??? // TODO: this
8334reader.readAsArrayBuffer(response);break;}// The ms-stream case handles end separately in reader.onload()
8335if(self._xhr.readyState===rStates.DONE&&self._mode!=='ms-stream'){self.push(null);}};}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer);},{"./capability":45,"_process":23,"buffer":15,"inherits":20,"readable-stream":40}],48:[function(require,module,exports){module.exports={"100":"Continue","101":"Switching Protocols","102":"Processing","200":"OK","201":"Created","202":"Accepted","203":"Non-Authoritative Information","204":"No Content","205":"Reset Content","206":"Partial Content","207":"Multi-Status","208":"Already Reported","226":"IM Used","300":"Multiple Choices","301":"Moved Permanently","302":"Found","303":"See Other","304":"Not Modified","305":"Use Proxy","307":"Temporary Redirect","308":"Permanent Redirect","400":"Bad Request","401":"Unauthorized","402":"Payment Required","403":"Forbidden","404":"Not Found","405":"Method Not Allowed","406":"Not Acceptable","407":"Proxy Authentication Required","408":"Request Timeout","409":"Conflict","410":"Gone","411":"Length Required","412":"Precondition Failed","413":"Payload Too Large","414":"URI Too Long","415":"Unsupported Media Type","416":"Range Not Satisfiable","417":"Expectation Failed","418":"I'm a teapot","421":"Misdirected Request","422":"Unprocessable Entity","423":"Locked","424":"Failed Dependency","425":"Unordered Collection","426":"Upgrade Required","428":"Precondition Required","429":"Too Many Requests","431":"Request Header Fields Too Large","500":"Internal Server Error","501":"Not Implemented","502":"Bad Gateway","503":"Service Unavailable","504":"Gateway Timeout","505":"HTTP Version Not Supported","506":"Variant Also Negotiates","507":"Insufficient Storage","508":"Loop Detected","509":"Bandwidth Limit Exceeded","510":"Not Extended","511":"Network Authentication Required"};},{}],49:[function(require,module,exports){var Buffer=require('buffer').Buffer;module.exports=function(buf){// If the buffer is backed by a Uint8Array, a faster version will work
8336if(buf instanceof Uint8Array){// If the buffer isn't a subarray, return the underlying ArrayBuffer
8337if(buf.byteOffset===0&&buf.byteLength===buf.buffer.byteLength){return buf.buffer;}else if(typeof buf.buffer.slice==='function'){// Otherwise we need to get a proper copy
8338return buf.buffer.slice(buf.byteOffset,buf.byteOffset+buf.byteLength);}}if(Buffer.isBuffer(buf)){// This is the slow version that will work with any Buffer
8339// implementation (even in old browsers)
8340var arrayCopy=new Uint8Array(buf.length);var len=buf.length;for(var i=0;i<len;i++){arrayCopy[i]=buf[i];}return arrayCopy.buffer;}else{throw new Error('Argument must be a Buffer');}};},{"buffer":15}],50:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
8341//
8342// Permission is hereby granted, free of charge, to any person obtaining a
8343// copy of this software and associated documentation files (the
8344// "Software"), to deal in the Software without restriction, including
8345// without limitation the rights to use, copy, modify, merge, publish,
8346// distribute, sublicense, and/or sell copies of the Software, and to permit
8347// persons to whom the Software is furnished to do so, subject to the
8348// following conditions:
8349//
8350// The above copyright notice and this permission notice shall be included
8351// in all copies or substantial portions of the Software.
8352//
8353// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8354// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
8355// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
8356// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
8357// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
8358// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
8359// USE OR OTHER DEALINGS IN THE SOFTWARE.
8360var Buffer=require('buffer').Buffer;var isBufferEncoding=Buffer.isEncoding||function(encoding){switch(encoding&&encoding.toLowerCase()){case'hex':case'utf8':case'utf-8':case'ascii':case'binary':case'base64':case'ucs2':case'ucs-2':case'utf16le':case'utf-16le':case'raw':return true;default:return false;}};function assertEncoding(encoding){if(encoding&&!isBufferEncoding(encoding)){throw new Error('Unknown encoding: '+encoding);}}// StringDecoder provides an interface for efficiently splitting a series of
8361// buffers into a series of JS strings without breaking apart multi-byte
8362// characters. CESU-8 is handled as part of the UTF-8 encoding.
8363//
8364// @TODO Handling all encodings inside a single object makes it very difficult
8365// to reason about this code, so it should be split up in the future.
8366// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code
8367// points as used by CESU-8.
8368var StringDecoder=exports.StringDecoder=function(encoding){this.encoding=(encoding||'utf8').toLowerCase().replace(/[-_]/,'');assertEncoding(encoding);switch(this.encoding){case'utf8':// CESU-8 represents each of Surrogate Pair by 3-bytes
8369this.surrogateSize=3;break;case'ucs2':case'utf16le':// UTF-16 represents each of Surrogate Pair by 2-bytes
8370this.surrogateSize=2;this.detectIncompleteChar=utf16DetectIncompleteChar;break;case'base64':// Base-64 stores 3 bytes in 4 chars, and pads the remainder.
8371this.surrogateSize=3;this.detectIncompleteChar=base64DetectIncompleteChar;break;default:this.write=passThroughWrite;return;}// Enough space to store all bytes of a single character. UTF-8 needs 4
8372// bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).
8373this.charBuffer=new Buffer(6);// Number of bytes received for the current incomplete multi-byte character.
8374this.charReceived=0;// Number of bytes expected for the current incomplete multi-byte character.
8375this.charLength=0;};// write decodes the given buffer and returns it as JS string that is
8376// guaranteed to not contain any partial multi-byte characters. Any partial
8377// character found at the end of the buffer is buffered up, and will be
8378// returned when calling write again with the remaining bytes.
8379//
8380// Note: Converting a Buffer containing an orphan surrogate to a String
8381// currently works, but converting a String to a Buffer (via `new Buffer`, or
8382// Buffer#write) will replace incomplete surrogates with the unicode
8383// replacement character. See https://codereview.chromium.org/121173009/ .
8384StringDecoder.prototype.write=function(buffer){var charStr='';// if our last write ended with an incomplete multibyte character
8385while(this.charLength){// determine how many remaining bytes this buffer has to offer for this char
8386var available=buffer.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:buffer.length;// add the new bytes to the char buffer
8387buffer.copy(this.charBuffer,this.charReceived,0,available);this.charReceived+=available;if(this.charReceived<this.charLength){// still not enough chars in this buffer? wait for more ...
8388return'';}// remove bytes belonging to the current character from the buffer
8389buffer=buffer.slice(available,buffer.length);// get the character that was split
8390charStr=this.charBuffer.slice(0,this.charLength).toString(this.encoding);// CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
8391var charCode=charStr.charCodeAt(charStr.length-1);if(charCode>=0xD800&&charCode<=0xDBFF){this.charLength+=this.surrogateSize;charStr='';continue;}this.charReceived=this.charLength=0;// if there are no more bytes in this buffer, just emit our char
8392if(buffer.length===0){return charStr;}break;}// determine and set charLength / charReceived
8393this.detectIncompleteChar(buffer);var end=buffer.length;if(this.charLength){// buffer the incomplete character bytes we got
8394buffer.copy(this.charBuffer,0,buffer.length-this.charReceived,end);end-=this.charReceived;}charStr+=buffer.toString(this.encoding,0,end);var end=charStr.length-1;var charCode=charStr.charCodeAt(end);// CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
8395if(charCode>=0xD800&&charCode<=0xDBFF){var size=this.surrogateSize;this.charLength+=size;this.charReceived+=size;this.charBuffer.copy(this.charBuffer,size,0,size);buffer.copy(this.charBuffer,0,0,size);return charStr.substring(0,end);}// or just emit the charStr
8396return charStr;};// detectIncompleteChar determines if there is an incomplete UTF-8 character at
8397// the end of the given buffer. If so, it sets this.charLength to the byte
8398// length that character, and sets this.charReceived to the number of bytes
8399// that are available for this character.
8400StringDecoder.prototype.detectIncompleteChar=function(buffer){// determine how many bytes we have to check at the end of this buffer
8401var i=buffer.length>=3?3:buffer.length;// Figure out if one of the last i bytes of our buffer announces an
8402// incomplete char.
8403for(;i>0;i--){var c=buffer[buffer.length-i];// See http://en.wikipedia.org/wiki/UTF-8#Description
8404// 110XXXXX
8405if(i==1&&c>>5==0x06){this.charLength=2;break;}// 1110XXXX
8406if(i<=2&&c>>4==0x0E){this.charLength=3;break;}// 11110XXX
8407if(i<=3&&c>>3==0x1E){this.charLength=4;break;}}this.charReceived=i;};StringDecoder.prototype.end=function(buffer){var res='';if(buffer&&buffer.length)res=this.write(buffer);if(this.charReceived){var cr=this.charReceived;var buf=this.charBuffer;var enc=this.encoding;res+=buf.slice(0,cr).toString(enc);}return res;};function passThroughWrite(buffer){return buffer.toString(this.encoding);}function utf16DetectIncompleteChar(buffer){this.charReceived=buffer.length%2;this.charLength=this.charReceived?2:0;}function base64DetectIncompleteChar(buffer){this.charReceived=buffer.length%3;this.charLength=this.charReceived?3:0;}},{"buffer":15}],51:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
8408//
8409// Permission is hereby granted, free of charge, to any person obtaining a
8410// copy of this software and associated documentation files (the
8411// "Software"), to deal in the Software without restriction, including
8412// without limitation the rights to use, copy, modify, merge, publish,
8413// distribute, sublicense, and/or sell copies of the Software, and to permit
8414// persons to whom the Software is furnished to do so, subject to the
8415// following conditions:
8416//
8417// The above copyright notice and this permission notice shall be included
8418// in all copies or substantial portions of the Software.
8419//
8420// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8421// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
8422// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
8423// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
8424// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
8425// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
8426// USE OR OTHER DEALINGS IN THE SOFTWARE.
8427'use strict';var punycode=require('punycode');var util=require('./util');exports.parse=urlParse;exports.resolve=urlResolve;exports.resolveObject=urlResolveObject;exports.format=urlFormat;exports.Url=Url;function Url(){this.protocol=null;this.slashes=null;this.auth=null;this.host=null;this.port=null;this.hostname=null;this.hash=null;this.search=null;this.query=null;this.pathname=null;this.path=null;this.href=null;}// Reference: RFC 3986, RFC 1808, RFC 2396
8428// define these here so at least they only have to be
8429// compiled once on the first module load.
8430var protocolPattern=/^([a-z0-9.+-]+:)/i,portPattern=/:[0-9]*$/,// Special case for a simple path URL
8431simplePathPattern=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,// RFC 2396: characters reserved for delimiting URLs.
8432// We actually just auto-escape these.
8433delims=['<','>','"','`',' ','\r','\n','\t'],// RFC 2396: characters not allowed for various reasons.
8434unwise=['{','}','|','\\','^','`'].concat(delims),// Allowed by RFCs, but cause of XSS attacks. Always escape these.
8435autoEscape=['\''].concat(unwise),// Characters that are never ever allowed in a hostname.
8436// Note that any invalid chars are also handled, but these
8437// are the ones that are *expected* to be seen, so we fast-path
8438// them.
8439nonHostChars=['%','/','?',';','#'].concat(autoEscape),hostEndingChars=['/','?','#'],hostnameMaxLen=255,hostnamePartPattern=/^[+a-z0-9A-Z_-]{0,63}$/,hostnamePartStart=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,// protocols that can allow "unsafe" and "unwise" chars.
8440unsafeProtocol={'javascript':true,'javascript:':true},// protocols that never have a hostname.
8441hostlessProtocol={'javascript':true,'javascript:':true},// protocols that always contain a // bit.
8442slashedProtocol={'http':true,'https':true,'ftp':true,'gopher':true,'file':true,'http:':true,'https:':true,'ftp:':true,'gopher:':true,'file:':true},querystring=require('querystring');function urlParse(url,parseQueryString,slashesDenoteHost){if(url&&util.isObject(url)&&url instanceof Url)return url;var u=new Url();u.parse(url,parseQueryString,slashesDenoteHost);return u;}Url.prototype.parse=function(url,parseQueryString,slashesDenoteHost){if(!util.isString(url)){throw new TypeError("Parameter 'url' must be a string, not "+(typeof url==="undefined"?"undefined":_typeof(url)));}// Copy chrome, IE, opera backslash-handling behavior.
8443// Back slashes before the query string get converted to forward slashes
8444// See: https://code.google.com/p/chromium/issues/detail?id=25916
8445var queryIndex=url.indexOf('?'),splitter=queryIndex!==-1&&queryIndex<url.indexOf('#')?'?':'#',uSplit=url.split(splitter),slashRegex=/\\/g;uSplit[0]=uSplit[0].replace(slashRegex,'/');url=uSplit.join(splitter);var rest=url;// trim before proceeding.
8446// This is to support parse stuff like " http://foo.com \n"
8447rest=rest.trim();if(!slashesDenoteHost&&url.split('#').length===1){// Try fast path regexp
8448var simplePath=simplePathPattern.exec(rest);if(simplePath){this.path=rest;this.href=rest;this.pathname=simplePath[1];if(simplePath[2]){this.search=simplePath[2];if(parseQueryString){this.query=querystring.parse(this.search.substr(1));}else{this.query=this.search.substr(1);}}else if(parseQueryString){this.search='';this.query={};}return this;}}var proto=protocolPattern.exec(rest);if(proto){proto=proto[0];var lowerProto=proto.toLowerCase();this.protocol=lowerProto;rest=rest.substr(proto.length);}// figure out if it's got a host
8449// user@server is *always* interpreted as a hostname, and url
8450// resolution will treat //foo/bar as host=foo,path=bar because that's
8451// how the browser resolves relative URLs.
8452if(slashesDenoteHost||proto||rest.match(/^\/\/[^@\/]+@[^@\/]+/)){var slashes=rest.substr(0,2)==='//';if(slashes&&!(proto&&hostlessProtocol[proto])){rest=rest.substr(2);this.slashes=true;}}if(!hostlessProtocol[proto]&&(slashes||proto&&!slashedProtocol[proto])){// there's a hostname.
8453// the first instance of /, ?, ;, or # ends the host.
8454//
8455// If there is an @ in the hostname, then non-host chars *are* allowed
8456// to the left of the last @ sign, unless some host-ending character
8457// comes *before* the @-sign.
8458// URLs are obnoxious.
8459//
8460// ex:
8461// http://a@b@c/ => user:a@b host:c
8462// http://a@b?@c => user:a host:c path:/?@c
8463// v0.12 TODO(isaacs): This is not quite how Chrome does things.
8464// Review our test case against browsers more comprehensively.
8465// find the first instance of any hostEndingChars
8466var hostEnd=-1;for(var i=0;i<hostEndingChars.length;i++){var hec=rest.indexOf(hostEndingChars[i]);if(hec!==-1&&(hostEnd===-1||hec<hostEnd))hostEnd=hec;}// at this point, either we have an explicit point where the
8467// auth portion cannot go past, or the last @ char is the decider.
8468var auth,atSign;if(hostEnd===-1){// atSign can be anywhere.
8469atSign=rest.lastIndexOf('@');}else{// atSign must be in auth portion.
8470// http://a@b/c@d => host:b auth:a path:/c@d
8471atSign=rest.lastIndexOf('@',hostEnd);}// Now we have a portion which is definitely the auth.
8472// Pull that off.
8473if(atSign!==-1){auth=rest.slice(0,atSign);rest=rest.slice(atSign+1);this.auth=decodeURIComponent(auth);}// the host is the remaining to the left of the first non-host char
8474hostEnd=-1;for(var i=0;i<nonHostChars.length;i++){var hec=rest.indexOf(nonHostChars[i]);if(hec!==-1&&(hostEnd===-1||hec<hostEnd))hostEnd=hec;}// if we still have not hit it, then the entire thing is a host.
8475if(hostEnd===-1)hostEnd=rest.length;this.host=rest.slice(0,hostEnd);rest=rest.slice(hostEnd);// pull out port.
8476this.parseHost();// we've indicated that there is a hostname,
8477// so even if it's empty, it has to be present.
8478this.hostname=this.hostname||'';// if hostname begins with [ and ends with ]
8479// assume that it's an IPv6 address.
8480var ipv6Hostname=this.hostname[0]==='['&&this.hostname[this.hostname.length-1]===']';// validate a little.
8481if(!ipv6Hostname){var hostparts=this.hostname.split(/\./);for(var i=0,l=hostparts.length;i<l;i++){var part=hostparts[i];if(!part)continue;if(!part.match(hostnamePartPattern)){var newpart='';for(var j=0,k=part.length;j<k;j++){if(part.charCodeAt(j)>127){// we replace non-ASCII char with a temporary placeholder
8482// we need this to make sure size of hostname is not
8483// broken by replacing non-ASCII by nothing
8484newpart+='x';}else{newpart+=part[j];}}// we test again with ASCII char only
8485if(!newpart.match(hostnamePartPattern)){var validParts=hostparts.slice(0,i);var notHost=hostparts.slice(i+1);var bit=part.match(hostnamePartStart);if(bit){validParts.push(bit[1]);notHost.unshift(bit[2]);}if(notHost.length){rest='/'+notHost.join('.')+rest;}this.hostname=validParts.join('.');break;}}}}if(this.hostname.length>hostnameMaxLen){this.hostname='';}else{// hostnames are always lower case.
8486this.hostname=this.hostname.toLowerCase();}if(!ipv6Hostname){// IDNA Support: Returns a punycoded representation of "domain".
8487// It only converts parts of the domain name that
8488// have non-ASCII characters, i.e. it doesn't matter if
8489// you call it with a domain that already is ASCII-only.
8490this.hostname=punycode.toASCII(this.hostname);}var p=this.port?':'+this.port:'';var h=this.hostname||'';this.host=h+p;this.href+=this.host;// strip [ and ] from the hostname
8491// the host field still retains them, though
8492if(ipv6Hostname){this.hostname=this.hostname.substr(1,this.hostname.length-2);if(rest[0]!=='/'){rest='/'+rest;}}}// now rest is set to the post-host stuff.
8493// chop off any delim chars.
8494if(!unsafeProtocol[lowerProto]){// First, make 100% sure that any "autoEscape" chars get
8495// escaped, even if encodeURIComponent doesn't think they
8496// need to be.
8497for(var i=0,l=autoEscape.length;i<l;i++){var ae=autoEscape[i];if(rest.indexOf(ae)===-1)continue;var esc=encodeURIComponent(ae);if(esc===ae){esc=escape(ae);}rest=rest.split(ae).join(esc);}}// chop off from the tail first.
8498var hash=rest.indexOf('#');if(hash!==-1){// got a fragment string.
8499this.hash=rest.substr(hash);rest=rest.slice(0,hash);}var qm=rest.indexOf('?');if(qm!==-1){this.search=rest.substr(qm);this.query=rest.substr(qm+1);if(parseQueryString){this.query=querystring.parse(this.query);}rest=rest.slice(0,qm);}else if(parseQueryString){// no query string, but parseQueryString still requested
8500this.search='';this.query={};}if(rest)this.pathname=rest;if(slashedProtocol[lowerProto]&&this.hostname&&!this.pathname){this.pathname='/';}//to support http.request
8501if(this.pathname||this.search){var p=this.pathname||'';var s=this.search||'';this.path=p+s;}// finally, reconstruct the href based on what has been validated.
8502this.href=this.format();return this;};// format a parsed object into a url string
8503function urlFormat(obj){// ensure it's an object, and not a string url.
8504// If it's an obj, this is a no-op.
8505// this way, you can call url_format() on strings
8506// to clean up potentially wonky urls.
8507if(util.isString(obj))obj=urlParse(obj);if(!(obj instanceof Url))return Url.prototype.format.call(obj);return obj.format();}Url.prototype.format=function(){var auth=this.auth||'';if(auth){auth=encodeURIComponent(auth);auth=auth.replace(/%3A/i,':');auth+='@';}var protocol=this.protocol||'',pathname=this.pathname||'',hash=this.hash||'',host=false,query='';if(this.host){host=auth+this.host;}else if(this.hostname){host=auth+(this.hostname.indexOf(':')===-1?this.hostname:'['+this.hostname+']');if(this.port){host+=':'+this.port;}}if(this.query&&util.isObject(this.query)&&Object.keys(this.query).length){query=querystring.stringify(this.query);}var search=this.search||query&&'?'+query||'';if(protocol&&protocol.substr(-1)!==':')protocol+=':';// only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
8508// unless they had them to begin with.
8509if(this.slashes||(!protocol||slashedProtocol[protocol])&&host!==false){host='//'+(host||'');if(pathname&&pathname.charAt(0)!=='/')pathname='/'+pathname;}else if(!host){host='';}if(hash&&hash.charAt(0)!=='#')hash='#'+hash;if(search&&search.charAt(0)!=='?')search='?'+search;pathname=pathname.replace(/[?#]/g,function(match){return encodeURIComponent(match);});search=search.replace('#','%23');return protocol+host+pathname+search+hash;};function urlResolve(source,relative){return urlParse(source,false,true).resolve(relative);}Url.prototype.resolve=function(relative){return this.resolveObject(urlParse(relative,false,true)).format();};function urlResolveObject(source,relative){if(!source)return relative;return urlParse(source,false,true).resolveObject(relative);}Url.prototype.resolveObject=function(relative){if(util.isString(relative)){var rel=new Url();rel.parse(relative,false,true);relative=rel;}var result=new Url();var tkeys=Object.keys(this);for(var tk=0;tk<tkeys.length;tk++){var tkey=tkeys[tk];result[tkey]=this[tkey];}// hash is always overridden, no matter what.
8510// even href="" will remove it.
8511result.hash=relative.hash;// if the relative url is empty, then there's nothing left to do here.
8512if(relative.href===''){result.href=result.format();return result;}// hrefs like //foo/bar always cut to the protocol.
8513if(relative.slashes&&!relative.protocol){// take everything except the protocol from relative
8514var rkeys=Object.keys(relative);for(var rk=0;rk<rkeys.length;rk++){var rkey=rkeys[rk];if(rkey!=='protocol')result[rkey]=relative[rkey];}//urlParse appends trailing / to urls like http://www.example.com
8515if(slashedProtocol[result.protocol]&&result.hostname&&!result.pathname){result.path=result.pathname='/';}result.href=result.format();return result;}if(relative.protocol&&relative.protocol!==result.protocol){// if it's a known url protocol, then changing
8516// the protocol does weird things
8517// first, if it's not file:, then we MUST have a host,
8518// and if there was a path
8519// to begin with, then we MUST have a path.
8520// if it is file:, then the host is dropped,
8521// because that's known to be hostless.
8522// anything else is assumed to be absolute.
8523if(!slashedProtocol[relative.protocol]){var keys=Object.keys(relative);for(var v=0;v<keys.length;v++){var k=keys[v];result[k]=relative[k];}result.href=result.format();return result;}result.protocol=relative.protocol;if(!relative.host&&!hostlessProtocol[relative.protocol]){var relPath=(relative.pathname||'').split('/');while(relPath.length&&!(relative.host=relPath.shift())){}if(!relative.host)relative.host='';if(!relative.hostname)relative.hostname='';if(relPath[0]!=='')relPath.unshift('');if(relPath.length<2)relPath.unshift('');result.pathname=relPath.join('/');}else{result.pathname=relative.pathname;}result.search=relative.search;result.query=relative.query;result.host=relative.host||'';result.auth=relative.auth;result.hostname=relative.hostname||relative.host;result.port=relative.port;// to support http.request
8524if(result.pathname||result.search){var p=result.pathname||'';var s=result.search||'';result.path=p+s;}result.slashes=result.slashes||relative.slashes;result.href=result.format();return result;}var isSourceAbs=result.pathname&&result.pathname.charAt(0)==='/',isRelAbs=relative.host||relative.pathname&&relative.pathname.charAt(0)==='/',mustEndAbs=isRelAbs||isSourceAbs||result.host&&relative.pathname,removeAllDots=mustEndAbs,srcPath=result.pathname&&result.pathname.split('/')||[],relPath=relative.pathname&&relative.pathname.split('/')||[],psychotic=result.protocol&&!slashedProtocol[result.protocol];// if the url is a non-slashed url, then relative
8525// links like ../.. should be able
8526// to crawl up to the hostname, as well. This is strange.
8527// result.protocol has already been set by now.
8528// Later on, put the first path part into the host field.
8529if(psychotic){result.hostname='';result.port=null;if(result.host){if(srcPath[0]==='')srcPath[0]=result.host;else srcPath.unshift(result.host);}result.host='';if(relative.protocol){relative.hostname=null;relative.port=null;if(relative.host){if(relPath[0]==='')relPath[0]=relative.host;else relPath.unshift(relative.host);}relative.host=null;}mustEndAbs=mustEndAbs&&(relPath[0]===''||srcPath[0]==='');}if(isRelAbs){// it's absolute.
8530result.host=relative.host||relative.host===''?relative.host:result.host;result.hostname=relative.hostname||relative.hostname===''?relative.hostname:result.hostname;result.search=relative.search;result.query=relative.query;srcPath=relPath;// fall through to the dot-handling below.
8531}else if(relPath.length){// it's relative
8532// throw away the existing file, and take the new path instead.
8533if(!srcPath)srcPath=[];srcPath.pop();srcPath=srcPath.concat(relPath);result.search=relative.search;result.query=relative.query;}else if(!util.isNullOrUndefined(relative.search)){// just pull out the search.
8534// like href='?foo'.
8535// Put this after the other two cases because it simplifies the booleans
8536if(psychotic){result.hostname=result.host=srcPath.shift();//occationaly the auth can get stuck only in host
8537//this especially happens in cases like
8538//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
8539var authInHost=result.host&&result.host.indexOf('@')>0?result.host.split('@'):false;if(authInHost){result.auth=authInHost.shift();result.host=result.hostname=authInHost.shift();}}result.search=relative.search;result.query=relative.query;//to support http.request
8540if(!util.isNull(result.pathname)||!util.isNull(result.search)){result.path=(result.pathname?result.pathname:'')+(result.search?result.search:'');}result.href=result.format();return result;}if(!srcPath.length){// no path at all. easy.
8541// we've already handled the other stuff above.
8542result.pathname=null;//to support http.request
8543if(result.search){result.path='/'+result.search;}else{result.path=null;}result.href=result.format();return result;}// if a url ENDs in . or .., then it must get a trailing slash.
8544// however, if it ends in anything else non-slashy,
8545// then it must NOT get a trailing slash.
8546var last=srcPath.slice(-1)[0];var hasTrailingSlash=(result.host||relative.host||srcPath.length>1)&&(last==='.'||last==='..')||last==='';// strip single dots, resolve double dots to parent dir
8547// if the path tries to go above the root, `up` ends up > 0
8548var up=0;for(var i=srcPath.length;i>=0;i--){last=srcPath[i];if(last==='.'){srcPath.splice(i,1);}else if(last==='..'){srcPath.splice(i,1);up++;}else if(up){srcPath.splice(i,1);up--;}}// if the path is allowed to go above the root, restore leading ..s
8549if(!mustEndAbs&&!removeAllDots){for(;up--;up){srcPath.unshift('..');}}if(mustEndAbs&&srcPath[0]!==''&&(!srcPath[0]||srcPath[0].charAt(0)!=='/')){srcPath.unshift('');}if(hasTrailingSlash&&srcPath.join('/').substr(-1)!=='/'){srcPath.push('');}var isAbsolute=srcPath[0]===''||srcPath[0]&&srcPath[0].charAt(0)==='/';// put the host back
8550if(psychotic){result.hostname=result.host=isAbsolute?'':srcPath.length?srcPath.shift():'';//occationaly the auth can get stuck only in host
8551//this especially happens in cases like
8552//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
8553var authInHost=result.host&&result.host.indexOf('@')>0?result.host.split('@'):false;if(authInHost){result.auth=authInHost.shift();result.host=result.hostname=authInHost.shift();}}mustEndAbs=mustEndAbs||result.host&&srcPath.length;if(mustEndAbs&&!isAbsolute){srcPath.unshift('');}if(!srcPath.length){result.pathname=null;result.path=null;}else{result.pathname=srcPath.join('/');}//to support request.http
8554if(!util.isNull(result.pathname)||!util.isNull(result.search)){result.path=(result.pathname?result.pathname:'')+(result.search?result.search:'');}result.auth=relative.auth||result.auth;result.slashes=result.slashes||relative.slashes;result.href=result.format();return result;};Url.prototype.parseHost=function(){var host=this.host;var port=portPattern.exec(host);if(port){port=port[0];if(port!==':'){this.port=port.substr(1);}host=host.substr(0,host.length-port.length);}if(host)this.hostname=host;};},{"./util":52,"punycode":24,"querystring":27}],52:[function(require,module,exports){'use strict';module.exports={isString:function isString(arg){return typeof arg==='string';},isObject:function isObject(arg){return(typeof arg==="undefined"?"undefined":_typeof(arg))==='object'&&arg!==null;},isNull:function isNull(arg){return arg===null;},isNullOrUndefined:function isNullOrUndefined(arg){return arg==null;}};},{}],53:[function(require,module,exports){module.exports=function isBuffer(arg){return arg&&(typeof arg==="undefined"?"undefined":_typeof(arg))==='object'&&typeof arg.copy==='function'&&typeof arg.fill==='function'&&typeof arg.readUInt8==='function';};},{}],54:[function(require,module,exports){(function(process,global){// Copyright Joyent, Inc. and other Node contributors.
8555//
8556// Permission is hereby granted, free of charge, to any person obtaining a
8557// copy of this software and associated documentation files (the
8558// "Software"), to deal in the Software without restriction, including
8559// without limitation the rights to use, copy, modify, merge, publish,
8560// distribute, sublicense, and/or sell copies of the Software, and to permit
8561// persons to whom the Software is furnished to do so, subject to the
8562// following conditions:
8563//
8564// The above copyright notice and this permission notice shall be included
8565// in all copies or substantial portions of the Software.
8566//
8567// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8568// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
8569// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
8570// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
8571// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
8572// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
8573// USE OR OTHER DEALINGS IN THE SOFTWARE.
8574var formatRegExp=/%[sdj%]/g;exports.format=function(f){if(!isString(f)){var objects=[];for(var i=0;i<arguments.length;i++){objects.push(inspect(arguments[i]));}return objects.join(' ');}var i=1;var args=arguments;var len=args.length;var str=String(f).replace(formatRegExp,function(x){if(x==='%%')return'%';if(i>=len)return x;switch(x){case'%s':return String(args[i++]);case'%d':return Number(args[i++]);case'%j':try{return JSON.stringify(args[i++]);}catch(_){return'[Circular]';}default:return x;}});for(var x=args[i];i<len;x=args[++i]){if(isNull(x)||!isObject(x)){str+=' '+x;}else{str+=' '+inspect(x);}}return str;};// Mark that a method should not be used.
8575// Returns a modified function which warns once by default.
8576// If --no-deprecation is set, then it is a no-op.
8577exports.deprecate=function(fn,msg){// Allow for deprecating things in the process of starting up.
8578if(isUndefined(global.process)){return function(){return exports.deprecate(fn,msg).apply(this,arguments);};}if(process.noDeprecation===true){return fn;}var warned=false;function deprecated(){if(!warned){if(process.throwDeprecation){throw new Error(msg);}else if(process.traceDeprecation){console.trace(msg);}else{console.error(msg);}warned=true;}return fn.apply(this,arguments);}return deprecated;};var debugs={};var debugEnviron;exports.debuglog=function(set){if(isUndefined(debugEnviron))debugEnviron=process.env.NODE_DEBUG||'';set=set.toUpperCase();if(!debugs[set]){if(new RegExp('\\b'+set+'\\b','i').test(debugEnviron)){var pid=process.pid;debugs[set]=function(){var msg=exports.format.apply(exports,arguments);console.error('%s %d: %s',set,pid,msg);};}else{debugs[set]=function(){};}}return debugs[set];};/**
8579 * Echos the value of a value. Trys to print the value out
8580 * in the best way possible given the different types.
8581 *
8582 * @param {Object} obj The object to print out.
8583 * @param {Object} opts Optional options object that alters the output.
8584 *//* legacy: obj, showHidden, depth, colors*/function inspect(obj,opts){// default options
8585var ctx={seen:[],stylize:stylizeNoColor};// legacy...
8586if(arguments.length>=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean(opts)){// legacy...
8587ctx.showHidden=opts;}else if(opts){// got an "options" object
8588exports._extend(ctx,opts);}// set default options
8589if(isUndefined(ctx.showHidden))ctx.showHidden=false;if(isUndefined(ctx.depth))ctx.depth=2;if(isUndefined(ctx.colors))ctx.colors=false;if(isUndefined(ctx.customInspect))ctx.customInspect=true;if(ctx.colors)ctx.stylize=stylizeWithColor;return formatValue(ctx,obj,ctx.depth);}exports.inspect=inspect;// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
8590inspect.colors={'bold':[1,22],'italic':[3,23],'underline':[4,24],'inverse':[7,27],'white':[37,39],'grey':[90,39],'black':[30,39],'blue':[34,39],'cyan':[36,39],'green':[32,39],'magenta':[35,39],'red':[31,39],'yellow':[33,39]};// Don't use 'blue' not visible on cmd.exe
8591inspect.styles={'special':'cyan','number':'yellow','boolean':'yellow','undefined':'grey','null':'bold','string':'green','date':'magenta',// "name": intentionally not styling
8592'regexp':'red'};function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style){return"\u001b["+inspect.colors[style][0]+'m'+str+"\u001b["+inspect.colors[style][1]+'m';}else{return str;}}function stylizeNoColor(str,styleType){return str;}function arrayToHash(array){var hash={};array.forEach(function(val,idx){hash[val]=true;});return hash;}function formatValue(ctx,value,recurseTimes){// Provide a hook for user-specified inspect functions.
8593// Check that value is an object with an inspect function on it
8594if(ctx.customInspect&&value&&isFunction(value.inspect)&&// Filter out the util module, it's inspect function is special
8595value.inspect!==exports.inspect&&// Also filter out any prototype objects using the circular check.
8596!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString(ret)){ret=formatValue(ctx,ret,recurseTimes);}return ret;}// Primitive types cannot have properties
8597var primitive=formatPrimitive(ctx,value);if(primitive){return primitive;}// Look up the keys of the object.
8598var keys=Object.keys(value);var visibleKeys=arrayToHash(keys);if(ctx.showHidden){keys=Object.getOwnPropertyNames(value);}// IE doesn't make error fields non-enumerable
8599// http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
8600if(isError(value)&&(keys.indexOf('message')>=0||keys.indexOf('description')>=0)){return formatError(value);}// Some type of object without properties can be shortcutted.
8601if(keys.length===0){if(isFunction(value)){var name=value.name?': '+value.name:'';return ctx.stylize('[Function'+name+']','special');}if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),'regexp');}if(isDate(value)){return ctx.stylize(Date.prototype.toString.call(value),'date');}if(isError(value)){return formatError(value);}}var base='',array=false,braces=['{','}'];// Make Array say that they are Array
8602if(isArray(value)){array=true;braces=['[',']'];}// Make functions say that they are functions
8603if(isFunction(value)){var n=value.name?': '+value.name:'';base=' [Function'+n+']';}// Make RegExps say that they are RegExps
8604if(isRegExp(value)){base=' '+RegExp.prototype.toString.call(value);}// Make dates with properties first say the date
8605if(isDate(value)){base=' '+Date.prototype.toUTCString.call(value);}// Make error with message first say the error
8606if(isError(value)){base=' '+formatError(value);}if(keys.length===0&&(!array||value.length==0)){return braces[0]+base+braces[1];}if(recurseTimes<0){if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),'regexp');}else{return ctx.stylize('[Object]','special');}}ctx.seen.push(value);var output;if(array){output=formatArray(ctx,value,recurseTimes,visibleKeys,keys);}else{output=keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array);});}ctx.seen.pop();return reduceToSingleString(output,base,braces);}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize('undefined','undefined');if(isString(value)){var simple='\''+JSON.stringify(value).replace(/^"|"$/g,'').replace(/'/g,"\\'").replace(/\\"/g,'"')+'\'';return ctx.stylize(simple,'string');}if(isNumber(value))return ctx.stylize(''+value,'number');if(isBoolean(value))return ctx.stylize(''+value,'boolean');// For some reason typeof null is "object", so special case here.
8607if(isNull(value))return ctx.stylize('null','null');}function formatError(value){return'['+Error.prototype.toString.call(value)+']';}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i=0,l=value.length;i<l;++i){if(hasOwnProperty(value,String(i))){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i),true));}else{output.push('');}}keys.forEach(function(key){if(!key.match(/^\d+$/)){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,true));}});return output;}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]};if(desc.get){if(desc.set){str=ctx.stylize('[Getter/Setter]','special');}else{str=ctx.stylize('[Getter]','special');}}else{if(desc.set){str=ctx.stylize('[Setter]','special');}}if(!hasOwnProperty(visibleKeys,key)){name='['+key+']';}if(!str){if(ctx.seen.indexOf(desc.value)<0){if(isNull(recurseTimes)){str=formatValue(ctx,desc.value,null);}else{str=formatValue(ctx,desc.value,recurseTimes-1);}if(str.indexOf('\n')>-1){if(array){str=str.split('\n').map(function(line){return' '+line;}).join('\n').substr(2);}else{str='\n'+str.split('\n').map(function(line){return' '+line;}).join('\n');}}}else{str=ctx.stylize('[Circular]','special');}}if(isUndefined(name)){if(array&&key.match(/^\d+$/)){return str;}name=JSON.stringify(''+key);if(name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){name=name.substr(1,name.length-2);name=ctx.stylize(name,'name');}else{name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");name=ctx.stylize(name,'string');}}return name+': '+str;}function reduceToSingleString(output,base,braces){var numLinesEst=0;var length=output.reduce(function(prev,cur){numLinesEst++;if(cur.indexOf('\n')>=0)numLinesEst++;return prev+cur.replace(/\u001b\[\d\d?m/g,'').length+1;},0);if(length>60){return braces[0]+(base===''?'':base+'\n ')+' '+output.join(',\n ')+' '+braces[1];}return braces[0]+base+' '+output.join(', ')+' '+braces[1];}// NOTE: These type checking functions intentionally don't use `instanceof`
8608// because it is fragile and can be easily faked with `Object.create()`.
8609function isArray(ar){return Array.isArray(ar);}exports.isArray=isArray;function isBoolean(arg){return typeof arg==='boolean';}exports.isBoolean=isBoolean;function isNull(arg){return arg===null;}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null;}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==='number';}exports.isNumber=isNumber;function isString(arg){return typeof arg==='string';}exports.isString=isString;function isSymbol(arg){return(typeof arg==="undefined"?"undefined":_typeof(arg))==='symbol';}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0;}exports.isUndefined=isUndefined;function isRegExp(re){return isObject(re)&&objectToString(re)==='[object RegExp]';}exports.isRegExp=isRegExp;function isObject(arg){return(typeof arg==="undefined"?"undefined":_typeof(arg))==='object'&&arg!==null;}exports.isObject=isObject;function isDate(d){return isObject(d)&&objectToString(d)==='[object Date]';}exports.isDate=isDate;function isError(e){return isObject(e)&&(objectToString(e)==='[object Error]'||e instanceof Error);}exports.isError=isError;function isFunction(arg){return typeof arg==='function';}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==='boolean'||typeof arg==='number'||typeof arg==='string'||(typeof arg==="undefined"?"undefined":_typeof(arg))==='symbol'||// ES6 symbol
8610typeof arg==='undefined';}exports.isPrimitive=isPrimitive;exports.isBuffer=require('./support/isBuffer');function objectToString(o){return Object.prototype.toString.call(o);}function pad(n){return n<10?'0'+n.toString(10):n.toString(10);}var months=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];// 26 Feb 16:19:34
8611function timestamp(){var d=new Date();var time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(':');return[d.getDate(),months[d.getMonth()],time].join(' ');}// log is just a thin wrapper to console.log that prepends a timestamp
8612exports.log=function(){console.log('%s - %s',timestamp(),exports.format.apply(exports,arguments));};/**
8613 * Inherit the prototype methods from one constructor into another.
8614 *
8615 * The Function.prototype.inherits from lang.js rewritten as a standalone
8616 * function (not on Function.prototype). NOTE: If this file is to be loaded
8617 * during bootstrapping this function needs to be rewritten using some native
8618 * functions as prototype setup using normal JavaScript does not work as
8619 * expected during bootstrapping (see mirror.js in r114903).
8620 *
8621 * @param {function} ctor Constructor function which needs to inherit the
8622 * prototype.
8623 * @param {function} superCtor Constructor function to inherit prototype from.
8624 */exports.inherits=require('inherits');exports._extend=function(origin,add){// Don't do anything if add isn't an object
8625if(!add||!isObject(add))return origin;var keys=Object.keys(add);var i=keys.length;while(i--){origin[keys[i]]=add[keys[i]];}return origin;};function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop);}}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"./support/isBuffer":53,"_process":23,"inherits":20}],55:[function(require,module,exports){module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty;function extend(){var target={};for(var i=0;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;}},{}],56:[function(require,module,exports){(function(process){var path=require('path');var minimist=require('minimist');var wordwrap=require('wordwrap');/* Hack an instance of Argv with process.argv into Argv
8626 so people can do
8627 require('optimist')(['--beeble=1','-z','zizzle']).argv
8628 to parse a list of args and
8629 require('optimist').argv
8630 to get a parsed version of process.argv.
8631*/var inst=Argv(process.argv.slice(2));Object.keys(inst).forEach(function(key){Argv[key]=typeof inst[key]=='function'?inst[key].bind(inst):inst[key];});var exports=module.exports=Argv;function Argv(processArgs,cwd){var self={};if(!cwd)cwd=process.cwd();self.$0=process.argv.slice(0,2).map(function(x){var b=rebase(cwd,x);return x.match(/^\//)&&b.length<x.length?b:x;}).join(' ');if(process.env._!=undefined&&process.argv[1]==process.env._){self.$0=process.env._.replace(path.dirname(process.execPath)+'/','');}var options={boolean:[],string:[],alias:{},default:[]};self.boolean=function(bools){options.boolean.push.apply(options.boolean,[].concat(bools));return self;};self.string=function(strings){options.string.push.apply(options.string,[].concat(strings));return self;};self.default=function(key,value){if((typeof key==="undefined"?"undefined":_typeof(key))==='object'){Object.keys(key).forEach(function(k){self.default(k,key[k]);});}else{options.default[key]=value;}return self;};self.alias=function(x,y){if((typeof x==="undefined"?"undefined":_typeof(x))==='object'){Object.keys(x).forEach(function(key){self.alias(key,x[key]);});}else{options.alias[x]=(options.alias[x]||[]).concat(y);}return self;};var demanded={};self.demand=function(keys){if(typeof keys=='number'){if(!demanded._)demanded._=0;demanded._+=keys;}else if(Array.isArray(keys)){keys.forEach(function(key){self.demand(key);});}else{demanded[keys]=true;}return self;};var usage;self.usage=function(msg,opts){if(!opts&&(typeof msg==="undefined"?"undefined":_typeof(msg))==='object'){opts=msg;msg=null;}usage=msg;if(opts)self.options(opts);return self;};function fail(msg){self.showHelp();if(msg)console.error(msg);process.exit(1);}var checks=[];self.check=function(f){checks.push(f);return self;};var descriptions={};self.describe=function(key,desc){if((typeof key==="undefined"?"undefined":_typeof(key))==='object'){Object.keys(key).forEach(function(k){self.describe(k,key[k]);});}else{descriptions[key]=desc;}return self;};self.parse=function(args){return parseArgs(args);};self.option=self.options=function(key,opt){if((typeof key==="undefined"?"undefined":_typeof(key))==='object'){Object.keys(key).forEach(function(k){self.options(k,key[k]);});}else{if(opt.alias)self.alias(key,opt.alias);if(opt.demand)self.demand(key);if(typeof opt.default!=='undefined'){self.default(key,opt.default);}if(opt.boolean||opt.type==='boolean'){self.boolean(key);}if(opt.string||opt.type==='string'){self.string(key);}var desc=opt.describe||opt.description||opt.desc;if(desc){self.describe(key,desc);}}return self;};var wrap=null;self.wrap=function(cols){wrap=cols;return self;};self.showHelp=function(fn){if(!fn)fn=console.error;fn(self.help());};self.help=function(){var keys=Object.keys(Object.keys(descriptions).concat(Object.keys(demanded)).concat(Object.keys(options.default)).reduce(function(acc,key){if(key!=='_')acc[key]=true;return acc;},{}));var help=keys.length?['Options:']:[];if(usage){help.unshift(usage.replace(/\$0/g,self.$0),'');}var switches=keys.reduce(function(acc,key){acc[key]=[key].concat(options.alias[key]||[]).map(function(sw){return(sw.length>1?'--':'-')+sw;}).join(', ');return acc;},{});var switchlen=longest(Object.keys(switches).map(function(s){return switches[s]||'';}));var desclen=longest(Object.keys(descriptions).map(function(d){return descriptions[d]||'';}));keys.forEach(function(key){var kswitch=switches[key];var desc=descriptions[key]||'';if(wrap){desc=wordwrap(switchlen+4,wrap)(desc).slice(switchlen+4);}var spadding=new Array(Math.max(switchlen-kswitch.length+3,0)).join(' ');var dpadding=new Array(Math.max(desclen-desc.length+1,0)).join(' ');var type=null;if(options.boolean[key])type='[boolean]';if(options.string[key])type='[string]';if(!wrap&&dpadding.length>0){desc+=dpadding;}var prelude=' '+kswitch+spadding;var extra=[type,demanded[key]?'[required]':null,options.default[key]!==undefined?'[default: '+JSON.stringify(options.default[key])+']':null].filter(Boolean).join(' ');var body=[desc,extra].filter(Boolean).join(' ');if(wrap){var dlines=desc.split('\n');var dlen=dlines.slice(-1)[0].length+(dlines.length===1?prelude.length:0);body=desc+(dlen+extra.length>wrap-2?'\n'+new Array(wrap-extra.length+1).join(' ')+extra:new Array(wrap-extra.length-dlen+1).join(' ')+extra);}help.push(prelude+body);});help.push('');return help.join('\n');};Object.defineProperty(self,'argv',{get:function get(){return parseArgs(processArgs);},enumerable:true});function parseArgs(args){var argv=minimist(args,options);argv.$0=self.$0;if(demanded._&&argv._.length<demanded._){fail('Not enough non-option arguments: got '+argv._.length+', need at least '+demanded._);}var missing=[];Object.keys(demanded).forEach(function(key){if(!argv[key])missing.push(key);});if(missing.length){fail('Missing required arguments: '+missing.join(', '));}checks.forEach(function(f){try{if(f(argv)===false){fail('Argument check failed: '+f.toString());}}catch(err){fail(err);}});return argv;}function longest(xs){return Math.max.apply(null,xs.map(function(x){return x.length;}));}return self;};// rebase an absolute path to a relative one with respect to a base directory
8632// exported for tests
8633exports.rebase=rebase;function rebase(base,dir){var ds=path.normalize(dir).split('/').slice(1);var bs=path.normalize(base).split('/').slice(1);for(var i=0;ds[i]&&ds[i]==bs[i];i++){}ds.splice(0,i);bs.splice(0,i);var p=path.normalize(bs.map(function(){return'..';}).concat(ds).join('/')).replace(/\/$/,'').replace(/^$/,'.');return p.match(/^[.\/]/)?p:'./'+p;};}).call(this,require('_process'));},{"_process":23,"minimist":57,"path":22,"wordwrap":58}],57:[function(require,module,exports){module.exports=function(args,opts){if(!opts)opts={};var flags={bools:{},strings:{}};[].concat(opts['boolean']).filter(Boolean).forEach(function(key){flags.bools[key]=true;});var aliases={};Object.keys(opts.alias||{}).forEach(function(key){aliases[key]=[].concat(opts.alias[key]);aliases[key].forEach(function(x){aliases[x]=[key].concat(aliases[key].filter(function(y){return x!==y;}));});});[].concat(opts.string).filter(Boolean).forEach(function(key){flags.strings[key]=true;if(aliases[key]){flags.strings[aliases[key]]=true;}});var defaults=opts['default']||{};var argv={_:[]};Object.keys(flags.bools).forEach(function(key){setArg(key,defaults[key]===undefined?false:defaults[key]);});var notFlags=[];if(args.indexOf('--')!==-1){notFlags=args.slice(args.indexOf('--')+1);args=args.slice(0,args.indexOf('--'));}function setArg(key,val){var value=!flags.strings[key]&&isNumber(val)?Number(val):val;setKey(argv,key.split('.'),value);(aliases[key]||[]).forEach(function(x){setKey(argv,x.split('.'),value);});}for(var i=0;i<args.length;i++){var arg=args[i];if(/^--.+=/.test(arg)){// Using [\s\S] instead of . because js doesn't support the
8634// 'dotall' regex modifier. See:
8635// http://stackoverflow.com/a/1068308/13216
8636var m=arg.match(/^--([^=]+)=([\s\S]*)$/);setArg(m[1],m[2]);}else if(/^--no-.+/.test(arg)){var key=arg.match(/^--no-(.+)/)[1];setArg(key,false);}else if(/^--.+/.test(arg)){var key=arg.match(/^--(.+)/)[1];var next=args[i+1];if(next!==undefined&&!/^-/.test(next)&&!flags.bools[key]&&(aliases[key]?!flags.bools[aliases[key]]:true)){setArg(key,next);i++;}else if(/^(true|false)$/.test(next)){setArg(key,next==='true');i++;}else{setArg(key,flags.strings[key]?'':true);}}else if(/^-[^-]+/.test(arg)){var letters=arg.slice(1,-1).split('');var broken=false;for(var j=0;j<letters.length;j++){var next=arg.slice(j+2);if(next==='-'){setArg(letters[j],next);continue;}if(/[A-Za-z]/.test(letters[j])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(next)){setArg(letters[j],next);broken=true;break;}if(letters[j+1]&&letters[j+1].match(/\W/)){setArg(letters[j],arg.slice(j+2));broken=true;break;}else{setArg(letters[j],flags.strings[letters[j]]?'':true);}}var key=arg.slice(-1)[0];if(!broken&&key!=='-'){if(args[i+1]&&!/^(-|--)[^-]/.test(args[i+1])&&!flags.bools[key]&&(aliases[key]?!flags.bools[aliases[key]]:true)){setArg(key,args[i+1]);i++;}else if(args[i+1]&&/true|false/.test(args[i+1])){setArg(key,args[i+1]==='true');i++;}else{setArg(key,flags.strings[key]?'':true);}}}else{argv._.push(flags.strings['_']||!isNumber(arg)?arg:Number(arg));}}Object.keys(defaults).forEach(function(key){if(!hasKey(argv,key.split('.'))){setKey(argv,key.split('.'),defaults[key]);(aliases[key]||[]).forEach(function(x){setKey(argv,x.split('.'),defaults[key]);});}});notFlags.forEach(function(key){argv._.push(key);});return argv;};function hasKey(obj,keys){var o=obj;keys.slice(0,-1).forEach(function(key){o=o[key]||{};});var key=keys[keys.length-1];return key in o;}function setKey(obj,keys,value){var o=obj;keys.slice(0,-1).forEach(function(key){if(o[key]===undefined)o[key]={};o=o[key];});var key=keys[keys.length-1];if(o[key]===undefined||typeof o[key]==='boolean'){o[key]=value;}else if(Array.isArray(o[key])){o[key].push(value);}else{o[key]=[o[key],value];}}function isNumber(x){if(typeof x==='number')return true;if(/^0x[0-9a-f]+$/i.test(x))return true;return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);}},{}],58:[function(require,module,exports){var wordwrap=module.exports=function(start,stop,params){if((typeof start==="undefined"?"undefined":_typeof(start))==='object'){params=start;start=params.start;stop=params.stop;}if((typeof stop==="undefined"?"undefined":_typeof(stop))==='object'){params=stop;start=start||params.start;stop=undefined;}if(!stop){stop=start;start=0;}if(!params)params={};var mode=params.mode||'soft';var re=mode==='hard'?/\b/:/(\S+\s+)/;return function(text){var chunks=text.toString().split(re).reduce(function(acc,x){if(mode==='hard'){for(var i=0;i<x.length;i+=stop-start){acc.push(x.slice(i,i+stop-start));}}else acc.push(x);return acc;},[]);return chunks.reduce(function(lines,rawChunk){if(rawChunk==='')return lines;var chunk=rawChunk.replace(/\t/g,' ');var i=lines.length-1;if(lines[i].length+chunk.length>stop){lines[i]=lines[i].replace(/\s+$/,'');chunk.split(/\n/).forEach(function(c){lines.push(new Array(start+1).join(' ')+c.replace(/^\s+/,''));});}else if(chunk.match(/\n/)){var xs=chunk.split(/\n/);lines[i]+=xs.shift();xs.forEach(function(c){lines.push(new Array(start+1).join(' ')+c.replace(/^\s+/,''));});}else{lines[i]+=chunk;}return lines;},[new Array(start+1).join(' ')]).join('\n');};};wordwrap.soft=wordwrap;wordwrap.hard=function(start,stop){return wordwrap(start,stop,{mode:'hard'});};},{}],59:[function(require,module,exports){(function(Buffer){;(function(sax){// wrapper for non-node envs
8637sax.parser=function(strict,opt){return new SAXParser(strict,opt);};sax.SAXParser=SAXParser;sax.SAXStream=SAXStream;sax.createStream=createStream;// When we pass the MAX_BUFFER_LENGTH position, start checking for buffer overruns.
8638// When we check, schedule the next check for MAX_BUFFER_LENGTH - (max(buffer lengths)),
8639// since that's the earliest that a buffer overrun could occur. This way, checks are
8640// as rare as required, but as often as necessary to ensure never crossing this bound.
8641// Furthermore, buffers are only tested at most once per write(), so passing a very
8642// large string into write() might have undesirable effects, but this is manageable by
8643// the caller, so it is assumed to be safe. Thus, a call to write() may, in the extreme
8644// edge case, result in creating at most one complete copy of the string passed in.
8645// Set to Infinity to have unlimited buffers.
8646sax.MAX_BUFFER_LENGTH=64*1024;var buffers=['comment','sgmlDecl','textNode','tagName','doctype','procInstName','procInstBody','entity','attribName','attribValue','cdata','script'];sax.EVENTS=['text','processinginstruction','sgmldeclaration','doctype','comment','opentagstart','attribute','opentag','closetag','opencdata','cdata','closecdata','error','end','ready','script','opennamespace','closenamespace'];function SAXParser(strict,opt){if(!(this instanceof SAXParser)){return new SAXParser(strict,opt);}var parser=this;clearBuffers(parser);parser.q=parser.c='';parser.bufferCheckPosition=sax.MAX_BUFFER_LENGTH;parser.opt=opt||{};parser.opt.lowercase=parser.opt.lowercase||parser.opt.lowercasetags;parser.looseCase=parser.opt.lowercase?'toLowerCase':'toUpperCase';parser.tags=[];parser.closed=parser.closedRoot=parser.sawRoot=false;parser.tag=parser.error=null;parser.strict=!!strict;parser.noscript=!!(strict||parser.opt.noscript);parser.state=S.BEGIN;parser.strictEntities=parser.opt.strictEntities;parser.ENTITIES=parser.strictEntities?Object.create(sax.XML_ENTITIES):Object.create(sax.ENTITIES);parser.attribList=[];// namespaces form a prototype chain.
8647// it always points at the current tag,
8648// which protos to its parent tag.
8649if(parser.opt.xmlns){parser.ns=Object.create(rootNS);}// mostly just for error reporting
8650parser.trackPosition=parser.opt.position!==false;if(parser.trackPosition){parser.position=parser.line=parser.column=0;}emit(parser,'onready');}if(!Object.create){Object.create=function(o){function F(){}F.prototype=o;var newf=new F();return newf;};}if(!Object.keys){Object.keys=function(o){var a=[];for(var i in o){if(o.hasOwnProperty(i))a.push(i);}return a;};}function checkBufferLength(parser){var maxAllowed=Math.max(sax.MAX_BUFFER_LENGTH,10);var maxActual=0;for(var i=0,l=buffers.length;i<l;i++){var len=parser[buffers[i]].length;if(len>maxAllowed){// Text/cdata nodes can get big, and since they're buffered,
8651// we can get here under normal conditions.
8652// Avoid issues by emitting the text node now,
8653// so at least it won't get any bigger.
8654switch(buffers[i]){case'textNode':closeText(parser);break;case'cdata':emitNode(parser,'oncdata',parser.cdata);parser.cdata='';break;case'script':emitNode(parser,'onscript',parser.script);parser.script='';break;default:error(parser,'Max buffer length exceeded: '+buffers[i]);}}maxActual=Math.max(maxActual,len);}// schedule the next check for the earliest possible buffer overrun.
8655var m=sax.MAX_BUFFER_LENGTH-maxActual;parser.bufferCheckPosition=m+parser.position;}function clearBuffers(parser){for(var i=0,l=buffers.length;i<l;i++){parser[buffers[i]]='';}}function flushBuffers(parser){closeText(parser);if(parser.cdata!==''){emitNode(parser,'oncdata',parser.cdata);parser.cdata='';}if(parser.script!==''){emitNode(parser,'onscript',parser.script);parser.script='';}}SAXParser.prototype={end:function end(){_end(this);},write:write,resume:function resume(){this.error=null;return this;},close:function close(){return this.write(null);},flush:function flush(){flushBuffers(this);}};var Stream;try{Stream=require('stream').Stream;}catch(ex){Stream=function Stream(){};}var streamWraps=sax.EVENTS.filter(function(ev){return ev!=='error'&&ev!=='end';});function createStream(strict,opt){return new SAXStream(strict,opt);}function SAXStream(strict,opt){if(!(this instanceof SAXStream)){return new SAXStream(strict,opt);}Stream.apply(this);this._parser=new SAXParser(strict,opt);this.writable=true;this.readable=true;var me=this;this._parser.onend=function(){me.emit('end');};this._parser.onerror=function(er){me.emit('error',er);// if didn't throw, then means error was handled.
8656// go ahead and clear error, so we can write again.
8657me._parser.error=null;};this._decoder=null;streamWraps.forEach(function(ev){Object.defineProperty(me,'on'+ev,{get:function get(){return me._parser['on'+ev];},set:function set(h){if(!h){me.removeAllListeners(ev);me._parser['on'+ev]=h;return h;}me.on(ev,h);},enumerable:true,configurable:false});});}SAXStream.prototype=Object.create(Stream.prototype,{constructor:{value:SAXStream}});SAXStream.prototype.write=function(data){if(typeof Buffer==='function'&&typeof Buffer.isBuffer==='function'&&Buffer.isBuffer(data)){if(!this._decoder){var SD=require('string_decoder').StringDecoder;this._decoder=new SD('utf8');}data=this._decoder.write(data);}this._parser.write(data.toString());this.emit('data',data);return true;};SAXStream.prototype.end=function(chunk){if(chunk&&chunk.length){this.write(chunk);}this._parser.end();return true;};SAXStream.prototype.on=function(ev,handler){var me=this;if(!me._parser['on'+ev]&&streamWraps.indexOf(ev)!==-1){me._parser['on'+ev]=function(){var args=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);args.splice(0,0,ev);me.emit.apply(me,args);};}return Stream.prototype.on.call(me,ev,handler);};// character classes and tokens
8658var whitespace='\r\n\t ';// this really needs to be replaced with character classes.
8659// XML allows all manner of ridiculous numbers and digits.
8660var number='0124356789';var letter='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';// (Letter | "_" | ":")
8661var quote='\'"';var attribEnd=whitespace+'>';var CDATA='[CDATA[';var DOCTYPE='DOCTYPE';var XML_NAMESPACE='http://www.w3.org/XML/1998/namespace';var XMLNS_NAMESPACE='http://www.w3.org/2000/xmlns/';var rootNS={xml:XML_NAMESPACE,xmlns:XMLNS_NAMESPACE};// turn all the string character sets into character class objects.
8662whitespace=charClass(whitespace);number=charClass(number);letter=charClass(letter);// http://www.w3.org/TR/REC-xml/#NT-NameStartChar
8663// This implementation works on strings, a single character at a time
8664// as such, it cannot ever support astral-plane characters (10000-EFFFF)
8665// without a significant breaking change to either this parser, or the
8666// JavaScript language. Implementation of an emoji-capable xml parser
8667// is left as an exercise for the reader.
8668var nameStart=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;var nameBody=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/;var entityStart=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;var entityBody=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/;quote=charClass(quote);attribEnd=charClass(attribEnd);function charClass(str){return str.split('').reduce(function(s,c){s[c]=true;return s;},{});}function isRegExp(c){return Object.prototype.toString.call(c)==='[object RegExp]';}function is(charclass,c){return isRegExp(charclass)?!!c.match(charclass):charclass[c];}function not(charclass,c){return!is(charclass,c);}var S=0;sax.STATE={BEGIN:S++,// leading byte order mark or whitespace
8669BEGIN_WHITESPACE:S++,// leading whitespace
8670TEXT:S++,// general stuff
8671TEXT_ENTITY:S++,// &amp and such.
8672OPEN_WAKA:S++,// <
8673SGML_DECL:S++,// <!BLARG
8674SGML_DECL_QUOTED:S++,// <!BLARG foo "bar
8675DOCTYPE:S++,// <!DOCTYPE
8676DOCTYPE_QUOTED:S++,// <!DOCTYPE "//blah
8677DOCTYPE_DTD:S++,// <!DOCTYPE "//blah" [ ...
8678DOCTYPE_DTD_QUOTED:S++,// <!DOCTYPE "//blah" [ "foo
8679COMMENT_STARTING:S++,// <!-
8680COMMENT:S++,// <!--
8681COMMENT_ENDING:S++,// <!-- blah -
8682COMMENT_ENDED:S++,// <!-- blah --
8683CDATA:S++,// <![CDATA[ something
8684CDATA_ENDING:S++,// ]
8685CDATA_ENDING_2:S++,// ]]
8686PROC_INST:S++,// <?hi
8687PROC_INST_BODY:S++,// <?hi there
8688PROC_INST_ENDING:S++,// <?hi "there" ?
8689OPEN_TAG:S++,// <strong
8690OPEN_TAG_SLASH:S++,// <strong /
8691ATTRIB:S++,// <a
8692ATTRIB_NAME:S++,// <a foo
8693ATTRIB_NAME_SAW_WHITE:S++,// <a foo _
8694ATTRIB_VALUE:S++,// <a foo=
8695ATTRIB_VALUE_QUOTED:S++,// <a foo="bar
8696ATTRIB_VALUE_CLOSED:S++,// <a foo="bar"
8697ATTRIB_VALUE_UNQUOTED:S++,// <a foo=bar
8698ATTRIB_VALUE_ENTITY_Q:S++,// <foo bar="&quot;"
8699ATTRIB_VALUE_ENTITY_U:S++,// <foo bar=&quot
8700CLOSE_TAG:S++,// </a
8701CLOSE_TAG_SAW_WHITE:S++,// </a >
8702SCRIPT:S++,// <script> ...
8703SCRIPT_ENDING:S++// <script> ... <
8704};sax.XML_ENTITIES={'amp':'&','gt':'>','lt':'<','quot':'"','apos':"'"};sax.ENTITIES={'amp':'&','gt':'>','lt':'<','quot':'"','apos':"'",'AElig':198,'Aacute':193,'Acirc':194,'Agrave':192,'Aring':197,'Atilde':195,'Auml':196,'Ccedil':199,'ETH':208,'Eacute':201,'Ecirc':202,'Egrave':200,'Euml':203,'Iacute':205,'Icirc':206,'Igrave':204,'Iuml':207,'Ntilde':209,'Oacute':211,'Ocirc':212,'Ograve':210,'Oslash':216,'Otilde':213,'Ouml':214,'THORN':222,'Uacute':218,'Ucirc':219,'Ugrave':217,'Uuml':220,'Yacute':221,'aacute':225,'acirc':226,'aelig':230,'agrave':224,'aring':229,'atilde':227,'auml':228,'ccedil':231,'eacute':233,'ecirc':234,'egrave':232,'eth':240,'euml':235,'iacute':237,'icirc':238,'igrave':236,'iuml':239,'ntilde':241,'oacute':243,'ocirc':244,'ograve':242,'oslash':248,'otilde':245,'ouml':246,'szlig':223,'thorn':254,'uacute':250,'ucirc':251,'ugrave':249,'uuml':252,'yacute':253,'yuml':255,'copy':169,'reg':174,'nbsp':160,'iexcl':161,'cent':162,'pound':163,'curren':164,'yen':165,'brvbar':166,'sect':167,'uml':168,'ordf':170,'laquo':171,'not':172,'shy':173,'macr':175,'deg':176,'plusmn':177,'sup1':185,'sup2':178,'sup3':179,'acute':180,'micro':181,'para':182,'middot':183,'cedil':184,'ordm':186,'raquo':187,'frac14':188,'frac12':189,'frac34':190,'iquest':191,'times':215,'divide':247,'OElig':338,'oelig':339,'Scaron':352,'scaron':353,'Yuml':376,'fnof':402,'circ':710,'tilde':732,'Alpha':913,'Beta':914,'Gamma':915,'Delta':916,'Epsilon':917,'Zeta':918,'Eta':919,'Theta':920,'Iota':921,'Kappa':922,'Lambda':923,'Mu':924,'Nu':925,'Xi':926,'Omicron':927,'Pi':928,'Rho':929,'Sigma':931,'Tau':932,'Upsilon':933,'Phi':934,'Chi':935,'Psi':936,'Omega':937,'alpha':945,'beta':946,'gamma':947,'delta':948,'epsilon':949,'zeta':950,'eta':951,'theta':952,'iota':953,'kappa':954,'lambda':955,'mu':956,'nu':957,'xi':958,'omicron':959,'pi':960,'rho':961,'sigmaf':962,'sigma':963,'tau':964,'upsilon':965,'phi':966,'chi':967,'psi':968,'omega':969,'thetasym':977,'upsih':978,'piv':982,'ensp':8194,'emsp':8195,'thinsp':8201,'zwnj':8204,'zwj':8205,'lrm':8206,'rlm':8207,'ndash':8211,'mdash':8212,'lsquo':8216,'rsquo':8217,'sbquo':8218,'ldquo':8220,'rdquo':8221,'bdquo':8222,'dagger':8224,'Dagger':8225,'bull':8226,'hellip':8230,'permil':8240,'prime':8242,'Prime':8243,'lsaquo':8249,'rsaquo':8250,'oline':8254,'frasl':8260,'euro':8364,'image':8465,'weierp':8472,'real':8476,'trade':8482,'alefsym':8501,'larr':8592,'uarr':8593,'rarr':8594,'darr':8595,'harr':8596,'crarr':8629,'lArr':8656,'uArr':8657,'rArr':8658,'dArr':8659,'hArr':8660,'forall':8704,'part':8706,'exist':8707,'empty':8709,'nabla':8711,'isin':8712,'notin':8713,'ni':8715,'prod':8719,'sum':8721,'minus':8722,'lowast':8727,'radic':8730,'prop':8733,'infin':8734,'ang':8736,'and':8743,'or':8744,'cap':8745,'cup':8746,'int':8747,'there4':8756,'sim':8764,'cong':8773,'asymp':8776,'ne':8800,'equiv':8801,'le':8804,'ge':8805,'sub':8834,'sup':8835,'nsub':8836,'sube':8838,'supe':8839,'oplus':8853,'otimes':8855,'perp':8869,'sdot':8901,'lceil':8968,'rceil':8969,'lfloor':8970,'rfloor':8971,'lang':9001,'rang':9002,'loz':9674,'spades':9824,'clubs':9827,'hearts':9829,'diams':9830};Object.keys(sax.ENTITIES).forEach(function(key){var e=sax.ENTITIES[key];var s=typeof e==='number'?String.fromCharCode(e):e;sax.ENTITIES[key]=s;});for(var s in sax.STATE){sax.STATE[sax.STATE[s]]=s;}// shorthand
8705S=sax.STATE;function emit(parser,event,data){parser[event]&&parser[event](data);}function emitNode(parser,nodeType,data){if(parser.textNode)closeText(parser);emit(parser,nodeType,data);}function closeText(parser){parser.textNode=textopts(parser.opt,parser.textNode);if(parser.textNode)emit(parser,'ontext',parser.textNode);parser.textNode='';}function textopts(opt,text){if(opt.trim)text=text.trim();if(opt.normalize)text=text.replace(/\s+/g,' ');return text;}function error(parser,er){closeText(parser);if(parser.trackPosition){er+='\nLine: '+parser.line+'\nColumn: '+parser.column+'\nChar: '+parser.c;}er=new Error(er);parser.error=er;emit(parser,'onerror',er);return parser;}function _end(parser){if(parser.sawRoot&&!parser.closedRoot)strictFail(parser,'Unclosed root tag');if(parser.state!==S.BEGIN&&parser.state!==S.BEGIN_WHITESPACE&&parser.state!==S.TEXT){error(parser,'Unexpected end');}closeText(parser);parser.c='';parser.closed=true;emit(parser,'onend');SAXParser.call(parser,parser.strict,parser.opt);return parser;}function strictFail(parser,message){if((typeof parser==="undefined"?"undefined":_typeof(parser))!=='object'||!(parser instanceof SAXParser)){throw new Error('bad call to strictFail');}if(parser.strict){error(parser,message);}}function newTag(parser){if(!parser.strict)parser.tagName=parser.tagName[parser.looseCase]();var parent=parser.tags[parser.tags.length-1]||parser;var tag=parser.tag={name:parser.tagName,attributes:{}};// will be overridden if tag contails an xmlns="foo" or xmlns:foo="bar"
8706if(parser.opt.xmlns){tag.ns=parent.ns;}parser.attribList.length=0;emitNode(parser,'onopentagstart',tag);}function qname(name,attribute){var i=name.indexOf(':');var qualName=i<0?['',name]:name.split(':');var prefix=qualName[0];var local=qualName[1];// <x "xmlns"="http://foo">
8707if(attribute&&name==='xmlns'){prefix='xmlns';local='';}return{prefix:prefix,local:local};}function attrib(parser){if(!parser.strict){parser.attribName=parser.attribName[parser.looseCase]();}if(parser.attribList.indexOf(parser.attribName)!==-1||parser.tag.attributes.hasOwnProperty(parser.attribName)){parser.attribName=parser.attribValue='';return;}if(parser.opt.xmlns){var qn=qname(parser.attribName,true);var prefix=qn.prefix;var local=qn.local;if(prefix==='xmlns'){// namespace binding attribute. push the binding into scope
8708if(local==='xml'&&parser.attribValue!==XML_NAMESPACE){strictFail(parser,'xml: prefix must be bound to '+XML_NAMESPACE+'\n'+'Actual: '+parser.attribValue);}else if(local==='xmlns'&&parser.attribValue!==XMLNS_NAMESPACE){strictFail(parser,'xmlns: prefix must be bound to '+XMLNS_NAMESPACE+'\n'+'Actual: '+parser.attribValue);}else{var tag=parser.tag;var parent=parser.tags[parser.tags.length-1]||parser;if(tag.ns===parent.ns){tag.ns=Object.create(parent.ns);}tag.ns[local]=parser.attribValue;}}// defer onattribute events until all attributes have been seen
8709// so any new bindings can take effect. preserve attribute order
8710// so deferred events can be emitted in document order
8711parser.attribList.push([parser.attribName,parser.attribValue]);}else{// in non-xmlns mode, we can emit the event right away
8712parser.tag.attributes[parser.attribName]=parser.attribValue;emitNode(parser,'onattribute',{name:parser.attribName,value:parser.attribValue});}parser.attribName=parser.attribValue='';}function openTag(parser,selfClosing){if(parser.opt.xmlns){// emit namespace binding events
8713var tag=parser.tag;// add namespace info to tag
8714var qn=qname(parser.tagName);tag.prefix=qn.prefix;tag.local=qn.local;tag.uri=tag.ns[qn.prefix]||'';if(tag.prefix&&!tag.uri){strictFail(parser,'Unbound namespace prefix: '+JSON.stringify(parser.tagName));tag.uri=qn.prefix;}var parent=parser.tags[parser.tags.length-1]||parser;if(tag.ns&&parent.ns!==tag.ns){Object.keys(tag.ns).forEach(function(p){emitNode(parser,'onopennamespace',{prefix:p,uri:tag.ns[p]});});}// handle deferred onattribute events
8715// Note: do not apply default ns to attributes:
8716// http://www.w3.org/TR/REC-xml-names/#defaulting
8717for(var i=0,l=parser.attribList.length;i<l;i++){var nv=parser.attribList[i];var name=nv[0];var value=nv[1];var qualName=qname(name,true);var prefix=qualName.prefix;var local=qualName.local;var uri=prefix===''?'':tag.ns[prefix]||'';var a={name:name,value:value,prefix:prefix,local:local,uri:uri};// if there's any attributes with an undefined namespace,
8718// then fail on them now.
8719if(prefix&&prefix!=='xmlns'&&!uri){strictFail(parser,'Unbound namespace prefix: '+JSON.stringify(prefix));a.uri=prefix;}parser.tag.attributes[name]=a;emitNode(parser,'onattribute',a);}parser.attribList.length=0;}parser.tag.isSelfClosing=!!selfClosing;// process the tag
8720parser.sawRoot=true;parser.tags.push(parser.tag);emitNode(parser,'onopentag',parser.tag);if(!selfClosing){// special case for <script> in non-strict mode.
8721if(!parser.noscript&&parser.tagName.toLowerCase()==='script'){parser.state=S.SCRIPT;}else{parser.state=S.TEXT;}parser.tag=null;parser.tagName='';}parser.attribName=parser.attribValue='';parser.attribList.length=0;}function closeTag(parser){if(!parser.tagName){strictFail(parser,'Weird empty close tag.');parser.textNode+='</>';parser.state=S.TEXT;return;}if(parser.script){if(parser.tagName!=='script'){parser.script+='</'+parser.tagName+'>';parser.tagName='';parser.state=S.SCRIPT;return;}emitNode(parser,'onscript',parser.script);parser.script='';}// first make sure that the closing tag actually exists.
8722// <a><b></c></b></a> will close everything, otherwise.
8723var t=parser.tags.length;var tagName=parser.tagName;if(!parser.strict){tagName=tagName[parser.looseCase]();}var closeTo=tagName;while(t--){var close=parser.tags[t];if(close.name!==closeTo){// fail the first time in strict mode
8724strictFail(parser,'Unexpected close tag');}else{break;}}// didn't find it. we already failed for strict, so just abort.
8725if(t<0){strictFail(parser,'Unmatched closing tag: '+parser.tagName);parser.textNode+='</'+parser.tagName+'>';parser.state=S.TEXT;return;}parser.tagName=tagName;var s=parser.tags.length;while(s-->t){var tag=parser.tag=parser.tags.pop();parser.tagName=parser.tag.name;emitNode(parser,'onclosetag',parser.tagName);var x={};for(var i in tag.ns){x[i]=tag.ns[i];}var parent=parser.tags[parser.tags.length-1]||parser;if(parser.opt.xmlns&&tag.ns!==parent.ns){// remove namespace bindings introduced by tag
8726Object.keys(tag.ns).forEach(function(p){var n=tag.ns[p];emitNode(parser,'onclosenamespace',{prefix:p,uri:n});});}}if(t===0)parser.closedRoot=true;parser.tagName=parser.attribValue=parser.attribName='';parser.attribList.length=0;parser.state=S.TEXT;}function parseEntity(parser){var entity=parser.entity;var entityLC=entity.toLowerCase();var num;var numStr='';if(parser.ENTITIES[entity]){return parser.ENTITIES[entity];}if(parser.ENTITIES[entityLC]){return parser.ENTITIES[entityLC];}entity=entityLC;if(entity.charAt(0)==='#'){if(entity.charAt(1)==='x'){entity=entity.slice(2);num=parseInt(entity,16);numStr=num.toString(16);}else{entity=entity.slice(1);num=parseInt(entity,10);numStr=num.toString(10);}}entity=entity.replace(/^0+/,'');if(numStr.toLowerCase()!==entity){strictFail(parser,'Invalid character entity');return'&'+parser.entity+';';}return String.fromCodePoint(num);}function beginWhiteSpace(parser,c){if(c==='<'){parser.state=S.OPEN_WAKA;parser.startTagPosition=parser.position;}else if(not(whitespace,c)){// have to process this as a text node.
8727// weird, but happens.
8728strictFail(parser,'Non-whitespace before first tag.');parser.textNode=c;parser.state=S.TEXT;}}function charAt(chunk,i){var result='';if(i<chunk.length){result=chunk.charAt(i);}return result;}function write(chunk){var parser=this;if(this.error){throw this.error;}if(parser.closed){return error(parser,'Cannot write after close. Assign an onready handler.');}if(chunk===null){return _end(parser);}if((typeof chunk==="undefined"?"undefined":_typeof(chunk))==='object'){chunk=chunk.toString();}var i=0;var c='';while(true){c=charAt(chunk,i++);parser.c=c;if(!c){break;}if(parser.trackPosition){parser.position++;if(c==='\n'){parser.line++;parser.column=0;}else{parser.column++;}}switch(parser.state){case S.BEGIN:parser.state=S.BEGIN_WHITESPACE;if(c===""){continue;}beginWhiteSpace(parser,c);continue;case S.BEGIN_WHITESPACE:beginWhiteSpace(parser,c);continue;case S.TEXT:if(parser.sawRoot&&!parser.closedRoot){var starti=i-1;while(c&&c!=='<'&&c!=='&'){c=charAt(chunk,i++);if(c&&parser.trackPosition){parser.position++;if(c==='\n'){parser.line++;parser.column=0;}else{parser.column++;}}}parser.textNode+=chunk.substring(starti,i-1);}if(c==='<'&&!(parser.sawRoot&&parser.closedRoot&&!parser.strict)){parser.state=S.OPEN_WAKA;parser.startTagPosition=parser.position;}else{if(not(whitespace,c)&&(!parser.sawRoot||parser.closedRoot)){strictFail(parser,'Text data outside of root node.');}if(c==='&'){parser.state=S.TEXT_ENTITY;}else{parser.textNode+=c;}}continue;case S.SCRIPT:// only non-strict
8729if(c==='<'){parser.state=S.SCRIPT_ENDING;}else{parser.script+=c;}continue;case S.SCRIPT_ENDING:if(c==='/'){parser.state=S.CLOSE_TAG;}else{parser.script+='<'+c;parser.state=S.SCRIPT;}continue;case S.OPEN_WAKA:// either a /, ?, !, or text is coming next.
8730if(c==='!'){parser.state=S.SGML_DECL;parser.sgmlDecl='';}else if(is(whitespace,c)){// wait for it...
8731}else if(is(nameStart,c)){parser.state=S.OPEN_TAG;parser.tagName=c;}else if(c==='/'){parser.state=S.CLOSE_TAG;parser.tagName='';}else if(c==='?'){parser.state=S.PROC_INST;parser.procInstName=parser.procInstBody='';}else{strictFail(parser,'Unencoded <');// if there was some whitespace, then add that in.
8732if(parser.startTagPosition+1<parser.position){var pad=parser.position-parser.startTagPosition;c=new Array(pad).join(' ')+c;}parser.textNode+='<'+c;parser.state=S.TEXT;}continue;case S.SGML_DECL:if((parser.sgmlDecl+c).toUpperCase()===CDATA){emitNode(parser,'onopencdata');parser.state=S.CDATA;parser.sgmlDecl='';parser.cdata='';}else if(parser.sgmlDecl+c==='--'){parser.state=S.COMMENT;parser.comment='';parser.sgmlDecl='';}else if((parser.sgmlDecl+c).toUpperCase()===DOCTYPE){parser.state=S.DOCTYPE;if(parser.doctype||parser.sawRoot){strictFail(parser,'Inappropriately located doctype declaration');}parser.doctype='';parser.sgmlDecl='';}else if(c==='>'){emitNode(parser,'onsgmldeclaration',parser.sgmlDecl);parser.sgmlDecl='';parser.state=S.TEXT;}else if(is(quote,c)){parser.state=S.SGML_DECL_QUOTED;parser.sgmlDecl+=c;}else{parser.sgmlDecl+=c;}continue;case S.SGML_DECL_QUOTED:if(c===parser.q){parser.state=S.SGML_DECL;parser.q='';}parser.sgmlDecl+=c;continue;case S.DOCTYPE:if(c==='>'){parser.state=S.TEXT;emitNode(parser,'ondoctype',parser.doctype);parser.doctype=true;// just remember that we saw it.
8733}else{parser.doctype+=c;if(c==='['){parser.state=S.DOCTYPE_DTD;}else if(is(quote,c)){parser.state=S.DOCTYPE_QUOTED;parser.q=c;}}continue;case S.DOCTYPE_QUOTED:parser.doctype+=c;if(c===parser.q){parser.q='';parser.state=S.DOCTYPE;}continue;case S.DOCTYPE_DTD:parser.doctype+=c;if(c===']'){parser.state=S.DOCTYPE;}else if(is(quote,c)){parser.state=S.DOCTYPE_DTD_QUOTED;parser.q=c;}continue;case S.DOCTYPE_DTD_QUOTED:parser.doctype+=c;if(c===parser.q){parser.state=S.DOCTYPE_DTD;parser.q='';}continue;case S.COMMENT:if(c==='-'){parser.state=S.COMMENT_ENDING;}else{parser.comment+=c;}continue;case S.COMMENT_ENDING:if(c==='-'){parser.state=S.COMMENT_ENDED;parser.comment=textopts(parser.opt,parser.comment);if(parser.comment){emitNode(parser,'oncomment',parser.comment);}parser.comment='';}else{parser.comment+='-'+c;parser.state=S.COMMENT;}continue;case S.COMMENT_ENDED:if(c!=='>'){strictFail(parser,'Malformed comment');// allow <!-- blah -- bloo --> in non-strict mode,
8734// which is a comment of " blah -- bloo "
8735parser.comment+='--'+c;parser.state=S.COMMENT;}else{parser.state=S.TEXT;}continue;case S.CDATA:if(c===']'){parser.state=S.CDATA_ENDING;}else{parser.cdata+=c;}continue;case S.CDATA_ENDING:if(c===']'){parser.state=S.CDATA_ENDING_2;}else{parser.cdata+=']'+c;parser.state=S.CDATA;}continue;case S.CDATA_ENDING_2:if(c==='>'){if(parser.cdata){emitNode(parser,'oncdata',parser.cdata);}emitNode(parser,'onclosecdata');parser.cdata='';parser.state=S.TEXT;}else if(c===']'){parser.cdata+=']';}else{parser.cdata+=']]'+c;parser.state=S.CDATA;}continue;case S.PROC_INST:if(c==='?'){parser.state=S.PROC_INST_ENDING;}else if(is(whitespace,c)){parser.state=S.PROC_INST_BODY;}else{parser.procInstName+=c;}continue;case S.PROC_INST_BODY:if(!parser.procInstBody&&is(whitespace,c)){continue;}else if(c==='?'){parser.state=S.PROC_INST_ENDING;}else{parser.procInstBody+=c;}continue;case S.PROC_INST_ENDING:if(c==='>'){emitNode(parser,'onprocessinginstruction',{name:parser.procInstName,body:parser.procInstBody});parser.procInstName=parser.procInstBody='';parser.state=S.TEXT;}else{parser.procInstBody+='?'+c;parser.state=S.PROC_INST_BODY;}continue;case S.OPEN_TAG:if(is(nameBody,c)){parser.tagName+=c;}else{newTag(parser);if(c==='>'){openTag(parser);}else if(c==='/'){parser.state=S.OPEN_TAG_SLASH;}else{if(not(whitespace,c)){strictFail(parser,'Invalid character in tag name');}parser.state=S.ATTRIB;}}continue;case S.OPEN_TAG_SLASH:if(c==='>'){openTag(parser,true);closeTag(parser);}else{strictFail(parser,'Forward-slash in opening tag not followed by >');parser.state=S.ATTRIB;}continue;case S.ATTRIB:// haven't read the attribute name yet.
8736if(is(whitespace,c)){continue;}else if(c==='>'){openTag(parser);}else if(c==='/'){parser.state=S.OPEN_TAG_SLASH;}else if(is(nameStart,c)){parser.attribName=c;parser.attribValue='';parser.state=S.ATTRIB_NAME;}else{strictFail(parser,'Invalid attribute name');}continue;case S.ATTRIB_NAME:if(c==='='){parser.state=S.ATTRIB_VALUE;}else if(c==='>'){strictFail(parser,'Attribute without value');parser.attribValue=parser.attribName;attrib(parser);openTag(parser);}else if(is(whitespace,c)){parser.state=S.ATTRIB_NAME_SAW_WHITE;}else if(is(nameBody,c)){parser.attribName+=c;}else{strictFail(parser,'Invalid attribute name');}continue;case S.ATTRIB_NAME_SAW_WHITE:if(c==='='){parser.state=S.ATTRIB_VALUE;}else if(is(whitespace,c)){continue;}else{strictFail(parser,'Attribute without value');parser.tag.attributes[parser.attribName]='';parser.attribValue='';emitNode(parser,'onattribute',{name:parser.attribName,value:''});parser.attribName='';if(c==='>'){openTag(parser);}else if(is(nameStart,c)){parser.attribName=c;parser.state=S.ATTRIB_NAME;}else{strictFail(parser,'Invalid attribute name');parser.state=S.ATTRIB;}}continue;case S.ATTRIB_VALUE:if(is(whitespace,c)){continue;}else if(is(quote,c)){parser.q=c;parser.state=S.ATTRIB_VALUE_QUOTED;}else{strictFail(parser,'Unquoted attribute value');parser.state=S.ATTRIB_VALUE_UNQUOTED;parser.attribValue=c;}continue;case S.ATTRIB_VALUE_QUOTED:if(c!==parser.q){if(c==='&'){parser.state=S.ATTRIB_VALUE_ENTITY_Q;}else{parser.attribValue+=c;}continue;}attrib(parser);parser.q='';parser.state=S.ATTRIB_VALUE_CLOSED;continue;case S.ATTRIB_VALUE_CLOSED:if(is(whitespace,c)){parser.state=S.ATTRIB;}else if(c==='>'){openTag(parser);}else if(c==='/'){parser.state=S.OPEN_TAG_SLASH;}else if(is(nameStart,c)){strictFail(parser,'No whitespace between attributes');parser.attribName=c;parser.attribValue='';parser.state=S.ATTRIB_NAME;}else{strictFail(parser,'Invalid attribute name');}continue;case S.ATTRIB_VALUE_UNQUOTED:if(not(attribEnd,c)){if(c==='&'){parser.state=S.ATTRIB_VALUE_ENTITY_U;}else{parser.attribValue+=c;}continue;}attrib(parser);if(c==='>'){openTag(parser);}else{parser.state=S.ATTRIB;}continue;case S.CLOSE_TAG:if(!parser.tagName){if(is(whitespace,c)){continue;}else if(not(nameStart,c)){if(parser.script){parser.script+='</'+c;parser.state=S.SCRIPT;}else{strictFail(parser,'Invalid tagname in closing tag.');}}else{parser.tagName=c;}}else if(c==='>'){closeTag(parser);}else if(is(nameBody,c)){parser.tagName+=c;}else if(parser.script){parser.script+='</'+parser.tagName;parser.tagName='';parser.state=S.SCRIPT;}else{if(not(whitespace,c)){strictFail(parser,'Invalid tagname in closing tag');}parser.state=S.CLOSE_TAG_SAW_WHITE;}continue;case S.CLOSE_TAG_SAW_WHITE:if(is(whitespace,c)){continue;}if(c==='>'){closeTag(parser);}else{strictFail(parser,'Invalid characters in closing tag');}continue;case S.TEXT_ENTITY:case S.ATTRIB_VALUE_ENTITY_Q:case S.ATTRIB_VALUE_ENTITY_U:var returnState;var buffer;switch(parser.state){case S.TEXT_ENTITY:returnState=S.TEXT;buffer='textNode';break;case S.ATTRIB_VALUE_ENTITY_Q:returnState=S.ATTRIB_VALUE_QUOTED;buffer='attribValue';break;case S.ATTRIB_VALUE_ENTITY_U:returnState=S.ATTRIB_VALUE_UNQUOTED;buffer='attribValue';break;}if(c===';'){parser[buffer]+=parseEntity(parser);parser.entity='';parser.state=returnState;}else if(is(parser.entity.length?entityBody:entityStart,c)){parser.entity+=c;}else{strictFail(parser,'Invalid character in entity name');parser[buffer]+='&'+parser.entity+c;parser.entity='';parser.state=returnState;}continue;default:throw new Error(parser,'Unknown state: '+parser.state);}}// while
8737if(parser.position>=parser.bufferCheckPosition){checkBufferLength(parser);}return parser;}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */if(!String.fromCodePoint){(function(){var stringFromCharCode=String.fromCharCode;var floor=Math.floor;var fromCodePoint=function fromCodePoint(){var MAX_SIZE=0x4000;var codeUnits=[];var highSurrogate;var lowSurrogate;var index=-1;var length=arguments.length;if(!length){return'';}var result='';while(++index<length){var codePoint=Number(arguments[index]);if(!isFinite(codePoint)||// `NaN`, `+Infinity`, or `-Infinity`
8738codePoint<0||// not a valid Unicode code point
8739codePoint>0x10FFFF||// not a valid Unicode code point
8740floor(codePoint)!==codePoint// not an integer
8741){throw RangeError('Invalid code point: '+codePoint);}if(codePoint<=0xFFFF){// BMP code point
8742codeUnits.push(codePoint);}else{// Astral code point; split in surrogate halves
8743// http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
8744codePoint-=0x10000;highSurrogate=(codePoint>>10)+0xD800;lowSurrogate=codePoint%0x400+0xDC00;codeUnits.push(highSurrogate,lowSurrogate);}if(index+1===length||codeUnits.length>MAX_SIZE){result+=stringFromCharCode.apply(null,codeUnits);codeUnits.length=0;}}return result;};if(Object.defineProperty){Object.defineProperty(String,'fromCodePoint',{value:fromCodePoint,configurable:true,writable:true});}else{String.fromCodePoint=fromCodePoint;}})();}})(typeof exports==='undefined'?this.sax={}:exports);}).call(this,require("buffer").Buffer);},{"buffer":15,"stream":43,"string_decoder":50}],60:[function(require,module,exports){// Copyright 2011-2012 Jacob Beard, INFICON, and other SCION contributors
8745//
8746// Licensed under the Apache License, Version 2.0 (the "License");
8747// you may not use this file except in compliance with the License.
8748// You may obtain a copy of the License at
8749//
8750// http://www.apache.org/licenses/LICENSE-2.0
8751//
8752// Unless required by applicable law or agreed to in writing, software
8753// distributed under the License is distributed on an "AS IS" BASIS,
8754// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8755// See the License for the specific language governing permissions and
8756// limitations under the License.
8757var extend=Object.assign||function(to,from){Object.keys(from).forEach(function(k){to[k]=from[k];});return to;};var STATE_TYPES={BASIC:0,COMPOSITE:1,PARALLEL:2,HISTORY:3,INITIAL:4,FINAL:5};var ioProcessorTypes={'scxml':{location:'http://www.w3.org/TR/scxml/#SCXMLEventProcessor'},'basichttp':{location:'http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor'},'dom':{location:'http://www.w3.org/TR/scxml/#DOMEventProcessor'},'publish':{location:'https://github.com/jbeard4/SCION#publish'}};function transitionWithTargets(t){return t.targets;}function stateExitComparator(s1,s2){return s2.depth-s1.depth;}function stateEntryComparator(s1,s2){return s1.depth-s2.depth;}function transitionComparator(t1,t2){return t1.documentOrder-t2.documentOrder;}function initializeModel(rootState){var transitions=[],idToStateMap=new Map(),documentOrder=0;//TODO: need to add fake ids to anyone that doesn't have them
8758//FIXME: make this safer - break into multiple passes
8759var idCount={};function generateId(type){if(idCount[type]===undefined)idCount[type]=0;var count=idCount[type]++;return'$generated-'+type+'-'+count;}function wrapInFakeRootState(state){return{$deserializeDatamodel:state.$deserializeDatamodel||function(){},$serializeDatamodel:state.$serializeDatamodel||function(){return null;},$idToStateMap:idToStateMap,//keep this for handy deserialization of serialized configuration
8760states:[{$type:'initial',transitions:[{target:state}]},state]};}var statesWithInitialAttributes=[];function traverse(ancestors,state){//add to global transition and state id caches
8761if(state.transitions)transitions.push.apply(transitions,state.transitions);//populate state id map
8762if(state.id){if(idToStateMap.has(state.id))throw new Error('Redefinition of state id '+state.id);idToStateMap.set(state.id,state);}//create a default type, just to normalize things
8763//this way we can check for unsupported types below
8764state.$type=state.$type||'state';//add ancestors and depth properties
8765state.ancestors=ancestors;state.depth=ancestors.length;state.parent=ancestors[0];//add some information to transitions
8766state.transitions=state.transitions||[];for(var j=0,len=state.transitions.length;j<len;j++){var transition=state.transitions[j];transition.documentOrder=documentOrder++;transition.source=state;};//recursive step
8767if(state.states){var ancs=[state].concat(ancestors);for(var j=0,len=state.states.length;j<len;j++){traverse(ancs,state.states[j]);}}//setup fast state type
8768switch(state.$type){case'parallel':state.typeEnum=STATE_TYPES.PARALLEL;break;case'initial':state.typeEnum=STATE_TYPES.INITIAL;break;case'history':state.typeEnum=STATE_TYPES.HISTORY;break;case'final':state.typeEnum=STATE_TYPES.FINAL;break;case'state':case'scxml':if(state.states&&state.states.length){state.typeEnum=STATE_TYPES.COMPOSITE;}else{state.typeEnum=STATE_TYPES.BASIC;}break;default:throw new Error('Unknown state type: '+state.$type);}//descendants property on states will now be populated. add descendants to this state
8769if(state.states){state.descendants=state.states.concat(state.states.map(function(s){return s.descendants;}).reduce(function(a,b){return a.concat(b);},[]));}else{state.descendants=[];}var initialChildren;if(state.typeEnum===STATE_TYPES.COMPOSITE){//set up initial state
8770if(typeof state.initial==='string'){statesWithInitialAttributes.push(state);}else{//take the first child that has initial type, or first child
8771initialChildren=state.states.filter(function(child){return child.$type==='initial';});state.initialRef=initialChildren.length?initialChildren[0]:state.states[0];checkInitialRef(state);}}//hook up history
8772if(state.typeEnum===STATE_TYPES.COMPOSITE||state.typeEnum===STATE_TYPES.PARALLEL){var historyChildren=state.states.filter(function(s){return s.$type==='history';});state.historyRef=historyChildren[0];}//now it's safe to fill in fake state ids
8773if(!state.id){state.id=generateId(state.$type);idToStateMap.set(state.id,state);}//normalize onEntry/onExit, which can be single fn or array
8774if(state.onEntry&&!Array.isArray(state.onEntry)){state.onEntry=[state.onEntry];}if(state.onExit&&!Array.isArray(state.onExit)){state.onExit=[state.onExit];}}//TODO: convert events to regular expressions in advance
8775function checkInitialRef(state){if(!state.initialRef)throw new Error('Unable to locate initial state for composite state: '+state.id);}function connectIntialAttributes(){for(var j=0,len=statesWithInitialAttributes.length;j<len;j++){var s=statesWithInitialAttributes[j];s.initialRef=idToStateMap.get(s.initial);checkInitialRef(s);}}var RX_WHITESPACE=/\s+/;function connectTransitionGraph(){//normalize as with onEntry/onExit
8776for(var i=0,len=transitions.length;i<len;i++){var t=transitions[i];if(t.onTransition&&!Array.isArray(t.onTransition)){t.onTransition=[t.onTransition];}//normalize "event" attribute into "events" attribute
8777if(typeof t.event==='string'){t.events=t.event.trim().split(RX_WHITESPACE);}delete t.event;if(t.targets||typeof t.target==='undefined'){//targets have already been set up
8778continue;}if(typeof t.target==='string'){var target=idToStateMap.get(t.target);if(!target)throw new Error('Unable to find target state with id '+t.target);t.target=target;t.targets=[t.target];}else if(Array.isArray(t.target)){t.targets=t.target.map(function(target){if(typeof target==='string'){target=idToStateMap.get(target);if(!target)throw new Error('Unable to find target state with id '+t.target);return target;}else{return target;}});}else if(_typeof(t.target)==='object'){t.targets=[t.target];}else{throw new Error('Transition target has unknown type: '+t.target);}}//hook up LCA - optimization
8779for(var i=0,len=transitions.length;i<len;i++){var t=transitions[i];if(t.targets)t.lcca=getLCCA(t.source,t.targets[0]);//FIXME: we technically do not need to hang onto the lcca. only the scope is used by the algorithm
8780t.scope=getScope(t);//console.log('scope',t.source.id,t.scope.id,t.targets);
8781}}function getScope(transition){//Transition scope is normally the least common compound ancestor (lcca).
8782//Internal transitions have a scope equal to the source state.
8783var transitionIsReallyInternal=transition.type==='internal'&&transition.source.parent&&//root state won't have parent
8784transition.targets&&//does it target its descendants
8785transition.targets.every(function(target){return transition.source.descendants.indexOf(target)>-1;});if(!transition.targets){return transition.source;}else if(transitionIsReallyInternal){return transition.source;}else{return transition.lcca;}}function getLCCA(s1,s2){//console.log('getLCCA',s1, s2);
8786var commonAncestors=[];for(var j=0,len=s1.ancestors.length;j<len;j++){var anc=s1.ancestors[j];//console.log('s1.id',s1.id,'anc',anc.id,'anc.typeEnum',anc.typeEnum,'s2.id',s2.id);
8787if(anc.typeEnum===STATE_TYPES.COMPOSITE&&anc.descendants.indexOf(s2)>-1){commonAncestors.push(anc);}};//console.log('commonAncestors',s1.id,s2.id,commonAncestors.map(function(s){return s.id;}));
8788if(!commonAncestors.length)throw new Error("Could not find LCA for states.");return commonAncestors[0];}//main execution starts here
8789//FIXME: only wrap in root state if it's not a compound state
8790var fakeRootState=wrapInFakeRootState(rootState);//I wish we had pointer semantics and could make this a C-style "out argument". Instead we return him
8791traverse([],fakeRootState);connectTransitionGraph();connectIntialAttributes();return fakeRootState;}/* begin tiny-events: https://github.com/ZauberNerd/tiny-events */function EventEmitter(){this._listeners={};this._listeners['*']=[];}EventEmitter.prototype.on=function _on(type,listener){if(!Array.isArray(this._listeners[type])){this._listeners[type]=[];}if(this._listeners[type].indexOf(listener)===-1){this._listeners[type].push(listener);}return this;};EventEmitter.prototype.once=function _once(type,listener){var self=this;function __once(){for(var args=[],i=0;i<arguments.length;i+=1){args[i]=arguments[i];}self.off(type,__once);listener.apply(self,args);}__once.listener=listener;return this.on(type,__once);};EventEmitter.prototype.off=function _off(type,listener){if(!Array.isArray(this._listeners[type])){return this;}if(typeof listener==='undefined'){this._listeners[type]=[];return this;}var index=this._listeners[type].indexOf(listener);if(index===-1){for(var i=0;i<this._listeners[type].length;i+=1){if(this._listeners[type][i].listener===listener){index=i;break;}}}this._listeners[type].splice(index,1);return this;};EventEmitter.prototype.emit=function _emit(type){var args=Array.prototype.slice.call(arguments);var modifiedArgs=args.slice(1);var listeners=this._listeners[type];var j,len;if(Array.isArray(listeners)){for(j=0,len=listeners.length;j<len;j++){listeners[j].apply(this,modifiedArgs);}}//special '*' event
8792listeners=this._listeners['*'];for(j=0,len=listeners.length;j<len;j++){listeners[j].apply(this,args);}return this;};/* end tiny-events *//* begin ArraySet *//** @constructor */function ArraySet(l){l=l||[];this.o=new Set(l);}ArraySet.prototype={add:function add(x){this.o.add(x);},remove:function remove(x){return this.o["delete"](x);},union:function union(l){var _iteratorNormalCompletion=true;var _didIteratorError=false;var _iteratorError=undefined;try{for(var _iterator=l.o[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var v=_step.value;this.o.add(v);}}catch(err){_didIteratorError=true;_iteratorError=err;}finally{try{if(!_iteratorNormalCompletion&&_iterator["return"]){_iterator["return"]();}}finally{if(_didIteratorError){throw _iteratorError;}}}return this;},difference:function difference(l){var _iteratorNormalCompletion2=true;var _didIteratorError2=false;var _iteratorError2=undefined;try{for(var _iterator2=l.o[Symbol.iterator](),_step2;!(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done);_iteratorNormalCompletion2=true){var v=_step2.value;this.o["delete"](v);}}catch(err){_didIteratorError2=true;_iteratorError2=err;}finally{try{if(!_iteratorNormalCompletion2&&_iterator2["return"]){_iterator2["return"]();}}finally{if(_didIteratorError2){throw _iteratorError2;}}}return this;},contains:function contains(x){return this.o.has(x);},iter:function iter(){return Array.from(this.o);},isEmpty:function isEmpty(){return!this.o.size;},size:function size(){return this.o.size;},equals:function equals(s2){if(this.o.size!==s2.size()){return false;}var _iteratorNormalCompletion3=true;var _didIteratorError3=false;var _iteratorError3=undefined;try{for(var _iterator3=this.o[Symbol.iterator](),_step3;!(_iteratorNormalCompletion3=(_step3=_iterator3.next()).done);_iteratorNormalCompletion3=true){var v=_step3.value;if(!s2.contains(v)){return false;}}}catch(err){_didIteratorError3=true;_iteratorError3=err;}finally{try{if(!_iteratorNormalCompletion3&&_iterator3["return"]){_iterator3["return"]();}}finally{if(_didIteratorError3){throw _iteratorError3;}}}return true;},toString:function toString(){return"Set("+Array.from(this.o).toString()+")";}};var scxmlPrefixTransitionSelector=function(){var eventNameReCache={};function eventNameToRe(name){return new RegExp("^"+name.replace(/\./g,"\\.")+"(\\.[0-9a-zA-Z]+)*$");}function retrieveEventRe(name){return eventNameReCache[name]?eventNameReCache[name]:eventNameReCache[name]=eventNameToRe(name);}function nameMatch(t,event){return event&&event.name&&(t.events.indexOf("*")>-1?true:t.events.filter(function(tEvent){return retrieveEventRe(tEvent).test(event.name);}).length);}return function(state,event,evaluator){return state.transitions.filter(function(t){return(!t.events||nameMatch(t,event))&&(!t.cond||evaluator(t.cond));});};}();//model accessor functions
8793var query={getAncestors:function getAncestors(s,root){var ancestors,index,state;index=s.ancestors.indexOf(root);if(index>-1){return s.ancestors.slice(0,index);}else{return s.ancestors;}},/** @this {model} */getAncestorsOrSelf:function getAncestorsOrSelf(s,root){return[s].concat(this.getAncestors(s,root));},getDescendantsOrSelf:function getDescendantsOrSelf(s){return[s].concat(s.descendants);},/** @this {model} */isOrthogonalTo:function isOrthogonalTo(s1,s2){//Two control states are orthogonal if they are not ancestrally
8794//related, and their smallest, mutual parent is a Concurrent-state.
8795return!this.isAncestrallyRelatedTo(s1,s2)&&this.getLCA(s1,s2).typeEnum===STATE_TYPES.PARALLEL;},/** @this {model} */isAncestrallyRelatedTo:function isAncestrallyRelatedTo(s1,s2){//Two control states are ancestrally related if one is child/grandchild of another.
8796return this.getAncestorsOrSelf(s2).indexOf(s1)>-1||this.getAncestorsOrSelf(s1).indexOf(s2)>-1;},/** @this {model} */getLCA:function getLCA(s1,s2){var commonAncestors=this.getAncestors(s1).filter(function(a){return a.descendants.indexOf(s2)>-1;},this);return commonAncestors[0];}};//priority comparison functions
8797function getTransitionWithHigherSourceChildPriority(_arg){var t1=_arg[0],t2=_arg[1];//compare transitions based first on depth, then based on document order
8798if(t1.source.depth<t2.source.depth){return t2;}else if(t2.source.depth<t1.source.depth){return t1;}else{if(t1.documentOrder<t2.documentOrder){return t1;}else{return t2;}}}function initializeModelGeneratorFn(modelFn,opts,interpreter){opts.x=opts.x||{};return modelFn.call(interpreter,opts.x,opts.sessionid,opts.ioprocessors,interpreter.isIn.bind(interpreter));}function deserializeSerializedConfiguration(serializedConfiguration,idToStateMap){return serializedConfiguration.map(function(id){var state=idToStateMap.get(id);if(!state)throw new Error('Error loading serialized configuration. Unable to locate state with id '+id);return state;});}function deserializeHistory(serializedHistory,idToStateMap){var o={};Object.keys(serializedHistory).forEach(function(sid){o[sid]=serializedHistory[sid].map(function(id){var state=idToStateMap.get(id);if(!state)throw new Error('Error loading serialized history. Unable to locate state with id '+id);return state;});});return o;}/** @const */var printTrace=false;/** @constructor */function BaseInterpreter(modelOrFnGenerator,opts){EventEmitter.call(this);this._scriptingContext=opts.interpreterScriptingContext||(opts.InterpreterScriptingContext?new opts.InterpreterScriptingContext(this):{});var model;if(typeof modelOrFnGenerator==='function'){model=initializeModelGeneratorFn(modelOrFnGenerator,opts,this);}else if(typeof modelOrFnGenerator==='string'){model=JSON.parse(modelOrFnGenerator);}else{model=modelOrFnGenerator;}this._model=initializeModel(model);//console.log(require('util').inspect(this._model,false,4));
8799this.opts=opts||{};this.opts.console=opts.console||(typeof console==='undefined'?{log:function log(){}}:console);//rely on global console if this console is undefined
8800this.opts.Set=this.opts.Set||ArraySet;this.opts.priorityComparisonFn=this.opts.priorityComparisonFn||getTransitionWithHigherSourceChildPriority;this.opts.transitionSelector=this.opts.transitionSelector||scxmlPrefixTransitionSelector;this._scriptingContext.log=this._scriptingContext.log||function log(){if(this.opts.console.log.apply){this.opts.console.log.apply(this.opts.console,arguments);}else{//console.log on older IE does not support Function.apply, so just pass him the first argument. Best we can do for now.
8801this.opts.console.log(Array.prototype.slice.apply(arguments).join(','));}}.bind(this);//set up default scripting context log function
8802this._internalEventQueue=[];//check if we're loading from a previous snapshot
8803if(opts.snapshot){this._configuration=new this.opts.Set(deserializeSerializedConfiguration(opts.snapshot[0],this._model.$idToStateMap));this._historyValue=deserializeHistory(opts.snapshot[1],this._model.$idToStateMap);this._isInFinalState=opts.snapshot[2];this._model.$deserializeDatamodel(opts.snapshot[3]);//load up the datamodel
8804}else{this._configuration=new this.opts.Set();this._historyValue={};this._isInFinalState=false;}//SCXML system variables:
8805this._x={_sessionId:opts.sessionId||null,_name:model.name||opts.name||null,_ioprocessors:opts.ioprocessors||null};}BaseInterpreter.prototype=extend(beget(EventEmitter.prototype),{/** @expose */start:function start(){//perform big step without events to take all default transitions and reach stable initial state
8806if(printTrace)this.opts.console.log("performing initial big step");//We effectively need to figure out states to enter here to populate initial config. assuming root is compound state makes this simple.
8807//but if we want it to be parallel, then this becomes more complex. so when initializing the model, we add a 'fake' root state, which
8808//makes the following operation safe.
8809this._configuration.add(this._model.initialRef);this._performBigStep();return this.getConfiguration();},/**
8810 * Starts the interpreter asynchronously
8811 * @param {Function} cb Callback invoked with an error or the interpreter's stable configuration
8812 * @expose
8813 */startAsync:function startAsync(cb){if(typeof cb!=='function'){cb=nop;}if(printTrace)this.opts.console.log("performing initial big step");this._configuration.add(this._model.initialRef);this._performBigStepAsync(null,cb);},/** @expose */getConfiguration:function getConfiguration(){return this._configuration.iter().map(function(s){return s.id;});},/** @expose */getFullConfiguration:function getFullConfiguration(){return this._configuration.iter().map(function(s){return[s].concat(query.getAncestors(s));},this).reduce(function(a,b){return a.concat(b);},[]).//flatten
8814map(function(s){return s.id;}).reduce(function(a,b){return a.indexOf(b)>-1?a:a.concat(b);},[]);//uniq
8815},/** @expose */isIn:function isIn(stateName){return this.getFullConfiguration().indexOf(stateName)>-1;},/** @expose */isFinal:function isFinal(stateName){return this._isInFinalState;},/** @private */_performBigStep:function _performBigStep(e){this.emit('onBigStepBegin');if(e)this._internalEventQueue.push(e);var keepGoing=true;while(keepGoing){var currentEvent=this._internalEventQueue.shift()||null;this.emit('onSmallStepBegin',currentEvent);var selectedTransitions=this._performSmallStep(currentEvent);keepGoing=!selectedTransitions.isEmpty();}this._isInFinalState=this._configuration.iter().every(function(s){return s.typeEnum===STATE_TYPES.FINAL;});this.emit('onBigStepEnd');},_performBigStepAsync:function _performBigStepAsync(event,cb){if(event){this._internalEventQueue.push(event);}var self=this;function doBigStep(eventToEmit){var selectedTransitions;try{self.emit(eventToEmit);var currentEvent=self._internalEventQueue.shift()||null;self.emit('onSmallStepBegin',currentEvent);selectedTransitions=self._performSmallStep(currentEvent);self.emit('onSmallStepEnd',currentEvent);}catch(err){cb(err);return;}if(!selectedTransitions.isEmpty()){// keep going, but be nice (yield) to the process
8816// TODO: for compat with non-node, non-mozilla
8817// allow the context to provide the defer task function
8818self.emit('onBigStepSuspend');setImmediate(doBigStep,'onBigStepResume');}else{self._isInFinalState=self._configuration.iter().every(function(s){return s.typeEnum===STATE_TYPES.FINAL;});self.emit('onBigStepEnd');cb(undefined,self.getConfiguration());}}doBigStep('onBigStepBegin');},/** @private */_performSmallStep:function _performSmallStep(currentEvent){if(printTrace)this.opts.console.log("selecting transitions with currentEvent: ",currentEvent);var selectedTransitions=this._selectTransitions(currentEvent);if(printTrace)this.opts.console.log("selected transitions: ",selectedTransitions);if(!selectedTransitions.isEmpty()){if(printTrace)this.opts.console.log("sorted transitions: ",selectedTransitions);//we only want to enter and exit states from transitions with targets
8819//filter out targetless transitions here - we will only use these to execute transition actions
8820var selectedTransitionsWithTargets=new this.opts.Set(selectedTransitions.iter().filter(transitionWithTargets));var exitedTuple=this._getStatesExited(selectedTransitionsWithTargets),basicStatesExited=exitedTuple[0],statesExited=exitedTuple[1];var enteredTuple=this._getStatesEntered(selectedTransitionsWithTargets),basicStatesEntered=enteredTuple[0],statesEntered=enteredTuple[1];if(printTrace)this.opts.console.log("basicStatesExited ",basicStatesExited);if(printTrace)this.opts.console.log("basicStatesEntered ",basicStatesEntered);if(printTrace)this.opts.console.log("statesExited ",statesExited);if(printTrace)this.opts.console.log("statesEntered ",statesEntered);var eventsToAddToInnerQueue=new this.opts.Set();//update history states
8821if(printTrace)this.opts.console.log("executing state exit actions");for(var j=0,len=statesExited.length;j<len;j++){var stateExited=statesExited[j];if(printTrace||this.opts.logStatesEnteredAndExited)this.opts.console.log("exiting ",stateExited.id);//invoke listeners
8822this.emit('onExit',stateExited.id);if(stateExited.onExit!==undefined){for(var exitIdx=0,exitLen=stateExited.onExit.length;exitIdx<exitLen;exitIdx++){this._evaluateAction(currentEvent,stateExited.onExit[exitIdx]);}}var f;if(stateExited.historyRef){if(stateExited.historyRef.isDeep){f=function f(s0){return s0.typeEnum===STATE_TYPES.BASIC&&stateExited.descendants.indexOf(s0)>-1;};}else{f=function f(s0){return s0.parent===stateExited;};}//update history
8823this._historyValue[stateExited.historyRef.id]=statesExited.filter(f);}}// -> Concurrency: Number of transitions: Multiple
8824// -> Concurrency: Order of transitions: Explicitly defined
8825var sortedTransitions=selectedTransitions.iter().sort(transitionComparator);if(printTrace)this.opts.console.log("executing transitition actions");for(var stxIdx=0,len=sortedTransitions.length;stxIdx<len;stxIdx++){var transition=sortedTransitions[stxIdx];var targetIds=transition.targets&&transition.targets.map(function(target){return target.id;});this.emit('onTransition',transition.source.id,targetIds);if(transition.onTransition!==undefined){for(var txIdx=0,txLen=transition.onTransition.length;txIdx<txLen;txIdx++){this._evaluateAction(currentEvent,transition.onTransition[txIdx]);}}}if(printTrace)this.opts.console.log("executing state enter actions");for(var enterIdx=0,enterLen=statesEntered.length;enterIdx<enterLen;enterIdx++){var stateEntered=statesEntered[enterIdx];if(printTrace||this.opts.logStatesEnteredAndExited)this.opts.console.log("entering",stateEntered.id);this.emit('onEntry',stateEntered.id);if(stateEntered.onEntry!==undefined){for(var entryIdx=0,entryLen=stateEntered.onEntry.length;entryIdx<entryLen;entryIdx++){this._evaluateAction(currentEvent,stateEntered.onEntry[entryIdx]);}}}if(printTrace)this.opts.console.log("updating configuration ");if(printTrace)this.opts.console.log("old configuration ",this._configuration);//update configuration by removing basic states exited, and adding basic states entered
8826this._configuration.difference(basicStatesExited);this._configuration.union(basicStatesEntered);if(printTrace)this.opts.console.log("new configuration ",this._configuration);//add set of generated events to the innerEventQueue -> Event Lifelines: Next small-step
8827if(!eventsToAddToInnerQueue.isEmpty()){if(printTrace)this.opts.console.log("adding triggered events to inner queue ",eventsToAddToInnerQueue);this._internalEventQueue.push(eventsToAddToInnerQueue);}}//if selectedTransitions is empty, we have reached a stable state, and the big-step will stop, otherwise will continue -> Maximality: Take-Many
8828return selectedTransitions;},/** @private */_evaluateAction:function _evaluateAction(currentEvent,actionRef){try{return actionRef.call(this._scriptingContext,currentEvent);//SCXML system variables
8829}catch(e){var err={tagname:actionRef.tagname,line:actionRef.line,column:actionRef.column,reason:e.message};this._internalEventQueue.push({"name":"error.execution",data:err});this.emit('onError',err);}},/** @private */_getStatesExited:function _getStatesExited(transitions){var statesExited=new this.opts.Set();var basicStatesExited=new this.opts.Set();//States exited are defined to be active states that are
8830//descendants of the scope of each priority-enabled transition.
8831//Here, we iterate through the transitions, and collect states
8832//that match this condition.
8833var transitionList=transitions.iter();for(var txIdx=0,txLen=transitionList.length;txIdx<txLen;txIdx++){var transition=transitionList[txIdx];var scope=transition.scope,desc=scope.descendants;//For each state in the configuration
8834//is that state a descendant of the transition scope?
8835//Store ancestors of that state up to but not including the scope.
8836var configList=this._configuration.iter();for(var cfgIdx=0,cfgLen=configList.length;cfgIdx<cfgLen;cfgIdx++){var state=configList[cfgIdx];if(desc.indexOf(state)>-1){basicStatesExited.add(state);statesExited.add(state);var ancestors=query.getAncestors(state,scope);for(var ancIdx=0,ancLen=ancestors.length;ancIdx<ancLen;ancIdx++){statesExited.add(ancestors[ancIdx]);}}}}var sortedStatesExited=statesExited.iter().sort(stateExitComparator);return[basicStatesExited,sortedStatesExited];},/** @private */_getStatesEntered:function _getStatesEntered(transitions){var o={statesToEnter:new this.opts.Set(),basicStatesToEnter:new this.opts.Set(),statesProcessed:new this.opts.Set(),statesToProcess:[]};//do the initial setup
8837var transitionList=transitions.iter();for(var txIdx=0,txLen=transitionList.length;txIdx<txLen;txIdx++){var transition=transitionList[txIdx];for(var targetIdx=0,targetLen=transition.targets.length;targetIdx<targetLen;targetIdx++){this._addStateAndAncestors(transition.targets[targetIdx],transition.scope,o);}}//loop and add states until there are no more to add (we reach a stable state)
8838var s;/*jsl:ignore*/while(s=o.statesToProcess.pop()){/*jsl:end*/this._addStateAndDescendants(s,o);}//sort based on depth
8839var sortedStatesEntered=o.statesToEnter.iter().sort(stateEntryComparator);return[o.basicStatesToEnter,sortedStatesEntered];},/** @private */_addStateAndAncestors:function _addStateAndAncestors(target,scope,o){//process each target
8840this._addStateAndDescendants(target,o);//and process ancestors of targets up to the scope, but according to special rules
8841var ancestors=query.getAncestors(target,scope);for(var ancIdx=0,ancLen=ancestors.length;ancIdx<ancLen;ancIdx++){var s=ancestors[ancIdx];if(s.typeEnum===STATE_TYPES.COMPOSITE){//just add him to statesToEnter, and declare him processed
8842//this is to prevent adding his initial state later on
8843o.statesToEnter.add(s);o.statesProcessed.add(s);}else{//everything else can just be passed through as normal
8844this._addStateAndDescendants(s,o);}}},/** @private */_addStateAndDescendants:function _addStateAndDescendants(s,o){if(o.statesProcessed.contains(s))return;if(s.typeEnum===STATE_TYPES.HISTORY){if(s.id in this._historyValue){this._historyValue[s.id].forEach(function(stateFromHistory){this._addStateAndAncestors(stateFromHistory,s.parent,o);},this);}else{o.statesToEnter.add(s);o.basicStatesToEnter.add(s);}}else{o.statesToEnter.add(s);if(s.typeEnum===STATE_TYPES.PARALLEL){o.statesToProcess.push.apply(o.statesToProcess,s.states.filter(function(s){return s.typeEnum!==STATE_TYPES.HISTORY;}));}else if(s.typeEnum===STATE_TYPES.COMPOSITE){o.statesToProcess.push(s.initialRef);}else if(s.typeEnum===STATE_TYPES.INITIAL||s.typeEnum===STATE_TYPES.BASIC||s.typeEnum===STATE_TYPES.FINAL){o.basicStatesToEnter.add(s);}}o.statesProcessed.add(s);},/** @private */_selectTransitions:function _selectTransitions(currentEvent){if(this.opts.onlySelectFromBasicStates){var states=this._configuration.iter();}else{var statesAndParents=new this.opts.Set();//get full configuration, unordered
8845//this means we may select transitions from parents before states
8846var configList=this._configuration.iter();for(var idx=0,len=configList.length;idx<len;idx++){var basicState=configList[idx];statesAndParents.add(basicState);var ancestors=query.getAncestors(basicState);for(var ancIdx=0,ancLen=ancestors.length;ancIdx<ancLen;ancIdx++){statesAndParents.add(ancestors[ancIdx]);}}states=statesAndParents.iter();}var usePrefixMatchingAlgorithm=currentEvent&&currentEvent.name&&currentEvent.name.search(".");var transitionSelector=usePrefixMatchingAlgorithm?scxmlPrefixTransitionSelector:this.opts.transitionSelector;var enabledTransitions=new this.opts.Set();var e=this._evaluateAction.bind(this,currentEvent);for(var stateIdx=0,stateLen=states.length;stateIdx<stateLen;stateIdx++){var transitions=transitionSelector(states[stateIdx],currentEvent,e);for(var txIdx=0,len=transitions.length;txIdx<len;txIdx++){enabledTransitions.add(transitions[txIdx]);}}var priorityEnabledTransitions=this._selectPriorityEnabledTransitions(enabledTransitions);if(printTrace)this.opts.console.log("priorityEnabledTransitions",priorityEnabledTransitions);return priorityEnabledTransitions;},/** @private */_selectPriorityEnabledTransitions:function _selectPriorityEnabledTransitions(enabledTransitions){var priorityEnabledTransitions=new this.opts.Set();var tuple=this._getInconsistentTransitions(enabledTransitions),consistentTransitions=tuple[0],inconsistentTransitionsPairs=tuple[1];priorityEnabledTransitions.union(consistentTransitions);if(printTrace)this.opts.console.log("enabledTransitions",enabledTransitions);if(printTrace)this.opts.console.log("consistentTransitions",consistentTransitions);if(printTrace)this.opts.console.log("inconsistentTransitionsPairs",inconsistentTransitionsPairs);if(printTrace)this.opts.console.log("priorityEnabledTransitions",priorityEnabledTransitions);while(!inconsistentTransitionsPairs.isEmpty()){enabledTransitions=new this.opts.Set(inconsistentTransitionsPairs.iter().map(function(t){return this.opts.priorityComparisonFn(t);},this));tuple=this._getInconsistentTransitions(enabledTransitions);consistentTransitions=tuple[0];inconsistentTransitionsPairs=tuple[1];priorityEnabledTransitions.union(consistentTransitions);if(printTrace)this.opts.console.log("enabledTransitions",enabledTransitions);if(printTrace)this.opts.console.log("consistentTransitions",consistentTransitions);if(printTrace)this.opts.console.log("inconsistentTransitionsPairs",inconsistentTransitionsPairs);if(printTrace)this.opts.console.log("priorityEnabledTransitions",priorityEnabledTransitions);}return priorityEnabledTransitions;},/** @private */_getInconsistentTransitions:function _getInconsistentTransitions(transitions){var allInconsistentTransitions=new this.opts.Set();var inconsistentTransitionsPairs=new this.opts.Set();var transitionList=transitions.iter();if(printTrace)this.opts.console.log("transitions",transitionList);for(var i=0;i<transitionList.length;i++){for(var j=i+1;j<transitionList.length;j++){var t1=transitionList[i];var t2=transitionList[j];if(this._conflicts(t1,t2)){allInconsistentTransitions.add(t1);allInconsistentTransitions.add(t2);inconsistentTransitionsPairs.add([t1,t2]);}}}var consistentTransitions=transitions.difference(allInconsistentTransitions);return[consistentTransitions,inconsistentTransitionsPairs];},/** @private */_conflicts:function _conflicts(t1,t2){return!this._isArenaOrthogonal(t1,t2);},/** @private */_isArenaOrthogonal:function _isArenaOrthogonal(t1,t2){if(printTrace)this.opts.console.log("transition scopes",t1.scope,t2.scope);var isOrthogonal=query.isOrthogonalTo(t1.scope,t2.scope);if(printTrace)this.opts.console.log("transition scopes are orthogonal?",isOrthogonal);return isOrthogonal;},/*
8847 registerListener provides a generic mechanism to subscribe to state change and runtime error notifications.
8848 Can be used for logging and debugging. For example, can attach a logger that simply logs the state changes.
8849 Or can attach a network debugging client that sends state change notifications to a debugging server.
8850
8851 listener is of the form:
8852 {
8853 onEntry : function(stateId){},
8854 onExit : function(stateId){},
8855 onTransition : function(sourceStateId,targetStatesIds[]){},
8856 onError: function(errorInfo){},
8857 onBigStepBegin: function(){},
8858 onBigStepResume: function(){},
8859 onBigStepSuspend: function(){},
8860 onBigStepEnd: function(){}
8861 onSmallStepBegin: function(event){},
8862 onSmallStepEnd: function(){}
8863 }
8864 *///TODO: refactor this to be event emitter?
8865/** @expose */registerListener:function registerListener(listener){if(listener.onEntry)this.on('onEntry',listener.onEntry);if(listener.onExit)this.on('onExit',listener.onExit);if(listener.onTransition)this.on('onTransition',listener.onTransition);if(listener.onError)this.on('onError',listener.onError);if(listener.onBigStepBegin)this.on('onBigStepBegin',listener.onBigStepBegin);if(listener.onBigStepSuspend)this.on('onBigStepSuspend',listener.onBigStepSuspend);if(listener.onBigStepResume)this.on('onBigStepResume',listener.onBigStepResume);if(listener.onSmallStepBegin)this.on('onSmallStepBegin',listener.onSmallStepBegin);if(listener.onSmallStepEnd)this.on('onSmallStepEnd',listener.onSmallStepEnd);if(listener.onBigStepEnd)this.on('onBigStepEnd',listener.onBigStepEnd);},/** @expose */unregisterListener:function unregisterListener(listener){if(listener.onEntry)this.off('onEntry',listener.onEntry);if(listener.onExit)this.off('onExit',listener.onExit);if(listener.onTransition)this.off('onTransition',listener.onTransition);if(listener.onError)this.off('onError',listener.onError);if(listener.onBigStepBegin)this.off('onBigStepBegin',listener.onBigStepBegin);if(listener.onBigStepSuspend)this.off('onBigStepSuspend',listener.onBigStepSuspend);if(listener.onBigStepResume)this.off('onBigStepResume',listener.onBigStepResume);if(listener.onSmallStepBegin)this.off('onSmallStepBegin',listener.onSmallStepBegin);if(listener.onSmallStepEnd)this.off('onSmallStepEnd',listener.onSmallStepEnd);if(listener.onBigStepEnd)this.off('onBigStepEnd',listener.onBigStepEnd);},/** @expose */getAllTransitionEvents:function getAllTransitionEvents(){var events={};function getEvents(state){if(state.transitions){for(var txIdx=0,txLen=state.transitions.length;txIdx<txLen;txIdx++){events[state.transitions[txIdx].event]=true;}}if(state.states){for(var stateIdx=0,stateLen=state.states.length;stateIdx<stateLen;stateIdx++){getEvents(state.states[stateIdx]);}}}getEvents(this._model);return Object.keys(events);},/** @expose *//**
8866 Three things capture the current snapshot of a running SCION interpreter:
8867
8868 * basic configuration (the set of basic states the state machine is in)
8869 * history state values (the states the state machine was in last time it was in the parent of a history state)
8870 * the datamodel
8871
8872 Note that this assumes that the method to serialize a scion.SCXML
8873 instance is not called when the interpreter is executing a big-step (e.g. after
8874 scion.SCXML.prototype.gen is called, and before the call to gen returns). If
8875 the serialization method is called during the execution of a big-step, then the
8876 inner event queue must also be saved. I do not expect this to be a common
8877 requirement however, and therefore I believe it would be better to only support
8878 serialization when the interpreter is not executing a big-step.
8879 */getSnapshot:function getSnapshot(){if(this._isStepping)throw new Error('getSnapshot cannot be called while interpreter is executing a big-step');return[this.getConfiguration(),this._serializeHistory(),this._isInFinalState,this._model.$serializeDatamodel()];},_serializeHistory:function _serializeHistory(){var o={};Object.keys(this._historyValue).forEach(function(sid){o[sid]=this._historyValue[sid].map(function(state){return state.id;});},this);return o;}});/**
8880 * @constructor
8881 * @extends BaseInterpreter
8882 */function Statechart(model,opts){opts=opts||{};opts.ioprocessors={};//Create all supported Event I/O processor nodes.
8883//TODO fix location after implementing actual processors
8884for(var processorType in ioProcessorTypes){opts.ioprocessors[processorType]=ioProcessorTypes[processorType];}opts.InterpreterScriptingContext=opts.InterpreterScriptingContext||InterpreterScriptingContext;this._isStepping=false;BaseInterpreter.call(this,model,opts);//call super constructor
8885}function beget(o){function F(){}F.prototype=o;return new F();}/**
8886 * Do nothing
8887 */function nop(){}//Statechart.prototype = Object.create(BaseInterpreter.prototype);
8888//would like to use Object.create here, but not portable, but it's too complicated to use portably
8889Statechart.prototype=beget(BaseInterpreter.prototype);/** @expose */Statechart.prototype.gen=function(evtObjOrName,optionalData){var currentEvent;switch(typeof evtObjOrName==="undefined"?"undefined":_typeof(evtObjOrName)){case'string':currentEvent={name:evtObjOrName,data:optionalData};break;case'object':if(typeof evtObjOrName.name==='string'){currentEvent=evtObjOrName;}else{throw new Error('Event object must have "name" property of type string.');}break;default:throw new Error('First argument to gen must be a string or object.');}if(this._isStepping)throw new Error('Cannot call gen during a big-step');//otherwise, kick him off
8890this._isStepping=true;this._performBigStep(currentEvent);this._isStepping=false;return this.getConfiguration();};/**
8891 * Injects an external event into the interpreter asynchronously
8892 * @param {object} currentEvent The event to inject
8893 * @param {string} currentEvent.name The name of the event
8894 * @param {string} [currentEvent.data] The event data
8895 * @param {Function} cb Callback invoked with an error or the interpreter's stable configuration
8896 * @expose
8897 */Statechart.prototype.genAsync=function(currentEvent,cb){if((typeof currentEvent==="undefined"?"undefined":_typeof(currentEvent))!=='object'||!currentEvent||typeof currentEvent.name!=='string'){throw new Error('expected currentEvent to be an Object with a name');}if(this._isStepping){throw new Error('Cannot call gen during a big-step');}if(typeof cb!=='function'){cb=nop;}this._isStepping=true;var self=this;this._performBigStepAsync(currentEvent,function(err,config){self._isStepping=false;cb(err,config);});};function InterpreterScriptingContext(interpreter){this._interpreter=interpreter;this._timeoutMap={};}//Regex from:
8898// http://daringfireball.net/2010/07/improved_regex_for_matching_urls
8899// http://stackoverflow.com/a/6927878
8900var validateUriRegex=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/i;//TODO: consider whether this is the API we would like to expose
8901InterpreterScriptingContext.prototype={raise:function raise(event){this._interpreter._internalEventQueue.push(event);},send:function send(event,options){//TODO: move these out
8902function validateSend(event,options,sendAction){if(event.target){var targetIsValidUri=validateUriRegex.test(event.target);if(!targetIsValidUri){return this.raise({name:"error.execution",data:'Target is not valid URI',sendid:options.sendid});}}var eventProcessorTypes=Object.keys(ioProcessorTypes).map(function(k){return ioProcessorTypes[k].location;});if(eventProcessorTypes.indexOf(event.type)===-1){return this.raise({name:"error.execution",data:'Unsupported event processor type',sendid:options.sendid});}sendAction.call(this,event,options);}function defaultSendAction(event,options){if(typeof setTimeout==='undefined')throw new Error('Default implementation of Statechart.prototype.send will not work unless setTimeout is defined globally.');var timeoutId=setTimeout(this._interpreter.gen.bind(this._interpreter,event),options.delay||0);if(options.sendid)this._timeoutMap[options.sendid]=timeoutId;}function publish(){this._interpreter.emit(event.name,event.data);}event.type=event.type||ioProcessorTypes.scxml.location;//choose send function
8903var sendFn;if(event.type==='https://github.com/jbeard4/SCION#publish'){sendFn=publish;}else if(this._interpreter.opts.customSend){sendFn=this._interpreter.opts.customSend;}else{sendFn=defaultSendAction;}options=options||{};if(printTrace)this._interpreter.opts.console.log("sending event",event.name,"with content",event.data,"after delay",options.delay);validateSend.call(this,event,options,sendFn);},cancel:function cancel(sendid){if(this._interpreter.opts.customCancel){return this._interpreter.opts.customCancel.apply(this,[sendid]);}if(typeof clearTimeout==='undefined')throw new Error('Default implementation of Statechart.prototype.cancel will not work unless setTimeout is defined globally.');if(sendid in this._timeoutMap){if(printTrace)this._interpreter.opts.console.log("cancelling ",sendid," with timeout id ",this._timeoutMap[sendid]);clearTimeout(this._timeoutMap[sendid]);}}};module.exports={/** @expose */BaseInterpreter:BaseInterpreter,/** @expose */Statechart:Statechart,/** @expose */ArraySet:ArraySet,/** @expose */STATE_TYPES:STATE_TYPES,/** @expose */initializeModel:initializeModel,/** @expose */InterpreterScriptingContext:InterpreterScriptingContext,/** @expose */ioProcessorTypes:ioProcessorTypes};},{}],61:[function(require,module,exports){(function(){var JS_ILLEGAL_IDENTIFIER_CHARS,JS_KEYWORDS,WRAPPER_PREFIX,WRAPPER_REGEX,WRAPPER_SUFFIX,char_wrapper,to_js_identifier,wrapper;JS_KEYWORDS=["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","implements","import","in","instanceof","interface","let","new","null","package","private","protected","public","return","static","switch","super","this","throw","true","try","typeof","undefined","var","void","while","with","yield"];JS_ILLEGAL_IDENTIFIER_CHARS={"~":"tilde","`":"backtick","!":"exclamationmark","@":"at","#":"pound","%":"percent","^":"carat","&":"amperstand","*":"asterisk","(":"leftparen",")":"rightparen","-":"dash","+":"plus","=":"equals","{":"leftcurly","}":"rightcurly","[":"leftsquare","]":"rightsquare","|":"pipe","\\":"backslash","\"":"doublequote","'":"singlequote",":":"colon",";":"semicolon","<":"leftangle",">":"rightangle",",":"comma",".":"period","?":"questionmark","/":"forwardslash"," ":"space","\t":"tab","\n":"newline","\r":"carriagereturn"};WRAPPER_PREFIX="_$";WRAPPER_SUFFIX="_";WRAPPER_REGEX=/_\$[^_]+_/g;wrapper=function wrapper(text){return""+WRAPPER_PREFIX+text+WRAPPER_SUFFIX;};char_wrapper=function char_wrapper(char){var txt,_ref;txt=(_ref=JS_ILLEGAL_IDENTIFIER_CHARS[char])!=null?_ref:"ASCII_"+char.charCodeAt(0);return wrapper(txt);};to_js_identifier=function to_js_identifier(text){if(JS_KEYWORDS.indexOf(text)>=0)return wrapper(text);if(text.length===0)return wrapper("null");return text.replace(WRAPPER_REGEX,wrapper).replace(/^\d/,char_wrapper).replace(/[^\w\$]/g,char_wrapper);};if((typeof module!=="undefined"&&module!==null?module.exports:void 0)!=null){module.exports=to_js_identifier;}else if(typeof ender!=="undefined"&&ender!==null){ender.ender({to_js_identifier:to_js_identifier});}else{this.to_js_identifier=to_js_identifier;}}).call(this);},{}],62:[function(require,module,exports){var indexOf=require('indexof');var Object_keys=function Object_keys(obj){if(Object.keys)return Object.keys(obj);else{var res=[];for(var key in obj){res.push(key);}return res;}};var forEach=function forEach(xs,fn){if(xs.forEach)return xs.forEach(fn);else for(var i=0;i<xs.length;i++){fn(xs[i],i,xs);}};var defineProp=function(){try{Object.defineProperty({},'_',{});return function(obj,name,value){Object.defineProperty(obj,name,{writable:true,enumerable:false,configurable:true,value:value});};}catch(e){return function(obj,name,value){obj[name]=value;};}}();var globals=['Array','Boolean','Date','Error','EvalError','Function','JSON','Math','NaN','Number','Object','RangeError','ReferenceError','RegExp','String','SyntaxError','TypeError','URIError','decodeURI','decodeURIComponent','encodeURI','encodeURIComponent','escape','eval','isFinite','isNaN','parseFloat','parseInt','undefined','unescape'];function Context(){var iframe=document.createElement('iframe');if(!iframe.style)iframe.style={};iframe.style.display='none';document.body.appendChild(iframe);Object.defineProperty(this,"_iframe",{enumerable:false,writable:true});this._iframe=iframe;}Context.prototype={};var Script=exports.Script=function NodeScript(code){if(!(this instanceof Script))return new Script(code);this.code=code;};Script.prototype.runInContext=function(context){if(!(context instanceof Context)){throw new TypeError("needs a 'context' argument.");}var win=context._iframe.contentWindow;var wEval=win.eval,wExecScript=win.execScript;if(!wEval&&wExecScript){// win.eval() magically appears when this is called in IE:
8904wExecScript.call(win,'null');wEval=win.eval;}forEach(Object_keys(context),function(key){win[key]=context[key];});forEach(globals,function(key){if(context[key]){win[key]=context[key];}});var winKeys=Object_keys(win);var res=wEval.call(win,this.code);forEach(Object_keys(win),function(key){// Avoid copying circular objects like `top` and `window` by only
8905// updating existing context properties or new properties in the `win`
8906// that was only introduced after the eval.
8907if(key in context||indexOf(winKeys,key)===-1){context[key]=win[key];}});forEach(globals,function(key){if(!(key in context)){defineProp(context,key,win[key]);}});return res;};Script.prototype.runInThisContext=function(){return eval(this.code);// maybe...
8908};Script.prototype.runInNewContext=function(context){var ctx=Script.createContext(context);var res=this.runInContext(ctx);forEach(Object_keys(ctx),function(key){context[key]=ctx[key];});return res;};forEach(Object_keys(Script.prototype),function(name){exports[name]=Script[name]=function(code){var s=Script(code);return s[name].apply(s,[].slice.call(arguments,1));};});exports.createScript=function(code){return exports.Script(code);};exports.createContext=Script.createContext=function(context){var copy=new Context();if((typeof context==="undefined"?"undefined":_typeof(context))==='object'){forEach(Object_keys(context),function(key){copy[key]=context[key];copy._iframe.contentWindow[key]=context[key];});}return copy;};exports.isContext=function(sandbox){return sandbox instanceof Context;};},{"indexof":63}],63:[function(require,module,exports){var indexOf=[].indexOf;module.exports=function(arr,obj){if(indexOf)return arr.indexOf(obj);for(var i=0;i<arr.length;++i){if(arr[i]===obj)return i;}return-1;};},{}]},{},[7])(7);});});
8909//# sourceMappingURL=scxml.js.map