UNPKG

711 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
11if (global._babelPolyfill) {
12 throw new Error("only one instance of babel-polyfill is allowed");
13}
14global._babelPolyfill = true;
15
16var DEFINE_PROPERTY = "defineProperty";
17function define(O, key, value) {
18 O[key] || Object[DEFINE_PROPERTY](O, key, {
19 writable: true,
20 configurable: true,
21 value: value
22 });
23}
24
25define(String.prototype, "padLeft", "".padStart);
26define(String.prototype, "padRight", "".padEnd);
27
28"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) {
29 [][key] && define(Array, key, Function.call.bind([][key]));
30});
31}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
32},{"2":2,"295":295,"296":296}],2:[function(_dereq_,module,exports){
33_dereq_(119);
34module.exports = _dereq_(23).RegExp.escape;
35},{"119":119,"23":23}],3:[function(_dereq_,module,exports){
36module.exports = function(it){
37 if(typeof it != 'function')throw TypeError(it + ' is not a function!');
38 return it;
39};
40},{}],4:[function(_dereq_,module,exports){
41var cof = _dereq_(18);
42module.exports = function(it, msg){
43 if(typeof it != 'number' && cof(it) != 'Number')throw TypeError(msg);
44 return +it;
45};
46},{"18":18}],5:[function(_dereq_,module,exports){
47// 22.1.3.31 Array.prototype[@@unscopables]
48var UNSCOPABLES = _dereq_(117)('unscopables')
49 , ArrayProto = Array.prototype;
50if(ArrayProto[UNSCOPABLES] == undefined)_dereq_(40)(ArrayProto, UNSCOPABLES, {});
51module.exports = function(key){
52 ArrayProto[UNSCOPABLES][key] = true;
53};
54},{"117":117,"40":40}],6:[function(_dereq_,module,exports){
55module.exports = function(it, Constructor, name, forbiddenField){
56 if(!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)){
57 throw TypeError(name + ': incorrect invocation!');
58 } return it;
59};
60},{}],7:[function(_dereq_,module,exports){
61var isObject = _dereq_(49);
62module.exports = function(it){
63 if(!isObject(it))throw TypeError(it + ' is not an object!');
64 return it;
65};
66},{"49":49}],8:[function(_dereq_,module,exports){
67// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
68'use strict';
69var toObject = _dereq_(109)
70 , toIndex = _dereq_(105)
71 , toLength = _dereq_(108);
72
73module.exports = [].copyWithin || function copyWithin(target/*= 0*/, start/*= 0, end = @length*/){
74 var O = toObject(this)
75 , len = toLength(O.length)
76 , to = toIndex(target, len)
77 , from = toIndex(start, len)
78 , end = arguments.length > 2 ? arguments[2] : undefined
79 , count = Math.min((end === undefined ? len : toIndex(end, len)) - from, len - to)
80 , inc = 1;
81 if(from < to && to < from + count){
82 inc = -1;
83 from += count - 1;
84 to += count - 1;
85 }
86 while(count-- > 0){
87 if(from in O)O[to] = O[from];
88 else delete O[to];
89 to += inc;
90 from += inc;
91 } return O;
92};
93},{"105":105,"108":108,"109":109}],9:[function(_dereq_,module,exports){
94// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
95'use strict';
96var toObject = _dereq_(109)
97 , toIndex = _dereq_(105)
98 , toLength = _dereq_(108);
99module.exports = function fill(value /*, start = 0, end = @length */){
100 var O = toObject(this)
101 , length = toLength(O.length)
102 , aLen = arguments.length
103 , index = toIndex(aLen > 1 ? arguments[1] : undefined, length)
104 , end = aLen > 2 ? arguments[2] : undefined
105 , endPos = end === undefined ? length : toIndex(end, length);
106 while(endPos > index)O[index++] = value;
107 return O;
108};
109},{"105":105,"108":108,"109":109}],10:[function(_dereq_,module,exports){
110var forOf = _dereq_(37);
111
112module.exports = function(iter, ITERATOR){
113 var result = [];
114 forOf(iter, false, result.push, result, ITERATOR);
115 return result;
116};
117
118},{"37":37}],11:[function(_dereq_,module,exports){
119// false -> Array#indexOf
120// true -> Array#includes
121var toIObject = _dereq_(107)
122 , toLength = _dereq_(108)
123 , toIndex = _dereq_(105);
124module.exports = function(IS_INCLUDES){
125 return function($this, el, fromIndex){
126 var O = toIObject($this)
127 , length = toLength(O.length)
128 , index = toIndex(fromIndex, length)
129 , value;
130 // Array#includes uses SameValueZero equality algorithm
131 if(IS_INCLUDES && el != el)while(length > index){
132 value = O[index++];
133 if(value != value)return true;
134 // Array#toIndex ignores holes, Array#includes - not
135 } else for(;length > index; index++)if(IS_INCLUDES || index in O){
136 if(O[index] === el)return IS_INCLUDES || index || 0;
137 } return !IS_INCLUDES && -1;
138 };
139};
140},{"105":105,"107":107,"108":108}],12:[function(_dereq_,module,exports){
141// 0 -> Array#forEach
142// 1 -> Array#map
143// 2 -> Array#filter
144// 3 -> Array#some
145// 4 -> Array#every
146// 5 -> Array#find
147// 6 -> Array#findIndex
148var ctx = _dereq_(25)
149 , IObject = _dereq_(45)
150 , toObject = _dereq_(109)
151 , toLength = _dereq_(108)
152 , asc = _dereq_(15);
153module.exports = function(TYPE, $create){
154 var IS_MAP = TYPE == 1
155 , IS_FILTER = TYPE == 2
156 , IS_SOME = TYPE == 3
157 , IS_EVERY = TYPE == 4
158 , IS_FIND_INDEX = TYPE == 6
159 , NO_HOLES = TYPE == 5 || IS_FIND_INDEX
160 , create = $create || asc;
161 return function($this, callbackfn, that){
162 var O = toObject($this)
163 , self = IObject(O)
164 , f = ctx(callbackfn, that, 3)
165 , length = toLength(self.length)
166 , index = 0
167 , result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined
168 , val, res;
169 for(;length > index; index++)if(NO_HOLES || index in self){
170 val = self[index];
171 res = f(val, index, O);
172 if(TYPE){
173 if(IS_MAP)result[index] = res; // map
174 else if(res)switch(TYPE){
175 case 3: return true; // some
176 case 5: return val; // find
177 case 6: return index; // findIndex
178 case 2: result.push(val); // filter
179 } else if(IS_EVERY)return false; // every
180 }
181 }
182 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
183 };
184};
185},{"108":108,"109":109,"15":15,"25":25,"45":45}],13:[function(_dereq_,module,exports){
186var aFunction = _dereq_(3)
187 , toObject = _dereq_(109)
188 , IObject = _dereq_(45)
189 , toLength = _dereq_(108);
190
191module.exports = function(that, callbackfn, aLen, memo, isRight){
192 aFunction(callbackfn);
193 var O = toObject(that)
194 , self = IObject(O)
195 , length = toLength(O.length)
196 , index = isRight ? length - 1 : 0
197 , i = isRight ? -1 : 1;
198 if(aLen < 2)for(;;){
199 if(index in self){
200 memo = self[index];
201 index += i;
202 break;
203 }
204 index += i;
205 if(isRight ? index < 0 : length <= index){
206 throw TypeError('Reduce of empty array with no initial value');
207 }
208 }
209 for(;isRight ? index >= 0 : length > index; index += i)if(index in self){
210 memo = callbackfn(memo, self[index], index, O);
211 }
212 return memo;
213};
214},{"108":108,"109":109,"3":3,"45":45}],14:[function(_dereq_,module,exports){
215var isObject = _dereq_(49)
216 , isArray = _dereq_(47)
217 , SPECIES = _dereq_(117)('species');
218
219module.exports = function(original){
220 var C;
221 if(isArray(original)){
222 C = original.constructor;
223 // cross-realm fallback
224 if(typeof C == 'function' && (C === Array || isArray(C.prototype)))C = undefined;
225 if(isObject(C)){
226 C = C[SPECIES];
227 if(C === null)C = undefined;
228 }
229 } return C === undefined ? Array : C;
230};
231},{"117":117,"47":47,"49":49}],15:[function(_dereq_,module,exports){
232// 9.4.2.3 ArraySpeciesCreate(originalArray, length)
233var speciesConstructor = _dereq_(14);
234
235module.exports = function(original, length){
236 return new (speciesConstructor(original))(length);
237};
238},{"14":14}],16:[function(_dereq_,module,exports){
239'use strict';
240var aFunction = _dereq_(3)
241 , isObject = _dereq_(49)
242 , invoke = _dereq_(44)
243 , arraySlice = [].slice
244 , factories = {};
245
246var construct = function(F, len, args){
247 if(!(len in factories)){
248 for(var n = [], i = 0; i < len; i++)n[i] = 'a[' + i + ']';
249 factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')');
250 } return factories[len](F, args);
251};
252
253module.exports = Function.bind || function bind(that /*, args... */){
254 var fn = aFunction(this)
255 , partArgs = arraySlice.call(arguments, 1);
256 var bound = function(/* args... */){
257 var args = partArgs.concat(arraySlice.call(arguments));
258 return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that);
259 };
260 if(isObject(fn.prototype))bound.prototype = fn.prototype;
261 return bound;
262};
263},{"3":3,"44":44,"49":49}],17:[function(_dereq_,module,exports){
264// getting tag from 19.1.3.6 Object.prototype.toString()
265var cof = _dereq_(18)
266 , TAG = _dereq_(117)('toStringTag')
267 // ES3 wrong here
268 , ARG = cof(function(){ return arguments; }()) == 'Arguments';
269
270// fallback for IE11 Script Access Denied error
271var tryGet = function(it, key){
272 try {
273 return it[key];
274 } catch(e){ /* empty */ }
275};
276
277module.exports = function(it){
278 var O, T, B;
279 return it === undefined ? 'Undefined' : it === null ? 'Null'
280 // @@toStringTag case
281 : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
282 // builtinTag case
283 : ARG ? cof(O)
284 // ES3 arguments fallback
285 : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
286};
287},{"117":117,"18":18}],18:[function(_dereq_,module,exports){
288var toString = {}.toString;
289
290module.exports = function(it){
291 return toString.call(it).slice(8, -1);
292};
293},{}],19:[function(_dereq_,module,exports){
294'use strict';
295var dP = _dereq_(67).f
296 , create = _dereq_(66)
297 , redefineAll = _dereq_(86)
298 , ctx = _dereq_(25)
299 , anInstance = _dereq_(6)
300 , defined = _dereq_(27)
301 , forOf = _dereq_(37)
302 , $iterDefine = _dereq_(53)
303 , step = _dereq_(55)
304 , setSpecies = _dereq_(91)
305 , DESCRIPTORS = _dereq_(28)
306 , fastKey = _dereq_(62).fastKey
307 , SIZE = DESCRIPTORS ? '_s' : 'size';
308
309var getEntry = function(that, key){
310 // fast case
311 var index = fastKey(key), entry;
312 if(index !== 'F')return that._i[index];
313 // frozen object case
314 for(entry = that._f; entry; entry = entry.n){
315 if(entry.k == key)return entry;
316 }
317};
318
319module.exports = {
320 getConstructor: function(wrapper, NAME, IS_MAP, ADDER){
321 var C = wrapper(function(that, iterable){
322 anInstance(that, C, NAME, '_i');
323 that._i = create(null); // index
324 that._f = undefined; // first entry
325 that._l = undefined; // last entry
326 that[SIZE] = 0; // size
327 if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
328 });
329 redefineAll(C.prototype, {
330 // 23.1.3.1 Map.prototype.clear()
331 // 23.2.3.2 Set.prototype.clear()
332 clear: function clear(){
333 for(var that = this, data = that._i, entry = that._f; entry; entry = entry.n){
334 entry.r = true;
335 if(entry.p)entry.p = entry.p.n = undefined;
336 delete data[entry.i];
337 }
338 that._f = that._l = undefined;
339 that[SIZE] = 0;
340 },
341 // 23.1.3.3 Map.prototype.delete(key)
342 // 23.2.3.4 Set.prototype.delete(value)
343 'delete': function(key){
344 var that = this
345 , entry = getEntry(that, key);
346 if(entry){
347 var next = entry.n
348 , prev = entry.p;
349 delete that._i[entry.i];
350 entry.r = true;
351 if(prev)prev.n = next;
352 if(next)next.p = prev;
353 if(that._f == entry)that._f = next;
354 if(that._l == entry)that._l = prev;
355 that[SIZE]--;
356 } return !!entry;
357 },
358 // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
359 // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
360 forEach: function forEach(callbackfn /*, that = undefined */){
361 anInstance(this, C, 'forEach');
362 var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3)
363 , entry;
364 while(entry = entry ? entry.n : this._f){
365 f(entry.v, entry.k, this);
366 // revert to the last existing entry
367 while(entry && entry.r)entry = entry.p;
368 }
369 },
370 // 23.1.3.7 Map.prototype.has(key)
371 // 23.2.3.7 Set.prototype.has(value)
372 has: function has(key){
373 return !!getEntry(this, key);
374 }
375 });
376 if(DESCRIPTORS)dP(C.prototype, 'size', {
377 get: function(){
378 return defined(this[SIZE]);
379 }
380 });
381 return C;
382 },
383 def: function(that, key, value){
384 var entry = getEntry(that, key)
385 , prev, index;
386 // change existing entry
387 if(entry){
388 entry.v = value;
389 // create new entry
390 } else {
391 that._l = entry = {
392 i: index = fastKey(key, true), // <- index
393 k: key, // <- key
394 v: value, // <- value
395 p: prev = that._l, // <- previous entry
396 n: undefined, // <- next entry
397 r: false // <- removed
398 };
399 if(!that._f)that._f = entry;
400 if(prev)prev.n = entry;
401 that[SIZE]++;
402 // add to index
403 if(index !== 'F')that._i[index] = entry;
404 } return that;
405 },
406 getEntry: getEntry,
407 setStrong: function(C, NAME, IS_MAP){
408 // add .keys, .values, .entries, [@@iterator]
409 // 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
410 $iterDefine(C, NAME, function(iterated, kind){
411 this._t = iterated; // target
412 this._k = kind; // kind
413 this._l = undefined; // previous
414 }, function(){
415 var that = this
416 , kind = that._k
417 , entry = that._l;
418 // revert to the last existing entry
419 while(entry && entry.r)entry = entry.p;
420 // get next entry
421 if(!that._t || !(that._l = entry = entry ? entry.n : that._t._f)){
422 // or finish the iteration
423 that._t = undefined;
424 return step(1);
425 }
426 // return step by kind
427 if(kind == 'keys' )return step(0, entry.k);
428 if(kind == 'values')return step(0, entry.v);
429 return step(0, [entry.k, entry.v]);
430 }, IS_MAP ? 'entries' : 'values' , !IS_MAP, true);
431
432 // add [@@species], 23.1.2.2, 23.2.2.2
433 setSpecies(NAME);
434 }
435};
436},{"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){
437// https://github.com/DavidBruant/Map-Set.prototype.toJSON
438var classof = _dereq_(17)
439 , from = _dereq_(10);
440module.exports = function(NAME){
441 return function toJSON(){
442 if(classof(this) != NAME)throw TypeError(NAME + "#toJSON isn't generic");
443 return from(this);
444 };
445};
446},{"10":10,"17":17}],21:[function(_dereq_,module,exports){
447'use strict';
448var redefineAll = _dereq_(86)
449 , getWeak = _dereq_(62).getWeak
450 , anObject = _dereq_(7)
451 , isObject = _dereq_(49)
452 , anInstance = _dereq_(6)
453 , forOf = _dereq_(37)
454 , createArrayMethod = _dereq_(12)
455 , $has = _dereq_(39)
456 , arrayFind = createArrayMethod(5)
457 , arrayFindIndex = createArrayMethod(6)
458 , id = 0;
459
460// fallback for uncaught frozen keys
461var uncaughtFrozenStore = function(that){
462 return that._l || (that._l = new UncaughtFrozenStore);
463};
464var UncaughtFrozenStore = function(){
465 this.a = [];
466};
467var findUncaughtFrozen = function(store, key){
468 return arrayFind(store.a, function(it){
469 return it[0] === key;
470 });
471};
472UncaughtFrozenStore.prototype = {
473 get: function(key){
474 var entry = findUncaughtFrozen(this, key);
475 if(entry)return entry[1];
476 },
477 has: function(key){
478 return !!findUncaughtFrozen(this, key);
479 },
480 set: function(key, value){
481 var entry = findUncaughtFrozen(this, key);
482 if(entry)entry[1] = value;
483 else this.a.push([key, value]);
484 },
485 'delete': function(key){
486 var index = arrayFindIndex(this.a, function(it){
487 return it[0] === key;
488 });
489 if(~index)this.a.splice(index, 1);
490 return !!~index;
491 }
492};
493
494module.exports = {
495 getConstructor: function(wrapper, NAME, IS_MAP, ADDER){
496 var C = wrapper(function(that, iterable){
497 anInstance(that, C, NAME, '_i');
498 that._i = id++; // collection id
499 that._l = undefined; // leak store for uncaught frozen objects
500 if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
501 });
502 redefineAll(C.prototype, {
503 // 23.3.3.2 WeakMap.prototype.delete(key)
504 // 23.4.3.3 WeakSet.prototype.delete(value)
505 'delete': function(key){
506 if(!isObject(key))return false;
507 var data = getWeak(key);
508 if(data === true)return uncaughtFrozenStore(this)['delete'](key);
509 return data && $has(data, this._i) && delete data[this._i];
510 },
511 // 23.3.3.4 WeakMap.prototype.has(key)
512 // 23.4.3.4 WeakSet.prototype.has(value)
513 has: function has(key){
514 if(!isObject(key))return false;
515 var data = getWeak(key);
516 if(data === true)return uncaughtFrozenStore(this).has(key);
517 return data && $has(data, this._i);
518 }
519 });
520 return C;
521 },
522 def: function(that, key, value){
523 var data = getWeak(anObject(key), true);
524 if(data === true)uncaughtFrozenStore(that).set(key, value);
525 else data[that._i] = value;
526 return that;
527 },
528 ufstore: uncaughtFrozenStore
529};
530},{"12":12,"37":37,"39":39,"49":49,"6":6,"62":62,"7":7,"86":86}],22:[function(_dereq_,module,exports){
531'use strict';
532var global = _dereq_(38)
533 , $export = _dereq_(32)
534 , redefine = _dereq_(87)
535 , redefineAll = _dereq_(86)
536 , meta = _dereq_(62)
537 , forOf = _dereq_(37)
538 , anInstance = _dereq_(6)
539 , isObject = _dereq_(49)
540 , fails = _dereq_(34)
541 , $iterDetect = _dereq_(54)
542 , setToStringTag = _dereq_(92)
543 , inheritIfRequired = _dereq_(43);
544
545module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){
546 var Base = global[NAME]
547 , C = Base
548 , ADDER = IS_MAP ? 'set' : 'add'
549 , proto = C && C.prototype
550 , O = {};
551 var fixMethod = function(KEY){
552 var fn = proto[KEY];
553 redefine(proto, KEY,
554 KEY == 'delete' ? function(a){
555 return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
556 } : KEY == 'has' ? function has(a){
557 return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
558 } : KEY == 'get' ? function get(a){
559 return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a);
560 } : KEY == 'add' ? function add(a){ fn.call(this, a === 0 ? 0 : a); return this; }
561 : function set(a, b){ fn.call(this, a === 0 ? 0 : a, b); return this; }
562 );
563 };
564 if(typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function(){
565 new C().entries().next();
566 }))){
567 // create collection constructor
568 C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
569 redefineAll(C.prototype, methods);
570 meta.NEED = true;
571 } else {
572 var instance = new C
573 // early implementations not supports chaining
574 , HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance
575 // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false
576 , THROWS_ON_PRIMITIVES = fails(function(){ instance.has(1); })
577 // most early implementations doesn't supports iterables, most modern - not close it correctly
578 , ACCEPT_ITERABLES = $iterDetect(function(iter){ new C(iter); }) // eslint-disable-line no-new
579 // for early implementations -0 and +0 not the same
580 , BUGGY_ZERO = !IS_WEAK && fails(function(){
581 // V8 ~ Chromium 42- fails only with 5+ elements
582 var $instance = new C()
583 , index = 5;
584 while(index--)$instance[ADDER](index, index);
585 return !$instance.has(-0);
586 });
587 if(!ACCEPT_ITERABLES){
588 C = wrapper(function(target, iterable){
589 anInstance(target, C, NAME);
590 var that = inheritIfRequired(new Base, target, C);
591 if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
592 return that;
593 });
594 C.prototype = proto;
595 proto.constructor = C;
596 }
597 if(THROWS_ON_PRIMITIVES || BUGGY_ZERO){
598 fixMethod('delete');
599 fixMethod('has');
600 IS_MAP && fixMethod('get');
601 }
602 if(BUGGY_ZERO || HASNT_CHAINING)fixMethod(ADDER);
603 // weak collections should not contains .clear method
604 if(IS_WEAK && proto.clear)delete proto.clear;
605 }
606
607 setToStringTag(C, NAME);
608
609 O[NAME] = C;
610 $export($export.G + $export.W + $export.F * (C != Base), O);
611
612 if(!IS_WEAK)common.setStrong(C, NAME, IS_MAP);
613
614 return C;
615};
616},{"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){
617var core = module.exports = {version: '2.4.0'};
618if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
619},{}],24:[function(_dereq_,module,exports){
620'use strict';
621var $defineProperty = _dereq_(67)
622 , createDesc = _dereq_(85);
623
624module.exports = function(object, index, value){
625 if(index in object)$defineProperty.f(object, index, createDesc(0, value));
626 else object[index] = value;
627};
628},{"67":67,"85":85}],25:[function(_dereq_,module,exports){
629// optional / simple context binding
630var aFunction = _dereq_(3);
631module.exports = function(fn, that, length){
632 aFunction(fn);
633 if(that === undefined)return fn;
634 switch(length){
635 case 1: return function(a){
636 return fn.call(that, a);
637 };
638 case 2: return function(a, b){
639 return fn.call(that, a, b);
640 };
641 case 3: return function(a, b, c){
642 return fn.call(that, a, b, c);
643 };
644 }
645 return function(/* ...args */){
646 return fn.apply(that, arguments);
647 };
648};
649},{"3":3}],26:[function(_dereq_,module,exports){
650'use strict';
651var anObject = _dereq_(7)
652 , toPrimitive = _dereq_(110)
653 , NUMBER = 'number';
654
655module.exports = function(hint){
656 if(hint !== 'string' && hint !== NUMBER && hint !== 'default')throw TypeError('Incorrect hint');
657 return toPrimitive(anObject(this), hint != NUMBER);
658};
659},{"110":110,"7":7}],27:[function(_dereq_,module,exports){
660// 7.2.1 RequireObjectCoercible(argument)
661module.exports = function(it){
662 if(it == undefined)throw TypeError("Can't call method on " + it);
663 return it;
664};
665},{}],28:[function(_dereq_,module,exports){
666// Thank's IE8 for his funny defineProperty
667module.exports = !_dereq_(34)(function(){
668 return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
669});
670},{"34":34}],29:[function(_dereq_,module,exports){
671var isObject = _dereq_(49)
672 , document = _dereq_(38).document
673 // in old IE typeof document.createElement is 'object'
674 , is = isObject(document) && isObject(document.createElement);
675module.exports = function(it){
676 return is ? document.createElement(it) : {};
677};
678},{"38":38,"49":49}],30:[function(_dereq_,module,exports){
679// IE 8- don't enum bug keys
680module.exports = (
681 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
682).split(',');
683},{}],31:[function(_dereq_,module,exports){
684// all enumerable object keys, includes symbols
685var getKeys = _dereq_(76)
686 , gOPS = _dereq_(73)
687 , pIE = _dereq_(77);
688module.exports = function(it){
689 var result = getKeys(it)
690 , getSymbols = gOPS.f;
691 if(getSymbols){
692 var symbols = getSymbols(it)
693 , isEnum = pIE.f
694 , i = 0
695 , key;
696 while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))result.push(key);
697 } return result;
698};
699},{"73":73,"76":76,"77":77}],32:[function(_dereq_,module,exports){
700var global = _dereq_(38)
701 , core = _dereq_(23)
702 , hide = _dereq_(40)
703 , redefine = _dereq_(87)
704 , ctx = _dereq_(25)
705 , PROTOTYPE = 'prototype';
706
707var $export = function(type, name, source){
708 var IS_FORCED = type & $export.F
709 , IS_GLOBAL = type & $export.G
710 , IS_STATIC = type & $export.S
711 , IS_PROTO = type & $export.P
712 , IS_BIND = type & $export.B
713 , target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]
714 , exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
715 , expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {})
716 , key, own, out, exp;
717 if(IS_GLOBAL)source = name;
718 for(key in source){
719 // contains in native
720 own = !IS_FORCED && target && target[key] !== undefined;
721 // export native or passed
722 out = (own ? target : source)[key];
723 // bind timers to global for call from export context
724 exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
725 // extend global
726 if(target)redefine(target, key, out, type & $export.U);
727 // export
728 if(exports[key] != out)hide(exports, key, exp);
729 if(IS_PROTO && expProto[key] != out)expProto[key] = out;
730 }
731};
732global.core = core;
733// type bitmap
734$export.F = 1; // forced
735$export.G = 2; // global
736$export.S = 4; // static
737$export.P = 8; // proto
738$export.B = 16; // bind
739$export.W = 32; // wrap
740$export.U = 64; // safe
741$export.R = 128; // real proto method for `library`
742module.exports = $export;
743},{"23":23,"25":25,"38":38,"40":40,"87":87}],33:[function(_dereq_,module,exports){
744var MATCH = _dereq_(117)('match');
745module.exports = function(KEY){
746 var re = /./;
747 try {
748 '/./'[KEY](re);
749 } catch(e){
750 try {
751 re[MATCH] = false;
752 return !'/./'[KEY](re);
753 } catch(f){ /* empty */ }
754 } return true;
755};
756},{"117":117}],34:[function(_dereq_,module,exports){
757module.exports = function(exec){
758 try {
759 return !!exec();
760 } catch(e){
761 return true;
762 }
763};
764},{}],35:[function(_dereq_,module,exports){
765'use strict';
766var hide = _dereq_(40)
767 , redefine = _dereq_(87)
768 , fails = _dereq_(34)
769 , defined = _dereq_(27)
770 , wks = _dereq_(117);
771
772module.exports = function(KEY, length, exec){
773 var SYMBOL = wks(KEY)
774 , fns = exec(defined, SYMBOL, ''[KEY])
775 , strfn = fns[0]
776 , rxfn = fns[1];
777 if(fails(function(){
778 var O = {};
779 O[SYMBOL] = function(){ return 7; };
780 return ''[KEY](O) != 7;
781 })){
782 redefine(String.prototype, KEY, strfn);
783 hide(RegExp.prototype, SYMBOL, length == 2
784 // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
785 // 21.2.5.11 RegExp.prototype[@@split](string, limit)
786 ? function(string, arg){ return rxfn.call(string, this, arg); }
787 // 21.2.5.6 RegExp.prototype[@@match](string)
788 // 21.2.5.9 RegExp.prototype[@@search](string)
789 : function(string){ return rxfn.call(string, this); }
790 );
791 }
792};
793},{"117":117,"27":27,"34":34,"40":40,"87":87}],36:[function(_dereq_,module,exports){
794'use strict';
795// 21.2.5.3 get RegExp.prototype.flags
796var anObject = _dereq_(7);
797module.exports = function(){
798 var that = anObject(this)
799 , result = '';
800 if(that.global) result += 'g';
801 if(that.ignoreCase) result += 'i';
802 if(that.multiline) result += 'm';
803 if(that.unicode) result += 'u';
804 if(that.sticky) result += 'y';
805 return result;
806};
807},{"7":7}],37:[function(_dereq_,module,exports){
808var ctx = _dereq_(25)
809 , call = _dereq_(51)
810 , isArrayIter = _dereq_(46)
811 , anObject = _dereq_(7)
812 , toLength = _dereq_(108)
813 , getIterFn = _dereq_(118)
814 , BREAK = {}
815 , RETURN = {};
816var exports = module.exports = function(iterable, entries, fn, that, ITERATOR){
817 var iterFn = ITERATOR ? function(){ return iterable; } : getIterFn(iterable)
818 , f = ctx(fn, that, entries ? 2 : 1)
819 , index = 0
820 , length, step, iterator, result;
821 if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!');
822 // fast case for arrays with default iterator
823 if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){
824 result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
825 if(result === BREAK || result === RETURN)return result;
826 } else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){
827 result = call(iterator, f, step.value, entries);
828 if(result === BREAK || result === RETURN)return result;
829 }
830};
831exports.BREAK = BREAK;
832exports.RETURN = RETURN;
833},{"108":108,"118":118,"25":25,"46":46,"51":51,"7":7}],38:[function(_dereq_,module,exports){
834// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
835var global = module.exports = typeof window != 'undefined' && window.Math == Math
836 ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
837if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
838},{}],39:[function(_dereq_,module,exports){
839var hasOwnProperty = {}.hasOwnProperty;
840module.exports = function(it, key){
841 return hasOwnProperty.call(it, key);
842};
843},{}],40:[function(_dereq_,module,exports){
844var dP = _dereq_(67)
845 , createDesc = _dereq_(85);
846module.exports = _dereq_(28) ? function(object, key, value){
847 return dP.f(object, key, createDesc(1, value));
848} : function(object, key, value){
849 object[key] = value;
850 return object;
851};
852},{"28":28,"67":67,"85":85}],41:[function(_dereq_,module,exports){
853module.exports = _dereq_(38).document && document.documentElement;
854},{"38":38}],42:[function(_dereq_,module,exports){
855module.exports = !_dereq_(28) && !_dereq_(34)(function(){
856 return Object.defineProperty(_dereq_(29)('div'), 'a', {get: function(){ return 7; }}).a != 7;
857});
858},{"28":28,"29":29,"34":34}],43:[function(_dereq_,module,exports){
859var isObject = _dereq_(49)
860 , setPrototypeOf = _dereq_(90).set;
861module.exports = function(that, target, C){
862 var P, S = target.constructor;
863 if(S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf){
864 setPrototypeOf(that, P);
865 } return that;
866};
867},{"49":49,"90":90}],44:[function(_dereq_,module,exports){
868// fast apply, http://jsperf.lnkit.com/fast-apply/5
869module.exports = function(fn, args, that){
870 var un = that === undefined;
871 switch(args.length){
872 case 0: return un ? fn()
873 : fn.call(that);
874 case 1: return un ? fn(args[0])
875 : fn.call(that, args[0]);
876 case 2: return un ? fn(args[0], args[1])
877 : fn.call(that, args[0], args[1]);
878 case 3: return un ? fn(args[0], args[1], args[2])
879 : fn.call(that, args[0], args[1], args[2]);
880 case 4: return un ? fn(args[0], args[1], args[2], args[3])
881 : fn.call(that, args[0], args[1], args[2], args[3]);
882 } return fn.apply(that, args);
883};
884},{}],45:[function(_dereq_,module,exports){
885// fallback for non-array-like ES3 and non-enumerable old V8 strings
886var cof = _dereq_(18);
887module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){
888 return cof(it) == 'String' ? it.split('') : Object(it);
889};
890},{"18":18}],46:[function(_dereq_,module,exports){
891// check on default Array iterator
892var Iterators = _dereq_(56)
893 , ITERATOR = _dereq_(117)('iterator')
894 , ArrayProto = Array.prototype;
895
896module.exports = function(it){
897 return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
898};
899},{"117":117,"56":56}],47:[function(_dereq_,module,exports){
900// 7.2.2 IsArray(argument)
901var cof = _dereq_(18);
902module.exports = Array.isArray || function isArray(arg){
903 return cof(arg) == 'Array';
904};
905},{"18":18}],48:[function(_dereq_,module,exports){
906// 20.1.2.3 Number.isInteger(number)
907var isObject = _dereq_(49)
908 , floor = Math.floor;
909module.exports = function isInteger(it){
910 return !isObject(it) && isFinite(it) && floor(it) === it;
911};
912},{"49":49}],49:[function(_dereq_,module,exports){
913module.exports = function(it){
914 return typeof it === 'object' ? it !== null : typeof it === 'function';
915};
916},{}],50:[function(_dereq_,module,exports){
917// 7.2.8 IsRegExp(argument)
918var isObject = _dereq_(49)
919 , cof = _dereq_(18)
920 , MATCH = _dereq_(117)('match');
921module.exports = function(it){
922 var isRegExp;
923 return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');
924};
925},{"117":117,"18":18,"49":49}],51:[function(_dereq_,module,exports){
926// call something on iterator step with safe closing on error
927var anObject = _dereq_(7);
928module.exports = function(iterator, fn, value, entries){
929 try {
930 return entries ? fn(anObject(value)[0], value[1]) : fn(value);
931 // 7.4.6 IteratorClose(iterator, completion)
932 } catch(e){
933 var ret = iterator['return'];
934 if(ret !== undefined)anObject(ret.call(iterator));
935 throw e;
936 }
937};
938},{"7":7}],52:[function(_dereq_,module,exports){
939'use strict';
940var create = _dereq_(66)
941 , descriptor = _dereq_(85)
942 , setToStringTag = _dereq_(92)
943 , IteratorPrototype = {};
944
945// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
946_dereq_(40)(IteratorPrototype, _dereq_(117)('iterator'), function(){ return this; });
947
948module.exports = function(Constructor, NAME, next){
949 Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)});
950 setToStringTag(Constructor, NAME + ' Iterator');
951};
952},{"117":117,"40":40,"66":66,"85":85,"92":92}],53:[function(_dereq_,module,exports){
953'use strict';
954var LIBRARY = _dereq_(58)
955 , $export = _dereq_(32)
956 , redefine = _dereq_(87)
957 , hide = _dereq_(40)
958 , has = _dereq_(39)
959 , Iterators = _dereq_(56)
960 , $iterCreate = _dereq_(52)
961 , setToStringTag = _dereq_(92)
962 , getPrototypeOf = _dereq_(74)
963 , ITERATOR = _dereq_(117)('iterator')
964 , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next`
965 , FF_ITERATOR = '@@iterator'
966 , KEYS = 'keys'
967 , VALUES = 'values';
968
969var returnThis = function(){ return this; };
970
971module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){
972 $iterCreate(Constructor, NAME, next);
973 var getMethod = function(kind){
974 if(!BUGGY && kind in proto)return proto[kind];
975 switch(kind){
976 case KEYS: return function keys(){ return new Constructor(this, kind); };
977 case VALUES: return function values(){ return new Constructor(this, kind); };
978 } return function entries(){ return new Constructor(this, kind); };
979 };
980 var TAG = NAME + ' Iterator'
981 , DEF_VALUES = DEFAULT == VALUES
982 , VALUES_BUG = false
983 , proto = Base.prototype
984 , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]
985 , $default = $native || getMethod(DEFAULT)
986 , $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined
987 , $anyNative = NAME == 'Array' ? proto.entries || $native : $native
988 , methods, key, IteratorPrototype;
989 // Fix native
990 if($anyNative){
991 IteratorPrototype = getPrototypeOf($anyNative.call(new Base));
992 if(IteratorPrototype !== Object.prototype){
993 // Set @@toStringTag to native iterators
994 setToStringTag(IteratorPrototype, TAG, true);
995 // fix for some old engines
996 if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis);
997 }
998 }
999 // fix Array#{values, @@iterator}.name in V8 / FF
1000 if(DEF_VALUES && $native && $native.name !== VALUES){
1001 VALUES_BUG = true;
1002 $default = function values(){ return $native.call(this); };
1003 }
1004 // Define iterator
1005 if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){
1006 hide(proto, ITERATOR, $default);
1007 }
1008 // Plug for library
1009 Iterators[NAME] = $default;
1010 Iterators[TAG] = returnThis;
1011 if(DEFAULT){
1012 methods = {
1013 values: DEF_VALUES ? $default : getMethod(VALUES),
1014 keys: IS_SET ? $default : getMethod(KEYS),
1015 entries: $entries
1016 };
1017 if(FORCED)for(key in methods){
1018 if(!(key in proto))redefine(proto, key, methods[key]);
1019 } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
1020 }
1021 return methods;
1022};
1023},{"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){
1024var ITERATOR = _dereq_(117)('iterator')
1025 , SAFE_CLOSING = false;
1026
1027try {
1028 var riter = [7][ITERATOR]();
1029 riter['return'] = function(){ SAFE_CLOSING = true; };
1030 Array.from(riter, function(){ throw 2; });
1031} catch(e){ /* empty */ }
1032
1033module.exports = function(exec, skipClosing){
1034 if(!skipClosing && !SAFE_CLOSING)return false;
1035 var safe = false;
1036 try {
1037 var arr = [7]
1038 , iter = arr[ITERATOR]();
1039 iter.next = function(){ return {done: safe = true}; };
1040 arr[ITERATOR] = function(){ return iter; };
1041 exec(arr);
1042 } catch(e){ /* empty */ }
1043 return safe;
1044};
1045},{"117":117}],55:[function(_dereq_,module,exports){
1046module.exports = function(done, value){
1047 return {value: value, done: !!done};
1048};
1049},{}],56:[function(_dereq_,module,exports){
1050module.exports = {};
1051},{}],57:[function(_dereq_,module,exports){
1052var getKeys = _dereq_(76)
1053 , toIObject = _dereq_(107);
1054module.exports = function(object, el){
1055 var O = toIObject(object)
1056 , keys = getKeys(O)
1057 , length = keys.length
1058 , index = 0
1059 , key;
1060 while(length > index)if(O[key = keys[index++]] === el)return key;
1061};
1062},{"107":107,"76":76}],58:[function(_dereq_,module,exports){
1063module.exports = false;
1064},{}],59:[function(_dereq_,module,exports){
1065// 20.2.2.14 Math.expm1(x)
1066var $expm1 = Math.expm1;
1067module.exports = (!$expm1
1068 // Old FF bug
1069 || $expm1(10) > 22025.465794806719 || $expm1(10) < 22025.4657948067165168
1070 // Tor Browser bug
1071 || $expm1(-2e-17) != -2e-17
1072) ? function expm1(x){
1073 return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1;
1074} : $expm1;
1075},{}],60:[function(_dereq_,module,exports){
1076// 20.2.2.20 Math.log1p(x)
1077module.exports = Math.log1p || function log1p(x){
1078 return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x);
1079};
1080},{}],61:[function(_dereq_,module,exports){
1081// 20.2.2.28 Math.sign(x)
1082module.exports = Math.sign || function sign(x){
1083 return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
1084};
1085},{}],62:[function(_dereq_,module,exports){
1086var META = _dereq_(114)('meta')
1087 , isObject = _dereq_(49)
1088 , has = _dereq_(39)
1089 , setDesc = _dereq_(67).f
1090 , id = 0;
1091var isExtensible = Object.isExtensible || function(){
1092 return true;
1093};
1094var FREEZE = !_dereq_(34)(function(){
1095 return isExtensible(Object.preventExtensions({}));
1096});
1097var setMeta = function(it){
1098 setDesc(it, META, {value: {
1099 i: 'O' + ++id, // object ID
1100 w: {} // weak collections IDs
1101 }});
1102};
1103var fastKey = function(it, create){
1104 // return primitive with prefix
1105 if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
1106 if(!has(it, META)){
1107 // can't set metadata to uncaught frozen object
1108 if(!isExtensible(it))return 'F';
1109 // not necessary to add metadata
1110 if(!create)return 'E';
1111 // add missing metadata
1112 setMeta(it);
1113 // return object ID
1114 } return it[META].i;
1115};
1116var getWeak = function(it, create){
1117 if(!has(it, META)){
1118 // can't set metadata to uncaught frozen object
1119 if(!isExtensible(it))return true;
1120 // not necessary to add metadata
1121 if(!create)return false;
1122 // add missing metadata
1123 setMeta(it);
1124 // return hash weak collections IDs
1125 } return it[META].w;
1126};
1127// add metadata on freeze-family methods calling
1128var onFreeze = function(it){
1129 if(FREEZE && meta.NEED && isExtensible(it) && !has(it, META))setMeta(it);
1130 return it;
1131};
1132var meta = module.exports = {
1133 KEY: META,
1134 NEED: false,
1135 fastKey: fastKey,
1136 getWeak: getWeak,
1137 onFreeze: onFreeze
1138};
1139},{"114":114,"34":34,"39":39,"49":49,"67":67}],63:[function(_dereq_,module,exports){
1140var Map = _dereq_(149)
1141 , $export = _dereq_(32)
1142 , shared = _dereq_(94)('metadata')
1143 , store = shared.store || (shared.store = new (_dereq_(255)));
1144
1145var getOrCreateMetadataMap = function(target, targetKey, create){
1146 var targetMetadata = store.get(target);
1147 if(!targetMetadata){
1148 if(!create)return undefined;
1149 store.set(target, targetMetadata = new Map);
1150 }
1151 var keyMetadata = targetMetadata.get(targetKey);
1152 if(!keyMetadata){
1153 if(!create)return undefined;
1154 targetMetadata.set(targetKey, keyMetadata = new Map);
1155 } return keyMetadata;
1156};
1157var ordinaryHasOwnMetadata = function(MetadataKey, O, P){
1158 var metadataMap = getOrCreateMetadataMap(O, P, false);
1159 return metadataMap === undefined ? false : metadataMap.has(MetadataKey);
1160};
1161var ordinaryGetOwnMetadata = function(MetadataKey, O, P){
1162 var metadataMap = getOrCreateMetadataMap(O, P, false);
1163 return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey);
1164};
1165var ordinaryDefineOwnMetadata = function(MetadataKey, MetadataValue, O, P){
1166 getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue);
1167};
1168var ordinaryOwnMetadataKeys = function(target, targetKey){
1169 var metadataMap = getOrCreateMetadataMap(target, targetKey, false)
1170 , keys = [];
1171 if(metadataMap)metadataMap.forEach(function(_, key){ keys.push(key); });
1172 return keys;
1173};
1174var toMetaKey = function(it){
1175 return it === undefined || typeof it == 'symbol' ? it : String(it);
1176};
1177var exp = function(O){
1178 $export($export.S, 'Reflect', O);
1179};
1180
1181module.exports = {
1182 store: store,
1183 map: getOrCreateMetadataMap,
1184 has: ordinaryHasOwnMetadata,
1185 get: ordinaryGetOwnMetadata,
1186 set: ordinaryDefineOwnMetadata,
1187 keys: ordinaryOwnMetadataKeys,
1188 key: toMetaKey,
1189 exp: exp
1190};
1191},{"149":149,"255":255,"32":32,"94":94}],64:[function(_dereq_,module,exports){
1192var global = _dereq_(38)
1193 , macrotask = _dereq_(104).set
1194 , Observer = global.MutationObserver || global.WebKitMutationObserver
1195 , process = global.process
1196 , Promise = global.Promise
1197 , isNode = _dereq_(18)(process) == 'process';
1198
1199module.exports = function(){
1200 var head, last, notify;
1201
1202 var flush = function(){
1203 var parent, fn;
1204 if(isNode && (parent = process.domain))parent.exit();
1205 while(head){
1206 fn = head.fn;
1207 head = head.next;
1208 try {
1209 fn();
1210 } catch(e){
1211 if(head)notify();
1212 else last = undefined;
1213 throw e;
1214 }
1215 } last = undefined;
1216 if(parent)parent.enter();
1217 };
1218
1219 // Node.js
1220 if(isNode){
1221 notify = function(){
1222 process.nextTick(flush);
1223 };
1224 // browsers with MutationObserver
1225 } else if(Observer){
1226 var toggle = true
1227 , node = document.createTextNode('');
1228 new Observer(flush).observe(node, {characterData: true}); // eslint-disable-line no-new
1229 notify = function(){
1230 node.data = toggle = !toggle;
1231 };
1232 // environments with maybe non-completely correct, but existent Promise
1233 } else if(Promise && Promise.resolve){
1234 var promise = Promise.resolve();
1235 notify = function(){
1236 promise.then(flush);
1237 };
1238 // for other environments - macrotask based on:
1239 // - setImmediate
1240 // - MessageChannel
1241 // - window.postMessag
1242 // - onreadystatechange
1243 // - setTimeout
1244 } else {
1245 notify = function(){
1246 // strange IE + webpack dev server bug - use .call(global)
1247 macrotask.call(global, flush);
1248 };
1249 }
1250
1251 return function(fn){
1252 var task = {fn: fn, next: undefined};
1253 if(last)last.next = task;
1254 if(!head){
1255 head = task;
1256 notify();
1257 } last = task;
1258 };
1259};
1260},{"104":104,"18":18,"38":38}],65:[function(_dereq_,module,exports){
1261'use strict';
1262// 19.1.2.1 Object.assign(target, source, ...)
1263var getKeys = _dereq_(76)
1264 , gOPS = _dereq_(73)
1265 , pIE = _dereq_(77)
1266 , toObject = _dereq_(109)
1267 , IObject = _dereq_(45)
1268 , $assign = Object.assign;
1269
1270// should work with symbols and should have deterministic property order (V8 bug)
1271module.exports = !$assign || _dereq_(34)(function(){
1272 var A = {}
1273 , B = {}
1274 , S = Symbol()
1275 , K = 'abcdefghijklmnopqrst';
1276 A[S] = 7;
1277 K.split('').forEach(function(k){ B[k] = k; });
1278 return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
1279}) ? function assign(target, source){ // eslint-disable-line no-unused-vars
1280 var T = toObject(target)
1281 , aLen = arguments.length
1282 , index = 1
1283 , getSymbols = gOPS.f
1284 , isEnum = pIE.f;
1285 while(aLen > index){
1286 var S = IObject(arguments[index++])
1287 , keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S)
1288 , length = keys.length
1289 , j = 0
1290 , key;
1291 while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key];
1292 } return T;
1293} : $assign;
1294},{"109":109,"34":34,"45":45,"73":73,"76":76,"77":77}],66:[function(_dereq_,module,exports){
1295// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
1296var anObject = _dereq_(7)
1297 , dPs = _dereq_(68)
1298 , enumBugKeys = _dereq_(30)
1299 , IE_PROTO = _dereq_(93)('IE_PROTO')
1300 , Empty = function(){ /* empty */ }
1301 , PROTOTYPE = 'prototype';
1302
1303// Create object with fake `null` prototype: use iframe Object with cleared prototype
1304var createDict = function(){
1305 // Thrash, waste and sodomy: IE GC bug
1306 var iframe = _dereq_(29)('iframe')
1307 , i = enumBugKeys.length
1308 , lt = '<'
1309 , gt = '>'
1310 , iframeDocument;
1311 iframe.style.display = 'none';
1312 _dereq_(41).appendChild(iframe);
1313 iframe.src = 'javascript:'; // eslint-disable-line no-script-url
1314 // createDict = iframe.contentWindow.Object;
1315 // html.removeChild(iframe);
1316 iframeDocument = iframe.contentWindow.document;
1317 iframeDocument.open();
1318 iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
1319 iframeDocument.close();
1320 createDict = iframeDocument.F;
1321 while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]];
1322 return createDict();
1323};
1324
1325module.exports = Object.create || function create(O, Properties){
1326 var result;
1327 if(O !== null){
1328 Empty[PROTOTYPE] = anObject(O);
1329 result = new Empty;
1330 Empty[PROTOTYPE] = null;
1331 // add "__proto__" for Object.getPrototypeOf polyfill
1332 result[IE_PROTO] = O;
1333 } else result = createDict();
1334 return Properties === undefined ? result : dPs(result, Properties);
1335};
1336
1337},{"29":29,"30":30,"41":41,"68":68,"7":7,"93":93}],67:[function(_dereq_,module,exports){
1338var anObject = _dereq_(7)
1339 , IE8_DOM_DEFINE = _dereq_(42)
1340 , toPrimitive = _dereq_(110)
1341 , dP = Object.defineProperty;
1342
1343exports.f = _dereq_(28) ? Object.defineProperty : function defineProperty(O, P, Attributes){
1344 anObject(O);
1345 P = toPrimitive(P, true);
1346 anObject(Attributes);
1347 if(IE8_DOM_DEFINE)try {
1348 return dP(O, P, Attributes);
1349 } catch(e){ /* empty */ }
1350 if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
1351 if('value' in Attributes)O[P] = Attributes.value;
1352 return O;
1353};
1354},{"110":110,"28":28,"42":42,"7":7}],68:[function(_dereq_,module,exports){
1355var dP = _dereq_(67)
1356 , anObject = _dereq_(7)
1357 , getKeys = _dereq_(76);
1358
1359module.exports = _dereq_(28) ? Object.defineProperties : function defineProperties(O, Properties){
1360 anObject(O);
1361 var keys = getKeys(Properties)
1362 , length = keys.length
1363 , i = 0
1364 , P;
1365 while(length > i)dP.f(O, P = keys[i++], Properties[P]);
1366 return O;
1367};
1368},{"28":28,"67":67,"7":7,"76":76}],69:[function(_dereq_,module,exports){
1369// Forced replacement prototype accessors methods
1370module.exports = _dereq_(58)|| !_dereq_(34)(function(){
1371 var K = Math.random();
1372 // In FF throws only define methods
1373 __defineSetter__.call(null, K, function(){ /* empty */});
1374 delete _dereq_(38)[K];
1375});
1376},{"34":34,"38":38,"58":58}],70:[function(_dereq_,module,exports){
1377var pIE = _dereq_(77)
1378 , createDesc = _dereq_(85)
1379 , toIObject = _dereq_(107)
1380 , toPrimitive = _dereq_(110)
1381 , has = _dereq_(39)
1382 , IE8_DOM_DEFINE = _dereq_(42)
1383 , gOPD = Object.getOwnPropertyDescriptor;
1384
1385exports.f = _dereq_(28) ? gOPD : function getOwnPropertyDescriptor(O, P){
1386 O = toIObject(O);
1387 P = toPrimitive(P, true);
1388 if(IE8_DOM_DEFINE)try {
1389 return gOPD(O, P);
1390 } catch(e){ /* empty */ }
1391 if(has(O, P))return createDesc(!pIE.f.call(O, P), O[P]);
1392};
1393},{"107":107,"110":110,"28":28,"39":39,"42":42,"77":77,"85":85}],71:[function(_dereq_,module,exports){
1394// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
1395var toIObject = _dereq_(107)
1396 , gOPN = _dereq_(72).f
1397 , toString = {}.toString;
1398
1399var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
1400 ? Object.getOwnPropertyNames(window) : [];
1401
1402var getWindowNames = function(it){
1403 try {
1404 return gOPN(it);
1405 } catch(e){
1406 return windowNames.slice();
1407 }
1408};
1409
1410module.exports.f = function getOwnPropertyNames(it){
1411 return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
1412};
1413
1414},{"107":107,"72":72}],72:[function(_dereq_,module,exports){
1415// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
1416var $keys = _dereq_(75)
1417 , hiddenKeys = _dereq_(30).concat('length', 'prototype');
1418
1419exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O){
1420 return $keys(O, hiddenKeys);
1421};
1422},{"30":30,"75":75}],73:[function(_dereq_,module,exports){
1423exports.f = Object.getOwnPropertySymbols;
1424},{}],74:[function(_dereq_,module,exports){
1425// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
1426var has = _dereq_(39)
1427 , toObject = _dereq_(109)
1428 , IE_PROTO = _dereq_(93)('IE_PROTO')
1429 , ObjectProto = Object.prototype;
1430
1431module.exports = Object.getPrototypeOf || function(O){
1432 O = toObject(O);
1433 if(has(O, IE_PROTO))return O[IE_PROTO];
1434 if(typeof O.constructor == 'function' && O instanceof O.constructor){
1435 return O.constructor.prototype;
1436 } return O instanceof Object ? ObjectProto : null;
1437};
1438},{"109":109,"39":39,"93":93}],75:[function(_dereq_,module,exports){
1439var has = _dereq_(39)
1440 , toIObject = _dereq_(107)
1441 , arrayIndexOf = _dereq_(11)(false)
1442 , IE_PROTO = _dereq_(93)('IE_PROTO');
1443
1444module.exports = function(object, names){
1445 var O = toIObject(object)
1446 , i = 0
1447 , result = []
1448 , key;
1449 for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);
1450 // Don't enum bug & hidden keys
1451 while(names.length > i)if(has(O, key = names[i++])){
1452 ~arrayIndexOf(result, key) || result.push(key);
1453 }
1454 return result;
1455};
1456},{"107":107,"11":11,"39":39,"93":93}],76:[function(_dereq_,module,exports){
1457// 19.1.2.14 / 15.2.3.14 Object.keys(O)
1458var $keys = _dereq_(75)
1459 , enumBugKeys = _dereq_(30);
1460
1461module.exports = Object.keys || function keys(O){
1462 return $keys(O, enumBugKeys);
1463};
1464},{"30":30,"75":75}],77:[function(_dereq_,module,exports){
1465exports.f = {}.propertyIsEnumerable;
1466},{}],78:[function(_dereq_,module,exports){
1467// most Object methods by ES6 should accept primitives
1468var $export = _dereq_(32)
1469 , core = _dereq_(23)
1470 , fails = _dereq_(34);
1471module.exports = function(KEY, exec){
1472 var fn = (core.Object || {})[KEY] || Object[KEY]
1473 , exp = {};
1474 exp[KEY] = exec(fn);
1475 $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp);
1476};
1477},{"23":23,"32":32,"34":34}],79:[function(_dereq_,module,exports){
1478var getKeys = _dereq_(76)
1479 , toIObject = _dereq_(107)
1480 , isEnum = _dereq_(77).f;
1481module.exports = function(isEntries){
1482 return function(it){
1483 var O = toIObject(it)
1484 , keys = getKeys(O)
1485 , length = keys.length
1486 , i = 0
1487 , result = []
1488 , key;
1489 while(length > i)if(isEnum.call(O, key = keys[i++])){
1490 result.push(isEntries ? [key, O[key]] : O[key]);
1491 } return result;
1492 };
1493};
1494},{"107":107,"76":76,"77":77}],80:[function(_dereq_,module,exports){
1495// all object keys, includes non-enumerable and symbols
1496var gOPN = _dereq_(72)
1497 , gOPS = _dereq_(73)
1498 , anObject = _dereq_(7)
1499 , Reflect = _dereq_(38).Reflect;
1500module.exports = Reflect && Reflect.ownKeys || function ownKeys(it){
1501 var keys = gOPN.f(anObject(it))
1502 , getSymbols = gOPS.f;
1503 return getSymbols ? keys.concat(getSymbols(it)) : keys;
1504};
1505},{"38":38,"7":7,"72":72,"73":73}],81:[function(_dereq_,module,exports){
1506var $parseFloat = _dereq_(38).parseFloat
1507 , $trim = _dereq_(102).trim;
1508
1509module.exports = 1 / $parseFloat(_dereq_(103) + '-0') !== -Infinity ? function parseFloat(str){
1510 var string = $trim(String(str), 3)
1511 , result = $parseFloat(string);
1512 return result === 0 && string.charAt(0) == '-' ? -0 : result;
1513} : $parseFloat;
1514},{"102":102,"103":103,"38":38}],82:[function(_dereq_,module,exports){
1515var $parseInt = _dereq_(38).parseInt
1516 , $trim = _dereq_(102).trim
1517 , ws = _dereq_(103)
1518 , hex = /^[\-+]?0[xX]/;
1519
1520module.exports = $parseInt(ws + '08') !== 8 || $parseInt(ws + '0x16') !== 22 ? function parseInt(str, radix){
1521 var string = $trim(String(str), 3);
1522 return $parseInt(string, (radix >>> 0) || (hex.test(string) ? 16 : 10));
1523} : $parseInt;
1524},{"102":102,"103":103,"38":38}],83:[function(_dereq_,module,exports){
1525'use strict';
1526var path = _dereq_(84)
1527 , invoke = _dereq_(44)
1528 , aFunction = _dereq_(3);
1529module.exports = function(/* ...pargs */){
1530 var fn = aFunction(this)
1531 , length = arguments.length
1532 , pargs = Array(length)
1533 , i = 0
1534 , _ = path._
1535 , holder = false;
1536 while(length > i)if((pargs[i] = arguments[i++]) === _)holder = true;
1537 return function(/* ...args */){
1538 var that = this
1539 , aLen = arguments.length
1540 , j = 0, k = 0, args;
1541 if(!holder && !aLen)return invoke(fn, pargs, that);
1542 args = pargs.slice();
1543 if(holder)for(;length > j; j++)if(args[j] === _)args[j] = arguments[k++];
1544 while(aLen > k)args.push(arguments[k++]);
1545 return invoke(fn, args, that);
1546 };
1547};
1548},{"3":3,"44":44,"84":84}],84:[function(_dereq_,module,exports){
1549module.exports = _dereq_(38);
1550},{"38":38}],85:[function(_dereq_,module,exports){
1551module.exports = function(bitmap, value){
1552 return {
1553 enumerable : !(bitmap & 1),
1554 configurable: !(bitmap & 2),
1555 writable : !(bitmap & 4),
1556 value : value
1557 };
1558};
1559},{}],86:[function(_dereq_,module,exports){
1560var redefine = _dereq_(87);
1561module.exports = function(target, src, safe){
1562 for(var key in src)redefine(target, key, src[key], safe);
1563 return target;
1564};
1565},{"87":87}],87:[function(_dereq_,module,exports){
1566var global = _dereq_(38)
1567 , hide = _dereq_(40)
1568 , has = _dereq_(39)
1569 , SRC = _dereq_(114)('src')
1570 , TO_STRING = 'toString'
1571 , $toString = Function[TO_STRING]
1572 , TPL = ('' + $toString).split(TO_STRING);
1573
1574_dereq_(23).inspectSource = function(it){
1575 return $toString.call(it);
1576};
1577
1578(module.exports = function(O, key, val, safe){
1579 var isFunction = typeof val == 'function';
1580 if(isFunction)has(val, 'name') || hide(val, 'name', key);
1581 if(O[key] === val)return;
1582 if(isFunction)has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
1583 if(O === global){
1584 O[key] = val;
1585 } else {
1586 if(!safe){
1587 delete O[key];
1588 hide(O, key, val);
1589 } else {
1590 if(O[key])O[key] = val;
1591 else hide(O, key, val);
1592 }
1593 }
1594// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
1595})(Function.prototype, TO_STRING, function toString(){
1596 return typeof this == 'function' && this[SRC] || $toString.call(this);
1597});
1598},{"114":114,"23":23,"38":38,"39":39,"40":40}],88:[function(_dereq_,module,exports){
1599module.exports = function(regExp, replace){
1600 var replacer = replace === Object(replace) ? function(part){
1601 return replace[part];
1602 } : replace;
1603 return function(it){
1604 return String(it).replace(regExp, replacer);
1605 };
1606};
1607},{}],89:[function(_dereq_,module,exports){
1608// 7.2.9 SameValue(x, y)
1609module.exports = Object.is || function is(x, y){
1610 return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
1611};
1612},{}],90:[function(_dereq_,module,exports){
1613// Works with __proto__ only. Old v8 can't work with null proto objects.
1614/* eslint-disable no-proto */
1615var isObject = _dereq_(49)
1616 , anObject = _dereq_(7);
1617var check = function(O, proto){
1618 anObject(O);
1619 if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!");
1620};
1621module.exports = {
1622 set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
1623 function(test, buggy, set){
1624 try {
1625 set = _dereq_(25)(Function.call, _dereq_(70).f(Object.prototype, '__proto__').set, 2);
1626 set(test, []);
1627 buggy = !(test instanceof Array);
1628 } catch(e){ buggy = true; }
1629 return function setPrototypeOf(O, proto){
1630 check(O, proto);
1631 if(buggy)O.__proto__ = proto;
1632 else set(O, proto);
1633 return O;
1634 };
1635 }({}, false) : undefined),
1636 check: check
1637};
1638},{"25":25,"49":49,"7":7,"70":70}],91:[function(_dereq_,module,exports){
1639'use strict';
1640var global = _dereq_(38)
1641 , dP = _dereq_(67)
1642 , DESCRIPTORS = _dereq_(28)
1643 , SPECIES = _dereq_(117)('species');
1644
1645module.exports = function(KEY){
1646 var C = global[KEY];
1647 if(DESCRIPTORS && C && !C[SPECIES])dP.f(C, SPECIES, {
1648 configurable: true,
1649 get: function(){ return this; }
1650 });
1651};
1652},{"117":117,"28":28,"38":38,"67":67}],92:[function(_dereq_,module,exports){
1653var def = _dereq_(67).f
1654 , has = _dereq_(39)
1655 , TAG = _dereq_(117)('toStringTag');
1656
1657module.exports = function(it, tag, stat){
1658 if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});
1659};
1660},{"117":117,"39":39,"67":67}],93:[function(_dereq_,module,exports){
1661var shared = _dereq_(94)('keys')
1662 , uid = _dereq_(114);
1663module.exports = function(key){
1664 return shared[key] || (shared[key] = uid(key));
1665};
1666},{"114":114,"94":94}],94:[function(_dereq_,module,exports){
1667var global = _dereq_(38)
1668 , SHARED = '__core-js_shared__'
1669 , store = global[SHARED] || (global[SHARED] = {});
1670module.exports = function(key){
1671 return store[key] || (store[key] = {});
1672};
1673},{"38":38}],95:[function(_dereq_,module,exports){
1674// 7.3.20 SpeciesConstructor(O, defaultConstructor)
1675var anObject = _dereq_(7)
1676 , aFunction = _dereq_(3)
1677 , SPECIES = _dereq_(117)('species');
1678module.exports = function(O, D){
1679 var C = anObject(O).constructor, S;
1680 return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
1681};
1682},{"117":117,"3":3,"7":7}],96:[function(_dereq_,module,exports){
1683var fails = _dereq_(34);
1684
1685module.exports = function(method, arg){
1686 return !!method && fails(function(){
1687 arg ? method.call(null, function(){}, 1) : method.call(null);
1688 });
1689};
1690},{"34":34}],97:[function(_dereq_,module,exports){
1691var toInteger = _dereq_(106)
1692 , defined = _dereq_(27);
1693// true -> String#at
1694// false -> String#codePointAt
1695module.exports = function(TO_STRING){
1696 return function(that, pos){
1697 var s = String(defined(that))
1698 , i = toInteger(pos)
1699 , l = s.length
1700 , a, b;
1701 if(i < 0 || i >= l)return TO_STRING ? '' : undefined;
1702 a = s.charCodeAt(i);
1703 return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
1704 ? TO_STRING ? s.charAt(i) : a
1705 : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
1706 };
1707};
1708},{"106":106,"27":27}],98:[function(_dereq_,module,exports){
1709// helper for String#{startsWith, endsWith, includes}
1710var isRegExp = _dereq_(50)
1711 , defined = _dereq_(27);
1712
1713module.exports = function(that, searchString, NAME){
1714 if(isRegExp(searchString))throw TypeError('String#' + NAME + " doesn't accept regex!");
1715 return String(defined(that));
1716};
1717},{"27":27,"50":50}],99:[function(_dereq_,module,exports){
1718var $export = _dereq_(32)
1719 , fails = _dereq_(34)
1720 , defined = _dereq_(27)
1721 , quot = /"/g;
1722// B.2.3.2.1 CreateHTML(string, tag, attribute, value)
1723var createHTML = function(string, tag, attribute, value) {
1724 var S = String(defined(string))
1725 , p1 = '<' + tag;
1726 if(attribute !== '')p1 += ' ' + attribute + '="' + String(value).replace(quot, '&quot;') + '"';
1727 return p1 + '>' + S + '</' + tag + '>';
1728};
1729module.exports = function(NAME, exec){
1730 var O = {};
1731 O[NAME] = exec(createHTML);
1732 $export($export.P + $export.F * fails(function(){
1733 var test = ''[NAME]('"');
1734 return test !== test.toLowerCase() || test.split('"').length > 3;
1735 }), 'String', O);
1736};
1737},{"27":27,"32":32,"34":34}],100:[function(_dereq_,module,exports){
1738// https://github.com/tc39/proposal-string-pad-start-end
1739var toLength = _dereq_(108)
1740 , repeat = _dereq_(101)
1741 , defined = _dereq_(27);
1742
1743module.exports = function(that, maxLength, fillString, left){
1744 var S = String(defined(that))
1745 , stringLength = S.length
1746 , fillStr = fillString === undefined ? ' ' : String(fillString)
1747 , intMaxLength = toLength(maxLength);
1748 if(intMaxLength <= stringLength || fillStr == '')return S;
1749 var fillLen = intMaxLength - stringLength
1750 , stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length));
1751 if(stringFiller.length > fillLen)stringFiller = stringFiller.slice(0, fillLen);
1752 return left ? stringFiller + S : S + stringFiller;
1753};
1754
1755},{"101":101,"108":108,"27":27}],101:[function(_dereq_,module,exports){
1756'use strict';
1757var toInteger = _dereq_(106)
1758 , defined = _dereq_(27);
1759
1760module.exports = function repeat(count){
1761 var str = String(defined(this))
1762 , res = ''
1763 , n = toInteger(count);
1764 if(n < 0 || n == Infinity)throw RangeError("Count can't be negative");
1765 for(;n > 0; (n >>>= 1) && (str += str))if(n & 1)res += str;
1766 return res;
1767};
1768},{"106":106,"27":27}],102:[function(_dereq_,module,exports){
1769var $export = _dereq_(32)
1770 , defined = _dereq_(27)
1771 , fails = _dereq_(34)
1772 , spaces = _dereq_(103)
1773 , space = '[' + spaces + ']'
1774 , non = '\u200b\u0085'
1775 , ltrim = RegExp('^' + space + space + '*')
1776 , rtrim = RegExp(space + space + '*$');
1777
1778var exporter = function(KEY, exec, ALIAS){
1779 var exp = {};
1780 var FORCE = fails(function(){
1781 return !!spaces[KEY]() || non[KEY]() != non;
1782 });
1783 var fn = exp[KEY] = FORCE ? exec(trim) : spaces[KEY];
1784 if(ALIAS)exp[ALIAS] = fn;
1785 $export($export.P + $export.F * FORCE, 'String', exp);
1786};
1787
1788// 1 -> String#trimLeft
1789// 2 -> String#trimRight
1790// 3 -> String#trim
1791var trim = exporter.trim = function(string, TYPE){
1792 string = String(defined(string));
1793 if(TYPE & 1)string = string.replace(ltrim, '');
1794 if(TYPE & 2)string = string.replace(rtrim, '');
1795 return string;
1796};
1797
1798module.exports = exporter;
1799},{"103":103,"27":27,"32":32,"34":34}],103:[function(_dereq_,module,exports){
1800module.exports = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' +
1801 '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
1802},{}],104:[function(_dereq_,module,exports){
1803var ctx = _dereq_(25)
1804 , invoke = _dereq_(44)
1805 , html = _dereq_(41)
1806 , cel = _dereq_(29)
1807 , global = _dereq_(38)
1808 , process = global.process
1809 , setTask = global.setImmediate
1810 , clearTask = global.clearImmediate
1811 , MessageChannel = global.MessageChannel
1812 , counter = 0
1813 , queue = {}
1814 , ONREADYSTATECHANGE = 'onreadystatechange'
1815 , defer, channel, port;
1816var run = function(){
1817 var id = +this;
1818 if(queue.hasOwnProperty(id)){
1819 var fn = queue[id];
1820 delete queue[id];
1821 fn();
1822 }
1823};
1824var listener = function(event){
1825 run.call(event.data);
1826};
1827// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
1828if(!setTask || !clearTask){
1829 setTask = function setImmediate(fn){
1830 var args = [], i = 1;
1831 while(arguments.length > i)args.push(arguments[i++]);
1832 queue[++counter] = function(){
1833 invoke(typeof fn == 'function' ? fn : Function(fn), args);
1834 };
1835 defer(counter);
1836 return counter;
1837 };
1838 clearTask = function clearImmediate(id){
1839 delete queue[id];
1840 };
1841 // Node.js 0.8-
1842 if(_dereq_(18)(process) == 'process'){
1843 defer = function(id){
1844 process.nextTick(ctx(run, id, 1));
1845 };
1846 // Browsers with MessageChannel, includes WebWorkers
1847 } else if(MessageChannel){
1848 channel = new MessageChannel;
1849 port = channel.port2;
1850 channel.port1.onmessage = listener;
1851 defer = ctx(port.postMessage, port, 1);
1852 // Browsers with postMessage, skip WebWorkers
1853 // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
1854 } else if(global.addEventListener && typeof postMessage == 'function' && !global.importScripts){
1855 defer = function(id){
1856 global.postMessage(id + '', '*');
1857 };
1858 global.addEventListener('message', listener, false);
1859 // IE8-
1860 } else if(ONREADYSTATECHANGE in cel('script')){
1861 defer = function(id){
1862 html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function(){
1863 html.removeChild(this);
1864 run.call(id);
1865 };
1866 };
1867 // Rest old browsers
1868 } else {
1869 defer = function(id){
1870 setTimeout(ctx(run, id, 1), 0);
1871 };
1872 }
1873}
1874module.exports = {
1875 set: setTask,
1876 clear: clearTask
1877};
1878},{"18":18,"25":25,"29":29,"38":38,"41":41,"44":44}],105:[function(_dereq_,module,exports){
1879var toInteger = _dereq_(106)
1880 , max = Math.max
1881 , min = Math.min;
1882module.exports = function(index, length){
1883 index = toInteger(index);
1884 return index < 0 ? max(index + length, 0) : min(index, length);
1885};
1886},{"106":106}],106:[function(_dereq_,module,exports){
1887// 7.1.4 ToInteger
1888var ceil = Math.ceil
1889 , floor = Math.floor;
1890module.exports = function(it){
1891 return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
1892};
1893},{}],107:[function(_dereq_,module,exports){
1894// to indexed object, toObject with fallback for non-array-like ES3 strings
1895var IObject = _dereq_(45)
1896 , defined = _dereq_(27);
1897module.exports = function(it){
1898 return IObject(defined(it));
1899};
1900},{"27":27,"45":45}],108:[function(_dereq_,module,exports){
1901// 7.1.15 ToLength
1902var toInteger = _dereq_(106)
1903 , min = Math.min;
1904module.exports = function(it){
1905 return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
1906};
1907},{"106":106}],109:[function(_dereq_,module,exports){
1908// 7.1.13 ToObject(argument)
1909var defined = _dereq_(27);
1910module.exports = function(it){
1911 return Object(defined(it));
1912};
1913},{"27":27}],110:[function(_dereq_,module,exports){
1914// 7.1.1 ToPrimitive(input [, PreferredType])
1915var isObject = _dereq_(49);
1916// instead of the ES6 spec version, we didn't implement @@toPrimitive case
1917// and the second argument - flag - preferred type is a string
1918module.exports = function(it, S){
1919 if(!isObject(it))return it;
1920 var fn, val;
1921 if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
1922 if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;
1923 if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
1924 throw TypeError("Can't convert object to primitive value");
1925};
1926},{"49":49}],111:[function(_dereq_,module,exports){
1927'use strict';
1928if(_dereq_(28)){
1929 var LIBRARY = _dereq_(58)
1930 , global = _dereq_(38)
1931 , fails = _dereq_(34)
1932 , $export = _dereq_(32)
1933 , $typed = _dereq_(113)
1934 , $buffer = _dereq_(112)
1935 , ctx = _dereq_(25)
1936 , anInstance = _dereq_(6)
1937 , propertyDesc = _dereq_(85)
1938 , hide = _dereq_(40)
1939 , redefineAll = _dereq_(86)
1940 , toInteger = _dereq_(106)
1941 , toLength = _dereq_(108)
1942 , toIndex = _dereq_(105)
1943 , toPrimitive = _dereq_(110)
1944 , has = _dereq_(39)
1945 , same = _dereq_(89)
1946 , classof = _dereq_(17)
1947 , isObject = _dereq_(49)
1948 , toObject = _dereq_(109)
1949 , isArrayIter = _dereq_(46)
1950 , create = _dereq_(66)
1951 , getPrototypeOf = _dereq_(74)
1952 , gOPN = _dereq_(72).f
1953 , getIterFn = _dereq_(118)
1954 , uid = _dereq_(114)
1955 , wks = _dereq_(117)
1956 , createArrayMethod = _dereq_(12)
1957 , createArrayIncludes = _dereq_(11)
1958 , speciesConstructor = _dereq_(95)
1959 , ArrayIterators = _dereq_(130)
1960 , Iterators = _dereq_(56)
1961 , $iterDetect = _dereq_(54)
1962 , setSpecies = _dereq_(91)
1963 , arrayFill = _dereq_(9)
1964 , arrayCopyWithin = _dereq_(8)
1965 , $DP = _dereq_(67)
1966 , $GOPD = _dereq_(70)
1967 , dP = $DP.f
1968 , gOPD = $GOPD.f
1969 , RangeError = global.RangeError
1970 , TypeError = global.TypeError
1971 , Uint8Array = global.Uint8Array
1972 , ARRAY_BUFFER = 'ArrayBuffer'
1973 , SHARED_BUFFER = 'Shared' + ARRAY_BUFFER
1974 , BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT'
1975 , PROTOTYPE = 'prototype'
1976 , ArrayProto = Array[PROTOTYPE]
1977 , $ArrayBuffer = $buffer.ArrayBuffer
1978 , $DataView = $buffer.DataView
1979 , arrayForEach = createArrayMethod(0)
1980 , arrayFilter = createArrayMethod(2)
1981 , arraySome = createArrayMethod(3)
1982 , arrayEvery = createArrayMethod(4)
1983 , arrayFind = createArrayMethod(5)
1984 , arrayFindIndex = createArrayMethod(6)
1985 , arrayIncludes = createArrayIncludes(true)
1986 , arrayIndexOf = createArrayIncludes(false)
1987 , arrayValues = ArrayIterators.values
1988 , arrayKeys = ArrayIterators.keys
1989 , arrayEntries = ArrayIterators.entries
1990 , arrayLastIndexOf = ArrayProto.lastIndexOf
1991 , arrayReduce = ArrayProto.reduce
1992 , arrayReduceRight = ArrayProto.reduceRight
1993 , arrayJoin = ArrayProto.join
1994 , arraySort = ArrayProto.sort
1995 , arraySlice = ArrayProto.slice
1996 , arrayToString = ArrayProto.toString
1997 , arrayToLocaleString = ArrayProto.toLocaleString
1998 , ITERATOR = wks('iterator')
1999 , TAG = wks('toStringTag')
2000 , TYPED_CONSTRUCTOR = uid('typed_constructor')
2001 , DEF_CONSTRUCTOR = uid('def_constructor')
2002 , ALL_CONSTRUCTORS = $typed.CONSTR
2003 , TYPED_ARRAY = $typed.TYPED
2004 , VIEW = $typed.VIEW
2005 , WRONG_LENGTH = 'Wrong length!';
2006
2007 var $map = createArrayMethod(1, function(O, length){
2008 return allocate(speciesConstructor(O, O[DEF_CONSTRUCTOR]), length);
2009 });
2010
2011 var LITTLE_ENDIAN = fails(function(){
2012 return new Uint8Array(new Uint16Array([1]).buffer)[0] === 1;
2013 });
2014
2015 var FORCED_SET = !!Uint8Array && !!Uint8Array[PROTOTYPE].set && fails(function(){
2016 new Uint8Array(1).set({});
2017 });
2018
2019 var strictToLength = function(it, SAME){
2020 if(it === undefined)throw TypeError(WRONG_LENGTH);
2021 var number = +it
2022 , length = toLength(it);
2023 if(SAME && !same(number, length))throw RangeError(WRONG_LENGTH);
2024 return length;
2025 };
2026
2027 var toOffset = function(it, BYTES){
2028 var offset = toInteger(it);
2029 if(offset < 0 || offset % BYTES)throw RangeError('Wrong offset!');
2030 return offset;
2031 };
2032
2033 var validate = function(it){
2034 if(isObject(it) && TYPED_ARRAY in it)return it;
2035 throw TypeError(it + ' is not a typed array!');
2036 };
2037
2038 var allocate = function(C, length){
2039 if(!(isObject(C) && TYPED_CONSTRUCTOR in C)){
2040 throw TypeError('It is not a typed array constructor!');
2041 } return new C(length);
2042 };
2043
2044 var speciesFromList = function(O, list){
2045 return fromList(speciesConstructor(O, O[DEF_CONSTRUCTOR]), list);
2046 };
2047
2048 var fromList = function(C, list){
2049 var index = 0
2050 , length = list.length
2051 , result = allocate(C, length);
2052 while(length > index)result[index] = list[index++];
2053 return result;
2054 };
2055
2056 var addGetter = function(it, key, internal){
2057 dP(it, key, {get: function(){ return this._d[internal]; }});
2058 };
2059
2060 var $from = function from(source /*, mapfn, thisArg */){
2061 var O = toObject(source)
2062 , aLen = arguments.length
2063 , mapfn = aLen > 1 ? arguments[1] : undefined
2064 , mapping = mapfn !== undefined
2065 , iterFn = getIterFn(O)
2066 , i, length, values, result, step, iterator;
2067 if(iterFn != undefined && !isArrayIter(iterFn)){
2068 for(iterator = iterFn.call(O), values = [], i = 0; !(step = iterator.next()).done; i++){
2069 values.push(step.value);
2070 } O = values;
2071 }
2072 if(mapping && aLen > 2)mapfn = ctx(mapfn, arguments[2], 2);
2073 for(i = 0, length = toLength(O.length), result = allocate(this, length); length > i; i++){
2074 result[i] = mapping ? mapfn(O[i], i) : O[i];
2075 }
2076 return result;
2077 };
2078
2079 var $of = function of(/*...items*/){
2080 var index = 0
2081 , length = arguments.length
2082 , result = allocate(this, length);
2083 while(length > index)result[index] = arguments[index++];
2084 return result;
2085 };
2086
2087 // iOS Safari 6.x fails here
2088 var TO_LOCALE_BUG = !!Uint8Array && fails(function(){ arrayToLocaleString.call(new Uint8Array(1)); });
2089
2090 var $toLocaleString = function toLocaleString(){
2091 return arrayToLocaleString.apply(TO_LOCALE_BUG ? arraySlice.call(validate(this)) : validate(this), arguments);
2092 };
2093
2094 var proto = {
2095 copyWithin: function copyWithin(target, start /*, end */){
2096 return arrayCopyWithin.call(validate(this), target, start, arguments.length > 2 ? arguments[2] : undefined);
2097 },
2098 every: function every(callbackfn /*, thisArg */){
2099 return arrayEvery(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2100 },
2101 fill: function fill(value /*, start, end */){ // eslint-disable-line no-unused-vars
2102 return arrayFill.apply(validate(this), arguments);
2103 },
2104 filter: function filter(callbackfn /*, thisArg */){
2105 return speciesFromList(this, arrayFilter(validate(this), callbackfn,
2106 arguments.length > 1 ? arguments[1] : undefined));
2107 },
2108 find: function find(predicate /*, thisArg */){
2109 return arrayFind(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
2110 },
2111 findIndex: function findIndex(predicate /*, thisArg */){
2112 return arrayFindIndex(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
2113 },
2114 forEach: function forEach(callbackfn /*, thisArg */){
2115 arrayForEach(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2116 },
2117 indexOf: function indexOf(searchElement /*, fromIndex */){
2118 return arrayIndexOf(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
2119 },
2120 includes: function includes(searchElement /*, fromIndex */){
2121 return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
2122 },
2123 join: function join(separator){ // eslint-disable-line no-unused-vars
2124 return arrayJoin.apply(validate(this), arguments);
2125 },
2126 lastIndexOf: function lastIndexOf(searchElement /*, fromIndex */){ // eslint-disable-line no-unused-vars
2127 return arrayLastIndexOf.apply(validate(this), arguments);
2128 },
2129 map: function map(mapfn /*, thisArg */){
2130 return $map(validate(this), mapfn, arguments.length > 1 ? arguments[1] : undefined);
2131 },
2132 reduce: function reduce(callbackfn /*, initialValue */){ // eslint-disable-line no-unused-vars
2133 return arrayReduce.apply(validate(this), arguments);
2134 },
2135 reduceRight: function reduceRight(callbackfn /*, initialValue */){ // eslint-disable-line no-unused-vars
2136 return arrayReduceRight.apply(validate(this), arguments);
2137 },
2138 reverse: function reverse(){
2139 var that = this
2140 , length = validate(that).length
2141 , middle = Math.floor(length / 2)
2142 , index = 0
2143 , value;
2144 while(index < middle){
2145 value = that[index];
2146 that[index++] = that[--length];
2147 that[length] = value;
2148 } return that;
2149 },
2150 some: function some(callbackfn /*, thisArg */){
2151 return arraySome(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2152 },
2153 sort: function sort(comparefn){
2154 return arraySort.call(validate(this), comparefn);
2155 },
2156 subarray: function subarray(begin, end){
2157 var O = validate(this)
2158 , length = O.length
2159 , $begin = toIndex(begin, length);
2160 return new (speciesConstructor(O, O[DEF_CONSTRUCTOR]))(
2161 O.buffer,
2162 O.byteOffset + $begin * O.BYTES_PER_ELEMENT,
2163 toLength((end === undefined ? length : toIndex(end, length)) - $begin)
2164 );
2165 }
2166 };
2167
2168 var $slice = function slice(start, end){
2169 return speciesFromList(this, arraySlice.call(validate(this), start, end));
2170 };
2171
2172 var $set = function set(arrayLike /*, offset */){
2173 validate(this);
2174 var offset = toOffset(arguments[1], 1)
2175 , length = this.length
2176 , src = toObject(arrayLike)
2177 , len = toLength(src.length)
2178 , index = 0;
2179 if(len + offset > length)throw RangeError(WRONG_LENGTH);
2180 while(index < len)this[offset + index] = src[index++];
2181 };
2182
2183 var $iterators = {
2184 entries: function entries(){
2185 return arrayEntries.call(validate(this));
2186 },
2187 keys: function keys(){
2188 return arrayKeys.call(validate(this));
2189 },
2190 values: function values(){
2191 return arrayValues.call(validate(this));
2192 }
2193 };
2194
2195 var isTAIndex = function(target, key){
2196 return isObject(target)
2197 && target[TYPED_ARRAY]
2198 && typeof key != 'symbol'
2199 && key in target
2200 && String(+key) == String(key);
2201 };
2202 var $getDesc = function getOwnPropertyDescriptor(target, key){
2203 return isTAIndex(target, key = toPrimitive(key, true))
2204 ? propertyDesc(2, target[key])
2205 : gOPD(target, key);
2206 };
2207 var $setDesc = function defineProperty(target, key, desc){
2208 if(isTAIndex(target, key = toPrimitive(key, true))
2209 && isObject(desc)
2210 && has(desc, 'value')
2211 && !has(desc, 'get')
2212 && !has(desc, 'set')
2213 // TODO: add validation descriptor w/o calling accessors
2214 && !desc.configurable
2215 && (!has(desc, 'writable') || desc.writable)
2216 && (!has(desc, 'enumerable') || desc.enumerable)
2217 ){
2218 target[key] = desc.value;
2219 return target;
2220 } else return dP(target, key, desc);
2221 };
2222
2223 if(!ALL_CONSTRUCTORS){
2224 $GOPD.f = $getDesc;
2225 $DP.f = $setDesc;
2226 }
2227
2228 $export($export.S + $export.F * !ALL_CONSTRUCTORS, 'Object', {
2229 getOwnPropertyDescriptor: $getDesc,
2230 defineProperty: $setDesc
2231 });
2232
2233 if(fails(function(){ arrayToString.call({}); })){
2234 arrayToString = arrayToLocaleString = function toString(){
2235 return arrayJoin.call(this);
2236 }
2237 }
2238
2239 var $TypedArrayPrototype$ = redefineAll({}, proto);
2240 redefineAll($TypedArrayPrototype$, $iterators);
2241 hide($TypedArrayPrototype$, ITERATOR, $iterators.values);
2242 redefineAll($TypedArrayPrototype$, {
2243 slice: $slice,
2244 set: $set,
2245 constructor: function(){ /* noop */ },
2246 toString: arrayToString,
2247 toLocaleString: $toLocaleString
2248 });
2249 addGetter($TypedArrayPrototype$, 'buffer', 'b');
2250 addGetter($TypedArrayPrototype$, 'byteOffset', 'o');
2251 addGetter($TypedArrayPrototype$, 'byteLength', 'l');
2252 addGetter($TypedArrayPrototype$, 'length', 'e');
2253 dP($TypedArrayPrototype$, TAG, {
2254 get: function(){ return this[TYPED_ARRAY]; }
2255 });
2256
2257 module.exports = function(KEY, BYTES, wrapper, CLAMPED){
2258 CLAMPED = !!CLAMPED;
2259 var NAME = KEY + (CLAMPED ? 'Clamped' : '') + 'Array'
2260 , ISNT_UINT8 = NAME != 'Uint8Array'
2261 , GETTER = 'get' + KEY
2262 , SETTER = 'set' + KEY
2263 , TypedArray = global[NAME]
2264 , Base = TypedArray || {}
2265 , TAC = TypedArray && getPrototypeOf(TypedArray)
2266 , FORCED = !TypedArray || !$typed.ABV
2267 , O = {}
2268 , TypedArrayPrototype = TypedArray && TypedArray[PROTOTYPE];
2269 var getter = function(that, index){
2270 var data = that._d;
2271 return data.v[GETTER](index * BYTES + data.o, LITTLE_ENDIAN);
2272 };
2273 var setter = function(that, index, value){
2274 var data = that._d;
2275 if(CLAMPED)value = (value = Math.round(value)) < 0 ? 0 : value > 0xff ? 0xff : value & 0xff;
2276 data.v[SETTER](index * BYTES + data.o, value, LITTLE_ENDIAN);
2277 };
2278 var addElement = function(that, index){
2279 dP(that, index, {
2280 get: function(){
2281 return getter(this, index);
2282 },
2283 set: function(value){
2284 return setter(this, index, value);
2285 },
2286 enumerable: true
2287 });
2288 };
2289 if(FORCED){
2290 TypedArray = wrapper(function(that, data, $offset, $length){
2291 anInstance(that, TypedArray, NAME, '_d');
2292 var index = 0
2293 , offset = 0
2294 , buffer, byteLength, length, klass;
2295 if(!isObject(data)){
2296 length = strictToLength(data, true)
2297 byteLength = length * BYTES;
2298 buffer = new $ArrayBuffer(byteLength);
2299 } else if(data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER){
2300 buffer = data;
2301 offset = toOffset($offset, BYTES);
2302 var $len = data.byteLength;
2303 if($length === undefined){
2304 if($len % BYTES)throw RangeError(WRONG_LENGTH);
2305 byteLength = $len - offset;
2306 if(byteLength < 0)throw RangeError(WRONG_LENGTH);
2307 } else {
2308 byteLength = toLength($length) * BYTES;
2309 if(byteLength + offset > $len)throw RangeError(WRONG_LENGTH);
2310 }
2311 length = byteLength / BYTES;
2312 } else if(TYPED_ARRAY in data){
2313 return fromList(TypedArray, data);
2314 } else {
2315 return $from.call(TypedArray, data);
2316 }
2317 hide(that, '_d', {
2318 b: buffer,
2319 o: offset,
2320 l: byteLength,
2321 e: length,
2322 v: new $DataView(buffer)
2323 });
2324 while(index < length)addElement(that, index++);
2325 });
2326 TypedArrayPrototype = TypedArray[PROTOTYPE] = create($TypedArrayPrototype$);
2327 hide(TypedArrayPrototype, 'constructor', TypedArray);
2328 } else if(!$iterDetect(function(iter){
2329 // V8 works with iterators, but fails in many other cases
2330 // https://code.google.com/p/v8/issues/detail?id=4552
2331 new TypedArray(null); // eslint-disable-line no-new
2332 new TypedArray(iter); // eslint-disable-line no-new
2333 }, true)){
2334 TypedArray = wrapper(function(that, data, $offset, $length){
2335 anInstance(that, TypedArray, NAME);
2336 var klass;
2337 // `ws` module bug, temporarily remove validation length for Uint8Array
2338 // https://github.com/websockets/ws/pull/645
2339 if(!isObject(data))return new Base(strictToLength(data, ISNT_UINT8));
2340 if(data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER){
2341 return $length !== undefined
2342 ? new Base(data, toOffset($offset, BYTES), $length)
2343 : $offset !== undefined
2344 ? new Base(data, toOffset($offset, BYTES))
2345 : new Base(data);
2346 }
2347 if(TYPED_ARRAY in data)return fromList(TypedArray, data);
2348 return $from.call(TypedArray, data);
2349 });
2350 arrayForEach(TAC !== Function.prototype ? gOPN(Base).concat(gOPN(TAC)) : gOPN(Base), function(key){
2351 if(!(key in TypedArray))hide(TypedArray, key, Base[key]);
2352 });
2353 TypedArray[PROTOTYPE] = TypedArrayPrototype;
2354 if(!LIBRARY)TypedArrayPrototype.constructor = TypedArray;
2355 }
2356 var $nativeIterator = TypedArrayPrototype[ITERATOR]
2357 , CORRECT_ITER_NAME = !!$nativeIterator && ($nativeIterator.name == 'values' || $nativeIterator.name == undefined)
2358 , $iterator = $iterators.values;
2359 hide(TypedArray, TYPED_CONSTRUCTOR, true);
2360 hide(TypedArrayPrototype, TYPED_ARRAY, NAME);
2361 hide(TypedArrayPrototype, VIEW, true);
2362 hide(TypedArrayPrototype, DEF_CONSTRUCTOR, TypedArray);
2363
2364 if(CLAMPED ? new TypedArray(1)[TAG] != NAME : !(TAG in TypedArrayPrototype)){
2365 dP(TypedArrayPrototype, TAG, {
2366 get: function(){ return NAME; }
2367 });
2368 }
2369
2370 O[NAME] = TypedArray;
2371
2372 $export($export.G + $export.W + $export.F * (TypedArray != Base), O);
2373
2374 $export($export.S, NAME, {
2375 BYTES_PER_ELEMENT: BYTES,
2376 from: $from,
2377 of: $of
2378 });
2379
2380 if(!(BYTES_PER_ELEMENT in TypedArrayPrototype))hide(TypedArrayPrototype, BYTES_PER_ELEMENT, BYTES);
2381
2382 $export($export.P, NAME, proto);
2383
2384 setSpecies(NAME);
2385
2386 $export($export.P + $export.F * FORCED_SET, NAME, {set: $set});
2387
2388 $export($export.P + $export.F * !CORRECT_ITER_NAME, NAME, $iterators);
2389
2390 $export($export.P + $export.F * (TypedArrayPrototype.toString != arrayToString), NAME, {toString: arrayToString});
2391
2392 $export($export.P + $export.F * fails(function(){
2393 new TypedArray(1).slice();
2394 }), NAME, {slice: $slice});
2395
2396 $export($export.P + $export.F * (fails(function(){
2397 return [1, 2].toLocaleString() != new TypedArray([1, 2]).toLocaleString()
2398 }) || !fails(function(){
2399 TypedArrayPrototype.toLocaleString.call([1, 2]);
2400 })), NAME, {toLocaleString: $toLocaleString});
2401
2402 Iterators[NAME] = CORRECT_ITER_NAME ? $nativeIterator : $iterator;
2403 if(!LIBRARY && !CORRECT_ITER_NAME)hide(TypedArrayPrototype, ITERATOR, $iterator);
2404 };
2405} else module.exports = function(){ /* empty */ };
2406},{"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){
2407'use strict';
2408var global = _dereq_(38)
2409 , DESCRIPTORS = _dereq_(28)
2410 , LIBRARY = _dereq_(58)
2411 , $typed = _dereq_(113)
2412 , hide = _dereq_(40)
2413 , redefineAll = _dereq_(86)
2414 , fails = _dereq_(34)
2415 , anInstance = _dereq_(6)
2416 , toInteger = _dereq_(106)
2417 , toLength = _dereq_(108)
2418 , gOPN = _dereq_(72).f
2419 , dP = _dereq_(67).f
2420 , arrayFill = _dereq_(9)
2421 , setToStringTag = _dereq_(92)
2422 , ARRAY_BUFFER = 'ArrayBuffer'
2423 , DATA_VIEW = 'DataView'
2424 , PROTOTYPE = 'prototype'
2425 , WRONG_LENGTH = 'Wrong length!'
2426 , WRONG_INDEX = 'Wrong index!'
2427 , $ArrayBuffer = global[ARRAY_BUFFER]
2428 , $DataView = global[DATA_VIEW]
2429 , Math = global.Math
2430 , RangeError = global.RangeError
2431 , Infinity = global.Infinity
2432 , BaseBuffer = $ArrayBuffer
2433 , abs = Math.abs
2434 , pow = Math.pow
2435 , floor = Math.floor
2436 , log = Math.log
2437 , LN2 = Math.LN2
2438 , BUFFER = 'buffer'
2439 , BYTE_LENGTH = 'byteLength'
2440 , BYTE_OFFSET = 'byteOffset'
2441 , $BUFFER = DESCRIPTORS ? '_b' : BUFFER
2442 , $LENGTH = DESCRIPTORS ? '_l' : BYTE_LENGTH
2443 , $OFFSET = DESCRIPTORS ? '_o' : BYTE_OFFSET;
2444
2445// IEEE754 conversions based on https://github.com/feross/ieee754
2446var packIEEE754 = function(value, mLen, nBytes){
2447 var buffer = Array(nBytes)
2448 , eLen = nBytes * 8 - mLen - 1
2449 , eMax = (1 << eLen) - 1
2450 , eBias = eMax >> 1
2451 , rt = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0
2452 , i = 0
2453 , s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0
2454 , e, m, c;
2455 value = abs(value)
2456 if(value != value || value === Infinity){
2457 m = value != value ? 1 : 0;
2458 e = eMax;
2459 } else {
2460 e = floor(log(value) / LN2);
2461 if(value * (c = pow(2, -e)) < 1){
2462 e--;
2463 c *= 2;
2464 }
2465 if(e + eBias >= 1){
2466 value += rt / c;
2467 } else {
2468 value += rt * pow(2, 1 - eBias);
2469 }
2470 if(value * c >= 2){
2471 e++;
2472 c /= 2;
2473 }
2474 if(e + eBias >= eMax){
2475 m = 0;
2476 e = eMax;
2477 } else if(e + eBias >= 1){
2478 m = (value * c - 1) * pow(2, mLen);
2479 e = e + eBias;
2480 } else {
2481 m = value * pow(2, eBias - 1) * pow(2, mLen);
2482 e = 0;
2483 }
2484 }
2485 for(; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8);
2486 e = e << mLen | m;
2487 eLen += mLen;
2488 for(; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8);
2489 buffer[--i] |= s * 128;
2490 return buffer;
2491};
2492var unpackIEEE754 = function(buffer, mLen, nBytes){
2493 var eLen = nBytes * 8 - mLen - 1
2494 , eMax = (1 << eLen) - 1
2495 , eBias = eMax >> 1
2496 , nBits = eLen - 7
2497 , i = nBytes - 1
2498 , s = buffer[i--]
2499 , e = s & 127
2500 , m;
2501 s >>= 7;
2502 for(; nBits > 0; e = e * 256 + buffer[i], i--, nBits -= 8);
2503 m = e & (1 << -nBits) - 1;
2504 e >>= -nBits;
2505 nBits += mLen;
2506 for(; nBits > 0; m = m * 256 + buffer[i], i--, nBits -= 8);
2507 if(e === 0){
2508 e = 1 - eBias;
2509 } else if(e === eMax){
2510 return m ? NaN : s ? -Infinity : Infinity;
2511 } else {
2512 m = m + pow(2, mLen);
2513 e = e - eBias;
2514 } return (s ? -1 : 1) * m * pow(2, e - mLen);
2515};
2516
2517var unpackI32 = function(bytes){
2518 return bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0];
2519};
2520var packI8 = function(it){
2521 return [it & 0xff];
2522};
2523var packI16 = function(it){
2524 return [it & 0xff, it >> 8 & 0xff];
2525};
2526var packI32 = function(it){
2527 return [it & 0xff, it >> 8 & 0xff, it >> 16 & 0xff, it >> 24 & 0xff];
2528};
2529var packF64 = function(it){
2530 return packIEEE754(it, 52, 8);
2531};
2532var packF32 = function(it){
2533 return packIEEE754(it, 23, 4);
2534};
2535
2536var addGetter = function(C, key, internal){
2537 dP(C[PROTOTYPE], key, {get: function(){ return this[internal]; }});
2538};
2539
2540var get = function(view, bytes, index, isLittleEndian){
2541 var numIndex = +index
2542 , intIndex = toInteger(numIndex);
2543 if(numIndex != intIndex || intIndex < 0 || intIndex + bytes > view[$LENGTH])throw RangeError(WRONG_INDEX);
2544 var store = view[$BUFFER]._b
2545 , start = intIndex + view[$OFFSET]
2546 , pack = store.slice(start, start + bytes);
2547 return isLittleEndian ? pack : pack.reverse();
2548};
2549var set = function(view, bytes, index, conversion, value, isLittleEndian){
2550 var numIndex = +index
2551 , intIndex = toInteger(numIndex);
2552 if(numIndex != intIndex || intIndex < 0 || intIndex + bytes > view[$LENGTH])throw RangeError(WRONG_INDEX);
2553 var store = view[$BUFFER]._b
2554 , start = intIndex + view[$OFFSET]
2555 , pack = conversion(+value);
2556 for(var i = 0; i < bytes; i++)store[start + i] = pack[isLittleEndian ? i : bytes - i - 1];
2557};
2558
2559var validateArrayBufferArguments = function(that, length){
2560 anInstance(that, $ArrayBuffer, ARRAY_BUFFER);
2561 var numberLength = +length
2562 , byteLength = toLength(numberLength);
2563 if(numberLength != byteLength)throw RangeError(WRONG_LENGTH);
2564 return byteLength;
2565};
2566
2567if(!$typed.ABV){
2568 $ArrayBuffer = function ArrayBuffer(length){
2569 var byteLength = validateArrayBufferArguments(this, length);
2570 this._b = arrayFill.call(Array(byteLength), 0);
2571 this[$LENGTH] = byteLength;
2572 };
2573
2574 $DataView = function DataView(buffer, byteOffset, byteLength){
2575 anInstance(this, $DataView, DATA_VIEW);
2576 anInstance(buffer, $ArrayBuffer, DATA_VIEW);
2577 var bufferLength = buffer[$LENGTH]
2578 , offset = toInteger(byteOffset);
2579 if(offset < 0 || offset > bufferLength)throw RangeError('Wrong offset!');
2580 byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength);
2581 if(offset + byteLength > bufferLength)throw RangeError(WRONG_LENGTH);
2582 this[$BUFFER] = buffer;
2583 this[$OFFSET] = offset;
2584 this[$LENGTH] = byteLength;
2585 };
2586
2587 if(DESCRIPTORS){
2588 addGetter($ArrayBuffer, BYTE_LENGTH, '_l');
2589 addGetter($DataView, BUFFER, '_b');
2590 addGetter($DataView, BYTE_LENGTH, '_l');
2591 addGetter($DataView, BYTE_OFFSET, '_o');
2592 }
2593
2594 redefineAll($DataView[PROTOTYPE], {
2595 getInt8: function getInt8(byteOffset){
2596 return get(this, 1, byteOffset)[0] << 24 >> 24;
2597 },
2598 getUint8: function getUint8(byteOffset){
2599 return get(this, 1, byteOffset)[0];
2600 },
2601 getInt16: function getInt16(byteOffset /*, littleEndian */){
2602 var bytes = get(this, 2, byteOffset, arguments[1]);
2603 return (bytes[1] << 8 | bytes[0]) << 16 >> 16;
2604 },
2605 getUint16: function getUint16(byteOffset /*, littleEndian */){
2606 var bytes = get(this, 2, byteOffset, arguments[1]);
2607 return bytes[1] << 8 | bytes[0];
2608 },
2609 getInt32: function getInt32(byteOffset /*, littleEndian */){
2610 return unpackI32(get(this, 4, byteOffset, arguments[1]));
2611 },
2612 getUint32: function getUint32(byteOffset /*, littleEndian */){
2613 return unpackI32(get(this, 4, byteOffset, arguments[1])) >>> 0;
2614 },
2615 getFloat32: function getFloat32(byteOffset /*, littleEndian */){
2616 return unpackIEEE754(get(this, 4, byteOffset, arguments[1]), 23, 4);
2617 },
2618 getFloat64: function getFloat64(byteOffset /*, littleEndian */){
2619 return unpackIEEE754(get(this, 8, byteOffset, arguments[1]), 52, 8);
2620 },
2621 setInt8: function setInt8(byteOffset, value){
2622 set(this, 1, byteOffset, packI8, value);
2623 },
2624 setUint8: function setUint8(byteOffset, value){
2625 set(this, 1, byteOffset, packI8, value);
2626 },
2627 setInt16: function setInt16(byteOffset, value /*, littleEndian */){
2628 set(this, 2, byteOffset, packI16, value, arguments[2]);
2629 },
2630 setUint16: function setUint16(byteOffset, value /*, littleEndian */){
2631 set(this, 2, byteOffset, packI16, value, arguments[2]);
2632 },
2633 setInt32: function setInt32(byteOffset, value /*, littleEndian */){
2634 set(this, 4, byteOffset, packI32, value, arguments[2]);
2635 },
2636 setUint32: function setUint32(byteOffset, value /*, littleEndian */){
2637 set(this, 4, byteOffset, packI32, value, arguments[2]);
2638 },
2639 setFloat32: function setFloat32(byteOffset, value /*, littleEndian */){
2640 set(this, 4, byteOffset, packF32, value, arguments[2]);
2641 },
2642 setFloat64: function setFloat64(byteOffset, value /*, littleEndian */){
2643 set(this, 8, byteOffset, packF64, value, arguments[2]);
2644 }
2645 });
2646} else {
2647 if(!fails(function(){
2648 new $ArrayBuffer; // eslint-disable-line no-new
2649 }) || !fails(function(){
2650 new $ArrayBuffer(.5); // eslint-disable-line no-new
2651 })){
2652 $ArrayBuffer = function ArrayBuffer(length){
2653 return new BaseBuffer(validateArrayBufferArguments(this, length));
2654 };
2655 var ArrayBufferProto = $ArrayBuffer[PROTOTYPE] = BaseBuffer[PROTOTYPE];
2656 for(var keys = gOPN(BaseBuffer), j = 0, key; keys.length > j; ){
2657 if(!((key = keys[j++]) in $ArrayBuffer))hide($ArrayBuffer, key, BaseBuffer[key]);
2658 };
2659 if(!LIBRARY)ArrayBufferProto.constructor = $ArrayBuffer;
2660 }
2661 // iOS Safari 7.x bug
2662 var view = new $DataView(new $ArrayBuffer(2))
2663 , $setInt8 = $DataView[PROTOTYPE].setInt8;
2664 view.setInt8(0, 2147483648);
2665 view.setInt8(1, 2147483649);
2666 if(view.getInt8(0) || !view.getInt8(1))redefineAll($DataView[PROTOTYPE], {
2667 setInt8: function setInt8(byteOffset, value){
2668 $setInt8.call(this, byteOffset, value << 24 >> 24);
2669 },
2670 setUint8: function setUint8(byteOffset, value){
2671 $setInt8.call(this, byteOffset, value << 24 >> 24);
2672 }
2673 }, true);
2674}
2675setToStringTag($ArrayBuffer, ARRAY_BUFFER);
2676setToStringTag($DataView, DATA_VIEW);
2677hide($DataView[PROTOTYPE], $typed.VIEW, true);
2678exports[ARRAY_BUFFER] = $ArrayBuffer;
2679exports[DATA_VIEW] = $DataView;
2680},{"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){
2681var global = _dereq_(38)
2682 , hide = _dereq_(40)
2683 , uid = _dereq_(114)
2684 , TYPED = uid('typed_array')
2685 , VIEW = uid('view')
2686 , ABV = !!(global.ArrayBuffer && global.DataView)
2687 , CONSTR = ABV
2688 , i = 0, l = 9, Typed;
2689
2690var TypedArrayConstructors = (
2691 'Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array'
2692).split(',');
2693
2694while(i < l){
2695 if(Typed = global[TypedArrayConstructors[i++]]){
2696 hide(Typed.prototype, TYPED, true);
2697 hide(Typed.prototype, VIEW, true);
2698 } else CONSTR = false;
2699}
2700
2701module.exports = {
2702 ABV: ABV,
2703 CONSTR: CONSTR,
2704 TYPED: TYPED,
2705 VIEW: VIEW
2706};
2707},{"114":114,"38":38,"40":40}],114:[function(_dereq_,module,exports){
2708var id = 0
2709 , px = Math.random();
2710module.exports = function(key){
2711 return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
2712};
2713},{}],115:[function(_dereq_,module,exports){
2714var global = _dereq_(38)
2715 , core = _dereq_(23)
2716 , LIBRARY = _dereq_(58)
2717 , wksExt = _dereq_(116)
2718 , defineProperty = _dereq_(67).f;
2719module.exports = function(name){
2720 var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
2721 if(name.charAt(0) != '_' && !(name in $Symbol))defineProperty($Symbol, name, {value: wksExt.f(name)});
2722};
2723},{"116":116,"23":23,"38":38,"58":58,"67":67}],116:[function(_dereq_,module,exports){
2724exports.f = _dereq_(117);
2725},{"117":117}],117:[function(_dereq_,module,exports){
2726var store = _dereq_(94)('wks')
2727 , uid = _dereq_(114)
2728 , Symbol = _dereq_(38).Symbol
2729 , USE_SYMBOL = typeof Symbol == 'function';
2730
2731var $exports = module.exports = function(name){
2732 return store[name] || (store[name] =
2733 USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
2734};
2735
2736$exports.store = store;
2737},{"114":114,"38":38,"94":94}],118:[function(_dereq_,module,exports){
2738var classof = _dereq_(17)
2739 , ITERATOR = _dereq_(117)('iterator')
2740 , Iterators = _dereq_(56);
2741module.exports = _dereq_(23).getIteratorMethod = function(it){
2742 if(it != undefined)return it[ITERATOR]
2743 || it['@@iterator']
2744 || Iterators[classof(it)];
2745};
2746},{"117":117,"17":17,"23":23,"56":56}],119:[function(_dereq_,module,exports){
2747// https://github.com/benjamingr/RexExp.escape
2748var $export = _dereq_(32)
2749 , $re = _dereq_(88)(/[\\^$*+?.()|[\]{}]/g, '\\$&');
2750
2751$export($export.S, 'RegExp', {escape: function escape(it){ return $re(it); }});
2752
2753},{"32":32,"88":88}],120:[function(_dereq_,module,exports){
2754// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
2755var $export = _dereq_(32);
2756
2757$export($export.P, 'Array', {copyWithin: _dereq_(8)});
2758
2759_dereq_(5)('copyWithin');
2760},{"32":32,"5":5,"8":8}],121:[function(_dereq_,module,exports){
2761'use strict';
2762var $export = _dereq_(32)
2763 , $every = _dereq_(12)(4);
2764
2765$export($export.P + $export.F * !_dereq_(96)([].every, true), 'Array', {
2766 // 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg])
2767 every: function every(callbackfn /* , thisArg */){
2768 return $every(this, callbackfn, arguments[1]);
2769 }
2770});
2771},{"12":12,"32":32,"96":96}],122:[function(_dereq_,module,exports){
2772// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
2773var $export = _dereq_(32);
2774
2775$export($export.P, 'Array', {fill: _dereq_(9)});
2776
2777_dereq_(5)('fill');
2778},{"32":32,"5":5,"9":9}],123:[function(_dereq_,module,exports){
2779'use strict';
2780var $export = _dereq_(32)
2781 , $filter = _dereq_(12)(2);
2782
2783$export($export.P + $export.F * !_dereq_(96)([].filter, true), 'Array', {
2784 // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg])
2785 filter: function filter(callbackfn /* , thisArg */){
2786 return $filter(this, callbackfn, arguments[1]);
2787 }
2788});
2789},{"12":12,"32":32,"96":96}],124:[function(_dereq_,module,exports){
2790'use strict';
2791// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined)
2792var $export = _dereq_(32)
2793 , $find = _dereq_(12)(6)
2794 , KEY = 'findIndex'
2795 , forced = true;
2796// Shouldn't skip holes
2797if(KEY in [])Array(1)[KEY](function(){ forced = false; });
2798$export($export.P + $export.F * forced, 'Array', {
2799 findIndex: function findIndex(callbackfn/*, that = undefined */){
2800 return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2801 }
2802});
2803_dereq_(5)(KEY);
2804},{"12":12,"32":32,"5":5}],125:[function(_dereq_,module,exports){
2805'use strict';
2806// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined)
2807var $export = _dereq_(32)
2808 , $find = _dereq_(12)(5)
2809 , KEY = 'find'
2810 , forced = true;
2811// Shouldn't skip holes
2812if(KEY in [])Array(1)[KEY](function(){ forced = false; });
2813$export($export.P + $export.F * forced, 'Array', {
2814 find: function find(callbackfn/*, that = undefined */){
2815 return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2816 }
2817});
2818_dereq_(5)(KEY);
2819},{"12":12,"32":32,"5":5}],126:[function(_dereq_,module,exports){
2820'use strict';
2821var $export = _dereq_(32)
2822 , $forEach = _dereq_(12)(0)
2823 , STRICT = _dereq_(96)([].forEach, true);
2824
2825$export($export.P + $export.F * !STRICT, 'Array', {
2826 // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg])
2827 forEach: function forEach(callbackfn /* , thisArg */){
2828 return $forEach(this, callbackfn, arguments[1]);
2829 }
2830});
2831},{"12":12,"32":32,"96":96}],127:[function(_dereq_,module,exports){
2832'use strict';
2833var ctx = _dereq_(25)
2834 , $export = _dereq_(32)
2835 , toObject = _dereq_(109)
2836 , call = _dereq_(51)
2837 , isArrayIter = _dereq_(46)
2838 , toLength = _dereq_(108)
2839 , createProperty = _dereq_(24)
2840 , getIterFn = _dereq_(118);
2841
2842$export($export.S + $export.F * !_dereq_(54)(function(iter){ Array.from(iter); }), 'Array', {
2843 // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
2844 from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){
2845 var O = toObject(arrayLike)
2846 , C = typeof this == 'function' ? this : Array
2847 , aLen = arguments.length
2848 , mapfn = aLen > 1 ? arguments[1] : undefined
2849 , mapping = mapfn !== undefined
2850 , index = 0
2851 , iterFn = getIterFn(O)
2852 , length, result, step, iterator;
2853 if(mapping)mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);
2854 // if object isn't iterable or it's array with default iterator - use simple case
2855 if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){
2856 for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){
2857 createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);
2858 }
2859 } else {
2860 length = toLength(O.length);
2861 for(result = new C(length); length > index; index++){
2862 createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
2863 }
2864 }
2865 result.length = index;
2866 return result;
2867 }
2868});
2869
2870},{"108":108,"109":109,"118":118,"24":24,"25":25,"32":32,"46":46,"51":51,"54":54}],128:[function(_dereq_,module,exports){
2871'use strict';
2872var $export = _dereq_(32)
2873 , $indexOf = _dereq_(11)(false)
2874 , $native = [].indexOf
2875 , NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0;
2876
2877$export($export.P + $export.F * (NEGATIVE_ZERO || !_dereq_(96)($native)), 'Array', {
2878 // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex])
2879 indexOf: function indexOf(searchElement /*, fromIndex = 0 */){
2880 return NEGATIVE_ZERO
2881 // convert -0 to +0
2882 ? $native.apply(this, arguments) || 0
2883 : $indexOf(this, searchElement, arguments[1]);
2884 }
2885});
2886},{"11":11,"32":32,"96":96}],129:[function(_dereq_,module,exports){
2887// 22.1.2.2 / 15.4.3.2 Array.isArray(arg)
2888var $export = _dereq_(32);
2889
2890$export($export.S, 'Array', {isArray: _dereq_(47)});
2891},{"32":32,"47":47}],130:[function(_dereq_,module,exports){
2892'use strict';
2893var addToUnscopables = _dereq_(5)
2894 , step = _dereq_(55)
2895 , Iterators = _dereq_(56)
2896 , toIObject = _dereq_(107);
2897
2898// 22.1.3.4 Array.prototype.entries()
2899// 22.1.3.13 Array.prototype.keys()
2900// 22.1.3.29 Array.prototype.values()
2901// 22.1.3.30 Array.prototype[@@iterator]()
2902module.exports = _dereq_(53)(Array, 'Array', function(iterated, kind){
2903 this._t = toIObject(iterated); // target
2904 this._i = 0; // next index
2905 this._k = kind; // kind
2906// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
2907}, function(){
2908 var O = this._t
2909 , kind = this._k
2910 , index = this._i++;
2911 if(!O || index >= O.length){
2912 this._t = undefined;
2913 return step(1);
2914 }
2915 if(kind == 'keys' )return step(0, index);
2916 if(kind == 'values')return step(0, O[index]);
2917 return step(0, [index, O[index]]);
2918}, 'values');
2919
2920// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
2921Iterators.Arguments = Iterators.Array;
2922
2923addToUnscopables('keys');
2924addToUnscopables('values');
2925addToUnscopables('entries');
2926},{"107":107,"5":5,"53":53,"55":55,"56":56}],131:[function(_dereq_,module,exports){
2927'use strict';
2928// 22.1.3.13 Array.prototype.join(separator)
2929var $export = _dereq_(32)
2930 , toIObject = _dereq_(107)
2931 , arrayJoin = [].join;
2932
2933// fallback for not array-like strings
2934$export($export.P + $export.F * (_dereq_(45) != Object || !_dereq_(96)(arrayJoin)), 'Array', {
2935 join: function join(separator){
2936 return arrayJoin.call(toIObject(this), separator === undefined ? ',' : separator);
2937 }
2938});
2939},{"107":107,"32":32,"45":45,"96":96}],132:[function(_dereq_,module,exports){
2940'use strict';
2941var $export = _dereq_(32)
2942 , toIObject = _dereq_(107)
2943 , toInteger = _dereq_(106)
2944 , toLength = _dereq_(108)
2945 , $native = [].lastIndexOf
2946 , NEGATIVE_ZERO = !!$native && 1 / [1].lastIndexOf(1, -0) < 0;
2947
2948$export($export.P + $export.F * (NEGATIVE_ZERO || !_dereq_(96)($native)), 'Array', {
2949 // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex])
2950 lastIndexOf: function lastIndexOf(searchElement /*, fromIndex = @[*-1] */){
2951 // convert -0 to +0
2952 if(NEGATIVE_ZERO)return $native.apply(this, arguments) || 0;
2953 var O = toIObject(this)
2954 , length = toLength(O.length)
2955 , index = length - 1;
2956 if(arguments.length > 1)index = Math.min(index, toInteger(arguments[1]));
2957 if(index < 0)index = length + index;
2958 for(;index >= 0; index--)if(index in O)if(O[index] === searchElement)return index || 0;
2959 return -1;
2960 }
2961});
2962},{"106":106,"107":107,"108":108,"32":32,"96":96}],133:[function(_dereq_,module,exports){
2963'use strict';
2964var $export = _dereq_(32)
2965 , $map = _dereq_(12)(1);
2966
2967$export($export.P + $export.F * !_dereq_(96)([].map, true), 'Array', {
2968 // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg])
2969 map: function map(callbackfn /* , thisArg */){
2970 return $map(this, callbackfn, arguments[1]);
2971 }
2972});
2973},{"12":12,"32":32,"96":96}],134:[function(_dereq_,module,exports){
2974'use strict';
2975var $export = _dereq_(32)
2976 , createProperty = _dereq_(24);
2977
2978// WebKit Array.of isn't generic
2979$export($export.S + $export.F * _dereq_(34)(function(){
2980 function F(){}
2981 return !(Array.of.call(F) instanceof F);
2982}), 'Array', {
2983 // 22.1.2.3 Array.of( ...items)
2984 of: function of(/* ...args */){
2985 var index = 0
2986 , aLen = arguments.length
2987 , result = new (typeof this == 'function' ? this : Array)(aLen);
2988 while(aLen > index)createProperty(result, index, arguments[index++]);
2989 result.length = aLen;
2990 return result;
2991 }
2992});
2993},{"24":24,"32":32,"34":34}],135:[function(_dereq_,module,exports){
2994'use strict';
2995var $export = _dereq_(32)
2996 , $reduce = _dereq_(13);
2997
2998$export($export.P + $export.F * !_dereq_(96)([].reduceRight, true), 'Array', {
2999 // 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue])
3000 reduceRight: function reduceRight(callbackfn /* , initialValue */){
3001 return $reduce(this, callbackfn, arguments.length, arguments[1], true);
3002 }
3003});
3004},{"13":13,"32":32,"96":96}],136:[function(_dereq_,module,exports){
3005'use strict';
3006var $export = _dereq_(32)
3007 , $reduce = _dereq_(13);
3008
3009$export($export.P + $export.F * !_dereq_(96)([].reduce, true), 'Array', {
3010 // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue])
3011 reduce: function reduce(callbackfn /* , initialValue */){
3012 return $reduce(this, callbackfn, arguments.length, arguments[1], false);
3013 }
3014});
3015},{"13":13,"32":32,"96":96}],137:[function(_dereq_,module,exports){
3016'use strict';
3017var $export = _dereq_(32)
3018 , html = _dereq_(41)
3019 , cof = _dereq_(18)
3020 , toIndex = _dereq_(105)
3021 , toLength = _dereq_(108)
3022 , arraySlice = [].slice;
3023
3024// fallback for not array-like ES3 strings and DOM objects
3025$export($export.P + $export.F * _dereq_(34)(function(){
3026 if(html)arraySlice.call(html);
3027}), 'Array', {
3028 slice: function slice(begin, end){
3029 var len = toLength(this.length)
3030 , klass = cof(this);
3031 end = end === undefined ? len : end;
3032 if(klass == 'Array')return arraySlice.call(this, begin, end);
3033 var start = toIndex(begin, len)
3034 , upTo = toIndex(end, len)
3035 , size = toLength(upTo - start)
3036 , cloned = Array(size)
3037 , i = 0;
3038 for(; i < size; i++)cloned[i] = klass == 'String'
3039 ? this.charAt(start + i)
3040 : this[start + i];
3041 return cloned;
3042 }
3043});
3044},{"105":105,"108":108,"18":18,"32":32,"34":34,"41":41}],138:[function(_dereq_,module,exports){
3045'use strict';
3046var $export = _dereq_(32)
3047 , $some = _dereq_(12)(3);
3048
3049$export($export.P + $export.F * !_dereq_(96)([].some, true), 'Array', {
3050 // 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg])
3051 some: function some(callbackfn /* , thisArg */){
3052 return $some(this, callbackfn, arguments[1]);
3053 }
3054});
3055},{"12":12,"32":32,"96":96}],139:[function(_dereq_,module,exports){
3056'use strict';
3057var $export = _dereq_(32)
3058 , aFunction = _dereq_(3)
3059 , toObject = _dereq_(109)
3060 , fails = _dereq_(34)
3061 , $sort = [].sort
3062 , test = [1, 2, 3];
3063
3064$export($export.P + $export.F * (fails(function(){
3065 // IE8-
3066 test.sort(undefined);
3067}) || !fails(function(){
3068 // V8 bug
3069 test.sort(null);
3070 // Old WebKit
3071}) || !_dereq_(96)($sort)), 'Array', {
3072 // 22.1.3.25 Array.prototype.sort(comparefn)
3073 sort: function sort(comparefn){
3074 return comparefn === undefined
3075 ? $sort.call(toObject(this))
3076 : $sort.call(toObject(this), aFunction(comparefn));
3077 }
3078});
3079},{"109":109,"3":3,"32":32,"34":34,"96":96}],140:[function(_dereq_,module,exports){
3080_dereq_(91)('Array');
3081},{"91":91}],141:[function(_dereq_,module,exports){
3082// 20.3.3.1 / 15.9.4.4 Date.now()
3083var $export = _dereq_(32);
3084
3085$export($export.S, 'Date', {now: function(){ return new Date().getTime(); }});
3086},{"32":32}],142:[function(_dereq_,module,exports){
3087'use strict';
3088// 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString()
3089var $export = _dereq_(32)
3090 , fails = _dereq_(34)
3091 , getTime = Date.prototype.getTime;
3092
3093var lz = function(num){
3094 return num > 9 ? num : '0' + num;
3095};
3096
3097// PhantomJS / old WebKit has a broken implementations
3098$export($export.P + $export.F * (fails(function(){
3099 return new Date(-5e13 - 1).toISOString() != '0385-07-25T07:06:39.999Z';
3100}) || !fails(function(){
3101 new Date(NaN).toISOString();
3102})), 'Date', {
3103 toISOString: function toISOString(){
3104 if(!isFinite(getTime.call(this)))throw RangeError('Invalid time value');
3105 var d = this
3106 , y = d.getUTCFullYear()
3107 , m = d.getUTCMilliseconds()
3108 , s = y < 0 ? '-' : y > 9999 ? '+' : '';
3109 return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) +
3110 '-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) +
3111 'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) +
3112 ':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z';
3113 }
3114});
3115},{"32":32,"34":34}],143:[function(_dereq_,module,exports){
3116'use strict';
3117var $export = _dereq_(32)
3118 , toObject = _dereq_(109)
3119 , toPrimitive = _dereq_(110);
3120
3121$export($export.P + $export.F * _dereq_(34)(function(){
3122 return new Date(NaN).toJSON() !== null || Date.prototype.toJSON.call({toISOString: function(){ return 1; }}) !== 1;
3123}), 'Date', {
3124 toJSON: function toJSON(key){
3125 var O = toObject(this)
3126 , pv = toPrimitive(O);
3127 return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString();
3128 }
3129});
3130},{"109":109,"110":110,"32":32,"34":34}],144:[function(_dereq_,module,exports){
3131var TO_PRIMITIVE = _dereq_(117)('toPrimitive')
3132 , proto = Date.prototype;
3133
3134if(!(TO_PRIMITIVE in proto))_dereq_(40)(proto, TO_PRIMITIVE, _dereq_(26));
3135},{"117":117,"26":26,"40":40}],145:[function(_dereq_,module,exports){
3136var DateProto = Date.prototype
3137 , INVALID_DATE = 'Invalid Date'
3138 , TO_STRING = 'toString'
3139 , $toString = DateProto[TO_STRING]
3140 , getTime = DateProto.getTime;
3141if(new Date(NaN) + '' != INVALID_DATE){
3142 _dereq_(87)(DateProto, TO_STRING, function toString(){
3143 var value = getTime.call(this);
3144 return value === value ? $toString.call(this) : INVALID_DATE;
3145 });
3146}
3147},{"87":87}],146:[function(_dereq_,module,exports){
3148// 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...)
3149var $export = _dereq_(32);
3150
3151$export($export.P, 'Function', {bind: _dereq_(16)});
3152},{"16":16,"32":32}],147:[function(_dereq_,module,exports){
3153'use strict';
3154var isObject = _dereq_(49)
3155 , getPrototypeOf = _dereq_(74)
3156 , HAS_INSTANCE = _dereq_(117)('hasInstance')
3157 , FunctionProto = Function.prototype;
3158// 19.2.3.6 Function.prototype[@@hasInstance](V)
3159if(!(HAS_INSTANCE in FunctionProto))_dereq_(67).f(FunctionProto, HAS_INSTANCE, {value: function(O){
3160 if(typeof this != 'function' || !isObject(O))return false;
3161 if(!isObject(this.prototype))return O instanceof this;
3162 // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this:
3163 while(O = getPrototypeOf(O))if(this.prototype === O)return true;
3164 return false;
3165}});
3166},{"117":117,"49":49,"67":67,"74":74}],148:[function(_dereq_,module,exports){
3167var dP = _dereq_(67).f
3168 , createDesc = _dereq_(85)
3169 , has = _dereq_(39)
3170 , FProto = Function.prototype
3171 , nameRE = /^\s*function ([^ (]*)/
3172 , NAME = 'name';
3173
3174var isExtensible = Object.isExtensible || function(){
3175 return true;
3176};
3177
3178// 19.2.4.2 name
3179NAME in FProto || _dereq_(28) && dP(FProto, NAME, {
3180 configurable: true,
3181 get: function(){
3182 try {
3183 var that = this
3184 , name = ('' + that).match(nameRE)[1];
3185 has(that, NAME) || !isExtensible(that) || dP(that, NAME, createDesc(5, name));
3186 return name;
3187 } catch(e){
3188 return '';
3189 }
3190 }
3191});
3192},{"28":28,"39":39,"67":67,"85":85}],149:[function(_dereq_,module,exports){
3193'use strict';
3194var strong = _dereq_(19);
3195
3196// 23.1 Map Objects
3197module.exports = _dereq_(22)('Map', function(get){
3198 return function Map(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
3199}, {
3200 // 23.1.3.6 Map.prototype.get(key)
3201 get: function get(key){
3202 var entry = strong.getEntry(this, key);
3203 return entry && entry.v;
3204 },
3205 // 23.1.3.9 Map.prototype.set(key, value)
3206 set: function set(key, value){
3207 return strong.def(this, key === 0 ? 0 : key, value);
3208 }
3209}, strong, true);
3210},{"19":19,"22":22}],150:[function(_dereq_,module,exports){
3211// 20.2.2.3 Math.acosh(x)
3212var $export = _dereq_(32)
3213 , log1p = _dereq_(60)
3214 , sqrt = Math.sqrt
3215 , $acosh = Math.acosh;
3216
3217$export($export.S + $export.F * !($acosh
3218 // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509
3219 && Math.floor($acosh(Number.MAX_VALUE)) == 710
3220 // Tor Browser bug: Math.acosh(Infinity) -> NaN
3221 && $acosh(Infinity) == Infinity
3222), 'Math', {
3223 acosh: function acosh(x){
3224 return (x = +x) < 1 ? NaN : x > 94906265.62425156
3225 ? Math.log(x) + Math.LN2
3226 : log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1));
3227 }
3228});
3229},{"32":32,"60":60}],151:[function(_dereq_,module,exports){
3230// 20.2.2.5 Math.asinh(x)
3231var $export = _dereq_(32)
3232 , $asinh = Math.asinh;
3233
3234function asinh(x){
3235 return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : Math.log(x + Math.sqrt(x * x + 1));
3236}
3237
3238// Tor Browser bug: Math.asinh(0) -> -0
3239$export($export.S + $export.F * !($asinh && 1 / $asinh(0) > 0), 'Math', {asinh: asinh});
3240},{"32":32}],152:[function(_dereq_,module,exports){
3241// 20.2.2.7 Math.atanh(x)
3242var $export = _dereq_(32)
3243 , $atanh = Math.atanh;
3244
3245// Tor Browser bug: Math.atanh(-0) -> 0
3246$export($export.S + $export.F * !($atanh && 1 / $atanh(-0) < 0), 'Math', {
3247 atanh: function atanh(x){
3248 return (x = +x) == 0 ? x : Math.log((1 + x) / (1 - x)) / 2;
3249 }
3250});
3251},{"32":32}],153:[function(_dereq_,module,exports){
3252// 20.2.2.9 Math.cbrt(x)
3253var $export = _dereq_(32)
3254 , sign = _dereq_(61);
3255
3256$export($export.S, 'Math', {
3257 cbrt: function cbrt(x){
3258 return sign(x = +x) * Math.pow(Math.abs(x), 1 / 3);
3259 }
3260});
3261},{"32":32,"61":61}],154:[function(_dereq_,module,exports){
3262// 20.2.2.11 Math.clz32(x)
3263var $export = _dereq_(32);
3264
3265$export($export.S, 'Math', {
3266 clz32: function clz32(x){
3267 return (x >>>= 0) ? 31 - Math.floor(Math.log(x + 0.5) * Math.LOG2E) : 32;
3268 }
3269});
3270},{"32":32}],155:[function(_dereq_,module,exports){
3271// 20.2.2.12 Math.cosh(x)
3272var $export = _dereq_(32)
3273 , exp = Math.exp;
3274
3275$export($export.S, 'Math', {
3276 cosh: function cosh(x){
3277 return (exp(x = +x) + exp(-x)) / 2;
3278 }
3279});
3280},{"32":32}],156:[function(_dereq_,module,exports){
3281// 20.2.2.14 Math.expm1(x)
3282var $export = _dereq_(32)
3283 , $expm1 = _dereq_(59);
3284
3285$export($export.S + $export.F * ($expm1 != Math.expm1), 'Math', {expm1: $expm1});
3286},{"32":32,"59":59}],157:[function(_dereq_,module,exports){
3287// 20.2.2.16 Math.fround(x)
3288var $export = _dereq_(32)
3289 , sign = _dereq_(61)
3290 , pow = Math.pow
3291 , EPSILON = pow(2, -52)
3292 , EPSILON32 = pow(2, -23)
3293 , MAX32 = pow(2, 127) * (2 - EPSILON32)
3294 , MIN32 = pow(2, -126);
3295
3296var roundTiesToEven = function(n){
3297 return n + 1 / EPSILON - 1 / EPSILON;
3298};
3299
3300
3301$export($export.S, 'Math', {
3302 fround: function fround(x){
3303 var $abs = Math.abs(x)
3304 , $sign = sign(x)
3305 , a, result;
3306 if($abs < MIN32)return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32;
3307 a = (1 + EPSILON32 / EPSILON) * $abs;
3308 result = a - (a - $abs);
3309 if(result > MAX32 || result != result)return $sign * Infinity;
3310 return $sign * result;
3311 }
3312});
3313},{"32":32,"61":61}],158:[function(_dereq_,module,exports){
3314// 20.2.2.17 Math.hypot([value1[, value2[, … ]]])
3315var $export = _dereq_(32)
3316 , abs = Math.abs;
3317
3318$export($export.S, 'Math', {
3319 hypot: function hypot(value1, value2){ // eslint-disable-line no-unused-vars
3320 var sum = 0
3321 , i = 0
3322 , aLen = arguments.length
3323 , larg = 0
3324 , arg, div;
3325 while(i < aLen){
3326 arg = abs(arguments[i++]);
3327 if(larg < arg){
3328 div = larg / arg;
3329 sum = sum * div * div + 1;
3330 larg = arg;
3331 } else if(arg > 0){
3332 div = arg / larg;
3333 sum += div * div;
3334 } else sum += arg;
3335 }
3336 return larg === Infinity ? Infinity : larg * Math.sqrt(sum);
3337 }
3338});
3339},{"32":32}],159:[function(_dereq_,module,exports){
3340// 20.2.2.18 Math.imul(x, y)
3341var $export = _dereq_(32)
3342 , $imul = Math.imul;
3343
3344// some WebKit versions fails with big numbers, some has wrong arity
3345$export($export.S + $export.F * _dereq_(34)(function(){
3346 return $imul(0xffffffff, 5) != -5 || $imul.length != 2;
3347}), 'Math', {
3348 imul: function imul(x, y){
3349 var UINT16 = 0xffff
3350 , xn = +x
3351 , yn = +y
3352 , xl = UINT16 & xn
3353 , yl = UINT16 & yn;
3354 return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0);
3355 }
3356});
3357},{"32":32,"34":34}],160:[function(_dereq_,module,exports){
3358// 20.2.2.21 Math.log10(x)
3359var $export = _dereq_(32);
3360
3361$export($export.S, 'Math', {
3362 log10: function log10(x){
3363 return Math.log(x) / Math.LN10;
3364 }
3365});
3366},{"32":32}],161:[function(_dereq_,module,exports){
3367// 20.2.2.20 Math.log1p(x)
3368var $export = _dereq_(32);
3369
3370$export($export.S, 'Math', {log1p: _dereq_(60)});
3371},{"32":32,"60":60}],162:[function(_dereq_,module,exports){
3372// 20.2.2.22 Math.log2(x)
3373var $export = _dereq_(32);
3374
3375$export($export.S, 'Math', {
3376 log2: function log2(x){
3377 return Math.log(x) / Math.LN2;
3378 }
3379});
3380},{"32":32}],163:[function(_dereq_,module,exports){
3381// 20.2.2.28 Math.sign(x)
3382var $export = _dereq_(32);
3383
3384$export($export.S, 'Math', {sign: _dereq_(61)});
3385},{"32":32,"61":61}],164:[function(_dereq_,module,exports){
3386// 20.2.2.30 Math.sinh(x)
3387var $export = _dereq_(32)
3388 , expm1 = _dereq_(59)
3389 , exp = Math.exp;
3390
3391// V8 near Chromium 38 has a problem with very small numbers
3392$export($export.S + $export.F * _dereq_(34)(function(){
3393 return !Math.sinh(-2e-17) != -2e-17;
3394}), 'Math', {
3395 sinh: function sinh(x){
3396 return Math.abs(x = +x) < 1
3397 ? (expm1(x) - expm1(-x)) / 2
3398 : (exp(x - 1) - exp(-x - 1)) * (Math.E / 2);
3399 }
3400});
3401},{"32":32,"34":34,"59":59}],165:[function(_dereq_,module,exports){
3402// 20.2.2.33 Math.tanh(x)
3403var $export = _dereq_(32)
3404 , expm1 = _dereq_(59)
3405 , exp = Math.exp;
3406
3407$export($export.S, 'Math', {
3408 tanh: function tanh(x){
3409 var a = expm1(x = +x)
3410 , b = expm1(-x);
3411 return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x));
3412 }
3413});
3414},{"32":32,"59":59}],166:[function(_dereq_,module,exports){
3415// 20.2.2.34 Math.trunc(x)
3416var $export = _dereq_(32);
3417
3418$export($export.S, 'Math', {
3419 trunc: function trunc(it){
3420 return (it > 0 ? Math.floor : Math.ceil)(it);
3421 }
3422});
3423},{"32":32}],167:[function(_dereq_,module,exports){
3424'use strict';
3425var global = _dereq_(38)
3426 , has = _dereq_(39)
3427 , cof = _dereq_(18)
3428 , inheritIfRequired = _dereq_(43)
3429 , toPrimitive = _dereq_(110)
3430 , fails = _dereq_(34)
3431 , gOPN = _dereq_(72).f
3432 , gOPD = _dereq_(70).f
3433 , dP = _dereq_(67).f
3434 , $trim = _dereq_(102).trim
3435 , NUMBER = 'Number'
3436 , $Number = global[NUMBER]
3437 , Base = $Number
3438 , proto = $Number.prototype
3439 // Opera ~12 has broken Object#toString
3440 , BROKEN_COF = cof(_dereq_(66)(proto)) == NUMBER
3441 , TRIM = 'trim' in String.prototype;
3442
3443// 7.1.3 ToNumber(argument)
3444var toNumber = function(argument){
3445 var it = toPrimitive(argument, false);
3446 if(typeof it == 'string' && it.length > 2){
3447 it = TRIM ? it.trim() : $trim(it, 3);
3448 var first = it.charCodeAt(0)
3449 , third, radix, maxCode;
3450 if(first === 43 || first === 45){
3451 third = it.charCodeAt(2);
3452 if(third === 88 || third === 120)return NaN; // Number('+0x1') should be NaN, old V8 fix
3453 } else if(first === 48){
3454 switch(it.charCodeAt(1)){
3455 case 66 : case 98 : radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i
3456 case 79 : case 111 : radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i
3457 default : return +it;
3458 }
3459 for(var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++){
3460 code = digits.charCodeAt(i);
3461 // parseInt parses a string to a first unavailable symbol
3462 // but ToNumber should return NaN if a string contains unavailable symbols
3463 if(code < 48 || code > maxCode)return NaN;
3464 } return parseInt(digits, radix);
3465 }
3466 } return +it;
3467};
3468
3469if(!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')){
3470 $Number = function Number(value){
3471 var it = arguments.length < 1 ? 0 : value
3472 , that = this;
3473 return that instanceof $Number
3474 // check on 1..constructor(foo) case
3475 && (BROKEN_COF ? fails(function(){ proto.valueOf.call(that); }) : cof(that) != NUMBER)
3476 ? inheritIfRequired(new Base(toNumber(it)), that, $Number) : toNumber(it);
3477 };
3478 for(var keys = _dereq_(28) ? gOPN(Base) : (
3479 // ES3:
3480 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
3481 // ES6 (in case, if modules with ES6 Number statics required before):
3482 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
3483 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'
3484 ).split(','), j = 0, key; keys.length > j; j++){
3485 if(has(Base, key = keys[j]) && !has($Number, key)){
3486 dP($Number, key, gOPD(Base, key));
3487 }
3488 }
3489 $Number.prototype = proto;
3490 proto.constructor = $Number;
3491 _dereq_(87)(global, NUMBER, $Number);
3492}
3493},{"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){
3494// 20.1.2.1 Number.EPSILON
3495var $export = _dereq_(32);
3496
3497$export($export.S, 'Number', {EPSILON: Math.pow(2, -52)});
3498},{"32":32}],169:[function(_dereq_,module,exports){
3499// 20.1.2.2 Number.isFinite(number)
3500var $export = _dereq_(32)
3501 , _isFinite = _dereq_(38).isFinite;
3502
3503$export($export.S, 'Number', {
3504 isFinite: function isFinite(it){
3505 return typeof it == 'number' && _isFinite(it);
3506 }
3507});
3508},{"32":32,"38":38}],170:[function(_dereq_,module,exports){
3509// 20.1.2.3 Number.isInteger(number)
3510var $export = _dereq_(32);
3511
3512$export($export.S, 'Number', {isInteger: _dereq_(48)});
3513},{"32":32,"48":48}],171:[function(_dereq_,module,exports){
3514// 20.1.2.4 Number.isNaN(number)
3515var $export = _dereq_(32);
3516
3517$export($export.S, 'Number', {
3518 isNaN: function isNaN(number){
3519 return number != number;
3520 }
3521});
3522},{"32":32}],172:[function(_dereq_,module,exports){
3523// 20.1.2.5 Number.isSafeInteger(number)
3524var $export = _dereq_(32)
3525 , isInteger = _dereq_(48)
3526 , abs = Math.abs;
3527
3528$export($export.S, 'Number', {
3529 isSafeInteger: function isSafeInteger(number){
3530 return isInteger(number) && abs(number) <= 0x1fffffffffffff;
3531 }
3532});
3533},{"32":32,"48":48}],173:[function(_dereq_,module,exports){
3534// 20.1.2.6 Number.MAX_SAFE_INTEGER
3535var $export = _dereq_(32);
3536
3537$export($export.S, 'Number', {MAX_SAFE_INTEGER: 0x1fffffffffffff});
3538},{"32":32}],174:[function(_dereq_,module,exports){
3539// 20.1.2.10 Number.MIN_SAFE_INTEGER
3540var $export = _dereq_(32);
3541
3542$export($export.S, 'Number', {MIN_SAFE_INTEGER: -0x1fffffffffffff});
3543},{"32":32}],175:[function(_dereq_,module,exports){
3544var $export = _dereq_(32)
3545 , $parseFloat = _dereq_(81);
3546// 20.1.2.12 Number.parseFloat(string)
3547$export($export.S + $export.F * (Number.parseFloat != $parseFloat), 'Number', {parseFloat: $parseFloat});
3548},{"32":32,"81":81}],176:[function(_dereq_,module,exports){
3549var $export = _dereq_(32)
3550 , $parseInt = _dereq_(82);
3551// 20.1.2.13 Number.parseInt(string, radix)
3552$export($export.S + $export.F * (Number.parseInt != $parseInt), 'Number', {parseInt: $parseInt});
3553},{"32":32,"82":82}],177:[function(_dereq_,module,exports){
3554'use strict';
3555var $export = _dereq_(32)
3556 , toInteger = _dereq_(106)
3557 , aNumberValue = _dereq_(4)
3558 , repeat = _dereq_(101)
3559 , $toFixed = 1..toFixed
3560 , floor = Math.floor
3561 , data = [0, 0, 0, 0, 0, 0]
3562 , ERROR = 'Number.toFixed: incorrect invocation!'
3563 , ZERO = '0';
3564
3565var multiply = function(n, c){
3566 var i = -1
3567 , c2 = c;
3568 while(++i < 6){
3569 c2 += n * data[i];
3570 data[i] = c2 % 1e7;
3571 c2 = floor(c2 / 1e7);
3572 }
3573};
3574var divide = function(n){
3575 var i = 6
3576 , c = 0;
3577 while(--i >= 0){
3578 c += data[i];
3579 data[i] = floor(c / n);
3580 c = (c % n) * 1e7;
3581 }
3582};
3583var numToString = function(){
3584 var i = 6
3585 , s = '';
3586 while(--i >= 0){
3587 if(s !== '' || i === 0 || data[i] !== 0){
3588 var t = String(data[i]);
3589 s = s === '' ? t : s + repeat.call(ZERO, 7 - t.length) + t;
3590 }
3591 } return s;
3592};
3593var pow = function(x, n, acc){
3594 return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc);
3595};
3596var log = function(x){
3597 var n = 0
3598 , x2 = x;
3599 while(x2 >= 4096){
3600 n += 12;
3601 x2 /= 4096;
3602 }
3603 while(x2 >= 2){
3604 n += 1;
3605 x2 /= 2;
3606 } return n;
3607};
3608
3609$export($export.P + $export.F * (!!$toFixed && (
3610 0.00008.toFixed(3) !== '0.000' ||
3611 0.9.toFixed(0) !== '1' ||
3612 1.255.toFixed(2) !== '1.25' ||
3613 1000000000000000128..toFixed(0) !== '1000000000000000128'
3614) || !_dereq_(34)(function(){
3615 // V8 ~ Android 4.3-
3616 $toFixed.call({});
3617})), 'Number', {
3618 toFixed: function toFixed(fractionDigits){
3619 var x = aNumberValue(this, ERROR)
3620 , f = toInteger(fractionDigits)
3621 , s = ''
3622 , m = ZERO
3623 , e, z, j, k;
3624 if(f < 0 || f > 20)throw RangeError(ERROR);
3625 if(x != x)return 'NaN';
3626 if(x <= -1e21 || x >= 1e21)return String(x);
3627 if(x < 0){
3628 s = '-';
3629 x = -x;
3630 }
3631 if(x > 1e-21){
3632 e = log(x * pow(2, 69, 1)) - 69;
3633 z = e < 0 ? x * pow(2, -e, 1) : x / pow(2, e, 1);
3634 z *= 0x10000000000000;
3635 e = 52 - e;
3636 if(e > 0){
3637 multiply(0, z);
3638 j = f;
3639 while(j >= 7){
3640 multiply(1e7, 0);
3641 j -= 7;
3642 }
3643 multiply(pow(10, j, 1), 0);
3644 j = e - 1;
3645 while(j >= 23){
3646 divide(1 << 23);
3647 j -= 23;
3648 }
3649 divide(1 << j);
3650 multiply(1, 1);
3651 divide(2);
3652 m = numToString();
3653 } else {
3654 multiply(0, z);
3655 multiply(1 << -e, 0);
3656 m = numToString() + repeat.call(ZERO, f);
3657 }
3658 }
3659 if(f > 0){
3660 k = m.length;
3661 m = s + (k <= f ? '0.' + repeat.call(ZERO, f - k) + m : m.slice(0, k - f) + '.' + m.slice(k - f));
3662 } else {
3663 m = s + m;
3664 } return m;
3665 }
3666});
3667},{"101":101,"106":106,"32":32,"34":34,"4":4}],178:[function(_dereq_,module,exports){
3668'use strict';
3669var $export = _dereq_(32)
3670 , $fails = _dereq_(34)
3671 , aNumberValue = _dereq_(4)
3672 , $toPrecision = 1..toPrecision;
3673
3674$export($export.P + $export.F * ($fails(function(){
3675 // IE7-
3676 return $toPrecision.call(1, undefined) !== '1';
3677}) || !$fails(function(){
3678 // V8 ~ Android 4.3-
3679 $toPrecision.call({});
3680})), 'Number', {
3681 toPrecision: function toPrecision(precision){
3682 var that = aNumberValue(this, 'Number#toPrecision: incorrect invocation!');
3683 return precision === undefined ? $toPrecision.call(that) : $toPrecision.call(that, precision);
3684 }
3685});
3686},{"32":32,"34":34,"4":4}],179:[function(_dereq_,module,exports){
3687// 19.1.3.1 Object.assign(target, source)
3688var $export = _dereq_(32);
3689
3690$export($export.S + $export.F, 'Object', {assign: _dereq_(65)});
3691},{"32":32,"65":65}],180:[function(_dereq_,module,exports){
3692var $export = _dereq_(32)
3693// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
3694$export($export.S, 'Object', {create: _dereq_(66)});
3695},{"32":32,"66":66}],181:[function(_dereq_,module,exports){
3696var $export = _dereq_(32);
3697// 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties)
3698$export($export.S + $export.F * !_dereq_(28), 'Object', {defineProperties: _dereq_(68)});
3699},{"28":28,"32":32,"68":68}],182:[function(_dereq_,module,exports){
3700var $export = _dereq_(32);
3701// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
3702$export($export.S + $export.F * !_dereq_(28), 'Object', {defineProperty: _dereq_(67).f});
3703},{"28":28,"32":32,"67":67}],183:[function(_dereq_,module,exports){
3704// 19.1.2.5 Object.freeze(O)
3705var isObject = _dereq_(49)
3706 , meta = _dereq_(62).onFreeze;
3707
3708_dereq_(78)('freeze', function($freeze){
3709 return function freeze(it){
3710 return $freeze && isObject(it) ? $freeze(meta(it)) : it;
3711 };
3712});
3713},{"49":49,"62":62,"78":78}],184:[function(_dereq_,module,exports){
3714// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
3715var toIObject = _dereq_(107)
3716 , $getOwnPropertyDescriptor = _dereq_(70).f;
3717
3718_dereq_(78)('getOwnPropertyDescriptor', function(){
3719 return function getOwnPropertyDescriptor(it, key){
3720 return $getOwnPropertyDescriptor(toIObject(it), key);
3721 };
3722});
3723},{"107":107,"70":70,"78":78}],185:[function(_dereq_,module,exports){
3724// 19.1.2.7 Object.getOwnPropertyNames(O)
3725_dereq_(78)('getOwnPropertyNames', function(){
3726 return _dereq_(71).f;
3727});
3728},{"71":71,"78":78}],186:[function(_dereq_,module,exports){
3729// 19.1.2.9 Object.getPrototypeOf(O)
3730var toObject = _dereq_(109)
3731 , $getPrototypeOf = _dereq_(74);
3732
3733_dereq_(78)('getPrototypeOf', function(){
3734 return function getPrototypeOf(it){
3735 return $getPrototypeOf(toObject(it));
3736 };
3737});
3738},{"109":109,"74":74,"78":78}],187:[function(_dereq_,module,exports){
3739// 19.1.2.11 Object.isExtensible(O)
3740var isObject = _dereq_(49);
3741
3742_dereq_(78)('isExtensible', function($isExtensible){
3743 return function isExtensible(it){
3744 return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false;
3745 };
3746});
3747},{"49":49,"78":78}],188:[function(_dereq_,module,exports){
3748// 19.1.2.12 Object.isFrozen(O)
3749var isObject = _dereq_(49);
3750
3751_dereq_(78)('isFrozen', function($isFrozen){
3752 return function isFrozen(it){
3753 return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true;
3754 };
3755});
3756},{"49":49,"78":78}],189:[function(_dereq_,module,exports){
3757// 19.1.2.13 Object.isSealed(O)
3758var isObject = _dereq_(49);
3759
3760_dereq_(78)('isSealed', function($isSealed){
3761 return function isSealed(it){
3762 return isObject(it) ? $isSealed ? $isSealed(it) : false : true;
3763 };
3764});
3765},{"49":49,"78":78}],190:[function(_dereq_,module,exports){
3766// 19.1.3.10 Object.is(value1, value2)
3767var $export = _dereq_(32);
3768$export($export.S, 'Object', {is: _dereq_(89)});
3769},{"32":32,"89":89}],191:[function(_dereq_,module,exports){
3770// 19.1.2.14 Object.keys(O)
3771var toObject = _dereq_(109)
3772 , $keys = _dereq_(76);
3773
3774_dereq_(78)('keys', function(){
3775 return function keys(it){
3776 return $keys(toObject(it));
3777 };
3778});
3779},{"109":109,"76":76,"78":78}],192:[function(_dereq_,module,exports){
3780// 19.1.2.15 Object.preventExtensions(O)
3781var isObject = _dereq_(49)
3782 , meta = _dereq_(62).onFreeze;
3783
3784_dereq_(78)('preventExtensions', function($preventExtensions){
3785 return function preventExtensions(it){
3786 return $preventExtensions && isObject(it) ? $preventExtensions(meta(it)) : it;
3787 };
3788});
3789},{"49":49,"62":62,"78":78}],193:[function(_dereq_,module,exports){
3790// 19.1.2.17 Object.seal(O)
3791var isObject = _dereq_(49)
3792 , meta = _dereq_(62).onFreeze;
3793
3794_dereq_(78)('seal', function($seal){
3795 return function seal(it){
3796 return $seal && isObject(it) ? $seal(meta(it)) : it;
3797 };
3798});
3799},{"49":49,"62":62,"78":78}],194:[function(_dereq_,module,exports){
3800// 19.1.3.19 Object.setPrototypeOf(O, proto)
3801var $export = _dereq_(32);
3802$export($export.S, 'Object', {setPrototypeOf: _dereq_(90).set});
3803},{"32":32,"90":90}],195:[function(_dereq_,module,exports){
3804'use strict';
3805// 19.1.3.6 Object.prototype.toString()
3806var classof = _dereq_(17)
3807 , test = {};
3808test[_dereq_(117)('toStringTag')] = 'z';
3809if(test + '' != '[object z]'){
3810 _dereq_(87)(Object.prototype, 'toString', function toString(){
3811 return '[object ' + classof(this) + ']';
3812 }, true);
3813}
3814},{"117":117,"17":17,"87":87}],196:[function(_dereq_,module,exports){
3815var $export = _dereq_(32)
3816 , $parseFloat = _dereq_(81);
3817// 18.2.4 parseFloat(string)
3818$export($export.G + $export.F * (parseFloat != $parseFloat), {parseFloat: $parseFloat});
3819},{"32":32,"81":81}],197:[function(_dereq_,module,exports){
3820var $export = _dereq_(32)
3821 , $parseInt = _dereq_(82);
3822// 18.2.5 parseInt(string, radix)
3823$export($export.G + $export.F * (parseInt != $parseInt), {parseInt: $parseInt});
3824},{"32":32,"82":82}],198:[function(_dereq_,module,exports){
3825'use strict';
3826var LIBRARY = _dereq_(58)
3827 , global = _dereq_(38)
3828 , ctx = _dereq_(25)
3829 , classof = _dereq_(17)
3830 , $export = _dereq_(32)
3831 , isObject = _dereq_(49)
3832 , aFunction = _dereq_(3)
3833 , anInstance = _dereq_(6)
3834 , forOf = _dereq_(37)
3835 , speciesConstructor = _dereq_(95)
3836 , task = _dereq_(104).set
3837 , microtask = _dereq_(64)()
3838 , PROMISE = 'Promise'
3839 , TypeError = global.TypeError
3840 , process = global.process
3841 , $Promise = global[PROMISE]
3842 , process = global.process
3843 , isNode = classof(process) == 'process'
3844 , empty = function(){ /* empty */ }
3845 , Internal, GenericPromiseCapability, Wrapper;
3846
3847var USE_NATIVE = !!function(){
3848 try {
3849 // correct subclassing with @@species support
3850 var promise = $Promise.resolve(1)
3851 , FakePromise = (promise.constructor = {})[_dereq_(117)('species')] = function(exec){ exec(empty, empty); };
3852 // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
3853 return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise;
3854 } catch(e){ /* empty */ }
3855}();
3856
3857// helpers
3858var sameConstructor = function(a, b){
3859 // with library wrapper special case
3860 return a === b || a === $Promise && b === Wrapper;
3861};
3862var isThenable = function(it){
3863 var then;
3864 return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
3865};
3866var newPromiseCapability = function(C){
3867 return sameConstructor($Promise, C)
3868 ? new PromiseCapability(C)
3869 : new GenericPromiseCapability(C);
3870};
3871var PromiseCapability = GenericPromiseCapability = function(C){
3872 var resolve, reject;
3873 this.promise = new C(function($$resolve, $$reject){
3874 if(resolve !== undefined || reject !== undefined)throw TypeError('Bad Promise constructor');
3875 resolve = $$resolve;
3876 reject = $$reject;
3877 });
3878 this.resolve = aFunction(resolve);
3879 this.reject = aFunction(reject);
3880};
3881var perform = function(exec){
3882 try {
3883 exec();
3884 } catch(e){
3885 return {error: e};
3886 }
3887};
3888var notify = function(promise, isReject){
3889 if(promise._n)return;
3890 promise._n = true;
3891 var chain = promise._c;
3892 microtask(function(){
3893 var value = promise._v
3894 , ok = promise._s == 1
3895 , i = 0;
3896 var run = function(reaction){
3897 var handler = ok ? reaction.ok : reaction.fail
3898 , resolve = reaction.resolve
3899 , reject = reaction.reject
3900 , domain = reaction.domain
3901 , result, then;
3902 try {
3903 if(handler){
3904 if(!ok){
3905 if(promise._h == 2)onHandleUnhandled(promise);
3906 promise._h = 1;
3907 }
3908 if(handler === true)result = value;
3909 else {
3910 if(domain)domain.enter();
3911 result = handler(value);
3912 if(domain)domain.exit();
3913 }
3914 if(result === reaction.promise){
3915 reject(TypeError('Promise-chain cycle'));
3916 } else if(then = isThenable(result)){
3917 then.call(result, resolve, reject);
3918 } else resolve(result);
3919 } else reject(value);
3920 } catch(e){
3921 reject(e);
3922 }
3923 };
3924 while(chain.length > i)run(chain[i++]); // variable length - can't use forEach
3925 promise._c = [];
3926 promise._n = false;
3927 if(isReject && !promise._h)onUnhandled(promise);
3928 });
3929};
3930var onUnhandled = function(promise){
3931 task.call(global, function(){
3932 var value = promise._v
3933 , abrupt, handler, console;
3934 if(isUnhandled(promise)){
3935 abrupt = perform(function(){
3936 if(isNode){
3937 process.emit('unhandledRejection', value, promise);
3938 } else if(handler = global.onunhandledrejection){
3939 handler({promise: promise, reason: value});
3940 } else if((console = global.console) && console.error){
3941 console.error('Unhandled promise rejection', value);
3942 }
3943 });
3944 // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
3945 promise._h = isNode || isUnhandled(promise) ? 2 : 1;
3946 } promise._a = undefined;
3947 if(abrupt)throw abrupt.error;
3948 });
3949};
3950var isUnhandled = function(promise){
3951 if(promise._h == 1)return false;
3952 var chain = promise._a || promise._c
3953 , i = 0
3954 , reaction;
3955 while(chain.length > i){
3956 reaction = chain[i++];
3957 if(reaction.fail || !isUnhandled(reaction.promise))return false;
3958 } return true;
3959};
3960var onHandleUnhandled = function(promise){
3961 task.call(global, function(){
3962 var handler;
3963 if(isNode){
3964 process.emit('rejectionHandled', promise);
3965 } else if(handler = global.onrejectionhandled){
3966 handler({promise: promise, reason: promise._v});
3967 }
3968 });
3969};
3970var $reject = function(value){
3971 var promise = this;
3972 if(promise._d)return;
3973 promise._d = true;
3974 promise = promise._w || promise; // unwrap
3975 promise._v = value;
3976 promise._s = 2;
3977 if(!promise._a)promise._a = promise._c.slice();
3978 notify(promise, true);
3979};
3980var $resolve = function(value){
3981 var promise = this
3982 , then;
3983 if(promise._d)return;
3984 promise._d = true;
3985 promise = promise._w || promise; // unwrap
3986 try {
3987 if(promise === value)throw TypeError("Promise can't be resolved itself");
3988 if(then = isThenable(value)){
3989 microtask(function(){
3990 var wrapper = {_w: promise, _d: false}; // wrap
3991 try {
3992 then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
3993 } catch(e){
3994 $reject.call(wrapper, e);
3995 }
3996 });
3997 } else {
3998 promise._v = value;
3999 promise._s = 1;
4000 notify(promise, false);
4001 }
4002 } catch(e){
4003 $reject.call({_w: promise, _d: false}, e); // wrap
4004 }
4005};
4006
4007// constructor polyfill
4008if(!USE_NATIVE){
4009 // 25.4.3.1 Promise(executor)
4010 $Promise = function Promise(executor){
4011 anInstance(this, $Promise, PROMISE, '_h');
4012 aFunction(executor);
4013 Internal.call(this);
4014 try {
4015 executor(ctx($resolve, this, 1), ctx($reject, this, 1));
4016 } catch(err){
4017 $reject.call(this, err);
4018 }
4019 };
4020 Internal = function Promise(executor){
4021 this._c = []; // <- awaiting reactions
4022 this._a = undefined; // <- checked in isUnhandled reactions
4023 this._s = 0; // <- state
4024 this._d = false; // <- done
4025 this._v = undefined; // <- value
4026 this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
4027 this._n = false; // <- notify
4028 };
4029 Internal.prototype = _dereq_(86)($Promise.prototype, {
4030 // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
4031 then: function then(onFulfilled, onRejected){
4032 var reaction = newPromiseCapability(speciesConstructor(this, $Promise));
4033 reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
4034 reaction.fail = typeof onRejected == 'function' && onRejected;
4035 reaction.domain = isNode ? process.domain : undefined;
4036 this._c.push(reaction);
4037 if(this._a)this._a.push(reaction);
4038 if(this._s)notify(this, false);
4039 return reaction.promise;
4040 },
4041 // 25.4.5.1 Promise.prototype.catch(onRejected)
4042 'catch': function(onRejected){
4043 return this.then(undefined, onRejected);
4044 }
4045 });
4046 PromiseCapability = function(){
4047 var promise = new Internal;
4048 this.promise = promise;
4049 this.resolve = ctx($resolve, promise, 1);
4050 this.reject = ctx($reject, promise, 1);
4051 };
4052}
4053
4054$export($export.G + $export.W + $export.F * !USE_NATIVE, {Promise: $Promise});
4055_dereq_(92)($Promise, PROMISE);
4056_dereq_(91)(PROMISE);
4057Wrapper = _dereq_(23)[PROMISE];
4058
4059// statics
4060$export($export.S + $export.F * !USE_NATIVE, PROMISE, {
4061 // 25.4.4.5 Promise.reject(r)
4062 reject: function reject(r){
4063 var capability = newPromiseCapability(this)
4064 , $$reject = capability.reject;
4065 $$reject(r);
4066 return capability.promise;
4067 }
4068});
4069$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
4070 // 25.4.4.6 Promise.resolve(x)
4071 resolve: function resolve(x){
4072 // instanceof instead of internal slot check because we should fix it without replacement native Promise core
4073 if(x instanceof $Promise && sameConstructor(x.constructor, this))return x;
4074 var capability = newPromiseCapability(this)
4075 , $$resolve = capability.resolve;
4076 $$resolve(x);
4077 return capability.promise;
4078 }
4079});
4080$export($export.S + $export.F * !(USE_NATIVE && _dereq_(54)(function(iter){
4081 $Promise.all(iter)['catch'](empty);
4082})), PROMISE, {
4083 // 25.4.4.1 Promise.all(iterable)
4084 all: function all(iterable){
4085 var C = this
4086 , capability = newPromiseCapability(C)
4087 , resolve = capability.resolve
4088 , reject = capability.reject;
4089 var abrupt = perform(function(){
4090 var values = []
4091 , index = 0
4092 , remaining = 1;
4093 forOf(iterable, false, function(promise){
4094 var $index = index++
4095 , alreadyCalled = false;
4096 values.push(undefined);
4097 remaining++;
4098 C.resolve(promise).then(function(value){
4099 if(alreadyCalled)return;
4100 alreadyCalled = true;
4101 values[$index] = value;
4102 --remaining || resolve(values);
4103 }, reject);
4104 });
4105 --remaining || resolve(values);
4106 });
4107 if(abrupt)reject(abrupt.error);
4108 return capability.promise;
4109 },
4110 // 25.4.4.4 Promise.race(iterable)
4111 race: function race(iterable){
4112 var C = this
4113 , capability = newPromiseCapability(C)
4114 , reject = capability.reject;
4115 var abrupt = perform(function(){
4116 forOf(iterable, false, function(promise){
4117 C.resolve(promise).then(capability.resolve, reject);
4118 });
4119 });
4120 if(abrupt)reject(abrupt.error);
4121 return capability.promise;
4122 }
4123});
4124},{"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){
4125// 26.1.1 Reflect.apply(target, thisArgument, argumentsList)
4126var $export = _dereq_(32)
4127 , aFunction = _dereq_(3)
4128 , anObject = _dereq_(7)
4129 , rApply = (_dereq_(38).Reflect || {}).apply
4130 , fApply = Function.apply;
4131// MS Edge argumentsList argument is optional
4132$export($export.S + $export.F * !_dereq_(34)(function(){
4133 rApply(function(){});
4134}), 'Reflect', {
4135 apply: function apply(target, thisArgument, argumentsList){
4136 var T = aFunction(target)
4137 , L = anObject(argumentsList);
4138 return rApply ? rApply(T, thisArgument, L) : fApply.call(T, thisArgument, L);
4139 }
4140});
4141},{"3":3,"32":32,"34":34,"38":38,"7":7}],200:[function(_dereq_,module,exports){
4142// 26.1.2 Reflect.construct(target, argumentsList [, newTarget])
4143var $export = _dereq_(32)
4144 , create = _dereq_(66)
4145 , aFunction = _dereq_(3)
4146 , anObject = _dereq_(7)
4147 , isObject = _dereq_(49)
4148 , fails = _dereq_(34)
4149 , bind = _dereq_(16)
4150 , rConstruct = (_dereq_(38).Reflect || {}).construct;
4151
4152// MS Edge supports only 2 arguments and argumentsList argument is optional
4153// FF Nightly sets third argument as `new.target`, but does not create `this` from it
4154var NEW_TARGET_BUG = fails(function(){
4155 function F(){}
4156 return !(rConstruct(function(){}, [], F) instanceof F);
4157});
4158var ARGS_BUG = !fails(function(){
4159 rConstruct(function(){});
4160});
4161
4162$export($export.S + $export.F * (NEW_TARGET_BUG || ARGS_BUG), 'Reflect', {
4163 construct: function construct(Target, args /*, newTarget*/){
4164 aFunction(Target);
4165 anObject(args);
4166 var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]);
4167 if(ARGS_BUG && !NEW_TARGET_BUG)return rConstruct(Target, args, newTarget);
4168 if(Target == newTarget){
4169 // w/o altered newTarget, optimization for 0-4 arguments
4170 switch(args.length){
4171 case 0: return new Target;
4172 case 1: return new Target(args[0]);
4173 case 2: return new Target(args[0], args[1]);
4174 case 3: return new Target(args[0], args[1], args[2]);
4175 case 4: return new Target(args[0], args[1], args[2], args[3]);
4176 }
4177 // w/o altered newTarget, lot of arguments case
4178 var $args = [null];
4179 $args.push.apply($args, args);
4180 return new (bind.apply(Target, $args));
4181 }
4182 // with altered newTarget, not support built-in constructors
4183 var proto = newTarget.prototype
4184 , instance = create(isObject(proto) ? proto : Object.prototype)
4185 , result = Function.apply.call(Target, instance, args);
4186 return isObject(result) ? result : instance;
4187 }
4188});
4189},{"16":16,"3":3,"32":32,"34":34,"38":38,"49":49,"66":66,"7":7}],201:[function(_dereq_,module,exports){
4190// 26.1.3 Reflect.defineProperty(target, propertyKey, attributes)
4191var dP = _dereq_(67)
4192 , $export = _dereq_(32)
4193 , anObject = _dereq_(7)
4194 , toPrimitive = _dereq_(110);
4195
4196// MS Edge has broken Reflect.defineProperty - throwing instead of returning false
4197$export($export.S + $export.F * _dereq_(34)(function(){
4198 Reflect.defineProperty(dP.f({}, 1, {value: 1}), 1, {value: 2});
4199}), 'Reflect', {
4200 defineProperty: function defineProperty(target, propertyKey, attributes){
4201 anObject(target);
4202 propertyKey = toPrimitive(propertyKey, true);
4203 anObject(attributes);
4204 try {
4205 dP.f(target, propertyKey, attributes);
4206 return true;
4207 } catch(e){
4208 return false;
4209 }
4210 }
4211});
4212},{"110":110,"32":32,"34":34,"67":67,"7":7}],202:[function(_dereq_,module,exports){
4213// 26.1.4 Reflect.deleteProperty(target, propertyKey)
4214var $export = _dereq_(32)
4215 , gOPD = _dereq_(70).f
4216 , anObject = _dereq_(7);
4217
4218$export($export.S, 'Reflect', {
4219 deleteProperty: function deleteProperty(target, propertyKey){
4220 var desc = gOPD(anObject(target), propertyKey);
4221 return desc && !desc.configurable ? false : delete target[propertyKey];
4222 }
4223});
4224},{"32":32,"7":7,"70":70}],203:[function(_dereq_,module,exports){
4225'use strict';
4226// 26.1.5 Reflect.enumerate(target)
4227var $export = _dereq_(32)
4228 , anObject = _dereq_(7);
4229var Enumerate = function(iterated){
4230 this._t = anObject(iterated); // target
4231 this._i = 0; // next index
4232 var keys = this._k = [] // keys
4233 , key;
4234 for(key in iterated)keys.push(key);
4235};
4236_dereq_(52)(Enumerate, 'Object', function(){
4237 var that = this
4238 , keys = that._k
4239 , key;
4240 do {
4241 if(that._i >= keys.length)return {value: undefined, done: true};
4242 } while(!((key = keys[that._i++]) in that._t));
4243 return {value: key, done: false};
4244});
4245
4246$export($export.S, 'Reflect', {
4247 enumerate: function enumerate(target){
4248 return new Enumerate(target);
4249 }
4250});
4251},{"32":32,"52":52,"7":7}],204:[function(_dereq_,module,exports){
4252// 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey)
4253var gOPD = _dereq_(70)
4254 , $export = _dereq_(32)
4255 , anObject = _dereq_(7);
4256
4257$export($export.S, 'Reflect', {
4258 getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey){
4259 return gOPD.f(anObject(target), propertyKey);
4260 }
4261});
4262},{"32":32,"7":7,"70":70}],205:[function(_dereq_,module,exports){
4263// 26.1.8 Reflect.getPrototypeOf(target)
4264var $export = _dereq_(32)
4265 , getProto = _dereq_(74)
4266 , anObject = _dereq_(7);
4267
4268$export($export.S, 'Reflect', {
4269 getPrototypeOf: function getPrototypeOf(target){
4270 return getProto(anObject(target));
4271 }
4272});
4273},{"32":32,"7":7,"74":74}],206:[function(_dereq_,module,exports){
4274// 26.1.6 Reflect.get(target, propertyKey [, receiver])
4275var gOPD = _dereq_(70)
4276 , getPrototypeOf = _dereq_(74)
4277 , has = _dereq_(39)
4278 , $export = _dereq_(32)
4279 , isObject = _dereq_(49)
4280 , anObject = _dereq_(7);
4281
4282function get(target, propertyKey/*, receiver*/){
4283 var receiver = arguments.length < 3 ? target : arguments[2]
4284 , desc, proto;
4285 if(anObject(target) === receiver)return target[propertyKey];
4286 if(desc = gOPD.f(target, propertyKey))return has(desc, 'value')
4287 ? desc.value
4288 : desc.get !== undefined
4289 ? desc.get.call(receiver)
4290 : undefined;
4291 if(isObject(proto = getPrototypeOf(target)))return get(proto, propertyKey, receiver);
4292}
4293
4294$export($export.S, 'Reflect', {get: get});
4295},{"32":32,"39":39,"49":49,"7":7,"70":70,"74":74}],207:[function(_dereq_,module,exports){
4296// 26.1.9 Reflect.has(target, propertyKey)
4297var $export = _dereq_(32);
4298
4299$export($export.S, 'Reflect', {
4300 has: function has(target, propertyKey){
4301 return propertyKey in target;
4302 }
4303});
4304},{"32":32}],208:[function(_dereq_,module,exports){
4305// 26.1.10 Reflect.isExtensible(target)
4306var $export = _dereq_(32)
4307 , anObject = _dereq_(7)
4308 , $isExtensible = Object.isExtensible;
4309
4310$export($export.S, 'Reflect', {
4311 isExtensible: function isExtensible(target){
4312 anObject(target);
4313 return $isExtensible ? $isExtensible(target) : true;
4314 }
4315});
4316},{"32":32,"7":7}],209:[function(_dereq_,module,exports){
4317// 26.1.11 Reflect.ownKeys(target)
4318var $export = _dereq_(32);
4319
4320$export($export.S, 'Reflect', {ownKeys: _dereq_(80)});
4321},{"32":32,"80":80}],210:[function(_dereq_,module,exports){
4322// 26.1.12 Reflect.preventExtensions(target)
4323var $export = _dereq_(32)
4324 , anObject = _dereq_(7)
4325 , $preventExtensions = Object.preventExtensions;
4326
4327$export($export.S, 'Reflect', {
4328 preventExtensions: function preventExtensions(target){
4329 anObject(target);
4330 try {
4331 if($preventExtensions)$preventExtensions(target);
4332 return true;
4333 } catch(e){
4334 return false;
4335 }
4336 }
4337});
4338},{"32":32,"7":7}],211:[function(_dereq_,module,exports){
4339// 26.1.14 Reflect.setPrototypeOf(target, proto)
4340var $export = _dereq_(32)
4341 , setProto = _dereq_(90);
4342
4343if(setProto)$export($export.S, 'Reflect', {
4344 setPrototypeOf: function setPrototypeOf(target, proto){
4345 setProto.check(target, proto);
4346 try {
4347 setProto.set(target, proto);
4348 return true;
4349 } catch(e){
4350 return false;
4351 }
4352 }
4353});
4354},{"32":32,"90":90}],212:[function(_dereq_,module,exports){
4355// 26.1.13 Reflect.set(target, propertyKey, V [, receiver])
4356var dP = _dereq_(67)
4357 , gOPD = _dereq_(70)
4358 , getPrototypeOf = _dereq_(74)
4359 , has = _dereq_(39)
4360 , $export = _dereq_(32)
4361 , createDesc = _dereq_(85)
4362 , anObject = _dereq_(7)
4363 , isObject = _dereq_(49);
4364
4365function set(target, propertyKey, V/*, receiver*/){
4366 var receiver = arguments.length < 4 ? target : arguments[3]
4367 , ownDesc = gOPD.f(anObject(target), propertyKey)
4368 , existingDescriptor, proto;
4369 if(!ownDesc){
4370 if(isObject(proto = getPrototypeOf(target))){
4371 return set(proto, propertyKey, V, receiver);
4372 }
4373 ownDesc = createDesc(0);
4374 }
4375 if(has(ownDesc, 'value')){
4376 if(ownDesc.writable === false || !isObject(receiver))return false;
4377 existingDescriptor = gOPD.f(receiver, propertyKey) || createDesc(0);
4378 existingDescriptor.value = V;
4379 dP.f(receiver, propertyKey, existingDescriptor);
4380 return true;
4381 }
4382 return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true);
4383}
4384
4385$export($export.S, 'Reflect', {set: set});
4386},{"32":32,"39":39,"49":49,"67":67,"7":7,"70":70,"74":74,"85":85}],213:[function(_dereq_,module,exports){
4387var global = _dereq_(38)
4388 , inheritIfRequired = _dereq_(43)
4389 , dP = _dereq_(67).f
4390 , gOPN = _dereq_(72).f
4391 , isRegExp = _dereq_(50)
4392 , $flags = _dereq_(36)
4393 , $RegExp = global.RegExp
4394 , Base = $RegExp
4395 , proto = $RegExp.prototype
4396 , re1 = /a/g
4397 , re2 = /a/g
4398 // "new" creates a new object, old webkit buggy here
4399 , CORRECT_NEW = new $RegExp(re1) !== re1;
4400
4401if(_dereq_(28) && (!CORRECT_NEW || _dereq_(34)(function(){
4402 re2[_dereq_(117)('match')] = false;
4403 // RegExp constructor can alter flags and IsRegExp works correct with @@match
4404 return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i';
4405}))){
4406 $RegExp = function RegExp(p, f){
4407 var tiRE = this instanceof $RegExp
4408 , piRE = isRegExp(p)
4409 , fiU = f === undefined;
4410 return !tiRE && piRE && p.constructor === $RegExp && fiU ? p
4411 : inheritIfRequired(CORRECT_NEW
4412 ? new Base(piRE && !fiU ? p.source : p, f)
4413 : Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f)
4414 , tiRE ? this : proto, $RegExp);
4415 };
4416 var proxy = function(key){
4417 key in $RegExp || dP($RegExp, key, {
4418 configurable: true,
4419 get: function(){ return Base[key]; },
4420 set: function(it){ Base[key] = it; }
4421 });
4422 };
4423 for(var keys = gOPN(Base), i = 0; keys.length > i; )proxy(keys[i++]);
4424 proto.constructor = $RegExp;
4425 $RegExp.prototype = proto;
4426 _dereq_(87)(global, 'RegExp', $RegExp);
4427}
4428
4429_dereq_(91)('RegExp');
4430},{"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){
4431// 21.2.5.3 get RegExp.prototype.flags()
4432if(_dereq_(28) && /./g.flags != 'g')_dereq_(67).f(RegExp.prototype, 'flags', {
4433 configurable: true,
4434 get: _dereq_(36)
4435});
4436},{"28":28,"36":36,"67":67}],215:[function(_dereq_,module,exports){
4437// @@match logic
4438_dereq_(35)('match', 1, function(defined, MATCH, $match){
4439 // 21.1.3.11 String.prototype.match(regexp)
4440 return [function match(regexp){
4441 'use strict';
4442 var O = defined(this)
4443 , fn = regexp == undefined ? undefined : regexp[MATCH];
4444 return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
4445 }, $match];
4446});
4447},{"35":35}],216:[function(_dereq_,module,exports){
4448// @@replace logic
4449_dereq_(35)('replace', 2, function(defined, REPLACE, $replace){
4450 // 21.1.3.14 String.prototype.replace(searchValue, replaceValue)
4451 return [function replace(searchValue, replaceValue){
4452 'use strict';
4453 var O = defined(this)
4454 , fn = searchValue == undefined ? undefined : searchValue[REPLACE];
4455 return fn !== undefined
4456 ? fn.call(searchValue, O, replaceValue)
4457 : $replace.call(String(O), searchValue, replaceValue);
4458 }, $replace];
4459});
4460},{"35":35}],217:[function(_dereq_,module,exports){
4461// @@search logic
4462_dereq_(35)('search', 1, function(defined, SEARCH, $search){
4463 // 21.1.3.15 String.prototype.search(regexp)
4464 return [function search(regexp){
4465 'use strict';
4466 var O = defined(this)
4467 , fn = regexp == undefined ? undefined : regexp[SEARCH];
4468 return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
4469 }, $search];
4470});
4471},{"35":35}],218:[function(_dereq_,module,exports){
4472// @@split logic
4473_dereq_(35)('split', 2, function(defined, SPLIT, $split){
4474 'use strict';
4475 var isRegExp = _dereq_(50)
4476 , _split = $split
4477 , $push = [].push
4478 , $SPLIT = 'split'
4479 , LENGTH = 'length'
4480 , LAST_INDEX = 'lastIndex';
4481 if(
4482 'abbc'[$SPLIT](/(b)*/)[1] == 'c' ||
4483 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 ||
4484 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 ||
4485 '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 ||
4486 '.'[$SPLIT](/()()/)[LENGTH] > 1 ||
4487 ''[$SPLIT](/.?/)[LENGTH]
4488 ){
4489 var NPCG = /()??/.exec('')[1] === undefined; // nonparticipating capturing group
4490 // based on es5-shim implementation, need to rework it
4491 $split = function(separator, limit){
4492 var string = String(this);
4493 if(separator === undefined && limit === 0)return [];
4494 // If `separator` is not a regex, use native split
4495 if(!isRegExp(separator))return _split.call(string, separator, limit);
4496 var output = [];
4497 var flags = (separator.ignoreCase ? 'i' : '') +
4498 (separator.multiline ? 'm' : '') +
4499 (separator.unicode ? 'u' : '') +
4500 (separator.sticky ? 'y' : '');
4501 var lastLastIndex = 0;
4502 var splitLimit = limit === undefined ? 4294967295 : limit >>> 0;
4503 // Make `global` and avoid `lastIndex` issues by working with a copy
4504 var separatorCopy = new RegExp(separator.source, flags + 'g');
4505 var separator2, match, lastIndex, lastLength, i;
4506 // Doesn't need flags gy, but they don't hurt
4507 if(!NPCG)separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\s)', flags);
4508 while(match = separatorCopy.exec(string)){
4509 // `separatorCopy.lastIndex` is not reliable cross-browser
4510 lastIndex = match.index + match[0][LENGTH];
4511 if(lastIndex > lastLastIndex){
4512 output.push(string.slice(lastLastIndex, match.index));
4513 // Fix browsers whose `exec` methods don't consistently return `undefined` for NPCG
4514 if(!NPCG && match[LENGTH] > 1)match[0].replace(separator2, function(){
4515 for(i = 1; i < arguments[LENGTH] - 2; i++)if(arguments[i] === undefined)match[i] = undefined;
4516 });
4517 if(match[LENGTH] > 1 && match.index < string[LENGTH])$push.apply(output, match.slice(1));
4518 lastLength = match[0][LENGTH];
4519 lastLastIndex = lastIndex;
4520 if(output[LENGTH] >= splitLimit)break;
4521 }
4522 if(separatorCopy[LAST_INDEX] === match.index)separatorCopy[LAST_INDEX]++; // Avoid an infinite loop
4523 }
4524 if(lastLastIndex === string[LENGTH]){
4525 if(lastLength || !separatorCopy.test(''))output.push('');
4526 } else output.push(string.slice(lastLastIndex));
4527 return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output;
4528 };
4529 // Chakra, V8
4530 } else if('0'[$SPLIT](undefined, 0)[LENGTH]){
4531 $split = function(separator, limit){
4532 return separator === undefined && limit === 0 ? [] : _split.call(this, separator, limit);
4533 };
4534 }
4535 // 21.1.3.17 String.prototype.split(separator, limit)
4536 return [function split(separator, limit){
4537 var O = defined(this)
4538 , fn = separator == undefined ? undefined : separator[SPLIT];
4539 return fn !== undefined ? fn.call(separator, O, limit) : $split.call(String(O), separator, limit);
4540 }, $split];
4541});
4542},{"35":35,"50":50}],219:[function(_dereq_,module,exports){
4543'use strict';
4544_dereq_(214);
4545var anObject = _dereq_(7)
4546 , $flags = _dereq_(36)
4547 , DESCRIPTORS = _dereq_(28)
4548 , TO_STRING = 'toString'
4549 , $toString = /./[TO_STRING];
4550
4551var define = function(fn){
4552 _dereq_(87)(RegExp.prototype, TO_STRING, fn, true);
4553};
4554
4555// 21.2.5.14 RegExp.prototype.toString()
4556if(_dereq_(34)(function(){ return $toString.call({source: 'a', flags: 'b'}) != '/a/b'; })){
4557 define(function toString(){
4558 var R = anObject(this);
4559 return '/'.concat(R.source, '/',
4560 'flags' in R ? R.flags : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined);
4561 });
4562// FF44- RegExp#toString has a wrong name
4563} else if($toString.name != TO_STRING){
4564 define(function toString(){
4565 return $toString.call(this);
4566 });
4567}
4568},{"214":214,"28":28,"34":34,"36":36,"7":7,"87":87}],220:[function(_dereq_,module,exports){
4569'use strict';
4570var strong = _dereq_(19);
4571
4572// 23.2 Set Objects
4573module.exports = _dereq_(22)('Set', function(get){
4574 return function Set(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
4575}, {
4576 // 23.2.3.1 Set.prototype.add(value)
4577 add: function add(value){
4578 return strong.def(this, value = value === 0 ? 0 : value, value);
4579 }
4580}, strong);
4581},{"19":19,"22":22}],221:[function(_dereq_,module,exports){
4582'use strict';
4583// B.2.3.2 String.prototype.anchor(name)
4584_dereq_(99)('anchor', function(createHTML){
4585 return function anchor(name){
4586 return createHTML(this, 'a', 'name', name);
4587 }
4588});
4589},{"99":99}],222:[function(_dereq_,module,exports){
4590'use strict';
4591// B.2.3.3 String.prototype.big()
4592_dereq_(99)('big', function(createHTML){
4593 return function big(){
4594 return createHTML(this, 'big', '', '');
4595 }
4596});
4597},{"99":99}],223:[function(_dereq_,module,exports){
4598'use strict';
4599// B.2.3.4 String.prototype.blink()
4600_dereq_(99)('blink', function(createHTML){
4601 return function blink(){
4602 return createHTML(this, 'blink', '', '');
4603 }
4604});
4605},{"99":99}],224:[function(_dereq_,module,exports){
4606'use strict';
4607// B.2.3.5 String.prototype.bold()
4608_dereq_(99)('bold', function(createHTML){
4609 return function bold(){
4610 return createHTML(this, 'b', '', '');
4611 }
4612});
4613},{"99":99}],225:[function(_dereq_,module,exports){
4614'use strict';
4615var $export = _dereq_(32)
4616 , $at = _dereq_(97)(false);
4617$export($export.P, 'String', {
4618 // 21.1.3.3 String.prototype.codePointAt(pos)
4619 codePointAt: function codePointAt(pos){
4620 return $at(this, pos);
4621 }
4622});
4623},{"32":32,"97":97}],226:[function(_dereq_,module,exports){
4624// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition])
4625'use strict';
4626var $export = _dereq_(32)
4627 , toLength = _dereq_(108)
4628 , context = _dereq_(98)
4629 , ENDS_WITH = 'endsWith'
4630 , $endsWith = ''[ENDS_WITH];
4631
4632$export($export.P + $export.F * _dereq_(33)(ENDS_WITH), 'String', {
4633 endsWith: function endsWith(searchString /*, endPosition = @length */){
4634 var that = context(this, searchString, ENDS_WITH)
4635 , endPosition = arguments.length > 1 ? arguments[1] : undefined
4636 , len = toLength(that.length)
4637 , end = endPosition === undefined ? len : Math.min(toLength(endPosition), len)
4638 , search = String(searchString);
4639 return $endsWith
4640 ? $endsWith.call(that, search, end)
4641 : that.slice(end - search.length, end) === search;
4642 }
4643});
4644},{"108":108,"32":32,"33":33,"98":98}],227:[function(_dereq_,module,exports){
4645'use strict';
4646// B.2.3.6 String.prototype.fixed()
4647_dereq_(99)('fixed', function(createHTML){
4648 return function fixed(){
4649 return createHTML(this, 'tt', '', '');
4650 }
4651});
4652},{"99":99}],228:[function(_dereq_,module,exports){
4653'use strict';
4654// B.2.3.7 String.prototype.fontcolor(color)
4655_dereq_(99)('fontcolor', function(createHTML){
4656 return function fontcolor(color){
4657 return createHTML(this, 'font', 'color', color);
4658 }
4659});
4660},{"99":99}],229:[function(_dereq_,module,exports){
4661'use strict';
4662// B.2.3.8 String.prototype.fontsize(size)
4663_dereq_(99)('fontsize', function(createHTML){
4664 return function fontsize(size){
4665 return createHTML(this, 'font', 'size', size);
4666 }
4667});
4668},{"99":99}],230:[function(_dereq_,module,exports){
4669var $export = _dereq_(32)
4670 , toIndex = _dereq_(105)
4671 , fromCharCode = String.fromCharCode
4672 , $fromCodePoint = String.fromCodePoint;
4673
4674// length should be 1, old FF problem
4675$export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
4676 // 21.1.2.2 String.fromCodePoint(...codePoints)
4677 fromCodePoint: function fromCodePoint(x){ // eslint-disable-line no-unused-vars
4678 var res = []
4679 , aLen = arguments.length
4680 , i = 0
4681 , code;
4682 while(aLen > i){
4683 code = +arguments[i++];
4684 if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point');
4685 res.push(code < 0x10000
4686 ? fromCharCode(code)
4687 : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
4688 );
4689 } return res.join('');
4690 }
4691});
4692},{"105":105,"32":32}],231:[function(_dereq_,module,exports){
4693// 21.1.3.7 String.prototype.includes(searchString, position = 0)
4694'use strict';
4695var $export = _dereq_(32)
4696 , context = _dereq_(98)
4697 , INCLUDES = 'includes';
4698
4699$export($export.P + $export.F * _dereq_(33)(INCLUDES), 'String', {
4700 includes: function includes(searchString /*, position = 0 */){
4701 return !!~context(this, searchString, INCLUDES)
4702 .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined);
4703 }
4704});
4705},{"32":32,"33":33,"98":98}],232:[function(_dereq_,module,exports){
4706'use strict';
4707// B.2.3.9 String.prototype.italics()
4708_dereq_(99)('italics', function(createHTML){
4709 return function italics(){
4710 return createHTML(this, 'i', '', '');
4711 }
4712});
4713},{"99":99}],233:[function(_dereq_,module,exports){
4714'use strict';
4715var $at = _dereq_(97)(true);
4716
4717// 21.1.3.27 String.prototype[@@iterator]()
4718_dereq_(53)(String, 'String', function(iterated){
4719 this._t = String(iterated); // target
4720 this._i = 0; // next index
4721// 21.1.5.2.1 %StringIteratorPrototype%.next()
4722}, function(){
4723 var O = this._t
4724 , index = this._i
4725 , point;
4726 if(index >= O.length)return {value: undefined, done: true};
4727 point = $at(O, index);
4728 this._i += point.length;
4729 return {value: point, done: false};
4730});
4731},{"53":53,"97":97}],234:[function(_dereq_,module,exports){
4732'use strict';
4733// B.2.3.10 String.prototype.link(url)
4734_dereq_(99)('link', function(createHTML){
4735 return function link(url){
4736 return createHTML(this, 'a', 'href', url);
4737 }
4738});
4739},{"99":99}],235:[function(_dereq_,module,exports){
4740var $export = _dereq_(32)
4741 , toIObject = _dereq_(107)
4742 , toLength = _dereq_(108);
4743
4744$export($export.S, 'String', {
4745 // 21.1.2.4 String.raw(callSite, ...substitutions)
4746 raw: function raw(callSite){
4747 var tpl = toIObject(callSite.raw)
4748 , len = toLength(tpl.length)
4749 , aLen = arguments.length
4750 , res = []
4751 , i = 0;
4752 while(len > i){
4753 res.push(String(tpl[i++]));
4754 if(i < aLen)res.push(String(arguments[i]));
4755 } return res.join('');
4756 }
4757});
4758},{"107":107,"108":108,"32":32}],236:[function(_dereq_,module,exports){
4759var $export = _dereq_(32);
4760
4761$export($export.P, 'String', {
4762 // 21.1.3.13 String.prototype.repeat(count)
4763 repeat: _dereq_(101)
4764});
4765},{"101":101,"32":32}],237:[function(_dereq_,module,exports){
4766'use strict';
4767// B.2.3.11 String.prototype.small()
4768_dereq_(99)('small', function(createHTML){
4769 return function small(){
4770 return createHTML(this, 'small', '', '');
4771 }
4772});
4773},{"99":99}],238:[function(_dereq_,module,exports){
4774// 21.1.3.18 String.prototype.startsWith(searchString [, position ])
4775'use strict';
4776var $export = _dereq_(32)
4777 , toLength = _dereq_(108)
4778 , context = _dereq_(98)
4779 , STARTS_WITH = 'startsWith'
4780 , $startsWith = ''[STARTS_WITH];
4781
4782$export($export.P + $export.F * _dereq_(33)(STARTS_WITH), 'String', {
4783 startsWith: function startsWith(searchString /*, position = 0 */){
4784 var that = context(this, searchString, STARTS_WITH)
4785 , index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length))
4786 , search = String(searchString);
4787 return $startsWith
4788 ? $startsWith.call(that, search, index)
4789 : that.slice(index, index + search.length) === search;
4790 }
4791});
4792},{"108":108,"32":32,"33":33,"98":98}],239:[function(_dereq_,module,exports){
4793'use strict';
4794// B.2.3.12 String.prototype.strike()
4795_dereq_(99)('strike', function(createHTML){
4796 return function strike(){
4797 return createHTML(this, 'strike', '', '');
4798 }
4799});
4800},{"99":99}],240:[function(_dereq_,module,exports){
4801'use strict';
4802// B.2.3.13 String.prototype.sub()
4803_dereq_(99)('sub', function(createHTML){
4804 return function sub(){
4805 return createHTML(this, 'sub', '', '');
4806 }
4807});
4808},{"99":99}],241:[function(_dereq_,module,exports){
4809'use strict';
4810// B.2.3.14 String.prototype.sup()
4811_dereq_(99)('sup', function(createHTML){
4812 return function sup(){
4813 return createHTML(this, 'sup', '', '');
4814 }
4815});
4816},{"99":99}],242:[function(_dereq_,module,exports){
4817'use strict';
4818// 21.1.3.25 String.prototype.trim()
4819_dereq_(102)('trim', function($trim){
4820 return function trim(){
4821 return $trim(this, 3);
4822 };
4823});
4824},{"102":102}],243:[function(_dereq_,module,exports){
4825'use strict';
4826// ECMAScript 6 symbols shim
4827var global = _dereq_(38)
4828 , has = _dereq_(39)
4829 , DESCRIPTORS = _dereq_(28)
4830 , $export = _dereq_(32)
4831 , redefine = _dereq_(87)
4832 , META = _dereq_(62).KEY
4833 , $fails = _dereq_(34)
4834 , shared = _dereq_(94)
4835 , setToStringTag = _dereq_(92)
4836 , uid = _dereq_(114)
4837 , wks = _dereq_(117)
4838 , wksExt = _dereq_(116)
4839 , wksDefine = _dereq_(115)
4840 , keyOf = _dereq_(57)
4841 , enumKeys = _dereq_(31)
4842 , isArray = _dereq_(47)
4843 , anObject = _dereq_(7)
4844 , toIObject = _dereq_(107)
4845 , toPrimitive = _dereq_(110)
4846 , createDesc = _dereq_(85)
4847 , _create = _dereq_(66)
4848 , gOPNExt = _dereq_(71)
4849 , $GOPD = _dereq_(70)
4850 , $DP = _dereq_(67)
4851 , $keys = _dereq_(76)
4852 , gOPD = $GOPD.f
4853 , dP = $DP.f
4854 , gOPN = gOPNExt.f
4855 , $Symbol = global.Symbol
4856 , $JSON = global.JSON
4857 , _stringify = $JSON && $JSON.stringify
4858 , PROTOTYPE = 'prototype'
4859 , HIDDEN = wks('_hidden')
4860 , TO_PRIMITIVE = wks('toPrimitive')
4861 , isEnum = {}.propertyIsEnumerable
4862 , SymbolRegistry = shared('symbol-registry')
4863 , AllSymbols = shared('symbols')
4864 , OPSymbols = shared('op-symbols')
4865 , ObjectProto = Object[PROTOTYPE]
4866 , USE_NATIVE = typeof $Symbol == 'function'
4867 , QObject = global.QObject;
4868// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
4869var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
4870
4871// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
4872var setSymbolDesc = DESCRIPTORS && $fails(function(){
4873 return _create(dP({}, 'a', {
4874 get: function(){ return dP(this, 'a', {value: 7}).a; }
4875 })).a != 7;
4876}) ? function(it, key, D){
4877 var protoDesc = gOPD(ObjectProto, key);
4878 if(protoDesc)delete ObjectProto[key];
4879 dP(it, key, D);
4880 if(protoDesc && it !== ObjectProto)dP(ObjectProto, key, protoDesc);
4881} : dP;
4882
4883var wrap = function(tag){
4884 var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
4885 sym._k = tag;
4886 return sym;
4887};
4888
4889var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function(it){
4890 return typeof it == 'symbol';
4891} : function(it){
4892 return it instanceof $Symbol;
4893};
4894
4895var $defineProperty = function defineProperty(it, key, D){
4896 if(it === ObjectProto)$defineProperty(OPSymbols, key, D);
4897 anObject(it);
4898 key = toPrimitive(key, true);
4899 anObject(D);
4900 if(has(AllSymbols, key)){
4901 if(!D.enumerable){
4902 if(!has(it, HIDDEN))dP(it, HIDDEN, createDesc(1, {}));
4903 it[HIDDEN][key] = true;
4904 } else {
4905 if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false;
4906 D = _create(D, {enumerable: createDesc(0, false)});
4907 } return setSymbolDesc(it, key, D);
4908 } return dP(it, key, D);
4909};
4910var $defineProperties = function defineProperties(it, P){
4911 anObject(it);
4912 var keys = enumKeys(P = toIObject(P))
4913 , i = 0
4914 , l = keys.length
4915 , key;
4916 while(l > i)$defineProperty(it, key = keys[i++], P[key]);
4917 return it;
4918};
4919var $create = function create(it, P){
4920 return P === undefined ? _create(it) : $defineProperties(_create(it), P);
4921};
4922var $propertyIsEnumerable = function propertyIsEnumerable(key){
4923 var E = isEnum.call(this, key = toPrimitive(key, true));
4924 if(this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return false;
4925 return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
4926};
4927var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){
4928 it = toIObject(it);
4929 key = toPrimitive(key, true);
4930 if(it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return;
4931 var D = gOPD(it, key);
4932 if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true;
4933 return D;
4934};
4935var $getOwnPropertyNames = function getOwnPropertyNames(it){
4936 var names = gOPN(toIObject(it))
4937 , result = []
4938 , i = 0
4939 , key;
4940 while(names.length > i){
4941 if(!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META)result.push(key);
4942 } return result;
4943};
4944var $getOwnPropertySymbols = function getOwnPropertySymbols(it){
4945 var IS_OP = it === ObjectProto
4946 , names = gOPN(IS_OP ? OPSymbols : toIObject(it))
4947 , result = []
4948 , i = 0
4949 , key;
4950 while(names.length > i){
4951 if(has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true))result.push(AllSymbols[key]);
4952 } return result;
4953};
4954
4955// 19.4.1.1 Symbol([description])
4956if(!USE_NATIVE){
4957 $Symbol = function Symbol(){
4958 if(this instanceof $Symbol)throw TypeError('Symbol is not a constructor!');
4959 var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
4960 var $set = function(value){
4961 if(this === ObjectProto)$set.call(OPSymbols, value);
4962 if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false;
4963 setSymbolDesc(this, tag, createDesc(1, value));
4964 };
4965 if(DESCRIPTORS && setter)setSymbolDesc(ObjectProto, tag, {configurable: true, set: $set});
4966 return wrap(tag);
4967 };
4968 redefine($Symbol[PROTOTYPE], 'toString', function toString(){
4969 return this._k;
4970 });
4971
4972 $GOPD.f = $getOwnPropertyDescriptor;
4973 $DP.f = $defineProperty;
4974 _dereq_(72).f = gOPNExt.f = $getOwnPropertyNames;
4975 _dereq_(77).f = $propertyIsEnumerable;
4976 _dereq_(73).f = $getOwnPropertySymbols;
4977
4978 if(DESCRIPTORS && !_dereq_(58)){
4979 redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
4980 }
4981
4982 wksExt.f = function(name){
4983 return wrap(wks(name));
4984 }
4985}
4986
4987$export($export.G + $export.W + $export.F * !USE_NATIVE, {Symbol: $Symbol});
4988
4989for(var symbols = (
4990 // 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
4991 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
4992).split(','), i = 0; symbols.length > i; )wks(symbols[i++]);
4993
4994for(var symbols = $keys(wks.store), i = 0; symbols.length > i; )wksDefine(symbols[i++]);
4995
4996$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
4997 // 19.4.2.1 Symbol.for(key)
4998 'for': function(key){
4999 return has(SymbolRegistry, key += '')
5000 ? SymbolRegistry[key]
5001 : SymbolRegistry[key] = $Symbol(key);
5002 },
5003 // 19.4.2.5 Symbol.keyFor(sym)
5004 keyFor: function keyFor(key){
5005 if(isSymbol(key))return keyOf(SymbolRegistry, key);
5006 throw TypeError(key + ' is not a symbol!');
5007 },
5008 useSetter: function(){ setter = true; },
5009 useSimple: function(){ setter = false; }
5010});
5011
5012$export($export.S + $export.F * !USE_NATIVE, 'Object', {
5013 // 19.1.2.2 Object.create(O [, Properties])
5014 create: $create,
5015 // 19.1.2.4 Object.defineProperty(O, P, Attributes)
5016 defineProperty: $defineProperty,
5017 // 19.1.2.3 Object.defineProperties(O, Properties)
5018 defineProperties: $defineProperties,
5019 // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
5020 getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
5021 // 19.1.2.7 Object.getOwnPropertyNames(O)
5022 getOwnPropertyNames: $getOwnPropertyNames,
5023 // 19.1.2.8 Object.getOwnPropertySymbols(O)
5024 getOwnPropertySymbols: $getOwnPropertySymbols
5025});
5026
5027// 24.3.2 JSON.stringify(value [, replacer [, space]])
5028$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function(){
5029 var S = $Symbol();
5030 // MS Edge converts symbol values to JSON as {}
5031 // WebKit converts symbol values to JSON as null
5032 // V8 throws on boxed symbols
5033 return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}';
5034})), 'JSON', {
5035 stringify: function stringify(it){
5036 if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined
5037 var args = [it]
5038 , i = 1
5039 , replacer, $replacer;
5040 while(arguments.length > i)args.push(arguments[i++]);
5041 replacer = args[1];
5042 if(typeof replacer == 'function')$replacer = replacer;
5043 if($replacer || !isArray(replacer))replacer = function(key, value){
5044 if($replacer)value = $replacer.call(this, key, value);
5045 if(!isSymbol(value))return value;
5046 };
5047 args[1] = replacer;
5048 return _stringify.apply($JSON, args);
5049 }
5050});
5051
5052// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
5053$Symbol[PROTOTYPE][TO_PRIMITIVE] || _dereq_(40)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
5054// 19.4.3.5 Symbol.prototype[@@toStringTag]
5055setToStringTag($Symbol, 'Symbol');
5056// 20.2.1.9 Math[@@toStringTag]
5057setToStringTag(Math, 'Math', true);
5058// 24.3.3 JSON[@@toStringTag]
5059setToStringTag(global.JSON, 'JSON', true);
5060},{"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){
5061'use strict';
5062var $export = _dereq_(32)
5063 , $typed = _dereq_(113)
5064 , buffer = _dereq_(112)
5065 , anObject = _dereq_(7)
5066 , toIndex = _dereq_(105)
5067 , toLength = _dereq_(108)
5068 , isObject = _dereq_(49)
5069 , ArrayBuffer = _dereq_(38).ArrayBuffer
5070 , speciesConstructor = _dereq_(95)
5071 , $ArrayBuffer = buffer.ArrayBuffer
5072 , $DataView = buffer.DataView
5073 , $isView = $typed.ABV && ArrayBuffer.isView
5074 , $slice = $ArrayBuffer.prototype.slice
5075 , VIEW = $typed.VIEW
5076 , ARRAY_BUFFER = 'ArrayBuffer';
5077
5078$export($export.G + $export.W + $export.F * (ArrayBuffer !== $ArrayBuffer), {ArrayBuffer: $ArrayBuffer});
5079
5080$export($export.S + $export.F * !$typed.CONSTR, ARRAY_BUFFER, {
5081 // 24.1.3.1 ArrayBuffer.isView(arg)
5082 isView: function isView(it){
5083 return $isView && $isView(it) || isObject(it) && VIEW in it;
5084 }
5085});
5086
5087$export($export.P + $export.U + $export.F * _dereq_(34)(function(){
5088 return !new $ArrayBuffer(2).slice(1, undefined).byteLength;
5089}), ARRAY_BUFFER, {
5090 // 24.1.4.3 ArrayBuffer.prototype.slice(start, end)
5091 slice: function slice(start, end){
5092 if($slice !== undefined && end === undefined)return $slice.call(anObject(this), start); // FF fix
5093 var len = anObject(this).byteLength
5094 , first = toIndex(start, len)
5095 , final = toIndex(end === undefined ? len : end, len)
5096 , result = new (speciesConstructor(this, $ArrayBuffer))(toLength(final - first))
5097 , viewS = new $DataView(this)
5098 , viewT = new $DataView(result)
5099 , index = 0;
5100 while(first < final){
5101 viewT.setUint8(index++, viewS.getUint8(first++));
5102 } return result;
5103 }
5104});
5105
5106_dereq_(91)(ARRAY_BUFFER);
5107},{"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){
5108var $export = _dereq_(32);
5109$export($export.G + $export.W + $export.F * !_dereq_(113).ABV, {
5110 DataView: _dereq_(112).DataView
5111});
5112},{"112":112,"113":113,"32":32}],246:[function(_dereq_,module,exports){
5113_dereq_(111)('Float32', 4, function(init){
5114 return function Float32Array(data, byteOffset, length){
5115 return init(this, data, byteOffset, length);
5116 };
5117});
5118},{"111":111}],247:[function(_dereq_,module,exports){
5119_dereq_(111)('Float64', 8, function(init){
5120 return function Float64Array(data, byteOffset, length){
5121 return init(this, data, byteOffset, length);
5122 };
5123});
5124},{"111":111}],248:[function(_dereq_,module,exports){
5125_dereq_(111)('Int16', 2, function(init){
5126 return function Int16Array(data, byteOffset, length){
5127 return init(this, data, byteOffset, length);
5128 };
5129});
5130},{"111":111}],249:[function(_dereq_,module,exports){
5131_dereq_(111)('Int32', 4, function(init){
5132 return function Int32Array(data, byteOffset, length){
5133 return init(this, data, byteOffset, length);
5134 };
5135});
5136},{"111":111}],250:[function(_dereq_,module,exports){
5137_dereq_(111)('Int8', 1, function(init){
5138 return function Int8Array(data, byteOffset, length){
5139 return init(this, data, byteOffset, length);
5140 };
5141});
5142},{"111":111}],251:[function(_dereq_,module,exports){
5143_dereq_(111)('Uint16', 2, function(init){
5144 return function Uint16Array(data, byteOffset, length){
5145 return init(this, data, byteOffset, length);
5146 };
5147});
5148},{"111":111}],252:[function(_dereq_,module,exports){
5149_dereq_(111)('Uint32', 4, function(init){
5150 return function Uint32Array(data, byteOffset, length){
5151 return init(this, data, byteOffset, length);
5152 };
5153});
5154},{"111":111}],253:[function(_dereq_,module,exports){
5155_dereq_(111)('Uint8', 1, function(init){
5156 return function Uint8Array(data, byteOffset, length){
5157 return init(this, data, byteOffset, length);
5158 };
5159});
5160},{"111":111}],254:[function(_dereq_,module,exports){
5161_dereq_(111)('Uint8', 1, function(init){
5162 return function Uint8ClampedArray(data, byteOffset, length){
5163 return init(this, data, byteOffset, length);
5164 };
5165}, true);
5166},{"111":111}],255:[function(_dereq_,module,exports){
5167'use strict';
5168var each = _dereq_(12)(0)
5169 , redefine = _dereq_(87)
5170 , meta = _dereq_(62)
5171 , assign = _dereq_(65)
5172 , weak = _dereq_(21)
5173 , isObject = _dereq_(49)
5174 , getWeak = meta.getWeak
5175 , isExtensible = Object.isExtensible
5176 , uncaughtFrozenStore = weak.ufstore
5177 , tmp = {}
5178 , InternalMap;
5179
5180var wrapper = function(get){
5181 return function WeakMap(){
5182 return get(this, arguments.length > 0 ? arguments[0] : undefined);
5183 };
5184};
5185
5186var methods = {
5187 // 23.3.3.3 WeakMap.prototype.get(key)
5188 get: function get(key){
5189 if(isObject(key)){
5190 var data = getWeak(key);
5191 if(data === true)return uncaughtFrozenStore(this).get(key);
5192 return data ? data[this._i] : undefined;
5193 }
5194 },
5195 // 23.3.3.5 WeakMap.prototype.set(key, value)
5196 set: function set(key, value){
5197 return weak.def(this, key, value);
5198 }
5199};
5200
5201// 23.3 WeakMap Objects
5202var $WeakMap = module.exports = _dereq_(22)('WeakMap', wrapper, methods, weak, true, true);
5203
5204// IE11 WeakMap frozen keys fix
5205if(new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7){
5206 InternalMap = weak.getConstructor(wrapper);
5207 assign(InternalMap.prototype, methods);
5208 meta.NEED = true;
5209 each(['delete', 'has', 'get', 'set'], function(key){
5210 var proto = $WeakMap.prototype
5211 , method = proto[key];
5212 redefine(proto, key, function(a, b){
5213 // store frozen objects on internal weakmap shim
5214 if(isObject(a) && !isExtensible(a)){
5215 if(!this._f)this._f = new InternalMap;
5216 var result = this._f[key](a, b);
5217 return key == 'set' ? this : result;
5218 // store all the rest on native weakmap
5219 } return method.call(this, a, b);
5220 });
5221 });
5222}
5223},{"12":12,"21":21,"22":22,"49":49,"62":62,"65":65,"87":87}],256:[function(_dereq_,module,exports){
5224'use strict';
5225var weak = _dereq_(21);
5226
5227// 23.4 WeakSet Objects
5228_dereq_(22)('WeakSet', function(get){
5229 return function WeakSet(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
5230}, {
5231 // 23.4.3.1 WeakSet.prototype.add(value)
5232 add: function add(value){
5233 return weak.def(this, value, true);
5234 }
5235}, weak, false, true);
5236},{"21":21,"22":22}],257:[function(_dereq_,module,exports){
5237'use strict';
5238// https://github.com/tc39/Array.prototype.includes
5239var $export = _dereq_(32)
5240 , $includes = _dereq_(11)(true);
5241
5242$export($export.P, 'Array', {
5243 includes: function includes(el /*, fromIndex = 0 */){
5244 return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
5245 }
5246});
5247
5248_dereq_(5)('includes');
5249},{"11":11,"32":32,"5":5}],258:[function(_dereq_,module,exports){
5250// https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-09/sept-25.md#510-globalasap-for-enqueuing-a-microtask
5251var $export = _dereq_(32)
5252 , microtask = _dereq_(64)()
5253 , process = _dereq_(38).process
5254 , isNode = _dereq_(18)(process) == 'process';
5255
5256$export($export.G, {
5257 asap: function asap(fn){
5258 var domain = isNode && process.domain;
5259 microtask(domain ? domain.bind(fn) : fn);
5260 }
5261});
5262},{"18":18,"32":32,"38":38,"64":64}],259:[function(_dereq_,module,exports){
5263// https://github.com/ljharb/proposal-is-error
5264var $export = _dereq_(32)
5265 , cof = _dereq_(18);
5266
5267$export($export.S, 'Error', {
5268 isError: function isError(it){
5269 return cof(it) === 'Error';
5270 }
5271});
5272},{"18":18,"32":32}],260:[function(_dereq_,module,exports){
5273// https://github.com/DavidBruant/Map-Set.prototype.toJSON
5274var $export = _dereq_(32);
5275
5276$export($export.P + $export.R, 'Map', {toJSON: _dereq_(20)('Map')});
5277},{"20":20,"32":32}],261:[function(_dereq_,module,exports){
5278// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
5279var $export = _dereq_(32);
5280
5281$export($export.S, 'Math', {
5282 iaddh: function iaddh(x0, x1, y0, y1){
5283 var $x0 = x0 >>> 0
5284 , $x1 = x1 >>> 0
5285 , $y0 = y0 >>> 0;
5286 return $x1 + (y1 >>> 0) + (($x0 & $y0 | ($x0 | $y0) & ~($x0 + $y0 >>> 0)) >>> 31) | 0;
5287 }
5288});
5289},{"32":32}],262:[function(_dereq_,module,exports){
5290// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
5291var $export = _dereq_(32);
5292
5293$export($export.S, 'Math', {
5294 imulh: function imulh(u, v){
5295 var UINT16 = 0xffff
5296 , $u = +u
5297 , $v = +v
5298 , u0 = $u & UINT16
5299 , v0 = $v & UINT16
5300 , u1 = $u >> 16
5301 , v1 = $v >> 16
5302 , t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16);
5303 return u1 * v1 + (t >> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >> 16);
5304 }
5305});
5306},{"32":32}],263:[function(_dereq_,module,exports){
5307// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
5308var $export = _dereq_(32);
5309
5310$export($export.S, 'Math', {
5311 isubh: function isubh(x0, x1, y0, y1){
5312 var $x0 = x0 >>> 0
5313 , $x1 = x1 >>> 0
5314 , $y0 = y0 >>> 0;
5315 return $x1 - (y1 >>> 0) - ((~$x0 & $y0 | ~($x0 ^ $y0) & $x0 - $y0 >>> 0) >>> 31) | 0;
5316 }
5317});
5318},{"32":32}],264:[function(_dereq_,module,exports){
5319// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
5320var $export = _dereq_(32);
5321
5322$export($export.S, 'Math', {
5323 umulh: function umulh(u, v){
5324 var UINT16 = 0xffff
5325 , $u = +u
5326 , $v = +v
5327 , u0 = $u & UINT16
5328 , v0 = $v & UINT16
5329 , u1 = $u >>> 16
5330 , v1 = $v >>> 16
5331 , t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16);
5332 return u1 * v1 + (t >>> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >>> 16);
5333 }
5334});
5335},{"32":32}],265:[function(_dereq_,module,exports){
5336'use strict';
5337var $export = _dereq_(32)
5338 , toObject = _dereq_(109)
5339 , aFunction = _dereq_(3)
5340 , $defineProperty = _dereq_(67);
5341
5342// B.2.2.2 Object.prototype.__defineGetter__(P, getter)
5343_dereq_(28) && $export($export.P + _dereq_(69), 'Object', {
5344 __defineGetter__: function __defineGetter__(P, getter){
5345 $defineProperty.f(toObject(this), P, {get: aFunction(getter), enumerable: true, configurable: true});
5346 }
5347});
5348},{"109":109,"28":28,"3":3,"32":32,"67":67,"69":69}],266:[function(_dereq_,module,exports){
5349'use strict';
5350var $export = _dereq_(32)
5351 , toObject = _dereq_(109)
5352 , aFunction = _dereq_(3)
5353 , $defineProperty = _dereq_(67);
5354
5355// B.2.2.3 Object.prototype.__defineSetter__(P, setter)
5356_dereq_(28) && $export($export.P + _dereq_(69), 'Object', {
5357 __defineSetter__: function __defineSetter__(P, setter){
5358 $defineProperty.f(toObject(this), P, {set: aFunction(setter), enumerable: true, configurable: true});
5359 }
5360});
5361},{"109":109,"28":28,"3":3,"32":32,"67":67,"69":69}],267:[function(_dereq_,module,exports){
5362// https://github.com/tc39/proposal-object-values-entries
5363var $export = _dereq_(32)
5364 , $entries = _dereq_(79)(true);
5365
5366$export($export.S, 'Object', {
5367 entries: function entries(it){
5368 return $entries(it);
5369 }
5370});
5371},{"32":32,"79":79}],268:[function(_dereq_,module,exports){
5372// https://github.com/tc39/proposal-object-getownpropertydescriptors
5373var $export = _dereq_(32)
5374 , ownKeys = _dereq_(80)
5375 , toIObject = _dereq_(107)
5376 , gOPD = _dereq_(70)
5377 , createProperty = _dereq_(24);
5378
5379$export($export.S, 'Object', {
5380 getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object){
5381 var O = toIObject(object)
5382 , getDesc = gOPD.f
5383 , keys = ownKeys(O)
5384 , result = {}
5385 , i = 0
5386 , key;
5387 while(keys.length > i)createProperty(result, key = keys[i++], getDesc(O, key));
5388 return result;
5389 }
5390});
5391},{"107":107,"24":24,"32":32,"70":70,"80":80}],269:[function(_dereq_,module,exports){
5392'use strict';
5393var $export = _dereq_(32)
5394 , toObject = _dereq_(109)
5395 , toPrimitive = _dereq_(110)
5396 , getPrototypeOf = _dereq_(74)
5397 , getOwnPropertyDescriptor = _dereq_(70).f;
5398
5399// B.2.2.4 Object.prototype.__lookupGetter__(P)
5400_dereq_(28) && $export($export.P + _dereq_(69), 'Object', {
5401 __lookupGetter__: function __lookupGetter__(P){
5402 var O = toObject(this)
5403 , K = toPrimitive(P, true)
5404 , D;
5405 do {
5406 if(D = getOwnPropertyDescriptor(O, K))return D.get;
5407 } while(O = getPrototypeOf(O));
5408 }
5409});
5410},{"109":109,"110":110,"28":28,"32":32,"69":69,"70":70,"74":74}],270:[function(_dereq_,module,exports){
5411'use strict';
5412var $export = _dereq_(32)
5413 , toObject = _dereq_(109)
5414 , toPrimitive = _dereq_(110)
5415 , getPrototypeOf = _dereq_(74)
5416 , getOwnPropertyDescriptor = _dereq_(70).f;
5417
5418// B.2.2.5 Object.prototype.__lookupSetter__(P)
5419_dereq_(28) && $export($export.P + _dereq_(69), 'Object', {
5420 __lookupSetter__: function __lookupSetter__(P){
5421 var O = toObject(this)
5422 , K = toPrimitive(P, true)
5423 , D;
5424 do {
5425 if(D = getOwnPropertyDescriptor(O, K))return D.set;
5426 } while(O = getPrototypeOf(O));
5427 }
5428});
5429},{"109":109,"110":110,"28":28,"32":32,"69":69,"70":70,"74":74}],271:[function(_dereq_,module,exports){
5430// https://github.com/tc39/proposal-object-values-entries
5431var $export = _dereq_(32)
5432 , $values = _dereq_(79)(false);
5433
5434$export($export.S, 'Object', {
5435 values: function values(it){
5436 return $values(it);
5437 }
5438});
5439},{"32":32,"79":79}],272:[function(_dereq_,module,exports){
5440'use strict';
5441// https://github.com/zenparsing/es-observable
5442var $export = _dereq_(32)
5443 , global = _dereq_(38)
5444 , core = _dereq_(23)
5445 , microtask = _dereq_(64)()
5446 , OBSERVABLE = _dereq_(117)('observable')
5447 , aFunction = _dereq_(3)
5448 , anObject = _dereq_(7)
5449 , anInstance = _dereq_(6)
5450 , redefineAll = _dereq_(86)
5451 , hide = _dereq_(40)
5452 , forOf = _dereq_(37)
5453 , RETURN = forOf.RETURN;
5454
5455var getMethod = function(fn){
5456 return fn == null ? undefined : aFunction(fn);
5457};
5458
5459var cleanupSubscription = function(subscription){
5460 var cleanup = subscription._c;
5461 if(cleanup){
5462 subscription._c = undefined;
5463 cleanup();
5464 }
5465};
5466
5467var subscriptionClosed = function(subscription){
5468 return subscription._o === undefined;
5469};
5470
5471var closeSubscription = function(subscription){
5472 if(!subscriptionClosed(subscription)){
5473 subscription._o = undefined;
5474 cleanupSubscription(subscription);
5475 }
5476};
5477
5478var Subscription = function(observer, subscriber){
5479 anObject(observer);
5480 this._c = undefined;
5481 this._o = observer;
5482 observer = new SubscriptionObserver(this);
5483 try {
5484 var cleanup = subscriber(observer)
5485 , subscription = cleanup;
5486 if(cleanup != null){
5487 if(typeof cleanup.unsubscribe === 'function')cleanup = function(){ subscription.unsubscribe(); };
5488 else aFunction(cleanup);
5489 this._c = cleanup;
5490 }
5491 } catch(e){
5492 observer.error(e);
5493 return;
5494 } if(subscriptionClosed(this))cleanupSubscription(this);
5495};
5496
5497Subscription.prototype = redefineAll({}, {
5498 unsubscribe: function unsubscribe(){ closeSubscription(this); }
5499});
5500
5501var SubscriptionObserver = function(subscription){
5502 this._s = subscription;
5503};
5504
5505SubscriptionObserver.prototype = redefineAll({}, {
5506 next: function next(value){
5507 var subscription = this._s;
5508 if(!subscriptionClosed(subscription)){
5509 var observer = subscription._o;
5510 try {
5511 var m = getMethod(observer.next);
5512 if(m)return m.call(observer, value);
5513 } catch(e){
5514 try {
5515 closeSubscription(subscription);
5516 } finally {
5517 throw e;
5518 }
5519 }
5520 }
5521 },
5522 error: function error(value){
5523 var subscription = this._s;
5524 if(subscriptionClosed(subscription))throw value;
5525 var observer = subscription._o;
5526 subscription._o = undefined;
5527 try {
5528 var m = getMethod(observer.error);
5529 if(!m)throw value;
5530 value = m.call(observer, value);
5531 } catch(e){
5532 try {
5533 cleanupSubscription(subscription);
5534 } finally {
5535 throw e;
5536 }
5537 } cleanupSubscription(subscription);
5538 return value;
5539 },
5540 complete: function complete(value){
5541 var subscription = this._s;
5542 if(!subscriptionClosed(subscription)){
5543 var observer = subscription._o;
5544 subscription._o = undefined;
5545 try {
5546 var m = getMethod(observer.complete);
5547 value = m ? m.call(observer, value) : undefined;
5548 } catch(e){
5549 try {
5550 cleanupSubscription(subscription);
5551 } finally {
5552 throw e;
5553 }
5554 } cleanupSubscription(subscription);
5555 return value;
5556 }
5557 }
5558});
5559
5560var $Observable = function Observable(subscriber){
5561 anInstance(this, $Observable, 'Observable', '_f')._f = aFunction(subscriber);
5562};
5563
5564redefineAll($Observable.prototype, {
5565 subscribe: function subscribe(observer){
5566 return new Subscription(observer, this._f);
5567 },
5568 forEach: function forEach(fn){
5569 var that = this;
5570 return new (core.Promise || global.Promise)(function(resolve, reject){
5571 aFunction(fn);
5572 var subscription = that.subscribe({
5573 next : function(value){
5574 try {
5575 return fn(value);
5576 } catch(e){
5577 reject(e);
5578 subscription.unsubscribe();
5579 }
5580 },
5581 error: reject,
5582 complete: resolve
5583 });
5584 });
5585 }
5586});
5587
5588redefineAll($Observable, {
5589 from: function from(x){
5590 var C = typeof this === 'function' ? this : $Observable;
5591 var method = getMethod(anObject(x)[OBSERVABLE]);
5592 if(method){
5593 var observable = anObject(method.call(x));
5594 return observable.constructor === C ? observable : new C(function(observer){
5595 return observable.subscribe(observer);
5596 });
5597 }
5598 return new C(function(observer){
5599 var done = false;
5600 microtask(function(){
5601 if(!done){
5602 try {
5603 if(forOf(x, false, function(it){
5604 observer.next(it);
5605 if(done)return RETURN;
5606 }) === RETURN)return;
5607 } catch(e){
5608 if(done)throw e;
5609 observer.error(e);
5610 return;
5611 } observer.complete();
5612 }
5613 });
5614 return function(){ done = true; };
5615 });
5616 },
5617 of: function of(){
5618 for(var i = 0, l = arguments.length, items = Array(l); i < l;)items[i] = arguments[i++];
5619 return new (typeof this === 'function' ? this : $Observable)(function(observer){
5620 var done = false;
5621 microtask(function(){
5622 if(!done){
5623 for(var i = 0; i < items.length; ++i){
5624 observer.next(items[i]);
5625 if(done)return;
5626 } observer.complete();
5627 }
5628 });
5629 return function(){ done = true; };
5630 });
5631 }
5632});
5633
5634hide($Observable.prototype, OBSERVABLE, function(){ return this; });
5635
5636$export($export.G, {Observable: $Observable});
5637
5638_dereq_(91)('Observable');
5639},{"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){
5640var metadata = _dereq_(63)
5641 , anObject = _dereq_(7)
5642 , toMetaKey = metadata.key
5643 , ordinaryDefineOwnMetadata = metadata.set;
5644
5645metadata.exp({defineMetadata: function defineMetadata(metadataKey, metadataValue, target, targetKey){
5646 ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), toMetaKey(targetKey));
5647}});
5648},{"63":63,"7":7}],274:[function(_dereq_,module,exports){
5649var metadata = _dereq_(63)
5650 , anObject = _dereq_(7)
5651 , toMetaKey = metadata.key
5652 , getOrCreateMetadataMap = metadata.map
5653 , store = metadata.store;
5654
5655metadata.exp({deleteMetadata: function deleteMetadata(metadataKey, target /*, targetKey */){
5656 var targetKey = arguments.length < 3 ? undefined : toMetaKey(arguments[2])
5657 , metadataMap = getOrCreateMetadataMap(anObject(target), targetKey, false);
5658 if(metadataMap === undefined || !metadataMap['delete'](metadataKey))return false;
5659 if(metadataMap.size)return true;
5660 var targetMetadata = store.get(target);
5661 targetMetadata['delete'](targetKey);
5662 return !!targetMetadata.size || store['delete'](target);
5663}});
5664},{"63":63,"7":7}],275:[function(_dereq_,module,exports){
5665var Set = _dereq_(220)
5666 , from = _dereq_(10)
5667 , metadata = _dereq_(63)
5668 , anObject = _dereq_(7)
5669 , getPrototypeOf = _dereq_(74)
5670 , ordinaryOwnMetadataKeys = metadata.keys
5671 , toMetaKey = metadata.key;
5672
5673var ordinaryMetadataKeys = function(O, P){
5674 var oKeys = ordinaryOwnMetadataKeys(O, P)
5675 , parent = getPrototypeOf(O);
5676 if(parent === null)return oKeys;
5677 var pKeys = ordinaryMetadataKeys(parent, P);
5678 return pKeys.length ? oKeys.length ? from(new Set(oKeys.concat(pKeys))) : pKeys : oKeys;
5679};
5680
5681metadata.exp({getMetadataKeys: function getMetadataKeys(target /*, targetKey */){
5682 return ordinaryMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1]));
5683}});
5684},{"10":10,"220":220,"63":63,"7":7,"74":74}],276:[function(_dereq_,module,exports){
5685var metadata = _dereq_(63)
5686 , anObject = _dereq_(7)
5687 , getPrototypeOf = _dereq_(74)
5688 , ordinaryHasOwnMetadata = metadata.has
5689 , ordinaryGetOwnMetadata = metadata.get
5690 , toMetaKey = metadata.key;
5691
5692var ordinaryGetMetadata = function(MetadataKey, O, P){
5693 var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P);
5694 if(hasOwn)return ordinaryGetOwnMetadata(MetadataKey, O, P);
5695 var parent = getPrototypeOf(O);
5696 return parent !== null ? ordinaryGetMetadata(MetadataKey, parent, P) : undefined;
5697};
5698
5699metadata.exp({getMetadata: function getMetadata(metadataKey, target /*, targetKey */){
5700 return ordinaryGetMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
5701}});
5702},{"63":63,"7":7,"74":74}],277:[function(_dereq_,module,exports){
5703var metadata = _dereq_(63)
5704 , anObject = _dereq_(7)
5705 , ordinaryOwnMetadataKeys = metadata.keys
5706 , toMetaKey = metadata.key;
5707
5708metadata.exp({getOwnMetadataKeys: function getOwnMetadataKeys(target /*, targetKey */){
5709 return ordinaryOwnMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1]));
5710}});
5711},{"63":63,"7":7}],278:[function(_dereq_,module,exports){
5712var metadata = _dereq_(63)
5713 , anObject = _dereq_(7)
5714 , ordinaryGetOwnMetadata = metadata.get
5715 , toMetaKey = metadata.key;
5716
5717metadata.exp({getOwnMetadata: function getOwnMetadata(metadataKey, target /*, targetKey */){
5718 return ordinaryGetOwnMetadata(metadataKey, anObject(target)
5719 , arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
5720}});
5721},{"63":63,"7":7}],279:[function(_dereq_,module,exports){
5722var metadata = _dereq_(63)
5723 , anObject = _dereq_(7)
5724 , getPrototypeOf = _dereq_(74)
5725 , ordinaryHasOwnMetadata = metadata.has
5726 , toMetaKey = metadata.key;
5727
5728var ordinaryHasMetadata = function(MetadataKey, O, P){
5729 var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P);
5730 if(hasOwn)return true;
5731 var parent = getPrototypeOf(O);
5732 return parent !== null ? ordinaryHasMetadata(MetadataKey, parent, P) : false;
5733};
5734
5735metadata.exp({hasMetadata: function hasMetadata(metadataKey, target /*, targetKey */){
5736 return ordinaryHasMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
5737}});
5738},{"63":63,"7":7,"74":74}],280:[function(_dereq_,module,exports){
5739var metadata = _dereq_(63)
5740 , anObject = _dereq_(7)
5741 , ordinaryHasOwnMetadata = metadata.has
5742 , toMetaKey = metadata.key;
5743
5744metadata.exp({hasOwnMetadata: function hasOwnMetadata(metadataKey, target /*, targetKey */){
5745 return ordinaryHasOwnMetadata(metadataKey, anObject(target)
5746 , arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
5747}});
5748},{"63":63,"7":7}],281:[function(_dereq_,module,exports){
5749var metadata = _dereq_(63)
5750 , anObject = _dereq_(7)
5751 , aFunction = _dereq_(3)
5752 , toMetaKey = metadata.key
5753 , ordinaryDefineOwnMetadata = metadata.set;
5754
5755metadata.exp({metadata: function metadata(metadataKey, metadataValue){
5756 return function decorator(target, targetKey){
5757 ordinaryDefineOwnMetadata(
5758 metadataKey, metadataValue,
5759 (targetKey !== undefined ? anObject : aFunction)(target),
5760 toMetaKey(targetKey)
5761 );
5762 };
5763}});
5764},{"3":3,"63":63,"7":7}],282:[function(_dereq_,module,exports){
5765// https://github.com/DavidBruant/Map-Set.prototype.toJSON
5766var $export = _dereq_(32);
5767
5768$export($export.P + $export.R, 'Set', {toJSON: _dereq_(20)('Set')});
5769},{"20":20,"32":32}],283:[function(_dereq_,module,exports){
5770'use strict';
5771// https://github.com/mathiasbynens/String.prototype.at
5772var $export = _dereq_(32)
5773 , $at = _dereq_(97)(true);
5774
5775$export($export.P, 'String', {
5776 at: function at(pos){
5777 return $at(this, pos);
5778 }
5779});
5780},{"32":32,"97":97}],284:[function(_dereq_,module,exports){
5781'use strict';
5782// https://tc39.github.io/String.prototype.matchAll/
5783var $export = _dereq_(32)
5784 , defined = _dereq_(27)
5785 , toLength = _dereq_(108)
5786 , isRegExp = _dereq_(50)
5787 , getFlags = _dereq_(36)
5788 , RegExpProto = RegExp.prototype;
5789
5790var $RegExpStringIterator = function(regexp, string){
5791 this._r = regexp;
5792 this._s = string;
5793};
5794
5795_dereq_(52)($RegExpStringIterator, 'RegExp String', function next(){
5796 var match = this._r.exec(this._s);
5797 return {value: match, done: match === null};
5798});
5799
5800$export($export.P, 'String', {
5801 matchAll: function matchAll(regexp){
5802 defined(this);
5803 if(!isRegExp(regexp))throw TypeError(regexp + ' is not a regexp!');
5804 var S = String(this)
5805 , flags = 'flags' in RegExpProto ? String(regexp.flags) : getFlags.call(regexp)
5806 , rx = new RegExp(regexp.source, ~flags.indexOf('g') ? flags : 'g' + flags);
5807 rx.lastIndex = toLength(regexp.lastIndex);
5808 return new $RegExpStringIterator(rx, S);
5809 }
5810});
5811},{"108":108,"27":27,"32":32,"36":36,"50":50,"52":52}],285:[function(_dereq_,module,exports){
5812'use strict';
5813// https://github.com/tc39/proposal-string-pad-start-end
5814var $export = _dereq_(32)
5815 , $pad = _dereq_(100);
5816
5817$export($export.P, 'String', {
5818 padEnd: function padEnd(maxLength /*, fillString = ' ' */){
5819 return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false);
5820 }
5821});
5822},{"100":100,"32":32}],286:[function(_dereq_,module,exports){
5823'use strict';
5824// https://github.com/tc39/proposal-string-pad-start-end
5825var $export = _dereq_(32)
5826 , $pad = _dereq_(100);
5827
5828$export($export.P, 'String', {
5829 padStart: function padStart(maxLength /*, fillString = ' ' */){
5830 return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true);
5831 }
5832});
5833},{"100":100,"32":32}],287:[function(_dereq_,module,exports){
5834'use strict';
5835// https://github.com/sebmarkbage/ecmascript-string-left-right-trim
5836_dereq_(102)('trimLeft', function($trim){
5837 return function trimLeft(){
5838 return $trim(this, 1);
5839 };
5840}, 'trimStart');
5841},{"102":102}],288:[function(_dereq_,module,exports){
5842'use strict';
5843// https://github.com/sebmarkbage/ecmascript-string-left-right-trim
5844_dereq_(102)('trimRight', function($trim){
5845 return function trimRight(){
5846 return $trim(this, 2);
5847 };
5848}, 'trimEnd');
5849},{"102":102}],289:[function(_dereq_,module,exports){
5850_dereq_(115)('asyncIterator');
5851},{"115":115}],290:[function(_dereq_,module,exports){
5852_dereq_(115)('observable');
5853},{"115":115}],291:[function(_dereq_,module,exports){
5854// https://github.com/ljharb/proposal-global
5855var $export = _dereq_(32);
5856
5857$export($export.S, 'System', {global: _dereq_(38)});
5858},{"32":32,"38":38}],292:[function(_dereq_,module,exports){
5859var $iterators = _dereq_(130)
5860 , redefine = _dereq_(87)
5861 , global = _dereq_(38)
5862 , hide = _dereq_(40)
5863 , Iterators = _dereq_(56)
5864 , wks = _dereq_(117)
5865 , ITERATOR = wks('iterator')
5866 , TO_STRING_TAG = wks('toStringTag')
5867 , ArrayValues = Iterators.Array;
5868
5869for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){
5870 var NAME = collections[i]
5871 , Collection = global[NAME]
5872 , proto = Collection && Collection.prototype
5873 , key;
5874 if(proto){
5875 if(!proto[ITERATOR])hide(proto, ITERATOR, ArrayValues);
5876 if(!proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME);
5877 Iterators[NAME] = ArrayValues;
5878 for(key in $iterators)if(!proto[key])redefine(proto, key, $iterators[key], true);
5879 }
5880}
5881},{"117":117,"130":130,"38":38,"40":40,"56":56,"87":87}],293:[function(_dereq_,module,exports){
5882var $export = _dereq_(32)
5883 , $task = _dereq_(104);
5884$export($export.G + $export.B, {
5885 setImmediate: $task.set,
5886 clearImmediate: $task.clear
5887});
5888},{"104":104,"32":32}],294:[function(_dereq_,module,exports){
5889// ie9- setTimeout & setInterval additional parameters fix
5890var global = _dereq_(38)
5891 , $export = _dereq_(32)
5892 , invoke = _dereq_(44)
5893 , partial = _dereq_(83)
5894 , navigator = global.navigator
5895 , MSIE = !!navigator && /MSIE .\./.test(navigator.userAgent); // <- dirty ie9- check
5896var wrap = function(set){
5897 return MSIE ? function(fn, time /*, ...args */){
5898 return set(invoke(
5899 partial,
5900 [].slice.call(arguments, 2),
5901 typeof fn == 'function' ? fn : Function(fn)
5902 ), time);
5903 } : set;
5904};
5905$export($export.G + $export.B + $export.F * MSIE, {
5906 setTimeout: wrap(global.setTimeout),
5907 setInterval: wrap(global.setInterval)
5908});
5909},{"32":32,"38":38,"44":44,"83":83}],295:[function(_dereq_,module,exports){
5910_dereq_(243);
5911_dereq_(180);
5912_dereq_(182);
5913_dereq_(181);
5914_dereq_(184);
5915_dereq_(186);
5916_dereq_(191);
5917_dereq_(185);
5918_dereq_(183);
5919_dereq_(193);
5920_dereq_(192);
5921_dereq_(188);
5922_dereq_(189);
5923_dereq_(187);
5924_dereq_(179);
5925_dereq_(190);
5926_dereq_(194);
5927_dereq_(195);
5928_dereq_(146);
5929_dereq_(148);
5930_dereq_(147);
5931_dereq_(197);
5932_dereq_(196);
5933_dereq_(167);
5934_dereq_(177);
5935_dereq_(178);
5936_dereq_(168);
5937_dereq_(169);
5938_dereq_(170);
5939_dereq_(171);
5940_dereq_(172);
5941_dereq_(173);
5942_dereq_(174);
5943_dereq_(175);
5944_dereq_(176);
5945_dereq_(150);
5946_dereq_(151);
5947_dereq_(152);
5948_dereq_(153);
5949_dereq_(154);
5950_dereq_(155);
5951_dereq_(156);
5952_dereq_(157);
5953_dereq_(158);
5954_dereq_(159);
5955_dereq_(160);
5956_dereq_(161);
5957_dereq_(162);
5958_dereq_(163);
5959_dereq_(164);
5960_dereq_(165);
5961_dereq_(166);
5962_dereq_(230);
5963_dereq_(235);
5964_dereq_(242);
5965_dereq_(233);
5966_dereq_(225);
5967_dereq_(226);
5968_dereq_(231);
5969_dereq_(236);
5970_dereq_(238);
5971_dereq_(221);
5972_dereq_(222);
5973_dereq_(223);
5974_dereq_(224);
5975_dereq_(227);
5976_dereq_(228);
5977_dereq_(229);
5978_dereq_(232);
5979_dereq_(234);
5980_dereq_(237);
5981_dereq_(239);
5982_dereq_(240);
5983_dereq_(241);
5984_dereq_(141);
5985_dereq_(143);
5986_dereq_(142);
5987_dereq_(145);
5988_dereq_(144);
5989_dereq_(129);
5990_dereq_(127);
5991_dereq_(134);
5992_dereq_(131);
5993_dereq_(137);
5994_dereq_(139);
5995_dereq_(126);
5996_dereq_(133);
5997_dereq_(123);
5998_dereq_(138);
5999_dereq_(121);
6000_dereq_(136);
6001_dereq_(135);
6002_dereq_(128);
6003_dereq_(132);
6004_dereq_(120);
6005_dereq_(122);
6006_dereq_(125);
6007_dereq_(124);
6008_dereq_(140);
6009_dereq_(130);
6010_dereq_(213);
6011_dereq_(219);
6012_dereq_(214);
6013_dereq_(215);
6014_dereq_(216);
6015_dereq_(217);
6016_dereq_(218);
6017_dereq_(198);
6018_dereq_(149);
6019_dereq_(220);
6020_dereq_(255);
6021_dereq_(256);
6022_dereq_(244);
6023_dereq_(245);
6024_dereq_(250);
6025_dereq_(253);
6026_dereq_(254);
6027_dereq_(248);
6028_dereq_(251);
6029_dereq_(249);
6030_dereq_(252);
6031_dereq_(246);
6032_dereq_(247);
6033_dereq_(199);
6034_dereq_(200);
6035_dereq_(201);
6036_dereq_(202);
6037_dereq_(203);
6038_dereq_(206);
6039_dereq_(204);
6040_dereq_(205);
6041_dereq_(207);
6042_dereq_(208);
6043_dereq_(209);
6044_dereq_(210);
6045_dereq_(212);
6046_dereq_(211);
6047_dereq_(257);
6048_dereq_(283);
6049_dereq_(286);
6050_dereq_(285);
6051_dereq_(287);
6052_dereq_(288);
6053_dereq_(284);
6054_dereq_(289);
6055_dereq_(290);
6056_dereq_(268);
6057_dereq_(271);
6058_dereq_(267);
6059_dereq_(265);
6060_dereq_(266);
6061_dereq_(269);
6062_dereq_(270);
6063_dereq_(260);
6064_dereq_(282);
6065_dereq_(291);
6066_dereq_(259);
6067_dereq_(261);
6068_dereq_(263);
6069_dereq_(262);
6070_dereq_(264);
6071_dereq_(273);
6072_dereq_(274);
6073_dereq_(276);
6074_dereq_(275);
6075_dereq_(278);
6076_dereq_(277);
6077_dereq_(279);
6078_dereq_(280);
6079_dereq_(281);
6080_dereq_(258);
6081_dereq_(272);
6082_dereq_(294);
6083_dereq_(293);
6084_dereq_(292);
6085module.exports = _dereq_(23);
6086},{"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){
6087(function (global){
6088/**
6089 * Copyright (c) 2014, Facebook, Inc.
6090 * All rights reserved.
6091 *
6092 * This source code is licensed under the BSD-style license found in the
6093 * https://raw.github.com/facebook/regenerator/master/LICENSE file. An
6094 * additional grant of patent rights can be found in the PATENTS file in
6095 * the same directory.
6096 */
6097
6098!(function(global) {
6099 "use strict";
6100
6101 var hasOwn = Object.prototype.hasOwnProperty;
6102 var undefined; // More compressible than void 0.
6103 var $Symbol = typeof Symbol === "function" ? Symbol : {};
6104 var iteratorSymbol = $Symbol.iterator || "@@iterator";
6105 var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
6106
6107 var inModule = typeof module === "object";
6108 var runtime = global.regeneratorRuntime;
6109 if (runtime) {
6110 if (inModule) {
6111 // If regeneratorRuntime is defined globally and we're in a module,
6112 // make the exports object identical to regeneratorRuntime.
6113 module.exports = runtime;
6114 }
6115 // Don't bother evaluating the rest of this file if the runtime was
6116 // already defined globally.
6117 return;
6118 }
6119
6120 // Define the runtime globally (as expected by generated code) as either
6121 // module.exports (if we're in a module) or a new, empty object.
6122 runtime = global.regeneratorRuntime = inModule ? module.exports : {};
6123
6124 function wrap(innerFn, outerFn, self, tryLocsList) {
6125 // If outerFn provided, then outerFn.prototype instanceof Generator.
6126 var generator = Object.create((outerFn || Generator).prototype);
6127 var context = new Context(tryLocsList || []);
6128
6129 // The ._invoke method unifies the implementations of the .next,
6130 // .throw, and .return methods.
6131 generator._invoke = makeInvokeMethod(innerFn, self, context);
6132
6133 return generator;
6134 }
6135 runtime.wrap = wrap;
6136
6137 // Try/catch helper to minimize deoptimizations. Returns a completion
6138 // record like context.tryEntries[i].completion. This interface could
6139 // have been (and was previously) designed to take a closure to be
6140 // invoked without arguments, but in all the cases we care about we
6141 // already have an existing method we want to call, so there's no need
6142 // to create a new function object. We can even get away with assuming
6143 // the method takes exactly one argument, since that happens to be true
6144 // in every case, so we don't have to touch the arguments object. The
6145 // only additional allocation required is the completion record, which
6146 // has a stable shape and so hopefully should be cheap to allocate.
6147 function tryCatch(fn, obj, arg) {
6148 try {
6149 return { type: "normal", arg: fn.call(obj, arg) };
6150 } catch (err) {
6151 return { type: "throw", arg: err };
6152 }
6153 }
6154
6155 var GenStateSuspendedStart = "suspendedStart";
6156 var GenStateSuspendedYield = "suspendedYield";
6157 var GenStateExecuting = "executing";
6158 var GenStateCompleted = "completed";
6159
6160 // Returning this object from the innerFn has the same effect as
6161 // breaking out of the dispatch switch statement.
6162 var ContinueSentinel = {};
6163
6164 // Dummy constructor functions that we use as the .constructor and
6165 // .constructor.prototype properties for functions that return Generator
6166 // objects. For full spec compliance, you may wish to configure your
6167 // minifier not to mangle the names of these two functions.
6168 function Generator() {}
6169 function GeneratorFunction() {}
6170 function GeneratorFunctionPrototype() {}
6171
6172 var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype;
6173 GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
6174 GeneratorFunctionPrototype.constructor = GeneratorFunction;
6175 GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction";
6176
6177 // Helper for defining the .next, .throw, and .return methods of the
6178 // Iterator interface in terms of a single ._invoke method.
6179 function defineIteratorMethods(prototype) {
6180 ["next", "throw", "return"].forEach(function(method) {
6181 prototype[method] = function(arg) {
6182 return this._invoke(method, arg);
6183 };
6184 });
6185 }
6186
6187 runtime.isGeneratorFunction = function(genFun) {
6188 var ctor = typeof genFun === "function" && genFun.constructor;
6189 return ctor
6190 ? ctor === GeneratorFunction ||
6191 // For the native GeneratorFunction constructor, the best we can
6192 // do is to check its .name property.
6193 (ctor.displayName || ctor.name) === "GeneratorFunction"
6194 : false;
6195 };
6196
6197 runtime.mark = function(genFun) {
6198 if (Object.setPrototypeOf) {
6199 Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
6200 } else {
6201 genFun.__proto__ = GeneratorFunctionPrototype;
6202 if (!(toStringTagSymbol in genFun)) {
6203 genFun[toStringTagSymbol] = "GeneratorFunction";
6204 }
6205 }
6206 genFun.prototype = Object.create(Gp);
6207 return genFun;
6208 };
6209
6210 // Within the body of any async function, `await x` is transformed to
6211 // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
6212 // `value instanceof AwaitArgument` to determine if the yielded value is
6213 // meant to be awaited. Some may consider the name of this method too
6214 // cutesy, but they are curmudgeons.
6215 runtime.awrap = function(arg) {
6216 return new AwaitArgument(arg);
6217 };
6218
6219 function AwaitArgument(arg) {
6220 this.arg = arg;
6221 }
6222
6223 function AsyncIterator(generator) {
6224 function invoke(method, arg, resolve, reject) {
6225 var record = tryCatch(generator[method], generator, arg);
6226 if (record.type === "throw") {
6227 reject(record.arg);
6228 } else {
6229 var result = record.arg;
6230 var value = result.value;
6231 if (value instanceof AwaitArgument) {
6232 return Promise.resolve(value.arg).then(function(value) {
6233 invoke("next", value, resolve, reject);
6234 }, function(err) {
6235 invoke("throw", err, resolve, reject);
6236 });
6237 }
6238
6239 return Promise.resolve(value).then(function(unwrapped) {
6240 // When a yielded Promise is resolved, its final value becomes
6241 // the .value of the Promise<{value,done}> result for the
6242 // current iteration. If the Promise is rejected, however, the
6243 // result for this iteration will be rejected with the same
6244 // reason. Note that rejections of yielded Promises are not
6245 // thrown back into the generator function, as is the case
6246 // when an awaited Promise is rejected. This difference in
6247 // behavior between yield and await is important, because it
6248 // allows the consumer to decide what to do with the yielded
6249 // rejection (swallow it and continue, manually .throw it back
6250 // into the generator, abandon iteration, whatever). With
6251 // await, by contrast, there is no opportunity to examine the
6252 // rejection reason outside the generator function, so the
6253 // only option is to throw it from the await expression, and
6254 // let the generator function handle the exception.
6255 result.value = unwrapped;
6256 resolve(result);
6257 }, reject);
6258 }
6259 }
6260
6261 if (typeof process === "object" && process.domain) {
6262 invoke = process.domain.bind(invoke);
6263 }
6264
6265 var previousPromise;
6266
6267 function enqueue(method, arg) {
6268 function callInvokeWithMethodAndArg() {
6269 return new Promise(function(resolve, reject) {
6270 invoke(method, arg, resolve, reject);
6271 });
6272 }
6273
6274 return previousPromise =
6275 // If enqueue has been called before, then we want to wait until
6276 // all previous Promises have been resolved before calling invoke,
6277 // so that results are always delivered in the correct order. If
6278 // enqueue has not been called before, then it is important to
6279 // call invoke immediately, without waiting on a callback to fire,
6280 // so that the async generator function has the opportunity to do
6281 // any necessary setup in a predictable way. This predictability
6282 // is why the Promise constructor synchronously invokes its
6283 // executor callback, and why async functions synchronously
6284 // execute code before the first await. Since we implement simple
6285 // async functions in terms of async generators, it is especially
6286 // important to get this right, even though it requires care.
6287 previousPromise ? previousPromise.then(
6288 callInvokeWithMethodAndArg,
6289 // Avoid propagating failures to Promises returned by later
6290 // invocations of the iterator.
6291 callInvokeWithMethodAndArg
6292 ) : callInvokeWithMethodAndArg();
6293 }
6294
6295 // Define the unified helper method that is used to implement .next,
6296 // .throw, and .return (see defineIteratorMethods).
6297 this._invoke = enqueue;
6298 }
6299
6300 defineIteratorMethods(AsyncIterator.prototype);
6301
6302 // Note that simple async functions are implemented on top of
6303 // AsyncIterator objects; they just return a Promise for the value of
6304 // the final result produced by the iterator.
6305 runtime.async = function(innerFn, outerFn, self, tryLocsList) {
6306 var iter = new AsyncIterator(
6307 wrap(innerFn, outerFn, self, tryLocsList)
6308 );
6309
6310 return runtime.isGeneratorFunction(outerFn)
6311 ? iter // If outerFn is a generator, return the full iterator.
6312 : iter.next().then(function(result) {
6313 return result.done ? result.value : iter.next();
6314 });
6315 };
6316
6317 function makeInvokeMethod(innerFn, self, context) {
6318 var state = GenStateSuspendedStart;
6319
6320 return function invoke(method, arg) {
6321 if (state === GenStateExecuting) {
6322 throw new Error("Generator is already running");
6323 }
6324
6325 if (state === GenStateCompleted) {
6326 if (method === "throw") {
6327 throw arg;
6328 }
6329
6330 // Be forgiving, per 25.3.3.3.3 of the spec:
6331 // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
6332 return doneResult();
6333 }
6334
6335 while (true) {
6336 var delegate = context.delegate;
6337 if (delegate) {
6338 if (method === "return" ||
6339 (method === "throw" && delegate.iterator[method] === undefined)) {
6340 // A return or throw (when the delegate iterator has no throw
6341 // method) always terminates the yield* loop.
6342 context.delegate = null;
6343
6344 // If the delegate iterator has a return method, give it a
6345 // chance to clean up.
6346 var returnMethod = delegate.iterator["return"];
6347 if (returnMethod) {
6348 var record = tryCatch(returnMethod, delegate.iterator, arg);
6349 if (record.type === "throw") {
6350 // If the return method threw an exception, let that
6351 // exception prevail over the original return or throw.
6352 method = "throw";
6353 arg = record.arg;
6354 continue;
6355 }
6356 }
6357
6358 if (method === "return") {
6359 // Continue with the outer return, now that the delegate
6360 // iterator has been terminated.
6361 continue;
6362 }
6363 }
6364
6365 var record = tryCatch(
6366 delegate.iterator[method],
6367 delegate.iterator,
6368 arg
6369 );
6370
6371 if (record.type === "throw") {
6372 context.delegate = null;
6373
6374 // Like returning generator.throw(uncaught), but without the
6375 // overhead of an extra function call.
6376 method = "throw";
6377 arg = record.arg;
6378 continue;
6379 }
6380
6381 // Delegate generator ran and handled its own exceptions so
6382 // regardless of what the method was, we continue as if it is
6383 // "next" with an undefined arg.
6384 method = "next";
6385 arg = undefined;
6386
6387 var info = record.arg;
6388 if (info.done) {
6389 context[delegate.resultName] = info.value;
6390 context.next = delegate.nextLoc;
6391 } else {
6392 state = GenStateSuspendedYield;
6393 return info;
6394 }
6395
6396 context.delegate = null;
6397 }
6398
6399 if (method === "next") {
6400 // Setting context._sent for legacy support of Babel's
6401 // function.sent implementation.
6402 context.sent = context._sent = arg;
6403
6404 } else if (method === "throw") {
6405 if (state === GenStateSuspendedStart) {
6406 state = GenStateCompleted;
6407 throw arg;
6408 }
6409
6410 if (context.dispatchException(arg)) {
6411 // If the dispatched exception was caught by a catch block,
6412 // then let that catch block handle the exception normally.
6413 method = "next";
6414 arg = undefined;
6415 }
6416
6417 } else if (method === "return") {
6418 context.abrupt("return", arg);
6419 }
6420
6421 state = GenStateExecuting;
6422
6423 var record = tryCatch(innerFn, self, context);
6424 if (record.type === "normal") {
6425 // If an exception is thrown from innerFn, we leave state ===
6426 // GenStateExecuting and loop back for another invocation.
6427 state = context.done
6428 ? GenStateCompleted
6429 : GenStateSuspendedYield;
6430
6431 var info = {
6432 value: record.arg,
6433 done: context.done
6434 };
6435
6436 if (record.arg === ContinueSentinel) {
6437 if (context.delegate && method === "next") {
6438 // Deliberately forget the last sent value so that we don't
6439 // accidentally pass it on to the delegate.
6440 arg = undefined;
6441 }
6442 } else {
6443 return info;
6444 }
6445
6446 } else if (record.type === "throw") {
6447 state = GenStateCompleted;
6448 // Dispatch the exception by looping back around to the
6449 // context.dispatchException(arg) call above.
6450 method = "throw";
6451 arg = record.arg;
6452 }
6453 }
6454 };
6455 }
6456
6457 // Define Generator.prototype.{next,throw,return} in terms of the
6458 // unified ._invoke helper method.
6459 defineIteratorMethods(Gp);
6460
6461 Gp[iteratorSymbol] = function() {
6462 return this;
6463 };
6464
6465 Gp[toStringTagSymbol] = "Generator";
6466
6467 Gp.toString = function() {
6468 return "[object Generator]";
6469 };
6470
6471 function pushTryEntry(locs) {
6472 var entry = { tryLoc: locs[0] };
6473
6474 if (1 in locs) {
6475 entry.catchLoc = locs[1];
6476 }
6477
6478 if (2 in locs) {
6479 entry.finallyLoc = locs[2];
6480 entry.afterLoc = locs[3];
6481 }
6482
6483 this.tryEntries.push(entry);
6484 }
6485
6486 function resetTryEntry(entry) {
6487 var record = entry.completion || {};
6488 record.type = "normal";
6489 delete record.arg;
6490 entry.completion = record;
6491 }
6492
6493 function Context(tryLocsList) {
6494 // The root entry object (effectively a try statement without a catch
6495 // or a finally block) gives us a place to store values thrown from
6496 // locations where there is no enclosing try statement.
6497 this.tryEntries = [{ tryLoc: "root" }];
6498 tryLocsList.forEach(pushTryEntry, this);
6499 this.reset(true);
6500 }
6501
6502 runtime.keys = function(object) {
6503 var keys = [];
6504 for (var key in object) {
6505 keys.push(key);
6506 }
6507 keys.reverse();
6508
6509 // Rather than returning an object with a next method, we keep
6510 // things simple and return the next function itself.
6511 return function next() {
6512 while (keys.length) {
6513 var key = keys.pop();
6514 if (key in object) {
6515 next.value = key;
6516 next.done = false;
6517 return next;
6518 }
6519 }
6520
6521 // To avoid creating an additional object, we just hang the .value
6522 // and .done properties off the next function object itself. This
6523 // also ensures that the minifier will not anonymize the function.
6524 next.done = true;
6525 return next;
6526 };
6527 };
6528
6529 function values(iterable) {
6530 if (iterable) {
6531 var iteratorMethod = iterable[iteratorSymbol];
6532 if (iteratorMethod) {
6533 return iteratorMethod.call(iterable);
6534 }
6535
6536 if (typeof iterable.next === "function") {
6537 return iterable;
6538 }
6539
6540 if (!isNaN(iterable.length)) {
6541 var i = -1, next = function next() {
6542 while (++i < iterable.length) {
6543 if (hasOwn.call(iterable, i)) {
6544 next.value = iterable[i];
6545 next.done = false;
6546 return next;
6547 }
6548 }
6549
6550 next.value = undefined;
6551 next.done = true;
6552
6553 return next;
6554 };
6555
6556 return next.next = next;
6557 }
6558 }
6559
6560 // Return an iterator with no values.
6561 return { next: doneResult };
6562 }
6563 runtime.values = values;
6564
6565 function doneResult() {
6566 return { value: undefined, done: true };
6567 }
6568
6569 Context.prototype = {
6570 constructor: Context,
6571
6572 reset: function(skipTempReset) {
6573 this.prev = 0;
6574 this.next = 0;
6575 // Resetting context._sent for legacy support of Babel's
6576 // function.sent implementation.
6577 this.sent = this._sent = undefined;
6578 this.done = false;
6579 this.delegate = null;
6580
6581 this.tryEntries.forEach(resetTryEntry);
6582
6583 if (!skipTempReset) {
6584 for (var name in this) {
6585 // Not sure about the optimal order of these conditions:
6586 if (name.charAt(0) === "t" &&
6587 hasOwn.call(this, name) &&
6588 !isNaN(+name.slice(1))) {
6589 this[name] = undefined;
6590 }
6591 }
6592 }
6593 },
6594
6595 stop: function() {
6596 this.done = true;
6597
6598 var rootEntry = this.tryEntries[0];
6599 var rootRecord = rootEntry.completion;
6600 if (rootRecord.type === "throw") {
6601 throw rootRecord.arg;
6602 }
6603
6604 return this.rval;
6605 },
6606
6607 dispatchException: function(exception) {
6608 if (this.done) {
6609 throw exception;
6610 }
6611
6612 var context = this;
6613 function handle(loc, caught) {
6614 record.type = "throw";
6615 record.arg = exception;
6616 context.next = loc;
6617 return !!caught;
6618 }
6619
6620 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
6621 var entry = this.tryEntries[i];
6622 var record = entry.completion;
6623
6624 if (entry.tryLoc === "root") {
6625 // Exception thrown outside of any try block that could handle
6626 // it, so set the completion value of the entire function to
6627 // throw the exception.
6628 return handle("end");
6629 }
6630
6631 if (entry.tryLoc <= this.prev) {
6632 var hasCatch = hasOwn.call(entry, "catchLoc");
6633 var hasFinally = hasOwn.call(entry, "finallyLoc");
6634
6635 if (hasCatch && hasFinally) {
6636 if (this.prev < entry.catchLoc) {
6637 return handle(entry.catchLoc, true);
6638 } else if (this.prev < entry.finallyLoc) {
6639 return handle(entry.finallyLoc);
6640 }
6641
6642 } else if (hasCatch) {
6643 if (this.prev < entry.catchLoc) {
6644 return handle(entry.catchLoc, true);
6645 }
6646
6647 } else if (hasFinally) {
6648 if (this.prev < entry.finallyLoc) {
6649 return handle(entry.finallyLoc);
6650 }
6651
6652 } else {
6653 throw new Error("try statement without catch or finally");
6654 }
6655 }
6656 }
6657 },
6658
6659 abrupt: function(type, arg) {
6660 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
6661 var entry = this.tryEntries[i];
6662 if (entry.tryLoc <= this.prev &&
6663 hasOwn.call(entry, "finallyLoc") &&
6664 this.prev < entry.finallyLoc) {
6665 var finallyEntry = entry;
6666 break;
6667 }
6668 }
6669
6670 if (finallyEntry &&
6671 (type === "break" ||
6672 type === "continue") &&
6673 finallyEntry.tryLoc <= arg &&
6674 arg <= finallyEntry.finallyLoc) {
6675 // Ignore the finally entry if control is not jumping to a
6676 // location outside the try/catch block.
6677 finallyEntry = null;
6678 }
6679
6680 var record = finallyEntry ? finallyEntry.completion : {};
6681 record.type = type;
6682 record.arg = arg;
6683
6684 if (finallyEntry) {
6685 this.next = finallyEntry.finallyLoc;
6686 } else {
6687 this.complete(record);
6688 }
6689
6690 return ContinueSentinel;
6691 },
6692
6693 complete: function(record, afterLoc) {
6694 if (record.type === "throw") {
6695 throw record.arg;
6696 }
6697
6698 if (record.type === "break" ||
6699 record.type === "continue") {
6700 this.next = record.arg;
6701 } else if (record.type === "return") {
6702 this.rval = record.arg;
6703 this.next = "end";
6704 } else if (record.type === "normal" && afterLoc) {
6705 this.next = afterLoc;
6706 }
6707 },
6708
6709 finish: function(finallyLoc) {
6710 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
6711 var entry = this.tryEntries[i];
6712 if (entry.finallyLoc === finallyLoc) {
6713 this.complete(entry.completion, entry.afterLoc);
6714 resetTryEntry(entry);
6715 return ContinueSentinel;
6716 }
6717 }
6718 },
6719
6720 "catch": function(tryLoc) {
6721 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
6722 var entry = this.tryEntries[i];
6723 if (entry.tryLoc === tryLoc) {
6724 var record = entry.completion;
6725 if (record.type === "throw") {
6726 var thrown = record.arg;
6727 resetTryEntry(entry);
6728 }
6729 return thrown;
6730 }
6731 }
6732
6733 // The context.catch method must only be called with a location
6734 // argument that corresponds to a known catch block.
6735 throw new Error("illegal catch attempt");
6736 },
6737
6738 delegateYield: function(iterable, resultName, nextLoc) {
6739 this.delegate = {
6740 iterator: values(iterable),
6741 resultName: resultName,
6742 nextLoc: nextLoc
6743 };
6744
6745 return ContinueSentinel;
6746 }
6747 };
6748})(
6749 // Among the various tricks for obtaining a reference to the global
6750 // object, this seems to be the most reliable technique that does not
6751 // use indirect eval (which violates Content Security Policy).
6752 typeof global === "object" ? global :
6753 typeof window === "object" ? window :
6754 typeof self === "object" ? self : this
6755);
6756
6757}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
6758},{}]},{},[1]);
6759;(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&&obj!==Symbol.prototype?"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){// Copyright 2011-2012 Jacob Beard, INFICON, and other SCION contributors
6760//
6761// Licensed under the Apache License, Version 2.0 (the "License");
6762// you may not use this file except in compliance with the License.
6763// You may obtain a copy of the License at
6764//
6765// http://www.apache.org/licenses/LICENSE-2.0
6766//
6767// Unless required by applicable law or agreed to in writing, software
6768// distributed under the License is distributed on an "AS IS" BASIS,
6769// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6770// See the License for the specific language governing permissions and
6771// limitations under the License.
6772"use strict";var 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 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
6773//FIXME: make this safer - break into multiple passes
6774var 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
6775states:[{$type:'initial',transitions:[{target:state}]},state]};}var statesWithInitialAttributes=[];function transitionToString(sourceState){return sourceState+" -- "+(this.events?'('+this.events.join(',')+')':null)+(this.cond?'['+this.cond.name+']':'')+" --> "+(this.targets?this.targets.join(','):null);}function stateToString(){return this.id;}function traverse(ancestors,state){if(printTrace)state.toString=stateToString;//add to global transition and state id caches
6776if(state.transitions)transitions.push.apply(transitions,state.transitions);//populate state id map
6777if(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
6778//this way we can check for unsupported types below
6779state.$type=state.$type||'state';//add ancestors and depth properties
6780state.ancestors=ancestors;state.depth=ancestors.length;state.parent=ancestors[0];state.documentOrder=documentOrder++;//add some information to transitions
6781state.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;if(printTrace)transition.toString=transitionToString.bind(transition,state);};//recursive step
6782if(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
6783switch(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
6784if(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
6785if(typeof state.initial==='string'){statesWithInitialAttributes.push(state);}else{//take the first child that has initial type, or first child
6786initialChildren=state.states.filter(function(child){return child.$type==='initial';});state.initialRef=initialChildren.length?initialChildren[0]:state.states[0];checkInitialRef(state);}}//hook up history
6787if(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
6788if(!state.id){state.id=generateId(state.$type);idToStateMap.set(state.id,state);}//normalize onEntry/onExit, which can be single fn or array
6789if(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
6790function 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
6791for(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
6792if(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
6793continue;}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
6794for(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
6795t.scope=getScope(t);//console.log('scope',t.source.id,t.scope.id,t.targets);
6796}}function getScope(transition){//Transition scope is normally the least common compound ancestor (lcca).
6797//Internal transitions have a scope equal to the source state.
6798var transitionIsReallyInternal=transition.type==='internal'&&transition.source.parent&&//root state won't have parent
6799transition.targets&&//does it target its descendants
6800transition.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);
6801var 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);
6802if(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;}));
6803if(!commonAncestors.length)throw new Error("Could not find LCA for states.");return commonAncestors[0];}//main execution starts here
6804//FIXME: only wrap in root state if it's not a compound state
6805var fakeRootState=wrapInFakeRootState(rootState);//I wish we had pointer semantics and could make this a C-style "out argument". Instead we return him
6806traverse([],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
6807listeners=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 this.o.size===0?'<empty>':Array.from(this.o).join(',\n');}};var RX_TRAILING_WILDCARD=/\.\*$/;function isEventPrefixMatch(prefix,fullName){prefix=prefix.replace(RX_TRAILING_WILDCARD,'');if(prefix===fullName){return true;}if(prefix.length>fullName.length){return false;}if(fullName.charAt(prefix.length)!=='.'){return false;}return fullName.indexOf(prefix)===0;}function isTransitionMatch(t,eventName){return t.events.some(function(tEvent){return tEvent==='*'||isEventPrefixMatch(tEvent,eventName);});}function scxmlPrefixTransitionSelector(state,event,evaluator,selectEventlessTransitions){return state.transitions.filter(function(t){return(selectEventlessTransitions?!t.events:!t.events||event&&event.name&&isTransitionMatch(t,event.name))&&(!t.cond||evaluator(t.cond));});}function eventlessTransitionSelector(state){return state.transitions.filter(function(transition){return!transition.events||transition.events&&transition.events.length===0;});}//model accessor functions
6808var 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
6809//related, and their smallest, mutual parent is a Concurrent-state.
6810return!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.
6811return 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
6812function getTransitionWithHigherSourceChildPriority(_args){var t1=_args[0],t2=_args[1];var r=getStateWithHigherSourceChildPriority(t1.source,t2.source);//compare transitions based first on depth, then based on document order
6813if(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 getStateWithHigherSourceChildPriority(s1,s2){//compare states based first on depth, then based on document order
6814if(s1.depth>s2.depth){return-1;}else if(s1.depth<s2.depth){return 1;}else{//Equality
6815if(s1.documentOrder<s2.documentOrder){return 1;}else if(s1.documentOrder>s2.documentOrder){return-1;}else{return 0;}}}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;BaseInterpreter.EVENTS=['onEntry','onExit','onTransition','onError','onBigStepBegin','onBigStepSuspend','onBigStepResume','onSmallStepBegin','onSmallStepEnd','onBigStepEnd'];/** @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));
6816this.opts=opts||{};this.opts.console=opts.console||(typeof console==='undefined'?{log:function log(){}}:console);//rely on global console if this console is undefined
6817this.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.
6818this.opts.console.log(Array.prototype.slice.apply(arguments).join(','));}}.bind(this);//set up default scripting context log function
6819this._internalEventQueue=[];//check if we're loading from a previous snapshot
6820if(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
6821}else{this._configuration=new this.opts.Set();this._historyValue={};this._isInFinalState=false;}//SCXML system variables:
6822this._x={_sessionId:opts.sessionId||null,_name:model.name||opts.name||null,_ioprocessors:opts.ioprocessors||null};//add debug logging
6823BaseInterpreter.EVENTS.forEach(function(event){this.on(event,this._log.bind(this,event));},this);}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
6824this._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.
6825//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
6826//makes the following operation safe.
6827this._configuration.add(this._model.initialRef);this._performBigStep();return this.getConfiguration();},/**
6828 * Starts the interpreter asynchronously
6829 * @param {Function} cb Callback invoked with an error or the interpreter's stable configuration
6830 * @expose
6831 */startAsync:function startAsync(cb){if(typeof cb!=='function'){cb=nop;}this._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
6832map(function(s){return s.id;}).reduce(function(a,b){return a.indexOf(b)>-1?a:a.concat(b);},[]);//uniq
6833},/** @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;var selectedTransitions=this._selectTransitions(currentEvent,true);if(selectedTransitions.isEmpty()){selectedTransitions=this._selectTransitions(currentEvent,false);}this.emit('onSmallStepBegin',currentEvent);this._performSmallStep(currentEvent,selectedTransitions);this.emit('onSmallStepEnd',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;var selectedTransitions=self._selectTransitions(currentEvent,true);if(selectedTransitions.isEmpty()){selectedTransitions=self._selectTransitions(currentEvent,false);}self.emit('onSmallStepBegin',currentEvent);self._performSmallStep(currentEvent,selectedTransitions);self.emit('onSmallStepEnd',currentEvent);}catch(err){cb(err);return;}if(!selectedTransitions.isEmpty()){// keep going, but be nice (yield) to the process
6834// TODO: for compat with non-node, non-mozilla
6835// allow the context to provide the defer task function
6836self.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,selectedTransitions){this._log("selecting transitions with currentEvent",JSON.stringify(currentEvent));this._log("selected transitions",selectedTransitions);if(!selectedTransitions.isEmpty()){this._log("sorted transitions",selectedTransitions);//we only want to enter and exit states from transitions with targets
6837//filter out targetless transitions here - we will only use these to execute transition actions
6838var 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];this._log("basicStatesExited ",basicStatesExited);this._log("basicStatesEntered ",basicStatesEntered);this._log("statesExited ",statesExited);this._log("statesEntered ",statesEntered);var eventsToAddToInnerQueue=new this.opts.Set();//update history states
6839this._log("executing state exit actions");for(var j=0,len=statesExited.length;j<len;j++){var stateExited=statesExited[j];this._log("exiting ",stateExited.id);//invoke listeners
6840this.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
6841this._historyValue[stateExited.historyRef.id]=statesExited.filter(f);}}// -> Concurrency: Number of transitions: Multiple
6842// -> Concurrency: Order of transitions: Explicitly defined
6843var sortedTransitions=selectedTransitions.iter().sort(transitionComparator);this._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,stxIdx);if(transition.onTransition!==undefined){for(var txIdx=0,txLen=transition.onTransition.length;txIdx<txLen;txIdx++){this._evaluateAction(currentEvent,transition.onTransition[txIdx]);}}}this._log("executing state enter actions");for(var enterIdx=0,enterLen=statesEntered.length;enterIdx<enterLen;enterIdx++){var stateEntered=statesEntered[enterIdx];this._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]);}}}this._log("updating configuration ");this._log("old configuration ",this._configuration);//update configuration by removing basic states exited, and adding basic states entered
6844this._configuration.difference(basicStatesExited);this._configuration.union(basicStatesEntered);this._log("new configuration ",this._configuration);//add set of generated events to the innerEventQueue -> Event Lifelines: Next small-step
6845if(!eventsToAddToInnerQueue.isEmpty()){this._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
6846return selectedTransitions;},/** @private */_evaluateAction:function _evaluateAction(currentEvent,actionRef){try{return actionRef.call(this._scriptingContext,currentEvent);//SCXML system variables
6847}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
6848//descendants of the scope of each priority-enabled transition.
6849//Here, we iterate through the transitions, and collect states
6850//that match this condition.
6851var 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
6852//is that state a descendant of the transition scope?
6853//Store ancestors of that state up to but not including the scope.
6854var 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(getStateWithHigherSourceChildPriority);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
6855var 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)
6856var s;/*jsl:ignore*/while(s=o.statesToProcess.pop()){/*jsl:end*/this._addStateAndDescendants(s,o);}//sort based on depth
6857var sortedStatesEntered=o.statesToEnter.iter().sort(function(s1,s2){return getStateWithHigherSourceChildPriority(s1,s2)*-1;});return[o.basicStatesToEnter,sortedStatesEntered];},/** @private */_addStateAndAncestors:function _addStateAndAncestors(target,scope,o){//process each target
6858this._addStateAndDescendants(target,o);//and process ancestors of targets up to the scope, but according to special rules
6859var 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
6860//this is to prevent adding his initial state later on
6861o.statesToEnter.add(s);o.statesProcessed.add(s);}else{//everything else can just be passed through as normal
6862this._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,selectEventlessTransitions){if(this.opts.onlySelectFromBasicStates){var states=this._configuration.iter();}else{var statesAndParents=new this.opts.Set();//get full configuration, unordered
6863//this means we may select transitions from parents before states
6864var 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 transitionSelector=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,selectEventlessTransitions);for(var txIdx=0,len=transitions.length;txIdx<len;txIdx++){enabledTransitions.add(transitions[txIdx]);}}var priorityEnabledTransitions=this._selectPriorityEnabledTransitions(enabledTransitions);this._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);this._log("enabledTransitions",enabledTransitions);this._log("consistentTransitions",consistentTransitions);this._log("inconsistentTransitionsPairs",inconsistentTransitionsPairs);this._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);this._log("enabledTransitions",enabledTransitions);this._log("consistentTransitions",consistentTransitions);this._log("inconsistentTransitionsPairs",inconsistentTransitionsPairs);this._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();this._log("transitions",transitions);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];},_log:function _log(){if(printTrace){var args=Array.from(arguments);this.opts.console.log(args[0]+": "+args.slice(1).map(function(arg){return arg===null?'null':arg===undefined?'undefined':typeof arg==='string'?arg:arg.__proto__===Object.prototype?JSON.stringify(arg):arg.toString();}).join(', ')+"\n");}},/** @private */_conflicts:function _conflicts(t1,t2){return!this._isArenaOrthogonal(t1,t2);},/** @private */_isArenaOrthogonal:function _isArenaOrthogonal(t1,t2){this._log("transition scopes",t1.scope,t2.scope);var isOrthogonal=query.isOrthogonalTo(t1.scope,t2.scope);this._log("transition scopes are orthogonal?",isOrthogonal);return isOrthogonal;},/*
6865 registerListener provides a generic mechanism to subscribe to state change and runtime error notifications.
6866 Can be used for logging and debugging. For example, can attach a logger that simply logs the state changes.
6867 Or can attach a network debugging client that sends state change notifications to a debugging server.
6868
6869 listener is of the form:
6870 {
6871 onEntry : function(stateId){},
6872 onExit : function(stateId){},
6873 onTransition : function(sourceStateId,targetStatesIds[]){},
6874 onError: function(errorInfo){},
6875 onBigStepBegin: function(){},
6876 onBigStepResume: function(){},
6877 onBigStepSuspend: function(){},
6878 onBigStepEnd: function(){}
6879 onSmallStepBegin: function(event){},
6880 onSmallStepEnd: function(){}
6881 }
6882 *///TODO: refactor this to be event emitter?
6883/** @expose */registerListener:function registerListener(listener){BaseInterpreter.EVENTS.forEach(function(event){if(listener[event])this.on(event,listener[event]);});},/** @expose */unregisterListener:function unregisterListener(listener){BaseInterpreter.EVENTS.forEach(function(event){if(listener[event])this.off(event,listener[event]);});},/** @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 *//**
6884 Three things capture the current snapshot of a running SCION interpreter:
6885
6886 * basic configuration (the set of basic states the state machine is in)
6887 * history state values (the states the state machine was in last time it was in the parent of a history state)
6888 * the datamodel
6889
6890 Note that this assumes that the method to serialize a scion.SCXML
6891 instance is not called when the interpreter is executing a big-step (e.g. after
6892 scion.SCXML.prototype.gen is called, and before the call to gen returns). If
6893 the serialization method is called during the execution of a big-step, then the
6894 inner event queue must also be saved. I do not expect this to be a common
6895 requirement however, and therefore I believe it would be better to only support
6896 serialization when the interpreter is not executing a big-step.
6897 */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;}});/**
6898 * @constructor
6899 * @extends BaseInterpreter
6900 */function Statechart(model,opts){opts=opts||{};opts.ioprocessors={};//Create all supported Event I/O processor nodes.
6901//TODO fix location after implementing actual processors
6902for(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
6903}function beget(o){function F(){}F.prototype=o;return new F();}/**
6904 * Do nothing
6905 */function nop(){}//Statechart.prototype = Object.create(BaseInterpreter.prototype);
6906//would like to use Object.create here, but not portable, but it's too complicated to use portably
6907Statechart.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
6908this._isStepping=true;this._performBigStep(currentEvent);this._isStepping=false;return this.getConfiguration();};/**
6909 * Injects an external event into the interpreter asynchronously
6910 * @param {object} currentEvent The event to inject
6911 * @param {string} currentEvent.name The name of the event
6912 * @param {string} [currentEvent.data] The event data
6913 * @param {Function} cb Callback invoked with an error or the interpreter's stable configuration
6914 * @expose
6915 */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:
6916// http://daringfireball.net/2010/07/improved_regex_for_matching_urls
6917// http://stackoverflow.com/a/6927878
6918var 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
6919InterpreterScriptingContext.prototype={raise:function raise(event){this._interpreter._internalEventQueue.push(event);},send:function send(event,options){//TODO: move these out
6920function 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
6921var 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||{};this._interpreter._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){this._interpreter._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};},{}],2:[function(require,module,exports){(function(process){var _marked=[genStates].map(regeneratorRuntime.mark);/**
6922 * Accept a scjson document as input, either from a file or via stdin.
6923 * Generate a JavaScript module as output.
6924 * This module should be customizable:
6925 * plain object literal if appropriate
6926 * simple self-invoking function (for use in scion-scxml)
6927 * UMD in probably all other cases. although we could make it CommonJS/AMD/etc.
6928 */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
6929//TODO: we should also encode the document name. accept as command-line argument, or embed it in the scjson itself, maybe?
6930var 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,
6931//and another single function that inits the model needs to contain a reference to this init function,
6932//and the interpreter must know about it. should be optional.
6933//call it $scion_init_datamodel.
6934function 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
6935'}';}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
6936function generateEarlyBindingDatamodelInitFn(builder){//this guard guarantees it will only fire once
6937return'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
6938builder.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
6939return JSON.stringify(rootState,undefined,1).replace(REFERENCE_MARKER_RE,'$1');}function dumpFunctionDeclarations(fnDecAccumulator){//simple
6940return 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' +
6941program+'})';}ModuleBuilder.prototype.generateModule=function(){var rootState=this.rootState;var options=this.options;//TODO: enumerate these module types
6942if(this.datamodelAccumulator.length){//generalize him as an entry action on the root state
6943rootState.onEntry=rootState.onEntry||[];//make sure that datamodel initialization fn comes before all other entry actions
6944rootState.onEntry=[markAsReference(EARLY_BINDING_DATAMODEL_FN_NAME)].concat(rootState.onEntry);}//attach datamodel serialization functions
6945rootState[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);
6946//TODO: support other module formats (AMD, UMD, module pattern)
6947var 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
6948o.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
6949if(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
6950delete state.datamodel;setImmediate(function(self){self.visitState();},this);};/**
6951 * The uncooked SCION module
6952 * @param {string} [name] The name of the module derived from the scxml root element's name attribute
6953 * @param {string} datamodel The raw datamodel declarations
6954 * @param {Array<ScriptNode>} rootScripts A collection of 0 or more script nodes
6955 * Each node contains a src property which references an external js resource
6956 * or a content property which references a string containing the uncooked js
6957 * @param {string} scxmlModule A massive string containing the generated scxml program
6958 * less the parts enumerated above
6959 */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
6960var 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
6961this.datamodelAccumulator.push({$line:lineNum,$col:colNum,id:variableName});}};/**
6962 * Handles an externally referenced script within an executable content block
6963 * @param {object} action The script action
6964 * @return {string} A call to the named function that will be injected at model preparation time
6965 * @see document-string-to-model#prepare
6966 */ModuleBuilder.prototype.handleExternalActionScript=function(action){// base the generated function name on the fully-qualified url, NOT on its position in the file
6967var fnName=to_js_identifier(action.src);// Only load the script once. It will be evaluated as many times as it is referenced.
6968if(!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
6969return'$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
6970params.push(generateFnCall(builder.generateAttributeExpression(action,'labelexpr')));}else{// always push *something* so the interpreter context
6971// can differentiate between label and message
6972params.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
6973for(;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
6974if(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
6975function 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.
6976//if we're going to generate this expr on the fly, it would be better to clone the container.
6977container[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
6978if(action.content){return' '+JSON.stringify(action.content);//TODO: inline it if content is pure JSON. call custom attribute 'contentType'?
6979}else if(action.contentexpr){return generateFnCall(builder.generateAttributeExpression(action,'contentexpr'));}else{var props=[];//namelist
6980if(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
6981});}//params
6982if(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
6983" 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
6984var 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
6985//generate idlocationGenerator if we find
6986var 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
6987' } while($sendIdAccumulator.indexOf(sendid) > -1)\n'+' return sendid;\n'+'}';}module.exports=startTraversal;//for executing directly under node.js
6988if(require.main===module){//TODO: clean up command-line interface so that we do not expose unnecessary cruft
6989var 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
6990process.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":31,"fs":15,"optimist":28,"text-to-js-identifier":54}],3:[function(require,module,exports){(function(process){//TODO: resolve data/@src and script/@src. either here, or in a separate module.
6991//TODO: remove nodejs dependencies
6992//TODO: decide on a friendly, portable interface to this module. streaming is possible, but maybe not very portable.
6993var sax=require("sax"),strict=true,// set to false for html-mode
6994parser;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,
6995//and this is the only way we can capture their row/col numbers.
6996//so when we finally find one, it gets popped off the stack.
6997jsonStack=[],allTransitions=[];//we keep a reference to these so we can clean up the onTransition property later
6998function createActionJson(node){var action=merge({$line:parser.line,$column:parser.column,$type:node.local},copyNsAttrObj(node.attributes));//console.log('action node',node);
6999var actionContainer;if(Array.isArray(currentJson)){//this will be onExit and onEntry
7000currentJson.push(action);}else if(currentJson.$type==='scxml'&&action.$type==='script'){//top-level script
7001currentJson.rootScripts=currentJson.rootScripts||[];currentJson.rootScripts.push(action);}else{//if it's any other action
7002currentJson.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
7003if(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
7004if(transition.target){//console.log('transition',transition);
7005transition.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
7006"transition":createTransitionJson,"onentry":function onentry(node){currentJson=currentJson.onEntry=currentJson.onEntry||[];},"onexit":function onexit(node){currentJson=currentJson.onExit=currentJson.onExit||[];},//actions
7007"foreach":createActionJson,"raise":createActionJson,"log":createActionJson,"assign":createActionJson,"validate":createActionJson,"script":createActionJson,"cancel":createActionJson,//TODO: deal with namelist
7008//TODO: decide how to deal with location expressions, as opposed to regular expressions
7009"send":createActionJson,//children of send
7010"param":function param(node){//TODO: figure out how to deal with param and param/@expr and param/@location
7011currentJson.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
7012"if":createActionJson,"elseif":createActionJson,"else":createActionJson,//data
7013"datamodel":function datamodel(node){//console.log('datamodel currentJson',currentJson);
7014currentJson=currentJson.datamodel=[];},"data":function data(node){//console.log('data currentJson',currentJson);
7015currentJson.push(createDataJson(node));}//TODO: these
7016//"invoke":,
7017//"finalize":,
7018//"donedata":
7019};expressionAttributeCache={};//TODO: put in onstart or something like that
7020parser.onopentag=function(node){//console.log("open tag",node.local);
7021if(tagActions[node.local]){tagActions[node.local](node);jsonStack.push(currentJson);//console.log('current json now',currentJson,jsonStack.length);
7022//merge in the current expression attribute cache
7023merge(currentJson,expressionAttributeCache);expressionAttributeCache={};//clear the expression attribute cache
7024}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);
7025var localName=tag.split(':').pop();// if(tagActions[localName]){
7026jsonStack.pop();currentJson=jsonStack[jsonStack.length-1];//console.log('current json now',currentJson,jsonStack.length);
7027// }
7028};parser.onattribute=function(attr){//if attribute name ends with 'expr' or is one of the other ones enumerated above
7029//then cache him and his position
7030if(attr.name.match(/^.*expr$/)||EXPRESSION_ATTRS.indexOf(attr.name)>-1){expressionAttributeCache[getNormalizedAttributeName(attr)]=createExpression(attr.value);}};parser.onerror=function(e){// an error happened.
7031throw e;};parser.ontext=function(t){//the only text we care about is that inside of <script> and <content>
7032if(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
7033}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
7034delete rootJson.xmlns;//delete rootJson.type; //it can be useful to leave in 'type' === 'scxml'
7035delete rootJson.version;if(typeof rootJson.datamodel==='string')delete rootJson.datamodel;//this would happen if we have, e.g. state.datamodel === 'ecmascript'
7036//change the property name of transition event to something nicer
7037allTransitions.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
7038if(require.main===module){//TODO: allow reading from stdin directly
7039//TODO: use saxjs's support for streaming API.
7040console.log(JSON.stringify(transform(require('fs').readFileSync(process.argv[2],'utf8')),4,4));}}).call(this,require('_process'));},{"_process":31,"fs":15,"sax":47}],4:[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
7041}else{result.content=text;}cb(result);},context);}};module.exports=fileUtils;},{"../../runtime/platform-bootstrap/node/platform":10}],5:[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
7042//src attribute starting exactly with "file:"
7043if(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);
7044var errors=validateJavascriptCondition(node.cond);if(errors.length){//Assume illegal booleans as false, send override
7045//https://github.com/jbeard4/scxml-test-framework/blob/2.0.0/test/w3c-ecma/test309.txml.scxml
7046node.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
7047// each time the parent document is requested
7048}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
7049if(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
7050if(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
7051traverseSyntaxTree(tree[i],errors);}});}function getFileContents(filePath,done){//docUrl and context are coming from top function.
7052fileUtils.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.
7053if((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
7054if(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
7055waitingForAsync=true;}}};module.exports=scJsonAnalyzer;},{"./file-utils":4,"esprima":20}],6:[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":2,"../compiler/scxml-to-scjson":3,"../compiler/static-analysis/scjson-analyzer":5}],7:[function(require,module,exports){/*
7056 Copyright 2011-2012 Jacob Beard, INFICON, and other SCION contributors
7057
7058 Licensed under the Apache License, Version 2.0 (the "License");
7059 you may not use this file except in compliance with the License.
7060 You may obtain a copy of the License at
7061
7062 http://www.apache.org/licenses/LICENSE-2.0
7063
7064 Unless required by applicable law or agreed to in writing, software
7065 distributed under the License is distributed on an "AS IS" BASIS,
7066 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7067 See the License for the specific language governing permissions and
7068 limitations under the License.
7069*/"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;/**
7070 * Compile the raw scxml document into a compiled JS module
7071 * Top-level scripts are extracted so that they can be compiled and executed independently
7072 * @param {string} url The url of the scxml document
7073 * @param {string} docString The raw scxml document to be parsed
7074 * @param {Function} cb The callback to invoke once the document has been parsed
7075 * @param {object} [hostContext] Context provided by the interpreter host
7076 */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});});}/**
7077 * Compile the generated scxml module and any embedded or external scripts
7078 * @param {string} docUrl The scxml document url
7079 * @param {SCJsonRawModule} rawModule The raw SCION module created by scjson-to-module
7080 * @param {object} [hostContext] Context provided by the interpreter host
7081 * @param {Function} cb Callback to invoke with the compiled module or an error
7082 */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
7083promises[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;}/**
7084 * Prepares an scxml model for execution by binding it to an execution context
7085 * @param {object} [executionContext] The execution context (e.g. v8 VM sandbox).
7086 * If not provided, a bare bones context is constructed
7087 * @param {Function} cb Callback to execute with the prepared model or an error
7088 * The prepared model is a function to be passed into a SCION StateChart object
7089 * @param {object} [hostContext] Context provided by the interpreter host
7090 */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
7091scriptPromises[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":6,"./platform-bootstrap/node/platform":10,"assert":12,"fs":15,"vm":61}],8:[function(require,module,exports){/*
7092 Copyright 2011-2012 Jacob Beard, INFICON, and other SCION contributors
7093
7094 Licensed under the Apache License, Version 2.0 (the "License");
7095 you may not use this file except in compliance with the License.
7096 You may obtain a copy of the License at
7097
7098 http://www.apache.org/licenses/LICENSE-2.0
7099
7100 Unless required by applicable law or agreed to in writing, software
7101 distributed under the License is distributed on an "AS IS" BASIS,
7102 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7103 See the License for the specific language governing permissions and
7104 limitations under the License.
7105*/"use strict";var platform=require('./platform-bootstrap/node/platform'),documentStringToModel=require('./document-string-to-model');/**
7106 * Includes options passed to the model compiler as well as
7107 * data passed along to the platform-specific resource-fetching API.
7108 * @typedef {object} ModelContext
7109 * @property {boolean} [reportAllErrors=false] Indicates whether or not data model (aka JavaScript)
7110 * compilation errors cause the callback to be invoked with errors. By default these errors
7111 * are raised to the offending document as error.execution events.
7112 *//**
7113 * @param {string} url URL of the SCXML document to retrieve and convert to a model
7114 * @param {function} cb callback to invoke with an error or the model
7115 * @param {ModelContext} [context] The model compiler context
7116 */function urlToModel(url,cb,context){platform.http.get(url,function(err,doc){if(err){cb(err,null);}else{documentStringToModel(url,doc,cb,context);}},context);}/**
7117 * @param {string} url file system path of the SCXML document to retrieve and convert to a model
7118 * @param {function} cb callback to invoke with an error or the model
7119 * @param {ModelContext} [context] The model compiler context
7120 */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
7121platform.fs.get(url,function(err,doc){if(err){cb(err,null);}else{documentStringToModel(url,doc,cb,context);}},context);}/**
7122 * @param document SCXML document to convert to a model
7123 * @param {function} cb callback to invoke with an error or the model
7124 * @param {ModelContext} [context] The model compiler context
7125 */function documentToModel(doc,cb,context){var s=platform.dom.serializeToString(doc);documentStringToModel(null,s,cb,context);}//export standard interface
7126module.exports={pathToModel:pathToModel,urlToModel:urlToModel,documentStringToModel:documentStringToModel,documentToModel:documentToModel,ext:{platform:platform,compilerInternals:require('./compiler-internals')//expose
7127},scion:require('scion-core')};},{"./compiler-internals":6,"./document-string-to-model":7,"./platform-bootstrap/node/platform":10,"scion-core":1}],9:[function(require,module,exports){/*
7128 Copyright 2011-2012 Jacob Beard, INFICON, and other SCION contributors
7129
7130 Licensed under the Apache License, Version 2.0 (the "License");
7131 you may not use this file except in compliance with the License.
7132 You may obtain a copy of the License at
7133
7134 http://www.apache.org/licenses/LICENSE-2.0
7135
7136 Unless required by applicable law or agreed to in writing, software
7137 distributed under the License is distributed on an "AS IS" BASIS,
7138 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7139 See the License for the specific language governing permissions and
7140 limitations under the License.
7141*/"use strict";/**
7142 * This module contains some utility functions for getting stuff in node.js.
7143 */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?
7144){httpGet(url,cb);}else if(!urlObj.protocol){//assume filesystem
7145fs.readFile(url,'utf8',cb);}else{//pass in error for unrecognized protocol
7146cb(new Error("Unrecognized protocol"));}}module.exports={getResource:getResource,httpGet:httpGet};},{"fs":15,"http":49,"url":56}],10:[function(require,module,exports){(function(process){/*
7147 Copyright 2011-2012 Jacob Beard, INFICON, and other SCION contributors
7148
7149 Licensed under the Apache License, Version 2.0 (the "License");
7150 you may not use this file except in compliance with the License.
7151 You may obtain a copy of the License at
7152
7153 http://www.apache.org/licenses/LICENSE-2.0
7154
7155 Unless required by applicable law or agreed to in writing, software
7156 distributed under the License is distributed on an "AS IS" BASIS,
7157 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7158 See the License for the specific language governing permissions and
7159 limitations under the License.
7160*/"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
7161http:{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
7162url:{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
7163var _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;},/**
7164 * create a context in which to execute javascript
7165 * @param {object} [sandbox] An object to contextify
7166 * @return {object} An execution context
7167 * @see {@link https://nodejs.org/dist/latest-v4.x/docs/api/vm.html#vm_vm_createcontext_sandbox}
7168 */createExecutionContext:function createExecutionContext(sandbox,hostContext){return vm.createContext(sandbox);},/**
7169 * Create a compiled script object
7170 * @param {string} src The js source to compile
7171 * @param {object} options compilation options
7172 * @param {string} options.filename The path to the file associated with the source
7173 * @param {number} options.lineOffset The offset to the line number in the scxml document
7174 * @param {number} options.columnOffset The offset to the column number in the scxml document
7175 * @return {Script} A Script object which implements a runInContext method
7176 * @see {@link https://nodejs.org/dist/latest-v4.x/docs/api/vm.html#vm_class_script}
7177 */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
7178// https://247inc.atlassian.net/browse/OMNI-3
7179// create an isolated sandbox per session
7180var 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
7181var _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
7182ctx.require=context.require||//user-specified require
7183require.main&&//main module's require
7184require.main.require&&require.main.require.bind(require.main)||require;//this module's require
7185}//set up default require and module.exports
7186return 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);
7187}},log:console.log};}).call(this,require('_process'));},{"./get":9,"./url":11,"_process":31,"fs":15,"module":15,"path":29,"vm":61}],11:[function(require,module,exports){/*
7188 Copyright 2011-2012 Jacob Beard, INFICON, and other SCION contributors
7189
7190 Licensed under the Apache License, Version 2.0 (the "License");
7191 you may not use this file except in compliance with the License.
7192 You may obtain a copy of the License at
7193
7194 http://www.apache.org/licenses/LICENSE-2.0
7195
7196 Unless required by applicable law or agreed to in writing, software
7197 distributed under the License is distributed on an "AS IS" BASIS,
7198 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7199 See the License for the specific language governing permissions and
7200 limitations under the License.
7201*/"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":56}],12:[function(require,module,exports){// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
7202//
7203// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
7204//
7205// Originally from narwhal.js (http://narwhaljs.org)
7206// Copyright (c) 2009 Thomas Robinson <280north.com>
7207//
7208// Permission is hereby granted, free of charge, to any person obtaining a copy
7209// of this software and associated documentation files (the 'Software'), to
7210// deal in the Software without restriction, including without limitation the
7211// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7212// sell copies of the Software, and to permit persons to whom the Software is
7213// furnished to do so, subject to the following conditions:
7214//
7215// The above copyright notice and this permission notice shall be included in
7216// all copies or substantial portions of the Software.
7217//
7218// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
7219// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
7220// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
7221// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
7222// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
7223// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7224// when used in node, this will actually load the util module we depend on
7225// versus loading the builtin util module as happens otherwise
7226// this is a bug in node module loading as far as I am concerned
7227var util=require('util/');var pSlice=Array.prototype.slice;var hasOwn=Object.prototype.hasOwnProperty;// 1. The assert module provides functions that throw
7228// AssertionError's when particular conditions are not met. The
7229// assert module must conform to the following interface.
7230var assert=module.exports=ok;// 2. The AssertionError is defined in assert.
7231// new assert.AssertionError({ message: message,
7232// actual: actual,
7233// expected: expected })
7234assert.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
7235var err=new Error();if(err.stack){var out=err.stack;// try to strip useless frames
7236var fn_name=stackStartFunction.name;var idx=out.indexOf('\n'+fn_name);if(idx>=0){// once we have located the function frame
7237// we need to strip out everything before it (and its line)
7238var next_line=out.indexOf('\n',idx+1);out=out.substring(next_line+1);}this.stack=out;}}};// assert.AssertionError instanceof Error
7239util.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
7240// understood by the spec. Implementations or sub modules can pass
7241// other keys to the AssertionError's constructor - they will be
7242// ignored.
7243// 3. All of the following functions must throw an AssertionError
7244// when a corresponding condition is not met, with a message that
7245// may be undefined if not provided. All assertion methods provide
7246// both the actual and expected values to the assertion error for
7247// display purposes.
7248function 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.
7249assert.fail=fail;// 4. Pure assertion tests whether a value is truthy, as determined
7250// by !!guard.
7251// assert.ok(guard, message_opt);
7252// This statement is equivalent to assert.equal(true, !!guard,
7253// message_opt);. To test strictly for the value true, use
7254// assert.strictEqual(true, guard, message_opt);.
7255function ok(value,message){if(!value)fail(value,true,message,'==',assert.ok);}assert.ok=ok;// 5. The equality assertion tests shallow, coercive equality with
7256// ==.
7257// assert.equal(actual, expected, message_opt);
7258assert.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
7259// with != assert.notEqual(actual, expected, message_opt);
7260assert.notEqual=function notEqual(actual,expected,message){if(actual==expected){fail(actual,expected,message,'!=',assert.notEqual);}};// 7. The equivalence assertion tests a deep equality relation.
7261// assert.deepEqual(actual, expected, message_opt);
7262assert.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 ===.
7263if(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
7264// equivalent if it is also a Date object that refers to the same time.
7265}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
7266// equivalent if it is also a RegExp object with the same source and
7267// properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
7268}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',
7269// equivalence is determined by ==.
7270}else if(!util.isObject(actual)&&!util.isObject(expected)){return actual==expected;// 7.5 For all other Object pairs, including Array objects, equivalence is
7271// determined by having the same number of owned properties (as verified
7272// with Object.prototype.hasOwnProperty.call), the same set of keys
7273// (although not necessarily the same order), equivalent values for every
7274// corresponding key, and an identical 'prototype' property. Note: this
7275// accounts for both named and indexed properties on Arrays.
7276}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.
7277if(a.prototype!==b.prototype)return false;// if one is a primitive, the other must be same
7278if(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
7279// hasOwnProperty)
7280if(ka.length!=kb.length)return false;//the same set of keys (although not necessarily the same order),
7281ka.sort();kb.sort();//~~~cheap key test
7282for(i=ka.length-1;i>=0;i--){if(ka[i]!=kb[i])return false;}//equivalent values for every corresponding key, and
7283//~~~possibly expensive deep test
7284for(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.
7285// assert.notDeepEqual(actual, expected, message_opt);
7286assert.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 ===.
7287// assert.strictEqual(actual, expected, message_opt);
7288assert.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
7289// determined by !==. assert.notStrictEqual(actual, expected, message_opt);
7290assert.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:
7291// assert.throws(block, Error_opt, message_opt);
7292assert.throws=function(block,/*optional*/error,/*optional*/message){_throws.apply(this,[true].concat(pSlice.call(arguments)));};// EXTENSION! This is annoying to write outside this module.
7293assert.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/":60}],13:[function(require,module,exports){'use strict';exports.byteLength=byteLength;exports.toByteArray=toByteArray;exports.fromByteArray=fromByteArray;var lookup=[];var revLookup=[];var Arr=typeof Uint8Array!=='undefined'?Uint8Array:Array;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;function placeHoldersCount(b64){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)
7294// if there are two placeholders, than the two characters before it
7295// represent one byte
7296// if there is only one, then the three characters before it represent 2 bytes
7297// this is just a cheap hack to not do indexOf twice
7298return b64[len-2]==='='?2:b64[len-1]==='='?1:0;}function byteLength(b64){// base64 is 4/3 + up to two characters of the original data
7299return b64.length*3/4-placeHoldersCount(b64);}function toByteArray(b64){var i,j,l,tmp,placeHolders,arr;var len=b64.length;placeHolders=placeHoldersCount(b64);arr=new Arr(len*3/4-placeHolders);// if there are placeholders, only get up to the last complete 4 chars
7300l=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
7301var output='';var parts=[];var maxChunkLength=16383;// must be multiple of 3
7302// go through the array every three bytes, we'll deal with trailing stuff later
7303for(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
7304if(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('');}},{}],14:[function(require,module,exports){},{}],15:[function(require,module,exports){arguments[4][14][0].apply(exports,arguments);},{"dup":14}],16:[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":17}],17:[function(require,module,exports){(function(global){/*!
7305 * The buffer module from node.js, for the browser.
7306 *
7307 * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
7308 * @license MIT
7309 *//* 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;/**
7310 * If `Buffer.TYPED_ARRAY_SUPPORT`:
7311 * === true Use Uint8Array implementation (fastest)
7312 * === false Use Object implementation (most compatible, even IE6)
7313 *
7314 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
7315 * Opera 11.6+, iOS 4.2+.
7316 *
7317 * Due to various browser bugs, sometimes the Object implementation will be used even
7318 * when the browser supports typed arrays.
7319 *
7320 * Note:
7321 *
7322 * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
7323 * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
7324 *
7325 * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
7326 *
7327 * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
7328 * incorrect length in some situations.
7329
7330 * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
7331 * get the Object implementation, which is slower but behaves correctly.
7332 */Buffer.TYPED_ARRAY_SUPPORT=global.TYPED_ARRAY_SUPPORT!==undefined?global.TYPED_ARRAY_SUPPORT:typedArraySupport();/*
7333 * Export kMaxLength after typed array support is determined.
7334 */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
7335typeof arr.subarray==='function'&&// chrome 9-10 lack `subarray`
7336arr.subarray(1,1).byteLength===0;// ie10 has broken `subarray`
7337}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
7338that=new Uint8Array(length);that.__proto__=Buffer.prototype;}else{// Fallback: Return an object instance of the Buffer class
7339if(that===null){that=new Buffer(length);}that.length=length;}return that;}/**
7340 * The Buffer constructor returns instances of `Uint8Array` that have their
7341 * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
7342 * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
7343 * and the `Uint8Array` methods. Square bracket notation works as expected -- it
7344 * returns a single octet.
7345 *
7346 * The `Uint8Array` prototype remains unmodified.
7347 */function Buffer(arg,encodingOrOffset,length){if(!Buffer.TYPED_ARRAY_SUPPORT&&!(this instanceof Buffer)){return new Buffer(arg,encodingOrOffset,length);}// Common case.
7348if(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
7349// TODO: Legacy, not needed anymore. Remove in next major version.
7350Buffer._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);}/**
7351 * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
7352 * if value is a number.
7353 * Buffer.from(str[, encoding])
7354 * Buffer.from(array)
7355 * Buffer.from(buffer)
7356 * Buffer.from(arrayBuffer[, byteOffset[, length]])
7357 **/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
7358Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:true});}}function assertSize(size){if(typeof size!=='number'){throw new TypeError('"size" argument must be a number');}else if(size<0){throw new RangeError('"size" argument must not be negative');}}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
7359// prevents accidentally sending in a number that would
7360// be interpretted as a start offset.
7361return typeof encoding==='string'?createBuffer(that,size).fill(fill,encoding):createBuffer(that,size).fill(fill);}return createBuffer(that,size);}/**
7362 * Creates a new filled Buffer instance.
7363 * alloc(size[, fill[, encoding]])
7364 **/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;}/**
7365 * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
7366 * */Buffer.allocUnsafe=function(size){return allocUnsafe(null,size);};/**
7367 * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
7368 */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
7369// cause everything after the first invalid character to be ignored. (e.g.
7370// 'abxxcd' will be treated as 'ab')
7371that=that.slice(0,actual);}return that;}function fromArrayLike(that,array){var length=array.length<0?0: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
7372if(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
7373that=array;that.__proto__=Buffer.prototype;}else{// Fallback: Return an object instance of the Buffer class
7374that=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
7375// length is NaN (which is otherwise coerced to zero.)
7376if(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
7377length=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
7378var 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
7379encoding=(''+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
7380// property of a typed array.
7381// This behaves neither like String nor Uint8Array in that we set start/end
7382// to their upper/lower bounds if the value passed is out of range.
7383// undefined is handled specially as per ECMA-262 6th Edition,
7384// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
7385if(start===undefined||start<0){start=0;}// Return early if start > this.length. Done here to prevent potential uint32
7386// coercion fail below.
7387if(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.
7388end>>>=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
7389// Buffer instances.
7390Buffer.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`,
7391// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
7392//
7393// Arguments:
7394// - buffer - a Buffer to search
7395// - val - a string, Buffer, or number
7396// - byteOffset - an index into `buffer`; will be clamped to an int32
7397// - encoding - an optional encoding, relevant is val is a string
7398// - dir - true for indexOf, false for lastIndexOf
7399function bidirectionalIndexOf(buffer,val,byteOffset,encoding,dir){// Empty buffer means no match
7400if(buffer.length===0)return-1;// Normalize byteOffset
7401if(typeof byteOffset==='string'){encoding=byteOffset;byteOffset=0;}else if(byteOffset>0x7fffffff){byteOffset=0x7fffffff;}else if(byteOffset<-0x80000000){byteOffset=-0x80000000;}byteOffset=+byteOffset;// Coerce to Number.
7402if(isNaN(byteOffset)){// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
7403byteOffset=dir?0:buffer.length-1;}// Normalize byteOffset: negative offsets start from the end of the buffer
7404if(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
7405if(typeof val==='string'){val=Buffer.from(val,encoding);}// Finally, search either indexOf (if dir is true) or lastIndexOf
7406if(Buffer.isBuffer(val)){// Special case: looking for empty string/buffer always fails
7407if(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]
7408if(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
7409var 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)
7410if(offset===undefined){encoding='utf8';length=this.length;offset=0;// Buffer#write(string, encoding)
7411}else if(length===undefined&&typeof offset==='string'){encoding=offset;length=this.length;offset=0;// Buffer#write(string, offset[, length][, encoding])
7412}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
7413}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
7414return 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
7415// replacement char (U+FFFD) and advance only 1 byte
7416codePoint=0xFFFD;bytesPerSequence=1;}else if(codePoint>0xFFFF){// encode to utf16 (surrogate pair dance)
7417codePoint-=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
7418// the lowest limit is Chrome, with 0x10000 args.
7419// We go 1 magnitude less, for safety
7420var 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()
7421}// Decode in chunks to avoid "call stack size exceeded".
7422var 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;};/*
7423 * Need to make sure that buffer isn't trying to write out of bounds.
7424 */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)
7425Buffer.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
7426if(end===start)return 0;if(target.length===0||this.length===0)return 0;// Fatal error conditions
7427if(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?
7428if(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
7429for(i=len-1;i>=0;--i){target[i+targetStart]=this[i+start];}}else if(len<1000||!Buffer.TYPED_ARRAY_SUPPORT){// ascending copy from start
7430for(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:
7431// buffer.fill(number[, offset[, end]])
7432// buffer.fill(buffer[, offset[, end]])
7433// buffer.fill(string[, offset[, end]][, encoding])
7434Buffer.prototype.fill=function fill(val,start,end,encoding){// Handle string cases:
7435if(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.
7436if(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
7437// ================
7438var 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
7439str=stringtrim(str).replace(INVALID_BASE64_RE,'');// Node converts strings with length < 2 to ''
7440if(str.length<2)return'';// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
7441while(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
7442if(codePoint>0xD7FF&&codePoint<0xE000){// last char was a lead
7443if(!leadSurrogate){// no lead yet
7444if(codePoint>0xDBFF){// unexpected trail
7445if((units-=3)>-1)bytes.push(0xEF,0xBF,0xBD);continue;}else if(i+1===length){// unpaired lead
7446if((units-=3)>-1)bytes.push(0xEF,0xBF,0xBD);continue;}// valid lead
7447leadSurrogate=codePoint;continue;}// 2 leads in a row
7448if(codePoint<0xDC00){if((units-=3)>-1)bytes.push(0xEF,0xBF,0xBD);leadSurrogate=codePoint;continue;}// valid surrogate pair
7449codePoint=(leadSurrogate-0xD800<<10|codePoint-0xDC00)+0x10000;}else if(leadSurrogate){// valid bmp char, but last char was a lead
7450if((units-=3)>-1)bytes.push(0xEF,0xBF,0xBD);}leadSurrogate=null;// encode utf8
7451if(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..
7452byteArray.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
7453}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"base64-js":13,"ieee754":22,"isarray":26}],18:[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"};},{}],19:[function(require,module,exports){(function(Buffer){// Copyright Joyent, Inc. and other Node contributors.
7454//
7455// Permission is hereby granted, free of charge, to any person obtaining a
7456// copy of this software and associated documentation files (the
7457// "Software"), to deal in the Software without restriction, including
7458// without limitation the rights to use, copy, modify, merge, publish,
7459// distribute, sublicense, and/or sell copies of the Software, and to permit
7460// persons to whom the Software is furnished to do so, subject to the
7461// following conditions:
7462//
7463// The above copyright notice and this permission notice shall be included
7464// in all copies or substantial portions of the Software.
7465//
7466// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
7467// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
7468// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
7469// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
7470// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
7471// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
7472// USE OR OTHER DEALINGS IN THE SOFTWARE.
7473// NOTE: These type checking functions intentionally don't use `instanceof`
7474// because it is fragile and can be easily faked with `Object.create()`.
7475function 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
7476typeof arg==='undefined';}exports.isPrimitive=isPrimitive;exports.isBuffer=Buffer.isBuffer;function objectToString(o){return Object.prototype.toString.call(o);}}).call(this,{"isBuffer":require("../../is-buffer/index.js")});},{"../../is-buffer/index.js":25}],20:[function(require,module,exports){/*
7477 Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved.
7478
7479 Redistribution and use in source and binary forms, with or without
7480 modification, are permitted provided that the following conditions are met:
7481
7482 * Redistributions of source code must retain the above copyright
7483 notice, this list of conditions and the following disclaimer.
7484 * Redistributions in binary form must reproduce the above copyright
7485 notice, this list of conditions and the following disclaimer in the
7486 documentation and/or other materials provided with the distribution.
7487
7488 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
7489 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
7490 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
7491 ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
7492 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
7493 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
7494 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
7495 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
7496 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
7497 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7498*/(function(root,factory){'use strict';// Universal Module Definition (UMD) to support AMD, CommonJS/Node.js,
7499// Rhino, and plain browser loading.
7500/* 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.
7501FnExprTokens=['(','{','[','in','typeof','instanceof','new','return','case','delete','throw','void',// assignment operators
7502'=','+=','-=','*=','/=','%=','<<=','>>=','>>>=','&=','|=','^=',',',// binary/unary operators
7503'+','-','*','/','%','++','--','<<','>>','>>>','&','|','^','!','~','&&','||','?',':','===','==','>=','<=','<','>','!=','!=='];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.
7504Messages={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.
7505Regex={// ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierStart:
7506NonAsciiIdentifierStart:/[\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:
7507NonAsciiIdentifierPart:/[\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.
7508// This is only to have a better contract semantic, i.e. another safety net
7509// to catch a logic error. The condition shall be fulfilled in normal case.
7510// Do NOT use this to enforce a certain condition on any user input.
7511function assert(condition,message){/* istanbul ignore if */if(!condition){throw new Error('ASSERT: '+message);}}function isDecimalDigit(ch){return ch>=0x30&&ch<=0x39;// 0..9
7512}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
7513var 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
7514// with 0, 1, 2, 3
7515if('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
7516function 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
7517function isLineTerminator(ch){return ch===0x0A||ch===0x0D||ch===0x2028||ch===0x2029;}// ECMA-262 11.6 Identifier Names and Identifiers
7518function 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)
7519ch>=0x41&&ch<=0x5A||// A..Z
7520ch>=0x61&&ch<=0x7A||// a..z
7521ch===0x5C||// \ (backslash)
7522ch>=0x80&&Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));}function isIdentifierPart(ch){return ch===0x24||ch===0x5F||// $ (dollar) and _ (underscore)
7523ch>=0x41&&ch<=0x5A||// A..Z
7524ch>=0x61&&ch<=0x7A||// a..z
7525ch>=0x30&&ch<=0x39||// 0..9
7526ch===0x5C||// \ (backslash)
7527ch>=0x80&&Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));}// ECMA-262 11.6.2.2 Future Reserved Words
7528function 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
7529function 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
7530function 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 '*/'.
7531if(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
7532if(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 '/'
7533ch=source.charCodeAt(index+1);if(ch===0x2F){++index;++index;skipSingleLineComment(2);start=true;}else if(ch===0x2A){// U+002A is '*'
7534++index;++index;skipMultiLineComment();}else{break;}}else if(start&&ch===0x2D){// U+002D is '-'
7535// U+003E is '>'
7536if(source.charCodeAt(index+1)===0x2D&&source.charCodeAt(index+2)===0x3E){// '-->' is a single-line comment
7537index+=3;skipSingleLineComment(3);}else{break;}}else if(ch===0x3C){// U+003C is '<'
7538if(source.slice(index+1,index+4)==='!--'){++index;// `<`
7539++index;// `!`
7540++index;// `-`
7541++index;// `-`
7542skipSingleLineComment(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.
7543if(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.
7544if(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.
7545if(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.
7546index=start;return getComplexIdentifier();}else if(ch>=0xD800&&ch<0xDFFF){// Need to handle surrogate pairs.
7547index=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.
7548id=source.charCodeAt(index)===0x5C?getComplexIdentifier():getIdentifier();// There is no keyword or literal with only one character.
7549// Thus, it must be an identifier.
7550if(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
7551function scanPunctuator(){var token,str;token={type:Token.Punctuator,value:'',lineNumber:lineNumber,lineStart:lineStart,start:index,end:index};// Check for most common single-character punctuators.
7552str=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: ...
7553index+=2;str='...';}break;case'}':++index;state.curlyStack.pop();break;case')':case';':case',':case'[':case']':case':':case'?':case'~':++index;break;default:// 4-character punctuator.
7554str=source.substr(index,4);if(str==='>>>='){index+=4;}else{// 3-character punctuators.
7555str=str.substr(0,3);if(str==='==='||str==='!=='||str==='>>>'||str==='<<='||str==='>>='){index+=3;}else{// 2-character punctuators.
7556str=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.
7557str=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
7558function 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
7559throwUnexpectedToken();}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
7560throwUnexpectedToken();}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.
7561// (Annex B.1.1 on Numeric Literals)
7562for(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'.
7563// Octal number starts with '0'.
7564// Octal number in ES6 starts with '0o'.
7565// Binary number in ES6 starts with '0b'.
7566if(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
7567function 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
7568function 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
7569throwError(Messages.TemplateOctalLiteral);}cooked+='\0';}else if(isOctalDigit(ch)){// Illegal: \1 \2
7570throwError(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
7571function testRegExp(pattern,flags){// The BMP character to use as a replacement for astral symbols when
7572// translating an ES6 "u"-flagged pattern to an ES5-compatible
7573// approximation.
7574// Note: replacing with '\uFFFF' enables false positives in unlikely
7575// scenarios. For example, `[\u{1044f}-\u{10440}]` is an invalid
7576// pattern that would not be detected by this substitution.
7577var astralSubstitute="\uFFFF",tmp=pattern;if(flags.indexOf('u')>=0){tmp=tmp// Replace every Unicode escape sequence with the equivalent
7578// BMP character or a constant ASCII code point in the case of
7579// astral symbols. (See the above note on `astralSubstitute`
7580// for more information.)
7581.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
7582// avoid throwing on regular expressions that are only valid in
7583// combination with the "u" flag.
7584.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,astralSubstitute);}// First, detect invalid regular expressions.
7585try{RegExp(tmp);}catch(e){throwUnexpectedToken(null,Messages.InvalidRegExp);}// Return a regular expression object for this pattern-flag pair, or
7586// `null` in case the current environment doesn't support the flags it
7587// uses.
7588try{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
7589if(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.
7590body=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 '/='
7591if(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:
7592// https://github.com/mozilla/sweet.js/wiki/design
7593function 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,
7594// but we have to check for that.
7595regex=false;if(testKeyword(extra.tokenValues[extra.openCurlyToken-3])){// Anonymous function, e.g. function(){} /42
7596check=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/
7597check=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 ;
7598if(cp===0x28||cp===0x29||cp===0x3B){return scanPunctuator();}// String literal starts with single quote (U+0027) or double quote (U+0022).
7599if(cp===0x27||cp===0x22){return scanStringLiteral();}// Dot (.) U+002E can also start a floating-point number, hence the need
7600// to check the next character.
7601if(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.
7602if(extra.tokenize&&cp===0x2F){return advanceSlash();}// Template literals start with ` (U+0060) for template head
7603// or } (U+007D) for template middle or template tail.
7604if(cp===0x60||cp===0x7D&&state.curlyStack[state.curlyStack.length-1]==='${'){return scanTemplate();}// Possible identifier start in a surrogate pair.
7605if(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;}}/**
7606 * patch innnerComments for properties empty block
7607 * `function a() {/** comments **\/}`
7608 */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);
7609return;}}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.
7610while(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.
7611/* 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
7612function 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.
7613function 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.
7614// If not, an exception will be thrown.
7615function expect(value){var token=lex();if(token.type!==Token.Punctuator||token.value!==value){throwUnexpectedToken(token);}}/**
7616 * @name expectCommaSeparator
7617 * @description Quietly expect a comma when in tolerant mode, otherwise delegates
7618 * to <code>expect(value)</code>
7619 * @since 2.0
7620 */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.
7621// If not, an exception will be thrown.
7622function 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.
7623function match(value){return lookahead.type===Token.Punctuator&&lookahead.value===value;}// Return true if the next token matches the specified keyword
7624function matchKeyword(keyword){return lookahead.type===Token.Keyword&&lookahead.value===keyword;}// Return true if the next token matches the specified contextual keyword
7625// (where an identifier is sometimes a keyword depending on the context)
7626function matchContextualKeyword(keyword){return lookahead.type===Token.Identifier&&lookahead.value===keyword;}// Return true if the next token is an assignment operator
7627function 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).
7628if(source.charCodeAt(startIndex)===0x3B||match(';')){lex();return;}if(hasLineTerminator){return;}// FIXME(ikarienator): this is seemingly an issue in the previous location info convention.
7629lastIndex=startIndex;lastLineNumber=startLineNumber;lastLineStart=startLineStart;if(lookahead.type!==Token.EOF&&!match('}')){throwUnexpectedToken(lookahead);}}// Cover grammar support.
7630//
7631// When an assignment expression position starts with an left parenthesis, the determination of the type
7632// of the syntax is to be deferred arbitrarily long until the end of the parentheses pair (plus a lookahead)
7633// or the first comma. This situation also defers the determination of all the expressions nested in the pair.
7634//
7635// There are three productions that can be parsed in a parentheses pair that needs to be determined
7636// after the outermost pair is closed. They are:
7637//
7638// 1. AssignmentExpression
7639// 2. BindingElements
7640// 3. AssignmentTargets
7641//
7642// In order to avoid exponential backtracking, we use two flags to denote if the production can be
7643// binding element or assignment target.
7644//
7645// The three productions have the relationship:
7646//
7647// BindingElements ⊆ AssignmentTargets ⊆ AssignmentExpression
7648//
7649// with a single exception that CoverInitializedName when used directly in an Expression, generates
7650// an early error. Therefore, we need the third state, firstCoverInitializedNameError, to track the
7651// first usage of CoverInitializedName and report it when we reached the end of the parentheses pair.
7652//
7653// isolateCoverGrammar function runs the given parser function with a new cover grammar context, and it does not
7654// effect the current flags. This means the production the parser parses is only used as an expression. Therefore
7655// the CoverInitializedName check is conducted.
7656//
7657// inheritCoverGrammar function runs the given parse function with a new cover grammar context, and it propagates
7658// the flags outside of the parser. This means the production the parser parses is used as a part of a potential
7659// pattern. The CoverInitializedName check is deferred.
7660function 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
7661function 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
7662function 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
7663function 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
7664// EOF and Punctuator tokens are already filtered out.
7665switch(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,
7666// it might be called at a position where there is in fact a short hand identifier pattern or a data property.
7667// This can only be determined after we consumed up to the left parentheses.
7668//
7669// In order to avoid back tracking, it returns `null` if the position is not a MethodDefinition and the caller
7670// is responsible to visit other options.
7671function tryParseMethodDefinition(token,key,computed,node){var value,options,methodNode,params,previousAllowYield=state.allowYield;if(token.type===Token.Identifier){// check for `get` and `set`;
7672if(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.
7673return 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__
7674if(!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.
7675break;}}// ECMA-262 12.2.9 Template Literals
7676function 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
7677function 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
7678function 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
7679function 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
7680function 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
7681function 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
7682function 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
7683function 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
7684if(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
7685function 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
7686if(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
7687// ECMA-262 12.7 Additive Operators
7688// ECMA-262 12.8 Bitwise Shift Operators
7689// ECMA-262 12.9 Relational Operators
7690// ECMA-262 12.10 Equality Operators
7691// ECMA-262 12.11 Binary Bitwise Operators
7692// ECMA-262 12.12 Binary Logical Operators
7693function 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.
7694while(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.
7695token=lex();token.prec=prec;stack.push(token);markers.push(lookahead);expr=isolateCoverGrammar(parseUnaryExpression);stack.push(expr);}// Final reduce to clean-up the stack.
7696i=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
7697function 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
7698function 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
7699function 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
7700function 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
7701if(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
7702function 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
7703function 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
7704function 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
7705if(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
7706function parseLexicalBinding(kind,options){var init=null,id,node=new Node(),params=[];id=parsePattern(params,kind);// ECMA-262 12.2.1
7707if(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
7708function parseEmptyStatement(node){expect(';');return node.finishEmptyStatement();}// ECMA-262 12.4 Expression Statement
7709function parseExpressionStatement(node){var expr=parseExpression();consumeSemicolon();return node.finishExpressionStatement(expr);}// ECMA-262 13.6 If statement
7710function 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
7711function 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
7712function parseContinueStatement(node){var label=null,key;expectKeyword('continue');// Optimize the most common form: 'continue;'.
7713if(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
7714function parseBreakStatement(node){var label=null,key;expectKeyword('break');// Catch the very common case first: immediately a semicolon (U+003B).
7715if(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
7716function parseReturnStatement(node){var argument=null;expectKeyword('return');if(!state.inFunctionBody){tolerateError(Messages.IllegalReturn);}// 'return' followed by a space and an identifier is very common.
7717if(source.charCodeAt(lastIndex)===0x20){if(isIdentifierStart(source.charCodeAt(lastIndex+1))){argument=parseExpression();consumeSemicolon();return node.finishReturnStatement(argument);}}if(hasLineTerminator){// HACK
7718return 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
7719function 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
7720function 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
7721function 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
7722function 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
7723if(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
7724function parseDebuggerStatement(node){expectKeyword('debugger');consumeSemicolon();return node.finishDebuggerStatement();}// 13 Statements
7725function 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
7726if(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
7727function 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
7728break;}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
7729function 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
7730if(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
7731function parseModuleSpecifier(){var node=new Node();if(lookahead.type!==Token.StringLiteral){throwError(Messages.InvalidModuleSpecifier);}return node.finishLiteral(lex());}// ECMA-262 15.2.3 Exports
7732function parseExportSpecifier(){var exported,local,node=new Node(),def;if(matchKeyword('default')){// export {default} from 'something';
7733def=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
7734if(lookahead.type===Token.Keyword){// covers:
7735// export var f = 1;
7736switch(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:
7737// export {default} from 'foo';
7738// export {foo} from 'foo';
7739lex();src=parseModuleSpecifier();consumeSemicolon();}else if(isExportFromIdentifier){// covering:
7740// export {default}; // missing fromClause
7741throwError(lookahead.value?Messages.UnexpectedToken:Messages.MissingFromClause,lookahead.value);}else{// cover
7742// export {foo};
7743consumeSemicolon();}return node.finishExportNamedDeclaration(declaration,specifiers,src);}function parseExportDefaultDeclaration(node){var declaration=null,expression=null;// covers:
7744// export default ...
7745expectKeyword('default');if(matchKeyword('function')){// covers:
7746// export default function foo () {}
7747// export default function () {}
7748declaration=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:
7749// export default {};
7750// export default [];
7751// export default (1 + 2);
7752if(match('{')){expression=parseObjectInitializer();}else if(match('[')){expression=parseArrayInitializer();}else{expression=parseAssignmentExpression();}consumeSemicolon();return node.finishExportDefaultDeclaration(expression);}function parseExportAllDeclaration(node){var src;// covers:
7753// export * from 'foo';
7754expect('*');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
7755function parseImportSpecifier(){// import {<foo as bar>} ...;
7756var 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}
7757expect('{');while(!match('}')){specifiers.push(parseImportSpecifier());if(!match('}')){expect(',');if(match('}')){break;}}}expect('}');return specifiers;}function parseImportDefaultSpecifier(){// import <foo> ...;
7758var local,node=new Node();local=parseNonComputedProperty();return node.finishImportDefaultSpecifier(local);}function parseImportNamespaceSpecifier(){// import <* as foo> ...;
7759var 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';
7760src=parseModuleSpecifier();}else{if(match('{')){// import {bar}
7761specifiers=specifiers.concat(parseNamedImports());}else if(match('*')){// import * as foo
7762specifiers.push(parseImportNamespaceSpecifier());}else if(isIdentifierName(lookahead)&&!matchKeyword('default')){// import foo
7763specifiers.push(parseImportDefaultSpecifier());if(match(',')){lex();if(match('*')){// import foo, * as foo
7764specifiers.push(parseImportNamespaceSpecifier());}else if(match('{')){// import foo, {bar}
7765specifiers=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
7766function 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
7767break;}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.
7768options=options||{};// Of course we collect tokens here.
7769options.tokens=true;extra.tokens=[];extra.tokenValues=[];extra.tokenize=true;extra.delegate=delegate;// The following two fields are necessary to compute the Regex tokens.
7770extra.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
7771// to avoid infinite loops.
7772break;}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
7773state.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.
7774exports.version='2.7.2';exports.tokenize=tokenize;exports.parse=parse;// Deep copy.
7775/* 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 : */},{}],21:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
7776//
7777// Permission is hereby granted, free of charge, to any person obtaining a
7778// copy of this software and associated documentation files (the
7779// "Software"), to deal in the Software without restriction, including
7780// without limitation the rights to use, copy, modify, merge, publish,
7781// distribute, sublicense, and/or sell copies of the Software, and to permit
7782// persons to whom the Software is furnished to do so, subject to the
7783// following conditions:
7784//
7785// The above copyright notice and this permission notice shall be included
7786// in all copies or substantial portions of the Software.
7787//
7788// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
7789// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
7790// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
7791// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
7792// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
7793// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
7794// USE OR OTHER DEALINGS IN THE SOFTWARE.
7795function EventEmitter(){this._events=this._events||{};this._maxListeners=this._maxListeners||undefined;}module.exports=EventEmitter;// Backwards-compat with node 0.10.x
7796EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=undefined;EventEmitter.prototype._maxListeners=undefined;// By default EventEmitters will print a warning if more than 10 listeners are
7797// added to it. This is a useful default which helps finding memory leaks.
7798EventEmitter.defaultMaxListeners=10;// Obviously not all Emitters should be limited to 10. This function allows
7799// that to be increased. Set to zero for unlimited.
7800EventEmitter.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.
7801if(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
7802}else{// At least give some kind of context to the user
7803var 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
7804case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;// slower
7805default: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
7806// adding it to the listeners, first emit "newListener".
7807if(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.
7808this._events[type]=listener;else if(isObject(this._events[type]))// If we've already got an array, just append.
7809this._events[type].push(listener);else// Adding the second element, need to change to array.
7810this._events[type]=[this._events[type],listener];// Check for listener leak
7811if(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
7812console.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
7813EventEmitter.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
7814if(!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
7815if(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
7816while(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;}},{}],22:[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;};},{}],23:[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;};},{}],24:[function(require,module,exports){if(typeof Object.create==='function'){// implementation from standard node.js 'util' module
7817module.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
7818module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function TempCtor(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor();ctor.prototype.constructor=ctor;};}},{}],25:[function(require,module,exports){/*!
7819 * Determine if an object is a Buffer
7820 *
7821 * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
7822 * @license MIT
7823 */// The _isBuffer check is for Safari 5-7 support, because it's missing
7824// Object.prototype.constructor. Remove this eventually
7825module.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.
7826function isSlowBuffer(obj){return typeof obj.readFloatLE==='function'&&typeof obj.slice==='function'&&isBuffer(obj.slice(0,0));}},{}],26:[function(require,module,exports){var toString={}.toString;module.exports=Array.isArray||function(arr){return toString.call(arr)=='[object Array]';};},{}],27:[function(require,module,exports){module.exports=function(args,opts){if(!opts)opts={};var flags={bools:{},strings:{},unknownFn:null};if(typeof opts['unknown']==='function'){flags.unknownFn=opts['unknown'];}if(typeof opts['boolean']==='boolean'&&opts['boolean']){flags.allBools=true;}else{[].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 argDefined(key,arg){return flags.allBools&&/^--[^=]+$/.test(arg)||flags.strings[key]||flags.bools[key]||aliases[key];}function setArg(key,val,arg){if(arg&&flags.unknownFn&&!argDefined(key,arg)){if(flags.unknownFn(arg)===false)return;}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);});}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||flags.bools[key]||typeof o[key]==='boolean'){o[key]=value;}else if(Array.isArray(o[key])){o[key].push(value);}else{o[key]=[o[key],value];}}function aliasIsBoolean(key){return aliases[key].some(function(x){return flags.bools[x];});}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
7827// 'dotall' regex modifier. See:
7828// http://stackoverflow.com/a/1068308/13216
7829var m=arg.match(/^--([^=]+)=([\s\S]*)$/);var key=m[1];var value=m[2];if(flags.bools[key]){value=value!=='false';}setArg(key,value,arg);}else if(/^--no-.+/.test(arg)){var key=arg.match(/^--no-(.+)/)[1];setArg(key,false,arg);}else if(/^--.+/.test(arg)){var key=arg.match(/^--(.+)/)[1];var next=args[i+1];if(next!==undefined&&!/^-/.test(next)&&!flags.bools[key]&&!flags.allBools&&(aliases[key]?!aliasIsBoolean(key):true)){setArg(key,next,arg);i++;}else if(/^(true|false)$/.test(next)){setArg(key,next==='true',arg);i++;}else{setArg(key,flags.strings[key]?'':true,arg);}}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,arg);continue;}if(/[A-Za-z]/.test(letters[j])&&/=/.test(next)){setArg(letters[j],next.split('=')[1],arg);broken=true;break;}if(/[A-Za-z]/.test(letters[j])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(next)){setArg(letters[j],next,arg);broken=true;break;}if(letters[j+1]&&letters[j+1].match(/\W/)){setArg(letters[j],arg.slice(j+2),arg);broken=true;break;}else{setArg(letters[j],flags.strings[letters[j]]?'':true,arg);}}var key=arg.slice(-1)[0];if(!broken&&key!=='-'){if(args[i+1]&&!/^(-|--)[^-]/.test(args[i+1])&&!flags.bools[key]&&(aliases[key]?!aliasIsBoolean(key):true)){setArg(key,args[i+1],arg);i++;}else if(args[i+1]&&/true|false/.test(args[i+1])){setArg(key,args[i+1]==='true',arg);i++;}else{setArg(key,flags.strings[key]?'':true,arg);}}}else{if(!flags.unknownFn||flags.unknownFn(arg)!==false){argv._.push(flags.strings['_']||!isNumber(arg)?arg:Number(arg));}if(opts.stopEarly){argv._.push.apply(argv._,args.slice(i+1));break;}}}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]);});}});if(opts['--']){argv['--']=new Array();notFlags.forEach(function(key){argv['--'].push(key);});}else{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 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);}},{}],28:[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
7830 so people can do
7831 require('optimist')(['--beeble=1','-z','zizzle']).argv
7832 to parse a list of args and
7833 require('optimist').argv
7834 to get a parsed version of process.argv.
7835*/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
7836// exported for tests
7837exports.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":31,"minimist":27,"path":29,"wordwrap":62}],29:[function(require,module,exports){(function(process){// Copyright Joyent, Inc. and other Node contributors.
7838//
7839// Permission is hereby granted, free of charge, to any person obtaining a
7840// copy of this software and associated documentation files (the
7841// "Software"), to deal in the Software without restriction, including
7842// without limitation the rights to use, copy, modify, merge, publish,
7843// distribute, sublicense, and/or sell copies of the Software, and to permit
7844// persons to whom the Software is furnished to do so, subject to the
7845// following conditions:
7846//
7847// The above copyright notice and this permission notice shall be included
7848// in all copies or substantial portions of the Software.
7849//
7850// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
7851// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
7852// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
7853// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
7854// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
7855// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
7856// USE OR OTHER DEALINGS IN THE SOFTWARE.
7857// resolves . and .. elements in a path array with directory names there
7858// must be no slashes, empty elements, or device names (c:\) in the array
7859// (so also no leading and trailing slashes - it does not distinguish
7860// relative and absolute paths)
7861function normalizeArray(parts,allowAboveRoot){// if the path tries to go above the root, `up` ends up > 0
7862var 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
7863if(allowAboveRoot){for(;up--;up){parts.unshift('..');}}return parts;}// Split a filename into [root, dir, basename, ext], unix version
7864// 'root' is just a slash, or nothing.
7865var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var splitPath=function splitPath(filename){return splitPathRe.exec(filename).slice(1);};// path.resolve([from ...], to)
7866// posix version
7867exports.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
7868if(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
7869// handle relative paths to be safe (might happen when process.cwd() fails)
7870// Normalize the path
7871resolvedPath=normalizeArray(filter(resolvedPath.split('/'),function(p){return!!p;}),!resolvedAbsolute).join('/');return(resolvedAbsolute?'/':'')+resolvedPath||'.';};// path.normalize(path)
7872// posix version
7873exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==='/';// Normalize the path
7874path=normalizeArray(filter(path.split('/'),function(p){return!!p;}),!isAbsolute).join('/');if(!path&&!isAbsolute){path='.';}if(path&&trailingSlash){path+='/';}return(isAbsolute?'/':'')+path;};// posix version
7875exports.isAbsolute=function(path){return path.charAt(0)==='/';};// posix version
7876exports.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)
7877// posix version
7878exports.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
7879return'.';}if(dir){// It has a dirname, strip trailing slash
7880dir=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?
7881if(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
7882var 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":31}],30:[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":31}],31:[function(require,module,exports){// shim for using process in browser
7883var process=module.exports={};// cached from whatever global is present so that test runners that stub it
7884// don't break things. But we need to wrap it in a try catch in case it is
7885// wrapped in strict mode code which doesn't define any globals. It's inside a
7886// function because try/catches deoptimize in certain engines.
7887var cachedSetTimeout;var cachedClearTimeout;function defaultSetTimout(){throw new Error('setTimeout has not been defined');}function defaultClearTimeout(){throw new Error('clearTimeout has not been defined');}(function(){try{if(typeof setTimeout==='function'){cachedSetTimeout=setTimeout;}else{cachedSetTimeout=defaultSetTimout;}}catch(e){cachedSetTimeout=defaultSetTimout;}try{if(typeof clearTimeout==='function'){cachedClearTimeout=clearTimeout;}else{cachedClearTimeout=defaultClearTimeout;}}catch(e){cachedClearTimeout=defaultClearTimeout;}})();function runTimeout(fun){if(cachedSetTimeout===setTimeout){//normal enviroments in sane situations
7888return setTimeout(fun,0);}// if setTimeout wasn't available but was latter defined
7889if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout){cachedSetTimeout=setTimeout;return setTimeout(fun,0);}try{// when when somebody has screwed with setTimeout but no I.E. maddness
7890return 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
7891return 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
7892return cachedSetTimeout.call(this,fun,0);}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout){//normal enviroments in sane situations
7893return clearTimeout(marker);}// if clearTimeout wasn't available but was latter defined
7894if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout){cachedClearTimeout=clearTimeout;return clearTimeout(marker);}try{// when when somebody has screwed with setTimeout but no I.E. maddness
7895return 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
7896return 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.
7897// Some versions of I.E. have different rules for clearTimeout vs setTimeout
7898return 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
7899function 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
7900process.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;};},{}],32:[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;}/**
7901 * The `punycode` object.
7902 * @name punycode
7903 * @type Object
7904 */var punycode,/** Highest positive signed 32-bit float value */maxInt=2147483647,// aka. 0x7FFFFFFF or 2^31-1
7905/** Bootstring parameters */base=36,tMin=1,tMax=26,skew=38,damp=700,initialBias=72,initialN=128,// 0x80
7906delimiter='-',// '\x2D'
7907/** Regular expressions */regexPunycode=/^xn--/,regexNonASCII=/[^\x20-\x7E]/,// unprintable ASCII chars + non-ASCII chars
7908regexSeparators=/[\x2E\u3002\uFF0E\uFF61]/g,// RFC 3490 separators
7909/** 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;/*--------------------------------------------------------------------------*//**
7910 * A generic error utility function.
7911 * @private
7912 * @param {String} type The error type.
7913 * @returns {Error} Throws a `RangeError` with the applicable error message.
7914 */function error(type){throw new RangeError(errors[type]);}/**
7915 * A generic `Array#map` utility function.
7916 * @private
7917 * @param {Array} array The array to iterate over.
7918 * @param {Function} callback The function that gets called for every array
7919 * item.
7920 * @returns {Array} A new array of values returned by the callback function.
7921 */function map(array,fn){var length=array.length;var result=[];while(length--){result[length]=fn(array[length]);}return result;}/**
7922 * A simple `Array#map`-like wrapper to work with domain name strings or email
7923 * addresses.
7924 * @private
7925 * @param {String} domain The domain name or email address.
7926 * @param {Function} callback The function that gets called for every
7927 * character.
7928 * @returns {Array} A new string of characters returned by the callback
7929 * function.
7930 */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
7931// the local part (i.e. everything up to `@`) intact.
7932result=parts[0]+'@';string=parts[1];}// Avoid `split(regex)` for IE8 compatibility. See #17.
7933string=string.replace(regexSeparators,'\x2E');var labels=string.split('.');var encoded=map(labels,fn).join('.');return result+encoded;}/**
7934 * Creates an array containing the numeric code points of each Unicode
7935 * character in the string. While JavaScript uses UCS-2 internally,
7936 * this function will convert a pair of surrogate halves (each of which
7937 * UCS-2 exposes as separate characters) into a single code point,
7938 * matching UTF-16.
7939 * @see `punycode.ucs2.encode`
7940 * @see <https://mathiasbynens.be/notes/javascript-encoding>
7941 * @memberOf punycode.ucs2
7942 * @name decode
7943 * @param {String} string The Unicode input string (UCS-2).
7944 * @returns {Array} The new array of code points.
7945 */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
7946extra=string.charCodeAt(counter++);if((extra&0xFC00)==0xDC00){// low surrogate
7947output.push(((value&0x3FF)<<10)+(extra&0x3FF)+0x10000);}else{// unmatched surrogate; only append this code unit, in case the next
7948// code unit is the high surrogate of a surrogate pair
7949output.push(value);counter--;}}else{output.push(value);}}return output;}/**
7950 * Creates a string based on an array of numeric code points.
7951 * @see `punycode.ucs2.decode`
7952 * @memberOf punycode.ucs2
7953 * @name encode
7954 * @param {Array} codePoints The array of numeric code points.
7955 * @returns {String} The new Unicode string (UCS-2).
7956 */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('');}/**
7957 * Converts a basic code point into a digit/integer.
7958 * @see `digitToBasic()`
7959 * @private
7960 * @param {Number} codePoint The basic numeric code point value.
7961 * @returns {Number} The numeric value of a basic code point (for use in
7962 * representing integers) in the range `0` to `base - 1`, or `base` if
7963 * the code point does not represent a value.
7964 */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;}/**
7965 * Converts a digit/integer into a basic code point.
7966 * @see `basicToDigit()`
7967 * @private
7968 * @param {Number} digit The numeric value of a basic code point.
7969 * @returns {Number} The basic code point whose value (when used for
7970 * representing integers) is `digit`, which needs to be in the range
7971 * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
7972 * used; else, the lowercase form is used. The behavior is undefined
7973 * if `flag` is non-zero and `digit` has no uppercase form.
7974 */function digitToBasic(digit,flag){// 0..25 map to ASCII a..z or A..Z
7975// 26..35 map to ASCII 0..9
7976return digit+22+75*(digit<26)-((flag!=0)<<5);}/**
7977 * Bias adaptation function as per section 3.4 of RFC 3492.
7978 * https://tools.ietf.org/html/rfc3492#section-3.4
7979 * @private
7980 */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));}/**
7981 * Converts a Punycode string of ASCII-only symbols to a string of Unicode
7982 * symbols.
7983 * @memberOf punycode
7984 * @param {String} input The Punycode string of ASCII-only symbols.
7985 * @returns {String} The resulting string of Unicode symbols.
7986 */function decode(input){// Don't use UCS-2
7987var 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
7988// points before the last delimiter, or `0` if there is none, then copy
7989// the first basic code points to the output.
7990basic=input.lastIndexOf(delimiter);if(basic<0){basic=0;}for(j=0;j<basic;++j){// if it's not a basic code point
7991if(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
7992// points were copied; start at the beginning otherwise.
7993for(index=basic>0?basic+1:0;index<inputLength;)/* no final expression */{// `index` is the index of the next character to be consumed.
7994// Decode a generalized variable-length integer into `delta`,
7995// which gets added to `i`. The overflow checking is easier
7996// if we increase `i` as we go, then subtract off its starting
7997// value at the end to obtain `delta`.
7998for(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`,
7999// incrementing `n` each time, so we'll fix that now:
8000if(floor(i/out)>maxInt-n){error('overflow');}n+=floor(i/out);i%=out;// Insert `n` at position `i` of the output
8001output.splice(i++,0,n);}return ucs2encode(output);}/**
8002 * Converts a string of Unicode symbols (e.g. a domain name label) to a
8003 * Punycode string of ASCII-only symbols.
8004 * @memberOf punycode
8005 * @param {String} input The string of Unicode symbols.
8006 * @returns {String} The resulting Punycode string of ASCII-only symbols.
8007 */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
8008input=ucs2decode(input);// Cache the length
8009inputLength=input.length;// Initialize the state
8010n=initialN;delta=0;bias=initialBias;// Handle the basic code points
8011for(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;
8012// `basicLength` is the number of basic code points.
8013// Finish the basic string - if it is not empty - with a delimiter
8014if(basicLength){output.push(delimiter);}// Main encoding loop:
8015while(handledCPCount<inputLength){// All non-basic code points < n have been handled already. Find the next
8016// larger one:
8017for(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>,
8018// but guard against overflow
8019handledCPCountPlusOne=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
8020for(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('');}/**
8021 * Converts a Punycode string representing a domain name or an email address
8022 * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
8023 * it doesn't matter if you call it on a string that has already been
8024 * converted to Unicode.
8025 * @memberOf punycode
8026 * @param {String} input The Punycoded domain name or email address to
8027 * convert to Unicode.
8028 * @returns {String} The Unicode representation of the given Punycode
8029 * string.
8030 */function toUnicode(input){return mapDomain(input,function(string){return regexPunycode.test(string)?decode(string.slice(4).toLowerCase()):string;});}/**
8031 * Converts a Unicode string representing a domain name or an email address to
8032 * Punycode. Only the non-ASCII parts of the domain name will be converted,
8033 * i.e. it doesn't matter if you call it with a domain that's already in
8034 * ASCII.
8035 * @memberOf punycode
8036 * @param {String} input The domain name or email address to convert, as a
8037 * Unicode string.
8038 * @returns {String} The Punycode representation of the given domain name or
8039 * email address.
8040 */function toASCII(input){return mapDomain(input,function(string){return regexNonASCII.test(string)?'xn--'+encode(string):string;});}/*--------------------------------------------------------------------------*//** Define the public API */punycode={/**
8041 * A string representing the current Punycode.js version number.
8042 * @memberOf punycode
8043 * @type String
8044 */'version':'1.4.1',/**
8045 * An object of methods to convert from JavaScript's internal character
8046 * representation (UCS-2) to Unicode code points, and back.
8047 * @see <https://mathiasbynens.be/notes/javascript-encoding>
8048 * @memberOf punycode
8049 * @type Object
8050 */'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
8051// like the following:
8052if(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+
8053freeModule.exports=punycode;}else{// in Narwhal or RingoJS v0.7.0-
8054for(key in punycode){punycode.hasOwnProperty(key)&&(freeExports[key]=punycode[key]);}}}else{// in Rhino or a web browser
8055root.punycode=punycode;}})(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],33:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
8056//
8057// Permission is hereby granted, free of charge, to any person obtaining a
8058// copy of this software and associated documentation files (the
8059// "Software"), to deal in the Software without restriction, including
8060// without limitation the rights to use, copy, modify, merge, publish,
8061// distribute, sublicense, and/or sell copies of the Software, and to permit
8062// persons to whom the Software is furnished to do so, subject to the
8063// following conditions:
8064//
8065// The above copyright notice and this permission notice shall be included
8066// in all copies or substantial portions of the Software.
8067//
8068// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8069// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
8070// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
8071// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
8072// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
8073// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
8074// USE OR OTHER DEALINGS IN THE SOFTWARE.
8075'use strict';// If obj.hasOwnProperty has been overridden, then calling
8076// obj.hasOwnProperty(prop) will break.
8077// See: https://github.com/joyent/node/issues/1707
8078function 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
8079if(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]';};},{}],34:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
8080//
8081// Permission is hereby granted, free of charge, to any person obtaining a
8082// copy of this software and associated documentation files (the
8083// "Software"), to deal in the Software without restriction, including
8084// without limitation the rights to use, copy, modify, merge, publish,
8085// distribute, sublicense, and/or sell copies of the Software, and to permit
8086// persons to whom the Software is furnished to do so, subject to the
8087// following conditions:
8088//
8089// The above copyright notice and this permission notice shall be included
8090// in all copies or substantial portions of the Software.
8091//
8092// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8093// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
8094// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
8095// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
8096// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
8097// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
8098// USE OR OTHER DEALINGS IN THE SOFTWARE.
8099'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;};},{}],35:[function(require,module,exports){'use strict';exports.decode=exports.parse=require('./decode');exports.encode=exports.stringify=require('./encode');},{"./decode":33,"./encode":34}],36:[function(require,module,exports){module.exports=require("./lib/_stream_duplex.js");},{"./lib/_stream_duplex.js":37}],37:[function(require,module,exports){// a duplex stream is just a stream that is both readable and writable.
8100// Since JS doesn't have multiple prototypal inheritance, this class
8101// prototypally inherits from Readable, and then parasitically from
8102// Writable.
8103'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
8104function onend(){// if we allow half-open state, or if the writable side ended,
8105// then we're ok.
8106if(this.allowHalfOpen||this._writableState.ended)return;// no more data can be written.
8107// But allow more writes to happen in this tick.
8108processNextTick(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":39,"./_stream_writable":41,"core-util-is":19,"inherits":24,"process-nextick-args":30}],38:[function(require,module,exports){// a passthrough stream.
8109// basically just the most minimal sort of Transform stream.
8110// Every written chunk gets output as-is.
8111'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":40,"core-util-is":19,"inherits":24}],39:[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 BufferList=require('./internal/streams/BufferList');var StringDecoder;util.inherits(Readable,Stream);function prependListener(emitter,event,fn){if(typeof emitter.prependListener==='function'){return emitter.prependListener(event,fn);}else{// This is a hack to make sure that our error handler is attached before any
8112// userland ones. NEVER DO THIS. This is here only because this code needs
8113// to continue to work with older versions of Node.js that do not include
8114// the prependListener() method. The goal is to eventually remove this hack.
8115if(!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
8116// make all the buffer merging and length checks go away
8117this.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
8118// Note: 0 is a valid value, means "don't call _read preemptively ever"
8119var hwm=options.highWaterMark;var defaultHwm=this.objectMode?16:16*1024;this.highWaterMark=hwm||hwm===0?hwm:defaultHwm;// cast to ints.
8120this.highWaterMark=~~this.highWaterMark;// A linked list is used to store data chunks instead of an array because the
8121// linked list can remove elements from the beginning faster than
8122// array.shift()
8123this.buffer=new BufferList();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,
8124// or on a later tick. We set this to true at first, because any
8125// actions that shouldn't happen until "later" should generally also
8126// not happen before the first write call.
8127this.sync=true;// whenever we return null, then we set a flag to say
8128// that we're awaiting a 'readable' event emission.
8129this.needReadable=false;this.emittedReadable=false;this.readableListening=false;this.resumeScheduled=false;// Crypto is kind of old and crusty. Historically, its default string
8130// encoding is 'binary' so we have to make this configurable.
8131// Everything else in the universe uses 'utf8', though.
8132this.defaultEncoding=options.defaultEncoding||'utf8';// when piping, we only care about 'readable' events that happen
8133// after read()ing all the bytes and not getting any pushback.
8134this.ranOut=false;// the number of writers that are awaiting a drain event in .pipe()s
8135this.awaitDrain=0;// if true, a maybeReadMore has been scheduled
8136this.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
8137this.readable=true;if(options&&typeof options.read==='function')this._read=options.read;Stream.call(this);}// Manually shove something into the read() buffer.
8138// This returns true if the highWaterMark has not been hit yet,
8139// similar to how Writable.write() returns true if you should
8140// write() some more.
8141Readable.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()
8142Readable.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
8143// we're not in object mode
8144if(!skipAdd){// if we want the data now, just emit it.
8145if(state.flowing&&state.length===0&&!state.sync){stream.emit('data',chunk);stream.read(0);}else{// update the buffer info.
8146state.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.
8147// Also, if we have no data yet, we can stand some
8148// more bytes. This is to work around cases where hwm=0,
8149// such as the repl. Also, if the push() triggered a
8150// readable event, and the user called read(largeNumber) such that
8151// needReadable was set, then we ought to push more, so that another
8152// 'readable' event will be triggered.
8153function needMoreData(state){return!state.ended&&(state.needReadable||state.length<state.highWaterMark||state.length===0);}// backwards compatibility.
8154Readable.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
8155var MAX_HWM=0x800000;function computeNewHighWaterMark(n){if(n>=MAX_HWM){n=MAX_HWM;}else{// Get the next highest power of 2 to prevent increasing hwm excessively in
8156// tiny amounts
8157n--;n|=n>>>1;n|=n>>>2;n|=n>>>4;n|=n>>>8;n|=n>>>16;n++;}return n;}// This function is designed to be inlinable, so please take care when making
8158// changes to the function body.
8159function howMuchToRead(n,state){if(n<=0||state.length===0&&state.ended)return 0;if(state.objectMode)return 1;if(n!==n){// Only flow one buffer at a time
8160if(state.flowing&&state.length)return state.buffer.head.data.length;else return state.length;}// If we're asking for more than the current hwm, then raise the hwm.
8161if(n>state.highWaterMark)state.highWaterMark=computeNewHighWaterMark(n);if(n<=state.length)return n;// Don't have enough
8162if(!state.ended){state.needReadable=true;return 0;}return state.length;}// you can override either this method, or the async _read(n) below.
8163Readable.prototype.read=function(n){debug('read',n);n=parseInt(n,10);var state=this._readableState;var nOrig=n;if(n!==0)state.emittedReadable=false;// if we're doing read(0) to trigger a readable event, but we
8164// already have a bunch of data in the buffer, then just trigger
8165// the 'readable' event and move on.
8166if(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.
8167if(n===0&&state.ended){if(state.length===0)endReadable(this);return null;}// All the actual chunk generation logic needs to be
8168// *below* the call to _read. The reason is that in certain
8169// synthetic stream cases, such as passthrough streams, _read
8170// may be a completely synchronous operation which may change
8171// the state of the read buffer, providing enough data when
8172// before there was *not* enough.
8173//
8174// So, the steps are:
8175// 1. Figure out what the state of things will be after we do
8176// a read from the buffer.
8177//
8178// 2. If that resulting state will trigger a _read, then call _read.
8179// Note that this may be asynchronous, or synchronous. Yes, it is
8180// deeply ugly to write APIs this way, but that still doesn't mean
8181// that the Readable class should behave improperly, as streams are
8182// designed to be sync/async agnostic.
8183// Take note if the _read call is sync or async (ie, if the read call
8184// has returned yet), so that we know whether or not it's safe to emit
8185// 'readable' etc.
8186//
8187// 3. Actually pull the requested chunks out of the buffer and return.
8188// if we need a readable event, then we need to do some reading.
8189var doRead=state.needReadable;debug('need readable',doRead);// if we currently have less than the highWaterMark, then also read some
8190if(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
8191// reading, then it's unnecessary.
8192if(state.ended||state.reading){doRead=false;debug('reading or ended',doRead);}else if(doRead){debug('do read');state.reading=true;state.sync=true;// if the length is currently zero, then we *need* a readable event.
8193if(state.length===0)state.needReadable=true;// call internal read method
8194this._read(state.highWaterMark);state.sync=false;// If _read pushed data synchronously, then `reading` will be false,
8195// and we need to re-evaluate how much data we can return to the user.
8196if(!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;}else{state.length-=n;}if(state.length===0){// If we have nothing in the buffer, then we want to know
8197// as soon as we *do* get something into the buffer.
8198if(!state.ended)state.needReadable=true;// If we tried to read() past the EOF, then emit end on the next tick.
8199if(nOrig!==n&&state.ended)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.
8200emitReadable(stream);}// Don't emit readable right away in sync mode, because this can trigger
8201// another read() call => stack overflow. This way, it might trigger
8202// a nextTick recursion warning, but that's not so bad.
8203function 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,
8204// and called read() to consume some data. that may have triggered
8205// in turn another _read(n) call, in which case reading = true if
8206// it's in progress.
8207// However, if we're not ended, or reading, and the length < hwm,
8208// then go ahead and try to read some more preemptively.
8209function 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.
8210break;else len=state.length;}state.readingMore=false;}// abstract method. to be overridden in specific implementation classes.
8211// call cb(er, data) where data is <= n in length.
8212// for virtual (non-string, non-buffer) streams, "length" is somewhat
8213// arbitrary, and perhaps not very meaningful.
8214Readable.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
8215// on the source. This would be more elegant with a .once()
8216// handler in flow(), but adding and removing repeatedly is
8217// too slow.
8218var ondrain=pipeOnDrain(src);dest.on('drain',ondrain);var cleanedUp=false;function cleanup(){debug('cleanup');// cleanup event handlers once the pipe is broken
8219dest.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
8220// specific writer, then it would cause it to never start
8221// flowing again.
8222// So, if this is awaiting a drain, then we just call it now.
8223// If we don't know, then assume that we are waiting for one.
8224if(state.awaitDrain&&(!dest._writableState||dest._writableState.needDrain))ondrain();}// If the user pushes more data while we're writing to dest then we'll end up
8225// in ondata again. However, we only want to increase awaitDrain once because
8226// dest will only emit one 'drain' event for the multiple writes.
8227// => Introduce a guard on increasing awaitDrain.
8228var increasedAwaitDrain=false;src.on('data',ondata);function ondata(chunk){debug('ondata');increasedAwaitDrain=false;var ret=dest.write(chunk);if(false===ret&&!increasedAwaitDrain){// If the user unpiped during `dest.write()`, it is possible
8229// to get stuck in a permanently paused state if that write
8230// also returned false.
8231// => Check whether `dest` is still a piping destination.
8232if((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++;increasedAwaitDrain=true;}src.pause();}}// if the dest has an error, then stop piping into it.
8233// however, don't suppress the throwing behavior for this.
8234function 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.
8235prependListener(dest,'error',onerror);// Both close and finish should trigger unpipe, but only once.
8236function 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
8237dest.emit('pipe',src);// start the flow if it hasn't been started already.
8238if(!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.
8239if(state.pipesCount===0)return this;// just one destination. most common case.
8240if(state.pipesCount===1){// passed in one, but it's not the right one.
8241if(dest&&dest!==state.pipes)return this;if(!dest)dest=state.pipes;// got a match.
8242state.pipes=null;state.pipesCount=0;state.flowing=false;if(dest)dest.emit('unpipe',this);return this;}// slow case. multiple pipe destinations.
8243if(!dest){// remove all.
8244var 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.
8245var 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
8246// Ensure readable listeners eventually get something
8247Readable.prototype.on=function(ev,fn){var res=Stream.prototype.on.call(this,ev,fn);if(ev==='data'){// Start flowing on next tick if stream isn't explicitly paused
8248if(this._readableState.flowing!==false)this.resume();}else if(ev==='readable'){var state=this._readableState;if(!state.endEmitted&&!state.readableListening){state.readableListening=state.needReadable=true;state.emittedReadable=false;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
8249// If the user uses them, then switch into old mode.
8250Readable.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;state.awaitDrain=0;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);while(state.flowing&&stream.read()!==null){}}// wrap an old-style stream as the async data source.
8251// This is *not* part of the readable stream interface.
8252// It is an ugly unfortunate mess of history.
8253Readable.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
8254if(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.
8255// important when wrapping filters and duplexes.
8256for(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.
8257var 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
8258// underlying stream.
8259self._read=function(n){debug('wrapped _read',n);if(paused){paused=false;stream.resume();}};return self;};// exposed for testing purposes only.
8260Readable._fromList=fromList;// Pluck off n bytes from an array of buffers.
8261// Length is the combined lengths of all the buffers in the list.
8262// This function is designed to be inlinable, so please take care when making
8263// changes to the function body.
8264function fromList(n,state){// nothing buffered
8265if(state.length===0)return null;var ret;if(state.objectMode)ret=state.buffer.shift();else if(!n||n>=state.length){// read it all, truncate the list
8266if(state.decoder)ret=state.buffer.join('');else if(state.buffer.length===1)ret=state.buffer.head.data;else ret=state.buffer.concat(state.length);state.buffer.clear();}else{// read part of list
8267ret=fromListPartial(n,state.buffer,state.decoder);}return ret;}// Extracts only enough buffered data to satisfy the amount requested.
8268// This function is designed to be inlinable, so please take care when making
8269// changes to the function body.
8270function fromListPartial(n,list,hasStrings){var ret;if(n<list.head.data.length){// slice is the same for buffers and strings
8271ret=list.head.data.slice(0,n);list.head.data=list.head.data.slice(n);}else if(n===list.head.data.length){// first chunk is a perfect match
8272ret=list.shift();}else{// result spans more than one buffer
8273ret=hasStrings?copyFromBufferString(n,list):copyFromBuffer(n,list);}return ret;}// Copies a specified amount of characters from the list of buffered data
8274// chunks.
8275// This function is designed to be inlinable, so please take care when making
8276// changes to the function body.
8277function copyFromBufferString(n,list){var p=list.head;var c=1;var ret=p.data;n-=ret.length;while(p=p.next){var str=p.data;var nb=n>str.length?str.length:n;if(nb===str.length)ret+=str;else ret+=str.slice(0,n);n-=nb;if(n===0){if(nb===str.length){++c;if(p.next)list.head=p.next;else list.head=list.tail=null;}else{list.head=p;p.data=str.slice(nb);}break;}++c;}list.length-=c;return ret;}// Copies a specified amount of bytes from the list of buffered data chunks.
8278// This function is designed to be inlinable, so please take care when making
8279// changes to the function body.
8280function copyFromBuffer(n,list){var ret=bufferShim.allocUnsafe(n);var p=list.head;var c=1;p.data.copy(ret);n-=p.data.length;while(p=p.next){var buf=p.data;var nb=n>buf.length?buf.length:n;buf.copy(ret,ret.length-n,0,nb);n-=nb;if(n===0){if(nb===buf.length){++c;if(p.next)list.head=p.next;else list.head=list.tail=null;}else{list.head=p;p.data=buf.slice(nb);}break;}++c;}list.length-=c;return ret;}function endReadable(stream){var state=stream._readableState;// If we get here before consuming all the bytes, then that is a
8281// bug in node. Should never happen.
8282if(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.
8283if(!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":37,"./internal/streams/BufferList":42,"_process":31,"buffer":17,"buffer-shims":16,"core-util-is":19,"events":21,"inherits":24,"isarray":26,"process-nextick-args":30,"string_decoder/":53,"util":14}],40:[function(require,module,exports){// a transform stream is a readable/writable stream where you do
8284// something with the data. Sometimes it's called a "filter",
8285// but that's not a great name for it, since that implies a thing where
8286// some bits pass through, and others are simply ignored. (That would
8287// be a valid example of a transform, of course.)
8288//
8289// While the output is causally related to the input, it's not a
8290// necessarily symmetric or synchronous transformation. For example,
8291// a zlib stream might take multiple plain-text writes(), and then
8292// emit a single compressed chunk some time in the future.
8293//
8294// Here's how this works:
8295//
8296// The Transform stream has all the aspects of the readable and writable
8297// stream classes. When you write(chunk), that calls _write(chunk,cb)
8298// internally, and returns false if there's a lot of pending writes
8299// buffered up. When you call read(), that calls _read(n) until
8300// there's enough pending readable data buffered up.
8301//
8302// In a transform stream, the written data is placed in a buffer. When
8303// _read(n) is called, it transforms the queued up data, calling the
8304// buffered _write cb's as it consumes chunks. If consuming a single
8305// written chunk would result in multiple output chunks, then the first
8306// outputted bit calls the readcb, and subsequent chunks just go into
8307// the read buffer, and will cause it to emit 'readable' if necessary.
8308//
8309// This way, back-pressure is actually determined by the reading side,
8310// since _read has to be called to start processing a new chunk. However,
8311// a pathological inflate type of transform can cause excessive buffering
8312// here. For example, imagine a stream where every byte of input is
8313// interpreted as an integer from 0-255, and then results in that many
8314// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
8315// 1kb of data being output. In this case, you could write a very small
8316// amount of input, and end up with a very large amount of output. In
8317// such a pathological inflating mechanism, there'd be no way to tell
8318// the system to stop doing the transform. A single 4MB write could
8319// cause the system to run out of memory.
8320//
8321// However, even in such a pathological case, only a single written chunk
8322// would be consumed, and then the rest would wait (un-transformed) until
8323// the results of the previous transformed chunk were consumed.
8324'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.
8325var stream=this;// start out asking for a readable event once data is transformed.
8326this._readableState.needReadable=true;// we have implemented the _read method, and done the other things
8327// that Readable wants before the first _read call, so unset the
8328// sync guard flag.
8329this._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!
8330// override this function in implementation classes.
8331// 'chunk' is an input chunk.
8332//
8333// Call `push(newChunk)` to pass along transformed output
8334// to the readable side. You may call 'push' zero or more times.
8335//
8336// Call `cb(err)` when you are done with this chunk. If you pass
8337// an error, then that'll put the hurt on the whole operation. If you
8338// never call cb(), then you'll never get another chunk.
8339Transform.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.
8340// _transform does all the work.
8341// That we got here means that the readable side wants more data.
8342Transform.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
8343// will get processed, now that we've asked for it.
8344ts.needTransform=true;}};function done(stream,er){if(er)return stream.emit('error',er);// if there's nothing in the write buffer, then that means
8345// that nothing more will ever be provided
8346var 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":37,"core-util-is":19,"inherits":24}],41:[function(require,module,exports){(function(process){// A bit simpler than readable streams.
8347// Implement an async ._write(chunk, encoding, cb), and it'll handle all
8348// the drain event emission and buffering.
8349'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
8350// contains buffers or objects.
8351this.objectMode=!!options.objectMode;if(stream instanceof Duplex)this.objectMode=this.objectMode||!!options.writableObjectMode;// the point at which write() starts returning false
8352// Note: 0 is a valid value, means that we always return false if
8353// the entire buffer is not flushed immediately on write()
8354var hwm=options.highWaterMark;var defaultHwm=this.objectMode?16:16*1024;this.highWaterMark=hwm||hwm===0?hwm:defaultHwm;// cast to ints.
8355this.highWaterMark=~~this.highWaterMark;this.needDrain=false;// at the start of calling end()
8356this.ending=false;// when end() has been called, and returned
8357this.ended=false;// when 'finish' is emitted
8358this.finished=false;// should we decode strings into buffers before passing to _write?
8359// this is here so that some node-core streams can optimize string
8360// handling at a lower level.
8361var noDecode=options.decodeStrings===false;this.decodeStrings=!noDecode;// Crypto is kind of old and crusty. Historically, its default string
8362// encoding is 'binary' so we have to make this configurable.
8363// Everything else in the universe uses 'utf8', though.
8364this.defaultEncoding=options.defaultEncoding||'utf8';// not an actual buffer we keep track of, but a measurement
8365// of how much we're waiting to get pushed to some underlying
8366// socket or file.
8367this.length=0;// a flag to see when we're in the middle of a write.
8368this.writing=false;// when true all writes will be buffered until .uncork() call
8369this.corked=0;// a flag to be able to tell if the onwrite cb is called immediately,
8370// or on a later tick. We set this to true at first, because any
8371// actions that shouldn't happen until "later" should generally also
8372// not happen before the first write call.
8373this.sync=true;// a flag to know if we're processing previously buffered items, which
8374// may call the _write() callback in the same tick, so that we don't
8375// end up in an overlapped onwrite situation.
8376this.bufferProcessing=false;// the callback that's passed to _write(chunk,cb)
8377this.onwrite=function(er){onwrite(stream,er);};// the callback that the user supplies to write(chunk,encoding,cb)
8378this.writecb=null;// the amount that is being written when _write is called.
8379this.writelen=0;this.bufferedRequest=null;this.lastBufferedRequest=null;// number of pending user-supplied write callbacks
8380// this must be 0 before 'finish' can be emitted
8381this.pendingcb=0;// emit prefinish if the only thing we're waiting for is _write cbs
8382// This is relevant for synchronous Transform streams
8383this.prefinished=false;// True if the error was already emitted and should not be thrown again
8384this.errorEmitted=false;// count buffered requests
8385this.bufferedRequestCount=0;// allocate the first CorkedRequest, there is always
8386// one allocated and free to use, and we maintain at most two
8387this.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
8388// instanceof Writable, they're instanceof Readable.
8389if(!(this instanceof Writable)&&!(this instanceof Duplex))return new Writable(options);this._writableState=new WritableState(options,this);// legacy.
8390this.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.
8391Writable.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
8392stream.emit('error',er);processNextTick(cb,er);}// If we get something that is not a buffer, string, null, or undefined,
8393// and we're not in objectMode, then that's an error.
8394// Otherwise stream chunks are all considered to be of length=1, and the
8395// watermarks determine how many objects to keep in the buffer, rather than
8396// how many bytes or characters.
8397function validChunk(stream,state,chunk,cb){var valid=true;var er=false;// Always throw error if a null is written
8398// if we are not in object mode then throw
8399// if it is not a buffer, string, or undefined.
8400if(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.
8401if(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
8402// in the queue, and wait our turn. Otherwise, call _write
8403// If we return false, then we need a drain event, so set that flag.
8404function 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.
8405if(!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
8406var 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
8407// emit 'drain' before the write() consumer gets the 'false' return
8408// value, and has a chance to attach a 'drain' listener.
8409function 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
8410function clearBuffer(stream,state){state.bufferProcessing=true;var entry=state.bufferedRequest;if(stream._writev&&entry&&entry.next){// Fast case, write everything using _writev()
8411var 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
8412// as the hot path ends with doWrite
8413state.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
8414while(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
8415// it means that we need to wait until it does.
8416// also, that means that the chunk and cb are currently
8417// being processed, so move the buffer counter past them.
8418if(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
8419if(state.corked){state.corked=1;this.uncork();}// ignore unnecessary end() calls.
8420if(!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
8421// there will be only 2 of these for each stream
8422function 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":37,"_process":31,"buffer":17,"buffer-shims":16,"core-util-is":19,"events":21,"inherits":24,"process-nextick-args":30,"util-deprecate":58}],42:[function(require,module,exports){'use strict';var Buffer=require('buffer').Buffer;/*<replacement>*/var bufferShim=require('buffer-shims');/*</replacement>*/module.exports=BufferList;function BufferList(){this.head=null;this.tail=null;this.length=0;}BufferList.prototype.push=function(v){var entry={data:v,next:null};if(this.length>0)this.tail.next=entry;else this.head=entry;this.tail=entry;++this.length;};BufferList.prototype.unshift=function(v){var entry={data:v,next:this.head};if(this.length===0)this.tail=entry;this.head=entry;++this.length;};BufferList.prototype.shift=function(){if(this.length===0)return;var ret=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;--this.length;return ret;};BufferList.prototype.clear=function(){this.head=this.tail=null;this.length=0;};BufferList.prototype.join=function(s){if(this.length===0)return'';var p=this.head;var ret=''+p.data;while(p=p.next){ret+=s+p.data;}return ret;};BufferList.prototype.concat=function(n){if(this.length===0)return bufferShim.alloc(0);if(this.length===1)return this.head.data;var ret=bufferShim.allocUnsafe(n>>>0);var p=this.head;var i=0;while(p){p.data.copy(ret,i);i+=p.data.length;p=p.next;}return ret;};},{"buffer":17,"buffer-shims":16}],43:[function(require,module,exports){module.exports=require("./lib/_stream_passthrough.js");},{"./lib/_stream_passthrough.js":38}],44:[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
8423}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":37,"./lib/_stream_passthrough.js":38,"./lib/_stream_readable.js":39,"./lib/_stream_transform.js":40,"./lib/_stream_writable.js":41,"_process":31}],45:[function(require,module,exports){module.exports=require("./lib/_stream_transform.js");},{"./lib/_stream_transform.js":40}],46:[function(require,module,exports){module.exports=require("./lib/_stream_writable.js");},{"./lib/_stream_writable.js":41}],47:[function(require,module,exports){(function(Buffer){;(function(sax){// wrapper for non-node envs
8424sax.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.
8425// When we check, schedule the next check for MAX_BUFFER_LENGTH - (max(buffer lengths)),
8426// since that's the earliest that a buffer overrun could occur. This way, checks are
8427// as rare as required, but as often as necessary to ensure never crossing this bound.
8428// Furthermore, buffers are only tested at most once per write(), so passing a very
8429// large string into write() might have undesirable effects, but this is manageable by
8430// the caller, so it is assumed to be safe. Thus, a call to write() may, in the extreme
8431// edge case, result in creating at most one complete copy of the string passed in.
8432// Set to Infinity to have unlimited buffers.
8433sax.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.
8434// it always points at the current tag,
8435// which protos to its parent tag.
8436if(parser.opt.xmlns){parser.ns=Object.create(rootNS);}// mostly just for error reporting
8437parser.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,
8438// we can get here under normal conditions.
8439// Avoid issues by emitting the text node now,
8440// so at least it won't get any bigger.
8441switch(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.
8442var 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.
8443// go ahead and clear error, so we can write again.
8444me._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
8445var whitespace='\r\n\t ';// this really needs to be replaced with character classes.
8446// XML allows all manner of ridiculous numbers and digits.
8447var number='0124356789';var letter='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';// (Letter | "_" | ":")
8448var 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.
8449whitespace=charClass(whitespace);number=charClass(number);letter=charClass(letter);// http://www.w3.org/TR/REC-xml/#NT-NameStartChar
8450// This implementation works on strings, a single character at a time
8451// as such, it cannot ever support astral-plane characters (10000-EFFFF)
8452// without a significant breaking change to either this parser, or the
8453// JavaScript language. Implementation of an emoji-capable xml parser
8454// is left as an exercise for the reader.
8455var 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
8456BEGIN_WHITESPACE:S++,// leading whitespace
8457TEXT:S++,// general stuff
8458TEXT_ENTITY:S++,// &amp and such.
8459OPEN_WAKA:S++,// <
8460SGML_DECL:S++,// <!BLARG
8461SGML_DECL_QUOTED:S++,// <!BLARG foo "bar
8462DOCTYPE:S++,// <!DOCTYPE
8463DOCTYPE_QUOTED:S++,// <!DOCTYPE "//blah
8464DOCTYPE_DTD:S++,// <!DOCTYPE "//blah" [ ...
8465DOCTYPE_DTD_QUOTED:S++,// <!DOCTYPE "//blah" [ "foo
8466COMMENT_STARTING:S++,// <!-
8467COMMENT:S++,// <!--
8468COMMENT_ENDING:S++,// <!-- blah -
8469COMMENT_ENDED:S++,// <!-- blah --
8470CDATA:S++,// <![CDATA[ something
8471CDATA_ENDING:S++,// ]
8472CDATA_ENDING_2:S++,// ]]
8473PROC_INST:S++,// <?hi
8474PROC_INST_BODY:S++,// <?hi there
8475PROC_INST_ENDING:S++,// <?hi "there" ?
8476OPEN_TAG:S++,// <strong
8477OPEN_TAG_SLASH:S++,// <strong /
8478ATTRIB:S++,// <a
8479ATTRIB_NAME:S++,// <a foo
8480ATTRIB_NAME_SAW_WHITE:S++,// <a foo _
8481ATTRIB_VALUE:S++,// <a foo=
8482ATTRIB_VALUE_QUOTED:S++,// <a foo="bar
8483ATTRIB_VALUE_CLOSED:S++,// <a foo="bar"
8484ATTRIB_VALUE_UNQUOTED:S++,// <a foo=bar
8485ATTRIB_VALUE_ENTITY_Q:S++,// <foo bar="&quot;"
8486ATTRIB_VALUE_ENTITY_U:S++,// <foo bar=&quot
8487CLOSE_TAG:S++,// </a
8488CLOSE_TAG_SAW_WHITE:S++,// </a >
8489SCRIPT:S++,// <script> ...
8490SCRIPT_ENDING:S++// <script> ... <
8491};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
8492S=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"
8493if(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">
8494if(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
8495if(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
8496// so any new bindings can take effect. preserve attribute order
8497// so deferred events can be emitted in document order
8498parser.attribList.push([parser.attribName,parser.attribValue]);}else{// in non-xmlns mode, we can emit the event right away
8499parser.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
8500var tag=parser.tag;// add namespace info to tag
8501var 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
8502// Note: do not apply default ns to attributes:
8503// http://www.w3.org/TR/REC-xml-names/#defaulting
8504for(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,
8505// then fail on them now.
8506if(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
8507parser.sawRoot=true;parser.tags.push(parser.tag);emitNode(parser,'onopentag',parser.tag);if(!selfClosing){// special case for <script> in non-strict mode.
8508if(!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.
8509// <a><b></c></b></a> will close everything, otherwise.
8510var 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
8511strictFail(parser,'Unexpected close tag');}else{break;}}// didn't find it. we already failed for strict, so just abort.
8512if(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
8513Object.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.
8514// weird, but happens.
8515strictFail(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==="\uFEFF"){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
8516if(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.
8517if(c==='!'){parser.state=S.SGML_DECL;parser.sgmlDecl='';}else if(is(whitespace,c)){// wait for it...
8518}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.
8519if(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.
8520}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,
8521// which is a comment of " blah -- bloo "
8522parser.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.
8523if(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
8524if(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`
8525codePoint<0||// not a valid Unicode code point
8526codePoint>0x10FFFF||// not a valid Unicode code point
8527floor(codePoint)!==codePoint// not an integer
8528){throw RangeError('Invalid code point: '+codePoint);}if(codePoint<=0xFFFF){// BMP code point
8529codeUnits.push(codePoint);}else{// Astral code point; split in surrogate halves
8530// http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
8531codePoint-=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":17,"stream":48,"string_decoder":53}],48:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
8532//
8533// Permission is hereby granted, free of charge, to any person obtaining a
8534// copy of this software and associated documentation files (the
8535// "Software"), to deal in the Software without restriction, including
8536// without limitation the rights to use, copy, modify, merge, publish,
8537// distribute, sublicense, and/or sell copies of the Software, and to permit
8538// persons to whom the Software is furnished to do so, subject to the
8539// following conditions:
8540//
8541// The above copyright notice and this permission notice shall be included
8542// in all copies or substantial portions of the Software.
8543//
8544// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8545// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
8546// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
8547// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
8548// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
8549// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
8550// USE OR OTHER DEALINGS IN THE SOFTWARE.
8551module.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
8552Stream.Stream=Stream;// old-style streams. Note that the pipe method (the only relevant
8553// part of this class) is overridden in the Readable class.
8554function 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
8555// source gets the 'end' or 'close' events. Only dest.end() once.
8556if(!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.
8557function onerror(er){cleanup();if(EE.listenerCount(this,'error')===0){throw er;// Unhandled stream error in pipe.
8558}}source.on('error',onerror);dest.on('error',onerror);// remove all the event listeners that were added.
8559function 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)
8560return dest;};},{"events":21,"inherits":24,"readable-stream/duplex.js":36,"readable-stream/passthrough.js":43,"readable-stream/readable.js":44,"readable-stream/transform.js":45,"readable-stream/writable.js":46}],49:[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
8561// will result in a (valid) protocol-relative url. However, this won't work if
8562// the protocol is something else, like 'file:'
8563var 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
8564if(host&&host.indexOf(':')!==-1)host='['+host+']';// This may be a relative url. The browser should always be able to interpret it correctly.
8565opts.url=(host?protocol+'//'+host:'')+(port?':'+port:'')+path;opts.method=(opts.method||'GET').toUpperCase();opts.headers=opts.headers||{};// Also valid opts.auth, opts.mode
8566var 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":51,"builtin-status-codes":18,"url":56,"xtend":63}],50:[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
8567// from a Blob, then use example.com to avoid an error
8568xhr.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'.
8569// Safari 7.1 appears to have fixed this bug.
8570var 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
8571// be used if it's available, just return false for these to avoid the warnings.
8572exports.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
8573}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],51:[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,useFetch){if(capability.fetch&&useFetch){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;var useFetch=true;if(opts.mode==='disable-fetch'){// If the use of XHR should be preferred and includes preserving the 'content-type' header
8574useFetch=false;preferBinary=true;}else if(opts.mode==='prefer-streaming'){// If streaming is a high priority but binary compatibility and
8575// the accuracy of the 'content-type' header aren't
8576preferBinary=false;}else if(opts.mode==='allow-wrong-content-type'){// If streaming is more important than preserving the 'content-type' header
8577preferBinary=!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
8578preferBinary=true;}else{throw new Error('Invalid value for opts.mode');}self._mode=decideMode(preferBinary,useFetch);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
8579// headers. To be honest I'm not entirely sure hiding these warnings is a good thing, but
8580// http-browserify did it, so I will too.
8581if(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
8582body=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
8583if('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
8584// in onprogress, not in onreadystatechange with xhr.readyState = 3
8585if(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;}}};/**
8586 * Checks if xhr.status is readable and non-zero, indicating no error.
8587 * Even though the spec says it should be available in readyState 3,
8588 * accessing it throws an exception in IE8
8589 */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.
8590// If you like bikeshedding, see https://github.com/whatwg/fetch/issues/27
8591};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
8592var 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":50,"./response":52,"_process":31,"buffer":17,"inherits":24,"readable-stream":44,"to-arraybuffer":55}],52:[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
8593self.on('end',function(){// The nextTick is necessary to prevent the 'request' module from causing an infinite loop
8594process.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>):
8595// for (var <item>,_i,_it = <iterable>[Symbol.iterator](); <item> = (_i = _it.next()).value,!_i.done;)
8596for(_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
8597reader=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
8598}}};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
8599if(xhr.readyState!==rStates.DONE)break;try{// This fails in IE8
8600response=new global.VBArray(xhr.responseBody).toArray();}catch(e){}if(response!==null){self.push(new Buffer(response));break;}// Falls through in IE8
8601case'text':try{// This will fail when readyState = 3 in IE9. Switch mode and wait for readyState = 4
8602response=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||!xhr.response)break;response=xhr.response;self.push(new Buffer(new Uint8Array(response)));break;case'moz-chunked-arraybuffer':// take whole
8603response=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
8604reader.readAsArrayBuffer(response);break;}// The ms-stream case handles end separately in reader.onload()
8605if(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":50,"_process":31,"buffer":17,"inherits":24,"readable-stream":44}],53:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
8606//
8607// Permission is hereby granted, free of charge, to any person obtaining a
8608// copy of this software and associated documentation files (the
8609// "Software"), to deal in the Software without restriction, including
8610// without limitation the rights to use, copy, modify, merge, publish,
8611// distribute, sublicense, and/or sell copies of the Software, and to permit
8612// persons to whom the Software is furnished to do so, subject to the
8613// following conditions:
8614//
8615// The above copyright notice and this permission notice shall be included
8616// in all copies or substantial portions of the Software.
8617//
8618// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8619// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
8620// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
8621// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
8622// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
8623// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
8624// USE OR OTHER DEALINGS IN THE SOFTWARE.
8625var 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
8626// buffers into a series of JS strings without breaking apart multi-byte
8627// characters. CESU-8 is handled as part of the UTF-8 encoding.
8628//
8629// @TODO Handling all encodings inside a single object makes it very difficult
8630// to reason about this code, so it should be split up in the future.
8631// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code
8632// points as used by CESU-8.
8633var 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
8634this.surrogateSize=3;break;case'ucs2':case'utf16le':// UTF-16 represents each of Surrogate Pair by 2-bytes
8635this.surrogateSize=2;this.detectIncompleteChar=utf16DetectIncompleteChar;break;case'base64':// Base-64 stores 3 bytes in 4 chars, and pads the remainder.
8636this.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
8637// bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).
8638this.charBuffer=new Buffer(6);// Number of bytes received for the current incomplete multi-byte character.
8639this.charReceived=0;// Number of bytes expected for the current incomplete multi-byte character.
8640this.charLength=0;};// write decodes the given buffer and returns it as JS string that is
8641// guaranteed to not contain any partial multi-byte characters. Any partial
8642// character found at the end of the buffer is buffered up, and will be
8643// returned when calling write again with the remaining bytes.
8644//
8645// Note: Converting a Buffer containing an orphan surrogate to a String
8646// currently works, but converting a String to a Buffer (via `new Buffer`, or
8647// Buffer#write) will replace incomplete surrogates with the unicode
8648// replacement character. See https://codereview.chromium.org/121173009/ .
8649StringDecoder.prototype.write=function(buffer){var charStr='';// if our last write ended with an incomplete multibyte character
8650while(this.charLength){// determine how many remaining bytes this buffer has to offer for this char
8651var available=buffer.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:buffer.length;// add the new bytes to the char buffer
8652buffer.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 ...
8653return'';}// remove bytes belonging to the current character from the buffer
8654buffer=buffer.slice(available,buffer.length);// get the character that was split
8655charStr=this.charBuffer.slice(0,this.charLength).toString(this.encoding);// CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
8656var 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
8657if(buffer.length===0){return charStr;}break;}// determine and set charLength / charReceived
8658this.detectIncompleteChar(buffer);var end=buffer.length;if(this.charLength){// buffer the incomplete character bytes we got
8659buffer.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
8660if(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
8661return charStr;};// detectIncompleteChar determines if there is an incomplete UTF-8 character at
8662// the end of the given buffer. If so, it sets this.charLength to the byte
8663// length that character, and sets this.charReceived to the number of bytes
8664// that are available for this character.
8665StringDecoder.prototype.detectIncompleteChar=function(buffer){// determine how many bytes we have to check at the end of this buffer
8666var i=buffer.length>=3?3:buffer.length;// Figure out if one of the last i bytes of our buffer announces an
8667// incomplete char.
8668for(;i>0;i--){var c=buffer[buffer.length-i];// See http://en.wikipedia.org/wiki/UTF-8#Description
8669// 110XXXXX
8670if(i==1&&c>>5==0x06){this.charLength=2;break;}// 1110XXXX
8671if(i<=2&&c>>4==0x0E){this.charLength=3;break;}// 11110XXX
8672if(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":17}],54:[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);},{}],55:[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
8673if(buf instanceof Uint8Array){// If the buffer isn't a subarray, return the underlying ArrayBuffer
8674if(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
8675return buf.buffer.slice(buf.byteOffset,buf.byteOffset+buf.byteLength);}}if(Buffer.isBuffer(buf)){// This is the slow version that will work with any Buffer
8676// implementation (even in old browsers)
8677var 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":17}],56:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
8678//
8679// Permission is hereby granted, free of charge, to any person obtaining a
8680// copy of this software and associated documentation files (the
8681// "Software"), to deal in the Software without restriction, including
8682// without limitation the rights to use, copy, modify, merge, publish,
8683// distribute, sublicense, and/or sell copies of the Software, and to permit
8684// persons to whom the Software is furnished to do so, subject to the
8685// following conditions:
8686//
8687// The above copyright notice and this permission notice shall be included
8688// in all copies or substantial portions of the Software.
8689//
8690// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8691// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
8692// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
8693// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
8694// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
8695// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
8696// USE OR OTHER DEALINGS IN THE SOFTWARE.
8697'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
8698// define these here so at least they only have to be
8699// compiled once on the first module load.
8700var protocolPattern=/^([a-z0-9.+-]+:)/i,portPattern=/:[0-9]*$/,// Special case for a simple path URL
8701simplePathPattern=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,// RFC 2396: characters reserved for delimiting URLs.
8702// We actually just auto-escape these.
8703delims=['<','>','"','`',' ','\r','\n','\t'],// RFC 2396: characters not allowed for various reasons.
8704unwise=['{','}','|','\\','^','`'].concat(delims),// Allowed by RFCs, but cause of XSS attacks. Always escape these.
8705autoEscape=['\''].concat(unwise),// Characters that are never ever allowed in a hostname.
8706// Note that any invalid chars are also handled, but these
8707// are the ones that are *expected* to be seen, so we fast-path
8708// them.
8709nonHostChars=['%','/','?',';','#'].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.
8710unsafeProtocol={'javascript':true,'javascript:':true},// protocols that never have a hostname.
8711hostlessProtocol={'javascript':true,'javascript:':true},// protocols that always contain a // bit.
8712slashedProtocol={'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.
8713// Back slashes before the query string get converted to forward slashes
8714// See: https://code.google.com/p/chromium/issues/detail?id=25916
8715var 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.
8716// This is to support parse stuff like " http://foo.com \n"
8717rest=rest.trim();if(!slashesDenoteHost&&url.split('#').length===1){// Try fast path regexp
8718var 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
8719// user@server is *always* interpreted as a hostname, and url
8720// resolution will treat //foo/bar as host=foo,path=bar because that's
8721// how the browser resolves relative URLs.
8722if(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.
8723// the first instance of /, ?, ;, or # ends the host.
8724//
8725// If there is an @ in the hostname, then non-host chars *are* allowed
8726// to the left of the last @ sign, unless some host-ending character
8727// comes *before* the @-sign.
8728// URLs are obnoxious.
8729//
8730// ex:
8731// http://a@b@c/ => user:a@b host:c
8732// http://a@b?@c => user:a host:c path:/?@c
8733// v0.12 TODO(isaacs): This is not quite how Chrome does things.
8734// Review our test case against browsers more comprehensively.
8735// find the first instance of any hostEndingChars
8736var 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
8737// auth portion cannot go past, or the last @ char is the decider.
8738var auth,atSign;if(hostEnd===-1){// atSign can be anywhere.
8739atSign=rest.lastIndexOf('@');}else{// atSign must be in auth portion.
8740// http://a@b/c@d => host:b auth:a path:/c@d
8741atSign=rest.lastIndexOf('@',hostEnd);}// Now we have a portion which is definitely the auth.
8742// Pull that off.
8743if(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
8744hostEnd=-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.
8745if(hostEnd===-1)hostEnd=rest.length;this.host=rest.slice(0,hostEnd);rest=rest.slice(hostEnd);// pull out port.
8746this.parseHost();// we've indicated that there is a hostname,
8747// so even if it's empty, it has to be present.
8748this.hostname=this.hostname||'';// if hostname begins with [ and ends with ]
8749// assume that it's an IPv6 address.
8750var ipv6Hostname=this.hostname[0]==='['&&this.hostname[this.hostname.length-1]===']';// validate a little.
8751if(!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
8752// we need this to make sure size of hostname is not
8753// broken by replacing non-ASCII by nothing
8754newpart+='x';}else{newpart+=part[j];}}// we test again with ASCII char only
8755if(!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.
8756this.hostname=this.hostname.toLowerCase();}if(!ipv6Hostname){// IDNA Support: Returns a punycoded representation of "domain".
8757// It only converts parts of the domain name that
8758// have non-ASCII characters, i.e. it doesn't matter if
8759// you call it with a domain that already is ASCII-only.
8760this.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
8761// the host field still retains them, though
8762if(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.
8763// chop off any delim chars.
8764if(!unsafeProtocol[lowerProto]){// First, make 100% sure that any "autoEscape" chars get
8765// escaped, even if encodeURIComponent doesn't think they
8766// need to be.
8767for(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.
8768var hash=rest.indexOf('#');if(hash!==-1){// got a fragment string.
8769this.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
8770this.search='';this.query={};}if(rest)this.pathname=rest;if(slashedProtocol[lowerProto]&&this.hostname&&!this.pathname){this.pathname='/';}//to support http.request
8771if(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.
8772this.href=this.format();return this;};// format a parsed object into a url string
8773function urlFormat(obj){// ensure it's an object, and not a string url.
8774// If it's an obj, this is a no-op.
8775// this way, you can call url_format() on strings
8776// to clean up potentially wonky urls.
8777if(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.
8778// unless they had them to begin with.
8779if(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.
8780// even href="" will remove it.
8781result.hash=relative.hash;// if the relative url is empty, then there's nothing left to do here.
8782if(relative.href===''){result.href=result.format();return result;}// hrefs like //foo/bar always cut to the protocol.
8783if(relative.slashes&&!relative.protocol){// take everything except the protocol from relative
8784var 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
8785if(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
8786// the protocol does weird things
8787// first, if it's not file:, then we MUST have a host,
8788// and if there was a path
8789// to begin with, then we MUST have a path.
8790// if it is file:, then the host is dropped,
8791// because that's known to be hostless.
8792// anything else is assumed to be absolute.
8793if(!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
8794if(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
8795// links like ../.. should be able
8796// to crawl up to the hostname, as well. This is strange.
8797// result.protocol has already been set by now.
8798// Later on, put the first path part into the host field.
8799if(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.
8800result.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.
8801}else if(relPath.length){// it's relative
8802// throw away the existing file, and take the new path instead.
8803if(!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.
8804// like href='?foo'.
8805// Put this after the other two cases because it simplifies the booleans
8806if(psychotic){result.hostname=result.host=srcPath.shift();//occationaly the auth can get stuck only in host
8807//this especially happens in cases like
8808//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
8809var 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
8810if(!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.
8811// we've already handled the other stuff above.
8812result.pathname=null;//to support http.request
8813if(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.
8814// however, if it ends in anything else non-slashy,
8815// then it must NOT get a trailing slash.
8816var 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
8817// if the path tries to go above the root, `up` ends up > 0
8818var 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
8819if(!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
8820if(psychotic){result.hostname=result.host=isAbsolute?'':srcPath.length?srcPath.shift():'';//occationaly the auth can get stuck only in host
8821//this especially happens in cases like
8822//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
8823var 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
8824if(!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":57,"punycode":32,"querystring":35}],57:[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;}};},{}],58:[function(require,module,exports){(function(global){/**
8825 * Module exports.
8826 */module.exports=deprecate;/**
8827 * Mark that a method should not be used.
8828 * Returns a modified function which warns once by default.
8829 *
8830 * If `localStorage.noDeprecation = true` is set, then it is a no-op.
8831 *
8832 * If `localStorage.throwDeprecation = true` is set, then deprecated functions
8833 * will throw an Error when invoked.
8834 *
8835 * If `localStorage.traceDeprecation = true` is set, then deprecated functions
8836 * will invoke `console.trace()` instead of `console.error()`.
8837 *
8838 * @param {Function} fn - the function to deprecate
8839 * @param {String} msg - the string to print to the console when `fn` is invoked
8840 * @returns {Function} a new "deprecated" version of `fn`
8841 * @api public
8842 */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;}/**
8843 * Checks `localStorage` for boolean values for the given `name`.
8844 *
8845 * @param {String} name
8846 * @returns {Boolean}
8847 * @api private
8848 */function config(name){// accessing global.localStorage can trigger a DOMException in sandboxed iframes
8849try{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:{});},{}],59:[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';};},{}],60:[function(require,module,exports){(function(process,global){// Copyright Joyent, Inc. and other Node contributors.
8850//
8851// Permission is hereby granted, free of charge, to any person obtaining a
8852// copy of this software and associated documentation files (the
8853// "Software"), to deal in the Software without restriction, including
8854// without limitation the rights to use, copy, modify, merge, publish,
8855// distribute, sublicense, and/or sell copies of the Software, and to permit
8856// persons to whom the Software is furnished to do so, subject to the
8857// following conditions:
8858//
8859// The above copyright notice and this permission notice shall be included
8860// in all copies or substantial portions of the Software.
8861//
8862// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8863// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
8864// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
8865// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
8866// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
8867// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
8868// USE OR OTHER DEALINGS IN THE SOFTWARE.
8869var 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.
8870// Returns a modified function which warns once by default.
8871// If --no-deprecation is set, then it is a no-op.
8872exports.deprecate=function(fn,msg){// Allow for deprecating things in the process of starting up.
8873if(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];};/**
8874 * Echos the value of a value. Trys to print the value out
8875 * in the best way possible given the different types.
8876 *
8877 * @param {Object} obj The object to print out.
8878 * @param {Object} opts Optional options object that alters the output.
8879 *//* legacy: obj, showHidden, depth, colors*/function inspect(obj,opts){// default options
8880var ctx={seen:[],stylize:stylizeNoColor};// legacy...
8881if(arguments.length>=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean(opts)){// legacy...
8882ctx.showHidden=opts;}else if(opts){// got an "options" object
8883exports._extend(ctx,opts);}// set default options
8884if(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
8885inspect.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
8886inspect.styles={'special':'cyan','number':'yellow','boolean':'yellow','undefined':'grey','null':'bold','string':'green','date':'magenta',// "name": intentionally not styling
8887'regexp':'red'};function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style){return"\x1B["+inspect.colors[style][0]+'m'+str+"\x1B["+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.
8888// Check that value is an object with an inspect function on it
8889if(ctx.customInspect&&value&&isFunction(value.inspect)&&// Filter out the util module, it's inspect function is special
8890value.inspect!==exports.inspect&&// Also filter out any prototype objects using the circular check.
8891!(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
8892var primitive=formatPrimitive(ctx,value);if(primitive){return primitive;}// Look up the keys of the object.
8893var keys=Object.keys(value);var visibleKeys=arrayToHash(keys);if(ctx.showHidden){keys=Object.getOwnPropertyNames(value);}// IE doesn't make error fields non-enumerable
8894// http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
8895if(isError(value)&&(keys.indexOf('message')>=0||keys.indexOf('description')>=0)){return formatError(value);}// Some type of object without properties can be shortcutted.
8896if(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
8897if(isArray(value)){array=true;braces=['[',']'];}// Make functions say that they are functions
8898if(isFunction(value)){var n=value.name?': '+value.name:'';base=' [Function'+n+']';}// Make RegExps say that they are RegExps
8899if(isRegExp(value)){base=' '+RegExp.prototype.toString.call(value);}// Make dates with properties first say the date
8900if(isDate(value)){base=' '+Date.prototype.toUTCString.call(value);}// Make error with message first say the error
8901if(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.
8902if(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`
8903// because it is fragile and can be easily faked with `Object.create()`.
8904function 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
8905typeof 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
8906function 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
8907exports.log=function(){console.log('%s - %s',timestamp(),exports.format.apply(exports,arguments));};/**
8908 * Inherit the prototype methods from one constructor into another.
8909 *
8910 * The Function.prototype.inherits from lang.js rewritten as a standalone
8911 * function (not on Function.prototype). NOTE: If this file is to be loaded
8912 * during bootstrapping this function needs to be rewritten using some native
8913 * functions as prototype setup using normal JavaScript does not work as
8914 * expected during bootstrapping (see mirror.js in r114903).
8915 *
8916 * @param {function} ctor Constructor function which needs to inherit the
8917 * prototype.
8918 * @param {function} superCtor Constructor function to inherit prototype from.
8919 */exports.inherits=require('inherits');exports._extend=function(origin,add){// Don't do anything if add isn't an object
8920if(!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":59,"_process":31,"inherits":24}],61:[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:
8921wExecScript.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
8922// updating existing context properties or new properties in the `win`
8923// that was only introduced after the eval.
8924if(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...
8925};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":23}],62:[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'});};},{}],63:[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;}},{}]},{},[8])(8);});});
8926//# sourceMappingURL=scxml.js.map